!function(e){function t(t){for(var r,i,l=t[0],s=t[1],c=t[2],u=0,p=[];u({state:t.type,error:t.error});t.PasswordResetPage=e=>{const a=d.ConfigHelper.useAuthContext(),[h,_]=n.useReducer(f,E),y=o.useHistory(),{sendRequest:C,callbackAction:b,data:P,error:I,isLoading:R}=c.useRequest();n.useEffect(()=>{a.isAuthenticated?y.push("/"):A()},[a.isAuthenticated]),n.useEffect(()=>{!R&&!I&&P&&P.validity&&b&&b.type===g.URL_VALID&&_({type:b.type}),!R&&(I||P&&!P.validity)&&b&&b.type===g.URL_VALID&&_({type:g.URL_EXPIRED_OR_INVALID,error:"This link has either expired or is invalid. Please try again with a new password reset request."}),R||I||!b||b.type!==g.PASSWORD_UPDATED||(a.logout(),_({type:b.type})),!R&&I&&b&&b.type===g.PASSWORD_UPDATED&&_({type:g.UPDATE_FAILED,error:"We could not update your password. Please try again."})},[R,I,P,b,_]);const A=()=>{if(!R){var t=new URLSearchParams(e.location.search),a=t.get("email"),r=t.get("key");a&&r?C({type:g.URL_VALID},d.ConfigHelper.getRootUrl("BACKEND_API_ROOT_URL"),`v1/check-password-reset-request-validity?email=${encodeURIComponent(a)}&key=${r}`,"GET"):_({type:g.URL_EXPIRED_OR_INVALID})}},w=(e,t)=>{s.FormControllerGroup.defaultOnChangeHandler(v,T,e,t)},[v,T]=n.useState(new s.FormControllerGroup({label:"PasswordResetForm",handleChangeCallback:w,controllers:[{label:m.password,valueType:s.FormControllerValueTypes.password,handleChangeCallback:w,initialValue:"",errorValidators:[s.fieldNotEmpty,s.matchesPasswordRequirements]},{label:m.passwordConfirmation,valueType:s.FormControllerValueTypes.password,handleChangeCallback:w,initialValue:"",errorValidators:[e=>e===v.getController([m.password]).value?null:t.PASSWORD_CONFIRMATION_NOT_MATCHING_ERROR_LABEL]}]})),O=()=>{if(!R){var t=v.applyValidators();if(t.isValid()){var a=new URLSearchParams(e.location.search),r=a.get("email"),n=a.get("key");C({type:g.PASSWORD_UPDATED},d.ConfigHelper.getRootUrl("BACKEND_API_ROOT_URL"),"v1/reset-password","POST",{email:r,key:n,password:v.getController([m.password]).value})}else T(t)}};return r.createElement(r.Fragment,null,r.createElement(u.PublicCardLayout,{title:"Password reset",subtitle:(()=>{switch(h.state){case g.CHECKING_URL:return"Checking link validity ...";case g.URL_VALID:return"Please enter your new password";case g.URL_EXPIRED_OR_INVALID:case g.UPDATE_FAILED:return"Oups, something went wrong";case g.PASSWORD_UPDATED:return a.isAuthenticated?"Logging you out...":"All done! :)";default:return null}})(),additionalContent:r.createElement(r.Fragment,null,h.state==g.PASSWORD_UPDATED&&r.createElement("div",{className:"password-reset-feedback success-feedback"},r.createElement(i.default,null),r.createElement("span",null,"Your password has been updated!")),h.error&&r.createElement("div",{className:"password-reset-feedback error-feedback"},r.createElement(l.default,null),r.createElement("span",null,h.error)),h.state==g.URL_VALID&&r.createElement("form",{noValidate:!0,autoComplete:"off",id:"password-reset-form"},r.createElement(s.NewPasswordInputForm,{id:"password-reset-form-password",label:"Password",controller:v.getController([m.password])}),r.createElement(s.InputForm,{id:"password-reset-form-password-confirmation",inputType:s.FormControllerValueTypes.password,required:!0,label:"Password confirmation",controller:v.getController([m.passwordConfirmation]),onEnter:O}))),actions:h.state==g.URL_VALID?[{text:"Reset password",onClick:O,color:"primary",isLoading:R}]:h.state!=g.PASSWORD_UPDATED||a.isAuthenticated?[]:[{text:"Login",onClick:()=>{y.push(p.LOGIN_PATH)},color:"primary",isLoading:R}]}))}},131:function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LoginPage=t.getStoredIdentifier=t.getRememberMe=t.saveRememberMe=t.clearRememberMe=void 0;const r=a(0),n=a(0),o=a(40);a(287);const i=a(46),l=a(134),s=a(135),c=a(65),d=a(66),u=a(52),p=a(57),m=a(93),g=a(41);var E;t.clearRememberMe=()=>{localStorage.removeItem("REMEMBER_ME"),localStorage.removeItem("REMEMBER_ME_IDENTIFIER")},t.saveRememberMe=e=>{localStorage.setItem("REMEMBER_ME","true"),localStorage.setItem("REMEMBER_ME_IDENTIFIER",e)},t.getRememberMe=()=>{var e;return null!==(e=localStorage.getItem("REMEMBER_ME"))&&void 0!==e?e:""},t.getStoredIdentifier=()=>{var e;return null!==(e=localStorage.getItem("REMEMBER_ME_IDENTIFIER"))&&void 0!==e?e:""},function(e){e.PRISTINE="pristine",e.LOGIN_LOCAL="local",e.LOGIN_LOCAL_FAIL="local-fail",e.LOGIN_GOOGLE="google",e.LOGIN_GITHUB="github"}(E||(E={}));const f={state:E.PRISTINE,isLoading:!1,error:void 0},h=(e,t)=>{switch(t.type){case E.PRISTINE:return Object.assign(Object.assign({},f),{error:t.error});case E.LOGIN_LOCAL:return{state:t.type,email:t.email,password:t.password,isLoading:!0};case E.LOGIN_GOOGLE:case E.LOGIN_GITHUB:return{state:t.type,isLoading:!0};default:throw new Error("Should not get there!")}};var _;!function(e){e.email="email",e.password="password",e.rememberMe="rememberMe"}(_||(_={})),t.LoginPage=()=>{const e=g.ConfigHelper.useAuthContext(),a=o.useHistory(),y=o.useLocation(),[C,b]=n.useState(!1),[P,I]=n.useReducer(h,f);n.useEffect(()=>{P.state!==E.LOGIN_LOCAL||e.isWorking||I({type:E.PRISTINE,error:"We could not authenticate you, the given credentials are not matching."})},[e.isWorking]),n.useEffect(()=>{if(P.state===E.LOGIN_LOCAL){var a=A.getController([_.rememberMe]).value;!0===a?t.saveRememberMe(A.getController([_.email]).value):t.clearRememberMe(),e.login({identifier:P.email,password:P.password,rememberMe:a},new URLSearchParams(y.search),e.defaultOnSessionReadyCallback(m.QUERY_PARAMETER_REDIRECT_PATH),null)}P.state===E.LOGIN_GOOGLE&&e.login(null,new URLSearchParams(y.search),e.defaultOnSessionReadyCallback(m.QUERY_PARAMETER_REDIRECT_PATH),null),P.state===E.LOGIN_GITHUB&&e.login(null,new URLSearchParams(y.search),e.defaultOnSessionReadyCallback(m.QUERY_PARAMETER_REDIRECT_PATH),null)},[P.state]);const R=(e,t)=>{d.FormControllerGroup.defaultOnChangeHandler(A,w,e,t)},[A,w]=n.useState(new d.FormControllerGroup({label:"LoginForm",handleChangeCallback:R,controllers:[{label:_.email,valueType:d.FormControllerValueTypes.text,initialValue:t.getStoredIdentifier(),trimValue:!0,handleChangeCallback:R,errorValidators:[d.fieldNotEmpty]},{label:_.password,valueType:d.FormControllerValueTypes.text,initialValue:"",handleChangeCallback:R,errorValidators:[d.fieldNotEmpty]},{label:_.rememberMe,valueType:d.FormControllerValueTypes.checkbox,initialValue:!!t.getRememberMe(),handleChangeCallback:R}]}));n.useEffect(()=>{e.isSessionReady&&a.push("/")},[]);const v=e=>{if(!P.isLoading){var t=A.applyValidators();t.isValid()?I({type:E.LOGIN_LOCAL,email:A.getController([_.email]).value,password:A.getController([_.password]).value}):w(t)}};return r.createElement(r.Fragment,null,r.createElement(u.PublicCardLayout,{title:"Login",subtitle:"Passport please :)",additionalContent:r.createElement(r.Fragment,null,P.error&&r.createElement("div",{className:"login-feedback error-feedback"},r.createElement(c.default,null),r.createElement("span",null,P.error)),r.createElement("form",{noValidate:!0,autoComplete:"off",id:"login-form"},r.createElement(d.InputForm,{id:"login-form-email",inputType:d.FormControllerValueTypes.text,required:!0,label:"Email",controller:A.getController([_.email])}),r.createElement(d.InputForm,{id:"login-form-password",inputType:C?d.FormControllerValueTypes.text:d.FormControllerValueTypes.password,required:!0,label:"Password",controller:A.getController([_.password]),onEnter:e=>v(),endAdornment:r.createElement(i.InputAdornment,{position:"end"},r.createElement(i.IconButton,{"aria-label":"toggle password visibility",onClick:()=>{b(!C)}},C?r.createElement(l.default,null):r.createElement(s.default,null)))}),r.createElement(d.InputForm,{id:"login-form-remember-me",inputType:d.FormControllerValueTypes.checkbox,label:"Remember me",controller:A.getController([_.rememberMe])}),r.createElement(i.Link,{onClick:e=>{P.isLoading||a.push(p.PASSWORD_FORGOTTEN_PATH)}},"Password forgotten?"))),actions:[{text:"Log in",onClick:v,color:"primary",isLoading:P.isLoading&&P.state==E.LOGIN_LOCAL,disabled:P.state!==E.PRISTINE&&P.state!==E.LOGIN_LOCAL}],postActionsContent:r.createElement(r.Fragment,null,r.createElement("div",{className:"login-separator"},r.createElement("hr",null),r.createElement("span",null,"OR"),r.createElement("hr",null)),r.createElement("div",{id:"login-oauth-container"},r.createElement(i.Button,{id:"google-oauth-button",className:"login-oauth-button",variant:"contained",onClick:e=>{I({type:E.LOGIN_GOOGLE})},disabled:!0},r.createElement("img",{src:"./assets/icons/Google_Logo.svg"}),r.createElement("span",null,"Log in with Google")),r.createElement(i.Button,{id:"github-oauth-button",className:"login-oauth-button",variant:"contained",onClick:e=>{I({type:E.LOGIN_GITHUB})},disabled:!0},r.createElement("img",{src:"./assets/icons/GitHub_Logo_Light.png"}),r.createElement("span",null,"Log in with GitHub"))),r.createElement("div",{id:"login-no-account-container"},r.createElement("div",{id:"login-no-account"},"Don't have an account?"),r.createElement(i.Link,{onClick:e=>{P.isLoading||a.push(p.REGISTER_PATH+y.search)}},"Join us here!")))}))}},132:function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PageLayout=void 0;const r=a(0),n=a(46),o=a(304),i=a(305),l=a(306),s=a(307),c=a(308),d=a(309),u=a(230),p=a(231),m=a(310);a(311);const g=a(41),E=a(40),f=a(57),h=a(93),_=n.makeStyles(e=>n.createStyles({root:{display:"flex"},appBar:{zIndex:e.zIndex.drawer+1,transition:e.transitions.create(["width","margin"],{easing:e.transitions.easing.sharp,duration:e.transitions.duration.leavingScreen})},appBarShift:{marginLeft:240,width:"calc(100% - 240px)",transition:e.transitions.create(["width","margin"],{easing:e.transitions.easing.sharp,duration:e.transitions.duration.enteringScreen})},menuButton:{marginRight:36},hide:{display:"none"},drawer:{width:240,flexShrink:0,whiteSpace:"nowrap"},drawerOpen:{width:240,transition:e.transitions.create("width",{easing:e.transitions.easing.sharp,duration:e.transitions.duration.enteringScreen})},drawerClose:{transition:e.transitions.create("width",{easing:e.transitions.easing.sharp,duration:e.transitions.duration.leavingScreen}),overflowX:"hidden",width:e.spacing(7)+1,[e.breakpoints.up("sm")]:{width:e.spacing(9)+1}},toolbar:Object.assign({display:"flex",alignItems:"center",justifyContent:"flex-end",padding:e.spacing(0,1)},e.mixins.toolbar),content:{flexGrow:1,padding:e.spacing(3)}}));t.PageLayout=e=>{const t=g.ConfigHelper.useAuthContext(),[a,y]=r.useState(window.innerWidth),C=E.useHistory(),b=_(),P=n.useTheme(),[I,R]=r.useState(!1),[A,w]=r.useState(null);r.useEffect(()=>{window.addEventListener("resize",(function(){y(window.innerWidth)}))},[]);const v=e=>{C.push(e)},T=e=>`${e}?${`${h.QUERY_PARAMETER_REDIRECT_PATH}=${encodeURIComponent(`${location.pathname}${location.search}`)}`}`,O=e=>{e=T(e),v(e)},N=[{displayLabel:"Account",redirectPath:"/account"},{displayLabel:"Log out",redirectPath:f.LOGOUT_PATH}],S=()=>t.isAuthenticated,L=r.useCallback(()=>a<=425,[a]),x=()=>!S()&&L(),D=()=>V.find(e=>void 0===e.displayCondition)||V.map(e=>e.displayCondition()).find(e=>1==e),k=e=>location.pathname==e.redirectPath,V=[{displayLabel:"Home",redirectPath:"/home",icon:r.createElement(m.default,null),displayCondition:S,placeDividerBelow:!0},{displayLabel:"Account",redirectPath:"/account",icon:r.createElement(u.default,null),displayCondition:S},{displayLabel:"Security",redirectPath:"/security",icon:r.createElement(p.default,null),placeDividerBelow:!0,displayCondition:S},{displayLabel:"Log in",redirectPath:T(f.LOGIN_PATH),icon:r.createElement(c.default,null),displayCondition:x},{displayLabel:"Register",redirectPath:T(f.REGISTER_PATH),icon:r.createElement(d.default,null),placeDividerBelow:!0,displayCondition:x}];return r.createElement("div",{className:b.root},r.createElement(n.CssBaseline,null),r.createElement(n.AppBar,{position:"fixed",className:`${b.appBar} ${I&&b.appBarShift}`},r.createElement(n.Toolbar,null,D()&&r.createElement(n.Button,{id:"toolbar-hamburger-button",color:"inherit","aria-label":"open drawer",onClick:()=>{R(!0)},className:`${b.menuButton} ${I&&b.hide}`},r.createElement(i.default,null)),r.createElement("img",{src:"./assets/icons/logo192.png",onClick:()=>v("/")}),r.createElement(n.Typography,{variant:"h6",noWrap:!0},"Vikings"),t.isAuthenticated?r.createElement("div",{id:"toolbar-right"},r.createElement(n.Button,{onClick:e=>{w(e.currentTarget.parentElement.parentElement)}},r.createElement(o.default,null)),r.createElement(n.Menu,{id:"menu-appbar",anchorEl:A,getContentAnchorEl:null,anchorOrigin:{vertical:"bottom",horizontal:"right"},keepMounted:!0,transformOrigin:{vertical:"top",horizontal:"right"},open:Boolean(A),onClose:()=>{w(null)}},N.map((e,t)=>r.createElement(n.MenuItem,{key:t,onClick:()=>v(e.redirectPath)},e.displayLabel)))):r.createElement("div",{id:"toolbar-right"},!L()&&r.createElement(r.Fragment,null,r.createElement(n.Button,{onClick:()=>O(f.LOGIN_PATH)},"Log in"),r.createElement(n.Button,{onClick:()=>O(f.REGISTER_PATH),id:"register-button"},"Register"))))),D()&&r.createElement(n.Drawer,{variant:"permanent",className:`${b.drawer} ${I?b.drawerOpen+" open":b.drawerClose+" close"}`,classes:{paper:""+(I?b.drawerOpen:b.drawerClose)}},r.createElement("div",{className:b.toolbar},r.createElement(n.Button,{onClick:()=>{R(!1)}},"rtl"===P.direction?r.createElement(s.default,null):r.createElement(l.default,null))),r.createElement(n.Divider,null),r.createElement(n.List,null,V.filter(e=>void 0===e.displayCondition||e.displayCondition()).map((e,t)=>r.createElement(r.Fragment,{key:t},r.createElement(n.ListItem,{button:!0,key:t,onClick:()=>v(e.redirectPath),className:k(e)?"active-drawer-item":""},r.createElement(n.ListItemIcon,null,e.icon),r.createElement(n.ListItemText,{primary:e.displayLabel})),e.placeDividerBelow&&r.createElement(n.Divider,null))))),r.createElement("main",{className:b.content},r.createElement("div",{className:b.toolbar}),e.children))}},133:function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LanguagesDataContext=void 0;const r=a(0),n=a(0),o=a(24),i=a(94);var l;!function(e){e.GET_ALL="GET_ALL"}(l||(l={}));t.LanguagesDataContext=r.createContext(Object.assign(Object.assign({},{languages:null}),{clear:void 0,fetchLanguages:void 0}));t.default=e=>{const[a,s]=n.useState(null),{sendRequest:c,callbackAction:d,data:u,error:p,isLoading:m}=o.useRequest();n.useEffect(()=>{localStorage.setItem("LANGUAGES",JSON.stringify(a))},[a]),n.useEffect(()=>{m||p||!d||d.type!==l.GET_ALL||s([{id:1,iso2:"FR",displayName:{FR:"Français"}}])},[m,p,u,d,s]);const g=n.useCallback(e=>{if(e&&s(null),null==a||e){var t=JSON.parse(localStorage.getItem("LANGUAGES"));null!==t?s(t):c({type:l.GET_ALL},i.ConfigHelper.getRootUrl("BACKEND_API_ROOT_URL"),"languages","GET")}},[]),E=n.useCallback(()=>{s(null)},[s]),f={languages:a,clear:E,fetchLanguages:g};return r.createElement(t.LanguagesDataContext.Provider,{value:f},e.children)}},228:function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActionButton=void 0;const r=a(0);a(281);const n=a(46);t.ActionButton=e=>r.createElement(n.Button,{className:"action-button",variant:"contained",color:e.color,onClick:t=>e.onClick(t),disabled:e.disabled,disableTouchRipple:e.isLoading},e.isLoading?r.createElement(n.CircularProgress,{className:"loading-indicator"}):r.createElement("span",{className:"action-button-text"},e.text))},229:function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NavigationComponent=void 0;const r=a(0),n=a(40),o=a(57);t.NavigationComponent=()=>r.createElement(r.Fragment,null,r.createElement("ul",null,r.createElement("li",null,r.createElement(n.Link,{to:o.LOGIN_PATH},"Login Page")),r.createElement("li",null,r.createElement(n.Link,{to:o.LOGOUT_PATH},"Logout Page")),r.createElement("li",null,r.createElement(n.Link,{to:"/public"},"Public Page")),r.createElement("li",null,r.createElement(n.Link,{to:"/protected"},"Protected Page")),r.createElement("li",null,r.createElement(n.Link,{to:"/administration"},"Administration Page"))),r.createElement("hr",null))},232:function(e,t,a){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,a,r){void 0===r&&(r=a),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[a]}})}:function(e,t,a,r){void 0===r&&(r=a),e[r]=t[a]}),n=this&&this.__exportStar||function(e,t){for(var a in e)"default"===a||t.hasOwnProperty(a)||r(t,e,a)};Object.defineProperty(t,"__esModule",{value:!0}),n(a(319),t),n(a(233),t),n(a(320),t)},233:function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DataContext=void 0;const r=a(0),n=a(0),o=a(133);t.DataContext=r.createContext(Object.assign(Object.assign({},{}),{clearAll:()=>{}}));t.default=e=>{const{clear:a}=n.useContext(o.LanguagesDataContext),i={clearAll:n.useCallback(()=>{a()},[a])};return r.createElement(t.DataContext.Provider,{value:i},e.children)}},249:function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=a(0),n=a(12),o=a(254);a(333),n.render(r.createElement(o.App,null),document.getElementById("app"))},254:function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.App=void 0;const r=a(0),n=a(40),o=a(218),i=a(57),l=a(232),s=a(41);t.App=()=>r.createElement(l.DataContextWrapper,null,r.createElement(n.BrowserRouter,null,r.createElement(o.AuthContextProvider,{authApiRootUrl:s.ConfigHelper.getRootUrl("BACKEND_API_ROOT_URL"),getAuthProvider:s.ConfigHelper.getAuthProvider},r.createElement(i.default,null))))},275:function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RegisterPage=void 0;const r=a(0);a(276);const n=a(40),o=a(0),i=a(46),l=a(85),s=a(65),c=a(66),d=a(24),u=a(130),p=a(52),m=a(93),g=a(41);var E,f;!function(e){e.PRISTINE="pristine",e.EMAIL_VERIFICATION_SEND="emailVerificationSend",e.EMAIL_VERIFIED="emailVerified",e.REGISTERED="registered"}(E||(E={})),function(e){e[e.EMAIL=0]="EMAIL",e[e.PASSWORD=1]="PASSWORD"}(f||(f={}));const h={state:E.PRISTINE,activeStep:f.EMAIL},_=(e,t)=>{switch(t.type){case E.PRISTINE:return Object.assign(Object.assign({},h),{error:t.error});case E.EMAIL_VERIFICATION_SEND:return{state:t.type,activeStep:f.EMAIL,email:t.email,emailValidationId:t.emailValidationId,error:t.error,success:t.success};case E.EMAIL_VERIFIED:return{state:t.type,activeStep:f.PASSWORD,email:t.email,emailValidationId:t.emailValidationId,emailPendingVerifiedId:t.emailPendingVerifiedId,error:t.error,success:t.success};case E.REGISTERED:return{state:t.type,activeStep:f.PASSWORD,email:t.email,emailValidationId:t.emailValidationId,emailPendingVerifiedId:t.emailPendingVerifiedId,password:t.password,error:t.error,success:t.success};default:throw new Error("Should not get there!")}};var y;!function(e){e.email="email",e.emailCode="email-code",e.password="password",e.passwordConfirmation="password-confirmation",e.rememberMe="rememberMe"}(y||(y={})),t.RegisterPage=e=>{const t=g.ConfigHelper.useAuthContext(),a=n.useHistory(),[C,b]=o.useReducer(_,h);o.useEffect(()=>{t.isSessionReady&&a.push("/")},[t.isSessionReady]);const{sendRequest:P,callbackAction:I,data:R,error:A,isLoading:w}=d.useRequest();o.useEffect(()=>{w||A||!I||I.type!==E.EMAIL_VERIFICATION_SEND?!w&&A&&I&&I.type===E.EMAIL_VERIFICATION_SEND&&b({type:E.PRISTINE,error:400==A.status?"Sorry, but this email is already in use":"An error occured on our side, please try again later."}):b({type:E.EMAIL_VERIFICATION_SEND,email:I.email,emailValidationId:R.id,success:"An email has been send with the verification code."})},[w,A,R,I,b]);const v=(e,t)=>{c.FormControllerGroup.defaultOnChangeHandler(T,O,e,t)},[T,O]=o.useState(new c.FormControllerGroup({label:"RegisterForm",handleChangeCallback:v,controllers:[{label:y.email,valueType:c.FormControllerValueTypes.email,initialValue:"",handleChangeCallback:v,trimValue:!0,errorValidators:[c.fieldNotEmpty,c.isValidEmail]}]})),N=e=>{if(!X()&&S()){var t=T.applyValidators();if(t.isValid()){let e=T.getController([y.email]).value;P({type:E.EMAIL_VERIFICATION_SEND,email:e},g.ConfigHelper.getRootUrl("BACKEND_API_ROOT_URL"),"v1/sendEmailValidation","POST",{email:e})}else O(t)}},S=()=>C.state===E.PRISTINE,{sendRequest:L,callbackAction:x,data:D,error:k,isLoading:V}=d.useRequest();o.useEffect(()=>{V||k||!x||x.type!==E.EMAIL_VERIFIED?!V&&k&&x&&x.type===E.EMAIL_VERIFIED&&b({type:E.PRISTINE,error:400==k.status?"Code not valid":"An error occured on our side, please try again later."}):b({type:E.EMAIL_VERIFIED,email:x.email,emailValidationId:x.emailValidationId,emailPendingVerifiedId:D.id,success:void 0})},[V,k,D,x,b]);const M=(e,t)=>{c.FormControllerGroup.defaultOnChangeHandler(F,U,e,t)},[F,U]=o.useState(new c.FormControllerGroup({label:"CodeForm",handleChangeCallback:M,controllers:[{label:y.emailCode,valueType:c.FormControllerValueTypes.string,initialValue:"",trimValue:!0,handleChangeCallback:M,errorValidators:[c.fieldNotEmpty]}]})),G=e=>{if(!X()&&j()){var t=F.applyValidators();if(t.isValid()){let e=C.email,t=C.emailValidationId;L({type:E.EMAIL_VERIFIED,email:e,emailValidationId:t},g.ConfigHelper.getRootUrl("BACKEND_API_ROOT_URL"),"v1/validateEmail","POST",{email:e,emailValidationId:t,validationCode:F.getController([y.emailCode]).value})}else U(t)}},H=e=>{X()||!j()&&!J()||(F.getController([y.emailCode]).value="",b({type:E.PRISTINE,email:C.email,success:void 0}))},j=()=>C.state===E.EMAIL_VERIFICATION_SEND,B=(e,t)=>{c.FormControllerGroup.defaultOnChangeHandler(z,q,e,t)},[z,q]=o.useState(new c.FormControllerGroup({label:"PasswordForm",handleChangeCallback:B,controllers:[{label:y.password,valueType:c.FormControllerValueTypes.password,handleChangeCallback:B,initialValue:"",errorValidators:[c.fieldNotEmpty,c.matchesPasswordRequirements]},{label:y.passwordConfirmation,valueType:c.FormControllerValueTypes.password,handleChangeCallback:B,initialValue:"",errorValidators:[e=>e===z.getController([y.password]).value?null:u.PASSWORD_CONFIRMATION_NOT_MATCHING_ERROR_LABEL]}]})),{sendRequest:W,callbackAction:Z,data:$,error:K,isLoading:Y}=d.useRequest();o.useEffect(()=>{Y||K||!Z||Z.type!==E.REGISTERED?!Y&&K&&Z&&Z.type===E.REGISTERED&&b({type:E.EMAIL_VERIFIED,email:Z.email,emailValidationId:Z.emailValidationId,emailPendingVerifiedId:Z.emailPendingVerifiedId,error:"Something went wrong when creating your account. Try again later."}):b({type:E.REGISTERED,email:Z.email,emailValidationId:Z.emailValidationId,emailPendingVerifiedId:Z.emailPendingVerifiedId,password:Z.password})},[Y,K,$,x,b]);const Q=e=>{if(!X()&&J()){var t=z.applyValidators();if(t.isValid()){let e=C.email,t=z.getController([y.password]).value;W({type:E.REGISTERED,email:e,emailValidationId:C.emailValidationId,emailPendingVerifiedId:C.emailPendingVerifiedId,password:t},g.ConfigHelper.getRootUrl("BACKEND_API_ROOT_URL"),"v1/register","POST",{password:t,pendingEmailVerifiedId:C.emailPendingVerifiedId})}else q(t)}},J=()=>C.state===E.EMAIL_VERIFIED,X=()=>w||V||Y;o.useEffect(()=>{C.state===E.REGISTERED&&t.login({identifier:C.email,password:C.password,rememberMe:!1},new URLSearchParams(location.search),t.defaultOnSessionReadyCallback(m.QUERY_PARAMETER_REDIRECT_PATH),null)},[C.state]);return r.createElement(r.Fragment,null,r.createElement(p.PublicCardLayout,{title:C.state===E.REGISTERED?"Login":"Register",subtitle:S()?"Which Email address will you use?":j()?"Let's check that":J()?"Last step before sailing away, get ready!":C.state===E.REGISTERED?"Hoist the sails, we have a new crew member!":"We need some basic info to create your account",additionalContent:r.createElement(r.Fragment,null,C.error?r.createElement("div",{className:"register-feedback error-feedback"},r.createElement(s.default,null),r.createElement("span",null,C.error)):null,C.success?r.createElement("div",{className:"register-feedback success-feedback"},r.createElement(l.default,null),r.createElement("span",null,C.success)):null,C.state!==E.REGISTERED?r.createElement(i.Stepper,{activeStep:C.activeStep,orientation:"vertical",id:"register-stepper"},Object.keys(f).map(e=>Number(e)).filter(e=>!1===isNaN(Number(e))).map(e=>r.createElement(i.Step,{key:e},r.createElement(i.StepLabel,null,(e=>{switch(e){case f.EMAIL:return C.activeStep>f.EMAIL?r.createElement(r.Fragment,null,"Email:",r.createElement("br",null),r.createElement("div",{className:"label-conten-overview"},C.email)):"Email";case f.PASSWORD:return"Password"}})(e)),r.createElement(i.StepContent,null,e===f.EMAIL?r.createElement(r.Fragment,null,r.createElement("form",{noValidate:!0,autoComplete:"off",className:"register-form"},r.createElement(c.InputForm,{id:"register-form-email",inputType:c.FormControllerValueTypes.email,required:!0,label:"Email",controller:T.getController([y.email]),disabled:C.state!==E.PRISTINE,onEnter:e=>N()}),C.state===E.EMAIL_VERIFICATION_SEND?r.createElement(c.InputForm,{id:"register-form-email-code",inputType:c.FormControllerValueTypes.string,required:!0,label:"Code",controller:F.getController([y.emailCode]),onEnter:e=>G()}):"",S()?r.createElement("div",{className:"action-container"},r.createElement(p.ActionButton,{text:"Verify Email",onClick:N,color:"primary",isLoading:X()})):null,j()?r.createElement("div",{className:"action-container"},r.createElement(p.ActionButton,{text:"Verify",onClick:G,color:"primary",isLoading:X()}),r.createElement(i.Link,{onClick:H},"Change Email")):null)):null,e===f.PASSWORD?r.createElement("form",{noValidate:!0,autoComplete:"off",className:"register-form"},r.createElement(c.NewPasswordInputForm,{id:"register-form-password",label:"Password",controller:z.getController([y.password])}),r.createElement(c.InputForm,{id:"register-form-password-confirmation",inputType:c.FormControllerValueTypes.password,required:!0,label:"Password confirmation",controller:z.getController([y.passwordConfirmation]),onEnter:e=>Q()}),r.createElement("div",{className:"action-container"},r.createElement(p.ActionButton,{text:"Register",onClick:Q,color:"primary",isLoading:X()}),r.createElement(i.Link,{onClick:H,unselectable:X()?"on":"off"},"Change Email"))):null)))):r.createElement("div",{id:"register-login-loading-wrapper"},r.createElement(i.CircularProgress,{className:"loading-indicator"})))}))}},276:function(e,t,a){var r=a(22),n=a(277);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var o={insert:"head",singleton:!1};r(n,o);e.exports=n.locals||{}},277:function(e,t,a){(t=a(23)(!1)).push([e.i,".register-feedback{margin-bottom:1.3rem}.register-form{max-width:100%;padding:0px 5%;display:flex;flex-wrap:wrap;align-items:center;justify-content:center}.register-form>div{flex:0 0 100%;margin-bottom:0.6rem}.register-form .action-container{margin-top:1.5rem;display:flex;flex-flow:column;justify-content:center}.register-form .action-container a{margin:auto;margin-top:1.2rem;font-size:0.9rem;font-weight:bold;cursor:pointer}#register-stepper{padding:0px}#register-stepper .MuiStepIcon-completed{color:green}#register-stepper .MuiSvgIcon-root{font-size:1.3rem}#register-stepper .MuiStepLabel-label{font-size:1.3rem}#register-stepper .MuiStepLabel-label .label-conten-overview{font-weight:normal;font-size:1.1rem;overflow:hidden;text-overflow:ellipsis}#register-login-loading-wrapper{display:flex;justify-content:center}\n",""]),e.exports=t},279:function(e,t,a){var r=a(22),n=a(280);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var o={insert:"head",singleton:!1};r(n,o);e.exports=n.locals||{}},280:function(e,t,a){(t=a(23)(!1)).push([e.i,"#password-reset-form{max-width:100%;padding:0px 7.5%;display:flex;flex-wrap:wrap;align-items:center;justify-content:center}#password-reset-form>div{flex:0 0 100%;margin-bottom:0.6rem}\n",""]),e.exports=t},281:function(e,t,a){var r=a(22),n=a(282);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var o={insert:"head",singleton:!1};r(n,o);e.exports=n.locals||{}},282:function(e,t,a){(t=a(23)(!1)).push([e.i,".MuiButton-root.action-button{font-weight:600;font-size:0.8rem;margin:0px 0.33rem;padding:12px 32px}.MuiButton-root.action-button .loading-indicator{color:white;width:2rem !important;height:2rem !important}.MuiButton-root.action-button .action-button-text{height:1.3rem}\n",""]),e.exports=t},283:function(e,t,a){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,a,r){void 0===r&&(r=a),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[a]}})}:function(e,t,a,r){void 0===r&&(r=a),e[r]=t[a]}),n=this&&this.__exportStar||function(e,t){for(var a in e)"default"===a||t.hasOwnProperty(a)||r(t,e,a)};Object.defineProperty(t,"__esModule",{value:!0}),n(a(284),t)},284:function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PublicCardLayout=void 0;const r=a(0);a(285);const n=a(228);t.PublicCardLayout=e=>r.createElement("div",{id:"public-card-layout-container"},r.createElement("div",{id:"public-card"},r.createElement("img",{id:"public-card-image-logo",src:"/assets/icons/logo192.png"}),r.createElement("div",{id:"public-card-tile"},e.title),e.subtitle&&r.createElement("div",{id:"public-card-subtitle"},e.subtitle),e.additionalContent&&r.createElement("div",{id:"public-card-additional-content"},e.additionalContent),e.actions&&e.actions.length>0&&r.createElement("div",{id:"public-card-content-container"},e.actions.map((e,t)=>r.createElement(n.ActionButton,{key:t,text:e.text,onClick:e.onClick,color:e.color,disabled:e.disabled,isLoading:e.isLoading}))),e.postActionsContent&&r.createElement("div",{id:"public-card-post-actions-content"},e.postActionsContent),e.languageSwitch&&r.createElement("div",{id:"public-card-language-switch"}),e.footer&&r.createElement("div",{id:"public-card-footer"})))},285:function(e,t,a){var r=a(22),n=a(286);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var o={insert:"head",singleton:!1};r(n,o);e.exports=n.locals||{}},286:function(e,t,a){(t=a(23)(!1)).push([e.i,'#public-card-layout-container{width:100vw;min-height:100vh;padding:1.8rem;box-sizing:border-box;display:flex;align-items:center;justify-content:center;background-image:url("/assets/images/public_background.jpg");background-size:cover;background-repeat:no-repeat;background-attachment:fixed;background-position:50%}#public-card-layout-container #public-card{box-sizing:border-box;display:flex;flex-flow:column;align-items:center;justify-items:center;background-color:white;border-radius:10px;height:fit-content;width:100%;max-width:385px;padding:2.1rem;padding-bottom:3.7rem}#public-card-layout-container #public-card-image-logo{width:8.5rem;margin:1rem;max-width:100%;height:auto}#public-card-layout-container #public-card-tile{margin-top:1rem;margin-bottom:0.6rem;font-size:2rem;text-align:center}#public-card-layout-container #public-card-subtitle{margin-bottom:1.1rem;font-size:1.1rem;font-weight:600;text-align:center;color:grey}#public-card-layout-container #public-card-additional-content{margin-top:1rem;width:100%}#public-card-layout-container #public-card-content-container{margin-top:2rem;min-width:100%;display:flex;flex-flow:row;align-items:center;justify-content:center}#public-card-layout-container #public-card-post-actions-content{margin-top:2rem;width:100%}\n',""]),e.exports=t},287:function(e,t,a){var r=a(22),n=a(288);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var o={insert:"head",singleton:!1};r(n,o);e.exports=n.locals||{}},288:function(e,t,a){(t=a(23)(!1)).push([e.i,".login-feedback{margin-bottom:1.3rem}#login-form{max-width:100%;padding:0px 7.5%;display:flex;flex-wrap:wrap;align-items:center;justify-content:center}#login-form>div{flex:0 0 100%;margin-bottom:0.6rem}#login-form>div>label,#login-form>div div>input{font-size:1rem !important}#login-form a{margin-left:auto;font-size:0.7rem;font-weight:bold;cursor:pointer}#login-form #login-form-remember-me span{font-size:0.9rem;font-weight:normal}#login-form #login-form-remember-me svg{font-size:1.5rem}.login-separator{width:100%;display:flex;align-items:center;justify-content:center;margin-bottom:1.6rem}.login-separator hr{width:2.1rem;border:none;height:1px;margin:0;flex-shrink:0;background-color:rgba(0,0,0,0.42)}.login-separator span{margin:0px 0.5rem;font-size:1rem}#login-oauth-container{width:100%;display:flex;flex-wrap:wrap;align-items:center;justify-content:center}#login-oauth-container .login-oauth-button{width:70%;font-size:0.7rem;margin-bottom:10px}#login-oauth-container .login-oauth-button img{max-height:1.3rem;margin-right:1.3rem}#login-oauth-container .login-oauth-button:last-child{margin-bottom:0px}#login-oauth-container #github-oauth-button{background-color:#0e0e0e;color:white}#login-oauth-container #github-oauth-button[disabled]{color:#C4C4C4}#login-no-account-container{margin-top:1.6rem;display:flex;flex-flow:row;flex-wrap:wrap;align-items:center;justify-content:center;font-size:1rem}#login-no-account-container #login-no-account{flex:0 0 100%;text-align:center}#login-no-account-container a{font-weight:bold;cursor:pointer}\n",""]),e.exports=t},289:function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PasswordForgottenPage=void 0;const r=a(0);a(290);const n=a(0),o=a(40),i=a(85),l=a(65),s=a(66),c=a(24),d=a(41),u=a(52),p=a(131);var m,g;!function(e){e.email="email"}(m||(m={})),function(e){e.PRISTINE="pristine",e.HAS_BEEN_SEND="has-been-send",e.SEND_FAILED="send-failed"}(g||(g={}));const E={state:g.PRISTINE,email:null},f=(e,t)=>{switch(t.type){case g.PRISTINE:return E;case g.HAS_BEEN_SEND:return{state:t.type,email:t.email};case g.SEND_FAILED:return Object.assign(Object.assign({},e),{state:t.type,error:t.error});default:throw new Error("Should not get there!")}};t.PasswordForgottenPage=()=>{const e=d.ConfigHelper.useAuthContext(),[t,a]=n.useReducer(f,E),h=o.useHistory(),{sendRequest:_,callbackAction:y,data:C,error:b,isLoading:P}=c.useRequest();n.useEffect(()=>{e.isAuthenticated&&h.push("/")},[e.isAuthenticated]),n.useEffect(()=>{P||b||!y||y.type!==g.HAS_BEEN_SEND||a({type:g.HAS_BEEN_SEND,email:y.email}),!P&&b&&y&&y.type===g.HAS_BEEN_SEND&&a({type:g.SEND_FAILED,error:"Something went wrong with your request, please try again later."})},[P,b,C,y,a]);const I=(e,t)=>{s.FormControllerGroup.defaultOnChangeHandler(R,A,e,t)},[R,A]=n.useState(new s.FormControllerGroup({label:"PasswordForgottenForm",handleChangeCallback:I,controllers:[{label:m.email,valueType:s.FormControllerValueTypes.text,initialValue:p.getStoredIdentifier(),trimValue:!0,handleChangeCallback:I,errorValidators:[s.fieldNotEmpty]}]})),w=()=>{if(!P){var e=R.applyValidators();e.isValid()?_({type:g.HAS_BEEN_SEND,email:R.getController([m.email]).value},d.ConfigHelper.getRootUrl("BACKEND_API_ROOT_URL"),"v1/password-forgotten","POST",{email:R.getController([m.email]).value}):A(e)}};return r.createElement(r.Fragment,null,r.createElement(u.PublicCardLayout,{title:"Password forgotten?",subtitle:"No problem, we got ya ;)",additionalContent:r.createElement(r.Fragment,null,t.state==g.HAS_BEEN_SEND&&t.email&&r.createElement("div",{id:"password-forgotten-feedback",className:"success-feedback"},r.createElement(i.default,null),r.createElement("span",null,"An email has been send to ",r.createElement("b",null,t.email),".",r.createElement("br",null),"The link will be valid for 30 minutes.",r.createElement("br",null),"You can close this page.")),t.state==g.SEND_FAILED&&t.error&&r.createElement("div",{id:"password-forgotten-feedback",className:"error-feedback"},r.createElement(l.default,null),r.createElement("span",null,t.error)),t.state==g.PRISTINE&&r.createElement("form",{noValidate:!0,autoComplete:"off",id:"password-forgotten-form"},r.createElement(s.InputForm,{id:"password-forgotten-form-email",inputType:s.FormControllerValueTypes.text,required:!0,label:"Email",controller:R.getController([m.email]),onEnter:w}))),actions:t.state==g.PRISTINE?[{text:"Send recovery link",onClick:w,color:"primary",isLoading:P}]:[]}))}},290:function(e,t,a){var r=a(22),n=a(291);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var o={insert:"head",singleton:!1};r(n,o);e.exports=n.locals||{}},291:function(e,t,a){(t=a(23)(!1)).push([e.i,"#password-forgotten-form{max-width:100%;padding:0px 7.5%;display:flex;flex-wrap:wrap;align-items:center;justify-content:center}#password-forgotten-form>div{flex:0 0 100%;margin-bottom:0.6rem}#password-forgotten-form>div>label,#password-forgotten-form>div div>input{font-size:1rem !important}\n",""]),e.exports=t},292:function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LogoutPage=void 0;const r=a(0);a(293);const n=a(0),o=a(40),i=a(46),l=a(41),s=a(57),c=a(52);t.LogoutPage=()=>{const e=l.ConfigHelper.useAuthContext(),t=o.useHistory();n.useEffect(()=>{e.isAuthenticated&&e.logout()},[e.isAuthenticated]);return r.createElement(r.Fragment,null,e.isAuthenticated?r.createElement(c.PublicCardLayout,{title:"Logging you out ...",additionalContent:r.createElement("div",{id:"logout-loading-wrapper"},r.createElement(i.CircularProgress,{className:"loading-indicator"}))}):r.createElement(c.PublicCardLayout,{title:"Successfully logged out!",subtitle:"See you soon!",actions:[{text:"Login again",onClick:e=>{t.push(s.LOGIN_PATH)},color:"primary"}]}))}},293:function(e,t,a){var r=a(22),n=a(294);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var o={insert:"head",singleton:!1};r(n,o);e.exports=n.locals||{}},294:function(e,t,a){(t=a(23)(!1)).push([e.i,"#logout-loading-wrapper{display:flex;justify-content:center}\n",""]),e.exports=t},295:function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.UnauthorizedPage=void 0;const r=a(0);a(296),t.UnauthorizedPage=()=>r.createElement("div",{className:"unauthorized-page"},"Sorry but you do not have access to the requested page.")},296:function(e,t,a){var r=a(22),n=a(297);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var o={insert:"head",singleton:!1};r(n,o);e.exports=n.locals||{}},297:function(e,t,a){(t=a(23)(!1)).push([e.i,"",""]),e.exports=t},298:function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.OauthAuthorizePage=void 0;const r=a(0);a(299);const n=a(0),o=a(24),i=a(52),l=a(41),s=["client_id","response_type","state","redirect_url","scope"],c=["client_id","response_type","redirect_url","scope"];var d;!function(e){e.PRISTINE="pristine",e.APP_REDIRECT_AND_SCOPE_RECOGNIZED="appRedirectAndScopeRecognized",e.APP_REDIRECT_AND_SCOPE_NOT_RECOGNIZED="appRedirectAndScopeNotRecognized",e.APP_AUTHORIZED="appAuthorized",e.APP_NOT_AUTHORIZED="appNotAuthorized"}(d||(d={}));const u={state:d.PRISTINE,isLoading:!1,clientApp:null,scopes:null,code:null},p=(e,t)=>{switch(t.type){case d.PRISTINE:return u;case d.APP_NOT_AUTHORIZED:case d.APP_REDIRECT_AND_SCOPE_NOT_RECOGNIZED:return Object.assign(Object.assign({},u),{state:t.type,isLoading:!1});case d.APP_REDIRECT_AND_SCOPE_RECOGNIZED:return{state:d.APP_REDIRECT_AND_SCOPE_RECOGNIZED,clientApp:t.clientApp,scopes:t.scopes,isLoading:!1,code:null};case d.APP_AUTHORIZED:return Object.assign(Object.assign({},e),{state:d.APP_AUTHORIZED,isLoading:!1,code:t.code});default:throw new Error("Should not get there!")}};t.OauthAuthorizePage=e=>{const[t,a]=n.useReducer(p,u),m=o.useRequest();n.useEffect(()=>{var e=new URLSearchParams(location.search);for(var t of e.keys())if(!s.includes(t))return void a({type:d.APP_REDIRECT_AND_SCOPE_NOT_RECOGNIZED});for(var t of c)if(!e.has(t))return void a({type:d.APP_REDIRECT_AND_SCOPE_NOT_RECOGNIZED});m.sendRequest({type:d.APP_REDIRECT_AND_SCOPE_RECOGNIZED},l.ConfigHelper.getRootUrl("BACKEND_API_ROOT_URL"),`v1/oauth/validateAuthorizeParams/${e.get("client_id")}/${e.get("response_type")}?redirect_url=${encodeURIComponent(e.get("redirect_url"))}&scope=${encodeURIComponent(e.get("scope"))}`,"GET")},[m.sendRequest]),n.useEffect(()=>{const{isLoading:e,error:t,data:r,callbackAction:n}=m;e||t||!n||n.type!==d.APP_REDIRECT_AND_SCOPE_RECOGNIZED||a({type:d.APP_REDIRECT_AND_SCOPE_RECOGNIZED,clientApp:r.clientApplication,scopes:r.scopes}),!e&&t&&n&&n.type===d.APP_REDIRECT_AND_SCOPE_RECOGNIZED&&a({type:d.APP_REDIRECT_AND_SCOPE_NOT_RECOGNIZED})},[m.isLoading,m.error,m.data,m.callbackAction,a]);const g=o.useRequest();n.useEffect(()=>{const{isLoading:e,error:t,data:r,callbackAction:n}=g;e||t||!n||n.type!==d.APP_AUTHORIZED||a({type:d.APP_AUTHORIZED,code:r}),!e&&t&&n&&n.type===d.APP_AUTHORIZED&&a({type:d.APP_REDIRECT_AND_SCOPE_NOT_RECOGNIZED})},[g.isLoading,g.error,g.data,g.callbackAction,a]);n.useEffect(()=>{if(t.state==d.APP_AUTHORIZED){var e=new URLSearchParams(location.search),a=e.get("redirect_url");a.lastIndexOf("/")==a.length-1&&(a=a.slice(0,a.length-1)),"code"==e.get("response_type")&&window.location.assign(`${a}?authorization_code=${t.code.authorizationCode}${e.get("state")?"&state="+e.get("state"):""}`),"token"==e.get("response_type")&&window.location.assign(`${a}?access_token=${t.code.access_token}&refresh_token=${t.code.refresh_token}&token_type=${t.code.token_type}&token_expires=${t.code.expires}${e.get("state")?"&state="+e.get("state"):""}`)}},[t.state]);return r.createElement(r.Fragment,null,r.createElement(i.PublicCardLayout,{title:"Authorization",subtitle:(()=>{switch(t.state){case d.PRISTINE:return"The gods are checking the authenticity of the app's request...";case d.APP_REDIRECT_AND_SCOPE_NOT_RECOGNIZED:return"Something seems strange in this app request, better not trust it";case d.APP_NOT_AUTHORIZED:return"You rejected the app's request and can close this page";case d.APP_REDIRECT_AND_SCOPE_RECOGNIZED:return"The followin app would like to access those data";case d.APP_AUTHORIZED:return"Hurrah! Request accepted! We are redirecting you to the app!"}})(),additionalContent:t.state===d.PRISTINE||t.state===d.APP_REDIRECT_AND_SCOPE_NOT_RECOGNIZED||t.state===d.APP_NOT_AUTHORIZED||t.state===d.APP_AUTHORIZED?null:t.state==d.APP_REDIRECT_AND_SCOPE_RECOGNIZED?r.createElement(r.Fragment,null,r.createElement("div",{id:"authorize-client-app-details-container"},r.createElement("div",{id:"client-app-logo"},t.clientApp.logoUrl?r.createElement("img",{src:t.clientApp.logoUrl}):null),r.createElement("span",{id:"client-app-name"},t.clientApp.name)),r.createElement("div",{id:"authorize-scope-container"},t.scopes.map((e,t)=>r.createElement("div",{className:"scope-entry",key:t},r.createElement("div",{className:"scope-icon"},r.createElement("img",{src:e.iconUrl})),r.createElement("div",{className:"scope-info"},r.createElement("div",{className:"scope-name"},e.defaultName),r.createElement("div",{className:"scope-description"},e.defaultDescription)))))):null,actions:t.state==d.APP_REDIRECT_AND_SCOPE_RECOGNIZED?[{text:"Deny",onClick:()=>{a({type:d.APP_NOT_AUTHORIZED})},color:"default"},{text:"Allow",onClick:()=>{var e=new URLSearchParams(location.search);for(var t of e.keys())if(!s.includes(t))return void a({type:d.APP_REDIRECT_AND_SCOPE_NOT_RECOGNIZED});for(var t of c)if(!e.has(t))return void a({type:d.APP_REDIRECT_AND_SCOPE_NOT_RECOGNIZED});g.sendRequest({type:d.APP_AUTHORIZED},l.ConfigHelper.getRootUrl("BACKEND_API_ROOT_URL"),"v1/oauth/grantAuthorization/code","POST",{clientAppId:e.get("client_id"),redirectUrl:e.get("redirect_url"),scope:e.get("scope")})},color:"primary",isLoading:g.isLoading}]:[]}))}},299:function(e,t,a){var r=a(22),n=a(300);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var o={insert:"head",singleton:!1};r(n,o);e.exports=n.locals||{}},300:function(e,t,a){(t=a(23)(!1)).push([e.i,"#authorize-client-app-details-container{display:flex;flex-direction:row;box-sizing:border-box;width:100%;padding:0px 2rem;margin-bottom:2rem}#authorize-client-app-details-container #client-app-logo{flex:0 0 25%;align-self:center;margin-right:1rem}#authorize-client-app-details-container #client-app-logo img{max-width:100%}#authorize-client-app-details-container #client-app-name{align-self:center;font-weight:bold;overflow-wrap:anywhere}#authorize-scope-container{width:100%;padding:0.5rem 0px}#authorize-scope-container .scope-entry{width:100%;display:flex;flex-direction:row;border-bottom:1px solid grey;padding:0.6rem 0px}#authorize-scope-container .scope-entry .scope-icon{flex:0 0 15%;align-self:flex-start;margin-right:1rem}#authorize-scope-container .scope-entry .scope-icon img{width:100%;max-height:100px}#authorize-scope-container .scope-entry .scope-info .scope-name{font-weight:bold;margin-bottom:0.25rem}#authorize-scope-container .scope-entry .scope-info .scope-description{font-size:0.75rem;color:grey}#authorize-scope-container :last-child{border-bottom:none}\n",""]),e.exports=t},301:function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.HomePage=void 0;const r=a(0),n=a(40),o=a(46),i=a(230),l=a(231);a(302);const s=a(132),c=a(41);t.HomePage=()=>{const e=c.ConfigHelper.useAuthContext(),t=n.useHistory(),a=[{displayName:"Sneakyearth",description:"Follow my latest gaming move and some funny situations",link:"https://sneakyearth.com",imageLink:"https://www.sneakyearth.com/assets/images/logo.jpg"}],d=[{buttonLabel:"Manage your account",icon:r.createElement(i.default,null),redirectPath:"/account"},{buttonLabel:"Manage security",icon:r.createElement(l.default,null),redirectPath:"/security"}],u=e=>{t.push(e)},p=e=>{window.open(e,"_blank").focus()},m=e=>r.createElement(r.Fragment,null,r.createElement("div",{className:"app-presentation-title"},e),r.createElement("div",{className:"app-presentation-wrapper"},a.map((e,t)=>r.createElement(o.Card,{className:"app-presentation-card",key:t},r.createElement(o.CardActionArea,{onClick:()=>p(e.link)},r.createElement(o.CardMedia,{className:"app-presentatrion-image",image:e.imageLink,title:e.displayName}),r.createElement(o.CardContent,null,r.createElement(o.Typography,{gutterBottom:!0,variant:"h5",component:"h2"},e.displayName),r.createElement(o.Typography,{variant:"body2",color:"textSecondary",component:"p"},e.description))),r.createElement(o.CardActions,null,r.createElement(o.Button,{size:"small",color:"primary",onClick:()=>p(e.link)},"Open app")))),r.createElement(o.Card,{className:"app-presentation-card"},r.createElement(o.CardActionArea,null,r.createElement(o.CardContent,null,r.createElement(o.Typography,{gutterBottom:!0,variant:"h5",component:"h2"},"More to come..."))))));return r.createElement(s.PageLayout,null,e.isSessionReady?r.createElement("div",{id:"home-container"},r.createElement("div",{className:"home-title"},"Welcome ",e.currentUser.pseudo||e.currentUser.email,"!"),r.createElement("div",{className:"home-subtitle"},"Here you can access our apps and manage your account."),r.createElement("div",{className:"quick-link-wrapper"},d.map((e,t)=>r.createElement(o.Card,{className:"quick-link-card",key:t},r.createElement(o.CardActionArea,{onClick:()=>u(e.redirectPath)},r.createElement(o.CardContent,null,e.icon)),r.createElement(o.CardActions,null,r.createElement(o.Button,{size:"small",color:"primary",onClick:()=>u(e.redirectPath)},e.buttonLabel))))),m("Access the application you want from here!")):r.createElement("div",{id:"home-container"},r.createElement("div",{className:"home-title"},"Welcome on Vikings account management!"),r.createElement("div",{className:"logo-container"},r.createElement("img",{src:"./assets/icons/logo192.png"})),m("Create a single account and access all applications we made! Register now!")))}},302:function(e,t,a){var r=a(22),n=a(303);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var o={insert:"head",singleton:!1};r(n,o);e.exports=n.locals||{}},303:function(e,t,a){(t=a(23)(!1)).push([e.i,"#home-container .home-title{width:100%;text-align:center;font-size:3em;font-weight:bold}#home-container .home-subtitle{width:100%;text-align:center;font-size:2em;font-weight:bold;color:#707070}#home-container .logo-container{margin:auto;width:fit-content;margin-top:50px}#home-container .logo-container img{height:250px}#home-container .quick-link-wrapper{margin-top:50px;padding:15px 0px;width:100%;min-width:450px;display:flex;flex-direction:row;align-items:center;justify-content:center}#home-container .quick-link-wrapper .quick-link-card{width:250px;margin:0px 15px}#home-container .quick-link-wrapper .quick-link-card .MuiCardContent-root{width:fit-content;margin:auto;padding-bottom:0px;padding-top:10px}#home-container .quick-link-wrapper .quick-link-card .MuiCardContent-root svg{height:2em;width:2em}#home-container .app-presentation-title{margin-top:100px;text-align:center;font-size:2em}#home-container .app-presentation-wrapper{margin-top:50px;padding:15px 0px;width:100%;display:flex;flex-direction:row;align-items:center;justify-content:center}#home-container .app-presentation-wrapper .app-presentation-card{max-width:345px;margin:0px 15px}#home-container .app-presentation-wrapper .app-presentation-card .app-presentatrion-image{height:140px}#home-container .app-presentation-wrapper .app-presentation-card button{font-weight:bold}\n",""]),e.exports=t},311:function(e,t,a){var r=a(22),n=a(312);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var o={insert:"head",singleton:!1};r(n,o);e.exports=n.locals||{}},312:function(e,t,a){(t=a(23)(!1)).push([e.i,"#app header{background-color:white;color:black}#app header button{height:100%;padding-left:15px;padding-right:15px}#app header .MuiToolbar-root{height:64px;padding-left:0px;padding-right:0px}#app header .MuiToolbar-root #toolbar-hamburger-button{width:72px;margin-right:0px}#app header .MuiToolbar-root img{height:85%;margin-right:15px;padding-left:15px;cursor:pointer}#app header .MuiToolbar-root #toolbar-right{height:100%;margin-left:auto}#app header .MuiToolbar-root #toolbar-right #register-button{font-weight:bold}@media screen and (max-width: 768px){#app .MuiDrawer-root.close{width:0px}#app .MuiDrawer-root.close .MuiPaper-root{width:0px}}#app .MuiDrawer-root button{height:100%}#app .MuiDrawer-root .MuiPaper-root>div{padding-right:0px}#app .MuiDrawer-root .MuiPaper-root .active-drawer-item{background-color:#e6e6e6}\n",""]),e.exports=t},313:function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PublicPage=void 0;const r=a(0);a(314),t.PublicPage=()=>r.createElement("div",{className:"public-page"},"This page is public. No authentication needed. ",r.createElement("br",null),r.createElement("img",{src:"./assets/icons/logo192.png"}),r.createElement("br",null))},314:function(e,t,a){var r=a(22),n=a(315);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var o={insert:"head",singleton:!1};r(n,o);e.exports=n.locals||{}},315:function(e,t,a){(t=a(23)(!1)).push([e.i,"",""]),e.exports=t},316:function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ProtectedPage=void 0;const r=a(0);a(317);const n=a(0),o=a(232),i=a(94);t.ProtectedPage=()=>{const e=i.ConfigHelper.useAuthContext(),t=n.useContext(o.LanguagesDataContext);return n.useEffect(()=>{t.fetchLanguages(!1)},[]),r.createElement("div",{className:"protected-page"},"This page is protected. This means, you are athenticated. List of languages:"," ",t.languages&&e.currentUser&&t.languages.map(t=>r.createElement("span",{key:t.id},t.displayName[e.currentUser.languageIso2],",")))}},317:function(e,t,a){var r=a(22),n=a(318);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var o={insert:"head",singleton:!1};r(n,o);e.exports=n.locals||{}},318:function(e,t,a){(t=a(23)(!1)).push([e.i,"",""]),e.exports=t},319:function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DataContextWrapper=void 0;const r=a(0),n=a(133),o=a(233);t.DataContextWrapper=e=>r.createElement(n.default,null,r.createElement(o.default,null,e.children))},320:function(e,t,a){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,a,r){void 0===r&&(r=a),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[a]}})}:function(e,t,a,r){void 0===r&&(r=a),e[r]=t[a]}),n=this&&this.__exportStar||function(e,t){for(var a in e)"default"===a||t.hasOwnProperty(a)||r(t,e,a)};Object.defineProperty(t,"__esModule",{value:!0}),n(a(133),t)},321:function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AdministrationPage=void 0;const r=a(0);a(322),t.AdministrationPage=()=>r.createElement("div",{className:"administration-page"},"This is the administration page . This means, you are an admin.")},322:function(e,t,a){var r=a(22),n=a(323);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var o={insert:"head",singleton:!1};r(n,o);e.exports=n.locals||{}},323:function(e,t,a){(t=a(23)(!1)).push([e.i,"",""]),e.exports=t},324:function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PreparingSessionPage=void 0;const r=a(0),n=a(46);a(325);const o=a(52);t.PreparingSessionPage=()=>r.createElement("div",{id:"preparing-session-page"},r.createElement(o.PublicCardLayout,{title:"Preparing your session...",additionalContent:r.createElement(n.CircularProgress,null)}))},325:function(e,t,a){var r=a(22),n=a(326);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var o={insert:"head",singleton:!1};r(n,o);e.exports=n.locals||{}},326:function(e,t,a){(t=a(23)(!1)).push([e.i,"#preparing-session-page #public-card-additional-content{display:flex;justify-content:center}#preparing-session-page #public-card-additional-content div.MuiCircularProgress-root{height:50px !important;width:50px !important}\n",""]),e.exports=t},327:function(e,t,a){"use strict";var r=this&&this.__awaiter||function(e,t,a,r){return new(a||(a=Promise))((function(n,o){function i(e){try{s(r.next(e))}catch(e){o(e)}}function l(e){try{s(r.throw(e))}catch(e){o(e)}}function s(e){var t;e.done?n(e.value):(t=e.value,t instanceof a?t:new a((function(e){e(t)}))).then(i,l)}s((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.SecurityPage=void 0;const n=a(0),o=a(0),i=a(66),l=a(24),s=a(46),c=a(85),d=a(65);a(328);const u=a(132),p=a(130),m=a(41),g=a(52);var E,f;!function(e){e.oldPassword="old-passowed",e.newPassword="password",e.newPasswordConfirmation="password-confirmation"}(E||(E={})),function(e){e.PRISTINE="pristine",e.LOADING_PASSWORD_UPDATE="loading-password-update"}(f||(f={}));const h={state:f.PRISTINE},_=(e,t)=>{switch(t.type){case f.PRISTINE:return h;case f.LOADING_PASSWORD_UPDATE:return{state:t.type};default:throw new Error("Should not get there!")}};t.SecurityPage=()=>{const e=m.ConfigHelper.useAuthContext(),[t,a]=o.useState(void 0),[y,C]=o.useState(void 0),[b,P]=o.useReducer(_,h),I=(e,t)=>{i.FormControllerGroup.defaultOnChangeHandler(R,A,e,t)},[R,A]=o.useState(new i.FormControllerGroup({label:"PasswordUpdateForm",handleChangeCallback:I,controllers:[{label:E.oldPassword,valueType:i.FormControllerValueTypes.password,handleChangeCallback:I,initialValue:"",errorValidators:[i.fieldNotEmpty]},{label:E.newPassword,valueType:i.FormControllerValueTypes.password,handleChangeCallback:I,initialValue:"",errorValidators:[i.fieldNotEmpty,i.matchesPasswordRequirements]},{label:E.newPasswordConfirmation,valueType:i.FormControllerValueTypes.password,handleChangeCallback:I,initialValue:"",errorValidators:[e=>e===R.getController([E.newPassword]).value?null:p.PASSWORD_CONFIRMATION_NOT_MATCHING_ERROR_LABEL]}]})),{sendRequest:w,callbackAction:v,data:T,error:O,isLoading:N}=l.useRequest();o.useEffect(()=>N||O||!v||v.type!==f.LOADING_PASSWORD_UPDATE?!N&&O&&v&&v.type===f.LOADING_PASSWORD_UPDATE?(C("Something went wrong, please check that the old password is correct."),a(void 0),void P({type:f.PRISTINE})):void 0:(a("Your password has been updated! You will be redirected to login with your new password."),C(void 0),R.getController([E.oldPassword]).value="",R.getController([E.newPassword]).value="",R.getController([E.newPasswordConfirmation]).value="",setTimeout(()=>{e.logout()},2e3),void P({type:f.PRISTINE})),[N,O,T,v,P]);const S=()=>r(void 0,void 0,void 0,(function*(){if(!N){var e=R.applyValidators();if(e.isValid()){var t=R.getController([E.newPassword]).value,a=R.getController([E.oldPassword]).value;w({type:f.LOADING_PASSWORD_UPDATE},m.ConfigHelper.getRootUrl("BACKEND_API_ROOT_URL"),"v1/account/update-password","POST",{oldPassword:a,newPassword:t})}else A(e)}}));return n.createElement(u.PageLayout,null,n.createElement("div",{id:"security-container"},n.createElement("div",{className:"security-title"},"Security"),n.createElement(s.Card,{variant:"outlined",className:"card-container"},n.createElement(s.Typography,{gutterBottom:!0,variant:"h5",component:"h2",className:"security-category-title"},"Change Password"),n.createElement("div",{className:"security-category-subtitle"},"(you will need to login again after update)"),n.createElement("div",{className:"password-update-container card-content"},t&&n.createElement("div",{className:"password-update-feedback success-feedback"},n.createElement(c.default,null),n.createElement("span",null,t)),y&&n.createElement("div",{className:"password-update-feedback error-feedback"},n.createElement(d.default,null),n.createElement("span",null,y)),n.createElement("form",{noValidate:!0,autoComplete:"off",id:"password-update-form"},n.createElement(i.InputForm,{id:"password-reset-form-password-old",inputType:i.FormControllerValueTypes.password,required:!0,label:"Old password",controller:R.getController([E.oldPassword])}),n.createElement(i.NewPasswordInputForm,{id:"password-reset-form-password-new",label:"Password",controller:R.getController([E.newPassword])}),n.createElement(i.InputForm,{id:"password-reset-form-password-confirmation",inputType:i.FormControllerValueTypes.password,required:!0,label:"Password confirmation",controller:R.getController([E.newPasswordConfirmation]),onEnter:S}),n.createElement(g.ActionButton,{onClick:S,color:"primary",text:"Update password",isLoading:N}))))))}},328:function(e,t,a){var r=a(22),n=a(329);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var o={insert:"head",singleton:!1};r(n,o);e.exports=n.locals||{}},329:function(e,t,a){(t=a(23)(!1)).push([e.i,"#security-container .security-title{width:100%;text-align:center;font-size:3em;font-weight:bold;margin-bottom:0.5em}#security-container .security-category-title{margin-bottom:0.7em}#security-container .security-category-subtitle{font-size:1em;font-weight:bold;color:#8f8f8f;margin-top:-1.3em;margin-bottom:1.3em}#security-container .MuiCard-root.card-container{margin:0px auto 25px auto;width:500px;max-width:100%;padding:15px 25px;border-radius:6px}#security-container .MuiCard-root.card-container .card-content{margin:auto;width:100%}#security-container .password-update-container .error-feedback,#security-container .password-update-container .success-feedback{width:fit-content;max-width:300px;margin:auto;margin-bottom:1.7em}#security-container .password-update-container #password-update-form{width:100%;padding:0px 2em;margin-bottom:1em;display:flex;flex-flow:column;flex-wrap:wrap}#security-container .password-update-container #password-update-form .MuiFormControl-root{max-width:250px}#security-container .password-update-container #password-update-form button,#security-container .password-update-container #password-update-form a{margin:15px auto 0px auto}#security-container .password-update-container #password-update-form #password-requirements-show-password{margin:0}#security-container .password-update-container #password-update-form>div{flex:0 0 100%;margin-bottom:0.6rem}#security-container .password-update-container #password-update-form .submit-button{margin-top:0.5em;margin-left:auto}\n",""]),e.exports=t},330:function(e,t,a){"use strict";var r=this&&this.__awaiter||function(e,t,a,r){return new(a||(a=Promise))((function(n,o){function i(e){try{s(r.next(e))}catch(e){o(e)}}function l(e){try{s(r.throw(e))}catch(e){o(e)}}function s(e){var t;e.done?n(e.value):(t=e.value,t instanceof a?t:new a((function(e){e(t)}))).then(i,l)}s((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.AccountPage=void 0;const n=a(0),o=a(0),i=a(66),l=a(24),s=a(46),c=a(85),d=a(65);a(331);const u=a(132),p=a(41),m=a(52),g=a(131);var E,f;!function(e){e.pseudo="pseudo"}(E||(E={})),function(e){e.PRISTINE="pristine",e.LOADING_PROFILE_UPDATE="loading-profile-update"}(f||(f={}));const h={state:f.PRISTINE},_=(e,t)=>{switch(t.type){case f.PRISTINE:return h;case f.LOADING_PROFILE_UPDATE:return{state:t.type};default:throw new Error("Should not get there!")}};var y,C;!function(e){e.email="email",e.emailCode="email-code"}(y||(y={})),function(e){e.PRISTINE="pristine",e.EMAIL_VERIFICATION_SEND="emailVerificationSend",e.EMAIL_VERIFIED="emailVerified"}(C||(C={}));const b={state:C.PRISTINE},P=(e,t)=>{switch(t.type){case C.PRISTINE:return Object.assign(Object.assign({},b),{success:t.success,error:t.error});case C.EMAIL_VERIFICATION_SEND:return{state:t.type,email:t.email,emailValidationId:t.emailValidationId,error:t.error,success:t.success};case C.EMAIL_VERIFIED:return{state:t.type,email:t.email,emailValidationId:t.emailValidationId,emailPendingVerifiedId:t.emailPendingVerifiedId,error:t.error,success:t.success};default:throw new Error("Should not get there!")}};t.AccountPage=()=>{const e=p.ConfigHelper.useAuthContext(),[t,a]=o.useState(void 0),[I,R]=o.useState(void 0),[A,w]=o.useReducer(_,h),{sendRequest:v,callbackAction:T,data:O,error:N,isLoading:S}=l.useRequest(),L=(e,t)=>{i.FormControllerGroup.defaultOnChangeHandler(x,D,e,t)},[x,D]=o.useState(new i.FormControllerGroup({label:"ProfileUpdateForm",handleChangeCallback:L,controllers:[{label:E.pseudo,valueType:i.FormControllerValueTypes.text,handleChangeCallback:L,trimValue:!0,initialValue:e.currentUser.pseudo||"",errorValidators:[i.fieldNotEmpty]}]}));o.useEffect(()=>S||N||!T||T.type!==f.LOADING_PROFILE_UPDATE?!S&&N&&T&&T.type===f.LOADING_PROFILE_UPDATE?(R("Something went wrong, please check that the old password is correct."),a(void 0),void w({type:f.PRISTINE})):void 0:(a("Your profile has been updated!"),R(void 0),setTimeout(()=>{e.updateCurrentUserData()},200),void w({type:f.PRISTINE})),[S,N,O,T,w]);const[k,V]=o.useReducer(P,b),{sendRequest:M,callbackAction:F,data:U,error:G,isLoading:H}=l.useRequest();o.useEffect(()=>{H||G||!F||F.type!==C.EMAIL_VERIFICATION_SEND?!H&&G&&F&&F.type===C.EMAIL_VERIFICATION_SEND&&V({type:C.PRISTINE,error:400==G.status?"Sorry, but this email is already in use":"An error occured on our side, please try again later.",success:void 0}):V({type:C.EMAIL_VERIFICATION_SEND,email:F.email,emailValidationId:U.id,success:"An email has been send with the verification code."})},[H,G,U,F,V]);const j=(e,t)=>{i.FormControllerGroup.defaultOnChangeHandler(B,z,e,t)},[B,z]=o.useState(new i.FormControllerGroup({label:"emailChangeForm",handleChangeCallback:j,controllers:[{label:y.email,valueType:i.FormControllerValueTypes.email,initialValue:"",trimValue:!0,handleChangeCallback:j,errorValidators:[i.fieldNotEmpty,i.isValidEmail]}]})),q=e=>{if(!re()&&W()){var t=B.applyValidators();if(t.isValid()){let e=B.getController([y.email]).value;M({type:C.EMAIL_VERIFICATION_SEND,email:e},p.ConfigHelper.getRootUrl("BACKEND_API_ROOT_URL"),"v1/sendEmailValidation","POST",{email:e})}else z(t)}},W=()=>k.state===C.PRISTINE,{sendRequest:Z,callbackAction:$,data:K,error:Y,isLoading:Q}=l.useRequest();o.useEffect(()=>{if(!Q&&!Y&&$&&$.type===C.EMAIL_VERIFIED)return B.getController([y.email]).value="",setTimeout(()=>{e.logout()},2e3),"true"===g.getRememberMe()&&g.saveRememberMe(k.email),void V({type:C.PRISTINE,email:"",success:"Your email has been updated! You will be redirected to login with your new email.",error:void 0});!Q&&Y&&$&&$.type===C.EMAIL_VERIFIED&&V({type:C.PRISTINE,error:400==Y.status?"Code not valid":"An error occured on our side, please try again later.",success:void 0})},[Q,Y,K,$,V]);const J=(e,t)=>{i.FormControllerGroup.defaultOnChangeHandler(X,ee,e,t)},[X,ee]=o.useState(new i.FormControllerGroup({label:"CodeForm",handleChangeCallback:J,controllers:[{label:y.emailCode,valueType:i.FormControllerValueTypes.string,initialValue:"",handleChangeCallback:J,errorValidators:[i.fieldNotEmpty]}]})),te=e=>{if(!re()&&ae()){var t=X.applyValidators();if(t.isValid()){let e=k.email,t=k.emailValidationId;Z({type:C.EMAIL_VERIFIED,email:e,emailValidationId:t},p.ConfigHelper.getRootUrl("BACKEND_API_ROOT_URL"),"v1/account/updateEmail","POST",{email:e,emailValidationId:t,validationCode:X.getController([y.emailCode]).value})}else ee(t)}},ae=()=>k.state===C.EMAIL_VERIFICATION_SEND,re=()=>H||Q;return n.createElement(u.PageLayout,null,n.createElement("div",{id:"account-container"},n.createElement("div",{className:"account-title"},"Account"),n.createElement(s.Card,{variant:"outlined",className:"card-container"},n.createElement(s.Typography,{gutterBottom:!0,variant:"h5",component:"h2",className:"account-category-title"},"Profile"),n.createElement("div",{className:"profile-update-container card-content"},t&&n.createElement("div",{className:"profile-update-feedback success-feedback"},n.createElement(c.default,null),n.createElement("span",null,t)),I&&n.createElement("div",{className:"profile-update-feedback error-feedback"},n.createElement(d.default,null),n.createElement("span",null,I)),n.createElement("form",{noValidate:!0,autoComplete:"off",id:"profile-update-form"},n.createElement(i.InputForm,{id:"profile-update-form-pseudo",inputType:i.FormControllerValueTypes.text,label:"Pseudo",controller:x.getController([E.pseudo])}),n.createElement(m.ActionButton,{onClick:()=>r(void 0,void 0,void 0,(function*(){if(!S){var e=x.applyValidators();if(e.isValid()){var t=x.getController([E.pseudo]).value;v({type:f.LOADING_PROFILE_UPDATE},p.ConfigHelper.getRootUrl("BACKEND_API_ROOT_URL"),"v1/account","PUT",{pseudo:t})}else D(e)}})),color:"primary",text:"Update profile",isLoading:S})))),n.createElement(s.Card,{variant:"outlined",className:"card-container"},n.createElement(s.Typography,{gutterBottom:!0,variant:"h5",component:"h2",className:"account-category-title"},"Email"),n.createElement("div",{className:"account-category-subtitle"},"(you will need to login again after update)"),n.createElement("div",{className:"email-update-container card-content"},k.success&&n.createElement("div",{className:"email-update-feedback success-feedback"},n.createElement(c.default,null),n.createElement("span",null,k.success)),k.error&&n.createElement("div",{className:"email-update-feedback error-feedback"},n.createElement(d.default,null),n.createElement("span",null,k.error)),n.createElement("form",{noValidate:!0,autoComplete:"off",id:"email-update-form"},n.createElement(i.InputForm,{id:"email-update-form-email",inputType:i.FormControllerValueTypes.email,required:!0,label:"Email",controller:B.getController([y.email]),disabled:k.state!==C.PRISTINE,onEnter:e=>q()}),k.state===C.EMAIL_VERIFICATION_SEND?n.createElement(i.InputForm,{id:"email-update-form-email-code",inputType:i.FormControllerValueTypes.string,required:!0,label:"Code",controller:X.getController([y.emailCode]),onEnter:e=>te()}):"",W()?n.createElement(m.ActionButton,{text:"Verify Email",onClick:q,color:"primary",isLoading:re()}):null,ae()?n.createElement(n.Fragment,null,n.createElement(m.ActionButton,{text:"Verify",onClick:te,color:"primary",isLoading:re()}),n.createElement(s.Link,{onClick:e=>{!re()&&ae()&&V({type:C.PRISTINE,email:k.email,success:void 0})}},"Change Email")):null)))))}},331:function(e,t,a){var r=a(22),n=a(332);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var o={insert:"head",singleton:!1};r(n,o);e.exports=n.locals||{}},332:function(e,t,a){(t=a(23)(!1)).push([e.i,"#account-container .account-title{width:100%;text-align:center;font-size:3em;font-weight:bold;margin-bottom:0.5em}#account-container .account-category-title{margin-bottom:0.7em}#account-container .account-category-subtitle{font-size:1em;color:#8f8f8f;margin-top:-1.3em;margin-bottom:1.3em}#account-container .MuiCard-root.card-container{margin:0px auto 25px auto;width:500px;max-width:100%;padding:15px 25px;border-radius:6px}#account-container .MuiCard-root.card-container .card-content{margin:auto;width:100%}#account-container .profile-update-container .error-feedback,#account-container .profile-update-container .success-feedback,#account-container .email-update-container .error-feedback,#account-container .email-update-container .success-feedback{width:fit-content;max-width:300px;margin:auto;margin-bottom:1.7em}#account-container .profile-update-container #profile-update-form,#account-container .profile-update-container #email-update-form,#account-container .email-update-container #profile-update-form,#account-container .email-update-container #email-update-form{width:100%;padding:0px 2em;margin-bottom:1em;display:flex;flex-flow:column;flex-wrap:wrap}#account-container .profile-update-container #profile-update-form .MuiFormControl-root,#account-container .profile-update-container #email-update-form .MuiFormControl-root,#account-container .email-update-container #profile-update-form .MuiFormControl-root,#account-container .email-update-container #email-update-form .MuiFormControl-root{max-width:250px}#account-container .profile-update-container #profile-update-form button,#account-container .profile-update-container #profile-update-form a,#account-container .profile-update-container #email-update-form button,#account-container .profile-update-container #email-update-form a,#account-container .email-update-container #profile-update-form button,#account-container .email-update-container #profile-update-form a,#account-container .email-update-container #email-update-form button,#account-container .email-update-container #email-update-form a{margin:15px auto 0px auto}#account-container .profile-update-container #profile-update-form>div,#account-container .profile-update-container #email-update-form>div,#account-container .email-update-container #profile-update-form>div,#account-container .email-update-container #email-update-form>div{flex:0 0 100%;margin-bottom:0.6rem}#account-container .profile-update-container #profile-update-form .submit-button,#account-container .profile-update-container #email-update-form .submit-button,#account-container .email-update-container #profile-update-form .submit-button,#account-container .email-update-container #email-update-form .submit-button{margin-top:0.5em;margin-left:auto}\n",""]),e.exports=t},333:function(e,t,a){var r=a(22),n=a(334);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var o={insert:"head",singleton:!1};r(n,o);e.exports=n.locals||{}},334:function(e,t,a){(t=a(23)(!1)).push([e.i,"body{font-family:Arial, Helvetica, sans-serif;margin:0 auto;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.success-feedback{color:green;background-color:#7aea556b;border-radius:10px;border:1px solid green;padding:10px;display:flex;align-items:center;font-size:0.9rem}.success-feedback svg{font-size:1.5rem;margin-right:0.7rem}.error-feedback{color:red;background-color:#ea55556b;border-radius:10px;border:1px solid red;padding:10px;display:flex;align-items:center;font-size:0.9rem}.error-feedback svg{font-size:1.5rem;margin-right:0.7rem}\n",""]),e.exports=t},41:function(e,t,a){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,a,r){void 0===r&&(r=a),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[a]}})}:function(e,t,a,r){void 0===r&&(r=a),e[r]=t[a]}),n=this&&this.__exportStar||function(e,t){for(var a in e)"default"===a||t.hasOwnProperty(a)||r(t,e,a)};Object.defineProperty(t,"__esModule",{value:!0}),n(a(94),t)},52:function(e,t,a){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,a,r){void 0===r&&(r=a),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[a]}})}:function(e,t,a,r){void 0===r&&(r=a),e[r]=t[a]}),n=this&&this.__exportStar||function(e,t){for(var a in e)"default"===a||t.hasOwnProperty(a)||r(t,e,a)};Object.defineProperty(t,"__esModule",{value:!0}),n(a(228),t),n(a(283),t),n(a(229),t)},57:function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.OAUTH_AUTHORIZE=t.ACCESS_RESTRICTED_PATH=t.LOGOUT_PATH=t.PASSWORD_RESET_PATH=t.PASSWORD_FORGOTTEN_PATH=t.SESSION_PREPARATION_PATH=t.LOGIN_PATH=t.REGISTER_PATH=void 0;const r=a(0),n=a(40),o=a(93),i=a(275),l=a(131),s=a(289),c=a(292),d=a(295),u=a(298),p=a(301),m=a(313),g=a(316),E=a(321),f=a(229),h=a(130),_=a(324),y=a(94),C=a(327),b=a(330);t.REGISTER_PATH="/register",t.LOGIN_PATH="/login",t.SESSION_PREPARATION_PATH="/session-preparation",t.PASSWORD_FORGOTTEN_PATH="/password-forgotten",t.PASSWORD_RESET_PATH="/password-reset",t.LOGOUT_PATH="/logout",t.ACCESS_RESTRICTED_PATH="/access-unauthorized",t.OAUTH_AUTHORIZE="/oauth/authorize",t.default=function(){const e=y.ConfigHelper.useAuthContext(),a={mustBeAuthenticated:!0,mustBeAdmin:!1};return r.createElement(r.Fragment,null,e.isSilentlyLogin?r.createElement(_.PreparingSessionPage,null):r.createElement(n.Switch,null,r.createElement(n.Route,{exact:!0,path:t.REGISTER_PATH,component:i.RegisterPage}),r.createElement(n.Route,{exact:!0,path:t.LOGIN_PATH,component:l.LoginPage}),r.createElement(n.Route,{exact:!0,path:t.LOGOUT_PATH,component:c.LogoutPage}),r.createElement(n.Route,{exact:!0,path:t.PASSWORD_FORGOTTEN_PATH,component:s.PasswordForgottenPage}),r.createElement(n.Route,{exact:!0,path:t.PASSWORD_RESET_PATH,component:h.PasswordResetPage}),r.createElement(o.default,Object.assign({},a,{exact:!0,path:t.OAUTH_AUTHORIZE,component:u.OauthAuthorizePage})),r.createElement(n.Route,{exact:!0,path:"/home",component:p.HomePage}),r.createElement(o.default,Object.assign({},a,{exact:!0,path:"/security",component:C.SecurityPage})),r.createElement(o.default,Object.assign({},a,{exact:!0,path:"/account",component:b.AccountPage})),r.createElement(n.Route,{path:"*"},"Environment: ","prod",r.createElement("br",null),r.createElement(f.NavigationComponent,null),r.createElement(n.Switch,null,r.createElement(n.Route,{exact:!0,path:"/public",component:m.PublicPage}),r.createElement(n.Route,{exact:!0,path:t.ACCESS_RESTRICTED_PATH,component:d.UnauthorizedPage}),r.createElement(o.default,Object.assign({},a,{exact:!0,path:"/protected",component:g.ProtectedPage})),r.createElement(o.default,Object.assign({},{mustBeAuthenticated:!0,mustBeAdmin:!0},{exact:!0,path:"/administration",component:E.AdministrationPage})),r.createElement(n.Redirect,{from:"*",to:"/home"})))))}},93:function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ProtectedRoute=t.QUERY_PARAMETER_REDIRECT_PATH=void 0;const r=a(0),n=a(17),o=a(40),i=a(57),l=a(41);t.QUERY_PARAMETER_REDIRECT_PATH="redirect_path",t.ProtectedRoute=e=>{const a=l.ConfigHelper.useAuthContext(),s=o.useLocation();let c=void 0,d=!1;if(e.mustBeAuthenticated&&!a.isAuthenticated&&(c=i.LOGIN_PATH,d=!0),!c&&e.mustBeAdmin&&a.isAuthenticated&&(c=i.ACCESS_RESTRICTED_PATH),c){if(d){var u=encodeURIComponent(`${s.pathname}${s.search}`);c=`${c}?${t.QUERY_PARAMETER_REDIRECT_PATH}=${u}`}const a=()=>r.createElement(n.Redirect,{to:c});return r.createElement(n.Route,Object.assign({},e,{component:a,render:void 0}))}return r.createElement(n.Route,Object.assign({},e))},t.default=t.ProtectedRoute},94:function(e,t,a){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0}),t.ConfigHelper=t.UI_LANGUAGES=t.DEFAULT_LANGUAGE_ISO2=void 0;const r=a(218),n=a(0);t.DEFAULT_LANGUAGE_ISO2="FR",t.UI_LANGUAGES=[{iso2:"FR",flag:"assets/flags/fr.svg",title:"Français"},{iso2:"DE",flag:"assets/flags/de.svg",title:"Deutsch"},{iso2:"EN",flag:"assets/flags/gb.svg",title:"English"}];class o{constructor(){}getApiRootURL(){return"https://auth-server-sneakyearth.azurewebsites.net/api/"}getDefaultLanguageIso2(){return t.DEFAULT_LANGUAGE_ISO2}getDefaultLanguage(){return t.UI_LANGUAGES.find(e=>e.iso2===t.DEFAULT_LANGUAGE_ISO2)||t.UI_LANGUAGES[0]}getUiLanguages(){return t.UI_LANGUAGES}static getRootUrl(e){switch(e){case"BACKEND_API_ROOT_URL":return"https://auth-server-sneakyearth.azurewebsites.net/api/";default:throw new Error("The requested root url doesn't exists")}}static getEnvironmentVariable(t){return e.env[t]}static useAuthContext(){return o.authContext||(o.authContext=r.createAuthContext()),n.useContext(o.authContext)}static getAuthProvider(){return o.authContext||(o.authContext=r.createAuthContext()),o.authContext.Provider}}t.ConfigHelper=o,o.authContext=void 0}).call(this,a(223))}}); //# sourceMappingURL=main.bundle.js.map