import{d as s,t as n,u as r,s as c}from"./vue.runtime.esm-Ct3_M7aQ.chunk.mjs";import{u as a}from"./video-BrTIeaIo.chunk.mjs";import{N as d}from"./NcEmptyContent-fSEzv6W7.chunk.mjs";import{j as m,z as p,n as u}from"./icons-VGG7keIQ.chunk.mjs";import{F as f}from"./FileComponent-BRrDlT2e.chunk.mjs";import{F as h,a as C}from"./FilesSelectionMixin-BKpOcwzO.chunk.mjs";import{ag as l}from"./index-C9rtWdw7.chunk.mjs";const F=s({name:"CollectionContent",components:{AlertCircleOutline:p,ImageMultipleOutline:m,NcEmptyContent:d,FilesListViewer:C,FileComponent:f},mixins:[h],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:a()}},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(){c("files:node:deleted",this.handleFileDeleted)},destroyed(){r("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:n}});var g=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,distance:i}){return t("FileComponent",{attrs:{file:e.files[o.id],"allow-selection":e.allowSelection,selected:e.selection[o.id]===!0,distance:i},on:{click:e.openViewer,"select-toggled":e.onFileSelectToggle}})}}],null,!1,1238834138)}):e._e()],2)},y=[],I=u(F,g,y,!1,null,"0c4cce4b");const x=I.exports;export{x as C};
//# sourceMappingURL=CollectionContent-BSqFCXDL.chunk.mjs.map
