Loading
function(e,t,n){"use strict";n.d(t,{X:()=>y});var l=n(627968),i=n(64700),s=n(284009),r=n.n(s),a=n(834730),o=n(17928),u=n(854354),c=n(944355),d=n(211159),m=n(410516),h=n(361597),p=n(736339),f=n(773669),g=n(97352),E=n(252424),A=n(428262),C=n(580630),x=n(788868),I=n(375708),_=n(327105),S=n(556208);let y=e=>{let{selectedPlanId:t,priceOptions:n,planOptions:s,subscriptionPeriodEnd:y,showPlanStatusSubText:v,disabled:T=!1,isInPlanSelectStep:N,headingSubText:j,planPricesLoading:b=!1}=e,{selectedPlan:R,selectedPlanPrice:P,isPrepaid:L,isPlansEligibleForDiscount:M,shouldShowHRKEuroWarning:O,shouldShowTotalInSubscriptionFlow:w,shouldShowTrialOrDiscountLayout:k,userTrialOffer:D,trialPeriodCopy:U,isEligibleForTrial:G,isEligibleForBOGOPromotion:F,premiumSubscriptionPlan:V,thePriceOptions:B,skuId:H}=(0,h.RO)({selectedPlanId:t,priceOptions:n,planOptions:s,subscriptionPeriodEnd:y,showTotal:N}),{shouldShowPremiumSwitchPlanSelectText:W,premiumSwitchPlanSelectText:K}=i.useMemo(()=>{let e=(0,h.U_)(V,{isEligibleForBOGOPromotion:F});return{shouldShowPremiumSwitchPlanSelectText:e,premiumSwitchPlanSelectText:e?(0,h.yq)(V,H):null}},[V,F,H]),Y=i.useMemo(()=>N&&G?(0,h.Ct)(D,{subscriptionPeriodEnd:y,trialPeriodCopy:U}):j,[N,G,D,y,U,j]),z=i.useMemo(()=>s.length>0?x.hd[s[0]].premiumType:void 0,[s]),{setSelectedPlanId:Z}=(0,d.t4)(e=>({setSelectedPlanId:e.setSelectedPlanId})),q=i.useCallback(e=>{Z(e.value)},[Z]),$=((e,t)=>{let{disabled:n,planPricesLoading:l,isEligibleForDiscount:s,priceOptions:a,isEligibleForTrial:c,isEligibleForBOGOPromotion:S,showPlanStatusSubText:y,isInPlanSelectStep:v}=t,{currentPremiumSubscriptionForCheckout:T,isGift:N,discountInfo:j}=(0,d.t4)(e=>({currentPremiumSubscriptionForCheckout:e.isGift?null:e.activeSubscription,isGift:e.isGift,discountInfo:e.premiumDiscountInfo})),b=(0,o.bG)([f.default],()=>f.default.locale),{discountOffer:R,discountAmountOff:P,applicablePlan:L}=j;return i.useMemo(()=>e.map(e=>{let t,i,o,{isCurrentPlan:d,disabled:f}=(0,h.cD)(T,e),j=g.A.get(e);r()(null!=j,"Missing subscriptionPlan");let M=(0,A.L_)({planId:e,isGift:N,priceOptions:a,subscriptionPlan:j}),O=null!=M&&null==R,w=(0,A.y8)(e,!1,N,a),k=(0,p.gS)(T,j,{userLocale:b,isEligibleForBOGOPromotion:S,shouldShowSavingsPercent:O,isGift:N,planId:e,savingsPercent:M}),D=((e,t)=>{let{isEligibleForTrial:n}=t;return n?I.intl.formatToPlainString(I.t.hXcaLT,{price:(0,C.$g)(0,e.currency,{minimumFractionDigits:0,maximumFractionDigits:0})}):(0,C.$g)(e.amount,e.currency)})(w,{isEligibleForTrial:c}),U=D,G=s&&null!=L&&e===L?P:null;null!=R&&!c&&((0,m.p2)(R)?j.interval===x.WT.YEAR?t=I.intl.format(_.default.ODKoJd,{percent:M??""}):j.interval===x.WT.MONTH&&(null!=G&&(U=I.intl.format(I.t.hXcaLT,{price:(0,C.$g)(w.amount-G,w.currency)})),t=I.intl.format(_.default.JsSin7,{priceRate:(0,C.CE)(D,j.interval,j.intervalCount),intervalCount:R.getFullIntervalCount()})):(0,m.hm)(R)&&j.interval===x.WT.YEAR&&null!=G&&(U=I.intl.format(I.t.hXcaLT,{price:(0,C.$g)(w.amount-G,w.currency)}),i=D,t=I.intl.format(I.t.VZ8Tvh,{regularPrice:D}),o=I.intl.formatToPlainString(_.default.nsG1jw,{savingsText:(0,E.l9)(b,parseInt(R.discount.amount)/100)}))),y&&(v&&c?t=(0,p.O7)(j,w):d?t=I.intl.string(I.t.ymSxhy):"string"==typeof k&&(t=k));let F=(e=>{let{promoTextOverride:t,overrideBadgeText:n,defaultValue:l}=e;return t??n??l})({promoTextOverride:o,overrideBadgeText:null!=k&&"object"==typeof k?(k.type,k.text):null,defaultValue:(0,u.Nc)({subscriptionPlan:j,userLocale:b,discountOffer:R,yearlyPercentSavings:M,shouldHideYearlySavingsBadge:null!=T||null!=R})});return{id:e,value:e,primaryText:(0,u.YR)(j.interval,j.intervalCount,!0),subText:l?I.intl.string(I.t.ZTNur7):U,subTextStrikethrough:l?null:i,secondarySubText:l?null:t,badgeText:l?null:F,isDisabled:f||n}}),[l,e,s,a,c,S,y,v,T,P,L,R,N,b,n])})(s,{disabled:T,planPricesLoading:b,isEligibleForDiscount:M,priceOptions:B,isEligibleForTrial:G,isEligibleForBOGOPromotion:F,showPlanStatusSubText:v,isInPlanSelectStep:N});return null==z?null:(0,l.jsxs)(l.Fragment,{children:[W&&(0,l.jsx)(a.E,{variant:"text-md/medium",color:"text-subtle",className:S.S,children:K}),(0,l.jsx)(c.me,{headingComponent:(0,l.jsx)(c.ec,{size:"sm",color:"text-strong",premiumType:z}),headingSubText:Y,planRadioOptions:$,value:R?.id??"",onChange:q}),N?(0,h.LR)({selectedPlan:R,selectedPlanPrice:P,isPrepaid:L,shouldShowHRKEuroWarning:O,shouldShowTrialOrDiscountLayout:k,showTotal:N,shouldShowTotalInSubscriptionFlow:w,previewTotalSectionClassName:S.$}):null]})}}