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 { css, customElement, html, nothing } from '../../../../external/lit/index.js';
import { UmbModalBaseElement } from '../../../core/modal/index.js';
let UmbManifestViewerModalElement = class UmbManifestViewerModalElement extends UmbModalBaseElement {
    // Code adapted from https://stackoverflow.com/a/57668208/12787
    // Licensed under the permissions of the CC BY-SA 4.0 DEED
    #stringify(obj) {
        let output = '{';
        for (const key in obj) {
            let value = obj[key];
            if (typeof value === 'function') {
                value = value.toString();
            }
            else if (value instanceof Array) {
                value = JSON.stringify(value);
            }
            else if (typeof value === 'object') {
                value = this.#stringify(value);
            }
            else if (typeof value === 'number') {
                value = `${value}`;
            }
            else if (typeof value === 'boolean') {
                value = `${value}`;
            }
            else {
                value = `"${value}"`;
            }
            output += `\n  ${key}: ${value},`;
        }
        return output + '\n}';
    }
    render() {
        return html `
			<umb-body-layout headline=${this.localize.term('general_manifest')} main-no-padding>
				${this.data
            ? html `<umb-code-block language="JSON" copy>${this.#stringify(this.data)}</umb-code-block>`
            : nothing}
				<div slot="actions">
					<uui-button label=${this.localize.term('general_close')} @click=${this._rejectModal}></uui-button>
				</div>
			</umb-body-layout>
		`;
    }
    static { this.styles = [
        css `
			umb-code-block {
				border: none;
				height: 100%;
			}
		`,
    ]; }
};
UmbManifestViewerModalElement = __decorate([
    customElement('umb-manifest-viewer-modal')
], UmbManifestViewerModalElement);
export { UmbManifestViewerModalElement };
export default UmbManifestViewerModalElement;
