"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1902],{3427:(e,t,r)=>{r.d(t,{O:()=>S});var a=r(94075),n=r(62094),o=r(70571),c=r(51565);let i=e=>{var t,r;if(e&&(/^(https?:\/\/)?((?:[a-z0-9-]+\.)+)?tf1\.fr/i.test(e)||(null!=(r=null==(t=(0,c.z)().partners)?void 0:t.postLoginRedirectWhiteList)?r:[]).includes(e)))return e};var l=r(24673),s=r(12998),u=r(92035),d=r(71669),v=r(68888),f=r(53726),h=r(25937),p=r(36244),g=r(99863),m=r(58320),y=r(18387),C=r(28949),T=r(78949),E=r(48301),I=r(80153),R=r(52500);let A=(0,R.createServerReference)("403b05a99dd02fcb978af3064920b182b73144b2ec",R.callServer,void 0,R.findSourceMapURL,"redirectToExternalUrlAction");var w=r(13205),b=r(17600);let S=e=>{var t;let{isKnownUser:r,children:c}=e,R=(0,o.use)(d.E),S=(0,v.c)(),N=(0,n.usePathname)(),{lang:k}=(0,n.useParams)(),{notify:P}=(0,o.useContext)(w.V2),[O,U]=(0,o.useState)(b.Q.accountInfo),[_,L]=(0,o.useState)(b.Q.authentActivated),[F,x]=(0,o.useState)(b.Q.termsAndConditions),[D,G]=(0,o.useState)(r),[H,M]=(0,o.useState)(!D||b.Q.hasChecked),[B,Q]=(0,o.useState)(!D||b.Q.hasChecked),[$,K]=(0,o.useState)(b.Q.isGigyaConnected),[V,W]=(0,o.useState)(b.Q.isConnected),[Y,j]=(0,o.useState)(b.Q.socialMediaUsed),z=(0,o.useCallback)(async e=>{var t,r,a,n,o,c,i,d,v,g,y,C,E,I,R;let{errorCode:A,regToken:w,loginID:b,isNewUser:N,email:k,firstName:P,lastName:O,gender:_,birthDay:L,birthMonth:F,birthYear:x,zip:D,city:G,country:H}=e;if(A===u.R$.ACCOUNT_PENDING_VERIFICATION){let r=null==(t=e.profile)?void 0:t.email;if(!r)try{r=JSON.parse(e.unverifiedEmail)[0]}catch(e){T.R.error(e,{tags:{type:m.By.AUTH}})()}return S.replace("".concat(l.Ay.get("CONFIRMATION"),"?email=").concat(r,"®Token=").concat(w)),e}if(A===u.R$.ACCOUNT_PENDING_REGISTRATION||N){let t=s.NJ(e);U({...t,profile:null!=(C=t.profile)?C:{email:k,gender:_,firstName:P,lastName:O,birthDay:L,birthMonth:F,birthYear:x,zip:D,city:G,country:H}}),(0,f.u)((0,h.bu)(t));let u=!!(null==(n=e.preferences)||null==(a=n.privacy)||null==(r=a.privacyTF1)?void 0:r.isConsentGranted)||!!(null==(c=e.preferences)||null==(o=c["privacy.privacyTF1"])?void 0:o.isConsentGranted),p=!!(null==(v=e.preferences)||null==(d=v.terms)||null==(i=d.termsTF1)?void 0:i.isConsentGranted)||!!(null==(y=e.preferences)||null==(g=y["terms.termsTF1"])?void 0:g.isConsentGranted);return!e.isRegistered||u&&p?S.replace("".concat(l.Ay.get("REGISTRATION_2"),"?regToken=").concat(w)):S.replace("".concat(l.Ay.get("AUTH_RECONSENT"),"?regToken=").concat(w,"&hasPrivacyConsent=").concat(u,"&hasTermsConsent=").concat(p,"&email=").concat(null==(E=e.profile)?void 0:E.email)),e}if(A===u.R$.LOGIN_IDENTIFIER_EXISTS&&w){let{conflictingAccount:{loginProviders:t}}=await u.cd.getConflictingAccount({regToken:w});if(t.find(e=>e===m.sH.SITE))return S.replace("".concat(l.Ay.get("LINK_ACCOUNTS"),"?regToken=").concat(w,"&loginID=").concat(b)),e;let r=new URLSearchParams(location.search);return t[0]&&et({provider:t[0],regToken:w},{redirectPath:null!=(I=r.get("redirectPath"))?I:l.Ay.get("HOME"),authSucessRedirectPath:null!=(R=r.get("authSuccessPath"))?R:l.Ay.get("HOME"),loginMode:m.xo.LINK}),e}return A===u.R$.ACCOUNTS_LINKED_SUCCESSFULLY&&w?(await u.cd.finalizeRegistration({regToken:w}),await ee(),(0,f.u)((0,h.hw)({authenticationMode:m.QW.MANUAL})),S.replace(l.Ay.get("LINK_ACCOUNTS_CONFIRM"))):((0,f.u)((0,h.$R)()),(0,f.u)((0,p.iT)(e))),e},[S]),X=(0,o.useCallback)(()=>fetch("".concat(R.auth.activationCheck.url,"?platform=web&version=").concat(R.product.version)).then(e=>e.json()).then(e=>e[0].features.find(e=>"private-calls"===e.name).value).catch(()=>Error("Failed to check auth activation")),[]);(0,I.$$)(async()=>{let e=await X();e instanceof Error||L(e)},y.f||V?null:R.auth.activationCheck.refreshDelay);let J=(0,o.useCallback)(async()=>{fetch("".concat(R.token.endpointPath,"token/revoke"),{method:"POST"}).catch(e=>{T.R.info("Token revoke failed",{contexts:{error:e},tags:{type:m.By.AUTH}})()}),await s.ri().catch(e=>Error(e)),(0,f.u)((0,h.Ub)()),G(!1),U(void 0),K(!1),W(!1),x(b.Q.termsAndConditions)},[]),Z=(0,o.useCallback)(e=>{e.errorCode!==u.R$.UNAUTHORIZED_ERROR_CODE&&(0,f.u)((0,p.iT)(e)),(0,f.u)((0,h.$R)()),s.W6(),G(!1),K(!1),W(!1),U(void 0)},[]),q=(0,o.useCallback)(async()=>{let e=await s.authenticateFromCache();if(e)return{fromCache:!0,accountInfo:e};if(!_)return{error:E.J$.AUTHENTICATION_DISABLED};try{return{fromCache:!1,accountInfo:await s.Ff()}}catch(e){return Z(e),{error:e}}},[_,Z]),ee=(0,o.useCallback)(async()=>{(0,f.u)((0,h.hw)({authenticationType:m.h_.LOGIN,authenticationMode:m.QW.AUTOLOG}));let e=await q();(0,o.startTransition)(()=>{let t=!("error"in e);K(t),G(t)}),"error"in e||((0,o.startTransition)(()=>U(e.accountInfo)),(0,f.u)((0,h.bu)(e.accountInfo)),Promise.resolve(e.fromCache&&R.featureFlag.auth.autologinBackgroundRefresh?s.Ff():e.accountInfo).then(e=>{(0,o.startTransition)(()=>{U(e),x((0,g.Rd)(e)),(0,f.u)((0,h.bu)(e))})}).catch(e=>{J(),T.R.warn("Failed to refresh gigya account info",{contexts:{error:e},tags:{type:m.By.GIGYA}})()}))},[q]);(0,o.useEffect)(()=>{let e=new URLSearchParams(location.search),t=e.get("errorCode"),r=e.get("authSuccessPath"),a=e.get("redirectTo");return t&&+t>0?void z({...Object.fromEntries(e.entries()),errorCode:+t}):t&&0==+t&&!V?void ee():a&&V&&i(a)?void A(a):void(t&&V&&S.push(null!=r?r:l.Ay.get("HOME")))},[ee,z,S,V]);let et=(0,o.useCallback)(async(e,t)=>{try{"provider"in e&&(null==t?void 0:t.loginMode)!==m.xo.LINK&&j((0,C.ZH)(e.provider));let r=new URLSearchParams(location.search);r.set("redirectPath",t.redirectPath),r.set("authSuccessPath",t.authSucessRedirectPath);let a=await s.iD(e,{...t,previousPath:t.redirectPath,redirectUrl:"".concat(N,"?").concat(r.toString())});return U(a),G(!0),K(!0),(0,f.u)((0,h.bu)(a)),(0,f.u)((0,p.fm)()),P({message:"Ravi de vous revoir sur TF1+ !"}),x((0,g.Rd)(a)),a}catch(e){if((0,u.uJ)(e))return z(e);T.R.error("Failed to login",{contexts:{error:e},tags:{type:m.By.GIGYA}})()}},[z,P]),er=(0,o.useCallback)(async(e,t)=>{let r=new URLSearchParams(location.search);try{let a=await s.Hh(e,{from:t.redirectPath,programSlug:r.get("programSlug")||"",serviceType:r.get("serviceType"),lang:k},null==O?void 0:O.profile,null==t?void 0:t.regToken);(0,f.u)((0,h.bu)(a)),(0,f.u)((0,p.QE)()),U(a),G(!0),K(!0),P({message:"Bienvenue sur TF1+ !"})}catch(t){if(t.errorCode===u.R$.ACCOUNT_PENDING_VERIFICATION){var a;return S.push("".concat(l.Ay.get("CONFIRMATION"),"?email=").concat((null==(a=t.profile)?void 0:a.email)||e.email,"®Token=").concat(t.regToken))}return(0,f.u)((0,h.$R)()),t}},[k,null==O?void 0:O.profile,P,S]),ea=(0,o.useCallback)(async()=>{let e=await s.refreshAccountInfo();return U(e),(0,f.u)((0,h.bu)(e)),e},[]),en=(0,o.useCallback)(async e=>{await u.cd.setAccountInfo({preferences:e});let t=await ea();x((0,g.Rd)(t))},[ea]),eo=(0,o.useCallback)(async e=>{await u.cd.resetPassword({loginID:e})},[]),ec=(0,o.useCallback)(async e=>{var t;await u.cd.setAccountInfo({profile:e,removeLoginEmails:(null==O||null==(t=O.profile)?void 0:t.email)||void 0}),await ea()},[null==O||null==(t=O.profile)?void 0:t.email,ea]),ei=(0,o.useCallback)(async e=>{await u.cd.setAccountInfo({data:{lastOptinPartnerUpdated:e}}),await ea()},[ea]);(0,o.useEffect)(()=>{(async()=>{r&&await ee(),(0,o.startTransition)(()=>M(!0)),(0,f.u)((0,h._N)()),X().then(e=>{e instanceof Error||((0,o.startTransition)(()=>L(e)),(0,f.u)((0,h.mF)(e)))})})()},[ee,X,r]);let el=(0,o.useMemo)(()=>({accountInfo:O,authentActivated:_,termsAndConditions:F,hasGigyaChecked:H,hasChecked:B,isKnownUser:D,isGigyaConnected:$,isConnected:V,socialMediaUsed:Y,autologin:ee,login:et,logout:J,refreshAccountInfo:ea,sendResetPasswordEmail:eo,signUp:er,updatePreferences:en,updateProfile:ec,updateLastOptinPartner:ei,setHasChecked:Q,setIsConnected:W}),[O,_,F,H,B,D,$,V,Y,ee,et,J,ea,eo,er,en,ec,ei]);return(0,a.jsx)(b.c.Provider,{value:el,children:c})}},5143:(e,t,r)=>{r.d(t,{A:()=>i,Y:()=>l});var a=r(94075),n=r(17725),o=r(70571),c=r(66075);let i=(0,o.createContext)(void 0);i.displayName="DeviceContext";let l=e=>{let t,r,l,s=(0,n.c)(5),{children:u}=e,[d,v]=(0,o.useState)();return s[0]===Symbol.for("react.memo_cache_sentinel")?(t=()=>{(0,o.startTransition)(()=>v((0,c.VK)().device))},r=[],s[0]=t,s[1]=r):(t=s[0],r=s[1]),(0,o.useEffect)(t,r),s[2]!==u||s[3]!==d?(l=(0,a.jsx)(i.Provider,{value:d,children:u}),s[2]=u,s[3]=d,s[4]=l):l=s[4],l}},16665:(e,t,r)=>{r.d(t,{X:()=>o});var a=r(79494),n=r(78949);let o=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{FallbackComponent:()=>null,onError:e=>n.R.error(e,{contexts:{error:e},tags:{errorBoundary:!0}})()};return(0,a.Xc)(e,t)}},21681:(e,t,r)=>{r.d(t,{O:()=>i});var a=r(70571),n=r(53726),o=r(44952),c=r(66075);let i=(0,r(16665).X)(()=>((0,a.useEffect)(()=>{let e=()=>{let e=(0,c.mb)((0,c.VK)().device);(0,n.u)((0,o.c)(e))};return e(),window.addEventListener("resize",e,{passive:!0}),()=>window.removeEventListener("resize",e)},[]),null))},29276:(e,t,r)=>{r.d(t,{D:()=>y});var a=r(94075),n=r(62094),o=r(19419),c=r(70571),i=r(80050),l=r(71669),s=r(53726),u=r(19549),d=r(41397),v=r(58320),f=r(78349),h=r(78949),p=r(29004),g=r(16665);let m=!1,y=(0,g.X)(()=>{var e,t;let r=(0,c.use)(l.E),g=(0,c.useContext)(p.c),y=(0,n.usePathname)(),C=(0,f.r)(y),T=g.status===v.PI.READY&&g.purposesAccepted.includes(i.Tq.AUDIENCE_MEASUREMENT),{abtasty:E,tagco:I,ipify:R}=r.thirdparty,A=E.enabled&&E.url&&T,w=R.enabled&&R.url&&T;return(0,c.useEffect)(()=>{var e,t,a;let n={environment:r.global.hostEnv,referer:null==(e=window.document)?void 0:e.referrer,productVersion:null==(t=r.product)?void 0:t.version,playerVersion:null==(a=r.player)?void 0:a.env.version};if(g.status!==v.PI.LOADING){if(g.status===v.PI.ERROR||g.status===v.PI.DISABLED||!w)return void(0,s.u)((0,u.sx)(n));w&&!m&&fetch(R.url).then(e=>e.text()).then(e=>{m=!0,(0,s.u)((0,u.sx)({...n,userIp:e}))}).catch(e=>{(0,s.u)((0,u.sx)(n)),h.R.warn("Failed to load Ipify script",{contexts:{error:e},tags:{type:v.By.THIRDPARTY}})()})}},[r.global.hostEnv,null==(e=r.player)?void 0:e.env.version,null==(t=r.product)?void 0:t.version,r.thirdparty.ipify,g.status,T,R.url,w]),(0,a.jsxs)(a.Fragment,{children:[A&&(0,a.jsx)(o.default,{strategy:"lazyOnload",src:E.url,onError:e=>{h.R.warn("Failed to load AB Tasty script",{contexts:{error:e},tags:{type:v.By.THIRDPARTY}})()}}),I.enabled&&(0,a.jsx)(o.default,{src:C?I.embedUrl:I.url,onLoad:()=>{(0,s.u)((0,d.O)())},onError:e=>{h.R.warn("Failed to load TMS scripts",{contexts:{error:e},tags:{type:v.By.THIRDPARTY}})()}})]})})},66075:(e,t,r)=>{r.d(t,{Kd:()=>d,VK:()=>s,mb:()=>c});var a=r(70571),n=r(25121),o=r(18387);let c=e=>({...e,device:{...e.device,type:i(e.device.type)},os:{...e.os,name:l(e.os.name)}}),i=e=>{switch(e){case"mobile":case"tablet":return e;case"wearable":case"embedded":return"mobile";default:return"desktop"}},l=e=>e?e.toLowerCase():"unknown",s=()=>{let e=function(){if(o.f)return;let e=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,t=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight;return{width:e,height:t,orientation:e>t?"landscape":"portrait"}}();return{device:c({...new n.UAParser(o.f?void 0:navigator.userAgent).getResult(),screen:e})}};var u=function(e){return e.SLOW_2G="slow-2g",e["2G"]="2g",e["3G"]="3g",e["4G"]="4g",e}(u||{});let d=()=>{let[e,t]=(0,a.useState)(!1);return(0,a.useEffect)(()=>{var e;let r=(null==(e=navigator)?void 0:e.connection)||null,a=null==r?void 0:r.effectiveType;t("slow-2g"===a||"2g"===a||"3g"===a)},[]),e}},68888:(e,t,r)=>{r.d(t,{c:()=>s});var a=r(17725),n=r(62094),o=r(96660),c=r(70571),i=r(86577),l=r(71669);let s=()=>{let e,t,r,s,u=(0,a.c)(14),{lang:d}=(0,n.useParams)(),v=(0,c.use)(l.E),{push:f,replace:h,back:p}=(0,o.ou)(),g=d===i.X?"":"/".concat(d);return u[0]!==v||u[1]!==g||u[2]!==f?(e=e=>{let t=e.split("/")[1];return f(v.country.locales.some(e=>e===t)?e:"".concat(g).concat(e))},u[0]=v,u[1]=g,u[2]=f,u[3]=e):e=u[3],u[4]!==v||u[5]!==g||u[6]!==h?(t=e=>{let t=e.split("/")[1];return h(v.country.locales.some(e=>e===t)?e:"".concat(g).concat(e))},u[4]=v,u[5]=g,u[6]=h,u[7]=t):t=u[7],u[8]!==p?(r=()=>p(),u[8]=p,u[9]=r):r=u[9],u[10]!==e||u[11]!==t||u[12]!==r?(s={push:e,replace:t,back:r},u[10]=e,u[11]=t,u[12]=r,u[13]=s):s=u[13],s}}}]);