import { D as e, E as t, N as n, R as r, S as i, U as a, _ as o, at as s, b as c, ct as l, f as u, g as d, h as f, lt as p, m, s as h, u as g, y as _, z as v } from "./draggable-Bcb86AsV.js";
import { Mt as y, Xt as b, Zt as x, rt as S } from "./features-BnG-dhzy.js";
//#region src/components/blocks/RichTextLinkDialog.vue?vue&type=script&setup=true&lang.ts
var C = ["data-tpl-theme"], w = { class: "tpl:flex tpl:items-center tpl:justify-between tpl:border-b tpl:border-[var(--tpl-border)] tpl:px-5 tpl:py-4" }, T = {
	id: "tpl-link-dialog-title",
	class: "tpl:m-0 tpl:text-sm tpl:font-semibold tpl:text-[var(--tpl-text)]"
}, E = ["aria-label"], D = { class: "tpl:p-5" }, O = { class: "tpl:mb-4 tpl:last:mb-0" }, k = {
	for: "tpl-link-dialog-url",
	class: "tpl:mb-1.5 tpl:block tpl:text-xs tpl:font-medium tpl:tracking-wide tpl:text-[var(--tpl-text-muted)] tpl:uppercase"
}, A = ["placeholder"], j = { class: "tpl:flex tpl:items-center tpl:justify-between tpl:border-t tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg-elevated)] tpl:px-5 tpl:py-4" }, M = { class: "tpl:ml-auto tpl:flex tpl:gap-2" }, N = /* @__PURE__ */ i({
	__name: "RichTextLinkDialog",
	props: /* @__PURE__ */ e({
		visible: { type: Boolean },
		isEditingLink: { type: Boolean }
	}, {
		linkUrl: { required: !0 },
		linkUrlModifiers: {},
		dialogRef: { required: !0 },
		dialogRefModifiers: {}
	}),
	emits: /* @__PURE__ */ e([
		"close",
		"insert",
		"remove",
		"keydown"
	], ["update:linkUrl", "update:dialogRef"]),
	setup(e, { emit: r }) {
		let i = v(e, "linkUrl"), _ = v(e, "dialogRef"), N = r, P = t(b, null), F = t(x, null), { t: I } = y();
		return (t, r) => (n(), f(u, { to: "body" }, [e.visible ? (n(), o("div", {
			key: 0,
			"data-tpl-theme": s(F),
			class: "tpl tpl-link-dialog tpl:fixed tpl:inset-0 tpl:z-modal tpl:flex tpl:items-center tpl:justify-center",
			style: l(s(P)),
			onClick: r[6] ||= g((e) => N("close"), ["self"])
		}, [m("div", {
			ref: (e) => _.value = e,
			role: "dialog",
			"aria-modal": "true",
			"aria-labelledby": "tpl-link-dialog-title",
			class: "tpl:w-[400px] tpl:overflow-hidden tpl:rounded-lg tpl:border tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg)] tpl:shadow-lg"
		}, [
			m("div", w, [m("h4", T, p(e.isEditingLink ? s(I).linkDialog.editLink : s(I).linkDialog.insertLink), 1), m("button", {
				type: "button",
				"aria-label": s(I).linkDialog.cancel,
				class: "tpl:flex tpl:size-7 tpl:cursor-pointer tpl:items-center tpl:justify-center tpl:rounded tpl:border-none tpl:bg-transparent tpl:p-0 tpl:text-[var(--tpl-text-muted)] tpl:hover:bg-[var(--tpl-bg-hover)] tpl:hover:text-[var(--tpl-text)]",
				onClick: r[0] ||= (e) => N("close")
			}, [c(s(S), {
				size: 16,
				"stroke-width": 2
			})], 8, E)]),
			m("div", D, [m("div", O, [m("label", k, p(s(I).linkDialog.urlLabel), 1), a(m("input", {
				id: "tpl-link-dialog-url",
				"onUpdate:modelValue": r[1] ||= (e) => i.value = e,
				type: "url",
				class: "tpl:w-full tpl:rounded-md tpl:border tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg)] tpl:px-3 tpl:py-2.5 tpl:text-sm tpl:text-[var(--tpl-text)] tpl:transition-all tpl:duration-150 tpl:outline-none tpl:placeholder:text-[var(--tpl-text-dim)] tpl:focus:border-[var(--tpl-primary)] tpl:focus:shadow-[0_0_0_3px_var(--tpl-primary-light)]",
				placeholder: s(I).linkDialog.urlPlaceholder,
				autofocus: "",
				onKeydown: r[2] ||= (e) => N("keydown", e)
			}, null, 40, A), [[h, i.value]])])]),
			m("div", j, [e.isEditingLink ? (n(), o("button", {
				key: 0,
				type: "button",
				class: "tpl:inline-flex tpl:cursor-pointer tpl:items-center tpl:rounded-md tpl:border tpl:border-[var(--tpl-danger)] tpl:bg-transparent tpl:px-4 tpl:py-2 tpl:text-[13px] tpl:font-medium tpl:text-[var(--tpl-danger)] tpl:transition-all tpl:duration-150 tpl:hover:bg-[var(--tpl-danger-light)]",
				onClick: r[3] ||= (e) => N("remove")
			}, p(s(I).linkDialog.removeLink), 1)) : d("", !0), m("div", M, [m("button", {
				type: "button",
				class: "tpl:inline-flex tpl:cursor-pointer tpl:items-center tpl:rounded-md tpl:border tpl:border-[var(--tpl-border)] tpl:bg-transparent tpl:px-4 tpl:py-2 tpl:text-[13px] tpl:font-medium tpl:text-[var(--tpl-text-muted)] tpl:transition-all tpl:duration-150 tpl:hover:bg-[var(--tpl-bg-hover)] tpl:hover:text-[var(--tpl-text)]",
				onClick: r[4] ||= (e) => N("close")
			}, p(s(I).linkDialog.cancel), 1), m("button", {
				type: "button",
				class: "tpl:inline-flex tpl:cursor-pointer tpl:items-center tpl:rounded-md tpl:border-none tpl:bg-[var(--tpl-primary)] tpl:px-4 tpl:py-2 tpl:text-[13px] tpl:font-medium tpl:transition-all tpl:duration-150 tpl:hover:bg-[var(--tpl-primary-hover)] tpl:text-[var(--tpl-bg)]",
				onClick: r[5] ||= (e) => N("insert")
			}, p(e.isEditingLink ? s(I).linkDialog.updateLink : s(I).linkDialog.insertLink), 1)])])
		], 512)], 12, C)) : d("", !0)]));
	}
}), P = {
	key: 0,
	class: "tpl-text-editable tpl:min-h-[1.5em] tpl:rounded tpl:border tpl:border-dashed tpl:border-[var(--tpl-primary)] tpl:p-2"
}, F = { class: "tpl:animate-pulse tpl:text-[var(--tpl-text-dim)]" }, I = {
	key: 1,
	class: "tpl-text-editable tpl:min-h-[1.5em] tpl:rounded tpl:border tpl:border-dashed tpl:p-2 tpl:text-center tpl:text-xs tpl:border-[var(--tpl-danger)] tpl:text-[var(--tpl-text-muted)]"
}, L = /* @__PURE__ */ i({
	__name: "RichTextEditorContent",
	props: {
		editor: {},
		editorContent: {},
		isLoading: { type: Boolean },
		initError: {}
	},
	emits: ["retry"],
	setup(e, { emit: t }) {
		let i = t, { t: a } = y();
		return (t, c) => e.isLoading ? (n(), o("div", P, [m("div", F, p(s(a).errors.editorLoading), 1)])) : e.initError ? (n(), o("div", I, [_(p(s(a).errors.editorLoadFailed) + " ", 1), m("button", {
			class: "tpl:ml-1 tpl:cursor-pointer tpl:border-none tpl:bg-transparent tpl:p-0 tpl:underline tpl:text-[var(--tpl-primary)]",
			onClick: c[0] ||= (e) => i("retry")
		}, p(s(a).errors.retry), 1)])) : e.editorContent && e.editor ? (n(), f(r(e.editorContent), {
			key: 2,
			editor: e.editor,
			class: "tpl-text-editable tpl:min-h-[1.5em] tpl:rounded tpl:border tpl:border-dashed tpl:border-[var(--tpl-primary)] tpl:p-2"
		}, null, 8, ["editor"])) : d("", !0);
	}
});
//#endregion
export { N as n, L as t };

//# sourceMappingURL=RichTextEditorContent-CmOwLOeY.js.map