1import{D as e,I as t,P as n,S as r,T as i,b as a,j as o,k as s,t as c,v as l,x as u}from"./index-DzIQx4Cf.js";var d=i(`<div class=peach-list-empty><span>loading...`),f=i(`<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=i(`<span class=peach-trash-purge-confirm-label>delete all permanently?`),m=i(`<button class="peach-btn peach-btn--sm peach-btn--danger">yes`),h=i(`<button class="peach-btn peach-btn--ghost peach-btn--sm">cancel`),g=i(`<div class="peach-settings-group peach-trash-list"><p class=peach-settings-sub-label> </p><div class=peach-trash-footer>`),_=i(`<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=i(`<button class="peach-btn peach-btn--sm peach-btn--danger">delete`),y=i(`<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=i(`<button class=peach-trash-delete-btn aria-label="Delete permanently">×`),x=i(`<button class=peach-trash-purge-all>permanently delete all`);function S(i){let[a,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 c({type:`GET_DELETED_ENTRIES`})).data??[]),w(!1)}async function A(e){await c({type:`RESTORE_ENTRY`,payload:{id:e}}),i.onRestored(),await k()}async function j(e){await c({type:`PURGE_ENTRY`,payload:{id:e}}),E(null),await k()}async function M(){for(let e of a())await c({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,c=n.firstChild,S=n.nextSibling;return l(c,`click`,i.onBack,!0),u(S,o(s,{get when(){return C()},get children(){return d()}}),null),u(S,o(s,{get when(){return r(()=>!C())()&&a().length===0},get children(){return f()}}),null),u(S,o(s,{get when(){return r(()=>!C())()&&a().length>0},get children(){var t=g(),n=t.firstChild,i=n.firstChild,c=n.nextSibling;return u(n,()=>a().length,i),u(n,()=>a().length===1?`entry`:`entries`,null),u(t,o(e,{get each(){return a()},children:e=>(()=>{var t=y(),n=t.firstChild,i=n.firstChild,a=i.nextSibling,c=n.nextSibling,l=c.firstChild;return u(i,()=>e.title),u(a,()=>N(e.deletedAt),null),u(a,(()=>{var t=r(()=>!!e.url);return()=>t()?` · ${e.url.replace(/^https?:\/\//,``).split(`/`)[0]}`:``})(),null),l.$$click=()=>void A(e.id),u(c,o(s,{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})()}),c),u(c,o(s,{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})()]}})),t}}),null),t})()}a([`click`]);export{S as TrashView};