(this.webpackJsonpfittrackee_client=this.webpackJsonpfittrackee_client||[]).push([[0],{198: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"}')},199: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"}')},200: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"}')},201:function(e){e.exports=JSON.parse('{"Personal records":"Personal records","This month":"This month","Upload one !":"Upload one !"}')},202: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."}')},203:function(e){e.exports=JSON.parse('{"Cycling (Sport)":"Cycling (Sport)","Cycling (Transport)":"Cycling (Transport)","Hiking":"Hiking","Mountain Biking":"Mountain Biking","Running":"Running","Walking":"Walking"}')},204:function(e){e.exports=JSON.parse('{"activities":"activities","distance":"distance","duration":"duration","month":"month","Statistics":"Statistics","year":"year","week":"week"}')},205: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>here 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>here to log in.","Username":"Username"}')},206: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"}')},207: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"}')},208: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"}')},209:function(e){e.exports=JSON.parse('{"Personal records":"Mes records","This month":"Ce mois","Upload one !":"Ajoutez votre premi\xe8re activit\xe9 !"}')},210: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."}')},211: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"}')},212:function(e){e.exports=JSON.parse('{"activities":"activit\xe9s","distance":"distance","duration":"dur\xe9e","month":"mois","Statistics":"Statistiques","year":"ann\xe9e","week":"semaine"}')},213: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>ici 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>ici pour vous connecter.","Username":"Nom d\'utilisateur"}')},271:function(e,t,a){},279:function(e,t){},461:function(e,t,a){"use strict";a.r(t),a.d(t,"history",(function(){return Ii})),a.d(t,"rootNode",(function(){return Hi})),a.d(t,"store",(function(){return qi}));var i=a(1),s=a(32),n=a(2),c=a.n(n),r=a(479),o=a(68),l=a.n(o),d=a(194),u=a(57),m=a(195),j=a(82),p=a(196),h=a(197),b={en:{activities:a(198),administration:a(199),common:a(200),dashboard:a(201),messages:a(202),sports:a(203),statistics:a(204),user:a(205)},fr:{activities:a(206),administration:a(207),common:a(208),dashboard:a(209),messages:a(210),sports:a(211),statistics:a(212),user:a(213)}};j.a.use(h.a).use(p.a).init({debug:!1,lng:"en",fallbackLng:"en",keySeparator:!1,interpolation:{escapeValue:!1},resources:b,ns:["common"],defaultNS:"common"});var v=j.a,f=a(6),O=a(7),x=a(10),g=a(9),y=a(8),N=a(20),w=(a(271),a(22)),k=a(465),_=function(e){Object(x.a)(a,e);var t=Object(g.a)(a);function a(){return Object(f.a)(this,a),t.apply(this,arguments)}return Object(O.a)(a,[{key:"render",value:function(){var e=this.props,t=e.message,a=e.messages,s=e.t,n=""!==t&&t?t.split("|").length>1?"".concat(s("messages:".concat(t.split("|")[0])),": ").concat(s("messages:".concat(t.split("|")[1]))):s("messages:".concat(t)):"";return Object(i.jsxs)("div",{className:"error-message",children:[""!==n&&Object(i.jsx)("code",{children:n}),a&&a.length>0&&Object(i.jsx)("code",{children:Object(i.jsx)("ul",{children:a.map((function(e){return Object(i.jsx)("li",{children:s("messages:".concat(e.value))},e.id)}))})})]})}}]),a}(c.a.PureComponent),S=a(15),D=a(481),A=a(480),C=a(217),E=["bytes","KB","MB","GB","TB"],M=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 i=(e/Math.pow(1024,a)).toFixed(1),s=E[a];return t?"".concat(i).concat(s):{size:i,suffix:s}},T="/api/",P=[{key:"activities_count",label:"activities count"},{key:"admin",label:"admin rights"},{key:"created_at",label:"registration date"},{key:"username",label:"user name"}],F=[{key:"asc",label:"ascending"},{key:"desc",label:"descending"}],z=function(){return!!window.localStorage.authToken},R=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 i=new Request("".concat(T).concat(e.url),a);return fetch(i).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.")}))},L=function(e,t){if(!e)return"";var a=C.DateTime.fromISO(Object(D.a)(new Date(e),"yyyy-MM-dd'T'HH:mm:ss.SSSxxx")).setZone(t);return Object(A.a)(a.toFormat("yyyy-MM-dd HH:mm:ss"),"yyyy-MM-dd HH:mm:ss",new Date)},I=function(e,t){var a=e.label.toLowerCase(),i=t.label.toLowerCase();return a>i?1:a2&&void 0!==arguments[2]?arguments[2]:"common";return t.map((function(t){return Object(S.a)(Object(S.a)({},t),{},{label:e("".concat(a,":").concat(t.label))})})).sort(I)},H=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,i){return a+="".concat(0===i?"":"&").concat(e,"=").concat(t[e])}))),a},q=function(){function e(){Object(f.a)(this,e)}return Object(O.a)(e,null,[{key:"getData",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=H(e,t),i={url:a,method:"GET",type:"application/json"};return R(i)}},{key:"addData",value:function(e,t){return R({url:e,method:"POST",body:t,type:"application/json"})}},{key:"addDataWithFile",value:function(e,t){return R({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 R(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 R(a)}},{key:"deleteData",value:function(e,t){var a={url:"".concat(e,"/").concat(t),method:"DELETE",type:"application/json"};return R(a)}}]),e}(),V=function(e,t){return{type:"SET_DATA",data:t,target:e}},B=function(e,t,a){return{type:"SET_PAGINATED_DATA",data:t,pagination:a,target:e}},G=function(e){return{type:"SET_ERROR",message:e}},W=function(e){return{type:"SET_LOADING",loading:e}},J=function(e){return{type:"UPDATE_SPORT_DATA",data:e}},Y=function(e){return{type:"UPDATE_USER_DATA",data:e}},K=function(e,t,a){var i=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];return function(s){return s(W(!0)),a&&a.id&&isNaN(a.id)?(s(W(!1)),s(G("".concat(t,"|Incorrect id")))):(s(G("")),q[e](t,a).then((function(a){if("success"===a.status)if(i){if("users"===t&&"getData"===e)return s(B(t,a.data,a.pagination));s(V(t,a.data))}else"updateData"===e&&"sports"===t?s(J(a.data.sports[0])):"updateData"===e&&"users"===t&&s(Y(a.data.users[0]));else s(G("".concat(t,"|").concat(a.message||a.status)));s(W(!1))})).catch((function(e){s(W(!1)),s(G("".concat(t,"|").concat(e)))})))}},X=function(e){return function(t){j.a.changeLanguage(e).then(t(function(e){return{type:"SET_LANGUAGE",language:e}}(e)))}},$=function(e){return{type:"SET_APP_CONFIG",data:e}},Z=function(e){return function(t){return q.getData(e).then((function(a){"success"===a.status?"config"===e?t($(a.data)):"stats/all"===e&&t({type:"SET_APP_STATS",data:a.data}):t(G("application|".concat(a.message)))})).catch((function(e){return t(G("application|".concat(e)))}))}},Q=function(e){Object(x.a)(a,e);var t=Object(g.a)(a);function a(e,i){var s;return Object(f.a)(this,a),(s=t.call(this,e,i)).state={formData:{},isInEdition:!1},s}return Object(O.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,s=t.onHandleConfigFormSubmit,n=t.t,c=this.state,r=c.formData,o=c.isInEdition;return Object(i.jsxs)("div",{children:[a&&Object(i.jsx)(_,{message:a,t:n}),Object.keys(r).length>0&&Object(i.jsx)("div",{className:"row",children:Object(i.jsx)("div",{className:"col-md-12",children:Object(i.jsxs)("div",{className:"card",children:[Object(i.jsx)("div",{className:"card-header",children:Object(i.jsx)("strong",{children:n("administration:Application configuration")})}),Object(i.jsx)("div",{className:"card-body",children:Object(i.jsxs)("form",{className:"app-config-form ".concat(o?"":"form-disabled"),onSubmit:function(t){e.toggleInEdition(t),s(r)},children:[Object(i.jsxs)("div",{className:"form-group row",children:[Object(i.jsxs)("label",{className:"col-sm-6 col-form-label",htmlFor:"max_users",children:[n("administration:Max. number of active users"),Object(i.jsx)("sup",{children:Object(i.jsx)("i",{className:"fa fa-question-circle","aria-hidden":"true",title:n("administration:if 0, no limitation")})}),":"]}),Object(i.jsx)("input",{className:"col-sm-5",id:"max_users",name:"max_users",type:"number",min:"0",value:r.max_users,onChange:function(t){return e.handleFormChange(t)}})]}),Object(i.jsxs)("div",{className:"form-group row",children:[Object(i.jsxs)("label",{className:"col-sm-6 col-form-label",htmlFor:"max_single_file_size",children:[n("administration:Max. size of uploaded files (in Mb)"),":"]}),Object(i.jsx)("input",{className:"col-sm-5",id:"max_single_file_size",name:"max_single_file_size",type:"number",step:"0.1",min:"0",value:r.max_single_file_size,onChange:function(t){return e.handleFormChange(t)}})]}),Object(i.jsxs)("div",{className:"form-group row",children:[Object(i.jsxs)("label",{className:"col-sm-6 col-form-label",htmlFor:"max_zip_file_size",children:[n("administration:Max. size of zip archive (in Mb)"),":"]}),Object(i.jsx)("input",{className:"col-sm-5",id:"max_zip_file_size",name:"max_zip_file_size",type:"number",step:"0.1",min:"0",value:r.max_zip_file_size,onChange:function(t){return e.handleFormChange(t)}})]}),Object(i.jsxs)("div",{className:"form-group row",children:[Object(i.jsx)("label",{className:"col-sm-6 col-form-label",htmlFor:"gpx_limit_import",children:n("administration:Max. files of zip archive")}),Object(i.jsx)("input",{className:"col-sm-5",id:"gpx_limit_import",name:"gpx_limit_import",type:"number",min:"0",value:r.gpx_limit_import,onChange:function(t){return e.handleFormChange(t)}})]}),o?Object(i.jsxs)(i.Fragment,{children:[Object(i.jsx)("input",{type:"submit",className:"btn btn-primary",value:n("common:Submit")}),Object(i.jsx)("input",{type:"submit",className:"btn btn-secondary",onClick:function(t){return e.toggleInEdition(t)},value:n("common:Cancel")})]}):Object(i.jsxs)(i.Fragment,{children:[Object(i.jsx)("input",{type:"submit",className:"btn btn-primary",onClick:function(t){e.toggleInEdition(t)},value:n("common:Edit")}),Object(i.jsx)("input",{type:"submit",className:"btn btn-secondary",onClick:function(){return Ii.push("/admin")},value:n("common:Back")})]})]})})]})})})]})}}]),a}(c.a.Component),ee=Object(y.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 q.updateData("config",e).then((function(e){"success"===e.status?t($(e.data)):t(G("application|".concat(e.message)))})).catch((function(e){return t(G("application|".concat(e)))}))}}(a))}}}))(Q),te=a(14),ae=function(e){Object(x.a)(a,e);var t=Object(g.a)(a);function a(){return Object(f.a)(this,a),t.apply(this,arguments)}return Object(O.a)(a,[{key:"componentDidMount",value:function(){this.props.loadAppStats()}},{key:"render",value:function(){var e=this.props,t=e.appStats,a=e.t,s=M(t.uploads_dir_size,!1);return Object(i.jsxs)("div",{className:"row",children:[Object(i.jsx)("div",{className:"col-lg-3 col-md-6 col-sm-6",children:Object(i.jsx)("div",{className:"card activity-card",children:Object(i.jsxs)("div",{className:"card-body row",children:[Object(i.jsx)("div",{className:"col-3",children:Object(i.jsx)("i",{className:"fa fa-users fa-3x fa-color"})}),Object(i.jsxs)("div",{className:"col-9 text-right",children:[Object(i.jsx)("div",{className:"huge",children:t.users?t.users:0}),Object(i.jsx)("div",{children:"".concat(1===t.users?a("administration:user"):a("administration:users"))})]})]})})}),Object(i.jsx)("div",{className:"col-lg-3 col-md-6 col-sm-6",children:Object(i.jsx)("div",{className:"card activity-card",children:Object(i.jsxs)("div",{className:"card-body row",children:[Object(i.jsx)("div",{className:"col-3",children:Object(i.jsx)("i",{className:"fa fa-tags fa-3x fa-color"})}),Object(i.jsxs)("div",{className:"col-9 text-right",children:[Object(i.jsx)("div",{className:"huge",children:t.sports?t.sports:0}),Object(i.jsx)("div",{children:"".concat(1===t.sports?a("common:sport"):a("common:sports"))})]})]})})}),Object(i.jsx)("div",{className:"col-lg-3 col-md-6 col-sm-6",children:Object(i.jsx)("div",{className:"card activity-card",children:Object(i.jsxs)("div",{className:"card-body row",children:[Object(i.jsx)("div",{className:"col-3",children:Object(i.jsx)("i",{className:"fa fa-calendar fa-3x fa-color"})}),Object(i.jsxs)("div",{className:"col-9 text-right",children:[Object(i.jsx)("div",{className:"huge",children:t.activities?t.activities:0}),Object(i.jsx)("div",{children:"".concat(1===t.activities?a("common:workout"):a("common:workouts"))})]})]})})}),Object(i.jsx)("div",{className:"col-lg-3 col-md-6 col-sm-6",children:Object(i.jsx)("div",{className:"card activity-card",children:Object(i.jsxs)("div",{className:"card-body row",children:[Object(i.jsx)("div",{className:"col-3",children:Object(i.jsx)("i",{className:"fa fa-folder-open fa-3x fa-color"})}),Object(i.jsxs)("div",{className:"col-9 text-right",children:[Object(i.jsx)("div",{className:"huge",children:s.size}),Object(i.jsxs)("div",{children:[s.suffix," (",a("administration:uploads"),")"]})]})]})})})]})}}]),a}(c.a.Component),ie=Object(k.a)()(Object(y.c)((function(e){return{appStats:e.application.statistics}}),(function(e){return{loadAppStats:function(){e(Z("stats/all"))}}}))(ae));function se(e){var t=e.appConfig,a=e.t;return Object(i.jsxs)("div",{className:"card activity-card",children:[Object(i.jsx)("div",{className:"card-header",children:Object(i.jsx)("strong",{children:a("administration:Administration")})}),Object(i.jsxs)("div",{className:"card-body",children:[Object(i.jsx)(ie,{}),Object(i.jsx)("br",{}),Object(i.jsxs)("dl",{className:"admin-items",children:[Object(i.jsx)("dt",{children:Object(i.jsx)(te.a,{to:{pathname:"/admin/application"},children:a("administration:Application")})}),Object(i.jsxs)("dd",{children:[a("administration:Update application configuration (maximum number of registered users, maximum files size)."),Object(i.jsx)("br",{}),Object(i.jsx)("strong",{children:a("administration:Registration is currently ".concat(t.is_registration_enabled?"enabled":"disabled","."))})]}),Object(i.jsx)("br",{}),Object(i.jsx)("dt",{children:Object(i.jsx)(te.a,{to:{pathname:"/admin/sports"},children:a("administration:Sports")})}),Object(i.jsx)("dd",{children:a("administration:Enable/disable sports.")}),Object(i.jsx)("br",{}),Object(i.jsx)("dt",{children:Object(i.jsx)(te.a,{to:{pathname:"/admin/users"},children:a("administration:Users")})}),Object(i.jsx)("dd",{children:a("administration:Add/remove admin rights, delete user account.")})]})]})]})}var ne=function(e){Object(x.a)(a,e);var t=Object(g.a)(a);function a(){return Object(f.a)(this,a),t.apply(this,arguments)}return Object(O.a)(a,[{key:"componentDidMount",value:function(){this.props.loadSports()}},{key:"render",value:function(){var e=this.props,t=e.message,a=e.sports,s=e.t,n=e.updateSport;return Object(i.jsxs)("div",{children:[t&&Object(i.jsx)(_,{message:t,t:s}),Object(i.jsx)("div",{className:"row",children:Object(i.jsx)("div",{className:"col",children:Object(i.jsxs)("div",{className:"card",children:[Object(i.jsx)("div",{className:"card-header",children:Object(i.jsx)("strong",{children:s("administration:Sports")})}),Object(i.jsxs)("div",{className:"card-body",children:[a.length>0&&Object(i.jsxs)("table",{className:"table",children:[Object(i.jsx)("thead",{children:Object(i.jsxs)("tr",{children:[Object(i.jsx)("th",{children:s("administration:id")}),Object(i.jsx)("th",{children:s("administration:Image")}),Object(i.jsx)("th",{children:s("administration:Label")}),Object(i.jsx)("th",{children:s("administration:Active")}),Object(i.jsx)("th",{children:s("administration:Actions")})]})}),Object(i.jsx)("tbody",{children:a.map((function(e){return Object(i.jsxs)("tr",{children:[Object(i.jsxs)("td",{children:[Object(i.jsx)("span",{className:"heading-span-absolute",children:s("administration:id")}),e.id]}),Object(i.jsxs)("td",{children:[Object(i.jsx)("span",{className:"heading-span-absolute",children:s("administration:Image")}),Object(i.jsx)("img",{className:"admin-img",src:e.img?e.img:"/img/photo.png",alt:"sport logo"})]}),Object(i.jsxs)("td",{children:[Object(i.jsx)("span",{className:"heading-span-absolute",children:s("administration:Label")}),s("sports:".concat(e.label))]}),Object(i.jsxs)("td",{children:[Object(i.jsx)("span",{className:"heading-span-absolute",children:s("administration:Active")}),e.is_active?Object(i.jsx)("i",{className:"fa fa-check-square-o custom-fa","aria-hidden":"true","data-toggle":"tooltip"}):Object(i.jsx)("i",{className:"fa fa-square-o custom-fa","aria-hidden":"true","data-toggle":"tooltip"})]}),Object(i.jsxs)("td",{children:[Object(i.jsx)("span",{className:"heading-span-absolute",children:s("administration:Actions")}),Object(i.jsx)("input",{type:"submit",className:"btn btn-".concat(e.is_active?"dark":"primary"," btn-sm"),value:e.is_active?s("administration:Disable"):s("administration:Enable"),onClick:function(){return n(e.id,!e.is_active)}}),e.has_activities&&Object(i.jsxs)("span",{className:"admin-message",children:[Object(i.jsx)("i",{className:"fa fa-warning custom-fa","aria-hidden":"true"}),s("administration:activities exist")]})]})]},e.id)}))})]}),Object(i.jsx)("input",{type:"submit",className:"btn btn-secondary",onClick:function(){return Ii.push("/admin/")},value:s("common:Back")})]})]})})})]})}}]),a}(c.a.Component),ce=Object(y.c)((function(e){return{message:e.message,sports:e.sports.data,user:e.user}}),(function(e){return{loadSports:function(){e(K("getData","sports"))},updateSport:function(t,a){e(K("updateData","sports",{id:t,is_active:a},!1))}}}))(ne),re=function(e){Object(x.a)(a,e);var t=Object(g.a)(a);function a(){return Object(f.a)(this,a),t.apply(this,arguments)}return Object(O.a)(a,[{key:"getUrl",value:function(e){var t=this.props,a=t.query,i=t.pathname,s=Object.assign({},a),n=a.page?+a.page:1;switch(e){case"prev":n-=1;break;case"next":n+=1;break;default:n=+e}return s.page=n,H(i,s)}},{key:"render",value:function(){var e,t=this,a=this.props,s=a.pagination,n=a.t;return Object(i.jsx)(i.Fragment,{children:s&&Object.keys(s).length>0&&Object(i.jsx)("nav",{"aria-label":"Page navigation example",children:Object(i.jsxs)("ul",{className:"pagination justify-content-center",children:[Object(i.jsx)("li",{className:"page-item ".concat(s.has_prev?"":"disabled"),children:Object(i.jsx)(te.a,{className:"page-link",to:this.getUrl("prev"),"aria-disabled":!s.has_prev,children:n("common:Previous")})}),(e=s.pages,Array.from({length:e},(function(e,t){return t+1}))).map((function(e){return Object(i.jsx)("li",{className:"page-item ".concat(e===s.page?"active":""),children:Object(i.jsx)(te.a,{className:"page-link",to:t.getUrl(e),children:e})},e)})),Object(i.jsx)("li",{className:"page-item ".concat(s.has_next?"":"disabled"),children:Object(i.jsx)(te.a,{className:"page-link",to:this.getUrl("next"),"aria-disabled":!s.has_next,children:n("common:Next")})})]})})})}}]),a}(c.a.PureComponent),oe=function(e){Object(x.a)(a,e);var t=Object(g.a)(a);function a(e,i){var s;return Object(f.a)(this,a),(s=t.call(this,e,i)).state={page:null,per_page:null,order_by:"created_at",order:"asc"},s}return Object(O.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 i=H(this.props.location.pathname,a);Ii.push(i)}},{key:"render",value:function(){var e=this,t=this.props,a=t.authUser,s=t.location,n=t.message,c=t.t,r=t.pagination,o=t.updateUser,l=t.users,d=U(c,P),u=U(c,F);return Object(i.jsxs)("div",{children:[n&&Object(i.jsx)(_,{message:n,t:c}),Object(i.jsx)("div",{className:"container",children:Object(i.jsx)("div",{className:"row",children:Object(i.jsx)("div",{className:"col",children:Object(i.jsxs)("div",{className:"card",children:[Object(i.jsx)("div",{className:"card-header",children:Object(i.jsx)("strong",{children:c("administration:Users")})}),Object(i.jsxs)("div",{className:"card-body",children:[Object(i.jsxs)("div",{className:"row user-filters",children:[Object(i.jsx)("div",{className:"col-lg-4 col-md-6 col-sm-12",children:Object(i.jsxs)("label",{htmlFor:"order_by",children:[c("common:Sort by"),":"," ",Object(i.jsx)("select",{id:"order_by",name:"order_by",value:this.state.order_by,onChange:function(t){return e.updatePage("order_by",t.target.value)},children:d.map((function(e){return Object(i.jsx)("option",{value:e.key,children:e.label},e.key)}))})," "]})}),Object(i.jsx)("div",{className:"col-lg-4 col-md-6 col-sm-12",children:Object(i.jsxs)("label",{htmlFor:"sort",children:[c("common:Sort"),":"," ",Object(i.jsx)("select",{id:"sort",name:"sort",value:this.state.order,onChange:function(t){return e.updatePage("order",t.target.value)},children:u.map((function(e){return Object(i.jsx)("option",{value:e.key,children:e.label},e.key)}))})," "]})})]}),Object(i.jsxs)("table",{className:"table",children:[Object(i.jsx)("thead",{children:Object(i.jsxs)("tr",{children:[Object(i.jsx)("th",{children:"#"}),Object(i.jsx)("th",{children:c("user:Username")}),Object(i.jsx)("th",{children:c("user:Email")}),Object(i.jsx)("th",{children:c("user:Registration Date")}),Object(i.jsx)("th",{children:c("activities:Activities")}),Object(i.jsx)("th",{children:c("user:Admin")}),Object(i.jsx)("th",{children:c("administration:Actions")})]})}),Object(i.jsx)("tbody",{children:l.map((function(e){return Object(i.jsxs)("tr",{children:[Object(i.jsxs)("td",{children:[Object(i.jsx)("span",{className:"heading-span-absolute",children:"#"}),!0===e.picture?Object(i.jsx)("img",{alt:"Avatar",src:"".concat(T,"users/").concat(e.username,"/picture?").concat(Date.now()),className:"img-fluid App-nav-profile-img"}):Object(i.jsx)("i",{className:"fa fa-user-circle-o fa-2x no-picture","aria-hidden":"true"})]}),Object(i.jsxs)("td",{children:[Object(i.jsx)("span",{className:"heading-span-absolute",children:c("user:Username")}),Object(i.jsx)(te.a,{to:"/users/".concat(e.username),children:e.username})]}),Object(i.jsxs)("td",{children:[Object(i.jsx)("span",{className:"heading-span-absolute",children:c("user:Email")}),e.email]}),Object(i.jsxs)("td",{children:[Object(i.jsx)("span",{className:"heading-span-absolute",children:c("user:Registration Date")}),Object(D.a)(new Date(e.created_at),"dd/MM/yyyy HH:mm")]}),Object(i.jsxs)("td",{children:[Object(i.jsx)("span",{className:"heading-span-absolute",children:c("activities:Activities")}),e.nb_activities]}),Object(i.jsxs)("td",{children:[Object(i.jsx)("span",{className:"heading-span-absolute",children:c("user:Admin")}),e.admin?Object(i.jsx)("i",{className:"fa fa-check-square-o custom-fa","aria-hidden":"true","data-toggle":"tooltip"}):Object(i.jsx)("i",{className:"fa fa-square-o custom-fa","aria-hidden":"true","data-toggle":"tooltip"})]}),Object(i.jsxs)("td",{children:[Object(i.jsx)("span",{className:"heading-span-absolute",children:c("administration:Actions")}),Object(i.jsx)("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)}})]})]},e.username)}))})]}),Object(i.jsx)(re,{pagination:r,pathname:s.pathname,query:this.state,t:c}),Object(i.jsx)("input",{type:"submit",className:"btn btn-secondary",onClick:function(){return Ii.push("/admin/")},value:c("common:Back")})]})]})})})})]})}}]),a}(c.a.Component),le=Object(y.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(K("getData","users",t))},updateUser:function(t,a){e(K("updateData","users",{username:t,admin:a},!1))}}}))(oe),de=a(218);function ue(){var e=Object(de.a)().t;return Object(i.jsxs)("div",{children:[Object(i.jsx)(w.a,{children:Object(i.jsx)("title",{children:"fittrackee - 404"})}),Object(i.jsx)("h1",{className:"page-title",children:e("Page not found")})]})}var me=Object(k.a)()(Object(y.c)((function(e){return{appConfig:e.application.config,user:e.user}}))((function(e){var t=e.appConfig,a=e.t,s=e.user;return Object(i.jsxs)(i.Fragment,{children:[Object(i.jsx)(w.a,{children:Object(i.jsxs)("title",{children:["FitTrackee - ",a("administration:Administration")]})}),Object(i.jsx)("div",{className:"container dashboard",children:s.admin?Object(i.jsxs)(N.d,{children:[Object(i.jsx)(N.b,{exact:!0,path:"/admin",render:function(){return Object(i.jsx)(se,{appConfig:t,t:a})}}),Object(i.jsx)(N.b,{exact:!0,path:"/admin/application",render:function(){return Object(i.jsx)(ee,{appConfig:t,t:a})}}),Object(i.jsx)(N.b,{exact:!0,path:"/admin/sports",render:function(){return Object(i.jsx)(ce,{t:a})}}),Object(i.jsx)(N.b,{exact:!0,path:"/admin/users",render:function(){return Object(i.jsx)(le,{t:a})}}),Object(i.jsx)(N.b,{component:ue})]}):Object(i.jsx)(ue,{})})]})}))),je=a(466),pe=a(40),he=a(485),be=a(221),ve=a.n(be),fe=["#55a8a3","#98C3A9","#D0838A","#ECC77E","#926692","#929292","#428bca"],Oe=[{record_type:"AS",label:"Ave. speed"},{record_type:"FD",label:"Farest distance"},{record_type:"LD",label:"Longest duration"},{record_type:"MS",label:"Max. speed"}],xe=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(D.a)(e,t):null,activity_time:e?Object(D.a)(e,a):null}},ge=function(e){var t=new Date(0);return(t=Object(he.a)(t.setSeconds(e),1)).getTime()},ye=function(e){for(var t=0;ti?1:a2&&void 0!==arguments[2]&&arguments[2];return e.filter((function(e){return!a||e.is_active})).map((function(e){return Object(S.a)(Object(S.a)({},e),{},{label:t("sports:".concat(e.label))})})).sort(Ne)},ke=function(){function e(){Object(f.a)(this,e)}return Object(O.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 R(a)}},{key:"deletePicture",value:function(){return R({url:"auth/picture",method:"DELETE"})}}]),e}(),_e=function(e){return{type:"PICTURE_ERROR",message:e}},Se=function(e){return{type:"PROFILE_UPDATE_ERROR",message:e}},De=function(){return function(e){return window.localStorage.getItem("authToken")?e(Ae()):{type:"LOGOUT"}}},Ae=function(){return function(e){return q.getData("auth/profile").then((function(t){return"success"===t.status?(e(K("getData","sports")),t.data.isAuthenticated=!0,t.data.language&&e(X(t.data.language)),e({type:"PROFILE_SUCCESS",profil:t.data})):e({type:"PROFILE_ERROR",message:t.message})})).catch((function(e){throw e}))}},Ce=function(e,t){return function(a){if("register"===t||"password/update"===t){var i=function(e){var t=[];return!(arguments.length>1&&void 0!==arguments[1]&&arguments[1])&&(e.username.length<3||e.username.length>12)&&t.push("3 to 12 characters required for username."),e.password!==e.password_conf&&t.push("Password and password confirmation don't match."),e.password.length<8&&t.push("8 characters required for password."),t}(e,"password/update"===t);if(i.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}))}(i)})}return a(function(e,t){return function(a){return ke.loginOrRegisterOrPasswordReset(e,t).then((function(t){if("success"===t.status){if("password/reset-request"===e)return Ii.push({pathname:"/password-reset/sent"});if("password/update"===e)return Ii.push({pathname:"/updated-password"});if("login"===e||"register"===e)return window.localStorage.setItem("authToken",t.auth_token),"register"===e&&a(Z("config")),a(Ae())}return a({type:"AUTH_ERROR",message:t.message})})).catch((function(e){throw e}))}}(t,e))}},Ee=function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return function(a){return q.deleteData("users",e).then((function(e){204===e.status?(a(Z("config")),t?Ii.push("/admin/users"):(a({type:"LOGOUT"}),Ii.push("/"))):e.json().then((function(e){return a(G("".concat(e.message)))}))})).catch((function(e){return a(G("user|".concat(e)))}))}},Me=function(e){return{type:"SET_GPX",gpxContent:e}},Te=function(e){return{type:"SET_CHART_DATA",chartData:e}},Pe=function(e){return function(t){return q.updateData("activities",e).then((function(e){"success"===e.status?(t(De()),Ii.push("/activities/".concat(e.data.activities[0].id))):t(G("activities|".concat(e.message))),t(W(!1))})).catch((function(e){t(W(!1)),t(G("activities|".concat(e)))}))}},Fe=function(e){return function(t){return q.getData("activities",e).then((function(e){"success"===e.status?e.data.activities.length>0&&t({type:"PUSH_ACTIVITIES",activities:e.data.activities}):t(G("activities|".concat(e.message)))})).catch((function(e){return t(G("activities|".concat(e)))}))}};var ze=Object(y.c)((function(e){return{appConfig:e.application.config,loading:e.loading}}),(function(e){return{onAddActivity:function(t){e(W(!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 q.addDataWithFile("activities",e).then((function(e){"created"===e.status?0===e.data.activities.length?t(G("activities|no correct file.")):1===e.data.activities.length?(t(De()),Ii.push("/activities/".concat(e.data.activities[0].id))):(t(De()),Ii.push("/")):413===e.status?t(G("activities|File size is greater than the allowed size")):t(G("activities|".concat(e.message))),t(W(!1))})).catch((function(e){t(W(!1)),t(G("activities|".concat(e)))}))}}(a))},onEditActivity:function(t,a){e(Pe({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,s=e.loading,n=e.onAddActivity,c=e.onEditActivity,r=e.sports,o=e.t,l=t?t.sport_id:"",d=we(r,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(M(a.max_zip_file_size)),m=M(a.max_single_file_size);return Object(i.jsxs)("form",{encType:"multipart/form-data",method:"post",onSubmit:function(e){return e.preventDefault()},children:[Object(i.jsx)("div",{className:"form-group",children:Object(i.jsxs)("label",{children:[o("common:Sport"),":",Object(i.jsxs)("select",{className:"form-control input-lg",defaultValue:l,disabled:s,name:"sport",required:!0,children:[Object(i.jsx)("option",{value:""}),d.map((function(e){return Object(i.jsx)("option",{value:e.id,children:e.label},e.id)}))]})]})}),t?Object(i.jsx)("div",{className:"form-group",children:Object(i.jsxs)("label",{children:[o("activities:Title"),":",Object(i.jsx)("input",{name:"title",defaultValue:t?t.title:"",disabled:s,className:"form-control input-lg"})]})}):Object(i.jsx)("div",{className:"form-group",children:Object(i.jsxs)("label",{children:[Object(i.jsxs)(je.a,{i18nKey:"activities:gpxFile",children:[Object(i.jsx)("strong",{children:"gpx"})," file"]}),Object(i.jsx)("sup",{children:Object(i.jsx)("i",{className:"fa fa-question-circle","aria-hidden":"true","data-toggle":"tooltip",title:"".concat(o("activities:max size"),": ").concat(m)})})," ",Object(i.jsxs)(je.a,{i18nKey:"activities:zipFile",children:["or ",Object(i.jsx)("strong",{children:" zip"})," file containing ",Object(i.jsx)("strong",{children:"gpx "}),"files"]}),Object(i.jsx)("sup",{children:Object(i.jsx)("i",{className:"fa fa-question-circle","aria-hidden":"true","data-toggle":"tooltip","data-placement":"top",title:u})})," ",":",Object(i.jsx)("input",{accept:".gpx, .zip",className:"form-control form-control-file gpx-file",disabled:s,name:"gpxFile",required:!0,type:"file"})]})}),Object(i.jsx)("div",{className:"form-group",children:Object(i.jsxs)("label",{children:[o("activities:Notes"),":",Object(i.jsx)("textarea",{name:"notes",defaultValue:t?t.notes:"",disabled:s,className:"form-control input-lg",maxLength:"500"})]})}),s?Object(i.jsx)("div",{className:"loader"}):Object(i.jsxs)("div",{children:[Object(i.jsx)("input",{type:"submit",className:"btn btn-primary",onClick:function(e){return t?c(e,t):n(e)},value:o("common:Submit")}),Object(i.jsx)("input",{type:"submit",className:"btn btn-secondary",onClick:function(){return Ii.push("/")},value:o("common:Cancel")})]})]})}));var Re=Object(y.c)((function(e){return{user:e.user}}),(function(e){return{onAddOrEdit:function(t,a){var i,s=t.target.form.duration.value.split(":"),n=60*+s[0]*60+60*+s[1]+ +s[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:n,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(Pe(c))):e((i=c,function(e){return q.addData("activities/no_gpx",i).then((function(t){"created"===t.status?(e(De()),Ii.push("/activities/".concat(t.data.activities[0].id))):e(G("activities|".concat(t.message)))})).catch((function(t){return e(G("activities|".concat(t)))}))}))}}}))((function(e){var t,a,s=e.activity,n=e.onAddOrEdit,c=e.sports,r=e.t,o=e.user,l=we(c,r,!0),d="";if(s){var u=xe(L(s.activity_date,o.timezone),"yyyy-MM-dd");t=u.activity_date,a=u.activity_time,d=s.sport_id}return Object(i.jsxs)("form",{onSubmit:function(e){return e.preventDefault()},children:[Object(i.jsx)("div",{className:"form-group",children:Object(i.jsxs)("label",{children:[r("activities:Title"),":",Object(i.jsx)("input",{name:"title",defaultValue:s?s.title:"",className:"form-control input-lg"})]})}),Object(i.jsx)("div",{className:"form-group",children:Object(i.jsxs)("label",{children:[r("common:Sport"),":",Object(i.jsxs)("select",{className:"form-control input-lg",defaultValue:d,name:"sport_id",required:!0,children:[Object(i.jsx)("option",{value:""}),l.map((function(e){return Object(i.jsx)("option",{value:e.id,children:e.label},e.id)}))]})]})}),Object(i.jsx)("div",{className:"form-group",children:Object(i.jsxs)("label",{children:[r("activities:Activity Date"),":",Object(i.jsx)("div",{className:"container",children:Object(i.jsxs)("div",{className:"row",children:[Object(i.jsx)("input",{name:"activity_date",defaultValue:t,className:"form-control col-md",required:!0,type:"date"}),Object(i.jsx)("input",{name:"activity_time",defaultValue:a,className:"form-control col-md",required:!0,type:"time"})]})})]})}),Object(i.jsx)("div",{className:"form-group",children:Object(i.jsxs)("label",{children:[r("activities:Duration"),":",Object(i.jsx)("input",{name:"duration",defaultValue:s?s.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"})]})}),Object(i.jsx)("div",{className:"form-group",children:Object(i.jsxs)("label",{children:[r("activities:Distance")," (km):",Object(i.jsx)("input",{name:"distance",defaultValue:s?s.distance:"",className:"form-control input-lg",min:0,required:!0,step:"0.001",type:"number"})]})}),Object(i.jsx)("div",{className:"form-group",children:Object(i.jsxs)("label",{children:[r("activities:Notes"),":",Object(i.jsx)("textarea",{name:"notes",defaultValue:s?s.notes:"",className:"form-control input-lg",maxLength:"500"})]})}),Object(i.jsx)("input",{type:"submit",className:"btn btn-primary",onClick:function(e){return n(e,s)},value:r("common:Submit")}),Object(i.jsx)("input",{type:"submit",className:"btn btn-secondary",onClick:function(){return Ii.push("/")},value:r("common:Cancel")})]})})),Le=function(e){Object(x.a)(a,e);var t=Object(g.a)(a);function a(e,i){var s;return Object(f.a)(this,a),(s=t.call(this,e,i)).state={withGpx:!0},s}return Object(O.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,s=t.loading,n=t.message,c=t.sports,r=t.t,o=this.state.withGpx;return Object(i.jsxs)("div",{children:[Object(i.jsx)(w.a,{children:Object(i.jsxs)("title",{children:["FitTrackee -"," ",r(a?"activities:Edit a workout":"activities:Add a workout")]})}),Object(i.jsx)("br",{}),Object(i.jsx)("br",{}),Object(i.jsx)(_,{message:n,t:r}),Object(i.jsx)("div",{className:"container",children:Object(i.jsxs)("div",{className:"row",children:[Object(i.jsx)("div",{className:"col-md-2"}),Object(i.jsx)("div",{className:"col-md-8",children:Object(i.jsxs)("div",{className:"card add-activity",children:[Object(i.jsx)("h2",{className:"card-header text-center",children:r(a?"activities:Edit a workout":"activities:Add a workout")}),Object(i.jsx)("div",{className:"card-body",children:a?a.with_gpx?Object(i.jsx)(ze,{activity:a,sports:c,t:r}):Object(i.jsx)(Re,{activity:a,sports:c,t:r}):Object(i.jsxs)("div",{children:[Object(i.jsx)("form",{children:Object(i.jsxs)("div",{className:"form-group row",children:[Object(i.jsx)("div",{className:"col",children:Object(i.jsxs)("label",{className:"radioLabel",children:[Object(i.jsx)("input",{className:"add-activity-radio",type:"radio",name:"withGpx",disabled:s,checked:o,onChange:function(t){return e.handleRadioChange(t)}}),r("activities:with gpx file")]})}),Object(i.jsx)("div",{className:"col",children:Object(i.jsxs)("label",{className:"radioLabel",children:[Object(i.jsx)("input",{className:"add-activity-radio",type:"radio",name:"withoutGpx",disabled:s,checked:!o,onChange:function(t){return e.handleRadioChange(t)}}),r("activities:without gpx file")]})})]})}),o?Object(i.jsx)(ze,{sports:c,t:r}):Object(i.jsx)(Re,{sports:c,t:r})]})})]})}),Object(i.jsx)("div",{className:"col-md-2"})]})})]})}}]),a}(c.a.Component),Ie=Object(k.a)()(Object(y.c)((function(e){return{loading:e.loading}}))(Le));var Ue=Object(y.c)((function(e){return{message:e.message,sports:e.sports.data,user:e.user}}))((function(e){var t=e.message,a=e.sports;return Object(i.jsx)("div",{children:Object(i.jsx)(Ie,{activity:null,message:t,sports:a})})}));function He(e){var t=e.activity,a=e.dataType,s=e.displayModal,n=e.segmentId,c=e.sport,r=e.t,o=e.title,l=e.user,d=t?xe(L(t.activity_date,l.timezone)):null,u="segment"===a&&1!==n?"/activities/".concat(t.id,"/segment/").concat(n-1):"activity"===a&&t.previous_activity?"/activities/".concat(t.previous_activity):null,m="segment"===a&&n0?Object(i.jsxs)("div",{children:[Object(i.jsxs)("div",{className:"row chart-radio",children:[Object(i.jsxs)("label",{className:"radioLabel col-md-1",children:[Object(i.jsx)("input",{type:"radio",name:"distance",checked:o,onChange:function(e){return a.handleRadioChange(e)}}),c("activities:distance")]}),Object(i.jsxs)("label",{className:"radioLabel col-md-1",children:[Object(i.jsx)("input",{type:"radio",name:"duration",checked:!o,onChange:function(e){return a.handleRadioChange(e)}}),c("activities:duration")]})]}),Object(i.jsxs)("div",{className:"row chart-radio",children:[Object(i.jsx)("div",{className:"col-md-5"}),Object(i.jsxs)("label",{className:"radioLabel col-md-1",children:[Object(i.jsx)("input",{type:"checkbox",name:"speed",checked:this.displayData("speed"),onChange:function(e){return a.handleLegendChange(e)}}),c("activities:speed")]}),Object(i.jsxs)("label",{className:"radioLabel col-md-1",children:[Object(i.jsx)("input",{type:"checkbox",name:"elevation",checked:this.displayData("elevation"),onChange:function(e){return a.handleLegendChange(e)}}),c("activities:elevation")]}),Object(i.jsx)("div",{className:"col-md-5"})]}),Object(i.jsx)("div",{className:"row chart",children:Object(i.jsx)(qe.f,{height:300,children:Object(i.jsxs)(qe.d,{data:n,margin:{top:15,right:30,left:20,bottom:15},onMouseMove:function(e){return r(e.activePayload)},onMouseLeave:function(){return r(null)},children:[Object(i.jsx)(qe.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(D.a)(e,"HH:mm:ss")},type:"number"}),Object(i.jsx)(qe.i,{label:{value:"".concat(c("activities:speed")," (km/h)"),angle:-90,position:"left"},yAxisId:"left"}),Object(i.jsx)(qe.i,{label:{value:"".concat(c("activities:elevation")," (m)"),angle:-90,position:"right"},yAxisId:"right",orientation:"right"}),this.displayData("elevation")&&Object(i.jsx)(qe.a,{yAxisId:"right",type:"linear",dataKey:"elevation",name:c("activities:elevation"),fill:"#e5e5e5",stroke:"#cccccc",dot:!1,unit:" m"}),this.displayData("speed")&&Object(i.jsx)(qe.e,{yAxisId:"left",type:"linear",dataKey:"speed",name:c("activities:speed"),stroke:"#8884d8",strokeWidth:2,dot:!1,unit:" km/h"}),Object(i.jsx)(qe.g,{labelFormatter:function(e){return o?"".concat(c("activities:distance"),": ").concat(e," km"):"".concat(c("activities:duration"),": ").concat(Object(D.a)(e,"HH:mm:ss"))}})]})})}),Object(i.jsx)("div",{className:"chart-info",children:c("activities:data from gpx, without any cleaning")})]}):c("activities:No data to display")})}}]),a}(c.a.Component),Be=Object(y.c)((function(e){return{chartData:e.chartData}}),(function(e){return{loadActivityData:function(t){e(function(e){return function(t){if(e)return q.getData("activities/".concat(e,"/chart_data")).then((function(e){"success"===e.status?t(Te(ye(e.data.chart_data))):t(G("activities|".concat(e.message)))})).catch((function(e){return t(G("activities|".concat(e)))}));t(Te(null))}}(t))},loadSegmentData:function(t,a){e(function(e,t){return function(a){if(e)return q.getData("activities/".concat(e,"/chart_data/segment/").concat(t)).then((function(e){"success"===e.status?a(Te(ye(e.data.chart_data))):a(G("activities|".concat(e.message)))})).catch((function(e){return a(G("activities|".concat(e)))}));a(Te(null))}}(t,a))}}}))(Ve);function Ge(e){var t=e.activity,a=e.t;return Object(i.jsx)("div",{className:"container",children:t.weather_start&&t.weather_end&&Object(i.jsxs)("table",{className:"table table-borderless weather-table text-center",children:[Object(i.jsx)("thead",{children:Object(i.jsxs)("tr",{children:[Object(i.jsx)("th",{}),Object(i.jsxs)("th",{children:[a("activities:Start"),Object(i.jsx)("br",{}),Object(i.jsx)("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})]}),Object(i.jsxs)("th",{children:[a("activities:End"),Object(i.jsx)("br",{}),Object(i.jsx)("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})]})]})}),Object(i.jsxs)("tbody",{children:[Object(i.jsxs)("tr",{children:[Object(i.jsx)("td",{children:Object(i.jsx)("img",{className:"weather-img-small",src:"/img/weather/temperature.png",alt:"Temperatures"})}),Object(i.jsxs)("td",{children:[Number(t.weather_start.temperature).toFixed(1),"\xb0C"]}),Object(i.jsxs)("td",{children:[Number(t.weather_end.temperature).toFixed(1),"\xb0C"]})]}),Object(i.jsxs)("tr",{children:[Object(i.jsx)("td",{children:Object(i.jsx)("img",{className:"weather-img-small",src:"/img/weather/pour-rain.png",alt:"Temperatures"})}),Object(i.jsxs)("td",{children:[Number(100*t.weather_start.humidity).toFixed(1),"%"]}),Object(i.jsxs)("td",{children:[Number(100*t.weather_end.humidity).toFixed(1),"%"]})]}),Object(i.jsxs)("tr",{children:[Object(i.jsx)("td",{children:Object(i.jsx)("img",{className:"weather-img-small",src:"/img/weather/breeze.png",alt:"Temperatures"})}),Object(i.jsxs)("td",{children:[Number(t.weather_start.wind).toFixed(1),"m/s"]}),Object(i.jsxs)("td",{children:[Number(t.weather_end.wind).toFixed(1),"m/s"]})]})]})]})})}function We(e){var t=e.activity,a=e.t,s="0:00:00"!==t.pauses&&null!==t.pauses;return Object(i.jsxs)("div",{className:"activity-details",children:[Object(i.jsxs)("p",{children:[Object(i.jsx)("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}))&&Object(i.jsx)("sup",{children:Object(i.jsx)("i",{className:"fa fa-trophy custom-fa","aria-hidden":"true"})}),s&&Object(i.jsxs)("span",{children:[Object(i.jsx)("br",{}),"(",a("activities:pauses"),": ",t.pauses,","," ",a("activities:total duration"),": ",t.duration,")"]})]}),Object(i.jsxs)("p",{children:[Object(i.jsx)("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}))&&Object(i.jsx)("sup",{children:Object(i.jsx)("i",{className:"fa fa-trophy custom-fa","aria-hidden":"true"})})]}),Object(i.jsxs)("p",{children:[Object(i.jsx)("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}))&&Object(i.jsx)("sup",{children:Object(i.jsx)("i",{className:"fa fa-trophy custom-fa","aria-hidden":"true"})}),Object(i.jsx)("br",{}),a("activities:Max. speed"),": ",t.max_speed," km/h",t.records&&t.records.find((function(e){return"MS"===e.record_type}))&&Object(i.jsx)("sup",{children:Object(i.jsx)("i",{className:"fa fa-trophy custom-fa","aria-hidden":"true"})})]}),t.min_alt&&t.max_alt&&Object(i.jsxs)("p",{children:[Object(i.jsx)("i",{className:"fi-mountains custom-fa"}),a("activities:Min. altitude"),": ",t.min_alt,"m",Object(i.jsx)("br",{}),a("activities:Max. altitude"),": ",t.max_alt,"m"]}),t.ascent&&t.descent&&Object(i.jsxs)("p",{children:[Object(i.jsx)("i",{className:"fa fa-location-arrow custom-fa"}),a("activities:Ascent"),": ",t.ascent,"m",Object(i.jsx)("br",{}),a("activities:Descent"),": ",t.descent,"m"]}),Object(i.jsx)(Ge,{activity:t,t:a})]})}var Je=a(232),Ye=a.n(Je),Ke=a(483),Xe=a(487),$e=a(484),Ze=a(467),Qe=function(e){Object(x.a)(a,e);var t=Object(g.a)(a);function a(e,i){var s;return Object(f.a)(this,a),(s=t.call(this,e,i)).state={zoom:13},s}return Object(O.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,s=e.gpxContent,n=e.mapAttribution,c=function(e){var t;if(e){var a=(new DOMParser).parseFromString(e,"text/xml");t=ve.a.gpx(a)}return{jsonData:t}}(s).jsonData,r=[[t.bounds[0],t.bounds[1]],[t.bounds[2],t.bounds[3]]];return Object(i.jsx)("div",{children:c&&Object(i.jsxs)(Ke.a,{zoom:this.state.zoom,bounds:r,boundsOptions:{padding:[10,10]},children:[Object(i.jsx)(Xe.a,{attribution:n,url:"".concat(T,"activities/map_tile/{s}/{z}/{x}/{y}.png")}),Object(i.jsx)($e.a,{data:c},Ye()(c)),a.latitude&&Object(i.jsx)(Ze.a,{position:[a.latitude,a.longitude]})]})})}}]),a}(c.a.Component),et=Object(y.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 q.getData("activities/".concat(e,"/gpx")).then((function(e){"success"===e.status?t(Me(e.data.gpx)):t(G("activities|".concat(e.message)))})).catch((function(e){return t(G("activities|".concat(e)))}));t(Me(null))}}(t))},loadSegmentGpx:function(t,a){e(function(e,t){return function(a){if(e)return q.getData("activities/".concat(e,"/gpx/segment/").concat(t)).then((function(e){"success"===e.status?a(Me(e.data.gpx)):a(G("activities|".concat(e.message)))})).catch((function(e){return a(G("activities|".concat(e)))}));a(Me(null))}}(t,a))}}}))(Qe);function tt(e){var t=e.t;return Object(i.jsx)("div",{className:"activity-no-map text-center",children:t("activities:No Map")})}function at(e){var t=e.notes,a=e.t;return Object(i.jsx)("div",{className:"row",children:Object(i.jsx)("div",{className:"col",children:Object(i.jsx)("div",{className:"card activity-card",children:Object(i.jsxs)("div",{className:"card-body",children:["Notes",Object(i.jsx)("div",{className:"activity-notes",children:t||a("activities:No notes")})]})})})})}function it(e){var t=e.segments,a=e.t;return Object(i.jsx)("div",{className:"row",children:Object(i.jsx)("div",{className:"col",children:Object(i.jsx)("div",{className:"card activity-card",children:Object(i.jsxs)("div",{className:"card-body",children:[a("activities:Segments"),Object(i.jsx)("div",{className:"activity-segments",children:Object(i.jsx)("ul",{children:t.map((function(e,t){return Object(i.jsxs)("li",{className:"activity-segments-list",children:[Object(i.jsxs)(te.a,{to:"/activities/".concat(e.activity_id,"/segment/").concat(t+1),children:[a("activities:segment")," ",t+1]})," ","(",a("activities:distance"),": ",e.distance," km,"," ",a("activities:duration"),": ",e.duration,")"]},"segment-".concat(t))}))})})]})})})})}function st(e){var t=Object(de.a)().t;return Object(i.jsx)("div",{className:"custom-modal-backdrop",children:Object(i.jsx)("div",{className:"custom-modal",children:Object(i.jsxs)("div",{className:"modal-content",children:[Object(i.jsxs)("div",{className:"modal-header",children:[Object(i.jsx)("h5",{className:"modal-title",children:e.title}),Object(i.jsx)("button",{type:"button",className:"close","aria-label":"Close",onClick:function(){return e.close()},children:Object(i.jsx)("span",{"aria-hidden":"true",children:"\xd7"})})]}),Object(i.jsx)("div",{className:"modal-body",children:Object(i.jsx)("p",{children:e.text})}),Object(i.jsxs)("div",{className:"modal-footer",children:[Object(i.jsx)("button",{type:"button",className:"btn btn-primary",onClick:function(){return e.confirm()},children:t("common:Yes")}),Object(i.jsx)("button",{type:"button",className:"btn btn-secondary",onClick:function(){return e.close()},children:t("common:No")})]})]})})})}var nt=function(e){Object(x.a)(a,e);var t=Object(g.a)(a);function a(e,i){var s;return Object(f.a)(this,a),(s=t.call(this,e,i)).state={displayModal:!1,coordinates:{latitude:null,longitude:null}},s}return Object(O.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(S.a)(Object(S.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(S.a)(Object(S.a)({},e),{},{coordinates:t})}))}},{key:"render",value:function(){var e=this,t=this.props,a=t.activities,s=t.message,n=t.onDeleteActivity,c=t.sports,r=t.t,o=t.user,l=this.state,d=l.coordinates,u=l.displayModal,m=Object(pe.a)(a,1)[0],j=m?m.title:r("activities:Activity"),p=m?c.filter((function(e){return e.id===m.sport_id})):[],h=Object(pe.a)(p,1)[0],b=parseInt(this.props.match.params.segmentId),v=b>=0?"segment":"activity";return Object(i.jsxs)("div",{className:"activity-page",children:[Object(i.jsx)(w.a,{children:Object(i.jsxs)("title",{children:["FitTrackee - ",j]})}),s?Object(i.jsx)(_,{message:s,t:r}):Object(i.jsxs)("div",{className:"container",children:[u&&Object(i.jsx)(st,{title:r("common:Confirmation"),text:r("activities:Are you sure you want to delete this activity?"),confirm:function(){n(m.id),e.displayModal(!1)},close:function(){return e.displayModal(!1)}}),m&&h&&1===a.length&&Object(i.jsxs)("div",{children:[Object(i.jsx)("div",{className:"row",children:Object(i.jsx)("div",{className:"col",children:Object(i.jsxs)("div",{className:"card activity-card",children:[Object(i.jsx)("div",{className:"card-header",children:Object(i.jsx)(He,{activity:m,dataType:v,segmentId:b,sport:h,t:r,title:j,user:o,displayModal:function(){return e.displayModal(!0)}})}),Object(i.jsx)("div",{className:"card-body",children:Object(i.jsxs)("div",{className:"row",children:[Object(i.jsx)("div",{className:"col-md-8",children:m.with_gpx?Object(i.jsx)(et,{activity:m,coordinates:d,dataType:v,segmentId:b}):Object(i.jsx)(tt,{t:r})}),Object(i.jsx)("div",{className:"col",children:Object(i.jsx)(We,{activity:"activity"===v?m:m.segments[b-1],t:r})})]})})]})})}),m.with_gpx&&Object(i.jsx)("div",{className:"row",children:Object(i.jsx)("div",{className:"col",children:Object(i.jsx)("div",{className:"card activity-card",children:Object(i.jsx)("div",{className:"card-body",children:Object(i.jsx)("div",{className:"row",children:Object(i.jsxs)("div",{className:"col",children:[Object(i.jsx)("div",{className:"chart-title",children:r("activities:Chart")}),Object(i.jsx)(Be,{activity:m,dataType:v,segmentId:b,t:r,updateCoordinates:function(t){return e.updateCoordinates(t)}})]})})})})})}),"activity"===v&&Object(i.jsxs)(i.Fragment,{children:[Object(i.jsx)(at,{notes:m.notes,t:r}),m.segments.length>1&&Object(i.jsx)(it,{segments:m.segments,t:r})]})]})]})]})}}]),a}(c.a.Component),ct=Object(k.a)()(Object(y.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(K("getData","activities",{id:t}))},onDeleteActivity:function(t){var a;e((a=t,function(e){return q.deleteData("activities",a).then((function(t){var i;204===t.status?Promise.resolve(e((i=a,{type:"REMOVE_ACTIVITY",activityId:i}))).then((function(){return e(De())})).then((function(){return Ii.push("/")})):e(G("activities|".concat(t.status)))})).catch((function(t){return e(G("activities|".concat(t)))}))}))}}}))(nt)),rt=function(e){Object(x.a)(a,e);var t=Object(g.a)(a);function a(){return Object(f.a)(this,a),t.apply(this,arguments)}return Object(O.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,s=e.sports,n=Object(pe.a)(t,1)[0];return Object(i.jsx)("div",{children:s.length>0&&Object(i.jsx)(Ie,{activity:n,message:a,sports:s})})}}]),a}(c.a.Component),ot=Object(y.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(K("getData","activities",{id:t}))}}}))(rt);var lt=Object(y.c)((function(e){return{user:e.user}}))((function(){return Object(i.jsx)("div",{children:z()?Object(i.jsxs)(N.d,{children:[Object(i.jsx)(N.b,{exact:!0,path:"/activities/add",component:Ue}),Object(i.jsx)(N.b,{exact:!0,path:"/activities/:activityId",component:ct}),Object(i.jsx)(N.b,{exact:!0,path:"/activities/:activityId/edit",component:ot}),Object(i.jsx)(N.b,{path:"/activities/:activityId/segment/:segmentId",component:ct}),Object(i.jsx)(N.b,{component:ue})]}):Object(i.jsx)(N.a,{to:"/login"})})})),dt=function(e){Object(x.a)(a,e);var t=Object(g.a)(a);function a(){return Object(f.a)(this,a),t.apply(this,arguments)}return Object(O.a)(a,[{key:"render",value:function(){var e=this.props,t=e.loadActivities,a=e.sports,s=e.t,n=e.updateParams,c=we(a,s);return Object(i.jsx)("div",{className:"card",children:Object(i.jsx)("div",{className:"card-body activity-filter",children:Object(i.jsxs)("form",{onSubmit:function(e){return e.preventDefault()},children:[Object(i.jsxs)("div",{className:"form-group",children:[Object(i.jsxs)("label",{children:[s("activities:From"),":",Object(i.jsx)("input",{className:"form-control col-md",name:"from",onChange:function(e){return n(e)},type:"date"})]}),Object(i.jsxs)("label",{children:[s("activities:To"),":",Object(i.jsx)("input",{className:"form-control col-md",name:"to",onChange:function(e){return n(e)},type:"date"})]})]}),Object(i.jsx)("div",{className:"form-group",children:Object(i.jsxs)("label",{children:[s("common:Sport"),":",Object(i.jsxs)("select",{className:"form-control input-lg",name:"sport_id",onChange:function(e){return n(e)},children:[Object(i.jsx)("option",{value:""}),c.map((function(e){return Object(i.jsx)("option",{value:e.id,children:e.label},e.id)}))]})]})}),Object(i.jsx)("div",{className:"form-group",children:Object(i.jsxs)("label",{children:[s("activities:Distance")," (km):",Object(i.jsx)("div",{className:"container",children:Object(i.jsxs)("div",{className:"row",children:[Object(i.jsx)("div",{className:"col-5",children:Object(i.jsx)("input",{className:"form-control",min:0,name:"distance_from",onChange:function(e){return n(e)},step:"1",type:"number"})}),Object(i.jsx)("div",{className:"col-2 align-middle text-center",children:s("common:to")}),Object(i.jsx)("div",{className:"col-5",children:Object(i.jsx)("input",{className:"form-control",min:0,name:"distance_to",onChange:function(e){return n(e)},step:"1",type:"number"})})]})})]})}),Object(i.jsx)("div",{className:"form-group",children:Object(i.jsxs)("label",{children:[s("activities:Duration"),":",Object(i.jsx)("div",{className:"container",children:Object(i.jsxs)("div",{className:"row",children:[Object(i.jsx)("div",{className:"col-5",children:Object(i.jsx)("input",{className:"form-control",name:"duration_from",onChange:function(e){return n(e)},pattern:"^([0-9]*[0-9]):([0-5][0-9])$",placeholder:"hh:mm",type:"text"})}),Object(i.jsx)("div",{className:"col-2 align-middle text-center",children:s("common:to")}),Object(i.jsx)("div",{className:"col-5",children:Object(i.jsx)("input",{className:"form-control",name:"duration_to",onChange:function(e){return n(e)},pattern:"^([0-9]*[0-9]):([0-5][0-9])$",placeholder:"hh:mm",type:"text"})})]})})]})}),Object(i.jsx)("div",{className:"form-group",children:Object(i.jsxs)("label",{children:[s("activities:Average speed")," (km/h):",Object(i.jsx)("div",{className:"container",children:Object(i.jsxs)("div",{className:"row",children:[Object(i.jsx)("div",{className:"col-5",children:Object(i.jsx)("input",{className:"form-control",min:0,name:"ave_speed_from",onChange:function(e){return n(e)},step:"1",type:"number"})}),Object(i.jsx)("div",{className:"col-2 align-middle text-center",children:s("common:to")}),Object(i.jsx)("div",{className:"col-5",children:Object(i.jsx)("input",{className:"form-control",min:0,name:"ave_speed_to",onChange:function(e){return n(e)},step:"1",type:"number"})})]})})]})}),Object(i.jsx)("div",{className:"form-group",children:Object(i.jsxs)("label",{children:[s("activities:Max. speed")," (km/h):",Object(i.jsx)("div",{className:"container",children:Object(i.jsxs)("div",{className:"row",children:[Object(i.jsx)("div",{className:"col-5",children:Object(i.jsx)("input",{className:"form-control",min:0,name:"max_speed_from",onChange:function(e){return n(e)},step:"1",type:"number"})}),Object(i.jsx)("div",{className:"col-2 align-middle text-center",children:s("common:to")}),Object(i.jsx)("div",{className:"col-5",children:Object(i.jsx)("input",{className:"form-control",min:0,name:"max_speed_to",onChange:function(e){return n(e)},step:"1",type:"number"})})]})})]})}),Object(i.jsx)("input",{className:"btn btn-primary btn-lg btn-block",onClick:function(){return t()},type:"submit",value:s("activities:Filter")})]})})})}}]),a}(c.a.PureComponent),ut=function(e){Object(x.a)(a,e);var t=Object(g.a)(a);function a(){return Object(f.a)(this,a),t.apply(this,arguments)}return Object(O.a)(a,[{key:"render",value:function(){var e=this.props,t=e.activity,a=e.display;return Object(i.jsxs)("div",{className:"activity-map".concat("list"===a?"-list":""),children:[Object(i.jsx)("img",{src:"".concat(T,"activities/map/").concat(t.map,"?").concat(Date.now()),alt:"activity map"}),Object(i.jsxs)("div",{className:"map-attribution".concat("list"===a?"-list":""),children:[Object(i.jsx)("span",{className:"map-attribution-text",children:"\xa9"}),Object(i.jsx)("a",{className:"map-attribution-text",href:"http://www.openstreetmap.org/copyright",target:"_blank",rel:"noopener noreferrer",children:"OpenStreetMap"})]})]})}}]),a}(c.a.PureComponent),mt=function(e){Object(x.a)(a,e);var t=Object(g.a)(a);function a(){return Object(f.a)(this,a),t.apply(this,arguments)}return Object(O.a)(a,[{key:"render",value:function(){var e=this.props,t=e.activities,a=e.loading,s=e.sports,n=e.t,c=e.user;return Object(i.jsx)("div",{className:"card activity-card",children:Object(i.jsxs)("div",{className:"card-body",children:[Object(i.jsxs)("table",{className:"table",children:[Object(i.jsx)("thead",{children:Object(i.jsxs)("tr",{children:[Object(i.jsx)("th",{scope:"col"}),Object(i.jsx)("th",{scope:"col",children:n("common:Workout")}),Object(i.jsx)("th",{scope:"col",children:n("activities:Date")}),Object(i.jsx)("th",{scope:"col",children:n("activities:Distance")}),Object(i.jsx)("th",{scope:"col",children:n("activities:Duration")}),Object(i.jsx)("th",{scope:"col",children:n("activities:Ave. speed")}),Object(i.jsx)("th",{scope:"col",children:n("activities:Max. speed")})]})}),Object(i.jsx)("tbody",{children:!a&&s&&t.map((function(e,t){return Object(i.jsxs)("tr",{children:[Object(i.jsxs)("td",{children:[Object(i.jsx)("span",{className:"heading-span-absolute",children:n("common:Sport")}),Object(i.jsx)("img",{className:"activity-sport",src:s.filter((function(t){return t.id===e.sport_id})).map((function(e){return e.img})),alt:"activity sport logo"})]}),Object(i.jsxs)("td",{className:"activity-title",children:[Object(i.jsx)("span",{className:"heading-span-absolute",children:n("common:Workout")}),Object(i.jsx)(te.a,{to:"/activities/".concat(e.id),children:e.title}),e.map&&Object(i.jsx)(ut,{activity:e,display:"list"})]}),Object(i.jsxs)("td",{children:[Object(i.jsx)("span",{className:"heading-span-absolute",children:n("activities:Date")}),Object(D.a)(L(e.activity_date,c.timezone),"dd/MM/yyyy HH:mm")]}),Object(i.jsxs)("td",{className:"text-right",children:[Object(i.jsx)("span",{className:"heading-span-absolute",children:n("activities:Distance")}),Number(e.distance).toFixed(2)," km"]}),Object(i.jsxs)("td",{className:"text-right",children:[Object(i.jsx)("span",{className:"heading-span-absolute",children:n("activities:Duration")}),e.moving]}),Object(i.jsxs)("td",{className:"text-right",children:[Object(i.jsx)("span",{className:"heading-span-absolute",children:n("activities:Ave. speed")}),e.ave_speed," km/h"]}),Object(i.jsxs)("td",{className:"text-right",children:[Object(i.jsx)("span",{className:"heading-span-absolute",children:n("activities:Max. speed")}),e.max_speed," km/h"]})]},t)}))})]}),a&&Object(i.jsx)("div",{className:"loader"})]})})}}]),a}(c.a.PureComponent),jt=function(e){Object(x.a)(a,e);var t=Object(g.a)(a);function a(){return Object(f.a)(this,a),t.apply(this,arguments)}return Object(O.a)(a,[{key:"render",value:function(){var e=this.props.t;return Object(i.jsx)("div",{className:"card text-center",children:Object(i.jsxs)("div",{className:"card-body",children:[e("common:No workouts.")," ",Object(i.jsx)(te.a,{to:{pathname:"/activities/add"},children:e("dashboard:Upload one !")})]})})}}]),a}(c.a.PureComponent),pt=function(e){Object(x.a)(a,e);var t=Object(g.a)(a);function a(e,i){var s;return Object(f.a)(this,a),(s=t.call(this,e,i)).state={params:{page:1,per_page:10}},s}return Object(O.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,s=t.loading,n=t.loadActivities,c=t.loadMoreActivities,r=t.message,o=t.sports,l=t.t,d=t.user,u=this.state.params,m=!(a.length>0)||null===a[a.length-1].previous_activity;return Object(i.jsxs)("div",{children:[Object(i.jsx)(w.a,{children:Object(i.jsxs)("title",{children:["FitTrackee - ",l("common:Workouts")]})}),r?Object(i.jsx)(_,{message:r,t:l}):Object(i.jsx)("div",{className:"container history",children:Object(i.jsxs)("div",{className:"row",children:[Object(i.jsx)("div",{className:"col-md-3",children:Object(i.jsx)(dt,{sports:o,loadActivities:function(){return n(u)},t:l,updateParams:function(t){return e.setParams(t)}})}),Object(i.jsxs)("div",{className:"col-md-9 activities-result",children:[Object(i.jsx)(mt,{activities:a,loading:s,sports:o,t:l,user:d}),!m&&Object(i.jsx)("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&&Object(i.jsx)(jt,{t:l})]})]})})]})}}]),a}(c.a.Component),ht=Object(k.a)()(Object(y.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(K("getData","activities",t))},loadMoreActivities:function(t){e(Fe(t))}}}))(pt));var bt=Object(k.a)()(Object(y.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 ke.deletePicture().then((function(t){return 204===t.status?e(Ae()):e(_e(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(),q.addDataWithFile("auth/picture",a).then((function(e){if("success"===e.status)return t(Ae());var a=e.message.match(/file size exceeds/g)?"Error during picture update, file size exceeds max size.":e.message;return t(_e(a))})).catch((function(e){throw e}))}}(t))}}}))((function(e){var t=e.appConfig,a=e.displayModal,s=e.editable,n=e.isDeletable,c=e.message,r=e.onDeletePicture,o=e.onUploadPicture,l=e.pathname,d=e.t,u=e.user,m=u.created_at?Object(D.a)(new Date(u.created_at),"dd/MM/yyyy HH:mm"):"",j=u.birth_date?Object(D.a)(new Date(u.birth_date),"dd/MM/yyyy"):"",p=M(t.max_single_file_size);return Object(i.jsxs)("div",{children:[Object(i.jsx)(w.a,{children:Object(i.jsxs)("title",{children:["FitTrackee - ",d("user:Profile")]})}),Object(i.jsx)(_,{message:c,t:d}),Object(i.jsxs)("div",{className:"container",children:[Object(i.jsx)("h1",{className:"page-title",children:d("user:Profile")}),Object(i.jsx)("div",{className:"row",children:Object(i.jsx)("div",{className:"col-md-12",children:Object(i.jsxs)("div",{className:"card",children:[Object(i.jsx)("div",{className:"card-header userName",children:Object(i.jsx)("strong",{children:u.username})}),Object(i.jsxs)("div",{className:"card-body",children:[Object(i.jsxs)("div",{className:"row",children:[Object(i.jsxs)("div",{className:"col-md-8",children:[Object(i.jsxs)("p",{children:[Object(i.jsx)("span",{className:"user-label",children:d("user:Email")}),": ",u.email]}),Object(i.jsxs)("p",{children:[Object(i.jsx)("span",{className:"user-label",children:d("user:Registration Date")}),": ",m]}),Object(i.jsxs)("p",{children:[Object(i.jsx)("span",{className:"user-label",children:d("user:First Name")}),": ",u.first_name]}),Object(i.jsxs)("p",{children:[Object(i.jsx)("span",{className:"user-label",children:d("user:Last Name")}),": ",u.last_name]}),Object(i.jsxs)("p",{children:[Object(i.jsx)("span",{className:"user-label",children:d("user:Birth Date")}),": ",j]}),Object(i.jsxs)("p",{children:[Object(i.jsx)("span",{className:"user-label",children:d("user:Location")}),": ",u.location]}),Object(i.jsxs)("p",{children:[Object(i.jsx)("span",{className:"user-label",children:d("user:Bio")}),":"," ",u.bio]}),Object(i.jsxs)("p",{children:[Object(i.jsx)("span",{className:"user-label",children:d("user:Language")}),": ",u.language]}),Object(i.jsxs)("p",{children:[Object(i.jsx)("span",{className:"user-label",children:d("user:Timezone")}),": ",u.timezone]}),Object(i.jsxs)("p",{children:[Object(i.jsx)("span",{className:"user-label",children:d("user:First day of week")}),": ",u.weekm?d("user:Monday"):d("user:Sunday")]})]}),Object(i.jsxs)("div",{className:"col-md-4",children:[!0===u.picture&&Object(i.jsxs)("div",{children:[Object(i.jsx)("img",{alt:"Profile",src:"".concat(T,"users/").concat(u.username,"/picture")+"?".concat(Date.now()),className:"img-fluid App-profile-img-small"}),s&&Object(i.jsxs)(i.Fragment,{children:[Object(i.jsx)("br",{}),Object(i.jsx)("button",{type:"submit",onClick:function(){return r()},children:d("user:Delete picture")}),Object(i.jsx)("br",{}),Object(i.jsx)("br",{})]})]}),s&&Object(i.jsxs)("form",{encType:"multipart/form-data",onSubmit:function(e){return o(e)},children:[Object(i.jsx)("input",{type:"file",name:"picture",accept:".png,.jpg,.gif"}),Object(i.jsx)("br",{}),Object(i.jsx)("button",{type:"submit",children:d("user:Send")})," (max. size: ".concat(p,")")]})," "]})]}),s&&Object(i.jsx)("button",{className:"btn btn-primary",onClick:function(){return Ii.push("/profile/edit")},children:d("common:Edit")}),n&&Object(i.jsx)("button",{className:"btn btn-danger",onClick:function(){return a(!0)},children:d("user:Delete user account")}),Object(i.jsx)("button",{className:"btn btn-secondary",onClick:function(){return"/profile"===l?Ii.push("/"):Ii.go(-1)},children:d("/profile"===l?"common:Back to home":"common:Back")})]})]})})})]})]})})));var vt=Object(k.a)()(Object(y.c)((function(e){return{user:e.user}}))((function(e){var t=e.t,a=e.user;return Object(i.jsx)("div",{children:Object(i.jsx)(bt,{editable:!0,t:t,user:a})})})));function ft(e){var t=e.activity,a=e.sports,s=e.t,n=e.user;return Object(i.jsxs)("div",{className:"card activity-card text-center",children:[Object(i.jsx)("div",{className:"card-header",children:Object(i.jsxs)(te.a,{to:"/activities/".concat(t.id),children:[a.filter((function(e){return e.id===t.sport_id})).map((function(e){return s("sports:".concat(e.label))}))," ","-"," ",Object(D.a)(L(t.activity_date,n.timezone),"dd/MM/yyyy HH:mm")]})}),Object(i.jsx)("div",{className:"card-body",children:Object(i.jsxs)("div",{className:"row",children:[t.map&&Object(i.jsx)("div",{className:"col",children:Object(i.jsx)(ut,{activity:t})}),Object(i.jsx)("div",{className:"col",children:Object(i.jsxs)("p",{children:[Object(i.jsx)("i",{className:"fa fa-clock-o","aria-hidden":"true"})," ",s("activities:Duration"),": ",t.moving,t.map?Object(i.jsxs)("span",{children:[Object(i.jsx)("br",{}),Object(i.jsx)("br",{})]}):" - ",Object(i.jsx)("i",{className:"fa fa-road","aria-hidden":"true"})," ",s("activities:Distance"),": ",t.distance," km"]})})]})})]})}var Ot=a(468),xt=a(469),gt=a(470),yt=a(471),Nt=a(234),wt=a(238),kt=a(472),_t=a(473),St=a(110),Dt=a(474),At=a(482),Ct=a(486);function Et(e){var t=e.activity,a=e.isDisabled,s=e.isMore,n=e.sportImg;return Object(i.jsx)(te.a,{className:"calendar-activity".concat(s),to:"/activities/".concat(t.id),children:Object(i.jsxs)(i.Fragment,{children:[Object(i.jsx)("img",{alt:"activity sport logo",className:"activity-sport ".concat(a),src:n,title:t.title}),t.records.length>0&&Object(i.jsx)("sup",{children:Object(i.jsx)("i",{className:"fa fa-trophy custom-fa-small","aria-hidden":"true",title:t.records.map((function(e){return" ".concat(Oe.filter((function(t){return t.record_type===e.record_type}))[0].label)}))})})]})})}var Mt=function(e){Object(x.a)(a,e);var t=Object(g.a)(a);function a(e,i){var s;return Object(f.a)(this,a),(s=t.call(this,e,i)).state={isHidden:!0},s}return Object(O.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,s=t.isDisabled,n=t.sports,c=this.state.isHidden;return Object(i.jsxs)("div",{children:[a.map((function(e){return Object(i.jsx)(Et,{activity:e,isDisabled:s,isMore:"",sportImg:n.filter((function(t){return t.id===e.sport_id})).map((function(e){return e.img}))},e.id)})),a.length>2&&Object(i.jsx)("i",{className:"fa fa-".concat(c?"plus":"times"," calendar-more"),"aria-hidden":"true",onClick:function(){return e.handleDisplayMore()},title:"show more activities"}),!c&&Object(i.jsx)("div",{className:"calendar-display-more",children:a.map((function(e){return Object(i.jsx)(Et,{activity:e,isDisabled:s,isMore:"-more",sportImg:n.filter((function(t){return t.id===e.sport_id})).map((function(e){return e.img}))},e.id)}))})]})}}]),a}(c.a.Component),Tt=function(e,t){var a=Object(Ot.a)(e),i=Object(xt.a)(e),s=t?1:0;return{start:Object(gt.a)(a,{weekStartsOn:s}),end:Object(yt.a)(i)}},Pt=function(e){Object(x.a)(a,e);var t=Object(g.a)(a);function a(e,i){var s;Object(f.a)(this,a),s=t.call(this,e,i);var n=new Date;return s.state={currentMonth:n,startDate:Tt(n,e.weekm).start,endDate:Tt(n,e.weekm).end,weekStartOnMonday:e.weekm},s}return Object(O.a)(a,[{key:"componentDidMount",value:function(){this.props.loadMonthActivities(this.state.startDate,this.state.endDate)}},{key:"renderHeader",value:function(e){var t=this;return Object(i.jsxs)("div",{className:"header row flex-middle",children:[Object(i.jsx)("div",{className:"col col-start",onClick:function(){return t.handlePrevMonth()},children:Object(i.jsx)("i",{className:"fa fa-chevron-left","aria-hidden":"true"})}),Object(i.jsx)("div",{className:"col col-center",children:Object(i.jsx)("span",{children:Object(D.a)(this.state.currentMonth,"MMM yyyy",e)})}),Object(i.jsx)("div",{className:"col col-end",onClick:function(){return t.handleNextMonth()},children:Object(i.jsx)("i",{className:"fa fa-chevron-right","aria-hidden":"true"})})]})}},{key:"renderDays",value:function(e){for(var t=[],a=this.state.startDate,s=0;s<7;s++)t.push(Object(i.jsx)("div",{className:"col col-center",children:Object(D.a)(Object(Nt.a)(a,s),"EEE",e)},s));return Object(i.jsx)("div",{className:"days row",children:t})}},{key:"filterActivities",value:function(e){var t=this.props,a=t.activities,i=t.user;return a?a.filter((function(t){return Object(wt.a)(L(t.activity_date,i.timezone),e)})):[]}},{key:"renderCells",value:function(){for(var e=this.state,t=e.currentMonth,a=e.startDate,s=e.endDate,n=e.weekStartOnMonday,c=this.props.sports,r=[],o=[],l=a,d="";l<=s;){for(var u=0;u<7;u++){d=Object(D.a)(l,"d");var m=this.filterActivities(l),j=Object(kt.a)(l,t)?"":"-disabled",p=n?[5,6].includes(u):[0,6].includes(u);o.push(Object(i.jsx)("div",{className:"col cell ".concat(p?" weekend":"").concat(Object(_t.a)(l)?" today":""),children:Object(i.jsxs)("div",{className:"img".concat(j),children:[Object(i.jsx)("span",{className:"number",children:d}),Object(i.jsx)(Mt,{dayActivities:m,isDisabled:j,sports:c})]})},l)),l=Object(Nt.a)(l,1)}r.push(Object(i.jsx)("div",{className:"row",children:o},l)),o=[]}return Object(i.jsx)("div",{className:"body",children:r})}},{key:"updateStateDate",value:function(e){var t=Tt(e,this.state.weekStartOnMonday),a=t.start,i=t.end;this.setState({currentMonth:e,startDate:a,endDate:i}),this.props.loadMonthActivities(a,i)}},{key:"handleNextMonth",value:function(){var e=Object(St.a)(this.state.currentMonth,1);this.updateStateDate(e)}},{key:"handlePrevMonth",value:function(){var e=Object(Dt.a)(this.state.currentMonth,1);this.updateStateDate(e)}},{key:"render",value:function(){var e={locale:"fr"===this.props.language?At.a:Ct.a};return Object(i.jsx)("div",{className:"card activity-card",children:Object(i.jsxs)("div",{className:"calendar",children:[this.renderHeader(e),this.renderDays(e),this.renderCells()]})})}}]),a}(c.a.Component),Ft=Object(y.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 i,s,n="yyyy-MM-dd";e((i=Object(D.a)(t,n),s=Object(D.a)(a,n),function(e){return q.getData("activities",{from:i,to:s,order:"asc",per_page:100}).then((function(t){"success"===t.status?e({type:"UPDATE_CALENDAR",activities:t.data.activities}):e(G("activities|".concat(t.message)))})).catch((function(t){return e(G("activities|".concat(t)))}))}))}}}))(Pt);function zt(e){var t=e.records,a=e.sports,s=e.t,n=e.user,c=we(a,s),r=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 i=Oe.filter((function(t){return t.record_type===e.record_type})),s=Object(pe.a)(i,1)[0];return{activity_date:xe(L(e.activity_date,t)).activity_date,activity_id:e.activity_id,id:e.id,record_type:s.label,value:a}}(t,n.timezone)),e}),{});return Object(i.jsxs)("div",{className:"card activity-card",children:[Object(i.jsx)("div",{className:"card-header",children:s("activities:Personal records")}),Object(i.jsx)("div",{className:"card-body",children:0===Object.keys(r).length?s("common:No records."):Object.keys(r).sort().map((function(e){return Object(i.jsxs)("div",{children:[Object(i.jsxs)("span",{className:"heading-span",children:[Object(i.jsx)("img",{alt:"".concat(e," logo"),className:"record-logo",src:r[e].img}),e]}),Object(i.jsxs)("table",{className:"table table-borderless table-sm record-table",children:[Object(i.jsx)("thead",{children:Object(i.jsx)("tr",{children:Object(i.jsxs)("th",{colSpan:"3",children:[Object(i.jsx)("img",{alt:"".concat(e," logo"),className:"record-logo",src:r[e].img}),e]})})}),Object(i.jsx)("tbody",{children:r[e].records.map((function(e){return Object(i.jsxs)("tr",{className:"record-tr",children:[Object(i.jsx)("td",{className:"record-td",children:s("activities:".concat(e.record_type))}),Object(i.jsx)("td",{className:"record-td text-right",children:e.value}),Object(i.jsx)("td",{className:"record-td text-right",children:Object(i.jsx)(te.a,{to:"/activities/".concat(e.activity_id),children:e.activity_date})})]},e.id)}))})]})]},e)}))})]})}var Rt=a(235),Lt=a(475),It=[{duration:"week",dateFormat:"yyyy-MM-dd",xAxis:"dd/MM"},{duration:"month",dateFormat:"yyyy-MM",xAxis:"MM/yyyy"},{duration:"year",dateFormat:"yyyy",xAxis:"yyyy"}],Ut=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 i=String(Math.floor(e/3600)).padStart(2,"0");e%=3600;var s=String(Math.floor(e/60)).padStart(2,"0"),n=String(e%60).padStart(2,"0");return t?"".concat("0"===a?"":"".concat(a,"d:")).concat("00"===i?"":"".concat(i,"h:")).concat(s,"m:").concat(n,"s"):"".concat("00"===i?"":"".concat(i,":")).concat(s,":").concat(n)},Ht=function(e,t){return 0===t?"":"distance"===e?"".concat(t.toFixed(2)," km"):"duration"===e?Ut(t):t},qt=function(e,t){switch(e){case"week":return Object(Nt.a)(t,7);case"year":return Object(Rt.a)(t,1);case"month":default:return Object(St.a)(t,1)}},Vt=function(e,t,a,i,s){for(var n=[],c=[],r=[],o=function(s){var o=It.filter((function(e){return e.duration===a.duration})),l=Object(pe.a)(o,1)[0],d=Object(D.a)(s,l.dateFormat),u=Object(D.a)(s,l.xAxis),m={date:u},j={date:u},p={date:u};e[d]&&Object.keys(e[d]).filter((function(e){return!i||i.includes(+e)})).map((function(a){var i=t.filter((function(e){return e.id===+a}))[0].label;return m[i]=e[d][a].nb_activities,j[i]=e[d][a].total_distance,p[i]=e[d][a].total_duration,null})),n.push(m),c.push(j),r.push(p)},l=function(e,t,a){switch(e){case"week":return Object(gt.a)(t,{weekStartsOn:a?1:0});case"year":return Object(Lt.a)(t);case"month":default:return Object(Ot.a)(t)}}(a.duration,a.start,s);l<=a.end;l=qt(a.duration,l))o(l);return{activities:n,distance:c,duration:r}},Bt=function(e,t){return"duration"===e?Ut(t,!0):"distance"===e?t.toFixed(2):t};function Gt(e){if(e.active){var t=e.displayedData,a=e.payload,s=e.label,n=0;return a.map((function(e){return n+=e.value})),Object(i.jsxs)("div",{className:"custom-tooltip",children:[Object(i.jsx)("p",{className:"custom-tooltip-label",children:s}),a.map((function(e){return Object(i.jsxs)("p",{style:{color:e.fill},children:[e.name,": ",Bt(t,e.value)," ",e.unit]},e.name)})),a.length>0&&Object(i.jsxs)("p",{children:["Total: ",Bt(t,n)]})]})}return null}function Wt(e){var t=e.displayedData,a=e.x,s=e.y,n=e.width,c=e.value;if(!c)return null;var r=Ht(t,c);return Object(i.jsx)("g",{children:Object(i.jsx)("text",{x:a+n/2,y:s-10,fill:"#666",fontSize:"11",textAnchor:"middle",dominantBaseline:"middle",children:r})})}var Jt=function(e){Object(x.a)(a,e);var t=Object(g.a)(a);function a(e,i){var s;return Object(f.a)(this,a),(s=t.call(this,e,i)).state={displayedData:"distance"},s}return Object(O.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,s=a.sports,n=a.stats,c=a.t;return 0===Object.keys(n).length?c("common:No workouts."):Object(i.jsxs)("div",{className:"chart-stats",children:[Object(i.jsxs)("div",{className:"row chart-radio",children:[Object(i.jsxs)("label",{className:"radioLabel col",children:[Object(i.jsx)("input",{type:"radio",name:"distance",checked:"distance"===t,onChange:function(t){return e.handleRadioChange(t)}}),c("statistics:distance")]}),Object(i.jsxs)("label",{className:"radioLabel col",children:[Object(i.jsx)("input",{type:"radio",name:"duration",checked:"duration"===t,onChange:function(t){return e.handleRadioChange(t)}}),c("statistics:duration")]}),Object(i.jsxs)("label",{className:"radioLabel col",children:[Object(i.jsx)("input",{type:"radio",name:"activities",checked:"activities"===t,onChange:function(t){return e.handleRadioChange(t)}}),c("statistics:activities")]})]}),Object(i.jsx)(qe.f,{height:300,children:Object(i.jsxs)(qe.c,{data:n[t],margin:{top:15,bottom:0},children:[Object(i.jsx)(qe.h,{dataKey:"date",interval:0}),Object(i.jsx)(qe.i,{tickFormatter:function(e){return Ht(t,e)}}),Object(i.jsx)(qe.g,{content:Object(i.jsx)(Gt,{displayedData:t})}),s.map((function(e,a){return Object(i.jsx)(qe.b,{isAnimationActive:!1,dataKey:e.label,stackId:"a",fill:fe[a],label:a===s.length-1?Object(i.jsx)(Wt,{displayedData:t}):"",name:c("sports:".concat(e.label))},e.id)}))]})})]})}}]),a}(c.a.PureComponent),Yt=function(e){Object(x.a)(a,e);var t=Object(g.a)(a);function a(){return Object(f.a)(this,a),t.apply(this,arguments)}return Object(O.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,s=e.statistics,n=e.statsParams,c=e.displayEmpty,r=e.t,o=e.user;if(!c&&0===Object.keys(s).length)return Object(i.jsx)("span",{children:r("common:No workouts.")});var l=Vt(s,a,n,t,o.weekm);return Object(i.jsx)(Jt,{sports:a,stats:l,t:r})}}]),a}(c.a.PureComponent),Kt=Object(y.c)((function(e){return{sports:e.sports.data,statistics:e.statistics.data,user:e.user}}),(function(e){return{loadActivities:function(t,a,i){var s="yyyy-MM-dd",n="week"===i.duration?"".concat(i.duration).concat(a?"m":""):i.duration,c={from:Object(D.a)(i.start,s),to:Object(D.a)(i.end,s),time:n};e(function(e,t,a){return function(i){return q.getData("stats/".concat(e,"/").concat(t),a).then((function(e){"success"===e.status?i(V("statistics",e.data)):i(G("statistics|".concat(e.message)))})).catch((function(e){return i(G("statistics|".concat(e)))}))}}(t,i.type,c))}}}))(Yt),Xt=function(e){Object(x.a)(a,e);var t=Object(g.a)(a);function a(e,i){var s;Object(f.a)(this,a),s=t.call(this,e,i);var n=new Date;return s.state={start:Object(Ot.a)(n),end:Object(xt.a)(n),duration:"week",type:"by_time"},s}return Object(O.a)(a,[{key:"render",value:function(){var e=this.props.t;return Object(i.jsxs)("div",{className:"card activity-card",children:[Object(i.jsx)("div",{className:"card-header",children:e("dashboard:This month")}),Object(i.jsx)("div",{className:"card-body",children:Object(i.jsx)(Kt,{displayEmpty:!1,statsParams:this.state,t:e})})]})}}]),a}(c.a.Component);function $t(e){var t=e.t,a=e.user,s=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"),","),n=a.total_duration.match(/day/g)?a.total_duration.split(", ")[1]:a.total_duration;return n="".concat(n.split(":")[0],"h ").concat(n.split(":")[1],"min"),Object(i.jsxs)("div",{className:"row",children:[Object(i.jsx)("div",{className:"col-lg-3 col-md-6 col-sm-6",children:Object(i.jsx)("div",{className:"card activity-card",children:Object(i.jsxs)("div",{className:"card-body row",children:[Object(i.jsx)("div",{className:"col-3",children:Object(i.jsx)("i",{className:"fa fa-calendar fa-3x fa-color"})}),Object(i.jsxs)("div",{className:"col-9 text-right",children:[Object(i.jsx)("div",{className:"huge",children:a.nb_activities}),Object(i.jsx)("div",{children:"".concat(1===a.nb_activities?t("common:workout"):t("common:workouts"))})]})]})})}),Object(i.jsx)("div",{className:"col-lg-3 col-md-6 col-sm-6",children:Object(i.jsx)("div",{className:"card activity-card",children:Object(i.jsxs)("div",{className:"card-body row",children:[Object(i.jsx)("div",{className:"col-3",children:Object(i.jsx)("i",{className:"fa fa-road fa-3x fa-color"})}),Object(i.jsxs)("div",{className:"col-9 text-right",children:[Object(i.jsx)("div",{className:"huge",children:Number(a.total_distance).toFixed(2)}),Object(i.jsx)("div",{children:"km"})]})]})})}),Object(i.jsx)("div",{className:"col-lg-3 col-md-6 col-sm-6",children:Object(i.jsx)("div",{className:"card activity-card",children:Object(i.jsxs)("div",{className:"card-body row",children:[Object(i.jsx)("div",{className:"col-3",children:Object(i.jsx)("i",{className:"fa fa-clock-o fa-3x fa-color"})}),Object(i.jsxs)("div",{className:"col-9 text-right",children:[Object(i.jsx)("div",{className:"huge",children:s}),Object(i.jsx)("div",{children:n})]})]})})}),Object(i.jsx)("div",{className:"col-lg-3 col-md-6 col-sm-6",children:Object(i.jsx)("div",{className:"card activity-card",children:Object(i.jsxs)("div",{className:"card-body row",children:[Object(i.jsx)("div",{className:"col-3",children:Object(i.jsx)("i",{className:"fa fa-tags fa-3x fa-color"})}),Object(i.jsxs)("div",{className:"col-9 text-right",children:[Object(i.jsx)("div",{className:"huge",children:a.nb_sports}),Object(i.jsx)("div",{children:"".concat(1===a.nb_sports?t("common:sport"):t("common:sports"))})]})]})})})]})}var Zt=function(e){Object(x.a)(a,e);var t=Object(g.a)(a);function a(e,i){var s;return Object(f.a)(this,a),(s=t.call(this,e,i)).state={page:1},s}return Object(O.a)(a,[{key:"componentDidMount",value:function(){this.props.loadActivities()}},{key:"render",value:function(){var e=this,t=this.props,a=t.activities,s=t.loadMoreActivities,n=t.message,c=t.records,r=t.sports,o=t.t,l=t.user,d=!(a.length>0)||null===a[a.length-1].previous_activity,u=this.state.page;return Object(i.jsxs)("div",{children:[Object(i.jsx)(w.a,{children:Object(i.jsxs)("title",{children:["FitTrackee - ",o("common:Dashboard")]})}),n?Object(i.jsx)(_,{message:n,t:o}):a&&l.total_duration&&r.length>0&&Object(i.jsxs)("div",{className:"container dashboard",children:[Object(i.jsx)($t,{user:l,t:o}),Object(i.jsxs)("div",{className:"row",children:[Object(i.jsxs)("div",{className:"col-md-4",children:[Object(i.jsx)(Xt,{t:o}),Object(i.jsx)(zt,{t:o,records:c,sports:r,user:l})]}),Object(i.jsxs)("div",{className:"col-md-8",children:[Object(i.jsx)(Ft,{weekm:l.weekm}),a.length>0?a.map((function(e){return Object(i.jsx)(ft,{activity:e,sports:r,t:o,user:l},e.id)})):Object(i.jsx)(jt,{t:o}),!d&&Object(i.jsx)("input",{type:"submit",className:"btn btn-default btn-md btn-block",value:"Load more activities",onClick:function(){s(u+1),e.setState({page:u+1})}})]})]})]})]})}}]),a}(c.a.Component),Qt=Object(k.a)()(Object(y.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(K("getData","activities",{page:1})),e(K("getData","records"))},loadMoreActivities:function(t){e(Fe({page:t}))}}}))(Zt));function ea(){return Object(i.jsx)("footer",{className:"footer",children:Object(i.jsxs)("div",{className:"container",children:[Object(i.jsx)("strong",{children:"FitTrackee"})," v","0.4.0"," -"," ",Object(i.jsx)("a",{href:"https://github.com/SamR1/FitTrackee",target:"_blank",rel:"noopener noreferrer",children:"source code"})," ","under"," ",Object(i.jsx)("a",{href:"https://choosealicense.com/licenses/gpl-3.0/",target:"_blank",rel:"noopener noreferrer",children:"GPLv3"})," ","license -"," ",Object(i.jsx)("a",{href:"https://samr1.github.io/FitTrackee/",target:"_blank",rel:"noopener noreferrer",children:"documentation"})]})})}var ta=function(e){Object(x.a)(a,e);var t=Object(g.a)(a);function a(){return Object(f.a)(this,a),t.apply(this,arguments)}return Object(O.a)(a,[{key:"componentDidMount",value:function(){this.props.UserLogout()}},{key:"render",value:function(){return Object(i.jsx)("div",{className:"container dashboard",children:Object(i.jsxs)("div",{className:"row",children:[Object(i.jsx)("div",{className:"col-2"}),Object(i.jsx)("div",{className:"card col-8",children:Object(i.jsx)("div",{className:"card-body",children:Object(i.jsx)("div",{className:"text-center",children:Object(i.jsxs)(je.a,{i18nKey:"user:loggedOut",children:["You are now logged out. Click ",Object(i.jsx)(te.a,{to:"/login",children:"here"})," to log back in."]})})})}),Object(i.jsx)("div",{className:"col-2"})]})})}}]),a}(c.a.Component),aa=Object(y.c)((function(e){return{user:e.user}}),(function(e){return{UserLogout:function(){e({type:"LOGOUT"})}}}))(ta);function ia(){return(ia=Object.assign||function(e){for(var t=1;t=0||(s[a]=e[a]);return s}(e,t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);for(i=0;i=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(s[a]=e[a])}return s}var na=n.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"}),ca=n.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"}),ra=n.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"}),oa=n.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"}),la=n.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"}),da=n.createElement("path",{d:"m53.273 27.803 145.302 120.879v-120.879z",fill:"#406bd4"}),ua=n.createElement("path",{d:"m313.425 150.571v-122.768h148.082z",fill:"#3257b0"}),ma=n.createElement("path",{d:"m394.732 198.575 117.268-97.556v97.556z",fill:"#3257b0"}),ja=n.createElement("g",{fill:"#406bd4"},n.createElement("path",{d:"m0 99.317v99.258h119.313z"}),n.createElement("path",{d:"m0 313.425v97.699l117.44-97.699z"}),n.createElement("path",{d:"m50.49 484.197 148.085-122.676v122.676z"})),pa=n.createElement("path",{d:"m313.425 484.197v-124.139l149.221 124.139z",fill:"#3257b0"}),ha=n.createElement("path",{d:"m512 409.423-115.395-95.998h115.395z",fill:"#3257b0"}),ba=n.createElement("path",{d:"m512 222.142h-222.142v-194.339h-67.716v194.339h-222.142v67.716h222.142v194.339h67.716v-194.339h222.142z",fill:"#f40055"}),va=n.createElement("path",{d:"m289.858 222.142v-194.339h-33.858v456.394h33.858v-194.339h222.142v-67.716z",fill:"#c20044"});function fa(e,t){var a=e.title,i=e.titleId,s=sa(e,["title","titleId"]);return n.createElement("svg",ia({id:"Capa_1",enableBackground:"new 0 0 512 512",height:512,viewBox:"0 0 512 512",width:512,xmlns:"http://www.w3.org/2000/svg",ref:t,"aria-labelledby":i},s),a?n.createElement("title",{id:i},a):null,na,ca,ra,oa,la,da,ua,ma,ja,pa,ha,ba,va)}var Oa=n.forwardRef(fa);a.p;function xa(){return(xa=Object.assign||function(e){for(var t=1;t=0||(s[a]=e[a]);return s}(e,t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);for(i=0;i=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(s[a]=e[a])}return s}var ya=n.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=n.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"}),wa=n.createElement("path",{d:"m160.795 27.803h190.409v456.394h-190.409z",fill:"#f0f9ff"}),ka=n.createElement("path",{d:"m256 27.803h95.205v456.394h-95.205z",fill:"#cee5f5"});function _a(e,t){var a=e.title,i=e.titleId,s=ga(e,["title","titleId"]);return n.createElement("svg",xa({id:"Capa_1",enableBackground:"new 0 0 512 512",height:512,viewBox:"0 0 512 512",width:512,xmlns:"http://www.w3.org/2000/svg",ref:t,"aria-labelledby":i},s),a?n.createElement("title",{id:i},a):null,ya,Na,wa,ka)}var Sa=n.forwardRef(_a),Da=(a.p,[{name:"en",selected:!0,flag:Object(i.jsx)(Oa,{})},{name:"fr",selected:!1,flag:Object(i.jsx)(Sa,{})}]),Aa=function(e){Object(x.a)(a,e);var t=Object(g.a)(a);function a(e){var i;return Object(f.a)(this,a),(i=t.call(this,e)).state={isOpen:!1},i}return Object(O.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,s=a.language,n=a.onUpdateLanguage;return Object(i.jsx)("div",{className:"dropdown-wrapper",onClick:function(){return e.toggleDropdown()},children:Object(i.jsx)("ul",{className:"dropdown-list i18n-flag",children:Da.filter((function(e){return t?e:e.name===s})).map((function(e){return Object(i.jsxs)("li",{className:"dropdown-item".concat(e.name===s&&t?" dropdown-item-selected":""),onClick:function(){return n(e.name,s)},children:[e.flag," ",e.name]},e.name)}))})})}}]),a}(n.Component),Ca=Object(y.c)((function(e){return{language:e.language}}),(function(e){return{onUpdateLanguage:function(t,a){t!==a&&e(X(t))}}}))(Aa),Ea=function(e){Object(x.a)(a,e);var t=Object(g.a)(a);function a(){return Object(f.a)(this,a),t.apply(this,arguments)}return Object(O.a)(a,[{key:"render",value:function(){var e=this.props,t=e.admin,a=e.isAuthenticated,s=e.picture,n=e.t,c=e.username;return Object(i.jsx)("header",{children:Object(i.jsx)("nav",{className:"navbar navbar-expand-lg navbar-light bg-light",children:Object(i.jsxs)("div",{className:"container",children:[Object(i.jsx)("span",{className:"navbar-brand",children:"FitTrackee"}),Object(i.jsx)("button",{className:"navbar-toggler",type:"button","data-toggle":"collapse","data-target":"#navbarSupportedContent","aria-controls":"navbarSupportedContent","aria-expanded":"false","aria-label":"Toggle navigation",children:Object(i.jsx)("span",{className:"navbar-toggler-icon"})}),Object(i.jsxs)("div",{className:"collapse navbar-collapse",id:"navbarSupportedContent",children:[Object(i.jsxs)("ul",{className:"navbar-nav mr-auto",children:[Object(i.jsx)("li",{className:"nav-item",children:Object(i.jsx)(te.a,{className:"nav-link",to:{pathname:"/"},children:n("common:Dashboard")})}),a&&Object(i.jsx)("li",{className:"nav-item",children:Object(i.jsx)(te.a,{className:"nav-link",to:{pathname:"/activities/history"},children:n("Workouts")})}),a&&Object(i.jsx)("li",{className:"nav-item",children:Object(i.jsx)(te.a,{className:"nav-link",to:{pathname:"/activities/statistics"},children:n("common:Statistics")})}),t&&Object(i.jsx)("li",{className:"nav-item",children:Object(i.jsx)(te.a,{className:"nav-link",to:{pathname:"/admin"},children:"Admin"})}),a&&Object(i.jsx)("li",{className:"nav-item",children:Object(i.jsx)(te.a,{className:"nav-link",to:{pathname:"/activities/add"},children:Object(i.jsx)("strong",{children:n("common:Add workout")})})})]}),Object(i.jsxs)("ul",{className:"navbar-nav flex-row ml-md-auto d-none d-md-flex",children:[!a&&Object(i.jsx)("li",{className:"nav-item",children:Object(i.jsx)(te.a,{className:"nav-link",to:{pathname:"/register"},children:n("user:Register")})}),!a&&Object(i.jsx)("li",{className:"nav-item",children:Object(i.jsx)(te.a,{className:"nav-link",to:{pathname:"/login"},children:n("user:Login")})}),a&&Object(i.jsxs)(i.Fragment,{children:[!0===s?Object(i.jsx)("img",{alt:"Avatar",src:"".concat(T,"users/").concat(c,"/picture?").concat(Date.now()),className:"img-fluid App-nav-profile-img"}):Object(i.jsx)("i",{className:"fa fa-user-circle-o fa-2x no-picture","aria-hidden":"true"}),Object(i.jsx)("li",{className:"nav-item",children:Object(i.jsx)(te.a,{className:"nav-link",to:{pathname:"/profile"},children:c})}),Object(i.jsx)("li",{className:"nav-item",children:Object(i.jsx)(te.a,{className:"nav-link",to:{pathname:"/logout"},children:n("user:Logout")})})]}),Object(i.jsx)("li",{children:Object(i.jsx)(Ca,{})})]})]})]})})})}}]),a}(c.a.PureComponent),Ma=Object(k.a)()(Object(y.c)((function(e){var t=e.user;return{admin:t.admin,isAuthenticated:t.isAuthenticated,picture:t.picture,username:t.username}}))(Ea));function Ta(){return(Ta=Object.assign||function(e){for(var t=1;t=0||(s[a]=e[a]);return s}(e,t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);for(i=0;i=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(s[a]=e[a])}return s}var Fa=n.createElement("g",null,n.createElement("g",null,n.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"}))),za=n.createElement("g",null,n.createElement("g",null,n.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"}))),Ra=n.createElement("g",null,n.createElement("g",null,n.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"}))),La=n.createElement("g",null,n.createElement("g",null,n.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"}))),Ia=n.createElement("g",null,n.createElement("g",null,n.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"}))),Ua=n.createElement("g",null,n.createElement("g",null,n.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"}))),Ha=n.createElement("g",null,n.createElement("g",null,n.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"})));function qa(e,t){var a=e.title,i=e.titleId,s=Pa(e,["title","titleId"]);return n.createElement("svg",Ta({id:"Layer_1",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",x:"0px",y:"0px",viewBox:"0 0 512.001 512.001",style:{enableBackground:"new 0 0 512.001 512.001"},xmlSpace:"preserve",ref:t,"aria-labelledby":i},s),a?n.createElement("title",{id:i},a):null,Fa,za,Ra,La,Ia,Ua,Ha)}var Va=n.forwardRef(qa);a.p;function Ba(){return(Ba=Object.assign||function(e){for(var t=1;t=0||(s[a]=e[a]);return s}(e,t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);for(i=0;i=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(s[a]=e[a])}return s}var Wa=n.createElement("g",null,n.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"}),n.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"}),n.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"}),n.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"}));function Ja(e,t){var a=e.title,i=e.titleId,s=Ga(e,["title","titleId"]);return n.createElement("svg",Ba({id:"Capa_1",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",x:"0px",y:"0px",viewBox:"0 0 345.834 345.834",style:{enableBackground:"new 0 0 345.834 345.834"},xmlSpace:"preserve",ref:t,"aria-labelledby":i},s),a?n.createElement("title",{id:i},a):null,Wa)}var Ya=n.forwardRef(Ja);a.p;function Ka(e){var t=Object(de.a)().t,a=e.action;return Object(i.jsx)("div",{className:"container dashboard",children:Object(i.jsxs)("div",{className:"row",children:[Object(i.jsx)("div",{className:"col-2"}),Object(i.jsx)("div",{className:"card col-8",children:Object(i.jsx)("div",{className:"card-body",children:Object(i.jsxs)("div",{className:"text-center ",children:["sent"===a&&Object(i.jsxs)(i.Fragment,{children:[Object(i.jsx)("div",{className:"svg-icon",children:Object(i.jsx)(Ya,{})}),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&&Object(i.jsxs)(i.Fragment,{children:[Object(i.jsx)("div",{className:"svg-icon",children:Object(i.jsx)(Va,{})}),Object(i.jsxs)(je.a,{i18nKey:"user:updatedPasswordText",children:["Your password have been updated. Click",Object(i.jsx)(te.a,{to:"/login",children:"here"})," to log in."]})]})]})})}),Object(i.jsx)("div",{className:"col-2"})]})})}var Xa=a(236),$a=a.n(Xa),Za=function(e){Object(x.a)(a,e);var t=Object(g.a)(a);function a(e,i){var s;return Object(f.a)(this,a),(s=t.call(this,e,i)).state={formData:{},displayModal:!1},s}return Object(O.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(D.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(S.a)(Object(S.a)({},t),{},{displayModal:e})}))}},{key:"render",value:function(){var e=this,t=this.props,a=t.message,s=t.onDeleteUser,n=t.onHandleProfileFormSubmit,c=t.t,r=t.user,o=this.state,l=o.displayModal,d=o.formData;return Object(i.jsxs)("div",{children:[Object(i.jsx)(w.a,{children:Object(i.jsxs)("title",{children:["FitTrackee - ",c("user:Profile Edition")]})}),d.isAuthenticated&&Object(i.jsxs)("div",{className:"container",children:[l&&Object(i.jsx)(st,{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(){s(r.username),e.displayModal(!1)},close:function(){return e.displayModal(!1)}}),Object(i.jsx)("h1",{className:"page-title",children:c("user:Profile Edition")}),Object(i.jsxs)("div",{className:"row",children:[Object(i.jsx)("div",{className:"col-md-2"}),Object(i.jsx)("div",{className:"col-md-8",children:Object(i.jsxs)("div",{className:"card",children:[Object(i.jsx)("div",{className:"card-header",children:r.username}),Object(i.jsx)("div",{className:"card-body",children:Object(i.jsx)("div",{className:"row",children:Object(i.jsxs)("div",{className:"col-md-12",children:[Object(i.jsxs)("form",{onSubmit:function(e){e.preventDefault(),n(d)},children:[Object(i.jsx)("div",{className:"form-group",children:Object(i.jsxs)("label",{children:[c("user:Email"),":",Object(i.jsx)("input",{name:"email",className:"form-control input-lg",type:"text",value:d.email,readOnly:!0})]})}),Object(i.jsx)("div",{className:"form-group",children:Object(i.jsxs)("label",{children:[c("user:Registration Date"),":",Object(i.jsx)("input",{name:"createdAt",className:"form-control input-lg",type:"text",value:d.created_at,disabled:!0})]})}),Object(i.jsx)("div",{className:"form-group",children:Object(i.jsxs)("label",{children:[c("user:Password"),":",Object(i.jsx)("input",{name:"password",className:"form-control input-lg",type:"password",onChange:function(t){return e.handleFormChange(t)}})]})}),Object(i.jsx)("div",{className:"form-group",children:Object(i.jsxs)("label",{children:[c("user:Password Confirmation"),":",Object(i.jsx)("input",{name:"password_conf",className:"form-control input-lg",type:"password",onChange:function(t){return e.handleFormChange(t)}})]})}),Object(i.jsx)("hr",{}),Object(i.jsx)("div",{className:"form-group",children:Object(i.jsxs)("label",{children:[c("user:First Name"),":",Object(i.jsx)("input",{name:"first_name",className:"form-control input-lg",type:"text",value:d.first_name,onChange:function(t){return e.handleFormChange(t)}})]})}),Object(i.jsx)("div",{className:"form-group",children:Object(i.jsxs)("label",{children:[c("user:Last Name"),":",Object(i.jsx)("input",{name:"last_name",className:"form-control input-lg",type:"text",value:d.last_name,onChange:function(t){return e.handleFormChange(t)}})]})}),Object(i.jsx)("div",{className:"form-group",children:Object(i.jsxs)("label",{children:[c("user:Birth Date"),Object(i.jsx)("input",{name:"birth_date",className:"form-control input-lg",type:"date",value:d.birth_date,onChange:function(t){return e.handleFormChange(t)}})]})}),Object(i.jsx)("div",{className:"form-group",children:Object(i.jsxs)("label",{children:[c("user:Location"),":",Object(i.jsx)("input",{name:"location",className:"form-control input-lg",type:"text",value:d.location,onChange:function(t){return e.handleFormChange(t)}})]})}),Object(i.jsx)("div",{className:"form-group",children:Object(i.jsxs)("label",{children:[c("user:Bio"),":",Object(i.jsx)("textarea",{name:"bio",className:"form-control input-lg",maxLength:"200",value:d.bio,onChange:function(t){return e.handleFormChange(t)}})]})}),Object(i.jsx)("div",{className:"form-group",children:Object(i.jsxs)("label",{children:[c("user:Language"),":",Object(i.jsx)("select",{name:"language",className:"form-control input-lg",value:d.language,onChange:function(t){return e.handleFormChange(t)},children:Da.map((function(e){return Object(i.jsx)("option",{value:e.name,children:e.name},e.name)}))})]})}),Object(i.jsx)("div",{className:"form-group",children:Object(i.jsxs)("label",{children:[c("user:Timezone"),":",Object(i.jsx)($a.a,{className:"form-control timezone-custom",onChange:function(t){var a={target:{name:"timezone",value:t||"Europe/Paris"}};e.handleFormChange(a)},value:d.timezone})]})}),Object(i.jsx)("div",{className:"form-group",children:Object(i.jsxs)("label",{children:[c("user:First day of week"),":",Object(i.jsxs)("select",{name:"weekm",className:"form-control input-lg",value:d.weekm?"Monday":"Sunday",onChange:function(t){return e.handleFormChange(t)},children:[Object(i.jsx)("option",{value:"Sunday",children:c("user:Sunday")}),Object(i.jsx)("option",{value:"Monday",children:c("user:Monday")})]})]})}),Object(i.jsx)("button",{type:"submit",className:"btn btn-primary",children:c("common:Submit")}),Object(i.jsx)("button",{className:"btn btn-danger",onClick:function(t){t.preventDefault(),e.displayModal(!0)},children:c("user:Delete my account")}),Object(i.jsx)("button",{type:"submit",className:"btn btn-secondary",onClick:function(){return Ii.push("/profile")},children:c("common:Cancel")})]}),Object(i.jsx)(_,{message:a,t:c})]})})})]})}),Object(i.jsx)("div",{className:"col-md-2"})]})]})]})}}]),a}(c.a.Component),Qa=Object(k.a)()(Object(y.c)((function(e){return{location:e.router.location,message:e.message,user:e.user}}),(function(e){return{onDeleteUser:function(t){e(Ee(t))},onHandleProfileFormSubmit:function(t){e(function(e){return function(t){return!e.password===e.password_conf?t(Se("Password and password confirmation don't match.")):(delete e.id,q.postData("auth/profile/edit",e).then((function(e){if("success"===e.status)return t(Ae()),Ii.push("/profile");t(Se(e.message))})).catch((function(e){throw e})))}}(t))}}}))(Za)),ei=a(476),ti=a(477),ai=a(478),ii=a(237),si=["week","month","year"],ni=function(e){Object(x.a)(a,e);var t=Object(g.a)(a);function a(e,i){var s;Object(f.a)(this,a),s=t.call(this,e,i);var n=new Date;return s.state={displayedSports:e.sports.map((function(e){return e.id})),statsParams:{start:Object(Ot.a)(Object(Dt.a)(n,11)),end:Object(xt.a)(n),duration:"month",type:"by_time"}},s}return Object(O.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,i="year"===t?Object(Lt.a)(Object(ei.a)(a,9)):"week"===t?Object(Ot.a)(Object(Dt.a)(a,2)):Object(Ot.a)(Object(Dt.a)(a,11)),s="year"===t?Object(ti.a)(a):"week"===t?Object(yt.a)(a):Object(xt.a)(a);this.setState({statsParams:{duration:t,end:s,start:i,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,i=this.state.statsParams,s=i.start,n=i.end,c=i.duration;e?(t="year"===c?Object(Lt.a)(Object(ei.a)(s,1)):"week"===c?Object(gt.a)(Object(ai.a)(s,1)):Object(Ot.a)(Object(Dt.a)(s,1)),a="year"===c?Object(ti.a)(Object(ei.a)(n,1)):"week"===c?Object(yt.a)(Object(ai.a)(n,1)):Object(xt.a)(Object(Dt.a)(n,1))):(t="year"===c?Object(Lt.a)(Object(Rt.a)(s,1)):"week"===c?Object(gt.a)(Object(ii.a)(s,1)):Object(Ot.a)(Object(St.a)(s,1)),a="year"===c?Object(ti.a)(Object(Rt.a)(n,1)):"week"===c?Object(yt.a)(Object(ii.a)(n,1)):Object(xt.a)(Object(St.a)(n,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,s=t.statsParams,n=this.props,c=n.sports,r=n.t,o=n.user,l=we(c.filter((function(e){return o.sports_list.includes(e.id)})),r);return Object(i.jsxs)(i.Fragment,{children:[Object(i.jsx)(w.a,{children:Object(i.jsxs)("title",{children:["FitTrackee - ",r("statistics:Statistics")]})}),Object(i.jsxs)("div",{className:"container dashboard",children:[Object(i.jsxs)("div",{className:"card activity-card",children:[Object(i.jsx)("div",{className:"card-header",children:r("statistics:Statistics")}),Object(i.jsxs)("div",{className:"card-body".concat(0===o.nb_activities?" stats-disabled":""),children:[Object(i.jsxs)("div",{className:"chart-filters row",children:[Object(i.jsx)("div",{className:"col chart-arrows",children:Object(i.jsx)("p",{className:"text-center",children:Object(i.jsx)("i",{className:"fa fa-chevron-left","aria-hidden":"true",onClick:function(){return e.handleOnClickArrows(!0)}})})}),Object(i.jsx)("div",{className:"col-md-3 time-frames justify-content-around",children:si.map((function(t){return Object(i.jsx)("div",{className:"time-frame",children:Object(i.jsxs)("label",{children:[Object(i.jsx)("input",{type:"radio",id:t,name:t,checked:t===s.duration,onChange:function(t){return e.handleOnChangeDuration(t)}}),Object(i.jsx)("span",{children:r("statistics:".concat(t))})]})},t)}))}),Object(i.jsx)("div",{className:"col chart-arrows",children:Object(i.jsx)("p",{className:"text-center",children:Object(i.jsx)("i",{className:"fa fa-chevron-right","aria-hidden":"true",onClick:function(){return e.handleOnClickArrows(!1)}})})})]}),Object(i.jsx)(Kt,{displayEmpty:!0,displayedSports:a,statsParams:s,t:r}),Object(i.jsx)("div",{className:"row chart-activities",children:l.map((function(t){return Object(i.jsxs)("label",{className:"col activity-label",children:[Object(i.jsx)("input",{type:"checkbox",checked:a.includes(t.id),name:t.label,onChange:function(){return e.handleOnChangeSports(t.id)}}),Object(i.jsx)("span",{style:{color:fe[t.id-1]},children:" ".concat(t.label)})]},t.id)}))})]})]}),0===o.nb_activities&&Object(i.jsx)(jt,{t:r})]})]})}}]),a}(c.a.Component),ci=Object(k.a)()(Object(y.c)((function(e){return{sports:e.sports.data,user:e.user}}))(ni));function ri(e){var t=Object(de.a)().t,a="user:".concat(e.formType.charAt(0).toUpperCase()).concat(e.formType.slice(1));return Object(i.jsxs)("div",{children:[Object(i.jsx)(w.a,{children:Object(i.jsxs)("title",{children:["FitTrackee - ",t("user:".concat(e.formType))]})}),Object(i.jsx)("h1",{className:"page-title",children:t(a)}),Object(i.jsx)("div",{className:"container",children:Object(i.jsxs)("div",{className:"row",children:[Object(i.jsx)("div",{className:"col-md-3"}),Object(i.jsxs)("div",{className:"col-md-6",children:[Object(i.jsx)("br",{}),"register"!==e.formType||e.isRegistrationAllowed?Object(i.jsxs)(i.Fragment,{children:[Object(i.jsxs)("form",{onSubmit:function(t){return e.handleUserFormSubmit(t,e.formType)},children:["register"===e.formType&&Object(i.jsx)("div",{className:"form-group",children:Object(i.jsx)("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&&Object(i.jsx)("div",{className:"form-group",children:Object(i.jsx)("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&&Object(i.jsxs)(i.Fragment,{children:[Object(i.jsx)("div",{className:"form-group",children:Object(i.jsx)("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&&Object(i.jsx)("div",{className:"form-group",children:Object(i.jsx)("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})})]}),Object(i.jsx)("input",{type:"submit",className:"btn btn-primary btn-lg btn-block",value:t("Submit")})]}),Object(i.jsx)("p",{className:"password-forget",children:"login"===e.formType&&Object(i.jsx)(te.a,{to:{pathname:"/password-reset/request"},children:t("user:Forgot password?")})})]}):Object(i.jsxs)("div",{className:"card",children:[Object(i.jsx)("div",{className:"card-body",children:"Registration is disabled."}),Object(i.jsx)("div",{className:"card-body",children:Object(i.jsx)("button",{type:"submit",className:"btn btn-secondary btn-lg btn-block",onClick:function(){return Ii.go(-1)},children:"Back"})})]})]}),Object(i.jsx)("div",{className:"col-md-3"})]})})]})}var oi=function(e){Object(x.a)(a,e);var t=Object(g.a)(a);function a(e,i){var s;return Object(f.a)(this,a),(s=t.call(this,e,i)).state={formData:{username:"",email:"",password:"",password_conf:""}},s}return Object(O.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,s=t.isRegistrationAllowed,n=t.message,c=t.messages,r=t.onHandleUserFormSubmit,o=t.t,l=this.state.formData,d=this.props.location.query.token;return Object(i.jsx)("div",{children:z()||"password reset"===a&&!d?Object(i.jsx)(N.a,{to:"/"}):Object(i.jsxs)("div",{children:[Object(i.jsx)(_,{message:n,messages:c,t:o}),Object(i.jsx)(ri,{isRegistrationAllowed:s,formType:a,userForm:l,onHandleFormChange:function(t){return e.onHandleFormChange(t)},handleUserFormSubmit:function(e){e.preventDefault(),"password reset"===a&&(l.token=d),r(l,a)}})]})})}}]),a}(c.a.Component),li=Object(k.a)()(Object(y.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(Ce(t,a="password reset"===a?"password/update":"reset your password"===a?"password/reset-request":a))}}}))(oi)),di=function(e){Object(x.a)(a,e);var t=Object(g.a)(a);function a(e,i){var s;return Object(f.a)(this,a),(s=t.call(this,e,i)).state={displayModal:!1},s}return Object(O.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(S.a)(Object(S.a)({},t),{},{displayModal:e})}))}},{key:"render",value:function(){var e=this,t=this.props,a=t.t,s=t.currentUser,n=t.onDeleteUser,c=t.users,r=this.state.displayModal,o=Object(pe.a)(c,1)[0],l=!!o&&s.username===o.username;return Object(i.jsxs)("div",{children:[r&&Object(i.jsx)(st,{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(){n(o.username),e.displayModal(!1)},close:function(){return e.displayModal(!1)}}),o&&Object(i.jsx)(bt,{editable:l,isDeletable:s.admin&&!l,onDeleteUser:n,displayModal:function(t){return e.displayModal(t)},t:a,user:o})]})}}]),a}(c.a.Component),ui=Object(k.a)()(Object(y.c)((function(e){return{currentUser:e.user,users:e.users.data}}),(function(e){return{onDeleteUser:function(t){e(Ee(t,!0))},loadUser:function(t){e(K("getData","users",{username:t}))}}}))(di)),mi=function(e){Object(x.a)(a,e);var t=Object(g.a)(a);function a(e){var i;return Object(f.a)(this,a),(i=t.call(this,e)).props=e,i}return Object(O.a)(a,[{key:"componentDidMount",value:function(){this.props.loadAppConfig()}},{key:"render",value:function(){return Object(i.jsxs)("div",{className:"App",children:[Object(i.jsx)(Ma,{}),Object(i.jsxs)(N.d,{children:[Object(i.jsx)(N.b,{exact:!0,path:"/",component:Qt}),Object(i.jsx)(N.b,{exact:!0,path:"/register",render:function(){return Object(i.jsx)(li,{formType:"register"})}}),Object(i.jsx)(N.b,{exact:!0,path:"/login",render:function(){return Object(i.jsx)(li,{formType:"login"})}}),Object(i.jsx)(N.b,{exact:!0,path:"/password-reset",render:function(){return Object(i.jsx)(li,{formType:"password reset"})}}),Object(i.jsx)(N.b,{exact:!0,path:"/password-reset/request",render:function(){return Object(i.jsx)(li,{formType:"reset your password"})}}),Object(i.jsx)(N.b,{exact:!0,path:"/password-reset/sent",render:function(){return Object(i.jsx)(Ka,{action:"sent"})}}),Object(i.jsx)(N.b,{exact:!0,path:"/updated-password",render:function(){return Object(i.jsx)(Ka,{action:"updated"})}}),Object(i.jsx)(N.b,{exact:!0,path:"/password-reset/sent",component:Ka}),Object(i.jsx)(N.b,{exact:!0,path:"/logout",component:aa}),Object(i.jsx)(N.b,{exact:!0,path:"/profile/edit",component:Qa}),Object(i.jsx)(N.b,{exact:!0,path:"/profile",component:vt}),Object(i.jsx)(N.b,{exact:!0,path:"/activities/history",component:ht}),Object(i.jsx)(N.b,{exact:!0,path:"/activities/statistics",component:ci}),Object(i.jsx)(N.b,{exact:!0,path:"/users/:userName",component:ui}),Object(i.jsx)(N.b,{path:"/activities",component:lt}),Object(i.jsx)(N.b,{path:"/admin",component:me}),Object(i.jsx)(N.b,{component:ue})]}),Object(i.jsx)(ea,{})]})}}]),a}(c.a.Component),ji=Object(y.c)((function(){return{}}),(function(e){return{loadAppConfig:function(){e(Z("config"))}}}))(mi),pi=a(80);function hi(e){var t=e.store,a=e.history,s=e.children;return Object(i.jsx)(y.a,{store:t,children:Object(i.jsx)(pi.a,{history:a,children:s})})}var bi=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 vi(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 fi,Oi={data:[]},xi={language:"en",message:"",messages:[],user:{isAuthenticated:!1},activities:Object(S.a)({},Oi),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(S.a)({},Oi),chartData:[],gpx:null,loading:!1,records:Object(S.a)({},Oi),sports:Object(S.a)({},Oi),statistics:{data:{}},users:Object(S.a)({},Oi)},gi=function(e,t,a){return a.target!==t?e:"SET_DATA"===a.type?Object(S.a)(Object(S.a)({},e),{},{data:a.data[a.target]}):"SET_PAGINATED_DATA"===a.type?Object(S.a)(Object(S.a)({},e),{},{data:a.data[a.target],pagination:a.pagination}):e},yi=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:xi.activities,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"LOGOUT":return xi.activities;case"PUSH_ACTIVITIES":return Object(S.a)(Object(S.a)({},e),{},{data:e.data.concat(t.activities)});case"REMOVE_ACTIVITY":return Object(S.a)(Object(S.a)({},e),{},{data:e.data.filter((function(e){return e.id!==t.activityId}))});default:return gi(e,"activities",t)}},Ni=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:xi.application,t=arguments.length>1?arguments[1]:void 0;return"SET_APP_CONFIG"===t.type?Object(S.a)(Object(S.a)({},e),{},{config:t.data}):"SET_APP_STATS"===t.type?Object(S.a)(Object(S.a)({},e),{},{statistics:t.data}):e},wi=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:xi.calendarActivities,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"LOGOUT":return xi.calendarActivities;case"UPDATE_CALENDAR":return Object(S.a)(Object(S.a)({},e),{},{data:t.activities});default:return gi(e,"calendarActivities",t)}},ki=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:xi.chartData,t=arguments.length>1?arguments[1]:void 0;return"SET_CHART_DATA"===t.type?t.chartData:e},_i=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:xi.gpx,t=arguments.length>1?arguments[1]:void 0;return"SET_GPX"===t.type?t.gpxContent:e},Si=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:xi.language,t=arguments.length>1?arguments[1]:void 0;return"SET_LANGUAGE"===t.type?t.language:e},Di=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:xi.loading,t=arguments.length>1?arguments[1]:void 0;return"SET_LOADING"===t.type?t.loading:e},Ai=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:xi.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}},Ci=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:xi.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}},Ei=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:xi.records,t=arguments.length>1?arguments[1]:void 0;return"LOGOUT"===t.type?xi.records:gi(e,"records",t)},Mi=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:xi.sports,t=arguments.length>1?arguments[1]:void 0;return"UPDATE_SPORT_DATA"===t.type?Object(S.a)(Object(S.a)({},e),{},{data:e.data.map((function(e){return e.id===t.data.id&&(e.is_active=t.data.is_active),e}))}):gi(e,"sports",t)},Ti=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:xi.users,t=arguments.length>1?arguments[1]:void 0;return"UPDATE_USER_DATA"===t.type?Object(S.a)(Object(S.a)({},e),{},{data:e.data.map((function(e){return e.username===t.data.username&&(e.admin=t.data.admin),e}))}):gi(e,"users",t)},Pi=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:xi.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"),xi.user;case"PROFILE_SUCCESS":return t.profil;default:return e}},Fi=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:xi.statistics,t=arguments.length>1?arguments[1]:void 0;return"LOGOUT"===t.type?xi.statistics:gi(e,"statistics",t)},zi=["/login","/register","/password-reset","/password-reset/request","/password-reset/sent","/updated-password"],Ri=function(e,t){return"string"===typeof e||e instanceof String?e=t:e.pathname=t,e},Li=function(e){return window.localStorage.authToken||zi.includes(e.pathname)||(e=Ri(e,"/login")),window.localStorage.authToken&&zi.includes(e.pathname)&&(e=Ri(e,"/")),e},Ii=((fi=Object(s.a)()).location=Li(fi.location),Object(S.a)(Object(S.a)({},fi),{},{push:function(e){for(var t=arguments.length,a=new Array(t>1?t-1:0),i=1;i1?t-1:0),i=1;i