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