(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8365],{1445:e=>{e.exports={white:"loader_white__n6unS",l7:"loader_l7__nkKAr",black:"loader_black__p1jiV",blue:"loader_blue__ZBLWJ"}},4631:(e,t,a)=>{"use strict";a.d(t,{A:()=>o});var s=a(95155),r=a(12515);function o(e){let{error:t}=e;return(0,s.jsx)(s.Fragment,{children:t&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("br",{}),(0,s.jsx)("br",{}),(0,s.jsxs)("div",{className:"d-flex justify-content-center pb-2",role:"alert",children:[(0,s.jsx)("div",{children:(0,s.jsx)(r.ItP,{style:{minWidth:"17px",height:"17px",marginTop:"-3px"}})}),"\xa0\xa0",(0,s.jsx)("div",{dangerouslySetInnerHTML:{__html:t}})]})]})})}},35695:(e,t,a)=>{"use strict";var s=a(18999);a.o(s,"usePathname")&&a.d(t,{usePathname:function(){return s.usePathname}}),a.o(s,"useRouter")&&a.d(t,{useRouter:function(){return s.useRouter}}),a.o(s,"useSearchParams")&&a.d(t,{useSearchParams:function(){return s.useSearchParams}})},43626:(e,t,a)=>{"use strict";async function s(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"GET",a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};try{console.log("Requesting ".concat(t," to ").concat(e," with options: ").concat(JSON.stringify(a)));let s=localStorage.getItem("auth");if(""!==e)return await r(e,t,s,a);return{status:"ok"}}catch(e){return console.error("Error in fetchApi: ".concat(e.message)),{status:"error",message:e.message||"An unknown error occurred"}}}async function r(e,t,a,s){try{var r;let o,n;o=((r="api.browser.lol",void 0===r)?void 0:r.length)>0?"https://".concat("api.browser.lol","/v7").concat(e):"".concat(window.location.origin,"/v7").concat(e),n="GET"===t?await fetch(o,{method:t,headers:{Authorization:"Bearer ".concat(a),"Content-Type":"application/json"}}):await fetch(o,{method:t,headers:{Authorization:"Bearer ".concat(a),"Content-Type":"application/json"},body:JSON.stringify(s)});let l=await n.json();if(null==l?void 0:l.status)return console.log("Request succeeded to ".concat(e,": ").concat(JSON.stringify(l))),!0===l.forceLogout?(console.warn("Unauthorized. Cleaning up..."),localStorage.removeItem("auth")):(null==l?void 0:l.authToken)&&localStorage.setItem("auth",l.authToken),l;return console.log("Request failed to ".concat(e,": ").concat(JSON.stringify(l))),{status:"error",message:"Invalid server response"}}catch(e){return console.error("Error in fetchUrl: ".concat(e.message)),{status:"error",message:"Failed to connect to server. Please try again later."}}}a.d(t,{A:()=>s})},45507:(e,t,a)=>{"use strict";a.d(t,{A:()=>n});var s=a(95155),r=a(1445),o=a.n(r);function n(e){let{color:t}=e;return"black"===t?(0,s.jsx)(s.Fragment,{children:(0,s.jsx)("div",{className:o().black})}):"blue"===t?(0,s.jsx)(s.Fragment,{children:(0,s.jsx)("div",{className:o().blue})}):(0,s.jsx)(s.Fragment,{children:(0,s.jsx)("div",{className:o().white})})}},49822:(e,t,a)=>{"use strict";a.r(t),a.d(t,{default:()=>f,dynamic:()=>v});var s=a(95155),r=a(94545),o=a.n(r),n=a(45507),l=a(35695),i=a(26715),c=a(6874),u=a.n(c),d=a(84408),h=a(43626),g=a(12115),m=a(85376),x=a(4631),p=a(66983);function f(){let e=(0,l.useRouter)(),t=(0,i.jE)(),[a,r]=(0,g.useState)(""),[c,f]=(0,g.useState)(""),[v,b]=(0,g.useState)(""),[j,w]=(0,g.useState)(""),[y,N]=(0,g.useState)(""),[_,S]=(0,g.useState)(!0),{user:k}=(0,g.useContext)(p.E0);async function A(e){e.preventDefault(),N(""),f(""),w("");let s=!0;if(/^[\w-]+(\.[\w-]+)*@([a-z0-9-]+(\.[a-z0-9-]+)*?\.[a-z]{2,6}|(\d{1,3}\.){3}\d{1,3})(:\d{4})?$/i.test(a)||(f("is-invalid"),s=!1),v.length<8&&(w("is-invalid"),s=!1),s){S(!0);let e=await (0,h.A)("/auth/login","POST",{email:a,password:v});"ok"===e.status?(localStorage.setItem("auth",e.authToken),t.refetchQueries(["getUserData"])):(S(!1),N(e.message))}}return(0,g.useEffect)(()=>{(null==k?void 0:k.loggedIn)===!0?(console.log("Logged in, redirecting to /dashboard"),S(!0),e.push("/dashboard")):(null==k?void 0:k.loggedIn)===!1&&S(!1)},[k]),(0,s.jsx)(s.Fragment,{children:(0,s.jsxs)("div",{className:"w-100 align-self-center m-2 p-lg-5 py-5 px-3 rounded-4 shadow ".concat(o().authForm),children:[(0,s.jsxs)("h1",{className:"text-center gradientText antipasto",children:[(0,s.jsx)(d.G3M,{style:{marginTop:"-8px"},className:"gradientTextIcon"}),"Welcome Back!"]}),(0,s.jsxs)("form",{children:[(0,s.jsxs)("p",{className:"text-center pb-3 mb-3",children:["Don't have an account yet? ",(0,s.jsx)(u(),{href:"/auth/register",children:"Register here."})]}),(0,s.jsxs)("div",{className:"position-relative mb-4",children:[(0,s.jsx)("label",{htmlFor:"email",className:"form-label fs-base",children:"Email"}),(0,s.jsx)("input",{type:"email",id:"email",autoComplete:"email",name:"email",value:a,onChange:function(e){r(e.target.value),f("")},className:"form-control form-control-lg ".concat(c),required:""})]}),(0,s.jsxs)("div",{className:"mb-4",children:[(0,s.jsx)("label",{htmlFor:"password",className:"form-label fs-base",children:"Password"}),(0,s.jsx)("div",{className:"password-toggle",children:(0,s.jsx)("input",{type:"password",id:"password",name:"password",value:v,onChange:function(e){b(e.target.value),w("")},className:"form-control form-control-lg ".concat(j),required:"",autoComplete:"current-password"})})]}),!0===_?(0,s.jsx)("button",{className:"btn btn-primary shadow-primary btn-lg w-100",disabled:!0,children:(0,s.jsx)(n.A,{})}):(0,s.jsx)("button",{type:"submit",className:"btn btn-primary shadow-primary btn-lg w-100",onClick:A,children:"Login"}),(0,s.jsx)(x.A,{error:y}),(0,s.jsx)(u(),{href:"/auth/reset",className:"btn btn-link btn-lg w-100",children:"Forgot your password?"}),(0,s.jsx)("hr",{className:"my-4"}),(0,s.jsx)("h6",{className:"text-center mb-4",children:"Or sign in with your social network"}),(0,s.jsx)("div",{className:"row row-cols-1",children:(0,s.jsx)("div",{className:"col mb-3",children:(0,s.jsx)(m.A,{})})})]})]})})}let v="force-static"},66983:(e,t,a)=>{"use strict";a.d(t,{E0:()=>g,Ft:()=>d,default:()=>m});var s=a(95155),r=a(87017),o=a(26715),n=a(95799),l=a(12115),i=a(31195);a(71711);var c=a(50192),u=a(15666);let d=null,h=new r.E,g=(0,l.createContext)();function m(e){let{children:t}=e,[a,r]=(0,l.useState)({});return(0,l.useEffect)(()=>{i.Ay.initialize("AW-16989828804")},[]),(0,s.jsx)(g.Provider,{value:{user:a,setUser:r},children:(0,s.jsxs)(o.Ht,{client:h,children:[(0,s.jsxs)(u.zE,{children:[(0,s.jsx)(n.N9,{position:"top-center"}),t]}),(0,s.jsx)(c.E,{initialIsOpen:!1})]})})}},70724:(e,t,a)=>{Promise.resolve().then(a.bind(a,49822))},85376:(e,t,a)=>{"use strict";a.d(t,{A:()=>i});var s=a(95155);a(12115);var r=a(35695),o=a(66766),n=a(95799),l=a(43626);function i(){let e=(0,r.useRouter)();async function t(){console.log("getGoogleUrl");let t=window.location.hostname;if(!["browser.lol","v7.browser.lol","dev1.srv.browser.lol"].includes(t)){console.log("Not allowed domain, redirecting to /auth/reset?ref=google"),e.push("/auth/reset?ref=google");return}let a=await (0,l.A)("/auth/google/url","POST",{domain:t});"ok"===a.status?window.location.href=a.url:n.oR.error((null==a?void 0:a.message)||"Failed to get Google URL")}return(0,s.jsx)(s.Fragment,{children:(0,s.jsxs)("a",{onClick:t,className:"btn btn-icon btn-secondary btn-lg w-100",children:[(0,s.jsx)(o.default,{src:"/img/google-icon.png",alt:"Google",width:40,height:40}),"\xa0 Continue with Google"]})})}},94545:e=>{e.exports={authForm:"auth_authForm__QAWb9",titleIcon:"auth_titleIcon__C54Ot",googleIcon:"auth_googleIcon__V63xd"}}},e=>{var t=t=>e(e.s=t);e.O(0,[5318,5798,5479,1348,8520,2995,6967,5799,4903,6766,8441,1684,7358],()=>t(70724)),_N_E=e.O()}]);