@crystaldesign/products-component 25.4.0-beta.44 → 25.4.0-beta.45

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.
@@ -0,0 +1,2 @@
1
+ /*! For license information please see 210.products-component.umd.min.js.LICENSE.txt */
2
+ "use strict";(self.webpackChunkCrystaldesignProductsComponent=self.webpackChunkCrystaldesignProductsComponent||[]).push([[210],{4210:(e,t,n)=>{n.r(t),n.d(t,{default:()=>b});var r=n(7363),o=n(7095),a=n(4658),i=n(4988),s=n(747),l=n.n(s),u=n(523),c=n(9420),d=n(3693),h=n(8623),v=n(5617),g=n(7995),p=n(789),w=n(5515),x=n.n(w),f=n(7514);function OpenId(){var e,t,n,r=(0,o.KH)(),a=r.configurationStore,i=r.authorizationStore,s=(0,p.$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)(g.Z,{className:x()(u.FI,u.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)(g.Z,{className:x()(u.FI,u.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)(g.Z,{className:u.FI,style:{backgroundColor:null!==(t=l.generic.backgroundColor)&&void 0!==t?t:a.theme.palette.secondary.main,color:null!==(n=l.generic.color)&&void 0!==n?n:a.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=n(3830),y=n(6033),M=n(2999);function Header(e){var t=e.title,n=e.text,r=e.errorText,o=(0,M.$G)().t;return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)("div",{style:{textAlign:"center"},children:(0,f.jsx)("h2",{children:t})}),(0,f.jsx)("p",{children:n}),r&&(0,f.jsx)(y.Z,{severity:"error",className:u.vU,children:o(r)})]})}var k=(0,j.jl)("Framework","Login");const C=(0,c.Pi)((function Login(){var e,t,n,s,c=(0,o.KH)(),w=c.authorizationStore,x=c.authorizationHandler,j=(0,r.useState)("enter"),y=(0,i.Z)(j,2),M=y[0],C=y[1],L=(0,r.useState)(!1),N=(0,i.Z)(L,2),S=N[0],Z=N[1],I=(0,r.useState)(null!==(e=null===(t=w.state)||void 0===t?void 0:t.email)&&void 0!==e?e:""),E=(0,i.Z)(I,2),z=E[0],D=E[1],b=(0,r.useState)(""),P=(0,i.Z)(b,2),T=P[0],A=P[1],O=(0,r.useState)(""),_=(0,i.Z)(O,2),F=_[0],R=_[1],U=(0,r.useState)(!1),G=(0,i.Z)(U,2),H=G[0],K=G[1],$=(0,r.useState)(w.state.invitationId),Q=(0,i.Z)($,2),V=Q[0],W=Q[1],Y=(0,r.useState)("LOGIN"==(null===(n=w.state)||void 0===n?void 0:n.type)?w.state.error:void 0),B=(0,i.Z)(Y,2),q=B[0],J=B[1],X=(0,p.$G)().t,ee=function(){var e=(0,a.Z)(l().mark((function _callee(){var e,t;return l().wrap((function _callee$(n){for(;;)switch(n.prev=n.next){case 0:if(Z(!0),q&&J(void 0),n.prev=2,V){n.next=8;break}return n.next=6,x.getInvitationValue("id",z);case 6:(e=n.sent)&&(e.isNewUser&&(w.close(),w.showRegister(void 0,z,!!e.useotp)),W(!0),e.useotp&&K(!0));case 8:return n.next=10,x.fetchLoginProvider({email:z});case 10:"standard"==(t=n.sent).provider?C("login"):w.openOAuthLogin(t.provider,w.state.organizationId,w.state.invitationId),n.next=18;break;case 14:n.prev=14,n.t0=n.catch(2),k.error(new d.GE("Error while fetching login provider",{cause:n.t0})),J("auth.error.password");case 18:return n.prev=18,Z(!1),n.finish(18);case 21:case"end":return n.stop()}}),_callee,null,[[2,14,18,21]])})));return function onContinue(){return e.apply(this,arguments)}}(),te=function(){var e=(0,a.Z)(l().mark((function _callee2(){return l().wrap((function _callee2$(e){for(;;)switch(e.prev=e.next){case 0:return Z(!0),q&&J(void 0),e.prev=2,e.next=5,(0,h.fl)(w.login(z,T,!1,w.state.organizationId,w.state.invitationId,F));case 5:D(""),A(""),J(void 0),e.next=14;break;case 10:e.prev=10,e.t0=e.catch(2),k.error(new d.GE("Error while logging in",{cause:e.t0})),J(V?"auth.error.passwordotp":"auth.error.password");case 14:return e.prev=14,Z(!1),e.finish(14);case 17:case"end":return e.stop()}}),_callee2,null,[[2,10,14,17]])})));return function onLogin(){return e.apply(this,arguments)}}(),ne=function(){var e=(0,a.Z)(l().mark((function _callee3(){return l().wrap((function _callee3$(e){for(;;)switch(e.prev=e.next){case 0:w.showRequestNewPassword(z);case 1:case"end":return e.stop()}}),_callee3)})));return function resetPassword(){return e.apply(this,arguments)}}(),re="enter"==M&&0==z.length||"enter"!=M&&0==T.length;H&&!re&&(re=0==F.length);var oe=null===(s=w.state)||void 0===s?void 0:s.loginMethods;return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(Header,{title:X("auth.title.login"),text:X("auth.text.login",""),errorText:null!=q?q:""}),(0,f.jsx)(OpenId,{}),((null==oe?void 0:oe.generic)||(null==oe?void 0:oe.google)||(null==oe?void 0:oe.microsoft))&&oe.standard&&(0,f.jsx)("div",{className:u.kr,children:"or"}),(null==oe?void 0:oe.standard)&&(0,f.jsxs)(f.Fragment,{children:["enter"==M&&(0,f.jsxs)("form",{children:[(0,f.jsx)(v.Z,{id:"username",value:z,autoComplete:"username",autoFocus:!0,type:"email",placeholder:X("auth.input.email"),onChange:function onChange(e){return D(e.target.value)},onKeyPress:function onKeyPress(e){return"Enter"==e.key&&ee()}}),(0,f.jsx)(v.Z,{value:T,id:"password",type:"password",autoComplete:"current-password",hidden:!0,autoFocus:!0,placeholder:X("auth.input.password"),onChange:function onChange(e){return A(e.target.value)},onKeyPress:function onKeyPress(e){return"Enter"==e.key&&te()}})]}),"login"==M&&(0,f.jsxs)("form",{children:[H&&(0,f.jsx)(v.Z,{value:F,type:"text",autoFocus:!0,placeholder:X("auth.input.otp"),onChange:function onChange(e){return R(e.target.value)}}),(0,f.jsx)(v.Z,{value:z,type:"email",readOnly:!0,placeholder:X("auth.input.email"),resetInput:function reset(){C("enter"),D(""),A(""),J(void 0)}}),(0,f.jsx)(v.Z,{value:T,type:"password",id:"password",autoFocus:!0,placeholder:X("auth.input.password"),onChange:function onChange(e){return A(e.target.value)},onKeyPress:function onKeyPress(e){return"Enter"==e.key&&te()}})]}),(0,f.jsxs)(g.Z,{id:"submit",disabled:re||S,onClick:"enter"==M?ee:te,children:[S?(0,f.jsx)(m.Z,{size:24,color:"inherit"}):void 0,S?void 0:X("enter"==M?"auth.button.continue":"auth.button.login")]}),"login"==M&&(0,f.jsx)("div",{style:{textAlign:"center"},children:(0,f.jsx)("div",{className:u.p4,onClick:ne,children:X("auth.button.forgotpassword")})})," "]})]})}));var L=(0,j.jl)("Framework","RequestNewPassword");function RequestNewPassword(e){var t=e.initEmail,n=(0,o.KH)(),s=n.authorizationStore,c=n.apiHandler,h=n.loadingAndErrorStore,w=(0,r.useState)(t),x=(0,i.Z)(w,2),j=x[0],m=x[1],y=(0,r.useState)(!1),M=(0,i.Z)(y,2),k=M[0],C=M[1],N=(0,r.useState)(),S=(0,i.Z)(N,2),Z=S[0],I=S[1],E=(0,r.useState)(),z=(0,i.Z)(E,2),D=z[0],b=z[1],P=(0,p.$G)().t,T=function(){var e=(0,a.Z)(l().mark((function _callee(){return l().wrap((function _callee$(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,b(!0),h.toggleLoading("SendPassword"),e.next=5,c.sendPasswordRecoveryMail({email:j});case 5:b(!1),h.toggleLoading("SendPassword"),C(!0),I(void 0),e.next=17;break;case 11:e.prev=11,e.t0=e.catch(0),L.error(new d.GE("Error while sending password recovery mail",{cause:e.t0})),I("auth.error.resetpassword"),b(!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)(Header,{title:P("auth.title.resetpassword"),text:P("auth.info.resetdescription",""),errorText:null!=Z?Z:""}),k&&(0,f.jsxs)("div",{className:u.Vp,children:[(0,f.jsx)("span",{}),(0,f.jsx)("div",{children:P("auth.info.resetpassword")})]}),!k&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(v.Z,{value:j,autoFocus:!0,placeholder:P("auth.input.email"),onChange:function onChange(e){return m(e.target.value)},onKeyPress:function onKeyPress(e){return"Enter"==e.key&&T()}}),(0,f.jsx)(g.Z,{disabled:0==j.length,onClick:T,children:P("auth.button.resetpassword")})]}),k&&(0,f.jsx)(g.Z,{disabled:D,onClick:function toLogin(){s.close(),s.showLogin()},children:P("auth.button.login")})]})}function Errormessage(e){var t=e.hasError,n=e.authErrorsg,r=(0,p.$G)().t;return(0,f.jsxs)("div",{className:u.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 N=(0,j.jl)("Framework","cfhange-password");function ChangePassword(e){var t,n=e.token,s=(0,o.KH)(),c=s.configurationStore,h=s.authorizationStore,w=s.apiHandler,x=(s.loadingAndErrorStore,(0,r.useState)("")),j=(0,i.Z)(x,2),m=j[0],y=j[1],M=(0,r.useState)(""),k=(0,i.Z)(M,2),C=k[0],L=k[1],S=(0,r.useState)(!1),Z=(0,i.Z)(S,2),I=Z[0],E=Z[1],z=(0,r.useState)(),D=(0,i.Z)(z,2),b=D[0],P=D[1],T=(0,r.useState)(""),A=(0,i.Z)(T,2),O=A[0],_=A[1],F=(0,r.useRef)(null),R=(0,p.$G)().t;(0,r.useEffect)((function(){m===C&&P(void 0)}),[m,C]);var U=function(){var e=(0,a.Z)(l().mark((function _callee(){return l().wrap((function _callee$(e){for(;;)switch(e.prev=e.next){case 0:if(_(R("auth.error.verifypasswordserver")),!(m.length<8||m!==C)){e.next=4;break}return P("INVALID"),e.abrupt("return");case 4:return e.prev=4,e.next=7,w.resetPassword({password:m,token:n});case 7:E(!0),e.next=13;break;case 10:e.prev=10,e.t0=e.catch(4),G(e.t0);case 13:case"end":return e.stop()}}),_callee,null,[[4,10]])})));return function resetPassword(){return e.apply(this,arguments)}}(),G=function handleError(e){if(e instanceof d.GE){if("AUTH_0003"===e.name)_(R("auth.error.verifypasswordtokenerror",{errormsg:R("auth.error.tokenexpired")}));else _(R("auth.error.verifypasswordserver",e.message));N.error(e)}N.error(new d.GE("Error while resetting password",{cause:e})),P("SERVER")};return"SERVER"===b?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(Errormessage,{hasError:b,authErrorsg:O}),(0,f.jsx)(g.Z,{onClick:function onClickRequestNewPassword(){h.showRequestNewPassword("")},children:R("auth.button.resetpassword")})]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)("h1",{children:R("auth.title.verifypassword")}),I&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)("div",{className:u.Vp,children:[(0,f.jsx)("span",{}),(0,f.jsx)("div",{children:R("auth.info.verifypassword")})]}),(null===(t=c.authentication.resetPassword)||void 0===t?void 0:t.returnToLogin)&&(0,f.jsx)(g.Z,{onClick:function goToLogin(){h.close(),h.showLogin()},children:R("auth.button.login")})]}),!I&&(0,f.jsxs)(f.Fragment,{children:[b&&(0,f.jsx)(Errormessage,{hasError:b,authErrorsg:O}),(0,f.jsxs)("form",{children:[(0,f.jsx)(v.Z,{value:m,autoFocus:!0,placeholder:R("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=F.current)||void 0===t?void 0:t.focus())}}),(0,f.jsx)(v.Z,{ref:F,value:C,placeholder:R("auth.input.verifypassword"),type:"password",autoComplete:"new-password",onChange:function onChange(e){return L(e.target.value)},onKeyPress:function onKeyPress(e){return"Enter"==e.key&&U()}})]}),(0,f.jsx)(g.Z,{disabled:!m||!C,onClick:U,children:R("auth.button.save")})]})]})}var S=n(4614);function WelcomeScreen(e){var t=e.isNewUser,n=e.invitationId,s=e.invitationOrgId,u=(0,o.KH)(),c=u.authorizationStore,d=u.authorizationHandler,h=(0,r.useState)(""),v=(0,i.Z)(h,2),w=v[0],x=v[1],j=(0,p.$G)().t,m=function(){var e=(0,a.Z)(l().mark((function _callee(){var e;return l().wrap((function _callee$(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,checkInvitation();case 2:(e=t.sent)&&(c.close(),c.showLogin(void 0,void 0,s,n,e));case 4:case"end":return t.stop()}}),_callee)})));return function toLogin(){return e.apply(this,arguments)}}(),y=function(){var e=(0,a.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)&&(c.close(),c.showRegister(n,e));case 4:case"end":return t.stop()}}),_callee2)})));return function toRegister(){return e.apply(this,arguments)}}();function checkInvitation(){return _checkInvitation.apply(this,arguments)}function _checkInvitation(){return _checkInvitation=(0,a.Z)(l().mark((function _callee3(){var e,t,n;return l().wrap((function _callee3$(r){for(;;)switch(r.prev=r.next){case 0:return t=null===(e=c.state)||void 0===e?void 0:e.invitationId,r.next=3,d.getInvitationValue("email",t);case 3:if(!(n=r.sent)){r.next=8;break}return r.abrupt("return",n.email);case 8:return x("Invitation not found"),r.abrupt("return",void 0);case 10:case"end":return r.stop()}}),_callee3)}))),_checkInvitation.apply(this,arguments)}return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(Header,{title:j("auth.title.welcome"),text:j("auth.info.welcomedescription",""),errorText:null!=w?w:""}),t&&!w&&(0,f.jsx)(g.Z,{onClick:y,children:j("auth.title.register")}),!t&&!w&&(0,f.jsx)(g.Z,{onClick:m,children:j("auth.button.login")})]})}var Z=n(1705),I=(0,j.jl)("Framework","Register");const E=(0,c.Pi)((function Register(){var e,t,n,s,c,w,x=(0,o.KH)(),j=x.authorizationStore,M=x.configurationStore,k=(0,p.$G)().t,C=(0,r.useState)(null!==(e=null===(t=j.state)||void 0===t?void 0:t.email)&&void 0!==e?e:""),L=(0,i.Z)(C,2),N=L[0],S=L[1],E=(0,r.useState)(""),z=(0,i.Z)(E,2),D=z[0],b=z[1],P=(0,r.useState)(""),T=(0,i.Z)(P,2),A=T[0],O=T[1],_=(0,r.useState)(""),F=(0,i.Z)(_,2),R=F[0],U=F[1],G=(0,r.useState)(""),H=(0,i.Z)(G,2),K=H[0],$=H[1],Q=(0,r.useState)(""),V=(0,i.Z)(Q,2),W=V[0],Y=V[1],B=(0,r.useState)(""),q=(0,i.Z)(B,2),J=q[0],X=q[1],ee=(0,r.useState)(!1),te=(0,i.Z)(ee,2),ne=te[0],re=te[1],oe=(0,r.useState)(!1),ae=(0,i.Z)(oe,2),ie=ae[0],se=ae[1],le=function(){var e=(0,a.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,re(!0),t.next=4,(0,h.fl)(j.register(N,D,K,R,null===(e=j.state)||void 0===e?void 0:e.invitationId,ue?J:void 0));case 4:S(""),b(""),O(""),$(""),U(""),t.next=15;break;case 11:t.prev=11,t.t0=t.catch(0),Y("auth.error.invitationotp"),I.error(new d.GE("Error while registering",{cause:t.t0}));case 15:return t.prev=15,re(!1),t.finish(15);case 18:case"end":return t.stop()}}),_callee,null,[[0,11,15,18]])})));return function onRegister(){return e.apply(this,arguments)}}(),ue=null===(n=j.state)||void 0===n?void 0:n.useOtp,ce=function validPassword(){return ue?null!=J&&""!==J&&D==A&&""!=D&&null!=D&&ie:D==A&&""!=D&&null!=D&&ie},de=null===(s=j.state)||void 0===s?void 0:s.loginMethods;return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(Header,{title:k("auth.title.register"),text:k("auth.text.register",""),errorText:null!=W?W:""}),(0,f.jsx)(OpenId,{}),((null==de?void 0:de.generic)||(null==de?void 0:de.google)||(null==de?void 0:de.microsoft))&&de.standard&&(0,f.jsx)("div",{className:u.kr,children:"or"}),(null==de?void 0:de.standard)&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)("form",{children:[ue&&(0,f.jsx)(v.Z,{type:"text",value:J,placeholder:k("auth.input.otp"),onChange:function onChange(e){return X(e.target.value)}}),(0,f.jsx)(v.Z,{value:K,autoFocus:!0,placeholder:k("backoffice.form.userdetails.items.name"),onChange:function onChange(e){return $(e.target.value)}}),(0,f.jsx)(v.Z,{value:R,autoFocus:!0,placeholder:k("backoffice.form.userdetails.items.familyName"),onChange:function onChange(e){return U(e.target.value)}}),(0,f.jsx)(v.Z,{value:N,autoComplete:"email",autoFocus:!0,placeholder:k("auth.input.email"),disabled:!0}),(0,f.jsx)(v.Z,{value:D,type:"password",autoFocus:!0,placeholder:k("auth.input.newpassword"),onChange:function onChange(e){return b(e.target.value)}}),(0,f.jsx)(v.Z,{value:A,type:"password",autoFocus:!0,placeholder:k("auth.input.repeatpassword"),onChange:function onChange(e){return O(e.target.value)}}),(0,f.jsxs)("div",{style:{display:"flex",gap:5,alignItems:"center"},children:[(0,f.jsx)(Z.Z,{name:"checkAGB",checked:ie,onClick:function onClick(){return se(!ie)}}),(0,f.jsxs)("div",{style:{display:"flex",flexDirection:"column",fontSize:9},children:[(0,f.jsx)("span",{children:k("auth.acceptprivacyandagb")}),(0,f.jsxs)("span",{children:[(0,f.jsx)("a",{target:"_blank",href:null!==(c=M.navigation.tosUrl)&&void 0!==c?c:"https://www.diva-portal.de/agb",children:k("auth.GeneralTerms")}),", ",(0,f.jsx)("a",{target:"_blank",href:null!==(w=M.navigation.privacyUrl)&&void 0!==w?w:"https://www.diva-portal.de/datenschutz",children:k("auth.privacypolicy")})]})]})]}),(0,f.jsx)(y.Z,{severity:"warning",sx:{display:ce()?"none":"flex"},children:k("auth.input.passwordsnotmatch")})]}),(0,f.jsxs)(g.Z,{disabled:!ce()||ne,onClick:ce()?le:void 0,children:[ne?(0,f.jsx)(m.Z,{size:24,color:"inherit"}):void 0,ne?void 0:k("auth.input.login")]})]})]})}));var z=n(4376);var D=(0,c.Pi)((function(){var e,t=(0,o.KH)().authorizationStore;switch(null===(e=t.state)||void 0===e?void 0:e.type){case"LOGIN":return(0,f.jsx)(C,{});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)(E,{});case"INVITATION_EXPIRED":return(0,f.jsx)("h1",{children:"Abgelaufen"});default:return(0,f.jsx)(f.Fragment,{})}}));const b=(0,c.Pi)((function Auth(){var e,t,n,a,i=(0,o.KH)(),s=i.authorizationStore,l=i.configurationStore,c=i.dataStore,d=i.contentStore,v=(0,r.useMemo)((function(){var e,t,n,r="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciICB2aWV3Qm94PSIwIDAgMTAwMCAyOTMuNjUiPjxwYXRoIGQ9Ik0yNTAuODksMTQ3LjNjLTMuMTgtNzQtMzAuNC0xNDMuMTgtMTQxLjczLTE0My4xOEwwLDQuMjZBMzA3Ljg2LDMwNy44NiwwLDAsMSwyNi4xMiw2MC43aDc0LjJjNTIuODYsMCw3NiwyNS42OCw3OC42MSw4NS4yOSwyLjY2LDYxLjgxLTE4LjI5LDg3LjkyLTcxLjE1LDg3LjkySDc5LjJsLTQ2LjcxLjUyYTI4Ny4yOSwyODcuMjksMCwwLDEtMjAsNTMuODhoMTA5YzExMS4zMiwwLDEzMi42Ny02NywxMjkuNDgtMTQxTTMwNi44NCwyODloNzEuMjNWMGEzMDAuMDcsMzAwLjA3LDAsMCwxLTcxLjIzLDI1LjkyWm0zMTguOC42Mkw3MjYuNTkuODVhMzAwLDMwMCwwLDAsMS04My42NSwzMi4yNEw1NzcuMTEsMjI0LDUxMS4yOSwzMy4wOUEzMDAsMzAwLDAsMCwxLDQyNy42NC44NWwxMDEsMjg4Ljc2Wm0zNzQuMzYsNEw4OTkuMDUsNC45MUg4MDJMNzc1LjE0LDgxLjc0LDcwMS4wNSwyOTMuNjVBMzAwLjMyLDMwMC4zMiwwLDAsMSw3ODUsMjYxLjM1bDYuNzktMjEsMTkuMTQtNTcuNTRMODUwLjUyLDYybDQwLjA3LDEyMC44NSwxOC43LDU3LjU0LDcsMjFBMzAwLjIsMzAwLjIsMCwwLDEsMTAwMCwyOTMuNjUiIGZpbGw9IiNiM2IzYjMiLz48L3N2Zz4=";if(null!==(e=c.organization)&&void 0!==e&&e.logoUrl)r=null===(n=c.organization)||void 0===n?void 0:n.logoUrl;else if(null!==(t=l.navigation)&&void 0!==t&&t.logoUrl){var o;r=null===(o=l.navigation)||void 0===o?void 0:o.logoUrl}return r}),[null===(e=l.navigation)||void 0===e?void 0:e.logoUrl,null===(t=c.organization)||void 0===t?void 0:t.logoUrl]);return null==s.state?(0,f.jsx)(f.Fragment,{}):(0,f.jsxs)("div",{className:u.I8,children:[(null==l||null===(n=l.navigation)||void 0===n?void 0:n.showSnow)&&(0,f.jsx)(z.Z,{color:"#a7b6eb",speed:[0,2.5],wind:[-1,.5],snowflakeCount:300,radius:[.5,2],style:{zIndex:1e3}}),(0,f.jsxs)("div",{className:u.NB,children:[(!d.containerDimensions.isMobile||d.containerDimensions.isPortrait)&&(0,f.jsx)("div",{className:u.tn,style:{height:null!==(a=l.configuration.loginLogoHeight)&&void 0!==a?a:50,backgroundImage:"url(".concat(v,")")}}),(0,f.jsx)(D,{})]}),l.authentication.contentBox&&!d.containerDimensions.isMobile&&(0,f.jsx)("div",{style:{width:"calc(100% - 400px)",height:"100%",position:"relative",overflow:"hidden"},children:(0,f.jsx)(S.p,{settings:{contentBoxProps:(0,h.ZN)(l.authentication.contentBox.props)}})})]})}))}}]);
@@ -0,0 +1 @@
1
+ /*! filename:210 */
@@ -0,0 +1,2 @@
1
+ /*! For license information please see 43.products-component.umd.min.js.LICENSE.txt */
2
+ (self.webpackChunkCrystaldesignProductsComponent=self.webpackChunkCrystaldesignProductsComponent||[]).push([[43],{6033:(e,t,r)=>{"use strict";r.d(t,{Z:()=>F});var o=r(7363),n=r(7726),a=r(4062),s=r(9074),i=r(7843),l=r(518),c=r(2893),d=r(7204),p=r(1522),u=r(8981),f=r(9173),h=r(3966),m=r(431);function getAlertUtilityClass(e){return(0,m.ZP)("MuiAlert",e)}const g=(0,h.Z)("MuiAlert",["root","action","icon","message","filled","colorSuccess","colorInfo","colorWarning","colorError","filledSuccess","filledInfo","filledWarning","filledError","outlined","outlinedSuccess","outlinedInfo","outlinedWarning","outlinedError","standard","standardSuccess","standardInfo","standardWarning","standardError"]);var v=r(3697),y=r(6177),w=r(7514);const x=(0,y.Z)((0,w.jsx)("path",{d:"M20,12A8,8 0 0,1 12,20A8,8 0 0,1 4,12A8,8 0 0,1 12,4C12.76,4 13.5,4.11 14.2, 4.31L15.77,2.74C14.61,2.26 13.34,2 12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0, 0 22,12M7.91,10.08L6.5,11.5L11,16L21,6L19.59,4.58L11,13.17L7.91,10.08Z"}),"SuccessOutlined"),C=(0,y.Z)((0,w.jsx)("path",{d:"M12 5.99L19.53 19H4.47L12 5.99M12 2L1 21h22L12 2zm1 14h-2v2h2v-2zm0-6h-2v4h2v-4z"}),"ReportProblemOutlined"),S=(0,y.Z)((0,w.jsx)("path",{d:"M11 15h2v2h-2zm0-8h2v6h-2zm.99-5C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"}),"ErrorOutline"),k=(0,y.Z)((0,w.jsx)("path",{d:"M11,9H13V7H11M12,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4C16.41,4 20,7.59 20, 12C20,16.41 16.41,20 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10, 10 0 0,0 12,2M11,17H13V11H11V17Z"}),"InfoOutlined"),b=(0,y.Z)((0,w.jsx)("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"}),"Close"),Z=(0,i.ZP)(f.Z,{name:"MuiAlert",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:r}=e;return[t.root,t[r.variant],t[`${r.variant}${(0,p.Z)(r.color||r.severity)}`]]}})((0,l.Z)((({theme:e})=>{const t="light"===e.palette.mode?s._j:s.$n,r="light"===e.palette.mode?s.$n:s._j;return{...e.typography.body2,backgroundColor:"transparent",display:"flex",padding:"6px 16px",variants:[...Object.entries(e.palette).filter((0,u.Z)(["light"])).map((([o])=>({props:{colorSeverity:o,variant:"standard"},style:{color:e.vars?e.vars.palette.Alert[`${o}Color`]:t(e.palette[o].light,.6),backgroundColor:e.vars?e.vars.palette.Alert[`${o}StandardBg`]:r(e.palette[o].light,.9),[`& .${g.icon}`]:e.vars?{color:e.vars.palette.Alert[`${o}IconColor`]}:{color:e.palette[o].main}}}))),...Object.entries(e.palette).filter((0,u.Z)(["light"])).map((([r])=>({props:{colorSeverity:r,variant:"outlined"},style:{color:e.vars?e.vars.palette.Alert[`${r}Color`]:t(e.palette[r].light,.6),border:`1px solid ${(e.vars||e).palette[r].light}`,[`& .${g.icon}`]:e.vars?{color:e.vars.palette.Alert[`${r}IconColor`]}:{color:e.palette[r].main}}}))),...Object.entries(e.palette).filter((0,u.Z)(["dark"])).map((([t])=>({props:{colorSeverity:t,variant:"filled"},style:{fontWeight:e.typography.fontWeightMedium,...e.vars?{color:e.vars.palette.Alert[`${t}FilledColor`],backgroundColor:e.vars.palette.Alert[`${t}FilledBg`]}:{backgroundColor:"dark"===e.palette.mode?e.palette[t].dark:e.palette[t].main,color:e.palette.getContrastText(e.palette[t].main)}}})))]}}))),P=(0,i.ZP)("div",{name:"MuiAlert",slot:"Icon",overridesResolver:(e,t)=>t.icon})({marginRight:12,padding:"7px 0",display:"flex",fontSize:22,opacity:.9}),z=(0,i.ZP)("div",{name:"MuiAlert",slot:"Message",overridesResolver:(e,t)=>t.message})({padding:"8px 0",minWidth:0,overflow:"auto"}),M=(0,i.ZP)("div",{name:"MuiAlert",slot:"Action",overridesResolver:(e,t)=>t.action})({display:"flex",alignItems:"flex-start",padding:"4px 0 0 16px",marginLeft:"auto",marginRight:-8}),A={success:(0,w.jsx)(x,{fontSize:"inherit"}),warning:(0,w.jsx)(C,{fontSize:"inherit"}),error:(0,w.jsx)(S,{fontSize:"inherit"}),info:(0,w.jsx)(k,{fontSize:"inherit"})},F=o.forwardRef((function Alert(e,t){const r=(0,c.i)({props:e,name:"MuiAlert"}),{action:o,children:s,className:i,closeText:l="Close",color:u,components:f={},componentsProps:h={},icon:m,iconMapping:g=A,onClose:y,role:x="alert",severity:C="success",slotProps:S={},slots:k={},variant:F="standard",...j}=r,R={...r,color:u,severity:C,variant:F,colorSeverity:u||C},I=(e=>{const{variant:t,color:r,severity:o,classes:n}=e,s={root:["root",`color${(0,p.Z)(r||o)}`,`${t}${(0,p.Z)(r||o)}`,`${t}`],icon:["icon"],message:["message"],action:["action"]};return(0,a.Z)(s,getAlertUtilityClass,n)})(R),$={slots:{closeButton:f.CloseButton,closeIcon:f.CloseIcon,...k},slotProps:{...h,...S}},[O,E]=(0,d.Z)("root",{ref:t,shouldForwardComponentProp:!0,className:(0,n.Z)(I.root,i),elementType:Z,externalForwardedProps:{...$,...j},ownerState:R,additionalProps:{role:x,elevation:0}}),[B,L]=(0,d.Z)("icon",{className:I.icon,elementType:P,externalForwardedProps:$,ownerState:R}),[T,q]=(0,d.Z)("message",{className:I.message,elementType:z,externalForwardedProps:$,ownerState:R}),[N,W]=(0,d.Z)("action",{className:I.action,elementType:M,externalForwardedProps:$,ownerState:R}),[H,U]=(0,d.Z)("closeButton",{elementType:v.Z,externalForwardedProps:$,ownerState:R}),[V,_]=(0,d.Z)("closeIcon",{elementType:b,externalForwardedProps:$,ownerState:R});return(0,w.jsxs)(O,{...E,children:[!1!==m?(0,w.jsx)(B,{...L,children:m||g[C]||A[C]}):null,(0,w.jsx)(T,{...q,children:s}),null!=o?(0,w.jsx)(N,{...W,children:o}):null,null==o&&y?(0,w.jsx)(N,{...W,children:(0,w.jsx)(H,{size:"small","aria-label":l,title:l,color:"inherit",onClick:y,...U,children:(0,w.jsx)(V,{fontSize:"small",..._})})}):null]})}))},1705:(e,t,r)=>{"use strict";r.d(t,{Z:()=>R});var o=r(7363),n=r(7726),a=r(4062),s=r(9074),i=r(1522),l=r(1684),c=r(7843);const d=function useControlled({controlled:e,default:t,name:r,state:n="value"}){const{current:a}=o.useRef(void 0!==e),[s,i]=o.useState(t);return[a?e:s,o.useCallback((e=>{a||i(e)}),[])]};const p=o.createContext(void 0);var u=r(189),f=r(3966),h=r(431);function getSwitchBaseUtilityClass(e){return(0,h.ZP)("PrivateSwitchBase",e)}(0,f.Z)("PrivateSwitchBase",["root","checked","disabled","input","edgeStart","edgeEnd"]);var m=r(7204),g=r(7514);const v=(0,c.ZP)(u.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}}]}),y=(0,c.ZP)("input",{shouldForwardProp:l.Z})({cursor:"inherit",position:"absolute",opacity:0,width:"100%",height:"100%",top:0,left:0,margin:0,padding:0,zIndex:1}),w=o.forwardRef((function SwitchBase(e,t){const{autoFocus:r,checked:n,checkedIcon:s,defaultChecked:l,disabled:c,disableFocusRipple:u=!1,edge:f=!1,icon:h,id:w,inputProps:x,inputRef:C,name:S,onBlur:k,onChange:b,onFocus:Z,readOnly:P,required:z=!1,tabIndex:M,type:A,value:F,slots:j={},slotProps:R={},...I}=e,[$,O]=d({controlled:n,default:Boolean(l),name:"SwitchBase",state:"checked"}),E=function useFormControl(){return o.useContext(p)}();let B=c;E&&void 0===B&&(B=E.disabled);const L="checkbox"===A||"radio"===A,T={...e,checked:$,disabled:B,disableFocusRipple:u,edge:f},q=(e=>{const{classes:t,checked:r,disabled:o,edge:n}=e,s={root:["root",r&&"checked",o&&"disabled",n&&`edge${(0,i.Z)(n)}`],input:["input"]};return(0,a.Z)(s,getSwitchBaseUtilityClass,t)})(T),N={slots:j,slotProps:{input:x,...R}},[W,H]=(0,m.Z)("root",{ref:t,elementType:v,className:q.root,shouldForwardComponentProp:!0,externalForwardedProps:{...N,component:"span",...I},getSlotProps:e=>({...e,onFocus:t=>{e.onFocus?.(t),(e=>{Z&&Z(e),E&&E.onFocus&&E.onFocus(e)})(t)},onBlur:t=>{e.onBlur?.(t),(e=>{k&&k(e),E&&E.onBlur&&E.onBlur(e)})(t)}}),ownerState:T,additionalProps:{centerRipple:!0,focusRipple:!u,disabled:B,role:void 0,tabIndex:null}}),[U,V]=(0,m.Z)("input",{ref:C,elementType:y,className:q.input,externalForwardedProps:N,getSlotProps:e=>({onChange:t=>{e.onChange?.(t),(e=>{if(e.nativeEvent.defaultPrevented)return;const t=e.target.checked;O(t),b&&b(e,t)})(t)}}),ownerState:T,additionalProps:{autoFocus:r,checked:n,defaultChecked:l,disabled:B,id:L?w:void 0,name:S,readOnly:P,required:z,tabIndex:M,type:A,..."checkbox"===A&&void 0===F?{}:{value:F}}});return(0,g.jsxs)(W,{...H,children:[(0,g.jsx)(U,{...V}),$?s:h]})}));var x=r(6177);const C=(0,x.Z)((0,g.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"),S=(0,x.Z)((0,g.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"),k=(0,x.Z)((0,g.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,h.ZP)("MuiCheckbox",e)}const b=(0,f.Z)("MuiCheckbox",["root","checked","disabled","indeterminate","colorPrimary","colorSecondary","sizeSmall","sizeMedium"]);var Z=r(518),P=r(8981),z=r(2893);function mergeSlotProps(e,t){if(!e)return t;if("function"==typeof e||"function"==typeof t)return r=>{const o="function"==typeof t?t(r):t,a="function"==typeof e?e({...r,...o}):e,s=(0,n.Z)(r?.className,o?.className,a?.className);return{...o,...a,...!!s&&{className:s},...o?.style&&a?.style&&{style:{...o.style,...a.style}},...o?.sx&&a?.sx&&{sx:[...Array.isArray(o.sx)?o.sx:[o.sx],...Array.isArray(a.sx)?a.sx:[a.sx]]}}};const r=t,o=(0,n.Z)(r?.className,e?.className);return{...t,...e,...!!o&&{className:o},...r?.style&&e?.style&&{style:{...r.style,...e.style}},...r?.sx&&e?.sx&&{sx:[...Array.isArray(r.sx)?r.sx:[r.sx],...Array.isArray(e.sx)?e.sx:[e.sx]]}}}const M=(0,c.ZP)(w,{shouldForwardProp:e=>(0,l.Z)(e)||"classes"===e,name:"MuiCheckbox",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:r}=e;return[t.root,r.indeterminate&&t.indeterminate,t[`size${(0,i.Z)(r.size)}`],"default"!==r.color&&t[`color${(0,i.Z)(r.color)}`]]}})((0,Z.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,s.Fq)(e.palette.action.active,e.palette.action.hoverOpacity)}}},...Object.entries(e.palette).filter((0,P.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,s.Fq)(e.palette[t].main,e.palette.action.hoverOpacity)}}}))),...Object.entries(e.palette).filter((0,P.Z)()).map((([t])=>({props:{color:t},style:{[`&.${b.checked}, &.${b.indeterminate}`]:{color:(e.vars||e).palette[t].main},[`&.${b.disabled}`]:{color:(e.vars||e).palette.action.disabled}}}))),{props:{disableRipple:!1},style:{"&:hover":{"@media (hover: none)":{backgroundColor:"transparent"}}}}]})))),A=(0,g.jsx)(S,{}),F=(0,g.jsx)(C,{}),j=(0,g.jsx)(k,{}),R=o.forwardRef((function Checkbox(e,t){const r=(0,z.i)({props:e,name:"MuiCheckbox"}),{checkedIcon:s=A,color:l="primary",icon:c=F,indeterminate:d=!1,indeterminateIcon:p=j,inputProps:u,size:f="medium",disableRipple:h=!1,className:v,slots:y={},slotProps:w={},...x}=r,C=d?p:c,S=d?p:s,k={...r,disableRipple:h,color:l,indeterminate:d,size:f},b=(e=>{const{classes:t,indeterminate:r,color:o,size:n}=e,s={root:["root",r&&"indeterminate",`color${(0,i.Z)(o)}`,`size${(0,i.Z)(n)}`]},l=(0,a.Z)(s,getCheckboxUtilityClass,t);return{...t,...l}})(k),Z=w.input??u,[P,R]=(0,m.Z)("root",{ref:t,elementType:M,className:(0,n.Z)(b.root,v),shouldForwardComponentProp:!0,externalForwardedProps:{slots:y,slotProps:w,...x},ownerState:k,additionalProps:{type:"checkbox",icon:o.cloneElement(C,{fontSize:C.props.fontSize??f}),checkedIcon:o.cloneElement(S,{fontSize:S.props.fontSize??f}),disableRipple:h,slots:y,slotProps:{input:mergeSlotProps("function"==typeof Z?Z(k):Z,{"data-indeterminate":d})}}});return(0,g.jsx)(P,{...R,classes:b})}))},8942:(e,t,r)=>{var o=r(5108),n="undefined"!=typeof Element,a="function"==typeof Map,s="function"==typeof Set,i="function"==typeof ArrayBuffer&&!!ArrayBuffer.isView;function equal(e,t){if(e===t)return!0;if(e&&t&&"object"==typeof e&&"object"==typeof t){if(e.constructor!==t.constructor)return!1;var r,o,l,c;if(Array.isArray(e)){if((r=e.length)!=t.length)return!1;for(o=r;0!=o--;)if(!equal(e[o],t[o]))return!1;return!0}if(a&&e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(c=e.entries();!(o=c.next()).done;)if(!t.has(o.value[0]))return!1;for(c=e.entries();!(o=c.next()).done;)if(!equal(o.value[1],t.get(o.value[0])))return!1;return!0}if(s&&e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(c=e.entries();!(o=c.next()).done;)if(!t.has(o.value[0]))return!1;return!0}if(i&&ArrayBuffer.isView(e)&&ArrayBuffer.isView(t)){if((r=e.length)!=t.length)return!1;for(o=r;0!=o--;)if(e[o]!==t[o])return!1;return!0}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf&&"function"==typeof e.valueOf&&"function"==typeof t.valueOf)return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString&&"function"==typeof e.toString&&"function"==typeof t.toString)return e.toString()===t.toString();if((r=(l=Object.keys(e)).length)!==Object.keys(t).length)return!1;for(o=r;0!=o--;)if(!Object.prototype.hasOwnProperty.call(t,l[o]))return!1;if(n&&e instanceof Element)return!1;for(o=r;0!=o--;)if(("_owner"!==l[o]&&"__v"!==l[o]&&"__o"!==l[o]||!e.$$typeof)&&!equal(e[l[o]],t[l[o]]))return!1;return!0}return e!=e&&t!=t}e.exports=function isEqual(e,t){try{return equal(e,t)}catch(e){if((e.message||"").match(/stack|recursion/i))return o.warn("react-fast-compare cannot handle circular refs"),!1;throw e}}},4376:(e,t,r)=>{"use strict";r.d(t,{Z:()=>lib_Snowfall});var o=r(7363),n=r(8942);function random(e,t){const r=Math.random()*(t-e+1)+e;return Number.isInteger(e)&&Number.isInteger(t)?Math.floor(r):r}function lerp(e,t,r){return(1-r)*e+r*t}function getSize(e){return e?{height:e.offsetHeight,width:e.offsetWidth}:{height:0,width:0}}const a=2*Math.PI,s={color:"#dee4fd",radius:[.5,3],speed:[1,3],wind:[-.5,2],changeFrequency:200,rotationSpeed:[-1,1],opacity:[1,1]};class Snowflake{static createSnowflakes(e,t,r){if(!e)return[];const o=[];for(let n=0;n<t;n++)o.push(new Snowflake(e,r));return o}constructor(e,t={}){this.updateConfig(t);const{radius:r,wind:o,speed:n,rotationSpeed:a,opacity:s}=this.config;this.params={x:random(0,e.offsetWidth),y:random(-e.offsetHeight,0),rotation:random(0,360),radius:random(...r),speed:random(...n),wind:random(...o),rotationSpeed:random(...a),nextSpeed:random(...n),nextWind:random(...o),nextRotationSpeed:random(...a),opacity:random(...s)},this.framesSinceLastUpdate=0}selectImage(){this.config.images&&this.config.images.length>0?this.image=function randomElement(e){return e[Math.floor(Math.random()*e.length)]}(this.config.images):this.image=void 0}updateConfig(e){const t=this.config;this.config={...s,...e},this.config.changeFrequency=random(this.config.changeFrequency,1.5*this.config.changeFrequency),this.params&&!n(this.config.radius,null==t?void 0:t.radius)&&(this.params.radius=random(...this.config.radius)),n(this.config.images,null==t?void 0:t.images)||this.selectImage()}updateTargetParams(){this.params.nextSpeed=random(...this.config.speed),this.params.nextWind=random(...this.config.wind),this.image&&(this.params.nextRotationSpeed=random(...this.config.rotationSpeed))}update(e,t,r=1){const{x:o,y:n,rotation:a,rotationSpeed:s,nextRotationSpeed:i,wind:l,speed:c,nextWind:d,nextSpeed:p,radius:u}=this.params;this.params.x=(o+l*r)%(e+2*u),this.params.x>e+u&&(this.params.x=-u),this.params.y=(n+c*r)%(t+2*u),this.params.y>t+u&&(this.params.y=-u),this.image&&(this.params.rotation=(a+s)%360),this.params.speed=lerp(c,p,.01),this.params.wind=lerp(l,d,.01),this.params.rotationSpeed=lerp(s,i,.01),this.framesSinceLastUpdate++>this.config.changeFrequency&&(this.updateTargetParams(),this.framesSinceLastUpdate=0)}getImageOffscreenCanvas(e,t){var r,o;if(e instanceof HTMLImageElement&&e.loading)return e;let n=Snowflake.offscreenCanvases.get(e);if(n||(n={},Snowflake.offscreenCanvases.set(e,n)),!(t in n)){const o=document.createElement("canvas");o.width=t,o.height=t,null===(r=o.getContext("2d"))||void 0===r||r.drawImage(e,0,0,t,t),n[t]=o}return null!==(o=n[t])&&void 0!==o?o:e}drawCircle(e){e.moveTo(this.params.x,this.params.y),e.arc(this.params.x,this.params.y,this.params.radius,0,a)}drawImage(e){const{x:t,y:r,rotation:o,radius:n}=this.params,a=o*Math.PI/180,s=Math.cos(a),i=Math.sin(a);1!==this.params.opacity&&(e.save(),e.globalAlpha=this.params.opacity),e.setTransform(s,i,-i,s,t,r);const l=this.getImageOffscreenCanvas(this.image,n);e.drawImage(l,-n/2,-n/2,n,n),1!==this.params.opacity&&e.restore()}}Snowflake.offscreenCanvases=new WeakMap;const i=Snowflake,l={pointerEvents:"none",backgroundColor:"transparent",position:"absolute",top:0,left:0,width:"100%",height:"100%"};var c,d,__classPrivateFieldGet=function(e,t,r,o){if("a"===r&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?o:"a"===r?o.call(e):o?o.value:t.get(e)},__classPrivateFieldSet=function(e,t,r,o,n){if("m"===o)throw new TypeError("Private method is not writable");if("a"===o&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===o?n.call(e,r):n?n.value=r:t.set(e,r),r};class SnowfallCanvas{get ctx(){return __classPrivateFieldGet(this,c,"f")}get canvas(){return __classPrivateFieldGet(this,d,"f")}set canvas(e){__classPrivateFieldSet(this,d,e,"f"),__classPrivateFieldSet(this,c,e.getContext("2d"),"f")}constructor(e,t){this.lastUpdate=Date.now(),this.snowflakes=[],c.set(this,void 0),d.set(this,void 0),__classPrivateFieldSet(this,d,e,"f"),__classPrivateFieldSet(this,c,e.getContext("2d"),"f"),this.config={snowflakeCount:150,...s,...t},this.snowflakes=[],this.snowflakes=i.createSnowflakes(e,t.snowflakeCount||150,t),this.play()}updateConfig(e){this.config={...this.config,...e};const t=this.config.snowflakeCount-this.snowflakes.length;t>0&&(this.snowflakes=[...this.snowflakes,...i.createSnowflakes(this.canvas,t,e)]),t<0&&(this.snowflakes=this.snowflakes.slice(0,this.config.snowflakeCount));for(const e of this.snowflakes)e.updateConfig(this.config)}render(e=1){const{ctx:t,canvas:r,snowflakes:o}=this;if(!t||!r)return;const{offsetWidth:n,offsetHeight:a}=r;for(const t of o)t.update(n,a,e);if(t.setTransform(1,0,0,1,0,0),t.clearRect(0,0,n,a),this.config.images&&this.config.images.length>0)for(const e of o)e.drawImage(t);else{t.beginPath();for(const e of o)e.drawCircle(t);t.fillStyle=this.config.color,t.fill()}}loop(){const e=Date.now(),t=Date.now()-this.lastUpdate;this.lastUpdate=e;const r=t/16.666666666666668;this.render(r),this.animationFrame=requestAnimationFrame((()=>this.loop()))}play(){this.loop()}pause(){this.animationFrame&&(cancelAnimationFrame(this.animationFrame),this.animationFrame=void 0)}}c=new WeakMap,d=new WeakMap;function useDeepMemo(e){const[t,r]=(0,o.useState)(e);return function useDeepCompareEffect(e,t){const r=(0,o.useRef)(t);return n(t,r.current)||(r.current=t),(0,o.useEffect)(e,r.current)}((()=>r(e)),[e]),t}const lib_Snowfall=({color:e=s.color,changeFrequency:t=s.changeFrequency,radius:r=s.radius,speed:n=s.speed,wind:a=s.wind,rotationSpeed:i=s.rotationSpeed,opacity:c=s.opacity,snowflakeCount:d=150,images:p,style:u}={})=>{const f=(h=u,(0,o.useMemo)((()=>({...l,...h||{}})),[h]));var h;const m=(0,o.useRef)(null),g=(e=>{const[t,r]=(0,o.useState)(getSize(e.current)),n=(0,o.useCallback)((()=>{e.current&&r(getSize(e.current))}),[e]);return(0,o.useEffect)((()=>{const{ResizeObserver:t}=window;if(e.current){if(n(),"function"==typeof t){const r=new t(n);return r.observe(e.current),()=>r.disconnect()}return window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)}}),[e,n]),t})(m),v=useDeepMemo({color:e,changeFrequency:t,radius:r,speed:n,wind:a,rotationSpeed:i,images:p,snowflakeCount:d,opacity:c}),y=(0,o.useRef)(v),w=(0,o.useRef)();return(0,o.useEffect)((()=>(!w.current&&m.current&&(w.current=new SnowfallCanvas(m.current,y.current)),()=>{var e;null===(e=w.current)||void 0===e||e.pause(),w.current=void 0})),[]),(0,o.useEffect)((()=>{w.current&&w.current.updateConfig(v)}),[v]),o.createElement("canvas",{ref:m,height:g.height,width:g.width,style:f,"data-testid":"SnowfallCanvas"})}}}]);
@@ -0,0 +1 @@
1
+ /*! filename:43 */