2 lines
153 KiB
JavaScript
2 lines
153 KiB
JavaScript
(this.webpackJsonpfittrackee_client=this.webpackJsonpfittrackee_client||[]).push([[0],{196:function(e){e.exports=JSON.parse('{"Workouts":"Workouts","Workout":"Workout","Workout Date":"Workout Date","Add a workout":"Add a workout","Are you sure you want to delete this workout?":"Are you sure you want to delete this workout?","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 workout":"Delete workout","Descent":"Descent","Distance":"Distance","distance":"distance","Duration":"Duration","duration":"duration","Edit a workout":"Edit a workout","Edit workout":"Edit workout","elevation":"elevation","End":"End","Farest distance":"Farest distance","Filter":"Filter","From":"From","gpxFile":"<strong>gpx</strong> 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 workout":"No next workout","No next segment":"No next segment","No notes":"No notes","No previous workout":"No previous workout","No previous segment":"No previous segment","Notes":"Notes","pauses":"pauses","Personal records":"Personal records","See next workout":"See next workout","See next segment":"See next segment","See previous workout":"See previous workout","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 <strong> zip</strong> file containing <strong>gpx </strong> files"}')},197:function(e){e.exports=JSON.parse('{"Actions":"Actions","Active":"Active","workouts exist":"workouts 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"}')},198:function(e){e.exports=JSON.parse('{"workouts count":"workouts 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"}')},199:function(e){e.exports=JSON.parse('{"Personal records":"Personal records","This month":"This month","Upload one !":"Upload one !"}')},200: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.","application":"application","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.","Max. files in a zip archive must be greater than 0":"Max. files in a zip archive must be greater than 0","Max. size of uploaded files must be greater than 0":"Max. size of uploaded files must be greater than 0","Max. size of zip archive must be equal or greater than max. size of uploaded files":"Max. size of zip archive must be equal or greater than max. size of uploaded files","Max. size of zip archive must be greater than 0":"Max. size of zip archive must be greater than 0","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 workout":"no gpx file for this workout","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, workouts exist.":"Sport can not be disabled, workouts 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.","workouts":"workouts","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."}')},201:function(e){e.exports=JSON.parse('{"Cycling (Sport)":"Cycling (Sport)","Cycling (Transport)":"Cycling (Transport)","Hiking":"Hiking","Mountain Biking":"Mountain Biking","Running":"Running","Walking":"Walking"}')},202:function(e){e.exports=JSON.parse('{"workouts":"workouts","distance":"distance","duration":"duration","month":"month","Statistics":"Statistics","year":"year","week":"week"}')},203: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</1> 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</1> to log in.","Username":"Username"}')},204:function(e){e.exports=JSON.parse('{"Workouts":"S\xe9ances","Workout":"S\xe9ance","Workout Date":"Date de l\'s\xe9ance","Add a workout":"Ajouter une s\xe9ance","Are you sure you want to delete this workout?":"Etes-vous s\xfbr de vouloir supprimer cette s\xe9ance ?","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 workout":"Supprimer l\'s\xe9ance","Descent":"D\xe9nivel\xe9 n\xe9gatif","Distance":"Distance","distance":"distance","Duration":"Dur\xe9e","duration":"dur\xe9e","Edit a workout":"Editer une s\xe9ance","Edit workout":"Editer une workout","elevation":"altitude","End":"Arriv\xe9e","Farest distance":"Distance la + longue","Filter":"Filtrer","From":"A partir de","gpxFile":"fichier <strong>gpx</strong>","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 workout":"Pas d\'s\xe9ance suivante","No next segment":"Pas de segment suivant","No notes":"Pas de notes","No previous workout":"Pas d\'s\xe9ance pr\xe9c\xe9dente","No previous segment":"Pas de segment pr\xe9c\xe9dent","Notes":"Notes","pauses":"pauses","Personal records":"Records personnels","See next workout":"Voir l\'s\xe9ance suivante","See next segment":"Voir le segment suivant","See previous workout":"Voir l\'s\xe9ance 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 <strong> zip</strong> contenant des fichiers <strong>gpx</strong>"}')},205: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","workouts exist":"des s\xe9ances 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"}')},206:function(e){e.exports=JSON.parse('{"workouts count":"nombre d\'s\xe9ances","Add workout":"Ajouter une s\xe9ance","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\'s\xe9ances.","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":"S\xe9ance","Workouts":"S\xe9ances","workout":"s\xe9ance","workouts":"s\xe9ances","Yes":"Oui","yes":"oui"}')},207:function(e){e.exports=JSON.parse('{"Personal records":"Mes records","This month":"Ce mois","Upload one !":"Ajoutez votre premi\xe8re s\xe9ance !"}')},208: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.","application":"application","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.","Max. files in a zip archive must be greater than 0":"Le nombre max. de fichiers dans une archive doit \xeatre sup\xe9rieur \xe0 0","Max. size of uploaded files must be greater than 0":"La taille max. des fichiers doit \xeatre sup\xe9rieure \xe0 0","Max. size of zip archive must be equal or greater than max. size of uploaded files":"La taille max. d\'une archive doit \xeatre sup\xe9rieure ou \xe9gale \xe0 la taille max. d\'un fichier","Max. size of zip archive must be greater than 0":"La taille max. d\'une archive doit \xeatre sup\xe9rieure \xe0 0","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 workout":"pas de fichier gpx pour cette s\xe9ance","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, workouts exist.":"Le sport ne peut \xeatre d\xe9sactiv\xe9, des s\xe9ancees 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.","workouts":"s\xe9ances","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."}')},209: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"}')},210:function(e){e.exports=JSON.parse('{"workouts":"s\xe9ances","distance":"distance","duration":"dur\xe9e","month":"mois","Statistics":"Statistiques","year":"ann\xe9e","week":"semaine"}')},211: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</1> 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</1> pour vous connecter.","Username":"Nom d\'utilisateur"}')},269:function(e,t,a){},278:function(e,t){},456:function(e,t,a){"use strict";a.r(t),a.d(t,"history",(function(){return Hs})),a.d(t,"rootNode",(function(){return Bs})),a.d(t,"store",(function(){return Gs}));var s=a(30),r=a(2),n=a.n(r),o=a(475),c=a(54),i=a.n(c),l=a(192),d=a(75),u=a(193),m=a(83),j=a(194),p=a(195),h={en:{workouts:a(196),administration:a(197),common:a(198),dashboard:a(199),messages:a(200),sports:a(201),statistics:a(202),user:a(203)},fr:{workouts:a(204),administration:a(205),common:a(206),dashboard:a(207),messages:a(208),sports:a(209),statistics:a(210),user:a(211)}};m.a.use(p.a).use(j.a).init({debug:!1,lng:"en",fallbackLng:"en",keySeparator:!1,interpolation:{escapeValue:!1},resources:h,ns:["common"],defaultNS:"common"});var b=m.a,f=a(6),O=a(7),x=a(10),g=a(9),v=a(8),k=a(20),w=(a(269),a(21)),y=a(459),N=a(1),_=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,r=""!==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(N.jsxs)("div",{className:"error-message",children:[""!==r&&Object(N.jsx)("code",{children:r}),a&&a.length>0&&(1===a.length?Object(N.jsx)("code",{children:a[0].value}):Object(N.jsx)("code",{children:Object(N.jsx)("ul",{children:a.map((function(e){return Object(N.jsx)("li",{children:s("messages:".concat(e.value))},e.id)}))})}))]})}}]),a}(n.a.PureComponent),S=a(12),D=a(477),C=a(476),E=a(215),A=["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 s=(e/Math.pow(1024,a)).toFixed(1),r=A[a];return t?"".concat(s).concat(r):{size:s,suffix:r}},T="/api/",P=[{key:"workouts_count",label:"workouts count"},{key:"admin",label:"admin rights"},{key:"created_at",label:"registration date"},{key:"username",label:"user name"}],z=[{key:"asc",label:"ascending"},{key:"desc",label:"descending"}],F=function(){return!!window.localStorage.authToken},R=function(e){var t=0;return e.map((function(e){var a={id:t,value:e};return t++,a}))},L=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 s=new Request("".concat(T).concat(e.url),a);return fetch(s).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.")}))},U=function(e,t){if(!e)return"";var a=E.DateTime.fromISO(Object(D.a)(new Date(e),"yyyy-MM-dd'T'HH:mm:ss.SSSxxx")).setZone(t);return Object(C.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(),s=t.label.toLowerCase();return a>s?1:a<s?-1:0},W=function(e,t){var a=arguments.length>2&&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,s){return a+="".concat(0===s?"":"&").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),s={url:a,method:"GET",type:"application/json"};return L(s)}},{key:"addData",value:function(e,t){return L({url:e,method:"POST",body:t,type:"application/json"})}},{key:"addDataWithFile",value:function(e,t){return L({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 L(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 L(a)}},{key:"deleteData",value:function(e,t){var a={url:"".concat(e,"/").concat(t),method:"DELETE",type:"application/json"};return L(a)}}]),e}(),B=function(e,t){return{type:"SET_DATA",data:t,target:e}},G=function(e,t,a){return{type:"SET_PAGINATED_DATA",data:t,pagination:a,target:e}},V=function(e){return{type:"SET_ERROR",message:e}},J=function(e){return{type:"SET_LOADING",loading:e}},K=function(e){return{type:"UPDATE_SPORT_DATA",data:e}},Y=function(e){return{type:"UPDATE_USER_DATA",data:e}},X=function(e,t,a){var s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];return function(r){return r(J(!0)),a&&a.id&&"workouts"!==t&&isNaN(a.id)?(r(J(!1)),r(V("".concat(t,"|Incorrect id")))):(r({type:"CLEAN_ALL_MESSAGES"}),q[e](t,a).then((function(a){if("success"===a.status)if(s){if("users"===t&&"getData"===e)return r(G(t,a.data,a.pagination));r(B(t,a.data))}else"updateData"===e&&"sports"===t?r(K(a.data.sports[0])):"updateData"===e&&"users"===t&&r(Y(a.data.users[0]));else r(V("".concat(t,"|").concat(a.message||a.status)));r(J(!1))})).catch((function(e){r(J(!1)),r(V("".concat(t,"|").concat(e)))})))}},$=function(e){return function(t){m.a.changeLanguage(e).then(t(function(e){return{type:"SET_LANGUAGE",language:e}}(e)))}},Z=function(e){return{type:"SET_APP_CONFIG",data:e}},Q=function(e){return function(t){return q.getData(e).then((function(a){"success"===a.status?"config"===e?t(Z(a.data)):"stats/all"===e&&t({type:"SET_APP_STATS",data:a.data}):t(V("application|".concat(a.message)))})).catch((function(e){return t(V("application|".concat(e)))}))}},ee=function(e){Object(x.a)(a,e);var t=Object(g.a)(a);function a(e,s){var r;return Object(f.a)(this,a),(r=t.call(this,e,s)).state={formData:{}},r}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:"render",value:function(){var e=this,t=this.props,a=t.isInEdition,s=t.loadAppConfig,r=t.message,n=t.messages,o=t.onHandleConfigFormSubmit,c=t.t,i=this.state.formData;return Object(N.jsxs)("div",{children:[(r||n)&&Object(N.jsx)(_,{message:r,messages:n,t:c}),Object.keys(i).length>0&&Object(N.jsx)("div",{className:"row",children:Object(N.jsx)("div",{className:"col-md-12",children:Object(N.jsxs)("div",{className:"card",children:[Object(N.jsx)("div",{className:"card-header",children:Object(N.jsx)("strong",{children:c("administration:Application configuration")})}),Object(N.jsx)("div",{className:"card-body",children:Object(N.jsxs)("form",{className:"app-config-form ".concat(a?"":"form-disabled"),onSubmit:function(e){e.preventDefault(),o(i)},children:[Object(N.jsxs)("div",{className:"form-group row",children:[Object(N.jsxs)("label",{className:"col-sm-6 col-form-label",htmlFor:"max_users",children:[c("administration:Max. number of active users"),Object(N.jsx)("sup",{children:Object(N.jsx)("i",{className:"fa fa-question-circle","aria-hidden":"true",title:c("administration:if 0, no limitation")})}),":"]}),Object(N.jsx)("input",{className:"col-sm-5",id:"max_users",name:"max_users",type:"number",min:"0",value:i.max_users,onChange:function(t){return e.handleFormChange(t)}})]}),Object(N.jsxs)("div",{className:"form-group row",children:[Object(N.jsxs)("label",{className:"col-sm-6 col-form-label",htmlFor:"max_single_file_size",children:[c("administration:Max. size of uploaded files (in Mb)"),":"]}),Object(N.jsx)("input",{className:"col-sm-5",id:"max_single_file_size",name:"max_single_file_size",type:"number",step:"0.1",min:"0",value:i.max_single_file_size,onChange:function(t){return e.handleFormChange(t)}})]}),Object(N.jsxs)("div",{className:"form-group row",children:[Object(N.jsxs)("label",{className:"col-sm-6 col-form-label",htmlFor:"max_zip_file_size",children:[c("administration:Max. size of zip archive (in Mb)"),":"]}),Object(N.jsx)("input",{className:"col-sm-5",id:"max_zip_file_size",name:"max_zip_file_size",type:"number",step:"0.1",min:"0",value:i.max_zip_file_size,onChange:function(t){return e.handleFormChange(t)}})]}),Object(N.jsxs)("div",{className:"form-group row",children:[Object(N.jsx)("label",{className:"col-sm-6 col-form-label",htmlFor:"gpx_limit_import",children:c("administration:Max. files of zip archive")}),Object(N.jsx)("input",{className:"col-sm-5",id:"gpx_limit_import",name:"gpx_limit_import",type:"number",min:"0",value:i.gpx_limit_import,onChange:function(t){return e.handleFormChange(t)}})]}),a?Object(N.jsxs)(N.Fragment,{children:[Object(N.jsx)("input",{type:"submit",className:"btn btn-primary",value:c("common:Submit")}),Object(N.jsx)("input",{type:"submit",className:"btn btn-secondary",onClick:function(e){e.preventDefault(),s(),Hs.push("/admin/application")},value:c("common:Cancel")})]}):Object(N.jsxs)(N.Fragment,{children:[Object(N.jsx)("input",{type:"submit",className:"btn btn-primary",onClick:function(e){e.preventDefault(),Hs.push("/admin/application/edit")},value:c("common:Edit")}),Object(N.jsx)("input",{type:"submit",className:"btn btn-secondary",onClick:function(){return Hs.push("/admin")},value:c("common:Back")})]})]})})]})})})]})}}]),a}(n.a.Component),te=Object(v.c)((function(e){return{message:e.message,messages:e.messages}}),(function(e){return{loadAppConfig:function(){e(Q("config"))},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){t({type:"CLEAN_ALL_MESSAGES"}),q.updateData("config",e).then((function(e){"success"===e.status?(t(Z(e.data)),Hs.push("/admin/application")):Array.isArray(e.message)?t({type:"APP_ERRORS",messages:R(e.message)}):t(V(e.message))})).catch((function(e){return t(V("application|".concat(e)))}))}}(a))}}}))(ee),ae=a(15),se=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(N.jsxs)("div",{className:"row",children:[Object(N.jsx)("div",{className:"col-lg-3 col-md-6 col-sm-6",children:Object(N.jsx)("div",{className:"card workout-card",children:Object(N.jsxs)("div",{className:"card-body row",children:[Object(N.jsx)("div",{className:"col-3",children:Object(N.jsx)("i",{className:"fa fa-users fa-3x fa-color"})}),Object(N.jsxs)("div",{className:"col-9 text-right",children:[Object(N.jsx)("div",{className:"huge",children:t.users?t.users:0}),Object(N.jsx)("div",{children:"".concat(1===t.users?a("administration:user"):a("administration:users"))})]})]})})}),Object(N.jsx)("div",{className:"col-lg-3 col-md-6 col-sm-6",children:Object(N.jsx)("div",{className:"card workout-card",children:Object(N.jsxs)("div",{className:"card-body row",children:[Object(N.jsx)("div",{className:"col-3",children:Object(N.jsx)("i",{className:"fa fa-tags fa-3x fa-color"})}),Object(N.jsxs)("div",{className:"col-9 text-right",children:[Object(N.jsx)("div",{className:"huge",children:t.sports?t.sports:0}),Object(N.jsx)("div",{children:"".concat(1===t.sports?a("common:sport"):a("common:sports"))})]})]})})}),Object(N.jsx)("div",{className:"col-lg-3 col-md-6 col-sm-6",children:Object(N.jsx)("div",{className:"card workout-card",children:Object(N.jsxs)("div",{className:"card-body row",children:[Object(N.jsx)("div",{className:"col-3",children:Object(N.jsx)("i",{className:"fa fa-calendar fa-3x fa-color"})}),Object(N.jsxs)("div",{className:"col-9 text-right",children:[Object(N.jsx)("div",{className:"huge",children:t.workouts?t.workouts:0}),Object(N.jsx)("div",{children:"".concat(1===t.workouts?a("common:workout"):a("common:workouts"))})]})]})})}),Object(N.jsx)("div",{className:"col-lg-3 col-md-6 col-sm-6",children:Object(N.jsx)("div",{className:"card workout-card",children:Object(N.jsxs)("div",{className:"card-body row",children:[Object(N.jsx)("div",{className:"col-3",children:Object(N.jsx)("i",{className:"fa fa-folder-open fa-3x fa-color"})}),Object(N.jsxs)("div",{className:"col-9 text-right",children:[Object(N.jsx)("div",{className:"huge",children:s.size}),Object(N.jsxs)("div",{children:[s.suffix," (",a("administration:uploads"),")"]})]})]})})})]})}}]),a}(n.a.Component),re=Object(y.a)()(Object(v.c)((function(e){return{appStats:e.application.statistics}}),(function(e){return{loadAppStats:function(){e(Q("stats/all"))}}}))(se));function ne(e){var t=e.appConfig,a=e.t;return Object(N.jsxs)("div",{className:"card workout-card",children:[Object(N.jsx)("div",{className:"card-header",children:Object(N.jsx)("strong",{children:a("administration:Administration")})}),Object(N.jsxs)("div",{className:"card-body",children:[Object(N.jsx)(re,{}),Object(N.jsx)("br",{}),Object(N.jsxs)("dl",{className:"admin-items",children:[Object(N.jsx)("dt",{children:Object(N.jsx)(ae.a,{to:{pathname:"/admin/application"},children:a("administration:Application")})}),Object(N.jsxs)("dd",{children:[a("administration:Update application configuration (maximum number of registered users, maximum files size)."),Object(N.jsx)("br",{}),Object(N.jsx)("strong",{children:a("administration:Registration is currently ".concat(t.is_registration_enabled?"enabled":"disabled","."))})]}),Object(N.jsx)("br",{}),Object(N.jsx)("dt",{children:Object(N.jsx)(ae.a,{to:{pathname:"/admin/sports"},children:a("administration:Sports")})}),Object(N.jsx)("dd",{children:a("administration:Enable/disable sports.")}),Object(N.jsx)("br",{}),Object(N.jsx)("dt",{children:Object(N.jsx)(ae.a,{to:{pathname:"/admin/users"},children:a("administration:Users")})}),Object(N.jsx)("dd",{children:a("administration:Add/remove admin rights, delete user account.")})]})]})]})}var oe=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,r=e.updateSport;return Object(N.jsxs)("div",{children:[t&&Object(N.jsx)(_,{message:t,t:s}),Object(N.jsx)("div",{className:"row",children:Object(N.jsx)("div",{className:"col",children:Object(N.jsxs)("div",{className:"card",children:[Object(N.jsx)("div",{className:"card-header",children:Object(N.jsx)("strong",{children:s("administration:Sports")})}),Object(N.jsxs)("div",{className:"card-body",children:[a.length>0&&Object(N.jsxs)("table",{className:"table",children:[Object(N.jsx)("thead",{children:Object(N.jsxs)("tr",{children:[Object(N.jsx)("th",{children:s("administration:id")}),Object(N.jsx)("th",{children:s("administration:Image")}),Object(N.jsx)("th",{children:s("administration:Label")}),Object(N.jsx)("th",{children:s("administration:Active")}),Object(N.jsx)("th",{children:s("administration:Actions")})]})}),Object(N.jsx)("tbody",{children:a.map((function(e){return Object(N.jsxs)("tr",{children:[Object(N.jsxs)("td",{children:[Object(N.jsx)("span",{className:"heading-span-absolute",children:s("administration:id")}),e.id]}),Object(N.jsxs)("td",{children:[Object(N.jsx)("span",{className:"heading-span-absolute",children:s("administration:Image")}),Object(N.jsx)("img",{className:"admin-img",src:e.img?e.img:"/img/photo.png",alt:"sport logo"})]}),Object(N.jsxs)("td",{children:[Object(N.jsx)("span",{className:"heading-span-absolute",children:s("administration:Label")}),s("sports:".concat(e.label))]}),Object(N.jsxs)("td",{children:[Object(N.jsx)("span",{className:"heading-span-absolute",children:s("administration:Active")}),e.is_active?Object(N.jsx)("i",{className:"fa fa-check-square-o custom-fa","aria-hidden":"true","data-toggle":"tooltip"}):Object(N.jsx)("i",{className:"fa fa-square-o custom-fa","aria-hidden":"true","data-toggle":"tooltip"})]}),Object(N.jsxs)("td",{children:[Object(N.jsx)("span",{className:"heading-span-absolute",children:s("administration:Actions")}),Object(N.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 r(e.id,!e.is_active)}}),e.has_workouts&&Object(N.jsxs)("span",{className:"admin-message",children:[Object(N.jsx)("i",{className:"fa fa-warning custom-fa","aria-hidden":"true"}),s("administration:workouts exist")]})]})]},e.id)}))})]}),Object(N.jsx)("input",{type:"submit",className:"btn btn-secondary",onClick:function(){return Hs.push("/admin/")},value:s("common:Back")})]})]})})})]})}}]),a}(n.a.Component),ce=Object(v.c)((function(e){return{message:e.message,sports:e.sports.data,user:e.user}}),(function(e){return{loadSports:function(){e(X("getData","sports"))},updateSport:function(t,a){e(X("updateData","sports",{id:t,is_active:a},!1))}}}))(oe),ie=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,s=t.pathname,r=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 r.page=n,H(s,r)}},{key:"render",value:function(){var e,t=this,a=this.props,s=a.pagination,r=a.t;return Object(N.jsx)(N.Fragment,{children:s&&Object.keys(s).length>0&&Object(N.jsx)("nav",{"aria-label":"Page navigation example",children:Object(N.jsxs)("ul",{className:"pagination justify-content-center",children:[Object(N.jsx)("li",{className:"page-item ".concat(s.has_prev?"":"disabled"),children:Object(N.jsx)(ae.a,{className:"page-link",to:this.getUrl("prev"),"aria-disabled":!s.has_prev,children:r("common:Previous")})}),(e=s.pages,Array.from({length:e},(function(e,t){return t+1}))).map((function(e){return Object(N.jsx)("li",{className:"page-item ".concat(e===s.page?"active":""),children:Object(N.jsx)(ae.a,{className:"page-link",to:t.getUrl(e),children:e})},e)})),Object(N.jsx)("li",{className:"page-item ".concat(s.has_next?"":"disabled"),children:Object(N.jsx)(ae.a,{className:"page-link",to:this.getUrl("next"),"aria-disabled":!s.has_next,children:r("common:Next")})})]})})})}}]),a}(n.a.PureComponent),le=function(e){Object(x.a)(a,e);var t=Object(g.a)(a);function a(e,s){var r;return Object(f.a)(this,a),(r=t.call(this,e,s)).state={page:null,per_page:null,order_by:"created_at",order:"asc"},r}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 s=H(this.props.location.pathname,a);Hs.push(s)}},{key:"render",value:function(){var e=this,t=this.props,a=t.authUser,s=t.location,r=t.message,n=t.t,o=t.pagination,c=t.updateUser,i=t.users,l=W(n,P),d=W(n,z);return Object(N.jsxs)("div",{children:[r&&Object(N.jsx)(_,{message:r,t:n}),Object(N.jsx)("div",{className:"container",children:Object(N.jsx)("div",{className:"row",children:Object(N.jsx)("div",{className:"col",children:Object(N.jsxs)("div",{className:"card",children:[Object(N.jsx)("div",{className:"card-header",children:Object(N.jsx)("strong",{children:n("administration:Users")})}),Object(N.jsxs)("div",{className:"card-body",children:[Object(N.jsxs)("div",{className:"row user-filters",children:[Object(N.jsx)("div",{className:"col-lg-4 col-md-6 col-sm-12",children:Object(N.jsxs)("label",{htmlFor:"order_by",children:[n("common:Sort by"),":"," ",Object(N.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:l.map((function(e){return Object(N.jsx)("option",{value:e.key,children:e.label},e.key)}))})," "]})}),Object(N.jsx)("div",{className:"col-lg-4 col-md-6 col-sm-12",children:Object(N.jsxs)("label",{htmlFor:"sort",children:[n("common:Sort"),":"," ",Object(N.jsx)("select",{id:"sort",name:"sort",value:this.state.order,onChange:function(t){return e.updatePage("order",t.target.value)},children:d.map((function(e){return Object(N.jsx)("option",{value:e.key,children:e.label},e.key)}))})," "]})})]}),Object(N.jsxs)("table",{className:"table",children:[Object(N.jsx)("thead",{children:Object(N.jsxs)("tr",{children:[Object(N.jsx)("th",{children:"#"}),Object(N.jsx)("th",{children:n("user:Username")}),Object(N.jsx)("th",{children:n("user:Email")}),Object(N.jsx)("th",{children:n("user:Registration Date")}),Object(N.jsx)("th",{children:n("workouts:Workouts")}),Object(N.jsx)("th",{children:n("user:Admin")}),Object(N.jsx)("th",{children:n("administration:Actions")})]})}),Object(N.jsx)("tbody",{children:i.map((function(e){return Object(N.jsxs)("tr",{children:[Object(N.jsxs)("td",{children:[Object(N.jsx)("span",{className:"heading-span-absolute",children:"#"}),!0===e.picture?Object(N.jsx)("img",{alt:"Avatar",src:"".concat(T,"users/").concat(e.username,"/picture?").concat(Date.now()),className:"img-fluid App-nav-profile-img"}):Object(N.jsx)("i",{className:"fa fa-user-circle-o fa-2x no-picture","aria-hidden":"true"})]}),Object(N.jsxs)("td",{children:[Object(N.jsx)("span",{className:"heading-span-absolute",children:n("user:Username")}),Object(N.jsx)(ae.a,{to:"/users/".concat(e.username),children:e.username})]}),Object(N.jsxs)("td",{children:[Object(N.jsx)("span",{className:"heading-span-absolute",children:n("user:Email")}),e.email]}),Object(N.jsxs)("td",{children:[Object(N.jsx)("span",{className:"heading-span-absolute",children:n("user:Registration Date")}),Object(D.a)(new Date(e.created_at),"dd/MM/yyyy HH:mm")]}),Object(N.jsxs)("td",{children:[Object(N.jsx)("span",{className:"heading-span-absolute",children:n("workouts:Workouts")}),e.nb_workouts]}),Object(N.jsxs)("td",{children:[Object(N.jsx)("span",{className:"heading-span-absolute",children:n("user:Admin")}),e.admin?Object(N.jsx)("i",{className:"fa fa-check-square-o custom-fa","aria-hidden":"true","data-toggle":"tooltip"}):Object(N.jsx)("i",{className:"fa fa-square-o custom-fa","aria-hidden":"true","data-toggle":"tooltip"})]}),Object(N.jsxs)("td",{children:[Object(N.jsx)("span",{className:"heading-span-absolute",children:n("administration:Actions")}),Object(N.jsx)("input",{type:"submit",className:"btn btn-".concat(e.admin?"dark":"primary"," btn-sm"),disabled:e.username===a.username,value:e.admin?n("administration:Remove admin rights"):n("administration:Add admin rights"),onClick:function(){return c(e.username,!e.admin)}})]})]},e.username)}))})]}),Object(N.jsx)(ie,{pagination:o,pathname:s.pathname,query:this.state,t:n}),Object(N.jsx)("input",{type:"submit",className:"btn btn-secondary",onClick:function(){return Hs.push("/admin/")},value:n("common:Back")})]})]})})})})]})}}]),a}(n.a.Component),de=Object(v.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(X("getData","users",t))},updateUser:function(t,a){e(X("updateData","users",{username:t,admin:a},!1))}}}))(le),ue=a(216);function me(){var e=Object(ue.a)().t;return Object(N.jsxs)("div",{children:[Object(N.jsx)(w.a,{children:Object(N.jsx)("title",{children:"fittrackee - 404"})}),Object(N.jsx)("h1",{className:"page-title",children:e("Page not found")})]})}var je=Object(y.a)()(Object(v.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(N.jsxs)(N.Fragment,{children:[Object(N.jsx)(w.a,{children:Object(N.jsxs)("title",{children:["FitTrackee - ",a("administration:Administration")]})}),Object(N.jsx)("div",{className:"container dashboard",children:s.admin?Object(N.jsxs)(k.d,{children:[Object(N.jsx)(k.b,{exact:!0,path:"/admin",render:function(){return Object(N.jsx)(ne,{appConfig:t,t:a})}}),Object(N.jsx)(k.b,{exact:!0,path:"/admin/application",render:function(){return Object(N.jsx)(te,{appConfig:t,t:a,isInEdition:!1})}}),Object(N.jsx)(k.b,{exact:!0,path:"/admin/application/edit",render:function(){return Object(N.jsx)(te,{appConfig:t,t:a,isInEdition:!0})}}),Object(N.jsx)(k.b,{exact:!0,path:"/admin/sports",render:function(){return Object(N.jsx)(ce,{t:a})}}),Object(N.jsx)(k.b,{exact:!0,path:"/admin/users",render:function(){return Object(N.jsx)(de,{t:a})}}),Object(N.jsx)(k.b,{component:me})]}):Object(N.jsx)(me,{})})]})}))),pe=a(479),he=a(25),be=a(480),fe=a(219),Oe=a.n(fe),xe=["#55a8a3","#98C3A9","#D0838A","#ECC77E","#926692","#929292","#428bca"],ge=[{record_type:"AS",label:"Ave. speed"},{record_type:"FD",label:"Farest distance"},{record_type:"LD",label:"Longest duration"},{record_type:"MS",label:"Max. speed"}],ve=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"),{workout_date:e?Object(D.a)(e,t):null,workout_time:e?Object(D.a)(e,a):null}},ke=function(e){var t=new Date(0);return(t=Object(be.a)(t.setSeconds(e),1)).getTime()},we=function(e){for(var t=0;t<e.length;t++)e[t].time=new Date(e[t].time).getTime(),e[t].duration=ke(e[t].duration);return e},ye=function(e,t){var a=e.label.toLowerCase(),s=t.label.toLowerCase();return a>s?1:a<s?-1:0},Ne=function(e,t){var a=arguments.length>2&&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(ye)},_e=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 L(a)}},{key:"deletePicture",value:function(){return L({url:"auth/picture",method:"DELETE"})}}]),e}(),Se=function(e){return{type:"PICTURE_ERROR",message:e}},De=function(e){return{type:"PROFILE_UPDATE_ERROR",message:e}},Ce=function(){return function(e){return window.localStorage.getItem("authToken")?e(Ee()):{type:"LOGOUT"}}},Ee=function(){return function(e){return q.getData("auth/profile").then((function(t){return"success"===t.status?(e(X("getData","sports")),t.data.isAuthenticated=!0,t.data.language&&e($(t.data.language)),e({type:"PROFILE_SUCCESS",profil:t.data})):e({type:"PROFILE_ERROR",message:t.message})})).catch((function(e){throw e}))}},Ae=function(e,t){return function(a){if("register"===t||"password/update"===t){var s=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(s.length>0)return a({type:"AUTH_ERRORS",messages:R(s)})}return a(function(e,t){return function(a){return _e.loginOrRegisterOrPasswordReset(e,t).then((function(t){if("success"===t.status){if("password/reset-request"===e)return Hs.push({pathname:"/password-reset/sent"});if("password/update"===e)return Hs.push({pathname:"/updated-password"});if("login"===e||"register"===e)return window.localStorage.setItem("authToken",t.auth_token),"register"===e&&a(Q("config")),a(Ee())}return a({type:"AUTH_ERROR",message:t.message})})).catch((function(e){throw e}))}}(t,e))}},Me=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(Q("config")),t?Hs.push("/admin/users"):(a({type:"LOGOUT"}),Hs.push("/"))):e.json().then((function(e){return a(V("".concat(e.message)))}))})).catch((function(e){return a(V("user|".concat(e)))}))}},Te=function(e){return{type:"SET_GPX",gpxContent:e}},Pe=function(e){return{type:"SET_CHART_DATA",chartData:e}},ze=function(e){return function(t){return q.updateData("workouts",e).then((function(e){"success"===e.status?(t(Ce()),Hs.push("/workouts/".concat(e.data.workouts[0].id))):t(V("workouts|".concat(e.message))),t(J(!1))})).catch((function(e){t(J(!1)),t(V("workouts|".concat(e)))}))}},Fe=function(e){return function(t){return q.getData("workouts",e).then((function(e){"success"===e.status?e.data.workouts.length>0&&t({type:"PUSH_WORKOUTS",workouts:e.data.workouts}):t(V("workouts|".concat(e.message)))})).catch((function(e){return t(V("workouts|".concat(e)))}))}};var Re=Object(v.c)((function(e){return{appConfig:e.application.config,loading:e.loading}}),(function(e){return{onAddWorkout:function(t){e(J(!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("workouts",e).then((function(e){"created"===e.status?0===e.data.workouts.length?t(V("workouts|no correct file.")):1===e.data.workouts.length?(t(Ce()),Hs.push("/workouts/".concat(e.data.workouts[0].id))):(t(Ce()),Hs.push("/")):413===e.status?t(V("workouts|File size is greater than the allowed size")):t(V("workouts|".concat(e.message))),t(J(!1))})).catch((function(e){t(J(!1)),t(V("workouts|".concat(e)))}))}}(a))},onEditWorkout:function(t,a){e(ze({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.appConfig,a=e.loading,s=e.onAddWorkout,r=e.onEditWorkout,n=e.sports,o=e.t,c=e.workout,i=c?c.sport_id:"",l=Ne(n,o,!0),d="".concat(o("workouts:no folder inside"),", ").concat(t.gpx_limit_import," ").concat(o("workouts:files max"),", ").concat(o("workouts:max size"),": ").concat(M(t.max_zip_file_size)),u=M(t.max_single_file_size);return Object(N.jsxs)("form",{encType:"multipart/form-data",method:"post",onSubmit:function(e){return e.preventDefault()},children:[Object(N.jsx)("div",{className:"form-group",children:Object(N.jsxs)("label",{children:[o("common:Sport"),":",Object(N.jsxs)("select",{className:"form-control input-lg",defaultValue:i,disabled:a,name:"sport",required:!0,children:[Object(N.jsx)("option",{value:""}),l.map((function(e){return Object(N.jsx)("option",{value:e.id,children:e.label},e.id)}))]})]})}),c?Object(N.jsx)("div",{className:"form-group",children:Object(N.jsxs)("label",{children:[o("workouts:Title"),":",Object(N.jsx)("input",{name:"title",defaultValue:c?c.title:"",disabled:a,className:"form-control input-lg"})]})}):Object(N.jsx)("div",{className:"form-group",children:Object(N.jsxs)("label",{children:[Object(N.jsxs)(pe.a,{i18nKey:"workouts:gpxFile",children:[Object(N.jsx)("strong",{children:"gpx"})," file"]}),Object(N.jsx)("sup",{children:Object(N.jsx)("i",{className:"fa fa-question-circle","aria-hidden":"true","data-toggle":"tooltip",title:"".concat(o("workouts:max size"),": ").concat(u)})})," ",Object(N.jsxs)(pe.a,{i18nKey:"workouts:zipFile",children:["or ",Object(N.jsx)("strong",{children:" zip"})," file containing ",Object(N.jsx)("strong",{children:"gpx "}),"files"]}),Object(N.jsx)("sup",{children:Object(N.jsx)("i",{className:"fa fa-question-circle","aria-hidden":"true","data-toggle":"tooltip","data-placement":"top",title:d})})," ",":",Object(N.jsx)("input",{accept:".gpx, .zip",className:"form-control form-control-file gpx-file",disabled:a,name:"gpxFile",required:!0,type:"file"})]})}),Object(N.jsx)("div",{className:"form-group",children:Object(N.jsxs)("label",{children:[o("workouts:Notes"),":",Object(N.jsx)("textarea",{name:"notes",defaultValue:c?c.notes:"",disabled:a,className:"form-control input-lg",maxLength:"500"})]})}),a?Object(N.jsx)("div",{className:"loader"}):Object(N.jsxs)("div",{children:[Object(N.jsx)("input",{type:"submit",className:"btn btn-primary",onClick:function(e){return c?r(e,c):s(e)},value:o("common:Submit")}),Object(N.jsx)("input",{type:"submit",className:"btn btn-secondary",onClick:function(){return Hs.push("/")},value:o("common:Cancel")})]})]})}));var Le=Object(v.c)((function(e){return{user:e.user}}),(function(e){return{onAddOrEdit:function(t,a){var s,r=t.target.form.duration.value.split(":"),n=60*+r[0]*60+60*+r[1]+ +r[2],o={workout_date:"".concat(t.target.form.workout_date.value," ").concat(t.target.form.workout_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?(o.id=a.id,e(ze(o))):e((s=o,function(e){return q.addData("workouts/no_gpx",s).then((function(t){"created"===t.status?(e(Ce()),Hs.push("/workouts/".concat(t.data.workouts[0].id))):e(V("workouts|".concat(t.message)))})).catch((function(t){return e(V("workouts|".concat(t)))}))}))}}}))((function(e){var t,a,s=e.onAddOrEdit,r=e.sports,n=e.t,o=e.user,c=e.workout,i=Ne(r,n,!0),l="";if(c){var d=ve(U(c.workout_date,o.timezone),"yyyy-MM-dd");t=d.workout_date,a=d.workout_time,l=c.sport_id}return Object(N.jsxs)("form",{onSubmit:function(e){return e.preventDefault()},children:[Object(N.jsx)("div",{className:"form-group",children:Object(N.jsxs)("label",{children:[n("workouts:Title"),":",Object(N.jsx)("input",{name:"title",defaultValue:c?c.title:"",className:"form-control input-lg"})]})}),Object(N.jsx)("div",{className:"form-group",children:Object(N.jsxs)("label",{children:[n("common:Sport"),":",Object(N.jsxs)("select",{className:"form-control input-lg",defaultValue:l,name:"sport_id",required:!0,children:[Object(N.jsx)("option",{value:""}),i.map((function(e){return Object(N.jsx)("option",{value:e.id,children:e.label},e.id)}))]})]})}),Object(N.jsx)("div",{className:"form-group",children:Object(N.jsxs)("label",{children:[n("workouts:Workout Date"),":",Object(N.jsx)("div",{className:"container",children:Object(N.jsxs)("div",{className:"row",children:[Object(N.jsx)("input",{name:"workout_date",defaultValue:t,className:"form-control col-md",required:!0,type:"date"}),Object(N.jsx)("input",{name:"workout_time",defaultValue:a,className:"form-control col-md",required:!0,type:"time"})]})})]})}),Object(N.jsx)("div",{className:"form-group",children:Object(N.jsxs)("label",{children:[n("workouts:Duration"),":",Object(N.jsx)("input",{name:"duration",defaultValue:c?c.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(N.jsx)("div",{className:"form-group",children:Object(N.jsxs)("label",{children:[n("workouts:Distance")," (km):",Object(N.jsx)("input",{name:"distance",defaultValue:c?c.distance:"",className:"form-control input-lg",min:0,required:!0,step:"0.001",type:"number"})]})}),Object(N.jsx)("div",{className:"form-group",children:Object(N.jsxs)("label",{children:[n("workouts:Notes"),":",Object(N.jsx)("textarea",{name:"notes",defaultValue:c?c.notes:"",className:"form-control input-lg",maxLength:"500"})]})}),Object(N.jsx)("input",{type:"submit",className:"btn btn-primary",onClick:function(e){return s(e,c)},value:n("common:Submit")}),Object(N.jsx)("input",{type:"submit",className:"btn btn-secondary",onClick:function(){return Hs.push("/")},value:n("common:Cancel")})]})})),Ue=function(e){Object(x.a)(a,e);var t=Object(g.a)(a);function a(e,s){var r;return Object(f.a)(this,a),(r=t.call(this,e,s)).state={withGpx:!0},r}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.loading,s=t.message,r=t.sports,n=t.t,o=t.workout,c=this.state.withGpx;return Object(N.jsxs)("div",{children:[Object(N.jsx)(w.a,{children:Object(N.jsxs)("title",{children:["FitTrackee -"," ",n(o?"workouts:Edit a workout":"workouts:Add a workout")]})}),Object(N.jsx)("br",{}),Object(N.jsx)("br",{}),Object(N.jsx)(_,{message:s,t:n}),Object(N.jsx)("div",{className:"container",children:Object(N.jsxs)("div",{className:"row",children:[Object(N.jsx)("div",{className:"col-md-2"}),Object(N.jsx)("div",{className:"col-md-8",children:Object(N.jsxs)("div",{className:"card add-workout",children:[Object(N.jsx)("h2",{className:"card-header text-center",children:n(o?"workouts:Edit a workout":"workouts:Add a workout")}),Object(N.jsx)("div",{className:"card-body",children:o?o.with_gpx?Object(N.jsx)(Re,{workout:o,sports:r,t:n}):Object(N.jsx)(Le,{workout:o,sports:r,t:n}):Object(N.jsxs)("div",{children:[Object(N.jsx)("form",{children:Object(N.jsxs)("div",{className:"form-group row",children:[Object(N.jsx)("div",{className:"col",children:Object(N.jsxs)("label",{className:"radioLabel",children:[Object(N.jsx)("input",{className:"add-workout-radio",type:"radio",name:"withGpx",disabled:a,checked:c,onChange:function(t){return e.handleRadioChange(t)}}),n("workouts:with gpx file")]})}),Object(N.jsx)("div",{className:"col",children:Object(N.jsxs)("label",{className:"radioLabel",children:[Object(N.jsx)("input",{className:"add-workout-radio",type:"radio",name:"withoutGpx",disabled:a,checked:!c,onChange:function(t){return e.handleRadioChange(t)}}),n("workouts:without gpx file")]})})]})}),c?Object(N.jsx)(Re,{sports:r,t:n}):Object(N.jsx)(Le,{sports:r,t:n})]})})]})}),Object(N.jsx)("div",{className:"col-md-2"})]})})]})}}]),a}(n.a.Component),Ie=Object(y.a)()(Object(v.c)((function(e){return{loading:e.loading}}))(Ue));var We=Object(v.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(N.jsx)("div",{children:Object(N.jsx)(Ie,{workout:null,message:t,sports:a})})}));function He(e){var t=Object(ue.a)().t;return Object(N.jsx)("div",{className:"custom-modal-backdrop",children:Object(N.jsx)("div",{className:"custom-modal",children:Object(N.jsxs)("div",{className:"modal-content",children:[Object(N.jsxs)("div",{className:"modal-header",children:[Object(N.jsx)("h5",{className:"modal-title",children:e.title}),Object(N.jsx)("button",{type:"button",className:"close","aria-label":"Close",onClick:function(){return e.close()},children:Object(N.jsx)("span",{"aria-hidden":"true",children:"\xd7"})})]}),Object(N.jsx)("div",{className:"modal-body",children:Object(N.jsx)("p",{children:e.text})}),Object(N.jsxs)("div",{className:"modal-footer",children:[Object(N.jsx)("button",{type:"button",className:"btn btn-primary",onClick:function(){return e.confirm()},children:t("common:Yes")}),Object(N.jsx)("button",{type:"button",className:"btn btn-secondary",onClick:function(){return e.close()},children:t("common:No")})]})]})})})}function qe(e){var t=e.dataType,a=e.displayModal,s=e.segmentId,r=e.sport,n=e.t,o=e.title,c=e.user,i=e.workout,l=i?ve(U(i.workout_date,c.timezone)):null,d="segment"===t&&1!==s?"/workouts/".concat(i.id,"/segment/").concat(s-1):"workout"===t&&i.previous_workout?"/workouts/".concat(i.previous_workout):null,u="segment"===t&&s<i.segments.length?"/workouts/".concat(i.id,"/segment/").concat(s+1):"workout"===t&&i.next_workout?"/workouts/".concat(i.next_workout):null;return Object(N.jsx)("div",{className:"container",children:Object(N.jsxs)("div",{className:"row",children:[Object(N.jsx)("div",{className:"col-auto",children:d?Object(N.jsx)(ae.a,{className:"unlink",to:d,children:Object(N.jsx)("i",{className:"fa fa-chevron-left","aria-hidden":"true",title:n("workouts:See previous ".concat(t))})}):Object(N.jsx)("i",{className:"fa fa-chevron-left inactive-link","aria-hidden":"true",title:n("workouts:No previous ".concat(t))})}),Object(N.jsx)("div",{className:"col-auto col-workout-logo",children:Object(N.jsx)("img",{className:"sport-img-medium",src:r.img,alt:"sport logo"})}),Object(N.jsxs)("div",{className:"col",children:["workout"===t?Object(N.jsxs)(N.Fragment,{children:[o," ",Object(N.jsx)(ae.a,{className:"unlink",to:"/workouts/".concat(i.id,"/edit"),children:Object(N.jsx)("i",{className:"fa fa-edit custom-fa","aria-hidden":"true",title:n("workouts:Edit workout")})}),Object(N.jsx)("i",{className:"fa fa-trash custom-fa","aria-hidden":"true",onClick:function(){return a(!0)},title:n("workouts:Delete workout")})]}):Object(N.jsxs)(N.Fragment,{children:[Object(N.jsx)(ae.a,{to:"/workouts/".concat(i.id),children:o})," ","- ",n("workouts:segment")," ",s]}),Object(N.jsx)("br",{}),l&&Object(N.jsx)("span",{className:"workout-date",children:"".concat(l.workout_date," - ").concat(l.workout_time)})]}),Object(N.jsx)("div",{className:"col-auto",children:u?Object(N.jsx)(ae.a,{className:"unlink",to:u,children:Object(N.jsx)("i",{className:"fa fa-chevron-right","aria-hidden":"true",title:n("workouts:See next ".concat(t))})}):Object(N.jsx)("i",{className:"fa fa-chevron-right inactive-link","aria-hidden":"true",title:n("workouts:No next ".concat(t))})})]})})}var Be=a(26),Ge=function(e){Object(x.a)(a,e);var t=Object(g.a)(a);function a(e,s){var r;return Object(f.a)(this,a),(r=t.call(this,e,s)).state={displayDistance:!0,dataToHide:[]},r}return Object(O.a)(a,[{key:"componentDidMount",value:function(){"workout"===this.props.dataType?this.props.loadWorkoutData(this.props.workout.id):this.props.loadSegmentData(this.props.workout.id,this.props.segmentId)}},{key:"componentDidUpdate",value:function(e){("workout"===this.props.dataType&&e.workout.id!==this.props.workout.id||"workout"===this.props.dataType&&"segment"===e.dataType)&&this.props.loadWorkoutData(this.props.workout.id),"segment"===this.props.dataType&&e.segmentId!==this.props.segmentId&&this.props.loadSegmentData(this.props.workout.id,this.props.segmentId)}},{key:"componentWillUnmount",value:function(){this.props.loadWorkoutData(null)}},{key:"handleRadioChange",value:function(e){this.setState({displayDistance:"distance"===e.target.name?e.target.value:!e.target.value})}},{key:"handleLegendChange",value:function(e){var t=this.state.dataToHide,a=e.target.name;t.find((function(e){return e===a}))?t.splice(t.indexOf(a),1):t.push(a),this.setState({dataToHide:t})}},{key:"displayData",value:function(e){return!this.state.dataToHide.find((function(t){return t===e}))}},{key:"render",value:function(){var e,t,a=this,s=this.props,r=s.chartData,n=s.t,o=s.updateCoordinates,c=this.state.displayDistance,i=r?parseInt(r.length/10,10):0;return c?(e="distance",t="linear"):(e="duration",t="time"),Object(N.jsx)("div",{className:"container",children:r&&r.length>0?Object(N.jsxs)("div",{children:[Object(N.jsxs)("div",{className:"row chart-radio",children:[Object(N.jsxs)("label",{className:"radioLabel col-md-1",children:[Object(N.jsx)("input",{type:"radio",name:"distance",checked:c,onChange:function(e){return a.handleRadioChange(e)}}),n("workouts:distance")]}),Object(N.jsxs)("label",{className:"radioLabel col-md-1",children:[Object(N.jsx)("input",{type:"radio",name:"duration",checked:!c,onChange:function(e){return a.handleRadioChange(e)}}),n("workouts:duration")]})]}),Object(N.jsxs)("div",{className:"row chart-radio",children:[Object(N.jsx)("div",{className:"col-md-5"}),Object(N.jsxs)("label",{className:"radioLabel col-md-1",children:[Object(N.jsx)("input",{type:"checkbox",name:"speed",checked:this.displayData("speed"),onChange:function(e){return a.handleLegendChange(e)}}),n("workouts:speed")]}),Object(N.jsxs)("label",{className:"radioLabel col-md-1",children:[Object(N.jsx)("input",{type:"checkbox",name:"elevation",checked:this.displayData("elevation"),onChange:function(e){return a.handleLegendChange(e)}}),n("workouts:elevation")]}),Object(N.jsx)("div",{className:"col-md-5"})]}),Object(N.jsx)("div",{className:"row chart",children:Object(N.jsx)(Be.f,{height:300,children:Object(N.jsxs)(Be.d,{data:r,margin:{top:15,right:30,left:20,bottom:15},onMouseMove:function(e){return o(e.activePayload)},onMouseLeave:function(){return o(null)},children:[Object(N.jsx)(Be.h,{allowDecimals:!1,dataKey:e,label:{value:n("workouts:".concat(e)),offset:0,position:"bottom"},scale:t,interval:i,tickFormatter:function(e){return c?e:Object(D.a)(e,"HH:mm:ss")},type:"number"}),Object(N.jsx)(Be.i,{label:{value:"".concat(n("workouts:speed")," (km/h)"),angle:-90,position:"left"},yAxisId:"left"}),Object(N.jsx)(Be.i,{label:{value:"".concat(n("workouts:elevation")," (m)"),angle:-90,position:"right"},yAxisId:"right",orientation:"right"}),this.displayData("elevation")&&Object(N.jsx)(Be.a,{yAxisId:"right",type:"linear",dataKey:"elevation",name:n("workouts:elevation"),fill:"#e5e5e5",stroke:"#cccccc",dot:!1,unit:" m"}),this.displayData("speed")&&Object(N.jsx)(Be.e,{yAxisId:"left",type:"linear",dataKey:"speed",name:n("workouts:speed"),stroke:"#8884d8",strokeWidth:2,dot:!1,unit:" km/h"}),Object(N.jsx)(Be.g,{labelFormatter:function(e){return c?"".concat(n("workouts:distance"),": ").concat(e," km"):"".concat(n("workouts:duration"),": ").concat(Object(D.a)(e,"HH:mm:ss"))}})]})})}),Object(N.jsx)("div",{className:"chart-info",children:n("workouts:data from gpx, without any cleaning")})]}):n("workouts:No data to display")})}}]),a}(n.a.Component),Ve=Object(v.c)((function(e){return{chartData:e.chartData}}),(function(e){return{loadWorkoutData:function(t){e(function(e){return function(t){if(e)return q.getData("workouts/".concat(e,"/chart_data")).then((function(e){"success"===e.status?t(Pe(we(e.data.chart_data))):t(V("workouts|".concat(e.message)))})).catch((function(e){return t(V("workouts|".concat(e)))}));t(Pe(null))}}(t))},loadSegmentData:function(t,a){e(function(e,t){return function(a){if(e)return q.getData("workouts/".concat(e,"/chart_data/segment/").concat(t)).then((function(e){"success"===e.status?a(Pe(we(e.data.chart_data))):a(V("workouts|".concat(e.message)))})).catch((function(e){return a(V("workouts|".concat(e)))}));a(Pe(null))}}(t,a))}}}))(Ge);function Je(e){var t=e.t,a=e.workout;return Object(N.jsx)("div",{className:"container",children:a.weather_start&&a.weather_end&&Object(N.jsxs)("table",{className:"table table-borderless weather-table text-center",children:[Object(N.jsx)("thead",{children:Object(N.jsxs)("tr",{children:[Object(N.jsx)("th",{}),Object(N.jsxs)("th",{children:[t("workouts:Start"),Object(N.jsx)("br",{}),Object(N.jsx)("img",{className:"weather-img",src:"/img/weather/".concat(a.weather_start.icon,".png"),alt:"workout weather (".concat(a.weather_start.icon,")"),title:a.weather_start.summary})]}),Object(N.jsxs)("th",{children:[t("workouts:End"),Object(N.jsx)("br",{}),Object(N.jsx)("img",{className:"weather-img",src:"/img/weather/".concat(a.weather_end.icon,".png"),alt:"workout weather (".concat(a.weather_end.icon,")"),title:a.weather_end.summary})]})]})}),Object(N.jsxs)("tbody",{children:[Object(N.jsxs)("tr",{children:[Object(N.jsx)("td",{children:Object(N.jsx)("img",{className:"weather-img-small",src:"/img/weather/temperature.png",alt:"Temperatures"})}),Object(N.jsxs)("td",{children:[Number(a.weather_start.temperature).toFixed(1),"\xb0C"]}),Object(N.jsxs)("td",{children:[Number(a.weather_end.temperature).toFixed(1),"\xb0C"]})]}),Object(N.jsxs)("tr",{children:[Object(N.jsx)("td",{children:Object(N.jsx)("img",{className:"weather-img-small",src:"/img/weather/pour-rain.png",alt:"Temperatures"})}),Object(N.jsxs)("td",{children:[Number(100*a.weather_start.humidity).toFixed(1),"%"]}),Object(N.jsxs)("td",{children:[Number(100*a.weather_end.humidity).toFixed(1),"%"]})]}),Object(N.jsxs)("tr",{children:[Object(N.jsx)("td",{children:Object(N.jsx)("img",{className:"weather-img-small",src:"/img/weather/breeze.png",alt:"Temperatures"})}),Object(N.jsxs)("td",{children:[Number(a.weather_start.wind).toFixed(1),"m/s"]}),Object(N.jsxs)("td",{children:[Number(a.weather_end.wind).toFixed(1),"m/s"]})]})]})]})})}function Ke(e){var t=e.t,a=e.workout,s="0:00:00"!==a.pauses&&null!==a.pauses;return Object(N.jsxs)("div",{className:"workout-details",children:[Object(N.jsxs)("p",{children:[Object(N.jsx)("i",{className:"fa fa-clock-o custom-fa","aria-hidden":"true"}),t("workouts:Duration"),": ",a.moving,a.records&&a.records.find((function(e){return"LD"===e.record_type}))&&Object(N.jsx)("sup",{children:Object(N.jsx)("i",{className:"fa fa-trophy custom-fa","aria-hidden":"true"})}),s&&Object(N.jsxs)("span",{children:[Object(N.jsx)("br",{}),"(",t("workouts:pauses"),": ",a.pauses,","," ",t("workouts:total duration"),": ",a.duration,")"]})]}),Object(N.jsxs)("p",{children:[Object(N.jsx)("i",{className:"fa fa-road custom-fa","aria-hidden":"true"}),t("workouts:Distance"),": ",a.distance," km",a.records&&a.records.find((function(e){return"FD"===e.record_type}))&&Object(N.jsx)("sup",{children:Object(N.jsx)("i",{className:"fa fa-trophy custom-fa","aria-hidden":"true"})})]}),Object(N.jsxs)("p",{children:[Object(N.jsx)("i",{className:"fa fa-tachometer custom-fa","aria-hidden":"true"}),t("workouts:Average speed"),": ",a.ave_speed," km/h",a.records&&a.records.find((function(e){return"AS"===e.record_type}))&&Object(N.jsx)("sup",{children:Object(N.jsx)("i",{className:"fa fa-trophy custom-fa","aria-hidden":"true"})}),Object(N.jsx)("br",{}),t("workouts:Max. speed"),": ",a.max_speed," km/h",a.records&&a.records.find((function(e){return"MS"===e.record_type}))&&Object(N.jsx)("sup",{children:Object(N.jsx)("i",{className:"fa fa-trophy custom-fa","aria-hidden":"true"})})]}),a.min_alt&&a.max_alt&&Object(N.jsxs)("p",{children:[Object(N.jsx)("i",{className:"fi-mountains custom-fa"}),t("workouts:Min. altitude"),": ",a.min_alt,"m",Object(N.jsx)("br",{}),t("workouts:Max. altitude"),": ",a.max_alt,"m"]}),a.ascent&&a.descent&&Object(N.jsxs)("p",{children:[Object(N.jsx)("i",{className:"fa fa-location-arrow custom-fa"}),t("workouts:Ascent"),": ",a.ascent,"m",Object(N.jsx)("br",{}),t("workouts:Descent"),": ",a.descent,"m"]}),Object(N.jsx)(Je,{workout:a,t:t})]})}var Ye=a(463),Xe=a(460),$e=a(482),Ze=a(461),Qe=a(462),et=a(230),tt=a.n(et);function at(e){var t=e.bounds,a=e.coordinates,s=e.jsonData,r=e.mapAttribution;return Object(Xe.a)().fitBounds(t),Object(N.jsxs)(N.Fragment,{children:[Object(N.jsx)($e.a,{attribution:r,url:"".concat(T,"workouts/map_tile/{s}/{z}/{x}/{y}.png")}),Object(N.jsx)(Ze.a,{data:s},tt()(s)),a.latitude&&Object(N.jsx)(Qe.a,{position:[a.latitude,a.longitude]})]})}var st=function(e){Object(x.a)(a,e);var t=Object(g.a)(a);function a(e,s){var r;return Object(f.a)(this,a),(r=t.call(this,e,s)).state={zoom:13},r}return Object(O.a)(a,[{key:"componentDidMount",value:function(){"workout"===this.props.dataType?this.props.loadWorkoutGpx(this.props.workout.id):this.props.loadSegmentGpx(this.props.workout.id,this.props.segmentId)}},{key:"componentDidUpdate",value:function(e){("workout"===this.props.dataType&&e.workout.id!==this.props.workout.id||"workout"===this.props.dataType&&"segment"===e.dataType)&&this.props.loadWorkoutGpx(this.props.workout.id),"segment"===this.props.dataType&&e.segmentId!==this.props.segmentId&&this.props.loadSegmentGpx(this.props.workout.id,this.props.segmentId)}},{key:"componentWillUnmount",value:function(){this.props.loadWorkoutGpx(null)}},{key:"render",value:function(){var e=this.props,t=e.coordinates,a=e.gpxContent,s=e.mapAttribution,r=e.workout,n=function(e){var t;if(e){var a=(new DOMParser).parseFromString(e,"text/xml");t=Oe.a.gpx(a)}return{jsonData:t}}(a).jsonData,o=[[r.bounds[0],r.bounds[1]],[r.bounds[2],r.bounds[3]]];return Object(N.jsx)("div",{children:n&&Object(N.jsx)(Ye.a,{zoom:this.state.zoom,bounds:o,boundsOptions:{padding:[10,10]},children:Object(N.jsx)(at,{bounds:o,coordinates:t,jsonData:n,mapAttribution:s})})})}}]),a}(n.a.Component),rt=Object(v.c)((function(e){return{gpxContent:e.gpx,mapAttribution:e.application.config.map_attribution}}),(function(e){return{loadWorkoutGpx:function(t){e(function(e){return function(t){if(e)return q.getData("workouts/".concat(e,"/gpx")).then((function(e){"success"===e.status?t(Te(e.data.gpx)):t(V("workouts|".concat(e.message)))})).catch((function(e){return t(V("workouts|".concat(e)))}));t(Te(null))}}(t))},loadSegmentGpx:function(t,a){e(function(e,t){return function(a){if(e)return q.getData("workouts/".concat(e,"/gpx/segment/").concat(t)).then((function(e){"success"===e.status?a(Te(e.data.gpx)):a(V("workouts|".concat(e.message)))})).catch((function(e){return a(V("workouts|".concat(e)))}));a(Te(null))}}(t,a))}}}))(st);function nt(e){var t=e.t;return Object(N.jsx)("div",{className:"workout-no-map text-center",children:t("workouts:No Map")})}function ot(e){var t=e.notes,a=e.t;return Object(N.jsx)("div",{className:"row",children:Object(N.jsx)("div",{className:"col",children:Object(N.jsx)("div",{className:"card workout-card",children:Object(N.jsxs)("div",{className:"card-body",children:["Notes",Object(N.jsx)("div",{className:"workout-notes",children:t||a("workouts:No notes")})]})})})})}function ct(e){var t=e.segments,a=e.t;return Object(N.jsx)("div",{className:"row",children:Object(N.jsx)("div",{className:"col",children:Object(N.jsx)("div",{className:"card workout-card",children:Object(N.jsxs)("div",{className:"card-body",children:[a("workouts:Segments"),Object(N.jsx)("div",{className:"workout-segments",children:Object(N.jsx)("ul",{children:t.map((function(e,t){return Object(N.jsxs)("li",{className:"workout-segments-list",children:[Object(N.jsxs)(ae.a,{to:"/workouts/".concat(e.workout_id,"/segment/").concat(t+1),children:[a("workouts:segment")," ",t+1]})," ","(",a("workouts:distance"),": ",e.distance," km,"," ",a("workouts:duration"),": ",e.duration,")"]},"segment-".concat(t))}))})})]})})})})}var it=function(e){Object(x.a)(a,e);var t=Object(g.a)(a);function a(e,s){var r;return Object(f.a)(this,a),(r=t.call(this,e,s)).state={displayModal:!1,coordinates:{latitude:null,longitude:null}},r}return Object(O.a)(a,[{key:"componentDidMount",value:function(){this.props.loadWorkout(this.props.match.params.workoutId)}},{key:"componentDidUpdate",value:function(e){e.match.params.workoutId!==this.props.match.params.workoutId&&this.props.loadWorkout(this.props.match.params.workoutId)}},{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.message,s=t.onDeleteWorkout,r=t.sports,n=t.t,o=t.user,c=t.workouts,i=this.state,l=i.coordinates,d=i.displayModal,u=Object(he.a)(c,1)[0],m=u?u.title:n("workouts:Workout"),j=u?r.filter((function(e){return e.id===u.sport_id})):[],p=Object(he.a)(j,1)[0],h=parseInt(this.props.match.params.segmentId),b=h>=0?"segment":"workout";return Object(N.jsxs)("div",{className:"workout-page",children:[Object(N.jsx)(w.a,{children:Object(N.jsxs)("title",{children:["FitTrackee - ",m]})}),a?Object(N.jsx)(_,{message:a,t:n}):Object(N.jsxs)("div",{className:"container",children:[d&&Object(N.jsx)(He,{title:n("common:Confirmation"),text:n("workouts:Are you sure you want to delete this workout?"),confirm:function(){s(u.id),e.displayModal(!1)},close:function(){return e.displayModal(!1)}}),u&&p&&1===c.length&&Object(N.jsxs)("div",{children:[Object(N.jsx)("div",{className:"row",children:Object(N.jsx)("div",{className:"col",children:Object(N.jsxs)("div",{className:"card workout-card",children:[Object(N.jsx)("div",{className:"card-header",children:Object(N.jsx)(qe,{workout:u,dataType:b,segmentId:h,sport:p,t:n,title:m,user:o,displayModal:function(){return e.displayModal(!0)}})}),Object(N.jsx)("div",{className:"card-body",children:Object(N.jsxs)("div",{className:"row",children:[Object(N.jsx)("div",{className:"col-md-8",children:u.with_gpx?Object(N.jsx)(rt,{workout:u,coordinates:l,dataType:b,segmentId:h}):Object(N.jsx)(nt,{t:n})}),Object(N.jsx)("div",{className:"col",children:Object(N.jsx)(Ke,{workout:"workout"===b?u:u.segments[h-1],t:n})})]})})]})})}),u.with_gpx&&Object(N.jsx)("div",{className:"row",children:Object(N.jsx)("div",{className:"col",children:Object(N.jsx)("div",{className:"card workout-card",children:Object(N.jsx)("div",{className:"card-body",children:Object(N.jsx)("div",{className:"row",children:Object(N.jsxs)("div",{className:"col",children:[Object(N.jsx)("div",{className:"chart-title",children:n("workouts:Chart")}),Object(N.jsx)(Ve,{workout:u,dataType:b,segmentId:h,t:n,updateCoordinates:function(t){return e.updateCoordinates(t)}})]})})})})})}),"workout"===b&&Object(N.jsxs)(N.Fragment,{children:[Object(N.jsx)(ot,{notes:u.notes,t:n}),u.segments.length>1&&Object(N.jsx)(ct,{segments:u.segments,t:n})]})]})]})]})}}]),a}(n.a.Component),lt=Object(y.a)()(Object(v.c)((function(e){return{workouts:e.workouts.data,message:e.message,sports:e.sports.data,user:e.user}}),(function(e){return{loadWorkout:function(t){e(X("getData","workouts",{id:t}))},onDeleteWorkout:function(t){var a;e((a=t,function(e){return q.deleteData("workouts",a).then((function(t){var s;204===t.status?Promise.resolve(e((s=a,{type:"REMOVE_WORKOUT",workoutId:s}))).then((function(){return e(Ce())})).then((function(){return Hs.push("/")})):e(V("workouts|".concat(t.status)))})).catch((function(t){return e(V("workouts|".concat(t)))}))}))}}}))(it)),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:"componentDidMount",value:function(){this.props.loadWorkout(this.props.match.params.workoutId)}},{key:"render",value:function(){var e=this.props,t=e.message,a=e.sports,s=e.workouts,r=Object(he.a)(s,1)[0];return Object(N.jsx)("div",{children:a.length>0&&Object(N.jsx)(Ie,{workout:r,message:t,sports:a})})}}]),a}(n.a.Component),ut=Object(v.c)((function(e){return{workouts:e.workouts.data,message:e.message,sports:e.sports.data,user:e.user}}),(function(e){return{loadWorkout:function(t){e(X("getData","workouts",{id:t}))}}}))(dt);var mt=Object(v.c)((function(e){return{user:e.user}}))((function(){return Object(N.jsx)("div",{children:F()?Object(N.jsxs)(k.d,{children:[Object(N.jsx)(k.b,{exact:!0,path:"/workouts/add",component:We}),Object(N.jsx)(k.b,{exact:!0,path:"/workouts/:workoutId",component:lt}),Object(N.jsx)(k.b,{exact:!0,path:"/workouts/:workoutId/edit",component:ut}),Object(N.jsx)(k.b,{path:"/workouts/:workoutId/segment/:segmentId",component:lt}),Object(N.jsx)(k.b,{component:me})]}):Object(N.jsx)(k.a,{to:"/login"})})})),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(N.jsx)("div",{className:"card text-center",children:Object(N.jsxs)("div",{className:"card-body",children:[e("common:No workouts.")," ",Object(N.jsx)(ae.a,{to:{pathname:"/workouts/add"},children:e("dashboard:Upload one !")})]})})}}]),a}(n.a.PureComponent),pt=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.loadWorkouts,a=e.sports,s=e.t,r=e.updateParams,n=Ne(a,s);return Object(N.jsx)("div",{className:"card",children:Object(N.jsx)("div",{className:"card-body workout-filter",children:Object(N.jsxs)("form",{onSubmit:function(e){return e.preventDefault()},children:[Object(N.jsxs)("div",{className:"form-group",children:[Object(N.jsxs)("label",{children:[s("workouts:From"),":",Object(N.jsx)("input",{className:"form-control col-md",name:"from",onChange:function(e){return r(e)},type:"date"})]}),Object(N.jsxs)("label",{children:[s("workouts:To"),":",Object(N.jsx)("input",{className:"form-control col-md",name:"to",onChange:function(e){return r(e)},type:"date"})]})]}),Object(N.jsx)("div",{className:"form-group",children:Object(N.jsxs)("label",{children:[s("common:Sport"),":",Object(N.jsxs)("select",{className:"form-control input-lg",name:"sport_id",onChange:function(e){return r(e)},children:[Object(N.jsx)("option",{value:""}),n.map((function(e){return Object(N.jsx)("option",{value:e.id,children:e.label},e.id)}))]})]})}),Object(N.jsx)("div",{className:"form-group",children:Object(N.jsxs)("label",{children:[s("workouts:Distance")," (km):",Object(N.jsx)("div",{className:"container",children:Object(N.jsxs)("div",{className:"row",children:[Object(N.jsx)("div",{className:"col-5",children:Object(N.jsx)("input",{className:"form-control",min:0,name:"distance_from",onChange:function(e){return r(e)},step:"1",type:"number"})}),Object(N.jsx)("div",{className:"col-2 align-middle text-center",children:s("common:to")}),Object(N.jsx)("div",{className:"col-5",children:Object(N.jsx)("input",{className:"form-control",min:0,name:"distance_to",onChange:function(e){return r(e)},step:"1",type:"number"})})]})})]})}),Object(N.jsx)("div",{className:"form-group",children:Object(N.jsxs)("label",{children:[s("workouts:Duration"),":",Object(N.jsx)("div",{className:"container",children:Object(N.jsxs)("div",{className:"row",children:[Object(N.jsx)("div",{className:"col-5",children:Object(N.jsx)("input",{className:"form-control",name:"duration_from",onChange:function(e){return r(e)},pattern:"^([0-9]*[0-9]):([0-5][0-9])$",placeholder:"hh:mm",type:"text"})}),Object(N.jsx)("div",{className:"col-2 align-middle text-center",children:s("common:to")}),Object(N.jsx)("div",{className:"col-5",children:Object(N.jsx)("input",{className:"form-control",name:"duration_to",onChange:function(e){return r(e)},pattern:"^([0-9]*[0-9]):([0-5][0-9])$",placeholder:"hh:mm",type:"text"})})]})})]})}),Object(N.jsx)("div",{className:"form-group",children:Object(N.jsxs)("label",{children:[s("workouts:Average speed")," (km/h):",Object(N.jsx)("div",{className:"container",children:Object(N.jsxs)("div",{className:"row",children:[Object(N.jsx)("div",{className:"col-5",children:Object(N.jsx)("input",{className:"form-control",min:0,name:"ave_speed_from",onChange:function(e){return r(e)},step:"1",type:"number"})}),Object(N.jsx)("div",{className:"col-2 align-middle text-center",children:s("common:to")}),Object(N.jsx)("div",{className:"col-5",children:Object(N.jsx)("input",{className:"form-control",min:0,name:"ave_speed_to",onChange:function(e){return r(e)},step:"1",type:"number"})})]})})]})}),Object(N.jsx)("div",{className:"form-group",children:Object(N.jsxs)("label",{children:[s("workouts:Max. speed")," (km/h):",Object(N.jsx)("div",{className:"container",children:Object(N.jsxs)("div",{className:"row",children:[Object(N.jsx)("div",{className:"col-5",children:Object(N.jsx)("input",{className:"form-control",min:0,name:"max_speed_from",onChange:function(e){return r(e)},step:"1",type:"number"})}),Object(N.jsx)("div",{className:"col-2 align-middle text-center",children:s("common:to")}),Object(N.jsx)("div",{className:"col-5",children:Object(N.jsx)("input",{className:"form-control",min:0,name:"max_speed_to",onChange:function(e){return r(e)},step:"1",type:"number"})})]})})]})}),Object(N.jsx)("input",{className:"btn btn-primary btn-lg btn-block",onClick:function(){return t()},type:"submit",value:s("workouts:Filter")})]})})})}}]),a}(n.a.PureComponent),ht=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.display,a=e.workout;return Object(N.jsxs)("div",{className:"workout-map".concat("list"===t?"-list":""),children:[Object(N.jsx)("img",{src:"".concat(T,"workouts/map/").concat(a.map,"?").concat(Date.now()),alt:"workout map"}),Object(N.jsxs)("div",{className:"map-attribution".concat("list"===t?"-list":""),children:[Object(N.jsx)("span",{className:"map-attribution-text",children:"\xa9"}),Object(N.jsx)("a",{className:"map-attribution-text",href:"http://www.openstreetmap.org/copyright",target:"_blank",rel:"noopener noreferrer",children:"OpenStreetMap"})]})]})}}]),a}(n.a.PureComponent),bt=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.loading,a=e.sports,s=e.t,r=e.user,n=e.workouts;return Object(N.jsx)("div",{className:"card workout-card",children:Object(N.jsxs)("div",{className:"card-body",children:[Object(N.jsxs)("table",{className:"table",children:[Object(N.jsx)("thead",{children:Object(N.jsxs)("tr",{children:[Object(N.jsx)("th",{scope:"col"}),Object(N.jsx)("th",{scope:"col",children:s("common:Workout")}),Object(N.jsx)("th",{scope:"col",children:s("workouts:Date")}),Object(N.jsx)("th",{scope:"col",children:s("workouts:Distance")}),Object(N.jsx)("th",{scope:"col",children:s("workouts:Duration")}),Object(N.jsx)("th",{scope:"col",children:s("workouts:Ave. speed")}),Object(N.jsx)("th",{scope:"col",children:s("workouts:Max. speed")})]})}),Object(N.jsx)("tbody",{children:!t&&a&&n.map((function(e,t){return Object(N.jsxs)("tr",{children:[Object(N.jsxs)("td",{children:[Object(N.jsx)("span",{className:"heading-span-absolute",children:s("common:Sport")}),Object(N.jsx)("img",{className:"workout-sport",src:a.filter((function(t){return t.id===e.sport_id})).map((function(e){return e.img})),alt:"workout sport logo"})]}),Object(N.jsxs)("td",{className:"workout-title",children:[Object(N.jsx)("span",{className:"heading-span-absolute",children:s("common:Workout")}),Object(N.jsx)(ae.a,{to:"/workouts/".concat(e.id),children:e.title}),e.map&&Object(N.jsx)(ht,{workout:e,display:"list"})]}),Object(N.jsxs)("td",{children:[Object(N.jsx)("span",{className:"heading-span-absolute",children:s("workouts:Date")}),Object(D.a)(U(e.workout_date,r.timezone),"dd/MM/yyyy HH:mm")]}),Object(N.jsxs)("td",{className:"text-right",children:[Object(N.jsx)("span",{className:"heading-span-absolute",children:s("workouts:Distance")}),Number(e.distance).toFixed(2)," km"]}),Object(N.jsxs)("td",{className:"text-right",children:[Object(N.jsx)("span",{className:"heading-span-absolute",children:s("workouts:Duration")}),e.moving]}),Object(N.jsxs)("td",{className:"text-right",children:[Object(N.jsx)("span",{className:"heading-span-absolute",children:s("workouts:Ave. speed")}),e.ave_speed," km/h"]}),Object(N.jsxs)("td",{className:"text-right",children:[Object(N.jsx)("span",{className:"heading-span-absolute",children:s("workouts:Max. speed")}),e.max_speed," km/h"]})]},t)}))})]}),t&&Object(N.jsx)("div",{className:"loader"})]})})}}]),a}(n.a.PureComponent),ft=function(e){Object(x.a)(a,e);var t=Object(g.a)(a);function a(e,s){var r;return Object(f.a)(this,a),(r=t.call(this,e,s)).state={params:{page:1,per_page:10}},r}return Object(O.a)(a,[{key:"componentDidMount",value:function(){this.props.loadWorkouts(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.loading,s=t.loadWorkouts,r=t.loadMoreWorkouts,n=t.message,o=t.sports,c=t.t,i=t.user,l=t.workouts,d=this.state.params,u=!(l.length>0)||null===l[l.length-1].previous_workout;return Object(N.jsxs)("div",{children:[Object(N.jsx)(w.a,{children:Object(N.jsxs)("title",{children:["FitTrackee - ",c("common:Workouts")]})}),n?Object(N.jsx)(_,{message:n,t:c}):Object(N.jsx)("div",{className:"container history",children:Object(N.jsxs)("div",{className:"row",children:[Object(N.jsx)("div",{className:"col-md-3",children:Object(N.jsx)(pt,{sports:o,loadWorkouts:function(){return s(d)},t:c,updateParams:function(t){return e.setParams(t)}})}),Object(N.jsxs)("div",{className:"col-md-9 workouts-result",children:[Object(N.jsx)(bt,{workouts:l,loading:a,sports:o,t:c,user:i}),!u&&Object(N.jsx)("input",{type:"submit",className:"btn btn-default btn-md btn-block",value:"Load more workouts",onClick:function(){d.page+=1,r(d),e.setState(d)}}),0===l.length&&Object(N.jsx)(jt,{t:c})]})]})})]})}}]),a}(n.a.Component),Ot=Object(y.a)()(Object(v.c)((function(e){return{workouts:e.workouts.data,loading:e.loading,message:e.message,sports:e.sports.data,user:e.user}}),(function(e){return{loadWorkouts:function(t){e(X("getData","workouts",t))},loadMoreWorkouts:function(t){e(Fe(t))}}}))(ft));var xt=Object(y.a)()(Object(v.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 _e.deletePicture().then((function(t){return 204===t.status?e(Ee()):e(Se(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(Ee());var a=413===e.status?"Error during picture update, file size exceeds max size.":e.message;return t(Se(a))})).catch((function(e){throw e}))}}(t))}}}))((function(e){var t=e.appConfig,a=e.displayModal,s=e.editable,r=e.isDeletable,n=e.message,o=e.onDeletePicture,c=e.onUploadPicture,i=e.pathname,l=e.t,d=e.user,u=d.created_at?Object(D.a)(new Date(d.created_at),"dd/MM/yyyy HH:mm"):"",m=d.birth_date?Object(D.a)(new Date(d.birth_date),"dd/MM/yyyy"):"",j=M(t.max_single_file_size);return Object(N.jsxs)("div",{children:[Object(N.jsx)(w.a,{children:Object(N.jsxs)("title",{children:["FitTrackee - ",l("user:Profile")]})}),Object(N.jsx)(_,{message:n,t:l}),Object(N.jsxs)("div",{className:"container",children:[Object(N.jsx)("h1",{className:"page-title",children:l("user:Profile")}),Object(N.jsx)("div",{className:"row",children:Object(N.jsx)("div",{className:"col-md-12",children:Object(N.jsxs)("div",{className:"card",children:[Object(N.jsx)("div",{className:"card-header userName",children:Object(N.jsx)("strong",{children:d.username})}),Object(N.jsxs)("div",{className:"card-body",children:[Object(N.jsxs)("div",{className:"row",children:[Object(N.jsxs)("div",{className:"col-md-8",children:[Object(N.jsxs)("p",{children:[Object(N.jsx)("span",{className:"user-label",children:l("user:Email")}),": ",d.email]}),Object(N.jsxs)("p",{children:[Object(N.jsx)("span",{className:"user-label",children:l("user:Registration Date")}),": ",u]}),Object(N.jsxs)("p",{children:[Object(N.jsx)("span",{className:"user-label",children:l("user:First Name")}),": ",d.first_name]}),Object(N.jsxs)("p",{children:[Object(N.jsx)("span",{className:"user-label",children:l("user:Last Name")}),": ",d.last_name]}),Object(N.jsxs)("p",{children:[Object(N.jsx)("span",{className:"user-label",children:l("user:Birth Date")}),": ",m]}),Object(N.jsxs)("p",{children:[Object(N.jsx)("span",{className:"user-label",children:l("user:Location")}),": ",d.location]}),Object(N.jsxs)("p",{children:[Object(N.jsx)("span",{className:"user-label",children:l("user:Bio")}),":"," ",d.bio]}),Object(N.jsxs)("p",{children:[Object(N.jsx)("span",{className:"user-label",children:l("user:Language")}),": ",d.language]}),Object(N.jsxs)("p",{children:[Object(N.jsx)("span",{className:"user-label",children:l("user:Timezone")}),": ",d.timezone]}),Object(N.jsxs)("p",{children:[Object(N.jsx)("span",{className:"user-label",children:l("user:First day of week")}),": ",d.weekm?l("user:Monday"):l("user:Sunday")]})]}),Object(N.jsxs)("div",{className:"col-md-4",children:[!0===d.picture&&Object(N.jsxs)("div",{children:[Object(N.jsx)("img",{alt:"Profile",src:"".concat(T,"users/").concat(d.username,"/picture")+"?".concat(Date.now()),className:"img-fluid App-profile-img-small"}),s&&Object(N.jsxs)(N.Fragment,{children:[Object(N.jsx)("br",{}),Object(N.jsx)("button",{type:"submit",onClick:function(){return o()},children:l("user:Delete picture")}),Object(N.jsx)("br",{}),Object(N.jsx)("br",{})]})]}),s&&Object(N.jsxs)("form",{encType:"multipart/form-data",onSubmit:function(e){return c(e)},children:[Object(N.jsx)("input",{type:"file",name:"picture",accept:".png,.jpg,.gif"}),Object(N.jsx)("br",{}),Object(N.jsx)("button",{type:"submit",children:l("user:Send")})," (max. size: ".concat(j,")")]})," "]})]}),s&&Object(N.jsx)("button",{className:"btn btn-primary",onClick:function(){return Hs.push("/profile/edit")},children:l("common:Edit")}),r&&Object(N.jsx)("button",{className:"btn btn-danger",onClick:function(){return a(!0)},children:l("user:Delete user account")}),Object(N.jsx)("button",{className:"btn btn-secondary",onClick:function(){return"/profile"===i?Hs.push("/"):Hs.go(-1)},children:l("/profile"===i?"common:Back to home":"common:Back")})]})]})})})]})]})})));var gt=Object(y.a)()(Object(v.c)((function(e){return{user:e.user}}))((function(e){var t=e.t,a=e.user;return Object(N.jsx)("div",{children:Object(N.jsx)(xt,{editable:!0,t:t,user:a})})}))),vt=a(464),kt=a(465),wt=a(466),yt=a(467),Nt=a(231),_t=a(236),St=a(468),Dt=a(469),Ct=a(112),Et=a(470),At=a(478),Mt=a(481);function Tt(e){var t=e.isDisabled,a=e.isMore,s=e.sportImg,r=e.workout;return Object(N.jsx)(ae.a,{className:"calendar-workout".concat(a),to:"/workouts/".concat(r.id),children:Object(N.jsxs)(N.Fragment,{children:[Object(N.jsx)("img",{alt:"workout sport logo",className:"workout-sport ".concat(t),src:s,title:r.title}),r.records.length>0&&Object(N.jsx)("sup",{children:Object(N.jsx)("i",{className:"fa fa-trophy custom-fa-small","aria-hidden":"true",title:r.records.map((function(e){return" ".concat(ge.filter((function(t){return t.record_type===e.record_type}))[0].label)}))})})]})})}var Pt=function(e){Object(x.a)(a,e);var t=Object(g.a)(a);function a(e,s){var r;return Object(f.a)(this,a),(r=t.call(this,e,s)).state={isHidden:!0},r}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.dayWorkouts,s=t.isDisabled,r=t.sports,n=this.state.isHidden;return Object(N.jsxs)("div",{children:[a.map((function(e){return Object(N.jsx)(Tt,{workout:e,isDisabled:s,isMore:"",sportImg:r.filter((function(t){return t.id===e.sport_id})).map((function(e){return e.img}))},e.id)})),a.length>2&&Object(N.jsx)("i",{className:"fa fa-".concat(n?"plus":"times"," calendar-more"),"aria-hidden":"true",onClick:function(){return e.handleDisplayMore()},title:"show more workouts"}),!n&&Object(N.jsx)("div",{className:"calendar-display-more",children:a.map((function(e){return Object(N.jsx)(Tt,{workout:e,isDisabled:s,isMore:"-more",sportImg:r.filter((function(t){return t.id===e.sport_id})).map((function(e){return e.img}))},e.id)}))})]})}}]),a}(n.a.Component),zt=function(e,t){var a=Object(vt.a)(e),s=Object(kt.a)(e),r=t?1:0;return{start:Object(wt.a)(a,{weekStartsOn:r}),end:Object(yt.a)(s)}},Ft=function(e){Object(x.a)(a,e);var t=Object(g.a)(a);function a(e,s){var r;Object(f.a)(this,a),r=t.call(this,e,s);var n=new Date;return r.state={currentMonth:n,startDate:zt(n,e.weekm).start,endDate:zt(n,e.weekm).end,weekStartOnMonday:e.weekm},r}return Object(O.a)(a,[{key:"componentDidMount",value:function(){this.props.loadMonthWorkouts(this.state.startDate,this.state.endDate)}},{key:"renderHeader",value:function(e){var t=this;return Object(N.jsxs)("div",{className:"header row flex-middle",children:[Object(N.jsx)("div",{className:"col col-start",onClick:function(){return t.handlePrevMonth()},children:Object(N.jsx)("i",{className:"fa fa-chevron-left","aria-hidden":"true"})}),Object(N.jsx)("div",{className:"col col-center",children:Object(N.jsx)("span",{children:Object(D.a)(this.state.currentMonth,"MMM yyyy",e)})}),Object(N.jsx)("div",{className:"col col-end",onClick:function(){return t.handleNextMonth()},children:Object(N.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(N.jsx)("div",{className:"col col-center",children:Object(D.a)(Object(Nt.a)(a,s),"EEE",e)},s));return Object(N.jsx)("div",{className:"days row",children:t})}},{key:"filterWorkouts",value:function(e){var t=this.props,a=t.workouts,s=t.user;return a?a.filter((function(t){return Object(_t.a)(U(t.workout_date,s.timezone),e)})).reverse():[]}},{key:"renderCells",value:function(){for(var e=this.state,t=e.currentMonth,a=e.startDate,s=e.endDate,r=e.weekStartOnMonday,n=this.props.sports,o=[],c=[],i=a,l="";i<=s;){for(var d=0;d<7;d++){l=Object(D.a)(i,"d");var u=this.filterWorkouts(i),m=Object(St.a)(i,t)?"":"-disabled",j=r?[5,6].includes(d):[0,6].includes(d);c.push(Object(N.jsx)("div",{className:"col cell ".concat(j?" weekend":"").concat(Object(Dt.a)(i)?" today":""),children:Object(N.jsxs)("div",{className:"img".concat(m),children:[Object(N.jsx)("span",{className:"number",children:l}),Object(N.jsx)(Pt,{dayWorkouts:u,isDisabled:m,sports:n})]})},i)),i=Object(Nt.a)(i,1)}o.push(Object(N.jsx)("div",{className:"row",children:c},i)),c=[]}return Object(N.jsx)("div",{className:"body",children:o})}},{key:"updateStateDate",value:function(e){var t=zt(e,this.state.weekStartOnMonday),a=t.start,s=t.end;this.setState({currentMonth:e,startDate:a,endDate:s}),this.props.loadMonthWorkouts(a,s)}},{key:"handleNextMonth",value:function(){var e=Object(Ct.a)(this.state.currentMonth,1);this.updateStateDate(e)}},{key:"handlePrevMonth",value:function(){var e=Object(Et.a)(this.state.currentMonth,1);this.updateStateDate(e)}},{key:"render",value:function(){var e={locale:"fr"===this.props.language?At.a:Mt.a};return Object(N.jsx)("div",{className:"card workout-card",children:Object(N.jsxs)("div",{className:"calendar",children:[this.renderHeader(e),this.renderDays(e),this.renderCells()]})})}}]),a}(n.a.Component),Rt=Object(v.c)((function(e){return{workouts:e.calendarWorkouts.data,language:e.language,sports:e.sports.data,user:e.user}}),(function(e){return{loadMonthWorkouts:function(t,a){var s,r,n="yyyy-MM-dd";e((s=Object(D.a)(t,n),r=Object(D.a)(a,n),function(e){return q.getData("workouts",{from:s,to:r,order:"desc",per_page:100}).then((function(t){"success"===t.status?e({type:"UPDATE_CALENDAR",workouts:t.data.workouts}):e(V("workouts|".concat(t.message)))})).catch((function(t){return e(V("workouts|".concat(t)))}))}))}}}))(Ft);function Lt(e){var t=e.records,a=e.sports,s=e.t,r=e.user,n=Ne(a,s),o=t.reduce((function(e,t){var a=n.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 s=ge.filter((function(t){return t.record_type===e.record_type})),r=Object(he.a)(s,1)[0];return{workout_date:ve(U(e.workout_date,t)).workout_date,workout_id:e.workout_id,id:e.id,record_type:r.label,value:a}}(t,r.timezone)),e}),{});return Object(N.jsxs)("div",{className:"card workout-card",children:[Object(N.jsx)("div",{className:"card-header",children:s("workouts:Personal records")}),Object(N.jsx)("div",{className:"card-body",children:0===Object.keys(o).length?s("common:No records."):Object.keys(o).sort().map((function(e){return Object(N.jsxs)("div",{children:[Object(N.jsxs)("span",{className:"heading-span",children:[Object(N.jsx)("img",{alt:"".concat(e," logo"),className:"record-logo",src:o[e].img}),e]}),Object(N.jsxs)("table",{className:"table table-borderless table-sm record-table",children:[Object(N.jsx)("thead",{children:Object(N.jsx)("tr",{children:Object(N.jsxs)("th",{colSpan:"3",children:[Object(N.jsx)("img",{alt:"".concat(e," logo"),className:"record-logo",src:o[e].img}),e]})})}),Object(N.jsx)("tbody",{children:o[e].records.map((function(e){return Object(N.jsxs)("tr",{className:"record-tr",children:[Object(N.jsx)("td",{className:"record-td",children:s("workouts:".concat(e.record_type))}),Object(N.jsx)("td",{className:"record-td text-right",children:e.value}),Object(N.jsx)("td",{className:"record-td text-right",children:Object(N.jsx)(ae.a,{to:"/workouts/".concat(e.workout_id),children:e.workout_date})})]},e.id)}))})]})]},e)}))})]})}var Ut=a(232),It=a(471),Wt=[{duration:"week",dateFormat:"yyyy-MM-dd",xAxis:"dd/MM"},{duration:"month",dateFormat:"yyyy-MM",xAxis:"MM/yyyy"},{duration:"year",dateFormat:"yyyy",xAxis:"yyyy"}],Ht=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 s=String(Math.floor(e/3600)).padStart(2,"0");e%=3600;var r=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"===s?"":"".concat(s,"h:")).concat(r,"m:").concat(n,"s"):"".concat("00"===s?"":"".concat(s,":")).concat(r,":").concat(n)},qt=function(e,t){return 0===t?"":"distance"===e?"".concat(t.toFixed(2)," km"):"duration"===e?Ht(t):t},Bt=function(e,t){switch(e){case"week":return Object(Nt.a)(t,7);case"year":return Object(Ut.a)(t,1);case"month":default:return Object(Ct.a)(t,1)}},Gt=function(e,t,a,s,r){for(var n=[],o=[],c=[],i=function(r){var i=Wt.filter((function(e){return e.duration===a.duration})),l=Object(he.a)(i,1)[0],d=Object(D.a)(r,l.dateFormat),u=Object(D.a)(r,l.xAxis),m={date:u},j={date:u},p={date:u};e[d]&&Object.keys(e[d]).filter((function(e){return!s||s.includes(+e)})).map((function(a){var s=t.filter((function(e){return e.id===+a}))[0].label;return m[s]=e[d][a].nb_workouts,j[s]=e[d][a].total_distance,p[s]=e[d][a].total_duration,null})),n.push(m),o.push(j),c.push(p)},l=function(e,t,a){switch(e){case"week":return Object(wt.a)(t,{weekStartsOn:a?1:0});case"year":return Object(It.a)(t);case"month":default:return Object(vt.a)(t)}}(a.duration,a.start,r);l<=a.end;l=Bt(a.duration,l))i(l);return{workouts:n,distance:o,duration:c}},Vt=function(e,t){return"duration"===e?Ht(t,!0):"distance"===e?t.toFixed(2):t};function Jt(e){if(e.active){var t=e.displayedData,a=e.payload,s=e.label,r=0;return a.map((function(e){return r+=e.value})),Object(N.jsxs)("div",{className:"custom-tooltip",children:[Object(N.jsx)("p",{className:"custom-tooltip-label",children:s}),a.map((function(e){return Object(N.jsxs)("p",{style:{color:e.fill},children:[e.name,": ",Vt(t,e.value)," ",e.unit]},e.name)})),a.length>0&&Object(N.jsxs)("p",{children:["Total: ",Vt(t,r)]})]})}return null}function Kt(e){var t=e.displayedData,a=e.x,s=e.y,r=e.width,n=e.value;if(!n)return null;var o=qt(t,n);return Object(N.jsx)("g",{children:Object(N.jsx)("text",{x:a+r/2,y:s-10,fill:"#666",fontSize:"11",textAnchor:"middle",dominantBaseline:"middle",children:o})})}var Yt=function(e){Object(x.a)(a,e);var t=Object(g.a)(a);function a(e,s){var r;return Object(f.a)(this,a),(r=t.call(this,e,s)).state={displayedData:"distance"},r}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,r=a.stats,n=a.t;return 0===Object.keys(r).length?n("common:No workouts."):Object(N.jsxs)("div",{className:"chart-stats",children:[Object(N.jsxs)("div",{className:"row chart-radio",children:[Object(N.jsxs)("label",{className:"radioLabel col",children:[Object(N.jsx)("input",{type:"radio",name:"distance",checked:"distance"===t,onChange:function(t){return e.handleRadioChange(t)}}),n("statistics:distance")]}),Object(N.jsxs)("label",{className:"radioLabel col",children:[Object(N.jsx)("input",{type:"radio",name:"duration",checked:"duration"===t,onChange:function(t){return e.handleRadioChange(t)}}),n("statistics:duration")]}),Object(N.jsxs)("label",{className:"radioLabel col",children:[Object(N.jsx)("input",{type:"radio",name:"workouts",checked:"workouts"===t,onChange:function(t){return e.handleRadioChange(t)}}),n("statistics:workouts")]})]}),Object(N.jsx)(Be.f,{height:300,children:Object(N.jsxs)(Be.c,{data:r[t],margin:{top:15,bottom:0},children:[Object(N.jsx)(Be.h,{dataKey:"date",interval:0}),Object(N.jsx)(Be.i,{tickFormatter:function(e){return qt(t,e)}}),Object(N.jsx)(Be.g,{content:Object(N.jsx)(Jt,{displayedData:t})}),s.map((function(e,a){return Object(N.jsx)(Be.b,{isAnimationActive:!1,dataKey:e.label,stackId:"a",fill:xe[a],label:a===s.length-1?Object(N.jsx)(Kt,{displayedData:t}):"",name:n("sports:".concat(e.label))},e.id)}))]})})]})}}]),a}(n.a.PureComponent),Xt=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.loadWorkouts(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,r=e.statsParams,n=e.displayEmpty,o=e.t,c=e.user;if(!n&&0===Object.keys(s).length)return Object(N.jsx)("span",{children:o("common:No workouts.")});var i=Gt(s,a,r,t,c.weekm);return Object(N.jsx)(Yt,{sports:a,stats:i,t:o})}}]),a}(n.a.PureComponent),$t=Object(v.c)((function(e){return{sports:e.sports.data,statistics:e.statistics.data,user:e.user}}),(function(e){return{loadWorkouts:function(t,a,s){var r="yyyy-MM-dd",n="week"===s.duration?"".concat(s.duration).concat(a?"m":""):s.duration,o={from:Object(D.a)(s.start,r),to:Object(D.a)(s.end,r),time:n};e(function(e,t,a){return function(s){return q.getData("stats/".concat(e,"/").concat(t),a).then((function(e){"success"===e.status?s(B("statistics",e.data)):s(V("statistics|".concat(e.message)))})).catch((function(e){return s(V("statistics|".concat(e)))}))}}(t,s.type,o))}}}))(Xt),Zt=function(e){Object(x.a)(a,e);var t=Object(g.a)(a);function a(e,s){var r;Object(f.a)(this,a),r=t.call(this,e,s);var n=new Date;return r.state={start:Object(vt.a)(n),end:Object(kt.a)(n),duration:"week",type:"by_time"},r}return Object(O.a)(a,[{key:"render",value:function(){var e=this.props.t;return Object(N.jsxs)("div",{className:"card workout-card",children:[Object(N.jsx)("div",{className:"card-header",children:e("dashboard:This month")}),Object(N.jsx)("div",{className:"card-body",children:Object(N.jsx)($t,{displayEmpty:!1,statsParams:this.state,t:e})})]})}}]),a}(n.a.Component);function Qt(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"),","),r=a.total_duration.match(/day/g)?a.total_duration.split(", ")[1]:a.total_duration;return r="".concat(r.split(":")[0],"h ").concat(r.split(":")[1],"min"),Object(N.jsxs)("div",{className:"row",children:[Object(N.jsx)("div",{className:"col-lg-3 col-md-6 col-sm-6",children:Object(N.jsx)("div",{className:"card workout-card",children:Object(N.jsxs)("div",{className:"card-body row",children:[Object(N.jsx)("div",{className:"col-3",children:Object(N.jsx)("i",{className:"fa fa-calendar fa-3x fa-color"})}),Object(N.jsxs)("div",{className:"col-9 text-right",children:[Object(N.jsx)("div",{className:"huge",children:a.nb_workouts}),Object(N.jsx)("div",{children:"".concat(1===a.nb_workouts?t("common:workout"):t("common:workouts"))})]})]})})}),Object(N.jsx)("div",{className:"col-lg-3 col-md-6 col-sm-6",children:Object(N.jsx)("div",{className:"card workout-card",children:Object(N.jsxs)("div",{className:"card-body row",children:[Object(N.jsx)("div",{className:"col-3",children:Object(N.jsx)("i",{className:"fa fa-road fa-3x fa-color"})}),Object(N.jsxs)("div",{className:"col-9 text-right",children:[Object(N.jsx)("div",{className:"huge",children:Number(a.total_distance).toFixed(2)}),Object(N.jsx)("div",{children:"km"})]})]})})}),Object(N.jsx)("div",{className:"col-lg-3 col-md-6 col-sm-6",children:Object(N.jsx)("div",{className:"card workout-card",children:Object(N.jsxs)("div",{className:"card-body row",children:[Object(N.jsx)("div",{className:"col-3",children:Object(N.jsx)("i",{className:"fa fa-clock-o fa-3x fa-color"})}),Object(N.jsxs)("div",{className:"col-9 text-right",children:[Object(N.jsx)("div",{className:"huge",children:s}),Object(N.jsx)("div",{children:r})]})]})})}),Object(N.jsx)("div",{className:"col-lg-3 col-md-6 col-sm-6",children:Object(N.jsx)("div",{className:"card workout-card",children:Object(N.jsxs)("div",{className:"card-body row",children:[Object(N.jsx)("div",{className:"col-3",children:Object(N.jsx)("i",{className:"fa fa-tags fa-3x fa-color"})}),Object(N.jsxs)("div",{className:"col-9 text-right",children:[Object(N.jsx)("div",{className:"huge",children:a.nb_sports}),Object(N.jsx)("div",{children:"".concat(1===a.nb_sports?t("common:sport"):t("common:sports"))})]})]})})})]})}function ea(e){var t=e.sports,a=e.t,s=e.user,r=e.workout;return Object(N.jsxs)("div",{className:"card workout-card text-center",children:[Object(N.jsx)("div",{className:"card-header",children:Object(N.jsxs)(ae.a,{to:"/workouts/".concat(r.id),children:[t.filter((function(e){return e.id===r.sport_id})).map((function(e){return a("sports:".concat(e.label))}))," ","-"," ",Object(D.a)(U(r.workout_date,s.timezone),"dd/MM/yyyy HH:mm")]})}),Object(N.jsx)("div",{className:"card-body",children:Object(N.jsxs)("div",{className:"row",children:[r.map&&Object(N.jsx)("div",{className:"col",children:Object(N.jsx)(ht,{workout:r})}),Object(N.jsx)("div",{className:"col",children:Object(N.jsxs)("p",{children:[Object(N.jsx)("i",{className:"fa fa-clock-o","aria-hidden":"true"})," ",a("workouts:Duration"),": ",r.moving,r.map?Object(N.jsxs)("span",{children:[Object(N.jsx)("br",{}),Object(N.jsx)("br",{})]}):" - ",Object(N.jsx)("i",{className:"fa fa-road","aria-hidden":"true"})," ",a("workouts:Distance"),": ",r.distance," km"]})})]})})]})}var ta=function(e){Object(x.a)(a,e);var t=Object(g.a)(a);function a(e,s){var r;return Object(f.a)(this,a),(r=t.call(this,e,s)).state={page:1},r}return Object(O.a)(a,[{key:"componentDidMount",value:function(){this.props.loadWorkouts()}},{key:"render",value:function(){var e=this,t=this.props,a=t.loadMoreWorkouts,s=t.message,r=t.records,n=t.sports,o=t.t,c=t.user,i=t.workouts,l=!(i.length>0)||null===i[i.length-1].previous_workout,d=this.state.page;return Object(N.jsxs)("div",{children:[Object(N.jsx)(w.a,{children:Object(N.jsxs)("title",{children:["FitTrackee - ",o("common:Dashboard")]})}),s?Object(N.jsx)(_,{message:s,t:o}):i&&c.total_duration&&n.length>0&&Object(N.jsxs)("div",{className:"container dashboard",children:[Object(N.jsx)(Qt,{user:c,t:o}),Object(N.jsxs)("div",{className:"row",children:[Object(N.jsxs)("div",{className:"col-md-4",children:[Object(N.jsx)(Zt,{t:o}),Object(N.jsx)(Lt,{t:o,records:r,sports:n,user:c})]}),Object(N.jsxs)("div",{className:"col-md-8",children:[Object(N.jsx)(Rt,{weekm:c.weekm}),i.length>0?i.map((function(e){return Object(N.jsx)(ea,{workout:e,sports:n,t:o,user:c},e.id)})):Object(N.jsx)(jt,{t:o}),!l&&Object(N.jsx)("input",{type:"submit",className:"btn btn-default btn-md btn-block",value:"Load more workouts",onClick:function(){a(d+1),e.setState({page:d+1})}})]})]})]})]})}}]),a}(n.a.Component),aa=Object(y.a)()(Object(v.c)((function(e){return{workouts:e.workouts.data,message:e.message,records:e.records.data,sports:e.sports.data,user:e.user}}),(function(e){return{loadWorkouts:function(){e(X("getData","workouts",{page:1})),e(X("getData","records"))},loadMoreWorkouts:function(t){e(Fe({page:t}))}}}))(ta));function sa(){return Object(N.jsx)("footer",{className:"footer",children:Object(N.jsxs)("div",{className:"container",children:[Object(N.jsx)("strong",{children:"FitTrackee"})," v","0.4.7"," -"," ",Object(N.jsx)("a",{href:"https://github.com/SamR1/FitTrackee",target:"_blank",rel:"noopener noreferrer",children:"source code"})," ","under"," ",Object(N.jsx)("a",{href:"https://choosealicense.com/licenses/gpl-3.0/",target:"_blank",rel:"noopener noreferrer",children:"GPLv3"})," ","license -"," ",Object(N.jsx)("a",{href:"https://samr1.github.io/FitTrackee/",target:"_blank",rel:"noopener noreferrer",children:"documentation"})]})})}var ra,na,oa,ca,ia,la,da,ua,ma,ja,pa,ha,ba,fa=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(N.jsx)("div",{className:"container dashboard",children:Object(N.jsxs)("div",{className:"row",children:[Object(N.jsx)("div",{className:"col-2"}),Object(N.jsx)("div",{className:"card col-8",children:Object(N.jsx)("div",{className:"card-body",children:Object(N.jsx)("div",{className:"text-center",children:Object(N.jsxs)(pe.a,{i18nKey:"user:loggedOut",children:["You are now logged out. Click ",Object(N.jsx)(ae.a,{to:"/login",children:"here"})," to log back in."]})})})}),Object(N.jsx)("div",{className:"col-2"})]})})}}]),a}(n.a.Component),Oa=Object(v.c)((function(e){return{user:e.user}}),(function(e){return{UserLogout:function(){e({type:"LOGOUT"})}}}))(fa);function xa(){return(xa=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var s in a)Object.prototype.hasOwnProperty.call(a,s)&&(e[s]=a[s])}return e}).apply(this,arguments)}function ga(e,t){if(null==e)return{};var a,s,r=function(e,t){if(null==e)return{};var a,s,r={},n=Object.keys(e);for(s=0;s<n.length;s++)a=n[s],t.indexOf(a)>=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);for(s=0;s<n.length;s++)a=n[s],t.indexOf(a)>=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}function va(e,t){var a=e.title,s=e.titleId,n=ga(e,["title","titleId"]);return r.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":s},n),a?r.createElement("title",{id:s},a):null,ra||(ra=r.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"})),na||(na=r.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"})),oa||(oa=r.createElement("path",{d:"m313.425 198.576h33.93l163.447-135.973c-2.325-9.923-7.93-18.592-15.613-24.796l-181.764 151.211z",fill:"#c20044"})),ca||(ca=r.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"})),ia||(ia=r.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"})),la||(la=r.createElement("path",{d:"m53.273 27.803 145.302 120.879v-120.879z",fill:"#406bd4"})),da||(da=r.createElement("path",{d:"m313.425 150.571v-122.768h148.082z",fill:"#3257b0"})),ua||(ua=r.createElement("path",{d:"m394.732 198.575 117.268-97.556v97.556z",fill:"#3257b0"})),ma||(ma=r.createElement("g",{fill:"#406bd4"},r.createElement("path",{d:"m0 99.317v99.258h119.313z"}),r.createElement("path",{d:"m0 313.425v97.699l117.44-97.699z"}),r.createElement("path",{d:"m50.49 484.197 148.085-122.676v122.676z"}))),ja||(ja=r.createElement("path",{d:"m313.425 484.197v-124.139l149.221 124.139z",fill:"#3257b0"})),pa||(pa=r.createElement("path",{d:"m512 409.423-115.395-95.998h115.395z",fill:"#3257b0"})),ha||(ha=r.createElement("path",{d:"m512 222.142h-222.142v-194.339h-67.716v194.339h-222.142v67.716h222.142v194.339h67.716v-194.339h222.142z",fill:"#f40055"})),ba||(ba=r.createElement("path",{d:"m289.858 222.142v-194.339h-33.858v456.394h33.858v-194.339h222.142v-67.716z",fill:"#c20044"})))}var ka,wa,ya,Na,_a=r.forwardRef(va);a.p;function Sa(){return(Sa=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var s in a)Object.prototype.hasOwnProperty.call(a,s)&&(e[s]=a[s])}return e}).apply(this,arguments)}function Da(e,t){if(null==e)return{};var a,s,r=function(e,t){if(null==e)return{};var a,s,r={},n=Object.keys(e);for(s=0;s<n.length;s++)a=n[s],t.indexOf(a)>=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);for(s=0;s<n.length;s++)a=n[s],t.indexOf(a)>=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}function Ca(e,t){var a=e.title,s=e.titleId,n=Da(e,["title","titleId"]);return r.createElement("svg",Sa({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":s},n),a?r.createElement("title",{id:s},a):null,ka||(ka=r.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"})),wa||(wa=r.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"})),ya||(ya=r.createElement("path",{d:"m160.795 27.803h190.409v456.394h-190.409z",fill:"#f0f9ff"})),Na||(Na=r.createElement("path",{d:"m256 27.803h95.205v456.394h-95.205z",fill:"#cee5f5"})))}var Ea,Aa,Ma,Ta,Pa,za,Fa,Ra=r.forwardRef(Ca),La=(a.p,[{name:"en",selected:!0,flag:Object(N.jsx)(_a,{})},{name:"fr",selected:!1,flag:Object(N.jsx)(Ra,{})}]),Ua=function(e){Object(x.a)(a,e);var t=Object(g.a)(a);function a(e){var s;return Object(f.a)(this,a),(s=t.call(this,e)).state={isOpen:!1},s}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,r=a.onUpdateLanguage;return Object(N.jsx)("div",{className:"dropdown-wrapper",onClick:function(){return e.toggleDropdown()},children:Object(N.jsx)("ul",{className:"dropdown-list i18n-flag",children:La.filter((function(e){return t?e:e.name===s})).map((function(e){return Object(N.jsxs)("li",{className:"dropdown-item".concat(e.name===s&&t?" dropdown-item-selected":""),onClick:function(){return r(e.name,s)},children:[e.flag," ",e.name]},e.name)}))})})}}]),a}(r.Component),Ia=Object(v.c)((function(e){return{language:e.language}}),(function(e){return{onUpdateLanguage:function(t,a){t!==a&&e($(t))}}}))(Ua),Wa=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,r=e.t,n=e.username;return Object(N.jsx)("header",{children:Object(N.jsx)("nav",{className:"navbar navbar-expand-lg navbar-light bg-light",children:Object(N.jsxs)("div",{className:"container",children:[Object(N.jsx)("span",{className:"navbar-brand",children:"FitTrackee"}),Object(N.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(N.jsx)("span",{className:"navbar-toggler-icon"})}),Object(N.jsxs)("div",{className:"collapse navbar-collapse",id:"navbarSupportedContent",children:[Object(N.jsxs)("ul",{className:"navbar-nav mr-auto",children:[Object(N.jsx)("li",{className:"nav-item",children:Object(N.jsx)(ae.a,{className:"nav-link",to:{pathname:"/"},children:r("common:Dashboard")})}),a&&Object(N.jsx)("li",{className:"nav-item",children:Object(N.jsx)(ae.a,{className:"nav-link",to:{pathname:"/workouts/history"},children:r("Workouts")})}),a&&Object(N.jsx)("li",{className:"nav-item",children:Object(N.jsx)(ae.a,{className:"nav-link",to:{pathname:"/workouts/statistics"},children:r("common:Statistics")})}),t&&Object(N.jsx)("li",{className:"nav-item",children:Object(N.jsx)(ae.a,{className:"nav-link",to:{pathname:"/admin"},children:"Admin"})}),a&&Object(N.jsx)("li",{className:"nav-item",children:Object(N.jsx)(ae.a,{className:"nav-link",to:{pathname:"/workouts/add"},children:Object(N.jsx)("strong",{children:r("common:Add workout")})})})]}),Object(N.jsxs)("ul",{className:"navbar-nav flex-row ml-md-auto d-none d-md-flex",children:[!a&&Object(N.jsx)("li",{className:"nav-item",children:Object(N.jsx)(ae.a,{className:"nav-link",to:{pathname:"/register"},children:r("user:Register")})}),!a&&Object(N.jsx)("li",{className:"nav-item",children:Object(N.jsx)(ae.a,{className:"nav-link",to:{pathname:"/login"},children:r("user:Login")})}),a&&Object(N.jsxs)(N.Fragment,{children:[!0===s?Object(N.jsx)("img",{alt:"Avatar",src:"".concat(T,"users/").concat(n,"/picture?").concat(Date.now()),className:"img-fluid App-nav-profile-img"}):Object(N.jsx)("i",{className:"fa fa-user-circle-o fa-2x no-picture","aria-hidden":"true"}),Object(N.jsx)("li",{className:"nav-item",children:Object(N.jsx)(ae.a,{className:"nav-link",to:{pathname:"/profile"},children:n})}),Object(N.jsx)("li",{className:"nav-item",children:Object(N.jsx)(ae.a,{className:"nav-link",to:{pathname:"/logout"},children:r("user:Logout")})})]}),Object(N.jsx)("li",{children:Object(N.jsx)(Ia,{})})]})]})]})})})}}]),a}(n.a.PureComponent),Ha=Object(y.a)()(Object(v.c)((function(e){var t=e.user;return{admin:t.admin,isAuthenticated:t.isAuthenticated,picture:t.picture,username:t.username}}))(Wa));function qa(){return(qa=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var s in a)Object.prototype.hasOwnProperty.call(a,s)&&(e[s]=a[s])}return e}).apply(this,arguments)}function Ba(e,t){if(null==e)return{};var a,s,r=function(e,t){if(null==e)return{};var a,s,r={},n=Object.keys(e);for(s=0;s<n.length;s++)a=n[s],t.indexOf(a)>=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);for(s=0;s<n.length;s++)a=n[s],t.indexOf(a)>=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}function Ga(e,t){var a=e.title,s=e.titleId,n=Ba(e,["title","titleId"]);return r.createElement("svg",qa({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":s},n),a?r.createElement("title",{id:s},a):null,Ea||(Ea=r.createElement("g",null,r.createElement("g",null,r.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"})))),Aa||(Aa=r.createElement("g",null,r.createElement("g",null,r.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"})))),Ma||(Ma=r.createElement("g",null,r.createElement("g",null,r.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"})))),Ta||(Ta=r.createElement("g",null,r.createElement("g",null,r.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"})))),Pa||(Pa=r.createElement("g",null,r.createElement("g",null,r.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"})))),za||(za=r.createElement("g",null,r.createElement("g",null,r.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"})))),Fa||(Fa=r.createElement("g",null,r.createElement("g",null,r.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"})))))}var Va,Ja=r.forwardRef(Ga);a.p;function Ka(){return(Ka=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var s in a)Object.prototype.hasOwnProperty.call(a,s)&&(e[s]=a[s])}return e}).apply(this,arguments)}function Ya(e,t){if(null==e)return{};var a,s,r=function(e,t){if(null==e)return{};var a,s,r={},n=Object.keys(e);for(s=0;s<n.length;s++)a=n[s],t.indexOf(a)>=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);for(s=0;s<n.length;s++)a=n[s],t.indexOf(a)>=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}function Xa(e,t){var a=e.title,s=e.titleId,n=Ya(e,["title","titleId"]);return r.createElement("svg",Ka({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":s},n),a?r.createElement("title",{id:s},a):null,Va||(Va=r.createElement("g",null,r.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"}),r.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"}),r.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"}),r.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"}))))}var $a=r.forwardRef(Xa);a.p;function Za(e){var t=Object(ue.a)().t,a=e.action;return Object(N.jsx)("div",{className:"container dashboard",children:Object(N.jsxs)("div",{className:"row",children:[Object(N.jsx)("div",{className:"col-2"}),Object(N.jsx)("div",{className:"card col-8",children:Object(N.jsx)("div",{className:"card-body",children:Object(N.jsxs)("div",{className:"text-center ",children:["sent"===a&&Object(N.jsxs)(N.Fragment,{children:[Object(N.jsx)("div",{className:"svg-icon",children:Object(N.jsx)($a,{})}),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(N.jsxs)(N.Fragment,{children:[Object(N.jsx)("div",{className:"svg-icon",children:Object(N.jsx)(Ja,{})}),Object(N.jsxs)(pe.a,{i18nKey:"user:updatedPasswordText",children:["Your password have been updated. Click",Object(N.jsx)(ae.a,{to:"/login",children:"here"})," to log in."]})]})]})})}),Object(N.jsx)("div",{className:"col-2"})]})})}var Qa=a(233),es=a.n(Qa),ts=function(e){Object(x.a)(a,e);var t=Object(g.a)(a);function a(e,s){var r;return Object(f.a)(this,a),(r=t.call(this,e,s)).state={formData:{},displayModal:!1},r}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,r=t.onHandleProfileFormSubmit,n=t.t,o=t.user,c=this.state,i=c.displayModal,l=c.formData;return Object(N.jsxs)("div",{children:[Object(N.jsx)(w.a,{children:Object(N.jsxs)("title",{children:["FitTrackee - ",n("user:Profile Edition")]})}),l.isAuthenticated&&Object(N.jsxs)("div",{className:"container",children:[i&&Object(N.jsx)(He,{title:n("common:Confirmation"),text:n("user:Are you sure you want to delete your account? All data will be deleted, this cannot be undone."),confirm:function(){s(o.username),e.displayModal(!1)},close:function(){return e.displayModal(!1)}}),Object(N.jsx)("h1",{className:"page-title",children:n("user:Profile Edition")}),Object(N.jsxs)("div",{className:"row",children:[Object(N.jsx)("div",{className:"col-md-2"}),Object(N.jsx)("div",{className:"col-md-8",children:Object(N.jsxs)("div",{className:"card",children:[Object(N.jsx)("div",{className:"card-header",children:o.username}),Object(N.jsx)("div",{className:"card-body",children:Object(N.jsx)("div",{className:"row",children:Object(N.jsxs)("div",{className:"col-md-12",children:[Object(N.jsxs)("form",{onSubmit:function(e){e.preventDefault(),r(l)},children:[Object(N.jsx)("div",{className:"form-group",children:Object(N.jsxs)("label",{children:[n("user:Email"),":",Object(N.jsx)("input",{name:"email",className:"form-control input-lg",type:"text",value:l.email,readOnly:!0})]})}),Object(N.jsx)("div",{className:"form-group",children:Object(N.jsxs)("label",{children:[n("user:Registration Date"),":",Object(N.jsx)("input",{name:"createdAt",className:"form-control input-lg",type:"text",value:l.created_at,disabled:!0})]})}),Object(N.jsx)("div",{className:"form-group",children:Object(N.jsxs)("label",{children:[n("user:Password"),":",Object(N.jsx)("input",{name:"password",className:"form-control input-lg",type:"password",onChange:function(t){return e.handleFormChange(t)}})]})}),Object(N.jsx)("div",{className:"form-group",children:Object(N.jsxs)("label",{children:[n("user:Password Confirmation"),":",Object(N.jsx)("input",{name:"password_conf",className:"form-control input-lg",type:"password",onChange:function(t){return e.handleFormChange(t)}})]})}),Object(N.jsx)("hr",{}),Object(N.jsx)("div",{className:"form-group",children:Object(N.jsxs)("label",{children:[n("user:First Name"),":",Object(N.jsx)("input",{name:"first_name",className:"form-control input-lg",type:"text",value:l.first_name,onChange:function(t){return e.handleFormChange(t)}})]})}),Object(N.jsx)("div",{className:"form-group",children:Object(N.jsxs)("label",{children:[n("user:Last Name"),":",Object(N.jsx)("input",{name:"last_name",className:"form-control input-lg",type:"text",value:l.last_name,onChange:function(t){return e.handleFormChange(t)}})]})}),Object(N.jsx)("div",{className:"form-group",children:Object(N.jsxs)("label",{children:[n("user:Birth Date"),Object(N.jsx)("input",{name:"birth_date",className:"form-control input-lg",type:"date",value:l.birth_date,onChange:function(t){return e.handleFormChange(t)}})]})}),Object(N.jsx)("div",{className:"form-group",children:Object(N.jsxs)("label",{children:[n("user:Location"),":",Object(N.jsx)("input",{name:"location",className:"form-control input-lg",type:"text",value:l.location,onChange:function(t){return e.handleFormChange(t)}})]})}),Object(N.jsx)("div",{className:"form-group",children:Object(N.jsxs)("label",{children:[n("user:Bio"),":",Object(N.jsx)("textarea",{name:"bio",className:"form-control input-lg",maxLength:"200",value:l.bio,onChange:function(t){return e.handleFormChange(t)}})]})}),Object(N.jsx)("div",{className:"form-group",children:Object(N.jsxs)("label",{children:[n("user:Language"),":",Object(N.jsx)("select",{name:"language",className:"form-control input-lg",value:l.language,onChange:function(t){return e.handleFormChange(t)},children:La.map((function(e){return Object(N.jsx)("option",{value:e.name,children:e.name},e.name)}))})]})}),Object(N.jsx)("div",{className:"form-group",children:Object(N.jsxs)("label",{children:[n("user:Timezone"),":",Object(N.jsx)(es.a,{className:"form-control timezone-custom",onChange:function(t){var a={target:{name:"timezone",value:t||"Europe/Paris"}};e.handleFormChange(a)},value:l.timezone})]})}),Object(N.jsx)("div",{className:"form-group",children:Object(N.jsxs)("label",{children:[n("user:First day of week"),":",Object(N.jsxs)("select",{name:"weekm",className:"form-control input-lg",value:l.weekm?"Monday":"Sunday",onChange:function(t){return e.handleFormChange(t)},children:[Object(N.jsx)("option",{value:"Sunday",children:n("user:Sunday")}),Object(N.jsx)("option",{value:"Monday",children:n("user:Monday")})]})]})}),Object(N.jsx)("button",{type:"submit",className:"btn btn-primary",children:n("common:Submit")}),Object(N.jsx)("button",{className:"btn btn-danger",onClick:function(t){t.preventDefault(),e.displayModal(!0)},children:n("user:Delete my account")}),Object(N.jsx)("button",{type:"submit",className:"btn btn-secondary",onClick:function(){return Hs.push("/profile")},children:n("common:Cancel")})]}),Object(N.jsx)(_,{message:a,t:n})]})})})]})}),Object(N.jsx)("div",{className:"col-md-2"})]})]})]})}}]),a}(n.a.Component),as=Object(y.a)()(Object(v.c)((function(e){return{location:e.router.location,message:e.message,user:e.user}}),(function(e){return{onDeleteUser:function(t){e(Me(t))},onHandleProfileFormSubmit:function(t){e(function(e){return function(t){return!e.password===e.password_conf?t(De("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(Ee()),Hs.push("/profile");t(De(e.message))})).catch((function(e){throw e})))}}(t))}}}))(ts)),ss=a(472),rs=a(473),ns=a(474),os=a(234),cs=["week","month","year"],is=function(e){Object(x.a)(a,e);var t=Object(g.a)(a);function a(e,s){var r;Object(f.a)(this,a),r=t.call(this,e,s);var n=new Date;return r.state={displayedSports:e.sports.map((function(e){return e.id})),statsParams:{start:Object(vt.a)(Object(Et.a)(n,11)),end:Object(kt.a)(n),duration:"month",type:"by_time"}},r}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,s="year"===t?Object(It.a)(Object(ss.a)(a,9)):"week"===t?Object(vt.a)(Object(Et.a)(a,2)):Object(vt.a)(Object(Et.a)(a,11)),r="year"===t?Object(rs.a)(a):"week"===t?Object(yt.a)(a):Object(kt.a)(a);this.setState({statsParams:{duration:t,end:r,start:s,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,s=this.state.statsParams,r=s.start,n=s.end,o=s.duration;e?(t="year"===o?Object(It.a)(Object(ss.a)(r,1)):"week"===o?Object(wt.a)(Object(ns.a)(r,1)):Object(vt.a)(Object(Et.a)(r,1)),a="year"===o?Object(rs.a)(Object(ss.a)(n,1)):"week"===o?Object(yt.a)(Object(ns.a)(n,1)):Object(kt.a)(Object(Et.a)(n,1))):(t="year"===o?Object(It.a)(Object(Ut.a)(r,1)):"week"===o?Object(wt.a)(Object(os.a)(r,1)):Object(vt.a)(Object(Ct.a)(r,1)),a="year"===o?Object(rs.a)(Object(Ut.a)(n,1)):"week"===o?Object(yt.a)(Object(os.a)(n,1)):Object(kt.a)(Object(Ct.a)(n,1))),this.setState({statsParams:{duration:o,end:a,start:t,type:"by_time"}})}},{key:"render",value:function(){var e=this,t=this.state,a=t.displayedSports,s=t.statsParams,r=this.props,n=r.sports,o=r.t,c=r.user,i=Ne(n.filter((function(e){return c.sports_list.includes(e.id)})),o);return Object(N.jsxs)(N.Fragment,{children:[Object(N.jsx)(w.a,{children:Object(N.jsxs)("title",{children:["FitTrackee - ",o("statistics:Statistics")]})}),Object(N.jsxs)("div",{className:"container dashboard",children:[Object(N.jsxs)("div",{className:"card workout-card",children:[Object(N.jsx)("div",{className:"card-header",children:o("statistics:Statistics")}),Object(N.jsxs)("div",{className:"card-body".concat(0===c.nb_workouts?" stats-disabled":""),children:[Object(N.jsxs)("div",{className:"chart-filters row",children:[Object(N.jsx)("div",{className:"col chart-arrows",children:Object(N.jsx)("p",{className:"text-center",children:Object(N.jsx)("i",{className:"fa fa-chevron-left","aria-hidden":"true",onClick:function(){return e.handleOnClickArrows(!0)}})})}),Object(N.jsx)("div",{className:"col-md-3 time-frames justify-content-around",children:cs.map((function(t){return Object(N.jsx)("div",{className:"time-frame",children:Object(N.jsxs)("label",{children:[Object(N.jsx)("input",{type:"radio",id:t,name:t,checked:t===s.duration,onChange:function(t){return e.handleOnChangeDuration(t)}}),Object(N.jsx)("span",{children:o("statistics:".concat(t))})]})},t)}))}),Object(N.jsx)("div",{className:"col chart-arrows",children:Object(N.jsx)("p",{className:"text-center",children:Object(N.jsx)("i",{className:"fa fa-chevron-right","aria-hidden":"true",onClick:function(){return e.handleOnClickArrows(!1)}})})})]}),Object(N.jsx)($t,{displayEmpty:!0,displayedSports:a,statsParams:s,t:o}),Object(N.jsx)("div",{className:"row chart-workouts",children:i.map((function(t){return Object(N.jsxs)("label",{className:"col workout-label",children:[Object(N.jsx)("input",{type:"checkbox",checked:a.includes(t.id),name:t.label,onChange:function(){return e.handleOnChangeSports(t.id)}}),Object(N.jsx)("span",{style:{color:xe[t.id-1]},children:" ".concat(t.label)})]},t.id)}))})]})]}),0===c.nb_workouts&&Object(N.jsx)(jt,{t:o})]})]})}}]),a}(n.a.Component),ls=Object(y.a)()(Object(v.c)((function(e){return{sports:e.sports.data,user:e.user}}))(is));function ds(e){var t=Object(ue.a)().t,a="user:".concat(e.formType.charAt(0).toUpperCase()).concat(e.formType.slice(1));return Object(N.jsxs)("div",{children:[Object(N.jsx)(w.a,{children:Object(N.jsxs)("title",{children:["FitTrackee - ",t("user:".concat(e.formType))]})}),Object(N.jsx)("h1",{className:"page-title",children:t(a)}),Object(N.jsx)("div",{className:"container",children:Object(N.jsxs)("div",{className:"row",children:[Object(N.jsx)("div",{className:"col-md-3"}),Object(N.jsxs)("div",{className:"col-md-6",children:[Object(N.jsx)("br",{}),"register"!==e.formType||e.isRegistrationAllowed?Object(N.jsxs)(N.Fragment,{children:[Object(N.jsxs)("form",{onSubmit:function(t){return e.handleUserFormSubmit(t,e.formType)},children:["register"===e.formType&&Object(N.jsx)("div",{className:"form-group",children:Object(N.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(N.jsx)("div",{className:"form-group",children:Object(N.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(N.jsxs)(N.Fragment,{children:[Object(N.jsx)("div",{className:"form-group",children:Object(N.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(N.jsx)("div",{className:"form-group",children:Object(N.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(N.jsx)("input",{type:"submit",className:"btn btn-primary btn-lg btn-block",value:t("Submit")})]}),Object(N.jsx)("p",{className:"password-forget",children:"login"===e.formType&&Object(N.jsx)(ae.a,{to:{pathname:"/password-reset/request"},children:t("user:Forgot password?")})})]}):Object(N.jsxs)("div",{className:"card",children:[Object(N.jsx)("div",{className:"card-body",children:"Registration is disabled."}),Object(N.jsx)("div",{className:"card-body",children:Object(N.jsx)("button",{type:"submit",className:"btn btn-secondary btn-lg btn-block",onClick:function(){return Hs.go(-1)},children:"Back"})})]})]}),Object(N.jsx)("div",{className:"col-md-3"})]})})]})}var us=function(e){Object(x.a)(a,e);var t=Object(g.a)(a);function a(e,s){var r;return Object(f.a)(this,a),(r=t.call(this,e,s)).state={formData:{username:"",email:"",password:"",password_conf:""}},r}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,r=t.message,n=t.messages,o=t.onHandleUserFormSubmit,c=t.t,i=this.state.formData,l=this.props.location.query.token;return Object(N.jsx)("div",{children:F()||"password reset"===a&&!l?Object(N.jsx)(k.a,{to:"/"}):Object(N.jsxs)("div",{children:[Object(N.jsx)(_,{message:r,messages:n,t:c}),Object(N.jsx)(ds,{isRegistrationAllowed:s,formType:a,userForm:i,onHandleFormChange:function(t){return e.onHandleFormChange(t)},handleUserFormSubmit:function(e){e.preventDefault(),"password reset"===a&&(i.token=l),o(i,a)}})]})})}}]),a}(n.a.Component),ms=Object(y.a)()(Object(v.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(Ae(t,a="password reset"===a?"password/update":"reset your password"===a?"password/reset-request":a))}}}))(us)),js=function(e){Object(x.a)(a,e);var t=Object(g.a)(a);function a(e,s){var r;return Object(f.a)(this,a),(r=t.call(this,e,s)).state={displayModal:!1},r}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,r=t.onDeleteUser,n=t.users,o=this.state.displayModal,c=Object(he.a)(n,1)[0],i=!!c&&s.username===c.username;return Object(N.jsxs)("div",{children:[o&&Object(N.jsx)(He,{title:a("common:Confirmation"),text:a("user:Are you sure you want to delete this account? All data will be deleted, this cannot be undone."),confirm:function(){r(c.username),e.displayModal(!1)},close:function(){return e.displayModal(!1)}}),c&&Object(N.jsx)(xt,{editable:i,isDeletable:s.admin&&!i,onDeleteUser:r,displayModal:function(t){return e.displayModal(t)},t:a,user:c})]})}}]),a}(n.a.Component),ps=Object(y.a)()(Object(v.c)((function(e){return{currentUser:e.user,users:e.users.data}}),(function(e){return{onDeleteUser:function(t){e(Me(t,!0))},loadUser:function(t){e(X("getData","users",{username:t}))}}}))(js)),hs=function(e){Object(x.a)(a,e);var t=Object(g.a)(a);function a(e){var s;return Object(f.a)(this,a),(s=t.call(this,e)).props=e,s}return Object(O.a)(a,[{key:"componentDidMount",value:function(){this.props.loadAppConfig()}},{key:"render",value:function(){return Object(N.jsxs)("div",{className:"App",children:[Object(N.jsx)(Ha,{}),Object(N.jsxs)(k.d,{children:[Object(N.jsx)(k.b,{exact:!0,path:"/",component:aa}),Object(N.jsx)(k.b,{exact:!0,path:"/register",render:function(){return Object(N.jsx)(ms,{formType:"register"})}}),Object(N.jsx)(k.b,{exact:!0,path:"/login",render:function(){return Object(N.jsx)(ms,{formType:"login"})}}),Object(N.jsx)(k.b,{exact:!0,path:"/password-reset",render:function(){return Object(N.jsx)(ms,{formType:"password reset"})}}),Object(N.jsx)(k.b,{exact:!0,path:"/password-reset/request",render:function(){return Object(N.jsx)(ms,{formType:"reset your password"})}}),Object(N.jsx)(k.b,{exact:!0,path:"/password-reset/sent",render:function(){return Object(N.jsx)(Za,{action:"sent"})}}),Object(N.jsx)(k.b,{exact:!0,path:"/updated-password",render:function(){return Object(N.jsx)(Za,{action:"updated"})}}),Object(N.jsx)(k.b,{exact:!0,path:"/password-reset/sent",component:Za}),Object(N.jsx)(k.b,{exact:!0,path:"/logout",component:Oa}),Object(N.jsx)(k.b,{exact:!0,path:"/profile/edit",component:as}),Object(N.jsx)(k.b,{exact:!0,path:"/profile",component:gt}),Object(N.jsx)(k.b,{exact:!0,path:"/workouts/history",component:Ot}),Object(N.jsx)(k.b,{exact:!0,path:"/workouts/statistics",component:ls}),Object(N.jsx)(k.b,{exact:!0,path:"/users/:userName",component:ps}),Object(N.jsx)(k.b,{path:"/workouts",component:mt}),Object(N.jsx)(k.b,{path:"/admin",component:je}),Object(N.jsx)(k.b,{component:me})]}),Object(N.jsx)(sa,{})]})}}]),a}(n.a.Component),bs=Object(v.c)((function(){return{}}),(function(e){return{loadAppConfig:function(){e(Q("config"))}}}))(hs),fs=a(80);function Os(e){var t=e.store,a=e.history,s=e.children;return Object(N.jsx)(v.a,{store:t,children:Object(N.jsx)(fs.a,{history:a,children:s})})}var xs=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 gs(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 vs,ks={data:[]},ws={language:"en",message:"",messages:[],user:{isAuthenticated:!1},workouts:Object(S.a)({},ks),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}},calendarWorkouts:Object(S.a)({},ks),chartData:[],gpx:null,loading:!1,records:Object(S.a)({},ks),sports:Object(S.a)({},ks),statistics:{data:{}},users:Object(S.a)({},ks)},ys=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},Ns=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ws.workouts,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"LOGOUT":return ws.workouts;case"PUSH_WORKOUTS":return Object(S.a)(Object(S.a)({},e),{},{data:e.data.concat(t.workouts)});case"REMOVE_WORKOUT":return Object(S.a)(Object(S.a)({},e),{},{data:e.data.filter((function(e){return e.id!==t.workoutId}))});default:return ys(e,"workouts",t)}},_s=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ws.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},Ss=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ws.calendarWorkouts,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"LOGOUT":return ws.calendarWorkouts;case"UPDATE_CALENDAR":return Object(S.a)(Object(S.a)({},e),{},{data:t.workouts});default:return ys(e,"calendarWorkouts",t)}},Ds=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ws.chartData,t=arguments.length>1?arguments[1]:void 0;return"SET_CHART_DATA"===t.type?t.chartData:e},Cs=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ws.gpx,t=arguments.length>1?arguments[1]:void 0;return"SET_GPX"===t.type?t.gpxContent:e},Es=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ws.language,t=arguments.length>1?arguments[1]:void 0;return"SET_LANGUAGE"===t.type?t.language:e},As=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ws.loading,t=arguments.length>1?arguments[1]:void 0;return"SET_LOADING"===t.type?t.loading:e},Ms=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ws.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"CLEAN_ALL_MESSAGES":case"LOGOUT":case"PROFILE_SUCCESS":case"SET_APP_CONFIG":case"SET_RESULTS":case"@@router/LOCATION_CHANGE":return"";default:return e}},Ts=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ws.messages,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"AUTH_ERRORS":case"APP_ERRORS":return t.messages;case"CLEAN_ALL_MESSAGES":case"LOGOUT":case"PROFILE_SUCCESS":case"@@router/LOCATION_CHANGE":return[];default:return e}},Ps=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ws.records,t=arguments.length>1?arguments[1]:void 0;return"LOGOUT"===t.type?ws.records:ys(e,"records",t)},zs=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ws.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}))}):ys(e,"sports",t)},Fs=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ws.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}))}):ys(e,"users",t)},Rs=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ws.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"),ws.user;case"PROFILE_SUCCESS":return t.profil;default:return e}},Ls=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ws.statistics,t=arguments.length>1?arguments[1]:void 0;return"LOGOUT"===t.type?ws.statistics:ys(e,"statistics",t)},Us=["/login","/register","/password-reset","/password-reset/request","/password-reset/sent","/updated-password"],Is=function(e,t){return"string"===typeof e||e instanceof String?e=t:e.pathname=t,e},Ws=function(e){return window.localStorage.authToken||Us.includes(e.pathname)||(e=Is(e,"/login")),window.localStorage.authToken&&Us.includes(e.pathname)&&(e=Is(e,"/")),e},Hs=((vs=Object(s.a)()).location=Ws(vs.location),Object(S.a)(Object(S.a)({},vs),{},{push:function(e){for(var t=arguments.length,a=new Array(t>1?t-1:0),s=1;s<t;s++)a[s-1]=arguments[s];return vs.push.apply(vs,[Ws(e)].concat(a))},replace:function(e){for(var t=arguments.length,a=new Array(t>1?t-1:0),s=1;s<t;s++)a[s-1]=arguments[s];return vs.replace.apply(vs,[Ws(e)].concat(a))}}));Hs.listen((function(){window.scrollTo(0,0)}));var qs,Bs=document.getElementById("root"),Gs=Object(d.d)((qs=Hs,Object(d.b)({workouts:Ns,application:_s,calendarWorkouts:Ss,chartData:Ds,gpx:Cs,language:Es,loading:As,message:Ms,messages:Ts,records:Ps,router:Object(fs.b)(qs),sports:zs,statistics:Ls,user:Rs,users:Fs})),window.__STATE__,(window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__||d.c)(Object(d.a)(Object(l.a)(Hs),u.a)));null!==window.localStorage.authToken&&Gs.dispatch(Ce()),i.a.render(Object(N.jsx)(Os,{store:Gs,history:Hs,children:Object(N.jsx)(o.a,{i18n:b,children:Object(N.jsx)(bs,{})})}),Bs),function(){if("serviceWorker"in navigator){if(new URL("",window.location).origin!==window.location.origin)return;window.addEventListener("load",(function(){var e="".concat("","/service-worker.js");xs?function(e){fetch(e).then((function(t){404===t.status||-1===t.headers.get("content-type").indexOf("javascript")?navigator.serviceWorker.ready.then((function(e){e.unregister().then((function(){window.location.reload()}))})):gs(e)})).catch((function(){console.log("No internet connection found. App is running in offline mode.")}))}(e):gs(e)}))}}()}},[[456,1,2]]]);
|
|
//# sourceMappingURL=main.77af5296.chunk.js.map
|