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