(this.webpackJsonpfittrackee_client=this.webpackJsonpfittrackee_client||[]).push([[0],{197:function(e){e.exports=JSON.parse('{"Activities":"Activities","Activity":"Activity","Activity Date":"Activity Date","Add a workout":"Add a workout","Are you sure you want to delete this activity?":"Are you sure you want to delete this activity?","Ave. speed":"Ave. speed","Ascent":"Ascent","Average speed":"Average speed","Chart":"Chart","data from gpx, without any cleaning":"data from gpx, without any cleaning","Date":"Date","Delete activity":"Delete activity","Descent":"Descent","Distance":"Distance","distance":"distance","Duration":"Duration","duration":"duration","Edit a workout":"Edit a workout","Edit activity":"Edit activity","elevation":"elevation","End":"End","Farest distance":"Farest distance","Filter":"Filter","From":"From","gpxFile":"gpx file","Longest duration":"Longest duration","Max. altitude":"Max. altitude","Max. speed":"Max. speed","Min. altitude":"Min. altitude","no folder inside":"no folder inside","files max":"files max","max size":"max size","No data to display":"No data to display","No Map":"No Map","No next activity":"No next activity","No next segment":"No next segment","No notes":"No notes","No previous activity":"No previous activity","No previous segment":"No previous segment","Notes":"Notes","pauses":"pauses","Personal records":"Personal records","See next activity":"See next activity","See next segment":"See next segment","See previous activity":"See previous activity","See previous segment":"See previous segment","segment":"segment","Segments":"Segments","speed":"speed","Start":"Start","Title":"Title","To":"To","total duration":"total duration","with gpx file":"with gpx file","without gpx file":"without gpx file","zipFile":"or zip file containing gpx files"}')},198:function(e){e.exports=JSON.parse('{"Actions":"Actions","Active":"Active","activities exist":"activities exist","Add admin rights":"Add admin rights","Add/remove admin rights, delete user account.":"Add/remove admin rights, delete user account.","Administration":"Administration","Application":"Application","Application configuration":"Application configuration","Back":"Back","Disable":"Disable","Enable":"Enable","Enable/disable sports.":"Enable/disable sports.","FitTrackee administration":"FitTrackee administration","id":"id","if 0, no limitation":"if 0, no limitation","Image":"Image","Label":"Label","Max. number of active users":"Max. number of active users","Max. files of zip archive":"Max. files of zip archive","Max. size of uploaded files":"Max. size of uploaded files","Max. size of uploaded files (in Mb)":"Max. size of uploaded files (in Mb)","Max. size of zip archive":"Max. size of zip archive","Max. size of zip archive (in Mb)":"Max. size of zip archive (in Mb)","Registration is currently disabled.":"Registration is currently disabled.","Registration is currently enabled.":"Registration is currently enabled.","Remove admin rights":"Remove admin rights","Sports":"Sports","Update application configuration (maximum number of registered users, maximum files size).":"Update application configuration (maximum number of registered users, maximum files size).","uploads":"uploads","user":"user","Users":"Users","users":"users"}')},199:function(e){e.exports=JSON.parse('{"activities count":"activities count","Add workout":"Add workout","admin rights":"admin rights","ascending":"ascending","Back":"Back","Back to home":"Back to home","Cancel":"Cancel","Confirmation":"Confirmation","Dashboard":"Dashboard","descending":"descending","Edit":"Edit","day":"day","days":"days","Next":"Next","No":"No","no":"no","No records.":"No records.","No workouts.":"No workouts.","Page not found":"Page not found","Previous":"Prev","registration date":"registration date","Sort":"Sort","Sort by":"Sort by","Sport":"Sport","sport":"sport","Sports":"Sports","sports":"sports","Statistics":"Statistics","Submit":"Submit","to":"to","user name":"user name","Workout":"Workout","Workouts":"Workouts","workout":"workout","workouts":"workouts","Yes":"Yes","yes":"yes"}')},200:function(e){e.exports=JSON.parse('{"Personal records":"Personal records","This month":"This month","Upload one !":"Upload one !"}')},201:function(e){e.exports=JSON.parse('{"3 to 12 characters required for username.":"3 to 12 characters required for username.","8 characters required for password.":"8 characters required for password.","An error occurred. Please contact the administrator.":"An error occurred. Please contact the administrator.","activities":"activities","Error during picture deletion.":"Error during picture deletion.","Error during picture update.":"Error during picture update.","Error during picture update, file size exceeds max size.":"Error during picture update, file size exceeds max size.","Error. Registration is disabled.":"Error. Registration is disabled.","Error. Please try again or contact the administrator.":"Error. Please try again or contact the administrator.","File extension not allowed.":"File extension not allowed.","File size is greater than the allowed size":"File size is greater than the allowed size","Incorrect id":"Incorrect id","Invalid credentials.":"Invalid credentials.","Invalid payload.":"Invalid payload.","Invalid token. Please log in again.":"Invalid token. Please log in again.","No file part.":"No file part.","No picture.":"No picture.","No selected file.":"No selected file.","no correct file.":"no correct file.","no gpx file for this activity":"no gpx file for this activity","Password and password confirmation don\'t match.":"Password and password confirmation don\'t match.","Provide a valid auth token":"Provide a valid auth token","records":"records","Signature expired. Please log in again.":"Signature expired. Please log in again.","Sorry. That user already exists.":"Sorry. That user already exists.","Sport can not be disabled, activities exist.":"Sport can not be disabled, activities exist.","Sport does not exist.":"Sport does not exist.","sports":"sports","statistics":"statistiques","User does not exist.":"User does not exist.","Valid email must be provided.\\n":"Valid email must be provided.","You can not delete your account, no other user has admin rights.":"You can not delete your account, no other user has admin rights.","You do not have permissions.":"You do not have permissions."}')},202:function(e){e.exports=JSON.parse('{"Cycling (Sport)":"Cycling (Sport)","Cycling (Transport)":"Cycling (Transport)","Hiking":"Hiking","Mountain Biking":"Mountain Biking","Running":"Running","Walking":"Walking"}')},203:function(e){e.exports=JSON.parse('{"activities":"activities","distance":"distance","duration":"duration","month":"month","Statistics":"Statistics","year":"year","week":"week"}')},204:function(e){e.exports=JSON.parse('{"Admin":"Admin","Are you sure you want to delete this account? All data will be deleted, this cannot be undone.":"Are you sure you want to delete this account? All data will be deleted, this cannot be undone.","Are you sure you want to delete your account? All data will be deleted, this cannot be undone.":"Are you sure you want to delete your account? All data will be deleted, this cannot be undone.","Bio":"Bio","Birth Date":"Birth Date","Check your email. If your address is in our database, you\'ll received an email with a link to reset your password.":"Check your email. If your address is in our database, you\'ll received an email with a link to reset your password.","Delete my account":"Delete my account","Delete picture":"Delete picture","Delete user account":"Delete user account","Edit Profile":"Edit Profile","Email":"Email","Enter a username":"Enter a username","Enter an email address":"Enter an email address","Enter a password":"Enter a password","Enter the password confirmation":"Enter the password confirmation","First day of week":"First day of week","First Name":"First Name","Forgot password?":"Forgot password?","Invalid token. Please request a new token.":"Invalid token. Please request a new token.","Language":"Language","Last Name":"Last Name","Location":"Location","loggedOut":"You are now logged out. Click <1>here1> to log back in.","Login":"Login","login":"login","Logout":"Logout","Monday":"Monday","Password":"Password","Password Confirmation":"Password Confirmation","Password reset":"Password reset","password reset":"password reset","Profile":"Profile","Profile Edition":"Profile Edition","Register":"Register","register":"register","Registration Date":"Registration Date","Reset your password":"Reset your password","reset your password":"reset your password","Send":"Send","Sunday":"Sunday","Timezone":"Timezone","updatedPasswordText":"Your password have been updated. Click <1>here1> to log in.","Username":"Username"}')},205:function(e){e.exports=JSON.parse('{"Activities":"Activit\xe9s","Activity":"Activit\xe9","Activity Date":"Date de l\'activit\xe9","Add a workout":"Ajouter une activit\xe9","Are you sure you want to delete this activity?":"Etes-vous s\xfbr de vouloir supprimer cette activit\xe9 ?","Ave. speed":"Vitesse moyenne","Ascent":"D\xe9nivel\xe9 positif","Average speed":"Vitesse moyenne","Chart":"Analyse","data from gpx, without any cleaning":"donn\xe9es issues du fichier gpx, sans correction","Date":"Date","Delete activity":"Supprimer l\'activit\xe9","Descent":"D\xe9nivel\xe9 n\xe9gatif","Distance":"Distance","distance":"distance","Duration":"Dur\xe9e","duration":"dur\xe9e","Edit a workout":"Editer une activit\xe9","Edit activity":"Editer une activity","elevation":"altitude","End":"Arriv\xe9e","Farest distance":"Distance la + longue","Filter":"Filtrer","From":"A partir de","gpxFile":"fichier gpx","Longest duration":"Dur\xe9e la + longue","Max. altitude":"Altitude max","Max. speed":"Vitesse max","Min. altitude":"Altitude min","no folder inside":"pas de r\xe9pertoire","files max":" fichiers max","max size":"taille max","No data to display":"Pas de donn\xe9es \xe0 afficher","No Map":"Pas de carte","No next activity":"Pas d\'activit\xe9 suivante","No next segment":"Pas de segment suivant","No notes":"Pas de notes","No previous activity":"Pas d\'activit\xe9 pr\xe9c\xe9dente","No previous segment":"Pas de segment pr\xe9c\xe9dent","Notes":"Notes","pauses":"pauses","Personal records":"Records personnels","See next activity":"Voir l\'activit\xe9 suivante","See next segment":"Voir le segment suivant","See previous activity":"Voir l\'activit\xe9 pr\xe9c\xe9dente","See previous segment":"Voir le segment pr\xe9c\xe9dent","segment":"segment","Segments":"Segments","Start":"D\xe9part","speed":"vitesse","Title":"Titre","To":"Jusqu\'au","total duration":"dur\xe9e totale","with gpx file":"avec un fichier gpx","without gpx file":"sans fichier gpx","zipFile":"ou un fichier zip contenant des fichiers gpx"}')},206:function(e){e.exports=JSON.parse('{"Actions":"Actions","Active":"Active","Add admin rights":"Ajouter des droits d\'admin","Add/remove admin rights, delete user account.":"Ajouter/retirer des droits d\'adminsitration, supprimer des comptes utilisateurs.","Administration":"Administration","activities exist":"des activit\xe9s existent","Application":"Application","Application configuration":"Configuration de l\'application","Back":"Retour","Disable":"d\xe9sactiver","Enable":"activer","Enable/disable sports.":"Activer/d\xe9sactiver des sports.","FitTrackee administration":"Administration de FitTrackee","id":"id","if 0, no limitation":"si \xe9gal \xe0 0, pas limite d\'inscription","Image":"Image","Label":"Label","Max. number of active users":"Nombre maximum d\'utilisateurs actifs","Max. files of zip archive":"Nombre max. de fichiers dans une archive zip","Max. size of uploaded files":"Taille max. des fichiers","Max. size of uploaded files (in Mb)":"Taille max. des fichiers (en Mo)","Max. size of zip archive":"Taille max. des archives zip","Max. size of zip archive (in Mb)":"Taille max. des archives zip (en Mo)","Registration is currently disabled.":"Les inscriptions sont actuellement d\xe9sactiv\xe9es.","Registration is currently enabled.":"Les inscriptions sont actuellement activ\xe9es.","Remove admin rights":"Retirer des droits d\'admin","Sports":"Sports","Update application configuration (maximum number of registered users, maximum files size).":"Configurer l\'application (nombre maximum d\'utilisateurs inscrits, taille maximale des fichers).","uploads":"fichiers","user":"user","Users":"Utilisateurs","users":"utilisateurs"}')},207:function(e){e.exports=JSON.parse('{"activities count":"nombre d\'activit\xe9s","Add workout":"Ajouter une activit\xe9","admin rights":"droits d\'admin","ascending":"ascendant","Back":"Revenir \xe0 la page pr\xe9c\xe9dente","Back to home":"Retour \xe0 l\'accueil","Cancel":"Annuler","Confirmation":"Confirmation","Dashboard":"Tableau de Bord","descending":"descendant","Edit":"Modifier","day":"jour","days":"jours","Next":"Page suivante","No":"Non","no":"non","No records.":"Pas de records.","No workouts.":"Pas d\'activit\xe9s.","Page not found":"Page introuvable","Previous":"Page pr\xe9c\xe9dente","registration date":"date d\'inscription","Sort":"Tri","Sort by":"Trier par","Sport":"Sport","sport":"sport","Sports":"Sports","sports":"sports","Statistics":"Statistiques","Submit":"Valider","to":"\xe0","user name":"utilisateur","Workout":"Activit\xe9","Workouts":"Activit\xe9s","workout":"activit\xe9","workouts":"activit\xe9s","Yes":"Oui","yes":"oui"}')},208:function(e){e.exports=JSON.parse('{"Personal records":"Mes records","This month":"Ce mois","Upload one !":"Ajoutez votre premi\xe8re activit\xe9 !"}')},209:function(e){e.exports=JSON.parse('{"3 to 12 characters required for username.":"3 \xe0 12 caract\xe8res requis pour le nom.","8 characters required for password.":"8 caract\xe8res minimum pour le mot de passe.","An error occurred. Please contact the administrator.":"Une erreur s\'est produite. Merci de contacter l\'administrateur.","activities":"activit\xe9s","Error during picture deletion.":"Erreur lors de la suppression de l\'image.","Error during picture update.":"Erreur lors de la mise \xe0 jour de l\'image.","Error during picture update, file size exceeds max size.":"Erreur lors de la mise \xe0 jour de l\'image, la taille du ficher d\xe9passe la taille maximum autoris\xe9e","Error. Registration is disabled.":"Erreur. L\'inscription est d\xe9sactiv\xe9e.","Error. Please try again or contact the administrator.":"Erreur. Veuillez r\xe9essayer ou contacter l\'administrateur","File extension not allowed.":"Extension de fichier non autoris\xe9e.","File size is greater than the allowed size":"La taille du fichier est sup\xe9rieure \xe0 la limite autoris\xe9e","Incorrect id":"Id incorrect","Invalid credentials.":"Identifiants invalides.","Invalid payload.":"Donn\xe9es incorrectes.","Invalid token. Please log in again.":"Jeton invalide. Merci de vous reconnecter.","No file part.":"Pas de fichier fourni.","No picture.":"Pas d\'image.","No selected file.":"Pas de fichier s\xe9lectionn\xe9.","no correct file.":"fichier incorrect","no gpx file for this activity":"pas de fichier gpx pour cette activit\xe9","Password and password confirmation don\'t match.":"Les mots de passe saisis sont diff\xe9rents.","Provide a valid auth token":"Merci de fournir un jeton valide","records":"records","Signature expired. Please log in again.":"Signature expir\xe9e. Merci de vous reconnecter.","Sorry. That user already exists.":"D\xe9sol\xe9. Cet utilisateur existe d\xe9j\xe0.","Sport can not be disabled, activities exist.":"Le sport ne peut \xeatre d\xe9sactiv\xe9, des activit\xe9es existent","Sport does not exist.":"Le sport n\'existe pas.","sports":"sports","statistics":"statistics","User does not exist.":"L\'utilisateur n\'existe pas.","Valid email must be provided.\\n":"L\'email fourni n\'est pas valide.","You can not delete your account, no other user has admin rights.":"Vous ne pouvez pas supprimer votre compte, aucun autre utilisateur n\'a des droits d\'administration.","You do not have permissions.":"Vous n\'avez pas les permissions n\xe9cessaires."}')},210:function(e){e.exports=JSON.parse('{"Cycling (Sport)":"V\xe9lo (Sport)","Cycling (Transport)":"V\xe9lo (Transport)","Hiking":"Randonn\xe9e","Mountain Biking":"VTT","Running":"Course","Walking":"Marche"}')},211:function(e){e.exports=JSON.parse('{"activities":"activit\xe9s","distance":"distance","duration":"dur\xe9e","month":"mois","Statistics":"Statistiques","year":"ann\xe9e","week":"semaine"}')},212:function(e){e.exports=JSON.parse('{"Admin":"Admin","Are you sure you want to delete this account? All data will be deleted, this cannot be undone.":"Etes-vous s\xfbr de vouloir supprimer ce compte ? Toutes les donn\xe9es seront d\xe9finitivement effac\xe9s.","Are you sure you want to delete your account? All data will be deleted, this cannot be undone.":"Etes-vous s\xfbr de vouloir supprimer votre compte ? Toutes les donn\xe9es seront d\xe9finitivement effac\xe9s.","Bio":"Bio","Birth Date":"Date de naissance","Check your email. If your address is in our database, you\'ll received an email with a link to reset your password.":"V\xe9rifiez vore boite mail. Si vote adresse est dans notre base de donn\xe9es, vous recevrez un email avec un lien pour r\xe9initialiser votre mot de passe","Delete my account":"Supprimer mon compte","Delete picture":"Supprimer l\'image","Delete user account":"Supprimer le compte","Edit Profile":"Editer le profil","Email":"Email","Enter a username":"Saisir un nom","Enter an email address":"Saisir une adresse e-mail","Enter a password":"Saisir un mot de passe","Enter the password confirmation":"Confirmer le mot de passe","First day of week":"Premier jour de la semaine","First Name":"Pr\xe9nom","Forgot password?":"Mot de passe oubli\xe9 ?","Invalid token. Please request a new token.":"Token invalid. Veuillez demander un nouveau token.","Language":"Langue","Last Name":"Nom","Location":"Lieu","loggedOut":"Vous \xeates d\xe9connect\xe9. Cliquez <1>ici1> pour vous reconnecter.","Login":"Se connecter","login":"se connecter","Logout":"Se d\xe9connecter","Monday":"Lundi","Password":"Mot de passe","Password Confirmation":"Confirmation du mot de passe","Password reset":"R\xe9initialiser votre mot de passe","password reset":"r\xe9initialiser votre mot de passe","Profile":"Profil","Profile Edition":"Edition du profil","Register":"S\'inscrire","register":"s\'inscrire","Registration Date":"Date d\'inscription","Reset your password":"R\xe9initialiser votre mot de passe","reset your password":"r\xe9initialiser votre mot de passe","Send":"Envoyer","Sunday":"Dimanche","Timezone":"Fuseau horaire","updatedPasswordText":"Votre mot de passe a \xe9t\xe9 mis \xe0 jour. Cliquez <1>ici1> pour vous connecter.","Username":"Nom d\'utilisateur"}')},261:function(e,t,a){e.exports=a(460)},270:function(e,t,a){},278:function(e,t){},460:function(e,t,a){"use strict";a.r(t),a.d(t,"history",(function(){return Ln})),a.d(t,"rootNode",(function(){return Un})),a.d(t,"store",(function(){return Hn}));var n=a(31),r=a(0),i=a.n(r),c=a(478),s=a(67),o=a.n(s),l=a(193),m=a(56),u=a(194),d=a(80),p=a(195),v=a(196),f={en:{activities:a(197),administration:a(198),common:a(199),dashboard:a(200),messages:a(201),sports:a(202),statistics:a(203),user:a(204)},fr:{activities:a(205),administration:a(206),common:a(207),dashboard:a(208),messages:a(209),sports:a(210),statistics:a(211),user:a(212)}};d.a.use(v.a).use(p.a).init({debug:!1,lng:"en",fallbackLng:"en",keySeparator:!1,interpolation:{escapeValue:!1},resources:f,ns:["common"],defaultNS:"common"});var h=d.a,g=a(5),E=a(6),y=a(9),b=a(8),N=a(7),O=a(19),w=(a(270),a(21)),k=a(464),x=function(e){Object(y.a)(a,e);var t=Object(b.a)(a);function a(){return Object(g.a)(this,a),t.apply(this,arguments)}return Object(E.a)(a,[{key:"render",value:function(){var e=this.props,t=e.message,a=e.messages,n=e.t,r=""!==t&&t?t.split("|").length>1?"".concat(n("messages:".concat(t.split("|")[0])),": ").concat(n("messages:".concat(t.split("|")[1]))):n("messages:".concat(t)):"";return i.a.createElement("div",{className:"error-message"},""!==r&&i.a.createElement("code",null,r),a&&a.length>0&&i.a.createElement("code",null,i.a.createElement("ul",null,a.map((function(e){return i.a.createElement("li",{key:e.id},n("messages:".concat(e.value)))})))))}}]),a}(i.a.PureComponent),j=a(15),_=a(480),S=a(479),D=a(216),A=["bytes","KB","MB","GB","TB"],C=function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],a=Math.floor(Math.log(e)/Math.log(1024));if(!e)return t?"0 bytes":{size:0,suffix:"bytes"};var n=(e/Math.pow(1024,a)).toFixed(1),r=A[a];return t?"".concat(n).concat(r):{size:n,suffix:r}},M=[{key:"activities_count",label:"activities count"},{key:"admin",label:"admin rights"},{key:"created_at",label:"registration date"},{key:"username",label:"user name"}],T=[{key:"asc",label:"ascending"},{key:"desc",label:"descending"}],P=function(){return!!window.localStorage.authToken},F=function(e){var t={};e.noAuthorization||(t.Authorization="Bearer ".concat(window.localStorage.getItem("authToken"))),e.type&&(t["Content-Type"]=e.type);var a={method:e.method,headers:t};"application/json"===e.type&&e.body?a.body=JSON.stringify(e.body):e.body&&(a.body=e.body);var n=new Request("".concat("/api/").concat(e.url),a);return fetch(n).then((function(t){return"DELETE"===e.method||413===t.status?t:t.json()})).catch((function(e){return console.error(e),new Error("An error occurred. Please contact the administrator.")}))},z=function(e,t){if(!e)return"";var a=D.DateTime.fromISO(Object(_.a)(new Date(e),"yyyy-MM-dd'T'HH:mm:ss.SSSxxx")).setZone(t);return Object(S.a)(a.toFormat("yyyy-MM-dd HH:mm:ss"),"yyyy-MM-dd HH:mm:ss",new Date)},R=function(e,t){var a=e.label.toLowerCase(),n=t.label.toLowerCase();return a>n?1:a2&&void 0!==arguments[2]?arguments[2]:"common";return t.map((function(t){return Object(j.a)(Object(j.a)({},t),{},{label:e("".concat(a,":").concat(t.label))})})).sort(R)},I=function(e,t){var a=e;return t.id||"users"===e&&t.username?a="".concat(a,"/").concat(t.username?t.username:t.id):Object.keys(t).length>0&&(a+="?",Object.keys(t).filter((function(e){return t[e]})).map((function(e,n){return a+="".concat(0===n?"":"&").concat(e,"=").concat(t[e])}))),a},U=function(){function e(){Object(g.a)(this,e)}return Object(E.a)(e,null,[{key:"getData",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=I(e,t),n={url:a,method:"GET",type:"application/json"};return F(n)}},{key:"addData",value:function(e,t){return F({url:e,method:"POST",body:t,type:"application/json"})}},{key:"addDataWithFile",value:function(e,t){return F({url:e,method:"POST",body:t})}},{key:"postData",value:function(e,t){var a={url:"".concat(e).concat(t.id?"/".concat(t.id):""),method:"POST",body:t,type:"application/json"};return F(a)}},{key:"updateData",value:function(e,t){var a={url:"".concat(e).concat(t.id?"/".concat(t.id):t.username?"/".concat(t.username):""),method:"PATCH",body:t,type:"application/json"};return F(a)}},{key:"deleteData",value:function(e,t){var a={url:"".concat(e,"/").concat(t),method:"DELETE",type:"application/json"};return F(a)}}]),e}(),H=function(e,t){return{type:"SET_DATA",data:t,target:e}},q=function(e,t,a){return{type:"SET_PAGINATED_DATA",data:t,pagination:a,target:e}},V=function(e){return{type:"SET_ERROR",message:e}},B=function(e){return{type:"SET_LOADING",loading:e}},G=function(e){return{type:"UPDATE_SPORT_DATA",data:e}},W=function(e){return{type:"UPDATE_USER_DATA",data:e}},J=function(e,t,a){var n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];return function(r){return r(B(!0)),a&&a.id&&isNaN(a.id)?(r(B(!1)),r(V("".concat(t,"|Incorrect id")))):(r(V("")),U[e](t,a).then((function(a){if("success"===a.status)if(n){if("users"===t&&"getData"===e)return r(q(t,a.data,a.pagination));r(H(t,a.data))}else"updateData"===e&&"sports"===t?r(G(a.data.sports[0])):"updateData"===e&&"users"===t&&r(W(a.data.users[0]));else r(V("".concat(t,"|").concat(a.message||a.status)));r(B(!1))})).catch((function(e){r(B(!1)),r(V("".concat(t,"|").concat(e)))})))}},Y=function(e){return function(t){d.a.changeLanguage(e).then(t(function(e){return{type:"SET_LANGUAGE",language:e}}(e)))}},K=function(e){return{type:"SET_APP_CONFIG",data:e}},X=function(e){return function(t){return U.getData(e).then((function(a){"success"===a.status?"config"===e?t(K(a.data)):"stats/all"===e&&t({type:"SET_APP_STATS",data:a.data}):t(V("application|".concat(a.message)))})).catch((function(e){return t(V("application|".concat(e)))}))}},$=function(e){Object(y.a)(a,e);var t=Object(b.a)(a);function a(e,n){var r;return Object(g.a)(this,a),(r=t.call(this,e,n)).state={formData:{},isInEdition:!1},r}return Object(E.a)(a,[{key:"componentDidMount",value:function(){this.initForm()}},{key:"componentDidUpdate",value:function(e){this.props.appConfig!==e.appConfig&&this.initForm()}},{key:"initForm",value:function(){var e=this.props.appConfig,t={};Object.keys(e).map((function(a){return null===e[a]?t[a]="":["max_single_file_size","max_zip_file_size"].includes(a)?t[a]=+(e[a]/1048576).toFixed(2):t[a]=e[a]})),this.setState({formData:t})}},{key:"handleFormChange",value:function(e){var t=this.state.formData;t[e.target.name]=+e.target.value,this.setState(t)}},{key:"toggleInEdition",value:function(e){e.preventDefault();var t=this.state.isInEdition;this.setState({isInEdition:!t})}},{key:"render",value:function(){var e=this,t=this.props,a=t.message,n=t.onHandleConfigFormSubmit,r=t.t,c=this.state,s=c.formData,o=c.isInEdition;return i.a.createElement("div",null,a&&i.a.createElement(x,{message:a,t:r}),Object.keys(s).length>0&&i.a.createElement("div",{className:"row"},i.a.createElement("div",{className:"col-md-12"},i.a.createElement("div",{className:"card"},i.a.createElement("div",{className:"card-header"},i.a.createElement("strong",null,r("administration:Application configuration"))),i.a.createElement("div",{className:"card-body"},i.a.createElement("form",{className:"app-config-form ".concat(o?"":"form-disabled"),onSubmit:function(t){e.toggleInEdition(t),n(s)}},i.a.createElement("div",{className:"form-group row"},i.a.createElement("label",{className:"col-sm-6 col-form-label",htmlFor:"max_users"},r("administration:Max. number of active users"),i.a.createElement("sup",null,i.a.createElement("i",{className:"fa fa-question-circle","aria-hidden":"true",title:r("administration:if 0, no limitation")})),":"),i.a.createElement("input",{className:"col-sm-5",id:"max_users",name:"max_users",type:"number",min:"0",value:s.max_users,onChange:function(t){return e.handleFormChange(t)}})),i.a.createElement("div",{className:"form-group row"},i.a.createElement("label",{className:"col-sm-6 col-form-label",htmlFor:"max_single_file_size"},r("administration:Max. size of uploaded files (in Mb)"),":"),i.a.createElement("input",{className:"col-sm-5",id:"max_single_file_size",name:"max_single_file_size",type:"number",step:"0.1",min:"0",value:s.max_single_file_size,onChange:function(t){return e.handleFormChange(t)}})),i.a.createElement("div",{className:"form-group row"},i.a.createElement("label",{className:"col-sm-6 col-form-label",htmlFor:"max_zip_file_size"},r("administration:Max. size of zip archive (in Mb)"),":"),i.a.createElement("input",{className:"col-sm-5",id:"max_zip_file_size",name:"max_zip_file_size",type:"number",step:"0.1",min:"0",value:s.max_zip_file_size,onChange:function(t){return e.handleFormChange(t)}})),i.a.createElement("div",{className:"form-group row"},i.a.createElement("label",{className:"col-sm-6 col-form-label",htmlFor:"gpx_limit_import"},r("administration:Max. files of zip archive")),i.a.createElement("input",{className:"col-sm-5",id:"gpx_limit_import",name:"gpx_limit_import",type:"number",min:"0",value:s.gpx_limit_import,onChange:function(t){return e.handleFormChange(t)}})),o?i.a.createElement(i.a.Fragment,null,i.a.createElement("input",{type:"submit",className:"btn btn-primary",value:r("common:Submit")}),i.a.createElement("input",{type:"submit",className:"btn btn-secondary",onClick:function(t){return e.toggleInEdition(t)},value:r("common:Cancel")})):i.a.createElement(i.a.Fragment,null,i.a.createElement("input",{type:"submit",className:"btn btn-primary",onClick:function(t){e.toggleInEdition(t)},value:r("common:Edit")}),i.a.createElement("input",{type:"submit",className:"btn btn-secondary",onClick:function(){return Ln.push("/admin")},value:r("common:Back")}))))))))}}]),a}(i.a.Component),Z=Object(N.c)((function(e){return{message:e.message}}),(function(e){return{onHandleConfigFormSubmit:function(t){var a=Object.assign({},t);a.max_single_file_size*=1048576,a.max_zip_file_size*=1048576,e(function(e){return function(t){return U.updateData("config",e).then((function(e){"success"===e.status?t(K(e.data)):t(V("application|".concat(e.message)))})).catch((function(e){return t(V("application|".concat(e)))}))}}(a))}}}))($),Q=a(13),ee=function(e){Object(y.a)(a,e);var t=Object(b.a)(a);function a(){return Object(g.a)(this,a),t.apply(this,arguments)}return Object(E.a)(a,[{key:"componentDidMount",value:function(){this.props.loadAppStats()}},{key:"render",value:function(){var e=this.props,t=e.appStats,a=e.t,n=C(t.uploads_dir_size,!1);return i.a.createElement("div",{className:"row"},i.a.createElement("div",{className:"col-lg-3 col-md-6 col-sm-6"},i.a.createElement("div",{className:"card activity-card"},i.a.createElement("div",{className:"card-body row"},i.a.createElement("div",{className:"col-3"},i.a.createElement("i",{className:"fa fa-users fa-3x fa-color"})),i.a.createElement("div",{className:"col-9 text-right"},i.a.createElement("div",{className:"huge"},t.users?t.users:0),i.a.createElement("div",null,"".concat(1===t.users?a("administration:user"):a("administration:users"))))))),i.a.createElement("div",{className:"col-lg-3 col-md-6 col-sm-6"},i.a.createElement("div",{className:"card activity-card"},i.a.createElement("div",{className:"card-body row"},i.a.createElement("div",{className:"col-3"},i.a.createElement("i",{className:"fa fa-tags fa-3x fa-color"})),i.a.createElement("div",{className:"col-9 text-right"},i.a.createElement("div",{className:"huge"},t.sports?t.sports:0),i.a.createElement("div",null,"".concat(1===t.sports?a("common:sport"):a("common:sports"))))))),i.a.createElement("div",{className:"col-lg-3 col-md-6 col-sm-6"},i.a.createElement("div",{className:"card activity-card"},i.a.createElement("div",{className:"card-body row"},i.a.createElement("div",{className:"col-3"},i.a.createElement("i",{className:"fa fa-calendar fa-3x fa-color"})),i.a.createElement("div",{className:"col-9 text-right"},i.a.createElement("div",{className:"huge"},t.activities?t.activities:0),i.a.createElement("div",null,"".concat(1===t.activities?a("common:workout"):a("common:workouts"))))))),i.a.createElement("div",{className:"col-lg-3 col-md-6 col-sm-6"},i.a.createElement("div",{className:"card activity-card"},i.a.createElement("div",{className:"card-body row"},i.a.createElement("div",{className:"col-3"},i.a.createElement("i",{className:"fa fa-folder-open fa-3x fa-color"})),i.a.createElement("div",{className:"col-9 text-right"},i.a.createElement("div",{className:"huge"},n.size),i.a.createElement("div",null,n.suffix," (",a("administration:uploads"),")"))))))}}]),a}(i.a.Component),te=Object(k.a)()(Object(N.c)((function(e){return{appStats:e.application.statistics}}),(function(e){return{loadAppStats:function(){e(X("stats/all"))}}}))(ee));function ae(e){var t=e.appConfig,a=e.t;return i.a.createElement("div",{className:"card activity-card"},i.a.createElement("div",{className:"card-header"},i.a.createElement("strong",null,a("administration:Administration"))),i.a.createElement("div",{className:"card-body"},i.a.createElement(te,null),i.a.createElement("br",null),i.a.createElement("dl",{className:"admin-items"},i.a.createElement("dt",null,i.a.createElement(Q.a,{to:{pathname:"/admin/application"}},a("administration:Application"))),i.a.createElement("dd",null,a("administration:Update application configuration (maximum number of registered users, maximum files size)."),i.a.createElement("br",null),i.a.createElement("strong",null,a("administration:Registration is currently ".concat(t.is_registration_enabled?"enabled":"disabled",".")))),i.a.createElement("br",null),i.a.createElement("dt",null,i.a.createElement(Q.a,{to:{pathname:"/admin/sports"}},a("administration:Sports"))),i.a.createElement("dd",null,a("administration:Enable/disable sports.")),i.a.createElement("br",null),i.a.createElement("dt",null,i.a.createElement(Q.a,{to:{pathname:"/admin/users"}},a("administration:Users"))),i.a.createElement("dd",null,a("administration:Add/remove admin rights, delete user account.")))))}var ne=function(e){Object(y.a)(a,e);var t=Object(b.a)(a);function a(){return Object(g.a)(this,a),t.apply(this,arguments)}return Object(E.a)(a,[{key:"componentDidMount",value:function(){this.props.loadSports()}},{key:"render",value:function(){var e=this.props,t=e.message,a=e.sports,n=e.t,r=e.updateSport;return i.a.createElement("div",null,t&&i.a.createElement(x,{message:t,t:n}),i.a.createElement("div",{className:"row"},i.a.createElement("div",{className:"col"},i.a.createElement("div",{className:"card"},i.a.createElement("div",{className:"card-header"},i.a.createElement("strong",null,n("administration:Sports"))),i.a.createElement("div",{className:"card-body"},a.length>0&&i.a.createElement("table",{className:"table"},i.a.createElement("thead",null,i.a.createElement("tr",null,i.a.createElement("th",null,n("administration:id")),i.a.createElement("th",null,n("administration:Image")),i.a.createElement("th",null,n("administration:Label")),i.a.createElement("th",null,n("administration:Active")),i.a.createElement("th",null,n("administration:Actions")))),i.a.createElement("tbody",null,a.map((function(e){return i.a.createElement("tr",{key:e.id},i.a.createElement("td",null,i.a.createElement("span",{className:"heading-span-absolute"},n("administration:id")),e.id),i.a.createElement("td",null,i.a.createElement("span",{className:"heading-span-absolute"},n("administration:Image")),i.a.createElement("img",{className:"admin-img",src:e.img?e.img:"/img/photo.png",alt:"sport logo"})),i.a.createElement("td",null,i.a.createElement("span",{className:"heading-span-absolute"},n("administration:Label")),n("sports:".concat(e.label))),i.a.createElement("td",null,i.a.createElement("span",{className:"heading-span-absolute"},n("administration:Active")),e.is_active?i.a.createElement("i",{className:"fa fa-check-square-o custom-fa","aria-hidden":"true","data-toggle":"tooltip"}):i.a.createElement("i",{className:"fa fa-square-o custom-fa","aria-hidden":"true","data-toggle":"tooltip"})),i.a.createElement("td",null,i.a.createElement("span",{className:"heading-span-absolute"},n("administration:Actions")),i.a.createElement("input",{type:"submit",className:"btn btn-".concat(e.is_active?"dark":"primary"," btn-sm"),value:e.is_active?n("administration:Disable"):n("administration:Enable"),onClick:function(){return r(e.id,!e.is_active)}}),e.has_activities&&i.a.createElement("span",{className:"admin-message"},i.a.createElement("i",{className:"fa fa-warning custom-fa","aria-hidden":"true"}),n("administration:activities exist"))))})))),i.a.createElement("input",{type:"submit",className:"btn btn-secondary",onClick:function(){return Ln.push("/admin/")},value:n("common:Back")}))))))}}]),a}(i.a.Component),re=Object(N.c)((function(e){return{message:e.message,sports:e.sports.data,user:e.user}}),(function(e){return{loadSports:function(){e(J("getData","sports"))},updateSport:function(t,a){e(J("updateData","sports",{id:t,is_active:a},!1))}}}))(ne),ie=function(e){Object(y.a)(a,e);var t=Object(b.a)(a);function a(){return Object(g.a)(this,a),t.apply(this,arguments)}return Object(E.a)(a,[{key:"getUrl",value:function(e){var t=this.props,a=t.query,n=t.pathname,r=Object.assign({},a),i=a.page?+a.page:1;switch(e){case"prev":i-=1;break;case"next":i+=1;break;default:i=+e}return r.page=i,I(n,r)}},{key:"render",value:function(){var e,t=this,a=this.props,n=a.pagination,r=a.t;return i.a.createElement(i.a.Fragment,null,n&&Object.keys(n).length>0&&i.a.createElement("nav",{"aria-label":"Page navigation example"},i.a.createElement("ul",{className:"pagination justify-content-center"},i.a.createElement("li",{className:"page-item ".concat(n.has_prev?"":"disabled")},i.a.createElement(Q.a,{className:"page-link",to:this.getUrl("prev"),"aria-disabled":!n.has_prev},r("common:Previous"))),(e=n.pages,Array.from({length:e},(function(e,t){return t+1}))).map((function(e){return i.a.createElement("li",{key:e,className:"page-item ".concat(e===n.page?"active":"")},i.a.createElement(Q.a,{className:"page-link",to:t.getUrl(e)},e))})),i.a.createElement("li",{className:"page-item ".concat(n.has_next?"":"disabled")},i.a.createElement(Q.a,{className:"page-link",to:this.getUrl("next"),"aria-disabled":!n.has_next},r("common:Next"))))))}}]),a}(i.a.PureComponent),ce=function(e){Object(y.a)(a,e);var t=Object(b.a)(a);function a(e,n){var r;return Object(g.a)(this,a),(r=t.call(this,e,n)).state={page:null,per_page:null,order_by:"created_at",order:"asc"},r}return Object(E.a)(a,[{key:"componentDidMount",value:function(){this.props.loadUsers(this.initState())}},{key:"componentDidUpdate",value:function(e){e.location.query!==this.props.location.query&&this.props.loadUsers(this.props.location.query)}},{key:"initState",value:function(){var e=this.props.location.query,t={page:e.page,per_page:e.per_page,order_by:e.order_by?e.order_by:"created_at",order:e.order?e.order:"asc"};return this.setState(t),t}},{key:"updatePage",value:function(e,t){var a=Object.assign({},this.state);a[e]=t,this.setState(a);var n=I(this.props.location.pathname,a);Ln.push(n)}},{key:"render",value:function(){var e=this,t=this.props,a=t.authUser,n=t.location,r=t.message,c=t.t,s=t.pagination,o=t.updateUser,l=t.users,m=L(c,M),u=L(c,T);return i.a.createElement("div",null,r&&i.a.createElement(x,{message:r,t:c}),i.a.createElement("div",{className:"container"},i.a.createElement("div",{className:"row"},i.a.createElement("div",{className:"col"},i.a.createElement("div",{className:"card"},i.a.createElement("div",{className:"card-header"},i.a.createElement("strong",null,c("administration:Users"))),i.a.createElement("div",{className:"card-body"},i.a.createElement("div",{className:"row user-filters"},i.a.createElement("div",{className:"col-lg-4 col-md-6 col-sm-12"},i.a.createElement("label",{htmlFor:"order_by"},c("common:Sort by"),":"," ",i.a.createElement("select",{id:"order_by",name:"order_by",value:this.state.order_by,onChange:function(t){return e.updatePage("order_by",t.target.value)}},m.map((function(e){return i.a.createElement("option",{key:e.key,value:e.key},e.label)})))," ")),i.a.createElement("div",{className:"col-lg-4 col-md-6 col-sm-12"},i.a.createElement("label",{htmlFor:"sort"},c("common:Sort"),":"," ",i.a.createElement("select",{id:"sort",name:"sort",value:this.state.order,onChange:function(t){return e.updatePage("order",t.target.value)}},u.map((function(e){return i.a.createElement("option",{key:e.key,value:e.key},e.label)})))," "))),i.a.createElement("table",{className:"table"},i.a.createElement("thead",null,i.a.createElement("tr",null,i.a.createElement("th",null,"#"),i.a.createElement("th",null,c("user:Username")),i.a.createElement("th",null,c("user:Email")),i.a.createElement("th",null,c("user:Registration Date")),i.a.createElement("th",null,c("activities:Activities")),i.a.createElement("th",null,c("user:Admin")),i.a.createElement("th",null,c("administration:Actions")))),i.a.createElement("tbody",null,l.map((function(e){return i.a.createElement("tr",{key:e.username},i.a.createElement("td",null,i.a.createElement("span",{className:"heading-span-absolute"},"#"),!0===e.picture?i.a.createElement("img",{alt:"Avatar",src:"".concat("/api/","users/").concat(e.username,"/picture?").concat(Date.now()),className:"img-fluid App-nav-profile-img"}):i.a.createElement("i",{className:"fa fa-user-circle-o fa-2x no-picture","aria-hidden":"true"})),i.a.createElement("td",null,i.a.createElement("span",{className:"heading-span-absolute"},c("user:Username")),i.a.createElement(Q.a,{to:"/users/".concat(e.username)},e.username)),i.a.createElement("td",null,i.a.createElement("span",{className:"heading-span-absolute"},c("user:Email")),e.email),i.a.createElement("td",null,i.a.createElement("span",{className:"heading-span-absolute"},c("user:Registration Date")),Object(_.a)(new Date(e.created_at),"dd/MM/yyyy HH:mm")),i.a.createElement("td",null,i.a.createElement("span",{className:"heading-span-absolute"},c("activities:Activities")),e.nb_activities),i.a.createElement("td",null,i.a.createElement("span",{className:"heading-span-absolute"},c("user:Admin")),e.admin?i.a.createElement("i",{className:"fa fa-check-square-o custom-fa","aria-hidden":"true","data-toggle":"tooltip"}):i.a.createElement("i",{className:"fa fa-square-o custom-fa","aria-hidden":"true","data-toggle":"tooltip"})),i.a.createElement("td",null,i.a.createElement("span",{className:"heading-span-absolute"},c("administration:Actions")),i.a.createElement("input",{type:"submit",className:"btn btn-".concat(e.admin?"dark":"primary"," btn-sm"),disabled:e.username===a.username,value:e.admin?c("administration:Remove admin rights"):c("administration:Add admin rights"),onClick:function(){return o(e.username,!e.admin)}})))})))),i.a.createElement(ie,{pagination:s,pathname:n.pathname,query:this.state,t:c}),i.a.createElement("input",{type:"submit",className:"btn btn-secondary",onClick:function(){return Ln.push("/admin/")},value:c("common:Back")})))))))}}]),a}(i.a.Component),se=Object(N.c)((function(e){return{authUser:e.user,location:e.router.location,message:e.message,pagination:e.users.pagination,users:e.users.data}}),(function(e){return{loadUsers:function(t){e(J("getData","users",t))},updateUser:function(t,a){e(J("updateData","users",{username:t,admin:a},!1))}}}))(ce),oe=a(217);function le(){var e=Object(oe.a)().t;return i.a.createElement("div",null,i.a.createElement(w.a,null,i.a.createElement("title",null,"fittrackee - 404")),i.a.createElement("h1",{className:"page-title"},e("Page not found")))}var me=Object(k.a)()(Object(N.c)((function(e){return{appConfig:e.application.config,user:e.user}}))((function(e){var t=e.appConfig,a=e.t,n=e.user;return i.a.createElement(i.a.Fragment,null,i.a.createElement(w.a,null,i.a.createElement("title",null,"FitTrackee - ",a("administration:Administration"))),i.a.createElement("div",{className:"container dashboard"},n.admin?i.a.createElement(O.d,null,i.a.createElement(O.b,{exact:!0,path:"/admin",render:function(){return i.a.createElement(ae,{appConfig:t,t:a})}}),i.a.createElement(O.b,{exact:!0,path:"/admin/application",render:function(){return i.a.createElement(Z,{appConfig:t,t:a})}}),i.a.createElement(O.b,{exact:!0,path:"/admin/sports",render:function(){return i.a.createElement(re,{t:a})}}),i.a.createElement(O.b,{exact:!0,path:"/admin/users",render:function(){return i.a.createElement(se,{t:a})}}),i.a.createElement(O.b,{component:le})):i.a.createElement(le,null)))}))),ue=a(465),de=a(39),pe=a(484),ve=a(220),fe=a.n(ve),he=["#55a8a3","#98C3A9","#D0838A","#ECC77E","#926692","#929292","#428bca"],ge=[{record_type:"AS",label:"Ave. speed"},{record_type:"FD",label:"Farest distance"},{record_type:"LD",label:"Longest duration"},{record_type:"MS",label:"Max. speed"}],Ee=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return t||(t="yyyy/MM/dd"),a||(a="HH:mm"),{activity_date:e?Object(_.a)(e,t):null,activity_time:e?Object(_.a)(e,a):null}},ye=function(e){var t=new Date(0);return(t=Object(pe.a)(t.setSeconds(e),1)).getTime()},be=function(e){for(var t=0;tn?1:a2&&void 0!==arguments[2]&&arguments[2];return e.filter((function(e){return!a||e.is_active})).map((function(e){return Object(j.a)(Object(j.a)({},e),{},{label:t("sports:".concat(e.label))})})).sort(Ne)},we=function(){function e(){Object(g.a)(this,e)}return Object(E.a)(e,null,[{key:"loginOrRegisterOrPasswordReset",value:function(e,t){var a={url:"auth/".concat(e),method:"POST",noAuthorization:!0,body:t,type:"application/json"};return F(a)}},{key:"deletePicture",value:function(){return F({url:"auth/picture",method:"DELETE"})}}]),e}(),ke=function(e){return{type:"PICTURE_ERROR",message:e}},xe=function(e){return{type:"PROFILE_UPDATE_ERROR",message:e}},je=function(){return function(e){return window.localStorage.getItem("authToken")?e(_e()):{type:"LOGOUT"}}},_e=function(){return function(e){return U.getData("auth/profile").then((function(t){return"success"===t.status?(e(J("getData","sports")),t.data.isAuthenticated=!0,t.data.language&&e(Y(t.data.language)),e({type:"PROFILE_SUCCESS",profil:t.data})):e({type:"PROFILE_ERROR",message:t.message})})).catch((function(e){throw e}))}},Se=function(e,t){return function(a){if("register"===t||"password/update"===t){var n=function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],a=[];return!t&&(e.username.length<3||e.username.length>12)&&a.push("3 to 12 characters required for username."),e.password!==e.password_conf&&a.push("Password and password confirmation don't match."),e.password.length<8&&a.push("8 characters required for password."),a}(e,"password/update"===t);if(n.length>0)return a({type:"AUTH_ERRORS",messages:function(e){var t=0;return e.map((function(e){var a={id:t,value:e};return t++,a}))}(n)})}return a(function(e,t){return function(a){return we.loginOrRegisterOrPasswordReset(e,t).then((function(t){if("success"===t.status){if("password/reset-request"===e)return Ln.push({pathname:"/password-reset/sent"});if("password/update"===e)return Ln.push({pathname:"/updated-password"});if("login"===e||"register"===e)return window.localStorage.setItem("authToken",t.auth_token),"register"===e&&a(X("config")),a(_e())}return a({type:"AUTH_ERROR",message:t.message})})).catch((function(e){throw e}))}}(t,e))}},De=function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return function(a){return U.deleteData("users",e).then((function(e){204===e.status?(a(X("config")),t?Ln.push("/admin/users"):(a({type:"LOGOUT"}),Ln.push("/"))):e.json().then((function(e){return a(V("".concat(e.message)))}))})).catch((function(e){return a(V("user|".concat(e)))}))}},Ae=function(e){return{type:"SET_GPX",gpxContent:e}},Ce=function(e){return{type:"SET_CHART_DATA",chartData:e}},Me=function(e){return function(t){return U.updateData("activities",e).then((function(e){"success"===e.status?(t(je()),Ln.push("/activities/".concat(e.data.activities[0].id))):t(V("activities|".concat(e.message))),t(B(!1))})).catch((function(e){t(B(!1)),t(V("activities|".concat(e)))}))}},Te=function(e){return function(t){return U.getData("activities",e).then((function(e){"success"===e.status?e.data.activities.length>0&&t({type:"PUSH_ACTIVITIES",activities:e.data.activities}):t(V("activities|".concat(e.message)))})).catch((function(e){return t(V("activities|".concat(e)))}))}};var Pe=Object(N.c)((function(e){return{appConfig:e.application.config,loading:e.loading}}),(function(e){return{onAddActivity:function(t){e(B(!0));var a=new FormData;a.append("file",t.target.form.gpxFile.files[0]),a.append("data",'{"sport_id": '.concat(t.target.form.sport.value,', "notes": "').concat(t.target.form.notes.value,'"}')),e(function(e){return function(t){return U.addDataWithFile("activities",e).then((function(e){"created"===e.status?0===e.data.activities.length?t(V("activities|no correct file.")):1===e.data.activities.length?(t(je()),Ln.push("/activities/".concat(e.data.activities[0].id))):(t(je()),Ln.push("/")):413===e.status?t(V("activities|File size is greater than the allowed size")):t(V("activities|".concat(e.message))),t(B(!1))})).catch((function(e){t(B(!1)),t(V("activities|".concat(e)))}))}}(a))},onEditActivity:function(t,a){e(Me({id:a.id,notes:t.target.form.notes.value,sport_id:+t.target.form.sport.value,title:t.target.form.title.value}))}}}))((function(e){var t=e.activity,a=e.appConfig,n=e.loading,r=e.onAddActivity,c=e.onEditActivity,s=e.sports,o=e.t,l=t?t.sport_id:"",m=Oe(s,o,!0),u="".concat(o("activities:no folder inside"),", ").concat(a.gpx_limit_import," ").concat(o("activities:files max"),", ").concat(o("activities:max size"),": ").concat(C(a.max_zip_file_size)),d=C(a.max_single_file_size);return i.a.createElement("form",{encType:"multipart/form-data",method:"post",onSubmit:function(e){return e.preventDefault()}},i.a.createElement("div",{className:"form-group"},i.a.createElement("label",null,o("common:Sport"),":",i.a.createElement("select",{className:"form-control input-lg",defaultValue:l,disabled:n,name:"sport",required:!0},i.a.createElement("option",{value:""}),m.map((function(e){return i.a.createElement("option",{key:e.id,value:e.id},e.label)}))))),t?i.a.createElement("div",{className:"form-group"},i.a.createElement("label",null,o("activities:Title"),":",i.a.createElement("input",{name:"title",defaultValue:t?t.title:"",disabled:n,className:"form-control input-lg"}))):i.a.createElement("div",{className:"form-group"},i.a.createElement("label",null,i.a.createElement(ue.a,{i18nKey:"activities:gpxFile"},i.a.createElement("strong",null,"gpx")," file"),i.a.createElement("sup",null,i.a.createElement("i",{className:"fa fa-question-circle","aria-hidden":"true","data-toggle":"tooltip",title:"".concat(o("activities:max size"),": ").concat(d)}))," ",i.a.createElement(ue.a,{i18nKey:"activities:zipFile"},"or ",i.a.createElement("strong",null," zip")," file containing ",i.a.createElement("strong",null,"gpx "),"files"),i.a.createElement("sup",null,i.a.createElement("i",{className:"fa fa-question-circle","aria-hidden":"true","data-toggle":"tooltip","data-placement":"top",title:u}))," ",":",i.a.createElement("input",{accept:".gpx, .zip",className:"form-control form-control-file gpx-file",disabled:n,name:"gpxFile",required:!0,type:"file"}))),i.a.createElement("div",{className:"form-group"},i.a.createElement("label",null,o("activities:Notes"),":",i.a.createElement("textarea",{name:"notes",defaultValue:t?t.notes:"",disabled:n,className:"form-control input-lg",maxLength:"500"}))),n?i.a.createElement("div",{className:"loader"}):i.a.createElement("div",null,i.a.createElement("input",{type:"submit",className:"btn btn-primary",onClick:function(e){return t?c(e,t):r(e)},value:o("common:Submit")}),i.a.createElement("input",{type:"submit",className:"btn btn-secondary",onClick:function(){return Ln.push("/")},value:o("common:Cancel")})))}));var Fe=Object(N.c)((function(e){return{user:e.user}}),(function(e){return{onAddOrEdit:function(t,a){var n,r=t.target.form.duration.value.split(":"),i=60*+r[0]*60+60*+r[1]+ +r[2],c={activity_date:"".concat(t.target.form.activity_date.value," ").concat(t.target.form.activity_time.value),distance:+t.target.form.distance.value,duration:i,notes:t.target.form.notes.value,sport_id:+t.target.form.sport_id.value,title:t.target.form.title.value};a?(c.id=a.id,e(Me(c))):e((n=c,function(e){return U.addData("activities/no_gpx",n).then((function(t){"created"===t.status?(e(je()),Ln.push("/activities/".concat(t.data.activities[0].id))):e(V("activities|".concat(t.message)))})).catch((function(t){return e(V("activities|".concat(t)))}))}))}}}))((function(e){var t,a,n=e.activity,r=e.onAddOrEdit,c=e.sports,s=e.t,o=e.user,l=Oe(c,s,!0),m="";if(n){var u=Ee(z(n.activity_date,o.timezone),"yyyy-MM-dd");t=u.activity_date,a=u.activity_time,m=n.sport_id}return i.a.createElement("form",{onSubmit:function(e){return e.preventDefault()}},i.a.createElement("div",{className:"form-group"},i.a.createElement("label",null,s("activities:Title"),":",i.a.createElement("input",{name:"title",defaultValue:n?n.title:"",className:"form-control input-lg"}))),i.a.createElement("div",{className:"form-group"},i.a.createElement("label",null,s("common:Sport"),":",i.a.createElement("select",{className:"form-control input-lg",defaultValue:m,name:"sport_id",required:!0},i.a.createElement("option",{value:""}),l.map((function(e){return i.a.createElement("option",{key:e.id,value:e.id},e.label)}))))),i.a.createElement("div",{className:"form-group"},i.a.createElement("label",null,s("activities:Activity Date"),":",i.a.createElement("div",{className:"container"},i.a.createElement("div",{className:"row"},i.a.createElement("input",{name:"activity_date",defaultValue:t,className:"form-control col-md",required:!0,type:"date"}),i.a.createElement("input",{name:"activity_time",defaultValue:a,className:"form-control col-md",required:!0,type:"time"}))))),i.a.createElement("div",{className:"form-group"},i.a.createElement("label",null,s("activities:Duration"),":",i.a.createElement("input",{name:"duration",defaultValue:n?n.duration:"",className:"form-control col-xs-4",pattern:"^([0-9]*[0-9]):([0-5][0-9]):([0-5][0-9])$",placeholder:"hh:mm:ss",required:!0,type:"text"}))),i.a.createElement("div",{className:"form-group"},i.a.createElement("label",null,s("activities:Distance")," (km):",i.a.createElement("input",{name:"distance",defaultValue:n?n.distance:"",className:"form-control input-lg",min:0,required:!0,step:"0.001",type:"number"}))),i.a.createElement("div",{className:"form-group"},i.a.createElement("label",null,s("activities:Notes"),":",i.a.createElement("textarea",{name:"notes",defaultValue:n?n.notes:"",className:"form-control input-lg",maxLength:"500"}))),i.a.createElement("input",{type:"submit",className:"btn btn-primary",onClick:function(e){return r(e,n)},value:s("common:Submit")}),i.a.createElement("input",{type:"submit",className:"btn btn-secondary",onClick:function(){return Ln.push("/")},value:s("common:Cancel")}))})),ze=function(e){Object(y.a)(a,e);var t=Object(b.a)(a);function a(e,n){var r;return Object(g.a)(this,a),(r=t.call(this,e,n)).state={withGpx:!0},r}return Object(E.a)(a,[{key:"handleRadioChange",value:function(e){this.setState({withGpx:"withGpx"===e.target.name?e.target.value:!e.target.value})}},{key:"render",value:function(){var e=this,t=this.props,a=t.activity,n=t.loading,r=t.message,c=t.sports,s=t.t,o=this.state.withGpx;return i.a.createElement("div",null,i.a.createElement(w.a,null,i.a.createElement("title",null,"FitTrackee -"," ",s(a?"activities:Edit a workout":"activities:Add a workout"))),i.a.createElement("br",null),i.a.createElement("br",null),i.a.createElement(x,{message:r,t:s}),i.a.createElement("div",{className:"container"},i.a.createElement("div",{className:"row"},i.a.createElement("div",{className:"col-md-2"}),i.a.createElement("div",{className:"col-md-8"},i.a.createElement("div",{className:"card add-activity"},i.a.createElement("h2",{className:"card-header text-center"},s(a?"activities:Edit a workout":"activities:Add a workout")),i.a.createElement("div",{className:"card-body"},a?a.with_gpx?i.a.createElement(Pe,{activity:a,sports:c,t:s}):i.a.createElement(Fe,{activity:a,sports:c,t:s}):i.a.createElement("div",null,i.a.createElement("form",null,i.a.createElement("div",{className:"form-group row"},i.a.createElement("div",{className:"col"},i.a.createElement("label",{className:"radioLabel"},i.a.createElement("input",{className:"add-activity-radio",type:"radio",name:"withGpx",disabled:n,checked:o,onChange:function(t){return e.handleRadioChange(t)}}),s("activities:with gpx file"))),i.a.createElement("div",{className:"col"},i.a.createElement("label",{className:"radioLabel"},i.a.createElement("input",{className:"add-activity-radio",type:"radio",name:"withoutGpx",disabled:n,checked:!o,onChange:function(t){return e.handleRadioChange(t)}}),s("activities:without gpx file"))))),o?i.a.createElement(Pe,{sports:c,t:s}):i.a.createElement(Fe,{sports:c,t:s}))))),i.a.createElement("div",{className:"col-md-2"}))))}}]),a}(i.a.Component),Re=Object(k.a)()(Object(N.c)((function(e){return{loading:e.loading}}))(ze));var Le=Object(N.c)((function(e){return{message:e.message,sports:e.sports.data,user:e.user}}))((function(e){var t=e.message,a=e.sports;return i.a.createElement("div",null,i.a.createElement(Re,{activity:null,message:t,sports:a}))}));function Ie(e){var t=e.activity,a=e.dataType,n=e.displayModal,r=e.segmentId,c=e.sport,s=e.t,o=e.title,l=e.user,m=t?Ee(z(t.activity_date,l.timezone)):null,u="segment"===a&&1!==r?"/activities/".concat(t.id,"/segment/").concat(r-1):"activity"===a&&t.previous_activity?"/activities/".concat(t.previous_activity):null,d="segment"===a&&r0?i.a.createElement("div",null,i.a.createElement("div",{className:"row chart-radio"},i.a.createElement("label",{className:"radioLabel col-md-1"},i.a.createElement("input",{type:"radio",name:"distance",checked:o,onChange:function(e){return a.handleRadioChange(e)}}),c("activities:distance")),i.a.createElement("label",{className:"radioLabel col-md-1"},i.a.createElement("input",{type:"radio",name:"duration",checked:!o,onChange:function(e){return a.handleRadioChange(e)}}),c("activities:duration"))),i.a.createElement("div",{className:"row chart-radio"},i.a.createElement("div",{className:"col-md-5"}),i.a.createElement("label",{className:"radioLabel col-md-1"},i.a.createElement("input",{type:"checkbox",name:"speed",checked:this.displayData("speed"),onChange:function(e){return a.handleLegendChange(e)}}),c("activities:speed")),i.a.createElement("label",{className:"radioLabel col-md-1"},i.a.createElement("input",{type:"checkbox",name:"elevation",checked:this.displayData("elevation"),onChange:function(e){return a.handleLegendChange(e)}}),c("activities:elevation")),i.a.createElement("div",{className:"col-md-5"})),i.a.createElement("div",{className:"row chart"},i.a.createElement(Ue.f,{height:300},i.a.createElement(Ue.d,{data:r,margin:{top:15,right:30,left:20,bottom:15},onMouseMove:function(e){return s(e.activePayload)},onMouseLeave:function(){return s(null)}},i.a.createElement(Ue.h,{allowDecimals:!1,dataKey:e,label:{value:c("activities:".concat(e)),offset:0,position:"bottom"},scale:t,interval:l,tickFormatter:function(e){return o?e:Object(_.a)(e,"HH:mm:ss")},type:"number"}),i.a.createElement(Ue.i,{label:{value:"".concat(c("activities:speed")," (km/h)"),angle:-90,position:"left"},yAxisId:"left"}),i.a.createElement(Ue.i,{label:{value:"".concat(c("activities:elevation")," (m)"),angle:-90,position:"right"},yAxisId:"right",orientation:"right"}),this.displayData("elevation")&&i.a.createElement(Ue.a,{yAxisId:"right",type:"linear",dataKey:"elevation",name:c("activities:elevation"),fill:"#e5e5e5",stroke:"#cccccc",dot:!1,unit:" m"}),this.displayData("speed")&&i.a.createElement(Ue.e,{yAxisId:"left",type:"linear",dataKey:"speed",name:c("activities:speed"),stroke:"#8884d8",strokeWidth:2,dot:!1,unit:" km/h"}),i.a.createElement(Ue.g,{labelFormatter:function(e){return o?"".concat(c("activities:distance"),": ").concat(e," km"):"".concat(c("activities:duration"),": ").concat(Object(_.a)(e,"HH:mm:ss"))}})))),i.a.createElement("div",{className:"chart-info"},c("activities:data from gpx, without any cleaning"))):c("activities:No data to display"))}}]),a}(i.a.Component),qe=Object(N.c)((function(e){return{chartData:e.chartData}}),(function(e){return{loadActivityData:function(t){e(function(e){return function(t){if(e)return U.getData("activities/".concat(e,"/chart_data")).then((function(e){"success"===e.status?t(Ce(be(e.data.chart_data))):t(V("activities|".concat(e.message)))})).catch((function(e){return t(V("activities|".concat(e)))}));t(Ce(null))}}(t))},loadSegmentData:function(t,a){e(function(e,t){return function(a){if(e)return U.getData("activities/".concat(e,"/chart_data/segment/").concat(t)).then((function(e){"success"===e.status?a(Ce(be(e.data.chart_data))):a(V("activities|".concat(e.message)))})).catch((function(e){return a(V("activities|".concat(e)))}));a(Ce(null))}}(t,a))}}}))(He);function Ve(e){var t=e.activity,a=e.t;return i.a.createElement("div",{className:"container"},t.weather_start&&t.weather_end&&i.a.createElement("table",{className:"table table-borderless weather-table text-center"},i.a.createElement("thead",null,i.a.createElement("tr",null,i.a.createElement("th",null),i.a.createElement("th",null,a("activities:Start"),i.a.createElement("br",null),i.a.createElement("img",{className:"weather-img",src:"/img/weather/".concat(t.weather_start.icon,".png"),alt:"activity weather (".concat(t.weather_start.icon,")"),title:t.weather_start.summary})),i.a.createElement("th",null,a("activities:End"),i.a.createElement("br",null),i.a.createElement("img",{className:"weather-img",src:"/img/weather/".concat(t.weather_end.icon,".png"),alt:"activity weather (".concat(t.weather_end.icon,")"),title:t.weather_end.summary})))),i.a.createElement("tbody",null,i.a.createElement("tr",null,i.a.createElement("td",null,i.a.createElement("img",{className:"weather-img-small",src:"/img/weather/temperature.png",alt:"Temperatures"})),i.a.createElement("td",null,Number(t.weather_start.temperature).toFixed(1),"\xb0C"),i.a.createElement("td",null,Number(t.weather_end.temperature).toFixed(1),"\xb0C")),i.a.createElement("tr",null,i.a.createElement("td",null,i.a.createElement("img",{className:"weather-img-small",src:"/img/weather/pour-rain.png",alt:"Temperatures"})),i.a.createElement("td",null,Number(100*t.weather_start.humidity).toFixed(1),"%"),i.a.createElement("td",null,Number(100*t.weather_end.humidity).toFixed(1),"%")),i.a.createElement("tr",null,i.a.createElement("td",null,i.a.createElement("img",{className:"weather-img-small",src:"/img/weather/breeze.png",alt:"Temperatures"})),i.a.createElement("td",null,Number(t.weather_start.wind).toFixed(1),"m/s"),i.a.createElement("td",null,Number(t.weather_end.wind).toFixed(1),"m/s")))))}function Be(e){var t=e.activity,a=e.t,n="0:00:00"!==t.pauses&&null!==t.pauses;return i.a.createElement("div",{className:"activity-details"},i.a.createElement("p",null,i.a.createElement("i",{className:"fa fa-clock-o custom-fa","aria-hidden":"true"}),a("activities:Duration"),": ",t.moving,t.records&&t.records.find((function(e){return"LD"===e.record_type}))&&i.a.createElement("sup",null,i.a.createElement("i",{className:"fa fa-trophy custom-fa","aria-hidden":"true"})),n&&i.a.createElement("span",null,i.a.createElement("br",null),"(",a("activities:pauses"),": ",t.pauses,","," ",a("activities:total duration"),": ",t.duration,")")),i.a.createElement("p",null,i.a.createElement("i",{className:"fa fa-road custom-fa","aria-hidden":"true"}),a("activities:Distance"),": ",t.distance," km",t.records&&t.records.find((function(e){return"FD"===e.record_type}))&&i.a.createElement("sup",null,i.a.createElement("i",{className:"fa fa-trophy custom-fa","aria-hidden":"true"}))),i.a.createElement("p",null,i.a.createElement("i",{className:"fa fa-tachometer custom-fa","aria-hidden":"true"}),a("activities:Average speed"),": ",t.ave_speed," km/h",t.records&&t.records.find((function(e){return"AS"===e.record_type}))&&i.a.createElement("sup",null,i.a.createElement("i",{className:"fa fa-trophy custom-fa","aria-hidden":"true"})),i.a.createElement("br",null),a("activities:Max. speed"),": ",t.max_speed," km/h",t.records&&t.records.find((function(e){return"MS"===e.record_type}))&&i.a.createElement("sup",null,i.a.createElement("i",{className:"fa fa-trophy custom-fa","aria-hidden":"true"}))),t.min_alt&&t.max_alt&&i.a.createElement("p",null,i.a.createElement("i",{className:"fi-mountains custom-fa"}),a("activities:Min. altitude"),": ",t.min_alt,"m",i.a.createElement("br",null),a("activities:Max. altitude"),": ",t.max_alt,"m"),t.ascent&&t.descent&&i.a.createElement("p",null,i.a.createElement("i",{className:"fa fa-location-arrow custom-fa"}),a("activities:Ascent"),": ",t.ascent,"m",i.a.createElement("br",null),a("activities:Descent"),": ",t.descent,"m"),i.a.createElement(Ve,{activity:t,t:a}))}var Ge=a(231),We=a.n(Ge),Je=a(482),Ye=a(486),Ke=a(483),Xe=a(466),$e=function(e){Object(y.a)(a,e);var t=Object(b.a)(a);function a(e,n){var r;return Object(g.a)(this,a),(r=t.call(this,e,n)).state={zoom:13},r}return Object(E.a)(a,[{key:"componentDidMount",value:function(){"activity"===this.props.dataType?this.props.loadActivityGpx(this.props.activity.id):this.props.loadSegmentGpx(this.props.activity.id,this.props.segmentId)}},{key:"componentDidUpdate",value:function(e){("activity"===this.props.dataType&&e.activity.id!==this.props.activity.id||"activity"===this.props.dataType&&"segment"===e.dataType)&&this.props.loadActivityGpx(this.props.activity.id),"segment"===this.props.dataType&&e.segmentId!==this.props.segmentId&&this.props.loadSegmentGpx(this.props.activity.id,this.props.segmentId)}},{key:"componentWillUnmount",value:function(){this.props.loadActivityGpx(null)}},{key:"render",value:function(){var e=this.props,t=e.activity,a=e.coordinates,n=e.gpxContent,r=e.mapAttribution,c=function(e){var t;if(e){var a=(new DOMParser).parseFromString(e,"text/xml");t=fe.a.gpx(a)}return{jsonData:t}}(n).jsonData,s=[[t.bounds[0],t.bounds[1]],[t.bounds[2],t.bounds[3]]];return i.a.createElement("div",null,c&&i.a.createElement(Je.a,{zoom:this.state.zoom,bounds:s,boundsOptions:{padding:[10,10]}},i.a.createElement(Ye.a,{attribution:r,url:"".concat("/api/","activities/map_tile/{s}/{z}/{x}/{y}.png")}),i.a.createElement(Ke.a,{key:We()(c),data:c}),a.latitude&&i.a.createElement(Xe.a,{position:[a.latitude,a.longitude]})))}}]),a}(i.a.Component),Ze=Object(N.c)((function(e){return{gpxContent:e.gpx,mapAttribution:e.application.config.map_attribution}}),(function(e){return{loadActivityGpx:function(t){e(function(e){return function(t){if(e)return U.getData("activities/".concat(e,"/gpx")).then((function(e){"success"===e.status?t(Ae(e.data.gpx)):t(V("activities|".concat(e.message)))})).catch((function(e){return t(V("activities|".concat(e)))}));t(Ae(null))}}(t))},loadSegmentGpx:function(t,a){e(function(e,t){return function(a){if(e)return U.getData("activities/".concat(e,"/gpx/segment/").concat(t)).then((function(e){"success"===e.status?a(Ae(e.data.gpx)):a(V("activities|".concat(e.message)))})).catch((function(e){return a(V("activities|".concat(e)))}));a(Ae(null))}}(t,a))}}}))($e);function Qe(e){var t=e.t;return i.a.createElement("div",{className:"activity-no-map text-center"},t("activities:No Map"))}function et(e){var t=e.notes,a=e.t;return i.a.createElement("div",{className:"row"},i.a.createElement("div",{className:"col"},i.a.createElement("div",{className:"card activity-card"},i.a.createElement("div",{className:"card-body"},"Notes",i.a.createElement("div",{className:"activity-notes"},t||a("activities:No notes"))))))}function tt(e){var t=e.segments,a=e.t;return i.a.createElement("div",{className:"row"},i.a.createElement("div",{className:"col"},i.a.createElement("div",{className:"card activity-card"},i.a.createElement("div",{className:"card-body"},a("activities:Segments"),i.a.createElement("div",{className:"activity-segments"},i.a.createElement("ul",null,t.map((function(e,t){return i.a.createElement("li",{className:"activity-segments-list",key:"segment-".concat(t)},i.a.createElement(Q.a,{to:"/activities/".concat(e.activity_id,"/segment/").concat(t+1)},a("activities:segment")," ",t+1)," ","(",a("activities:distance"),": ",e.distance," km,"," ",a("activities:duration"),": ",e.duration,")")}))))))))}function at(e){var t=Object(oe.a)().t;return i.a.createElement("div",{className:"custom-modal-backdrop"},i.a.createElement("div",{className:"custom-modal"},i.a.createElement("div",{className:"modal-content"},i.a.createElement("div",{className:"modal-header"},i.a.createElement("h5",{className:"modal-title"},e.title),i.a.createElement("button",{type:"button",className:"close","aria-label":"Close",onClick:function(){return e.close()}},i.a.createElement("span",{"aria-hidden":"true"},"\xd7"))),i.a.createElement("div",{className:"modal-body"},i.a.createElement("p",null,e.text)),i.a.createElement("div",{className:"modal-footer"},i.a.createElement("button",{type:"button",className:"btn btn-primary",onClick:function(){return e.confirm()}},t("common:Yes")),i.a.createElement("button",{type:"button",className:"btn btn-secondary",onClick:function(){return e.close()}},t("common:No"))))))}var nt=function(e){Object(y.a)(a,e);var t=Object(b.a)(a);function a(e,n){var r;return Object(g.a)(this,a),(r=t.call(this,e,n)).state={displayModal:!1,coordinates:{latitude:null,longitude:null}},r}return Object(E.a)(a,[{key:"componentDidMount",value:function(){this.props.loadActivity(this.props.match.params.activityId)}},{key:"componentDidUpdate",value:function(e){e.match.params.activityId!==this.props.match.params.activityId&&this.props.loadActivity(this.props.match.params.activityId)}},{key:"displayModal",value:function(e){this.setState((function(t){return Object(j.a)(Object(j.a)({},t),{},{displayModal:e})}))}},{key:"updateCoordinates",value:function(e){var t=e&&e.length>0?{latitude:e[0].payload.latitude,longitude:e[0].payload.longitude}:{latitude:null,longitude:null};this.setState((function(e){return Object(j.a)(Object(j.a)({},e),{},{coordinates:t})}))}},{key:"render",value:function(){var e=this,t=this.props,a=t.activities,n=t.message,r=t.onDeleteActivity,c=t.sports,s=t.t,o=t.user,l=this.state,m=l.coordinates,u=l.displayModal,d=Object(de.a)(a,1)[0],p=d?d.title:s("activities:Activity"),v=d?c.filter((function(e){return e.id===d.sport_id})):[],f=Object(de.a)(v,1)[0],h=parseInt(this.props.match.params.segmentId),g=h>=0?"segment":"activity";return i.a.createElement("div",{className:"activity-page"},i.a.createElement(w.a,null,i.a.createElement("title",null,"FitTrackee - ",p)),n?i.a.createElement(x,{message:n,t:s}):i.a.createElement("div",{className:"container"},u&&i.a.createElement(at,{title:s("common:Confirmation"),text:s("activities:Are you sure you want to delete this activity?"),confirm:function(){r(d.id),e.displayModal(!1)},close:function(){return e.displayModal(!1)}}),d&&f&&1===a.length&&i.a.createElement("div",null,i.a.createElement("div",{className:"row"},i.a.createElement("div",{className:"col"},i.a.createElement("div",{className:"card activity-card"},i.a.createElement("div",{className:"card-header"},i.a.createElement(Ie,{activity:d,dataType:g,segmentId:h,sport:f,t:s,title:p,user:o,displayModal:function(){return e.displayModal(!0)}})),i.a.createElement("div",{className:"card-body"},i.a.createElement("div",{className:"row"},i.a.createElement("div",{className:"col-md-8"},d.with_gpx?i.a.createElement(Ze,{activity:d,coordinates:m,dataType:g,segmentId:h}):i.a.createElement(Qe,{t:s})),i.a.createElement("div",{className:"col"},i.a.createElement(Be,{activity:"activity"===g?d:d.segments[h-1],t:s}))))))),d.with_gpx&&i.a.createElement("div",{className:"row"},i.a.createElement("div",{className:"col"},i.a.createElement("div",{className:"card activity-card"},i.a.createElement("div",{className:"card-body"},i.a.createElement("div",{className:"row"},i.a.createElement("div",{className:"col"},i.a.createElement("div",{className:"chart-title"},s("activities:Chart")),i.a.createElement(qe,{activity:d,dataType:g,segmentId:h,t:s,updateCoordinates:function(t){return e.updateCoordinates(t)}}))))))),"activity"===g&&i.a.createElement(i.a.Fragment,null,i.a.createElement(et,{notes:d.notes,t:s}),d.segments.length>1&&i.a.createElement(tt,{segments:d.segments,t:s})))))}}]),a}(i.a.Component),rt=Object(k.a)()(Object(N.c)((function(e){return{activities:e.activities.data,message:e.message,sports:e.sports.data,user:e.user}}),(function(e){return{loadActivity:function(t){e(J("getData","activities",{id:t}))},onDeleteActivity:function(t){var a;e((a=t,function(e){return U.deleteData("activities",a).then((function(t){var n;204===t.status?Promise.resolve(e((n=a,{type:"REMOVE_ACTIVITY",activityId:n}))).then((function(){return e(je())})).then((function(){return Ln.push("/")})):e(V("activities|".concat(t.status)))})).catch((function(t){return e(V("activities|".concat(t)))}))}))}}}))(nt)),it=function(e){Object(y.a)(a,e);var t=Object(b.a)(a);function a(){return Object(g.a)(this,a),t.apply(this,arguments)}return Object(E.a)(a,[{key:"componentDidMount",value:function(){this.props.loadActivity(this.props.match.params.activityId)}},{key:"render",value:function(){var e=this.props,t=e.activities,a=e.message,n=e.sports,r=Object(de.a)(t,1)[0];return i.a.createElement("div",null,n.length>0&&i.a.createElement(Re,{activity:r,message:a,sports:n}))}}]),a}(i.a.Component),ct=Object(N.c)((function(e){return{activities:e.activities.data,message:e.message,sports:e.sports.data,user:e.user}}),(function(e){return{loadActivity:function(t){e(J("getData","activities",{id:t}))}}}))(it);var st=Object(N.c)((function(e){return{user:e.user}}))((function(){return i.a.createElement("div",null,P()?i.a.createElement(O.d,null,i.a.createElement(O.b,{exact:!0,path:"/activities/add",component:Le}),i.a.createElement(O.b,{exact:!0,path:"/activities/:activityId",component:rt}),i.a.createElement(O.b,{exact:!0,path:"/activities/:activityId/edit",component:ct}),i.a.createElement(O.b,{path:"/activities/:activityId/segment/:segmentId",component:rt}),i.a.createElement(O.b,{component:le})):i.a.createElement(O.a,{to:"/login"}))})),ot=function(e){Object(y.a)(a,e);var t=Object(b.a)(a);function a(){return Object(g.a)(this,a),t.apply(this,arguments)}return Object(E.a)(a,[{key:"render",value:function(){var e=this.props,t=e.loadActivities,a=e.sports,n=e.t,r=e.updateParams,c=Oe(a,n);return i.a.createElement("div",{className:"card"},i.a.createElement("div",{className:"card-body activity-filter"},i.a.createElement("form",{onSubmit:function(e){return e.preventDefault()}},i.a.createElement("div",{className:"form-group"},i.a.createElement("label",null,n("activities:From"),":",i.a.createElement("input",{className:"form-control col-md",name:"from",onChange:function(e){return r(e)},type:"date"})),i.a.createElement("label",null,n("activities:To"),":",i.a.createElement("input",{className:"form-control col-md",name:"to",onChange:function(e){return r(e)},type:"date"}))),i.a.createElement("div",{className:"form-group"},i.a.createElement("label",null,n("common:Sport"),":",i.a.createElement("select",{className:"form-control input-lg",name:"sport_id",onChange:function(e){return r(e)}},i.a.createElement("option",{value:""}),c.map((function(e){return i.a.createElement("option",{key:e.id,value:e.id},e.label)}))))),i.a.createElement("div",{className:"form-group"},i.a.createElement("label",null,n("activities:Distance")," (km):",i.a.createElement("div",{className:"container"},i.a.createElement("div",{className:"row"},i.a.createElement("div",{className:"col-5"},i.a.createElement("input",{className:"form-control",min:0,name:"distance_from",onChange:function(e){return r(e)},step:"1",type:"number"})),i.a.createElement("div",{className:"col-2 align-middle text-center"},n("common:to")),i.a.createElement("div",{className:"col-5"},i.a.createElement("input",{className:"form-control",min:0,name:"distance_to",onChange:function(e){return r(e)},step:"1",type:"number"})))))),i.a.createElement("div",{className:"form-group"},i.a.createElement("label",null,n("activities:Duration"),":",i.a.createElement("div",{className:"container"},i.a.createElement("div",{className:"row"},i.a.createElement("div",{className:"col-5"},i.a.createElement("input",{className:"form-control",name:"duration_from",onChange:function(e){return r(e)},pattern:"^([0-9]*[0-9]):([0-5][0-9])$",placeholder:"hh:mm",type:"text"})),i.a.createElement("div",{className:"col-2 align-middle text-center"},n("common:to")),i.a.createElement("div",{className:"col-5"},i.a.createElement("input",{className:"form-control",name:"duration_to",onChange:function(e){return r(e)},pattern:"^([0-9]*[0-9]):([0-5][0-9])$",placeholder:"hh:mm",type:"text"})))))),i.a.createElement("div",{className:"form-group"},i.a.createElement("label",null,n("activities:Average speed")," (km/h):",i.a.createElement("div",{className:"container"},i.a.createElement("div",{className:"row"},i.a.createElement("div",{className:"col-5"},i.a.createElement("input",{className:"form-control",min:0,name:"ave_speed_from",onChange:function(e){return r(e)},step:"1",type:"number"})),i.a.createElement("div",{className:"col-2 align-middle text-center"},n("common:to")),i.a.createElement("div",{className:"col-5"},i.a.createElement("input",{className:"form-control",min:0,name:"ave_speed_to",onChange:function(e){return r(e)},step:"1",type:"number"})))))),i.a.createElement("div",{className:"form-group"},i.a.createElement("label",null,n("activities:Max. speed")," (km/h):",i.a.createElement("div",{className:"container"},i.a.createElement("div",{className:"row"},i.a.createElement("div",{className:"col-5"},i.a.createElement("input",{className:"form-control",min:0,name:"max_speed_from",onChange:function(e){return r(e)},step:"1",type:"number"})),i.a.createElement("div",{className:"col-2 align-middle text-center"},n("common:to")),i.a.createElement("div",{className:"col-5"},i.a.createElement("input",{className:"form-control",min:0,name:"max_speed_to",onChange:function(e){return r(e)},step:"1",type:"number"})))))),i.a.createElement("input",{className:"btn btn-primary btn-lg btn-block",onClick:function(){return t()},type:"submit",value:n("activities:Filter")}))))}}]),a}(i.a.PureComponent),lt=function(e){Object(y.a)(a,e);var t=Object(b.a)(a);function a(){return Object(g.a)(this,a),t.apply(this,arguments)}return Object(E.a)(a,[{key:"render",value:function(){var e=this.props,t=e.activity,a=e.display;return i.a.createElement("div",{className:"activity-map".concat("list"===a?"-list":"")},i.a.createElement("img",{src:"".concat("/api/","activities/map/").concat(t.map,"?").concat(Date.now()),alt:"activity map"}),i.a.createElement("div",{className:"map-attribution".concat("list"===a?"-list":"")},i.a.createElement("span",{className:"map-attribution-text"},"\xa9"),i.a.createElement("a",{className:"map-attribution-text",href:"http://www.openstreetmap.org/copyright",target:"_blank",rel:"noopener noreferrer"},"OpenStreetMap")))}}]),a}(i.a.PureComponent),mt=function(e){Object(y.a)(a,e);var t=Object(b.a)(a);function a(){return Object(g.a)(this,a),t.apply(this,arguments)}return Object(E.a)(a,[{key:"render",value:function(){var e=this.props,t=e.activities,a=e.loading,n=e.sports,r=e.t,c=e.user;return i.a.createElement("div",{className:"card activity-card"},i.a.createElement("div",{className:"card-body"},i.a.createElement("table",{className:"table"},i.a.createElement("thead",null,i.a.createElement("tr",null,i.a.createElement("th",{scope:"col"}),i.a.createElement("th",{scope:"col"},r("common:Workout")),i.a.createElement("th",{scope:"col"},r("activities:Date")),i.a.createElement("th",{scope:"col"},r("activities:Distance")),i.a.createElement("th",{scope:"col"},r("activities:Duration")),i.a.createElement("th",{scope:"col"},r("activities:Ave. speed")),i.a.createElement("th",{scope:"col"},r("activities:Max. speed")))),i.a.createElement("tbody",null,!a&&n&&t.map((function(e,t){return i.a.createElement("tr",{key:t},i.a.createElement("td",null,i.a.createElement("span",{className:"heading-span-absolute"},r("common:Sport")),i.a.createElement("img",{className:"activity-sport",src:n.filter((function(t){return t.id===e.sport_id})).map((function(e){return e.img})),alt:"activity sport logo"})),i.a.createElement("td",{className:"activity-title"},i.a.createElement("span",{className:"heading-span-absolute"},r("common:Workout")),i.a.createElement(Q.a,{to:"/activities/".concat(e.id)},e.title),e.map&&i.a.createElement(lt,{activity:e,display:"list"})),i.a.createElement("td",null,i.a.createElement("span",{className:"heading-span-absolute"},r("activities:Date")),Object(_.a)(z(e.activity_date,c.timezone),"dd/MM/yyyy HH:mm")),i.a.createElement("td",{className:"text-right"},i.a.createElement("span",{className:"heading-span-absolute"},r("activities:Distance")),Number(e.distance).toFixed(2)," km"),i.a.createElement("td",{className:"text-right"},i.a.createElement("span",{className:"heading-span-absolute"},r("activities:Duration")),e.moving),i.a.createElement("td",{className:"text-right"},i.a.createElement("span",{className:"heading-span-absolute"},r("activities:Ave. speed")),e.ave_speed," km/h"),i.a.createElement("td",{className:"text-right"},i.a.createElement("span",{className:"heading-span-absolute"},r("activities:Max. speed")),e.max_speed," km/h"))})))),a&&i.a.createElement("div",{className:"loader"})))}}]),a}(i.a.PureComponent),ut=function(e){Object(y.a)(a,e);var t=Object(b.a)(a);function a(){return Object(g.a)(this,a),t.apply(this,arguments)}return Object(E.a)(a,[{key:"render",value:function(){var e=this.props.t;return i.a.createElement("div",{className:"card text-center"},i.a.createElement("div",{className:"card-body"},e("common:No workouts.")," ",i.a.createElement(Q.a,{to:{pathname:"/activities/add"}},e("dashboard:Upload one !"))))}}]),a}(i.a.PureComponent),dt=function(e){Object(y.a)(a,e);var t=Object(b.a)(a);function a(e,n){var r;return Object(g.a)(this,a),(r=t.call(this,e,n)).state={params:{page:1,per_page:10}},r}return Object(E.a)(a,[{key:"componentDidMount",value:function(){this.props.loadActivities(this.state.params)}},{key:"setParams",value:function(e){var t=this.state.params;""===e.target.value?delete t[e.target.name]:t[e.target.name]=e.target.value,t.page=1,this.setState(t)}},{key:"render",value:function(){var e=this,t=this.props,a=t.activities,n=t.loading,r=t.loadActivities,c=t.loadMoreActivities,s=t.message,o=t.sports,l=t.t,m=t.user,u=this.state.params,d=!(a.length>0)||null===a[a.length-1].previous_activity;return i.a.createElement("div",null,i.a.createElement(w.a,null,i.a.createElement("title",null,"FitTrackee - ",l("common:Workouts"))),s?i.a.createElement(x,{message:s,t:l}):i.a.createElement("div",{className:"container history"},i.a.createElement("div",{className:"row"},i.a.createElement("div",{className:"col-md-3"},i.a.createElement(ot,{sports:o,loadActivities:function(){return r(u)},t:l,updateParams:function(t){return e.setParams(t)}})),i.a.createElement("div",{className:"col-md-9 activities-result"},i.a.createElement(mt,{activities:a,loading:n,sports:o,t:l,user:m}),!d&&i.a.createElement("input",{type:"submit",className:"btn btn-default btn-md btn-block",value:"Load more activities",onClick:function(){u.page+=1,c(u),e.setState(u)}}),0===a.length&&i.a.createElement(ut,{t:l})))))}}]),a}(i.a.Component),pt=Object(k.a)()(Object(N.c)((function(e){return{activities:e.activities.data,loading:e.loading,message:e.message,sports:e.sports.data,user:e.user}}),(function(e){return{loadActivities:function(t){e(J("getData","activities",t))},loadMoreActivities:function(t){e(Te(t))}}}))(dt));var vt=Object(k.a)()(Object(N.c)((function(e){return{appConfig:e.application.config,pathname:e.router.location.pathname,message:e.message}}),(function(e){return{onDeletePicture:function(){e((function(e){return we.deletePicture().then((function(t){return 204===t.status?e(_e()):e(ke(t.message))})).catch((function(e){throw e}))}))},onUploadPicture:function(t){e(function(e){return function(t){e.preventDefault();var a=new FormData;return a.append("file",e.target.picture.files[0]),e.target.reset(),U.addDataWithFile("auth/picture",a).then((function(e){if("success"===e.status)return t(_e());var a=e.message.match(/file size exceeds/g)?"Error during picture update, file size exceeds max size.":e.message;return t(ke(a))})).catch((function(e){throw e}))}}(t))}}}))((function(e){var t=e.appConfig,a=e.displayModal,n=e.editable,r=e.isDeletable,c=e.message,s=e.onDeletePicture,o=e.onUploadPicture,l=e.pathname,m=e.t,u=e.user,d=u.created_at?Object(_.a)(new Date(u.created_at),"dd/MM/yyyy HH:mm"):"",p=u.birth_date?Object(_.a)(new Date(u.birth_date),"dd/MM/yyyy"):"",v=C(t.max_single_file_size);return i.a.createElement("div",null,i.a.createElement(w.a,null,i.a.createElement("title",null,"FitTrackee - ",m("user:Profile"))),i.a.createElement(x,{message:c,t:m}),i.a.createElement("div",{className:"container"},i.a.createElement("h1",{className:"page-title"},m("user:Profile")),i.a.createElement("div",{className:"row"},i.a.createElement("div",{className:"col-md-12"},i.a.createElement("div",{className:"card"},i.a.createElement("div",{className:"card-header userName"},i.a.createElement("strong",null,u.username)),i.a.createElement("div",{className:"card-body"},i.a.createElement("div",{className:"row"},i.a.createElement("div",{className:"col-md-8"},i.a.createElement("p",null,i.a.createElement("span",{className:"user-label"},m("user:Email")),": ",u.email),i.a.createElement("p",null,i.a.createElement("span",{className:"user-label"},m("user:Registration Date")),": ",d),i.a.createElement("p",null,i.a.createElement("span",{className:"user-label"},m("user:First Name")),": ",u.first_name),i.a.createElement("p",null,i.a.createElement("span",{className:"user-label"},m("user:Last Name")),": ",u.last_name),i.a.createElement("p",null,i.a.createElement("span",{className:"user-label"},m("user:Birth Date")),": ",p),i.a.createElement("p",null,i.a.createElement("span",{className:"user-label"},m("user:Location")),": ",u.location),i.a.createElement("p",null,i.a.createElement("span",{className:"user-label"},m("user:Bio")),":"," ",u.bio),i.a.createElement("p",null,i.a.createElement("span",{className:"user-label"},m("user:Language")),": ",u.language),i.a.createElement("p",null,i.a.createElement("span",{className:"user-label"},m("user:Timezone")),": ",u.timezone),i.a.createElement("p",null,i.a.createElement("span",{className:"user-label"},m("user:First day of week")),": ",u.weekm?m("user:Monday"):m("user:Sunday"))),i.a.createElement("div",{className:"col-md-4"},!0===u.picture&&i.a.createElement("div",null,i.a.createElement("img",{alt:"Profile",src:"".concat("/api/","users/").concat(u.username,"/picture")+"?".concat(Date.now()),className:"img-fluid App-profile-img-small"}),n&&i.a.createElement(i.a.Fragment,null,i.a.createElement("br",null),i.a.createElement("button",{type:"submit",onClick:function(){return s()}},m("user:Delete picture")),i.a.createElement("br",null),i.a.createElement("br",null))),n&&i.a.createElement("form",{encType:"multipart/form-data",onSubmit:function(e){return o(e)}},i.a.createElement("input",{type:"file",name:"picture",accept:".png,.jpg,.gif"}),i.a.createElement("br",null),i.a.createElement("button",{type:"submit"},m("user:Send"))," (max. size: ".concat(v,")"))," ")),n&&i.a.createElement("button",{className:"btn btn-primary",onClick:function(){return Ln.push("/profile/edit")}},m("common:Edit")),r&&i.a.createElement("button",{className:"btn btn-danger",onClick:function(){return a(!0)}},m("user:Delete user account")),i.a.createElement("button",{className:"btn btn-secondary",onClick:function(){return"/profile"===l?Ln.push("/"):Ln.go(-1)}},m("/profile"===l?"common:Back to home":"common:Back"))))))))})));var ft=Object(k.a)()(Object(N.c)((function(e){return{user:e.user}}))((function(e){var t=e.t,a=e.user;return i.a.createElement("div",null,i.a.createElement(vt,{editable:!0,t:t,user:a}))})));function ht(e){var t=e.activity,a=e.sports,n=e.t,r=e.user;return i.a.createElement("div",{className:"card activity-card text-center"},i.a.createElement("div",{className:"card-header"},i.a.createElement(Q.a,{to:"/activities/".concat(t.id)},a.filter((function(e){return e.id===t.sport_id})).map((function(e){return n("sports:".concat(e.label))}))," ","-"," ",Object(_.a)(z(t.activity_date,r.timezone),"dd/MM/yyyy HH:mm"))),i.a.createElement("div",{className:"card-body"},i.a.createElement("div",{className:"row"},t.map&&i.a.createElement("div",{className:"col"},i.a.createElement(lt,{activity:t})),i.a.createElement("div",{className:"col"},i.a.createElement("p",null,i.a.createElement("i",{className:"fa fa-clock-o","aria-hidden":"true"})," ",n("activities:Duration"),": ",t.moving,t.map?i.a.createElement("span",null,i.a.createElement("br",null),i.a.createElement("br",null)):" - ",i.a.createElement("i",{className:"fa fa-road","aria-hidden":"true"})," ",n("activities:Distance"),": ",t.distance," km")))))}var gt=a(467),Et=a(468),yt=a(469),bt=a(470),Nt=a(233),Ot=a(237),wt=a(471),kt=a(472),xt=a(109),jt=a(473),_t=a(481),St=a(485);function Dt(e){var t=e.activity,a=e.isDisabled,n=e.isMore,r=e.sportImg;return i.a.createElement(Q.a,{className:"calendar-activity".concat(n),to:"/activities/".concat(t.id)},i.a.createElement(i.a.Fragment,null,i.a.createElement("img",{alt:"activity sport logo",className:"activity-sport ".concat(a),src:r,title:t.title}),t.records.length>0&&i.a.createElement("sup",null,i.a.createElement("i",{className:"fa fa-trophy custom-fa-small","aria-hidden":"true",title:t.records.map((function(e){return" ".concat(ge.filter((function(t){return t.record_type===e.record_type}))[0].label)}))}))))}var At=function(e){Object(y.a)(a,e);var t=Object(b.a)(a);function a(e,n){var r;return Object(g.a)(this,a),(r=t.call(this,e,n)).state={isHidden:!0},r}return Object(E.a)(a,[{key:"handleDisplayMore",value:function(){this.setState({isHidden:!this.state.isHidden})}},{key:"render",value:function(){var e=this,t=this.props,a=t.dayActivities,n=t.isDisabled,r=t.sports,c=this.state.isHidden;return i.a.createElement("div",null,a.map((function(e){return i.a.createElement(Dt,{key:e.id,activity:e,isDisabled:n,isMore:"",sportImg:r.filter((function(t){return t.id===e.sport_id})).map((function(e){return e.img}))})})),a.length>2&&i.a.createElement("i",{className:"fa fa-".concat(c?"plus":"times"," calendar-more"),"aria-hidden":"true",onClick:function(){return e.handleDisplayMore()},title:"show more activities"}),!c&&i.a.createElement("div",{className:"calendar-display-more"},a.map((function(e){return i.a.createElement(Dt,{key:e.id,activity:e,isDisabled:n,isMore:"-more",sportImg:r.filter((function(t){return t.id===e.sport_id})).map((function(e){return e.img}))})}))))}}]),a}(i.a.Component),Ct=function(e,t){var a=Object(gt.a)(e),n=Object(Et.a)(e),r=t?1:0;return{start:Object(yt.a)(a,{weekStartsOn:r}),end:Object(bt.a)(n)}},Mt=function(e){Object(y.a)(a,e);var t=Object(b.a)(a);function a(e,n){var r;Object(g.a)(this,a),r=t.call(this,e,n);var i=new Date;return r.state={currentMonth:i,startDate:Ct(i,e.weekm).start,endDate:Ct(i,e.weekm).end,weekStartOnMonday:e.weekm},r}return Object(E.a)(a,[{key:"componentDidMount",value:function(){this.props.loadMonthActivities(this.state.startDate,this.state.endDate)}},{key:"renderHeader",value:function(e){var t=this;return i.a.createElement("div",{className:"header row flex-middle"},i.a.createElement("div",{className:"col col-start",onClick:function(){return t.handlePrevMonth()}},i.a.createElement("i",{className:"fa fa-chevron-left","aria-hidden":"true"})),i.a.createElement("div",{className:"col col-center"},i.a.createElement("span",null,Object(_.a)(this.state.currentMonth,"MMM yyyy",e))),i.a.createElement("div",{className:"col col-end",onClick:function(){return t.handleNextMonth()}},i.a.createElement("i",{className:"fa fa-chevron-right","aria-hidden":"true"})))}},{key:"renderDays",value:function(e){for(var t=[],a=this.state.startDate,n=0;n<7;n++)t.push(i.a.createElement("div",{className:"col col-center",key:n},Object(_.a)(Object(Nt.a)(a,n),"EEE",e)));return i.a.createElement("div",{className:"days row"},t)}},{key:"filterActivities",value:function(e){var t=this.props,a=t.activities,n=t.user;return a?a.filter((function(t){return Object(Ot.a)(z(t.activity_date,n.timezone),e)})):[]}},{key:"renderCells",value:function(){for(var e=this.state,t=e.currentMonth,a=e.startDate,n=e.endDate,r=e.weekStartOnMonday,c=this.props.sports,s=[],o=[],l=a,m="";l<=n;){for(var u=0;u<7;u++){m=Object(_.a)(l,"d");var d=this.filterActivities(l),p=Object(wt.a)(l,t)?"":"-disabled",v=r?[5,6].includes(u):[0,6].includes(u);o.push(i.a.createElement("div",{className:"col cell ".concat(v?" weekend":"").concat(Object(kt.a)(l)?" today":""),key:l},i.a.createElement("div",{className:"img".concat(p)},i.a.createElement("span",{className:"number"},m),i.a.createElement(At,{dayActivities:d,isDisabled:p,sports:c})))),l=Object(Nt.a)(l,1)}s.push(i.a.createElement("div",{className:"row",key:l},o)),o=[]}return i.a.createElement("div",{className:"body"},s)}},{key:"updateStateDate",value:function(e){var t=Ct(e,this.state.weekStartOnMonday),a=t.start,n=t.end;this.setState({currentMonth:e,startDate:a,endDate:n}),this.props.loadMonthActivities(a,n)}},{key:"handleNextMonth",value:function(){var e=Object(xt.a)(this.state.currentMonth,1);this.updateStateDate(e)}},{key:"handlePrevMonth",value:function(){var e=Object(jt.a)(this.state.currentMonth,1);this.updateStateDate(e)}},{key:"render",value:function(){var e={locale:"fr"===this.props.language?_t.a:St.a};return i.a.createElement("div",{className:"card activity-card"},i.a.createElement("div",{className:"calendar"},this.renderHeader(e),this.renderDays(e),this.renderCells()))}}]),a}(i.a.Component),Tt=Object(N.c)((function(e){return{activities:e.calendarActivities.data,language:e.language,sports:e.sports.data,user:e.user}}),(function(e){return{loadMonthActivities:function(t,a){var n,r;e((n=Object(_.a)(t,"yyyy-MM-dd"),r=Object(_.a)(a,"yyyy-MM-dd"),function(e){return U.getData("activities",{from:n,to:r,order:"asc",per_page:100}).then((function(t){"success"===t.status?e({type:"UPDATE_CALENDAR",activities:t.data.activities}):e(V("activities|".concat(t.message)))})).catch((function(t){return e(V("activities|".concat(t)))}))}))}}}))(Mt);function Pt(e){var t=e.records,a=e.sports,n=e.t,r=e.user,c=Oe(a,n),s=t.reduce((function(e,t){var a=c.find((function(e){return e.id===t.sport_id}));return void 0===e[a.label]&&(e[a.label]={img:a.img,records:[]}),e[a.label].records.push(function(e,t){var a;switch(e.record_type){case"AS":case"MS":a="".concat(e.value," km/h");break;case"FD":a="".concat(e.value," km");break;default:a=e.value}var n=ge.filter((function(t){return t.record_type===e.record_type})),r=Object(de.a)(n,1)[0];return{activity_date:Ee(z(e.activity_date,t)).activity_date,activity_id:e.activity_id,id:e.id,record_type:r.label,value:a}}(t,r.timezone)),e}),{});return i.a.createElement("div",{className:"card activity-card"},i.a.createElement("div",{className:"card-header"},n("activities:Personal records")),i.a.createElement("div",{className:"card-body"},0===Object.keys(s).length?n("common:No records."):Object.keys(s).sort().map((function(e){return i.a.createElement("div",{key:e},i.a.createElement("span",{className:"heading-span"},i.a.createElement("img",{alt:"".concat(e," logo"),className:"record-logo",src:s[e].img}),e),i.a.createElement("table",{className:"table table-borderless table-sm record-table"},i.a.createElement("thead",null,i.a.createElement("tr",null,i.a.createElement("th",{colSpan:"3"},i.a.createElement("img",{alt:"".concat(e," logo"),className:"record-logo",src:s[e].img}),e))),i.a.createElement("tbody",null,s[e].records.map((function(e){return i.a.createElement("tr",{className:"record-tr",key:e.id},i.a.createElement("td",{className:"record-td"},n("activities:".concat(e.record_type))),i.a.createElement("td",{className:"record-td text-right"},e.value),i.a.createElement("td",{className:"record-td text-right"},i.a.createElement(Q.a,{to:"/activities/".concat(e.activity_id)},e.activity_date)))})))))}))))}var Ft=a(234),zt=a(474),Rt=[{duration:"week",dateFormat:"yyyy-MM-dd",xAxis:"dd/MM"},{duration:"month",dateFormat:"yyyy-MM",xAxis:"MM/yyyy"},{duration:"year",dateFormat:"yyyy",xAxis:"yyyy"}],Lt=function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],a="0";t&&(a=String(Math.floor(e/86400)),e%=86400);var n=String(Math.floor(e/3600)).padStart(2,"0");e%=3600;var r=String(Math.floor(e/60)).padStart(2,"0"),i=String(e%60).padStart(2,"0");return t?"".concat("0"===a?"":"".concat(a,"d:")).concat("00"===n?"":"".concat(n,"h:")).concat(r,"m:").concat(i,"s"):"".concat("00"===n?"":"".concat(n,":")).concat(r,":").concat(i)},It=function(e,t){return 0===t?"":"distance"===e?"".concat(t.toFixed(2)," km"):"duration"===e?Lt(t):t},Ut=function(e,t){switch(e){case"week":return Object(Nt.a)(t,7);case"year":return Object(Ft.a)(t,1);case"month":default:return Object(xt.a)(t,1)}},Ht=function(e,t,a,n,r){for(var i=[],c=[],s=[],o=function(r){var o=Rt.filter((function(e){return e.duration===a.duration})),l=Object(de.a)(o,1)[0],m=Object(_.a)(r,l.dateFormat),u=Object(_.a)(r,l.xAxis),d={date:u},p={date:u},v={date:u};e[m]&&Object.keys(e[m]).filter((function(e){return!n||n.includes(+e)})).map((function(a){var n=t.filter((function(e){return e.id===+a}))[0].label;return d[n]=e[m][a].nb_activities,p[n]=e[m][a].total_distance,v[n]=e[m][a].total_duration,null})),i.push(d),c.push(p),s.push(v)},l=function(e,t,a){switch(e){case"week":return Object(yt.a)(t,{weekStartsOn:a?1:0});case"year":return Object(zt.a)(t);case"month":default:return Object(gt.a)(t)}}(a.duration,a.start,r);l<=a.end;l=Ut(a.duration,l))o(l);return{activities:i,distance:c,duration:s}},qt=function(e,t){return"duration"===e?Lt(t,!0):"distance"===e?t.toFixed(2):t};function Vt(e){if(e.active){var t=e.displayedData,a=e.payload,n=e.label,r=0;return a.map((function(e){return r+=e.value})),i.a.createElement("div",{className:"custom-tooltip"},i.a.createElement("p",{className:"custom-tooltip-label"},n),a.map((function(e){return i.a.createElement("p",{key:e.name,style:{color:e.fill}},e.name,": ",qt(t,e.value)," ",e.unit)})),a.length>0&&i.a.createElement("p",null,"Total: ",qt(t,r)))}return null}function Bt(e){var t=e.displayedData,a=e.x,n=e.y,r=e.width,c=e.value;if(!c)return null;var s=It(t,c);return i.a.createElement("g",null,i.a.createElement("text",{x:a+r/2,y:n-10,fill:"#666",fontSize:"11",textAnchor:"middle",dominantBaseline:"middle"},s))}var Gt=function(e){Object(y.a)(a,e);var t=Object(b.a)(a);function a(e,n){var r;return Object(g.a)(this,a),(r=t.call(this,e,n)).state={displayedData:"distance"},r}return Object(E.a)(a,[{key:"handleRadioChange",value:function(e){this.setState({displayedData:e.target.name})}},{key:"render",value:function(){var e=this,t=this.state.displayedData,a=this.props,n=a.sports,r=a.stats,c=a.t;return 0===Object.keys(r).length?c("common:No workouts."):i.a.createElement("div",{className:"chart-stats"},i.a.createElement("div",{className:"row chart-radio"},i.a.createElement("label",{className:"radioLabel col"},i.a.createElement("input",{type:"radio",name:"distance",checked:"distance"===t,onChange:function(t){return e.handleRadioChange(t)}}),c("statistics:distance")),i.a.createElement("label",{className:"radioLabel col"},i.a.createElement("input",{type:"radio",name:"duration",checked:"duration"===t,onChange:function(t){return e.handleRadioChange(t)}}),c("statistics:duration")),i.a.createElement("label",{className:"radioLabel col"},i.a.createElement("input",{type:"radio",name:"activities",checked:"activities"===t,onChange:function(t){return e.handleRadioChange(t)}}),c("statistics:activities"))),i.a.createElement(Ue.f,{height:300},i.a.createElement(Ue.c,{data:r[t],margin:{top:15,bottom:0}},i.a.createElement(Ue.h,{dataKey:"date",interval:0}),i.a.createElement(Ue.i,{tickFormatter:function(e){return It(t,e)}}),i.a.createElement(Ue.g,{content:i.a.createElement(Vt,{displayedData:t})}),n.map((function(e,a){return i.a.createElement(Ue.b,{isAnimationActive:!1,key:e.id,dataKey:e.label,stackId:"a",fill:he[a],label:a===n.length-1?i.a.createElement(Bt,{displayedData:t}):"",name:c("sports:".concat(e.label))})})))))}}]),a}(i.a.PureComponent),Wt=function(e){Object(y.a)(a,e);var t=Object(b.a)(a);function a(){return Object(g.a)(this,a),t.apply(this,arguments)}return Object(E.a)(a,[{key:"componentDidMount",value:function(){this.updateData()}},{key:"componentDidUpdate",value:function(e){(this.props.user.username&&this.props.user.username!==e.user.username||this.props.statsParams!==e.statsParams)&&this.updateData()}},{key:"updateData",value:function(){this.props.user.username&&this.props.loadActivities(this.props.user.username,this.props.user.weekm,this.props.statsParams)}},{key:"render",value:function(){var e=this.props,t=e.displayedSports,a=e.sports,n=e.statistics,r=e.statsParams,c=e.displayEmpty,s=e.t,o=e.user;if(!c&&0===Object.keys(n).length)return i.a.createElement("span",null,s("common:No workouts."));var l=Ht(n,a,r,t,o.weekm);return i.a.createElement(Gt,{sports:a,stats:l,t:s})}}]),a}(i.a.PureComponent),Jt=Object(N.c)((function(e){return{sports:e.sports.data,statistics:e.statistics.data,user:e.user}}),(function(e){return{loadActivities:function(t,a,n){var r="week"===n.duration?"".concat(n.duration).concat(a?"m":""):n.duration,i={from:Object(_.a)(n.start,"yyyy-MM-dd"),to:Object(_.a)(n.end,"yyyy-MM-dd"),time:r};e(function(e,t,a){return function(n){return U.getData("stats/".concat(e,"/").concat(t),a).then((function(e){"success"===e.status?n(H("statistics",e.data)):n(V("statistics|".concat(e.message)))})).catch((function(e){return n(V("statistics|".concat(e)))}))}}(t,n.type,i))}}}))(Wt),Yt=function(e){Object(y.a)(a,e);var t=Object(b.a)(a);function a(e,n){var r;Object(g.a)(this,a),r=t.call(this,e,n);var i=new Date;return r.state={start:Object(gt.a)(i),end:Object(Et.a)(i),duration:"week",type:"by_time"},r}return Object(E.a)(a,[{key:"render",value:function(){var e=this.props.t;return i.a.createElement("div",{className:"card activity-card"},i.a.createElement("div",{className:"card-header"},e("dashboard:This month")),i.a.createElement("div",{className:"card-body"},i.a.createElement(Jt,{displayEmpty:!1,statsParams:this.state,t:e})))}}]),a}(i.a.Component);function Kt(e){var t=e.t,a=e.user,n=a.total_duration.match(/day/g)?"".concat(a.total_duration.split(" ")[0]," ").concat(a.total_duration.match(/days/g)?t("common:days"):t("common:day")):"0 ".concat(t("common:days"),","),r=a.total_duration.match(/day/g)?a.total_duration.split(", ")[1]:a.total_duration;return r="".concat(r.split(":")[0],"h ").concat(r.split(":")[1],"min"),i.a.createElement("div",{className:"row"},i.a.createElement("div",{className:"col-lg-3 col-md-6 col-sm-6"},i.a.createElement("div",{className:"card activity-card"},i.a.createElement("div",{className:"card-body row"},i.a.createElement("div",{className:"col-3"},i.a.createElement("i",{className:"fa fa-calendar fa-3x fa-color"})),i.a.createElement("div",{className:"col-9 text-right"},i.a.createElement("div",{className:"huge"},a.nb_activities),i.a.createElement("div",null,"".concat(1===a.nb_activities?t("common:workout"):t("common:workouts"))))))),i.a.createElement("div",{className:"col-lg-3 col-md-6 col-sm-6"},i.a.createElement("div",{className:"card activity-card"},i.a.createElement("div",{className:"card-body row"},i.a.createElement("div",{className:"col-3"},i.a.createElement("i",{className:"fa fa-road fa-3x fa-color"})),i.a.createElement("div",{className:"col-9 text-right"},i.a.createElement("div",{className:"huge"},Number(a.total_distance).toFixed(2)),i.a.createElement("div",null,"km"))))),i.a.createElement("div",{className:"col-lg-3 col-md-6 col-sm-6"},i.a.createElement("div",{className:"card activity-card"},i.a.createElement("div",{className:"card-body row"},i.a.createElement("div",{className:"col-3"},i.a.createElement("i",{className:"fa fa-clock-o fa-3x fa-color"})),i.a.createElement("div",{className:"col-9 text-right"},i.a.createElement("div",{className:"huge"},n),i.a.createElement("div",null,r))))),i.a.createElement("div",{className:"col-lg-3 col-md-6 col-sm-6"},i.a.createElement("div",{className:"card activity-card"},i.a.createElement("div",{className:"card-body row"},i.a.createElement("div",{className:"col-3"},i.a.createElement("i",{className:"fa fa-tags fa-3x fa-color"})),i.a.createElement("div",{className:"col-9 text-right"},i.a.createElement("div",{className:"huge"},a.nb_sports),i.a.createElement("div",null,"".concat(1===a.nb_sports?t("common:sport"):t("common:sports"))))))))}var Xt=function(e){Object(y.a)(a,e);var t=Object(b.a)(a);function a(e,n){var r;return Object(g.a)(this,a),(r=t.call(this,e,n)).state={page:1},r}return Object(E.a)(a,[{key:"componentDidMount",value:function(){this.props.loadActivities()}},{key:"render",value:function(){var e=this,t=this.props,a=t.activities,n=t.loadMoreActivities,r=t.message,c=t.records,s=t.sports,o=t.t,l=t.user,m=!(a.length>0)||null===a[a.length-1].previous_activity,u=this.state.page;return i.a.createElement("div",null,i.a.createElement(w.a,null,i.a.createElement("title",null,"FitTrackee - ",o("common:Dashboard"))),r?i.a.createElement(x,{message:r,t:o}):a&&l.total_duration&&s.length>0&&i.a.createElement("div",{className:"container dashboard"},i.a.createElement(Kt,{user:l,t:o}),i.a.createElement("div",{className:"row"},i.a.createElement("div",{className:"col-md-4"},i.a.createElement(Yt,{t:o}),i.a.createElement(Pt,{t:o,records:c,sports:s,user:l})),i.a.createElement("div",{className:"col-md-8"},i.a.createElement(Tt,{weekm:l.weekm}),a.length>0?a.map((function(e){return i.a.createElement(ht,{activity:e,key:e.id,sports:s,t:o,user:l})})):i.a.createElement(ut,{t:o}),!m&&i.a.createElement("input",{type:"submit",className:"btn btn-default btn-md btn-block",value:"Load more activities",onClick:function(){n(u+1),e.setState({page:u+1})}})))))}}]),a}(i.a.Component),$t=Object(k.a)()(Object(N.c)((function(e){return{activities:e.activities.data,message:e.message,records:e.records.data,sports:e.sports.data,user:e.user}}),(function(e){return{loadActivities:function(){e(J("getData","activities",{page:1})),e(J("getData","records"))},loadMoreActivities:function(t){e(Te({page:t}))}}}))(Xt));function Zt(){return i.a.createElement("footer",{className:"footer"},i.a.createElement("div",{className:"container"},i.a.createElement("strong",null,"FitTrackee")," v","0.3.0-beta"," -"," ",i.a.createElement("a",{href:"https://github.com/SamR1/FitTrackee",target:"_blank",rel:"noopener noreferrer"},"source code")," ","under"," ",i.a.createElement("a",{href:"https://choosealicense.com/licenses/gpl-3.0/",target:"_blank",rel:"noopener noreferrer"},"GPLv3")," ","license -"," ",i.a.createElement("a",{href:"https://samr1.github.io/FitTrackee/",target:"_blank",rel:"noopener noreferrer"},"documentation")))}var Qt=function(e){Object(y.a)(a,e);var t=Object(b.a)(a);function a(){return Object(g.a)(this,a),t.apply(this,arguments)}return Object(E.a)(a,[{key:"componentDidMount",value:function(){this.props.UserLogout()}},{key:"render",value:function(){return i.a.createElement("div",{className:"container dashboard"},i.a.createElement("div",{className:"row"},i.a.createElement("div",{className:"col-2"}),i.a.createElement("div",{className:"card col-8"},i.a.createElement("div",{className:"card-body"},i.a.createElement("div",{className:"text-center"},i.a.createElement(ue.a,{i18nKey:"user:loggedOut"},"You are now logged out. Click ",i.a.createElement(Q.a,{to:"/login"},"here")," to log back in.")))),i.a.createElement("div",{className:"col-2"})))}}]),a}(i.a.Component),ea=Object(N.c)((function(e){return{user:e.user}}),(function(e){return{UserLogout:function(){e({type:"LOGOUT"})}}}))(Qt);function ta(){return(ta=Object.assign||function(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var na=i.a.createElement("path",{d:"m466.916 27.803h-421.832c-24.859 0-45.084 20.225-45.084 45.084v366.226c0 24.859 20.225 45.084 45.084 45.084h421.832c24.859 0 45.084-20.225 45.084-45.084v-366.226c0-24.859-20.225-45.084-45.084-45.084z",fill:"#f0f9ff"}),ra=i.a.createElement("path",{d:"m198.58 188.334-181.344-150.862c-7.75 6.107-13.456 14.691-15.905 24.554l164.142 136.551h33.102z",fill:"#f40055"}),ia=i.a.createElement("path",{d:"m313.425 198.576h33.93l163.447-135.973c-2.325-9.923-7.93-18.592-15.613-24.796l-181.764 151.211z",fill:"#c20044"}),ca=i.a.createElement("path",{d:"m165.472 313.425-164.141 136.549c2.449 9.863 8.155 18.447 15.905 24.553l181.344-150.861-.005-10.241z",fill:"#f40055"}),sa=i.a.createElement("path",{d:"m313.425 313.425v9.557l181.765 151.211c7.683-6.204 13.288-14.874 15.613-24.796l-163.446-135.971z",fill:"#c20044"}),oa=i.a.createElement("path",{d:"m53.273 27.803 145.302 120.879v-120.879z",fill:"#406bd4"}),la=i.a.createElement("path",{d:"m313.425 150.571v-122.768h148.082z",fill:"#3257b0"}),ma=i.a.createElement("path",{d:"m394.732 198.575 117.268-97.556v97.556z",fill:"#3257b0"}),ua=i.a.createElement("g",{fill:"#406bd4"},i.a.createElement("path",{d:"m0 99.317v99.258h119.313z"}),i.a.createElement("path",{d:"m0 313.425v97.699l117.44-97.699z"}),i.a.createElement("path",{d:"m50.49 484.197 148.085-122.676v122.676z"})),da=i.a.createElement("path",{d:"m313.425 484.197v-124.139l149.221 124.139z",fill:"#3257b0"}),pa=i.a.createElement("path",{d:"m512 409.423-115.395-95.998h115.395z",fill:"#3257b0"}),va=i.a.createElement("path",{d:"m512 222.142h-222.142v-194.339h-67.716v194.339h-222.142v67.716h222.142v194.339h67.716v-194.339h222.142z",fill:"#f40055"}),fa=i.a.createElement("path",{d:"m289.858 222.142v-194.339h-33.858v456.394h33.858v-194.339h222.142v-67.716z",fill:"#c20044"}),ha=function(e){var t=e.svgRef,a=e.title,n=aa(e,["svgRef","title"]);return i.a.createElement("svg",ta({id:"Capa_1",enableBackground:"new 0 0 512 512",height:512,viewBox:"0 0 512 512",width:512,ref:t},n),a?i.a.createElement("title",null,a):null,na,ra,ia,ca,sa,oa,la,ma,ua,da,pa,va,fa)},ga=i.a.forwardRef((function(e,t){return i.a.createElement(ha,ta({svgRef:t},e))}));a.p;function Ea(){return(Ea=Object.assign||function(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var ba=i.a.createElement("path",{d:"m173.899 31.804h-8.707l-4.397-4h-115.711c-24.859-.001-45.084 20.224-45.084 45.083v366.226c0 24.859 20.225 45.084 45.084 45.084h115.711l6.348-4h6.755v-448.393z",fill:"#406bd4"}),Na=i.a.createElement("path",{d:"m466.916 27.803h-115.711l-4.523 4h-5.141v448.393h4.141l5.523 4h115.711c24.859 0 45.084-20.225 45.084-45.084v-366.225c0-24.859-20.225-45.084-45.084-45.084z",fill:"#c20044"}),Oa=i.a.createElement("path",{d:"m160.795 27.803h190.409v456.394h-190.409z",fill:"#f0f9ff"}),wa=i.a.createElement("path",{d:"m256 27.803h95.205v456.394h-95.205z",fill:"#cee5f5"}),ka=function(e){var t=e.svgRef,a=e.title,n=ya(e,["svgRef","title"]);return i.a.createElement("svg",Ea({id:"Capa_1",enableBackground:"new 0 0 512 512",height:512,viewBox:"0 0 512 512",width:512,ref:t},n),a?i.a.createElement("title",null,a):null,ba,Na,Oa,wa)},xa=i.a.forwardRef((function(e,t){return i.a.createElement(ka,Ea({svgRef:t},e))})),ja=(a.p,[{name:"en",selected:!0,flag:i.a.createElement(ga,null)},{name:"fr",selected:!1,flag:i.a.createElement(xa,null)}]),_a=function(e){Object(y.a)(a,e);var t=Object(b.a)(a);function a(e){var n;return Object(g.a)(this,a),(n=t.call(this,e)).state={isOpen:!1},n}return Object(E.a)(a,[{key:"toggleDropdown",value:function(){this.setState((function(e){return{isOpen:!e.isOpen}}))}},{key:"render",value:function(){var e=this,t=this.state.isOpen,a=this.props,n=a.language,r=a.onUpdateLanguage;return i.a.createElement("div",{className:"dropdown-wrapper",onClick:function(){return e.toggleDropdown()}},i.a.createElement("ul",{className:"dropdown-list i18n-flag"},ja.filter((function(e){return t?e:e.name===n})).map((function(e){return i.a.createElement("li",{className:"dropdown-item".concat(e.name===n&&t?" dropdown-item-selected":""),key:e.name,onClick:function(){return r(e.name,n)}},e.flag," ",e.name)}))))}}]),a}(r.Component),Sa=Object(N.c)((function(e){return{language:e.language}}),(function(e){return{onUpdateLanguage:function(t,a){t!==a&&e(Y(t))}}}))(_a),Da=function(e){Object(y.a)(a,e);var t=Object(b.a)(a);function a(){return Object(g.a)(this,a),t.apply(this,arguments)}return Object(E.a)(a,[{key:"render",value:function(){var e=this.props,t=e.admin,a=e.isAuthenticated,n=e.picture,r=e.t,c=e.username;return i.a.createElement("header",null,i.a.createElement("nav",{className:"navbar navbar-expand-lg navbar-light bg-light"},i.a.createElement("div",{className:"container"},i.a.createElement("span",{className:"navbar-brand"},"FitTrackee"),i.a.createElement("button",{className:"navbar-toggler",type:"button","data-toggle":"collapse","data-target":"#navbarSupportedContent","aria-controls":"navbarSupportedContent","aria-expanded":"false","aria-label":"Toggle navigation"},i.a.createElement("span",{className:"navbar-toggler-icon"})),i.a.createElement("div",{className:"collapse navbar-collapse",id:"navbarSupportedContent"},i.a.createElement("ul",{className:"navbar-nav mr-auto"},i.a.createElement("li",{className:"nav-item"},i.a.createElement(Q.a,{className:"nav-link",to:{pathname:"/"}},r("common:Dashboard"))),a&&i.a.createElement("li",{className:"nav-item"},i.a.createElement(Q.a,{className:"nav-link",to:{pathname:"/activities/history"}},r("Workouts"))),a&&i.a.createElement("li",{className:"nav-item"},i.a.createElement(Q.a,{className:"nav-link",to:{pathname:"/activities/statistics"}},r("common:Statistics"))),t&&i.a.createElement("li",{className:"nav-item"},i.a.createElement(Q.a,{className:"nav-link",to:{pathname:"/admin"}},"Admin")),a&&i.a.createElement("li",{className:"nav-item"},i.a.createElement(Q.a,{className:"nav-link",to:{pathname:"/activities/add"}},i.a.createElement("strong",null,r("common:Add workout"))))),i.a.createElement("ul",{className:"navbar-nav flex-row ml-md-auto d-none d-md-flex"},!a&&i.a.createElement("li",{className:"nav-item"},i.a.createElement(Q.a,{className:"nav-link",to:{pathname:"/register"}},r("user:Register"))),!a&&i.a.createElement("li",{className:"nav-item"},i.a.createElement(Q.a,{className:"nav-link",to:{pathname:"/login"}},r("user:Login"))),a&&i.a.createElement(i.a.Fragment,null,!0===n?i.a.createElement("img",{alt:"Avatar",src:"".concat("/api/","users/").concat(c,"/picture?").concat(Date.now()),className:"img-fluid App-nav-profile-img"}):i.a.createElement("i",{className:"fa fa-user-circle-o fa-2x no-picture","aria-hidden":"true"}),i.a.createElement("li",{className:"nav-item"},i.a.createElement(Q.a,{className:"nav-link",to:{pathname:"/profile"}},c)),i.a.createElement("li",{className:"nav-item"},i.a.createElement(Q.a,{className:"nav-link",to:{pathname:"/logout"}},r("user:Logout")))),i.a.createElement("li",null,i.a.createElement(Sa,null)))))))}}]),a}(i.a.PureComponent),Aa=Object(k.a)()(Object(N.c)((function(e){var t=e.user;return{admin:t.admin,isAuthenticated:t.isAuthenticated,picture:t.picture,username:t.username}}))(Da));function Ca(){return(Ca=Object.assign||function(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var Ta=i.a.createElement("g",null,i.a.createElement("g",null,i.a.createElement("path",{d:"M468.683,287.265h-69.07c-4.147,0-7.508,3.361-7.508,7.508c0,4.147,3.361,7.508,7.508,7.508h69.07 c4.147,0,7.508-3.361,7.508-7.508C476.191,290.626,472.83,287.265,468.683,287.265z"}))),Pa=i.a.createElement("g",null,i.a.createElement("g",null,i.a.createElement("path",{d:"M105.012,268.377L85.781,256l19.231-12.376c3.487-2.243,4.495-6.888,2.251-10.376c-2.244-3.486-6.888-4.497-10.376-2.25 l-17.471,11.243v-20.776c0-4.147-3.361-7.508-7.508-7.508c-4.147,0-7.508,3.361-7.508,7.508v20.775l-17.47-11.243 c-3.486-2.245-8.132-1.238-10.376,2.25c-2.245,3.487-1.237,8.133,2.25,10.376L58.034,256l-19.231,12.376 c-3.487,2.244-4.495,6.889-2.25,10.376c1.435,2.23,3.852,3.446,6.32,3.446c1.391,0,2.799-0.386,4.056-1.196l17.47-11.243v20.775 c0,4.147,3.361,7.508,7.508,7.508c4.147,0,7.508-3.361,7.508-7.508V269.76l17.471,11.243c1.257,0.809,2.664,1.196,4.056,1.196 c2.467,0,4.885-1.216,6.32-3.446C109.507,275.266,108.499,270.62,105.012,268.377z"}))),Fa=i.a.createElement("g",null,i.a.createElement("g",null,i.a.createElement("path",{d:"M194.441,268.377L175.21,256l19.231-12.376c3.487-2.244,4.495-6.889,2.25-10.376c-2.245-3.486-6.888-4.497-10.376-2.25 l-17.47,11.243v-20.775c0-4.147-3.361-7.508-7.508-7.508c-4.147,0-7.508,3.361-7.508,7.508v20.776l-17.471-11.243 c-3.487-2.245-8.133-1.238-10.376,2.25c-2.245,3.487-1.237,8.133,2.25,10.376L147.463,256l-19.231,12.376 c-3.487,2.244-4.495,6.889-2.25,10.376c1.435,2.23,3.852,3.446,6.32,3.446c1.391,0,2.799-0.386,4.056-1.196l17.471-11.243v20.776 c0,4.147,3.361,7.508,7.508,7.508c4.147,0,7.508-3.361,7.508-7.508V269.76l17.47,11.243c1.257,0.809,2.664,1.196,4.056,1.196 c2.467,0,4.885-1.216,6.32-3.446C198.936,275.266,197.928,270.62,194.441,268.377z"}))),za=i.a.createElement("g",null,i.a.createElement("g",null,i.a.createElement("path",{d:"M283.871,268.377L264.64,256l19.231-12.376c3.487-2.243,4.495-6.888,2.251-10.376c-2.245-3.486-6.888-4.497-10.376-2.25 l-17.471,11.243v-20.775c0-4.147-3.361-7.508-7.508-7.508c-4.147,0-7.508,3.361-7.508,7.508v20.775l-17.471-11.243 c-3.486-2.245-8.134-1.238-10.376,2.25c-2.245,3.487-1.237,8.133,2.25,10.376L236.892,256l-19.231,12.376 c-3.487,2.244-4.495,6.889-2.25,10.376c1.435,2.23,3.852,3.446,6.32,3.446c1.391,0,2.799-0.386,4.056-1.196l17.471-11.243v20.775 c0,4.147,3.361,7.508,7.508,7.508c4.147,0,7.508-3.361,7.508-7.508V269.76l17.471,11.243c1.257,0.809,2.664,1.196,4.056,1.196 c2.467,0,4.886-1.216,6.32-3.446C288.366,275.266,287.358,270.62,283.871,268.377z"}))),Ra=i.a.createElement("g",null,i.a.createElement("g",null,i.a.createElement("path",{d:"M373.3,268.377L354.069,256l19.231-12.376c3.487-2.244,4.495-6.889,2.25-10.376c-2.244-3.486-6.888-4.497-10.376-2.25 l-17.471,11.243v-20.776c0-4.147-3.361-7.508-7.508-7.508c-4.147,0-7.508,3.361-7.508,7.508v20.775l-17.47-11.243 c-3.486-2.245-8.132-1.238-10.376,2.25c-2.245,3.487-1.237,8.133,2.25,10.376L326.322,256l-19.231,12.376 c-3.487,2.244-4.495,6.889-2.25,10.376c1.435,2.23,3.852,3.446,6.32,3.446c1.391,0,2.799-0.386,4.056-1.196l17.47-11.243v20.776 c0,4.147,3.361,7.508,7.508,7.508c4.147,0,7.508-3.361,7.508-7.508V269.76l17.471,11.243c1.257,0.809,2.664,1.196,4.056,1.196 c2.467,0,4.885-1.216,6.32-3.446C377.795,275.266,376.787,270.62,373.3,268.377z"}))),La=i.a.createElement("g",null,i.a.createElement("g",null,i.a.createElement("path",{d:"M271.792,330.359H15.016V181.642h93.1c4.147,0,7.508-3.361,7.508-7.508c0-4.147-3.361-7.508-7.508-7.508H12.513 C5.613,166.626,0,172.24,0,179.14v153.722c0,6.9,5.613,12.513,12.513,12.513h259.278c4.147,0,7.508-3.361,7.508-7.508 C279.299,333.72,275.939,330.359,271.792,330.359z"}))),Ia=i.a.createElement("g",null,i.a.createElement("g",null,i.a.createElement("path",{d:"M499.487,166.626H162.174c-4.147,0-7.508,3.361-7.508,7.508c0,4.147,3.361,7.508,7.508,7.508h334.811v148.716H323.848 c-4.147,0-7.508,3.361-7.508,7.508c0,4.147,3.361,7.508,7.508,7.508h175.64c6.9,0,12.513-5.613,12.513-12.513V179.14 C512.001,172.24,506.387,166.626,499.487,166.626z"}))),Ua=function(e){var t=e.svgRef,a=e.title,n=Ma(e,["svgRef","title"]);return i.a.createElement("svg",Ca({id:"Layer_1",x:"0px",y:"0px",viewBox:"0 0 512.001 512.001",style:{enableBackground:"new 0 0 512.001 512.001"},xmlSpace:"preserve",ref:t},n),a?i.a.createElement("title",null,a):null,Ta,Pa,Fa,za,Ra,La,Ia)},Ha=i.a.forwardRef((function(e,t){return i.a.createElement(Ua,Ca({svgRef:t},e))}));a.p;function qa(){return(qa=Object.assign||function(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var Ba=i.a.createElement("g",null,i.a.createElement("path",{d:"M339.798,260.429c0.13-0.026,0.257-0.061,0.385-0.094c0.109-0.028,0.219-0.051,0.326-0.084 c0.125-0.038,0.247-0.085,0.369-0.129c0.108-0.039,0.217-0.074,0.324-0.119c0.115-0.048,0.226-0.104,0.338-0.157 c0.109-0.052,0.22-0.1,0.327-0.158c0.107-0.057,0.208-0.122,0.312-0.184c0.107-0.064,0.215-0.124,0.319-0.194 c0.111-0.074,0.214-0.156,0.321-0.236c0.09-0.067,0.182-0.13,0.27-0.202c0.162-0.133,0.316-0.275,0.466-0.421 c0.027-0.026,0.056-0.048,0.083-0.075c0.028-0.028,0.052-0.059,0.079-0.088c0.144-0.148,0.284-0.3,0.416-0.46 c0.077-0.094,0.144-0.192,0.216-0.289c0.074-0.1,0.152-0.197,0.221-0.301c0.074-0.111,0.139-0.226,0.207-0.34 c0.057-0.096,0.118-0.19,0.171-0.289c0.062-0.115,0.114-0.234,0.169-0.351c0.049-0.104,0.101-0.207,0.146-0.314 c0.048-0.115,0.086-0.232,0.128-0.349c0.041-0.114,0.085-0.227,0.12-0.343c0.036-0.118,0.062-0.238,0.092-0.358 c0.029-0.118,0.063-0.234,0.086-0.353c0.028-0.141,0.045-0.283,0.065-0.425c0.014-0.1,0.033-0.199,0.043-0.3 c0.025-0.249,0.038-0.498,0.038-0.748V92.76c0-4.143-3.357-7.5-7.5-7.5h-236.25c-0.066,0-0.13,0.008-0.196,0.01 c-0.143,0.004-0.285,0.01-0.427,0.022c-0.113,0.009-0.225,0.022-0.337,0.037c-0.128,0.016-0.255,0.035-0.382,0.058 c-0.119,0.021-0.237,0.046-0.354,0.073c-0.119,0.028-0.238,0.058-0.356,0.092c-0.117,0.033-0.232,0.069-0.346,0.107 c-0.117,0.04-0.234,0.082-0.349,0.128c-0.109,0.043-0.216,0.087-0.322,0.135c-0.118,0.053-0.235,0.11-0.351,0.169 c-0.099,0.051-0.196,0.103-0.292,0.158c-0.116,0.066-0.23,0.136-0.343,0.208c-0.093,0.06-0.184,0.122-0.274,0.185 c-0.106,0.075-0.211,0.153-0.314,0.235c-0.094,0.075-0.186,0.152-0.277,0.231c-0.09,0.079-0.179,0.158-0.266,0.242 c-0.099,0.095-0.194,0.194-0.288,0.294c-0.047,0.05-0.097,0.094-0.142,0.145c-0.027,0.03-0.048,0.063-0.074,0.093 c-0.094,0.109-0.182,0.223-0.27,0.338c-0.064,0.084-0.13,0.168-0.19,0.254c-0.078,0.112-0.15,0.227-0.222,0.343 c-0.059,0.095-0.12,0.189-0.174,0.286c-0.063,0.112-0.118,0.227-0.175,0.342c-0.052,0.105-0.106,0.21-0.153,0.317 c-0.049,0.113-0.092,0.23-0.135,0.345c-0.043,0.113-0.087,0.225-0.124,0.339c-0.037,0.115-0.067,0.232-0.099,0.349 c-0.032,0.12-0.066,0.239-0.093,0.36c-0.025,0.113-0.042,0.228-0.062,0.342c-0.022,0.13-0.044,0.26-0.06,0.39 c-0.013,0.108-0.019,0.218-0.027,0.328c-0.01,0.14-0.019,0.28-0.021,0.421c-0.001,0.041-0.006,0.081-0.006,0.122v46.252 c0,4.143,3.357,7.5,7.5,7.5s7.5-3.357,7.5-7.5v-29.595l66.681,59.037c-0.348,0.245-0.683,0.516-0.995,0.827l-65.687,65.687v-49.288 c0-4.143-3.357-7.5-7.5-7.5s-7.5,3.357-7.5,7.5v9.164h-38.75c-4.143,0-7.5,3.357-7.5,7.5s3.357,7.5,7.5,7.5h38.75v43.231 c0,4.143,3.357,7.5,7.5,7.5h236.25c0.247,0,0.494-0.013,0.74-0.037c0.115-0.011,0.226-0.033,0.339-0.049 C339.542,260.469,339.67,260.454,339.798,260.429z M330.834,234.967l-65.688-65.687c-0.042-0.042-0.087-0.077-0.13-0.117 l49.383-41.897c3.158-2.68,3.546-7.412,0.866-10.571c-2.678-3.157-7.41-3.547-10.571-0.866l-84.381,71.59l-98.444-87.158h208.965 V234.967z M185.878,179.888c0.535-0.535,0.969-1.131,1.308-1.765l28.051,24.835c1.418,1.255,3.194,1.885,4.972,1.885 c1.726,0,3.451-0.593,4.853-1.781l28.587-24.254c0.26,0.38,0.553,0.743,0.89,1.08l65.687,65.687H120.191L185.878,179.888z"}),i.a.createElement("path",{d:"M7.5,170.676h126.667c4.143,0,7.5-3.357,7.5-7.5s-3.357-7.5-7.5-7.5H7.5c-4.143,0-7.5,3.357-7.5,7.5 S3.357,170.676,7.5,170.676z"}),i.a.createElement("path",{d:"M20.625,129.345H77.5c4.143,0,7.5-3.357,7.5-7.5s-3.357-7.5-7.5-7.5H20.625c-4.143,0-7.5,3.357-7.5,7.5 S16.482,129.345,20.625,129.345z"}),i.a.createElement("path",{d:"M62.5,226.51h-55c-4.143,0-7.5,3.357-7.5,7.5s3.357,7.5,7.5,7.5h55c4.143,0,7.5-3.357,7.5-7.5S66.643,226.51,62.5,226.51z"})),Ga=function(e){var t=e.svgRef,a=e.title,n=Va(e,["svgRef","title"]);return i.a.createElement("svg",qa({id:"Capa_1",x:"0px",y:"0px",viewBox:"0 0 345.834 345.834",style:{enableBackground:"new 0 0 345.834 345.834"},xmlSpace:"preserve",ref:t},n),a?i.a.createElement("title",null,a):null,Ba)},Wa=i.a.forwardRef((function(e,t){return i.a.createElement(Ga,qa({svgRef:t},e))}));a.p;function Ja(e){var t=Object(oe.a)().t,a=e.action;return i.a.createElement("div",{className:"container dashboard"},i.a.createElement("div",{className:"row"},i.a.createElement("div",{className:"col-2"}),i.a.createElement("div",{className:"card col-8"},i.a.createElement("div",{className:"card-body"},i.a.createElement("div",{className:"text-center "},"sent"===a&&i.a.createElement(i.a.Fragment,null,i.a.createElement("div",{className:"svg-icon"},i.a.createElement(Wa,null)),t("user:Check your email. If your address is in our database, you'll received an email with a link to reset your password.")),"updated"===a&&i.a.createElement(i.a.Fragment,null,i.a.createElement("div",{className:"svg-icon"},i.a.createElement(Ha,null)),i.a.createElement(ue.a,{i18nKey:"user:updatedPasswordText"},"Your password have been updated. Click",i.a.createElement(Q.a,{to:"/login"},"here")," to log in."))))),i.a.createElement("div",{className:"col-2"})))}var Ya=a(235),Ka=a.n(Ya),Xa=function(e){Object(y.a)(a,e);var t=Object(b.a)(a);function a(e,n){var r;return Object(g.a)(this,a),(r=t.call(this,e,n)).state={formData:{},displayModal:!1},r}return Object(E.a)(a,[{key:"componentDidMount",value:function(){this.initForm()}},{key:"componentDidUpdate",value:function(e){e.user!==this.props.user&&this.initForm()}},{key:"initForm",value:function(){var e=this.props.user,t={};Object.keys(e).map((function(a){return null===e[a]?t[a]="":t[a]="birth_date"===a?Object(_.a)(new Date(e[a]),"yyyy-MM-DD"):e[a]})),this.setState({formData:t})}},{key:"handleFormChange",value:function(e){var t=this.state.formData;"weekm"===e.target.name?t.weekm="Monday"===e.target.value:t[e.target.name]=e.target.value,this.setState(t)}},{key:"displayModal",value:function(e){this.setState((function(t){return Object(j.a)(Object(j.a)({},t),{},{displayModal:e})}))}},{key:"render",value:function(){var e=this,t=this.props,a=t.message,n=t.onDeleteUser,r=t.onHandleProfileFormSubmit,c=t.t,s=t.user,o=this.state,l=o.displayModal,m=o.formData;return i.a.createElement("div",null,i.a.createElement(w.a,null,i.a.createElement("title",null,"FitTrackee - ",c("user:Profile Edition"))),m.isAuthenticated&&i.a.createElement("div",{className:"container"},l&&i.a.createElement(at,{title:c("common:Confirmation"),text:c("user:Are you sure you want to delete your account? All data will be deleted, this cannot be undone."),confirm:function(){n(s.username),e.displayModal(!1)},close:function(){return e.displayModal(!1)}}),i.a.createElement("h1",{className:"page-title"},c("user:Profile Edition")),i.a.createElement("div",{className:"row"},i.a.createElement("div",{className:"col-md-2"}),i.a.createElement("div",{className:"col-md-8"},i.a.createElement("div",{className:"card"},i.a.createElement("div",{className:"card-header"},s.username),i.a.createElement("div",{className:"card-body"},i.a.createElement("div",{className:"row"},i.a.createElement("div",{className:"col-md-12"},i.a.createElement("form",{onSubmit:function(e){e.preventDefault(),r(m)}},i.a.createElement("div",{className:"form-group"},i.a.createElement("label",null,c("user:Email"),":",i.a.createElement("input",{name:"email",className:"form-control input-lg",type:"text",value:m.email,readOnly:!0}))),i.a.createElement("div",{className:"form-group"},i.a.createElement("label",null,c("user:Registration Date"),":",i.a.createElement("input",{name:"createdAt",className:"form-control input-lg",type:"text",value:m.created_at,disabled:!0}))),i.a.createElement("div",{className:"form-group"},i.a.createElement("label",null,c("user:Password"),":",i.a.createElement("input",{name:"password",className:"form-control input-lg",type:"password",onChange:function(t){return e.handleFormChange(t)}}))),i.a.createElement("div",{className:"form-group"},i.a.createElement("label",null,c("user:Password Confirmation"),":",i.a.createElement("input",{name:"password_conf",className:"form-control input-lg",type:"password",onChange:function(t){return e.handleFormChange(t)}}))),i.a.createElement("hr",null),i.a.createElement("div",{className:"form-group"},i.a.createElement("label",null,c("user:First Name"),":",i.a.createElement("input",{name:"first_name",className:"form-control input-lg",type:"text",value:m.first_name,onChange:function(t){return e.handleFormChange(t)}}))),i.a.createElement("div",{className:"form-group"},i.a.createElement("label",null,c("user:Last Name"),":",i.a.createElement("input",{name:"last_name",className:"form-control input-lg",type:"text",value:m.last_name,onChange:function(t){return e.handleFormChange(t)}}))),i.a.createElement("div",{className:"form-group"},i.a.createElement("label",null,c("user:Birth Date"),i.a.createElement("input",{name:"birth_date",className:"form-control input-lg",type:"date",value:m.birth_date,onChange:function(t){return e.handleFormChange(t)}}))),i.a.createElement("div",{className:"form-group"},i.a.createElement("label",null,c("user:Location"),":",i.a.createElement("input",{name:"location",className:"form-control input-lg",type:"text",value:m.location,onChange:function(t){return e.handleFormChange(t)}}))),i.a.createElement("div",{className:"form-group"},i.a.createElement("label",null,c("user:Bio"),":",i.a.createElement("textarea",{name:"bio",className:"form-control input-lg",maxLength:"200",value:m.bio,onChange:function(t){return e.handleFormChange(t)}}))),i.a.createElement("div",{className:"form-group"},i.a.createElement("label",null,c("user:Language"),":",i.a.createElement("select",{name:"language",className:"form-control input-lg",value:m.language,onChange:function(t){return e.handleFormChange(t)}},ja.map((function(e){return i.a.createElement("option",{value:e.name,key:e.name},e.name)}))))),i.a.createElement("div",{className:"form-group"},i.a.createElement("label",null,c("user:Timezone"),":",i.a.createElement(Ka.a,{className:"form-control timezone-custom",onChange:function(t){var a={target:{name:"timezone",value:t||"Europe/Paris"}};e.handleFormChange(a)},value:m.timezone}))),i.a.createElement("div",{className:"form-group"},i.a.createElement("label",null,c("user:First day of week"),":",i.a.createElement("select",{name:"weekm",className:"form-control input-lg",value:m.weekm?"Monday":"Sunday",onChange:function(t){return e.handleFormChange(t)}},i.a.createElement("option",{value:"Sunday"},c("user:Sunday")),i.a.createElement("option",{value:"Monday"},c("user:Monday"))))),i.a.createElement("button",{type:"submit",className:"btn btn-primary"},c("common:Submit")),i.a.createElement("button",{className:"btn btn-danger",onClick:function(t){t.preventDefault(),e.displayModal(!0)}},c("user:Delete my account")),i.a.createElement("button",{type:"submit",className:"btn btn-secondary",onClick:function(){return Ln.push("/profile")}},c("common:Cancel"))),i.a.createElement(x,{message:a,t:c})))))),i.a.createElement("div",{className:"col-md-2"}))))}}]),a}(i.a.Component),$a=Object(k.a)()(Object(N.c)((function(e){return{location:e.router.location,message:e.message,user:e.user}}),(function(e){return{onDeleteUser:function(t){e(De(t))},onHandleProfileFormSubmit:function(t){e(function(e){return function(t){return!e.password===e.password_conf?t(xe("Password and password confirmation don't match.")):(delete e.id,U.postData("auth/profile/edit",e).then((function(e){if("success"===e.status)return t(_e()),Ln.push("/profile");t(xe(e.message))})).catch((function(e){throw e})))}}(t))}}}))(Xa)),Za=a(475),Qa=a(476),en=a(477),tn=a(236),an=["week","month","year"],nn=function(e){Object(y.a)(a,e);var t=Object(b.a)(a);function a(e,n){var r;Object(g.a)(this,a),r=t.call(this,e,n);var i=new Date;return r.state={displayedSports:e.sports.map((function(e){return e.id})),statsParams:{start:Object(gt.a)(Object(jt.a)(i,11)),end:Object(Et.a)(i),duration:"month",type:"by_time"}},r}return Object(E.a)(a,[{key:"componentDidUpdate",value:function(e){this.props.sports!==e.sports&&this.updateDisplayedSports()}},{key:"updateDisplayedSports",value:function(){var e=this.props.sports;this.setState({displayedSports:e.map((function(e){return e.id}))})}},{key:"handleOnChangeDuration",value:function(e){var t=e.target.name,a=new Date,n="year"===t?Object(zt.a)(Object(Za.a)(a,9)):"week"===t?Object(gt.a)(Object(jt.a)(a,2)):Object(gt.a)(Object(jt.a)(a,11)),r="year"===t?Object(Qa.a)(a):"week"===t?Object(bt.a)(a):Object(Et.a)(a);this.setState({statsParams:{duration:t,end:r,start:n,type:"by_time"}})}},{key:"handleOnChangeSports",value:function(e){var t=this.state.displayedSports;t.includes(e)?this.setState({displayedSports:t.filter((function(t){return t!==e}))}):this.setState({displayedSports:t.concat([e])})}},{key:"handleOnClickArrows",value:function(e){var t,a,n=this.state.statsParams,r=n.start,i=n.end,c=n.duration;e?(t="year"===c?Object(zt.a)(Object(Za.a)(r,1)):"week"===c?Object(yt.a)(Object(en.a)(r,1)):Object(gt.a)(Object(jt.a)(r,1)),a="year"===c?Object(Qa.a)(Object(Za.a)(i,1)):"week"===c?Object(bt.a)(Object(en.a)(i,1)):Object(Et.a)(Object(jt.a)(i,1))):(t="year"===c?Object(zt.a)(Object(Ft.a)(r,1)):"week"===c?Object(yt.a)(Object(tn.a)(r,1)):Object(gt.a)(Object(xt.a)(r,1)),a="year"===c?Object(Qa.a)(Object(Ft.a)(i,1)):"week"===c?Object(bt.a)(Object(tn.a)(i,1)):Object(Et.a)(Object(xt.a)(i,1))),this.setState({statsParams:{duration:c,end:a,start:t,type:"by_time"}})}},{key:"render",value:function(){var e=this,t=this.state,a=t.displayedSports,n=t.statsParams,r=this.props,c=r.sports,s=r.t,o=r.user,l=Oe(c.filter((function(e){return o.sports_list.includes(e.id)})),s);return i.a.createElement(i.a.Fragment,null,i.a.createElement(w.a,null,i.a.createElement("title",null,"FitTrackee - ",s("statistics:Statistics"))),i.a.createElement("div",{className:"container dashboard"},i.a.createElement("div",{className:"card activity-card"},i.a.createElement("div",{className:"card-header"},s("statistics:Statistics")),i.a.createElement("div",{className:"card-body".concat(0===o.nb_activities?" stats-disabled":"")},i.a.createElement("div",{className:"chart-filters row"},i.a.createElement("div",{className:"col chart-arrows"},i.a.createElement("p",{className:"text-center"},i.a.createElement("i",{className:"fa fa-chevron-left","aria-hidden":"true",onClick:function(){return e.handleOnClickArrows(!0)}}))),i.a.createElement("div",{className:"col-md-3 time-frames justify-content-around"},an.map((function(t){return i.a.createElement("div",{className:"time-frame",key:t},i.a.createElement("label",null,i.a.createElement("input",{type:"radio",id:t,name:t,checked:t===n.duration,onChange:function(t){return e.handleOnChangeDuration(t)}}),i.a.createElement("span",null,s("statistics:".concat(t)))))}))),i.a.createElement("div",{className:"col chart-arrows"},i.a.createElement("p",{className:"text-center"},i.a.createElement("i",{className:"fa fa-chevron-right","aria-hidden":"true",onClick:function(){return e.handleOnClickArrows(!1)}})))),i.a.createElement(Jt,{displayEmpty:!0,displayedSports:a,statsParams:n,t:s}),i.a.createElement("div",{className:"row chart-activities"},l.map((function(t){return i.a.createElement("label",{className:"col activity-label",key:t.id},i.a.createElement("input",{type:"checkbox",checked:a.includes(t.id),name:t.label,onChange:function(){return e.handleOnChangeSports(t.id)}}),i.a.createElement("span",{style:{color:he[t.id-1]}}," ".concat(t.label)))}))))),0===o.nb_activities&&i.a.createElement(ut,{t:s})))}}]),a}(i.a.Component),rn=Object(k.a)()(Object(N.c)((function(e){return{sports:e.sports.data,user:e.user}}))(nn));function cn(e){var t=Object(oe.a)().t,a="user:".concat(e.formType.charAt(0).toUpperCase()).concat(e.formType.slice(1));return i.a.createElement("div",null,i.a.createElement(w.a,null,i.a.createElement("title",null,"FitTrackee - ",t("user:".concat(e.formType)))),i.a.createElement("h1",{className:"page-title"},t(a)),i.a.createElement("div",{className:"container"},i.a.createElement("div",{className:"row"},i.a.createElement("div",{className:"col-md-3"}),i.a.createElement("div",{className:"col-md-6"},i.a.createElement("br",null),"register"!==e.formType||e.isRegistrationAllowed?i.a.createElement(i.a.Fragment,null,i.a.createElement("form",{onSubmit:function(t){return e.handleUserFormSubmit(t,e.formType)}},"register"===e.formType&&i.a.createElement("div",{className:"form-group"},i.a.createElement("input",{className:"form-control input-lg",name:"username",placeholder:t("user:Enter a username"),required:!0,type:"text",value:e.userForm.username,onChange:e.onHandleFormChange})),"password reset"!==e.formType&&i.a.createElement("div",{className:"form-group"},i.a.createElement("input",{className:"form-control input-lg",name:"email",placeholder:t("user:Enter an email address"),required:!0,type:"email",value:e.userForm.email,onChange:e.onHandleFormChange})),"reset your password"!==e.formType&&i.a.createElement(i.a.Fragment,null,i.a.createElement("div",{className:"form-group"},i.a.createElement("input",{className:"form-control input-lg",name:"password",placeholder:t("user:Enter a password"),required:!0,type:"password",value:e.userForm.password,onChange:e.onHandleFormChange})),"login"!==e.formType&&i.a.createElement("div",{className:"form-group"},i.a.createElement("input",{className:"form-control input-lg",name:"password_conf",placeholder:t("user:Enter the password confirmation"),required:!0,type:"password",value:e.userForm.password_conf,onChange:e.onHandleFormChange}))),i.a.createElement("input",{type:"submit",className:"btn btn-primary btn-lg btn-block",value:t("Submit")})),i.a.createElement("p",{className:"password-forget"},"login"===e.formType&&i.a.createElement(Q.a,{to:{pathname:"/password-reset/request"}},t("user:Forgot password?")))):i.a.createElement("div",{className:"card"},i.a.createElement("div",{className:"card-body"},"Registration is disabled."),i.a.createElement("div",{className:"card-body"},i.a.createElement("button",{type:"submit",className:"btn btn-secondary btn-lg btn-block",onClick:function(){return Ln.go(-1)}},"Back")))),i.a.createElement("div",{className:"col-md-3"}))))}var sn=function(e){Object(y.a)(a,e);var t=Object(b.a)(a);function a(e,n){var r;return Object(g.a)(this,a),(r=t.call(this,e,n)).state={formData:{username:"",email:"",password:"",password_conf:""}},r}return Object(E.a)(a,[{key:"componentDidUpdate",value:function(e){e.location.pathname!==this.props.location.pathname&&this.emptyForm()}},{key:"emptyForm",value:function(){var e=this.state.formData;Object.keys(e).map((function(t){return e[t]=""})),this.setState(e)}},{key:"onHandleFormChange",value:function(e){var t=this.state.formData;t[e.target.name]=e.target.value,this.setState(t)}},{key:"render",value:function(){var e=this,t=this.props,a=t.formType,n=t.isRegistrationAllowed,r=t.message,c=t.messages,s=t.onHandleUserFormSubmit,o=t.t,l=this.state.formData,m=this.props.location.query.token;return i.a.createElement("div",null,P()||"password reset"===a&&!m?i.a.createElement(O.a,{to:"/"}):i.a.createElement("div",null,i.a.createElement(x,{message:r,messages:c,t:o}),i.a.createElement(cn,{isRegistrationAllowed:n,formType:a,userForm:l,onHandleFormChange:function(t){return e.onHandleFormChange(t)},handleUserFormSubmit:function(e){e.preventDefault(),"password reset"===a&&(l.token=m),s(l,a)}})))}}]),a}(i.a.Component),on=Object(k.a)()(Object(N.c)((function(e){return{isRegistrationAllowed:e.application.config.is_registration_enabled,location:e.router.location,message:e.message,messages:e.messages}}),(function(e){return{onHandleUserFormSubmit:function(t,a){e(Se(t,a="password reset"===a?"password/update":"reset your password"===a?"password/reset-request":a))}}}))(sn)),ln=function(e){Object(y.a)(a,e);var t=Object(b.a)(a);function a(e,n){var r;return Object(g.a)(this,a),(r=t.call(this,e,n)).state={displayModal:!1},r}return Object(E.a)(a,[{key:"componentDidMount",value:function(){this.props.loadUser(this.props.match.params.userName)}},{key:"componentDidUpdate",value:function(e){e.match.params.userName!==this.props.match.params.userName&&this.props.loadUser(this.props.match.params.userName)}},{key:"displayModal",value:function(e){this.setState((function(t){return Object(j.a)(Object(j.a)({},t),{},{displayModal:e})}))}},{key:"render",value:function(){var e=this,t=this.props,a=t.t,n=t.currentUser,r=t.onDeleteUser,c=t.users,s=this.state.displayModal,o=Object(de.a)(c,1)[0],l=!!o&&n.username===o.username;return i.a.createElement("div",null,s&&i.a.createElement(at,{title:a("common:Confirmation"),text:a("user:Are you sure you want to delete this account? All data will be deleted, this cannot be undone."),confirm:function(){r(o.username),e.displayModal(!1)},close:function(){return e.displayModal(!1)}}),o&&i.a.createElement(vt,{editable:l,isDeletable:n.admin&&!l,onDeleteUser:r,displayModal:function(t){return e.displayModal(t)},t:a,user:o}))}}]),a}(i.a.Component),mn=Object(k.a)()(Object(N.c)((function(e){return{currentUser:e.user,users:e.users.data}}),(function(e){return{onDeleteUser:function(t){e(De(t,!0))},loadUser:function(t){e(J("getData","users",{username:t}))}}}))(ln)),un=function(e){Object(y.a)(a,e);var t=Object(b.a)(a);function a(e){var n;return Object(g.a)(this,a),(n=t.call(this,e)).props=e,n}return Object(E.a)(a,[{key:"componentDidMount",value:function(){this.props.loadAppConfig()}},{key:"render",value:function(){return i.a.createElement("div",{className:"App"},i.a.createElement(Aa,null),i.a.createElement(O.d,null,i.a.createElement(O.b,{exact:!0,path:"/",component:$t}),i.a.createElement(O.b,{exact:!0,path:"/register",render:function(){return i.a.createElement(on,{formType:"register"})}}),i.a.createElement(O.b,{exact:!0,path:"/login",render:function(){return i.a.createElement(on,{formType:"login"})}}),i.a.createElement(O.b,{exact:!0,path:"/password-reset",render:function(){return i.a.createElement(on,{formType:"password reset"})}}),i.a.createElement(O.b,{exact:!0,path:"/password-reset/request",render:function(){return i.a.createElement(on,{formType:"reset your password"})}}),i.a.createElement(O.b,{exact:!0,path:"/password-reset/sent",render:function(){return i.a.createElement(Ja,{action:"sent"})}}),i.a.createElement(O.b,{exact:!0,path:"/updated-password",render:function(){return i.a.createElement(Ja,{action:"updated"})}}),i.a.createElement(O.b,{exact:!0,path:"/password-reset/sent",component:Ja}),i.a.createElement(O.b,{exact:!0,path:"/logout",component:ea}),i.a.createElement(O.b,{exact:!0,path:"/profile/edit",component:$a}),i.a.createElement(O.b,{exact:!0,path:"/profile",component:ft}),i.a.createElement(O.b,{exact:!0,path:"/activities/history",component:pt}),i.a.createElement(O.b,{exact:!0,path:"/activities/statistics",component:rn}),i.a.createElement(O.b,{exact:!0,path:"/users/:userName",component:mn}),i.a.createElement(O.b,{path:"/activities",component:st}),i.a.createElement(O.b,{path:"/admin",component:me}),i.a.createElement(O.b,{component:le})),i.a.createElement(Zt,null))}}]),a}(i.a.Component),dn=Object(N.c)((function(){return{}}),(function(e){return{loadAppConfig:function(){e(X("config"))}}}))(un),pn=a(78);function vn(e){var t=e.store,a=e.history,n=e.children;return i.a.createElement(N.a,{store:t},i.a.createElement(pn.a,{history:a},n))}var fn=Boolean("localhost"===window.location.hostname||"[::1]"===window.location.hostname||window.location.hostname.match(/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/));function hn(e){navigator.serviceWorker.register(e).then((function(e){e.onupdatefound=function(){var t=e.installing;t.onstatechange=function(){"installed"===t.state&&(navigator.serviceWorker.controller?console.log("New content is available; please refresh."):console.log("Content is cached for offline use."))}}})).catch((function(e){console.error("Error during service worker registration:",e)}))}var gn,En={data:[]},yn={language:"en",message:"",messages:[],user:{isAuthenticated:!1},activities:Object(j.a)({},En),application:{statistics:{},config:{gpx_limit_import:null,is_registration_enabled:null,max_single_file_size:null,max_users:null,max_zip_file_size:null,registration:null}},calendarActivities:Object(j.a)({},En),chartData:[],gpx:null,loading:!1,records:Object(j.a)({},En),sports:Object(j.a)({},En),statistics:{data:{}},users:Object(j.a)({},En)},bn=function(e,t,a){return a.target!==t?e:"SET_DATA"===a.type?Object(j.a)(Object(j.a)({},e),{},{data:a.data[a.target]}):"SET_PAGINATED_DATA"===a.type?Object(j.a)(Object(j.a)({},e),{},{data:a.data[a.target],pagination:a.pagination}):e},Nn=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:yn.activities,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"LOGOUT":return yn.activities;case"PUSH_ACTIVITIES":return Object(j.a)(Object(j.a)({},e),{},{data:e.data.concat(t.activities)});case"REMOVE_ACTIVITY":return Object(j.a)(Object(j.a)({},e),{},{data:e.data.filter((function(e){return e.id!==t.activityId}))});default:return bn(e,"activities",t)}},On=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:yn.application,t=arguments.length>1?arguments[1]:void 0;return"SET_APP_CONFIG"===t.type?Object(j.a)(Object(j.a)({},e),{},{config:t.data}):"SET_APP_STATS"===t.type?Object(j.a)(Object(j.a)({},e),{},{statistics:t.data}):e},wn=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:yn.calendarActivities,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"LOGOUT":return yn.calendarActivities;case"UPDATE_CALENDAR":return Object(j.a)(Object(j.a)({},e),{},{data:t.activities});default:return bn(e,"calendarActivities",t)}},kn=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:yn.chartData,t=arguments.length>1?arguments[1]:void 0;return"SET_CHART_DATA"===t.type?t.chartData:e},xn=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:yn.gpx,t=arguments.length>1?arguments[1]:void 0;return"SET_GPX"===t.type?t.gpxContent:e},jn=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:yn.language,t=arguments.length>1?arguments[1]:void 0;return"SET_LANGUAGE"===t.type?t.language:e},_n=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:yn.loading,t=arguments.length>1?arguments[1]:void 0;return"SET_LOADING"===t.type?t.loading:e},Sn=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:yn.message,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"AUTH_ERROR":case"PROFILE_ERROR":case"PROFILE_UPDATE_ERROR":case"PICTURE_ERROR":case"SET_ERROR":return t.message;case"LOGOUT":case"PROFILE_SUCCESS":case"SET_RESULTS":case"@@router/LOCATION_CHANGE":return"";default:return e}},Dn=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:yn.messages,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"AUTH_ERRORS":return t.messages;case"LOGOUT":case"PROFILE_SUCCESS":case"@@router/LOCATION_CHANGE":return[];default:return e}},An=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:yn.records,t=arguments.length>1?arguments[1]:void 0;return"LOGOUT"===t.type?yn.records:bn(e,"records",t)},Cn=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:yn.sports,t=arguments.length>1?arguments[1]:void 0;return"UPDATE_SPORT_DATA"===t.type?Object(j.a)(Object(j.a)({},e),{},{data:e.data.map((function(e){return e.id===t.data.id&&(e.is_active=t.data.is_active),e}))}):bn(e,"sports",t)},Mn=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:yn.users,t=arguments.length>1?arguments[1]:void 0;return"UPDATE_USER_DATA"===t.type?Object(j.a)(Object(j.a)({},e),{},{data:e.data.map((function(e){return e.username===t.data.username&&(e.admin=t.data.admin),e}))}):bn(e,"users",t)},Tn=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:yn.user,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"AUTH_ERROR":case"PROFILE_ERROR":case"LOGOUT":return window.localStorage.removeItem("authToken"),yn.user;case"PROFILE_SUCCESS":return t.profil;default:return e}},Pn=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:yn.statistics,t=arguments.length>1?arguments[1]:void 0;return"LOGOUT"===t.type?yn.statistics:bn(e,"statistics",t)},Fn=["/login","/register","/password-reset","/password-reset/request","/password-reset/sent","/updated-password"],zn=function(e,t){return"string"===typeof e||e instanceof String?e=t:e.pathname=t,e},Rn=function(e){return window.localStorage.authToken||Fn.includes(e.pathname)||(e=zn(e,"/login")),window.localStorage.authToken&&Fn.includes(e.pathname)&&(e=zn(e,"/")),e},Ln=((gn=Object(n.a)()).location=Rn(gn.location),Object(j.a)(Object(j.a)({},gn),{},{push:function(e){for(var t=arguments.length,a=new Array(t>1?t-1:0),n=1;n1?t-1:0),n=1;n