import * as i0 from '@angular/core';
import { input, inject, ChangeDetectionStrategy, Component, booleanAttribute, Injectable } from '@angular/core';
import { ModalRef, SiModalService, createModalConfig } from '@siemens/element-ng/modal';
import { take, Observable, switchMap } from 'rxjs';
import { AsyncPipe } from '@angular/common';
import { elementCancel } from '@siemens/element-icons';
import { addIcons, SiIconComponent } from '@siemens/element-ng/icon';
import { SiLoadingButtonComponent } from '@siemens/element-ng/loading-spinner';
import { t, SiTranslatePipe } from '@siemens/element-translate-ng/translate';

/**
 * Copyright (c) Siemens 2016 - 2026
 * SPDX-License-Identifier: MIT
 */
class SiAlertDialogComponent {
    titleId = input(...(ngDevMode ? [undefined, { debugName: "titleId" }] : []));
    /** @defaultValue '' */
    heading = input('', ...(ngDevMode ? [{ debugName: "heading" }] : []));
    /** @defaultValue '' */
    message = input('', ...(ngDevMode ? [{ debugName: "message" }] : []));
    /**
     * @defaultValue
     * ```
     * t(() => $localize`:@@SI_ALERT_DIALOG.OK:OK`)
     * ```
     */
    confirmBtnName = input(t(() => $localize `:@@SI_ALERT_DIALOG.OK:OK`), ...(ngDevMode ? [{ debugName: "confirmBtnName" }] : []));
    /**
     * @defaultValue
     * ```
     * {}
     * ```
     */
    translationParams = input({}, ...(ngDevMode ? [{ debugName: "translationParams" }] : []));
    /** @defaultValue '' */
    icon = input('', ...(ngDevMode ? [{ debugName: "icon" }] : []));
    modalRef = inject((ModalRef));
    loading$ = this.modalRef.message.pipe(take(1));
    icons = addIcons({ elementCancel });
    static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.8", ngImport: i0, type: SiAlertDialogComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
    static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.8", type: SiAlertDialogComponent, isStandalone: true, selector: "si-alert-dialog", inputs: { titleId: { classPropertyName: "titleId", publicName: "titleId", isSignal: true, isRequired: false, transformFunction: null }, heading: { classPropertyName: "heading", publicName: "heading", isSignal: true, isRequired: false, transformFunction: null }, message: { classPropertyName: "message", publicName: "message", isSignal: true, isRequired: false, transformFunction: null }, confirmBtnName: { classPropertyName: "confirmBtnName", publicName: "confirmBtnName", isSignal: true, isRequired: false, transformFunction: null }, translationParams: { classPropertyName: "translationParams", publicName: "translationParams", isSignal: true, isRequired: false, transformFunction: null }, icon: { classPropertyName: "icon", publicName: "icon", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "@let loading = loading$ | async;\n<div class=\"modal-header\">\n  @if (icon()) {\n    <si-icon class=\"icon\" [icon]=\"icon()\" />\n  }\n  <span class=\"modal-title\" [id]=\"titleId()\">{{ heading() | translate: translationParams() }}</span>\n  <button\n    type=\"button\"\n    class=\"btn btn-circle btn-ghost\"\n    [attr.aria-label]=\"confirmBtnName() | translate\"\n    [disabled]=\"!!loading\"\n    (click)=\"modalRef.messageOrHide('confirm')\"\n  >\n    <si-icon [icon]=\"icons.elementCancel\" />\n  </button>\n</div>\n<div class=\"modal-body text-pre-wrap text-break\">{{\n  message() | translate: translationParams()\n}}</div>\n<div class=\"modal-footer\">\n  <si-loading-button\n    buttonClass=\"btn btn-primary\"\n    [disabled]=\"!!loading && loading !== 'confirm'\"\n    [loading]=\"loading === 'confirm'\"\n    (click)=\"modalRef.messageOrHide('confirm')\"\n  >\n    {{ confirmBtnName() | translate }}\n  </si-loading-button>\n</div>\n", dependencies: [{ kind: "component", type: SiIconComponent, selector: "si-icon", inputs: ["icon"] }, { kind: "component", type: SiLoadingButtonComponent, selector: "si-loading-button", inputs: ["disabled", "loading", "type", "ariaLabel", "ariaLabelledBy", "buttonClass"] }, { kind: "pipe", type: AsyncPipe, name: "async" }, { kind: "pipe", type: SiTranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.8", ngImport: i0, type: SiAlertDialogComponent, decorators: [{
            type: Component,
            args: [{ selector: 'si-alert-dialog', imports: [AsyncPipe, SiIconComponent, SiTranslatePipe, SiLoadingButtonComponent], changeDetection: ChangeDetectionStrategy.OnPush, template: "@let loading = loading$ | async;\n<div class=\"modal-header\">\n  @if (icon()) {\n    <si-icon class=\"icon\" [icon]=\"icon()\" />\n  }\n  <span class=\"modal-title\" [id]=\"titleId()\">{{ heading() | translate: translationParams() }}</span>\n  <button\n    type=\"button\"\n    class=\"btn btn-circle btn-ghost\"\n    [attr.aria-label]=\"confirmBtnName() | translate\"\n    [disabled]=\"!!loading\"\n    (click)=\"modalRef.messageOrHide('confirm')\"\n  >\n    <si-icon [icon]=\"icons.elementCancel\" />\n  </button>\n</div>\n<div class=\"modal-body text-pre-wrap text-break\">{{\n  message() | translate: translationParams()\n}}</div>\n<div class=\"modal-footer\">\n  <si-loading-button\n    buttonClass=\"btn btn-primary\"\n    [disabled]=\"!!loading && loading !== 'confirm'\"\n    [loading]=\"loading === 'confirm'\"\n    (click)=\"modalRef.messageOrHide('confirm')\"\n  >\n    {{ confirmBtnName() | translate }}\n  </si-loading-button>\n</div>\n" }]
        }], propDecorators: { titleId: [{ type: i0.Input, args: [{ isSignal: true, alias: "titleId", required: false }] }], heading: [{ type: i0.Input, args: [{ isSignal: true, alias: "heading", required: false }] }], message: [{ type: i0.Input, args: [{ isSignal: true, alias: "message", required: false }] }], confirmBtnName: [{ type: i0.Input, args: [{ isSignal: true, alias: "confirmBtnName", required: false }] }], translationParams: [{ type: i0.Input, args: [{ isSignal: true, alias: "translationParams", required: false }] }], icon: [{ type: i0.Input, args: [{ isSignal: true, alias: "icon", required: false }] }] } });

/**
 * Copyright (c) Siemens 2016 - 2026
 * SPDX-License-Identifier: MIT
 */
class SiConfirmationDialogComponent {
    titleId = input(...(ngDevMode ? [undefined, { debugName: "titleId" }] : []));
    /** @defaultValue '' */
    heading = input('', ...(ngDevMode ? [{ debugName: "heading" }] : []));
    /** @defaultValue '' */
    message = input('', ...(ngDevMode ? [{ debugName: "message" }] : []));
    /**
     * @defaultValue
     * ```
     * t(() => $localize`:@@SI_CONFIRMATION_DIALOG.YES:Yes`)
     * ```
     */
    confirmBtnName = input(t(() => $localize `:@@SI_CONFIRMATION_DIALOG.YES:Yes`), ...(ngDevMode ? [{ debugName: "confirmBtnName" }] : []));
    /**
     * @defaultValue
     * ```
     * t(() => $localize`:@@SI_CONFIRMATION_DIALOG.NO:No`)
     * ```
     */
    declineBtnName = input(t(() => $localize `:@@SI_CONFIRMATION_DIALOG.NO:No`), ...(ngDevMode ? [{ debugName: "declineBtnName" }] : []));
    /**
     * @defaultValue
     * ```
     * {}
     * ```
     */
    translationParams = input({}, ...(ngDevMode ? [{ debugName: "translationParams" }] : []));
    /** @defaultValue '' */
    icon = input('', ...(ngDevMode ? [{ debugName: "icon" }] : []));
    modalRef = inject((ModalRef));
    loading$ = this.modalRef.message.pipe(take(1));
    static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.8", ngImport: i0, type: SiConfirmationDialogComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
    static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.8", type: SiConfirmationDialogComponent, isStandalone: true, selector: "si-confirmation-dialog", inputs: { titleId: { classPropertyName: "titleId", publicName: "titleId", isSignal: true, isRequired: false, transformFunction: null }, heading: { classPropertyName: "heading", publicName: "heading", isSignal: true, isRequired: false, transformFunction: null }, message: { classPropertyName: "message", publicName: "message", isSignal: true, isRequired: false, transformFunction: null }, confirmBtnName: { classPropertyName: "confirmBtnName", publicName: "confirmBtnName", isSignal: true, isRequired: false, transformFunction: null }, declineBtnName: { classPropertyName: "declineBtnName", publicName: "declineBtnName", isSignal: true, isRequired: false, transformFunction: null }, translationParams: { classPropertyName: "translationParams", publicName: "translationParams", isSignal: true, isRequired: false, transformFunction: null }, icon: { classPropertyName: "icon", publicName: "icon", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "@let loading = loading$ | async;\n<div class=\"modal-header\">\n  @if (icon()) {\n    <si-icon class=\"icon\" [icon]=\"icon()\" />\n  }\n  <span class=\"modal-title\" [id]=\"titleId()\">{{ heading() | translate: translationParams() }}</span>\n  <button\n    type=\"button\"\n    class=\"btn btn-circle btn-ghost element-cancel\"\n    [attr.aria-label]=\"declineBtnName() | translate\"\n    [disabled]=\"!!loading\"\n    (click)=\"modalRef.messageOrHide('decline')\"\n  >\n  </button>\n</div>\n<div class=\"modal-body text-pre-wrap text-break\">{{\n  message() | translate: translationParams()\n}}</div>\n<div class=\"modal-footer\">\n  <si-loading-button\n    buttonClass=\"btn btn-secondary\"\n    [disabled]=\"!!loading && loading !== 'decline'\"\n    [loading]=\"loading === 'decline'\"\n    (click)=\"modalRef.messageOrHide('decline')\"\n  >\n    {{ declineBtnName() | translate }}\n  </si-loading-button>\n  <si-loading-button\n    buttonClass=\"btn btn-primary\"\n    [disabled]=\"!!loading && loading !== 'confirm'\"\n    [loading]=\"loading === 'confirm'\"\n    (click)=\"modalRef.messageOrHide('confirm')\"\n  >\n    {{ confirmBtnName() | translate }}\n  </si-loading-button>\n</div>\n", dependencies: [{ kind: "component", type: SiIconComponent, selector: "si-icon", inputs: ["icon"] }, { kind: "component", type: SiLoadingButtonComponent, selector: "si-loading-button", inputs: ["disabled", "loading", "type", "ariaLabel", "ariaLabelledBy", "buttonClass"] }, { kind: "pipe", type: AsyncPipe, name: "async" }, { kind: "pipe", type: SiTranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.8", ngImport: i0, type: SiConfirmationDialogComponent, decorators: [{
            type: Component,
            args: [{ selector: 'si-confirmation-dialog', imports: [AsyncPipe, SiIconComponent, SiTranslatePipe, SiLoadingButtonComponent], changeDetection: ChangeDetectionStrategy.OnPush, template: "@let loading = loading$ | async;\n<div class=\"modal-header\">\n  @if (icon()) {\n    <si-icon class=\"icon\" [icon]=\"icon()\" />\n  }\n  <span class=\"modal-title\" [id]=\"titleId()\">{{ heading() | translate: translationParams() }}</span>\n  <button\n    type=\"button\"\n    class=\"btn btn-circle btn-ghost element-cancel\"\n    [attr.aria-label]=\"declineBtnName() | translate\"\n    [disabled]=\"!!loading\"\n    (click)=\"modalRef.messageOrHide('decline')\"\n  >\n  </button>\n</div>\n<div class=\"modal-body text-pre-wrap text-break\">{{\n  message() | translate: translationParams()\n}}</div>\n<div class=\"modal-footer\">\n  <si-loading-button\n    buttonClass=\"btn btn-secondary\"\n    [disabled]=\"!!loading && loading !== 'decline'\"\n    [loading]=\"loading === 'decline'\"\n    (click)=\"modalRef.messageOrHide('decline')\"\n  >\n    {{ declineBtnName() | translate }}\n  </si-loading-button>\n  <si-loading-button\n    buttonClass=\"btn btn-primary\"\n    [disabled]=\"!!loading && loading !== 'confirm'\"\n    [loading]=\"loading === 'confirm'\"\n    (click)=\"modalRef.messageOrHide('confirm')\"\n  >\n    {{ confirmBtnName() | translate }}\n  </si-loading-button>\n</div>\n" }]
        }], propDecorators: { titleId: [{ type: i0.Input, args: [{ isSignal: true, alias: "titleId", required: false }] }], heading: [{ type: i0.Input, args: [{ isSignal: true, alias: "heading", required: false }] }], message: [{ type: i0.Input, args: [{ isSignal: true, alias: "message", required: false }] }], confirmBtnName: [{ type: i0.Input, args: [{ isSignal: true, alias: "confirmBtnName", required: false }] }], declineBtnName: [{ type: i0.Input, args: [{ isSignal: true, alias: "declineBtnName", required: false }] }], translationParams: [{ type: i0.Input, args: [{ isSignal: true, alias: "translationParams", required: false }] }], icon: [{ type: i0.Input, args: [{ isSignal: true, alias: "icon", required: false }] }] } });

/**
 * Copyright (c) Siemens 2016 - 2026
 * SPDX-License-Identifier: MIT
 */
class SiDeleteConfirmationDialogComponent {
    titleId = input(...(ngDevMode ? [undefined, { debugName: "titleId" }] : []));
    /** @defaultValue '' */
    heading = input('', ...(ngDevMode ? [{ debugName: "heading" }] : []));
    /**
     * @defaultValue
     * ```
     * t(() => $localize`:@@SI_DELETE_CONFIRMATION_DIALOG.MESSAGE:Do you really want to delete the selected elements?`)
     * ```
     */
    message = input(t(() => $localize `:@@SI_DELETE_CONFIRMATION_DIALOG.MESSAGE:Do you really want to delete the selected elements?`), ...(ngDevMode ? [{ debugName: "message" }] : []));
    /**
     * @defaultValue
     * ```
     * t(() => $localize`:@@SI_DELETE_CONFIRMATION_DIALOG.DELETE_BTN:Delete`)
     * ```
     */
    deleteBtnName = input(t(() => $localize `:@@SI_DELETE_CONFIRMATION_DIALOG.DELETE_BTN:Delete`), ...(ngDevMode ? [{ debugName: "deleteBtnName" }] : []));
    /**
     * @defaultValue
     * ```
     * t(() => $localize`:@@SI_DELETE_CONFIRMATION_DIALOG.CANCEL_BTN:Cancel`)
     * ```
     */
    cancelBtnName = input(t(() => $localize `:@@SI_DELETE_CONFIRMATION_DIALOG.CANCEL_BTN:Cancel`), ...(ngDevMode ? [{ debugName: "cancelBtnName" }] : []));
    /**
     * @defaultValue
     * ```
     * {}
     * ```
     */
    translationParams = input({}, ...(ngDevMode ? [{ debugName: "translationParams" }] : []));
    /** @defaultValue '' */
    icon = input('', ...(ngDevMode ? [{ debugName: "icon" }] : []));
    modalRef = inject((ModalRef));
    loading$ = this.modalRef.message.pipe(take(1));
    icons = addIcons({ elementCancel });
    static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.8", ngImport: i0, type: SiDeleteConfirmationDialogComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
    static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.8", type: SiDeleteConfirmationDialogComponent, isStandalone: true, selector: "si-delete-confirmation-dialog", inputs: { titleId: { classPropertyName: "titleId", publicName: "titleId", isSignal: true, isRequired: false, transformFunction: null }, heading: { classPropertyName: "heading", publicName: "heading", isSignal: true, isRequired: false, transformFunction: null }, message: { classPropertyName: "message", publicName: "message", isSignal: true, isRequired: false, transformFunction: null }, deleteBtnName: { classPropertyName: "deleteBtnName", publicName: "deleteBtnName", isSignal: true, isRequired: false, transformFunction: null }, cancelBtnName: { classPropertyName: "cancelBtnName", publicName: "cancelBtnName", isSignal: true, isRequired: false, transformFunction: null }, translationParams: { classPropertyName: "translationParams", publicName: "translationParams", isSignal: true, isRequired: false, transformFunction: null }, icon: { classPropertyName: "icon", publicName: "icon", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "@let loading = loading$ | async;\n<div class=\"modal-header\">\n  @if (icon()) {\n    <si-icon class=\"icon\" [icon]=\"icon()\" />\n  }\n  <span class=\"modal-title\" [id]=\"titleId()\">{{ heading() | translate: translationParams() }}</span>\n  <button\n    type=\"button\"\n    class=\"btn btn-circle btn-ghost\"\n    [attr.aria-label]=\"cancelBtnName() | translate\"\n    [disabled]=\"!!loading\"\n    (click)=\"modalRef.messageOrHide('cancel')\"\n  >\n    <si-icon [icon]=\"icons.elementCancel\" />\n  </button>\n</div>\n<div class=\"modal-body text-pre-wrap text-break\">{{\n  message() | translate: translationParams()\n}}</div>\n<div class=\"modal-footer\">\n  <si-loading-button\n    buttonClass=\"btn btn-secondary\"\n    [disabled]=\"!!loading && loading !== 'cancel'\"\n    [loading]=\"loading === 'cancel'\"\n    (click)=\"modalRef.messageOrHide('cancel')\"\n  >\n    {{ cancelBtnName() | translate }}\n  </si-loading-button>\n  <si-loading-button\n    buttonClass=\"btn btn-danger\"\n    [disabled]=\"!!loading && loading !== 'delete'\"\n    [loading]=\"loading === 'delete'\"\n    (click)=\"modalRef.messageOrHide('delete')\"\n  >\n    {{ deleteBtnName() | translate }}\n  </si-loading-button>\n</div>\n", dependencies: [{ kind: "component", type: SiIconComponent, selector: "si-icon", inputs: ["icon"] }, { kind: "component", type: SiLoadingButtonComponent, selector: "si-loading-button", inputs: ["disabled", "loading", "type", "ariaLabel", "ariaLabelledBy", "buttonClass"] }, { kind: "pipe", type: AsyncPipe, name: "async" }, { kind: "pipe", type: SiTranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.8", ngImport: i0, type: SiDeleteConfirmationDialogComponent, decorators: [{
            type: Component,
            args: [{ selector: 'si-delete-confirmation-dialog', imports: [AsyncPipe, SiIconComponent, SiTranslatePipe, SiLoadingButtonComponent], changeDetection: ChangeDetectionStrategy.OnPush, template: "@let loading = loading$ | async;\n<div class=\"modal-header\">\n  @if (icon()) {\n    <si-icon class=\"icon\" [icon]=\"icon()\" />\n  }\n  <span class=\"modal-title\" [id]=\"titleId()\">{{ heading() | translate: translationParams() }}</span>\n  <button\n    type=\"button\"\n    class=\"btn btn-circle btn-ghost\"\n    [attr.aria-label]=\"cancelBtnName() | translate\"\n    [disabled]=\"!!loading\"\n    (click)=\"modalRef.messageOrHide('cancel')\"\n  >\n    <si-icon [icon]=\"icons.elementCancel\" />\n  </button>\n</div>\n<div class=\"modal-body text-pre-wrap text-break\">{{\n  message() | translate: translationParams()\n}}</div>\n<div class=\"modal-footer\">\n  <si-loading-button\n    buttonClass=\"btn btn-secondary\"\n    [disabled]=\"!!loading && loading !== 'cancel'\"\n    [loading]=\"loading === 'cancel'\"\n    (click)=\"modalRef.messageOrHide('cancel')\"\n  >\n    {{ cancelBtnName() | translate }}\n  </si-loading-button>\n  <si-loading-button\n    buttonClass=\"btn btn-danger\"\n    [disabled]=\"!!loading && loading !== 'delete'\"\n    [loading]=\"loading === 'delete'\"\n    (click)=\"modalRef.messageOrHide('delete')\"\n  >\n    {{ deleteBtnName() | translate }}\n  </si-loading-button>\n</div>\n" }]
        }], propDecorators: { titleId: [{ type: i0.Input, args: [{ isSignal: true, alias: "titleId", required: false }] }], heading: [{ type: i0.Input, args: [{ isSignal: true, alias: "heading", required: false }] }], message: [{ type: i0.Input, args: [{ isSignal: true, alias: "message", required: false }] }], deleteBtnName: [{ type: i0.Input, args: [{ isSignal: true, alias: "deleteBtnName", required: false }] }], cancelBtnName: [{ type: i0.Input, args: [{ isSignal: true, alias: "cancelBtnName", required: false }] }], translationParams: [{ type: i0.Input, args: [{ isSignal: true, alias: "translationParams", required: false }] }], icon: [{ type: i0.Input, args: [{ isSignal: true, alias: "icon", required: false }] }] } });

/**
 * Copyright (c) Siemens 2016 - 2026
 * SPDX-License-Identifier: MIT
 */
class SiEditDiscardDialogComponent {
    titleId = input(...(ngDevMode ? [undefined, { debugName: "titleId" }] : []));
    /** @defaultValue '' */
    heading = input('', ...(ngDevMode ? [{ debugName: "heading" }] : []));
    /**
     * @defaultValue
     * ```
     * t(() => $localize`:@@SI_EDIT_DISCARD_DIALOG.MESSAGE:Do you want to save changes to the modified element?`)
     * ```
     */
    message = input(t(() => $localize `:@@SI_EDIT_DISCARD_DIALOG.MESSAGE:Do you want to save changes to the modified element?`), ...(ngDevMode ? [{ debugName: "message" }] : []));
    /**
     * @defaultValue
     * ```
     * t(() => $localize`:@@SI_EDIT_DISCARD_DIALOG.SAVE_BTN:Save`)
     * ```
     */
    saveBtnName = input(t(() => $localize `:@@SI_EDIT_DISCARD_DIALOG.SAVE_BTN:Save`), ...(ngDevMode ? [{ debugName: "saveBtnName" }] : []));
    /**
     * @defaultValue
     * ```
     * t(() => $localize`:@@SI_EDIT_DISCARD_DIALOG.DISCARD_BTN:Discard`)
     * ```
     */
    discardBtnName = input(t(() => $localize `:@@SI_EDIT_DISCARD_DIALOG.DISCARD_BTN:Discard`), ...(ngDevMode ? [{ debugName: "discardBtnName" }] : []));
    /**
     * @defaultValue
     * ```
     * t(() => $localize`:@@SI_EDIT_DISCARD_DIALOG.CANCEL_BTN:Cancel`)
     * ```
     */
    cancelBtnName = input(t(() => $localize `:@@SI_EDIT_DISCARD_DIALOG.CANCEL_BTN:Cancel`), ...(ngDevMode ? [{ debugName: "cancelBtnName" }] : []));
    /** @defaultValue false */
    disableSave = input(false, { ...(ngDevMode ? { debugName: "disableSave" } : {}), transform: booleanAttribute });
    /**
     * @defaultValue
     * ```
     * t(() => $localize`:@@SI_EDIT_DISCARD_DIALOG.DISABLE_SAVE_MESSAGE:Do you want to discard the changes`)
     * ```
     */
    disableSaveMessage = input(t(() => $localize `:@@SI_EDIT_DISCARD_DIALOG.DISABLE_SAVE_MESSAGE:Do you want to discard the changes`), ...(ngDevMode ? [{ debugName: "disableSaveMessage" }] : []));
    /**
     * @defaultValue
     * ```
     * t(() => $localize`:@@SI_EDIT_DISCARD_DIALOG.DISABLE_SAVE_DISCARD_BTN:Discard`)
     * ```
     */
    disableSaveDiscardBtnName = input(t(() => $localize `:@@SI_EDIT_DISCARD_DIALOG.DISABLE_SAVE_DISCARD_BTN:Discard`), ...(ngDevMode ? [{ debugName: "disableSaveDiscardBtnName" }] : []));
    /**
     * @defaultValue
     * ```
     * {}
     * ```
     */
    translationParams = input({}, ...(ngDevMode ? [{ debugName: "translationParams" }] : []));
    /** @defaultValue '' */
    icon = input('', ...(ngDevMode ? [{ debugName: "icon" }] : []));
    modalRef = inject((ModalRef));
    loading$ = this.modalRef.message.pipe(take(1));
    icons = addIcons({ elementCancel });
    static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.8", ngImport: i0, type: SiEditDiscardDialogComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
    static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.8", type: SiEditDiscardDialogComponent, isStandalone: true, selector: "si-edit-discard-dialog", inputs: { titleId: { classPropertyName: "titleId", publicName: "titleId", isSignal: true, isRequired: false, transformFunction: null }, heading: { classPropertyName: "heading", publicName: "heading", isSignal: true, isRequired: false, transformFunction: null }, message: { classPropertyName: "message", publicName: "message", isSignal: true, isRequired: false, transformFunction: null }, saveBtnName: { classPropertyName: "saveBtnName", publicName: "saveBtnName", isSignal: true, isRequired: false, transformFunction: null }, discardBtnName: { classPropertyName: "discardBtnName", publicName: "discardBtnName", isSignal: true, isRequired: false, transformFunction: null }, cancelBtnName: { classPropertyName: "cancelBtnName", publicName: "cancelBtnName", isSignal: true, isRequired: false, transformFunction: null }, disableSave: { classPropertyName: "disableSave", publicName: "disableSave", isSignal: true, isRequired: false, transformFunction: null }, disableSaveMessage: { classPropertyName: "disableSaveMessage", publicName: "disableSaveMessage", isSignal: true, isRequired: false, transformFunction: null }, disableSaveDiscardBtnName: { classPropertyName: "disableSaveDiscardBtnName", publicName: "disableSaveDiscardBtnName", isSignal: true, isRequired: false, transformFunction: null }, translationParams: { classPropertyName: "translationParams", publicName: "translationParams", isSignal: true, isRequired: false, transformFunction: null }, icon: { classPropertyName: "icon", publicName: "icon", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "@let loading = loading$ | async;\n<div class=\"modal-header\">\n  @if (icon()) {\n    <si-icon class=\"icon\" [icon]=\"icon()\" />\n  }\n  <span class=\"modal-title\" [id]=\"titleId()\">{{ heading() | translate: translationParams() }}</span>\n  <button\n    type=\"button\"\n    class=\"btn btn-circle btn-ghost\"\n    [attr.aria-label]=\"cancelBtnName() | translate\"\n    [disabled]=\"!!loading\"\n    (click)=\"modalRef.messageOrHide('cancel')\"\n  >\n    <si-icon [icon]=\"icons.elementCancel\" />\n  </button>\n</div>\n<div class=\"modal-body text-pre-wrap text-break\">{{\n  (!disableSave() ? message() : disableSaveMessage()) | translate: translationParams()\n}}</div>\n<div class=\"modal-footer\">\n  <si-loading-button\n    buttonClass=\"btn btn-secondary\"\n    [disabled]=\"!!loading && loading !== 'cancel'\"\n    [loading]=\"loading === 'cancel'\"\n    (click)=\"modalRef.messageOrHide('cancel')\"\n  >\n    {{ cancelBtnName() | translate }}\n  </si-loading-button>\n  <si-loading-button\n    buttonClass=\"btn btn-danger\"\n    [disabled]=\"!!loading && loading !== 'discard'\"\n    [loading]=\"loading === 'discard'\"\n    (click)=\"modalRef.messageOrHide('discard')\"\n  >\n    {{ (!disableSave() ? discardBtnName() : disableSaveDiscardBtnName()) | translate }}\n  </si-loading-button>\n  @if (!disableSave()) {\n    <si-loading-button\n      buttonClass=\"btn btn-primary\"\n      [disabled]=\"!!loading && loading !== 'save'\"\n      [loading]=\"loading === 'save'\"\n      (click)=\"modalRef.messageOrHide('save')\"\n    >\n      {{ saveBtnName() | translate }}\n    </si-loading-button>\n  }\n</div>\n", dependencies: [{ kind: "component", type: SiIconComponent, selector: "si-icon", inputs: ["icon"] }, { kind: "component", type: SiLoadingButtonComponent, selector: "si-loading-button", inputs: ["disabled", "loading", "type", "ariaLabel", "ariaLabelledBy", "buttonClass"] }, { kind: "pipe", type: AsyncPipe, name: "async" }, { kind: "pipe", type: SiTranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.8", ngImport: i0, type: SiEditDiscardDialogComponent, decorators: [{
            type: Component,
            args: [{ selector: 'si-edit-discard-dialog', imports: [AsyncPipe, SiIconComponent, SiTranslatePipe, SiLoadingButtonComponent], changeDetection: ChangeDetectionStrategy.OnPush, template: "@let loading = loading$ | async;\n<div class=\"modal-header\">\n  @if (icon()) {\n    <si-icon class=\"icon\" [icon]=\"icon()\" />\n  }\n  <span class=\"modal-title\" [id]=\"titleId()\">{{ heading() | translate: translationParams() }}</span>\n  <button\n    type=\"button\"\n    class=\"btn btn-circle btn-ghost\"\n    [attr.aria-label]=\"cancelBtnName() | translate\"\n    [disabled]=\"!!loading\"\n    (click)=\"modalRef.messageOrHide('cancel')\"\n  >\n    <si-icon [icon]=\"icons.elementCancel\" />\n  </button>\n</div>\n<div class=\"modal-body text-pre-wrap text-break\">{{\n  (!disableSave() ? message() : disableSaveMessage()) | translate: translationParams()\n}}</div>\n<div class=\"modal-footer\">\n  <si-loading-button\n    buttonClass=\"btn btn-secondary\"\n    [disabled]=\"!!loading && loading !== 'cancel'\"\n    [loading]=\"loading === 'cancel'\"\n    (click)=\"modalRef.messageOrHide('cancel')\"\n  >\n    {{ cancelBtnName() | translate }}\n  </si-loading-button>\n  <si-loading-button\n    buttonClass=\"btn btn-danger\"\n    [disabled]=\"!!loading && loading !== 'discard'\"\n    [loading]=\"loading === 'discard'\"\n    (click)=\"modalRef.messageOrHide('discard')\"\n  >\n    {{ (!disableSave() ? discardBtnName() : disableSaveDiscardBtnName()) | translate }}\n  </si-loading-button>\n  @if (!disableSave()) {\n    <si-loading-button\n      buttonClass=\"btn btn-primary\"\n      [disabled]=\"!!loading && loading !== 'save'\"\n      [loading]=\"loading === 'save'\"\n      (click)=\"modalRef.messageOrHide('save')\"\n    >\n      {{ saveBtnName() | translate }}\n    </si-loading-button>\n  }\n</div>\n" }]
        }], propDecorators: { titleId: [{ type: i0.Input, args: [{ isSignal: true, alias: "titleId", required: false }] }], heading: [{ type: i0.Input, args: [{ isSignal: true, alias: "heading", required: false }] }], message: [{ type: i0.Input, args: [{ isSignal: true, alias: "message", required: false }] }], saveBtnName: [{ type: i0.Input, args: [{ isSignal: true, alias: "saveBtnName", required: false }] }], discardBtnName: [{ type: i0.Input, args: [{ isSignal: true, alias: "discardBtnName", required: false }] }], cancelBtnName: [{ type: i0.Input, args: [{ isSignal: true, alias: "cancelBtnName", required: false }] }], disableSave: [{ type: i0.Input, args: [{ isSignal: true, alias: "disableSave", required: false }] }], disableSaveMessage: [{ type: i0.Input, args: [{ isSignal: true, alias: "disableSaveMessage", required: false }] }], disableSaveDiscardBtnName: [{ type: i0.Input, args: [{ isSignal: true, alias: "disableSaveDiscardBtnName", required: false }] }], translationParams: [{ type: i0.Input, args: [{ isSignal: true, alias: "translationParams", required: false }] }], icon: [{ type: i0.Input, args: [{ isSignal: true, alias: "icon", required: false }] }] } });

/**
 * Copyright (c) Siemens 2016 - 2026
 * SPDX-License-Identifier: MIT
 */
const ACTION_DIALOG_COMPONENT = {
    'alert': SiAlertDialogComponent,
    'confirmation': SiConfirmationDialogComponent,
    'delete-confirm': SiDeleteConfirmationDialogComponent,
    'edit-discard': SiEditDiscardDialogComponent
};
const ACTION_DIALOG_DEFAULT_CLOSE_VALUE = {
    'alert': 'confirm',
    'confirmation': 'decline',
    'delete-confirm': 'cancel',
    'edit-discard': 'cancel'
};
/**
 * The service provides convenient methods to show common modal dialogs.
 * All return an observable, which emit the dialog results. After emitting,
 * the observables complete. Therefore, clients do not need to unsubscribe.
 */
class SiActionDialogService {
    modalService = inject(SiModalService);
    /**
     * Shows an action dialog
     * @param dialog - The dialog configuration
     * @param diOptions - Optional DI configuration.
     * @returns Observable for the result of the dialog. Need to `subscribe()` to show the dialog
     */
    showActionDialog(dialog, diOptions) {
        return new Observable(subscriber => {
            const { type, delayDismiss, ...inputs } = dialog;
            const config = createModalConfig(inputs);
            config.keyboard = true;
            config.messageInsteadOfAutoHide = !!delayDismiss;
            Object.assign(config, diOptions);
            const modalRef = this.modalService.show(ACTION_DIALOG_COMPONENT[type], config, ACTION_DIALOG_DEFAULT_CLOSE_VALUE[type]);
            let subscription;
            if (delayDismiss) {
                // `any`because TS cannot infer types correctly
                subscription = modalRef.message
                    .pipe(take(1), switchMap(delayDismiss))
                    .subscribe(modalRef.hide);
            }
            // ModalRef always allows emitting undefined. But we know that we don't emit undefined here, so do typecast.
            modalRef.hidden.subscribe(subscriber);
            return () => {
                subscription?.unsubscribe();
                modalRef.detach();
            };
        });
    }
    static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.8", ngImport: i0, type: SiActionDialogService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
    static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.8", ngImport: i0, type: SiActionDialogService, providedIn: 'root' });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.8", ngImport: i0, type: SiActionDialogService, decorators: [{
            type: Injectable,
            args: [{ providedIn: 'root' }]
        }] });

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

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

export { SiActionDialogService };
//# sourceMappingURL=siemens-element-ng-action-modal.mjs.map
