@crystaldesign/diva-support 24.15.0-beta.32 → 24.15.0-beta.34

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
1
  /*! For license information please see 767.diva-support.umd.min.js.LICENSE.txt */
2
- "use strict";(self.webpackChunkCrystaldesignDivaSupport=self.webpackChunkCrystaldesignDivaSupport||[]).push([[767],{6767:(e,t,n)=>{n.r(t),n.d(t,{default:()=>ne});var r=n(7363),a=n(6308),o=n(4658),i=n(4988),s=n(747),l=n.n(s),c=n(523),u=n(9420),d=n(9534),h=n(8623),p=n(3096),v=n(7995),g=n(789),x=n(5515),w=n.n(x),f=n(7514);function OpenId(){var e,t,n,r=(0,a.KH)(),o=r.configurationStore,i=r.authorizationStore,s=(0,g.$G)().t,l=null===(e=i.state)||void 0===e?void 0:e.loginMethods;return(0,f.jsxs)(f.Fragment,{children:[(null==l?void 0:l.google)&&(0,f.jsxs)(v.Z,{className:w()(c.FI,c.lk),onClick:function onClick(){var e;return i.openOAuthLogin("google",i.state.organizationId,null===(e=i.state)||void 0===e?void 0:e.invitationId)},children:[(0,f.jsx)("div",{}),s("auth.login.google")]}),(null==l?void 0:l.microsoft)&&(0,f.jsxs)(v.Z,{className:w()(c.FI,c.Eg),onClick:function onClick(){var e;return i.openOAuthLogin("microsoft",i.state.organizationId,null===(e=i.state)||void 0===e?void 0:e.invitationId)},children:[(0,f.jsx)("div",{}),s("auth.login.microsoft")]}),(null==l?void 0:l.generic)&&(0,f.jsxs)(v.Z,{className:c.FI,style:{backgroundColor:null!==(t=l.generic.backgroundColor)&&void 0!==t?t:o.theme.palette.secondary.main,color:null!==(n=l.generic.color)&&void 0!==n?n:o.theme.palette.secondary.contrastText},onClick:function onClick(){var e;return i.openOAuthLogin("genericOpenId",i.state.organizationId,null===(e=i.state)||void 0===e?void 0:e.invitationId)},children:[(0,f.jsx)("div",{style:l.generic.logo?{backgroundImage:"url(".concat(l.generic.logo,")")}:{}}),s("auth.login.generic")]})]})}var j=n(4680),m=(0,j.jl)("Framework","Login");const y=(0,u.Pi)((function Login(){var e,t,n,s,u=(0,a.KH)(),x=u.authorizationStore,w=u.authorizationHandler,j=(0,r.useState)("enter"),y=(0,i.Z)(j,2),k=y[0],C=y[1],M=(0,r.useState)(null!==(e=null===(t=x.state)||void 0===t?void 0:t.email)&&void 0!==e?e:""),S=(0,i.Z)(M,2),Z=S[0],b=S[1],L=(0,r.useState)(""),N=(0,i.Z)(L,2),I=N[0],z=N[1],E=(0,r.useState)(""),P=(0,i.Z)(E,2),D=P[0],O=P[1],F=(0,r.useState)(!1),R=(0,i.Z)(F,2),_=R[0],A=R[1],T=(0,r.useState)(x.state.invitationId),U=(0,i.Z)(T,2),$=U[0],B=U[1],G=(0,r.useState)("LOGIN"==(null===(n=x.state)||void 0===n?void 0:n.type)?x.state.error:void 0),H=(0,i.Z)(G,2),K=H[0],V=H[1],Q=(0,g.$G)().t,W=function(){var e=(0,o.Z)(l().mark((function _callee(){var e,t;return l().wrap((function _callee$(n){for(;;)switch(n.prev=n.next){case 0:if(n.prev=0,$){n.next=6;break}return n.next=4,w.getInvitationValue("id",Z);case 4:(e=n.sent)&&(e.isNewUser&&(x.close(),x.showRegister(void 0,Z,!!e.useotp)),B(!0),e.useotp&&A(!0));case 6:return n.next=8,w.fetchLoginProvider({email:Z});case 8:"standard"==(t=n.sent).provider?C("login"):x.openOAuthLogin(t.provider,x.state.organizationId,x.state.invitationId),n.next=16;break;case 12:n.prev=12,n.t0=n.catch(0),m.error(new d.GE("Error while fetching login provider",{cause:n.t0})),V("auth.error.password");case 16:case"end":return n.stop()}}),_callee,null,[[0,12]])})));return function onContinue(){return e.apply(this,arguments)}}(),Y=function(){var e=(0,o.Z)(l().mark((function _callee2(){return l().wrap((function _callee2$(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,(0,h.fl)(x.login(Z,I,!1,x.state.organizationId,x.state.invitationId,D));case 3:b(""),z(""),V(void 0),e.next=12;break;case 8:e.prev=8,e.t0=e.catch(0),m.error(new d.GE("Error while logging in",{cause:e.t0})),V($?"auth.error.passwordotp":"auth.error.password");case 12:case"end":return e.stop()}}),_callee2,null,[[0,8]])})));return function onLogin(){return e.apply(this,arguments)}}(),q=function(){var e=(0,o.Z)(l().mark((function _callee3(){return l().wrap((function _callee3$(e){for(;;)switch(e.prev=e.next){case 0:x.showRequestNewPassword(Z);case 1:case"end":return e.stop()}}),_callee3)})));return function resetPassword(){return e.apply(this,arguments)}}(),J="enter"==k&&0==Z.length||"enter"!=k&&0==I.length;_&&!J&&(J=0==D.length);var X=null===(s=x.state)||void 0===s?void 0:s.loginMethods;return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)("h1",{children:Q("auth.title.login")}),(0,f.jsx)("p",{children:Q("auth.text.login","")}),!!K&&(0,f.jsxs)("div",{className:c.vU,children:[(0,f.jsx)("span",{}),(0,f.jsx)("div",{id:"loginerrortext",children:Q(K)})]}),(0,f.jsx)(OpenId,{}),((null==X?void 0:X.generic)||(null==X?void 0:X.google)||(null==X?void 0:X.microsoft))&&X.standard&&(0,f.jsx)("div",{className:c.kr,children:"or"}),(null==X?void 0:X.standard)&&(0,f.jsxs)(f.Fragment,{children:["enter"==k&&(0,f.jsxs)("form",{children:[(0,f.jsx)(p.Z,{id:"username",value:Z,autoComplete:"username",autoFocus:!0,placeholder:Q("auth.input.email"),onChange:function onChange(e){return b(e.target.value)},onKeyPress:function onKeyPress(e){return"Enter"==e.key&&W()}}),(0,f.jsx)(p.Z,{value:I,id:"password",type:"password",autoComplete:"current-password",hidden:!0,autoFocus:!0,placeholder:Q("auth.input.password"),onChange:function onChange(e){return z(e.target.value)},onKeyPress:function onKeyPress(e){return"Enter"==e.key&&Y()}})]}),"login"==k&&(0,f.jsxs)("form",{children:[_&&(0,f.jsx)(p.Z,{value:D,type:"text",autoFocus:!0,placeholder:Q("auth.input.otp"),onChange:function onChange(e){return O(e.target.value)}}),(0,f.jsx)("label",{className:c.TL,onClick:function reset(){C("enter"),b(""),z(""),V(void 0)},children:(0,f.jsx)(p.Z,{value:Z,readOnly:!0,placeholder:Q("auth.input.email")})}),(0,f.jsx)(p.Z,{value:I,type:"password",id:"password",autoFocus:!0,placeholder:Q("auth.input.password"),onChange:function onChange(e){return z(e.target.value)},onKeyPress:function onKeyPress(e){return"Enter"==e.key&&Y()}}),(0,f.jsx)("div",{className:c.p4,style:{textAlign:"right"},onClick:q,children:Q("auth.button.forgotpassword")})]}),(0,f.jsx)(v.Z,{id:"submit",disabled:J,onClick:"enter"==k?W:Y,children:Q("enter"==k?"auth.button.continue":"auth.button.login")})]})]})}));var k=(0,j.jl)("Framework","RequestNewPassword");function RequestNewPassword(e){var t=e.initEmail,n=(0,a.KH)(),s=n.authorizationStore,u=n.apiHandler,h=n.loadingAndErrorStore,x=(0,r.useState)(t),w=(0,i.Z)(x,2),j=w[0],m=w[1],y=(0,r.useState)(!1),C=(0,i.Z)(y,2),M=C[0],S=C[1],Z=(0,r.useState)(),b=(0,i.Z)(Z,2),L=b[0],N=b[1],I=(0,r.useState)(),z=(0,i.Z)(I,2),E=z[0],P=z[1],D=(0,g.$G)().t,O=function(){var e=(0,o.Z)(l().mark((function _callee(){return l().wrap((function _callee$(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,P(!0),h.toggleLoading("SendPassword"),e.next=5,u.sendPasswordRecoveryMail({email:j});case 5:P(!1),h.toggleLoading("SendPassword"),S(!0),N(void 0),e.next=17;break;case 11:e.prev=11,e.t0=e.catch(0),k.error(new d.GE("Error while sending password recovery mail",{cause:e.t0})),N("auth.error.resetpassword"),P(!1),h.toggleLoading("SendPassword");case 17:case"end":return e.stop()}}),_callee,null,[[0,11]])})));return function resetPassword(){return e.apply(this,arguments)}}();return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)("h1",{children:D("auth.title.resetpassword")}),(0,f.jsx)("p",{children:D("auth.info.resetdescription")}),!!L&&(0,f.jsxs)("div",{className:c.vU,children:[(0,f.jsx)("span",{}),(0,f.jsx)("div",{children:D(L)})]}),M&&(0,f.jsxs)("div",{className:c.Vp,children:[(0,f.jsx)("span",{}),(0,f.jsx)("div",{children:D("auth.info.resetpassword")})]}),!M&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(p.Z,{value:j,autoFocus:!0,placeholder:D("auth.input.email"),onChange:function onChange(e){return m(e.target.value)},onKeyPress:function onKeyPress(e){return"Enter"==e.key&&O()}}),(0,f.jsx)(v.Z,{disabled:0==j.length,onClick:O,children:D("auth.button.resetpassword")})]}),M&&(0,f.jsx)(v.Z,{disabled:E,onClick:function toLogin(){s.close(),s.showLogin()},children:D("auth.button.login")})]})}function Errormessage(e){var t=e.hasError,n=e.authErrorsg,r=(0,g.$G)().t;return(0,f.jsxs)("div",{className:c.vU,children:[(0,f.jsx)("span",{}),"INVALID"==t&&(0,f.jsx)("div",{children:r("auth.error.verifypassword")}),"SERVER"==t&&(0,f.jsx)("div",{children:n})]})}var C=(0,j.jl)("Framework","cfhange-password");function ChangePassword(e){var t,n=e.token,s=(0,a.KH)(),u=s.configurationStore,h=s.authorizationStore,x=s.apiHandler,w=(s.loadingAndErrorStore,(0,r.useState)("")),j=(0,i.Z)(w,2),m=j[0],y=j[1],k=(0,r.useState)(""),M=(0,i.Z)(k,2),S=M[0],Z=M[1],b=(0,r.useState)(!1),L=(0,i.Z)(b,2),N=L[0],I=L[1],z=(0,r.useState)(),E=(0,i.Z)(z,2),P=E[0],D=E[1],O=(0,r.useState)(""),F=(0,i.Z)(O,2),R=F[0],_=F[1],A=(0,r.useRef)(null),T=(0,g.$G)().t;(0,r.useEffect)((function(){m===S&&D(void 0)}),[m,S]);var U=function(){var e=(0,o.Z)(l().mark((function _callee(){return l().wrap((function _callee$(e){for(;;)switch(e.prev=e.next){case 0:if(_(T("auth.error.verifypasswordserver")),!(m.length<8||m!==S)){e.next=4;break}return D("INVALID"),e.abrupt("return");case 4:return e.prev=4,e.next=7,x.resetPassword({password:m,token:n});case 7:I(!0),e.next=13;break;case 10:e.prev=10,e.t0=e.catch(4),$(e.t0);case 13:case"end":return e.stop()}}),_callee,null,[[4,10]])})));return function resetPassword(){return e.apply(this,arguments)}}(),$=function handleError(e){if(e instanceof d.GE){if("AUTH_0003"===e.name)_(T("auth.error.verifypasswordtokenerror",{errormsg:T("auth.error.tokenexpired")}));else _(T("auth.error.verifypasswordserver",e.message));C.error(e)}C.error(new d.GE("Error while resetting password",{cause:e})),D("SERVER")};return"SERVER"===P?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(Errormessage,{hasError:P,authErrorsg:R}),(0,f.jsx)(v.Z,{onClick:function onClickRequestNewPassword(){h.showRequestNewPassword("")},children:T("auth.button.resetpassword")})]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)("h1",{children:T("auth.title.verifypassword")}),N&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)("div",{className:c.Vp,children:[(0,f.jsx)("span",{}),(0,f.jsx)("div",{children:T("auth.info.verifypassword")})]}),(null===(t=u.authentication.resetPassword)||void 0===t?void 0:t.returnToLogin)&&(0,f.jsx)(v.Z,{onClick:function goToLogin(){h.close(),h.showLogin()},children:T("auth.button.login")})]}),!N&&(0,f.jsxs)(f.Fragment,{children:[P&&(0,f.jsx)(Errormessage,{hasError:P,authErrorsg:R}),(0,f.jsxs)("form",{children:[(0,f.jsx)(p.Z,{value:m,autoFocus:!0,placeholder:T("auth.input.password"),type:"password",autoComplete:"new-password",onChange:function onChange(e){return y(e.target.value)},onKeyPress:function onKeyPress(e){var t;return"Enter"==e.key&&(null===(t=A.current)||void 0===t?void 0:t.focus())}}),(0,f.jsx)(p.Z,{ref:A,value:S,placeholder:T("auth.input.verifypassword"),type:"password",autoComplete:"new-password",onChange:function onChange(e){return Z(e.target.value)},onKeyPress:function onKeyPress(e){return"Enter"==e.key&&U()}})]}),(0,f.jsx)(v.Z,{disabled:!m||!S,onClick:U,children:T("auth.button.save")})]})]})}var M=n(5019);function WelcomeScreen(e){var t=e.isNewUser,n=e.invitationId,s=e.invitationOrgId,u=(0,a.KH)(),d=u.authorizationStore,h=u.authorizationHandler,p=(0,r.useState)(""),x=(0,i.Z)(p,2),w=x[0],j=x[1],m=(0,g.$G)().t,y=(0,r.useState)(""),k=(0,i.Z)(y,2),C=k[0],M=k[1];(0,r.useEffect)((function(){function _getInvitation(){return(_getInvitation=(0,o.Z)(l().mark((function _callee(){var e,t;return l().wrap((function _callee$(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,h.getInvitationValue("user",null===(e=d.state)||void 0===e?void 0:e.invitationId);case 2:return(t=n.sent)?M(t.user):j("Invitation not found"),n.abrupt("return");case 5:case"end":return n.stop()}}),_callee)})))).apply(this,arguments)}!function getInvitation(){return _getInvitation.apply(this,arguments)}()}),[n]);var S=function(){var e=(0,o.Z)(l().mark((function _callee2(){var e;return l().wrap((function _callee2$(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,checkInvitation();case 2:(e=t.sent)&&(d.close(),d.showLogin(void 0,void 0,s,n,e));case 4:case"end":return t.stop()}}),_callee2)})));return function toLogin(){return e.apply(this,arguments)}}(),Z=function(){var e=(0,o.Z)(l().mark((function _callee3(){var e;return l().wrap((function _callee3$(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,checkInvitation();case 2:(e=t.sent)&&(d.close(),d.showRegister(n,e));case 4:case"end":return t.stop()}}),_callee3)})));return function toRegister(){return e.apply(this,arguments)}}();function checkInvitation(){return _checkInvitation.apply(this,arguments)}function _checkInvitation(){return _checkInvitation=(0,o.Z)(l().mark((function _callee4(){var e,t,n;return l().wrap((function _callee4$(r){for(;;)switch(r.prev=r.next){case 0:return t=null===(e=d.state)||void 0===e?void 0:e.invitationId,r.next=3,h.getInvitationValue("email",t);case 3:if(!(n=r.sent)){r.next=8;break}return r.abrupt("return",n.email);case 8:return j("Invitation not found"),r.abrupt("return",void 0);case 10:case"end":return r.stop()}}),_callee4)}))),_checkInvitation.apply(this,arguments)}return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)("h1",{children:m("auth.title.welcome")}),(0,f.jsx)("p",{children:m("auth.info.welcomedescription")}),w&&(0,f.jsxs)("div",{className:c.vU,children:[(0,f.jsx)("span",{}),(0,f.jsx)("div",{children:m(w)})]}),t&&!C&&!w&&(0,f.jsx)(v.Z,{onClick:Z,children:m("auth.title.register")}),C&&!w&&(0,f.jsx)(v.Z,{onClick:S,children:m("auth.button.login")})]})}var S=n(217),Z=n(7726),b=n(4062),L=n(9074),N=n(1522),I=n(4039),z=n(7843),E=n(8815),P=n(5739),D=n(883),O=n(3966),F=n(431);function getSwitchBaseUtilityClass(e){return(0,F.ZP)("PrivateSwitchBase",e)}(0,O.Z)("PrivateSwitchBase",["root","checked","disabled","input","edgeStart","edgeEnd"]);const R=(0,z.ZP)(D.Z)({padding:9,borderRadius:"50%",variants:[{props:{edge:"start",size:"small"},style:{marginLeft:-3}},{props:({edge:e,ownerState:t})=>"start"===e&&"small"!==t.size,style:{marginLeft:-12}},{props:{edge:"end",size:"small"},style:{marginRight:-3}},{props:({edge:e,ownerState:t})=>"end"===e&&"small"!==t.size,style:{marginRight:-12}}]}),_=(0,z.ZP)("input",{shouldForwardProp:I.Z})({cursor:"inherit",position:"absolute",opacity:0,width:"100%",height:"100%",top:0,left:0,margin:0,padding:0,zIndex:1}),A=r.forwardRef((function SwitchBase(e,t){const{autoFocus:n,checked:r,checkedIcon:a,className:o,defaultChecked:i,disabled:s,disableFocusRipple:l=!1,edge:c=!1,icon:u,id:d,inputProps:h,inputRef:p,name:v,onBlur:g,onChange:x,onFocus:w,readOnly:j,required:m=!1,tabIndex:y,type:k,value:C,...M}=e,[S,L]=(0,E.Z)({controlled:r,default:Boolean(i),name:"SwitchBase",state:"checked"}),I=(0,P.Z)();let z=s;I&&void 0===z&&(z=I.disabled);const D="checkbox"===k||"radio"===k,O={...e,checked:S,disabled:z,disableFocusRipple:l,edge:c},F=(e=>{const{classes:t,checked:n,disabled:r,edge:a}=e,o={root:["root",n&&"checked",r&&"disabled",a&&`edge${(0,N.Z)(a)}`],input:["input"]};return(0,b.Z)(o,getSwitchBaseUtilityClass,t)})(O);return(0,f.jsxs)(R,{component:"span",className:(0,Z.Z)(F.root,o),centerRipple:!0,focusRipple:!l,disabled:z,tabIndex:null,role:void 0,onFocus:e=>{w&&w(e),I&&I.onFocus&&I.onFocus(e)},onBlur:e=>{g&&g(e),I&&I.onBlur&&I.onBlur(e)},ownerState:O,ref:t,...M,children:[(0,f.jsx)(_,{autoFocus:n,checked:r,defaultChecked:i,className:F.input,disabled:z,id:D?d:void 0,name:v,onChange:e=>{if(e.nativeEvent.defaultPrevented)return;const t=e.target.checked;L(t),x&&x(e,t)},readOnly:j,ref:p,required:m,ownerState:O,tabIndex:y,type:k,..."checkbox"===k&&void 0===C?{}:{value:C},...h}),S?a:u]})}));var T=n(6177);const U=(0,T.Z)((0,f.jsx)("path",{d:"M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z"}),"CheckBoxOutlineBlank"),$=(0,T.Z)((0,f.jsx)("path",{d:"M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.11 0 2-.9 2-2V5c0-1.1-.89-2-2-2zm-9 14l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"}),"CheckBox"),B=(0,T.Z)((0,f.jsx)("path",{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-2 10H7v-2h10v2z"}),"IndeterminateCheckBox");function getCheckboxUtilityClass(e){return(0,F.ZP)("MuiCheckbox",e)}const G=(0,O.Z)("MuiCheckbox",["root","checked","disabled","indeterminate","colorPrimary","colorSecondary","sizeSmall","sizeMedium"]);var H=n(518),K=n(8981),V=n(2893);const Q=(0,z.ZP)(A,{shouldForwardProp:e=>(0,I.Z)(e)||"classes"===e,name:"MuiCheckbox",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,n.indeterminate&&t.indeterminate,t[`size${(0,N.Z)(n.size)}`],"default"!==n.color&&t[`color${(0,N.Z)(n.color)}`]]}})((0,H.Z)((({theme:e})=>({color:(e.vars||e).palette.text.secondary,variants:[{props:{color:"default",disableRipple:!1},style:{"&:hover":{backgroundColor:e.vars?`rgba(${e.vars.palette.action.activeChannel} / ${e.vars.palette.action.hoverOpacity})`:(0,L.Fq)(e.palette.action.active,e.palette.action.hoverOpacity)}}},...Object.entries(e.palette).filter((0,K.Z)()).map((([t])=>({props:{color:t,disableRipple:!1},style:{"&:hover":{backgroundColor:e.vars?`rgba(${e.vars.palette[t].mainChannel} / ${e.vars.palette.action.hoverOpacity})`:(0,L.Fq)(e.palette[t].main,e.palette.action.hoverOpacity)}}}))),...Object.entries(e.palette).filter((0,K.Z)()).map((([t])=>({props:{color:t},style:{[`&.${G.checked}, &.${G.indeterminate}`]:{color:(e.vars||e).palette[t].main},[`&.${G.disabled}`]:{color:(e.vars||e).palette.action.disabled}}}))),{props:{disableRipple:!1},style:{"&:hover":{"@media (hover: none)":{backgroundColor:"transparent"}}}}]})))),W=(0,f.jsx)($,{}),Y=(0,f.jsx)(U,{}),q=(0,f.jsx)(B,{}),J=r.forwardRef((function Checkbox(e,t){const n=(0,V.i)({props:e,name:"MuiCheckbox"}),{checkedIcon:a=W,color:o="primary",icon:i=Y,indeterminate:s=!1,indeterminateIcon:l=q,inputProps:c,size:u="medium",disableRipple:d=!1,className:h,...p}=n,v=s?l:i,g=s?l:a,x={...n,disableRipple:d,color:o,indeterminate:s,size:u},w=(e=>{const{classes:t,indeterminate:n,color:r,size:a}=e,o={root:["root",n&&"indeterminate",`color${(0,N.Z)(r)}`,`size${(0,N.Z)(a)}`]},i=(0,b.Z)(o,getCheckboxUtilityClass,t);return{...t,...i}})(x);return(0,f.jsx)(Q,{type:"checkbox",inputProps:{"data-indeterminate":s,...c},icon:r.cloneElement(v,{fontSize:v.props.fontSize??u}),checkedIcon:r.cloneElement(g,{fontSize:g.props.fontSize??u}),ownerState:x,ref:t,className:(0,Z.Z)(w.root,h),disableRipple:d,...p,classes:w})}));var X=(0,j.jl)("Framework","Register");const ee=(0,u.Pi)((function Register(){var e,t,n,s,u,x,w=(0,a.KH)(),j=w.authorizationStore,m=w.configurationStore,y=(0,g.$G)().t,k=(0,r.useState)(null!==(e=null===(t=j.state)||void 0===t?void 0:t.email)&&void 0!==e?e:""),C=(0,i.Z)(k,2),M=C[0],Z=C[1],b=(0,r.useState)(""),L=(0,i.Z)(b,2),N=L[0],I=L[1],z=(0,r.useState)(""),E=(0,i.Z)(z,2),P=E[0],D=E[1],O=(0,r.useState)(""),F=(0,i.Z)(O,2),R=F[0],_=F[1],A=(0,r.useState)(""),T=(0,i.Z)(A,2),U=T[0],$=T[1],B=(0,r.useState)(""),G=(0,i.Z)(B,2),H=G[0],K=G[1],V=(0,r.useState)(""),Q=(0,i.Z)(V,2),W=Q[0],Y=Q[1],q=(0,r.useState)(!1),ee=(0,i.Z)(q,2),te=ee[0],ne=ee[1],re=function(){var e=(0,o.Z)(l().mark((function _callee(){var e;return l().wrap((function _callee$(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,(0,h.fl)(j.register(M,N,U,R,null===(e=j.state)||void 0===e?void 0:e.invitationId,ae?W:void 0));case 3:Z(""),I(""),D(""),$(""),_(""),t.next=14;break;case 10:t.prev=10,t.t0=t.catch(0),K("auth.error.invitationotp"),X.error(new d.GE("Error while registering",{cause:t.t0}));case 14:case"end":return t.stop()}}),_callee,null,[[0,10]])})));return function onRegister(){return e.apply(this,arguments)}}(),ae=null===(n=j.state)||void 0===n?void 0:n.useOtp,oe=function validPassword(){return ae?null!=W&&""!==W&&N==P&&""!=N&&null!=N&&te:N==P&&""!=N&&null!=N&&te},ie=null===(s=j.state)||void 0===s?void 0:s.loginMethods;return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)("h1",{children:y("auth.title.register")}),(0,f.jsx)("p",{children:y("auth.text.register","")}),!!H&&(0,f.jsxs)("div",{className:c.vU,children:[(0,f.jsx)("span",{}),(0,f.jsx)("div",{children:y(H)})]}),(0,f.jsx)(OpenId,{}),((null==ie?void 0:ie.generic)||(null==ie?void 0:ie.google)||(null==ie?void 0:ie.microsoft))&&ie.standard&&(0,f.jsx)("div",{className:c.kr,children:"or"}),(null==ie?void 0:ie.standard)&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)("form",{children:[ae&&(0,f.jsx)(p.Z,{type:"text",value:W,placeholder:y("auth.input.otp"),onChange:function onChange(e){return Y(e.target.value)}}),(0,f.jsx)(p.Z,{value:U,autoFocus:!0,placeholder:y("backoffice.form.userdetails.items.name"),onChange:function onChange(e){return $(e.target.value)}}),(0,f.jsx)(p.Z,{value:R,autoFocus:!0,placeholder:y("backoffice.form.userdetails.items.familyName"),onChange:function onChange(e){return _(e.target.value)}}),(0,f.jsx)(p.Z,{value:M,autoComplete:"email",autoFocus:!0,placeholder:y("auth.input.email"),disabled:!0}),(0,f.jsx)(p.Z,{value:N,type:"password",autoFocus:!0,placeholder:y("auth.input.password"),onChange:function onChange(e){return I(e.target.value)}}),(0,f.jsx)(p.Z,{value:P,type:"password",autoFocus:!0,placeholder:y("auth.input.repeatpassword"),onChange:function onChange(e){return D(e.target.value)}}),(0,f.jsxs)("div",{style:{display:"flex",gap:5,alignItems:"center"},children:[(0,f.jsx)(J,{name:"checkAGB",checked:te,onClick:function onClick(){return ne(!te)}}),(0,f.jsxs)("div",{style:{display:"flex",flexDirection:"column",fontSize:9},children:[(0,f.jsx)("span",{children:y("auth.acceptprivacyandagb")}),(0,f.jsxs)("span",{children:[(0,f.jsx)("a",{target:"_blank",href:null!==(u=m.navigation.tosUrl)&&void 0!==u?u:"https://www.diva-portal.de/agb",children:y("auth.GeneralTerms")}),", ",(0,f.jsx)("a",{target:"_blank",href:null!==(x=m.navigation.privacyUrl)&&void 0!==x?x:"https://www.diva-portal.de/datenschutz",children:y("auth.privacypolicy")})]})]})]}),(0,f.jsx)(S.Z,{style:{color:"#FF8C00",marginTop:10,fontSize:14},hidden:oe(),children:y("auth.input.passwordsnotmatch")})]}),(0,f.jsx)(v.Z,{disabled:!oe(),onClick:oe()?re:void 0,children:y("auth.input.login")})]})]})}));var te=(0,u.Pi)((function(){var e,t=(0,a.KH)().authorizationStore;switch(null===(e=t.state)||void 0===e?void 0:e.type){case"LOGIN":return(0,f.jsx)(y,{});case"REQUEST_NEW_PASSWORD":return(0,f.jsx)(RequestNewPassword,{initEmail:t.state.email});case"CHANGE_PASSWORD":return(0,f.jsx)(ChangePassword,{token:t.state.token});case"WELCOME":return(0,f.jsx)(WelcomeScreen,{isNewUser:t.state.isNewUser,invitationId:t.state.invitationId,invitationOrgId:t.state.invitationOrgId});case"REGISTER":return(0,f.jsx)(ee,{});case"INVITATION_EXPIRED":return(0,f.jsx)("h1",{children:"Abgelaufen"});default:return(0,f.jsx)(f.Fragment,{})}}));const ne=(0,u.Pi)((function Auth(){var e,t,n,o=(0,a.KH)(),i=o.authorizationStore,s=o.configurationStore,l=o.dataStore,u=(o.authorizationHandler,(0,r.useMemo)((function(){var e,t,n,r="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciICB2aWV3Qm94PSIwIDAgMTAwMCAyOTMuNjUiPjxwYXRoIGQ9Ik0yNTAuODksMTQ3LjNjLTMuMTgtNzQtMzAuNC0xNDMuMTgtMTQxLjczLTE0My4xOEwwLDQuMjZBMzA3Ljg2LDMwNy44NiwwLDAsMSwyNi4xMiw2MC43aDc0LjJjNTIuODYsMCw3NiwyNS42OCw3OC42MSw4NS4yOSwyLjY2LDYxLjgxLTE4LjI5LDg3LjkyLTcxLjE1LDg3LjkySDc5LjJsLTQ2LjcxLjUyYTI4Ny4yOSwyODcuMjksMCwwLDEtMjAsNTMuODhoMTA5YzExMS4zMiwwLDEzMi42Ny02NywxMjkuNDgtMTQxTTMwNi44NCwyODloNzEuMjNWMGEzMDAuMDcsMzAwLjA3LDAsMCwxLTcxLjIzLDI1LjkyWm0zMTguOC42Mkw3MjYuNTkuODVhMzAwLDMwMCwwLDAsMS04My42NSwzMi4yNEw1NzcuMTEsMjI0LDUxMS4yOSwzMy4wOUEzMDAsMzAwLDAsMCwxLDQyNy42NC44NWwxMDEsMjg4Ljc2Wm0zNzQuMzYsNEw4OTkuMDUsNC45MUg4MDJMNzc1LjE0LDgxLjc0LDcwMS4wNSwyOTMuNjVBMzAwLjMyLDMwMC4zMiwwLDAsMSw3ODUsMjYxLjM1bDYuNzktMjEsMTkuMTQtNTcuNTRMODUwLjUyLDYybDQwLjA3LDEyMC44NSwxOC43LDU3LjU0LDcsMjFBMzAwLjIsMzAwLjIsMCwwLDEsMTAwMCwyOTMuNjUiIGZpbGw9IiNiM2IzYjMiLz48L3N2Zz4=";if(null!==(e=l.organization)&&void 0!==e&&e.logoUrl)r=null===(n=l.organization)||void 0===n?void 0:n.logoUrl;else if(null!==(t=s.navigation)&&void 0!==t&&t.logoUrl){var a;r=null===(a=s.navigation)||void 0===a?void 0:a.logoUrl}return r}),[null===(e=s.navigation)||void 0===e?void 0:e.logoUrl,null===(t=l.organization)||void 0===t?void 0:t.logoUrl]));return null==i.state?(0,f.jsx)(f.Fragment,{}):(0,f.jsxs)("div",{className:c.I8,children:[(0,f.jsxs)("div",{className:c.NB,children:[(0,f.jsx)("div",{className:c.tn,style:{height:null!==(n=s.configuration.loginLogoHeight)&&void 0!==n?n:50,backgroundImage:"url(".concat(u,")")}}),(0,f.jsx)(te,{})]}),s.authentication.contentBox&&(0,f.jsx)("div",{style:{width:"calc(100% - 400px)",height:"100%",position:"relative",overflow:"hidden"},children:(0,f.jsx)(M.p,{settings:{contentBoxProps:(0,h.ZN)(s.authentication.contentBox.props)}})})]})}))}}]);
2
+ "use strict";(self.webpackChunkCrystaldesignDivaSupport=self.webpackChunkCrystaldesignDivaSupport||[]).push([[767],{6767:(e,t,n)=>{n.r(t),n.d(t,{default:()=>ne});var r=n(7363),a=n(6308),o=n(4658),i=n(4988),s=n(747),l=n.n(s),c=n(523),u=n(9420),d=n(9534),h=n(8623),p=n(3096),v=n(7995),g=n(789),x=n(5515),w=n.n(x),f=n(7514);function OpenId(){var e,t,n,r=(0,a.KH)(),o=r.configurationStore,i=r.authorizationStore,s=(0,g.$G)().t,l=null===(e=i.state)||void 0===e?void 0:e.loginMethods;return(0,f.jsxs)(f.Fragment,{children:[(null==l?void 0:l.google)&&(0,f.jsxs)(v.Z,{className:w()(c.FI,c.lk),onClick:function onClick(){var e;return i.openOAuthLogin("google",i.state.organizationId,null===(e=i.state)||void 0===e?void 0:e.invitationId)},children:[(0,f.jsx)("div",{}),s("auth.login.google")]}),(null==l?void 0:l.microsoft)&&(0,f.jsxs)(v.Z,{className:w()(c.FI,c.Eg),onClick:function onClick(){var e;return i.openOAuthLogin("microsoft",i.state.organizationId,null===(e=i.state)||void 0===e?void 0:e.invitationId)},children:[(0,f.jsx)("div",{}),s("auth.login.microsoft")]}),(null==l?void 0:l.generic)&&(0,f.jsxs)(v.Z,{className:c.FI,style:{backgroundColor:null!==(t=l.generic.backgroundColor)&&void 0!==t?t:o.theme.palette.secondary.main,color:null!==(n=l.generic.color)&&void 0!==n?n:o.theme.palette.secondary.contrastText},onClick:function onClick(){var e;return i.openOAuthLogin("genericOpenId",i.state.organizationId,null===(e=i.state)||void 0===e?void 0:e.invitationId)},children:[(0,f.jsx)("div",{style:l.generic.logo?{backgroundImage:"url(".concat(l.generic.logo,")")}:{}}),s("auth.login.generic")]})]})}var j=n(4680),m=(0,j.jl)("Framework","Login");const y=(0,u.Pi)((function Login(){var e,t,n,s,u=(0,a.KH)(),x=u.authorizationStore,w=u.authorizationHandler,j=(0,r.useState)("enter"),y=(0,i.Z)(j,2),k=y[0],C=y[1],M=(0,r.useState)(null!==(e=null===(t=x.state)||void 0===t?void 0:t.email)&&void 0!==e?e:""),S=(0,i.Z)(M,2),Z=S[0],b=S[1],L=(0,r.useState)(""),N=(0,i.Z)(L,2),I=N[0],z=N[1],E=(0,r.useState)(""),P=(0,i.Z)(E,2),D=P[0],O=P[1],F=(0,r.useState)(!1),R=(0,i.Z)(F,2),_=R[0],A=R[1],T=(0,r.useState)(x.state.invitationId),U=(0,i.Z)(T,2),$=U[0],B=U[1],G=(0,r.useState)("LOGIN"==(null===(n=x.state)||void 0===n?void 0:n.type)?x.state.error:void 0),H=(0,i.Z)(G,2),K=H[0],V=H[1],Q=(0,g.$G)().t,W=function(){var e=(0,o.Z)(l().mark((function _callee(){var e,t;return l().wrap((function _callee$(n){for(;;)switch(n.prev=n.next){case 0:if(n.prev=0,$){n.next=6;break}return n.next=4,w.getInvitationValue("id",Z);case 4:(e=n.sent)&&(e.isNewUser&&(x.close(),x.showRegister(void 0,Z,!!e.useotp)),B(!0),e.useotp&&A(!0));case 6:return n.next=8,w.fetchLoginProvider({email:Z});case 8:"standard"==(t=n.sent).provider?C("login"):x.openOAuthLogin(t.provider,x.state.organizationId,x.state.invitationId),n.next=16;break;case 12:n.prev=12,n.t0=n.catch(0),m.error(new d.GE("Error while fetching login provider",{cause:n.t0})),V("auth.error.password");case 16:case"end":return n.stop()}}),_callee,null,[[0,12]])})));return function onContinue(){return e.apply(this,arguments)}}(),Y=function(){var e=(0,o.Z)(l().mark((function _callee2(){return l().wrap((function _callee2$(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,(0,h.fl)(x.login(Z,I,!1,x.state.organizationId,x.state.invitationId,D));case 3:b(""),z(""),V(void 0),e.next=12;break;case 8:e.prev=8,e.t0=e.catch(0),m.error(new d.GE("Error while logging in",{cause:e.t0})),V($?"auth.error.passwordotp":"auth.error.password");case 12:case"end":return e.stop()}}),_callee2,null,[[0,8]])})));return function onLogin(){return e.apply(this,arguments)}}(),q=function(){var e=(0,o.Z)(l().mark((function _callee3(){return l().wrap((function _callee3$(e){for(;;)switch(e.prev=e.next){case 0:x.showRequestNewPassword(Z);case 1:case"end":return e.stop()}}),_callee3)})));return function resetPassword(){return e.apply(this,arguments)}}(),J="enter"==k&&0==Z.length||"enter"!=k&&0==I.length;_&&!J&&(J=0==D.length);var X=null===(s=x.state)||void 0===s?void 0:s.loginMethods;return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)("h1",{children:Q("auth.title.login")}),(0,f.jsx)("p",{children:Q("auth.text.login","")}),!!K&&(0,f.jsxs)("div",{className:c.vU,children:[(0,f.jsx)("span",{}),(0,f.jsx)("div",{id:"loginerrortext",children:Q(K)})]}),(0,f.jsx)(OpenId,{}),((null==X?void 0:X.generic)||(null==X?void 0:X.google)||(null==X?void 0:X.microsoft))&&X.standard&&(0,f.jsx)("div",{className:c.kr,children:"or"}),(null==X?void 0:X.standard)&&(0,f.jsxs)(f.Fragment,{children:["enter"==k&&(0,f.jsxs)("form",{children:[(0,f.jsx)(p.Z,{id:"username",value:Z,autoComplete:"username",autoFocus:!0,placeholder:Q("auth.input.email"),onChange:function onChange(e){return b(e.target.value)},onKeyPress:function onKeyPress(e){return"Enter"==e.key&&W()}}),(0,f.jsx)(p.Z,{value:I,id:"password",type:"password",autoComplete:"current-password",hidden:!0,autoFocus:!0,placeholder:Q("auth.input.password"),onChange:function onChange(e){return z(e.target.value)},onKeyPress:function onKeyPress(e){return"Enter"==e.key&&Y()}})]}),"login"==k&&(0,f.jsxs)("form",{children:[_&&(0,f.jsx)(p.Z,{value:D,type:"text",autoFocus:!0,placeholder:Q("auth.input.otp"),onChange:function onChange(e){return O(e.target.value)}}),(0,f.jsx)("label",{className:c.TL,onClick:function reset(){C("enter"),b(""),z(""),V(void 0)},children:(0,f.jsx)(p.Z,{value:Z,readOnly:!0,placeholder:Q("auth.input.email")})}),(0,f.jsx)(p.Z,{value:I,type:"password",id:"password",autoFocus:!0,placeholder:Q("auth.input.password"),onChange:function onChange(e){return z(e.target.value)},onKeyPress:function onKeyPress(e){return"Enter"==e.key&&Y()}}),(0,f.jsx)("div",{className:c.p4,style:{textAlign:"right"},onClick:q,children:Q("auth.button.forgotpassword")})]}),(0,f.jsx)(v.Z,{id:"submit",disabled:J,onClick:"enter"==k?W:Y,children:Q("enter"==k?"auth.button.continue":"auth.button.login")})]})]})}));var k=(0,j.jl)("Framework","RequestNewPassword");function RequestNewPassword(e){var t=e.initEmail,n=(0,a.KH)(),s=n.authorizationStore,u=n.apiHandler,h=n.loadingAndErrorStore,x=(0,r.useState)(t),w=(0,i.Z)(x,2),j=w[0],m=w[1],y=(0,r.useState)(!1),C=(0,i.Z)(y,2),M=C[0],S=C[1],Z=(0,r.useState)(),b=(0,i.Z)(Z,2),L=b[0],N=b[1],I=(0,r.useState)(),z=(0,i.Z)(I,2),E=z[0],P=z[1],D=(0,g.$G)().t,O=function(){var e=(0,o.Z)(l().mark((function _callee(){return l().wrap((function _callee$(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,P(!0),h.toggleLoading("SendPassword"),e.next=5,u.sendPasswordRecoveryMail({email:j});case 5:P(!1),h.toggleLoading("SendPassword"),S(!0),N(void 0),e.next=17;break;case 11:e.prev=11,e.t0=e.catch(0),k.error(new d.GE("Error while sending password recovery mail",{cause:e.t0})),N("auth.error.resetpassword"),P(!1),h.toggleLoading("SendPassword");case 17:case"end":return e.stop()}}),_callee,null,[[0,11]])})));return function resetPassword(){return e.apply(this,arguments)}}();return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)("h1",{children:D("auth.title.resetpassword")}),(0,f.jsx)("p",{children:D("auth.info.resetdescription")}),!!L&&(0,f.jsxs)("div",{className:c.vU,children:[(0,f.jsx)("span",{}),(0,f.jsx)("div",{children:D(L)})]}),M&&(0,f.jsxs)("div",{className:c.Vp,children:[(0,f.jsx)("span",{}),(0,f.jsx)("div",{children:D("auth.info.resetpassword")})]}),!M&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(p.Z,{value:j,autoFocus:!0,placeholder:D("auth.input.email"),onChange:function onChange(e){return m(e.target.value)},onKeyPress:function onKeyPress(e){return"Enter"==e.key&&O()}}),(0,f.jsx)(v.Z,{disabled:0==j.length,onClick:O,children:D("auth.button.resetpassword")})]}),M&&(0,f.jsx)(v.Z,{disabled:E,onClick:function toLogin(){s.close(),s.showLogin()},children:D("auth.button.login")})]})}function Errormessage(e){var t=e.hasError,n=e.authErrorsg,r=(0,g.$G)().t;return(0,f.jsxs)("div",{className:c.vU,children:[(0,f.jsx)("span",{}),"INVALID"==t&&(0,f.jsx)("div",{children:r("auth.error.verifypassword")}),"SERVER"==t&&(0,f.jsx)("div",{children:n})]})}var C=(0,j.jl)("Framework","cfhange-password");function ChangePassword(e){var t,n=e.token,s=(0,a.KH)(),u=s.configurationStore,h=s.authorizationStore,x=s.apiHandler,w=(s.loadingAndErrorStore,(0,r.useState)("")),j=(0,i.Z)(w,2),m=j[0],y=j[1],k=(0,r.useState)(""),M=(0,i.Z)(k,2),S=M[0],Z=M[1],b=(0,r.useState)(!1),L=(0,i.Z)(b,2),N=L[0],I=L[1],z=(0,r.useState)(),E=(0,i.Z)(z,2),P=E[0],D=E[1],O=(0,r.useState)(""),F=(0,i.Z)(O,2),R=F[0],_=F[1],A=(0,r.useRef)(null),T=(0,g.$G)().t;(0,r.useEffect)((function(){m===S&&D(void 0)}),[m,S]);var U=function(){var e=(0,o.Z)(l().mark((function _callee(){return l().wrap((function _callee$(e){for(;;)switch(e.prev=e.next){case 0:if(_(T("auth.error.verifypasswordserver")),!(m.length<8||m!==S)){e.next=4;break}return D("INVALID"),e.abrupt("return");case 4:return e.prev=4,e.next=7,x.resetPassword({password:m,token:n});case 7:I(!0),e.next=13;break;case 10:e.prev=10,e.t0=e.catch(4),$(e.t0);case 13:case"end":return e.stop()}}),_callee,null,[[4,10]])})));return function resetPassword(){return e.apply(this,arguments)}}(),$=function handleError(e){if(e instanceof d.GE){if("AUTH_0003"===e.name)_(T("auth.error.verifypasswordtokenerror",{errormsg:T("auth.error.tokenexpired")}));else _(T("auth.error.verifypasswordserver",e.message));C.error(e)}C.error(new d.GE("Error while resetting password",{cause:e})),D("SERVER")};return"SERVER"===P?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(Errormessage,{hasError:P,authErrorsg:R}),(0,f.jsx)(v.Z,{onClick:function onClickRequestNewPassword(){h.showRequestNewPassword("")},children:T("auth.button.resetpassword")})]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)("h1",{children:T("auth.title.verifypassword")}),N&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)("div",{className:c.Vp,children:[(0,f.jsx)("span",{}),(0,f.jsx)("div",{children:T("auth.info.verifypassword")})]}),(null===(t=u.authentication.resetPassword)||void 0===t?void 0:t.returnToLogin)&&(0,f.jsx)(v.Z,{onClick:function goToLogin(){h.close(),h.showLogin()},children:T("auth.button.login")})]}),!N&&(0,f.jsxs)(f.Fragment,{children:[P&&(0,f.jsx)(Errormessage,{hasError:P,authErrorsg:R}),(0,f.jsxs)("form",{children:[(0,f.jsx)(p.Z,{value:m,autoFocus:!0,placeholder:T("auth.input.password"),type:"password",autoComplete:"new-password",onChange:function onChange(e){return y(e.target.value)},onKeyPress:function onKeyPress(e){var t;return"Enter"==e.key&&(null===(t=A.current)||void 0===t?void 0:t.focus())}}),(0,f.jsx)(p.Z,{ref:A,value:S,placeholder:T("auth.input.verifypassword"),type:"password",autoComplete:"new-password",onChange:function onChange(e){return Z(e.target.value)},onKeyPress:function onKeyPress(e){return"Enter"==e.key&&U()}})]}),(0,f.jsx)(v.Z,{disabled:!m||!S,onClick:U,children:T("auth.button.save")})]})]})}var M=n(5019);function WelcomeScreen(e){var t=e.isNewUser,n=e.invitationId,s=e.invitationOrgId,u=(0,a.KH)(),d=u.authorizationStore,h=u.authorizationHandler,p=(0,r.useState)(""),x=(0,i.Z)(p,2),w=x[0],j=x[1],m=(0,g.$G)().t,y=(0,r.useState)(""),k=(0,i.Z)(y,2),C=k[0],M=k[1];(0,r.useEffect)((function(){function _getInvitation(){return(_getInvitation=(0,o.Z)(l().mark((function _callee(){var e,t;return l().wrap((function _callee$(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,h.getInvitationValue("user",null===(e=d.state)||void 0===e?void 0:e.invitationId);case 2:return(t=n.sent)&&M(t.user),n.abrupt("return");case 5:case"end":return n.stop()}}),_callee)})))).apply(this,arguments)}!function getInvitation(){return _getInvitation.apply(this,arguments)}()}),[n]);var S=function(){var e=(0,o.Z)(l().mark((function _callee2(){var e;return l().wrap((function _callee2$(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,checkInvitation();case 2:(e=t.sent)&&(d.close(),d.showLogin(void 0,void 0,s,n,e));case 4:case"end":return t.stop()}}),_callee2)})));return function toLogin(){return e.apply(this,arguments)}}(),Z=function(){var e=(0,o.Z)(l().mark((function _callee3(){var e;return l().wrap((function _callee3$(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,checkInvitation();case 2:(e=t.sent)&&(d.close(),d.showRegister(n,e));case 4:case"end":return t.stop()}}),_callee3)})));return function toRegister(){return e.apply(this,arguments)}}();function checkInvitation(){return _checkInvitation.apply(this,arguments)}function _checkInvitation(){return _checkInvitation=(0,o.Z)(l().mark((function _callee4(){var e,t,n;return l().wrap((function _callee4$(r){for(;;)switch(r.prev=r.next){case 0:return t=null===(e=d.state)||void 0===e?void 0:e.invitationId,r.next=3,h.getInvitationValue("email",t);case 3:if(!(n=r.sent)){r.next=8;break}return r.abrupt("return",n.email);case 8:return j("Invitation not found"),r.abrupt("return",void 0);case 10:case"end":return r.stop()}}),_callee4)}))),_checkInvitation.apply(this,arguments)}return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)("h1",{children:m("auth.title.welcome")}),(0,f.jsx)("p",{children:m("auth.info.welcomedescription")}),w&&(0,f.jsxs)("div",{className:c.vU,children:[(0,f.jsx)("span",{}),(0,f.jsx)("div",{children:m(w)})]}),t&&!C&&!w&&(0,f.jsx)(v.Z,{onClick:Z,children:m("auth.title.register")}),C&&!w&&(0,f.jsx)(v.Z,{onClick:S,children:m("auth.button.login")})]})}var S=n(217),Z=n(7726),b=n(4062),L=n(9074),N=n(1522),I=n(4039),z=n(7843),E=n(8815),P=n(5739),D=n(883),O=n(3966),F=n(431);function getSwitchBaseUtilityClass(e){return(0,F.ZP)("PrivateSwitchBase",e)}(0,O.Z)("PrivateSwitchBase",["root","checked","disabled","input","edgeStart","edgeEnd"]);const R=(0,z.ZP)(D.Z)({padding:9,borderRadius:"50%",variants:[{props:{edge:"start",size:"small"},style:{marginLeft:-3}},{props:({edge:e,ownerState:t})=>"start"===e&&"small"!==t.size,style:{marginLeft:-12}},{props:{edge:"end",size:"small"},style:{marginRight:-3}},{props:({edge:e,ownerState:t})=>"end"===e&&"small"!==t.size,style:{marginRight:-12}}]}),_=(0,z.ZP)("input",{shouldForwardProp:I.Z})({cursor:"inherit",position:"absolute",opacity:0,width:"100%",height:"100%",top:0,left:0,margin:0,padding:0,zIndex:1}),A=r.forwardRef((function SwitchBase(e,t){const{autoFocus:n,checked:r,checkedIcon:a,className:o,defaultChecked:i,disabled:s,disableFocusRipple:l=!1,edge:c=!1,icon:u,id:d,inputProps:h,inputRef:p,name:v,onBlur:g,onChange:x,onFocus:w,readOnly:j,required:m=!1,tabIndex:y,type:k,value:C,...M}=e,[S,L]=(0,E.Z)({controlled:r,default:Boolean(i),name:"SwitchBase",state:"checked"}),I=(0,P.Z)();let z=s;I&&void 0===z&&(z=I.disabled);const D="checkbox"===k||"radio"===k,O={...e,checked:S,disabled:z,disableFocusRipple:l,edge:c},F=(e=>{const{classes:t,checked:n,disabled:r,edge:a}=e,o={root:["root",n&&"checked",r&&"disabled",a&&`edge${(0,N.Z)(a)}`],input:["input"]};return(0,b.Z)(o,getSwitchBaseUtilityClass,t)})(O);return(0,f.jsxs)(R,{component:"span",className:(0,Z.Z)(F.root,o),centerRipple:!0,focusRipple:!l,disabled:z,tabIndex:null,role:void 0,onFocus:e=>{w&&w(e),I&&I.onFocus&&I.onFocus(e)},onBlur:e=>{g&&g(e),I&&I.onBlur&&I.onBlur(e)},ownerState:O,ref:t,...M,children:[(0,f.jsx)(_,{autoFocus:n,checked:r,defaultChecked:i,className:F.input,disabled:z,id:D?d:void 0,name:v,onChange:e=>{if(e.nativeEvent.defaultPrevented)return;const t=e.target.checked;L(t),x&&x(e,t)},readOnly:j,ref:p,required:m,ownerState:O,tabIndex:y,type:k,..."checkbox"===k&&void 0===C?{}:{value:C},...h}),S?a:u]})}));var T=n(6177);const U=(0,T.Z)((0,f.jsx)("path",{d:"M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z"}),"CheckBoxOutlineBlank"),$=(0,T.Z)((0,f.jsx)("path",{d:"M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.11 0 2-.9 2-2V5c0-1.1-.89-2-2-2zm-9 14l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"}),"CheckBox"),B=(0,T.Z)((0,f.jsx)("path",{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-2 10H7v-2h10v2z"}),"IndeterminateCheckBox");function getCheckboxUtilityClass(e){return(0,F.ZP)("MuiCheckbox",e)}const G=(0,O.Z)("MuiCheckbox",["root","checked","disabled","indeterminate","colorPrimary","colorSecondary","sizeSmall","sizeMedium"]);var H=n(518),K=n(8981),V=n(2893);const Q=(0,z.ZP)(A,{shouldForwardProp:e=>(0,I.Z)(e)||"classes"===e,name:"MuiCheckbox",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,n.indeterminate&&t.indeterminate,t[`size${(0,N.Z)(n.size)}`],"default"!==n.color&&t[`color${(0,N.Z)(n.color)}`]]}})((0,H.Z)((({theme:e})=>({color:(e.vars||e).palette.text.secondary,variants:[{props:{color:"default",disableRipple:!1},style:{"&:hover":{backgroundColor:e.vars?`rgba(${e.vars.palette.action.activeChannel} / ${e.vars.palette.action.hoverOpacity})`:(0,L.Fq)(e.palette.action.active,e.palette.action.hoverOpacity)}}},...Object.entries(e.palette).filter((0,K.Z)()).map((([t])=>({props:{color:t,disableRipple:!1},style:{"&:hover":{backgroundColor:e.vars?`rgba(${e.vars.palette[t].mainChannel} / ${e.vars.palette.action.hoverOpacity})`:(0,L.Fq)(e.palette[t].main,e.palette.action.hoverOpacity)}}}))),...Object.entries(e.palette).filter((0,K.Z)()).map((([t])=>({props:{color:t},style:{[`&.${G.checked}, &.${G.indeterminate}`]:{color:(e.vars||e).palette[t].main},[`&.${G.disabled}`]:{color:(e.vars||e).palette.action.disabled}}}))),{props:{disableRipple:!1},style:{"&:hover":{"@media (hover: none)":{backgroundColor:"transparent"}}}}]})))),W=(0,f.jsx)($,{}),Y=(0,f.jsx)(U,{}),q=(0,f.jsx)(B,{}),J=r.forwardRef((function Checkbox(e,t){const n=(0,V.i)({props:e,name:"MuiCheckbox"}),{checkedIcon:a=W,color:o="primary",icon:i=Y,indeterminate:s=!1,indeterminateIcon:l=q,inputProps:c,size:u="medium",disableRipple:d=!1,className:h,...p}=n,v=s?l:i,g=s?l:a,x={...n,disableRipple:d,color:o,indeterminate:s,size:u},w=(e=>{const{classes:t,indeterminate:n,color:r,size:a}=e,o={root:["root",n&&"indeterminate",`color${(0,N.Z)(r)}`,`size${(0,N.Z)(a)}`]},i=(0,b.Z)(o,getCheckboxUtilityClass,t);return{...t,...i}})(x);return(0,f.jsx)(Q,{type:"checkbox",inputProps:{"data-indeterminate":s,...c},icon:r.cloneElement(v,{fontSize:v.props.fontSize??u}),checkedIcon:r.cloneElement(g,{fontSize:g.props.fontSize??u}),ownerState:x,ref:t,className:(0,Z.Z)(w.root,h),disableRipple:d,...p,classes:w})}));var X=(0,j.jl)("Framework","Register");const ee=(0,u.Pi)((function Register(){var e,t,n,s,u,x,w=(0,a.KH)(),j=w.authorizationStore,m=w.configurationStore,y=(0,g.$G)().t,k=(0,r.useState)(null!==(e=null===(t=j.state)||void 0===t?void 0:t.email)&&void 0!==e?e:""),C=(0,i.Z)(k,2),M=C[0],Z=C[1],b=(0,r.useState)(""),L=(0,i.Z)(b,2),N=L[0],I=L[1],z=(0,r.useState)(""),E=(0,i.Z)(z,2),P=E[0],D=E[1],O=(0,r.useState)(""),F=(0,i.Z)(O,2),R=F[0],_=F[1],A=(0,r.useState)(""),T=(0,i.Z)(A,2),U=T[0],$=T[1],B=(0,r.useState)(""),G=(0,i.Z)(B,2),H=G[0],K=G[1],V=(0,r.useState)(""),Q=(0,i.Z)(V,2),W=Q[0],Y=Q[1],q=(0,r.useState)(!1),ee=(0,i.Z)(q,2),te=ee[0],ne=ee[1],re=function(){var e=(0,o.Z)(l().mark((function _callee(){var e;return l().wrap((function _callee$(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,(0,h.fl)(j.register(M,N,U,R,null===(e=j.state)||void 0===e?void 0:e.invitationId,ae?W:void 0));case 3:Z(""),I(""),D(""),$(""),_(""),t.next=14;break;case 10:t.prev=10,t.t0=t.catch(0),K("auth.error.invitationotp"),X.error(new d.GE("Error while registering",{cause:t.t0}));case 14:case"end":return t.stop()}}),_callee,null,[[0,10]])})));return function onRegister(){return e.apply(this,arguments)}}(),ae=null===(n=j.state)||void 0===n?void 0:n.useOtp,oe=function validPassword(){return ae?null!=W&&""!==W&&N==P&&""!=N&&null!=N&&te:N==P&&""!=N&&null!=N&&te},ie=null===(s=j.state)||void 0===s?void 0:s.loginMethods;return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)("h1",{children:y("auth.title.register")}),(0,f.jsx)("p",{children:y("auth.text.register","")}),!!H&&(0,f.jsxs)("div",{className:c.vU,children:[(0,f.jsx)("span",{}),(0,f.jsx)("div",{children:y(H)})]}),(0,f.jsx)(OpenId,{}),((null==ie?void 0:ie.generic)||(null==ie?void 0:ie.google)||(null==ie?void 0:ie.microsoft))&&ie.standard&&(0,f.jsx)("div",{className:c.kr,children:"or"}),(null==ie?void 0:ie.standard)&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)("form",{children:[ae&&(0,f.jsx)(p.Z,{type:"text",value:W,placeholder:y("auth.input.otp"),onChange:function onChange(e){return Y(e.target.value)}}),(0,f.jsx)(p.Z,{value:U,autoFocus:!0,placeholder:y("backoffice.form.userdetails.items.name"),onChange:function onChange(e){return $(e.target.value)}}),(0,f.jsx)(p.Z,{value:R,autoFocus:!0,placeholder:y("backoffice.form.userdetails.items.familyName"),onChange:function onChange(e){return _(e.target.value)}}),(0,f.jsx)(p.Z,{value:M,autoComplete:"email",autoFocus:!0,placeholder:y("auth.input.email"),disabled:!0}),(0,f.jsx)(p.Z,{value:N,type:"password",autoFocus:!0,placeholder:y("auth.input.password"),onChange:function onChange(e){return I(e.target.value)}}),(0,f.jsx)(p.Z,{value:P,type:"password",autoFocus:!0,placeholder:y("auth.input.repeatpassword"),onChange:function onChange(e){return D(e.target.value)}}),(0,f.jsxs)("div",{style:{display:"flex",gap:5,alignItems:"center"},children:[(0,f.jsx)(J,{name:"checkAGB",checked:te,onClick:function onClick(){return ne(!te)}}),(0,f.jsxs)("div",{style:{display:"flex",flexDirection:"column",fontSize:9},children:[(0,f.jsx)("span",{children:y("auth.acceptprivacyandagb")}),(0,f.jsxs)("span",{children:[(0,f.jsx)("a",{target:"_blank",href:null!==(u=m.navigation.tosUrl)&&void 0!==u?u:"https://www.diva-portal.de/agb",children:y("auth.GeneralTerms")}),", ",(0,f.jsx)("a",{target:"_blank",href:null!==(x=m.navigation.privacyUrl)&&void 0!==x?x:"https://www.diva-portal.de/datenschutz",children:y("auth.privacypolicy")})]})]})]}),(0,f.jsx)(S.Z,{style:{color:"#FF8C00",marginTop:10,fontSize:14},hidden:oe(),children:y("auth.input.passwordsnotmatch")})]}),(0,f.jsx)(v.Z,{disabled:!oe(),onClick:oe()?re:void 0,children:y("auth.input.login")})]})]})}));var te=(0,u.Pi)((function(){var e,t=(0,a.KH)().authorizationStore;switch(null===(e=t.state)||void 0===e?void 0:e.type){case"LOGIN":return(0,f.jsx)(y,{});case"REQUEST_NEW_PASSWORD":return(0,f.jsx)(RequestNewPassword,{initEmail:t.state.email});case"CHANGE_PASSWORD":return(0,f.jsx)(ChangePassword,{token:t.state.token});case"WELCOME":return(0,f.jsx)(WelcomeScreen,{isNewUser:t.state.isNewUser,invitationId:t.state.invitationId,invitationOrgId:t.state.invitationOrgId});case"REGISTER":return(0,f.jsx)(ee,{});case"INVITATION_EXPIRED":return(0,f.jsx)("h1",{children:"Abgelaufen"});default:return(0,f.jsx)(f.Fragment,{})}}));const ne=(0,u.Pi)((function Auth(){var e,t,n,o=(0,a.KH)(),i=o.authorizationStore,s=o.configurationStore,l=o.dataStore,u=(o.authorizationHandler,(0,r.useMemo)((function(){var e,t,n,r="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciICB2aWV3Qm94PSIwIDAgMTAwMCAyOTMuNjUiPjxwYXRoIGQ9Ik0yNTAuODksMTQ3LjNjLTMuMTgtNzQtMzAuNC0xNDMuMTgtMTQxLjczLTE0My4xOEwwLDQuMjZBMzA3Ljg2LDMwNy44NiwwLDAsMSwyNi4xMiw2MC43aDc0LjJjNTIuODYsMCw3NiwyNS42OCw3OC42MSw4NS4yOSwyLjY2LDYxLjgxLTE4LjI5LDg3LjkyLTcxLjE1LDg3LjkySDc5LjJsLTQ2LjcxLjUyYTI4Ny4yOSwyODcuMjksMCwwLDEtMjAsNTMuODhoMTA5YzExMS4zMiwwLDEzMi42Ny02NywxMjkuNDgtMTQxTTMwNi44NCwyODloNzEuMjNWMGEzMDAuMDcsMzAwLjA3LDAsMCwxLTcxLjIzLDI1LjkyWm0zMTguOC42Mkw3MjYuNTkuODVhMzAwLDMwMCwwLDAsMS04My42NSwzMi4yNEw1NzcuMTEsMjI0LDUxMS4yOSwzMy4wOUEzMDAsMzAwLDAsMCwxLDQyNy42NC44NWwxMDEsMjg4Ljc2Wm0zNzQuMzYsNEw4OTkuMDUsNC45MUg4MDJMNzc1LjE0LDgxLjc0LDcwMS4wNSwyOTMuNjVBMzAwLjMyLDMwMC4zMiwwLDAsMSw3ODUsMjYxLjM1bDYuNzktMjEsMTkuMTQtNTcuNTRMODUwLjUyLDYybDQwLjA3LDEyMC44NSwxOC43LDU3LjU0LDcsMjFBMzAwLjIsMzAwLjIsMCwwLDEsMTAwMCwyOTMuNjUiIGZpbGw9IiNiM2IzYjMiLz48L3N2Zz4=";if(null!==(e=l.organization)&&void 0!==e&&e.logoUrl)r=null===(n=l.organization)||void 0===n?void 0:n.logoUrl;else if(null!==(t=s.navigation)&&void 0!==t&&t.logoUrl){var a;r=null===(a=s.navigation)||void 0===a?void 0:a.logoUrl}return r}),[null===(e=s.navigation)||void 0===e?void 0:e.logoUrl,null===(t=l.organization)||void 0===t?void 0:t.logoUrl]));return null==i.state?(0,f.jsx)(f.Fragment,{}):(0,f.jsxs)("div",{className:c.I8,children:[(0,f.jsxs)("div",{className:c.NB,children:[(0,f.jsx)("div",{className:c.tn,style:{height:null!==(n=s.configuration.loginLogoHeight)&&void 0!==n?n:50,backgroundImage:"url(".concat(u,")")}}),(0,f.jsx)(te,{})]}),s.authentication.contentBox&&(0,f.jsx)("div",{style:{width:"calc(100% - 400px)",height:"100%",position:"relative",overflow:"hidden"},children:(0,f.jsx)(M.p,{settings:{contentBoxProps:(0,h.ZN)(s.authentication.contentBox.props)}})})]})}))}}]);