/*! For license information please see files_trashbin-init.js.LICENSE.txt */
(()=>{"use strict";var e,t={29276:(e,t,n)=>{var i=n(85072),r=n.n(i),o=n(97825),s=n.n(o),l=n(77659),a=n.n(l),d=n(55056),c=n.n(d),u=n(10540),p=n.n(u),v=n(41113),h=n.n(v),f=n(98290),b={};b.styleTagTransform=h(),b.setAttributes=c(),b.insert=a().bind(null,"head"),b.domAPI=s(),b.insertStyleElement=p(),r()(f.A,b),f.A&&f.A.locals&&f.A.locals;var m,g=n(53334),w=n(19231),y=n(78791),A=n(63814),x=n(21777),_=n(44719);const C="/trashbin/".concat(null===(m=(0,x.HW)())||void 0===m?void 0:m.uid,"/trash"),T=(0,A.dC)("dav"+C),H=(0,_.UU)(T),O=e=>{H.setHeaders({"X-Requested-With":"XMLHttpRequest",requesttoken:null!=e?e:""})};(0,x.zo)(O),O((0,x.do)());const L=H,S='\n\n\t\n\t\t\n\t\t\n\t\t\n\t\t\n\t\t").concat((0,y.VX)(),"\n\t\n"),P=function(e){var t,n,i,r,o;const s=(0,y.vb)(null===(t=e.props)||void 0===t?void 0:t.permissions),l=null===(n=(0,x.HW)())||void 0===n?void 0:n.uid,a=(0,A.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,A.dC)("dav"+C+e.filename),mime:e.mime,size:(null===(r=e.props)||void 0===r?void 0:r.size)||0,permissions:s,owner:l,root:C,attributes:{...e,...e.props,displayName:null===(o=e.props)||void 0===o?void 0:o["trashbin-filename"],previewUrl:a}};return delete d.attributes.props,"file"===e.type?new y.ZH(d):new y.vd(d)};var j=n(61338),k=n(26287);const M=(0,n(53529).YK)().setApp("files").detectUser().build();var V=n(71225);(0,y.Gg)(new y.hY({id:"restore",displayName:()=>(0,g.Tl)("files_trashbin","Restore"),iconSvgInline:()=>'',enabled:(e,t)=>"trashbin"===t.id&&e.length>0&&e.map((e=>e.permissions)).every((e=>!!(e&y.aX.READ))),async exec(e){try{var t;const n=(0,A.dC)((0,V.O0)("dav/trashbin/".concat(null===(t=(0,x.HW)())||void 0===t?void 0:t.uid,"/restore/").concat(e.basename)));return await(0,k.A)({method:"MOVE",url:e.encodedSource,headers:{destination:n}}),(0,j.Ic)("files:node:deleted",e),!0}catch(e){return M.error(e),!1}},async execBatch(e,t,n){return Promise.all(e.map((e=>this.exec(e,t,n))))},order:1,inline:()=>!0}));const E=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,g.Tl)("files_trashbin","Unknown");const r=(0,V.pD)(i);return r===i?(0,g.Tl)("files_trashbin","All files"):(0,V.HS)((0,g.Tl)("files_trashbin","All files"),r)};(0,y.bh)().register(new y.Ss({id:"trashbin",name:(0,g.Tl)("files_trashbin","Deleted files"),caption:(0,g.Tl)("files_trashbin","List of files that have been deleted."),emptyTitle:(0,g.Tl)("files_trashbin","No deleted files"),emptyCaption:(0,g.Tl)("files_trashbin","Files and folders you have deleted will show up here"),icon:'',order:50,sticky:!0,defaultSortKey:"deleted",columns:[new y.VP({id:"original-location",title:(0,g.Tl)("files_trashbin","Original location"),render(e){const t=E(e),n=document.createElement("span");return n.title=t,n.textContent=t,n},sort(e,t){const n=E(e),i=E(t);return n.localeCompare(i)}}),new y.VP({id:"deleted",title:(0,g.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=w.A.unix(n).format("LLL"),i.textContent=w.A.unix(n).fromNow(),i):(i.textContent=(0,g.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}})],getContents:async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"/";const t=await L.stat(e,{details:!0,data:S}),n=await L.getDirectoryContents(e,{details:!0,data:S});return{folder:P(t.data),contents:n.data.map(P)}}}))},98290:(e,t,n)=>{n.d(t,{A:()=>l});var i=n(71354),r=n.n(i),o=n(76314),s=n.n(o)()(r());s.push([e.id,".files-list__row-trashbin-original-location{width:150px !important}","",{version:3,sources:["webpack://./apps/files_trashbin/src/trashbin.scss"],names:[],mappings:"AAAA,4CACE,sBAAA",sourcesContent:[".files-list__row-trashbin-original-location {\n width: 150px !important;\n}\n"],sourceRoot:""}]);const l=s}},n={};function i(e){var r=n[e];if(void 0!==r)return r.exports;var o=n[e]={id:e,loaded:!1,exports:{}};return t[e].call(o.exports,o,o.exports,i),o.loaded=!0,o.exports}i.m=t,e=[],i.O=(t,n,r,o)=>{if(!n){var s=1/0;for(c=0;c=o)&&Object.keys(i.O).every((e=>i.O[e](n[a])))?n.splice(a--,1):(l=!1,o0&&e[c-1][2]>o;c--)e[c]=e[c-1];e[c]=[n,r,o]},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,o,s=n[0],l=n[1],a=n[2],d=0;if(s.some((t=>0!==e[t]))){for(r in l)i.o(l,r)&&(i.m[r]=l[r]);if(a)var c=a(i)}for(t&&t(n);di(29276)));r=i.O(r)})();
//# sourceMappingURL=files_trashbin-init.js.map?v=70a9f636c8c504cb7f54