import{a as i,t as s,v as n,x as r}from"./preload-helper-B5suVMXI.chunk.mjs";import{E as l,C as c}from"./index-jVniDJU4.chunk.mjs";import{N as a}from"./NcEmptyContent-N81-grsO.chunk.mjs";import{I as d,A as m,n as p}from"./icons-Du8Q1knx.chunk.mjs";import{F as u}from"./FileComponent-DWuxKJ_4.chunk.mjs";import{F as f,a as h}from"./FilesSelectionMixin-c2BhZHiC.chunk.mjs";const C=i({name:"CollectionContent",components:{AlertCircleOutline:m,ImageMultipleOutline:d,NcEmptyContent:a,FilesListViewer:h,FileComponent:u},mixins:[f],props:{collection:{type:Object,default:()=>{}},collectionFileIds:{type:Array,required:!0},loading:{type:Boolean,default:!1},allowSelection:{type:Boolean,default:!0},error:{type:[Error,Number],default:null}},setup(){return{isMobile:c()}},data(){return{appContent:document.getElementById("app-content-vue")}},computed:{files(){return this.$store.getters.files},sortedCollectionFileIds(){return this.collectionFileIds.toSorted((e,t)=>this.files[e].attributes.timestamp<this.files[t].attributes.timestamp?-1:1)}},mounted(){r("files:node:deleted",this.handleFileDeleted)},destroyed(){n("files:node:deleted",this.handleFileDeleted)},methods:{openViewer(e){window.OCA.Viewer.open({fileInfo:l(this.files[e]),list:this.sortedCollectionFileIds.map(t=>l(this.files[t]))})},handleFileDeleted({fileid:e}){this.$store.commit("removeFilesFromCollection",{collectionFileName:this.collection.root+this.collection.path,fileIdsToRemove:[e?.toString()]})},t:s}});var F=function(){var e=this,t=e._self._c;return e._self._setupProxy,e.collection===void 0&&!e.loading||e.error===404?t("NcEmptyContent",{staticClass:"empty-content-with-illustration",attrs:{name:e.t("photos","This collection does not exist")}},[t("ImageMultipleOutline",{attrs:{slot:"icon"},slot:"icon"})],1):e.error?t("NcEmptyContent",{attrs:{name:e.t("photos","An error occurred")}},[t("AlertCircleOutline",{attrs:{slot:"icon"},slot:"icon"})],1):t("div",{staticClass:"collection"},[e._t("header",null,{selectedFileIds:e.selectedFileIds,resetSelection:e.resetSelection}),e.sortedCollectionFileIds.length===0&&!e.loading?e._t("empty-content"):e._e(),e.collection!==void 0&&e.sortedCollectionFileIds.length>0?t("FilesListViewer",{staticClass:"collection__media",attrs:{"container-element":e.appContent,"file-ids":e.sortedCollectionFileIds,"base-height":e.isMobile?120:200,loading:e.loading},scopedSlots:e._u([{key:"default",fn:function({file:o}){return t("FileComponent",{attrs:{file:e.files[o.id],"allow-selection":e.allowSelection,selected:e.selection[o.id]===!0},on:{click:e.openViewer,"select-toggled":e.onFileSelectToggle}})}}],null,!1,2202403043)}):e._e()],2)},g=[],y=p(C,F,g,!1,null,"aecef337");const x=y.exports;export{x as C};
//# sourceMappingURL=CollectionContent-6SBWaXsG.chunk.mjs.map
