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