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