nextcloud/dist/files_trashbin-init.mjs
Ferdinand Thiessen b4b5986be9 chore: compile assets
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
2026-01-27 23:52:40 +01:00

12 lines
6.5 KiB
JavaScript

import{C as c,V as _,F as v,a as x,g as V,b as H,c as A}from"./index-CE6ly_uD.chunk.mjs";import{a as o,g as C,e as p}from"./index-6_gsQFyp.chunk.mjs";import{c as u,i as N}from"./index-D9L8KHF3.chunk.mjs";import{a as b,d as E,g as S}from"./index-JpgrUA2Z-D4yQFKNw.chunk.mjs";import{t as n,g as y,a as f}from"./translation-DoG5ZELJ-2ffMJaM4.chunk.mjs";import{d as $,e as I,l as D}from"./index-xFugdZPW.chunk.mjs";import{g as L,d as M}from"./createElementId-DhjFt1I9-Bjk2333q.chunk.mjs";import{g as T,a as F,b as k,r as B,d as U}from"./dav-B62B0Btx.chunk.mjs";import{f as P}from"./index-Dzo4H_NA.chunk.mjs";import{h as O}from"./runtime-dom.esm-bundler-DSTOTAEf.chunk.mjs";import{N as R}from"./NcUserBubble-DPAmU2_J-B8QraJ_f.chunk.mjs";import{P as q}from"./folder-CeyZUHai-CVGj8rKf.chunk.mjs";import"./string_decoder-BO00msnV.chunk.mjs";import"./NcNoteCard-CVhtNL04-CdF6Qoal.chunk.mjs";import"./logger-D3RVzcfQ-iUjwSNGe.chunk.mjs";import"./index-BlJ76-SL.chunk.mjs";import"./mdi-kAZc0JKn.chunk.mjs";import"./NcAvatar-DmUGApWA-JvdYd-8p.chunk.mjs";import"./colors-Go3zmZRD-Bml2X1sg.chunk.mjs";import"./NcUserStatusIcon-CGEf7fej-CR1VhaiT.chunk.mjs";import"./PencilOutline-BPy7Lagu.chunk.mjs";import"./NcDateTime.vue_vue_type_script_setup_true_lang-BhB8yA4U-Bb9gAlar.chunk.mjs";const z='<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>',K='<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`,Y=T(),Z=`<?xml version="1.0"?>
<d:propfind ${F()}>
<d:prop>
<nc:trashbin-deletion-time />
<nc:trashbin-original-location />
<nc:trashbin-title />
<nc:trashbin-deleted-by-id />
<nc:trashbin-deleted-by-display-name />
${k()}
</d:prop>
</d:propfind>`;function j(i){const e=B(i,w);return e.attributes.previewUrl=L("/apps/files_trashbin/preview?fileId={fileid}&x=32&y=32",{fileid:e.fileid}),e}async function G(i="/"){const e=(await Y.getDirectoryContents(`${w}${i}`,{details:!0,data:Z,includeSelf:!0})).data.map(j),[t]=e.splice(e.findIndex(r=>r.path===i),1);return{folder:t,contents:e}}const J=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"})}}),Q=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 O(R,{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"})}}),W=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=P(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=$(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 h="trashbin",X=new _({id:h,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:K,order:50,sticky:!0,defaultSortKey:"deleted",columns:[J,Q,W],getContents:G}),g=C().setApp("files_trashbin").detectUser().build(),ee=new v({id:"restore",displayName(){return n("files_trashbin","Restore")},iconSvgInline:()=>z,enabled({nodes:i,view:e}){return e.id!==h?!1:i.length>0&&i.map(t=>t.permissions).every(t=>!!(t&q.READ))},async exec({nodes:i}){const e=i[0];try{const t=M(I(`dav/trashbin/${o().uid}/restore/${e.basename}`));return await u.request({method:"MOVE",url:e.encodedSource,headers:{destination:t}}),p("files:node:deleted",e),!0}catch(t){return N(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 te(){try{return await u.delete(`${U}/trashbin/${o().uid}/trash`),E(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 ie=new x({id:"empty-trash",displayName:()=>n("files_trashbin","Empty deleted files"),order:0,enabled({view:i,folder:e,contents:t}){return i.id!==h||!D("files_trashbin","config").allow_delete?!1:t.length>0&&e.path==="/"},async exec({contents:i}){return await new Promise(e=>{S(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 te()&&i.forEach(e=>p("files:node:deleted",e)),null}}),ne=V();ne.register(X),H(ie),A(ee);
//# sourceMappingURL=files_trashbin-init.mjs.map