import { A as e, B as t, E as n, L as r, M as i, X as a, _ as ee, a as o, at as s, b as c, d as l, f as u, h as d, l as f, m as p, ot as te, p as m, rt as h, st as g, t as _, v, z as y } from "./vue.runtime.esm-bundler-BDSGA5hA.js";
import { A as b, l as ne, p as re, r as ie } from "./keys-B8K7Z7Ef.js";
import { t as ae } from "./useI18n-CBbStVlD.js";
import { t as x } from "./createLucideIcon-XgXOJ05E.js";
import { t as oe } from "./check-ChQyfxJ3.js";
import { t as se } from "./chevron-down-DJjo0jSV.js";
import { t as S } from "./loader-circle-Rz_4vJLH.js";
import { t as C } from "./message-circle-D-umK_MU.js";
import { t as w } from "./send-BhbhbIFT.js";
import { t as T } from "./trash-2-BpY5BCLT.js";
import { t as E } from "./x-rcnxRG8Y.js";
import { t as D } from "./_plugin-vue_export-helper-B3ysoDQm.js";
import { n as ce } from "./useCloudI18n-DFzVgYhJ.js";
import { t as le } from "./formatRelativeTime-CyDg5cDD.js";
var ue = x("chevron-up", [["path", {
	d: "m18 15-6-6-6 6",
	key: "153udz"
}]]), de = x("circle-check", [["circle", {
	cx: "12",
	cy: "12",
	r: "10",
	key: "1mglay"
}], ["path", {
	d: "m9 12 2 2 4-4",
	key: "dzmm74"
}]]), O = x("pencil", [["path", {
	d: "M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",
	key: "1a8usu"
}], ["path", {
	d: "m15 5 4 4",
	key: "1mk7zo"
}]]), fe = x("reply", [["path", {
	d: "M20 18v-2a4 4 0 0 0-4-4H4",
	key: "5vmcpk"
}], ["path", {
	d: "m9 17-5-5 5-5",
	key: "nvlc11"
}]]), pe = {
	key: 0,
	class: "tpl-comments-sidebar tpl:absolute tpl:top-14 tpl:right-0 tpl:bottom-0 tpl:z-panel tpl:flex tpl:w-[360px] tpl:flex-col tpl:border-l tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg-elevated)]"
}, me = { class: "tpl:flex tpl:items-center tpl:justify-between tpl:border-b tpl:border-[var(--tpl-border)] tpl:px-4 tpl:py-3" }, he = { class: "tpl:flex tpl:items-center tpl:gap-1.5 tpl:text-sm tpl:font-medium tpl:text-[var(--tpl-text)]" }, ge = {
	key: 0,
	class: "tpl:ml-1 tpl:inline-flex tpl:size-5 tpl:items-center tpl:justify-center tpl:rounded-full tpl:text-[10px] tpl:font-semibold tpl:bg-[var(--tpl-primary)] tpl:text-[var(--tpl-bg)]"
}, _e = { class: "tpl:flex tpl:gap-1 tpl:border-b tpl:border-[var(--tpl-border)] tpl:px-4 tpl:py-2" }, ve = { class: "tpl:flex-1 tpl:overflow-y-auto" }, ye = {
	key: 0,
	class: "tpl:flex tpl:h-full tpl:items-center tpl:justify-center"
}, be = {
	key: 1,
	class: "tpl:flex tpl:h-full tpl:flex-col tpl:items-center tpl:justify-center tpl:gap-3 tpl:px-6 tpl:text-center"
}, xe = { class: "tpl:max-w-[240px] tpl:text-sm tpl:text-[var(--tpl-text-muted)]" }, Se = {
	key: 2,
	class: "tpl:flex tpl:flex-col tpl:gap-3 tpl:p-3"
}, Ce = { class: "tpl-comment-card tpl:rounded-lg tpl:border tpl:px-3.5 tpl:py-3" }, we = { class: "tpl:flex tpl:items-start tpl:justify-between tpl:gap-2" }, Te = { class: "tpl:flex tpl:items-center tpl:gap-1.5" }, Ee = { class: "tpl:text-xs tpl:font-semibold tpl:text-[var(--tpl-text)]" }, De = { class: "tpl:text-[10px] tpl:text-[var(--tpl-text-dim)]" }, Oe = {
	key: 0,
	class: "tpl:text-[10px] tpl:italic tpl:text-[var(--tpl-text-dim)]"
}, ke = { class: "tpl:flex tpl:items-center tpl:gap-0.5" }, Ae = ["title", "onClick"], je = ["title", "onClick"], Me = ["title", "onClick"], Ne = {
	key: 0,
	class: "tpl:mt-1 tpl:flex tpl:items-center tpl:gap-1 tpl:text-[10px] tpl:text-[var(--tpl-primary)]"
}, Pe = {
	key: 0,
	class: "tpl:mt-1 tpl:inline-flex tpl:items-center tpl:gap-1 tpl:rounded tpl:px-1.5 tpl:py-0.5 tpl:text-[10px] tpl:font-medium tpl:bg-[var(--tpl-warning-light)] tpl:text-[var(--tpl-warning)]"
}, Fe = ["onClick"], Ie = {
	key: 2,
	class: "tpl:mt-2"
}, Le = ["onKeydown"], Re = { class: "tpl:mt-1.5 tpl:flex tpl:gap-1.5" }, ze = ["disabled", "onClick"], Be = {
	key: 3,
	class: "tpl:mt-1.5 tpl:text-xs tpl:leading-relaxed tpl:whitespace-pre-wrap tpl:text-[var(--tpl-text)]"
}, Ve = {
	key: 4,
	class: "tpl:mt-2 tpl:flex tpl:items-center tpl:gap-2 tpl:rounded-md tpl:px-2.5 tpl:py-2 tpl:text-xs tpl:bg-[var(--tpl-danger-light)] tpl:text-[var(--tpl-danger)]"
}, He = { class: "tpl:flex-1" }, Ue = ["onClick"], We = {
	key: 5,
	class: "tpl:mt-2 tpl:flex tpl:items-center tpl:gap-2"
}, Ge = ["title", "onClick"], Ke = ["onClick"], qe = {
	key: 0,
	class: "tpl-comment-replies tpl:ml-5 tpl:pl-3 tpl:pt-2"
}, Je = { class: "tpl:flex tpl:items-start tpl:justify-between tpl:gap-2" }, Ye = { class: "tpl:flex tpl:items-center tpl:gap-1.5" }, Xe = { class: "tpl:text-xs tpl:font-semibold tpl:text-[var(--tpl-text)]" }, Ze = { class: "tpl:text-[10px] tpl:text-[var(--tpl-text-dim)]" }, Qe = {
	key: 0,
	class: "tpl:text-[10px] tpl:italic tpl:text-[var(--tpl-text-dim)]"
}, $e = { class: "tpl:flex tpl:items-center tpl:gap-0.5" }, et = ["title", "onClick"], tt = ["title", "onClick"], nt = {
	key: 0,
	class: "tpl:mt-1.5"
}, rt = ["onKeydown"], it = { class: "tpl:mt-1.5 tpl:flex tpl:gap-1.5" }, at = ["disabled", "onClick"], ot = {
	key: 1,
	class: "tpl:mt-1 tpl:text-xs tpl:leading-relaxed tpl:whitespace-pre-wrap tpl:text-[var(--tpl-text)]"
}, st = {
	key: 2,
	class: "tpl:mt-2 tpl:flex tpl:items-center tpl:gap-2 tpl:rounded-md tpl:px-2.5 tpl:py-2 tpl:text-xs tpl:bg-[var(--tpl-danger-light)] tpl:text-[var(--tpl-danger)]"
}, ct = { class: "tpl:flex-1" }, lt = ["onClick"], ut = {
	key: 0,
	class: "tpl-comment-replies tpl:ml-5 tpl:pl-3 tpl:pt-2"
}, dt = { class: "tpl:flex tpl:items-end tpl:gap-2" }, ft = ["placeholder", "onKeydown"], pt = { class: "tpl:flex tpl:shrink-0 tpl:flex-col tpl:gap-1" }, mt = ["disabled", "onClick"], ht = { class: "tpl:border-t tpl:p-3 tpl:border-[var(--tpl-border)]" }, gt = {
	key: 0,
	class: "tpl:flex tpl:min-h-[68px] tpl:items-center tpl:rounded-md tpl:px-3 tpl:py-2 tpl:text-xs tpl:bg-[var(--tpl-warning-light)] tpl:text-[var(--tpl-warning)]"
}, _t = {
	key: 1,
	class: "tpl-comments-input-wrapper tpl:flex tpl:min-h-[68px] tpl:items-end tpl:gap-2 tpl:rounded-[var(--tpl-radius)] tpl:border tpl:px-3 tpl:py-2 tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg)]"
}, vt = ["placeholder", "disabled"], yt = ["disabled"], k = /* @__PURE__ */ D(/* @__PURE__ */ c({
	__name: "CommentsSidebar",
	props: { visible: { type: Boolean } },
	emits: ["close", "filterBlock"],
	setup(c, { expose: x, emit: D }) {
		let k = c, A = D, { format: j } = ae(), { t: M } = ce(), N = b(re, "CommentsSidebar"), bt = b(ie, "CommentsSidebar"), P = b(ne, "CommentsSidebar"), F = a("unresolved"), I = a(null), L = a(""), R = a(null), z = a(""), B = a(null), V = a(""), H = a(/* @__PURE__ */ new Set()), U = a(null), W = a(null), xt = l(() => bt.userConfig?.id ?? null), St = l(() => {
			let e = /* @__PURE__ */ new Set();
			for (let t of N.content.value.blocks) if (e.add(t.id), t.type === "section") for (let n of t.children) for (let t of n) e.add(t.id);
			return e;
		});
		function Ct(e) {
			return e ? !St.value.has(e) : !1;
		}
		let wt = l(() => F.value !== "block" || !I.value ? !1 : !(N.savedBlockIds?.value.has(I.value) ?? !0)), G = l(() => {
			let e = P.comments.value;
			return F.value === "unresolved" ? e = e.filter((e) => !e.resolved_at) : F.value === "block" && I.value && (e = e.filter((e) => e.block_id === I.value)), e;
		});
		r(() => k.visible, (e) => {
			e && P.loadComments();
		}), r(() => N.state.selectedBlockId, (e) => {
			F.value === "block" && e && (I.value = e);
		});
		function K(e, t) {
			F.value = e, I.value = e === "block" ? t ?? null : null;
		}
		function Tt(e) {
			K("block", e), A("filterBlock", e);
		}
		function Et(e) {
			H.value.has(e) ? H.value.delete(e) : H.value.add(e);
		}
		function Dt(e) {
			R.value = e, z.value = "", B.value = null, H.value.has(e) || H.value.add(e);
		}
		function Ot() {
			R.value = null, z.value = "";
		}
		function q(e) {
			B.value = e.id, V.value = e.body, R.value = null;
		}
		function J() {
			B.value = null, V.value = "";
		}
		function Y(e) {
			U.value = e;
		}
		function X() {
			U.value = null;
		}
		async function Z() {
			let e = L.value.trim();
			if (!e) return;
			let t = F.value === "block" ? I.value : void 0;
			await P.addComment(e, t ?? void 0), L.value = "";
		}
		async function kt(e) {
			let t = z.value.trim();
			if (!t) return;
			let n = P.comments.value.find((t) => t.id === e);
			await P.addComment(t, n?.block_id ?? void 0, e), R.value = null, z.value = "";
		}
		async function Q(e) {
			let t = V.value.trim();
			t && (await P.editComment(e, t), B.value = null, V.value = "");
		}
		async function At(e) {
			await P.removeComment(e), U.value = null;
		}
		async function jt(e) {
			await P.toggleResolve(e);
		}
		function $(e) {
			return e.author_identifier === xt.value;
		}
		function Mt(e) {
			return le(e, M.snapshotHistory) ?? e;
		}
		function Nt(e) {
			e.key === "Enter" && !e.shiftKey && (e.preventDefault(), Z());
		}
		function Pt(e, t) {
			e.key === "Enter" && !e.shiftKey && (e.preventDefault(), kt(t));
		}
		function Ft(e, t) {
			e.key === "Enter" && !e.shiftKey && (e.preventDefault(), Q(t)), e.key === "Escape" && J();
		}
		function It() {
			n(() => {
				W.value?.focus();
			});
		}
		return x({
			filterByBlock: Tt,
			focusNewComment: It
		}), (n, r) => (e(), m(_, {
			"enter-active-class": "tpl-comments-slide-enter-active",
			"enter-from-class": "tpl:translate-x-full",
			"enter-to-class": "tpl:translate-x-0",
			"leave-active-class": "tpl-comments-slide-leave-active",
			"leave-from-class": "tpl:translate-x-0",
			"leave-to-class": "tpl:translate-x-full"
		}, {
			default: y(() => [c.visible ? (e(), d("div", pe, [
				u("div", me, [u("div", he, [
					v(h(C), {
						size: 13,
						"stroke-width": 2
					}),
					u("span", null, g(h(M).comments.title), 1),
					h(P).unresolvedCount.value > 0 ? (e(), d("span", ge, g(h(P).unresolvedCount.value), 1)) : p("", !0)
				]), u("button", {
					class: "tpl:rounded-md tpl:p-0.5 tpl:transition-colors tpl:duration-150 tpl:text-[var(--tpl-text-muted)]",
					onClick: r[0] ||= (e) => A("close")
				}, [v(h(E), {
					size: 14,
					"stroke-width": 2
				})])]),
				u("div", _e, [
					u("button", {
						class: s(["tpl-comment-filter tpl:rounded-md tpl:px-2.5 tpl:py-1 tpl:text-xs tpl:font-medium tpl:transition-colors tpl:duration-150", F.value === "unresolved" ? "tpl-comment-filter--active" : ""]),
						onClick: r[1] ||= (e) => K("unresolved")
					}, g(h(M).comments.filterUnresolved), 3),
					u("button", {
						class: s(["tpl-comment-filter tpl:rounded-md tpl:px-2.5 tpl:py-1 tpl:text-xs tpl:font-medium tpl:transition-colors tpl:duration-150", F.value === "all" ? "tpl-comment-filter--active" : ""]),
						onClick: r[2] ||= (e) => K("all")
					}, g(h(M).comments.filterAll), 3),
					h(N).state.selectedBlockId ? (e(), d("button", {
						key: 0,
						class: s(["tpl-comment-filter tpl:rounded-md tpl:px-2.5 tpl:py-1 tpl:text-xs tpl:font-medium tpl:transition-colors tpl:duration-150", F.value === "block" ? "tpl-comment-filter--active" : ""]),
						onClick: r[3] ||= (e) => K("block", h(N).state.selectedBlockId ?? void 0)
					}, g(h(M).comments.filterBlock), 3)) : p("", !0)
				]),
				u("div", ve, [h(P).isLoading.value ? (e(), d("div", ye, [v(h(S), {
					class: "tpl-spinner tpl:text-[var(--tpl-text-muted)]",
					size: 24,
					"stroke-width": 2
				})])) : G.value.length === 0 ? (e(), d("div", be, [v(h(C), {
					size: 32,
					"stroke-width": 1.5,
					class: "tpl:text-[var(--tpl-text-dim)]"
				}), u("p", xe, g(F.value === "all" ? h(M).comments.noCommentsHint : h(M).comments.noComments), 1)])) : (e(), d("div", Se, [(e(!0), d(f, null, i(G.value, (n) => (e(), d("div", {
					key: n.id,
					class: "tpl-comment-thread"
				}, [
					u("div", Ce, [
						u("div", we, [u("div", Te, [
							u("span", Ee, g($(n) ? h(M).comments.ownedByYou : n.author_name), 1),
							u("span", De, g(Mt(n.created_at)), 1),
							n.updated_at === n.created_at ? p("", !0) : (e(), d("span", Oe, " (" + g(h(M).comments.edited) + ") ", 1))
						]), u("div", ke, [
							u("button", {
								class: "tpl-comment-action tpl:rounded tpl:p-1 tpl:transition-colors tpl:duration-150",
								title: n.resolved_at ? h(M).comments.unresolve : h(M).comments.resolve,
								onClick: (e) => jt(n.id)
							}, [v(h(de), {
								size: 13,
								"stroke-width": 2,
								class: "tpl-resolve-icon",
								style: te({ color: n.resolved_at ? "var(--tpl-primary)" : void 0 })
							}, null, 8, ["style"])], 8, Ae),
							$(n) ? (e(), d("button", {
								key: 0,
								class: "tpl-comment-action tpl:rounded tpl:p-1 tpl:transition-colors tpl:duration-150",
								title: h(M).comments.edit,
								onClick: (e) => q(n)
							}, [v(h(O), {
								size: 12,
								"stroke-width": 2
							})], 8, je)) : p("", !0),
							$(n) ? (e(), d("button", {
								key: 1,
								class: "tpl-comment-action tpl-comment-delete tpl:rounded tpl:p-1 tpl:transition-colors tpl:duration-150",
								title: h(M).comments.delete,
								onClick: (e) => Y(n.id)
							}, [v(h(T), {
								size: 12,
								"stroke-width": 2
							})], 8, Me)) : p("", !0)
						])]),
						v(_, { name: "tpl-resolve" }, {
							default: y(() => [n.resolved_at ? (e(), d("div", Ne, [v(h(oe), {
								size: 10,
								"stroke-width": 2.5
							}), u("span", null, g(h(j)(h(M).comments.resolvedBy, { name: n.resolved_by_name ?? "" })), 1)])) : p("", !0)]),
							_: 2
						}, 1024),
						n.block_id && Ct(n.block_id) ? (e(), d("span", Pe, g(h(M).comments.missingBlock), 1)) : n.block_id ? (e(), d("button", {
							key: 1,
							class: "tpl:mt-1 tpl:inline-flex tpl:items-center tpl:gap-1 tpl:rounded tpl:px-1.5 tpl:py-0.5 tpl:text-[10px] tpl:font-medium tpl:transition-colors tpl:duration-150 tpl:bg-[var(--tpl-bg-hover)] tpl:text-[var(--tpl-text-muted)]",
							onClick: (e) => h(N).selectBlock(n.block_id ?? "")
						}, " Block ", 8, Fe)) : p("", !0),
						B.value === n.id ? (e(), d("div", Ie, [t(u("textarea", {
							"onUpdate:modelValue": r[4] ||= (e) => V.value = e,
							class: "tpl:w-full tpl:resize-none tpl:rounded-md tpl:border tpl:px-2.5 tpl:py-2 tpl:font-sans tpl:text-xs tpl:outline-none tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg)] tpl:text-[var(--tpl-text)]",
							rows: "3",
							onKeydown: (e) => Ft(e, n.id)
						}, null, 40, Le), [[o, V.value]]), u("div", Re, [u("button", {
							class: "tpl:rounded-md tpl:px-2.5 tpl:py-1 tpl:text-xs tpl:font-medium tpl:transition-colors tpl:duration-150 tpl:bg-[var(--tpl-primary)] tpl:text-[var(--tpl-bg)]",
							disabled: !V.value.trim() || h(P).isSubmitting.value,
							onClick: (e) => Q(n.id)
						}, g(h(M).comments.save), 9, ze), u("button", {
							class: "tpl:rounded-md tpl:px-2.5 tpl:py-1 tpl:text-xs tpl:font-medium tpl:transition-colors tpl:duration-150 tpl:text-[var(--tpl-text-muted)]",
							onClick: r[5] ||= (e) => J()
						}, g(h(M).comments.cancel), 1)])])) : (e(), d("p", Be, g(n.body), 1)),
						U.value === n.id ? (e(), d("div", Ve, [
							u("span", He, g(h(M).comments.deleteConfirm), 1),
							u("button", {
								class: "tpl:rounded tpl:px-2 tpl:py-0.5 tpl:text-xs tpl:font-medium tpl:bg-[var(--tpl-danger)] tpl:text-[var(--tpl-bg)]",
								onClick: (e) => At(n.id)
							}, g(h(M).comments.delete), 9, Ue),
							u("button", {
								class: "tpl:text-xs tpl:font-medium tpl:text-[var(--tpl-text-muted)]",
								onClick: r[6] ||= (e) => X()
							}, g(h(M).comments.cancel), 1)
						])) : p("", !0),
						B.value !== n.id && U.value !== n.id ? (e(), d("div", We, [u("button", {
							class: "tpl-comment-action tpl:rounded tpl:p-1 tpl:transition-colors tpl:duration-150",
							title: h(M).comments.reply,
							onClick: (e) => Dt(n.id)
						}, [v(h(fe), {
							size: 13,
							"stroke-width": 2,
							class: "tpl:text-[var(--tpl-primary)]"
						})], 8, Ge), (n.replies?.length ?? 0) > 0 ? (e(), d("button", {
							key: 0,
							class: "tpl:flex tpl:items-center tpl:gap-0.5 tpl:text-[11px] tpl:font-medium tpl:transition-colors tpl:duration-150 tpl:text-[var(--tpl-text-muted)]",
							onClick: (e) => Et(n.id)
						}, [H.value.has(n.id) ? (e(), m(h(ue), {
							key: 0,
							size: 11,
							"stroke-width": 2
						})) : (e(), m(h(se), {
							key: 1,
							size: 11,
							"stroke-width": 2
						})), ee(" " + g((n.replies?.length ?? 0) === 1 ? h(j)(h(M).comments.replyOne, { count: String(n.replies?.length ?? 0) }) : h(j)(h(M).comments.replyMany, { count: String(n.replies?.length ?? 0) })), 1)], 8, Ke)) : p("", !0)])) : p("", !0)
					]),
					v(_, { name: "tpl-replies" }, {
						default: y(() => [H.value.has(n.id) && (n.replies?.length ?? 0) > 0 ? (e(), d("div", qe, [(e(!0), d(f, null, i(n.replies, (i, a) => (e(), d("div", {
							key: i.id,
							class: s(["tpl-comment-reply-card tpl:relative tpl:rounded-lg tpl:border tpl:px-3.5 tpl:py-2.5", a < (n.replies?.length ?? 0) - 1 ? "tpl:mb-2" : ""])
						}, [
							u("div", Je, [u("div", Ye, [
								u("span", Xe, g($(i) ? h(M).comments.ownedByYou : i.author_name), 1),
								u("span", Ze, g(Mt(i.created_at)), 1),
								i.updated_at === i.created_at ? p("", !0) : (e(), d("span", Qe, " (" + g(h(M).comments.edited) + ") ", 1))
							]), u("div", $e, [$(i) ? (e(), d("button", {
								key: 0,
								class: "tpl-comment-action tpl:rounded tpl:p-1 tpl:transition-colors tpl:duration-150",
								title: h(M).comments.edit,
								onClick: (e) => q(i)
							}, [v(h(O), {
								size: 11,
								"stroke-width": 2
							})], 8, et)) : p("", !0), $(i) ? (e(), d("button", {
								key: 1,
								class: "tpl-comment-action tpl-comment-delete tpl:rounded tpl:p-1 tpl:transition-colors tpl:duration-150",
								title: h(M).comments.delete,
								onClick: (e) => Y(i.id)
							}, [v(h(T), {
								size: 11,
								"stroke-width": 2
							})], 8, tt)) : p("", !0)])]),
							B.value === i.id ? (e(), d("div", nt, [t(u("textarea", {
								"onUpdate:modelValue": r[7] ||= (e) => V.value = e,
								class: "tpl:w-full tpl:resize-none tpl:rounded-md tpl:border tpl:px-2.5 tpl:py-2 tpl:font-sans tpl:text-xs tpl:outline-none tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg)] tpl:text-[var(--tpl-text)]",
								rows: "2",
								onKeydown: (e) => Ft(e, i.id)
							}, null, 40, rt), [[o, V.value]]), u("div", it, [u("button", {
								class: "tpl:rounded-md tpl:px-2.5 tpl:py-1 tpl:text-xs tpl:font-medium tpl:bg-[var(--tpl-primary)] tpl:text-[var(--tpl-bg)]",
								disabled: !V.value.trim() || h(P).isSubmitting.value,
								onClick: (e) => Q(i.id)
							}, g(h(M).comments.save), 9, at), u("button", {
								class: "tpl:rounded-md tpl:px-2.5 tpl:py-1 tpl:text-xs tpl:font-medium tpl:text-[var(--tpl-text-muted)]",
								onClick: r[8] ||= (e) => J()
							}, g(h(M).comments.cancel), 1)])])) : (e(), d("p", ot, g(i.body), 1)),
							U.value === i.id ? (e(), d("div", st, [
								u("span", ct, g(h(M).comments.deleteConfirm), 1),
								u("button", {
									class: "tpl:rounded tpl:px-2 tpl:py-0.5 tpl:text-xs tpl:font-medium tpl:bg-[var(--tpl-danger)] tpl:text-[var(--tpl-bg)]",
									onClick: (e) => At(i.id)
								}, g(h(M).comments.delete), 9, lt),
								u("button", {
									class: "tpl:text-xs tpl:font-medium tpl:text-[var(--tpl-text-muted)]",
									onClick: r[9] ||= (e) => X()
								}, g(h(M).comments.cancel), 1)
							])) : p("", !0)
						], 2))), 128))])) : p("", !0)]),
						_: 2
					}, 1024),
					v(_, { name: "tpl-replies" }, {
						default: y(() => [R.value === n.id ? (e(), d("div", ut, [u("div", dt, [t(u("textarea", {
							"onUpdate:modelValue": r[10] ||= (e) => z.value = e,
							class: "tpl:flex-1 tpl:resize-none tpl:rounded-md tpl:border tpl:px-2.5 tpl:py-2 tpl:font-sans tpl:text-xs tpl:outline-none tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg)] tpl:text-[var(--tpl-text)]",
							placeholder: h(M).comments.replyPlaceholder,
							rows: "2",
							onKeydown: (e) => Pt(e, n.id)
						}, null, 40, ft), [[o, z.value]]), u("div", pt, [u("button", {
							class: "tpl:flex tpl:items-center tpl:justify-center tpl:rounded-md tpl:p-1.5 tpl:transition-colors tpl:duration-150 tpl:disabled:opacity-40 tpl:text-[var(--tpl-primary)]",
							disabled: !z.value.trim() || h(P).isSubmitting.value,
							onClick: (e) => kt(n.id)
						}, [v(h(w), {
							size: 14,
							"stroke-width": 2
						})], 8, mt), u("button", {
							class: "tpl:flex tpl:items-center tpl:justify-center tpl:rounded-md tpl:p-1.5 tpl:transition-colors tpl:duration-150 tpl:text-[var(--tpl-text-muted)]",
							onClick: r[11] ||= (e) => Ot()
						}, [v(h(E), {
							size: 14,
							"stroke-width": 2
						})])])])])) : p("", !0)]),
						_: 2
					}, 1024)
				]))), 128))]))]),
				u("div", ht, [wt.value ? (e(), d("div", gt, g(h(M).comments.saveTemplateFirst), 1)) : (e(), d("div", _t, [t(u("textarea", {
					ref_key: "newCommentInput",
					ref: W,
					"onUpdate:modelValue": r[12] ||= (e) => L.value = e,
					class: "tpl:max-h-24 tpl:min-h-[48px] tpl:flex-1 tpl:resize-none tpl:border-none tpl:bg-transparent tpl:font-sans tpl:text-xs tpl:outline-none tpl:text-[var(--tpl-text)]",
					placeholder: h(M).comments.placeholder,
					disabled: h(P).isSubmitting.value,
					rows: "2",
					onKeydown: Nt
				}, null, 40, vt), [[o, L.value]]), u("button", {
					class: "tpl-comments-send-btn tpl:flex tpl:shrink-0 tpl:items-center tpl:justify-center tpl:rounded-md tpl:p-1.5 tpl:transition-all tpl:duration-150 tpl:disabled:opacity-40 tpl:text-[var(--tpl-primary)]",
					disabled: !L.value.trim() || h(P).isSubmitting.value,
					onClick: Z
				}, [h(P).isSubmitting.value ? (e(), m(h(S), {
					key: 0,
					class: "tpl-spinner",
					size: 16,
					"stroke-width": 2
				})) : (e(), m(h(w), {
					key: 1,
					size: 16,
					"stroke-width": 2
				}))], 8, yt)]))])
			])) : p("", !0)]),
			_: 1
		}));
	}
}), [["__scopeId", "data-v-d204f573"]]);
//#endregion
export { k as default };
