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