(()=>{var e,t={79462:(e,t,n)=>{"use strict";var i=n(85072),r=n.n(i),l=n(97825),o=n.n(l),s=n(77659),a=n.n(s),d=n(55056),u=n.n(d),c=n(10540),v=n.n(c),b=n(41113),p=n.n(b),h=n(98290),f={};f.styleTagTransform=p(),f.setAttributes=u(),f.insert=a().bind(null,"head"),f.domAPI=o(),f.insertStyleElement=v(),r()(h.A,f),h.A&&h.A.locals&&h.A.locals;var m,y=n(53334),w=n(26304),g=n(63814),A=n(21777),x=n(63623);const _="/trashbin/".concat(null===(m=(0,A.HW)())||void 0===m?void 0:m.uid,"/trash"),T=(0,g.dC)("dav"+_),C=(0,x.UU)(T),H=e=>{C.setHeaders({"X-Requested-With":"XMLHttpRequest",requesttoken:null!=e?e:""})};(0,A.zo)(H),H((0,A.do)());const L=C,P='\n\n\t\n\t\t\n\t\t\n\t\t\n\t\t\n\t\t\n\t\t\n\t\t").concat((0,w.VX)(),"\n\t\n"),S=function(e){var t,n,i,r,l;const o=(0,w.vb)(null===(t=e.props)||void 0===t?void 0:t.permissions),s=null===(n=(0,A.HW)())||void 0===n?void 0:n.uid,a=(0,g.Jv)("/apps/files_trashbin/preview?fileId={fileid}&x=32&y=32",e.props),d={id:(null===(i=e.props)||void 0===i?void 0:i.fileid)||0,source:(0,g.dC)("dav"+_+e.filename),mime:e.mime,size:(null===(r=e.props)||void 0===r?void 0:r.size)||0,permissions:o,owner:s,root:_,attributes:{...e,...e.props,displayName:null===(l=e.props)||void 0===l?void 0:l["trashbin-filename"],previewUrl:a}};return delete d.attributes.props,"file"===e.type?new w.ZH(d):new w.vd(d)};var O=n(51651),N=n(71089),k=n(85471),D=n(92019);const I=e=>{var t,n;const i=void 0!==(null===(t=e.attributes)||void 0===t?void 0:t["trashbin-original-location"])?String(null===(n=e.attributes)||void 0===n?void 0:n["trashbin-original-location"]):null;if(!i)return(0,y.Tl)("files_trashbin","Unknown");const r=(0,N.pD)(i);return r===i?(0,y.Tl)("files_trashbin","All files"):r.replace(/^\//,"")},U=e=>{var t,n,i,r;const l=void 0!==(null===(t=e.attributes)||void 0===t?void 0:t["trashbin-deleted-by-id"])?String(null===(n=e.attributes)||void 0===n?void 0:n["trashbin-deleted-by-id"]):null,o=void 0!==(null===(i=e.attributes)||void 0===i?void 0:i["trashbin-deleted-by-display-name"])?String(null===(r=e.attributes)||void 0===r?void 0:r["trashbin-deleted-by-display-name"]):null,s=((e,t)=>{var n;return e===(null===(n=(0,A.HW)())||void 0===n?void 0:n.uid)?(0,y.Tl)("files_trashbin","You"):e||t?null:(0,y.Tl)("files_trashbin","Unknown")})(l,o);return{userId:l,displayName:o,label:s}},V=new w.VP({id:"original-location",title:(0,y.Tl)("files_trashbin","Original location"),render(e){const t=I(e),n=document.createElement("span");return n.title=t,n.textContent=t,n},sort(e,t){const n=I(e),i=I(t);return n.localeCompare(i)}}),j=new w.VP({id:"deleted-by",title:(0,y.Tl)("files_trashbin","Deleted by"),render(e){const{userId:t,displayName:n,label:i}=U(e);if(i){const e=document.createElement("span");return e.textContent=i,e}return new(k.Ay.extend(D.N))({propsData:{size:32,user:null!=t?t:void 0,displayName:null!=n?n:(0,y.Tl)("files_trashbin","Unknown")}}).$mount().$el},sort(e,t){var n,i,r,l;const o=null!==(n=null!==(i=U(e).label)&&void 0!==i?i:U(e).displayName)&&void 0!==n?n:(0,y.Tl)("files_trashbin","Unknown"),s=null!==(r=null!==(l=U(t).label)&&void 0!==l?l:U(t).displayName)&&void 0!==r?r:(0,y.Tl)("files_trashbin","Unknown");return o.localeCompare(s)}}),E=new w.VP({id:"deleted",title:(0,y.Tl)("files_trashbin","Deleted"),render(e){var t;const n=null===(t=e.attributes)||void 0===t?void 0:t["trashbin-deletion-time"],i=document.createElement("span");return n?(i.title=O.A.unix(n).format("LLL"),i.textContent=O.A.unix(n).fromNow(),i):(i.textContent=(0,y.Tl)("files_trashbin","A long time ago"),i)},sort(e,t){var n,i;const r=(null===(n=e.attributes)||void 0===n?void 0:n["trashbin-deletion-time"])||(null==e?void 0:e.mtime)||0;return((null===(i=t.attributes)||void 0===i?void 0:i["trashbin-deletion-time"])||(null==t?void 0:t.mtime)||0)-r}}),M=[V,j,E];var X=n(61338),R=n(65043);const G=(0,n(35947).YK)().setApp("files").detectUser().build();(0,w.Gg)(new w.hY({id:"restore",displayName:()=>(0,y.Tl)("files_trashbin","Restore"),iconSvgInline:()=>'',enabled:(e,t)=>"trashbin"===t.id&&e.length>0&&e.map((e=>e.permissions)).every((e=>0!=(e&w.aX.READ))),async exec(e){try{var t;const n=(0,g.dC)((0,N.O0)("dav/trashbin/".concat(null===(t=(0,A.HW)())||void 0===t?void 0:t.uid,"/restore/").concat(e.basename)));return await(0,R.Ay)({method:"MOVE",url:e.encodedSource,headers:{destination:n}}),(0,X.Ic)("files:node:deleted",e),!0}catch(e){return G.error(e),!1}},async execBatch(e,t,n){return Promise.all(e.map((e=>this.exec(e,t,n))))},order:1,inline:()=>!0})),(0,w.bh)().register(new w.Ss({id:"trashbin",name:(0,y.Tl)("files_trashbin","Deleted files"),caption:(0,y.Tl)("files_trashbin","List of files that have been deleted."),emptyTitle:(0,y.Tl)("files_trashbin","No deleted files"),emptyCaption:(0,y.Tl)("files_trashbin","Files and folders you have deleted will show up here"),icon:'',order:50,sticky:!0,defaultSortKey:"deleted",columns:M,getContents:async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"/";const t=await L.stat(e,{details:!0,data:P}),n=await L.getDirectoryContents(e,{details:!0,data:P});return{folder:S(t.data),contents:n.data.map(S)}}}))},98290:(e,t,n)=>{"use strict";n.d(t,{A:()=>s});var i=n(71354),r=n.n(i),l=n(76314),o=n.n(l)()(r());o.push([e.id,"/*!\n * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */.files-list__row-trashbin-original-location{width:150px !important}","",{version:3,sources:["webpack://./apps/files_trashbin/src/trashbin.scss"],names:[],mappings:"AAAA;;;EAAA,CAIA,4CACE,sBAAA",sourcesContent:["/*!\n * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\n.files-list__row-trashbin-original-location {\n width: 150px !important;\n}\n"],sourceRoot:""}]);const s=o},42634:()=>{},15340:()=>{},79838:()=>{}},n={};function i(e){var r=n[e];if(void 0!==r)return r.exports;var l=n[e]={id:e,loaded:!1,exports:{}};return t[e].call(l.exports,l,l.exports,i),l.loaded=!0,l.exports}i.m=t,e=[],i.O=(t,n,r,l)=>{if(!n){var o=1/0;for(u=0;u=l)&&Object.keys(i.O).every((e=>i.O[e](n[a])))?n.splice(a--,1):(s=!1,l0&&e[u-1][2]>l;u--)e[u]=e[u-1];e[u]=[n,r,l]},i.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return i.d(t,{a:t}),t},i.d=(e,t)=>{for(var n in t)i.o(t,n)&&!i.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},i.e=()=>Promise.resolve(),i.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),i.j=2573,(()=>{i.b=document.baseURI||self.location.href;var e={2573:0};i.O.j=t=>0===e[t];var t=(t,n)=>{var r,l,o=n[0],s=n[1],a=n[2],d=0;if(o.some((t=>0!==e[t]))){for(r in s)i.o(s,r)&&(i.m[r]=s[r]);if(a)var u=a(i)}for(t&&t(n);di(79462)));r=i.O(r)})();
//# sourceMappingURL=files_trashbin-init.js.map?v=7bbe7cf534a4b9113561