import { A as e, B as t, L as n, M as r, X as i, _ as a, at as o, b as s, f as c, h as l, i as u, l as d, m as f, p, rt as m, st as h, v as g, z as _ } from "./vue.runtime.esm-bundler-Bxqkjqhc.js";
import "./useEditorCore-DT3VrvZS.js";
import { t as v } from "./loader-circle-_9bP23op.js";
import { n as y } from "./useCloudI18n-BPUHj2CZ.js";
import { t as b } from "./TplModal-CVq2BAIW.js";
//#region src/cloud/components/TestEmailModal.vue?vue&type=script&setup=true&lang.ts
var x = ["aria-busy"], S = {
	id: "tpl-test-email-title",
	class: "tpl:mb-4 tpl:text-sm tpl:font-semibold tpl:text-[var(--tpl-text)]"
}, C = { class: "tpl:mb-3" }, w = { class: "tpl:mb-1.5 tpl:block tpl:text-sm tpl:font-medium tpl:text-[var(--tpl-text-muted)]" }, T = ["value"], E = ["disabled"], D = ["value"], O = {
	key: 0,
	role: "alert",
	class: "tpl:mb-3 tpl:text-xs tpl:text-[var(--tpl-danger)]"
}, k = { class: "tpl:flex tpl:justify-end tpl:gap-2" }, A = ["disabled"], j = ["disabled"], M = {
	key: 0,
	class: "tpl:flex tpl:items-center tpl:gap-1.5"
}, N = { key: 1 }, P = /* @__PURE__ */ s({
	__name: "TestEmailModal",
	props: {
		visible: { type: Boolean },
		allowedEmails: {},
		isSending: { type: Boolean },
		error: {}
	},
	emits: ["send", "close"],
	setup(s, { emit: P }) {
		let F = s, I = P, { t: L } = y(), R = i("");
		n(() => F.visible, (e) => {
			e && (R.value = F.allowedEmails[0] ?? "");
		});
		function z() {
			!R.value || F.isSending || I("send", R.value);
		}
		function B() {
			F.isSending || I("close");
		}
		function V(e) {
			e.key === "Enter" && !e.shiftKey && (e.preventDefault(), z()), e.key === "Escape" && B();
		}
		return (n, i) => (e(), p(b, {
			visible: s.visible,
			onClose: B,
			onKeydown: V
		}, {
			default: _(() => [c("div", {
				role: "dialog",
				"aria-modal": "true",
				"aria-busy": s.isSending,
				"aria-labelledby": "tpl-test-email-title",
				class: "tpl-scale-in tpl:mx-4 tpl:w-full tpl:max-w-sm tpl:rounded-[var(--tpl-radius-lg)] tpl:p-5",
				style: {
					"background-color": "var(--tpl-bg-elevated)",
					"box-shadow": "var(--tpl-shadow-xl)"
				}
			}, [
				c("h3", S, h(m(L).testEmail.title), 1),
				c("div", C, [c("label", w, h(m(L).testEmail.recipientLabel), 1), s.allowedEmails.length === 1 ? (e(), l("input", {
					key: 0,
					type: "text",
					value: R.value,
					disabled: "",
					class: "tpl:h-9 tpl:w-full tpl:rounded-md tpl:border tpl:px-3 tpl:py-1 tpl:text-sm tpl:opacity-70 tpl:shadow-xs tpl:outline-none tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg)] tpl:text-[var(--tpl-text)]"
				}, null, 8, T)) : t((e(), l("select", {
					key: 1,
					"onUpdate:modelValue": i[0] ||= (e) => R.value = e,
					class: "tpl:h-9 tpl:w-full tpl:rounded-md tpl:border tpl:px-3 tpl:py-1 tpl:text-sm tpl:shadow-xs tpl:outline-none tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg)] tpl:text-[var(--tpl-text)]",
					disabled: s.isSending
				}, [(e(!0), l(d, null, r(s.allowedEmails, (t) => (e(), l("option", {
					key: t,
					value: t
				}, h(t), 9, D))), 128))], 8, E)), [[u, R.value]])]),
				s.error ? (e(), l("p", O, h(s.error), 1)) : f("", !0),
				c("div", k, [c("button", {
					type: "button",
					class: o(["tpl:cursor-pointer tpl:rounded-md tpl:border tpl:px-3 tpl:py-1.5 tpl:text-sm tpl:font-medium tpl:shadow-xs tpl:transition-all tpl:duration-150 tpl:border-[var(--tpl-border)] tpl:text-[var(--tpl-text)] tpl:bg-[var(--tpl-bg)]", { "tpl:cursor-not-allowed tpl:opacity-50": s.isSending }]),
					disabled: s.isSending,
					onClick: B
				}, h(m(L).testEmail.cancel), 11, A), c("button", {
					type: "button",
					class: "tpl:cursor-pointer tpl:rounded-md tpl:px-3 tpl:py-1.5 tpl:text-sm tpl:font-medium tpl:shadow-xs tpl:transition-all tpl:duration-150 tpl:hover:opacity-90 tpl:disabled:cursor-not-allowed tpl:disabled:opacity-50 tpl:bg-[var(--tpl-primary)] tpl:text-[var(--tpl-bg)]",
					disabled: !R.value || s.isSending,
					onClick: z
				}, [s.isSending ? (e(), l("span", M, [g(m(v), {
					class: "tpl:animate-spin",
					size: 12,
					"stroke-width": 2
				}), a(" " + h(m(L).testEmail.sending), 1)])) : (e(), l("span", N, h(m(L).testEmail.send), 1))], 8, j)])
			], 8, x)]),
			_: 1
		}, 8, ["visible"]));
	}
});
//#endregion
export { P as default };
