nextcloud/dist/files_trashbin-init.mjs
nextcloud-command 78098c8325 chore(assets): Recompile assets
Signed-off-by: nextcloud-command <nextcloud-command@users.noreply.github.com>
2026-04-01 13:41:02 +00:00

12 lines
6.5 KiB
JavaScript

import{C as c,V as _,b as v,c as x,a as V}from"./index-DMw01uN3.chunk.mjs";import{a as o,b as H,i as A,g as C,h as N,j as E,f as h}from"./index-Bp9-GhMo.chunk.mjs";import{c as u,i as S}from"./index-ClciYKp3.chunk.mjs";import{a as b,d as $,g as I}from"./index-C1xmmKTZ-CmvjJKkk.chunk.mjs";import{P as D}from"./folder-29HuacU_-GslSi8fz.chunk.mjs";import{g as y,b as f,t as n}from"./translation-DoG5ZELJ-DJHEP2RB.chunk.mjs";import{g as L,a as M,b as T,r as k,d as F}from"./dav-B4SnxxuE.chunk.mjs";import{f as B}from"./NcModal-kyWZ3UFC-BxKwwKAq.chunk.mjs";import{e as U}from"./preload-helper-DoJVKVMq.chunk.mjs";import{N as P}from"./NcUserBubble-BE6yD-R0-BVT_gW8E.chunk.mjs";import{l as O}from"./public-CvthP4YJ.chunk.mjs";import"./util-Caafb9Jl.chunk.mjs";import"./NcDialog-nDc1gW50-CpnK8gUQ.chunk.mjs";import"./NcIconSvgWrapper-De-2-ukl-CcvQeIAt.chunk.mjs";import"./mdi-BUoBIgaz.chunk.mjs";import"./Web-rJva_rmF.chunk.mjs";import"./TrashCanOutline-D66Xz3gd.chunk.mjs";import"./index-BDmvh1Np.chunk.mjs";import"./NcAvatar-ruClKRzS-D00PbCEA.chunk.mjs";import"./colors-BfjxNgsx-Dyl_2CuU.chunk.mjs";import"./NcUserStatusIcon-JWiuiAXe-BJYvYIQF.chunk.mjs";import"./PencilOutline-BzoFsBsK.chunk.mjs";import"./NcDateTime.vue_vue_type_script_setup_true_lang-B4upiZjL-L27IwP9h.chunk.mjs";const R='<svg xmlns="http://www.w3.org/2000/svg" id="mdi-history" viewBox="0 0 24 24"><path d="M13.5,8H12V13L16.28,15.54L17,14.33L13.5,12.25V8M13,3A9,9 0 0,0 4,12H1L4.96,16.03L9,12H6A7,7 0 0,1 13,5A7,7 0 0,1 20,12A7,7 0 0,1 13,19C11.07,19 9.32,18.21 8.06,16.94L6.64,18.36C8.27,20 10.5,21 13,21A9,9 0 0,0 22,12A9,9 0 0,0 13,3" /></svg>',j='<svg xmlns="http://www.w3.org/2000/svg" id="mdi-trash-can-outline" viewBox="0 0 24 24"><path d="M9,3V4H4V6H5V19A2,2 0 0,0 7,21H17A2,2 0 0,0 19,19V6H20V4H15V3H9M7,6H17V19H7V6M9,8V17H11V8H9M13,8V17H15V8H13Z" /></svg>',w=`/trashbin/${o()?.uid}/trash`,q=L(),z=`<?xml version="1.0"?>
<d:propfind ${M()}>
<d:prop>
<nc:trashbin-deletion-time />
<nc:trashbin-original-location />
<nc:trashbin-title />
<nc:trashbin-deleted-by-id />
<nc:trashbin-deleted-by-display-name />
${T()}
</d:prop>
</d:propfind>`;function K(i){const e=k(i,w);return e.attributes.previewUrl=H("/apps/files_trashbin/preview?fileId={fileid}&x=32&y=32",{fileid:e.fileid}),e}async function Y(i="/"){const e=(await q.getDirectoryContents(`${w}${i}`,{details:!0,data:z,includeSelf:!0})).data.map(K),[t]=e.splice(e.findIndex(r=>r.path===i),1);return{folder:t,contents:e}}const Z=new c({id:"files_trashbin--original-location",title:n("files_trashbin","Original location"),render(i){const e=l(i),t=document.createElement("span");return t.title=e,t.textContent=e,t},sort(i,e){const t=l(i),r=l(e);return t.localeCompare(r,[y(),f()],{numeric:!0,usage:"sort"})}}),G=new c({id:"files_trashbin--deleted-by",title:n("files_trashbin","Deleted by"),render(i){const{userId:e,displayName:t,label:r}=d(i);if(r){const a=document.createElement("span");return a.textContent=r,a}const s=document.createElement("div");return U(P,{size:32,user:e??void 0,displayName:t??e}).mount(s),s},sort(i,e){const t=d(i),r=t.label??t.displayName??t.userId,s=d(e),a=s.label??s.displayName??s.userId;return r.localeCompare(a,[y(),f()],{numeric:!0,usage:"sort"})}}),J=new c({id:"files_trashbin--deleted",title:n("files_trashbin","Deleted"),render(i){const e=i.attributes?.["trashbin-deletion-time"]||(i?.mtime?.getTime()??0)/1e3,t=document.createElement("span");if(e){const r=Intl.DateTimeFormat([f()],{dateStyle:"long",timeStyle:"short"}),s=new Date(e*1e3);return t.title=r.format(s),t.textContent=B(s,{ignoreSeconds:n("files","few seconds ago")}),t}return t.textContent=n("files_trashbin","A long time ago"),t},sort(i,e){const t=i.attributes?.["trashbin-deletion-time"]||(i?.mtime?.getTime()??0)/1e3;return(e.attributes?.["trashbin-deletion-time"]||(e?.mtime?.getTime()??0)/1e3)-t}});function l(i){const e=m(i.attributes?.["trashbin-original-location"]);if(!e)return n("files_trashbin","Unknown");const t=A(e);return t==="/"||t==="."?n("files_trashbin","All files"):t.replace(/^\//,"")}function d(i){const e=m(i.attributes?.["trashbin-deleted-by-id"]),t=m(i.attributes?.["trashbin-deleted-by-display-name"]);let r;const s=o()?.uid;return e===s&&(r=n("files_trashbin","You")),!e&&!t&&(r=n("files_trashbin","Unknown")),{userId:e,displayName:t,label:r}}function m(i){return i?String(i):null}const p="trashbin",Q=new _({id:p,name:n("files_trashbin","Deleted files"),caption:n("files_trashbin","List of files that have been deleted."),emptyTitle:n("files_trashbin","No deleted files"),emptyCaption:n("files_trashbin","Files and folders you have deleted will show up here"),icon:j,order:50,sticky:!0,defaultSortKey:"deleted",columns:[Z,G,J],getContents:Y}),g=C().setApp("files_trashbin").detectUser().build(),W={id:"restore",displayName(){return n("files_trashbin","Restore")},iconSvgInline:()=>R,enabled({nodes:i,view:e}){return e.id!==p?!1:i.length>0&&i.map(t=>t.permissions).every(t=>!!(t&D.READ))},async exec({nodes:i}){const e=i[0];try{const t=N(E(`dav/trashbin/${o().uid}/restore/${e.basename}`));return await u.request({method:"MOVE",url:e.encodedSource,headers:{destination:t}}),h("files:node:deleted",e),!0}catch(t){return S(t)&&t.response?.status===507&&b(n("files_trashbin","Not enough free space to restore the file/folder")),g.error("Failed to restore node",{error:t,node:e}),!1}},async execBatch({nodes:i,view:e,folder:t,contents:r}){return Promise.all(i.map(s=>this.exec({nodes:[s],view:e,folder:t,contents:r})))},order:1,inline:()=>!0};async function X(){try{return await u.delete(`${F}/trashbin/${o().uid}/trash`),$(n("files_trashbin","All files have been permanently deleted")),!0}catch(i){return b(n("files_trashbin","Failed to empty deleted files")),g.error("Failed to empty deleted files",{error:i}),!1}}const ee={id:"empty-trash",displayName:()=>n("files_trashbin","Empty deleted files"),order:0,enabled({view:i,folder:e,contents:t}){return i.id!==p||!O("files_trashbin","config").allow_delete?!1:t.length>0&&e.path==="/"},async exec({contents:i}){return await new Promise(e=>{I(n("files_trashbin","Confirm permanent deletion")).setSeverity("warning").setText(n("files_trashbin","Are you sure you want to permanently delete all files and folders in the trash? This cannot be undone.")).setButtons([{label:n("files_trashbin","Cancel"),variant:"secondary",callback:()=>e(!1)},{label:n("files_trashbin","Empty deleted files"),variant:"error",callback:()=>e(!0)}]).build().show().then(()=>{e(!1)})})===!0&&await X()&&i.forEach(e=>h("files:node:deleted",e)),null}},te=v();te.register(Q),x(ee),V(W);
//# sourceMappingURL=files_trashbin-init.mjs.map