1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2486],{21061:(e,a,s)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/checkout/masterpass",function(){return s(43586)}])},43586:(e,a,s)=>{"use strict";s.r(a),s.d(a,{__N_SSP:()=>E,default:()=>T});var t=s(60),r=s(68080),n=s(69807),o=s(13084),c=s.n(o),i=s(84144),l=s(85859),p=s(71979),u=s.n(p),h=s(80080),d=s(4708),m=s(19610),y=s(70851),k=s(94494),_=s(55281),w=s(60201),g=s(96397),C=s(37680),S=s(50985),j=s(30793),b=s(83964),f=s(29273),P=s(36250),x=s(97763),N=s(46084),L=s(43843),E=!0;let T=e=>{let{notificationDispatch:a}=(0,P.dq)(),{authState:s}=(0,f.Z2)(),o=e.isUserLoggedIn,p=(0,l.useRouter)(),{t:E}=(0,i.A)(),[T,v]=(0,h.useState)(o?2:3),[I,q]=(0,h.useState)(+("show"!==e.query.compare)),[F,O]=(0,h.useState)(e.isShowLogin),[M,U]=(0,h.useState)(e.hasPlanCode),[A,D]=(0,h.useState)(!1),[R,$]=(0,h.useState)(!1),[H,J]=(0,h.useState)(!0),[B,z]=(0,h.useState)(!1),[X,Z]=(0,h.useState)(e.plan),[G,K]=(0,h.useState)(E("checkout:steps.registration")),[Q,V]=(0,h.useState)(),W=(0,h.useRef)(T),Y=(e,s,t)=>{a((0,x.Fp)({type:e,title:s,message:t,isHTML:!1,isShow:!0}))},ee=a=>{switch(a){case 1:if(2===T&&1===a){(0,y.rJ)(e.plan.price,p.pathname,"masterpass"),(0,y.rJ)(e.plan.price,p.pathname,"yearly"===X.category?"yearly":"masterpass"),N.N.track("Checkout Masterpass Payment",{product:e.hasPlanCode?"masterpass trial":e.plan.product_name.toLowerCase()}),ei("2"),ei("3"),K(E("checkout:steps.payment"));break}N.N.track("Checkout Login",{product:e.hasPlanCode?"masterpass trial":e.plan.product_name.toLowerCase(),product_type:"subscription_plans"}),ei("2"),K(E("checkout:steps.registration"));break;case 2:if(2===T&&2===a){N.N.track("Checkout Masterpass Success",{product:e.hasPlanCode?"masterpass trial":e.plan.product_name.toLowerCase()}),ei("4"),K(E("checkout:steps.finished"));break}N.N.track("Checkout Masterpass Payment",{product:e.hasPlanCode?"masterpass trial":e.plan.product_name.toLowerCase()}),(0,y.rJ)(e.plan.price,p.pathname,"masterpass"),ei("3"),K(E("checkout:steps.payment"));break;case 3:ei("4"),N.N.track("Checkout Masterpass Success",{product:e.hasPlanCode?"masterpass trial":e.plan.product_name.toLowerCase()}),K(E("checkout:steps.finished"));break;default:K(E("checkout:step.selection"))}q(a)},ea=async e=>{null!==e.payment.payment_id&&await (0,y.z7)(e.order,"masterpass",s.email,X?.category==="yearly"),es(e),V(e)},es=async e=>{B&&await (0,y.EF)("Purchase",X,e.payment,"subscription"),ee(3===T?3:2)},et=e=>!!e&&(Y("error","",E("checkout:course.already_has_masterpass")),!0),er=async a=>{let s=(0,r.getCookie)("hidden_plan");if((0,r.deleteCookie)("hidden_plan"),et(a.is_subscribed))return D(!1),u().start(),p.push(`/${p.locale}/`);if(void 0!==s){let a=await en(s);a.success&&!e.hasPlanCode&&(Z(a.data[0]),U(!0),setTimeout(()=>{$(!0)},500))}e.isAuthSuccess?ee(2):ee(3===T?2:1),J(!1)},en=async e=>await (0,m.f5)(e),eo=async()=>{B&&(await (0,y.EF)("AddToCart",e.plan,null,"subscription"),await (0,y.EF)("InitiateCheckout",e.plan,null,"subscription"))},ec=async()=>{let a=e.isCartEmpty;if(!1===o){let e=localStorage.getItem("bundle_cart");a=null===e||0===JSON.parse(e).length}if(!1===a)return u().start(),Y("error","",E("checkout:bundle.error.cart_not_empty")),p.push(`/${p.locale}/masterpass`);if(await eo(),e.hasPlanCode&&(Z(e.plan),U(!1),$(null!==e.plan.promo.title)),o){let a=(0,r.getCookie)("hidden_plan");if((0,r.deleteCookie)("hidden_plan"),v(2),ee(+("show"!==e.query.compare)),void 0===a)return J(!1),!1;let s=await en(a);return s.success&&(Z(s.data[0]),U(!0),$(!0)),ee(+("show"!==e.query.compare)),J(!1),!1}ee(+("show"!==e.query.compare)),J(!1)},ei=a=>{(0,y.OO)(p.pathname,a,e.plan.price,X?.category==="yearly"?"yearly":"masterpass")};return(0,h.useEffect)(()=>{z((0,L.UF)()),!1===A&&(!1===et(e.isSubscribed)?(ei("1"),ec()):(u().start(),p.push(`/${p.locale}/`)),D(!0));let a=()=>{if(u().start(),!new URLSearchParams(window.location.search).get("dialog")){let a=""!==e.req?e.req:`/${p.locale}/masterpass`;return window.location.href=a,!1}let a=(0,r.getCookie)("_auth_access");3===W.current&&a&&v(2),ee(1)};return window.addEventListener("popstate",a),()=>{window.removeEventListener("popstate",a)}},[]),(0,h.useEffect)(()=>{W.current=T},[T]),(0,t.jsxs)(t.Fragment,{children:[H&&(0,t.jsx)(_.D,{size:"800"}
1),!1===H&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(d.m,{children:[(0,t.jsx)("script",{async:!0,src:"https://js.braintreegateway.com/web/3.106.0/js/client.min.js"}),(0,t.jsx)("script",{async:!0,src:"https://js.braintreegateway.com/web/3.106.0/js/hosted-fields.min.js"}),(0,t.jsx)("script",{async:!0,src:"https://pay.google.com/gp/p/js/pay.js"}),(0,t.jsx)("script",{async:!0,src:"https://js.braintreegateway.com/web/3.106.0/js/google-payment.min.js"})]}),!1===A&&(0,t.jsx)(t.Fragment,{}),A&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(k.N,{name:0===I?"":G,stepData:0===I?0:I,allStepData:T}),(0,t.jsxs)("div",{className:"main-container",children:["show"===e.query.compare&&0===I&&(0,t.jsx)(j.n,{course:null,onStepChange:ee,type:"masterpass",isMasterpassCheckout:!0}),1===I&&!1===s.isLoggedIn&&!F&&(0,t.jsx)(C.c,{slug:"masterpass",position:"masterpass",onStepChange:er,isTrial:e.hasPlanCode,handleClick:()=>O(!0)}),1===I&&!1===s.isLoggedIn&&F&&(0,t.jsx)(S.g,{slug:"masterpass",position:"masterpass",onStepChange:er,handleClick:()=>O(!1)}),(2===I&&3===T||1===I&&2===T)&&(0,t.jsx)(w.p,{type:n.c.SUBSCRIPTION,requireBillingAddress:!0,isNeedConfirm:!0,plan:X,isHiddenPlan:M,isTrial:e.isTrialPlan,isShowCoupon:!1,productType:n.c.SUBSCRIPTION,userEmail:s.email,success:ea,allPlans:e.allPlans,isAllowTrack:B,changePlan:a=>{Z(c()(e.allPlans,e=>e.category===a)[0])}}),(3===I&&3===T||2===I&&2===T)&&(0,t.jsx)(b.s,{headline:E("checkout:thank_you.title"),subHeadline:"",cover:X?.cover,description:E("checkout:thank_you.have_fun_streaming"),subDescription:E("checkout:thank_you.your_oder_was_success"),buttonLabel:E("checkout:thank_you.let_go"),handleClick:()=>p.push(`/${p.locale}/kurse`),paymentId:Q?.payment.payment_id,isTrial:e.hasPlanCode})]})]}),R&&(0,t.jsx)(g.U,{isHiddenPlan:!0,planData:X,cover:X?.cover,isOpen:R,handleClose:()=>{$(!1)}})]})]})}}},e=>{e.O(0,[2836,620,8760,3729,5701,7356,7133,7072,8023,8741,5486,793,636,6593,8792],()=>e(e.s=21061)),_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.