import { a as usePage, i as useForm, n as head_default, o as vue_exports, r as link_default } from "../ssr.js";
import { t as Editor_default } from "./Editor-buEABZ1h.js";
import { n as server_renderer_exports, t } from "./i18n-CXLOYfyq.js";
import { t as toast } from "./toast-DMXj7c3P.js";
import { t as UploadButton_default } from "./UploadButton-Ci6PFd1I.js";
import { n as uploadImage } from "./upload-D2yiLNgi.js";
import { t as AppLayout_default } from "./AppLayout-VvVFrkTb.js";
//#region resources/js/Pages/Topic/Create.vue?vue&type=script&setup=true&lang.ts
var pollField = "w-full rounded-lg border-line bg-appbg text-sm text-ink placeholder:text-ink-muted focus:border-primary focus:ring-primary";
var Create_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ (0, vue_exports.defineComponent)({
	__name: "Create",
	__ssrInlineRender: true,
	props: {
		categories: {},
		tags: {},
		draft: {},
		autosave: {}
	},
	setup(__props) {
		const props = __props;
		const editor = (0, vue_exports.ref)(null);
		const uploadingCover = (0, vue_exports.ref)(false);
		const draftId = (0, vue_exports.ref)(props.draft?.id ?? null);
		const draftBody = props.draft?.body_html ?? "";
		const dp = props.draft?.poll ?? null;
		const poll = (0, vue_exports.reactive)({
			enabled: !!dp?.question,
			question: dp?.question ?? "",
			options: dp?.options && dp.options.length >= 2 ? [...dp.options] : ["", ""],
			multiple: !!dp?.multiple,
			closes_days: dp?.closes_days ?? null
		});
		function addOption() {
			if (poll.options.length < 10) poll.options.push("");
		}
		function removeOption(i) {
			if (poll.options.length > 2) poll.options.splice(i, 1);
		}
		const form = useForm({
			title: props.draft?.title ?? "",
			category_id: props.draft?.category_id ?? props.categories[0]?.id ?? null,
			tags: props.draft?.tags ?? [],
			cover: props.draft?.cover ?? "",
			body_html: "",
			body_json: ""
		});
		const showSchedule = (0, vue_exports.ref)(false);
		const scheduledAt = (0, vue_exports.ref)("");
		const pollPayload = () => {
			const opts = poll.options.map((o) => o.trim()).filter(Boolean);
			return poll.enabled && poll.question.trim() && opts.length >= 2 ? {
				question: poll.question.trim(),
				options: opts,
				multiple: poll.multiple,
				closes_days: poll.closes_days || null
			} : null;
		};
		const draftForm = useForm({
			draft_id: null,
			title: "",
			category_id: null,
			tags: [],
			cover: "",
			body_html: "",
			body_json: "",
			poll: null,
			scheduled_at: null
		});
		function saveDraft(schedule = false) {
			if (schedule && !scheduledAt.value) {
				showSchedule.value = true;
				return;
			}
			draftForm.draft_id = draftId.value;
			draftForm.title = form.title;
			draftForm.category_id = form.category_id;
			draftForm.tags = form.tags;
			draftForm.cover = form.cover;
			draftForm.body_html = editor.value?.getHTML() ?? "";
			draftForm.body_json = editor.value?.getJSON() ?? "";
			draftForm.poll = pollPayload();
			draftForm.scheduled_at = schedule ? scheduledAt.value : null;
			draftForm.post("/drafts");
		}
		const saveState = (0, vue_exports.ref)("idle");
		const savedAt = (0, vue_exports.ref)(props.autosave?.savedAt ?? null);
		const savedAgo = (0, vue_exports.ref)(props.autosave?.savedAgo ?? "");
		let autoTimer = null;
		let lastSig = "";
		function autoPayload() {
			return {
				title: form.title,
				category_id: form.category_id,
				tags: form.tags,
				cover: form.cover,
				body_html: editor.value?.getHTML() ?? "",
				body_json: editor.value?.getJSON() ?? "",
				poll: pollPayload()
			};
		}
		function isBlank(p) {
			return !String(p.title || "").trim() && !String(p.body_html || "").replace(/<[^>]+>/g, "").trim();
		}
		function scheduleAutosave() {
			if (autoTimer) clearTimeout(autoTimer);
			autoTimer = window.setTimeout(doAutosave, 2500);
		}
		async function doAutosave() {
			const payload = autoPayload();
			const sig = JSON.stringify(payload);
			if (sig === lastSig || isBlank(payload)) return;
			lastSig = sig;
			saveState.value = "saving";
			try {
				const d = await (await fetch("/drafts/autosave", {
					method: "POST",
					credentials: "include",
					headers: {
						"Content-Type": "application/json",
						Accept: "application/json",
						"X-CSRF-TOKEN": csrf()
					},
					body: sig
				})).json();
				if (d.saved) {
					savedAt.value = d.at;
					savedAgo.value = t("just now");
					saveState.value = "saved";
				} else saveState.value = "idle";
			} catch {
				saveState.value = "idle";
			}
		}
		(0, vue_exports.watch)(() => [
			form.title,
			form.category_id,
			form.tags.slice(),
			form.cover,
			poll.enabled,
			poll.question,
			poll.options.slice(),
			poll.multiple,
			poll.closes_days
		], scheduleAutosave, { deep: true });
		const showRestore = (0, vue_exports.ref)(!!props.autosave);
		function restoreAutosave() {
			const a = props.autosave;
			form.title = a.title ?? "";
			if (a.category_id != null) form.category_id = a.category_id;
			form.tags = (a.tags ?? []).slice();
			form.cover = a.cover ?? "";
			editor.value?.setHTML(a.body_html ?? "");
			if (a.poll?.question) {
				poll.enabled = true;
				poll.question = a.poll.question ?? "";
				poll.options = a.poll.options?.length >= 2 ? [...a.poll.options] : ["", ""];
				poll.multiple = !!a.poll.multiple;
				poll.closes_days = a.poll.closes_days ?? null;
			}
			showRestore.value = false;
		}
		async function discardAutosave() {
			showRestore.value = false;
			try {
				await fetch("/drafts/autosave", {
					method: "DELETE",
					credentials: "include",
					headers: {
						Accept: "application/json",
						"X-CSRF-TOKEN": csrf()
					}
				});
			} catch {}
		}
		const related = (0, vue_exports.ref)([]);
		let relTimer = null;
		function csrf() {
			return document.querySelector("meta[name=\"csrf-token\"]")?.content ?? "";
		}
		(0, vue_exports.watch)(() => form.title, (title) => {
			if (relTimer) clearTimeout(relTimer);
			const q = title.trim();
			if (q.length < 5) {
				related.value = [];
				return;
			}
			relTimer = window.setTimeout(async () => {
				try {
					const d = await (await fetch("/api/related", {
						method: "POST",
						headers: {
							"Content-Type": "application/json",
							Accept: "application/json",
							"X-CSRF-TOKEN": csrf()
						},
						body: JSON.stringify({ q })
					})).json();
					related.value = Array.isArray(d.related) ? d.related : [];
				} catch {}
			}, 450);
		});
		function toggleTag(id) {
			const i = form.tags.indexOf(id);
			if (i === -1) form.tags.push(id);
			else form.tags.splice(i, 1);
		}
		const aiEnabled = (0, vue_exports.computed)(() => !!usePage().props.ask?.enabled);
		const draftText = () => (editor.value?.getHTML() ?? "").replace(/<[^>]+>/g, " ").replace(/\s+/g, " ").trim();
		const titleSuggestions = (0, vue_exports.ref)([]);
		const suggestingTitle = (0, vue_exports.ref)(false);
		async function suggestTitle() {
			if (suggestingTitle.value) return;
			const text = draftText();
			if (text.length < 10) {
				toast(t("Write a bit of your post first — I’ll suggest a title from it."), "info");
				return;
			}
			suggestingTitle.value = true;
			titleSuggestions.value = [];
			try {
				titleSuggestions.value = (await (await fetch("/api/ai/suggest-title", {
					method: "POST",
					headers: {
						"Content-Type": "application/json",
						Accept: "application/json",
						"X-CSRF-TOKEN": csrf()
					},
					body: JSON.stringify({ text })
				})).json()).titles ?? [];
			} catch {} finally {
				suggestingTitle.value = false;
			}
		}
		const suggestingTags = (0, vue_exports.ref)(false);
		async function suggestTags() {
			if (suggestingTags.value) return;
			const text = draftText();
			if (text.length < 10) {
				toast(t("Write a bit of your post first — I’ll suggest tags from it."), "info");
				return;
			}
			suggestingTags.value = true;
			try {
				const names = (await (await fetch("/api/ai/suggest-tags", {
					method: "POST",
					headers: {
						"Content-Type": "application/json",
						Accept: "application/json",
						"X-CSRF-TOKEN": csrf()
					},
					body: JSON.stringify({
						text,
						title: form.title
					})
				})).json()).tags ?? [];
				for (const name of names) {
					const tag = props.tags.find((t) => t.name.toLowerCase() === name.toLowerCase());
					if (tag && !form.tags.includes(tag.id)) form.tags.push(tag.id);
				}
			} catch {} finally {
				suggestingTags.value = false;
			}
		}
		async function pickCover(file) {
			uploadingCover.value = true;
			try {
				const { url } = await uploadImage(file);
				form.cover = url;
			} catch {} finally {
				uploadingCover.value = false;
			}
		}
		function submit() {
			if (autoTimer) clearTimeout(autoTimer);
			if (!editor.value || editor.value.isEmpty()) {
				form.setError("body_html", t("Write something first."));
				return;
			}
			form.body_html = editor.value.getHTML();
			form.body_json = editor.value.getJSON();
			const opts = poll.options.map((o) => o.trim()).filter(Boolean);
			form.transform((data) => ({
				...data,
				draft_id: draftId.value,
				poll: poll.enabled && poll.question.trim() && opts.length >= 2 ? {
					question: poll.question.trim(),
					options: opts,
					multiple: poll.multiple,
					closes_days: poll.closes_days || null
				} : null
			}));
			form.post("/topics", { onFinish: () => form.transform((d) => d) });
		}
		return (_ctx, _push, _parent, _attrs) => {
			_push(`<!--[-->`);
			_push((0, server_renderer_exports.ssrRenderComponent)((0, vue_exports.unref)(head_default), { title: (0, vue_exports.unref)(t)("Start a topic") }, null, _parent));
			_push((0, server_renderer_exports.ssrRenderComponent)(AppLayout_default, null, {
				default: (0, vue_exports.withCtx)((_, _push, _parent, _scopeId) => {
					if (_push) {
						_push(`<div class="mx-auto max-w-[760px]"${_scopeId}><h1 class="mb-5 text-2xl font-extrabold tracking-tight"${_scopeId}>${(0, server_renderer_exports.ssrInterpolate)((0, vue_exports.unref)(t)("Start a topic"))}</h1>`);
						if (showRestore.value) _push(`<div class="mb-5 flex flex-wrap items-center gap-3 rounded-c border border-primary/30 bg-primary/[0.06] px-4 py-3"${_scopeId}><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" class="shrink-0 text-primary"${_scopeId}><path d="M3 12a9 9 0 1 0 9-9 9 9 0 0 0-6.4 2.6L3 8"${_scopeId}></path><path d="M3 3v5h5"${_scopeId}></path></svg><div class="min-w-0 flex-1 text-sm"${_scopeId}><span class="font-semibold text-ink"${_scopeId}>${(0, server_renderer_exports.ssrInterpolate)((0, vue_exports.unref)(t)("You have an unsaved draft"))}</span><span class="text-ink-2"${_scopeId}> · ${(0, server_renderer_exports.ssrInterpolate)((0, vue_exports.unref)(t)("autosaved {ago}", { ago: props.autosave?.savedAgo ?? (0, vue_exports.unref)(t)("recently") }))}</span></div><button type="button" class="rounded-lg bg-primary px-3 py-1.5 text-xs font-semibold text-white hover:bg-primary-600"${_scopeId}>${(0, server_renderer_exports.ssrInterpolate)((0, vue_exports.unref)(t)("Restore"))}</button><button type="button" class="rounded-lg border border-line bg-surface px-3 py-1.5 text-xs font-semibold text-ink-2 hover:bg-surface-2"${_scopeId}>${(0, server_renderer_exports.ssrInterpolate)((0, vue_exports.unref)(t)("Discard"))}</button></div>`);
						else _push(`<!---->`);
						_push(`<form class="space-y-5"${_scopeId}><div class="rounded-c border border-line bg-surface p-5"${_scopeId}><div class="flex items-center justify-between"${_scopeId}><label class="block text-sm font-semibold text-ink-2"${_scopeId}>${(0, server_renderer_exports.ssrInterpolate)((0, vue_exports.unref)(t)("Title"))}</label>`);
						if (aiEnabled.value) _push(`<button type="button"${(0, server_renderer_exports.ssrIncludeBooleanAttr)(suggestingTitle.value) ? " disabled" : ""} class="inline-flex items-center gap-1 text-xs font-semibold text-primary hover:underline disabled:opacity-50"${_scopeId}><svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"${_scopeId}><circle cx="12" cy="12" r="3"${_scopeId}></circle><path d="M12 3v3M12 18v3M3 12h3M18 12h3"${_scopeId}></path></svg> ${(0, server_renderer_exports.ssrInterpolate)(suggestingTitle.value ? (0, vue_exports.unref)(t)("Thinking…") : (0, vue_exports.unref)(t)("Suggest a title"))}</button>`);
						else _push(`<!---->`);
						_push(`</div><input${(0, server_renderer_exports.ssrRenderAttr)("value", (0, vue_exports.unref)(form).title)} type="text" maxlength="160"${(0, server_renderer_exports.ssrRenderAttr)("placeholder", (0, vue_exports.unref)(t)("What do you want to discuss?"))} class="mt-1.5 w-full rounded-lg border-line bg-surface-2 text-ink placeholder:text-ink-muted focus:border-primary focus:ring-primary"${_scopeId}>`);
						if ((0, vue_exports.unref)(form).errors.title) _push(`<p class="mt-1 text-sm text-red-500"${_scopeId}>${(0, server_renderer_exports.ssrInterpolate)((0, vue_exports.unref)(form).errors.title)}</p>`);
						else _push(`<!---->`);
						if (titleSuggestions.value.length) {
							_push(`<div class="mt-2 flex flex-wrap gap-2"${_scopeId}><!--[-->`);
							(0, server_renderer_exports.ssrRenderList)(titleSuggestions.value, (s, i) => {
								_push(`<button type="button" class="rounded-lg border border-primary/30 bg-primary/[0.06] px-2.5 py-1 text-left text-xs text-ink hover:bg-primary/10"${_scopeId}>${(0, server_renderer_exports.ssrInterpolate)(s)}</button>`);
							});
							_push(`<!--]--></div>`);
						} else _push(`<!---->`);
						if (related.value.length) {
							_push(`<div class="mt-3 rounded-lg border border-primary/25 bg-primary/[0.04] p-3"${_scopeId}><div class="mb-1.5 flex items-center gap-1.5 text-xs font-bold text-primary"${_scopeId}><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"${_scopeId}><circle cx="11" cy="11" r="7"${_scopeId}></circle><path d="m21 21-4.3-4.3"${_scopeId}></path></svg> ${(0, server_renderer_exports.ssrInterpolate)((0, vue_exports.unref)(t)("Already asked? These discussions might help:"))}</div><ul class="space-y-1"${_scopeId}><!--[-->`);
							(0, server_renderer_exports.ssrRenderList)(related.value, (r) => {
								_push(`<li${_scopeId}><a${(0, server_renderer_exports.ssrRenderAttr)("href", r.url)} target="_blank" class="text-sm font-semibold text-primary hover:underline"${_scopeId}>${(0, server_renderer_exports.ssrInterpolate)(r.title)}</a><span class="block truncate text-xs text-ink-muted"${_scopeId}>${(0, server_renderer_exports.ssrInterpolate)(r.snippet)}</span></li>`);
							});
							_push(`<!--]--></ul><p class="mt-1.5 text-[11px] text-ink-muted"${_scopeId}>${(0, server_renderer_exports.ssrInterpolate)((0, vue_exports.unref)(t)("Still different? Carry on — your question is welcome."))}</p></div>`);
						} else _push(`<!---->`);
						_push(`<label class="mt-4 block text-sm font-semibold text-ink-2"${_scopeId}>${(0, server_renderer_exports.ssrInterpolate)((0, vue_exports.unref)(t)("Category"))}</label><select class="mt-1.5 w-full rounded-lg border-line bg-surface-2 text-ink focus:border-primary focus:ring-primary"${_scopeId}><option${(0, server_renderer_exports.ssrRenderAttr)("value", null)}${(0, server_renderer_exports.ssrIncludeBooleanAttr)(Array.isArray((0, vue_exports.unref)(form).category_id) ? (0, server_renderer_exports.ssrLooseContain)((0, vue_exports.unref)(form).category_id, null) : (0, server_renderer_exports.ssrLooseEqual)((0, vue_exports.unref)(form).category_id, null)) ? " selected" : ""}${_scopeId}>${(0, server_renderer_exports.ssrInterpolate)((0, vue_exports.unref)(t)("— none —"))}</option><!--[-->`);
						(0, server_renderer_exports.ssrRenderList)(__props.categories, (c) => {
							_push(`<option${(0, server_renderer_exports.ssrRenderAttr)("value", c.id)}${(0, server_renderer_exports.ssrIncludeBooleanAttr)(Array.isArray((0, vue_exports.unref)(form).category_id) ? (0, server_renderer_exports.ssrLooseContain)((0, vue_exports.unref)(form).category_id, c.id) : (0, server_renderer_exports.ssrLooseEqual)((0, vue_exports.unref)(form).category_id, c.id)) ? " selected" : ""}${_scopeId}>${(0, server_renderer_exports.ssrInterpolate)(c.name)}</option>`);
						});
						_push(`<!--]--></select><div class="mt-4 flex items-center justify-between"${_scopeId}><label class="block text-sm font-semibold text-ink-2"${_scopeId}>${(0, server_renderer_exports.ssrInterpolate)((0, vue_exports.unref)(t)("Tags"))}</label>`);
						if (aiEnabled.value && __props.tags.length) _push(`<button type="button"${(0, server_renderer_exports.ssrIncludeBooleanAttr)(suggestingTags.value) ? " disabled" : ""} class="inline-flex items-center gap-1 text-xs font-semibold text-primary hover:underline disabled:opacity-50"${_scopeId}><svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"${_scopeId}><circle cx="12" cy="12" r="3"${_scopeId}></circle><path d="M12 3v3M12 18v3M3 12h3M18 12h3"${_scopeId}></path></svg> ${(0, server_renderer_exports.ssrInterpolate)(suggestingTags.value ? (0, vue_exports.unref)(t)("Thinking…") : (0, vue_exports.unref)(t)("Suggest tags"))}</button>`);
						else _push(`<!---->`);
						_push(`</div><div class="mt-2 flex flex-wrap gap-2"${_scopeId}><!--[-->`);
						(0, server_renderer_exports.ssrRenderList)(__props.tags, (t) => {
							_push(`<button type="button" class="${(0, server_renderer_exports.ssrRenderClass)([(0, vue_exports.unref)(form).tags.includes(t.id) ? "border-primary bg-primary/15 text-primary" : "border-line bg-surface-2 text-ink-2 hover:bg-surface", "rounded-full border px-3 py-1 text-xs font-semibold"])}"${_scopeId}>#${(0, server_renderer_exports.ssrInterpolate)(t.name)}</button>`);
						});
						_push(`<!--]-->`);
						if (!__props.tags.length) _push(`<span class="text-sm text-ink-muted"${_scopeId}>${(0, server_renderer_exports.ssrInterpolate)((0, vue_exports.unref)(t)("No tags yet."))}</span>`);
						else _push(`<!---->`);
						_push(`</div><label class="mt-4 block text-sm font-semibold text-ink-2"${_scopeId}>${(0, server_renderer_exports.ssrInterpolate)((0, vue_exports.unref)(t)("Cover image"))} <span class="font-normal text-ink-muted"${_scopeId}>${(0, server_renderer_exports.ssrInterpolate)((0, vue_exports.unref)(t)("(optional, for grid view)"))}</span></label><div class="mt-2 flex items-center gap-3"${_scopeId}>`);
						if ((0, vue_exports.unref)(form).cover) _push(`<img${(0, server_renderer_exports.ssrRenderAttr)("src", (0, vue_exports.unref)(form).cover)} alt="" class="h-14 w-24 rounded-lg object-cover"${_scopeId}>`);
						else _push(`<!---->`);
						_push((0, server_renderer_exports.ssrRenderComponent)(UploadButton_default, {
							uploading: uploadingCover.value,
							label: (0, vue_exports.unref)(t)("Choose cover"),
							accept: "image/*",
							onFile: pickCover
						}, null, _parent, _scopeId));
						_push(`</div><label class="mt-4 flex items-center gap-2 text-sm font-semibold text-ink-2"${_scopeId}><input${(0, server_renderer_exports.ssrIncludeBooleanAttr)(Array.isArray(poll.enabled) ? (0, server_renderer_exports.ssrLooseContain)(poll.enabled, null) : poll.enabled) ? " checked" : ""} type="checkbox" class="rounded border-line text-primary focus:ring-primary"${_scopeId}> ${(0, server_renderer_exports.ssrInterpolate)((0, vue_exports.unref)(t)("Add a poll"))}</label>`);
						if (poll.enabled) {
							_push(`<div class="mt-2 space-y-2.5 rounded-xl border border-line bg-surface-2/40 p-4"${_scopeId}><input${(0, server_renderer_exports.ssrRenderAttr)("value", poll.question)} type="text"${(0, server_renderer_exports.ssrRenderAttr)("placeholder", (0, vue_exports.unref)(t)("Ask a question…"))} class="${(0, server_renderer_exports.ssrRenderClass)(pollField)}" maxlength="200"${_scopeId}><!--[-->`);
							(0, server_renderer_exports.ssrRenderList)(poll.options, (o, i) => {
								_push(`<div class="flex items-center gap-2"${_scopeId}><input${(0, server_renderer_exports.ssrRenderAttr)("value", poll.options[i])} type="text"${(0, server_renderer_exports.ssrRenderAttr)("placeholder", (0, vue_exports.unref)(t)("Option {n}", { n: i + 1 }))} class="${(0, server_renderer_exports.ssrRenderClass)(pollField)}" maxlength="120"${_scopeId}>`);
								if (poll.options.length > 2) _push(`<button type="button" class="grid h-8 w-8 shrink-0 place-items-center rounded-lg text-ink-muted hover:bg-surface hover:text-red-500"${(0, server_renderer_exports.ssrRenderAttr)("aria-label", (0, vue_exports.unref)(t)("Remove"))}${_scopeId}>✕</button>`);
								else _push(`<!---->`);
								_push(`</div>`);
							});
							_push(`<!--]-->`);
							if (poll.options.length < 10) _push(`<button type="button" class="text-sm font-semibold text-primary hover:text-primary-600"${_scopeId}>+ ${(0, server_renderer_exports.ssrInterpolate)((0, vue_exports.unref)(t)("Add option"))}</button>`);
							else _push(`<!---->`);
							_push(`<div class="flex flex-wrap items-center gap-x-5 gap-y-2 border-t border-line pt-3"${_scopeId}><label class="flex items-center gap-2 text-sm text-ink-2"${_scopeId}><input${(0, server_renderer_exports.ssrIncludeBooleanAttr)(Array.isArray(poll.multiple) ? (0, server_renderer_exports.ssrLooseContain)(poll.multiple, null) : poll.multiple) ? " checked" : ""} type="checkbox" class="rounded border-line text-primary focus:ring-primary"${_scopeId}> ${(0, server_renderer_exports.ssrInterpolate)((0, vue_exports.unref)(t)("Allow multiple choices"))}</label><label class="flex items-center gap-2 text-sm text-ink-2"${_scopeId}>${(0, server_renderer_exports.ssrInterpolate)((0, vue_exports.unref)(t)("Close after"))} <input${(0, server_renderer_exports.ssrRenderAttr)("value", poll.closes_days)} type="number" min="1" max="365" class="w-16 rounded-lg border-line bg-appbg text-sm text-ink focus:border-primary focus:ring-primary"${_scopeId}> ${(0, server_renderer_exports.ssrInterpolate)((0, vue_exports.unref)(t)("days"))}</label></div></div>`);
						} else _push(`<!---->`);
						_push(`</div><div${_scopeId}><label class="mb-1.5 block text-sm font-semibold text-ink-2"${_scopeId}>${(0, server_renderer_exports.ssrInterpolate)((0, vue_exports.unref)(t)("Post"))}</label>`);
						_push((0, server_renderer_exports.ssrRenderComponent)(Editor_default, {
							ref_key: "editor",
							ref: editor,
							content: (0, vue_exports.unref)(draftBody),
							placeholder: (0, vue_exports.unref)(t)("Write your post… (rich text, drag images in)"),
							onTyping: scheduleAutosave
						}, null, _parent, _scopeId));
						if ((0, vue_exports.unref)(form).errors.body_html) _push(`<p class="mt-1 text-sm text-red-500"${_scopeId}>${(0, server_renderer_exports.ssrInterpolate)((0, vue_exports.unref)(form).errors.body_html)}</p>`);
						else _push(`<!---->`);
						_push(`</div>`);
						if (showSchedule.value) _push(`<div class="flex flex-wrap items-center gap-3 rounded-c border border-line bg-surface p-4"${_scopeId}><label class="text-sm font-semibold text-ink-2"${_scopeId}>${(0, server_renderer_exports.ssrInterpolate)((0, vue_exports.unref)(t)("Publish at"))}</label><input${(0, server_renderer_exports.ssrRenderAttr)("value", scheduledAt.value)} type="datetime-local" class="rounded-lg border-line bg-surface-2 text-sm text-ink focus:border-primary focus:ring-primary"${_scopeId}><button type="button"${(0, server_renderer_exports.ssrIncludeBooleanAttr)(!scheduledAt.value || (0, vue_exports.unref)(draftForm).processing) ? " disabled" : ""} class="rounded-lg bg-primary px-4 py-2 text-sm font-semibold text-white hover:bg-primary-600 disabled:opacity-50"${_scopeId}>${(0, server_renderer_exports.ssrInterpolate)((0, vue_exports.unref)(t)("Schedule post"))}</button><button type="button" class="text-sm text-ink-2 hover:text-ink"${_scopeId}>${(0, server_renderer_exports.ssrInterpolate)((0, vue_exports.unref)(t)("Cancel"))}</button></div>`);
						else _push(`<!---->`);
						_push(`<div class="flex flex-wrap items-center gap-3"${_scopeId}><button type="submit"${(0, server_renderer_exports.ssrIncludeBooleanAttr)((0, vue_exports.unref)(form).processing) ? " disabled" : ""} class="rounded-c bg-primary px-5 py-2.5 text-sm font-semibold text-white shadow-lg shadow-primary/30 hover:bg-primary-600 disabled:opacity-60"${_scopeId}>${(0, server_renderer_exports.ssrInterpolate)((0, vue_exports.unref)(form).processing ? (0, vue_exports.unref)(t)("Posting…") : (0, vue_exports.unref)(t)("Post topic"))}</button><button type="button"${(0, server_renderer_exports.ssrIncludeBooleanAttr)((0, vue_exports.unref)(draftForm).processing) ? " disabled" : ""} class="rounded-c border border-line bg-surface px-4 py-2.5 text-sm font-semibold text-ink-2 hover:bg-surface-2 disabled:opacity-60"${_scopeId}>${(0, server_renderer_exports.ssrInterpolate)((0, vue_exports.unref)(draftForm).processing ? (0, vue_exports.unref)(t)("Saving…") : draftId.value ? (0, vue_exports.unref)(t)("Update draft") : (0, vue_exports.unref)(t)("Save draft"))}</button><button type="button" class="rounded-c border border-line bg-surface px-4 py-2.5 text-sm font-semibold text-ink-2 hover:bg-surface-2"${_scopeId}> 🕑 ${(0, server_renderer_exports.ssrInterpolate)((0, vue_exports.unref)(t)("Schedule"))}</button><span class="ml-auto inline-flex items-center gap-1.5 text-xs text-ink-muted" aria-live="polite"${_scopeId}>`);
						if (saveState.value === "saving") _push(`<!--[--><svg class="animate-spin" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5"${_scopeId}><path d="M21 12a9 9 0 1 1-6.2-8.5" stroke-linecap="round"${_scopeId}></path></svg> ${(0, server_renderer_exports.ssrInterpolate)((0, vue_exports.unref)(t)("Saving…"))}<!--]-->`);
						else if (saveState.value === "saved") _push(`<!--[--><svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" class="text-emerald-500"${_scopeId}><path d="M20 6 9 17l-5-5" stroke-linecap="round" stroke-linejoin="round"${_scopeId}></path></svg> ${(0, server_renderer_exports.ssrInterpolate)((0, vue_exports.unref)(t)("Draft saved"))}<!--]-->`);
						else _push(`<!---->`);
						_push(`</span>`);
						_push((0, server_renderer_exports.ssrRenderComponent)((0, vue_exports.unref)(link_default), {
							href: "/drafts",
							class: "text-sm font-semibold text-ink-2 hover:text-ink"
						}, {
							default: (0, vue_exports.withCtx)((_, _push, _parent, _scopeId) => {
								if (_push) _push(`${(0, server_renderer_exports.ssrInterpolate)((0, vue_exports.unref)(t)("My drafts"))}`);
								else return [(0, vue_exports.createTextVNode)((0, vue_exports.toDisplayString)((0, vue_exports.unref)(t)("My drafts")), 1)];
							}),
							_: 1
						}, _parent, _scopeId));
						_push(`</div></form></div>`);
					} else return [(0, vue_exports.createVNode)("div", { class: "mx-auto max-w-[760px]" }, [
						(0, vue_exports.createVNode)("h1", { class: "mb-5 text-2xl font-extrabold tracking-tight" }, (0, vue_exports.toDisplayString)((0, vue_exports.unref)(t)("Start a topic")), 1),
						showRestore.value ? ((0, vue_exports.openBlock)(), (0, vue_exports.createBlock)("div", {
							key: 0,
							class: "mb-5 flex flex-wrap items-center gap-3 rounded-c border border-primary/30 bg-primary/[0.06] px-4 py-3"
						}, [
							((0, vue_exports.openBlock)(), (0, vue_exports.createBlock)("svg", {
								width: "18",
								height: "18",
								viewBox: "0 0 24 24",
								fill: "none",
								stroke: "currentColor",
								"stroke-width": "2",
								"stroke-linecap": "round",
								class: "shrink-0 text-primary"
							}, [(0, vue_exports.createVNode)("path", { d: "M3 12a9 9 0 1 0 9-9 9 9 0 0 0-6.4 2.6L3 8" }), (0, vue_exports.createVNode)("path", { d: "M3 3v5h5" })])),
							(0, vue_exports.createVNode)("div", { class: "min-w-0 flex-1 text-sm" }, [(0, vue_exports.createVNode)("span", { class: "font-semibold text-ink" }, (0, vue_exports.toDisplayString)((0, vue_exports.unref)(t)("You have an unsaved draft")), 1), (0, vue_exports.createVNode)("span", { class: "text-ink-2" }, " · " + (0, vue_exports.toDisplayString)((0, vue_exports.unref)(t)("autosaved {ago}", { ago: props.autosave?.savedAgo ?? (0, vue_exports.unref)(t)("recently") })), 1)]),
							(0, vue_exports.createVNode)("button", {
								type: "button",
								class: "rounded-lg bg-primary px-3 py-1.5 text-xs font-semibold text-white hover:bg-primary-600",
								onClick: restoreAutosave
							}, (0, vue_exports.toDisplayString)((0, vue_exports.unref)(t)("Restore")), 1),
							(0, vue_exports.createVNode)("button", {
								type: "button",
								class: "rounded-lg border border-line bg-surface px-3 py-1.5 text-xs font-semibold text-ink-2 hover:bg-surface-2",
								onClick: discardAutosave
							}, (0, vue_exports.toDisplayString)((0, vue_exports.unref)(t)("Discard")), 1)
						])) : (0, vue_exports.createCommentVNode)("", true),
						(0, vue_exports.createVNode)("form", {
							class: "space-y-5",
							onSubmit: (0, vue_exports.withModifiers)(submit, ["prevent"])
						}, [
							(0, vue_exports.createVNode)("div", { class: "rounded-c border border-line bg-surface p-5" }, [
								(0, vue_exports.createVNode)("div", { class: "flex items-center justify-between" }, [(0, vue_exports.createVNode)("label", { class: "block text-sm font-semibold text-ink-2" }, (0, vue_exports.toDisplayString)((0, vue_exports.unref)(t)("Title")), 1), aiEnabled.value ? ((0, vue_exports.openBlock)(), (0, vue_exports.createBlock)("button", {
									key: 0,
									type: "button",
									disabled: suggestingTitle.value,
									onClick: suggestTitle,
									class: "inline-flex items-center gap-1 text-xs font-semibold text-primary hover:underline disabled:opacity-50"
								}, [((0, vue_exports.openBlock)(), (0, vue_exports.createBlock)("svg", {
									width: "13",
									height: "13",
									viewBox: "0 0 24 24",
									fill: "none",
									stroke: "currentColor",
									"stroke-width": "2"
								}, [(0, vue_exports.createVNode)("circle", {
									cx: "12",
									cy: "12",
									r: "3"
								}), (0, vue_exports.createVNode)("path", { d: "M12 3v3M12 18v3M3 12h3M18 12h3" })])), (0, vue_exports.createTextVNode)(" " + (0, vue_exports.toDisplayString)(suggestingTitle.value ? (0, vue_exports.unref)(t)("Thinking…") : (0, vue_exports.unref)(t)("Suggest a title")), 1)], 8, ["disabled"])) : (0, vue_exports.createCommentVNode)("", true)]),
								(0, vue_exports.withDirectives)((0, vue_exports.createVNode)("input", {
									"onUpdate:modelValue": ($event) => (0, vue_exports.unref)(form).title = $event,
									type: "text",
									maxlength: "160",
									placeholder: (0, vue_exports.unref)(t)("What do you want to discuss?"),
									class: "mt-1.5 w-full rounded-lg border-line bg-surface-2 text-ink placeholder:text-ink-muted focus:border-primary focus:ring-primary"
								}, null, 8, ["onUpdate:modelValue", "placeholder"]), [[vue_exports.vModelText, (0, vue_exports.unref)(form).title]]),
								(0, vue_exports.unref)(form).errors.title ? ((0, vue_exports.openBlock)(), (0, vue_exports.createBlock)("p", {
									key: 0,
									class: "mt-1 text-sm text-red-500"
								}, (0, vue_exports.toDisplayString)((0, vue_exports.unref)(form).errors.title), 1)) : (0, vue_exports.createCommentVNode)("", true),
								titleSuggestions.value.length ? ((0, vue_exports.openBlock)(), (0, vue_exports.createBlock)("div", {
									key: 1,
									class: "mt-2 flex flex-wrap gap-2"
								}, [((0, vue_exports.openBlock)(true), (0, vue_exports.createBlock)(vue_exports.Fragment, null, (0, vue_exports.renderList)(titleSuggestions.value, (s, i) => {
									return (0, vue_exports.openBlock)(), (0, vue_exports.createBlock)("button", {
										key: i,
										type: "button",
										onClick: ($event) => {
											(0, vue_exports.unref)(form).title = s;
											titleSuggestions.value = [];
										},
										class: "rounded-lg border border-primary/30 bg-primary/[0.06] px-2.5 py-1 text-left text-xs text-ink hover:bg-primary/10"
									}, (0, vue_exports.toDisplayString)(s), 9, ["onClick"]);
								}), 128))])) : (0, vue_exports.createCommentVNode)("", true),
								related.value.length ? ((0, vue_exports.openBlock)(), (0, vue_exports.createBlock)("div", {
									key: 2,
									class: "mt-3 rounded-lg border border-primary/25 bg-primary/[0.04] p-3"
								}, [
									(0, vue_exports.createVNode)("div", { class: "mb-1.5 flex items-center gap-1.5 text-xs font-bold text-primary" }, [((0, vue_exports.openBlock)(), (0, vue_exports.createBlock)("svg", {
										width: "14",
										height: "14",
										viewBox: "0 0 24 24",
										fill: "none",
										stroke: "currentColor",
										"stroke-width": "2",
										"stroke-linecap": "round"
									}, [(0, vue_exports.createVNode)("circle", {
										cx: "11",
										cy: "11",
										r: "7"
									}), (0, vue_exports.createVNode)("path", { d: "m21 21-4.3-4.3" })])), (0, vue_exports.createTextVNode)(" " + (0, vue_exports.toDisplayString)((0, vue_exports.unref)(t)("Already asked? These discussions might help:")), 1)]),
									(0, vue_exports.createVNode)("ul", { class: "space-y-1" }, [((0, vue_exports.openBlock)(true), (0, vue_exports.createBlock)(vue_exports.Fragment, null, (0, vue_exports.renderList)(related.value, (r) => {
										return (0, vue_exports.openBlock)(), (0, vue_exports.createBlock)("li", { key: r.url }, [(0, vue_exports.createVNode)("a", {
											href: r.url,
											target: "_blank",
											class: "text-sm font-semibold text-primary hover:underline"
										}, (0, vue_exports.toDisplayString)(r.title), 9, ["href"]), (0, vue_exports.createVNode)("span", { class: "block truncate text-xs text-ink-muted" }, (0, vue_exports.toDisplayString)(r.snippet), 1)]);
									}), 128))]),
									(0, vue_exports.createVNode)("p", { class: "mt-1.5 text-[11px] text-ink-muted" }, (0, vue_exports.toDisplayString)((0, vue_exports.unref)(t)("Still different? Carry on — your question is welcome.")), 1)
								])) : (0, vue_exports.createCommentVNode)("", true),
								(0, vue_exports.createVNode)("label", { class: "mt-4 block text-sm font-semibold text-ink-2" }, (0, vue_exports.toDisplayString)((0, vue_exports.unref)(t)("Category")), 1),
								(0, vue_exports.withDirectives)((0, vue_exports.createVNode)("select", {
									"onUpdate:modelValue": ($event) => (0, vue_exports.unref)(form).category_id = $event,
									class: "mt-1.5 w-full rounded-lg border-line bg-surface-2 text-ink focus:border-primary focus:ring-primary"
								}, [(0, vue_exports.createVNode)("option", { value: null }, (0, vue_exports.toDisplayString)((0, vue_exports.unref)(t)("— none —")), 1), ((0, vue_exports.openBlock)(true), (0, vue_exports.createBlock)(vue_exports.Fragment, null, (0, vue_exports.renderList)(__props.categories, (c) => {
									return (0, vue_exports.openBlock)(), (0, vue_exports.createBlock)("option", {
										key: c.id,
										value: c.id
									}, (0, vue_exports.toDisplayString)(c.name), 9, ["value"]);
								}), 128))], 8, ["onUpdate:modelValue"]), [[vue_exports.vModelSelect, (0, vue_exports.unref)(form).category_id]]),
								(0, vue_exports.createVNode)("div", { class: "mt-4 flex items-center justify-between" }, [(0, vue_exports.createVNode)("label", { class: "block text-sm font-semibold text-ink-2" }, (0, vue_exports.toDisplayString)((0, vue_exports.unref)(t)("Tags")), 1), aiEnabled.value && __props.tags.length ? ((0, vue_exports.openBlock)(), (0, vue_exports.createBlock)("button", {
									key: 0,
									type: "button",
									disabled: suggestingTags.value,
									onClick: suggestTags,
									class: "inline-flex items-center gap-1 text-xs font-semibold text-primary hover:underline disabled:opacity-50"
								}, [((0, vue_exports.openBlock)(), (0, vue_exports.createBlock)("svg", {
									width: "13",
									height: "13",
									viewBox: "0 0 24 24",
									fill: "none",
									stroke: "currentColor",
									"stroke-width": "2"
								}, [(0, vue_exports.createVNode)("circle", {
									cx: "12",
									cy: "12",
									r: "3"
								}), (0, vue_exports.createVNode)("path", { d: "M12 3v3M12 18v3M3 12h3M18 12h3" })])), (0, vue_exports.createTextVNode)(" " + (0, vue_exports.toDisplayString)(suggestingTags.value ? (0, vue_exports.unref)(t)("Thinking…") : (0, vue_exports.unref)(t)("Suggest tags")), 1)], 8, ["disabled"])) : (0, vue_exports.createCommentVNode)("", true)]),
								(0, vue_exports.createVNode)("div", { class: "mt-2 flex flex-wrap gap-2" }, [((0, vue_exports.openBlock)(true), (0, vue_exports.createBlock)(vue_exports.Fragment, null, (0, vue_exports.renderList)(__props.tags, (t) => {
									return (0, vue_exports.openBlock)(), (0, vue_exports.createBlock)("button", {
										key: t.id,
										type: "button",
										class: ["rounded-full border px-3 py-1 text-xs font-semibold", (0, vue_exports.unref)(form).tags.includes(t.id) ? "border-primary bg-primary/15 text-primary" : "border-line bg-surface-2 text-ink-2 hover:bg-surface"],
										onClick: ($event) => toggleTag(t.id)
									}, "#" + (0, vue_exports.toDisplayString)(t.name), 11, ["onClick"]);
								}), 128)), !__props.tags.length ? ((0, vue_exports.openBlock)(), (0, vue_exports.createBlock)("span", {
									key: 0,
									class: "text-sm text-ink-muted"
								}, (0, vue_exports.toDisplayString)((0, vue_exports.unref)(t)("No tags yet.")), 1)) : (0, vue_exports.createCommentVNode)("", true)]),
								(0, vue_exports.createVNode)("label", { class: "mt-4 block text-sm font-semibold text-ink-2" }, [(0, vue_exports.createTextVNode)((0, vue_exports.toDisplayString)((0, vue_exports.unref)(t)("Cover image")) + " ", 1), (0, vue_exports.createVNode)("span", { class: "font-normal text-ink-muted" }, (0, vue_exports.toDisplayString)((0, vue_exports.unref)(t)("(optional, for grid view)")), 1)]),
								(0, vue_exports.createVNode)("div", { class: "mt-2 flex items-center gap-3" }, [(0, vue_exports.unref)(form).cover ? ((0, vue_exports.openBlock)(), (0, vue_exports.createBlock)("img", {
									key: 0,
									src: (0, vue_exports.unref)(form).cover,
									alt: "",
									class: "h-14 w-24 rounded-lg object-cover"
								}, null, 8, ["src"])) : (0, vue_exports.createCommentVNode)("", true), (0, vue_exports.createVNode)(UploadButton_default, {
									uploading: uploadingCover.value,
									label: (0, vue_exports.unref)(t)("Choose cover"),
									accept: "image/*",
									onFile: pickCover
								}, null, 8, ["uploading", "label"])]),
								(0, vue_exports.createVNode)("label", { class: "mt-4 flex items-center gap-2 text-sm font-semibold text-ink-2" }, [(0, vue_exports.withDirectives)((0, vue_exports.createVNode)("input", {
									"onUpdate:modelValue": ($event) => poll.enabled = $event,
									type: "checkbox",
									class: "rounded border-line text-primary focus:ring-primary"
								}, null, 8, ["onUpdate:modelValue"]), [[vue_exports.vModelCheckbox, poll.enabled]]), (0, vue_exports.createTextVNode)(" " + (0, vue_exports.toDisplayString)((0, vue_exports.unref)(t)("Add a poll")), 1)]),
								poll.enabled ? ((0, vue_exports.openBlock)(), (0, vue_exports.createBlock)("div", {
									key: 3,
									class: "mt-2 space-y-2.5 rounded-xl border border-line bg-surface-2/40 p-4"
								}, [
									(0, vue_exports.withDirectives)((0, vue_exports.createVNode)("input", {
										"onUpdate:modelValue": ($event) => poll.question = $event,
										type: "text",
										placeholder: (0, vue_exports.unref)(t)("Ask a question…"),
										class: pollField,
										maxlength: "200"
									}, null, 8, ["onUpdate:modelValue", "placeholder"]), [[vue_exports.vModelText, poll.question]]),
									((0, vue_exports.openBlock)(true), (0, vue_exports.createBlock)(vue_exports.Fragment, null, (0, vue_exports.renderList)(poll.options, (o, i) => {
										return (0, vue_exports.openBlock)(), (0, vue_exports.createBlock)("div", {
											key: i,
											class: "flex items-center gap-2"
										}, [(0, vue_exports.withDirectives)((0, vue_exports.createVNode)("input", {
											"onUpdate:modelValue": ($event) => poll.options[i] = $event,
											type: "text",
											placeholder: (0, vue_exports.unref)(t)("Option {n}", { n: i + 1 }),
											class: pollField,
											maxlength: "120"
										}, null, 8, ["onUpdate:modelValue", "placeholder"]), [[vue_exports.vModelText, poll.options[i]]]), poll.options.length > 2 ? ((0, vue_exports.openBlock)(), (0, vue_exports.createBlock)("button", {
											key: 0,
											type: "button",
											class: "grid h-8 w-8 shrink-0 place-items-center rounded-lg text-ink-muted hover:bg-surface hover:text-red-500",
											"aria-label": (0, vue_exports.unref)(t)("Remove"),
											onClick: ($event) => removeOption(i)
										}, "✕", 8, ["aria-label", "onClick"])) : (0, vue_exports.createCommentVNode)("", true)]);
									}), 128)),
									poll.options.length < 10 ? ((0, vue_exports.openBlock)(), (0, vue_exports.createBlock)("button", {
										key: 0,
										type: "button",
										class: "text-sm font-semibold text-primary hover:text-primary-600",
										onClick: addOption
									}, "+ " + (0, vue_exports.toDisplayString)((0, vue_exports.unref)(t)("Add option")), 1)) : (0, vue_exports.createCommentVNode)("", true),
									(0, vue_exports.createVNode)("div", { class: "flex flex-wrap items-center gap-x-5 gap-y-2 border-t border-line pt-3" }, [(0, vue_exports.createVNode)("label", { class: "flex items-center gap-2 text-sm text-ink-2" }, [(0, vue_exports.withDirectives)((0, vue_exports.createVNode)("input", {
										"onUpdate:modelValue": ($event) => poll.multiple = $event,
										type: "checkbox",
										class: "rounded border-line text-primary focus:ring-primary"
									}, null, 8, ["onUpdate:modelValue"]), [[vue_exports.vModelCheckbox, poll.multiple]]), (0, vue_exports.createTextVNode)(" " + (0, vue_exports.toDisplayString)((0, vue_exports.unref)(t)("Allow multiple choices")), 1)]), (0, vue_exports.createVNode)("label", { class: "flex items-center gap-2 text-sm text-ink-2" }, [
										(0, vue_exports.createTextVNode)((0, vue_exports.toDisplayString)((0, vue_exports.unref)(t)("Close after")) + " ", 1),
										(0, vue_exports.withDirectives)((0, vue_exports.createVNode)("input", {
											"onUpdate:modelValue": ($event) => poll.closes_days = $event,
											type: "number",
											min: "1",
											max: "365",
											class: "w-16 rounded-lg border-line bg-appbg text-sm text-ink focus:border-primary focus:ring-primary"
										}, null, 8, ["onUpdate:modelValue"]), [[
											vue_exports.vModelText,
											poll.closes_days,
											void 0,
											{ number: true }
										]]),
										(0, vue_exports.createTextVNode)(" " + (0, vue_exports.toDisplayString)((0, vue_exports.unref)(t)("days")), 1)
									])])
								])) : (0, vue_exports.createCommentVNode)("", true)
							]),
							(0, vue_exports.createVNode)("div", null, [
								(0, vue_exports.createVNode)("label", { class: "mb-1.5 block text-sm font-semibold text-ink-2" }, (0, vue_exports.toDisplayString)((0, vue_exports.unref)(t)("Post")), 1),
								(0, vue_exports.createVNode)(Editor_default, {
									ref_key: "editor",
									ref: editor,
									content: (0, vue_exports.unref)(draftBody),
									placeholder: (0, vue_exports.unref)(t)("Write your post… (rich text, drag images in)"),
									onTyping: scheduleAutosave
								}, null, 8, ["content", "placeholder"]),
								(0, vue_exports.unref)(form).errors.body_html ? ((0, vue_exports.openBlock)(), (0, vue_exports.createBlock)("p", {
									key: 0,
									class: "mt-1 text-sm text-red-500"
								}, (0, vue_exports.toDisplayString)((0, vue_exports.unref)(form).errors.body_html), 1)) : (0, vue_exports.createCommentVNode)("", true)
							]),
							showSchedule.value ? ((0, vue_exports.openBlock)(), (0, vue_exports.createBlock)("div", {
								key: 0,
								class: "flex flex-wrap items-center gap-3 rounded-c border border-line bg-surface p-4"
							}, [
								(0, vue_exports.createVNode)("label", { class: "text-sm font-semibold text-ink-2" }, (0, vue_exports.toDisplayString)((0, vue_exports.unref)(t)("Publish at")), 1),
								(0, vue_exports.withDirectives)((0, vue_exports.createVNode)("input", {
									"onUpdate:modelValue": ($event) => scheduledAt.value = $event,
									type: "datetime-local",
									class: "rounded-lg border-line bg-surface-2 text-sm text-ink focus:border-primary focus:ring-primary"
								}, null, 8, ["onUpdate:modelValue"]), [[vue_exports.vModelText, scheduledAt.value]]),
								(0, vue_exports.createVNode)("button", {
									type: "button",
									disabled: !scheduledAt.value || (0, vue_exports.unref)(draftForm).processing,
									class: "rounded-lg bg-primary px-4 py-2 text-sm font-semibold text-white hover:bg-primary-600 disabled:opacity-50",
									onClick: ($event) => saveDraft(true)
								}, (0, vue_exports.toDisplayString)((0, vue_exports.unref)(t)("Schedule post")), 9, ["disabled", "onClick"]),
								(0, vue_exports.createVNode)("button", {
									type: "button",
									class: "text-sm text-ink-2 hover:text-ink",
									onClick: ($event) => showSchedule.value = false
								}, (0, vue_exports.toDisplayString)((0, vue_exports.unref)(t)("Cancel")), 9, ["onClick"])
							])) : (0, vue_exports.createCommentVNode)("", true),
							(0, vue_exports.createVNode)("div", { class: "flex flex-wrap items-center gap-3" }, [
								(0, vue_exports.createVNode)("button", {
									type: "submit",
									disabled: (0, vue_exports.unref)(form).processing,
									class: "rounded-c bg-primary px-5 py-2.5 text-sm font-semibold text-white shadow-lg shadow-primary/30 hover:bg-primary-600 disabled:opacity-60"
								}, (0, vue_exports.toDisplayString)((0, vue_exports.unref)(form).processing ? (0, vue_exports.unref)(t)("Posting…") : (0, vue_exports.unref)(t)("Post topic")), 9, ["disabled"]),
								(0, vue_exports.createVNode)("button", {
									type: "button",
									disabled: (0, vue_exports.unref)(draftForm).processing,
									class: "rounded-c border border-line bg-surface px-4 py-2.5 text-sm font-semibold text-ink-2 hover:bg-surface-2 disabled:opacity-60",
									onClick: ($event) => saveDraft(false)
								}, (0, vue_exports.toDisplayString)((0, vue_exports.unref)(draftForm).processing ? (0, vue_exports.unref)(t)("Saving…") : draftId.value ? (0, vue_exports.unref)(t)("Update draft") : (0, vue_exports.unref)(t)("Save draft")), 9, ["disabled", "onClick"]),
								(0, vue_exports.createVNode)("button", {
									type: "button",
									class: "rounded-c border border-line bg-surface px-4 py-2.5 text-sm font-semibold text-ink-2 hover:bg-surface-2",
									onClick: ($event) => showSchedule.value = !showSchedule.value
								}, " 🕑 " + (0, vue_exports.toDisplayString)((0, vue_exports.unref)(t)("Schedule")), 9, ["onClick"]),
								(0, vue_exports.createVNode)("span", {
									class: "ml-auto inline-flex items-center gap-1.5 text-xs text-ink-muted",
									"aria-live": "polite"
								}, [saveState.value === "saving" ? ((0, vue_exports.openBlock)(), (0, vue_exports.createBlock)(vue_exports.Fragment, { key: 0 }, [((0, vue_exports.openBlock)(), (0, vue_exports.createBlock)("svg", {
									class: "animate-spin",
									width: "13",
									height: "13",
									viewBox: "0 0 24 24",
									fill: "none",
									stroke: "currentColor",
									"stroke-width": "2.5"
								}, [(0, vue_exports.createVNode)("path", {
									d: "M21 12a9 9 0 1 1-6.2-8.5",
									"stroke-linecap": "round"
								})])), (0, vue_exports.createTextVNode)(" " + (0, vue_exports.toDisplayString)((0, vue_exports.unref)(t)("Saving…")), 1)], 64)) : saveState.value === "saved" ? ((0, vue_exports.openBlock)(), (0, vue_exports.createBlock)(vue_exports.Fragment, { key: 1 }, [((0, vue_exports.openBlock)(), (0, vue_exports.createBlock)("svg", {
									width: "13",
									height: "13",
									viewBox: "0 0 24 24",
									fill: "none",
									stroke: "currentColor",
									"stroke-width": "2.5",
									class: "text-emerald-500"
								}, [(0, vue_exports.createVNode)("path", {
									d: "M20 6 9 17l-5-5",
									"stroke-linecap": "round",
									"stroke-linejoin": "round"
								})])), (0, vue_exports.createTextVNode)(" " + (0, vue_exports.toDisplayString)((0, vue_exports.unref)(t)("Draft saved")), 1)], 64)) : (0, vue_exports.createCommentVNode)("", true)]),
								(0, vue_exports.createVNode)((0, vue_exports.unref)(link_default), {
									href: "/drafts",
									class: "text-sm font-semibold text-ink-2 hover:text-ink"
								}, {
									default: (0, vue_exports.withCtx)(() => [(0, vue_exports.createTextVNode)((0, vue_exports.toDisplayString)((0, vue_exports.unref)(t)("My drafts")), 1)]),
									_: 1
								})
							])
						], 32)
					])];
				}),
				_: 1
			}, _parent));
			_push(`<!--]-->`);
		};
	}
});
//#endregion
//#region resources/js/Pages/Topic/Create.vue
var _sfc_setup = Create_vue_vue_type_script_setup_true_lang_default.setup;
Create_vue_vue_type_script_setup_true_lang_default.setup = (props, ctx) => {
	const ssrContext = (0, vue_exports.useSSRContext)();
	(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("resources/js/Pages/Topic/Create.vue");
	return _sfc_setup ? _sfc_setup(props, ctx) : void 0;
};
var Create_default = Create_vue_vue_type_script_setup_true_lang_default;
//#endregion
export { Create_default as default };
