Build 567923stable
Module 162307
119,114 characters · in 3d3b05863accbf32.jsDependencies
Lazily required by (0)none
Requires (325)
412679211436817928193112074221161262792659431823319693840538785447244593846225499995146561750647006748067948694947139371804718677382575304863798771994204956359735297808102741104510106778107610117218120700120992123292136857137728143582145659155718158317160946163437165191166403166532166926169797171835174459178368183623187322192308194256196617200766203632208733211083211159211287213530216641219103228366231723234419237412238017240921241524241989242874249872252424253390258915266060267861270537284009285719285753287809289873293035295405296589298305303612304072310829313961315949317560318007318254319820320448321073322076327105328232328968331322339048344159344346349288353791354033361597363476364840364995366523367727371794374200375708376843380619387745403052403362403581404374406263408278410516425013426398427262427358427675427858428262429913430993442123444927452027456839458785460905463376469778473145477421482132483764489254491057496142499373503698510022512950524246525723529427531260531506532794534479534514536572543767545075554146558620561794564064565756566980570287573359575593575650576052580630584160587491587895590180596034597770599062599961606267607399615310615396622631623373624210625494627968630303634378636441650588652215655857661531663803666646672525674658683071683433688810695366696208699595701273702361702841713517715054726656733391735305735438739508742158753390758836761365763827769160771566773669775602778712780651780898783878786300788868789645793574795791800471801541802790806931807098811611811656818348818824820739821609825484825755830382832163832286834040834730835245837015841702848149855104862990865543871109871123871181874638877624879100881489888751889137890856891197892118898461898640901017901930903209910200912140916261922016925847929283935462937008938430938796939249944355947641953150953761958340960851964486966327966971967198972607975571976860977445980094986687989553990078993408994500999291
Source Raw
function(e,t,n){"use strict";n.d(t,{o:()=>rh}),n(321073);var l,i=n(627968),s=n(64700),r=n(835245),a=n(192308),o=n(231723),u=n(166532),c=n(925847),d=n(310829),m=n(174459),h=n(75304),p=n(145659),f=n(624210),g=n(26279);async function E(e){let{checkoutSucceeded:t,order:n}=e;if(!t&&n?.id!=null&&n.status===g.Re.DRAFT)try{await (0,f.Nl)(n.id)}catch(e){}}var A=n(17928),C=n(444927),x=n(964486),I=n(793574),_=n(120700),S=n(171835),y=n(558620),v=n(584160),T=n(169797),N=n(211159),j=n(832286),b=n(958340),R=n(566980),P=n(615310),L=n(489254),M=n(71393),O=n(178368),w=n(166403),k=n(473145),D=n(802790),U=n(636441),G=n(587491),F=n(285753),V=n(430993),B=n(86379),H=n(545075),W=n(655857),K=n(534479),Y=n(753390);function z(){let e=(0,A.bG)([w.A],()=>w.A.hasFetchedSubscriptions());return s.useEffect(()=>{e||(0,Y.hP)()},[e]),e}var Z=n(769160),q=n(295405),$=n(786300);let[J,X,Q]=(0,$.A)();function ee(e){let{initialNumGuildBoostsToPurchase:t,disablePremiumUpsell:n=!1,closeGuildPerksModal:l,children:r,guildId:a,analyticsLocation:o,analyticsSourceLocation:u,applicationId:c,intent:d,onSubscribeComplete:m}=e,[h,p]=s.useState(t),[f,g]=s.useState(!0),E=(0,C.A)(()=>Date.now()),x=(0,C.A)(()=>(0,k.D$)(O.A.boostSlots).length),I=(0,N.t4)(e=>e.activeSubscription),_=(0,A.bG)([w.A],()=>w.A.hasFetchedSubscriptions()),S=(0,A.bG)([q.A],()=>q.A.defaultPaymentSourceId),y=null!=I?I.paymentSourceId:null,v=(0,Z._V)(null!=y?y:_?S:null);return(0,i.jsx)(J.Provider,{value:{numGuildBoostsToPurchase:h,setNumGuildBoostsToPurchase:p,disablePremiumUpsell:n,closeGuildPerksModal:l,guildId:a,paymentModalArgs:v,premiumSubscriptionPaymentSourceId:y,analyticsLocation:o,analyticsSourceLocation:u,forceDisableSubmitButton:f,setForceDisableSubmitButton:g,applicationId:c,intent:d,onSubscribeComplete:m,flowStartTime:E,existingAvailableSlotCount:x},children:r})}var et=n(160946),en=n(253390),el=n(97352),ei=n(615396),es=n(788868);function er(){let e=(0,N.t4)(e=>e.activeSubscription),{numGuildBoostsToPurchase:t}=X(),n=(0,A.bG)([el.A],()=>null==e||null!=el.A.get(e.planId)),l=(0,et.Y)(),i=(0,A.bG)([el.A],()=>null!=e?(0,ei.c9)(e.planId):null),r=s.useMemo(()=>null!=e&&n&&l?(0,en.v)(e,t):[{planId:es.gD.PREMIUM_MONTH_GUILD,quantity:t}],[e,n,l,t]),a=s.useMemo(()=>r.find(e=>{let{planId:t}=e;return es.pW.has(t)})?.planId??es.gD.PREMIUM_MONTH_GUILD,[r]),o=null==e||n&&l;return{newAdditionalPlans:r,currentPremiumSubscriptionPlan:i,hasFetchedPremiumSubscriptionPlan:n,hasFetchedAdditionalPlans:o,premiumGuildSubscriptionPlanId:a}}var ea=n(652215),eo=n(375708),eu=n(898640);function ec(e){let{message:t}=e;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(T.s3,{title:eo.intl.string(eo.t.q9EGps)}),(0,i.jsx)(V.c,{children:(0,i.jsx)("p",{className:eu.C,children:t})})]})}var ed=n(482132),em=n(216641),eh=n(879100);function ep(e){let{handleClose:t}=e,{guildId:n,numGuildBoostsToPurchase:l,paymentModalArgs:s,existingAvailableSlotCount:r}=X(),{activeSubscription:a,startingFractionalPremiumEndsAt:o,customCheckoutFlow:u,paymentSourceId:c}=(0,N.t4)(e=>({activeSubscription:e.activeSubscription,startingFractionalPremiumEndsAt:e.startingFractionalPremiumEndsAt,customCheckoutFlow:e.customCheckoutFlow,paymentSourceId:e.paymentSourceId})),d=(0,A.bG)([b.A],()=>null!=n?b.A.getGuild(n):void 0,[n]),m=null!=n?M.A.getGuild(n):null,h=(0,C.A)(()=>(0,ei.b2)(o)),p=(0,A.bG)([el.A],()=>null!=a?(0,ei.c9)(a.planId):null),{paymentSources:f}=s,g=(0,em.g)(f,c),E=null!=m?m.name:null!=d?d.name:void 0,x=h&&null!=p&&!es.YV.has(p.id);return(0,i.jsx)(ed.dZ,{children:(0,i.jsx)(eh.W,{guild:m,guildBoostQuantity:l+r,onClose:t,withAnimation:!1,paymentSourceType:g,fallbackGuildName:E,didPurchaseOnFractionalPremium:x,customCheckoutFlow:u})})}var ef=n(284009),eg=n.n(ef),eE=n(683071),eA=n(512950),eC=n(821609),ex=n(123292),eI=n(529427),e_=n(87719);let eS=(0,n(240921).Ay)({name:"2026-05-boosting-pre-checkout-modal-refresh-monthly-rate",kind:"user",defaultConfig:{enabled:!1},variations:{0:{enabled:!1},1:{enabled:!0}}});var ey=n(503698),ev=n.n(ey),eT=n(661531),eN=n(990078),ej=n(408278),eb=n(834040),eR=n(499373),eP=n(834730),eL=n(403581),eM=n(663803),eO=n(320448),ew=n(534514),ek=n(104510),eD=n(695366),eU=n(289873),eG=n(726656),eF=n(688810),eV=n(531260),eB=n(666646),eH=n(404374),eW=n(543767),eK=n(881489),eY=n(477421),ez=n(234419),eZ=n(363476),eq=n(531506),e$=n(51465);function eJ(){return(0,i.jsxs)("div",{className:ev()(e$.dt,e$.dE),children:[(0,i.jsx)("img",{src:"https://cdn.discordapp.com/assets/content/0253ce7b3c383fba5cadfd162724ef1769e45a69203a87698bf89d6b87a53acd.svg",alt:"reverse trial unlock",className:e$.qq}),(0,i.jsx)(eP.E,{variant:"text-sm/medium",className:e$.tD,children:eo.intl.format(eo.t.f5VHKm,{})})]})}function eX(e){let{text:t,color:n}=e;return(0,i.jsxs)("div",{className:e$.dt,children:[(0,i.jsx)(eL.t,{size:"md",className:e$.YW,color:n}),(0,i.jsx)("div",{children:t})]})}var eQ=n(773669),e0=n(287809),e1=n(975571),e2=n(252424),e3=n(428262),e4=n(580630),e6=n(155718),e5=n(606267),e7=n(376843),e8=n(38785),e9=n(818824),te=n(596034),tt=n(270537),tn=n(241989),tl=n(888751),ti=n(874638),ts=n(458785),tr=n(818348),ta=n(327105),to=n(7921);function tu(e){let{paymentSourceType:t,premiumSubscriptionPlan:n,renewalPrice:l,totalDue:s,currency:r,startDate:a}=e,{immediateDelivery:o}=(0,e9.U)();return(0,i.jsx)(te._,{variant:{type:te.I.Subscription,purchaseButtonText:eo.intl.string(eo.t.eUEeCt),totalDue:s,renewalPrice:l,currency:r,interval:n.interval,intervalCount:n.intervalCount,startDate:a},paymentSourceType:t,immediateDelivery:o})}function tc(e){return eo.intl.format(eo.t.IeaYqg,{endDate:e})}function td(e){let{text:t,className:n}=e;return(0,i.jsxs)("div",{className:n,children:[(0,i.jsx)("div",{className:to.bU}),(0,i.jsx)(eP.E,{variant:"text-sm/normal",className:to.b7,children:t}),(0,i.jsx)("div",{className:to.bU})]})}function tm(e){let{originalAmount:t,basePlanAdjustment:n,basePlanInvoiceItems:l,guildBoostingAdjustment:s,checkoutInvoicePreview:r}=e,a=function(e){let{addedQuantity:t,guildBoostingSubscriptionPlan:n,isPrepaid:l,formattedGuildBoostPrice:i,formattedGuildBoostRate:s,subscriptionDiscount:r,entitlementDiscount:a,originalAmount:o,checkoutInvoicePreview:u}=e;return{label:eo.intl.formatToPlainString(eo.t.a3cAOg,{numGuildSubscriptions:t,planName:(0,e3.Mn)(n.id,!1,l)}),value:l?i:s,subscriptionDiscount:r,entitlementDiscount:a,originalAmount:o,currency:u.currency,interval:n.interval,intervalCount:n.intervalCount}}(e),o=[];0!==n&&o.push({id:"base-plan-adjustment",label:eo.intl.formatToPlainString(eo.t.ZSVged,{planName:(0,e3.RH)(l[0].subscriptionPlanId)}),tooltip:eo.intl.string(eo.t.JmwQJM),amount:n,lineItemType:"adjustment"}),0!==s&&o.push({id:"guild-boosting-adjustment",label:eo.intl.string(eo.t["+as5ZZ"]),tooltip:eo.intl.string(eo.t.JmwQJM),amount:s,lineItemType:"adjustment"}),0!==r.tax&&o.push({id:"tax",label:eo.intl.string(eo.t.jiRvC7),amount:r.tax,lineItemType:"tax"});let{lineItems:u,currency:c}=(0,tl.EA)({id:"main-line-item",amount:t,...a}),d=[...u,...o];return(0,i.jsx)(tt.Vm,{defaultExpanded:!0,label:eo.intl.string(ta.default.eoXh7B),lineItems:d,currency:c})}function th(e){let{isSubscriptionUpdate:t,premiumSubscription:n,checkoutInvoicePreview:l,renewalInvoicePreview:s}=e;return null!=n?(0,i.jsx)(ts.m0,{proratedInvoice:l,renewalInvoice:s,isUpdate:t}):(0,i.jsx)(ts.m0,{renewalInvoice:s})}function tp(e){let{guildId:t,paymentSources:n,priceOptions:l,currentPremiumSubscription:s,premiumSubscriptionPaymentSourceId:r,premiumSubscriptionPlan:a,newAdditionalPlans:o,paymentSourceId:u,setPaymentSourceId:c,onPaymentSourceAdd:d}=e,m=function(e){let t,{guildId:n,priceOptions:l,currentPremiumSubscription:i,premiumSubscriptionPlan:s,newAdditionalPlans:r}=e,a=(0,A.bG)([M.A,b.A],()=>{let e=M.A.getGuild(n);return null!=e?e:b.A.isGuildFetching(n)?null:b.A.getGuild(n)},[n]),o=s.interval,u=s.intervalCount,c=(0,A.bG)([el.A],()=>el.A.getForSkuAndInterval((0,e3.mH)(es.pe.GUILD),o,u));eg()(null!=c,"Missing guildBoostingSubscriptionPlan");let d=(0,e3.J$)(l.paymentSourceId),m=(0,eK.ds)();t=null!=i?(0,e3.Om)(i,r[0].quantity,r[0].planId):r;let{analyticsLocations:h}=(0,eF.Ay)(),[p,f]=(0,eW.YV)({subscriptionId:i?.id,items:t,renewal:!1,applyEntitlements:!0,paymentSourceId:l.paymentSourceId,currency:void 0,analyticsLocations:h,analyticsLocation:I.A.GUILD_BOOSTING_REVIEW_PRORATED}),[g,E]=(0,eW.YV)({subscriptionId:i?.id,items:t,renewal:!0,paymentSourceId:l.paymentSourceId,currency:void 0,analyticsLocations:h,analyticsLocation:I.A.GUILD_BOOSTING_REVIEW_RENEWAL});return(0,eB.OQ)({checkoutInvoicePreview:p,checkoutInvoiceError:f,renewalInvoicePreview:g,renewalInvoiceError:E}),{guild:a??null,guildBoostingSubscriptionPlan:c,isPrepaid:d,isReverseTrial:m,checkoutInvoicePreview:p,renewalInvoicePreview:g,isSubscriptionUpdate:null!=i}}({guildId:t,priceOptions:l,currentPremiumSubscription:s,premiumSubscriptionPlan:a,newAdditionalPlans:o}),{isSubscriptionUpdate:h,guild:p,isPrepaid:f,isReverseTrial:g,checkoutInvoicePreview:E,renewalInvoicePreview:C}=m,x=(0,e5.A)({location:"GuildBoostReview",message:eo.intl.string(ta.default["tK8A/8"])});if(null==E||null==C||null==p)return(0,i.jsx)(e8.E,{});let _=(0,i.jsx)(th,{isSubscriptionUpdate:h,premiumSubscription:s,checkoutInvoicePreview:E,renewalInvoicePreview:C}),S=(0,i.jsx)(e7.n,{setPaymentSourceId:c,paymentSourceId:u,location:"GuildBoostReview",label:eo.intl.string(eo.t["u+Cw58"]),onPaymentSourceAdd:d,premiumSubscriptionPaymentSourceId:r,hideCurrencySelect:!0}),y=function(e){let{isSubscriptionUpdate:t,premiumSubscriptionPlan:n,renewalInvoicePreview:l,checkoutInvoicePreview:i,paymentSources:s,paymentSourceId:r}=e;return{paymentSourceType:(0,em.g)(s,r),premiumSubscriptionPlan:n,renewalPrice:l.subtotal,totalDue:i.total,currency:i.currency,startDate:(0,ts.de)({isSubscriptionUpdate:t,currentInvoice:i,renewalInvoice:l})}}({isSubscriptionUpdate:h,premiumSubscriptionPlan:a,renewalInvoicePreview:C,checkoutInvoicePreview:E,paymentSources:n,paymentSourceId:u}),v=(0,i.jsx)(tu,{...y}),T=function(e){let{premiumSubscription:t,premiumSubscriptionPlan:n,checkoutInvoicePreview:l,renewalInvoicePreview:i,priceOptions:s,reviewState:r}=e,{guildBoostingSubscriptionPlan:a,isPrepaid:o,isReverseTrial:u}=r,c=n.interval,d=n.intervalCount;function m(e){return(0,ti.Z)(l.invoiceItems).find(t=>es.pW.has(t.subscriptionPlanId)&&e(t))}let h=m(e=>e.amount>=0);eg()(null!=h,"Missing guild boosting invoice item");let p=m(e=>e.amount<0),f=null!=p?h.quantity-p.quantity:h.quantity,g=l.invoiceItems.filter(e=>(0,e3.xq)(e.subscriptionPlanId)),E=g.reduce((e,t)=>e+t.amount,0),A=(0,eW.sL)(h)*f,C=(0,e4.$g)(A,l.currency),x=(0,e4.CE)(C,c,d),I=(0,e4.$g)(l.total,l.currency)+(l.currency!==tr.Yr.USD?"*":""),_=l.subtotal-A-E,S=h.discounts.map(e=>{let t=e.amount/h.quantity;return{...e,amount:t*f}}),y=S.find(e=>e.type===e6.iS.SUBSCRIPTION_PLAN),v=S.find(e=>e.type===e6.iS.ENTITLEMENT),T=h.subscriptionPlanPrice*f;return{addedQuantity:f,guildBoostingSubscriptionPlan:a,isPrepaid:o,isReverseTrial:u,formattedGuildBoostPrice:C,formattedGuildBoostRate:x,formattedOriginalAmountGuildBoostRate:(0,e4.CE)((0,e4.$g)(T,l.currency),c,d),formattedTotal:I,basePlanAdjustment:E,basePlanInvoiceItems:g,guildBoostingAdjustment:_,subscriptionDiscount:y,entitlementDiscount:v,originalAmount:T,premiumSubscription:t,checkoutInvoicePreview:l,renewalInvoicePreview:i,priceOptions:s}}({premiumSubscription:s,premiumSubscriptionPlan:a,checkoutInvoicePreview:E,renewalInvoicePreview:C,priceOptions:l,reviewState:m}),N=(0,i.jsx)(tm,{...T}),j=function(e,t,n){let{addedQuantity:l,guildBoostingSubscriptionPlan:s,isPrepaid:r,formattedGuildBoostRate:a,formattedOriginalAmountGuildBoostRate:o,subscriptionDiscount:u}=t,c=null!=u;return{label:eo.intl.formatToPlainString(eo.t.a3cAOg,{numGuildSubscriptions:l,planName:(0,e3.Mn)(s.id,!1,r)}),target:{type:"boost",guild:e},graphic:(0,i.jsx)(tn.a6,{}),price:a,PriceIcon:c?eL.t:void 0,priceTooltip:c?eo.intl.string(ta.default.YUNJJa):void 0,priceSubText:c?o:void 0,bottomSubText:n?.text??null}}(p,T,function(e){let{isPrepaid:t,isReverseTrial:n,premiumSubscription:l}=e;return!t&&n&&null!=l?{type:"reverseTrial",text:tc(l.currentPeriodEnd)}:null}({isPrepaid:f,isReverseTrial:g,premiumSubscription:s})),R=(0,i.jsx)(tn.f7,{...j});return(0,i.jsx)(e8.T,{shouldShowGlobalNotices:!0,upperInlineNoticeProps:x,purchaseItemContent:R,subscriptionDetailsContent:_,paymentMethodContent:S,invoiceSummaryContent:N,legalContent:v,invoiceTotalDueValue:T.formattedTotal,invoiceTotalDueLabel:eo.intl.string(ta.default.R0cZsM)})}var tf=n(406263);function tg(e){return""===e||"-"===e}function tE(e){let{value:t,onChange:n,minValue:l=1,maxValue:r=30,ariaLabel:a}=e,[o,u]=s.useState(t);s.useEffect(()=>{u(t)},[t]);let c="number"==typeof o;function d(e){u(e),tg(e)||n(e)}return(0,i.jsxs)("div",{className:tf.U$,children:[(0,i.jsx)(ej.K,{variant:"secondary",size:"md",icon:eb.Q,onClick:()=>{c&&!(o<=l)&&d(o-1)},"aria-label":eo.intl.string(eo.t["k+ohJm"]),disabled:!c||o<=l}),(0,i.jsx)("div",{className:tf.WJ,children:(0,i.jsx)("input",{className:tf.Zh,"aria-label":a,inputMode:"numeric",value:`${o}`,onChange:e=>(function(e){if(tg(e))return void d(e);let t=parseInt(e,10);if(!isNaN(t)){if(t<=l)return void d(l);if(t>=r)return void d(r);d(t)}})(e.currentTarget.value),onBlur:function(){tg(o)&&u(t)}})}),(0,i.jsx)(ej.K,{variant:"secondary",size:"md",icon:eR.T,onClick:()=>{c&&!(o>=r)&&d(o+1)},"aria-label":eo.intl.string(eo.t.w8Sc4B),disabled:!c||o>=r})]})}function tA(e){let{message:t}=e;return(0,i.jsx)(eP.E,{variant:"text-xs/normal",color:"text-muted",className:tf.jH,children:t})}function tC(e){let{text:t}=e;return(0,i.jsxs)("div",{className:tf.Vk,children:[(0,i.jsx)("div",{className:tf.D0,children:(0,i.jsx)(eL.t,{"aria-hidden":"true",size:"custom",width:20,height:20,className:tf.ue,color:eH.k0.PREMIUM_TIER_2})}),(0,i.jsx)("div",{className:tf.yP,children:t})]})}function tx(e){let{isLoading:t,numGuildBoosts:n,setNumGuildBoosts:l,planLabel:r,planPriceContent:a,subtotalContent:o,refreshSubtotalContent:u,legacyDescriptionContent:c,refreshDescriptionContent:d,fractionalBanner:m,existingSlotNotice:h,discountCallout:p,refreshDiscountCallout:f,legacyPricingNotes:g,refreshPricingNotes:E}=e;return(0,i.jsxs)("div",{children:[m,c,h,(0,i.jsxs)("div",{className:to.mP,children:[(0,i.jsxs)("div",{className:to.E6,children:[(0,i.jsx)(eM.l,{value:n,onChange:e=>l(e),className:to.__invalid_planSelector,minValue:1,maxValue:30}),(0,i.jsx)("div",{className:to.$0,children:r})]}),(0,i.jsx)("div",{className:ev()(to.QK,{[to.S]:t}),children:a})]}),(0,i.jsx)("div",{className:to.J3}),(0,i.jsxs)("div",{className:to.mP,children:[(0,i.jsx)("div",{className:to.xp,children:eo.intl.string(eo.t.RtA7nR)}),(0,i.jsx)("div",{className:ev()(to.__invalid_planSelectorSubtotalPrice,{[to.S]:t}),children:o})]}),g.map((e,t)=>(0,i.jsx)(s.Fragment,{children:e},t)),p]})}function tI(e){let{isLoading:t,numGuildBoosts:n,setNumGuildBoosts:l,refreshNextStepLabel:r,planLabel:a,planPriceContent:o,subtotalContent:u,refreshSubtotalContent:c,legacyDescriptionContent:d,refreshDescriptionContent:m,fractionalBanner:h,existingSlotNotice:p,discountCallout:f,refreshDiscountCallout:g,legacyPricingNotes:E,refreshPricingNotes:A}=e;return(0,i.jsxs)("div",{className:tf.xY,children:[h,(0,i.jsxs)("div",{className:tf.K3,children:[(0,i.jsx)(eP.E,{variant:"text-md/medium",className:tf.bk,children:eo.intl.string(eo.t["r+SebU"])}),(0,i.jsx)(eO._,{className:tf.bN,color:"currentColor",size:"xs"}),(0,i.jsx)(eP.E,{variant:"text-md/medium",className:tf.kX,children:r})]}),m,p,(0,i.jsxs)("div",{className:tf.fh,children:[(0,i.jsxs)("div",{className:tf.fX,children:[(0,i.jsx)(tE,{value:n,onChange:e=>l(e),ariaLabel:a,minValue:1,maxValue:30}),(0,i.jsx)(eP.E,{variant:"text-md/medium",className:tf.ny,children:a})]}),(0,i.jsx)("div",{className:ev()(tf.El,{[to.S]:t}),children:o})]}),g,(0,i.jsxs)("div",{className:tf.fh,children:[(0,i.jsx)(ew.D,{variant:"heading-lg/semibold",className:tf.O3,children:eo.intl.string(eo.t.RtA7nR)}),(0,i.jsx)("div",{className:ev()(tf.BU,{[to.S]:t}),children:c})]}),A.map((e,t)=>(0,i.jsx)(s.Fragment,{children:e},t))]})}function t_(e){let{existingAvailableSlots:t,canceledCount:n,premiumSubscription:l}=e;return(0,i.jsxs)("div",{className:to.Mv,children:[(0,i.jsx)(ek._,{className:to.T5,color:eT.A.unsafe_rawColors.GUILD_BOOSTING_PINK}),(0,i.jsxs)("div",{children:[eo.intl.format(eo.t.F8xlhr,{slotCount:t.length}),n>0&&null!=l?(0,i.jsx)(eN.m,{text:eo.intl.formatToPlainString(eo.t.SFpsCH,{canceledCount:n,date:l.currentPeriodEnd}),children:(0,i.jsx)(eD.E,{size:"custom",width:20,height:20,className:to.Y5,color:eT.A.unsafe_rawColors.YELLOW_300.css})}):null]})]})}function tS(e){let{premiumSubscriptionPlan:t,numGuildBoosts:n,setNumGuildBoosts:l,setForceDisableSubmitButton:r,premiumSubscription:a,onClickPremiumSubscriptionLink:o,existingAvailableSlots:u=[],priceOptions:c,isRefreshEnabled:d=!1,showRefreshSubtotalRate:m=!1,refreshNextStepLabel:h=eo.intl.string(eo.t.QBnNHq)}=e,p=function(e){let t,n,{premiumSubscriptionPlan:l,numGuildBoosts:r,setForceDisableSubmitButton:a,premiumSubscription:o,onClickPremiumSubscriptionLink:u,existingAvailableSlots:c,priceOptions:d,showRefreshSubtotalRate:m}=e,h=(t=(0,A.bG)([w.A],()=>w.A.getPremiumTypeSubscription()),(0,A.bG)([q.A],()=>t?.paymentSourceId!=null?q.A.getPaymentSource(t.paymentSourceId)?.country:null)),p=l.interval,f=l.intervalCount,g=(0,A.bG)([el.A],()=>el.A.getForSkuAndInterval((0,e3.mH)(es.pe.GUILD),p,f)),E=(0,A.bG)([e0.default],()=>e0.default.getCurrentUser()),C=(0,eV.A)({forceFetch:!1});eg()(null!=g,"Missing guildBoostingSubscriptionPlan");let x=[{planId:g.id,quantity:1}],_=o?.items.find(e=>e.planId===es.gD.PREMIUM_MONTH_TIER_2||e.planId===es.gD.PREMIUM_YEAR_TIER_2);null!=_&&x.push(_);let S=o?.items.find(e=>e.planId===es.gD.PREMIUM_MONTH_GUILD||e.planId===es.gD.PREMIUM_YEAR_GUILD),y=null==h||!es.uJ.has(h)||null==S,{analyticsLocations:v}=(0,eF.Ay)(),[T,N]=(0,eW.YV)({subscriptionId:o?.id,items:x,renewal:!0,paymentSourceId:o?.paymentSourceId,currency:d.currency,preventFetch:y,analyticsLocations:v,analyticsLocation:I.A.GUILD_BOOSTING_PLAN_SELECT});(0,eB.Tr)(T,N);let j=!y&&null==T&&null==N;s.useLayoutEffect(()=>{a(j)},[j,a]);let b=(0,ez.V)()?.subscription_trial?.sku_id===es.pe.TIER_2,R=e3.Ay.hasBoostDiscount(E),P=R&&null!=o&&e3.Ay.isPremiumAtLeast(e3.Ay.getPremiumType(o.planId),es.PremiumTypes.TIER_1),L=T?.findInvoiceItemByPlanId(g.id),M=null!=L?{amount:L.amount,tax:0,taxInclusive:!0,currency:T.currency}:e3.Ay.getPrice(g.id,R,!1,d),O=r*M.amount,D=(0,eK.ds)()&&R&&null!=o,U=function(e){let t,{existingAvailableSlotsCount:n,fractionalPremiumState:l,isReverseTrial:i,hasDiscountUpsell:s,withTrialOfferCopyVariant:r}=e;return t=i?"reverse_trial":s?"discount":r?"upsell_trial":"upsell",{showExistingSlotNotice:n>0,showFractionalPremiumBanner:l===es.xc.FP_SUB_PAUSED,upsellVariant:t}}({existingAvailableSlotsCount:c.length,fractionalPremiumState:C.fractionalState,isReverseTrial:D,hasDiscountUpsell:P,withTrialOfferCopyVariant:b});"discount"===U.upsellVariant?(eg()(null!=o,"Missing premiumSubscription for discount upsell variant"),n=eo.intl.format(eo.t.hf6YOY,{planName:e3.Ay.getTierDisplayNameByPlanId(o.planId)})):n=eo.intl.format("upsell_trial"===U.upsellVariant?eo.t.ba1L74:eo.t.fkffDT,{onPremiumSubscriptionClick:u,discountPercentage:(0,e2.l9)(eQ.default.locale,es.oX/100),freeSubscriptionCount:es.M4});let G=c.filter(e=>(0,k.I5)(e)).length,F=(0,e3.J$)(d.paymentSourceId),{ipCountryCode:V}=(0,eY.A)(),B="HR"===V&&M.currency===tr.Yr.EUR,H=D&&null!=o?(0,i.jsx)(td,{text:tc(o.currentPeriodEnd)}):(0,i.jsx)("div",{className:ev()(to.hA,to.G3),children:eo.intl.string(eo.t.jNY1FO)}),W=D&&null!=o?(0,i.jsx)(td,{text:tc(o.currentPeriodEnd),className:to.jk}):(0,i.jsx)("div",{className:tf._X,children:eo.intl.string(eo.t.jNY1FO)}),K=U.showExistingSlotNotice?(0,i.jsx)(t_,{existingAvailableSlots:c,canceledCount:G,premiumSubscription:o}):null,Y=U.showFractionalPremiumBanner?(0,i.jsx)(eq.vi,{fractionalPremiumInfo:C}):null,z=F?function(e){let{intervalType:t,intervalCount:n=1}=e;return t===es.WT.YEAR?eo.intl.string(eo.t.YDpAzZ):t===es.WT.MONTH&&1===n?eo.intl.string(eo.t["6ZR3By"]):null}({intervalType:p,intervalCount:f})??eo.intl.string(eo.t.K9Bmze):eo.intl.string(eo.t.K9Bmze),Z=j?(0,i.jsx)(eU.y,{}):F?(0,e4.$g)(M.amount,M.currency):function(e){let{amount:t,currency:n,intervalType:l,intervalCount:i=1}=e,s=(0,e4.$g)(t,n);return l===es.WT.YEAR?eo.intl.formatToPlainString(eo.t["8M04YJ"],{price:s}):l===es.WT.MONTH&&1===i?eo.intl.formatToPlainString(eo.t.VStWCR,{price:s}):l===es.WT.MONTH&&i>1?eo.intl.formatToPlainString(eo.t.xJvAFU,{price:s}):null}({intervalType:p,intervalCount:f,amount:M.amount,currency:M.currency}),$=j?(0,i.jsx)(eU.y,{}):(0,i.jsx)(eZ.A,{price:O,currency:M.currency,intervalType:p,intervalCount:f,isPrepaidPaymentSource:F}),J=j?(0,i.jsx)(eU.y,{}):m&&!F?(0,e4.CE)((0,e4.$g)(O,M.currency),p,f):(0,e4.$g)(O,M.currency),X=[],Q=[];if(B){let e=(0,i.jsx)(eG.A,{message:eo.intl.formatToPlainString(eo.t["9hnZoK"],{kunaPriceWithCurrency:(0,e4.$g)(7.5345*O,tr.Yr.HRK)})},"hrk-warning");X.push(e),Q.push(e)}let ee=eo.intl.format(eo.t.Om31w8,{documentationLink:e1.A.getArticleURL(ea.MVz.LOCALIZED_PRICING)});return X.push((0,i.jsx)(eG.A,{message:ee},"localized-pricing")),Q.push((0,i.jsx)(tA,{message:ee},"localized-pricing")),{isLoading:j,planLabel:z,planPriceContent:Z,subtotalContent:$,refreshSubtotalContent:J,legacyDescriptionContent:H,refreshDescriptionContent:W,existingSlotNotice:K,fractionalBanner:Y,legacyPricingNotes:X,refreshPricingNotes:Q,discountCallout:"reverse_trial"===U.upsellVariant?(0,i.jsx)(eJ,{}):(0,i.jsx)(eX,{text:n,color:eH.k0.PREMIUM_TIER_2}),refreshDiscountCallout:"reverse_trial"===U.upsellVariant?(0,i.jsx)(eJ,{}):(0,i.jsx)(tC,{text:n})}}({premiumSubscriptionPlan:t,numGuildBoosts:n,setForceDisableSubmitButton:r,premiumSubscription:a,onClickPremiumSubscriptionLink:o,existingAvailableSlots:u,priceOptions:c,showRefreshSubtotalRate:m});return(0,i.jsx)(d?tI:tx,{isLoading:p.isLoading,numGuildBoosts:n,setNumGuildBoosts:l,planLabel:p.planLabel,planPriceContent:p.planPriceContent,subtotalContent:p.subtotalContent,refreshSubtotalContent:p.refreshSubtotalContent,legacyDescriptionContent:p.legacyDescriptionContent,refreshDescriptionContent:p.refreshDescriptionContent,fractionalBanner:p.fractionalBanner,existingSlotNotice:p.existingSlotNotice,discountCallout:p.discountCallout,refreshDiscountCallout:p.refreshDiscountCallout,legacyPricingNotes:p.legacyPricingNotes,refreshPricingNotes:p.refreshPricingNotes,refreshNextStepLabel:h})}let ty=es.gD.NONE_MONTH,tv=[es.pe.GUILD];function tT(e){let{handleClose:t,handleStepChange:n}=e,{numGuildBoostsToPurchase:l,setNumGuildBoostsToPurchase:s,guildId:r,closeGuildPerksModal:a,disablePremiumUpsell:o,setForceDisableSubmitButton:c,forceDisableSubmitButton:d,paymentModalArgs:m,premiumSubscriptionPaymentSourceId:h}=X(),{paymentSourceId:p,activeSubscription:f}=(0,N.t4)(e=>({paymentSourceId:e.paymentSourceId,activeSubscription:e.activeSubscription})),{displayCurrency:g}=(0,W.Jn)(),E=null!=h||Object.keys(m.paymentSources).length>0,x=(0,u.Ir)(E?u.pn.REVIEW:u.pn.ADD_PAYMENT_STEPS),I=(0,C.A)(()=>(0,k.D$)(O.A.boostSlots)),_=(0,L.n)("GuildBoostPurchaseModal"),S=eS.useConfig({location:"GuildBoostPurchaseModal"}).enabled,y=_&&S,v=(0,A.bG)([b.A],()=>null!=r?b.A.getGuild(r):void 0,[r]),T=null!=r?M.A.getGuild(r):null,j=null==v&&null==T,R=null!=f&&f.isPurchasedExternally,P=Object.keys(m.paymentSources).length>0,w=(0,A.bG)([el.A],()=>null!=f?(0,ei.c9)(f.planId):null),D=(0,A.bG)([el.A],()=>null==w?el.A.get(ty):w);if(null==r)throw new eI.vd({message:"Missing guildId"});eg()(null!=D,"Missing nextPremiumSubscriptionPlan");let U=(0,i.jsx)(tS,{premiumSubscriptionPlan:D,numGuildBoosts:l,setNumGuildBoosts:s,setForceDisableSubmitButton:c,premiumSubscription:f,existingAvailableSlots:I,onClickPremiumSubscriptionLink:()=>{if(__BILLING_STANDALONE__){window.location.href="discord://app/settings/nitro";return}t(),null!=a&&a(),(0,e_.e)()},priceOptions:null!=p?{paymentSourceId:p,currency:null!=g?g:void 0}:{currency:null!=g?g:void 0},isRefreshEnabled:_,showRefreshSubtotalRate:y,refreshNextStepLabel:x});return R&&null!=f&&null!=f.paymentGateway?U=(0,i.jsxs)("div",{className:eu.xK,children:[(0,i.jsx)(eE.w,{type:"critical",children:eo.intl.format(eo.t["/m3Y3s"],{paymentGatewayName:tr.qm[f.paymentGateway]})}),U]}):null!=r&&!b.A.isGuildFetching(r)&&j&&(U=(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(eA.p,{messageType:eA.Y.ERROR,className:eu.MR,children:eo.intl.string(eo.t.eAn6z2)}),U]})),(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(ed.dZ,{children:U}),(0,i.jsx)(ed.UX,{children:(0,i.jsx)(eh._,{currentStep:u.pn.PLAN_SELECT,isRefreshEnabled:_,backStep:void 0,handleStepChange:n,primaryButtonProps:null,secondaryButton:_?(0,i.jsx)(eC.$,{variant:"secondary",text:eo.intl.string(eo.t["ETE/oC"]),onClick:t}):(0,i.jsx)(ex.Q,{text:eo.intl.string(eo.t.oEAioF),onClick:t,variant:"secondary"}),legacySubmitButton:(0,i.jsx)(eC.$,{variant:"primary",text:eo.intl.string(eo.t["3PatSz"]),type:"submit",disabled:function(e){let{forceDisableSubmitButton:t,numGuildBoostsToPurchase:n,isDisabledBecauseExternalSubscription:l,isMissingGuildInformation:i}=e;return t||0===n||l||i}({forceDisableSubmitButton:d,numGuildBoostsToPurchase:l,isDisabledBecauseExternalSubscription:R,isMissingGuildInformation:j}),onClick:()=>{o||null!=w&&w.premiumSubscriptionType===es.PremiumTypes.TIER_2?n(null!=h||P?u.pn.REVIEW:u.pn.ADD_PAYMENT_STEPS):n(u.pn.PREMIUM_UPSELL)}})})})]})}var tN=n(364840),tj=n(460905),tb=n(183623),tR=n(95635),tP=n(935462),tL=n(331322),tM=n(532794),tO=n(811611),tw=n(901017),tk=n(403052);function tD(e){let{shouldUpsellFromNoneTier:t}=e,n=(0,A.bG)([eQ.default],()=>eQ.default.locale);return(0,i.jsxs)("div",{className:tk.mH,children:[(0,i.jsx)(tw.A,{icon:ek._,iconClassName:tk.pl,description:eo.intl.formatToPlainString(eo.t.sQBgs2,{numFreeGuildSubscriptions:es.M4}),color:eT.A.unsafe_rawColors.GUILD_BOOSTING_PINK.css}),(0,i.jsx)(tw.A,{icon:ek._,iconClassName:tk.pl,description:eo.intl.formatToPlainString(eo.t["1A6vXi"],{percent:(0,e2.l9)(n,es.oX/100)}),color:eT.A.unsafe_rawColors.GUILD_BOOSTING_PINK.css}),t?(0,i.jsx)(tw.A,{icon:tj.n,iconClassName:tk.zO,description:eo.intl.string(eo.t.Z9b2x2)}):null,(0,i.jsx)(tw.A,{icon:tb.F,iconClassName:tk.Kg,description:eo.intl.string(eo.t["8dqG5E"])}),(0,i.jsx)(tw.A,{icon:tR.J,iconClassName:tk.$z,description:eo.intl.string(eo.t.cBorIy)})]})}function tU(e){let{premiumSubscriptionPlan:t,onClose:n,onBack:l,onSkip:r,onSubscriptionConfirmation:a,analyticsLocation:o,analyticsSourceLocation:u,priceOptions:c}=e,{analyticsLocations:d,sourceAnalyticsLocations:h}=(0,eF.Ay)(I.A.GUILD_BOOSTING_PREMIUM_UPSELL),p=null==t||null==t.premiumSubscriptionType,f=e3.Ay.getPrice(es.gD.PREMIUM_MONTH_TIER_2,!1,!1,c),g=(0,e4.$g)(f.amount,f.currency),E=(0,ez.V)(),A=E?.trial_id,C=E?.subscription_trial?.sku_id===es.pe.TIER_2;return s.useEffect(()=>{m.default.track(ea.HAw.PREMIUM_UPSELL_VIEWED,{type:es.e.GUILD_PREMIUM_UPSELL_MODAL,location_stack:h})},[h]),(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(tP.s_,{"data-migration-pending":!0,onClick:n,className:tk.b}),(0,i.jsxs)(V.c,{children:[C&&(0,i.jsx)(tO.Vq,{className:tk.Fg}),(0,i.jsx)("div",{className:ev()(tk.Tn,{[tk.NH]:C})}),(0,i.jsx)("div",{className:tk.G3,children:null!=A?eo.intl.string(eo.t.AoSzEr):eo.intl.format(eo.t["7vePZb"],{monthlyPrice:g})}),(0,i.jsx)(tD,{shouldUpsellFromNoneTier:p})]}),(0,i.jsx)(tN.j,{children:(0,i.jsxs)(tL.B,{direction:"horizontal",align:"center",justify:"space-between",fullWidth:!0,children:[(0,i.jsx)(ex.Q,{text:eo.intl.string(eo.t["13/7kX"]),onClick:l,variant:"secondary"}),(0,i.jsxs)(tL.B,{direction:"horizontal",align:"center",fullWidth:!1,children:[(0,i.jsx)(ex.Q,{text:eo.intl.string(eo.t["SI/adm"]),onClick:r,variant:"secondary"}),(0,i.jsx)(eC.$,{variant:"active",text:null!=A?eo.intl.string(eo.t["Gd/XHF"]):eo.intl.string(eo.t.p2moip),type:"submit",onClick:()=>{n(),(0,tM.A)({initialPlanId:null,subscriptionTier:es.pe.TIER_2,analyticsLocations:d,analyticsObject:{...o,section:ea.JJy.PREMIUM_GUILD_PURCHASE_MODAL},analyticsSourceLocation:u,onSubscriptionConfirmation:a,trialId:A})}})]})]})})]})}function tG(e){let{handleClose:t,handleStepChange:n,onSubscriptionConfirmation:l}=e,{paymentModalArgs:r,analyticsLocation:a,analyticsSourceLocation:o}=X(),{paymentSourceId:c,activeSubscription:d}=(0,N.t4)(e=>({paymentSourceId:e.paymentSourceId,activeSubscription:e.activeSubscription})),{displayCurrency:m}=(0,W.Jn)(),h=(0,A.bG)([el.A],()=>null!=d?(0,ei.c9)(d.planId):null),p=(0,A.bG)([el.A],()=>null==h?el.A.get(ty):h);eg()(null!=p,"Missing nextPremiumSubscriptionPlan"),eg()(null!=m&&""!==m,"Currency not defined");let{paymentSources:f}=r,g=null!=d?d.paymentSourceId:null,E=Object.keys(f).length>0,C=s.useCallback(()=>n(u.pn.PLAN_SELECT),[n]),x=s.useCallback(()=>n(null!=g||E?u.pn.REVIEW:u.pn.ADD_PAYMENT_STEPS),[n,g,E]);return(0,i.jsx)(tU,{premiumSubscriptionPlan:p,analyticsLocation:a,analyticsSourceLocation:o,onClose:t,onBack:C,onSkip:x,onSubscriptionConfirmation:l,priceOptions:null!=c?{paymentSourceId:c,currency:m}:{currency:m}})}var tF=n(364995),tV=n(820739);async function tB(e,t){await (0,tV.CD)();let n=(0,k.D$)(O.A.boostSlots);return(0,tV.VA)(e,n.map(e=>e.id),t)}var tH=n(825755);function tW(e){let{onComplete:t}=e,{guildId:n,intent:l,onSubscribeComplete:i,flowStartTime:r,numGuildBoostsToPurchase:a,analyticsLocation:o,analyticsSourceLocation:c,paymentModalArgs:d}=X(),{setIsSubmittingCurrentStep:h,paymentSources:p}=d,{premiumGuildSubscriptionPlanId:f}=er(),{paymentSourceId:g,setPurchaseState:E,setPurchaseError:C,loadId:x,startTime:I}=(0,N.t4)(e=>({paymentSourceId:e.paymentSourceId,setPurchaseState:e.setPurchaseState,setPurchaseError:e.setPurchaseError,loadId:e.contextMetadata.loadId,startTime:e.contextMetadata.startTime})),S=(0,P.l)(),y=(0,eF.Db)(),v=(0,A.bG)([tH.A],()=>tH.A.popupCallbackCalled),T={baseAnalyticsData:s.useMemo(()=>({load_id:x,payment_type:tr.fr[tr.VV.SUBSCRIPTION],subscription_type:ea.rzx.PREMIUM,subscription_plan_id:f,sku_id:(0,e3.mH)(es.pe.GUILD),quantity:a,location:o,source:c,location_stack:y,checkout_flow:_.C.GUILD_BOOST_CHECKOUT,is_gift:!1,eligible_for_trial:!1,guild_id:n??void 0}),[x,f,a,o,c,y,n]),flowStartTime:r,startTime:I,guildId:n,onComplete:t,onSubscribeComplete:i,paymentSourceId:g,paymentSources:p,setIsSubmittingCurrentStep:h,setPurchaseError:C,setPurchaseState:E,setStep:S},j=s.useRef(T);return s.useEffect(()=>{j.current=T}),s.useEffect(()=>{let{baseAnalyticsData:e,flowStartTime:t,startTime:n,guildId:i,onComplete:s,onSubscribeComplete:r,paymentSourceId:a,paymentSources:o,setIsSubmittingCurrentStep:c,setPurchaseError:d,setPurchaseState:h,setStep:p}=j.current;(async()=>{if(!0===v)try{if(null==tH.A.redirectedPaymentId)return;await (0,Y.tn)(tH.A.redirectedPaymentId),m.default.track(ea.HAw.PAYMENT_FLOW_SUCCEEDED,{...e,duration_ms:Date.now()-n,payment_source_type:(0,em.g)(o,a)??void 0}),d(null),p(u.pn.CONFIRM),h(R.h.COMPLETED),null!=i&&await tB(i,null!=l),r?.(),null!=s&&s()}catch(i){h(R.h.FAIL),d(i);let{guild_id:n,...l}=e;m.default.track(ea.HAw.PAYMENT_FLOW_FAILED,{...l,payment_error_code:i?.code,payment_gateway:ea.kM_.STRIPE,payment_source_id:a,duration_ms:Date.now()-t})}finally{c(!1),(0,Y.bl)()}})()},[v,l]),null}let tK=[u.pn.PLAN_SELECT],tY=[{key:u.pn.PLAN_SELECT,renderStep:e=>(0,i.jsx)(tT,{...e}),options:{renderHeader:!0}},{key:u.pn.PREMIUM_UPSELL,renderStep:e=>(0,i.jsx)(tG,{...e}),options:{renderHeader:!1,hideSlider:!0}}],tz={CHECKOUT_FLOW:_.C.GUILD_BOOST_CHECKOUT,CustomCheckoutPredicateStep:function(e){let{handleStepChange:t}=e,n=(0,N.t4)(e=>e.activeSubscription),{guildId:l,analyticsLocation:r}=X(),a=(0,B.Hp)(),o=z(),{hasFetchedRelatedSubscriptionPlans:c,displayCurrency:d}=(0,W.Jn)(),{hasFetchedPremiumSubscriptionPlan:h}=er(),p=null!=n&&null!=n.renewalMutations,f=null!=n&&n.isPausedOrPausePending&&!n.isPausedAllowsUpdatesButNotResume,g=!o||!c||!h||null==d||""===d;return((0,x.Ay)(()=>{p&&m.default.track(ea.HAw.PREMIUM_GUILD_PENDING_MODAL,{location:r,guild_id:l})}),s.useEffect(()=>{g||a||f||p||t(u.pn.PLAN_SELECT)},[g,a,f,p,t]),f)?(0,i.jsx)(ec,{message:eo.intl.string(eo.t.mOWsF1)}):p?(0,i.jsx)(ec,{message:eo.intl.string(eo.t.npfhh0)}):g?(0,i.jsx)(K.A,{}):a?(0,i.jsx)(H.oO,{}):null},STEPS_BEFORE_CHECKOUT:tY,CHECKOUT_STEPS:{[u.pn.REVIEW]:function(e){let{handleStepChange:t,handleClose:n,analyticsData:l}=e,{guildId:r,paymentModalArgs:a,premiumSubscriptionPaymentSourceId:o}=X(),{activeSubscription:c,paymentSourceId:d,setPaymentSourceId:h}=(0,N.t4)(e=>({activeSubscription:e.activeSubscription,paymentSourceId:e.paymentSourceId,setPaymentSourceId:e.setPaymentSourceId})),{displayCurrency:p}=(0,W.Jn)();if(null==r)throw new eI.vd({message:"Missing guildId"});eg()(null!=p&&""!==p,"Currency not defined");let{paymentSources:f}=a,{newAdditionalPlans:g,currentPremiumSubscriptionPlan:E}=er(),C=(0,A.bG)([el.A],()=>null==E?el.A.get(ty):E);eg()(null!=C,"Missing nextPremiumSubscriptionPlan");let x=null!=d?{paymentSourceId:d,currency:p}:{currency:p},I=function(e){let{handleStepChange:t,handleClose:n,analyticsData:l}=e,{guildId:i,paymentModalArgs:r,premiumSubscriptionPaymentSourceId:a,numGuildBoostsToPurchase:o,analyticsLocation:c,analyticsSourceLocation:d,flowStartTime:h,applicationId:p,intent:f,onSubscribeComplete:g}=X(),{displayCurrency:E}=(0,W.Jn)(),{paymentSources:A,setIsSubmittingCurrentStep:C,isSubmittingCurrentStep:x}=r,{activeSubscription:I,paymentSourceId:_,setPurchaseError:S,hasAcceptedTerms:y,setPurchaseState:v}=(0,N.t4)(e=>({activeSubscription:e.activeSubscription,paymentSourceId:e.paymentSourceId,setPurchaseError:e.setPurchaseError,hasAcceptedTerms:e.hasAcceptedTerms,setPurchaseState:e.setPurchaseState})),T=(0,eB.sw)(),{newAdditionalPlans:j,currentPremiumSubscriptionPlan:b,premiumGuildSubscriptionPlanId:P}=er(),L=(0,e5.A)({location:"GuildBoostPurchaseModal",message:eo.intl.string(ta.default["tK8A/8"])}),{checkoutPaymentSources:M}=(0,tF.t)(),O=(0,e5.iB)({checkoutPaymentSources:M,paymentSourceId:_,location:"GuildBoostPurchaseModal"}),w=s.useMemo(()=>({...l,location:c,source:d,subscription_plan_id:P,sku_id:(0,e3.mH)(es.pe.GUILD),quantity:o}),[l,c,d,o,P]),k=s.useMemo(()=>{let{guild_id:e,...t}=w;return t},[w]),[D,U]=s.useState(!1),G=null!=_?{paymentSourceId:_,currency:E??void 0}:{currency:E??void 0},F=async()=>{eg()(null!=j,"Missing newAdditionalPlans");let e=(0,em.W)(A,_);S(null);try{v(R.h.PURCHASING),C(!0),eg()(null!=_,"Missing paymentSourceId"),eg()(null!=T,"Missing invoicePreview");let s={amount:T.total,currency:T.currency},r=G.currency??T.currency,o=(0,e3.U8)(I,j,r.toLowerCase(),G.paymentSourceId);if(m.default.track(ea.HAw.PAYMENT_FLOW_COMPLETED,{...w,duration_ms:Date.now()-h,guild_id:i??void 0,application_id:p}),D)return;if(null==I||null==b){eg()(null!=e,"Missing paymentSource");let t=await (0,Y.Ky)({items:j,paymentSource:e,currency:r,expectedInvoicePrice:s,expectedRenewalPrice:o});if(t.redirectConfirmation)return void U(null!=t.redirectURL)}else{let t={items:(0,e3.aE)(I,j)};t.currency=I.currency??r,t.paymentSource=null!=a?A[a]:void 0,null==t.paymentSource&&(eg()(null!=e,"Missing paymentSource"),t.paymentSource=e,t.currency=r);let n=await (0,Y.nV)(I,t,s,o,l.location_stack);if(n.redirectConfirmation)return void U(null!=n.redirectURL)}null==f&&t(u.pn.CONFIRM),v(R.h.COMPLETED),null!=i&&await tB(i,null!=f),null!=f&&n(),g?.()}catch(t){v(R.h.FAIL),S(t),m.default.track(ea.HAw.PAYMENT_FLOW_FAILED,{...k,payment_error_code:t?.code,payment_gateway:null!=e?e.type===ea.hes.CARD?ea.kM_.STRIPE:ea.kM_.BRAINTREE:null,payment_source_id:_,duration_ms:Date.now()-h})}finally{D||C(!1)}};return{text:eo.intl.string(eo.t.eUEeCt),loading:x,disabled:null==_||!y||null!=L||O,onClick:F,variant:"active"}}({handleStepChange:t,handleClose:n,analyticsData:l}),_=s.useCallback(()=>{t(u.pn.ADD_PAYMENT_STEPS),h(null)},[t,h]);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(ed.dZ,{children:(0,i.jsx)(tp,{guildId:r,paymentSources:f,priceOptions:x,currentPremiumSubscription:c,premiumSubscriptionPaymentSourceId:o,premiumSubscriptionPlan:C,newAdditionalPlans:g,paymentSourceId:d,setPaymentSourceId:h,onPaymentSourceAdd:_})}),(0,i.jsx)(ed.UX,{children:(0,i.jsx)(T.lo,{onBackClick:()=>t(u.pn.PLAN_SELECT),primaryButtonProps:I})})]})}},TENANT_PROVIDER_CONFIGS:{tenantProvidesCheckoutRoot:!0,CustomTenantProvider:e=>{let{tenantParams:{guildId:t,totalNumberOfSlotsToAssign:n=1,intent:l,disablePremiumUpsell:s,onSubscribeComplete:r,closeGuildPerksModal:a,analyticsLocation:o},applicationId:u,analyticsSourceLocation:c,stepConfigs:d,loadId:m,onComplete:h,children:p}=e,f=(0,A.bG)([w.A],()=>w.A.getPremiumTypeSubscription()),g=(0,C.A)(()=>n-(0,k.D$)(O.A.boostSlots).length);return(0,x.Ay)(()=>{null!=b.A.getGuild(t)||b.A.isGuildFetching(t)||(0,j.y)(t)}),(0,i.jsx)(S.M,{activeSubscription:f,stepConfigs:d,skuIDs:tv,loadId:m,unifiedCheckoutFlow:_.C.GUILD_BOOST_CHECKOUT,children:(0,i.jsxs)(ee,{initialNumGuildBoostsToPurchase:g,disablePremiumUpsell:s,closeGuildPerksModal:a,guildId:t,analyticsLocation:o,analyticsSourceLocation:c,applicationId:u,intent:l,onSubscribeComplete:r,children:[(0,i.jsx)(tW,{onComplete:h}),p]})})},TenantPaymentModalRenderer:e=>{let{originalPaymentModalProps:t,renderPaymentModal:n}=e,{numGuildBoostsToPurchase:l,guildId:r,existingAvailableSlotCount:a}=X(),o=(0,P.bB)(),c=(0,N.t4)(e=>e.purchaseState),d=(0,L.n)("GuildBoostUnifiedCheckout"),m=d&&(o===u.pn.REVIEW||o===u.pn.CONFIRM),h=(0,F.A)(m),p=s.useMemo(()=>({quantity:l}),[l]);return d&&o===u.pn.CONFIRM?(0,i.jsx)(G.A,{mediaUrls:h.mediaUrls,isSuccess:h.isSuccess,transitionState:t.transitionState,onClose:()=>(t.onClose(c===R.h.COMPLETED),Promise.resolve()),children:(e,n)=>(0,i.jsx)(U.A,{transitionState:t.transitionState,guild:M.A.getGuild(r),guildBoostQuantity:l+a,isTransfer:!1,graphic:e,onClose:n})}):n({...t,analyticsDataOverride:p,skipUnifiedHeaderForSteps:tK,disableUnsupportedExternalSubscriptionHandler:!0,isMediumModal:!0})},tenantAnalyticsLocation:I.A.GUILD_BOOST_PURCHASE_MODAL},CustomHeaderComponent:function(e){let{onClose:t,step:n}=e,l=(0,L.n)("GuildBoostUnifiedCheckout"),s=(0,N.t4)(e=>e.purchaseState),r=(0,y.A)();if(n===u.pn.PREMIUM_UPSELL)return null;if(n===u.pn.REVIEW){let e=null!=r?r.skuId:null;return(0,i.jsx)(T.s3,{...(0,v.uO)({skuId:e,step:n})})}return l?(0,i.jsx)(T.s3,{title:(0,v.uO)({skuId:null,step:n}).title}):(0,i.jsx)(D.A,{onClose:()=>t(s===R.h.COMPLETED),currentStep:n,purchaseState:s})},CUSTOM_CONFIRM_STEP_CONFIG:{renderStep:e=>(0,i.jsx)(ep,{...e}),options:{renderHeader:!0}}};var tZ=n(630303),tq=n(871109);let t$=s.createContext(void 0);function tJ(){let e=s.useContext(t$);return eg()(null!=e,"GuildProductPurchaseContext not found"),e}function tX(e){let{children:t,skuId:n,...l}=e,s=(0,A.bG)([tq.A],()=>tq.A.getGuildProduct(n));return eg()(null!=s,"guildProductListing cannot be null"),(0,i.jsx)(t$.Provider,{value:{guildProductListing:s,...l},children:t})}function tQ(e){let{handleClose:t}=e,{guildProductListing:l,guildId:s}=tJ(),r=(0,eB.sw)();return(0,x.Ay)(()=>{var e;eg()(null!=r,"invoicePreview cannot be null"),e={guildId:s,guildProductListingId:l.id,invoicePreview:r},(0,a.openModalLazy)(async()=>{let{default:t}=await Promise.all([n.e("57034"),n.e("67837"),n.e("35778"),n.e("47812"),n.e("13583"),n.e("28090")]).then(n.bind(n,779457));return n=>(0,i.jsx)(t,{...e,...n})}),t()}),null}var t0=n(939249),t1=n(789645),t2=n(303612),t3=n(916261),t4=n(575650);function t6(e){let{className:t,onClose:n}=e;return(0,i.jsx)(t0.D,{className:ev()(t3.cG,t),onClick:n,children:(0,i.jsx)(t1.P,{size:"xs",color:"currentColor",className:t3.yP})})}function t5(e){let{guildProductListing:t,onClose:n,className:l}=e;return(0,i.jsxs)(tP.rQ,{className:ev()(t3.wx,t4.G,l),separator:!1,"data-migration-pending":!0,children:[(0,i.jsx)(t2.A,{className:t3.F0,listing:t,imageSize:500,alt:""}),(0,i.jsx)(t6,{className:t3.b,onClose:n})]})}var t7=n(196617);let t8={CHECKOUT_FLOW:eI.CL.GUILD_PRODUCT_CHECKOUT,CHECKOUT_STEPS:{[u.pn.REVIEW]:tZ.p},TENANT_PROVIDER_CONFIGS:{CustomTenantProvider:e=>{let{tenantParams:{guildId:t},skuId:n,children:l}=e;return(0,i.jsx)(tX,{guildId:t,skuId:n,children:l})},tenantProvidesCheckoutRoot:!1,tenantAnalyticsLocation:I.A.GUILD_PRODUCT_PAYMENT_MODAL},CustomHeaderComponent:function(e){let{onClose:t,step:n}=e,{guildProductListing:l}=tJ();return n===u.pn.CONFIRM?null:(0,i.jsx)(t5,{guildProductListing:l,className:t7.w,onClose:()=>t(!1)})},CUSTOM_CONFIRM_STEP_CONFIG:{renderStep:e=>(0,i.jsx)(tQ,{...e})}};var t9=n(20742),ne=n(848149),nt=n(937008),nn=n(106778),nl=n(228366),ni=n(213530),ns=n(966971),nr=n(758836),na=n(483764);let no={sliderBodyClassName:na.Bz},nu=e=>{let{environment:t,setConfettiCanvas:n,customConfettiDisplayOptions:l,customConfettiVisible:s}=e;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(nn.Fk,{ref:n,className:na.Lb,environment:t.current}),(0,i.jsx)(ni.K,{options:l,className:ev()(na.Oh,{[na.R]:!s})})]})};var nc=n(702841),nd=n(775602),nm=n(31823),nh=n(211083),np=n(427675),nf=n(590180),ng=n(953150),nE=n(524246),nA=n(14368),nC=n(61750),nx=n(972607),nI=n(901930);function n_(e){let{handleClose:t,analyticsLocations:n}=e,{selectedSkuId:l,purchaseError:r,purchasePreviewError:a,appliedUserDiscounts:o}=(0,N.t4)(e=>({selectedSkuId:e.selectedSkuId,purchaseError:e.purchaseError,purchasePreviewError:e.purchasePreviewError,appliedUserDiscounts:e.appliedUserDiscounts})),{paymentError:u}=(0,nh.o)(),{application:c}=(0,nm.V)(),d=(0,np.gU)(),m=(0,nc.bG)([nf.A],()=>nf.A.getProduct(l)),h=s.useRef(!1);eg()(null!=l,"Expected selectedSkuId"),eg()(null!=c,"Expected application");let p=d[l];eg()(null!=p,"Expected sku");let f=null!=u||null!=r||null!=a,g=o.length>0?eo.intl.formatToPlainString(eo.t.VuV3Td,{discountOfferAmount:o[0].discount.amount}):void 0;return(s.useEffect(()=>{null==m||f||h.current||(h.current=!0,(0,nC.A)({product:m,overrideTitle:g,analyticsLocations:n,onCloseCallback:t,purchaseType:nr.gs.FIAT}))},[m,n,t,f,g]),f)?(0,i.jsx)(ed.dZ,{children:(0,i.jsx)(nI.A,{})}):null}function nS(e){let{isGift:t,giftCode:n,selectedGiftStyle:l,hasSentMessage:r,giftRecipient:a,giftMessageError:o,isSendingMessage:u,giftingOrigin:c}=(0,nt.Pv)(),d=(0,nc.bG)([nd.Ay],()=>nd.Ay.useReducedMotion),m=s.useRef(null),h=(0,N.t4)(e=>e.selectedSkuId),p=(0,nc.bG)([nf.A],()=>nf.A.getProduct(h)),{confettiColors:f}=(0,ng.A)(p?.styles);return s.useEffect(()=>{t&&null!=a&&null!=h&&(c===es.vQ.USER_PROFILE_WISHLIST||c===es.vQ.DM_CHANNEL_WISHLIST)&&nl.h.dispatch({type:"WISHLIST_GIFT_SENT",skuId:h,recipientId:a.id})},[t,a,h,c]),t?(0,i.jsxs)("div",{ref:m,children:[(0,i.jsx)(nx.A,{giftCode:n,onClose:e.handleClose,selectedGiftStyle:l,hasSentMessage:r,giftRecipient:a,giftMessageError:o,isSendingMessage:u}),!e.hideConfetti&&!d&&(0,i.jsx)(nE.A,{confettiTarget:m.current,confettiCanvas:e.confettiCanvas,sprites:(0,nA.rA)(p?.categorySkuId),colors:f?.map(e=>e.toHexString())})]}):(0,i.jsx)(n_,{...e})}var ny=n(564064),nv=n(993408),nT=n(575593),nN=n(452027),nj=n(922016),nb=n(778712),nR=n(986687),nP=n(999291),nL=n(903209),nM=n(674658),nO=n(898461),nw=n(203632),nk=n(892118),nD=n(536572),nU=n(456839),nG=n(219103),nF=n(525723),nV=n(780651);function nB(e){let{skuId:t,priceAmount:n,priceCurrency:l,className:r,previewHeaderClassName:a,hideProfilePreview:o}=e,{giftRecipient:u,giftRecipientError:c}=(0,nt.Pv)(),d=(0,A.bG)([e0.default],()=>e0.default.getCurrentUser()),m=e3.Ay.canUseShopDiscounts(d),h=(0,nP.Ay)(u?.id),p=s.useRef(null),[f,g]=s.useState(!1),{product:E}=(0,nM.q)(t,!0),C=s.useMemo(()=>(0,nv.fT)(E,m),[E,m]),x=(0,nF.V_)(E);if(null==E||0===E.items.length)return null;let[I]=E.items,_=(0,nD.VG)(E),S=null!=u&&u.id!==d?.id&&E.type!==nT.R.BUNDLE&&I.type!==nT.R.NAMEPLATE&&!o;return(0,i.jsxs)("div",{className:r,children:[(0,i.jsx)("div",{className:ev()(nV.QU,a),children:(0,i.jsx)(nN.D,{label:eo.intl.string(eo.t.PpoJzt),children:S&&(0,i.jsx)(nj.Y,{targetElementRef:p,align:"center",shouldShow:f,onRequestClose:()=>g(!1),preload:()=>(0,nL.A)(u.id,u.getAvatarURL(null,80)),renderPopout:e=>(0,i.jsx)(nR.A,{...e,user:u,pendingAvatar:u.getAvatarURL(null,(0,nb.FT)(nb._3.SIZE_80)),pendingAvatarDecoration:(0,nO.T)(I)?I:null,pendingProfileEffect:(0,nw.C3)(I)?I:null,pendingProfileFrame:(0,nk.s)(I)?I:null,canUsePremiumCustomization:!0,disabledInputs:!0,hideExampleButton:!0}),children:e=>{let{onClick:t,onMouseDown:n,...l}=e;return(0,i.jsx)(t0.D,{...l,className:nV.Nx,innerRef:p,onClick:e=>{g(e=>!e),t?.(e)},onMouseDown:e=>{f?e.stopPropagation():n?.(e)},children:(0,i.jsx)(eP.E,{variant:"text-xs/medium",color:"text-link",children:eo.intl.string(eo.t["2GnJQL"])})})}},h?.userId)})}),(0,i.jsxs)("div",{className:ev()(nV.i1,null!=c?nV.cN:nV.no),children:[(0,i.jsxs)("div",{className:nV.Ug,children:[(0,i.jsx)(nU.O,{product:E}),(0,i.jsxs)("div",{className:nV.JZ,children:[(0,i.jsx)(eP.E,{variant:"text-md/semibold",children:_}),(0,i.jsx)(ew.D,{variant:"heading-sm/medium",color:"text-default",children:E?.type===nT.R.BUNDLE?null:I.type===nT.R.AVATAR_DECORATION?eo.intl.string(eo.t["7v0T9P"]):I.type===nT.R.NAMEPLATE?eo.intl.string(eo.t.x5CoXR):I.type===nT.R.PROFILE_EFFECT?eo.intl.string(eo.t.wR5wOo):I.type===nT.R.PROFILE_FRAME?eo.intl.string(eo.t.GWrZOd):null})]}),(0,i.jsx)(nG.x,{priceAmount:n,priceCurrency:l,discount:C,discountOfferAmount:x,variant:"text-md/bold"})]}),null!=c&&(0,i.jsx)("div",{className:nV.Wh,children:(0,i.jsx)(eP.E,{variant:"text-sm/normal",color:"text-feedback-critical",children:c})})]})]})}var nH=n(783878),nW=n(966327),nK=n(427262);let nY=function(e){let{selectedSkuId:t,validateSelectedGift:n,className:l,recipients:s}=e,{giftRecipient:r,setGiftRecipient:a}=(0,nt.Pv)();return null==t?null:(0,i.jsx)("div",{className:l,children:(0,i.jsx)(nH.Z,{selectionMode:"single",label:eo.intl.string(eo.t.xFn72s),placeholder:eo.intl.string(eo.t.R0vK0N),value:r?.id,onSelectionChange:e=>{let l=s.find(t=>t.id===e);null!=l&&(n(l,t),a(l))},options:s.map(e=>({id:e.id,value:e.id,label:`${nK.Ay.getUserTag(e)}`,leading:(0,i.jsx)(nW.A,{user:e,size:nb._3.SIZE_20})}))})})};var nz=n(735438),nZ=n.n(nz),nq=n(427358),n$=n(570287),nJ=n(994500);function nX(){let e=(0,A.yK)([nJ.A],()=>nJ.A.getFriendIDs()),t=(0,A.yK)([nq.A],()=>nq.A.getUserAffinities().filter(e=>{let{isFriend:t,communicationProbability:n,vcProbability:l,otherUserId:i}=e,s=(0,n$.q)(i);return!t&&(n>=.1||l>=.1)&&s}).map(e=>{let{otherUserId:t}=e;return t})),n=s.useMemo(()=>nZ().uniq([...e,...t]),[e,t]);return(0,A.yK)([e0.default],()=>n.reduce((e,t)=>{let n=e0.default.getUser(t);return null==n||n.bot||e.push(n),e},[]),[n])}var nQ=n(871181),n0=n(318007),n1=n(285719),n2=n(976860),n3=n(353791);function n4(e){let{handleClose:t,selectedSkuId:n}=e,{analyticsLocations:l}=(0,eF.Ay)(I.A.COLLECTIBLES_GIFT_CUSTOMIZATION_MODAL);return(0,i.jsx)(ex.Q,{text:eo.intl.string(eo.t.J82mpK),onClick:function(){t(),(0,a.closeAllModals)(),null==n?(0,ny.Cz)({analyticsLocations:l,analyticsSource:I.A.COLLECTIBLES_GIFT_CUSTOMIZATION_MODAL}):(0,n2.pX)(`${ea.BVt.COLLECTIBLES_SHOP}#itemSkuId=${n}`)},textVariant:"text-sm/medium"})}let n6=(0,s.createContext)({setCustomConfettiVisible:()=>{},confettiCanvas:null,hideConfirmStepConfetti:!1,skuIDs:[]}),n5=()=>(0,s.useContext)(n6),n7=e=>{let{hideConfirmStepConfetti:t,confettiCanvas:n}=n5(),{analyticsLocations:l}=(0,eF.Ay)();return(0,i.jsx)(nS,{analyticsLocations:l,hideConfetti:t,confettiCanvas:n,...e})},n8={[u.pn.GIFT_CUSTOMIZATION]:()=>eo.intl.string(eo.t["JCFN/y"]),[u.pn.AWAITING_PURCHASE_TOKEN_AUTH]:()=>eo.intl.string(eo.t.lDbi6H),[u.pn.CONFIRM]:()=>""},n9=e=>{let{step:t}=e,n=n8[t];return null==n?null:(0,i.jsx)(t9.rQ,{title:n(),titleTextVariant:"heading-lg/semibold"})},le={CHECKOUT_FLOW:eI.CL.COLLECTIBLES_CHECKOUT,CHECKOUT_STEPS:{[u.pn.GIFT_CUSTOMIZATION]:e=>{let{handleStepChange:t,handleClose:n}=e,{renderLeftColumn:l,renderRightColumn:r,ctaDisabled:a,loading:o}=(e=>{let{handleStepChange:t,handleClose:n}=e,{customGiftMessage:l="",setCustomGiftMessage:s,giftRecipientError:r,setGiftRecipientError:a,validatingGiftRecipient:o,giftRecipient:u,giftingOrigin:c,setValidatingGiftRecipient:d}=(0,nt.Pv)(),{selectedSkuId:h,checkoutInvoicePreview:p}=(0,N.t4)(e=>({selectedSkuId:e.selectedSkuId,checkoutInvoicePreview:e.checkoutInvoicePreview})),f=(0,np.gU)(),g=(0,A.bG)([e0.default],()=>e0.default.getCurrentUser()),E=nX(),C=async(e,t)=>{d(!0),null!=r&&a(),await (0,ny.JJ)(e.id,t)||a(eo.intl.string(eo.t["4kgVqQ"])),d(!1)};(0,x.Ay)(()=>{null!=h&&null!=u&&(c!==es.vQ.DM_CHANNEL_WISHLIST&&m.default.track(ea.HAw.COLLECTIBLES_GIFTING_SHOP_ITEM_CLICKED,{sku_id:h}),C(u,h))});let I=()=>(0,i.jsx)(nQ.A,{onTextChange:e=>s?.(e),pendingText:l,currentText:l,disableThemedBackground:!0,className:n3.iX,innerClassName:n3.pt});return{renderLeftColumn:()=>(0,i.jsx)("div",{className:n3.qL,children:(0,i.jsx)(n0.t,{isShopGift:!0})}),renderRightColumn:()=>{let e=(0,nv.pA)({invoicePreview:p,selectedSkuId:h,skusById:f});return c===es.vQ.USER_PROFILE_WISHLIST||c===es.vQ.DM_CHANNEL_WISHLIST?(0,i.jsxs)("div",{children:[(0,i.jsx)(n1.Z,{giftRecipient:u}),I(),null!=e&&null!=h&&(0,i.jsx)(nB,{skuId:h,priceAmount:e.amount,priceCurrency:e.currency,className:n3.uW,previewHeaderClassName:n3.vX,hideProfilePreview:!0}),(0,i.jsx)("div",{className:n3.fi,children:(0,i.jsx)(n4,{handleClose:n,selectedSkuId:h})})]}):(0,i.jsxs)("div",{children:[(0,i.jsx)(nY,{selectedSkuId:h,recipients:E,className:n3.uh,validateSelectedGift:C}),I(),null!=e&&null!=h&&(0,i.jsx)(nB,{skuId:h,priceAmount:e.amount,priceCurrency:e.currency,className:n3.Ng})]})},onStepChange:t,onBackClick:n,ctaDisabled:null!=r||null==u||u.id===g?.id||l.length>es.Jo,loading:o}})({handleStepChange:t,handleClose:n}),u=s.useMemo(()=>({loading:o,disabled:a}),[o,a]);return(0,i.jsx)(eI.Mw,{paymentModalStepProps:e,layout:eI.XZ.TWO_COLUMN,renderLeftColumn:l,renderRightColumn:r,primaryCTAButtonProps:u})},[u.pn.REVIEW]:tZ.p},TENANT_PROVIDER_CONFIGS:{tenantProvidesCheckoutRoot:!0,CustomTenantProvider:e=>{let{skuId:t,children:n,...l}=e,{environment:r,confettiCanvas:a,setConfettiCanvas:o,customConfettiVisible:u,setCustomConfettiVisible:c,customConfettiDisplayOptions:d,hideConfirmStepConfetti:m}=(e=>{let{skuId:t}=e,n=s.useRef(new nn.OH),[l,i]=s.useState(null),[r,a]=s.useState(!1),o=s.useMemo(()=>(0,ns.AB)({purchaseType:nr.gs.FIAT,skuId:t}),[t]);return{environment:n,confettiCanvas:l,setConfettiCanvas:i,customConfettiVisible:r,setCustomConfettiVisible:a,customConfettiDisplayOptions:o,hideConfirmStepConfetti:null!=o}})({skuId:t}),h=(e=>{let{skuId:t}=e;return null!=t?[t]:[]})({skuId:t}),p=(0,s.useMemo)(()=>({skuIDs:h,setCustomConfettiVisible:c,hideConfirmStepConfetti:m,confettiCanvas:a}),[h,c,m,a]);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(nu,{environment:r,setConfettiCanvas:o,customConfettiDisplayOptions:d,customConfettiVisible:u}),(0,i.jsx)(S.M,{...l,skuIDs:h,stepConfigs:l.stepConfigs,activeSubscription:null,purchaseType:tr.VV.ONE_TIME,excludeSubscriptionPlansBySKU:!0,children:(0,i.jsx)(n6.Provider,{value:p,children:n})})]})},TenantPaymentModalRenderer:e=>{let{originalPaymentModalProps:t,renderPaymentModal:n}=e,{skuIDs:l,setCustomConfettiVisible:i}=n5(),{isGift:r}=(0,nt.Pv)(),a=(0,ne.J)(),{paymentModalSkuId:o,paymentModalOnClose:u,paymentModalOnComplete:c}=(e=>{let{skuIDs:t,onClose:n,onComplete:l,setCustomConfettiVisible:i}=e,r=t[0]??null,a=s.useCallback(()=>{i(!0),l?.()},[l,i]);return{paymentModalSkuId:r,paymentModalOnClose:s.useCallback(e=>{i(!1),n(e),nl.h.dispatch({type:"SKU_PURCHASE_MODAL_CLOSE",error:null})},[n,i]),paymentModalOnComplete:a}})({onClose:t.onClose,onComplete:t.onComplete,skuIDs:l,setCustomConfettiVisible:i}),d=s.useCallback(e=>{u(e),e&&r&&a()},[u,r,a]);return n({...t,skuId:o,onClose:d,onComplete:c,applicationId:ea.FYj})},tenantAnalyticsLocation:I.A.COLLECTIBLES_PAYMENT_MODAL},CustomHeaderComponent:e=>{let{step:t}=e,{isGift:n}=(0,nt.Pv)();return n?(0,i.jsx)(n9,{step:t}):null},CUSTOM_CONFIRM_STEP_CONFIG:{renderStep:e=>(0,i.jsx)(n7,{...e}),options:no}};var lt=n(354033),ln=n(491057),ll=n(496142),li=n(877624),ls=n(554146),lr=n(71804),la=n(426398),lo=n(841702),lu=n(367727),lc=n(380619),ld=n(374200),lm=n(771566),lh=n(625494),lp=n(45938),lf=n(97808),lg=n(912140),lE=n(780898),lA=n(344346),lC=n(837015),lx=n(258915);function lI(e){let{rewardSkuId:t,onClose:n,onRewardModalClose:l}=e,r=(0,A.bG)([e0.default],()=>e0.default.getCurrentUser()),a=(0,A.bG)([nd.Ay],()=>nd.Ay.useReducedMotion),{analyticsLocations:o}=(0,eF.Ay)(),u=nb._3.SIZE_32,{product:c,isFetching:d}=(0,nM.q)(t),[m,h]=s.useState(!1),p=c?.items[0],{isNameplateReward:f,nameplateData:g,rewardAvatarDecorationSrc:E}=s.useMemo(()=>null==p?{isNameplateReward:!1,nameplateData:null,rewardAvatarDecorationSrc:null}:(0,lC.F)(p)?{isNameplateReward:!0,nameplateData:{skuId:p.skuId,src:p.asset,palette:(0,lE.H6)(p.palette??"sky"),imgAlt:p.label},rewardAvatarDecorationSrc:null}:(0,nO.T)(p)?{isNameplateReward:!1,nameplateData:null,rewardAvatarDecorationSrc:(0,lg.A)({legacyAssetId:p.asset,skuId:p.skuId,size:u,canAnimate:!a})}:{isNameplateReward:!1,nameplateData:null,rewardAvatarDecorationSrc:null},[p,u,a]);return(0,i.jsx)(ed.UX,{children:(0,i.jsx)(tN.j,{children:(0,i.jsxs)("div",{className:lx.W,children:[f&&null!=g?(0,i.jsx)("div",{className:lx.D,onMouseEnter:()=>h(!0),onMouseLeave:()=>h(!1),children:(0,i.jsx)(lA.a,{user:r,nameplate:null,nameplateData:g,showPlaceholderUser:!0,nameplatePreviewSize:"xsmall",isHighlighted:m})}):(0,i.jsx)(lf.Js,{"aria-label":r?.username,size:u,src:r?.getAvatarURL(void 0,(0,nb.FT)(u),!a),avatarDecoration:E}),(0,i.jsx)(eC.$,{variant:"primary",text:eo.intl.string(eo.t.kMYVwv),loading:d,onClick:()=>{null!=c&&(n(),(0,nC.A)({product:c,shouldShowPromotionalExperience:!0,analyticsLocations:o,purchaseType:nr.gs.PROMOTIONAL,onCloseCallback:l}))}})]})})})}var l_=n(49999);function lS(e){let t,{handleClose:l,planGroup:r,onSubscriptionConfirmation:o,renderPurchaseConfirmation:u,postSuccessGuild:c,followupSKUInfo:d,continueSessionToInitialStep:h}=e,{paymentSources:p}=(0,la.jm)(),{activeSubscription:f,selectedSkuId:g,updatedSubscription:E,paymentSourceId:C,isPremiumGroupPurchase:I,startingPremiumSubscriptionPlanId:_,startingFractionalPremiumEndsAt:S}=(0,N.t4)(e=>({activeSubscription:e.activeSubscription,selectedSkuId:e.selectedSkuId,updatedSubscription:e.updatedSubscription,paymentSourceId:e.paymentSourceId,isPremiumGroupPurchase:e.get("isPremiumGroupPurchase"),startingPremiumSubscriptionPlanId:e.startingPremiumSubscriptionPlanId,startingFractionalPremiumEndsAt:e.startingFractionalPremiumEndsAt})),v=(0,y.A)(),T=(0,P.bB)(),{isGift:j,giftRecipient:b,giftCode:R,hasSentMessage:L,isSendingMessage:M,sendGiftMessage:O,claimableRewards:w,selectedGiftingPromotionReward:k,openGiftingBadgePostPurchaseModal:D}=(0,nt.Pv)(),{confirmationFooter:U}=(0,ln.cG)(),G=(0,lc.px)(v,j,w),F=(0,lc.Mq)(v),V=(0,lo.Mv)(k,!1),B=(0,A.bG)([ld.A],()=>ld.A.getGiftPromotion()?.id),H=(0,A.bG)([ld.A],()=>{let e=ld.A.getMarketingComponentByType(li.C.GIFT_REMINDER_NAGBAR);return null==e||"giftReminderNagbar"!==e.properties.properties.oneofKind?null:e.properties.properties.giftReminderNagbar}),W=(0,em.g)(p,C),K=j&&null!=k&&null!=V&&F,Y={selectedPlan:v,selectedSkuId:g,step:T};if(null==v)throw new lr.v({message:"Expected plan to be selected",extraSentryInformation:Y});if(null==g)throw new lr.v({message:"Expected selectedSkuId",extraSentryInformation:Y});if(null==T)throw new lr.v({message:"Step should be set",extraSentryInformation:Y});let z=s.useCallback(()=>{l(),o?.()},[l,o]);(0,x.Ay)(()=>{I&&m.default.track(ea.HAw.PREMIUM_GROUP_PURCHASE_CONFIRMATION_VIEWED,{has_updated_subscription:null!=E,has_any_premium_group:E?.hasAnyPremiumGroup??!1,subscription_id:E?.id})}),s.useEffect(()=>{function e(){if(I)if(null!=E&&E.hasAnyPremiumGroup){m.default.track(ea.HAw.PREMIUM_GROUP_PURCHASE_FRIEND_SELECTOR_OPENED,{subscription_id:E.id});let e=(0,nz.uniqueId)("premium-group-purchase-flow-modal");(0,a.openModalLazy)(async()=>{let{default:e}=await Promise.all([n.e("17494"),n.e("44616"),n.e("96680"),n.e("85579")]).then(n.bind(n,785606));return t=>(0,i.jsx)(e,{...t,subscription:E,isFromPurchaseFlow:!0,onClose:async()=>{lh._.dispatch(ea.jej.PREMIUM_GROUP_PURCHASE_FLOW_COMPLETED),await t.onClose()}})},{onCloseRequest:()=>{lh._.dispatch(ea.jej.PREMIUM_GROUP_PURCHASE_FLOW_COMPLETED),(0,a.closeModal)(e)},modalKey:e})}else m.default.track(ea.HAw.PREMIUM_GROUP_PURCHASE_FRIEND_SELECTOR_SKIPPED,{has_updated_subscription:null!=E,has_any_premium_group:E?.hasAnyPremiumGroup??!1}),lh._.dispatch(ea.jej.PREMIUM_GROUP_PURCHASE_FLOW_COMPLETED)}return lh._.subscribe(ea.jej.WOW_MOMENT_CONFIRMATION_MODAL_CLOSED,e),()=>{lh._.unsubscribe(ea.jej.WOW_MOMENT_CONFIRMATION_MODAL_CLOSED,e)}},[I,E]),s.useEffect(()=>{!j||null==b||null==R||L||M||(0,lp.Ik)(b)||O({onSubscriptionConfirmation:o})},[O,j,b,R,L,M,o]),s.useEffect(()=>{G&&null!=H&&null!=B&&(0,lu.qr)(ls.M.GIFTING_PROMOTION_REMINDER,B,{dismissAction:l_.i.INDIRECT_ACTION})},[H,B,G]);let Z=null!=h?lm.Rs.DEEPLINK_TO_DESKTOP_APP:void 0;if(null!=u)t=u(v,z,E);else if(j)t=(0,i.jsx)(lm.fw,{planId:v.id,onClose:z});else{let e=_===v.id?{postSuccessGuild:c}:{followupSKUInfo:d,startingPremiumSubscriptionPlanId:_,isDowngrade:null!=f&&(0,ei.vT)(f,v.id,r)};t=(0,i.jsx)(lm.Ay,{planId:v.id,onClose:z,paymentSourceType:W,hideClose:null!=U,startingFractionalPremiumEndsAt:S,customCTAType:Z,...e})}return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(ed.dZ,{children:[(0,i.jsx)(nI.A,{}),t]}),null!=U&&U,K&&null!=k&&(0,i.jsx)(lI,{rewardSkuId:k,onClose:z,onRewardModalClose:D})]})}let[ly,lv]=(0,$.A)(),lT={CHECKOUT_FLOW:eI.CL.GUILD_ROLE_CHECKOUT,CHECKOUT_STEPS:{[u.pn.REVIEW]:ll.E},TENANT_PROVIDER_CONFIGS:{CustomTenantProvider:e=>{let{tenantParams:{guildId:t,listing:n},children:l}=e,r=s.useMemo(()=>({guildId:t,listing:n}),[t,n]);return(0,i.jsx)(ly.Provider,{value:r,children:(0,i.jsx)(ln.Qt,{children:l})})},tenantProvidesCheckoutRoot:!1},CustomHeaderComponent:e=>{let{onClose:t,step:n}=e,{guildId:l,listing:s}=lv();return(0,i.jsx)(lt.Y,{onClose:t,listing:s,step:n,guildId:l})},CUSTOM_CONFIRM_STEP_CONFIG:{renderStep:e=>(0,i.jsx)(lS,{...e}),options:{modalSizeGetter:()=>"md"}}};var lN=n(73825),lj=n(960851),lb=n(607399),lR=n(795791),lP=n(344159),lL=n(561794),lM=n(811656),lO=n(187322),lw=n(890856),lk=n(947641),lD=n(713517),lU=n(929283),lG=n(761365),lF=n(267861);function lV(e){let t,n,{skuId:l,user:r,claimed:a,onSelect:o,selectedSkuId:u}=e,[c,d]=s.useState(null),m=s.useCallback(e=>{d(e)},[]),h=s.useMemo(()=>({current:c}),[c]),{isHoveringOrFocusing:p}=(0,lD.A)(h),f=!a&&p,{product:g}=(0,nM.q)(l);if(null==g)return null;let E=g.items[0];return null==E?null:((0,nO.T)(E)?(n=nT.R.AVATAR_DECORATION,t=(0,i.jsx)(lU.i,{item:E,user:r,isHighlighted:f,avatarSize:nb._3.SIZE_96})):(0,lC.F)(E)&&(n=nT.R.NAMEPLATE,t=(0,i.jsx)(lG.A,{nameplate:E,user:r,isHighlighted:f,size:"small"})),(0,i.jsx)(lO.vN,{children:(0,i.jsxs)(lw.s,{ref:m,"aria-label":g.name??"",onClick:function(){null==l||null==o||a||o(l)},className:ev()(lF._x,{[lF.Vp]:!a,[lF.mr]:f,[lF.md]:u===l}),children:[(0,i.jsx)("div",{className:ev()(lF.VH,{[lF._Q]:n===nT.R.AVATAR_DECORATION,[lF.M4]:n===nT.R.NAMEPLATE}),children:null!=t?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("div",{className:ev()(lF.i1,{[lF.Sf]:a}),children:t}),a&&(0,i.jsx)(lk.r,{size:"custom",width:48,height:48,color:eT.A.colors.INTERACTIVE_TEXT_ACTIVE,className:lF.j0})]}):null}),(0,i.jsxs)("div",{className:lF.tZ,children:[(0,i.jsx)(ew.D,{variant:"heading-md/extrabold",children:g.name}),(0,i.jsx)(eP.E,{variant:"text-sm/normal",children:a?eo.intl.string(eo.t["6cfuDj"]):eo.intl.string(eo.t.QQsaCc)})]})]})}))}var lB=n(696208),lH=n(683433);function lW(e){let{onStepChange:t,selectedPlanId:n,paymentSources:l,onBackClick:r,showBackButton:a,planOptions:o,shouldRenderUpdatedPaymentModal:u=!1,isTrial:c,isNextDisabled:d=!1}=e,{paymentSources:m}=(0,la.jm)(),h=(0,y.A)(),{isGift:p,claimableRewards:f}=(0,nt.Pv)();l=l??m;let{variant:g,text:E,onClick:A,disabled:C}=lK({onStepChange:t,selectedPlanId:n=n??h?.id,isGift:p,claimableRewards:f,paymentSources:l,shouldRenderUpdatedPaymentModal:u,isTrial:c,isNextDisabled:d}),x=s.useMemo(()=>null!=n&&o.includes(n)?[{variant:g,text:E,onClick:A,disabled:C}]:[{variant:"primary",text:eo.intl.string(eo.t.XqMe3N),disabled:!0}],[g,E,A,C,n,o]);return(0,i.jsx)(lB.H,{leading:a&&null!=r?(0,i.jsx)(lH.A,{onClick:r}):void 0,actions:x})}let lK=e=>{let{onStepChange:t,selectedPlanId:n,isGift:l,claimableRewards:i,paymentSources:s,shouldRenderUpdatedPaymentModal:r,isTrial:a,isNextDisabled:o=!1}=e,c=(0,A.bG)([w.A],()=>w.A.getPremiumTypeSubscription()),d=(0,y.A)(),m=(0,P.bB)(),{hasEntitlements:h}=(0,lP.X)(n,l),p=null!=c&&null!=c.paymentSourceId||Object.keys(s).length>0||h&&!a;var f=r?eo.intl.string(eo.t.PDTjLN):eo.intl.string(eo.t.XqMe3N),g=u.pn.ADD_PAYMENT_STEPS;return p&&(g=u.pn.REVIEW),(0,lc.px)(d,l,i)&&m!==u.pn.SELECT_FREE_SKU&&(g=u.pn.SELECT_FREE_SKU),{variant:"primary",text:f,onClick:()=>t(g),disabled:o}};var lY=n(328232);function lz(e){let{handleStepChange:t}=e,n=(0,N.t4)(e=>e.selectedSkuId),l=(0,y.A)(),r=(0,P.bB)(),{setSelectedGiftingPromotionReward:a,selectedGiftingPromotionReward:o,claimableRewards:c}=(0,nt.Pv)(),d=(0,A.bG)([e0.default],()=>e0.default.getCurrentUser()),m=(0,A.yK)([ld.A],()=>ld.A.getGiftPromotionRewardSkuIds()),h=function(e,t){if(null!=e&&0!==e.length)return null!=t&&e.includes(t)?t:e[0]}(c,o),[p,f]=s.useState(h),[g,E]=s.useState(!1);s.useEffect(()=>{g||null!=o||null==h||(a(h),f(h))},[h,g,o,a]);let C={selectedPlan:l,selectedSkuId:n,step:r};if(null==l)throw new lr.v({message:"Expected plan to be selected",extraSentryInformation:C});if(null==n)throw new lr.v({message:"Expected selectedSkuId",extraSentryInformation:C});if(null==r)throw new lr.v({message:"Step should be set",extraSentryInformation:C});let x=s.useMemo(()=>null!=p&&(c??[]).includes(p),[p,c]),I=s.useMemo(()=>0===m.length||null==p||!x,[m,p,x]);s.useEffect(()=>{if(0===m.length){f(void 0),a(void 0);return}null!=p&&x&&m.includes(p)||null==p||(f(void 0),a(void 0))},[m,x,p,a]);let _=e=>{a(e),f(e),E(!0)},S=m.map(e=>(0,i.jsx)(lV,{skuId:e,claimed:null!=c&&!c.includes(e),user:d,onSelect:_,selectedSkuId:p},e)),v=(0,i.jsx)(ed.UX,{children:(0,i.jsx)(lW,{onStepChange:t,onBackClick:()=>t(u.pn.PLAN_SELECT),shouldRenderUpdatedPaymentModal:!0,showBackButton:!0,planOptions:[l.id],selectedPlanId:l.id,isNextDisabled:I})});return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(t9.rQ,{titleTextVariant:"heading-lg/semibold",title:eo.intl.string(eo.t.OEtqpm),subtitle:eo.intl.string(eo.t.h2nMp0)}),(0,i.jsx)(V.c,{children:(0,i.jsx)(tL.B,{direction:"vertical",justify:"center",align:"center",children:(0,i.jsx)("div",{className:lY.Dq,children:S})})}),v]})}var lZ=n(800471),lq=n(38405);let l$=function(e,t,n,l,i){let r=(0,s.useRef)(!1),a={componentName:e,sentryErrorOptions:i,stateToCapture:l},o=(0,s.useRef)(a);(0,s.useEffect)(()=>{o.current=a}),(0,s.useEffect)(()=>{let{componentName:e,sentryErrorOptions:l,stateToCapture:i}=o.current;if(t&&!r.current){r.current=!0;let t=setTimeout(()=>{let t=Error(`${e} is taking too long to load.`);lq.A.setExtra({loadingState:i,loadingTimeSeconds:n}),lq.A.captureException(t,{...l,tags:{...l?.tags}})},1e3*n);return()=>{clearTimeout(t)}}},[t,n])};var lJ=n(463376),lX=n(699595),lQ=n(442123),l0=n(67948),l1=n(807098),l2=n(298305),l3=n(387745);function l4(){let e=(0,A.bG)([ld.A],()=>{let e=ld.A.getMarketingComponentByType(li.C.GIFT_CUSTOMIZATION_BANNER);return null==e||"giftCustomizationBanner"!==e.properties.properties.oneofKind?null:e.properties.properties.giftCustomizationBanner}),{claimableRewards:t}=(0,nt.Pv)(),n=(0,l1.T)(e?.asset),l=(0,l1.T)(e?.backgroundAsset),s=e?.gradient,r=null!=s&&null!=s.colors&&s.colors.length>=2?(0,lc.K5)({gradient:s.colors,angle:s.angle??void 0}):void 0,a=(0,lc.gc)(l);null!=a&&(a.backgroundSize="cover, auto",a.backgroundPosition="right center, 0% 0%");let o=(0,lc.x)(a,r),u=e?.assetVariant===l0.u.LARGE_TILTED;return null==e||null==t?null:(0,i.jsxs)("div",{className:l3.qD,style:o,children:[(0,i.jsx)("div",{className:ev()([l3.my],{[l3.R_]:u}),children:(0,i.jsx)(l2.A,{claimableRewards:t,maxRewardImageSrc:n??"",size:u?nb._3.SIZE_72:nb._3.SIZE_40,imageScaling:1.25})}),(0,i.jsx)(eP.E,{variant:"text-md/medium",color:"always-white",children:eo.intl.string(eo.t.Abiuci)})]})}var l6=n(410516),l5=n(361597),l7=n(69494),l8=n(622631),l9=n(597770),ie=n(102741),it=n(296589);function il(e){let{giftMessage:t=eo.intl.string(eo.t["DrgnS+"])}=e,{isGift:n,giftRecipient:l}=(0,nt.Pv)();return!n||(0,lp.Ik)(l)?null:(0,i.jsx)(ie.A,{className:it.z,iconSize:ie.A.Sizes.SMALL,icon:l9.o,color:null==t?ie.A.Colors.PRIMARY:ie.A.Colors.SECONDARY,children:t})}var ii=n(71867),is=n(249872);function ir(e){let{handleStepChange:t,initialPlanId:n,planGroup:l,subscriptionTier:r,trialId:a,handleClose:o}=e,{selectedSkuId:c,priceOptions:d,activeSubscription:m,defaultPlanId:h}=(0,N.t4)(e=>({selectedSkuId:e.selectedSkuId,priceOptions:e.checkoutPriceOptions,activeSubscription:e.activeSubscription,defaultPlanId:e.defaultPlanId})),{isPremium:p,isEligibleForTrial:f,isEligibleForDiscount:g,discountOffer:E}=(0,lJ.i)(),A=(0,l6.YJ)(E),x=(0,y.A)(),I=(0,P.bB)(),{isGift:_,giftRecipient:S,giftMessage:v,claimableRewards:T}=(0,nt.Pv)(),j=(0,lc.Mq)(x),b=(0,nc.bG)([ld.A],()=>{let e=ld.A.getMarketingComponentByType(li.C.GIFT_CUSTOMIZATION_BANNER);return null!=e&&"giftCustomizationBanner"===e.properties.properties.oneofKind}),R=_&&j&&null!=T&&T.length>0&&b,L=(f||g)??!1,{monthlyDefaultSelected:M}=lQ.A.useConfig({location:`PremiumPaymentPlanSelectStep${_?"":" - DO NOT USE"}`}),O=(0,C.A)(M),w=s.useMemo(()=>{let e=h;return _&&O&&null!=c&&(e=es.En[c]),(0,e3.Tm)({skuId:c,isPremium:p,defaultPlanId:e})},[c,p,h,_,O]),k=g&&null!=A&&w.includes(A)?A:w[0],D=(0,nc.bG)([el.A],()=>el.A.get(k)),U=[{planId:D?.id,quantity:1}],[G,F]=s.useState(L),[V,B]=(0,eW.YV)({items:U,renewal:!1,preventFetch:!L,applyEntitlements:!0,trialId:a,paymentSourceId:d.paymentSourceId,currency:d.currency});s.useEffect(()=>{L&&F(V?.subscriptionPeriodEnd==null)},[V,L]),l$("Payment Modal Plan Select Step",G,5,{proratedInvoicePreview:V,proratedInvoiceError:B,isEligibleForOffer:L},{tags:{app_context:"billing"}});let H=B?.message??eo.intl.string(eo.t.R0RpRX),W=L&&null==B,K=L&&null!=B,Y=W&&null==m&&V?.subscriptionPeriodEnd==null;(0,lX.W)({priceOptions:d,trialId:a,discountInvoicePreview:V});let z=s.useMemo(()=>({planOptions:w,selectedPlanId:x?.id,planGroup:l,subscriptionPeriodEnd:V?.subscriptionPeriodEnd,useCompactGiftComponents:R,handleClose:o}),[w,x?.id,l,V?.subscriptionPeriodEnd,R,o]);if(Y)return(0,i.jsx)(e8.E,{className:is.QW});eg()(null!=I,"Step should be set"),eg()(w.length>0,"Premium plan options should be set");let Z=_?(0,i.jsx)(l5.$p,{...z}):(0,i.jsx)(l8.X,{...z,isInPlanSelectStep:!0,showPlanStatusSubText:!0});return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(il,{giftMessage:v}),!(_&&(0,lp.Ik)(S))&&(0,i.jsx)(l7.A,{isEligibleForTrial:f}),(0,i.jsxs)(ed.dZ,{children:[(0,i.jsx)(ii.P,{className:is.ZB,planSkuId:D?.skuId}),(0,i.jsx)(nI.A,{}),K?(0,i.jsx)(eE.w,{type:"critical",children:H}):Z,W&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("hr",{className:ev()(is.IM,is.Go)}),(0,i.jsx)(eP.E,{variant:"text-xs/normal",children:eo.intl.format(eo.t.BHtnqA,{link:e1.A.getArticleURL(ea.MVz.PREMIUM_DETAILS_CANCEL_SUB)})})]})]}),(0,i.jsxs)(ed.UX,{children:[R&&(0,i.jsx)(l4,{}),(0,i.jsx)(lW,{onStepChange:t,onBackClick:()=>t(u.pn.SKU_SELECT),showBackButton:null==n&&null==r,planOptions:w,shouldRenderUpdatedPaymentModal:W,isTrial:f})]})]})}var ia=n(862990),io=n(672525);function iu(e){let{isGift:t,skuId:n}=e,l=(0,N.t4)(e=>e.referralTrialOfferId??void 0),i=(0,ez.V)(l);return!t&&null!=i&&null!=n&&es.TP[i.trial_id].skus.includes(n)}var ic=n(634378);function id(e){let{handleStepChange:t}=e,{setSelectedSkuId:n,setSelectedPlanId:l,priceOptions:s,activeSubscription:r,defaultPlanId:a,startedPaymentFlowWithPaymentSources:o,referralTrialOfferId:c}=(0,N.t4)(e=>({setSelectedSkuId:e.setSelectedSkuId,setSelectedPlanId:e.setSelectedPlanId,priceOptions:e.checkoutPriceOptions,activeSubscription:e.activeSubscription,defaultPlanId:e.defaultPlanId,startedPaymentFlowWithPaymentSources:e.startedPaymentFlowWithPaymentSources,referralTrialOfferId:e.referralTrialOfferId??void 0})),{hasPaymentSources:d}=(0,la.jm)(),{isGift:m,claimableRewards:h}=(0,nt.Pv)(),p=m&&null!=h&&h.length>0,f=(0,ez.V)(c);return(0,i.jsx)(im,{selectSku:e=>(function(e){let{activeSubscription:t,newSkuId:n,setSelectedSkuId:l,handleStepChange:i,isGift:s,userTrialOffer:r,setSelectedPlanId:a,startedPaymentFlowWithPaymentSources:o,defaultPlanId:c}=e;l(n);let d=u.pn.PLAN_SELECT,m=(0,e3.aZ)(t);m!==es.pe.TIER_1&&m!==es.pe.TIER_2||n!==es.pe.TIER_0||s||(d=u.pn.WHAT_YOU_LOSE);let h=function(e){let{userTrialOffer:t,isGift:n,skuId:l}=e;return!n&&null!=t&&null!=l&&es.TP[t.trial_id].skus.includes(l)}({userTrialOffer:r,isGift:s,skuId:n}),p=(0,lZ.vT)({isTrial:h,isGift:s,selectedSkuId:n,startedPaymentFlowWithPaymentSources:o});d!==u.pn.WHAT_YOU_LOSE&&p&&(d=u.pn.REVIEW,a((0,lZ.xT)(n,t,c))),i(d,{analyticsDataOverride:{sku_id:n}})})({activeSubscription:r,newSkuId:e,setSelectedSkuId:n,handleStepChange:t,isGift:m,userTrialOffer:f,startedPaymentFlowWithPaymentSources:o,setSelectedPlanId:l,defaultPlanId:a}),onSelectPremiumGroup:()=>(function(e){let{setSelectedPlanId:t,handleStepChange:n,hasPaymentSources:l,setSelectedSkuId:i}=e;i((0,e3.mH)(es.pe.TIER_2)),t(es.gD.PREMIUM_GROUP_MONTH),n(l?u.pn.REVIEW:u.pn.ADD_PAYMENT_STEPS,{analyticsDataOverride:{sku_id:es.pe.TIER_2}})})({setSelectedPlanId:l,handleStepChange:t,hasPaymentSources:d,setSelectedSkuId:n}),isGift:m,priceOptions:s,showPromotionalGiftBanner:p})}function im(e){let{selectSku:t,isGift:n,priceOptions:l,showPromotionalGiftBanner:s,onSelectPremiumGroup:r}=e,a=(0,ia.FY)({isGift:n});return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(t9.rQ,{titleTextVariant:"heading-lg/semibold",title:eo.intl.string(eo.t["r+SebU"])}),a?(0,i.jsx)(V.c,{children:(0,i.jsx)("div",{className:ic.eE,children:(0,i.jsx)(io.yS,{onSelectSku:e=>t((0,e3.mH)(e)),onSelectPremiumGroup:r,priceOptions:l,showPromotionalGiftBanner:s})})}):(0,i.jsx)(V.c,{children:(0,i.jsx)("div",{className:ic.a2,children:(0,i.jsx)(io.Ay,{onSelectSku:e=>t((0,e3.mH)(e)),isGift:n,priceOptions:l,showPromotionalGiftBanner:s})})})]})}var ih=n(825484),ip=n(137728);function ig(e){let{handleStepChange:t,handleClose:n}=e,{selectedSkuId:l,setSelectedPlanId:s,activeSubscription:r,startedPaymentFlowWithPaymentSources:a}=(0,N.t4)(e=>({selectedSkuId:e.selectedSkuId,setSelectedPlanId:e.setSelectedPlanId,activeSubscription:e.activeSubscription,startedPaymentFlowWithPaymentSources:e.startedPaymentFlowWithPaymentSources})),{isGift:o}=(0,nt.Pv)(),c=null!=r?(0,e3.EL)(r):null,d=null!=c?(0,e3.RH)(c.planId):null,m=null!=c?(0,e3.m6)(c.planId):null,h=(0,lZ.vT)({isTrial:!1,isGift:o,selectedSkuId:l,startedPaymentFlowWithPaymentSources:a});return eg()(null!=m,"Expected premium type"),(0,i.jsx)(ip.A,{premiumType:m,titleText:eo.intl.string(eo.t["7VcWW0"]),subtitleText:eo.intl.format(eo.t.Qk34Ik,{subscriptionName:d}),footer:(0,i.jsxs)(ih.e,{direction:"horizontal-reverse",align:"center",children:[(0,i.jsx)(eC.$,{variant:"primary",text:eo.intl.string(eo.t["3PatSz"]),onClick:()=>{h?(s((0,lZ.xT)(l,r)),t(u.pn.REVIEW)):t(u.pn.PLAN_SELECT)}}),(0,i.jsx)(eC.$,{variant:"secondary",onClick:n,text:eo.intl.string(eo.t.rzVN6j)})]}),onClose:n,isDowngrade:!0})}var iE=n(242874),iA=n(573359),iC=n(165191),ix=n(237412),iI=n(865543);let i_=[{key:u.pn.SKU_SELECT,renderStep:e=>(0,i.jsx)(id,{...e}),options:{renderHeader:!1,hideSlider:!0,modalSizeGetter:e=>{let{canCurrentlyPurchasePremiumGroup:t}=e;return t?"xl":"md"}}},{key:u.pn.WHAT_YOU_LOSE,renderStep:e=>(0,i.jsx)(ig,{...e}),options:{modalSizeGetter:()=>"md",renderHeader:!1,hideSlider:!0}},{key:u.pn.PLAN_SELECT,renderStep:e=>(0,i.jsx)(ir,{...e}),options:{renderHeader:!0,useBreadcrumbLabel:e=>(0,lZ.lp)(e)?null:eo.intl.string(eo.t["r+SebU"]),sectionHeaderText:()=>eo.intl.string(eo.t.UKbp1N),modalSizeGetter:e=>{let{isGift:t}=e;return t?"xl":"md"}}},{key:u.pn.SELECT_FREE_SKU,renderStep:e=>(0,i.jsx)(lz,{...e}),options:{modalSizeGetter:()=>"lg",hideDefaultModalBody:!0}}],iS={CustomHeaderComponent:function(e){let{onClose:t}=e,{selectedSkuId:n,purchaseState:l}=(0,N.t4)(e=>({selectedSkuId:e.selectedSkuId,purchaseState:e.purchaseState})),r=(0,A.bG)([iA.A],()=>iA.A.isDisplayingWowMomentConfirmation),{isPremium:a,isPremiumGroupPurchase:o,isEligibleForTrial:c,isEligibleForDiscount:d}=(0,lJ.i)(),m=(0,np.S3)(),h=(0,P.bB)(),{isGift:p,selectedGiftStyle:f,giftRecipient:g}=(0,nt.Pv)(),E=m?.productLine===ea.EZt.COLLECTIBLES,C=m?.productLine===ea.EZt.SOCIAL_LAYER_GAME_ITEM,x=p&&(0,lp.Ik)(g)&&h===u.pn.CONFIRM&&null!=f&&!E&&!C,I=[u.pn.SKU_SELECT,u.pn.SELECT_FREE_SKU],_=null!=h&&!I.includes(h)&&null!=n,S=s.useCallback(()=>t(!1),[t]);return s.useMemo(()=>{if(null==h)return;let e=null;return x?e=(0,i.jsxs)("div",{className:iI.kL,children:[(0,i.jsx)("div",{"aria-hidden":!0,style:{display:"contents"},children:(0,i.jsx)(iC.A,{defaultAnimationState:iE.oA.LOOP,giftStyle:f,className:iI.qq})}),(0,i.jsx)(tP.s_,{onClick:S,className:iI.b,"data-migration-pending":!0})]}):_&&(eg()(n in es.WN,`invalid sku id: ${n}`),e=(0,i.jsx)(ix.A,{currentStep:h??void 0,purchaseState:l,premiumType:es.WN[n],onClose:S,showTrialBadge:c,showDiscountBadge:d,isGift:p,giftRecipient:g,isEligibleForTrial:c,enablePremiumBrandRefresh:a,isDisplayingWowMomentConfirmation:r,isPremiumGroupPurchase:o})),e},[f,S,l,n,h,c,d,x,_,p,g,a,r,o])},CHECKOUT_FLOW:_.C.PREMIUM_CHECKOUT,STEPS_BEFORE_CHECKOUT:i_,CHECKOUT_STEPS:{[u.pn.REVIEW]:ll.E},TENANT_PROVIDER_CONFIGS:{tenantProvidesCheckoutRoot:!0,CustomTenantProvider:e=>{let{tenantParams:{confirmationFooter:t,defaultPlanId:n,referralCode:l,referralTrialOfferId:r,subscriptionTier:a,subscription:o},stepConfigs:c,loadId:d,giftContextProps:m={isGift:!1,giftRecipient:null},renderModalProps:h,children:p}=e,f=(0,A.bG)([w.A],()=>w.A.getPremiumTypeSubscription()),g=(0,lj.cg)()?es.gD.PREMIUM_MONTH_TIER_2:void 0,{isGift:E,giftRecipient:C}=m;if(null!=a&&!Object.values(es.pe).includes(a))throw Error("subscriptionTier must be a premium subscription");let x=(0,lL.tA)({giftRecipient:C,isGift:E??!1}),I=s.useMemo(()=>x?c.map(e=>e.key===u.pn.SKU_SELECT&&null!=e.options?{...e,options:{...e.options,modalSizeGetter:()=>"xl"}}:e):c,[c,x]),y=null!=o?o:f,v=!E&&null!=y&&y.isPurchasedExternally&&null!=y.paymentGateway;(0,lP.s)(y,()=>h.onClose(),E??!1);let T=s.useMemo(()=>[...es.oz],[]);return v?null:(0,i.jsx)(S.M,{loadId:d,activeSubscription:y,stepConfigs:I,skuIDs:T,isGift:E,defaultPlanId:g??n,referralCode:l,referralTrialOfferId:r,unifiedCheckoutFlow:_.C.PREMIUM_CHECKOUT,children:(0,i.jsx)(ln.Qt,{confirmationFooter:t,children:p})})},TenantPaymentModalRenderer:e=>{let{originalPaymentModalProps:t,renderPaymentModal:n,tenantParams:{subscriptionTier:l}}=e,{onClose:r,renderPurchaseConfirmation:a,continueSessionToInitialStep:o}=t;s.useEffect(()=>{el.A.isLoadedForPremiumSKUs()||nl.h.wait(()=>(0,lN.zS)())},[]);let{selectedSkuId:c,purchaseState:d}=(0,N.t4)(e=>({selectedSkuId:e.selectedSkuId,purchaseState:e.purchaseState})),m=(0,P.bB)(),{isGift:h,selectedGiftingPromotionReward:p,openGiftingBadgePostPurchaseModal:f}=(0,nt.Pv)(),g=s.useMemo(()=>h?[u.pn.PLAN_SELECT]:[],[h]),E=s.useCallback((e,t)=>{r(e,t),e&&h&&null==p&&f()},[r,h,p,f]),A=!h&&c===es.pe.TIER_2&&!lb.Ct&&!lb.KY&&null==(0,lR.uM)(),C=d===R.h.PURCHASING;return(0,i.jsx)(lM.A,{isConfirmationStep:m===u.pn.CONFIRM&&null==o&&null==a,isEligibleForWowMoment:A,shouldPrefetchWowMoment:C,children:n({...t,onClose:E,analyticsSubscriptionType:ea.rzx.PREMIUM,shakeWhilePurchasing:!0,planGroup:es.LE,subscriptionTier:l,skipUnifiedHeaderForSteps:g})})},tenantAnalyticsLocation:I.A.PREMIUM_PAYMENT_MODAL},CUSTOM_CONFIRM_STEP_CONFIG:{renderStep:e=>(0,i.jsx)(lS,{...e}),options:{modalSizeGetter:()=>"md"}}};var iy=n(143582),iv=n(241524),iT=n(19311),iN=n(4126);let ij="(max-width: 485px)";var ib=n(702361),iR=n(938430);function iP(e){let{step:t,onClose:n}=e,l=(0,iv.A)("(max-height: 450px)");return t===u.pn.CONFIRM||t===u.pn.BENEFITS?(0,i.jsx)("div",{}):(0,i.jsxs)("div",{className:ev()(ib.N1,t4.G),children:[!l&&(0,i.jsx)("div",{className:ib.oZ,"aria-hidden":"true",children:(0,i.jsx)("img",{src:"/assets/6a6a49ffafe96618.svg",alt:"",className:ib.F0})}),(0,i.jsx)(t0.D,{className:ib.G3,onClick:()=>n(),"aria-label":eo.intl.string(eo.t.cpT0Cq),children:(0,i.jsx)(t1.P,{size:"md",color:"currentColor",className:ib.ut})})]})}function iL(e){let{icon:t,storeListingBenefits:n,skuBenefits:l,application:s,title:r,subtitle:a,description:o}=e;return null==s?null:(0,i.jsx)("div",{className:ib.RP,children:(0,i.jsxs)(iN.$K,{children:[(0,i.jsx)(iN.KF,{application:s,asset:t}),(0,i.jsx)(iN.kj,{children:r}),(0,i.jsx)(iN.ri,{}),(0,i.jsx)(iN.Mx,{title:a,description:o}),(0,i.jsx)(iN.iH,{applicationId:s.id,storeListingBenefits:n,skuBenefits:l})]})})}function iM(e){let{tierName:t,onConfirm:n,subscription:l}=e;return(0,i.jsxs)("div",{className:ib.NV,children:[(0,i.jsx)("img",{src:iR,alt:"",width:300,height:126}),(0,i.jsx)(ew.D,{className:ib.i1,variant:"heading-xl/extrabold",color:"text-strong",children:eo.intl.format(eo.t.wLFT6z,{tier:t})}),(0,i.jsx)(eP.E,{className:ib.sT,variant:"text-md/medium",color:"text-default",children:eo.intl.format(eo.t.OsAK9h,{timestamp:l?.currentPeriodEnd})}),(0,i.jsx)(ed.UX,{children:(0,i.jsx)(iT.Ay,{onPrimary:n,primaryCTA:iT.ti.CONTINUE,primaryText:eo.intl.string(eo.t["JtWl+a"])})})]})}var iO=n(967198);let[iw,ik]=(0,$.A)();function iD(e){let{guildId:t,showBenefitsFirst:n,children:l}=e,[r,a]=s.useState(null),o=s.useMemo(()=>({guildId:t,showBenefitsFirst:n,subscriptionMetadataRequest:r,setSubscriptionMetadataRequest:a}),[t,n,r]);return(0,i.jsx)(iw.Provider,{value:o,children:l})}n(938796);var iU=n(266060),iG=n(163437),iF=n(701273),iV=n(425013);function iB(e){let{onConfirm:t,onCancel:n,title:l,subtitle:s,confirmCta:r,showOpenDiscord:a=!0}=e;return(0,i.jsxs)("div",{className:iV.RP,children:[(0,i.jsx)(ew.D,{className:iV.RS,variant:"heading-lg/extrabold",children:l}),null!=s?(0,i.jsx)(eP.E,{className:iV.sT,variant:"text-sm/normal",color:"text-default",children:s}):null,(0,i.jsxs)("div",{className:iV.UD,children:[a&&(0,i.jsx)(eC.$,{variant:"primary",text:eo.intl.string(eo.t["8L5bZG"]),fullWidth:!0,onClick:()=>(0,iF.A)("application_sub_mweb_success_modal")}),(0,i.jsx)(eC.$,{variant:"secondary",text:r,fullWidth:!0,onClick:t}),null!=n&&(0,i.jsx)(eC.$,{variant:"secondary",text:eo.intl.string(eo.t.iAfxo3),fullWidth:!0,onClick:n})]})]})}function iH(e){let{onConfirm:t,tierName:n,subscription:l}=e;return(0,i.jsxs)("div",{className:iV.RP,children:[(0,i.jsx)(ew.D,{className:iV.RS,variant:"heading-lg/extrabold",children:eo.intl.format(eo.t.wLFT6z,{tier:n})}),(0,i.jsx)(eP.E,{className:iV.sT,variant:"text-sm/normal",color:"text-default",children:eo.intl.format(eo.t.OsAK9h,{timestamp:l?.currentPeriodEnd})}),(0,i.jsxs)("div",{className:iV.UD,children:[(0,i.jsx)("div",{"data-button-hoisted-classname-wrapper":!0,className:iV.__invalid_openDiscordButton,children:(0,i.jsx)(eC.$,{variant:"primary",text:eo.intl.string(eo.t["8L5bZG"]),onClick:()=>(0,iF.A)("application_sub_mweb_success_modal")})}),(0,i.jsx)(eC.$,{variant:"secondary",text:eo.intl.string(eo.t.nlkywz),onClick:t})]})]})}function iW(e){let{handleStepChange:t,handleClose:n}=e,l=(0,iU.K)(),{subscriptionMetadataRequest:r}=ik(),{application:a}=(0,nm.V)(),o=(0,np.S3)(),c=(0,iv.A)(ij),d=(0,A.bG)([M.A],()=>M.A.getGuild(r?.guild_id)),m=s.useCallback(()=>t(u.pn.REVIEW),[t]);if(null==o)return null;let h=(0,iG.bg)(o.flags);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(ed.dZ,{children:c?(0,i.jsx)(iB,{confirmCta:eo.intl.string(eo.t.PBHFSq),onConfirm:m,onCancel:n,title:eo.intl.format(eo.t["6n6oXA"],{tier:o.name}),subtitle:h?eo.intl.string(eo.t.lzAoKB):eo.intl.formatToPlainString(eo.t["GqaY/j"],{guildName:d?.name}),showOpenDiscord:!1}):(0,i.jsx)(iL,{icon:l?.thumbnail,storeListingBenefits:l?.benefits,application:a??void 0,title:eo.intl.format(eo.t.haiCxc,{tier:o.name}),subtitle:h?eo.intl.string(eo.t.RvtbP5):eo.intl.string(eo.t.zY39Zu),description:h?eo.intl.formatToPlainString(eo.t.QCe4rY,{applicationName:a?.name}):eo.intl.string(eo.t.n1Pu8C)})}),!c&&(0,i.jsx)(ed.UX,{children:(0,i.jsx)(iT.Ay,{onBack:n,backText:eo.intl.string(eo.t.TQBY1J),onPrimary:m,primaryCTA:iT.ti.CONTINUE,primaryText:eo.intl.string(eo.t["gZhF+3"])})})]})}var iK=n(21161);function iY(e){let t,n,{handleClose:l,onSubscriptionConfirmation:r}=e,a=(0,iU.K)(),{application:o}=(0,nm.V)(),{readySlideId:c,updatedSubscription:d}=(0,N.t4)(e=>({readySlideId:e.readySlideId,updatedSubscription:e.updatedSubscription})),m=(0,np.S3)(),h=(0,iv.A)(ij),{createMultipleConfettiAt:p}=s.useContext(iK.x),f=m?.name??"",g=()=>{l(),r?.()},E=c===u.pn.CONFIRM,A=(0,iG.bg)(m?.flags??0),C=null!=a&&a.benefits.length>0?eo.intl.formatToPlainString(eo.t["+IQQVM"],{benefitCount:a.benefits.length}):null,{showBenefitsFirst:x}=ik();return x?t=h?(0,i.jsx)(iH,{tierName:f,onConfirm:g,subscription:d}):(0,i.jsx)(iM,{tierName:f,onConfirm:g,subscription:d}):h?t=(0,i.jsx)(iB,{title:eo.intl.format(eo.t.ea6tZr,{tierName:f}),subtitle:null!=a&&a.benefits.length>0?eo.intl.formatToPlainString(eo.t.HNepft,{benefits:C}):null,onConfirm:g,confirmCta:eo.intl.string(eo.t.nlkywz)}):(t=null!=a&&null!=o?(0,i.jsx)(iL,{icon:a.thumbnail,storeListingBenefits:a.benefits,application:o,title:eo.intl.format(eo.t["Q+qktS"],{tier:f}),subtitle:eo.intl.string(eo.t.ECKxXU),description:A?eo.intl.format(eo.t["MAtQk/"],{applicationName:o?.name}):eo.intl.format(eo.t.vHkMF4,{tier:f})}):(0,i.jsx)(K.A,{}),n=(0,i.jsx)(iT.Ay,{onPrimary:g,primaryCTA:iT.ti.CONTINUE,primaryText:eo.intl.string(eo.t["JtWl+a"])})),s.useEffect(()=>{nd.Ay.useReducedMotion&&E&&p(window.innerWidth/2,window.innerHeight/2)},[p,E]),(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(ed.dZ,{children:[(0,i.jsx)(nI.A,{}),t]}),null!=n&&(0,i.jsx)(ed.UX,{children:n})]})}var iz=n(304072),iZ=n(427858),iq=n(166926),i$=n(953761);let iJ={CHECKOUT_FLOW:_.C.PREMIUM_APPS_SUBSCRIPTION_CHECKOUT,CustomCheckoutPredicateStep:function(e){let{initialPlanId:t,setAnalyticsData:n}=e,{selectedSkuId:l,setSelectedSkuId:r,setSelectedPlanId:a,priceOptions:o}=(0,N.t4)(e=>({selectedSkuId:e.selectedSkuId,setSelectedSkuId:e.setSelectedSkuId,setSelectedPlanId:e.setSelectedPlanId,priceOptions:e.checkoutPriceOptions})),{hasFetchedRelatedSubscriptionPlans:c,subscriptionPriceOptionsLoading:d,displayCurrency:m}=(0,W.Jn)(),{setSubscriptionMetadataRequest:h,guildId:p,showBenefitsFirst:f}=ik(),g=(0,B.Hp)(),E=z(),A=(0,P.l)(),{isGift:C}=(0,nt.Pv)(),x=f?u.pn.BENEFITS:u.pn.REVIEW,[I,_]=s.useState(!E||!c||d);return(s.useEffect(()=>{_(!E||!c||d)},[d,c,E]),s.useEffect(()=>{null!=p&&h({guild_id:p})},[p,h]),s.useEffect(()=>{a(t);let e=null!=t?el.A.get(t):null;I||g||(n(t=>{let n=null!=e?(0,e3.y8)(e.id,!1,C,{paymentSourceId:o.paymentSourceId}):void 0;return{...t,subscription_plan_id:e?.id,price:n?.amount,regular_price:e?.price,currency:m}}),null!=e&&(r(e?.skuId),A(x)))},[g,t,C,I,o,m,l,n,a,r,A,x]),I)?(0,i.jsx)(K.A,{}):g?(0,i.jsx)(H.oO,{}):null},CustomHeaderComponent:e=>{let{step:t,onClose:n}=e,l=s.useCallback(()=>n(!1),[n]);return(0,i.jsx)(iP,{step:t,onClose:l})},STEPS_BEFORE_CHECKOUT:[{key:u.pn.BENEFITS,renderStep:e=>(0,i.jsx)(iW,{...e}),options:{useBreadcrumbLabel:()=>eo.intl.string(eo.t["5LD2+B"])}}],CHECKOUT_STEPS:{[u.pn.REVIEW]:function(e){let{handleStepChange:t,planGroup:n,openInvoiceId:l,analyticsData:r,analyticsLocation:a}=e,{purchaseState:o,contextMetadata:c,purchaseError:d,setCurrency:m,activeSubscription:h}=(0,N.t4)(e=>({purchaseState:e.purchaseState,contextMetadata:e.contextMetadata,purchaseError:e.purchaseError,setCurrency:e.setCheckoutCurrency,activeSubscription:e.activeSubscription})),{paymentSources:p}=(0,la.jm)(),{dropdownCurrencies:f}=(0,W.Jn)(),{subscriptionMetadataRequest:g,showBenefitsFirst:E}=ik(),A=E?u.pn.BENEFITS:void 0,C=(0,y.A)(),x=(0,np.S3)();if(null==C)throw new lr.v({message:"Expected plan to be selected",extraSentryInformation:{selectedPlan:C}});let I=s.useRef(null),[_,S]=(0,iz.A)(!1,500),v=(0,eB.mx)(),T=(0,iG.bg)(x?.flags??0);s.useEffect(()=>{null!=d&&null!=I.current&&I.current.scrollIntoView({behavior:"smooth"})},[d]);let j=s.useRef(null),b=s.useCallback(()=>{t(u.pn.ADD_PAYMENT_STEPS)},[t]);return o===R.h.PURCHASING?(0,i.jsx)(K.A,{}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(ed.dZ,{children:null==h?(0,i.jsx)(i$._,{selectedPlanId:C.id,planGroup:n,paymentSources:p,handlePaymentSourceAdd:b,metadata:T?void 0:g}):(0,i.jsx)(iZ.A,{premiumSubscription:h,paymentSources:p,handlePaymentSourceAdd:b,planId:C.id,planGroup:n,currencies:f,onCurrencyChange:e=>m(e),hasOpenInvoice:null!=l,purchaseState:o})}),(0,i.jsx)(ed.UX,{children:(0,i.jsx)(iq.U,{premiumSubscription:h??null,onBack:()=>null!=A&&t(A),handleStepChange:t,postPurchaseStep:u.pn.CONFIRM,legalTermsNodeRef:j,flashLegalTerms:()=>S(!0),analyticsLocation:a,baseAnalyticsData:r,flowStartTime:c.startTime,planGroup:n,openInvoiceId:l,metadata:T?void 0:g,backButtonEligible:!!E||void 0,invoiceError:v,disablePurchase:g?.guild_id==null&&!T,onPaymentSourceAdd:b})})]})}},TENANT_PROVIDER_CONFIGS:{tenantProvidesCheckoutRoot:!0,CustomTenantProvider:e=>{let{loadId:t,applicationId:n,activeSubscription:l,stepConfigs:s,skuId:r,tenantParams:a,children:o}=e,{guildId:u,showBenefitsFirst:c}=a;return(0,i.jsx)(S.M,{loadId:t,applicationId:n,activeSubscription:l,stepConfigs:s,skuIDs:[r],unifiedCheckoutFlow:_.C.PREMIUM_APPS_SUBSCRIPTION_CHECKOUT,children:(0,i.jsx)(iD,{guildId:u,showBenefitsFirst:c,children:(0,i.jsx)(ln.Qt,{children:o})})})},TenantPaymentModalRenderer:e=>{let{originalPaymentModalProps:t,renderPaymentModal:n,tenantParams:{forcesTransitionToGuild:l,guildId:i}}=e,r=t.onClose,a=t.onComplete,o=s.useCallback(e=>{r(e),e&&null!=i&&(Y.hP(),(0,iy.f5)(i),null!=a&&a(),null!=i&&(l||iO.A.getGuildId()!==i)&&(0,n2.pX)(ea.BVt.CHANNEL(i)))},[r,a,l,i]);return n({...t,onClose:o,forceNewPaymentModal:!0})},tenantAnalyticsLocation:I.A.APPLICATION_SUBSCRIPTION_CHECKOUT},CUSTOM_CONFIRM_STEP_CONFIG:{renderStep:e=>(0,i.jsx)(iY,{...e})}};var iX=n(989553);function iQ(e){let{handleClose:t}=e,n=(0,N.t4)(e=>e.selectedSkuId),{application:l}=(0,nm.V)(),s=(0,np.gU)(),{isGift:r,giftRecipient:a}=(0,nt.Pv)();eg()(null!=n,"Expected selectedSkuId"),eg()(null!=l,"Expected application");let o=s[n];eg()(null!=o,"Expected sku");let u=r?eo.intl.formatToPlainString(eo.t["2VjPTw"],{itemName:o.name,giftRecipient:a?.username??"your recipient"}):eo.intl.formatToPlainString(eo.t.wK0IbP,{applicationName:l.name,itemName:o.name});return(0,i.jsxs)(ed.dZ,{children:[(0,i.jsx)(nI.A,{}),(0,i.jsxs)("div",{className:iX.EL,children:[(0,i.jsx)(ew.D,{variant:"heading-xxl/bold",className:iX.RS,children:"Success!"}),(0,i.jsx)(eP.E,{variant:"text-md/normal",children:u}),(0,i.jsx)("div",{className:iX.yF}),(0,i.jsx)(eC.$,{onClick:t,text:eo.intl.string(eo.t.cpT0Cq),fullWidth:!0})]})]})}var i0=n(67480),i1=n(328968),i2=n(371794),i3=n(565756);u.pn.GIFT_CUSTOMIZATION;let i4={CustomHeaderComponent:e=>{let{step:t,onClose:n}=e,l=s.useCallback(()=>n(!1),[n]);return(0,i.jsx)(iP,{step:t,onClose:l})},CHECKOUT_FLOW:eI.CL.PREMIUM_APPS_OTP_CHECKOUT,CHECKOUT_STEPS:{[u.pn.GIFT_CUSTOMIZATION]:e=>{let{customGiftMessage:t="",setCustomGiftMessage:n,giftRecipient:l}=(0,nt.Pv)(),r=(0,N.t4)(e=>e.selectedSkuId),a=(0,A.bG)([e0.default],()=>e0.default.getCurrentUser()),o=(0,A.bG)([i0.A],()=>null!=r?i0.A.get(r):null,[r]),u=nX(),c=(0,A.bG)([i1.A],()=>null!=r?i1.A.getForSKU(r):null,[r]),d=c?.headerBackground!=null&&o?.applicationId!=null?(0,i2.YE)(o.applicationId,c.headerBackground,256):void 0,m=async(e,t)=>{},h=null==l||l.id===a?.id||t.length>es.Jo,p=s.useMemo(()=>({disabled:h}),[h]);return(0,i.jsx)(eI.Mw,{onBackClick:e.handleClose,paymentModalStepProps:e,layout:eI.XZ.TWO_COLUMN,renderLeftColumn:()=>(0,i.jsxs)("div",{className:i3.P6,children:[o?.name!=null&&(0,i.jsx)(ew.D,{variant:"heading-lg/semibold",color:"text-strong",children:o.name}),null!=d&&(0,i.jsx)("img",{src:d,alt:o?.name??"",className:i3.LC})]}),renderRightColumn:()=>(0,i.jsxs)("div",{className:i3.P6,children:[(0,i.jsx)(nY,{recipients:u,selectedSkuId:r,validateSelectedGift:m}),(0,i.jsx)(nQ.A,{onTextChange:e=>n?.(e),pendingText:t,currentText:t,disableThemedBackground:!0,className:i3.iX,innerClassName:i3.pt})]}),primaryCTAButtonProps:p})},[u.pn.REVIEW]:tZ.p},CUSTOM_CONFIRM_STEP_CONFIG:{renderStep:e=>(0,i.jsx)(iQ,{...e})},TENANT_PROVIDER_CONFIGS:{CustomTenantProvider:e=>e.children,tenantProvidesCheckoutRoot:!1,tenantAnalyticsLocation:I.A.APPLICATION_OTP_PAYMENT_MODAL}};var i6=n(429913),i5=n(733391),i7=n(26594),i8=n(510022),i9=n(317560),se=n(366523),st=n(910200),sn=n(208733);function sl(e){let{handleClose:t}=e,{analyticsLocations:n}=(0,eF.Ay)(),{selectedSkuId:l,entitlementsGranted:r}=(0,N.t4)(e=>({selectedSkuId:e.selectedSkuId,entitlementsGranted:e.entitlementsGranted})),{application:a}=(0,nm.V)(),o=(0,np.gU)(),{isGift:u,giftRecipient:c}=(0,nt.Pv)();eg()(null!=l,"Expected selectedSkuId"),eg()(null!=a,"Expected application");let d=o[l];eg()(null!=d,"Expected sku");let m=r.find(e=>e.sku_id===l),h=(0,i7.G)(m,{isGift:u});return(s.useEffect(()=>{u||((0,i9.j)(),t(),(0,i8.n)({sku:d,application:a,analyticsLocations:n,entitlement:m}))},[u,d,a,t,n,m]),u)?(0,i.jsxs)(ed.dZ,{children:[(0,i.jsx)(nI.A,{}),(0,i.jsxs)("div",{className:sn.EL,children:[(0,i.jsx)(se.e,{sku:d,shape:"square",containerClassName:sn.LC}),(0,i.jsx)(ew.D,{variant:"heading-xl/semibold",className:sn.RS,children:eo.intl.string(eo.t["5glWta"])}),(0,i.jsx)(eP.E,{variant:"text-md/normal",children:eo.intl.formatToPlainString(eo.t["2VjPTw"],{itemName:d.name,giftRecipient:c?.username??"your recipient"})}),null!=h&&(0,i.jsx)("div",{className:sn.Is,children:(0,i.jsx)(st.O,{Icon:h.Icon,text:h.text})}),(0,i.jsx)("div",{className:sn.UD,children:(0,i.jsx)(eC.$,{onClick:t,text:eo.intl.string(eo.t.cpT0Cq),fullWidth:!0})})]})]}):null}n(801541);var si=n(889137),ss=n(742158),sr=n(313961),sa=n(238017),so=n(650588),su=n(117218),sc=n(763827),sd=n(403362),sm=n(871123),sh=n(832163),sp=n(31969),sf=n(44724),sg=n(980094),sE=n(806931),sA=n(107610);function sC(e){let{handleClose:t,sku:n,application:l}=e,r=s.useCallback(()=>{(0,sf.G)({applicationId:n.applicationId})},[n.applicationId]),o=s.useCallback(()=>{t();let e=sh.A.getStorefrontState(n.applicationId)?.activePage;(0,sm.uV)({pathname:window.location.pathname,search:window.location.search,applicationId:n.applicationId,pageIndex:e??0,guildId:l?.guildId,skuId:n.id})||((0,a.closeAllModals)(),(0,sf.default)({applicationId:n.applicationId,pageIndex:e??0,skuId:n.id,slug:n.slug}))},[n.applicationId,n.id,n.slug,t,l]);return(0,i.jsx)("div",{className:sA.$O,children:(0,i.jsx)(ex.Q,{text:eo.intl.string(eo.t.ImioFL),onMouseDown:r,onClick:o,textVariant:"text-sm/medium",lineClamp:void 0})})}let sx={CHECKOUT_FLOW:eI.CL.SLAYER_STOREFRONT_CHECKOUT,CHECKOUT_STEPS:{[u.pn.GIFT_CUSTOMIZATION]:e=>{let{handleStepChange:t,handleClose:n}=e,{renderStepBody:l,disabled:r}=function(e){var t;let n,l,r,{handleStepChange:a,handleClose:o}=e,{customGiftMessage:u="",setCustomGiftMessage:c,giftRecipient:d,emojiConfetti:m,soundEffect:h,setEmojiConfetti:p,setSoundEffect:f,giftingOrigin:g,additionalUserIds:E}=(0,nt.Pv)(),C=(0,N.t4)(e=>e.selectedSkuId),{application:x}=(0,nm.V)(),I=(0,A.bG)([e0.default],()=>e0.default.getCurrentUser()),_=(t=I?.id,n=nX(),l=function(e){let t=(0,A.bG)([sc.A],()=>sc.A.isConnected()?sc.A.getChannelId():null),[n,l]=s.useState([]);return s.useEffect(()=>{let n=null!=t?sr.A.getParticipants(t):[],i=[],s=new Set;for(let t of n)!(0,sE.Xw)(t)&&!(0,sE.Ay)(t)||t.user.id===e||s.has(t.user.id)||(s.add(t.user.id),i.push(t));i.sort((e,t)=>(0,sE.Ay)(e)&&!(0,sE.Ay)(t)?-1:(0,sE.Ay)(t)&&!(0,sE.Ay)(e)?1:0),l(i.map(e=>e.user))},[t,e]),n}(t),r=(0,A.yK)([e0.default],()=>E?.map(e0.default.getUser).filter(sd.Vq)??[],[E]),s.useMemo(()=>nZ().uniqWith([...null!=d?[d]:[],...r,...l,...n],(e,t)=>e.id===t.id),[d,r,l,n])),S=(0,A.bG)([i0.A],()=>null!=C?i0.A.get(C):null,[C]),{userPrice:y}=(0,su.CD)({sku:S,priceSetAssignmentPurchaseType:ea.lid.GIFT}),v=(0,sp.F)("gift_customization",{applicationId:x?.id,skuId:S?.id}),T=(0,sm.fq)(S),j=(0,sm.xf)(S);async function b(e,t){}let R=e=>{null!=f&&f(null==e?void 0:e)},P=()=>(0,i.jsxs)("div",{className:sA.mT,children:[null!=T&&(0,i.jsx)(se.A,{containerClassName:sA.T3,cardImage:T,cardBackgroundImage:j,altText:S?.name??"",shape:"square"}),(0,i.jsxs)("div",{className:sA._T,children:[(0,i.jsx)(so.A,{sound:h,onSelect:R}),(0,i.jsx)(sa.A,{setEmojiConfetti:p,emojiConfetti:null==m?void 0:m})]})]}),L=()=>(0,i.jsxs)("div",{className:sA.Tc,children:[null!=d&&(g===es.vQ.USER_PROFILE_WISHLIST||g===es.vQ.DM_CHANNEL_WISHLIST)?(0,i.jsx)(n1.Z,{giftRecipient:d}):(0,i.jsx)(nY,{selectedSkuId:C,validateSelectedGift:b,recipients:_}),(0,i.jsx)(nQ.A,{onTextChange:e=>c?.(e),pendingText:u,currentText:u,disableThemedBackground:!0,className:sA.iX,innerClassName:sA.pt}),null==S?null:(0,i.jsxs)("div",{className:sA.AN,children:[(0,i.jsx)(ss.z,{className:sA.jr,children:eo.intl.string(eo.t.PpoJzt)}),(0,i.jsxs)("div",{className:sA.Wx,children:[(0,i.jsx)("div",{className:sA.Xb,children:null!=S&&null!=T&&(0,i.jsx)(se.A,{containerClassName:sA.Iy,cardImage:T,cardBackgroundImage:j,altText:S.name,shape:"square"})}),(0,i.jsxs)("div",{className:sA.vz,children:[null!=x&&(0,i.jsx)(sg.Q,{application:x}),(0,i.jsx)(eP.E,{variant:"text-sm/semibold",children:S.name})]}),(0,i.jsx)(eP.E,{variant:"text-md/semibold",children:y})]})]}),null!=S&&(0,sm.Ri)(S)&&(0,i.jsx)(eE.w,{type:"info",children:eo.intl.string(eo.t.lORYb6)}),null!=v&&(0,i.jsx)(st.O,{Icon:v.Icon,text:v.text,endDatetime:v.endsAt,tooltip:v.tooltip}),null!=S&&(0,i.jsx)(sC,{handleClose:o,sku:S,application:x})]});return{renderStepBody:function(){return(0,i.jsxs)("div",{className:sA.Du,children:[P(),L()]})},getLeftColumnComponent:P,getRightColumnComponent:L,onStepChange:a,onBackClick:o,disabled:null==d||d.id===I?.id||u.length>es.Jo}}({handleStepChange:t,handleClose:n}),a=s.useMemo(()=>({disabled:r}),[r]);return(0,i.jsx)(eI.Mw,{paymentModalStepProps:e,layout:eI.XZ.CUSTOM_STEP_BODY,renderStepBody:l,primaryCTAButtonProps:a})},[u.pn.REVIEW]:tZ.p},CUSTOM_CONFIRM_STEP_CONFIG:{renderStep:e=>(0,i.jsx)(sl,{...e})},TENANT_PROVIDER_CONFIGS:{tenantProvidesCheckoutRoot:!0,CustomTenantProvider:e=>{let{children:t,discoverySessionId:n,loadId:l,applicationId:r,isGift:a,skuId:o,...u}=e;return!function(e){let{applicationId:t,skuId:n}=e,l=(0,i6.h)(t);s.useEffect(()=>{null==l||null==n||i1.A.isFetchingForSKU(n)||null!=i0.A.get(n)||(0,i5.Pp)(l.id,n)},[l,n])}({applicationId:r,skuId:o}),(0,i.jsx)(S.M,{loadId:l,discoverySessionId:n,applicationId:r,skuIDs:[o],purchaseType:tr.VV.ONE_TIME,isGift:a,...u,activeSubscription:null,children:t})},TenantPaymentModalRenderer:e=>{let{originalPaymentModalProps:t,renderPaymentModal:n}=e;return n({...t,analyticsObject:t.analyticsSourceLocation})},tenantAnalyticsLocation:I.A.SLAYER_STOREFRONT_PAYMENT_MODAL},CustomHeaderComponent:function(e){let{step:t}=e,n=(0,si.YW)(t).with(u.pn.GIFT_CUSTOMIZATION,()=>eo.intl.string(eo.t["JCFN/y"])).with(u.pn.AWAITING_PURCHASE_TOKEN_AUTH,()=>eo.intl.string(eo.t.lDbi6H)).with(u.pn.CONFIRM,()=>"").otherwise(()=>null);return null==n?null:(0,i.jsx)(t9.rQ,{title:n,titleTextVariant:"heading-lg/semibold"})}};var sI=n(46225),s_=n(587895),sS=n(944355),sy=n(977445),sv=n(211287),sT=n(623373),sN=n(739508),sj=n(715054);(0,r.A)();var sb=n(136857),sR=n(158317),sP=n(855104);n(322076);var sL=((l={})[l.INSUFFICIENT_ORB_BALANCE=1e3]="INSUFFICIENT_ORB_BALANCE",l[l.MISSING_DEPENDENT_SKU_ENTITLEMENT=1001]="MISSING_DEPENDENT_SKU_ENTITLEMENT",l[l.SKU_PRODUCT_LINE_NOT_PURCHASABLE=1002]="SKU_PRODUCT_LINE_NOT_PURCHASABLE",l[l.SKU_ALREADY_OWNED=1003]="SKU_ALREADY_OWNED",l[l.FRACTIONAL_PREMIUM_ACTIVE_MOBILE_SUBSCRIPTION=1004]="FRACTIONAL_PREMIUM_ACTIVE_MOBILE_SUBSCRIPTION",l[l.SKU_NOT_AVAILABLE_FOR_DISTRIBUTION=1005]="SKU_NOT_AVAILABLE_FOR_DISTRIBUTION",l[l.SKU_MISSING_ORB_PRICE=1006]="SKU_MISSING_ORB_PRICE",l[l.SKU_IS_THIRD_PARTY=1007]="SKU_IS_THIRD_PARTY",l[l.SLAYER_STOREFRONT_ORB_REDEMPTION_DISABLED=1008]="SLAYER_STOREFRONT_ORB_REDEMPTION_DISABLED",l[l.FRACTIONAL_PREMIUM_SUBSCRIPTION_GROUP_MEMBER=1009]="FRACTIONAL_PREMIUM_SUBSCRIPTION_GROUP_MEMBER",l[l.BUNDLE_PARTIALLY_OWNED=1010]="BUNDLE_PARTIALLY_OWNED",l[l.SOCIAL_LAYER_NOT_PURCHASABLE=1011]="SOCIAL_LAYER_NOT_PURCHASABLE",l[l.FRAMES_FIAT_EXCLUSIVE=1012]="FRAMES_FIAT_EXCLUSIVE",l[l.FIRST_PARTY_NO_ORBS=1013]="FIRST_PARTY_NO_ORBS",l),sM=n(318254),sO=n(576052),sw=n(120992),sk=n(194256),sD=n(319820),sU=n(200766);let sG=e=>{let{sku:t,orbPriceAmount:n}=e,{product:l,isSocialLayerGameItem:s}=(0,sD.AO)({sku:t}),r=(0,sk.oO)(l);s?r=eo.intl.string(ta.default.qwSlCO):(0,sT.Ab)(l)&&(r=eo.intl.string(eo.t["0TmQRG"]));let a=(0,sk.dL)(t),o=(0,nr.EZ)(t.id)?sO.m[t.id].render({className:sU.$}):(0,i.jsx)(tn.WH,{sku:t,product:l});return(0,i.jsx)(tn.f7,{label:a,description:r,graphic:o,price:null!=n?`${n}`:"",PriceIcon:sM.C})},sF=e=>{let{skuId:t,orbPriceAmount:n}=e;(0,sw.c)({applicationId:(0,d.P)(t),skuIDs:[t]});let l=(0,nc.bG)([i0.A],()=>i0.A.get(t),[t]);return null==l?(0,i.jsx)(eU.y,{type:eU.y.Type.PULSING_ELLIPSIS}):(0,i.jsx)(sG,{sku:l,orbPriceAmount:n})},sV=e=>{let{orbBalance:t}=e;return(0,i.jsx)(sS.vW,{label:eo.intl.string(eo.t.y0WGqP),value:null!=t?`${t}`:"",Icon:sM.C})},sB=()=>eo.intl.string(eo.t.wmcDyu);function sH(e){let{skuId:t}=e,{immediateDelivery:n}=(0,e9.U)(),l=function(e){let{skuId:t}=e,n=sB(),l=(0,A.bG)([i0.A],()=>i0.A.get(t),[t]),i=l?.productLine,s=l?.applicationId,r=(0,A.bG)([s_.A],()=>i===ea.EZt.SOCIAL_LAYER_GAME_ITEM?s_.A.getApplication(s):null,[s,i]),{fetched:a,hasAlreadyLinked:o}=(0,sI.RD)(r);return i!==ea.EZt.SOCIAL_LAYER_GAME_ITEM?{type:sS.I0.OrbsRedemption,purchaseButtonText:n}:{type:sS.I0.GiftGameShop,purchaseButtonText:n,applicationName:r?.name,applicationId:s,shouldAppendDisclaimer:a&&!o}}({skuId:t});return(0,i.jsx)(sS._P,{variant:l,paymentSourceType:null,immediateDelivery:n})}let sW=(0,s.createContext)({isRedeeming:!1,orbRedemptionError:null,orbProductContext:null,onRedeemVirtualCurrency:()=>{},skuId:"",analyticsSourceLocation:void 0}),sK=()=>(0,s.useContext)(sW),sY={payment_gateway:tr.kM.VIRTUAL_CURRENCY,currency:ea.Yri.DISCORD_ORB},sz={CHECKOUT_FLOW:eI.CL.ORB_CHECKOUT,CHECKOUT_STEPS:{[u.pn.REVIEW]:e=>{let{handleStepChange:t}=e,{orbProductContext:n,isRedeeming:l,orbRedemptionError:r,onRedeemVirtualCurrency:a,skuId:o,analyticsSourceLocation:c}=sK(),{primaryButtonProps:h,...f}=(e=>{let{skuId:t,analyticsSourceLocation:n,orbProductContext:l,isRedeeming:r,orbRedemptionError:a,onRedeemVirtualCurrency:o,handleStepChange:c}=e,{enabled:h}=sv.A.useConfig({location:"orb_checkout_review_step"}),{invoicePreviewTotal:f,orderOrbPriceAmount:g}=(0,N.t4)(e=>{let n=null!=e.orderRecord?e.orderRecord.getInvoicePreview():null;return{invoicePreviewTotal:null!=n?n.total:null,orderOrbPriceAmount:null!=n?n.getInvoicePreviewLineItemUnitPriceForSku(t):null}}),{isStepLoading:E,orbPriceAmount:C,orbBalanceToDisplay:x,onClickCheckout:I,showCollectiblesDiscountWarning:S,errorMessage:y}=(e=>{let{skuId:t,onRedeemVirtualCurrency:n,orbRedemptionError:l,orbProductContext:i,analyticsSourceLocation:r,handleStepChange:a}=e,{analyticsLocations:o}=(0,eF.Ay)(),{selectedSkuId:c,setPurchaseState:h,firstConstraintReasonCode:f}=(0,N.t4)(e=>({selectedSkuId:e.selectedSkuId,setPurchaseState:e.setPurchaseState,firstConstraintReasonCode:null!=e.orderRecord?e.orderRecord.firstUnsatisfiedConstraintReasonCode():null})),g=(0,sP.gN)(),E=(0,s.useRef)(g),{emitOrbCheckoutPaymentFlowEvent:A}=(e=>{let{skuId:t,orbProductContext:n,analyticsLocations:l,analyticsSourceLocation:i}=e,{activitySessionId:r}=(0,nm.V)(),{hasPaymentSources:a}=(0,la.jm)(),{loadId:o,startTime:c,discoverySessionId:h}=(0,N.t4)(e=>e.contextMetadata),f=(0,s.useMemo)(()=>({load_id:o,discovery_session_id:h,application_id:(0,d.P)(t),location:l,location_stack:l,sku_id:t,activity_session_id:r,payment_gateway:tr.ps.VIRTUAL_CURRENCY,...null!=n&&{price:n.orbPriceAmount??void 0,regular_price:n.orbPriceAmount??void 0},currency:ea.Yri.DISCORD_ORB,...null!=i&&{source:i},...{payment_type:ea.frM[ea.VVm.ONE_TIME],is_gift:!1,eligible_for_trial:!1,payment_modal_version:"v2",checkout_design:p.r.UNIFIED,checkout_flow:_.C.ORB_CHECKOUT}}),[o,h,r,t,l,i,n]);return{emitOrbCheckoutPaymentFlowEvent:(0,s.useCallback)((e,t)=>{let n=Date.now()-c;e===ea.HAw.PAYMENT_FLOW_STARTED?m.default.track(ea.HAw.PAYMENT_FLOW_STARTED,{...f,has_saved_payment_source:a,payment_gateway:tr.ps.VIRTUAL_CURRENCY,continue_session_initial_step:null}):e===ea.HAw.PAYMENT_FLOW_LOADED?m.default.track(ea.HAw.PAYMENT_FLOW_LOADED,{...f,has_saved_payment_source:a,initial_step:u.pn.REVIEW,duration_ms:n}):e===ea.HAw.PAYMENT_FLOW_CANCELED?m.default.track(ea.HAw.PAYMENT_FLOW_CANCELED,{...f,duration_ms:n}):e===ea.HAw.PAYMENT_FLOW_COMPLETED?m.default.track(ea.HAw.PAYMENT_FLOW_COMPLETED,{...f,duration_ms:n}):e===ea.HAw.PAYMENT_FLOW_SUCCEEDED?m.default.track(ea.HAw.PAYMENT_FLOW_SUCCEEDED,{...f,duration_ms:n}):m.default.track(ea.HAw.PAYMENT_FLOW_FAILED,{...f,duration_ms:n,...null!=t?{payment_error_code:t.code,error_message:t.message}:{}})},[c,f,a])}})({skuId:t,orbProductContext:i,analyticsLocations:o,analyticsSourceLocation:r});(0,s.useEffect)(()=>{null!=l&&null!==E.current&&(A(ea.HAw.PAYMENT_FLOW_FAILED,l),E.current=null)},[l,A]);let C=(0,s.useCallback)(()=>{E.current=g,A(ea.HAw.PAYMENT_FLOW_COMPLETED),n(e=>{h(R.h.COMPLETED),a(u.pn.CONFIRM,{fulfillment:{entitlements:e}})})},[n,h,g,A,a]),x=E.current??g,I=null!=i?i.orbPriceAmount:null;return{isStepLoading:null==i,showCollectiblesDiscountWarning:(0,nF.vw)({skuId:t,isOrbsPurchase:!0}),errorMessage:(0,s.useMemo)(()=>(function(e,t){if(null==e)return null;if(e instanceof sR.FY&&null!=t)switch(t){case sL.INSUFFICIENT_ORB_BALANCE:return eo.intl.string(eo.t.keFvXM);case sL.SKU_ALREADY_OWNED:return eo.intl.string(eo.t.m371Mx);case sL.BUNDLE_PARTIALLY_OWNED:return eo.intl.string(eo.t.v9oC0p);default:return eo.intl.string(eo.t.fqJZ11)}return e instanceof sR.j2?eo.intl.string(eo.t["2BmwgV"]):e.code===sb.tG.VIRTUAL_CURRENCY_INSUFFICIENT_BALANCE?eo.intl.string(eo.t.keFvXM):e.code===sb.tG.ALREADY_PURCHASED?eo.intl.string(eo.t.m371Mx):e.code===sb.tG.BILLING_ORDER_NOT_SIGNABLE?eo.intl.string(eo.t.ZHgEG7):eo.intl.string(eo.t.fqJZ11)})(l,f),[l,f]),orbPriceAmount:I,orbBalanceToDisplay:x,onClickCheckout:C,selectedSkuId:c}})({skuId:t,analyticsSourceLocation:n,orbProductContext:l,orbRedemptionError:a,onRedeemVirtualCurrency:o,handleStepChange:c}),v=(0,A.bG)([i0.A],()=>i0.A.get(t),[t]),T=(0,sy.uS)(v?.applicationId),{disabled:j,tooltipText:b,text:P}=(e=>{let{orbBalance:t,orbPriceAmount:n,isInTestMode:l=!1}=e,{disabled:i,tooltipText:r}=(0,s.useMemo)(()=>null==n?{disabled:!0,tooltipText:eo.intl.string(eo.t["c/rcUu"])}:!l&&(null==t||n>t)?{disabled:!0,tooltipText:eo.intl.string(eo.t.keFvXM)}:{disabled:!1,tooltipText:null},[n,t,l]);return{disabled:i,tooltipText:r,text:sB()}})({orbBalance:x,orbPriceAmount:h?f:C,isInTestMode:T}),L=(0,s.useMemo)(()=>({onClick:I,loading:r,text:P,disabled:j,tooltipText:b}),[I,r,P,j,b]),M=S?eo.intl.format(eo.t.fsOXXO,{}):null,O=T?eo.intl.string(eo.t.OvMyMd):null;return{isStepLoading:E,upperInlineNoticeProps:(0,s.useMemo)(()=>{if(null!=O||null!=M||null!=y){let e=[];return null!=O&&e.push({type:"warning",message:O,key:"test-mode-warning-notice"}),null!=M&&e.push({type:"warning",message:M,key:"orb-checkout-warning-notice"}),null!=y&&e.push({type:"critical",message:y,key:"orb-checkout-error-notice"}),e}return null},[O,M,y]),purchaseItemContent:(0,i.jsx)(sF,{skuId:t,orbPriceAmount:h?g:C}),paymentMethodContent:(0,i.jsx)(sV,{orbBalance:x}),legalContent:(0,i.jsx)(sH,{skuId:t}),primaryButtonProps:L,invoiceSummaryContent:null,invoiceTotalDueLabel:null,invoiceTotalDueValue:null}})({skuId:o,analyticsSourceLocation:c,orbProductContext:n,isRedeeming:l,orbRedemptionError:r,onRedeemVirtualCurrency:a,handleStepChange:t});return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(ed.dZ,{children:(0,i.jsx)(e8.T,{...f})}),(0,i.jsx)(ed.UX,{children:(0,i.jsx)(T.lo,{primaryButtonProps:h})})]})}},TENANT_PROVIDER_CONFIGS:{tenantProvidesCheckoutRoot:!1,CustomTenantProvider:e=>{let{skuId:t,loadId:n,analyticsSourceLocation:l,children:r}=e,{order:a,setOrder:o}=(0,N.t4)(e=>({order:e.order,setOrder:e.setOrder})),{orbProductContext:u,isRedeeming:c,orbRedemptionError:d,onRedeemVirtualCurrency:m}=(e=>{let{skuId:t,loadId:n,onCheckoutSuccess:l,onSignFailure:i,order:r}=e,a=(0,A.bG)([e0.default],()=>e3.Ay.canUseShopDiscounts(e0.default.getCurrentUser())),o=(0,A.bG)([i0.A],()=>i0.A.get(t),[t]),u=(0,su.JL)({sku:o}),{product:c}=(0,nM.q)(t),d=(0,s.useMemo)(()=>{if(null!=u)return{orbPriceAmount:u.amount};if(null!=c){let e=(0,sT.CW)({product:c,hasShopDiscount:a});return{orbPriceAmount:null!==e?e.amount:null}}return null},[u,c,a]);d?.orbPriceAmount==null&&(0,sN.hD)("Orb price not found for product",{tags:{sku_id:t}});let{redeemVirtualCurrency:m,isSubmitting:h,error:p}=(0,sj.Q)({skuId:t,loadId:n,order:r,onSignFailure:i}),f=(0,s.useCallback)(e=>{m(t,n,n=>{l?.({entitlements:n,skuId:t}),e(n)})},[t,n,m,l]);return{skuId:t,loadId:n,orbProductContext:d,onRedeemVirtualCurrency:f,isRedeeming:h,orbRedemptionError:p}})({skuId:t,loadId:n,order:a,onSignFailure:o}),h=(0,s.useMemo)(()=>({orbProductContext:u,isRedeeming:c,orbRedemptionError:d,onRedeemVirtualCurrency:m,skuId:t,analyticsSourceLocation:l}),[u,c,d,m,t,l]);return(0,i.jsx)(sW.Provider,{value:h,children:r})},TenantPaymentModalRenderer:e=>{let{originalPaymentModalProps:t,renderPaymentModal:n}=e,{orbProductContext:l}=sK(),i=(e=>{let{orbProductContext:t,overrideAnalyticParams:n}=e;return{analyticsDataOverride:(0,s.useMemo)(()=>{if(null!=t)return{...n,price:t.orbPriceAmount??void 0,regular_price:t.orbPriceAmount??void 0}},[t,n]),skipConfirm:!0}})({orbProductContext:l,overrideAnalyticParams:sY});return n({...t,...i})},overrideAnalyticParams:sY}},sZ={[h.C.ORB_CHECKOUT]:{flowType:h.C.ORB_CHECKOUT,implemented:!0,purchaseType:ea.VVm.ONE_TIME,TENANT_CHECKOUT_FLOW_CONFIG:sz},[h.C.COLLECTIBLES_CHECKOUT]:{flowType:h.C.COLLECTIBLES_CHECKOUT,implemented:!0,purchaseType:ea.VVm.ONE_TIME,TENANT_CHECKOUT_FLOW_CONFIG:le},[h.C.SLAYER_STOREFRONT_CHECKOUT]:{implemented:!0,flowType:h.C.SLAYER_STOREFRONT_CHECKOUT,purchaseType:ea.VVm.ONE_TIME,TENANT_CHECKOUT_FLOW_CONFIG:sx},[h.C.PREMIUM_CHECKOUT]:{implemented:!0,flowType:h.C.PREMIUM_CHECKOUT,purchaseType:ea.VVm.SUBSCRIPTION,TENANT_CHECKOUT_FLOW_CONFIG:iS},[h.C.INBOUND_PREMIUM_PROMOTION_CHECKOUT]:{implemented:!1,flowType:h.C.INBOUND_PREMIUM_PROMOTION_CHECKOUT},[h.C.PREMIUM_APPS_OTP_CHECKOUT]:{implemented:!0,flowType:h.C.PREMIUM_APPS_OTP_CHECKOUT,purchaseType:ea.VVm.ONE_TIME,TENANT_CHECKOUT_FLOW_CONFIG:i4},[h.C.PREMIUM_APPS_SUBSCRIPTION_CHECKOUT]:{implemented:!0,flowType:h.C.PREMIUM_APPS_SUBSCRIPTION_CHECKOUT,purchaseType:ea.VVm.SUBSCRIPTION,TENANT_CHECKOUT_FLOW_CONFIG:iJ},[h.C.GUILD_PRODUCT_CHECKOUT]:{implemented:!0,purchaseType:ea.VVm.ONE_TIME,TENANT_CHECKOUT_FLOW_CONFIG:t8,flowType:h.C.GUILD_PRODUCT_CHECKOUT},[h.C.GUILD_ROLE_CHECKOUT]:{implemented:!0,flowType:h.C.GUILD_ROLE_CHECKOUT,TENANT_CHECKOUT_FLOW_CONFIG:lT,purchaseType:ea.VVm.SUBSCRIPTION},[h.C.GUILD_BOOST_CHECKOUT]:{implemented:!0,flowType:h.C.GUILD_BOOST_CHECKOUT,purchaseType:ea.VVm.SUBSCRIPTION,TENANT_CHECKOUT_FLOW_CONFIG:tz}};var sq=n(735305);let s$=e=>{let{returnStep:t=u.pn.REVIEW,returnStepIfNoPaymentSources:n,paymentModalStepProps:l}=e,{purchaseType:r}=(0,N.t4)(e=>({purchaseType:e.purchaseType})),a=s.useCallback(()=>(e=>{let{paymentModalStepProps:t,returnStep:n=u.pn.REVIEW,returnStepIfNoPaymentSources:l,purchaseType:i}=e;if(0===Object.keys(q.A.paymentSources).length){if(null!=l)return void t.handleStepChange(l);i===tr.VV.SUBSCRIPTION?t.handleStepChange(n,{trackedFromStep:u.pn.ADD_PAYMENT_STEPS}):t.handleClose()}else t.handleStepChange(n,{trackedFromStep:u.pn.ADD_PAYMENT_STEPS})})({returnStep:t,returnStepIfNoPaymentSources:n,paymentModalStepProps:l,purchaseType:r}),[t,n,l,r]);return(0,i.jsx)(sq.x,{...l,onReturn:a})},sJ=e=>{let{initialPlanId:t}=e,n=(0,N.t4)(e=>e.selectedSkuId),l=(0,y.A)(),{isGift:r,claimableRewards:a}=(0,nt.Pv)(),o=iu({isGift:r,skuId:n}),c=(0,lZ.lp)(o),d=(0,lc.px)(l,r,a),m=s.useMemo(()=>{let e=null==t?u.pn.PLAN_SELECT:u.pn.REVIEW;return c&&(e=u.pn.REVIEW),d&&(e=u.pn.SELECT_FREE_SKU),e},[c,d,t]);return(0,i.jsx)(s$,{paymentModalStepProps:e,returnStep:u.pn.REVIEW,returnStepIfNoPaymentSources:m})},sX=e=>{let{checkoutFlow:t,returnStep:n=u.pn.REVIEW,returnStepIfNoPaymentSources:l,paymentModalStepProps:s}=e;return t===h.C.PREMIUM_CHECKOUT?(0,i.jsx)(sJ,{...s}):(0,i.jsx)(s$,{paymentModalStepProps:s,returnStep:n,returnStepIfNoPaymentSources:l})};var sQ=n(339048),s0=n(469778),s1=n(315949),s2=n(599062);function s3(){let{refreshCategories:e}=(0,s1.A)();return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(t9.rQ,{title:eo.intl.string(eo.t["p8+qtU"])}),(0,i.jsx)(V.c,{children:(0,i.jsx)(s2.h,{onRetry:e,errorOrigin:s2.A.GIFT_MODAL})})]})}function s4(e){let{handleStepChange:t}=e,n=(0,N.t4)(e=>e.selectedSkuId),{paymentSources:l,hasFetchedPaymentSources:r}=(0,la.jm)(),{application:a}=(0,nm.V)(),o=(0,B.Hp)(),c=(0,np.gU)(),d=(0,np.Hu)(),{isGift:m}=(0,nt.Pv)(),[h,p]=s.useState(!0),[f,g]=(0,nc.yK)([nf.A],()=>[nf.A.isFetchingCategories,nf.A.error]);return(s.useEffect(()=>{let e=null!=a;d&&r&&e&&p(f)},[d,r,a,f]),s.useEffect(()=>{if(h||o||null==n)return;let e=c[n];m&&(e?.productLine===ea.EZt.COLLECTIBLES||e?.productLine===ea.EZt.APPLICATION||e?.productLine===ea.EZt.SOCIAL_LAYER_GAME_ITEM)?t(u.pn.GIFT_CUSTOMIZATION):0===Object.keys(l).length?t(u.pn.ADD_PAYMENT_STEPS):t(u.pn.REVIEW)},[h,o,t,l,m,c,n]),h)?(0,i.jsx)(K.A,{}):o?(0,i.jsx)(H.oO,{}):null!=g?(0,i.jsx)(s3,{}):null}function s6(e){let{subscriptionTier:t,initialPlanId:n,handleStepChange:l,continueSessionToInitialStep:r}=e,{hasPaymentSources:a}=(0,la.jm)(),{selectedSkuId:o,setSelectedPlanId:c,activeSubscription:d,defaultPlanId:m,startedPaymentFlowWithPaymentSources:h}=(0,N.t4)(e=>({selectedSkuId:e.selectedSkuId,setSelectedPlanId:e.setSelectedPlanId,activeSubscription:e.activeSubscription,defaultPlanId:e.defaultPlanId,startedPaymentFlowWithPaymentSources:e.startedPaymentFlowWithPaymentSources})),p=(0,B.Hp)(),f=z(),{hasFetchedRelatedSubscriptionPlans:g,subscriptionPriceOptionsLoading:E}=(0,W.Jn)(),{isGift:A}=(0,nt.Pv)(),C=iu({isGift:A,skuId:o}),x=!f||!g||E,I=(0,nc.bG)([s0.A],()=>s0.A.applicationIdsFetched.has(es.tv));return(l$("Payment Modal",x,5,{hasFetchedSubscriptions:f,hasFetchedSubscriptionPlans:g,subscriptionPriceOptionsLoading:E},{tags:{app_context:"billing"}}),s.useEffect(()=>{if(I||(0,sQ.LM)(es.tv),x||p)return;let e=(0,lZ.vT)({isTrial:C,isGift:A,selectedSkuId:o,startedPaymentFlowWithPaymentSources:h});null!=r?l(u.pn.ADD_PAYMENT_STEPS,{emitPaymentFlowLoadedEvent:!0,trackedFromStep:r}):null!=n?n!==es.gD.PREMIUM_GROUP_MONTH||a?l(u.pn.REVIEW):l(u.pn.ADD_PAYMENT_STEPS):e?(c((0,lZ.xT)(o,d,m)),l(u.pn.REVIEW)):null!=t?l(u.pn.PLAN_SELECT):l(u.pn.SKU_SELECT)},[r,d,p,I,n,x,l,t,o,c,C,m,A,h,a]),x)?(0,i.jsx)(K.A,{}):p?(0,i.jsx)(H.oO,{}):null}var s5=n(891197),s7=n(293035);function s8(){return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(l7.A,{}),(0,i.jsx)(ed.dZ,{children:(0,i.jsx)(s5.N,{className:s7.D})})]})}var s9=n(830382),re=n(349288),rt=n(94204);function rn(e){let{className:t,isEmailResent:n,resendEmail:l}=e;return(0,i.jsx)("div",{className:t,children:(0,i.jsxs)("div",{className:rt.a,children:[(0,i.jsx)(ew.D,{variant:"heading-xl/bold",children:eo.intl.string(eo.t.Q03WWV)}),(0,i.jsxs)("p",{children:[(0,i.jsx)(eP.E,{variant:"text-md/normal",children:eo.intl.string(eo.t.BxPxhI)}),(0,i.jsx)("br",{}),(0,i.jsx)(eP.E,{variant:"text-md/normal",children:eo.intl.string(eo.t.Y3fdOp)}),(0,i.jsx)("br",{}),(0,i.jsxs)(eP.E,{variant:"text-md/normal",children:[eo.intl.string(eo.t.Paa4v4),"\xa0",n?eo.intl.string(eo.t.StGVvC):(0,i.jsx)(re.Anchor,{onClick:l,children:eo.intl.string(eo.t.Ex7sk9)})]})]})]})})}function rl(){let e=s.useMemo(()=>[{variant:"primary",text:eo.intl.string(eo.t.g8vPzy),disabled:!0}],[]);return(0,i.jsx)(lB.H,{actions:e})}var ri=n(599961);function rs(){let[e,t]=s.useState(!1),n=async()=>{t(!0),await (0,s9.lo)()};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(l7.A,{}),(0,i.jsx)(ed.dZ,{children:(0,i.jsx)(rn,{className:ri.r,isEmailResent:e,resendEmail:n})}),(0,i.jsx)(ed.UX,{children:(0,i.jsx)(rl,{})})]})}let rr={key:null,renderStep:e=>(0,i.jsx)(s4,{...e}),options:{modalSizeGetter:()=>"md"}},ra={key:null,renderStep:e=>(0,i.jsx)(s6,{...e})},ro=[{key:u.pn.AWAITING_PURCHASE_TOKEN_AUTH,renderStep:()=>(0,i.jsx)(rs,{})},{key:u.pn.AWAITING_AUTHENTICATION,renderStep:()=>(0,i.jsx)(s8,{}),options:{renderHeader:!0}}],ru=e=>{let{paymentModalStepProps:t,defaultStep:n}=e,l=(0,s.useRef)(!1),r=(0,B.Hp)(),{handleStepChange:a}=t;return((0,s.useEffect)(()=>{r||l.current||(a(n),l.current=!0)},[r,a,n]),r)?(0,i.jsx)(H.oO,{}):null},rc={[h.C.ORB_CHECKOUT]:{allowGiftCustomization:!1,excludePaymentAuthSteps:!0,predicateStepType:"unified"},[h.C.COLLECTIBLES_CHECKOUT]:{allowGiftCustomization:!0,predicateStepType:"one_time_payment"},[h.C.SLAYER_STOREFRONT_CHECKOUT]:{allowGiftCustomization:!0,predicateStepType:"one_time_payment"},[h.C.PREMIUM_CHECKOUT]:{allowGiftCustomization:!1,predicateStepType:"subscription"},[h.C.INBOUND_PREMIUM_PROMOTION_CHECKOUT]:{allowGiftCustomization:!1},[h.C.PREMIUM_APPS_OTP_CHECKOUT]:{allowGiftCustomization:!0,predicateStepType:"one_time_payment"},[h.C.PREMIUM_APPS_SUBSCRIPTION_CHECKOUT]:{allowGiftCustomization:!1},[h.C.GUILD_BOOST_CHECKOUT]:{allowGiftCustomization:!1},[h.C.GUILD_PRODUCT_CHECKOUT]:{allowGiftCustomization:!1,predicateStepType:"one_time_payment"},[h.C.GUILD_ROLE_CHECKOUT]:{allowGiftCustomization:!1,predicateStepType:"subscription"}},rd=(0,s.lazy)(()=>Promise.all([n.e("11005"),n.e("54791"),n.e("25246"),n.e("33319"),n.e("8430")]).then(n.bind(n,427325)).then(e=>{let{UnifiedCheckoutInstance:t}=e;return{default:t}})),rm=e=>(0,i.jsx)(rd,{...e});class rh{checkoutFlow;checkoutFlowConfiguration;tenantCheckoutFlowConfig;internalCheckoutFlowControls;override_analytic_params;constructor({checkoutFlow:e}){this.checkoutFlow=e;const t=sZ[e];if(!((e,t)=>null!=t&&t.implemented&&t.flowType===e)(e,t))throw Error(`Checkout flow ${e} is not implemented`);this.checkoutFlowConfiguration=t,this.tenantCheckoutFlowConfig=t.TENANT_CHECKOUT_FLOW_CONFIG,this.internalCheckoutFlowControls=rc[e],this.override_analytic_params=this.tenantCheckoutFlowConfig.TENANT_PROVIDER_CONFIGS.overrideAnalyticParams}getCheckoutStep(e){return this.tenantCheckoutFlowConfig.CHECKOUT_STEPS[e]}generateRenderHeader(){let{CustomHeaderComponent:e}=this.tenantCheckoutFlowConfig;if(null!=e)return t=>{let{handleClose:n,step:l}=t;return(0,i.jsx)(e,{onClose:n,step:l})}}getPredicateStepConfig(){let{CustomCheckoutPredicateStep:e}=this.tenantCheckoutFlowConfig,{predicateStepType:t}=this.internalCheckoutFlowControls;return null!=e?{key:null,renderStep:t=>(0,i.jsx)(e,{...t})}:"one_time_payment"===t?rr:"subscription"===t?ra:{key:null,renderStep:e=>(0,i.jsx)(ru,{paymentModalStepProps:e,defaultStep:u.pn.REVIEW})}}getAddPaymentStepConfig(e){let{isGift:t}=e,{allowGiftCustomization:n}=this.internalCheckoutFlowControls;if(this.checkoutFlow!==h.C.ORB_CHECKOUT)return{key:u.pn.ADD_PAYMENT_STEPS,renderStep:e=>(0,i.jsx)(sX,{checkoutFlow:this.checkoutFlow,paymentModalStepProps:e,returnStep:u.pn.REVIEW,returnStepIfNoPaymentSources:t&&n?u.pn.GIFT_CUSTOMIZATION:void 0}),options:{renderHeader:!0}}}getGiftCustomizationStepConfig(e){let{isGift:t}=e,{allowGiftCustomization:n}=this.internalCheckoutFlowControls,l=this.getCheckoutStep(u.pn.GIFT_CUSTOMIZATION);if(t&&n&&null!=l)return{key:u.pn.GIFT_CUSTOMIZATION,renderStep:e=>(0,i.jsx)(l,{...e}),options:{modalSizeGetter:()=>"xl",useBreadcrumbLabel:()=>eo.intl.string(eo.t["W685+b"])}}}getReviewStepConfig(){let e=this.getCheckoutStep(u.pn.REVIEW);return{key:u.pn.REVIEW,renderStep:t=>(0,i.jsx)(e,{...t}),options:{useBreadcrumbLabel:()=>eo.intl.string(eo.t.QBnNHq)}}}createDefinedStepConfigsArray(e){return e.filter(e=>null!=e)}generateCheckoutStepConfigs(e){let{isGift:t}=e,{CUSTOM_CONFIRM_STEP_CONFIG:n,STEPS_BEFORE_CHECKOUT:l=[]}=this.tenantCheckoutFlowConfig,{excludePaymentAuthSteps:i}=this.internalCheckoutFlowControls,s=this.getPredicateStepConfig(),r=this.getGiftCustomizationStepConfig({isGift:t}),a=this.getAddPaymentStepConfig({isGift:t}),o=this.getReviewStepConfig(),c=this.createDefinedStepConfigsArray([s,...null!=r?[r]:[],...l,a,...i?[]:ro,o]);return null!=n&&c.push({key:u.pn.CONFIRM,renderStep:n.renderStep,options:n.options}),c}getApplicationId(e){return this.checkoutFlow===h.C.ORB_CHECKOUT&&null!=e?(0,d.P)(e):this.checkoutFlow===h.C.COLLECTIBLES_CHECKOUT?ea.FYj:this.checkoutFlow===h.C.PREMIUM_CHECKOUT?es.tv:void 0}trackPaymentFlowCanceled(e){let{loadId:t,skuId:n,skuProductLine:l,applicationId:i,discoverySessionId:s,analyticsLocation:r,analyticsLocations:a,analyticsObject:o,analyticsSourceLocation:u,isGift:c,eligibleForTrial:d}=e;m.default.track(ea.HAw.PAYMENT_FLOW_CANCELED,{load_id:t,discovery_session_id:s,payment_type:ea.frM[this.checkoutFlowConfiguration.purchaseType],is_gift:c,sku_id:n,sku_product_line:l,application_id:i,location:r??o,location_stack:a,source:u,eligible_for_trial:d,payment_modal_version:"v2",checkout_design:p.r.UNIFIED,checkout_flow:this.checkoutFlow,...this.checkoutFlow===h.C.PREMIUM_CHECKOUT?{subscription_type:ea.rzx.PREMIUM}:{},...this.override_analytic_params})}renderCheckoutInstance(e){let{giftContextProps:t,checkoutHandlers:{onComplete:l,onClose:u}={},checkoutConfiguration:{skuId:d,skuProductLine:m,discoverySessionId:p,applicationId:f,activeSubscription:g},unifiedCheckoutProviderProps:{analyticsLocations:A,analyticsSourceLocation:C},forwardedPaymentModalProps:{analyticsObject:x,...I}={},tenantParams:_}=e,S=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"modal",y=arguments.length>2?arguments[2]:void 0,v={current:(this.checkoutFlow===h.C.PREMIUM_CHECKOUT?(0,c.A)():null)??(0,r.A)()},N={current:null},{modalKey:j}=y,b=this.generateRenderHeader(),R=f??this.getApplicationId(d),P=!!(null!=t&&t.isGift),L=!1,M={...I,checkoutFlow:this.checkoutFlow,checkoutFlowConfiguration:this.checkoutFlowConfiguration,tenantCheckoutFlowConfig:this.tenantCheckoutFlowConfig,stepConfigs:this.generateCheckoutStepConfigs({isGift:P}),onComplete:e=>{null!=l&&l(e),L=!0},onClose:u,renderHeader:b,skuId:d??null,tenantParams:_??{},loadId:v.current,onOrderCreated:e=>{v.current=e.id,N.current=e},discoverySessionId:p,activeSubscription:g??null,applicationId:R,analyticsLocations:A,analyticsObject:x,analyticsSourceLocation:C,giftContextProps:t};if("modal"===S)return(0,a.openModalLazy)(async()=>{let{UnifiedCheckoutInstance:e}=await Promise.all([n.e("11005"),n.e("54791"),n.e("25246"),n.e("33319"),n.e("8430")]).then(n.bind(n,427325));return t=>(0,i.jsx)(e,{...M,renderModalProps:t})},{...y,onCloseRequest:()=>{null!=y.onCloseRequest&&y.onCloseRequest(L,v.current),y.skipCloseModalOnCloseRequest||(0,a.closeModal)(j)},onCloseCallback:()=>{L||(E({checkoutSucceeded:L,order:N.current}),this.trackPaymentFlowCanceled({loadId:v.current,skuId:d,skuProductLine:m,applicationId:R,discoverySessionId:p,analyticsLocation:I.analyticsLocation,analyticsLocations:A,analyticsObject:x,analyticsSourceLocation:C,isGift:P,eligibleForTrial:null!=I.trialId})),null!=y.onCloseCallback&&y.onCloseCallback(L),null!=u&&u(L,d)},modalKey:j});{let e=I.paymentModalOnClose??u,t={transitionState:o.ip.ENTERED,onClose:()=>(null!=e&&e(!1),Promise.resolve())};return(0,i.jsx)(s.Suspense,{fallback:(0,i.jsx)(T.Jg,{transitionState:o.ip.ENTERED,onClose:ea.tEg,size:"md",isModalContentLoading:!0}),children:(0,i.jsx)(rm,{...M,paymentModalOnClose:e,renderModalProps:t})})}}openCheckoutModal(e){let{modalAPIOptions:t}=e;return this.renderCheckoutInstance(e,"modal",t)}renderStandaloneCheckout(e){return this.renderCheckoutInstance(e,"standalone",{modalKey:"standalone-checkout"})}}}