Loading
function(e,t,n){n.d(t,{x:()=>P});var l=n(284009),i=n.n(l),r=n(976634),a=n(446044),s=n(426398),o=n(211083),u=n(463376),c=n(21713),d=n(6938),p=n(61299),m=n(174459),h=n(723702),C=n(937008),A=n(166532),E=n(566980),f=n(615310),y=n(652215),S=n(202541);function P(e){let{analyticsData:t,initialPlanId:n,breadcrumbSteps:l,handleStepChange:P,onReturn:T,continueSessionToInitialStep:I}=e,{paymentSources:_}=(0,s.jm)(),{selectedSkuId:g,setPurchaseState:x,contextMetadata:v,paymentSourceId:N,setPaymentSourceId:b,purchaseError:R,setPurchaseError:M,activeSubscription:j}=(0,d.t4)(e=>({selectedSkuId:e.selectedSkuId,setPurchaseState:e.setPurchaseState,contextMetadata:e.contextMetadata,paymentSourceId:e.paymentSourceId,setPaymentSourceId:e.setPaymentSourceId,purchaseError:e.purchaseError,setPurchaseError:e.setPurchaseError,activeSubscription:e.activeSubscription})),{purchaseErrorBlockRef:O}=(0,c.Gm)(),{paymentAuthenticationState:L}=(0,o.o)(),{enabled:w}=(0,a.Y)({location:"PaymentModalAddPaymentStep"}),{isPremiumGroupPurchase:k,isEligibleForTrial:D}=(0,u.i)(),{step:U,previousStep:G}=(0,f.Ay)(),{isGift:F}=(0,C.Pv)(),B={...(0,p._V)(),paymentSources:_,paymentSourceId:N,setPaymentSourceId:b,purchaseError:R,setPurchaseError:M,purchaseErrorBlockRef:O,paymentAuthenticationState:L,selectedSkuId:g,isGift:F},Y=T??function(){P(Object.values(_).length<1&&null==n?A.pn.PLAN_SELECT:A.pn.REVIEW,{trackedFromStep:w?A.pn.PAYMENT_ELEMENT:A.pn.PAYMENT_TYPE})};i()(U,"Step should be set here");let H=(0,r.A)(()=>Date.now(),[U]),W=(0,r.A)(()=>null!=I&&null==G?w?A.pn.PAYMENT_ELEMENT:I:w?A.pn.PAYMENT_ELEMENT:A.pn.PAYMENT_TYPE,[I,G,w]);return(0,p.Y)({paymentModalArgs:B,initialStep:W,prependSteps:[A.pn.PROMOTION_INFO],appendSteps:[A.pn.REVIEW,A.pn.CONFIRM],breadcrumpSteps:l,currentBreadcrumpStep:U,usePaymentModalStep:!0,analyticsData:t,onReturn:k?void 0:Y,onComplete:e=>{A.l_.has(e)?(x(E.h.COMPLETED),P(A.pn.CONFIRM,{trackedFromStep:e})):P(A.pn.REVIEW,{trackedFromStep:e})},onStepChange:e=>{let{currentStep:n,toStep:l}=e,i=Date.now();m.default.track(y.HAw.PAYMENT_FLOW_STEP,{...t,from_step:n,to_step:l,step_duration_ms:i-H,flow_duration_ms:i-v.startTime})},isEligibleForTrial:D,allowDesktopRedirectPurchase:(0,h.isDesktop)()&&null!=g&&[S.pe.TIER_0,S.pe.TIER_2].includes(g)&&!F&&null==j,continueSessionToInitialStep:I,shouldUseManaModal:!0})}}