import { n as head_default, o as vue_exports, r as link_default, s as router } from "../ssr.js";
import { n as server_renderer_exports, t } from "./i18n-CXLOYfyq.js";
import { t as AppLayout_default } from "./AppLayout-DbhjYK6s.js";
import { t as EmptyState_default } from "./EmptyState-DTbgInaI.js";
//#region resources/js/Pages/Drafts.vue?vue&type=script&setup=true&lang.ts
var Drafts_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ (0, vue_exports.defineComponent)({
	__name: "Drafts",
	__ssrInlineRender: true,
	props: { drafts: {} },
	setup(__props) {
		function publish(id) {
			router.post(`/drafts/${id}/publish`, {}, { preserveScroll: true });
		}
		function remove(id) {
			if (confirm(t("Delete this draft? This can’t be undone."))) router.delete(`/drafts/${id}`, { preserveScroll: true });
		}
		return (_ctx, _push, _parent, _attrs) => {
			_push(`<!--[-->`);
			_push((0, server_renderer_exports.ssrRenderComponent)((0, vue_exports.unref)(head_default), { title: (0, vue_exports.unref)(t)("Drafts") }, 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-2xl px-4 py-8"${_scopeId}><div class="mb-5 flex items-center justify-between"${_scopeId}><h1 class="text-2xl font-extrabold tracking-tight text-ink"${_scopeId}>${(0, server_renderer_exports.ssrInterpolate)((0, vue_exports.unref)(t)("Drafts & scheduled"))}</h1>`);
						_push((0, server_renderer_exports.ssrRenderComponent)((0, vue_exports.unref)(link_default), {
							href: "/new",
							class: "rounded-lg bg-primary px-4 py-2 text-sm font-semibold text-white hover:bg-primary-600"
						}, {
							default: (0, vue_exports.withCtx)((_, _push, _parent, _scopeId) => {
								if (_push) _push(`${(0, server_renderer_exports.ssrInterpolate)((0, vue_exports.unref)(t)("Start a topic"))}`);
								else return [(0, vue_exports.createTextVNode)((0, vue_exports.toDisplayString)((0, vue_exports.unref)(t)("Start a topic")), 1)];
							}),
							_: 1
						}, _parent, _scopeId));
						_push(`</div>`);
						if (__props.drafts.length) {
							_push(`<div class="space-y-3"${_scopeId}><!--[-->`);
							(0, server_renderer_exports.ssrRenderList)(__props.drafts, (d) => {
								_push(`<div class="rounded-2xl border border-line bg-surface p-4"${_scopeId}><div class="flex items-start gap-3"${_scopeId}><div class="min-w-0 flex-1"${_scopeId}><div class="flex flex-wrap items-center gap-2"${_scopeId}><h3 class="truncate font-bold text-ink"${_scopeId}>${(0, server_renderer_exports.ssrInterpolate)(d.title)}</h3>`);
								if (d.isScheduled) _push(`<span class="inline-flex items-center gap-1 rounded-full bg-primary/10 px-2 py-0.5 text-[11px] font-bold text-primary"${_scopeId}>🕑 ${(0, server_renderer_exports.ssrInterpolate)((0, vue_exports.unref)(t)("Scheduled"))} ${(0, server_renderer_exports.ssrInterpolate)(d.scheduledLabel)}</span>`);
								else _push(`<span class="rounded-full bg-surface-2 px-2 py-0.5 text-[11px] font-bold text-ink-muted"${_scopeId}>${(0, server_renderer_exports.ssrInterpolate)((0, vue_exports.unref)(t)("Draft"))}</span>`);
								if (d.hasPoll) _push(`<span class="rounded-full bg-surface-2 px-2 py-0.5 text-[11px] font-semibold text-ink-muted"${_scopeId}>📊 ${(0, server_renderer_exports.ssrInterpolate)((0, vue_exports.unref)(t)("Poll"))}</span>`);
								else _push(`<!---->`);
								_push(`</div>`);
								if (d.excerpt) _push(`<p class="mt-1 line-clamp-2 text-sm text-ink-2"${_scopeId}>${(0, server_renderer_exports.ssrInterpolate)(d.excerpt)}</p>`);
								else _push(`<!---->`);
								_push(`<p class="mt-1 text-xs text-ink-muted"${_scopeId}>${(0, server_renderer_exports.ssrInterpolate)((0, vue_exports.unref)(t)("Edited {when}", { when: d.updated }))}</p></div></div><div class="mt-3 flex flex-wrap items-center gap-2 border-t border-line pt-3"${_scopeId}>`);
								_push((0, server_renderer_exports.ssrRenderComponent)((0, vue_exports.unref)(link_default), {
									href: `/new?draft=${d.id}`,
									class: "rounded-lg bg-surface-2 px-3 py-1.5 text-sm font-semibold text-ink hover:bg-appbg"
								}, {
									default: (0, vue_exports.withCtx)((_, _push, _parent, _scopeId) => {
										if (_push) _push(`${(0, server_renderer_exports.ssrInterpolate)((0, vue_exports.unref)(t)("Edit"))}`);
										else return [(0, vue_exports.createTextVNode)((0, vue_exports.toDisplayString)((0, vue_exports.unref)(t)("Edit")), 1)];
									}),
									_: 2
								}, _parent, _scopeId));
								_push(`<button type="button" class="rounded-lg bg-primary px-3 py-1.5 text-sm font-semibold text-white hover:bg-primary-600"${_scopeId}>${(0, server_renderer_exports.ssrInterpolate)(d.isScheduled ? (0, vue_exports.unref)(t)("Publish now") : (0, vue_exports.unref)(t)("Publish"))}</button><button type="button" class="ml-auto rounded-lg px-3 py-1.5 text-sm font-semibold text-ink-2 hover:text-red-500"${_scopeId}>${(0, server_renderer_exports.ssrInterpolate)((0, vue_exports.unref)(t)("Delete"))}</button></div></div>`);
							});
							_push(`<!--]--></div>`);
						} else _push((0, server_renderer_exports.ssrRenderComponent)(EmptyState_default, {
							icon: "📝",
							title: (0, vue_exports.unref)(t)("No drafts yet"),
							body: (0, vue_exports.unref)(t)("Save a topic as a draft to finish later, or schedule it to publish at a set time.")
						}, {
							default: (0, vue_exports.withCtx)((_, _push, _parent, _scopeId) => {
								if (_push) _push((0, server_renderer_exports.ssrRenderComponent)((0, vue_exports.unref)(link_default), {
									href: "/new",
									class: "rounded-lg bg-primary px-5 py-2.5 text-sm font-bold text-white hover:bg-primary-600"
								}, {
									default: (0, vue_exports.withCtx)((_, _push, _parent, _scopeId) => {
										if (_push) _push(`${(0, server_renderer_exports.ssrInterpolate)((0, vue_exports.unref)(t)("Start a topic"))}`);
										else return [(0, vue_exports.createTextVNode)((0, vue_exports.toDisplayString)((0, vue_exports.unref)(t)("Start a topic")), 1)];
									}),
									_: 1
								}, _parent, _scopeId));
								else return [(0, vue_exports.createVNode)((0, vue_exports.unref)(link_default), {
									href: "/new",
									class: "rounded-lg bg-primary px-5 py-2.5 text-sm font-bold text-white hover:bg-primary-600"
								}, {
									default: (0, vue_exports.withCtx)(() => [(0, vue_exports.createTextVNode)((0, vue_exports.toDisplayString)((0, vue_exports.unref)(t)("Start a topic")), 1)]),
									_: 1
								})];
							}),
							_: 1
						}, _parent, _scopeId));
						_push(`</div>`);
					} else return [(0, vue_exports.createVNode)("div", { class: "mx-auto max-w-2xl px-4 py-8" }, [(0, vue_exports.createVNode)("div", { class: "mb-5 flex items-center justify-between" }, [(0, vue_exports.createVNode)("h1", { class: "text-2xl font-extrabold tracking-tight text-ink" }, (0, vue_exports.toDisplayString)((0, vue_exports.unref)(t)("Drafts & scheduled")), 1), (0, vue_exports.createVNode)((0, vue_exports.unref)(link_default), {
						href: "/new",
						class: "rounded-lg bg-primary px-4 py-2 text-sm font-semibold text-white hover:bg-primary-600"
					}, {
						default: (0, vue_exports.withCtx)(() => [(0, vue_exports.createTextVNode)((0, vue_exports.toDisplayString)((0, vue_exports.unref)(t)("Start a topic")), 1)]),
						_: 1
					})]), __props.drafts.length ? ((0, vue_exports.openBlock)(), (0, vue_exports.createBlock)("div", {
						key: 0,
						class: "space-y-3"
					}, [((0, vue_exports.openBlock)(true), (0, vue_exports.createBlock)(vue_exports.Fragment, null, (0, vue_exports.renderList)(__props.drafts, (d) => {
						return (0, vue_exports.openBlock)(), (0, vue_exports.createBlock)("div", {
							key: d.id,
							class: "rounded-2xl border border-line bg-surface p-4"
						}, [(0, vue_exports.createVNode)("div", { class: "flex items-start gap-3" }, [(0, vue_exports.createVNode)("div", { class: "min-w-0 flex-1" }, [
							(0, vue_exports.createVNode)("div", { class: "flex flex-wrap items-center gap-2" }, [
								(0, vue_exports.createVNode)("h3", { class: "truncate font-bold text-ink" }, (0, vue_exports.toDisplayString)(d.title), 1),
								d.isScheduled ? ((0, vue_exports.openBlock)(), (0, vue_exports.createBlock)("span", {
									key: 0,
									class: "inline-flex items-center gap-1 rounded-full bg-primary/10 px-2 py-0.5 text-[11px] font-bold text-primary"
								}, "🕑 " + (0, vue_exports.toDisplayString)((0, vue_exports.unref)(t)("Scheduled")) + " " + (0, vue_exports.toDisplayString)(d.scheduledLabel), 1)) : ((0, vue_exports.openBlock)(), (0, vue_exports.createBlock)("span", {
									key: 1,
									class: "rounded-full bg-surface-2 px-2 py-0.5 text-[11px] font-bold text-ink-muted"
								}, (0, vue_exports.toDisplayString)((0, vue_exports.unref)(t)("Draft")), 1)),
								d.hasPoll ? ((0, vue_exports.openBlock)(), (0, vue_exports.createBlock)("span", {
									key: 2,
									class: "rounded-full bg-surface-2 px-2 py-0.5 text-[11px] font-semibold text-ink-muted"
								}, "📊 " + (0, vue_exports.toDisplayString)((0, vue_exports.unref)(t)("Poll")), 1)) : (0, vue_exports.createCommentVNode)("", true)
							]),
							d.excerpt ? ((0, vue_exports.openBlock)(), (0, vue_exports.createBlock)("p", {
								key: 0,
								class: "mt-1 line-clamp-2 text-sm text-ink-2"
							}, (0, vue_exports.toDisplayString)(d.excerpt), 1)) : (0, vue_exports.createCommentVNode)("", true),
							(0, vue_exports.createVNode)("p", { class: "mt-1 text-xs text-ink-muted" }, (0, vue_exports.toDisplayString)((0, vue_exports.unref)(t)("Edited {when}", { when: d.updated })), 1)
						])]), (0, vue_exports.createVNode)("div", { class: "mt-3 flex flex-wrap items-center gap-2 border-t border-line pt-3" }, [
							(0, vue_exports.createVNode)((0, vue_exports.unref)(link_default), {
								href: `/new?draft=${d.id}`,
								class: "rounded-lg bg-surface-2 px-3 py-1.5 text-sm font-semibold text-ink hover:bg-appbg"
							}, {
								default: (0, vue_exports.withCtx)(() => [(0, vue_exports.createTextVNode)((0, vue_exports.toDisplayString)((0, vue_exports.unref)(t)("Edit")), 1)]),
								_: 1
							}, 8, ["href"]),
							(0, vue_exports.createVNode)("button", {
								type: "button",
								class: "rounded-lg bg-primary px-3 py-1.5 text-sm font-semibold text-white hover:bg-primary-600",
								onClick: ($event) => publish(d.id)
							}, (0, vue_exports.toDisplayString)(d.isScheduled ? (0, vue_exports.unref)(t)("Publish now") : (0, vue_exports.unref)(t)("Publish")), 9, ["onClick"]),
							(0, vue_exports.createVNode)("button", {
								type: "button",
								class: "ml-auto rounded-lg px-3 py-1.5 text-sm font-semibold text-ink-2 hover:text-red-500",
								onClick: ($event) => remove(d.id)
							}, (0, vue_exports.toDisplayString)((0, vue_exports.unref)(t)("Delete")), 9, ["onClick"])
						])]);
					}), 128))])) : ((0, vue_exports.openBlock)(), (0, vue_exports.createBlock)(EmptyState_default, {
						key: 1,
						icon: "📝",
						title: (0, vue_exports.unref)(t)("No drafts yet"),
						body: (0, vue_exports.unref)(t)("Save a topic as a draft to finish later, or schedule it to publish at a set time.")
					}, {
						default: (0, vue_exports.withCtx)(() => [(0, vue_exports.createVNode)((0, vue_exports.unref)(link_default), {
							href: "/new",
							class: "rounded-lg bg-primary px-5 py-2.5 text-sm font-bold text-white hover:bg-primary-600"
						}, {
							default: (0, vue_exports.withCtx)(() => [(0, vue_exports.createTextVNode)((0, vue_exports.toDisplayString)((0, vue_exports.unref)(t)("Start a topic")), 1)]),
							_: 1
						})]),
						_: 1
					}, 8, ["title", "body"]))])];
				}),
				_: 1
			}, _parent));
			_push(`<!--]-->`);
		};
	}
});
//#endregion
//#region resources/js/Pages/Drafts.vue
var _sfc_setup = Drafts_vue_vue_type_script_setup_true_lang_default.setup;
Drafts_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/Drafts.vue");
	return _sfc_setup ? _sfc_setup(props, ctx) : void 0;
};
var Drafts_default = Drafts_vue_vue_type_script_setup_true_lang_default;
//#endregion
export { Drafts_default as default };
