import{t as a,V as l}from"./vue.runtime.esm-Ct3_M7aQ.chunk.mjs";import{N as r}from"./NcActionButton-CuVNJJtW-78GF8FR5.chunk.mjs";import{s as c,f as d,l as s,ag as i}from"./index-BMeBqg0T.chunk.mjs";import{N as f}from"./NcDialog-CKgpZOiy-Yt0iPUKp.chunk.mjs";import{N as u}from"./NcEmptyContent-C3BLUUdi.chunk.mjs";import{W as h,B as p,z as m,G as F,S as v,f as g,n as _}from"./icons-VGG7keIQ.chunk.mjs";import{F as w}from"./FaceMergeForm-BNC1lU6c.chunk.mjs";import{F as C}from"./FileComponent-Z0cvFFM3.chunk.mjs";import{F as y,a as S}from"./FilesSelectionMixin-JLsUiKnU.chunk.mjs";import{F as M}from"./FaceCover-NZ7niz3k.chunk.mjs";import{F as N}from"./FetchFilesMixin-Dh0XuSuT.chunk.mjs";import"./index-XmYygNaN.chunk.mjs";import"./NcCheckboxRadioSwitch-VeztTzpz-CXqdOpK4.chunk.mjs";import"./useModelMigration-EhAWvqDD-wVDp4GUR.chunk.mjs";import"./fileFetcher-EOUUgMjG.chunk.mjs";import"./AbortControllerMixin-KqbYNBDv.chunk.mjs";import"./PhotoSearch-DdDD9daK.chunk.mjs";const k={name:"UnassignedFaces",components:{Star:g,StarOutline:v,DownloadOutline:F,AlertCircleOutline:m,ArrowLeft:p,FaceMergeForm:w,FilesListViewer:S,FileComponent:C,NcLoadingIcon:d,NcEmptyContent:u,NcActions:c,NcActionButton:r,NcDialog:f,AccountSwitchOutline:h},directives:{focus(t){l.nextTick(()=>t.focus())}},mixins:[M,N,y],data(){return{showMoveModal:!1,loadingCount:0,appContent:document.getElementById("app-content-vue")}},computed:{files(){return this.$store.state.files.files},unassignedFiles(){return this.$store.state.faces.unassignedFiles},faceFileIds(){return this.unassignedFiles||[]},shouldFavoriteSelection(){return this.selectedFileIds.some(t=>this.$store.state.files.files[t].attributes.favorite===0)}},mounted(){this.fetchUnassignedFaces()},methods:{openViewer(t){window.OCA.Viewer.open({fileInfo:i(this.files[t]),list:this.faceFileIds.map(e=>i(this.files[e]))})},async handleMove(t,e){try{this.loadingCount++,await this.$store.dispatch("moveFilesToFace",{oldFace:null,faceName:t,fileIdsToMove:e}),this.showMoveModal=!1}catch(o){s.error("Failed to move selection",{error:o})}finally{this.loadingCount--}},async favoriteSelection(){try{this.loadingCount++,await this.$store.dispatch("toggleFavoriteForFiles",{fileIds:this.selectedFileIds,favoriteState:!0})}catch(t){s.error("Failed to favorite selection",{error:t})}finally{this.loadingCount--}},async unFavoriteSelection(){try{this.loadingCount++,await this.$store.dispatch("toggleFavoriteForFiles",{fileIds:this.selectedFileIds,favoriteState:!1})}catch(t){s.error("Failed to unfavorite selection",{error:t})}finally{this.loadingCount--}},async downloadSelection(){try{this.loadingCount++,await this.$store.dispatch("downloadFiles",this.selectedFileIds)}catch(t){s.error("Faile to download selection",{error:t})}finally{this.loadingCount--}},t:a}};var A=function(){var t=this,e=t._self._c;return t.errorFetchingFiles?e("NcEmptyContent",{scopedSlots:t._u([{key:"icon",fn:function(){return[e("AlertCircleOutline")]},proxy:!0}],null,!1,2159780319)},[t._v(" "+t._s(t.t("photos","An error occurred"))+" ")]):e("div",{staticClass:"face"},[e("div",{staticClass:"face__header"},[e("div",{staticClass:"face__header__left"},[e("NcActions",[e("NcActionButton",{on:{click:function(o){return t.$router.push("/faces/")}},scopedSlots:t._u([{key:"icon",fn:function(){return[e("ArrowLeft")]},proxy:!0}])},[t._v(t._s(t.t("photos","Back"))+" ")])],1),e("div",{staticClass:"face__header__title"},[e("h2",{class:{"face-name":!0}},[t._v(" "+t._s(t.t("photos","Unassigned faces"))+" ")])]),t.loadingCount>0||t.loadingFaces?e("NcLoadingIcon"):t._e()],1),e("div",{staticClass:"face__header__actions"},[e("NcActions",{attrs:{"force-menu":!0}},[t.selectedFileIds.length?[e("NcActionButton",{attrs:{"close-after-click":!0,"aria-label":t.t("photos","Download selected files")},on:{click:t.downloadSelection}},[e("DownloadOutline",{attrs:{slot:"icon"},slot:"icon"}),t._v(" "+t._s(t.t("photos","Download selected photos"))+" ")],1),t.shouldFavoriteSelection?e("NcActionButton",{attrs:{"close-after-click":!0,"aria-label":t.t("photos","Mark selection as favorite")},on:{click:t.favoriteSelection}},[e("StarOutline",{attrs:{slot:"icon"},slot:"icon"}),t._v(" "+t._s(t.t("photos","Favorite"))+" ")],1):e("NcActionButton",{attrs:{"close-after-click":!0,"aria-label":t.t("photos","Remove selection from favorites")},on:{click:t.unFavoriteSelection}},[e("Star",{attrs:{slot:"icon"},slot:"icon"}),t._v(" "+t._s(t.t("photos","Remove from favorites"))+" ")],1),e("NcActionButton",{attrs:{"close-after-click":!0},on:{click:function(o){t.showMoveModal=!0}},scopedSlots:t._u([{key:"icon",fn:function(){return[e("AccountSwitchOutline")]},proxy:!0}],null,!1,1476410576)},[t._v(" "+t._s(t.n("photos","Move photo to a different person","Move photos to a different person",t.selectedFileIds.length))+" ")])]:t._e()],2)],1)]),e("FilesListViewer",{staticClass:"face__photos",attrs:{"container-element":t.appContent,"file-ids":t.faceFileIds,loading:t.loadingFiles||t.loadingFaces},scopedSlots:t._u([{key:"default",fn:function({file:o,distance:n}){return e("FileComponent",{attrs:{file:t.files[o.id],"allow-selection":!0,selected:t.selection[o.id]===!0,distance:n},on:{click:t.openViewer,"select-toggled":t.onFileSelectToggle}})}}])}),t.showMoveModal?e("NcDialog",{attrs:{name:t.t("photos","Move to different person"),"close-on-click-outside":"",size:"normal"},on:{closing:function(o){t.showMoveModal=!1}}},[e("FaceMergeForm",{attrs:{"first-face":"-1"},on:{select:function(o){return t.handleMove(o,t.selectedFileIds)}}})],1):t._e()],1)},I=[],B=_(k,A,I,!1,null,"7673df7b");const J=B.exports;export{J as default}; //# sourceMappingURL=UnassignedFaces-BGIdLg8P.chunk.mjs.map