photos/js/photos-src_components_Faces...

1 line
28 KiB
Plaintext

{"version":3,"file":"photos-src_components_Faces_FaceCover_vue.js?v=7a57403c2dbed8013947","mappings":";qLAyBA,SACCA,KAAM,iBAENC,SAAU,KACNC,EAAAA,EAAAA,IAAW,CACb,QACA,aACA,WAIFC,QAAS,CACRC,aAAaC,GACZ,OAAOC,KAAKC,MAAMC,IAAAA,OAAUC,KAAKC,MAAML,GAAUM,MAAM,uBAAyB,MACjF,EASAC,cAAcP,GACb,MAAMQ,EAAQJ,KAAKL,aAAaC,GAChC,IAAKQ,IAAUA,EAAMC,UACpB,MAAO,CAAC,EAET,MAAMA,EAAYD,EAAMC,UAIlBC,EAAOC,KAAKC,IAAI,EAAI,EAAIH,EAAUI,MAAS,IAE3CC,EAA+D,KAArCL,EAAUM,EAAIN,EAAUI,MAAQ,GAC1DG,EAA8D,KAAtCP,EAAUQ,EAAIR,EAAUS,OAAS,GAE/D,MAAO,CAENL,MAAO,OAGPM,UAAW,gDAAFC,OAAkDN,EAAsB,4CAAAM,OAA2CJ,EAAoB,eAAAI,OAAcV,EAAI,KAElKW,gBAAiB,GAAFD,OAAKN,EAAsB,MAAAM,OAAKJ,EAAoB,KAErE,qJCrCF,SACCrB,KAAM,kBAEN2B,KAAIA,KACI,CACNC,mBAAoB,KACpBC,cAAc,EACdC,mBAAoB,KACpBC,cAAc,IAIhBC,OAAQ,CACPC,EAAAA,GAGDC,oBACCzB,KAAK0B,YACN,EAEAlC,SAAU,KACNC,EAAAA,EAAAA,IAAW,CACb,WAIFC,QAAS,KACLiC,EAAAA,EAAAA,IAAW,CACb,gBAGDF,mBACC,IAAIzB,KAAKoB,eAILQ,OAAOC,KAAK7B,KAAKC,OAAO6B,OAI5B,IAAI,IAAAC,EACH/B,KAAKoB,cAAe,EACpBpB,KAAKmB,mBAAqB,KAE1B,MAAQD,KAAMjB,SAAgB+B,EAAAA,GAAAA,qBAA4B,cAADhB,OAA+B,QAA/Be,GAAeE,EAAAA,EAAAA,aAA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AG,WAAWX,EAAIc,GAAGd,EAAIe,EAAE,SAAU,YAAa,YAAaf,EAAIX,KAAKlF,MAAe,UAAI,eACryB,GACsB,IIUpB,EACA,KACA,WACA,MAI8B","sources":["webpack:///photos/src/mixins/FaceCoverMixin.js","webpack:///photos/src/mixins/FetchFacesMixin.js","webpack:///photos/src/components/Faces/FaceCover.vue?vue&type=style&index=0&id=f77c54d0&prod&lang=scss&scoped=true","webpack://photos/./src/components/Faces/FaceCover.vue?076a","webpack:///photos/src/components/Faces/FaceCover.vue","webpack:///photos/src/components/Faces/FaceCover.vue?vue&type=script&lang=js","webpack://photos/./src/components/Faces/FaceCover.vue?eb04","webpack://photos/./src/components/Faces/FaceCover.vue?eba5"],"sourcesContent":["/**\n * @copyright Copyright (c) 2022 Marcel Klehr <mklehr@gmx.net>\n *\n * @author Marcel Klehr <mklehr@gmx.net>\n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\nimport { mapGetters } from 'vuex'\nimport he from 'he'\n\nexport default {\n\tname: 'FaceCoverMixin',\n\n\tcomputed: {\n\t\t...mapGetters([\n\t\t\t'faces',\n\t\t\t'facesFiles',\n\t\t\t'files',\n\t\t]),\n\t},\n\n\tmethods: {\n\t\tgetFaceCover(faceName) {\n\t\t\treturn JSON.parse(he.decode(this.faces[faceName].props['face-preview-image'] || '{}'))\n\t\t},\n\n\t\t/**\n\t\t * This will produce an inline style to apply to images\n\t\t * to zoom toward the detected face\n\t\t *\n\t\t * @param faceName\n\t\t * @return {{}|{transform: string, width: string, transformOrigin: string}}\n\t\t */\n\t\tgetCoverStyle(faceName) {\n\t\t\tconst cover = this.getFaceCover(faceName)\n\t\t\tif (!cover || !cover.detection) {\n\t\t\t\treturn {}\n\t\t\t}\n\t\t\tconst detection = cover.detection\n\n\t\t\t// Zoom into the picture so that the face fills the --photos-face-width box nicely\n\t\t\t// if the face is larger than the image, we don't zoom out (reason for the Math.max)\n\t\t\tconst zoom = Math.max(1, (1 / detection.width) * 0.4)\n\n\t\t\tconst horizontalCenterOfFace = (detection.x + detection.width / 2) * 100\n\t\t\tconst verticalCenterOfFace = (detection.y + detection.height / 2) * 100\n\n\t\t\treturn {\n\t\t\t\t// We assume that the image is inside a div with width: var(--photos-face-width)\n\t\t\t\twidth: '100%',\n\t\t\t\t// we translate the image so that the center of the detected face is in the center of the --photos-face-width box\n\t\t\t\t// and add the zoom\n\t\t\t\ttransform: `translate(calc( var(--photos-face-width)/2 - ${horizontalCenterOfFace}% ), calc( var(--photos-face-width)/2 - ${verticalCenterOfFace}% )) scale(${zoom})`,\n\t\t\t\t// this is necessary for the zoom to zoom toward the center of the face\n\t\t\t\ttransformOrigin: `${horizontalCenterOfFace}% ${verticalCenterOfFace}%`,\n\t\t\t}\n\t\t},\n\t},\n}\n","/**\n * @copyright Copyright (c) 2022 Louis Chemineau <louis@chmn.me>\n *\n * @author Louis Chemineau <louis@chmn.me>\n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\nimport { mapActions, mapGetters } from 'vuex'\n\nimport { showError } from '@nextcloud/dialogs'\nimport { getCurrentUser } from '@nextcloud/auth'\n\nimport client from '../services/DavClient.js'\nimport logger from '../services/logger.js'\nimport DavRequest from '../services/DavRequest.js'\nimport { genFileInfo } from '../utils/fileUtils.js'\nimport AbortControllerMixin from './AbortControllerMixin.js'\nimport he from 'he'\n\nexport default {\n\tname: 'FetchFacesMixin',\n\n\tdata() {\n\t\treturn {\n\t\t\terrorFetchingFaces: null,\n\t\t\tloadingFaces: false,\n\t\t\terrorFetchingFiles: null,\n\t\t\tloadingFiles: false,\n\t\t}\n\t},\n\n\tmixins: [\n\t\tAbortControllerMixin,\n\t],\n\n\tasync beforeMount() {\n\t\tthis.fetchFaces()\n\t},\n\n\tcomputed: {\n\t\t...mapGetters([\n\t\t\t'faces',\n\t\t]),\n\t},\n\n\tmethods: {\n\t\t...mapActions([\n\t\t\t'appendFiles',\n\t\t]),\n\n\t\tasync fetchFaces() {\n\t\t\tif (this.loadingFaces) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif (Object.keys(this.faces).length) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\ttry {\n\t\t\t\tthis.loadingFaces = true\n\t\t\t\tthis.errorFetchingFaces = null\n\n\t\t\t\tconst { data: faces } = await client.getDirectoryContents(`/recognize/${getCurrentUser()?.uid}/faces/`, {\n\t\t\t\t\tdata: DavRequest,\n\t\t\t\t\tdetails: true,\n\t\t\t\t\tsignal: this.abortController.signal,\n\t\t\t\t})\n\t\t\t\tthis.$store.dispatch('addFaces', { faces })\n\t\t\t\tlogger.debug(`[FetchFacesMixin] Fetched ${faces.length} new faces: `, faces)\n\t\t\t} catch (error) {\n\t\t\t\tif (error.response && error.response.status) {\n\t\t\t\t\tif (error.response.status === 404) {\n\t\t\t\t\t\tthis.errorFetchingFaces = 404\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis.errorFetchingFaces = error\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tlogger.error(t('photos', 'Failed to fetch faces list.'), { error })\n\t\t\t\tshowError(t('photos', 'Failed to fetch faces list.'))\n\t\t\t} finally {\n\t\t\t\tthis.loadingFaces = false\n\t\t\t}\n\t\t},\n\n\t\tasync fetchFaceContent(faceName, force) {\n\t\t\tif (this.loadingFiles) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif (!force && this.facesFiles[faceName] && this.facesFiles[faceName].length) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\ttry {\n\t\t\t\tthis.errorFetchingFiles = null\n\t\t\t\tthis.loadingFiles = true\n\n\t\t\t\tlet { data: fetchedFiles } = await client.getDirectoryContents(\n\t\t\t\t\t`/recognize/${getCurrentUser()?.uid}/faces/${faceName}`,\n\t\t\t\t\t{\n\t\t\t\t\t\tdata: DavRequest,\n\t\t\t\t\t\tdetails: true,\n\t\t\t\t\t\tsignal: this.abortController.signal,\n\t\t\t\t\t}\n\t\t\t\t)\n\n\t\t\t\tfetchedFiles = fetchedFiles\n\t\t\t\t\t.map(file => genFileInfo(file))\n\t\t\t\t\t.map(file => ({ ...file, filename: he.decode(file.realpath).replace(`/${getCurrentUser().uid}/files`, `/files/${getCurrentUser().uid}`) }))\n\t\t\t\t\t.map(file => ({ ...file, faceDetections: JSON.parse(he.decode(file.faceDetections)) }))\n\n\t\t\t\tconst fileIds = fetchedFiles.map(file => '' + file.fileid)\n\n\t\t\t\tthis.appendFiles(fetchedFiles)\n\n\t\t\t\tif (fetchedFiles.length > 0) {\n\t\t\t\t\tawait this.$store.commit('addFilesToFace', { faceName, fileIdsToAdd: fileIds })\n\t\t\t\t}\n\n\t\t\t\tlogger.debug(`[FetchFacesMixin] Fetched ${fileIds.length} new files: `, fileIds)\n\t\t\t} catch (error) {\n\t\t\t\tif (error.response && error.response.status) {\n\t\t\t\t\tif (error.response.status === 404) {\n\t\t\t\t\t\tthis.errorFetchingFiles = 404\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis.errorFetchingFiles = error\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// cancelled request, moving on...\n\t\t\t\tlogger.error('Error fetching face files', { error })\n\t\t\t} finally {\n\t\t\t\tthis.loadingFiles = false\n\t\t\t}\n\t\t},\n\n\t\tasync fetchUnassignedFaces(force) {\n\t\t\tif (this.loadingFiles) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif (!force && this.unassignedFiles && this.unassignedFiles.length) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\ttry {\n\t\t\t\tthis.errorFetchingFiles = null\n\t\t\t\tthis.loadingFiles = true\n\n\t\t\t\tlet { data: fetchedFiles } = await client.getDirectoryContents(\n\t\t\t\t\t`/recognize/${getCurrentUser()?.uid}/unassigned-faces`,\n\t\t\t\t\t{\n\t\t\t\t\t\tdata: DavRequest,\n\t\t\t\t\t\tdetails: true,\n\t\t\t\t\t\tsignal: this.abortController.signal,\n\t\t\t\t\t}\n\t\t\t\t)\n\n\t\t\t\tfetchedFiles = fetchedFiles\n\t\t\t\t\t.map(file => genFileInfo(file))\n\t\t\t\t\t.map(file => ({ ...file, filename: he.decode(file.realpath).replace(`/${getCurrentUser().uid}/files`, `/files/${getCurrentUser().uid}`) }))\n\t\t\t\t\t.map(file => ({ ...file, faceDetections: JSON.parse(he.decode(file.faceDetections)) }))\n\n\t\t\t\tconst fileIds = fetchedFiles.map(file => '' + file.fileid)\n\n\t\t\t\tthis.appendFiles(fetchedFiles)\n\n\t\t\t\tif (fetchedFiles.length > 0) {\n\t\t\t\t\tawait this.$store.commit('addUnassignedFiles', { fileIdsToAdd: fileIds })\n\t\t\t\t}\n\n\t\t\t\tlogger.debug(`[FetchFacesMixin] Fetched ${fileIds.length} new unassigned files: `, fileIds)\n\t\t\t} catch (error) {\n\t\t\t\tif (error.response && error.response.status) {\n\t\t\t\t\tif (error.response.status === 404) {\n\t\t\t\t\t\tthis.errorFetchingFiles = 404\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis.errorFetchingFiles = error\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// cancelled request, moving on...\n\t\t\t\tlogger.error('Error fetching unassigned files', { error })\n\t\t\t} finally {\n\t\t\t\tthis.loadingFiles = false\n\t\t\t}\n\t\t},\n\n\t\tasync fetchUnassignedFacesCount() {\n\t\t\ttry {\n\t\t\t\tconst { data: unassignedFacesRoot } = await client.stat(\n\t\t\t\t\t`/recognize/${getCurrentUser()?.uid}/unassigned-faces`,\n\t\t\t\t\t{\n\t\t\t\t\t\tdata: DavRequest,\n\t\t\t\t\t\tdetails: true,\n\t\t\t\t\t\tsignal: this.abortController.signal,\n\t\t\t\t\t}\n\t\t\t\t)\n\n\t\t\t\tconst count = Number(unassignedFacesRoot.props.nbItems)\n\n\t\t\t\tawait this.$store.commit('setUnassignedFilesCount', count)\n\n\t\t\t\tlogger.debug('[FetchFacesMixin] Fetched unassigned files count: ', count)\n\t\t\t} catch (error) {\n\t\t\t\t// cancelled request, moving on...\n\t\t\t\tlogger.error('Error fetching unassigned files count', { error })\n\t\t\t}\n\t\t},\n\t},\n}\n","// Imports\nimport ___CSS_LOADER_API_SOURCEMAP_IMPORT___ from \"../../../node_modules/css-loader/dist/runtime/sourceMaps.js\";\nimport ___CSS_LOADER_API_IMPORT___ from \"../../../node_modules/css-loader/dist/runtime/api.js\";\nvar ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(___CSS_LOADER_API_SOURCEMAP_IMPORT___);\n// Module\n___CSS_LOADER_EXPORT___.push([module.id, \".face-cover[data-v-f77c54d0]{display:flex;flex-direction:column;padding:10px;border-radius:var(--border-radius-large)}.face-cover__crop-container[data-v-f77c54d0]{overflow:hidden;width:128px;height:128px;border-radius:128px;position:relative;background:var(--color-background-darker);--photos-face-width: 128px}@media only screen and (max-width: 1020px){.face-cover__crop-container[data-v-f77c54d0]{width:95px;height:95px;--photos-face-width: 95px}}.face-cover[data-v-f77c54d0]:hover,.face-cover[data-v-f77c54d0]:focus{background:var(--color-background-hover)}.face-cover__details[data-v-f77c54d0]{display:flex;flex-direction:column;width:128px;margin-top:4px;text-align:center}@media only screen and (max-width: 1020px){.face-cover__details[data-v-f77c54d0]{width:95px}}.face-cover__details__first-line[data-v-f77c54d0]{display:flex;height:2em;overflow:hidden;text-overflow:ellipsis}.face-cover__details__second-line[data-v-f77c54d0]{margin-top:6px;color:var(--color-text-maxcontrast)}.face-cover__details__name[data-v-f77c54d0]{flex-grow:1;margin:0;font-weight:bold;font-size:20px;line-height:30px;color:var(--color-main-text)}.face-cover--small *[data-v-f77c54d0]{font-size:15px !important}.face-cover--small .face-cover__details[data-v-f77c54d0]{width:60px !important}.face-cover--small .face-cover__crop-container[data-v-f77c54d0]{width:60px !important;height:60px !important;--photos-face-width: 60px !important}\", \"\",{\"version\":3,\"sources\":[\"webpack://./src/mixins/FaceCover.scss\"],\"names\":[],\"mappings\":\"AAqBA,6BACC,YAAA,CACA,qBAAA,CACA,YAAA,CACA,wCAAA,CAEA,6CACC,eAAA,CACA,WAAA,CACA,YAAA,CACA,mBAAA,CACA,iBAAA,CACA,yCAAA,CACA,0BAAA,CAEA,2CATD,6CAUE,UAAA,CACA,WAAA,CACA,yBAAA,CAAA,CAIF,sEACC,wCAAA,CAGD,sCACC,YAAA,CACA,qBAAA,CACA,WAAA,CACA,cAAA,CACA,iBAAA,CAEA,2CAPD,sCAQE,UAAA,CAAA,CAGD,kDACC,YAAA,CACA,UAAA,CACA,eAAA,CACA,sBAAA,CAGD,mDACC,cAAA,CACA,mCAAA,CAGD,4CACC,WAAA,CACA,QAAA,CACA,gBAAA,CACA,cAAA,CACA,gBAAA,CACA,4BAAA,CAMF,sCACC,yBAAA,CAED,yDACC,qBAAA,CAED,gEACC,qBAAA,CACA,sBAAA,CACA,oCAAA\",\"sourcesContent\":[\"/**\\n * @copyright Copyright (c) 2023 Marcel Klehr <mklehr@gmx.net>\\n *\\n * @author Marcel Klehr <mklehr@gmx.net>\\n *\\n * @license AGPL-3.0-or-later\\n *\\n * This program is free software: you can redistribute it and/or modify\\n * it under the terms of the GNU Affero General Public License as\\n * published by the Free Software Foundation, either version 3 of the\\n * License, or (at your option) any later version.\\n *\\n * This program is distributed in the hope that it will be useful,\\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\\n * GNU Affero General Public License for more details.\\n *\\n * You should have received a copy of the GNU Affero General Public License\\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\\n *\\n */\\n.face-cover {\\n\\tdisplay: flex;\\n\\tflex-direction: column;\\n\\tpadding: 10px;\\n\\tborder-radius: var(--border-radius-large);\\n\\n\\t&__crop-container {\\n\\t\\toverflow: hidden;\\n\\t\\twidth: 128px;\\n\\t\\theight: 128px;\\n\\t\\tborder-radius: 128px;\\n\\t\\tposition: relative;\\n\\t\\tbackground: var(--color-background-darker);\\n\\t\\t--photos-face-width: 128px;\\n\\n\\t\\t@media only screen and (max-width: 1020px) {\\n\\t\\t\\twidth: 95px;\\n\\t\\t\\theight: 95px;\\n\\t\\t\\t--photos-face-width: 95px;\\n\\t\\t}\\n\\t}\\n\\n\\t&:hover, &:focus {\\n\\t\\tbackground: var(--color-background-hover);\\n\\t}\\n\\n\\t&__details {\\n\\t\\tdisplay: flex;\\n\\t\\tflex-direction: column;\\n\\t\\twidth: 128px;\\n\\t\\tmargin-top: 4px;\\n\\t\\ttext-align: center;\\n\\n\\t\\t@media only screen and (max-width: 1020px) {\\n\\t\\t\\twidth: 95px;\\n\\t\\t}\\n\\n\\t\\t&__first-line {\\n\\t\\t\\tdisplay: flex;\\n\\t\\t\\theight: 2em;\\n\\t\\t\\toverflow: hidden;\\n\\t\\t\\ttext-overflow: ellipsis;\\n\\t\\t}\\n\\n\\t\\t&__second-line {\\n\\t\\t\\tmargin-top: 6px;\\n\\t\\t\\tcolor: var(--color-text-maxcontrast);\\n\\t\\t}\\n\\n\\t\\t&__name {\\n\\t\\t\\tflex-grow: 1;\\n\\t\\t\\tmargin: 0;\\n\\t\\t\\tfont-weight: bold;\\n\\t\\t\\tfont-size: 20px;\\n\\t\\t\\tline-height: 30px;\\n\\t\\t\\tcolor: var(--color-main-text);\\n\\t\\t}\\n\\t}\\n}\\n\\n.face-cover--small {\\n\\t* {\\n\\t\\tfont-size: 15px !important;\\n\\t}\\n\\t.face-cover__details {\\n\\t\\twidth: 60px !important;\\n\\t}\\n\\t.face-cover__crop-container {\\n\\t\\twidth: 60px !important;\\n\\t\\theight: 60px !important;\\n\\t\\t--photos-face-width: 60px !important;\\n\\t}\\n}\\n\"],\"sourceRoot\":\"\"}]);\n// Exports\nexport default ___CSS_LOADER_EXPORT___;\n","var render = function render(){var _vm=this,_c=_vm._self._c;return _c('div',{class:['face-cover', _vm.small && 'face-cover--small'],on:{\"click\":function($event){return _vm.$emit('click')}}},[_c('div',{staticClass:\"face-cover__crop-container\"},[_c('img',{ref:\"image\",staticClass:\"face-cover__image\",style:(_vm.coverDimensions),attrs:{\"src\":_vm.coverUrl}})]),_vm._v(\" \"),_c('div',{staticClass:\"face-cover__details\"},[(!_vm.baseName.match(/^[0-9]+$/))?_c('div',{staticClass:\"face-cover__details__first-line\"},[_c('span',{staticClass:\"face-cover__details__name\"},[_vm._v(\"\\n\\t\\t\\t\\t\"+_vm._s(_vm.baseName)+\"\\n\\t\\t\\t\")])]):_vm._e(),_vm._v(\" \"),(!_vm.small)?_c('div',{staticClass:\"face-cover__details__second-line\"},[_vm._v(\"\\n\\t\\t\\t\"+_vm._s(_vm.n('photos', '%n photos', '%n photos', _vm.face.props['nbItems']))+\"\\n\\t\\t\")]):_vm._e()])])\n}\nvar staticRenderFns = []\n\nexport { render, staticRenderFns }","<!--\n - @copyright Copyright (c) 2022 Louis Chemineau <louis@chmn.me>\n - @copyright Copyright (c) 2022 Marcel Klehr <mklehr@gmx.net>\n -\n - @author Louis Chemineau <louis@chmn.me>\n - @author Marcel Klehr <mklehr@gmx.net>\n -\n - @license AGPL-3.0-or-later\n -\n - This program is free software: you can redistribute it and/or modify\n - it under the terms of the GNU Affero General Public License as\n - published by the Free Software Foundation, either version 3 of the\n - License, or (at your option) any later version.\n -\n - This program is distributed in the hope that it will be useful,\n - but WITHOUT ANY WARRANTY; without even the implied warranty of\n - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n - GNU Affero General Public License for more details.\n -\n - You should have received a copy of the GNU Affero General Public License\n - along with this program. If not, see <http://www.gnu.org/licenses/>.\n -\n -->\n\n<template>\n\t<div :class=\"['face-cover', small && 'face-cover--small']\" @click=\"$emit('click')\">\n\t\t<div class=\"face-cover__crop-container\">\n\t\t\t<img ref=\"image\"\n\t\t\t\tclass=\"face-cover__image\"\n\t\t\t\t:src=\"coverUrl\"\n\t\t\t\t:style=\"coverDimensions\">\n\t\t</div>\n\t\t<div class=\"face-cover__details\">\n\t\t\t<div v-if=\"!baseName.match(/^[0-9]+$/)\" class=\"face-cover__details__first-line\">\n\t\t\t\t<span class=\"face-cover__details__name\">\n\t\t\t\t\t{{ baseName }}\n\t\t\t\t</span>\n\t\t\t</div>\n\t\t\t<div v-if=\"!small\" class=\"face-cover__details__second-line\">\n\t\t\t\t{{ n('photos', '%n photos', '%n photos', face.props['nbItems']) }}\n\t\t\t</div>\n\t\t</div>\n\t</div>\n</template>\n\n<script>\nimport { mapGetters } from 'vuex'\nimport { generateUrl } from '@nextcloud/router'\nimport FetchFacesMixin from '../../mixins/FetchFacesMixin.js'\nimport FaceCoverMixin from '../../mixins/FaceCoverMixin.js'\n\nexport default {\n\tname: 'FaceCover',\n\n\tmixins: [\n\t\tFetchFacesMixin,\n\t\tFaceCoverMixin,\n\t],\n\n\tprops: {\n\t\tbaseName: {\n\t\t\ttype: String,\n\t\t\trequired: true,\n\t\t},\n\t\tsmall: {\n\t\t\ttype: Boolean,\n\t\t\tdefault: false,\n\t\t},\n\t},\n\n\tdata() {\n\t\treturn {\n\t\t\tobserver: null,\n\t\t}\n\t},\n\n\tcomputed: {\n\t\t...mapGetters([\n\t\t\t'files',\n\t\t\t'faces',\n\t\t\t'facesFiles',\n\t\t]),\n\n\t\t/**\n\t\t * @return {Face}\n\t\t */\n\t\tface() {\n\t\t\treturn this.faces[this.baseName]\n\t\t},\n\n\t\t/**\n\t\t * @return {string}\n\t\t */\n\t\tcoverUrl() {\n\t\t\tif (!this.cover) {\n\t\t\t\treturn ''\n\t\t\t}\n\n\t\t\treturn generateUrl(`/apps/photos/api/v1/preview/${this.cover.fileid}?x=${512}&y=${512}`)\n\t\t},\n\n\t\tcover() {\n\t\t\treturn this.getFaceCover(this.face.basename)\n\t\t},\n\n\t\tcoverDimensions() {\n\t\t\tif (!this.cover) return {}\n\t\t\treturn this.getCoverStyle(this.face.basename)\n\t\t},\n\t},\n}\n</script>\n\n<style lang=\"scss\" scoped>\n@import '../../mixins/FaceCover';\n</style>\n","import mod from \"-!../../../node_modules/babel-loader/lib/index.js!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./FaceCover.vue?vue&type=script&lang=js\"; export default mod; export * from \"-!../../../node_modules/babel-loader/lib/index.js!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./FaceCover.vue?vue&type=script&lang=js\"","\n import API from \"!../../../node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js\";\n import domAPI from \"!../../../node_modules/style-loader/dist/runtime/styleDomAPI.js\";\n import insertFn from \"!../../../node_modules/style-loader/dist/runtime/insertBySelector.js\";\n import setAttributes from \"!../../../node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js\";\n import insertStyleElement from \"!../../../node_modules/style-loader/dist/runtime/insertStyleElement.js\";\n import styleTagTransformFn from \"!../../../node_modules/style-loader/dist/runtime/styleTagTransform.js\";\n import content, * as namedExport from \"!!../../../node_modules/css-loader/dist/cjs.js!../../../node_modules/vue-loader/lib/loaders/stylePostLoader.js!../../../node_modules/postcss-loader/dist/cjs.js!../../../node_modules/sass-loader/dist/cjs.js??clonedRuleSet-2.use[3]!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./FaceCover.vue?vue&type=style&index=0&id=f77c54d0&prod&lang=scss&scoped=true\";\n \n \n\nvar options = {};\n\noptions.styleTagTransform = styleTagTransformFn;\noptions.setAttributes = setAttributes;\n\n options.insert = insertFn.bind(null, \"head\");\n \noptions.domAPI = domAPI;\noptions.insertStyleElement = insertStyleElement;\n\nvar update = API(content, options);\n\n\n\nexport * from \"!!../../../node_modules/css-loader/dist/cjs.js!../../../node_modules/vue-loader/lib/loaders/stylePostLoader.js!../../../node_modules/postcss-loader/dist/cjs.js!../../../node_modules/sass-loader/dist/cjs.js??clonedRuleSet-2.use[3]!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./FaceCover.vue?vue&type=style&index=0&id=f77c54d0&prod&lang=scss&scoped=true\";\n export default content && content.locals ? content.locals : undefined;\n","import { render, staticRenderFns } from \"./FaceCover.vue?vue&type=template&id=f77c54d0&scoped=true\"\nimport script from \"./FaceCover.vue?vue&type=script&lang=js\"\nexport * from \"./FaceCover.vue?vue&type=script&lang=js\"\nimport style0 from \"./FaceCover.vue?vue&type=style&index=0&id=f77c54d0&prod&lang=scss&scoped=true\"\n\n\n/* normalize component */\nimport normalizer from \"!../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js\"\nvar component = normalizer(\n script,\n render,\n staticRenderFns,\n false,\n null,\n \"f77c54d0\",\n null\n \n)\n\nexport default component.exports"],"names":["name","computed","mapGetters","methods","getFaceCover","faceName","JSON","parse","he","this","faces","props","getCoverStyle","cover","detection","zoom","Math","max","width","horizontalCenterOfFace","x","verticalCenterOfFace","y","height","transform","concat","transformOrigin","data","errorFetchingFaces","loadingFaces","errorFetchingFiles","loadingFiles","mixins","AbortControllerMixin","async","fetchFaces","mapActions","Object","keys","length","_getCurrentUser","client","getCurrentUser","uid","DavRequest","details","signal","abortController","$store","dispatch","logger","error","response","status","t","showError","force","facesFiles","_getCurrentUser2","fetchedFiles","map","file","genFileInfo","filename","realpath","replace","faceDetections","fileIds","fileid","appendFiles","commit","fileIdsToAdd","unassignedFiles","_getCurrentUser3","_getCurrentUser4","unassignedFacesRoot","count","Number","nbItems","___CSS_LOADER_EXPORT___","push","module","id","FetchFacesMixin","FaceCoverMixin","baseName","type","String","required","small","Boolean","default","observer","face","coverUrl","generateUrl","basename","coverDimensions","options","styleTagTransform","setAttributes","insert","domAPI","insertStyleElement","_vm","_c","_self","class","on","$event","$emit","staticClass","ref","style","attrs","_v","match","_e","_s","n"],"sourceRoot":""}