import{f as i,t as a}from"./preload-helper-DadE4qT2.chunk.mjs";import{x as n,y as r,C as o,l,A as c}from"./index-CTabiXQG.chunk.mjs";import{N as h}from"./NcActionButton-DykQxmXJ-CTbph1Ex.chunk.mjs";import{N as p}from"./NcEmptyContent-nvOtdNB6.chunk.mjs";import{f as g,n as d}from"./icons-CFZwNZD8.chunk.mjs";import{F as f}from"./FileComponent-BmXNe-6G.chunk.mjs";import{F as m,a as u}from"./FilesSelectionMixin-BtEPrG8Q.chunk.mjs";import{A as C}from"./AbortControllerMixin-Bb5X6Yae.chunk.mjs";import"./index-BCevi9E9.chunk.mjs";import"./createElementId-DhjFt1I9-B2HCdIOx.chunk.mjs";import"./NcCheckboxRadioSwitch-DAPHFb0L-DRvwoVpz.chunk.mjs";import"./useModelMigration-EhAWvqDD-Zhby4giX.chunk.mjs";import"./fileFetcher-BSUkPab7.chunk.mjs";const y={name:"TagContent",components:{FileComponent:f,FilesListViewer:u,NcEmptyContent:p,NcActions:r,NcActionButton:h,NcLoadingIcon:n,ArrowLeft:g},mixins:[m,C],props:{path:{type:String,default:""}},setup(){return{isMobile:c()}},data(){return{error:null,loading:!1,appContent:document.getElementById("app-content-vue")}},computed:{files(){return this.$store.state.files.files},tags(){return this.$store.state.systemtags.tags},tagId(){return this.$store.getters.tagId(this.path)},tag(){return this.tags[this.tagId]},fileIds(){return this.$store.state.systemtags.tagsFiles[this.tagId]},isEmpty(){return this.fileIds.length===0}},watch:{async path(){this.fetchContent()}},async beforeMount(){this.fetchContent()},methods:{async fetchContent(){window.OCA.Viewer.close(),this.loading=!0,this.error=null;try{this.tags[this.tagId]||await this.$store.dispatch("fetchAllTags",{signal:this.abortController.signal}),this.tag&&!this.fileIds&&await this.$store.dispatch("fetchTagFiles",{id:this.tagId,signal:this.abortController.signal})}catch(t){l.error("Failed to fetch tags",{error:t}),this.error=!0}finally{this.loading=!1}},openViewer(t){window.OCA.Viewer.open({fileInfo:o(this.files[t]),list:this.fileIds.map(s=>o(this.files[s]))})},t:a,n:i}};var w=function(){var t=this,s=t._self._c;return t.error?s("NcEmptyContent",{attrs:{name:t.t("photos","An error occurred")}}):t.loading?s("NcLoadingIcon",{staticClass:"loader"}):s("div",[s("div",{staticClass:"photos-navigation"},[s("NcActions",{staticClass:"photos-navigation__back"},[s("NcActionButton",{on:{click:function(e){return t.$router.push({name:"tags"})}},scopedSlots:t._u([{key:"icon",fn:function(){return[s("ArrowLeft")]},proxy:!0}])},[t._v(" "+t._s(t.t("photos","Back to tags overview"))+" ")])],1),s("h2",{staticClass:"photos-navigation__title"},[t._v(" "+t._s(t.path)+" ")])],1),s("div",{staticClass:"heading-subline"},[t._v(" "+t._s(t.n("photos","%n photo","%n photos",t.fileIds.length))+" ")]),t.isEmpty?s("NcEmptyContent",{attrs:{name:t.t("photos","No photos with this tag yet")}}):t._e(),s("FilesListViewer",{staticClass:"tag__photos",attrs:{"container-element":t.appContent,"file-ids":t.fileIds,"base-height":t.isMobile?120:200,loading:t.loading},scopedSlots:t._u([{key:"default",fn:function({file:e}){return s("FileComponent",{attrs:{file:t.files[e.id],"allow-selection":!0,selected:t.selection[e.id]===!0},on:{click:t.openViewer,"select-toggled":t.onFileSelectToggle}})}}])})],1)},_=[],I=d(y,w,_,!1,null,"a6eb2bbc");const T=I.exports;export{T as default};
//# sourceMappingURL=TagContent-BFtVAuyh.chunk.mjs.map
