photos/js/photos-node_modules_vue-mat...

1 line
32 KiB
Plaintext

{"version":3,"file":"photos-node_modules_vue-material-design-icons_AccountBoxMultipleOutline_vue-src_components_FaceCover_vue.js?v=9bdbe4009c1718cf139a","mappings":";iNAwBA,SACCA,KAAM,iBAENC,SAAU,KACNC,WAAAA,IAAW,CACb,QACA,aACA,WAIFC,QAAS,CACRC,aAAaC,GAEZ,MAAMC,EAAqBC,GACnBC,KAAKC,IAAI,GAAI,GAAKF,EAAcG,EAA0B,GAAtBH,EAAcI,QACvDH,KAAKC,IAAI,GAAI,GAAKF,EAAcK,EAA2B,GAAvBL,EAAcM,SAClDL,KAAKC,IAAI,GAAI,GAAK,GAAKF,EAAcG,EAAIH,EAAcI,OAA+B,GAAtBJ,EAAcI,QAC9EH,KAAKC,IAAI,GAAI,GAAK,GAAKF,EAAcK,EAAIL,EAAcM,QAAiC,GAAvBN,EAAcM,SAGlF,OAAQC,KAAKC,WAAWV,IAAa,IACnCW,MAAM,EAAG,IACTC,KAAIC,GAAUJ,KAAKK,MAAMD,KAEzBE,MAAK,CAACC,EAAGC,IACTA,EAAEC,eAAeC,MAAKC,GAAKA,EAAEC,QAAUrB,IAAUM,MAC/CU,EAAEE,eAAeC,MAAKC,GAAKA,EAAEC,QAAUrB,IAAUM,QAGnDS,MAAK,CAACC,EAAGC,IACTD,EAAEE,eAAeI,OACfL,EAAEC,eAAeI,SAGnBP,MAAK,CAACC,EAAGC,IACThB,EAAkBe,EAAEE,eAAeC,MAAKC,GAAKA,EAAEC,QAAUrB,KACvDC,EAAkBgB,EAAEC,eAAeC,MAAKC,GAAKA,EAAEC,QAAUrB,OAC1D,EACJ,EASAuB,cAAcvB,GACb,MAAMwB,EAAQf,KAAKV,aAAaC,GAChC,IAAKwB,EACJ,MAAO,CAAC,EAET,MAEMC,EAFaD,EAAMN,eAEIC,MAAKM,GAAaA,EAAUJ,QAAUrB,IAI7D0B,EAAOvB,KAAKC,IAAI,EAAI,EAAIqB,EAAUnB,MAAS,I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AAIU,GAAG,KAAKT,EAAG,MAAM,CAACG,YAAY,uBAAuB,CAAGJ,EAAIe,SAASkC,MAAM,YAAmLjD,EAAIY,KAA1KX,EAAG,MAAM,CAACG,YAAY,mCAAmC,CAACH,EAAG,KAAK,CAACG,YAAY,6BAA6B,CAACJ,EAAIU,GAAG,aAAaV,EAAIW,GAAGX,EAAIe,UAAU,gBAAyBf,EAAIU,GAAG,KAAMV,EAAI/E,WAAW+E,EAAIe,YAAcf,EAAIiB,MAAOhB,EAAG,MAAM,CAACG,YAAY,oCAAoC,CAACJ,EAAIU,GAAG,WAAWV,EAAIW,GAAGX,EAAIkD,EAAE,SAAU,YAAa,YAAalD,EAAI/E,WAAW+E,EAAIe,UAAUlF,SAAU,YAAYmE,EAAIY,QAC91B,GACsB,IIUpB,EACA,KACA,WACA,MAI8B","sources":["webpack:///photos/src/mixins/FaceCoverMixin.js","webpack:///photos/src/mixins/FetchFacesMixin.js","webpack:///photos/src/components/FaceCover.vue?vue&type=style&index=0&id=53f3a852&prod&lang=scss&scoped=true","webpack:///photos/node_modules/vue-material-design-icons/AccountBoxMultipleOutline.vue","webpack:///photos/node_modules/vue-material-design-icons/AccountBoxMultipleOutline.vue?vue&type=script&lang=js","webpack://photos/./node_modules/vue-material-design-icons/AccountBoxMultipleOutline.vue?a4da","webpack:///photos/node_modules/vue-material-design-icons/AccountBoxMultipleOutline.vue?vue&type=template&id=6bcc1fce","webpack://photos/./src/components/FaceCover.vue?a1ab","webpack:///photos/src/components/FaceCover.vue","webpack:///photos/src/components/FaceCover.vue?vue&type=script&lang=js","webpack://photos/./src/components/FaceCover.vue?b76e","webpack://photos/./src/components/FaceCover.vue?d6a7"],"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'\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\t// Give high scores for faces that intersect with the edge of the picture (with a margin of half the face size)\n\t\t\tconst scoreFacePosition = (faceDetection) => {\n\t\t\t\treturn Math.max(0, -1 * (faceDetection.x - faceDetection.width * 0.5))\n\t\t\t\t+ Math.max(0, -1 * (faceDetection.y - faceDetection.height * 0.5))\n\t\t\t\t+ Math.max(0, -1 * (1 - (faceDetection.x + faceDetection.width) - faceDetection.width * 0.5))\n\t\t\t\t+ Math.max(0, -1 * (1 - (faceDetection.y + faceDetection.height) - faceDetection.height * 0.5))\n\t\t\t}\n\n\t\t\treturn (this.facesFiles[faceName] || [])\n\t\t\t\t.slice(0, 25)\n\t\t\t\t.map(fileId => this.files[fileId])\n\t\t\t\t// sort larges face first\n\t\t\t\t.sort((a, b) =>\n\t\t\t\t\tb.faceDetections.find(d => d.title === faceName).width\n\t\t\t\t\t- a.faceDetections.find(d => d.title === faceName).width\n\t\t\t\t)\n\t\t\t\t// sort fewest face detections first\n\t\t\t\t.sort((a, b) =>\n\t\t\t\t\ta.faceDetections.length\n\t\t\t\t\t- b.faceDetections.length\n\t\t\t\t)\n\t\t\t\t// Sort faces that are at the edge last\n\t\t\t\t.sort((a, b) =>\n\t\t\t\t\tscoreFacePosition(a.faceDetections.find(d => d.title === faceName))\n\t\t\t\t\t- scoreFacePosition(b.faceDetections.find(d => d.title === faceName))\n\t\t\t\t)[0]\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) {\n\t\t\t\treturn {}\n\t\t\t}\n\t\t\tconst detections = cover.faceDetections\n\n\t\t\tconst detection = detections.find(detection => detection.title === faceName)\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\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-53f3a852]{display:flex;flex-direction:column;padding:10px;border-radius:var(--border-radius-large)}.face-cover__crop-container[data-v-53f3a852]{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-53f3a852]{width:95px;height:95px;--photos-face-width: 95px}}.face-cover[data-v-53f3a852]:hover,.face-cover[data-v-53f3a852]:focus{background:var(--color-background-hover)}.face-cover__details[data-v-53f3a852]{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-53f3a852]{width:95px}}.face-cover__details__first-line[data-v-53f3a852]{display:flex;height:2em;overflow:hidden;text-overflow:ellipsis}.face-cover__details__second-line[data-v-53f3a852]{margin-top:6px;color:var(--color-text-maxcontrast)}.face-cover__details__name[data-v-53f3a852]{flex-grow:1;margin:0}.face-cover--small *[data-v-53f3a852]{font-size:15px !important}.face-cover--small .face-cover__details[data-v-53f3a852]{width:60px !important}.face-cover--small .face-cover__crop-container[data-v-53f3a852]{width:60px !important;height:60px !important;--photos-face-width: 60px !important}\", \"\",{\"version\":3,\"sources\":[\"webpack://./src/components/FaceCover.vue\"],\"names\":[],\"mappings\":\"AAEA,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,CAMF,sCACC,yBAAA,CAED,yDACC,qBAAA,CAED,gEACC,qBAAA,CACA,sBAAA,CACA,oCAAA\",\"sourcesContent\":[\"$sizes: (\\\"400\\\": (\\\"count\\\": 3, \\\"marginTop\\\": 66, \\\"marginW\\\": 8), \\\"700\\\": (\\\"count\\\": 4, \\\"marginTop\\\": 66, \\\"marginW\\\": 8), \\\"1024\\\": (\\\"count\\\": 5, \\\"marginTop\\\": 66, \\\"marginW\\\": 44), \\\"1280\\\": (\\\"count\\\": 4, \\\"marginTop\\\": 66, \\\"marginW\\\": 44), \\\"1440\\\": (\\\"count\\\": 5, \\\"marginTop\\\": 88, \\\"marginW\\\": 66), \\\"1600\\\": (\\\"count\\\": 6, \\\"marginTop\\\": 88, \\\"marginW\\\": 66), \\\"2048\\\": (\\\"count\\\": 7, \\\"marginTop\\\": 88, \\\"marginW\\\": 66), \\\"2560\\\": (\\\"count\\\": 8, \\\"marginTop\\\": 88, \\\"marginW\\\": 88), \\\"3440\\\": (\\\"count\\\": 9, \\\"marginTop\\\": 88, \\\"marginW\\\": 88), \\\"max\\\": (\\\"count\\\": 10, \\\"marginTop\\\": 88, \\\"marginW\\\": 88));\\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}\\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","<template>\n <span v-bind=\"$attrs\"\n :aria-hidden=\"!title\"\n :aria-label=\"title\"\n class=\"material-design-icon account-box-multiple-outline-icon\"\n role=\"img\"\n @click=\"$emit('click', $event)\">\n <svg :fill=\"fillColor\"\n class=\"material-design-icon__svg\"\n :width=\"size\"\n :height=\"size\"\n viewBox=\"0 0 24 24\">\n <path d=\"M4 6H2V20C2 21.11 2.9 22 4 22H18V20H4V6M18.5 14.25C18.5 12.75 15.5 12 14 12S9.5 12.75 9.5 14.25V15H18.5M14 10.25C15.24 10.25 16.25 9.24 16.25 8S15.24 5.75 14 5.75 11.75 6.76 11.75 8 12.76 10.25 14 10.25M20 2H8C6.9 2 6 2.9 6 4V16C6 17.11 6.9 18 8 18H20C21.11 18 22 17.11 22 16V4C22 2.89 21.1 2 20 2M20 16H8V4H20V16Z\">\n <title v-if=\"title\">{{ title }}</title>\n </path>\n </svg>\n </span>\n</template>\n\n<script>\nexport default {\n name: \"AccountBoxMultipleOutlineIcon\",\n emits: ['click'],\n props: {\n title: {\n type: String,\n },\n fillColor: {\n type: String,\n default: \"currentColor\"\n },\n size: {\n type: Number,\n default: 24\n }\n }\n}\n</script>","import mod from \"-!../vue-loader/lib/index.js??vue-loader-options!./AccountBoxMultipleOutline.vue?vue&type=script&lang=js\"; export default mod; export * from \"-!../vue-loader/lib/index.js??vue-loader-options!./AccountBoxMultipleOutline.vue?vue&type=script&lang=js\"","import { render, staticRenderFns } from \"./AccountBoxMultipleOutline.vue?vue&type=template&id=6bcc1fce\"\nimport script from \"./AccountBoxMultipleOutline.vue?vue&type=script&lang=js\"\nexport * from \"./AccountBoxMultipleOutline.vue?vue&type=script&lang=js\"\n\n\n/* normalize component */\nimport normalizer from \"!../vue-loader/lib/runtime/componentNormalizer.js\"\nvar component = normalizer(\n script,\n render,\n staticRenderFns,\n false,\n null,\n null,\n null\n \n)\n\nexport default component.exports","var render = function render(){var _vm=this,_c=_vm._self._c;return _c('span',_vm._b({staticClass:\"material-design-icon account-box-multiple-outline-icon\",attrs:{\"aria-hidden\":!_vm.title,\"aria-label\":_vm.title,\"role\":\"img\"},on:{\"click\":function($event){return _vm.$emit('click', $event)}}},'span',_vm.$attrs,false),[_c('svg',{staticClass:\"material-design-icon__svg\",attrs:{\"fill\":_vm.fillColor,\"width\":_vm.size,\"height\":_vm.size,\"viewBox\":\"0 0 24 24\"}},[_c('path',{attrs:{\"d\":\"M4 6H2V20C2 21.11 2.9 22 4 22H18V20H4V6M18.5 14.25C18.5 12.75 15.5 12 14 12S9.5 12.75 9.5 14.25V15H18.5M14 10.25C15.24 10.25 16.25 9.24 16.25 8S15.24 5.75 14 5.75 11.75 6.76 11.75 8 12.76 10.25 14 10.25M20 2H8C6.9 2 6 2.9 6 4V16C6 17.11 6.9 18 8 18H20C21.11 18 22 17.11 22 16V4C22 2.89 21.1 2 20 2M20 16H8V4H20V16Z\"}},[(_vm.title)?_c('title',[_vm._v(_vm._s(_vm.title))]):_vm._e()])])])\n}\nvar staticRenderFns = []\n\nexport { render, staticRenderFns }","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('h2',{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.facesFiles[_vm.baseName] && !_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.facesFiles[_vm.baseName].length,))+\"\\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<h2 class=\"face-cover__details__name\">\n\t\t\t\t\t{{ baseName }}\n\t\t\t\t</h2>\n\t\t\t</div>\n\t\t\t<div v-if=\"facesFiles[baseName] && !small\" class=\"face-cover__details__second-line\">\n\t\t\t\t{{ n('photos', '%n photos', '%n photos', facesFiles[baseName].length,) }}\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\tasync mounted() {\n\t\tthis.waitForVisible(this.$el, (isVisible) => {\n\t\t\tif (!this.facesFiles[this.face.basename]) {\n\t\t\t\tthis.fetchFiles()\n\t\t\t}\n\t\t})\n\t},\n\n\tbeforeDestroy() {\n\t\tthis.observer.disconnect()\n\t},\n\n\tmethods: {\n\t\tasync fetchFiles() {\n\t\t\tawait this.fetchFaceContent(this.face.basename)\n\t\t},\n\t\twaitForVisible(el, listener) {\n\t\t\tthis.observer = new IntersectionObserver((entries, observer) => {\n\t\t\t\tentries.forEach(entry => {\n\t\t\t\t\tif (entry.intersectionRatio > 0) {\n\t\t\t\t\t\tlistener()\n\t\t\t\t\t\tobserver.disconnect()\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t})\n\n\t\t\tthis.observer.observe(el)\n\t\t},\n\t},\n}\n</script>\n\n<style lang=\"scss\" scoped>\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}\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</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=53f3a852&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=53f3a852&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=53f3a852&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=53f3a852&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 \"53f3a852\",\n null\n \n)\n\nexport default component.exports"],"names":["name","computed","mapGetters","methods","getFaceCover","faceName","scoreFacePosition","faceDetection","Math","max","x","width","y","height","this","facesFiles","slice","map","fileId","files","sort","a","b","faceDetections","find","d","title","length","getCoverStyle","cover","detection","zoom","horizontalCenterOfFace","verticalCenterOfFace","transform","concat","transformOrigin","data","errorFetchingFaces","loadingFaces","errorFetchingFiles","loadingFiles","mixins","AbortControllerMixin","async","fetchFaces","mapActions","Object","keys","faces","_getCurrentUser","client","getCurrentUser","uid","DavRequest","details","signal","abortController","$store","dispatch","logger","error","response","status","t","showError","force","_getCurrentUser2","fetchedFiles","file","genFileInfo","filename","he","realpath","replace","JSON","parse","fileIds","fileid","appendFiles","commit","fileIdsToAdd","___CSS_LOADER_EXPORT___","push","module","id","emits","props","type","String","fillColor","default","size","Number","_vm","_c","_self","_b","staticClass","attrs","on","$event","$emit","$attrs","_v","_s","_e","FetchFacesMixin","FaceCoverMixin","baseName","required","small","Boolean","observer","face","coverUrl","generateUrl","basename","coverDimensions","waitForVisible","$el","isVisible","fetchFiles","beforeDestroy","disconnect","fetchFaceContent","el","listener","IntersectionObserver","entries","forEach","entry","intersectionRatio","observe","options","styleTagTransform","setAttributes","insert","domAPI","insertStyleElement","class","ref","style","match","n"],"sourceRoot":""}