f7cloud_client/apps/photos/js/FaceContent-DMIngLh-.chunk.mjs
root 8b6a0139db f7cloud_client
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-17 22:59:26 +00:00

3 lines
9.6 KiB
JavaScript

import{a as i,t as c,V as l}from"./vue.runtime.esm-Ct3_M7aQ.chunk.mjs";import{N as r}from"./NcActionButton-CuVNJJtW-78GF8FR5.chunk.mjs";import{N as f,s as d,f as h,l as s,ag as a}from"./index-BMeBqg0T.chunk.mjs";import{N as u}from"./NcDialog-CKgpZOiy-Yt0iPUKp.chunk.mjs";import{N as p}from"./NcEmptyContent-C3BLUUdi.chunk.mjs";import{W as m,s as F,B as v,X as g,Q as _,z as y,x as N,G as w,S as M,f as C,v as k,n as S}from"./icons-VGG7keIQ.chunk.mjs";import{F as I}from"./FaceMergeForm-BNC1lU6c.chunk.mjs";import{F as A}from"./FileComponent-Z0cvFFM3.chunk.mjs";import{F as $,a as x}from"./FilesSelectionMixin-JLsUiKnU.chunk.mjs";import{F as R}from"./FaceCover-NZ7niz3k.chunk.mjs";import{F as B}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 O={name:"FaceContent",components:{PencilOutline:k,Star:C,StarOutline:M,Download:w,Close:N,AlertCircleOutline:y,SendOutline:_,Merge:g,ArrowLeft:v,AccountBoxMultipleOutline:F,FaceMergeForm:I,FilesListViewer:x,FileComponent:A,NcLoadingIcon:h,NcEmptyContent:p,NcActions:d,NcActionButton:r,NcDialog:u,NcButton:f,AccountSwitchOutline:m},directives:{focus(e){l.nextTick(()=>e.focus())}},mixins:[R,B,$],props:{faceName:{type:String,default:"/"}},data(){return{showMoveModal:!1,showMergeModal:!1,showRenameModal:!1,loadingCount:0,appContent:document.getElementById("app-content-vue")}},computed:{files(){return this.$store.state.files.files},facesFiles(){return this.$store.state.faces.facesFiles},face(){return this.faces[this.faceName]},faceFileIds(){return this.facesFiles[this.faceName]||[]},shouldFavoriteSelection(){return this.selectedFileIds.some(e=>this.$store.state.files.files[e].attributes.favorite===0)}},watch:{face(){this.face&&this.fetchFaceContent(this.faceName)}},mounted(){this.fetchFaceContent(this.faceName)},methods:{openViewer(e){window.OCA.Viewer.open({fileInfo:a(this.files[e]),list:this.faceFileIds.map(t=>a(this.files[t]))})},async handleRemoveFilesFromFace(e){try{this.loadingCount++,await this.$store.dispatch("removeFilesFromFace",{faceName:this.faceName,fileIdsToRemove:e}),this.resetSelection()}catch(t){s.error(t)}finally{this.loadingCount--}},async handleDeleteFace(){try{this.loadingCount++,await this.$store.dispatch("deleteFace",{faceName:this.faceName}),this.$router.push("/faces")}catch(e){s.error(e)}finally{this.loadingCount--}},async handleRenameFace(e){try{this.loadingCount++,this.showRenameModal=!1;const t=this.faceName;await this.$store.dispatch("renameFace",{oldName:t,faceName:e}),this.$router.push({name:"facecontent",params:{faceName:e}})}catch(t){s.error(t)}finally{this.loadingCount--}},async handleMerge(e){try{this.loadingCount++,await this.$store.dispatch("moveFilesToFace",{oldFace:this.faceName,faceName:e,fileIdsToMove:this.facesFiles[this.faceName]}),await this.$store.dispatch("deleteFace",{faceName:this.faceName}),this.showMergeModal=!1,this.$router.push({name:"facecontent",params:{faceName:e}})}catch(t){s.error(t)}finally{this.loadingCount--}},async handleMove(e,t){try{this.loadingCount++,await this.$store.dispatch("moveFilesToFace",{oldFace:this.faceName,faceName:e,fileIdsToMove:t}),this.showMoveModal=!1}catch(o){s.error(o)}finally{this.loadingCount--}},async favoriteSelection(){try{this.loadingCount++,await this.$store.dispatch("toggleFavoriteForFiles",{fileIds:this.selectedFileIds,favoriteState:!0})}catch(e){s.error(e)}finally{this.loadingCount--}},async unFavoriteSelection(){try{this.loadingCount++,await this.$store.dispatch("toggleFavoriteForFiles",{fileIds:this.selectedFileIds,favoriteState:!1})}catch(e){s.error(e)}finally{this.loadingCount--}},async downloadSelection(){try{this.loadingCount++,await this.$store.dispatch("downloadFiles",this.selectedFileIds)}catch(e){s.error(e)}finally{this.loadingCount--}},t:c,n:i}};var b=function(){var e=this,t=e._self._c;return e.face===void 0&&!e.loadingFiles&&!e.loadingFaces?t("NcEmptyContent",{staticClass:"empty-content-with-illustration",scopedSlots:e._u([{key:"icon",fn:function(){return[t("AccountBoxMultipleOutline")]},proxy:!0}],null,!1,2861705255)},[e._v(" "+e._s(e.t("photos","This person could not be found"))+" ")]):e.errorFetchingFiles||e.errorFetchingFaces?t("NcEmptyContent",{scopedSlots:e._u([{key:"icon",fn:function(){return[t("AlertCircleOutline")]},proxy:!0}])},[e._v(" "+e._s(e.t("photos","An error occurred"))+" ")]):t("div",{staticClass:"face"},[t("div",{staticClass:"face__header"},[t("div",{staticClass:"face__header__left"},[t("NcActions",[t("NcActionButton",{on:{click:function(o){return e.$router.push("/faces/")}},scopedSlots:e._u([{key:"icon",fn:function(){return[t("ArrowLeft")]},proxy:!0}])},[e._v(e._s(e.t("photos","Back"))+" ")])],1),t("div",{staticClass:"face__header__title"},[e.face!==void 0?t("h2",{class:{"face-name":!0,"hidden-visually":e.face.basename.match(/^[0-9]+$/)}},[e._v(" "+e._s(e.face.basename)+" ")]):e._e()]),e.loadingCount>0||e.loadingFaces?t("NcLoadingIcon"):e._e()],1),e.face!==void 0?t("div",{staticClass:"face__header__actions"},[t("NcActions",[t("NcActionButton",{attrs:{"close-after-click":!0,"aria-label":e.t("photos","Rename person")},on:{click:function(o){e.showRenameModal=!0}},scopedSlots:e._u([{key:"icon",fn:function(){return[t("PencilOutline")]},proxy:!0}],null,!1,347985790)},[e._v(" "+e._s(e.t("photos","Rename person"))+" ")])],1),t("NcActions",{attrs:{"force-menu":!0}},[Object.keys(e.faces).length>1?t("NcActionButton",{attrs:{"close-after-click":!0,"aria-label":e.t("photos","Merge with different person")},on:{click:function(o){e.showMergeModal=!0}},scopedSlots:e._u([{key:"icon",fn:function(){return[t("Merge")]},proxy:!0}],null,!1,3117189691)},[e._v(" "+e._s(e.t("photos","Merge with different person"))+" ")]):e._e(),e.selectedFileIds.length?[t("NcActionButton",{attrs:{"close-after-click":!0,"aria-label":e.t("photos","Download selected files")},on:{click:e.downloadSelection}},[t("Download",{attrs:{slot:"icon"},slot:"icon"}),e._v(" "+e._s(e.t("photos","Download selected photos"))+" ")],1),e.shouldFavoriteSelection?t("NcActionButton",{attrs:{"close-after-click":!0,"aria-label":e.t("photos","Mark selection as favorite")},on:{click:e.favoriteSelection}},[t("StarOutline",{attrs:{slot:"icon"},slot:"icon"}),e._v(" "+e._s(e.t("photos","Favorite"))+" ")],1):t("NcActionButton",{attrs:{"close-after-click":!0,"aria-label":e.t("photos","Remove selection from favorites")},on:{click:e.unFavoriteSelection}},[t("Star",{attrs:{slot:"icon"},slot:"icon"}),e._v(" "+e._s(e.t("photos","Remove from favorites"))+" ")],1),t("NcActionButton",{attrs:{"close-after-click":!0},on:{click:function(o){e.showMoveModal=!0}},scopedSlots:e._u([{key:"icon",fn:function(){return[t("AccountSwitchOutline")]},proxy:!0}],null,!1,1476410576)},[e._v(" "+e._s(e.n("photos","Move photo to a different person","Move photos to a different person",e.selectedFileIds.length))+" ")]),t("NcActionButton",{attrs:{"close-after-click":!0},on:{click:function(o){return e.handleRemoveFilesFromFace(e.selectedFileIds)}},scopedSlots:e._u([{key:"icon",fn:function(){return[t("Close")]},proxy:!0}],null,!1,1051939733)},[e._v(" "+e._s(e.n("photos","Remove photo from person","Remove photos from person",e.selectedFileIds.length))+" ")])]:e._e(),t("NcActionButton",{attrs:{"close-after-click":!0},on:{click:e.handleDeleteFace},scopedSlots:e._u([{key:"icon",fn:function(){return[t("Close")]},proxy:!0}],null,!1,1051939733)},[e._v(" "+e._s(e.t("photos","Remove person"))+" ")])],2)],1):e._e()]),e.face!==void 0?t("FilesListViewer",{staticClass:"face__photos",attrs:{"container-element":e.appContent,"file-ids":e.faceFileIds,loading:e.loadingFiles||e.loadingFaces},scopedSlots:e._u([{key:"default",fn:function({file:o,distance:n}){return t("FileComponent",{attrs:{file:e.files[o.id],"allow-selection":!0,selected:e.selection[o.id]===!0,distance:n},on:{click:e.openViewer,"select-toggled":e.onFileSelectToggle}})}}],null,!1,405762677)}):e._e(),e.showRenameModal?t("NcDialog",{attrs:{name:e.t("photos","Rename person"),"close-on-click-outside":"",size:"small"},on:{closing:function(o){e.showRenameModal=!1}},scopedSlots:e._u([{key:"actions",fn:function(){return[t("NcButton",{attrs:{"aria-label":e.t("photos","Save."),type:"primary",disabled:e.$refs.nameInput&&e.$refs.nameInput.value.trim()===""},on:{click:function(o){return e.handleRenameFace(e.$refs.nameInput.value)}},scopedSlots:e._u([{key:"icon",fn:function(){return[e.loadingCount?t("NcLoadingIcon"):t("SendOutline")]},proxy:!0}],null,!1,4093389955)},[e._v(" "+e._s(e.t("photos","Save"))+" ")])]},proxy:!0}],null,!1,732723997)},[t("div",{staticClass:"rename-form"},[t("input",{directives:[{name:"focus",rawName:"v-focus"}],ref:"nameInput",attrs:{type:"text",name:"name",required:"",placeholder:e.t("photos","Name of this person")},domProps:{value:e.faceName},on:{keydown:function(o){return!o.type.indexOf("key")&&e._k(o.keyCode,"enter",13,o.key,"Enter")?null:e.handleRenameFace(e.$refs.nameInput.value)}}})])]):e._e(),e.showMergeModal?t("NcDialog",{attrs:{name:e.t("photos","Merge person"),"close-on-click-outside":"",size:"normal"},on:{closing:function(o){e.showMergeModal=!1}}},[t("FaceMergeForm",{attrs:{"first-face":e.faceName},on:{select:function(o){return e.handleMerge(o)}}})],1):e._e(),e.showMoveModal?t("NcDialog",{attrs:{name:e.t("photos","Move to different person"),"close-on-click-outside":"",size:"normal"},on:{closing:function(o){e.showMoveModal=!1}}},[t("FaceMergeForm",{attrs:{"first-face":e.faceName},on:{select:function(o){return e.handleMove(o,e.selectedFileIds)}}})],1):e._e()],1)},D=[],T=S(O,b,D,!1,null,"2a807dfc");const ee=T.exports;export{ee as default};
//# sourceMappingURL=FaceContent-DMIngLh-.chunk.mjs.map