1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[401],{6337:function(e,r,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/login/facebook/callback",function(){return t(161)}])},161:function(e,r,t){"use strict";t.r(r),t.d(r,{default:function(){return FacebookCallback}});var o=t(7458),c=t(8440),n=t(6605);function FacebookCallback(){let{loading:e}=(0,c.Z)("Facebook");return e?(0,o.jsx)(n.Z,{className:"w-6 h-6 text-white sm:w-8 sm:h-8",delay:1e3}):(0,o.jsx)(o.Fragment,{})}FacebookCallback.getLayout=function(e){return(0,o.jsx)("div",{className:"flex justify-center w-full h-screen pt-6 bg-standardBg",children:e})}},8440:function(e,r,t){"use strict";t.d(r,{Z:function(){return useOauthCallback}});var o=t(2983),c=t(3833),n=t(9208),a=t(6379),u=t(4885),i=t(7525),l=t(8412);let s={loading:!0,error:void 0,failCode:void 0,userData:void 0,returnUrl:void 0},reducer=function(e,r){switch(r.type){case"failure":return{...e,loading:!1,failCode:r.failCode,error:r.error};case"success":return{...e,loading:!1,userData:r.userData,returnUrl:r.returnUrl};default:throw Error("Unexpected auth code reducer action: ".concat(JSON.stringify(r)))}};var d=t(8828),f=t(9975),gtm_gtm_login=e=>{(0,f.H)("login",{social_account_provider:e})};function useOauthCallback(e){let r=(0,d.Hs)(),{userData:t,returnUrl:f,error:p,loading:h,failCode:_}=function(e){var r,t;let d=(r=(0,o.useRef)(!1),t=(0,o.useCallback)(function(){return r.current},[]),(0,o.useEffect)(function(){return r.current=!0,function(){r.current=!1}},[]),t),[{userData:f,loading:p,error:h,returnUrl:_,failCode:C},U]=(0,o.useReducer)(reducer,s),g=(0,o.useCallback)(e=>{d()&&U(e)},[U,d]),{isReady:v,query:w,asPath:m}=(0,c.useRouter)();return(0,o.useEffect)(()=>{if(v&&v&&w&&m){let{code:r,returnUrl:t,failCode:o,error:c}=(0,a.PK)(w,"Facebook"===e?m:void 0);o&&g({type:"failure",failCode:o,error:c}),(async()=>{try{let o=(0,i.bd)(w,e),c=await (0,i.yx)({authCode:r,platform:o,clientType:"Shop"});if((0,i.wA)(c)){let e=(0,n.xL)(c,o);if(!e){g({type:"failure",failCode:u.AK.Default,error:Error("storeSocialAccount: Could not store user data: ".concat(c))});return}g({type:"success",userData:c,returnUrl:t});return}if((0,i.nj)(c)){g({type:"failure",failCode:c,error:Error("FetchCosAuthFromPlatform: FailResponse received")});return}g({type:"failure",failCode:u.AK.Default,error:Error("FetchCosAuthFromPlatform: Unexpected FailResponse")})}catch(e){(0,l.u)(e),g({type:"failure",failCode:u.AK.Default,error:e})}})()}},[v,w,e,g,m]),{userData:f,loading:p,error:h,returnUrl:_,failCode:C}}(e);return(0,o.useEffect)(()=>{(p||_)&&((0,n.$Y)(),r({type:"oauth-error",error:p,failCode:_})),t&&f&&!p&&!_&&(gtm_gtm_login(e),(0,n.$Y)(),window.location.replace(f))},[t,p,f,r,_,e]),{loading:h}}},6379:function(e,r,t){"use strict";t.d(r,{OS:function(){return constructAuthCodeUrl},PK:function(){return parseAuthRedirectUriParams}}),t(2649);var o=t(1847),c=t(8412),n=t(4885),a=t(331),u=t(9208);let getAuthorizationServerUrls=()=>{let[e,r,t,c]=(0,o.$u)({NEXT_PUBLIC_OAUTH_AUTH_SERVER_URI_TWITCH:"https://id.twitch.tv/oauth2/authorize",NEXT_PUBLIC_OAUTH_AUTH_SERVER_URI_FACEBOOK:"https://www.facebook.com/v8.0/dialog/oauth",NEXT_PUBLIC_OAUTH_AUTH_SERVER_URI_GOOGLE:"https://accounts.google.com/o/oauth2/v2/auth",NEXT_PUBLIC_OAUTH_AUTH_SERVER_URI_APPLE:"https://appleid.apple.com/auth/authorize"});return{Twitch:e,Facebook:r,Google:t,Apple:c}},getAuthorizationServerUrl=e=>getAuthorizationServerUrls()[e],i={Twitch:"openid",Facebook:"openid",Google:"openid profile email",Apple:"openid"},getEncodedScopes=(e,r)=>{if("Google"===e&&"Youtube"===r){let r=i[e]+" ",t=encodeURIComponent(r);return t+"https://www.googleapis.com/auth/youtube.readonly"}return encodeURIComponent(i[e])},constructAuthCodeUrl=(e,r)=>{let t=getAuthorizationServerUrl(e.provider),o="".concat(e.cosBaseUrl,"/login/").concat(e.provider.toLowerCase(),"/callback"),c=getEncodedScopes(e.provider,r),n="Facebook"===e.provider?"token":"code";return"".concat(t,"?\n response_type=").concat(n,"&\n client_id=").concat(e.clientId,"&\n redirect_uri=").concat(o,"&\n scope=").concat(c,"\n ").concat("Google"===e.provider?"&access_type=offline&prompt=consent":"","\n ").concat("Facebook"!==e.provider?"&state=".concat(e.state):"","\n ").replace(/\s/g,"")},parseAuthRedirectUriParams=(e,r)=>{let t,o,i;try{o=(0,u.QI)()}catch(e){(0,c.u)(e),t=n.Fx.StateLoadFailed}if(!o)return t=n.Fx.StateLoadFailed,{code:void 0,error:e.error,returnUrl:i,failCode:t};if(r){let e=r.split("#")[1],u=new URLSearchParams(e),l=u.get("access_token");l||(t=n.Fx.Unexpected);try{i=(0,a.Ru)(o).returnUrl}catch(e){(0,c.u)(e),t=n.Fx.StateDecodeFailed}return{code:l,error:void 0,returnUrl:i,failCode:t}}if(!e.hasOwnProperty("code")||!e.hasOwnProperty("state")||""===e.code)return e.hasOwnProperty("error")&&"access_de
1nied"===e.error||(t=n.Fx.Unexpected),"access_denied"===e.error&&(t=n.Fx.AccessDenied),e.hasOwnProperty("state")||(t=n.Fx.NoEchoedState),(0,c.u)(e.error),{code:void 0,error:e.error,returnUrl:i,failCode:t};if(e.state!==o)t=n.Fx.StateMismatch;else try{i=(0,a.Ru)(e.state).returnUrl}catch(e){(0,c.u)(e),t=n.Fx.StateDecodeFailed}return{code:e.code,error:e.error,returnUrl:i,failCode:t}}},6605:function(e,r,t){"use strict";t.d(r,{Z:function(){return internal_Spinner}});var o=t(7458),c=t(2983),updateReducer=function(e){return(e+1)%1e6},internal_Spinner=e=>{var r,t,n,a,u,i,l,s,d;let{className:f="w-5 h-5",delay:p=0}=e,[h]=(void 0===(r=p)&&(r=0),t=(0,c.useReducer)(updateReducer,0)[1],void 0===(n=r)&&(n=0),a=(0,c.useRef)(!1),u=(0,c.useRef)(),i=(0,c.useRef)(t),l=(0,c.useCallback)(function(){return a.current},[]),s=(0,c.useCallback)(function(){a.current=!1,u.current&&clearTimeout(u.current),u.current=setTimeout(function(){a.current=!0,i.current()},n)},[n]),d=(0,c.useCallback)(function(){a.current=null,u.current&&clearTimeout(u.current)},[]),(0,c.useEffect)(function(){i.current=t},[t]),(0,c.useEffect)(function(){return s(),d},[n]),[l,d,s]);return h()?(0,o.jsxs)("svg",{className:"animate-spin ".concat(f),xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[(0,o.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,o.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}):null}}},function(e){e.O(0,[774,888,179],function(){return e(e.s=6337)}),_N_E=e.O()}]);
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.