(this.webpackJsonpui=this.webpackJsonpui||[]).push([[0],{121:function(e,t,a){e.exports=a.p+"static/media/error_404.cbc5c16e.svg"},122:function(e,t,a){e.exports=a(191)},131:function(e,t,a){},159:function(e,t,a){},191:function(e,t,a){"use strict";a.r(t);var n,o,r,c,i,s,l,u,m,d,p,h,f,b,v,g,E,y,w,O,j,N,P,S,k,x,C,F,D,I,U,A,T,L,z,R,M,W,B,V,q,G,_,J,Y,H,Z,$,K,Q,X,ee=a(0),te=a.n(ee),ae=a(26),ne=a.n(ae),oe=a(12),re=(a(127),a(131),a(10)),ce=(a(132),a(3)),ie=a.n(ce),se=a(4),le=a(68),ue=a(17),me=a(22),de=a(86),pe=Object(re.a)((function(e){var t=e.component,a=Object(de.a)(e,["component"]),n=Le().user;return te.a.createElement(oe.b,Object.assign({},a,{render:function(e){return n?te.a.createElement(t,Object.assign({},a,e)):te.a.createElement(oe.a,{to:{pathname:"/login",state:{from:e.location}}})}}))})),he=Object(re.a)((function(e){var t=e.component,a=Object(de.a)(e,["component"]),n=Le().user;return te.a.createElement(oe.b,Object.assign({},a,{render:function(e){return n?te.a.createElement(oe.a,{to:"/"}):te.a.createElement(t,Object.assign({},a,e))}}))})),fe=a(5),be=a(8),ve=a(9),ge=a(2),Ee=(a(51),a(37)),ye=(a(140),a(1)),we=function(e){var t=e.children;return te.a.createElement("div",{className:"overlay"},te.a.createElement("div",{className:"modal"},t))},Oe=Object(re.a)((function(e){return e.visible?te.a.createElement(we,null,te.a.createElement("span",{className:"heading-sm text-accent"},e.header),te.a.createElement("p",{className:"paragraph text-center mb-48"},e.body),te.a.createElement("button",{className:"btn full-width",type:"button",onClick:function(t){t.preventDefault(),e.onOkClick()}},"Ok")):te.a.createElement(te.a.Fragment,null)})),je=(l=function e(){Object(be.a)(this,e),Object(fe.a)(this,"visible",o,this),Object(fe.a)(this,"header",r,this),Object(fe.a)(this,"body",c,this),Object(fe.a)(this,"show",i,this),Object(fe.a)(this,"hideModal",s,this)},n=l,o=Object(ge.a)(n.prototype,"visible",[ye.observable],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),r=Object(ge.a)(n.prototype,"header",[ye.observable],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return""}}),c=Object(ge.a)(n.prototype,"body",[ye.observable],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return""}}),i=Object(ge.a)(n.prototype,"show",[ye.action],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){var e=this;return function(t,a){e.visible=!0,e.header=t,e.body=a}}}),s=Object(ge.a)(n.prototype,"hideModal",[ye.action],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){var e=this;return function(){e.visible=!1}}}),n),Ne=new je,Pe=te.a.createContext(Ne),Se=a(29),ke=a(94),xe=Object(Se.a)(),Ce=new ke.RouterStore,Fe=Object(ke.syncHistoryWithStore)(xe,Ce),De=te.a.createContext(Ce),Ie=function(){return te.a.useContext(De)},Ue=(E=function(){function e(t,a){Object(be.a)(this,e),this.infoModalStore=t,this.routerStore=a,Object(fe.a)(this,"showLoading",m,this),Object(fe.a)(this,"userInfoLoaded",d,this),Object(fe.a)(this,"invalidLoginOrPassword",p,this),Object(fe.a)(this,"userAlreadyExist",h,this),Object(fe.a)(this,"userNotFound",f,this),Object(fe.a)(this,"user",b,this),Object(fe.a)(this,"showSignOutPopup",v,this),Object(fe.a)(this,"onUserChanged",g,this)}return Object(ve.a)(e,[{key:"configure",value:function(){Ee.auth().onAuthStateChanged(this.onUserChanged)}},{key:"signIn",value:function(){var e=Object(se.a)(ie.a.mark((function e(t,a){return ie.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,Ee.auth().signInWithEmailAndPassword(t,a);case 3:e.next=8;break;case 5:e.prev=5,e.t0=e.catch(0),e.t0.code&&e.t0.code.match(/^auth\/./)&&(this.invalidLoginOrPassword=!0);case 8:case"end":return e.stop()}}),e,this,[[0,5]])})));return function(t,a){return e.apply(this,arguments)}}()},{key:"signUp",value:function(){var e=Object(se.a)(ie.a.mark((function e(t,a){var n;return ie.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.showLoading=!0,e.prev=1,e.next=4,Ee.auth().createUserWithEmailAndPassword(t,a);case 4:if((n=e.sent)&&n.user){e.next=9;break}return console.error("cannot retrieve user. User credentials is :"),console.error(n),e.abrupt("return");case 9:return e.next=11,Ee.auth().signInWithEmailAndPassword(t,a);case 11:this.routerStore.push("/"),e.next=18;break;case 14:e.prev=14,e.t0=e.catch(1),e.t0.code&&"auth/email-already-in-use"===e.t0.code&&(this.userAlreadyExist=!0),console.warn(e.t0);case 18:return e.prev=18,this.showLoading=!1,e.finish(18);case 21:case"end":return e.stop()}}),e,this,[[1,14,18,21]])})));return function(t,a){return e.apply(this,arguments)}}()},{key:"sendPasswordRecoveryEmail",value:function(){var e=Object(se.a)(ie.a.mark((function e(t,a){return ie.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,!a){e.next=6;break}return e.next=4,Ee.auth().sendPasswordResetEmail(t,{url:a});case 4:e.next=8;break;case 6:return e.next=8,Ee.auth().sendPasswordResetEmail(t);case 8:this.infoModalStore.show("Password recovery email sent","Check your email for further instructions. You can close this page."),e.next=14;break;case 11:e.prev=11,e.t0=e.catch(0),e.t0.code&&"auth/user-not-found"===e.t0.code?this.userNotFound=!0:this.infoModalStore.show("Unexpected error",e.t0.message);case 14:case"end":return e.stop()}}),e,this,[[0,11]])})));return function(t,a){return e.apply(this,arguments)}}()},{key:"confirmResetPassword",value:function(){var e=Object(se.a)(ie.a.mark((function e(t,a){return ie.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,Ee.auth().verifyPasswordResetCode(a);case 3:return e.prev=3,e.next=6,Ee.auth().confirmPasswordReset(a,t);case 6:this.routerStore.push("/login"),this.infoModalStore.show("Password successfully reset","You can now sign in with new credentials."),e.next=14;break;case 10:e.prev=10,e.t0=e.catch(3),console.warn("cannot reset password"),console.error(e.t0);case 14:e.next=20;break;case 16:e.prev=16,e.t1=e.catch(0),this.infoModalStore.show("Invalid link","Invalid or expired link for password reset."),console.error(e.t1);case 20:case"end":return e.stop()}}),e,this,[[0,16],[3,10]])})));return function(t,a){return e.apply(this,arguments)}}()},{key:"startSignOut",value:function(){this.showSignOutPopup=!0}},{key:"completeSignOut",value:function(){var e=Object(se.a)(ie.a.mark((function e(){return ie.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Ee.auth().signOut();case 2:this.routerStore.push("/login"),this.showSignOutPopup=!1;case 4:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"cancelSignOut",value:function(){this.showSignOutPopup=!1}}]),e}(),u=E,m=Object(ge.a)(u.prototype,"showLoading",[ye.observable],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!0}}),d=Object(ge.a)(u.prototype,"userInfoLoaded",[ye.observable],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),p=Object(ge.a)(u.prototype,"invalidLoginOrPassword",[ye.observable],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),h=Object(ge.a)(u.prototype,"userAlreadyExist",[ye.observable],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),f=Object(ge.a)(u.prototype,"userNotFound",[ye.observable],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),b=Object(ge.a)(u.prototype,"user",[ye.observable],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),v=Object(ge.a)(u.prototype,"showSignOutPopup",[ye.observable],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),Object(ge.a)(u.prototype,"signIn",[ye.action],Object.getOwnPropertyDescriptor(u.prototype,"signIn"),u.prototype),Object(ge.a)(u.prototype,"signUp",[ye.action],Object.getOwnPropertyDescriptor(u.prototype,"signUp"),u.prototype),Object(ge.a)(u.prototype,"sendPasswordRecoveryEmail",[ye.action],Object.getOwnPropertyDescriptor(u.prototype,"sendPasswordRecoveryEmail"),u.prototype),Object(ge.a)(u.prototype,"confirmResetPassword",[ye.action],Object.getOwnPropertyDescriptor(u.prototype,"confirmResetPassword"),u.prototype),g=Object(ge.a)(u.prototype,"onUserChanged",[ye.action],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){var e=this;return function(t){e.user=t,e.showLoading=!1,e.userInfoLoaded=!0}}}),Object(ge.a)(u.prototype,"startSignOut",[ye.action],Object.getOwnPropertyDescriptor(u.prototype,"startSignOut"),u.prototype),Object(ge.a)(u.prototype,"completeSignOut",[ye.action],Object.getOwnPropertyDescriptor(u.prototype,"completeSignOut"),u.prototype),Object(ge.a)(u.prototype,"cancelSignOut",[ye.action],Object.getOwnPropertyDescriptor(u.prototype,"cancelSignOut"),u.prototype),u),Ae=new Ue(Ne,Ce),Te=te.a.createContext(Ae),Le=function(){return te.a.useContext(Te)},ze=a(41),Re=a(112),Me=a.n(Re),We=a(24),Be=a.n(We),Ve=new(function(){function e(){Object(be.a)(this,e)}return Object(ve.a)(e,[{key:"loadSettings",value:function(){var e=Object(se.a)(ie.a.mark((function e(){var t;return ie.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Be.a.get("/appsettings.json?tick=".concat(new Date));case 2:return t=e.sent,e.abrupt("return",t.data);case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}()},{key:"configureApplicationDefaults",value:function(e){Ee.initializeApp(e),Object.assign(Ge,e),Be.a.interceptors.request.use(function(){var e=Object(se.a)(ie.a.mark((function e(t){var a;return ie.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!Ae.user){e.next=5;break}return e.next=3,Ae.user.getIdToken();case 3:a=e.sent,t.headers.Authorization="Bearer ".concat(a);case 5:return e.abrupt("return",t);case 6:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}())}}]),e}()),qe=function e(){Object(be.a)(this,e),this.addPhotos="",this.getPhotos="",this.findSimilarFace="",this.getEmotions=""},Ge=new function e(){Object(be.a)(this,e),this.uiUrl="",this.apiKey="",this.authDomain="",this.api=new qe},_e=new(function(){function e(){Object(be.a)(this,e)}return Object(ve.a)(e,[{key:"addPhotos",value:function(){var e=Object(se.a)(ie.a.mark((function e(t){var a;return ie.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(""!==Ge.api.addPhotos){e.next=3;break}return console.error("addPhotos function url is not specified."),e.abrupt("return");case 3:return a=new FormData,t.forEach((function(e){a.append("files",e)})),e.prev=5,e.next=8,Be.a.post(Ge.api.addPhotos,a);case 8:e.next=14;break;case 10:return e.prev=10,e.t0=e.catch(5),console.error(e.t0),e.abrupt("return");case 14:case"end":return e.stop()}}),e,null,[[5,10]])})));return function(t){return e.apply(this,arguments)}}()}]),e}()),Je={headers:{"Content-Type":"application/x-www-form-urlencoded"}},Ye=new(function(){function e(){Object(be.a)(this,e)}return Object(ve.a)(e,[{key:"getAllPhotos",value:function(){var e=Object(se.a)(ie.a.mark((function e(){var t;return ie.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Be.a.post(Ge.api.getPhotos);case 2:return t=e.sent,e.abrupt("return",t.data);case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}()},{key:"getPhotosByFaces",value:function(){var e=Object(se.a)(ie.a.mark((function e(t){var a,n;return ie.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t&&t.length){e.next=2;break}return e.abrupt("return",[]);case 2:return(a=new URLSearchParams).append("persistedIds",JSON.stringify(t)),e.next=6,Be.a.post("".concat(Ge.api.getPhotos),a,Je);case 6:return n=e.sent,e.abrupt("return",n.data);case 8:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()},{key:"getPhotosByEmotionFilter",value:function(){var e=Object(se.a)(ie.a.mark((function e(t){var a,n;return ie.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t&&t.length){e.next=2;break}return e.abrupt("return",[]);case 2:return(a=new URLSearchParams).append("emotionIds",JSON.stringify(t)),a.append("minConfidence","".concat(.4)),e.next=7,Be.a.post("".concat(Ge.api.getPhotos),a,Je);case 7:return n=e.sent,e.abrupt("return",n.data);case 9:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()},{key:"getPhotosByFacesAndEmotions",value:function(){var e=Object(se.a)(ie.a.mark((function e(t,a){var n,o;return ie.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a&&a.length&&t&&t.length){e.next=2;break}return e.abrupt("return",[]);case 2:return(n=new URLSearchParams).append("emotionIds",JSON.stringify(a)),n.append("persistedIds",JSON.stringify(t)),n.append("minConfidence","".concat(.4)),e.next=8,Be.a.post("".concat(Ge.api.getPhotos),n,Je);case 8:return o=e.sent,e.abrupt("return",o.data);case 10:case"end":return e.stop()}}),e)})));return function(t,a){return e.apply(this,arguments)}}()},{key:"getFacesOnPhoto",value:function(){var e=Object(se.a)(ie.a.mark((function e(t){var a;return ie.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t){e.next=2;break}return e.abrupt("return",[]);case 2:return e.next=4,Be.a.get("".concat(Ge.api.getPhotos,"?objectId=").concat(t,"&minConfidence=",.4));case 4:return a=e.sent,e.abrupt("return",a.data);case 6:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()}]),e}()),He=new(function(){function e(){Object(be.a)(this,e)}return Object(ve.a)(e,[{key:"getAllEmotions",value:function(){var e=Object(se.a)(ie.a.mark((function e(){var t;return ie.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Be.a.get("".concat(Ge.api.getEmotions));case 2:return t=e.sent,e.abrupt("return",t.data);case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}()}]),e}()),Ze=new(function(){function e(){Object(be.a)(this,e)}return Object(ve.a)(e,[{key:"findSimilar",value:function(){var e=Object(se.a)(ie.a.mark((function e(t){var a,n;return ie.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=new FormData,t.forEach((function(e){a.append("files",e)})),e.prev=2,e.next=5,Be.a.post("".concat(Ge.api.findSimilarFace,"?minConfidence=0.7"),a);case 5:return n=e.sent,e.abrupt("return",n.data);case 9:return e.prev=9,e.t0=e.catch(2),e.abrupt("return",null);case 12:case"end":return e.stop()}}),e,null,[[2,9]])})));return function(t){return e.apply(this,arguments)}}()}]),e}()),$e=a(72),Ke=(a(158),a(159),function(){return te.a.createElement($e.a,{position:"top-right",className:"toaster",autoClose:10,newestOnTop:!1,closeOnClick:!0,rtl:!1,draggable:!0,hideProgressBar:!0})}),Qe=function(e,t){return function(e){var t=e.toasterType,a=e.toasterTitle,n=e.toasterContent,o=te.a.createElement(te.a.Fragment,null,te.a.createElement("i",{className:"toaster-icon"}),te.a.createElement("div",null,te.a.createElement("span",{className:"toaster-title"},a),te.a.createElement("p",{className:"toaster-text"},n)));switch(t){case"error":$e.b.error(o);break;case"success":$e.b.success(o);break;case"info":$e.b.info(o)}}({toasterType:"error",toasterTitle:t,toasterContent:e})},Xe=function(e){var t={},a=new Map;try{for(var n=function(){var e=Object(ue.a)(r[o],2),t=e[0];e[1].forEach((function(e,n){var o=e.similarUploadedFaces.sort().join("_");a.set(o,[t,n])}))},o=0,r=Object.entries(e);o1&&void 0!==arguments[1]?arguments[1]:10;return et(e.size)>t?"Max allowed file size is ".concat(t," MB"):e.name.match(/\.(jpg|jpeg|png|bmp|raw|heif)$/i)&&e.type.startsWith("image/")?null:"Invalid file type"},ot=function(e){return new Promise((function(t){var a=new FileReader;a.addEventListener("load",(function(){var e=new Image;e.src=a.result,t(e)})),a.readAsDataURL(e)}))},rt=a(113),ct=a.n(rt),it=function(){var e=Object(se.a)(ie.a.mark((function e(t,a){var n;return ie.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=[],e.next=3,new Promise((function(e,o){var r=new ct.a(t,{ready:function(t){a.map((function(e){r.setData({x:e.left,y:e.top,width:e.width,height:e.height});var t=at(r.getCroppedCanvas());n.push(t.toDataURL())})),r.destroy(),e()}})}));case 3:return e.abrupt("return",n);case 4:case"end":return e.stop()}}),e)})));return function(t,a){return e.apply(this,arguments)}}(),st=new(y=function(){function e(){Object(be.a)(this,e),Object(fe.a)(this,"loadingText",w,this)}return Object(ve.a)(e,[{key:"startLoading",value:function(e){this.loadingText=e}},{key:"stopLoading",value:function(){this.loadingText=null}}]),e}(),w=Object(ge.a)(y.prototype,"loadingText",[ye.observable],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),Object(ge.a)(y.prototype,"startLoading",[ye.action],Object.getOwnPropertyDescriptor(y.prototype,"startLoading"),y.prototype),Object(ge.a)(y.prototype,"stopLoading",[ye.action],Object.getOwnPropertyDescriptor(y.prototype,"stopLoading"),y.prototype),y),lt=te.a.createContext(st),ut=a(98),mt=new(O=function(){function e(){Object(be.a)(this,e),Object(fe.a)(this,"showEmotions",j,this),Object(fe.a)(this,"emotions",N,this),Object(fe.a)(this,"selectedEmotions",P,this)}return Object(ve.a)(e,[{key:"emotionsWithPosition",value:function(e){var t=0,a=0,n=0;return e.map((function(e,o){return Object(ut.a)(Object(ut.a)({},e),{},{top:"".concat(o<2?t+=10:t,"px"),left:"".concat(a+=20,"px"),opacity:"".concat(o<2?"1":"0.6"),zIndex:"".concat(o<2?"":n++)})}))}},{key:"loadAllEmotions",value:function(){var e=Object(se.a)(ie.a.mark((function e(){return ie.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,He.getAllEmotions();case 3:this.emotions=e.sent.map((function(e){return{id:e.emotionId,value:e.value.toLowerCase(),label:e.value.charAt(0).toUpperCase()+e.value.slice(1),count:e.count}})),e.next=10;break;case 6:e.prev=6,e.t0=e.catch(0),Qe("An error occurred while loading emotions."),console.error(e.t0);case 10:case"end":return e.stop()}}),e,this,[[0,6]])})));return function(){return e.apply(this,arguments)}}()},{key:"setEmotionVisible",value:function(e){this.showEmotions=e}},{key:"selectEmotion",value:function(e){this.selectedEmotions.push(e)}},{key:"removeSelectedEmotions",value:function(){for(var e=arguments.length,t=new Array(e),a=0;a0}},{key:"countSelectedPhotosOnGrid",get:function(){return this.photos.filter((function(e){return e.selected})).length}},{key:"selectedImageSrc",get:function(){var e;return(null===(e=this.selectedDetectedFace)||void 0===e?void 0:e.dataUrl)||vt.a}}]),Object(ve.a)(e,[{key:"setUploadingPhotos",value:function(){this.isUploadingPhotos=!0}},{key:"clearUploadingPhotos",value:function(){this.isUploadingPhotos=!1}},{key:"setSelecting",value:function(e){var t,a=Object(ze.a)(this.photos.filter((function(e){return e.selected})));try{for(a.s();!(t=a.n()).done;){t.value.selected=!1}}catch(n){a.e(n)}finally{a.f()}this.selectingPhotos=e}},{key:"resetSelecting",value:function(){var e,t=Object(ze.a)(this.photos.filter((function(e){return e.selected})));try{for(t.s();!(e=t.n()).done;){e.value.selected=!1}}catch(a){t.e(a)}finally{t.f()}this.selectingPhotos=!1}},{key:"setShowNoFaceOnImagePopup",value:function(e){this.showNoFaceOnImagePopup=e}},{key:"loadAllPhotos",value:function(){var e=Object(se.a)(ie.a.mark((function e(){return ie.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.resetSelecting(),this.selectedDetectedFace=null,this.detectedFaces=null,this.photos=[],this.loadingStore.startLoading("Loading images"),e.prev=5,e.next=8,Ye.getAllPhotos();case 8:this.photos=e.sent.sort((function(e,t){return Date.parse(t.timeCreated)-Date.parse(e.timeCreated)})).map((function(e){return{id:e.id,objectId:e.objectId,url:e.signedUrl,thumbnailUrl:e.thumbnail,selected:!1,emotions:[]}})),e.next=15;break;case 11:e.prev=11,e.t0=e.catch(5),Qe("An error occurred while loading photos."),console.error(e.t0);case 15:return e.prev=15,this.loadingStore.stopLoading(),e.finish(15);case 18:case"end":return e.stop()}}),e,this,[[5,11,15,18]])})));return function(){return e.apply(this,arguments)}}()},{key:"selectPhoto",value:function(){var e=Object(se.a)(ie.a.mark((function e(t,a){return ie.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.selectingPhotos?t.selected=!t.selected:(this.galeryStore.setPhotoIndexToShow(a),this.galeryStore.setShowGallery(!0),this.loadPhotoFacesEmotions(t));case 1:case"end":return e.stop()}}),e,this)})));return function(t,a){return e.apply(this,arguments)}}()},{key:"selectPhotosByEmotions",value:function(){var e=Object(se.a)(ie.a.mark((function e(){var t,a=this;return ie.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.resetSelecting(),this.selectedDetectedFace=null,this.detectedFaces=null,this.photos=[],this.loadingStore.startLoading("Loading images"),e.prev=5,t=this.emotionStore.selectedEmotions.map((function(e){return e.id})),e.next=9,Ye.getPhotosByEmotionFilter(t);case 9:this.photos=e.sent.map((function(e){return{id:e.id,objectId:e.objectId,url:e.signedUrl,thumbnailUrl:e.thumbnail,selected:!1,emotions:e.emotions.map((function(e){return{confidence:e.confidence,emotion:a.emotionStore.selectedEmotions.find((function(t){return t.id===e.id}))}}))}})),e.next=16;break;case 12:e.prev=12,e.t0=e.catch(5),Qe("An error occurred while loading photos."),console.error(e.t0);case 16:return e.prev=16,this.loadingStore.stopLoading(),e.finish(16);case 19:case"end":return e.stop()}}),e,this,[[5,12,16,19]])})));return function(){return e.apply(this,arguments)}}()},{key:"selectDetectedFace",value:function(){var e=Object(se.a)(ie.a.mark((function e(t){var a,n=this;return ie.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.selectedDetectedFace=t,this.photos=[],this.loadingStore.startLoading("Loading images"),e.prev=3,!(this.emotionStore.showEmotions&&this.emotionStore.selectedEmotions.length>0)){e.next=11;break}return a=this.emotionStore.selectedEmotions.map((function(e){return e.id})),e.next=8,Ye.getPhotosByFacesAndEmotions(t.similarFaces,a);case 8:this.photos=e.sent.map((function(e){return{id:e.id,objectId:e.objectId,url:e.signedUrl,thumbnailUrl:e.thumbnail,selected:!1,emotions:e.emotions.map((function(e){return{confidence:e.confidence,emotion:n.emotionStore.selectedEmotions.find((function(t){return t.id===e.id}))}}))}})),e.next=14;break;case 11:return e.next=13,Ye.getPhotosByFaces(t.similarFaces);case 13:this.photos=e.sent.map((function(e){return{id:e.id,objectId:e.objectId,url:e.signedUrl,thumbnailUrl:e.thumbnail,selected:!1,emotions:[]}}));case 14:this.photos&&this.photos.length||this.infoModalStore.show("","We didn't find photos similar to your request. Try other face."),e.next=21;break;case 17:e.prev=17,e.t0=e.catch(3),Qe("An error occurred while loading photos."),console.error(e.t0);case 21:return e.prev=21,this.loadingStore.stopLoading(),e.finish(21);case 24:case"end":return e.stop()}}),e,this,[[3,17,21,24]])})));return function(t){return e.apply(this,arguments)}}()},{key:"removeFaces",value:function(){var e=Object(se.a)(ie.a.mark((function e(){return ie.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.detectedFaces=null,this.selectedDetectedFace=null,!this.emotionStore.showEmotions){e.next=7;break}return e.next=5,this.selectPhotosByEmotions();case 5:e.next=9;break;case 7:return e.next=9,this.loadAllPhotos();case 9:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"addImages",value:function(){var e=Object(se.a)(ie.a.mark((function e(t){return ie.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.loadingStore.startLoading("Uploading images in progress\u2026"),e.next=3,_e.addPhotos(t);case 3:this.loadingStore.stopLoading();case 4:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()},{key:"findFace",value:function(){var e=Object(se.a)(ie.a.mark((function e(){var t,a,n,o,r,c,i,s,l,u,m,d=this,p=arguments;return ie.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(this.resetSelecting(),this.showNoFaceOnImagePopup=!1,t=[],a=p.length,n=new Array(a),o=0;o0?te.a.createElement("h2",{className:"heading-md"},"Photos ",te.a.createElement("span",{className:"text-light"},"(",this.photoStore.photos.length,")")):te.a.createElement("h2",{className:"heading"},"All Photos")}}]),Object(ve.a)(e,[{key:"downloadSelectedFiles",value:function(){var e,t=Object(ze.a)(this.photoStore.photos.filter((function(e){return e.selected})));try{for(t.s();!(e=t.n()).done;){var a=e.value;Me.a.saveAs(a.url,tt(a.url))}}catch(n){t.e(n)}finally{t.f()}}}]),e}(),Object(ge.a)(R.prototype,"header",[ye.computed],Object.getOwnPropertyDescriptor(R.prototype,"header"),R.prototype),Object(ge.a)(R.prototype,"downloadSelectedFiles",[ye.action],Object.getOwnPropertyDescriptor(R.prototype,"downloadSelectedFiles"),R.prototype),R)(gt,mt),Ot=te.a.createContext(wt),jt=new(M=function(){function e(t,a){Object(be.a)(this,e),this.emotionStore=t,this.photoStore=a}return Object(ve.a)(e,[{key:"toggleFilters",value:function(){var e=Object(se.a)(ie.a.mark((function e(){return ie.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.emotionStore.setEmotionVisible(!this.emotionStore.showEmotions),!(this.photoStore.detectedFaces&&this.photoStore.detectedFaces.length>0)){e.next=6;break}return e.next=4,this.photoStore.selectDetectedFace(this.photoStore.selectedDetectedFace||this.photoStore.detectedFaces[0]);case 4:e.next=14;break;case 6:if(!(this.emotionStore.showEmotions&&this.emotionStore.selectedEmotions.length>0)){e.next=11;break}return e.next=9,this.photoStore.selectPhotosByEmotions();case 9:e.next=14;break;case 11:if(this.emotionStore.showEmotions){e.next=14;break}return e.next=14,this.photoStore.loadAllPhotos();case 14:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"removeEmotionFromFilter",value:function(){var e=Object(se.a)(ie.a.mark((function e(t){return ie.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.emotionStore.removeSelectedEmotions(t),!(this.photoStore.detectedFaces&&this.photoStore.detectedFaces.length>0)){e.next=6;break}return e.next=4,this.photoStore.selectDetectedFace(this.photoStore.selectedDetectedFace||this.photoStore.detectedFaces[0]);case 4:e.next=13;break;case 6:if(!(this.emotionStore.selectedEmotions.length>0)){e.next=11;break}return e.next=9,this.photoStore.selectPhotosByEmotions();case 9:e.next=13;break;case 11:return e.next=13,this.photoStore.loadAllPhotos();case 13:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()}]),e}(),Object(ge.a)(M.prototype,"toggleFilters",[ye.action],Object.getOwnPropertyDescriptor(M.prototype,"toggleFilters"),M.prototype),Object(ge.a)(M.prototype,"removeEmotionFromFilter",[ye.action],Object.getOwnPropertyDescriptor(M.prototype,"removeEmotionFromFilter"),M.prototype),M)(mt,gt),Nt=te.a.createContext(jt),Pt=a(195),St=a(54),kt=new(W=function(){function e(t,a){var n=this;Object(be.a)(this,e),this.photoStore=t,this.infoModalStore=a,this.maximumPhotos=30,this.maxTimerSeconds=5,Object(fe.a)(this,"isCameraAvailable",B,this),Object(fe.a)(this,"isCameraWork",V,this),Object(fe.a)(this,"cameraStream",q,this),Object(fe.a)(this,"photos",G,this),Object(fe.a)(this,"selectingPhotos",_,this),Object(fe.a)(this,"timer",J,this),Object(fe.a)(this,"timerSeconds",Y,this),Object(fe.a)(this,"newPhotoAdd",H,this),Object(fe.a)(this,"newPhotoTimer",Z,this),Object(fe.a)(this,"setStream",$,this),Object(fe.a)(this,"takeScreen",K,this),Object(fe.a)(this,"uploadPhotos",Q,this),Object(fe.a)(this,"toggleTimer",X,this),navigator.mediaDevices&&navigator.mediaDevices.enumerateDevices&&navigator.mediaDevices.enumerateDevices().then((function(e){n.isCameraAvailable=e.some((function(e){return"videoinput"===e.kind}))}))}return Object(ve.a)(e,[{key:"hasPhotos",get:function(){var e;return(null===(e=this.photos)||void 0===e?void 0:e.length)>0}},{key:"countSelectedPhoto",get:function(){return this.photos.filter((function(e){return e.isSelected})).length}},{key:"isMaximumPhotos",get:function(){return this.photos.length===this.maximumPhotos}},{key:"showTimerSeconds",get:function(){return this.timerSeconds<10?"0".concat(this.timerSeconds.toString()):this.timerSeconds.toString()}}]),Object(ve.a)(e,[{key:"setSelecting",value:function(e){var t,a=Object(ze.a)(this.photos.filter((function(e){return e.isSelected})));try{for(a.s();!(t=a.n()).done;){t.value.isSelected=!1}}catch(n){a.e(n)}finally{a.f()}this.selectingPhotos=e}},{key:"selectPhoto",value:function(e){this.selectingPhotos&&(e.isSelected=!e.isSelected)}},{key:"deleteSelectedPhotos",value:function(){this.photos=this.photos.filter((function(e){return!e.isSelected}))}},{key:"resetTimerSeconds",value:function(){this.timerSeconds=this.maxTimerSeconds,this.timer&&(Object(St.clearInterval)(this.timer),this.timer=null)}}]),e}(),B=Object(ge.a)(W.prototype,"isCameraAvailable",[ye.observable],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),V=Object(ge.a)(W.prototype,"isCameraWork",[ye.observable],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),q=Object(ge.a)(W.prototype,"cameraStream",[ye.observable],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),G=Object(ge.a)(W.prototype,"photos",[ye.observable],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),_=Object(ge.a)(W.prototype,"selectingPhotos",[ye.observable],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),J=Object(ge.a)(W.prototype,"timer",[ye.observable],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),Y=Object(ge.a)(W.prototype,"timerSeconds",[ye.observable],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return this.maxTimerSeconds}}),H=Object(ge.a)(W.prototype,"newPhotoAdd",[ye.observable],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Z=Object(ge.a)(W.prototype,"newPhotoTimer",[ye.observable],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),Object(ge.a)(W.prototype,"hasPhotos",[ye.computed],Object.getOwnPropertyDescriptor(W.prototype,"hasPhotos"),W.prototype),Object(ge.a)(W.prototype,"countSelectedPhoto",[ye.computed],Object.getOwnPropertyDescriptor(W.prototype,"countSelectedPhoto"),W.prototype),Object(ge.a)(W.prototype,"isMaximumPhotos",[ye.computed],Object.getOwnPropertyDescriptor(W.prototype,"isMaximumPhotos"),W.prototype),Object(ge.a)(W.prototype,"showTimerSeconds",[ye.computed],Object.getOwnPropertyDescriptor(W.prototype,"showTimerSeconds"),W.prototype),Object(ge.a)(W.prototype,"setSelecting",[ye.action],Object.getOwnPropertyDescriptor(W.prototype,"setSelecting"),W.prototype),Object(ge.a)(W.prototype,"selectPhoto",[ye.action],Object.getOwnPropertyDescriptor(W.prototype,"selectPhoto"),W.prototype),Object(ge.a)(W.prototype,"deleteSelectedPhotos",[ye.action],Object.getOwnPropertyDescriptor(W.prototype,"deleteSelectedPhotos"),W.prototype),Object(ge.a)(W.prototype,"resetTimerSeconds",[ye.action],Object.getOwnPropertyDescriptor(W.prototype,"resetTimerSeconds"),W.prototype),$=Object(ge.a)(W.prototype,"setStream",[ye.action],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){var e=this;return function(){var t=Object(se.a)(ie.a.mark((function t(a){var n;return ie.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(t.prev=0,!a){t.next=9;break}return e.cameraStream&&e.cameraStream.getVideoTracks().forEach((function(e){return e.stop()})),t.next=5,navigator.mediaDevices.getUserMedia({video:!0});case 5:e.cameraStream=t.sent,e.isCameraWork=!0,t.next=16;break;case 9:null===(n=e.cameraStream)||void 0===n||n.getVideoTracks().forEach((function(e){return e.stop()})),e.isCameraWork=!1,e.cameraStream=null,e.selectingPhotos=!1,e.photos=[],e.newPhotoAdd=!1,e.resetTimerSeconds();case 16:t.next=21;break;case 18:t.prev=18,t.t0=t.catch(0),e.infoModalStore.show("","Can't get access to camera, please check your browser settings");case 21:case"end":return t.stop()}}),t,null,[[0,18]])})));return function(e){return t.apply(this,arguments)}}()}}),K=Object(ge.a)(W.prototype,"takeScreen",[ye.action],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){var e=this;return Object(se.a)(ie.a.mark((function t(){var a,n,o;return ie.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!(e.photos.length<30)){t.next=16;break}if(!(a=document.getElementById("web-camera"))){t.next=16;break}if((n=document.createElement("canvas")).setAttribute("width",a.videoWidth.toString()),n.setAttribute("height",a.videoHeight.toString()),!(o=n.getContext("2d"))){t.next=16;break}return o.drawImage(a,0,0),e.photos=[{dataUrl:n.toDataURL(),isSelected:!1}].concat(Object(le.a)(e.photos.map((function(e){return e})))),e.newPhotoAdd=!0,e.newPhotoTimer&&Object(St.clearTimeout)(e.newPhotoTimer),e.newPhotoTimer=Object(St.setInterval)((function(){e.newPhotoAdd=!1}),1e4),t.next=15,navigator.mediaDevices.getUserMedia({video:!0});case 15:e.cameraStream=t.sent;case 16:case"end":return t.stop()}}),t)})))}}),Q=Object(ge.a)(W.prototype,"uploadPhotos",[ye.action],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){var e=this;return Object(se.a)(ie.a.mark((function t(){var a,n,o;return ie.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!(e.selectingPhotos&&e.countSelectedPhoto>0)){t.next=8;break}return n=e.photos.filter((function(e){return e.isSelected})),t.next=4,Promise.all(n.map(function(){var e=Object(se.a)(ie.a.mark((function e(t){var a,n;return ie.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,fetch(t.dataUrl);case 2:return a=e.sent,e.next=5,a.blob();case 5:return n=e.sent,e.abrupt("return",new File([n],"".concat(Object(Pt.a)(),".png"),{type:"image/png"}));case 7:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()));case 4:return o=t.sent,e.setStream(!1),t.next=8,(a=e.photoStore).findFace.apply(a,Object(le.a)(o));case 8:case"end":return t.stop()}}),t)})))}}),X=Object(ge.a)(W.prototype,"toggleTimer",[ye.action],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){var e=this;return Object(se.a)(ie.a.mark((function t(){return ie.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e.timerSeconds=e.maxTimerSeconds,e.timer?(Object(St.clearInterval)(e.timer),e.timer=null):e.timer=Object(St.setInterval)(Object(se.a)(ie.a.mark((function t(){var a;return ie.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!((a=e.timerSeconds-1)<=0)){t.next=7;break}if(!e.timer){t.next=7;break}return t.next=5,e.takeScreen();case 5:Object(St.clearInterval)(e.timer),e.timer=null;case 7:e.timerSeconds=a;case 8:case"end":return t.stop()}}),t)}))),1e3);case 2:case"end":return t.stop()}}),t)})))}}),W)(gt,Ne),xt=te.a.createContext(kt),Ct=function(){return te.a.useContext(xt)},Ft=a(114),Dt=a(95),It=function(e){var t=e.photoSrc,a=e.handlerClick,n=e.active,o=e.mediaId,r=e.isEmotionsVisible,c=e.emotions;Object(ee.useEffect)((function(){return Object(Dt.a)()}),[]);var i=r?"show-emotion":"",s=c&&c.map((function(e){return te.a.createElement("i",{key:e.value,className:"media-emotion icon-".concat(e.value),style:{top:e.top,left:e.left,opacity:e.opacity||1,zIndex:e.zIndex||2}})}));return te.a.createElement("div",{id:o,onClick:function(e){var t;t=e.target,Object(Dt.b)(t),a&&a(e)},className:n?"media is-selected ".concat(i):"media ".concat(i)},te.a.createElement(Ft.LazyLoadImage,{className:"media-content",src:t,alt:"/"}),s)},Ut=a(115),At=a.n(Ut),Tt=function(e){var t=e.additionalClass,a=e.children;return te.a.createElement(At.a,{className:t},a)},Lt=function(){var e,t=Object(ee.useState)(!1),a=Object(ue.a)(t,2),n=a[0],o=a[1],r=Le();return te.a.createElement("div",{className:n?"mobile-menu is-open":"mobile-menu"},te.a.createElement("button",{onClick:function(){o(!n)},className:"mobile-menu-toggler",type:"button"}),te.a.createElement("ul",{className:"mobile-menu-list"},te.a.createElement("li",{className:"mobile-menu-item"},te.a.createElement("span",{className:"user-name"},null===(e=r.user)||void 0===e?void 0:e.email)),te.a.createElement("li",{className:"mobile-menu-item"},te.a.createElement("a",{href:"/",className:"link",onClick:function(e){e.preventDefault(),r.startSignOut()}},"Log Out"))))},zt=a(39),Rt=a.n(zt),Mt=function(e){var t,a=e.children,n=e.onLogoClick,o=Le();return te.a.createElement(te.a.Fragment,null,te.a.createElement("div",{className:"sidebar-head"},te.a.createElement("a",{className:"logo",href:"/",onClick:function(e){e.preventDefault(),n()}},te.a.createElement("img",{className:"logo-media",src:Rt.a,alt:"logo"})),te.a.createElement(Lt,null)),te.a.createElement("div",{className:"sidebar-body"},a),te.a.createElement("div",{className:"sidebar-foot"},te.a.createElement("span",{className:"user-name"},null===(t=o.user)||void 0===t?void 0:t.email),te.a.createElement("a",{href:"/",className:"link",onClick:function(e){e.preventDefault(),o.startSignOut()}},"Log Out")))},Wt=function(e){var t=e.children,a=e.onLogoClick;return te.a.createElement("div",{className:"sidebar"},te.a.createElement(Tt,null,te.a.createElement(Mt,{onLogoClick:a},t)))},Bt=function(e){var t=e.detectedPersonSrc,a=e.detectedPersonName;return te.a.createElement(te.a.Fragment,null,te.a.createElement("div",{className:"detected-person"},te.a.createElement("img",{className:"detected-person-photo",src:t,alt:"detected person photo"})),a&&te.a.createElement("span",{className:"detected-person-name"},a))},Vt=function(e){var t=e.loadingText;return te.a.createElement(we,null,te.a.createElement("span",{className:"spinner"},te.a.createElement("span",{className:"spinner-inner"})),te.a.createElement("p",{className:"heading-md text-center mb-0"},t))},qt=function(e){var t=te.a.useRef(null);return te.a.createElement(te.a.Fragment,null,te.a.createElement("button",{className:"btn ".concat(e.extendClass?e.extendClass:""),type:"button",onClick:function(){var e;return null===t||void 0===t||null===(e=t.current)||void 0===e?void 0:e.click()}},e.text),te.a.createElement("input",{id:"upload-button",type:"file",ref:t,onChange:function(t){t.target.files&&(e.handleFiles(t.target.files),t.target.value="")},multiple:!0,style:{display:"none"}}))},Gt=function(e){var t=te.a.useRef(null);return te.a.createElement(te.a.Fragment,null,te.a.createElement("div",{className:"popup-upload-control",role:"button",onClick:function(){var e;return null===t||void 0===t||null===(e=t.current)||void 0===e?void 0:e.click()}},te.a.createElement("div",{className:"popup-upload-control-icon device-icon"}),te.a.createElement("div",{className:"popup-upload-control-text"},e.text),te.a.createElement("input",{id:"upload-button",type:"file",ref:t,onChange:function(t){t.target.files&&(e.handleFiles(t.target.files),t.target.value="")},multiple:!0,style:{display:"none"}})))},_t=a(96),Jt=ne.a.createPortal,Yt=function(e){var t=e.children,a=e.handlerClose,n=e.isOpen,o=e.additionalClassName,r=e.isSwipeable,c=Object(ee.useState)(!1),i=Object(ue.a)(c,2),s=i[0],l=i[1],u=o||"",m=r?function(){var e=Object(_t.a)({onSwipedUp:function(){return l(!0)},onSwipedDown:function(){return l(!1)},preventDefaultTouchmoveEvent:!0,trackMouse:!1}),a=s?"is-visible":"",o=n?"popup is-swipeable is-open ".concat(u," ").concat(a):"popup ".concat(u," ").concat(a);return te.a.createElement("div",Object.assign({className:o},e),te.a.createElement("div",{className:"popup-overlay"}),te.a.createElement("div",{className:"popup-content"},t))}():function(){var e=Object(_t.a)({onSwipedDown:function(e){return a(e)},preventDefaultTouchmoveEvent:!0,trackMouse:!1}),o=n?"popup is-open ".concat(u):"popup ".concat(u);return te.a.createElement("div",Object.assign({className:o},e),te.a.createElement("div",{className:"popup-overlay",onClick:a}),te.a.createElement("div",{className:"popup-content"},t))}();return Jt(te.a.createElement(te.a.Fragment,null,m),document.body)},Ht=function(e){return te.a.createElement(we,null,te.a.createElement("span",{className:"heading-sm text-accent"},"Log Out"),te.a.createElement("p",{className:"paragraph text-center mb-48"},"Are you sure you want to log out?"),te.a.createElement("div",{className:"btn-group"},te.a.createElement("button",{className:"btn-light",type:"button",onClick:function(){return e.onCancel()}},"No"),te.a.createElement("button",{className:"btn",type:"button",onClick:function(){return e.onConfirm()}},"Yes")))},Zt=function(e){var t=e.data,a=e.onRemove,n=t.map((function(e,t){return te.a.createElement(te.a.Fragment,null,te.a.createElement("div",{className:"tags-item",key:"tag_".concat(e.label,"_").concat(t)},te.a.createElement("div",{className:"tag"},te.a.createElement("div",{className:"tag-label"},e.label),te.a.createElement("button",{type:"button",className:"tag-control icon-close",onClick:function(){a(e)}},te.a.createElement("span",{className:"visually-hidden"},"Remove tag ".concat(e.label))))))}));return te.a.createElement("div",{className:"tags"},n)},$t=function(e){var t=e.name,a=e.id,n=e.defaultChecked,o=e.onChange,r=e.disabled,c=e.label,i=e.additionalClassName;return te.a.createElement(te.a.Fragment,null,te.a.createElement("div",{className:"switch form-field inline ".concat(i)},te.a.createElement("span",{className:"form-label"},c),te.a.createElement("input",{key:"".concat(a,"_").concat(c,"_").concat(n,"_").concat(t),type:"checkbox",className:"switch-check visually-hidden",name:t,id:a,defaultChecked:n,disabled:r}),te.a.createElement("div",{className:"switch-control",onClick:o},te.a.createElement("span",{className:"switch-indicator"}))))},Kt=function(e){var t=e.name,a=e.id,n=e.defaultChecked,o=e.onChange,r=e.disabled,c=e.label,i=e.additionalClassName;return te.a.createElement(te.a.Fragment,null,te.a.createElement("label",{className:"checkbox form-field inline reverse ".concat(i),htmlFor:a},te.a.createElement("input",{type:"checkbox",className:"checkbox-mark visually-hidden",name:t,id:a,defaultChecked:n,onChange:o,disabled:r}),te.a.createElement("span",{className:"form-label"},c),te.a.createElement("div",{className:"checkbox-control"})))},Qt=a(75),Xt=a.n(Qt),ea=function(e){var t=e.children,a=e.handlerClose,n=e.handleClick;return te.a.createElement("div",{className:"preview-overlay",onClick:n},te.a.createElement("div",{className:"preview"},t,te.a.createElement("span",{onClick:a,className:"btn-close"})))},ta=function(e){var t=e.facesEmotionsOnPhoto,a=yt(),n=null===t||void 0===t?void 0:t.map((function(e,t){return te.a.createElement("div",{className:"description",key:"photo_".concat(t)},te.a.createElement("div",{className:"description-inner"},te.a.createElement("div",{onClick:function(){return a.selectFace(e)},className:e.isSelected?"avatar is-selected":"avatar"},te.a.createElement("div",{className:"avatar-media"},te.a.createElement("img",{className:"avatar-img",src:e.faceUrlData||vt.a,alt:"detected person"}))),te.a.createElement("div",{className:"description-content"},te.a.createElement("ul",{className:"description-list"},e.emotions.length>0?e.emotions.sort((function(e,t){return-e.confidence+t.confidence})).map((function(e){return function(e){var t,a;return te.a.createElement("li",{className:"description-item",key:null===(t=e.emotion)||void 0===t?void 0:t.label},"".concat(null===(a=e.emotion)||void 0===a?void 0:a.label," ").concat((100*e.confidence).toFixed(1),"%"))}(e)})):te.a.createElement("li",{className:"description-item"},"No emotion detected")))))}));return te.a.createElement(te.a.Fragment,null,n)},aa=function(e){var t=e.facesEmotionsOnPhoto,a=Object(ee.useState)(!0),n=Object(ue.a)(a,2),o=n[0],r=n[1];return te.a.createElement(Yt,{isSwipeable:!0,additionalClassName:"sm-min-hidden",handlerClose:function(){r(!1)},isOpen:o},te.a.createElement("div",{className:"preview-description"},te.a.createElement(ta,{facesEmotionsOnPhoto:t})))},na=function(e){var t=e.facesEmotionsOnPhoto;return te.a.createElement(te.a.Fragment,null,te.a.createElement("div",{className:"preview-info sm-max-hidden"},te.a.createElement(Tt,{additionalClass:"descriptions-scrollbar"},te.a.createElement(ta,{facesEmotionsOnPhoto:t}))),te.a.createElement(aa,{facesEmotionsOnPhoto:t}))},oa={dots:!1,infinite:!0,speed:500,slidesToShow:1,slidesToScroll:1,className:"preview-slider"},ra=function(e){var t=e.handlerClose,a=e.photos,n=e.handlerChange,o=e.selectedIndex,r=e.isEmotionsVisible,c=e.facesEmotionsOnPhoto,i=pt(),s=Object(ee.useRef)();Object(ee.useEffect)((function(){s.current.slickGoTo(o,!0)}),[]);var l=function(e){switch(e.key){case"ArrowRight":s.current.slickNext();break;case"ArrowLeft":s.current.slickPrev();break;case"Escape":t()}};return Object(ee.useEffect)((function(){return window.addEventListener("keydown",l),function(){window.removeEventListener("keydown",l)}}),[]),te.a.createElement(ea,{handlerClose:t,handleClick:function(e){return function(e,t){e.target===document.getElementsByClassName("preview-overlay")[0]&&t()}(e,t)}},te.a.createElement(Xt.a,Object.assign({ref:function(e){s.current=e},afterChange:function(e){n(e)}},oa,{lazyLoad:"progressive"}),a.map((function(e){return te.a.createElement(It,{mediaId:e.url,key:e.url,photoSrc:e.url,isEmotionsVisible:r,emotions:i.emotionsWithPosition(e.emotions.map((function(e){return e.emotion})))})}))),te.a.createElement(na,{facesEmotionsOnPhoto:c}))},ca=function(e){return te.a.createElement("div",{className:"photos-selection"},te.a.createElement("span",{className:"photos-count"},e.count),te.a.createElement("span",null,"Photos Selected"))},ia=a(20),sa=function(e){return te.a.createElement("div",{className:"socials"},te.a.createElement("ul",{className:"socials-list"},te.a.createElement("div",{className:"socials-item download",onClick:function(){return e.onDownload()}},te.a.createElement(ia.a,{className:"socials-link",to:"/"},te.a.createElement("span",{className:"socials-title"},"Download"),te.a.createElement("span",{className:"socials-media"},te.a.createElement("i",{className:"download-icon"}))))))},la=function(e){return te.a.createElement("div",{className:me("share share-control sm-max-hidden",{"is-disabled":0===e.selectedCount})},te.a.createElement("button",{className:"btn-share"},te.a.createElement("span",{className:"selected-photo"},e.selectedCount),te.a.createElement("i",{className:"share-icon"}),te.a.createElement("span",{className:"btn-share-text"},"Share")),te.a.createElement("div",{className:"share-socials"},te.a.createElement(sa,{onDownload:e.onDownload})))},ua=function(e){var t=Object(ee.useState)(!1),a=Object(ue.a)(t,2),n=a[0],o=a[1],r=te.a.createElement(Yt,{additionalClassName:"sm-min-hidden",handlerClose:function(){o(!1)},isOpen:n},te.a.createElement(sa,{onDownload:e.onDownload}));return te.a.createElement("div",{className:me("share-control sm-min-hidden",{"is-disabled":0===e.selectedCount})},te.a.createElement("button",{className:"btn-share",onClick:function(){o(!0)}},te.a.createElement("span",{className:"selected-photo"},e.selectedCount),te.a.createElement("i",{className:"share-icon"}),te.a.createElement("span",{className:"btn-share-text"},"Share")),r)},ma=function(e){var t=e.url,a=e.handlerClick,n=e.active;return te.a.createElement("li",{className:"detected-person-item"},te.a.createElement("div",{id:t,onClick:a,className:n?"avatar is-selected":"avatar"},te.a.createElement("div",{className:"avatar-media"},te.a.createElement("img",{className:"avatar-img",src:t,alt:"detected person"}))))},da=function(e){return te.a.createElement("ul",{className:"detected-person-list"},e.items.map((function(t){return te.a.createElement(ma,{key:t.dataUrl,url:t.dataUrl,handlerClick:function(){return e.onSelect(t)},active:t===e.selectedItem})})))},pa=te.a.memo((function(e){return te.a.createElement("div",null,te.a.createElement("video",{id:"web-camera",ref:function(t){t&&(t.srcObject=e.media)},className:"webcam-photo-person-img camera",muted:!0,playsInline:!0,autoPlay:!0},"detected person web camera"))})),ha=Object(re.a)((function(){var e=Ct(),t=Object(ee.useState)(!0),a=Object(ue.a)(t,2),n=a[0],o=a[1],r=n?te.a.createElement("button",{className:"btn webcam-photo-btn ".concat((e.isMaximumPhotos,"")),onClick:function(){return e.takeScreen()}},"Take photo"):te.a.createElement("button",{onClick:function(){return e.toggleTimer()},className:"btn webcam-photo-btn ".concat((e.isMaximumPhotos,""))},0==e.timerSeconds?"Try again":e.timer?"Stop":"Start",te.a.createElement("div",{className:"webcam-mobile-timer"},"00.",e.showTimerSeconds));return te.a.createElement(Yt,{handlerClose:function(){e.setStream(!1)},isOpen:e.isCameraWork,additionalClassName:"webcam-photo-popup"},te.a.createElement("div",{className:"popup-body"},te.a.createElement("div",{className:"webcam-photo-container mobile-divider"},te.a.createElement("div",{className:"webcam-desktop-counter ".concat(n?"":"is-auto"," ").concat(e.timer?"is-active":"")},te.a.createElement("div",{className:"webcam-counter-icon"}),te.a.createElement("div",{className:"webcam-counter-timer"},"00.",e.showTimerSeconds)),te.a.createElement("div",{className:"webcam-photo"},te.a.createElement("div",{className:"webcam-photo-person"},te.a.createElement(pa,{media:e.cameraStream})),r),te.a.createElement("div",{className:"shotmode-controls"},te.a.createElement("div",{className:"shotmode-control ".concat(n?"is-active":""),role:"button",onClick:function(){return o(!0)}},te.a.createElement("div",{className:"shotmode-control-icon manual-icon"}),te.a.createElement("div",{className:"shotmode-control-text"},"Manual Shot")),te.a.createElement("div",{className:"shotmode-control ".concat(n?"":"is-active"),role:"button",onClick:function(){o(!1),e.resetTimerSeconds()}},te.a.createElement("div",{className:"shotmode-control-icon auto-icon"}),te.a.createElement("div",{className:"shotmode-control-text"},"Automatic Shot")))),e.photos.length>0&&te.a.createElement("div",{className:"webcam-gallery"},te.a.createElement("div",{className:"webcam-gallery-header"},te.a.createElement("div",{className:"webcam-gallery-title"},"Photos",te.a.createElement("span",{className:"webcam-gallery-counter"},"(",e.photos.length,")")),te.a.createElement("div",{className:"webcam-counter-desktop ".concat(e.selectingPhotos?"is-selected-mode":"")},te.a.createElement("span",{className:"webcam-counter-value"},e.countSelectedPhoto),"Photos Selected"),te.a.createElement("div",{className:"webcam-gallery-controls"},te.a.createElement("button",{onClick:function(){return e.deleteSelectedPhotos()},className:"btn webcam-btn ".concat(e.selectingPhotos?"is-selected-mode":""," ").concat(e.countSelectedPhoto>0?"has-selected":"")},te.a.createElement("div",{className:"webcam-btn-counter"},e.countSelectedPhoto),te.a.createElement("div",{className:"webcam-btn-icon"}),te.a.createElement("span",{className:"webcam-btn-text"},"Delete")),te.a.createElement("button",{className:"btn-light",onClick:function(){return e.setSelecting(!e.selectingPhotos)}},e.selectingPhotos?"Cancel":"Select"))),te.a.createElement("div",{className:"webcam-slider-container"},te.a.createElement(Xt.a,Object.assign({},{swipeToSlide:!0,slide:"webcam-slide",rows:1,slidesToShow:7,arrows:!0,responsive:[{breakpoint:1679,settings:{slidesToShow:5,arrows:!0}},{breakpoint:787,settings:{slidesToShow:3,arrows:!1}}]},{infinite:!1}),e.photos.map((function(t,a){return te.a.createElement("div",{className:"slide-media output ".concat(t.isSelected?"is-selected":""," ").concat(0===a&&e.newPhotoAdd?"is-new":""),key:"photo_slider_".concat(a),onClick:function(){return e.selectPhoto(t)}},te.a.createElement("img",{className:"slide-media-content",src:t.dataUrl,alt:"webcam photo"}))})))),te.a.createElement("div",{className:"webcam-upload-control"},te.a.createElement("button",{className:"btn webcam-upload-btn ".concat(e.countSelectedPhoto>0?"has-selected":""),onClick:function(){return e.uploadPhotos()}},"Upload Photos")))))})),fa=Object(re.a)((function(){var e,t,a=te.a.useContext(Ot),n=yt(),o=pt(),r=te.a.useContext(Nt),c=te.a.useContext(lt),i=Le(),s=te.a.useContext(ft),l=Ct(),u=Object(ee.useState)(!1),m=Object(ue.a)(u,2),d=m[0],p=m[1],h=Object(ee.useState)(!1),f=Object(ue.a)(h,2),b=f[0],v=f[1];Object(ee.useEffect)((function(){o.loadAllEmotions(),n.loadAllPhotos()}),[]);var g=o.emotions.map((function(e,t){var a=o.selectedEmotions.some((function(t){return t.id===e.id}));return te.a.createElement("li",{className:"filters-item",key:"filter_".concat(t,"_").concat(a)},te.a.createElement(Kt,{defaultChecked:a,label:te.a.createElement("span",{className:"filters-label"},te.a.createElement("span",{className:"filters-name"},e.label),te.a.createElement("span",{className:"filters-matching"},"(".concat(e.count,")")),te.a.createElement("span",{className:"filters-icon icon-".concat(e.value)})),onChange:function(){a?o.removeSelectedEmotions(e):o.selectEmotion(e)}}))})),E=te.a.createElement(Yt,{handlerClose:function(){return p(!1)},isOpen:d},te.a.createElement("div",{className:"popup-header"},te.a.createElement("div",{className:"popup-container"},te.a.createElement("div",{className:"heading-lg text-center"},"Filter"))),te.a.createElement("div",{className:"popup-body"},te.a.createElement("div",{className:"popup-container"},te.a.createElement("div",{className:"popup-subheader sm-min-hidden"},te.a.createElement($t,{label:"Display Emotions",additionalClassName:"wide space-between",defaultChecked:o.showEmotions,onChange:function(){return r.toggleFilters()}})),te.a.createElement("div",{className:"popup-section"},te.a.createElement("div",{className:"filters"},te.a.createElement("span",{className:"filters-title"},"Choose Emotions"),te.a.createElement("ul",{className:"filters-list"},g))))),te.a.createElement("div",{className:"popup-footer"},te.a.createElement("div",{className:"popup-container"},te.a.createElement("button",{className:"popup-control btn full-width",type:"button",onClick:function(){p(!1),o.showEmotions&&(n.detectedFaces&&n.detectedFaces.length>0?n.selectDetectedFace(n.selectedDetectedFace||n.detectedFaces[0]):o.selectedEmotions.length>0?n.selectPhotosByEmotions():n.loadAllPhotos())}},"Apply"),te.a.createElement("button",{className:"popup-control btn-transparent full-width",type:"button",onClick:function(){o.removeSelectedEmotions.apply(o,Object(le.a)(o.selectedEmotions))}},"Clear All")))),y=te.a.createElement(Yt,{handlerClose:function(){return v(!1)},isOpen:b,additionalClassName:"upload-photo"},te.a.createElement("div",{className:"popup-body"},te.a.createElement("div",{className:"popup-container"},te.a.createElement("div",{className:"popup-upload-controls"},te.a.createElement("div",{className:"popup-upload-control",role:"button",onClick:function(){v(!1),l.setStream(!0)}},te.a.createElement("div",{className:"popup-upload-control-icon webcam-icon"}),te.a.createElement("div",{className:"popup-upload-control-text"},"Take a photo via Webcam")),te.a.createElement("span",{className:"popup-upload-text"},"Or"),te.a.createElement(Gt,{text:"Upload from a Device",handleFiles:function(e){for(var t=[],a=0;a