1import{A as e,J as t,K as n,L as r,M as i,N as a,P as o,U as s,V as c,k as l,z as u}from"./index-Dd8_N7xu.js";var d=r(`<div class=peach-list-empty><span>loading...`),f=r(`<div class=peach-list-empty style="padding:48px 20px;flex-direction:column;gap:6px"><span style=font-size:13px;color:var(--peach-t1)>Trash is empty.</span><span style=font-size:11px;color:var(--peach-t2)>Deleted entries appear here before being removed permanently.`),p=r(`<span class=peach-trash-purge-confirm-label>delete all permanently?`),m=r(`<button class="peach-btn peach-btn--sm peach-btn--danger">yes`),h=r(`<button class="peach-btn peach-btn--ghost peach-btn--sm">cancel`),g=r(`<div class="peach-settings-group peach-trash-list"><p class=peach-settings-sub-label> </p><div class=peach-trash-footer>`),_=r(`<div class="peach-overlay-view ov-enter-right"style=display:flex><div class=peach-overlay-header><button class="peach-btn peach-btn--ghost peach-btn--sm peach-icon-btn"aria-label=Back><svg width=7 height=12 viewBox="0 0 7 12"fill=none stroke=currentColor stroke-width=1.1 stroke-linecap=round stroke-linejoin=round><path d="M6 1L1 6L6 11"></path></svg></button><span class=peach-overlay-title>trash</span><div class=peach-overlay-spacer></div></div><div class=peach-settings-body>`),v=r(`<button class="peach-btn peach-btn--sm peach-btn--danger">delete`),y=r(`<div class=peach-trash-entry-row><div class=peach-trash-entry-info><span class=peach-trash-entry-title></span><span class=peach-trash-entry-meta></span></div><div class=peach-trash-entry-actions><button class="peach-btn peach-btn--subtle peach-btn--sm">restore`),b=r(`<button class=peach-trash-delete-btn aria-label="Delete permanently">×`),x=r(`<button class=peach-trash-purge-all>permanently delete all`);function S(r){let[i,S]=n([]),[C,w]=n(!0),[T,E]=n(null),[D,O]=n(!1);t(async()=>{await k()});async function k(){w(!0),S((await l({type:`GET_DELETED_ENTRIES`})).data??[]),w(!1)}async function A(e){await l({type:`RESTORE_ENTRY`,payload:{id:e}}),r.onRestored(),await k()}async function j(e){await l({type:`PURGE_ENTRY`,payload:{id:e}}),E(null),await k()}async function M(){for(let e of i())await l({type:`PURGE_ENTRY`,payload:{id:e.id}});O(!1),await k()}function N(e){return e?new Date(e).toLocaleDateString(void 0,{month:`short`,day:`numeric`}):``}return(()=>{var t=_(),n=t.firstChild,l=n.firstChild,S=n.nextSibling;return e(l,`click`,r.onBack,!0),a(S,s(c,{get when(){return C()},get children(){return d()}}),null),a(S,s(c,{get when(){return o(()=>!C())()&&i().length===0},get children(){return f()}}),null),a(S,s(c,{get when(){return o(()=>!C())()&&i().length>0},get children(){var e=g(),t=e.firstChild,n=t.firstChild,r=t.nextSibling;return a(t,()=>i().length,n),a(t,()=>i().length===1?`entry`:`entries`,null),a(e,s(u,{get each(){return i()},children:e=>(()=>{var t=y(),n=t.firstChild,r=n.firstChild,i=r.nextSibling,l=n.nextSibling,u=l.firstChild;return a(r,()=>e.title),a(i,()=>N(e.deletedAt),null),a(i,(()=>{var t=o(()=>!!e.url);return()=>t()?` · ${e.url.replace(/^https?:\/\//,``).split(`/`)[0]}`:``})(),null),u.$$click=()=>void A(e.id),a(l,s(c,{get when(){return T()===e.id},get fallback(){return(()=>{var t=b();return t.$$click=()=>E(e.id),t})()},get children(){return[(()=>{var t=v();return t.$$click=()=>void j(e.id),t})(),(()=>{var e=h();return e.$$click=()=>E(null),e})()]}}),null),t})()}),r),a(r,s(c,{get when(){return D()},get fallback(){return(()=>{var e=x();return e.$$click=()=>O(!0),e})()},get children(){return[p(),(()=>{var e=m();return e.$$click=()=>void M(),e})(),(()=>{var e=h();return e.$$click=()=>O(!1),e})()]}})),e}}),null),t})()}i([`click`]);export{S as TrashView};