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 } from '../../../../../external/lit/index.js';
import { umbFocus } from '../../../../core/lit-element/index.js';
import { UmbModalBaseElement } from '../../../../core/modal/index.js';
let UmbTiptapAnchorModalElement = class UmbTiptapAnchorModalElement extends UmbModalBaseElement {
    async #onSubmit(event) {
        event.preventDefault();
        const form = event.target;
        if (!form)
            return;
        const isValid = form.checkValidity();
        if (!isValid)
            return;
        const formData = new FormData(form);
        const name = formData.get('name');
        this.value = name;
        this._submitModal();
    }
    render() {
        const label = this.localize.term('tiptap_anchor_input');
        return html `
			<uui-dialog-layout>
				<uui-form>
					<form id="form" @submit=${this.#onSubmit}>
						<uui-form-layout-item>
							<uui-label for="name" slot="label" required>${label}</uui-label>
							<uui-input
								type="text"
								required
								id="name"
								name="name"
								label=${label}
								.value=${this.data?.id || ''}
								${umbFocus()}></uui-input>
						</uui-form-layout-item>
					</form>
				</uui-form>
				<uui-button
					slot="actions"
					label=${this.localize.term('buttons_confirmActionCancel')}
					@click=${this._rejectModal}></uui-button>
				<uui-button
					type="submit"
					slot="actions"
					form="form"
					color="positive"
					look="primary"
					label=${this.localize.term('general_submit')}></uui-button>
			</uui-dialog-layout>
		`;
    }
    static { this.styles = [
        css `
			:host {
				--umb-body-layout-color-background: var(--uui-color-surface);
			}

			uui-dialog-layout {
				width: var(--uui-size-100);
			}

			uui-input {
				width: 100%;
			}
		`,
    ]; }
};
UmbTiptapAnchorModalElement = __decorate([
    customElement('umb-tiptap-anchor-modal')
], UmbTiptapAnchorModalElement);
export { UmbTiptapAnchorModalElement };
export { UmbTiptapAnchorModalElement as element };
