import{$ as e,C as t,D as n,E as r,I as i,L as a,O as o,S as s,U as c,X as l,et as u,i as d,r as f,v as p,w as m,x as h}from"./app-C9PSrpEH.js";import{t as g}from"./i18n-CAfzuMJO.js";import{t as _}from"./AppLayout-C1MZgE5f.js";import{t as v}from"./EmptyState-7ulQscZa.js";var y={class:`mx-auto max-w-2xl px-4 py-8`},b={class:`mb-5 flex items-center justify-between`},x={class:`text-2xl font-extrabold tracking-tight text-ink`},S={key:0,class:`space-y-3`},C={class:`flex items-start gap-3`},w={class:`min-w-0 flex-1`},T={class:`flex flex-wrap items-center gap-2`},E={class:`truncate font-bold text-ink`},D={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`},O={key:1,class:`rounded-full bg-surface-2 px-2 py-0.5 text-[11px] font-bold text-ink-muted`},k={key:2,class:`rounded-full bg-surface-2 px-2 py-0.5 text-[11px] font-semibold text-ink-muted`},A={key:0,class:`mt-1 line-clamp-2 text-sm text-ink-2`},j={class:`mt-1 text-xs text-ink-muted`},M={class:`mt-3 flex flex-wrap items-center gap-2 border-t border-line pt-3`},N=[`onClick`],P=[`onClick`],F=o({__name:`Drafts`,props:{drafts:{}},setup(o){function F(e){u.post(`/drafts/${e}/publish`,{},{preserveScroll:!0})}function I(e){confirm(g(`Delete this draft? This can’t be undone.`))&&u.delete(`/drafts/${e}`,{preserveScroll:!0})}return(u,L)=>(i(),m(p,null,[n(l(f),{title:l(g)(`Drafts`)},null,8,[`title`]),n(_,null,{default:c(()=>[h(`div`,y,[h(`div`,b,[h(`h1`,x,e(l(g)(`Drafts & scheduled`)),1),n(l(d),{href:`/new`,class:`rounded-lg bg-primary px-4 py-2 text-sm font-semibold text-white hover:bg-primary-600`},{default:c(()=>[r(e(l(g)(`Start a topic`)),1)]),_:1})]),o.drafts.length?(i(),m(`div`,S,[(i(!0),m(p,null,a(o.drafts,a=>(i(),m(`div`,{key:a.id,class:`rounded-2xl border border-line bg-surface p-4`},[h(`div`,C,[h(`div`,w,[h(`div`,T,[h(`h3`,E,e(a.title),1),a.isScheduled?(i(),m(`span`,D,`🕑 `+e(l(g)(`Scheduled`))+` `+e(a.scheduledLabel),1)):(i(),m(`span`,O,e(l(g)(`Draft`)),1)),a.hasPoll?(i(),m(`span`,k,`📊 `+e(l(g)(`Poll`)),1)):t(``,!0)]),a.excerpt?(i(),m(`p`,A,e(a.excerpt),1)):t(``,!0),h(`p`,j,e(l(g)(`Edited {when}`,{when:a.updated})),1)])]),h(`div`,M,[n(l(d),{href:`/new?draft=${a.id}`,class:`rounded-lg bg-surface-2 px-3 py-1.5 text-sm font-semibold text-ink hover:bg-appbg`},{default:c(()=>[r(e(l(g)(`Edit`)),1)]),_:1},8,[`href`]),h(`button`,{type:`button`,class:`rounded-lg bg-primary px-3 py-1.5 text-sm font-semibold text-white hover:bg-primary-600`,onClick:e=>F(a.id)},e(a.isScheduled?l(g)(`Publish now`):l(g)(`Publish`)),9,N),h(`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:e=>I(a.id)},e(l(g)(`Delete`)),9,P)])]))),128))])):(i(),s(v,{key:1,icon:`📝`,title:l(g)(`No drafts yet`),body:l(g)(`Save a topic as a draft to finish later, or schedule it to publish at a set time.`)},{default:c(()=>[n(l(d),{href:`/new`,class:`rounded-lg bg-primary px-5 py-2.5 text-sm font-bold text-white hover:bg-primary-600`},{default:c(()=>[r(e(l(g)(`Start a topic`)),1)]),_:1})]),_:1},8,[`title`,`body`]))])]),_:1})],64))}});export{F as default};