Loading
function(e,t,n){"use strict";n.d(t,{Ke:()=>y,Ro:()=>_,X1:()=>v});var l=n(627968);n(64700);var i=n(284009),s=n.n(i),r=n(17928),a=n(403581),o=n(10716),u=n(688810),c=n(20015),d=n(364995),m=n(31823),h=n(426398),p=n(558620),f=n(211159),g=n(428262),E=n(615396),A=n(652215),C=n(818348),x=n(375708),I=n(327105);function _(e){let{purchaseType:t,plan:n,premiumSubscription:l,productLine:i,isGift:r,planGroup:a,isPrepaidPaymentSource:o,paymentSourceId:u,hasPaymentSources:c,willRelocateStoreCountry:d}=e;if(null===u&&c)return x.intl.string(x.t.CpOiEO);if(d)return x.intl.string(I.default["7r4HPu"]);if(t===C.VV.ONE_TIME)return r?x.intl.string(x.t.ouo4FK):x.intl.string(x.t.ExD0Ng);if(s()(null!=n,"Subscription plan must be selected to render PaymentModalReviewButton"),i===A.EZt.BOOST)return x.intl.string(x.t.eUEeCt);if(r)return x.intl.string(x.t.ouo4FK);if((0,g.ys)(n.id))return o?x.intl.string(x.t.cRCCJ3):null!=l?l.isPausedAllowsResumeButNotUpdates?x.intl.string(x.t.zpi5pg):(0,E.Ge)(l,n.id,a)?x.intl.string(x.t.IJI7yk):x.intl.string(x.t.VPuTc5):(0,g.ff)(null,n);return x.intl.string(x.t.YScQSF)}function S(e,t){null!=e.current&&(e.current.scrollIntoView({behavior:"smooth"}),t())}function y(e){let{premiumSubscription:t,isGift:n,planGroup:l,isPrepaid:i}=e,{checkoutPaymentSources:s}=(0,d.t)(),{hasAcceptedTerms:a,paymentSourceId:c,purchaseType:g,activeSubscription:E}=(0,f.t4)(e=>({hasAcceptedTerms:e.hasAcceptedTerms,paymentSourceId:e.paymentSourceId,purchaseType:e.purchaseType,activeSubscription:e.activeSubscription})),{hasPaymentSources:A}=(0,h.jm)(),{application:C}=(0,m.V)(),x=(0,r.bG)([o.A],()=>o.A.getFetchState()),I=(0,p.A)(),S=null!=c&&s.some(e=>e.id===c&&null!=e.relocationCountry),y=_({purchaseType:g,plan:I,premiumSubscription:t,isGift:n,planGroup:l,isPrepaidPaymentSource:i,paymentSourceId:c,hasPaymentSources:A,willRelocateStoreCountry:S}),{analyticsLocations:v}=(0,u.Ay)();return{buttonLabel:y,analyticsLocations:v,hasAcceptedTerms:a,application:C,paymentSourceId:c,activeSubscription:E,devShelfFetchState:x,hasPaymentSources:A}}function v(e,t){let{invoiceError:n,planError:i,disablePurchase:s,needsPaymentSource:r,onPaymentSourceAdd:u,isTrial:d,makePurchase:m,legalTermsNodeRef:h,flashLegalTerms:p,isSubmitting:f}=e,{buttonLabel:g,hasAcceptedTerms:E,application:C,devShelfFetchState:I,hasPaymentSources:_}=t;if(null!=n||null!=i||s)return{variant:"active",text:g,disabled:!0};if(r&&_)return{text:g,tooltipText:x.intl.string(x.t.L7jbQV),variant:"primary",type:"submit",dataTestId:"submitButton",onClick:u};if(r&&!_)return{tooltipText:x.intl.string(x.t.L7jbQV),variant:"active",text:g,type:"submit",dataTestId:"submitButton",disabled:!0};if((0,c.n)(C,A.gfo.EMBEDDED)&&I===o.$.LOADING)return{tooltipText:x.intl.string(x.t.cjA5tj),variant:"active",text:g,type:"submit",dataTestId:"submitButton",disabled:!0};if(d)return{variant:"expressive",text:g,onClick:E?m:()=>S(h,p),loading:f,iconPosition:"start",icon:()=>(0,l.jsx)(a.t,{color:"currentColor"}),dataTestId:E?"purchase":"submitButton"};else if(!E)return{tooltipText:x.intl.string(x.t.XdvBLS),variant:"active",text:g,type:"submit",onClick:()=>S(h,p),dataTestId:"submitButton"};else return{variant:"active",text:g,dataTestId:"purchase",onClick:m,loading:f}}}