var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
import { customElement, html, ifDefined, nothing, property } from '../../../../../external/lit/index.js';
import { UmbLitElement } from '../../../lit-element/index.js';
import { UMB_ERROR_VIEWER_MODAL, UMB_MODAL_MANAGER_CONTEXT } from '../../../modal/index.js';
let UmbPeekErrorNotificationElement = class UmbPeekErrorNotificationElement extends UmbLitElement {
    async #onClick() {
        const modalManager = await this.getContext(UMB_MODAL_MANAGER_CONTEXT);
        if (!modalManager) {
            throw new Error('Modal manager not found.');
        }
        modalManager.open(this, UMB_ERROR_VIEWER_MODAL, { data: this.data?.details });
        this.notificationHandler.close();
    }
    render() {
        return this.data
            ? html `<uui-toast-notification-layout headline=${ifDefined(this.data.headline)}
					>${this.data.message}${this.data.details
                ? html `<uui-button
								slot="actions"
								look="primary"
								color="danger"
								label=${this.localize.term('defaultdialogs_seeErrorAction')}
								@click=${this.#onClick}></uui-button>`
                : nothing}</uui-toast-notification-layout
				>`
            : nothing;
    }
};
__decorate([
    property({ attribute: false })
], UmbPeekErrorNotificationElement.prototype, "data", void 0);
UmbPeekErrorNotificationElement = __decorate([
    customElement('umb-peek-error-notification')
], UmbPeekErrorNotificationElement);
export { UmbPeekErrorNotificationElement };
