"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[3883],{85788(D,y,t){t.r(y),t.d(y,{default:()=>E});var o=t(74848),e=t(22803),A=t(75683),r=t(92745),b=t(43173),d=t(63142),p=t(34999),h=t(41654),u=t(45861),C=t(92948),S=t(71586),B=t(13791),N=t(53539),L=t(61238),m=t(58102),z=t(2543),$=t(48588),G=t(30703),a=t(65642);const T=()=>{const n=!!a.Ay.oauth;return{saml:{bgColor:"#464646",enabled:a.Ay.samlEnabled,name:a.Ay.samlName||$.En,icon:"key-skeleton-alt"},google:{bgColor:"#e84d3c",enabled:n&&!!a.Ay.oauth.google,name:a.Ay.oauth?.google?.name||"Google",icon:a.Ay.oauth?.google?.icon||"google"},azuread:{bgColor:"#2f2f2f",enabled:n&&!!a.Ay.oauth.azuread,name:a.Ay.oauth?.azuread?.name||"Microsoft",icon:a.Ay.oauth?.azuread?.icon||"microsoft"},github:{bgColor:"#464646",enabled:n&&!!a.Ay.oauth.github,name:a.Ay.oauth?.github?.name||"GitHub",icon:a.Ay.oauth?.github?.icon||"github"},gitlab:{bgColor:"#fc6d26",enabled:n&&!!a.Ay.oauth.gitlab,name:a.Ay.oauth?.gitlab?.name||"GitLab",icon:a.Ay.oauth?.gitlab?.icon||"gitlab"},grafanacom:{bgColor:"#262628",enabled:n&&!!a.Ay.oauth.grafana_com,name:a.Ay.oauth?.grafana_com?.name||"Grafana.com",icon:a.Ay.oauth?.grafana_com?.icon||"grafana",hrefName:"grafana_com"},okta:{bgColor:"#2f2f2f",enabled:n&&!!a.Ay.oauth.okta,name:a.Ay.oauth?.okta?.name||"Okta",icon:a.Ay.oauth?.okta?.icon||"okta"},oauth:{bgColor:"#262628",enabled:n&&!!a.Ay.oauth.generic_oauth,name:a.Ay.oauth?.generic_oauth?.name||"OAuth",icon:a.Ay.oauth?.generic_oauth?.icon||"signin",hrefName:"generic_oauth"}}},j=n=>({button:(0,e.css)({color:"#d8d9da",position:"relative"}),buttonIcon:(0,e.css)({position:"absolute",left:n.spacing(1),top:"50%",transform:"translateY(-50%)"}),divider:{base:(0,e.css)({color:n.colors.text.primary,display:"flex",marginBottom:n.spacing(1),justifyContent:"space-between",textAlign:"center",width:"100%"}),line:(0,e.css)({width:100,height:10,borderBottom:`1px solid ${n.colors.text}`})}}),F=()=>{const n=(0,d.of)(j);return(0,o.jsxs)("div",{className:n.divider.base,children:[(0,o.jsx)("div",{children:(0,o.jsx)("div",{className:n.divider.line})}),(0,o.jsx)("div",{children:(0,o.jsx)("span",{children:!a.Ay.disableLoginForm&&(0,o.jsx)(r.x6,{i18nKey:"login.divider.connecting-text",children:"or"})})}),(0,o.jsx)("div",{children:(0,o.jsx)("div",{className:n.divider.line})})]})};function K(n,s,i){return(0,e.cx)(s.button,(0,e.css)({backgroundColor:n.bgColor,color:i.colors.getContrastText(n.bgColor),"&:hover":{backgroundColor:i.colors.emphasize(n.bgColor,.15),boxShadow:i.shadows.z1}}))}const P=()=>{const n=(0,z.pickBy)(T(),c=>c.enabled),s=Object.keys(n).length>0,i=(0,d.$j)(),g=(0,d.of)(j);return s?(0,o.jsxs)(h.B,{direction:"column",width:"100%",children:[(0,o.jsx)(F,{}),Object.entries(n).map(([c,l])=>{const f=l.name;return(0,o.jsxs)(u.z9,{className:K(l,g,i),href:`login/${l.hrefName?l.hrefName:c}`,target:"_self",fullWidth:!0,children:[(0,o.jsx)(G.I,{className:g.buttonIcon,name:l.icon}),(0,o.jsxs)(r.x6,{i18nKey:"login.services.sing-in-with-prefix",children:["Sign in with ",{serviceName:f}]})]},c)})]}):null},U=()=>{const n=(0,a.zj)().verifyEmailEnabled?`${(0,a.zj)().appSubUrl}/verify`:`${(0,a.zj)().appSubUrl}/signup`,s=(0,e.css)({paddingTop:"16px"});return(0,o.jsxs)(h.B,{direction:"column",children:[(0,o.jsx)("div",{className:s,children:(0,o.jsx)(r.x6,{i18nKey:"login.signup.new-to-question",children:"New to Grafana?"})}),(0,o.jsx)(u.z9,{className:(0,e.css)({width:"100%",justifyContent:"center"}),href:n,variant:"secondary",fill:"outline",children:(0,o.jsx)(r.x6,{i18nKey:"login.signup.button-label",children:"Sign up"})})]})},E=()=>{const n=(0,d.of)(I);return document.title=C.Me.AppTitle,(0,o.jsx)(B.Y,{layout:A.k.Custom,children:(0,o.jsx)(N.A,{children:({loginHint:s,passwordHint:i,disableLoginForm:g,disableUserSignUp:c,login:l,isLoggingIn:f,changePassword:O,skipPasswordChange:M,isChangingPassword:x,showDefaultPasswordWarning:Y,loginErrorMessage:v})=>(0,o.jsxs)(m.GU,{isChangingPassword:x,children:[!x&&(0,o.jsxs)(m.qm,{children:[v&&(0,o.jsx)(p.F,{className:n.alert,severity:"error",title:(0,r.t)("login.error.title","Login failed"),children:v}),!g&&(0,o.jsx)(L.Q,{onSubmit:l,loginHint:s,passwordHint:i,isLoggingIn:f,children:(0,o.jsx)(h.B,{justifyContent:"flex-end",children:!b.$.auth.disableLogin&&(0,o.jsx)(u.z9,{className:n.forgottenPassword,fill:"text",href:`${b.$.appSubUrl}/user/password/send-reset-email`,children:(0,o.jsx)(r.x6,{i18nKey:"login.forgot-password",children:"Forgot your password?"})})})}),(0,o.jsx)(P,{}),!c&&(0,o.jsx)(U,{})]}),x&&(0,o.jsx)(m.qm,{children:(0,o.jsx)(S.S,{showDefaultPasswordWarning:Y,onSubmit:O,onSkip:()=>M()})})]})})})},I=n=>({forgottenPassword:(0,e.css)({padding:0,marginTop:n.spacing(.5)}),alert:(0,e.css)({width:"100%"})})}}]);

//# sourceMappingURL=LoginPage.2317d599a7ae071f1fed.js.map