import { D as e, E as t, H as n, L as r, M as i, Mt as a, Ot as o, R as s, S as c, _ as l, b as u, f as d, g as f, h as p, it as m, m as h, s as g, u as _, y as v } from "./vue.runtime.esm-bundler-DpvJL-nX.js";
import { E as y, w as b } from "./keys-BeW4IrXP.js";
import { t as x } from "./useI18n-Jp3X6Q0t.js";
import { n as S } from "./_plugin-vue_export-helper-GRmvIR5A.js";
import { t as C } from "./x-BNc1bVzp.js";
var w = S("bold", [["path", {
	d: "M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8",
	key: "mg9rjx"
}]]), T = S("italic", [
	["line", {
		x1: "19",
		x2: "10",
		y1: "4",
		y2: "4",
		key: "15jd3p"
	}],
	["line", {
		x1: "14",
		x2: "5",
		y1: "20",
		y2: "20",
		key: "bu0au3"
	}],
	["line", {
		x1: "15",
		x2: "9",
		y1: "4",
		y2: "20",
		key: "uljnxc"
	}]
]), E = S("link", [["path", {
	d: "M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",
	key: "1cjeqo"
}], ["path", {
	d: "M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",
	key: "19qd67"
}]]), D = ["data-tpl-theme"], O = { class: "tpl:flex tpl:items-center tpl:justify-between tpl:border-b tpl:border-[var(--tpl-border)] tpl:px-5 tpl:py-4" }, k = {
	id: "tpl-link-dialog-title",
	class: "tpl:m-0 tpl:text-sm tpl:font-semibold tpl:text-[var(--tpl-text)]"
}, A = ["aria-label"], j = { class: "tpl:p-5" }, M = { class: "tpl:mb-4 tpl:last:mb-0" }, N = {
	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"
}, P = ["placeholder"], F = { 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" }, I = { class: "tpl:ml-auto tpl:flex tpl:gap-2" }, L = /* @__PURE__ */ c({
	__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 c = s(e, "linkUrl"), v = s(e, "dialogRef"), S = r, w = t(b, null), T = t(y, null), { t: E } = x();
		return (t, r) => (i(), p(d, { to: "body" }, [e.visible ? (i(), l("div", {
			key: 0,
			"data-tpl-theme": m(T),
			class: "tpl tpl-link-dialog tpl:fixed tpl:inset-0 tpl:z-modal tpl:flex tpl:items-center tpl:justify-center",
			style: o(m(w)),
			onClick: r[6] ||= _((e) => S("close"), ["self"])
		}, [h("div", {
			ref: (e) => v.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"
		}, [
			h("div", O, [h("h4", k, a(e.isEditingLink ? m(E).linkDialog.editLink : m(E).linkDialog.insertLink), 1), h("button", {
				type: "button",
				"aria-label": m(E).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) => S("close")
			}, [u(m(C), {
				size: 16,
				"stroke-width": 2
			})], 8, A)]),
			h("div", j, [h("div", M, [h("label", N, a(m(E).linkDialog.urlLabel), 1), n(h("input", {
				id: "tpl-link-dialog-url",
				"onUpdate:modelValue": r[1] ||= (e) => c.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: m(E).linkDialog.urlPlaceholder,
				autofocus: "",
				onKeydown: r[2] ||= (e) => S("keydown", e)
			}, null, 40, P), [[g, c.value]])])]),
			h("div", F, [e.isEditingLink ? (i(), l("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) => S("remove")
			}, a(m(E).linkDialog.removeLink), 1)) : f("", !0), h("div", I, [h("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) => S("close")
			}, a(m(E).linkDialog.cancel), 1), h("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) => S("insert")
			}, a(e.isEditingLink ? m(E).linkDialog.updateLink : m(E).linkDialog.insertLink), 1)])])
		], 512)], 12, D)) : f("", !0)]));
	}
}), R = {
	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"
}, z = { class: "tpl:animate-pulse tpl:text-[var(--tpl-text-dim)]" }, B = {
	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)]"
}, V = /* @__PURE__ */ c({
	__name: "RichTextEditorContent",
	props: {
		editor: {},
		editorContent: {},
		isLoading: { type: Boolean },
		initError: {}
	},
	emits: ["retry"],
	setup(e, { emit: t }) {
		let n = t, { t: o } = x();
		return (t, s) => e.isLoading ? (i(), l("div", R, [h("div", z, a(m(o).errors.editorLoading), 1)])) : e.initError ? (i(), l("div", B, [v(a(m(o).errors.editorLoadFailed) + " ", 1), h("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: s[0] ||= (e) => n("retry")
		}, a(m(o).errors.retry), 1)])) : e.editorContent && e.editor ? (i(), p(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"])) : f("", !0);
	}
});
//#endregion
export { w as a, T as i, L as n, E as r, V as t };
