1!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},r=(new e.Error).stack;r&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[r]="c825d172-6a70-49f1-ac9b-e3ad8c58a697",e._sentryDebugIdIdentifier="sentry-dbid-c825d172-6a70-49f1-ac9b-e3ad8c58a697")}catch(e){}}();"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8284],{18284:function(e,r,n){n.r(r),n.d(r,{LoginPage:function(){return LoginPage}});var t,o,i=n(21526),a=n(12525),l=n(2e3),c=n(84432),s=n(4609),d=n(51865),u=n.n(d),p=n(1878),f=n.n(p),g=n(23947),h=n.n(g),m=n(1597),v=n(44194),b=n(67546),w=n(68075),k=n(39185),x=n(89859),Z=n(84239),y=n(26479),C=n(30513),P=n(37403),N=n(89771),L=n(99631),O=n.n(L),I=n(30179),_=n(76880),B=n.n(_),S=n(38033),E=n(99717),j=n(39036),M=n(6255),X=n(27719),G=n(11461),A=n(63701),T=n(62940),D=/^[a-z0-9.+_-]+@[a-z0-9.-]+.[a-z]{2,4}$/,ForgotPassword=function(e){var r,n=e.onNavigateBack,t=(0,G.$G)().t,o=(0,m.useRouter)(),i=(0,b.Ek)().authAPI,a=(0,S.y)().setForgetPasswordCredential,l=i("/reset-password").method("post").create(),c=(0,v.useState)(""),s=c[0],d=c[1],u=(0,v.useState)(!1),p=u[0],f=u[1],g=(0,v.useState)({errorMessage:"",showError:!1}),h=g[0],w=g[1],k=(r=(0,I.Z)(B().mark(function _callee(e){var r;return B().wrap(function(n){for(;;)switch(n.prev=n.next){case 0:return e.preventDefault(),f(!0),n.prev=2,n.next=5,l({emailOrUsername:s});case 5:(r=n.sent.data)&&(f(!1),a({userId:r.userId,email:r.email,ref:r.refNo,otpExp:r.expiresAt?new Date(r.expiresAt).getTime():new Date().getTime()}),o.push("/email-otp/forget-password")),n.next=15;break;case 10:n.prev=10,n.t0=n.catch(2),console.error(n.t0),f(!1),w({errorMessage:D.test(s)?"not-found-email":"not-found-username",showError:!0});case 15:case"end":return n.stop()}},_callee,null,[[2,10]])})),function(e){return r.apply(this,arguments)});return(0,T.BX)("div",{className:"flex flex-col items-center relative gap",children:[(0,T.tZ)(A.u,{onClick:n}),(0,T.BX)("div",{className:"flex flex-col gap-6 items-center",children:[(0,T.tZ)(j.Z,{className:"font-bold",variant:"h3",children:t("login-popup.forgot-password-title")}),(0,T.BX)("form",{className:"w-full flex flex-col gap-6",onSubmit:k,noValidate:!0,children:[(0,T.BX)(j.Z,{variant:"body",className:"flex flex-col items-center",children:[(0,T.BX)("div",{className:"flex gap-1",children:[t("login-popup.forgot-password-subtitle.subtitle1"),(0,T.tZ)(j.Z,{className:"font-bold",variant:"body",children:t("login-popup.forgot-password-subtitle.subtitle2")}),t("login-popup.forgot-password-subtitle.subtitle3")]}),t("login-popup.forgot-password-subtitle.subtitle4")]}),(0,T.tZ)(M.Z,{error:h.showError,helperText:h.errorMessage&&t("login-popup.forgot-password-error.".concat(h.errorMessage)),fullWidth:!0,id:"forgotPassword",placeholder:t("login-popup.username-or-email"),name:"forgotPassword",value:s,onChange:function(e){f(!1),d(e.target.value),w({errorMessage:"",showError:!1})},autoComplete:"forgotPassword"}),(0,T.tZ)(E.Z,{fullWidth:!0,loading:p,variant:"contained",color:"primary",size:"medium",type:"submit",disabled:""===s||h.showError,children:t("login-popup.confirm")})]})]}),(0,T.BX)("div",{className:"flex flex-col items-center mt-10",children:[(0,T.tZ)(j.Z,{children:t("login-popup.forgot-password-description.description1")}),(0,T.tZ)(X.Z,{variant:"text",color:"primary",className:"p-0",children:t("login-popup.forgot-password-description.description2")})]})]})},R=n(84302),F=n(33461),U=n(97770),z=n(38327),W=n(92018),$=n(25887),V=n(46918),K=n(41165),H=n(5951),Y=n(92406),q=n(32314),J=n(63622),Q=n(21363),ee=n(60237),er=n(8898),en=n(23601),et=n(78615),AppleButton=function(e){var r=e.currentURL,n=e.responseApple,t=e.onClick,o=F.m.appleCallback,i=(0,et.yX)().getLatestRedirectPath,a=(0,G.$G)().t;return i()===(0,P.an)()&&(o="".concat(F.m.appleCallback,"?redirect=").concat(i())),(0,T.tZ)(en.Z,{clientId:F.m.appleClientId,redirectURI:o,responseType:"code id_token",state:(0,K.hk)({providerAction:K.xv.AppleLogin,originURL:r}),responseMode:"fragment",callback:n,render:function(e){return(0,T.BX)(E.Z,{"aria-label":"Apple Login",onClick:function(){null==t||t(),e.onClick()},fullWidth:!0,variant:"outlined",className:"relative flex items-center justify-center border border-1",children:[(0,T.tZ)("img",{src:"/images/social-login/apple.svg",className:"w-6 h-6 absolute left-6"}),a("login-popup.login-btn.apple")]})}})},eo=n(84410),FacebookButton=function(e){var r=e.onClick,n=(0,G.$G)().t;return(0,T.BX)(E.Z,{"aria-label":"Facebook Login",onClick:r,fullWidth:!0,variant:"outlined",className:"relative flex items-center justify-center border border-1",children:[(0,T.tZ)("img",{src:"/images/social-login/facebook.svg",className:"w-6 h-6 absolute left-6"}),n("login-popup.login-btn.facebook")]})},ei=n(47886),ea=n(43186),GoogleButton=function(e){var r=e.responseGoogle,n=e.onClick,t=(0,ei.V)(),o=(0,G.$G)().t,i=(0,l.bj)(),a=(0,W.Sf)((0,U.VY)(),50),c=console.error;return console.error=function(){for(var e=arguments.length,r=Array(e),n=0;n<e;n++)r[n]=arguments[n];for(var t=0;t<r.length;t++){var i=r[t];"string"==typeof i&&i.includes("Maybe blocked by the browser")&&a({severity:"warning",message:o("login-popup.error.popup-blocked")})}c.apply(void 0,r)},(0,T.tZ)(T.HY,{children:(0,T.BX)("div",{className:"relative",children:[(0,T.tZ)("div",{className:"absolute inset-0 z-10 pointer-events-none flex items-center justify-center","aria-hidden":"true",children:(0,T.BX)(X.Z,{"aria-label":"Google Login",fullWidth:!0,variant:"outlined",className:"flex items-center justify-center border border-1 pointer-events-none",tabIndex:-1,
1children:[(0,T.tZ)("img",{src:"/images/social-login/google.svg",className:"w-6 h-6 absolute left-6"}),o("login-popup.login-btn.google")]})}),(0,T.tZ)("div",{className:"relative z-20 w-full h-full",style:{opacity:.01,minHeight:"40px"},children:(0,T.tZ)(ea.kZ,{click_listener:function(){null==n||n()},onSuccess:r,onError:function(){console.error("Google Login Failed"),t(Error("Google Login Failed"))},context:"signin",useOneTap:!1,type:"standard",theme:"outline",width:i.isMobile?330:350,size:"large",ux_mode:"popup"})})]})})},LineButton=function(e){var r=e.onClick,n=(0,G.$G)().t;return(0,T.BX)(E.Z,{"aria-label":"Line Login",onClick:r,fullWidth:!0,variant:"outlined",className:"relative flex items-center justify-center border border-1",children:[(0,T.tZ)("img",{src:"/images/social-login/line.svg",className:"w-6 h-6 absolute left-6"}),n("login-popup.login-btn.line")]})},el={backgroundColor:"#532881"},PantipButton=function(e){var r=e.onClick,n=(0,G.$G)().t;return(0,T.BX)(E.Z,{"aria-label":"Pantip Login",onClick:r,fullWidth:!0,variant:"outlined",className:"relative flex items-center justify-center border border-1",children:[(0,T.tZ)("span",{className:"w-6 h-6 absolute left-6 rounded-full flex items-center justify-center",style:el,children:(0,T.tZ)("img",{src:"/images/social-login/pantip.jpg",className:"w-5 h-5 object-contain"})}),n("login-popup.login-btn.pantip")]})};function ownKeys(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);r&&(t=t.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),n.push.apply(n,t)}return n}function _objectSpread(e){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?ownKeys(Object(n),!0).forEach(function(r){(0,R.Z)(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ownKeys(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var ec=(0,N.Pi)(function(e){var r,n,t,a,c,s,d=e.onForgotPassword,p=e.onRegister,f=e.onLoginProvider,g=e.onLoginEmailOrUsername,h=e.tab,w=(0,Z.aC)(),k=(0,m.useRouter)().query,C=(0,G.$G)().t,N=(0,v.useState)(!1),L=N[0],O=N[1],_=(0,v.useState)(!1),S=_[0],A=_[1],D=(0,v.useState)(""),en=D[0],ei=D[1],ea=(0,v.useState)({password:"",showPassword:!1}),el=ea[0],ec=ea[1],es=(0,v.useState)(null),ed=es[0],eu=es[1],ep=(0,v.useState)(!1),ef=ep[0],eg=ep[1],eh=(0,et.yX)(),em=eh.set,ev=eh.clear,eb=eh.action,ew=eh.redirect,ek=eh.getLatestRedirectPath,ex=(0,x.k)().track,eZ=(0,b.Ek)().authAPI,ey=(0,W.Sf)((0,U.VY)(),50),eC=(0,z.W)().pantipLogin,eP=(0,v.useMemo)(function(){return eZ("/get-access-token").method("post").create()},[eZ]),eN=(0,v.useRef)(null),eL=(0,v.useRef)(null),eO=(0,v.useRef)(void 0);(0,v.useEffect)(function(){eO.current=eb},[eb]);var setOwnedFeedback=function(e,r,n){eL.current=null!=n?n:null,em(e,r,n)},responsePantip=function(){if(!F.m.pantipAuthUrl||!F.m.pantipClientId||!F.m.pantipCallback){console.error("Pantip login is misconfigured: missing pantipAuthUrl/pantipClientId/pantipCallback"),ey({severity:"warning",message:C("login-popup.error.popup-blocked")});return}var e,r=F.m.pantipCallback,n="".concat(F.m.pantipAuthUrl,"?client_id=").concat(F.m.pantipClientId,"&callback=").concat(encodeURIComponent(r));(0,H.B_)("login");var t=(window.outerWidth-480)/2,o=(window.outerHeight-640)/2,i=window.open(n,"pantip-login","width=".concat(480,",height=").concat(640,",left=").concat(t,",top=").concat(o,",toolbar=no,menubar=no,scrollbars=yes,resizable=yes"));if(!i||i.closed){ey({severity:"warning",message:C("login-popup.error.popup-blocked")});return}setOwnedFeedback(et.IC.AwaitingProvider,void 0,function(){var e;null===(e=eN.current)||void 0===e||e.call(eN),eN.current=null,i.close(),ev()}),null===(e=eN.current)||void 0===e||e.call(eN),eN.current=(0,H.XY)(i,function(){eN.current=null,setOwnedFeedback(et.IC.Error,H.HG)})};(0,v.useEffect)(function(){if(eC){var e,r=(e=(0,I.Z)(B().mark(function _callee(e){var r,n,t,o;return B().wrap(function(i){for(;;)switch(i.prev=i.next){case 0:if(!(e.origin!==window.location.origin)){i.next=2;break}return i.abrupt("return");case 2:if(!((null==(n=e.data)?void 0:n.source)!==H.md)){i.next=5;break}return i.abrupt("return");case 5:if(null===(r=eN.current)||void 0===r||r.call(eN),eN.current=null,"error"!==n.status){i.next=10;break}return setOwnedFeedback(et.IC.Error,null!==(t=n.detail)&&void 0!==t?t:Error("Pantip login failed")),i.abrupt("return");case 10:return em(et.IC.Loading),i.prev=11,i.next=14,eP({},{credentials:"include"});case 14:if(null!=(o=i.sent.data)&&o.accessToken){i.next=18;break}throw Error("get-access-token returned no access token");case 18:return i.next=20,w.loggedIn(o.accessToken);case 20:ex(y.aM.LOGIN,{method:K.pL.Pantip},!1),em(et.IC.Success),i.next=27;break;case 24:i.prev=24,i.t0=i.catch(11),em(et.IC.Error,i.t0);case 27:case"end":return i.stop()}},_callee,null,[[11,24]])})),function(r){return e.apply(this,arguments)});return window.addEventListener("message",r),function(){var e;window.removeEventListener("message",r),null===(e=eN.current)||void 0===e||e.call(eN),eN.current=null,eO.current&&eO.current===eL.current&&(eL.current=null,ev())}}},[eC]),(0,v.useEffect)(function(){var e;(e=(0,I.Z)(B().mark(function _callee2(){var e,r;return B().wrap(function(n){for(;;)switch(n.prev=n.next){case 0:if(e=window.location.hash.substring(1)){n.next=3;break}return n.abrupt("return");case 3:if(!(r=new URLSearchParams(e).get("id_token"))){n.next=15;break}return n.prev=6,n.next=9,w.loginWithSocial({idToken:r,socialLogin:"SOCIAL_LOGIN_FACEBOOK"});case 9:em(et.IC.Success),n.next=15;break;case 12:n.prev=12,n.t0=n.catch(6),em(et.IC.Error,n.t0);case 15:case"end":return n.stop()}},_callee2,null,[[6,12]])})),function(){return e.apply(this,arguments)})()},[]);var clearLoginDetail=function(){ei(""),ec({password:"",showPassword:!1})},eI=(r=(0,I.Z)(B().mark(function _callee3(e){var r;return B().wrap(function(n){for(;;)switch(n.prev=n.next){case 0:return loginIntentOnClick(K.pL.Email)(),A(!0),e.preventDefault(),n.prev=3,n.next=6,w.loginWithEmail({emailOrUsername:en,password:el.password});case 6:clearLoginDetail(),ek()===(0,P.an)()&&ew(),n.next=15;break;case 10:n.prev=10,n.t0=n.catch(3),"type.googleapis.com/foundation.error.BadRequestError"===(r=(0,$.errToAppErr)(n.t0))["@type"]&&("username-or-password-invalid"===r.detail||"email-or-password-invalid"===r.detail)?O(!0):(eu(n.t0),eg(!0)),console.error(n.t0);case 15:return n.prev=15,A(!1),n.finish(15);case 18:case"end":return n.stop()}}
1,_callee3,null,[[3,10,15,18]])})),function(e){return r.apply(this,arguments)}),e_=(n=(0,I.Z)(B().mark(function _callee4(e){var r,n;return B().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.token,n=e.type,em(et.IC.Loading),t.prev=2,t.next=5,w.loginWithSocial({idToken:r,socialLogin:n});case 5:em(et.IC.Success),t.next=13;break;case 8:t.prev=8,t.t0=t.catch(2),em(et.IC.Error,t.t0),eu(t.t0),console.error(t.t0);case 13:case"end":return t.stop()}},_callee4,null,[[2,8]])})),function(e){return n.apply(this,arguments)}),eB=(t=(0,I.Z)(B().mark(function _callee5(e){return B().wrap(function(r){for(;;)switch(r.prev=r.next){case 0:if(!e.credential){r.next=5;break}return r.next=3,e_({token:e.credential,type:"SOCIAL_LOGIN_GOOGLE"});case 3:r.next=7;break;case 5:em(et.IC.Error,Error("Google login failed")),eu(Error("Google login failed"));case 7:case"end":return r.stop()}},_callee5)})),function(e){return t.apply(this,arguments)}),eS=(a=(0,I.Z)(B().mark(function _callee6(){var e;return B().wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,(0,V.t)();case 2:e=r.sent,window.location.href=e;case 4:case"end":return r.stop()}},_callee6)})),function(){return a.apply(this,arguments)}),eE=(c=(0,I.Z)(B().mark(function _callee7(e){var r;return B().wrap(function(n){for(;;)switch(n.prev=n.next){case 0:if("appledirect"!==k.state){n.next=3;break}return n.next=3,e_({token:null==e?void 0:null===(r=e.authorization)||void 0===r?void 0:r.id_token,type:"SOCIAL_LOGIN_APPLE"});case 3:case"end":return n.stop()}},_callee7)})),function(e){return c.apply(this,arguments)}),ej=(s=(0,I.Z)(B().mark(function _callee8(){var e,r;return B().wrap(function(n){for(;;)switch(n.prev=n.next){case 0:e=(0,K.hk)({providerAction:K.xv.LineLogin,originURL:window.location.href}),r="https://access.line.me/oauth2/v2.1/authorize?response_type=code&client_id=".concat(F.m.lineChannelId,"&redirect_uri=").concat(F.m.lineCallback,"&scope=openid%20profile%20email&nonce=reeeed-mp&state=").concat(e),window.location.href=r;case 3:case"end":return n.stop()}},_callee8)})),function(){return s.apply(this,arguments)}),loginIntentOnClick=function(e){return function(){ex(y.aM.LOGIN_INTENT,{method:e},!1)}},eM=(0,l.bj)();return(0,T.BX)(T.HY,{children:[(0,T.tZ)(eo.w,{error:ed,open:ef,handleClose:function(){eg(!1),setTimeout(function(){eu(null)},1e3)}}),(0,T.BX)("div",{className:"flex flex-col items-center",css:(0,i.iv)({gap:eM.isMobile?"24px":"30px"},"",""),children:[(0,T.BX)("div",{className:"w-full flex flex-col items-center",children:[(0,T.BX)("div",{className:"w-full relative flex items-center justify-center",children:[(0,T.tZ)(ee.Z,{onClick:f,className:u()("absolute left-0",h===o.LoginProvider&&"hidden"),children:(0,T.tZ)(Y.Z,{})}),(0,T.tZ)(j.Z,{className:"font-bold",variant:"h3",color:"black",children:C("login-popup.login")})]}),(0,T.BX)("div",{className:u()("flex flex-col gap-3 justify-center",h===o.LoginEmailOrUsername&&"hidden"),css:(0,i.iv)({width:eM.isMobile?"326px":"350px",marginTop:eM.isMobile?"24px":"20px"},"",""),children:[(0,T.BX)(E.Z,{"aria-label":"Email Login",fullWidth:!0,variant:"contained",className:"relative flex items-center justify-center border border-1",onClick:g,children:[(0,T.tZ)(q.Z,{width:28,className:"absolute left-6"}),C("login-popup.login-btn.email")]}),eC&&(0,T.tZ)(PantipButton,{onClick:function(){loginIntentOnClick(K.pL.Pantip)(),responsePantip()}}),(0,T.tZ)(FacebookButton,{onClick:function(){loginIntentOnClick(K.pL.Facebook)(),eS()}}),(0,T.tZ)(LineButton,{onClick:function(){loginIntentOnClick(K.pL.Line)(),ej()}}),(0,T.tZ)(GoogleButton,{onClick:loginIntentOnClick(K.pL.Google),responseGoogle:eB}),(0,T.tZ)(AppleButton,{onClick:loginIntentOnClick(K.pL.Apple),responseApple:eE,currentURL:window.location.href})]}),(0,T.BX)("div",{className:u()("w-full",h===o.LoginProvider&&"hidden"),children:[L?(0,T.tZ)("div",{className:"flex justify-center h-10 items-end",children:(0,T.tZ)(j.Z,{className:"font-bold",variant:"body",color:"secondary.red",children:C("login-popup.login-error")})}):(0,T.tZ)("div",{className:"h-10"}),(0,T.BX)("form",{onSubmit:eI,className:"flex flex-col gap-6",children:[(0,T.BX)("div",{className:"flex flex-col gap-1",children:[(0,T.tZ)(j.Z,{className:"text-sm",variant:"body",color:"primary.darkGray",children:C("login-popup.username-or-email")}),(0,T.tZ)(M.Z,{error:L,size:"small",fullWidth:!0,id:"username",placeholder:C("login-popup.username-or-email"),name:"username",value:en,onChange:function(e){O(!1),ei(e.target.value)},autoComplete:"username"})]}),(0,T.BX)("div",{className:"flex flex-col gap-1",children:[(0,T.BX)("div",{className:"flex justify-between items-center",children:[(0,T.tZ)(j.Z,{className:"text-sm",variant:"body",color:"primary.darkGray",children:C("login-popup.password")}),(0,T.tZ)(X.Z,{className:"h-5 p-0",color:"primary",variant:"text",children:(0,T.tZ)(j.Z,{className:"text-sm",variant:"body",onClick:d,children:C("login-popup.forgot-password")})})]}),(0,T.tZ)(M.Z,{error:L,size:"small",variant:"outlined",fullWidth:!0,name:"password",placeholder:C("login-popup.password"),id:"password",onChange:function(e){ec(_objectSpread(_objectSpread({},el),{},(0,R.Z)({},"password",e.target.value))),O(!1)},type:el.showPassword?"text":"password",value:el.password,autoComplete:"current-password",InputProps:{endAdornment:(0,T.tZ)(ee.Z,{"aria-label":"toggle password visibility",onClick:function(){ec(_objectSpread(_objectSpread({},el),{},{showPassword:!el.showPassword}))},onMouseDown:function(e){e.preventDefault()},edge:"end",children:el.showPassword?(0,T.tZ)(J.Z,{}):(0,T.tZ)(Q.Z,{})})}})]}),(0,T.tZ)(E.Z,{type:"submit",size:"medium",variant:"contained",loading:S,disabled:!en||!el.password,children:C("login-popup.login")})]})]})]}),(0,T.tZ)("div",{children:(0,T.BX)(j.Z,{variant:"caption",color:"primary.darkGray",children:[(0,T.BX)("div",{className:"text-center",children:[C("login-popup.login-description.description1"),(0,T.tZ)(er.Z,{underline:"none",href:(0,P.mk)(),children:C("login-popup.login-description.description2")})]}),(0,T.BX)("div",{className:"text-center",children:[C("login-popup.login-description.and"),(0,T.tZ)(er.Z,{underline:"none",href:(0,P.lC)("privacy"),children:C("login-popup.login-description.description3")}),C("login-popup.login-description.description4")]})]})}),(0,T.tZ)("div",{className:u()("w-full h-0.5 bg-ci-lighter-gray",h===o.LoginEmailOrUsername&&"hidden")}),(0,T.BX)("div",{className:u()("flex items-center gap-2 h-6",h===o.LoginEmailOrUsername&&"hidden"),children:[(0,T.tZ)(j.Z,{variant:"body",color:"black",children:C("login-popup.sign-up-with-email")}),(0,T.tZ)(X.Z,{className:"p-0 h-6",variant:"text",color:"primary",children:(0,T.tZ)(j.Z,{className:"font-bold",onClick:p,children:C("login-popup.sign-up-here")})})]})]})]})}),es=O()({loader:function(){return n.e(6795).then(n.bind(n,96795)).then(function(e){return e.SignUp})},ssr:!1}),ed=(0,N.Pi)(function(e){var r=e.setTab,n=e.tab,t=(0,m.useRouter)(),i=(0,Z.aC)(),a=(0,Z.$x)(),l=(0,b.Ek)(),c=(0,w.jD)().mutate,s=(0,k.Mg)().set,d=(0,w.wM)().remapSelectedProductIds,u=t.query[P.S8.Redirect],p=(0,v.useState)(!1),f=p[0],g=p[1],h=(0,v.useState)(!1),N=h[0],L=h[1],O
1=(0,x.k)().track;switch((0,v.useEffect)(function(){i.accessToken&&a.cart&&!f&&(g(!0),L(!0),l.orderAPI("/guest/cart:merge").method("post").create()({cart:a.cart}).then(function(e){var r,n,t=(null===(r=e.data)||void 0===r?void 0:null===(n=r.itemMappings)||void 0===n?void 0:n.filter(function(e){return e.guestCartItemId&&e.userCartItemId}))||[];if(t.length>0){var o=t.reduce(function(e,r){return e[r.guestCartItemId]=r.userCartItemId,e},{});s(function(e){return(0,C.Fb)(e,o)}),d(o)}a.clearCart(),c()}).catch(function(e){console.error("Failed to merge guest cart:",e)}).finally(function(){L(!1)}))},[i.accessToken,a,f,l,c,s,d]),(0,v.useEffect)(function(){i.accessToken&&!N&&(void 0!=u&&"string"==typeof u?t.push((0,P.sh)(u)):t.push((0,P.kr)()))},[i.accessToken,N,u,t]),n){case o.LoginProvider:case o.LoginEmailOrUsername:return(0,T.tZ)(ec,{onForgotPassword:function(){O(y.aM.INTENT_FORGOT_PASSWORD,{},!1),r(o.ForgotPassword)},onRegister:function(){O(y.aM.INTENT_SIGN_UP,{},!1),r(o.Signup)},onLoginProvider:function(){return r(o.LoginProvider)},onLoginEmailOrUsername:function(){return r(o.LoginEmailOrUsername)},tab:n});case o.ForgotPassword:return(0,T.tZ)(ForgotPassword,{onNavigateBack:function(){return r(o.LoginEmailOrUsername)}});case o.Signup:return(0,T.tZ)(es,{onNavigateBack:function(){return r(o.LoginProvider)}});default:return null}});(t=o||(o={}))[t.LoginProvider=0]="LoginProvider",t[t.LoginEmailOrUsername=1]="LoginEmailOrUsername",t[t.ForgotPassword=2]="ForgotPassword",t[t.Signup=3]="Signup";var LoginPage=function(){var e=(0,l.bj)(),r=(0,m.useRouter)(),n=(0,v.useState)(o.LoginProvider),t=n[0],d=n[1];return(0,T.BX)("div",{className:"flex flex-col items-center min-h-screen",children:[(0,T.tZ)(s.Z,{className:u()("absolute top-5 right-5 hover:cursor-pointer",(t!==o.LoginProvider||!e.isMobile)&&"hidden"),onClick:function(){r.back()}}),(0,T.tZ)(h(),{href:"/",className:"top-5",children:(0,T.tZ)(f(),{css:(0,i.iv)({marginTop:"16px",display:e.isDesktop?"block":"none"},"",""),alt:"login logo",src:a.V,width:158.2,height:56})}),(0,T.BX)("div",{className:u()("flex items-center rounded-2xl desktop:shadow-lg w-full",e.isMobile&&t===o.LoginProvider?"flex-col absolute bottom-8":e.isTablet&&"flex-col"),css:(0,i.iv)({maxWidth:(0,c.K)(e,"100%","558px","970px"),marginTop:e.isTablet?"95px":"20px",gap:e.isMobile&&t===o.LoginProvider?"24px":"0px"},"",""),children:[(0,T.tZ)("div",{className:"flex-grow relative hidden rounded-l-2xl overflow-hidden desktop:block w-1/2",children:(0,T.tZ)("img",{css:(0,i.iv)({display:e.isDesktop?"block":"none"},"",""),alt:"login banner",src:"/images/login-banner.svg",width:"100%"})}),(0,T.BX)("div",{className:"flex-grow w-full rounded-r-2xl desktop:w-1/2",css:(0,i.iv)({paddingLeft:e.isMobile?"20px":"64px",paddingRight:e.isMobile?"20px":"64px",width:e.isMobile?"100vw":"508px",paddingTop:e.isMobile?"0px":"20px",paddingBottom:e.isMobile?"0px":"20px"},"",""),children:[(0,T.tZ)(h(),{href:"/",children:(0,T.tZ)(f(),{className:"mx-auto mb-5",css:(0,i.iv)({display:e.isDesktop||t!==o.LoginProvider?"none":"block"},"",""),alt:"login logo",src:a.V,width:172.32,height:61})}),(0,T.tZ)(ed,{setTab:d,tab:t})]})]})]})}},84410:function(e,r,n){n.d(r,{w:function(){return p}});var t=n(55637),o=n(25887),i=n(14553),a=n(99717),l=n(21526),c=n(39036),s=n(89771),d=n(11461),u=n(62940),p=(0,s.Pi)(function(e){var r=e.error,n=e.open,s=e.handleClose,p=(0,d.$G)().t;return(0,u.tZ)(t.u,{open:n,onClose:s,css:(0,l.iv)({".MuiModal-backdrop":{background:"transparent"}}),showCloseButton:!0,children:(0,u.BX)("div",{className:"px-4 pt-4 mt-4 w-fit mx-auto",children:[(0,u.BX)("div",{className:"text-center",children:[(0,u.tZ)(i.Z,{width:80,height:80,color:"red"}),(0,u.tZ)(c.Z,{className:"font-bold",variant:"h4",color:"primary.black",component:"p",children:p((0,o.errToDefaultI18nKey)(r))})]}),(0,u.tZ)("div",{className:"mt-4 flex flex-col",children:(0,u.tZ)(a.Z,{variant:"contained",onClick:s,className:"mt-4",children:p("login-popup.confirm")})})]})})})},63701:function(e,r,n){n.d(r,{u:function(){return NavigateBackBtn}});var t=n(35043),o=n(78011),i=n(27719),a=n(39036);n(44194);var l=n(11461),c=n(62940),NavigateBackBtn=function(e){var r=e.onClick,n=(0,l.$G)().t,s=(0,o.Z)();return(0,c.BX)(i.Z,{className:"inset-0 absolute h-4 w-fit p-0",style:{color:s.palette.primary.darkGray},onClick:r,children:[(0,c.tZ)(t.Z,{}),(0,c.tZ)(a.Z,{variant:"caption",color:"primary.darkGray",children:n("login-popup.back")})]})}},55637:function(e,r,n){n.d(r,{u:function(){return k}});var t=n(84302),o=n(24231),i=n(84239),a=n(79804),l=n(23079),c=n(4609),s=n(78011),d=n(21526),u=n(18726),p=n(60237),f=n(65440),g=n(89771),h=n(1597);n(44194);var m=n(11461),v=n(62940),b=["children","header","footer","width","showCloseButton","onClose","disableClickOutside","padding","divider","showScrollBar"];function ownKeys(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);r&&(t=t.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),n.push.apply(n,t)}return n}function _objectSpread(e){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};
1r%2?ownKeys(Object(n),!0).forEach(function(r){(0,t.Z)(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ownKeys(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var w={CloseButtonSizeInPx:24},k=(0,g.Pi)(function(e){var r,n,t,g,k,x,Z=e.children,y=e.header,C=e.footer,P=e.width,N=e.showCloseButton,L=e.onClose,O=e.disableClickOutside,I=e.padding,_=void 0===I?"32px":I,B=e.divider,S=e.showScrollBar,E=(0,o.Z)(e,b),j=(0,h.useRouter)(),M=(0,m.$G)().t,X=(0,s.Z)().palette,G=(0,i.CL)(),A=(0,d.iv)({".MuiDialog-container>.MuiPaper-root":{color:null===(r=X.feature)||void 0===r?void 0:r.reader.day.color,backgroundColor:null===(n=X.feature)||void 0===n?void 0:n.reader.day.backgroundColor}});return j.pathname.includes("/reader")&&(G.themeMode===a.v.NIGHT&&(A=(0,d.iv)({".MuiDialog-container>.MuiPaper-root":{color:null===(t=X.feature)||void 0===t?void 0:t.reader.night.color,backgroundColor:null===(g=X.feature)||void 0===g?void 0:g.reader.night.backgroundColor}})),G.themeMode===a.v.WARM&&(A=(0,d.iv)({".MuiDialog-container>.MuiPaper-root":{color:null===(k=X.feature)||void 0===k?void 0:k.reader.warm.color,backgroundColor:null===(x=X.feature)||void 0===x?void 0:x.reader.warm.backgroundColor}}))),(0,v.BX)(u.Z,_objectSpread(_objectSpread({css:(0,d.iv)([{".MuiDialog-container>.MuiPaper-root":{borderRadius:E.fullScreen?void 0:"16px",overflow:"hidden",position:"relative",width:"100%",maxWidth:P}},A])},E),{},{onClose:O?void 0:L,children:[N&&!y?(0,v.tZ)(p.Z,{"aria-label":M("common.close"),onClick:L,className:"absolute right-4 top-4",children:(0,v.tZ)(c.Z,{width:w.CloseButtonSizeInPx,height:w.CloseButtonSizeInPx})}):null,y?(0,v.BX)("div",{className:"relative",style:{padding:_},children:[(0,v.tZ)("div",{children:y}),N&&(0,v.tZ)(p.Z,{"aria-label":M("common.close"),onClick:L,css:(0,d.iv)({position:"absolute",right:"calc(".concat("number"==typeof _?"".concat(_,"px"):_," - 8px)"),top:"calc(".concat("number"==typeof _?"".concat(_,"px"):_," - 8px)"),zIndex:3}),children:(0,v.tZ)(c.Z,{width:w.CloseButtonSizeInPx,height:w.CloseButtonSizeInPx})})]}):null,B&&(0,v.tZ)(f.Z,{className:"bg-ci-lighter-gray"}),(0,v.tZ)("div",{css:!S&&l.K,className:"tablet:max-h-[80vh] overflow-x-scroll pb-5 MpDialog-content pt-1",style:{paddingLeft:_,paddingRight:_},children:Z}),C?(0,v.tZ)("div",{css:(0,d.iv)({paddingBottom:_}),children:C}):null]}))})},38033:function(e,r,n){n.d(r,{y:function(){return useForgetPassword}});var t=(0,n(84315).LO)({}),clearState=function(){for(var e in t)t[e]=void 0},useForgetPassword=function(){return{forgetPasswordCredential:t,setForgetPasswordCredential:function(e){if(clearState(),e)for(var r in e)t[r]=e[r]},clearForgetPasswordCredential:function(){clearState()}}}},46918:function(e,r,n){n.d(r,{U:function(){return generateCodeVerifier},t:function(){return u}});var t,o,i=n(30179),a=n(76880),l=n.n(a),c=n(33461),s=n(41165),generateCodeVerifier=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:43,r=new Uint8Array(e);return crypto.getRandomValues(r),Array.from(r,function(e){return e.toString(16).padStart(2,"0")}).join("").slice(0,e)},d=(t=(0,i.Z)(l().mark(function _callee(e){var r,n;return l().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return r=new TextEncoder().encode(e),t.next=4,crypto.subtle.digest("SHA-256",r);case 4:return n=t.sent,t.abrupt("return",btoa(Array.from(new Uint8Array(n),function(e){return String.fromCharCode(e)}).join("")));case 6:case"end":return t.stop()}},_callee)})),function(e){return t.apply(this,arguments)}),u=(o=(0,i.Z)(l().mark(function _callee2(){var e,r,n,t,o;return l().wrap(function(i){for(;;)switch(i.prev=i.next){case 0:return e="".concat(window.location.origin,"/callback/sns-callback/facebook-login-callback"),r=(0,s.hk)({providerAction:s.xv.FacebookLogin,originURL:window.location.href}),n=generateCodeVerifier(),i.next=5,d(n);case 5:return t=i.sent,o=generateCodeVerifier(16),sessionStorage.setItem("code_verifier",n),sessionStorage.setItem("oauth_nonce",o),i.abrupt("return","https://limited.facebook.com/v16.0/dialog/oauth?client_id=".concat(c.m.facebookAppId,"&redirect_uri=").concat(e,"&state=").concat(r,"&scope=openid&response_type=id_token&code_challenge_method=S256&code_challenge=").concat(t,"&nonce=").concat(o));case 10:case"end":return i.stop()}},_callee2)}
1)),function(){return o.apply(this,arguments)})}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.