Loading
function(e,t,n){n.d(t,{M:()=>eT});var l=n(477900),r=n(582128),i=n(688810),a=n(795791),s=n(669874),u=n(202475),c=n(883645),o=n(601194),d=n(682689),h=n(115560),p=n(444927),f=n(856383),m=n(120700),C=n(855986),y=n(73153),E=n(669815),_=n(67480);function g(e,t){let{paymentSources:n,eligiblePaymentGateways:l}=t;return!!(null!=e&&e in n&&(null==l||0===l.length||l.includes(n[e].paymentGateway)))}function S(e){let{isGift:t,activeSubscription:n,defaultPaymentSourceId:l,paymentSources:r,eligiblePaymentGateways:i}=e;if(!t&&n?.paymentSourceId!=null)return n.paymentSourceId;if(null!=i&&i.length>0){if(null!=l&&l in r&&i.includes(r[l].paymentGateway))return l;for(let e in r){let t=r[e];if(i.includes(t.paymentGateway))return e}return null}return l}let I=e=>{let{isGift:t,activeSubscription:n,defaultPaymentSourceId:l,eligiblePaymentGateways:i,hasFetchedPaymentSources:a,paymentSources:s,initialPaymentSourceId:u}=e,{setPaymentSourceId:c,setPendingPaymentSourceId:o,setHasAddedPaymentSourceThisSession:h}=(0,d.t4)(e=>({setPaymentSourceId:e.setPaymentSourceId,setPendingPaymentSourceId:e.setPendingPaymentSourceId,setHasAddedPaymentSourceThisSession:e.setHasAddedPaymentSourceThisSession})),p=r.useRef(!1),f=r.useRef(!1),m=r.useCallback(()=>{if(!p.current&&!f.current){if(g(u,{paymentSources:s,eligiblePaymentGateways:i})){c(u),p.current=!0;return}c(S({isGift:t,activeSubscription:n,defaultPaymentSourceId:l,eligiblePaymentGateways:i,paymentSources:s}))}},[t,n,l,i,c,u]);r.useEffect(()=>{a?m():(0,E.$o)()},[a,m]);let C=r.useCallback(e=>{let{paymentSource:t}=e;f.current=!0,h(),o(t.id),c(t.id)},[c,o,h]);return r.useEffect(()=>(y.h.subscribe("BILLING_PAYMENT_SOURCE_CREATE_SUCCESS",C),()=>{y.h.unsubscribe("BILLING_PAYMENT_SOURCE_CREATE_SUCCESS",C)}),[C]),null};var A=n(531260);function P(e){let{hasFetchedPaymentSources:t,hasPaymentSources:n}=e,{activeSubscription:l,startedPaymentFlowWithPaymentSources:i,captureStartingPremiumSubscriptionPlanId:a,captureStartingFractionalPremiumEndsAt:s,captureStartingPaymentFlowWithPaymentSources:u}=(0,d.t4)(e=>({startedPaymentFlowWithPaymentSources:e.startedPaymentFlowWithPaymentSources,activeSubscription:e.activeSubscription,captureStartingPremiumSubscriptionPlanId:e.captureStartingPremiumSubscriptionPlanId,captureStartingFractionalPremiumEndsAt:e.captureStartingFractionalPremiumEndsAt,captureStartingPaymentFlowWithPaymentSources:e.captureStartingPaymentFlowWithPaymentSources}));r.useEffect(()=>{t&&null==i&&u(n)},[t,n,u,i]),r.useEffect(()=>{null!=l&&a(l.planId)},[l,a]);let{endsAt:c}=(0,A.A)({forceFetch:!1,excludeReverseTrial:!0});return r.useEffect(()=>{null!=c&&0!==c.valueOf()&&s(c)},[c,s]),null}var x=n(800342),v=n(328968),R=n(682901);function T(){let e=(0,d.t4)(e=>e.skuIds),t=r.useMemo(()=>e.filter(e=>!R.oz.includes(e)),[e]),n=(0,C.bG)([v.A],()=>t.filter(e=>null==v.A.getForSKU(e)&&!v.A.isFetchingForSKU(e)),[t]);return r.useEffect(()=>{for(let e of n)(0,x.QB)(e)},[n]),null}var M=n(459357),b=n(566980),L=n(830382),k=n(543767),N=n(570221);function j(e){return JSON.stringify({...e,paymentSourceId:void 0,previousTotal:void 0})}var U=n(666646),w=n(813873),H=n(11939);function O(e){let{location:t,currency:n}=e,{enabled:l}=(0,w.U)({location:t}),{giftCardCurrency:r}=(0,H.h)(),{applyWalletBalance:i,previewApplyWalletBalance:a}=(0,d.t4)(e=>({applyWalletBalance:e.applyWalletBalance,previewApplyWalletBalance:e.checkoutInvoicePreview?.applyWalletBalance}));return{splitPaymentsEnabled:l,applyWalletBalance:l?i??void 0:void 0,currency:l&&(i??a)===!0&&null!=r?r:n}}function F(){var e;let t,n,l,i,a,{isGift:s,applicationId:u,purchaseState:c,priceOptions:o,selectedSkuId:h,setPurchasePreviewError:p,invoicePreviewRefetchKey:f}=(0,d.t4)(e=>({purchaseState:e.purchaseState,applicationId:e.applicationId,isGift:e.isGift,priceOptions:e.checkoutPriceOptions,selectedSkuId:e.selectedSkuId,setPurchasePreviewError:e.setPurchasePreviewError,invoicePreviewRefetchKey:e.invoicePreviewRefetchKey})),m=c===b.h.PURCHASING||c===b.h.COMPLETED,{applyWalletBalance:C,currency:y,splitPaymentsEnabled:E}=O({location:"HeadlessCheckoutStoreOTPInvoiceFetcher",currency:o.loaded?o.currency:void 0}),{enabled:_}=(0,M.c)({location:"HeadlessCheckoutStoreOTPInvoiceFetcher"}),g=(0,d.t4)(e=>e.getEffectivePaymentSourceId({isSplitPaymentMode:e.getIsSplitPaymentMode({splitPaymentsEnabled:E,giftCardsEnabled:_})})),[S,I]=(e=r.useMemo(()=>({applicationId:u,skuId:h,paymentSourceId:g,isGift:s,currency:y,preventFetch:m,applyWalletBalance:C}),[u,h,g,s,y,m,C]),t=(0,r.useRef)(e),n=(0,r.useRef)(!1),l=(0,r.useRef)(new WeakMap),(0,r.useEffect)(()=>{t.current=e}),i=JSON.stringify(e),a=(0,r.useCallback)(async e=>{var r;let i=t.current;if(null==i.skuId)return null;let a={applicationId:i.applicationId,skuId:i.skuId,paymentSourceId:i.paymentSourceId,isGift:i.isGift,currency:i.currency,applyWalletBalance:i.applyWalletBalance??void 0},s=n.current?a:{...a,paymentSourceId:null,applyWalletBalance:void 0};n.current=!0;let u=function(e,t,n){if(null==t)return;let l=e.get(t);if(null!=l&&l.pricingKey===j(n)&&l.paymentSourceId!==n.paymentSourceId)return t.total}(l.current,e,s),c=await (0,L.NY)({...s,previousTotal:u}),o=null!=c?N.A.createFromOTPPreview(c):null;return r=l.current,null!=o&&null!=s.paymentSourceId&&r.set(o,{paymentSourceId:s.paymentSourceId,pricingKey:j(s)}),o},[i]),(0,k.$n)(e,a,f));return(0,U.F)(S,I),r.useEffect(()=>{p(I)},[I,p]),null}var D=n(120992);function B(){let{applicationId:e,skuIds:t}=(0,d.t4)(e=>({applicationId:e.applicationId,skuIds:e.skuIds}));return(0,D.c)({applicationId:e,skuIDs:t}),null}var G=n(166532);function K(e){let{fetchParams:t,refetchKey:n}=e,[l,i]=(0,k.YV)(t,n),{setCheckoutInvoicePreview:a}=(0,d.t4)(e=>({setCheckoutInvoicePreview:e.setCheckoutInvoicePreview}));return r.useEffect(()=>{a(l,i)},[l,i,a]),null}function Z(e){let{fetchParams:t,refetchKey:n}=e,[l,i]=(0,k.C8)(t,n),{setCheckoutInvoicePreview:a}=(0,d.t4)(e=>({setCheckoutInvoicePreview:e.setCheckoutInvoicePreview}));return r.useEffect(()=>{a(l,i)},[l,i,a]),null}function W(e){let{fetchParams:t,refetchKey:n}=e,{applyWalletBalance:l,currency:i}=O({location:"HeadlessFetchPremiumGiftCheckoutInvoicePreview",currency:t.currency}),[a,s]=(0,k.QQ)({...t,currency:i,applyWalletBalance:l},n),{setCheckoutInvoicePreview:u}=(0,d.t4)(e=>({setCheckoutInvoicePreview:e.setCheckoutInvoicePreview}));return r.useEffect(()=>{u(a,s)},[a,s,u]),null}function Y(e){let{fetchParams:t,refetchKey:n}=e,[l,i]=(0,k.YV)(t,n),{setRenewalInvoicePreview:a}=(0,d.t4)(e=>({setRenewalInvoicePreview:e.setRenewalInvoicePreview}));return r.useEffect(()=>{a(l,i)},[l,i,a]),null}function z(){let e=(0,c.Ay)(e=>e.step),t=r.useRef(e),{fetchCheckoutInvoicePreviewRequest:n,fetchRenewalInvoicePreviewRequest:i,setFetchCheckoutInvoicePreviewRequest:a,setFetchRenewalInvoicePreviewRequest:s,invoicePreviewRefetchKey:u}=(0,d.t4)(e=>({setFetchCheckoutInvoicePreviewRequest:e.setFetchCheckoutInvoicePreviewRequest,setFetchRenewalInvoicePreviewRequest:e.setFetchRenewalInvoicePreviewRequest,fetchCheckoutInvoicePreviewRequest:e.fetchCheckoutInvoicePreviewRequest,fetchRenewalInvoicePreviewRequest:e.fetchRenewalInvoicePreviewRequest,invoicePreviewRefetchKey:e.invoicePreviewRefetchKey}));return(r.useEffect(()=>{let n=t.current;t.current=e,n===G.pn.REVIEW&&e!==G.pn.REVIEW&&(a(null),s(null))},[e,a,s]),null==n&&null==i)?null:(null!=i&&i.type,(0,l.jsxs)(l.Fragment,{children:[null!=n&&"subscription_checkout_invoice"===n.type&&(0,l.jsx)(K,{fetchParams:n.params,refetchKey:u}),null!=n&&"subscription_checkout_invoice_get_request"===n.type&&(0,l.jsx)(Z,{fetchParams:n.params,refetchKey:u}),null!=n&&"premium_one_time_gift_purchase_invoice"===n.type&&(0,l.jsx)(W,{fetchParams:n.params,refetchKey:u}),null!=i&&(0,l.jsx)(Y,{fetchParams:i.params,refetchKey:u})]}))}var q=n(428865),Q=n(624210),V=n(949192);class X{checkoutStore;isPatchingRef;constructor(e,t){this.checkoutStore=e,this.isPatchingRef=t}shouldPatchOrder(e){return!(0,q.L)(e)}persistedPaymentSourceId(e){let t=e.billing_facet;return null==t||null==t.payment_source_id?null:t.payment_source_id}persistedCurrency(e){let t=e.billing_facet;return null==t||null==t.currency?null:t.currency}persistedApplyWalletBalance(e){let t=e.billing_facet;return null==t||null==t.apply_wallet_balance?null:t.apply_wallet_balance}pendingOrderUpdates(e,t){let n={};return null!=t.paymentSourceId&&this.persistedPaymentSourceId(e)!==t.paymentSourceId&&(n.paymentSourceId=t.paymentSourceId),null!=t.currency&&this.persistedCurrency(e)!==t.currency&&(n.currency=t.currency),null!=t.applyWalletBalance&&this.persistedApplyWalletBalance(e)!==t.applyWalletBalance&&(n.applyWalletBalance=t.applyWalletBalance),Object.keys(n).length>0?n:null}async syncOrder(e){let{order:t,orderUpdates:n,orderSyncError:l}=e;if(null==t||!this.shouldPatchOrder(t)||null!=l)return;let r=this.pendingOrderUpdates(t,n);if(null==r||this.isPatchingRef.current)return;let{setOrder:i,setIsOrderSyncing:a,setOrderSyncError:s}=this.checkoutStore.getState();this.isPatchingRef.current=!0,a(!0);try{let e=await (0,Q.iY)({orderId:t.id,updates:r,expectedRevision:t.revision});if(null!=e){i(e);let{currency:n,...l}=r;if(null!=this.pendingOrderUpdates(e,l)){let e=Error("Order patch was not applied");(0,V.pM)(e,{tags:{source:"order_sync"},extra:{orderId:t.id}}),s(e)}}}catch(n){let e=n instanceof Error?n:Error(String(n));(0,V.gr)(n)||(0,V.pM)(e,{tags:{source:"order_sync"},extra:{orderId:t.id}}),s(e)}finally{this.isPatchingRef.current=!1,a(!1)}}}function $(){let{paymentSourceId:e,paymentGateway:t,selectedCurrency:n,applyWalletBalance:l,contextMetadata:i}=(0,d.t4)(e=>({paymentSourceId:e.paymentSourceId,paymentGateway:e.paymentGateway,selectedCurrency:e.get("checkoutSelectedCurrency"),applyWalletBalance:e.applyWalletBalance,contextMetadata:e.contextMetadata}));return!function(e){let t=(0,d.Q9)(),n=(0,r.useRef)(!1),l=(0,r.useMemo)(()=>new X(t,n),[t]),{order:i,orderSyncError:a}=(0,d.t4)(e=>({order:e.order,orderSyncError:e.orderSyncError}));(0,r.useEffect)(()=>{l.syncOrder({order:i,orderUpdates:e,orderSyncError:a})},[l,i,e,a])}(r.useMemo(()=>({paymentSourceId:e,paymentGateway:t,currency:n,applyWalletBalance:l,loadId:i.loadId}),[e,t,n,l,i.loadId])),null}var J=n(991690),ee=n(10716),et=n(578983),en=n(627363),el=n(253932);function er(){let e=(0,d.t4)(e=>e.applicationId),{data:t}=(0,en.YY)(e),n=el.Q_.useSetting(),l=(0,C.bG)([ee.A],()=>ee.A.getFetchState());return r.useEffect(()=>{null!=t&&t.supportsEmbeddedSurface(J.U.MAIN)&&n&&null==l&&(0,et.S)()},[t,n,l]),null}function ei(){let{orderRecord:e,orderSyncError:t,setOrderSyncError:n,setPaymentSourceId:l,setCheckoutCurrency:i,setApplyWalletBalance:a}=(0,d.t4)(e=>({orderRecord:e.orderRecord,orderSyncError:e.orderSyncError,setOrderSyncError:e.setOrderSyncError,setPaymentSourceId:e.setPaymentSourceId,setCheckoutCurrency:e.setCheckoutCurrency,setApplyWalletBalance:e.setApplyWalletBalance})),s=null!=e?e.billingFacetRecord:null,u=null!=s?s.paymentSourceId:null,c=null!=s?s.fiatCurrency:null;return r.useEffect(()=>{null!=e&&null!=t&&(l(u),i(c),a(null),n(null))},[e,t,u,c,l,i,a,n]),null}var ea=n(158317);function es(){let e=(0,d.Q9)(),{order:t,setOrder:n,lastOrderUpdateRevision:l}=(0,d.t4)(e=>({order:e.order,setOrder:e.setOrder,lastOrderUpdateRevision:e.lastOrderUpdateRevision})),i=null!=t?t.id:null,a=null!=t?t.revision:0;return r.useEffect(()=>{if(null==i||l<=a)return;let t=!1;return(0,ea.r$)(i).then(l=>{if(t||null==l)return;let r=e.getState().order;null!=r&&r.id===l.id&&l.revision<=r.revision||n(l)}),()=>{t=!0}},[i,l,a,n,e]),null}function eu(){let e=(0,d.t4)(e=>e.handleOrderUpdate);return r.useEffect(()=>(y.h.subscribe("ORDER_UPDATE",e),()=>{y.h.unsubscribe("ORDER_UPDATE",e)}),[e]),null}let ec=["BILLING_SUBSCRIPTION_UPDATE_FAIL","GIFT_CODE_REDEEM_FAILURE","PREMIUM_PAYMENT_SUBSCRIBE_FAIL","PREMIUM_PAYMENT_UPDATE_FAIL","SKU_PURCHASE_FAIL"],eo=["BILLING_PAYMENT_FETCH_SUCCESS","PAYMENT_UPDATE"],ed=["BILLING_SUBSCRIPTION_UPDATE_START","PAYMENT_AUTHENTICATION_CLEAR_ERROR","PREMIUM_PAYMENT_ERROR_CLEAR","PREMIUM_PAYMENT_SUBSCRIBE_START","PREMIUM_PAYMENT_SUBSCRIBE_SUCCESS","PREMIUM_PAYMENT_UPDATE_SUCCESS","SKU_PURCHASE_START","SKU_PURCHASE_SUCCESS"];function eh(){let{handlePaymentFailure:e,handlePaymentUpdate:t,handlePaymentAuthenticationError:n,handlePaymentAuthenticationCancel:l,resetPaymentAuthentication:i}=(0,d.t4)(e=>({handlePaymentFailure:e.handlePaymentFailure,handlePaymentUpdate:e.handlePaymentUpdate,handlePaymentAuthenticationError:e.handlePaymentAuthenticationError,handlePaymentAuthenticationCancel:e.handlePaymentAuthenticationCancel,resetPaymentAuthentication:e.resetPaymentAuthentication}));return r.useEffect(()=>{for(let t of ec)y.h.subscribe(t,e);for(let e of eo)y.h.subscribe(e,t);for(let e of ed)y.h.subscribe(e,i);return y.h.subscribe("PAYMENT_AUTHENTICATION_ERROR",n),y.h.subscribe("PAYMENT_AUTHENTICATION_CANCEL",l),()=>{for(let t of ec)y.h.unsubscribe(t,e);for(let e of eo)y.h.unsubscribe(e,t);for(let e of ed)y.h.unsubscribe(e,i);y.h.unsubscribe("PAYMENT_AUTHENTICATION_ERROR",n),y.h.unsubscribe("PAYMENT_AUTHENTICATION_CANCEL",l)}},[e,t,n,l,i]),null}var ep=n(83617),ef=n(655857),em=n(652215);function eC(){let{setCheckoutPriceOptions:e,paymentSourceId:t,skuIds:n,isGift:l,excludeSubscriptionPlansBySKU:i}=(0,d.t4)(e=>({setCheckoutPriceOptions:e.setCheckoutPriceOptions,paymentSourceId:e.paymentSourceId,skuIds:e.skuIds,isGift:e.isGift,excludeSubscriptionPlansBySKU:e.excludeSubscriptionPlansBySKU})),a=r.useMemo(()=>(0,ef._r)(n),[n]),{subscriptionPlanIdForCurrency:s,hasFetchedRelatedSubscriptionPlans:u}=(0,ef.ow)({skuIDs:a,paymentSourceId:t,isGift:l}),c=JSON.stringify(a),o=r.useRef(a);return r.useEffect(()=>{o.current=a}),r.useEffect(()=>{(async function(){let{current:n}=o;try{n.length>0&&!i&&await (0,ep.c_)(t,n)}catch(e){if(10027!==e.code)throw e}e({paymentSourceId:t,currency:void 0,loaded:!0})})().catch(em.tEg)},[t,c,i,e,s,u,l]),null}let ey=["BILLING_SUBSCRIPTION_UPDATE_START","PAYMENT_AUTHENTICATION_CLEAR_ERROR","PREMIUM_PAYMENT_ERROR_CLEAR","PREMIUM_PAYMENT_SUBSCRIBE_START","PREMIUM_PAYMENT_SUBSCRIBE_SUCCESS","PREMIUM_PAYMENT_UPDATE_SUCCESS","SKU_PURCHASE_START","SKU_PURCHASE_SUCCESS"],eE=["SKU_PURCHASE_FAIL","PREMIUM_PAYMENT_SUBSCRIBE_FAIL"],e_=["USER_PAYMENT_CLIENT_ADD"];function eg(){let{handlePaymentFailureForPurchaseTokenAuth:e,handlePurchaseTokenAuth:t,resetPurchaseTokenState:n}=(0,d.t4)(e=>({purchaseTokenAuthState:e.purchaseTokenAuthState,handlePaymentFailureForPurchaseTokenAuth:e.handlePaymentFailureForPurchaseTokenAuth,handlePurchaseTokenAuth:e.handlePurchaseTokenAuth,resetPurchaseTokenState:e.resetPurchaseTokenState}));return r.useEffect(()=>{for(let e of ey)y.h.subscribe(e,n);for(let t of eE)y.h.subscribe(t,e);for(let e of e_)y.h.subscribe(e,t);return()=>{for(let e of ey)y.h.unsubscribe(e,n);for(let t of eE)y.h.unsubscribe(t,e);for(let e of e_)y.h.unsubscribe(e,t)}},[n,e,t]),null}function eS(){let e=(0,d.t4)(e=>e.repriceIfWalletBalanceChanged);return r.useEffect(()=>(y.h.subscribe("SKU_PURCHASE_FAIL",e),()=>{y.h.unsubscribe("SKU_PURCHASE_FAIL",e)}),[e]),null}var eI=n(860215),eA=n(260273);function eP(){return!function(){let e=(0,c.s2)(),{purchaseState:t,setPurchaseState:n}=(0,d.t4)(e=>({purchaseState:e.purchaseState,setPurchaseState:e.setPurchaseState}));(0,G.zT)(e,t,n)}(),null}let ex=[m.C.PREMIUM_CHECKOUT,m.C.GUILD_ROLE_CHECKOUT,m.C.PREMIUM_APPS_SUBSCRIPTION_CHECKOUT,m.C.GUILD_BOOST_CHECKOUT,m.C.GAME_SERVER_SUBSCRIPTION_CHECKOUT];function ev(e){var t,n;let{checkoutInitParameters:i=eA.rc,loadId:a,discoverySessionId:s,children:c}=e,{order:o,isOrderCreationEnabled:y}=(0,eI._5)(),E=(0,p.A)(()=>{let e=o?.id??a??(0,h.A)();return f.A.addBreadcrumb({message:`Checkout session ID: ${e}`}),{loadId:e,discoverySessionId:s,startTime:Date.now()}}),{initialCheckoutPaymentSourceId:A,defaultPaymentSourceId:x,eligiblePaymentGateways:v,hasFetchedPaymentSources:R,paymentSources:M,hasPaymentSources:b}=function(e){let{skuId:t,isGift:n,activeSubscription:l,initialPaymentSourceId:i}=e,a=(0,C.bG)([_.A],()=>_.A.get(t),[t]),s=null!=a?a.eligiblePaymentGateways:null,{defaultPaymentSourceId:c,paymentSources:o,hasFetchedPaymentSources:d,hasPaymentSources:h}=(0,u.j)();return{initialCheckoutPaymentSourceId:r.useMemo(()=>{var e;return g((e={isGift:n,activeSubscription:l,defaultPaymentSourceId:c,eligiblePaymentGateways:s,paymentSources:o,initialPaymentSourceId:i}).initialPaymentSourceId,e)?e.initialPaymentSourceId??null:S(e)??null},[n,l,c,s,o,i]),defaultPaymentSourceId:c,eligiblePaymentGateways:s,hasFetchedPaymentSources:d,paymentSources:o,hasPaymentSources:h}}({skuId:i.skuIds[0],isGift:i.isGift,activeSubscription:i.activeSubscription,initialPaymentSourceId:i.sharedCheckoutParams.initialPaymentSourceId}),[L]=r.useState(()=>{let e={startedPaymentFlowWithPaymentSources:null,startingPremiumSubscriptionPlanId:null!=i.activeSubscription?i.activeSubscription?.planId:null};return R&&(e.startedPaymentFlowWithPaymentSources=b),(0,d.y$)({checkoutInitParameters:i,startingValues:e,contextMetadata:E,order:o,initialPaymentSourceId:A,initialCurrency:(0,ef.el)({activeSubscription:i.activeSubscription,skuIds:i.skuIds,paymentSourceId:A,isGift:i.isGift})})});r.useEffect(()=>{L.getState().setCheckoutInitParameters(i)},[L,i]);let k=(t=i.purchaseType,null!=(n=i.unifiedCheckoutFlow)&&t===em.VVm.SUBSCRIPTION&&ex.includes(n)),N=i.unifiedCheckoutFlow===m.C.GUILD_ROLE_CHECKOUT,j=i.purchaseType===em.VVm.ONE_TIME&&i.unifiedCheckoutFlow!==m.C.ORB_CHECKOUT,U=!y&&j;return(0,l.jsxs)(d.Ni,{value:L,children:[(0,l.jsx)(P,{hasFetchedPaymentSources:R,hasPaymentSources:b}),(0,l.jsx)(eP,{}),(0,l.jsx)(eh,{}),i.unifiedCheckoutFlow!==m.C.ORB_CHECKOUT&&(0,l.jsx)(eg,{}),(0,l.jsx)(eS,{}),(0,l.jsx)(er,{}),(0,l.jsx)(eC,{}),(0,l.jsx)($,{}),(0,l.jsx)(ei,{}),(0,l.jsx)(eu,{}),(0,l.jsx)(es,{}),(0,l.jsx)(I,{isGift:i.isGift,activeSubscription:i.activeSubscription,defaultPaymentSourceId:x,eligiblePaymentGateways:v,hasFetchedPaymentSources:R,paymentSources:M,initialPaymentSourceId:i.sharedCheckoutParams.initialPaymentSourceId}),k&&(0,l.jsx)(z,{}),N&&(0,l.jsx)(T,{}),j&&(0,l.jsx)(B,{}),U&&(0,l.jsx)(F,{}),c]})}var eR=n(783327);function eT(e){let{stepConfigs:t,breadcrumbs:n,loadId:i,discoverySessionId:s,purchaseType:u=em.VVm.SUBSCRIPTION,overrideCustomCheckoutFlow:o,...d}=e,h=JSON.stringify(d.skuIDs),p=r.useMemo(()=>d.skuIDs,[h]),f=(0,a.$w)(),m=r.useMemo(()=>({skuIds:p,isGift:d.isGift??!1,sharedCheckoutParams:d.sharedCheckoutParams??eA.iz,activeSubscription:d.activeSubscription??null,excludeSubscriptionPlansBySKU:d.excludeSubscriptionPlansBySKU??!1,purchaseType:u,defaultPlanId:d.defaultPlanId,customCheckoutFlow:o??f,unifiedCheckoutFlow:d.unifiedCheckoutFlow,paymentGateway:d.paymentGateway,applicationId:d.applicationId??R.tv,tenantParamsMap:d.tenantParamsMap??{}}),[p,u,d.isGift,d.sharedCheckoutParams,d.activeSubscription,d.excludeSubscriptionPlansBySKU,d.applicationId,d.defaultPlanId,o,f,d.unifiedCheckoutFlow,d.paymentGateway,d.tenantParamsMap]);return(0,l.jsx)(c.Gf,{stepConfigs:t,breadcrumbs:n,children:(0,l.jsx)(ev,{loadId:i,discoverySessionId:s,checkoutInitParameters:m,children:(0,l.jsx)(eM,{...d,skuIDs:p,purchaseType:u})})})}function eM(e){let{errorHandlingBehavior:t="close-and-alert",onErrorReported:n,skuIDs:a,children:h}=e,{paymentSources:p}=(0,u.j)(),{contextMetadata:f,unifiedCheckoutFlow:m,purchaseType:C,isGift:y,selectedSkuId:E,selectedPlanId:_,paymentSourceId:g,paymentGateway:S}=(0,d.t4)(e=>({contextMetadata:e.contextMetadata,unifiedCheckoutFlow:e.unifiedCheckoutFlow,purchaseType:e.purchaseType,isGift:e.isGift,selectedSkuId:e.selectedSkuId,selectedPlanId:e.selectedPlanId,paymentSourceId:e.paymentSourceId,paymentGateway:e.paymentGateway})),I=null!=g&&null!=p[g]?p[g]?.type:null,A=r.useMemo(()=>({payment_source_id:g,payment_gateway:S,payment_source_type:I,checkout_flow:m,is_gift:y}),[g,S,I,m,y]),P=(0,i.Db)(),x=(0,c.BQ)();return(0,l.jsx)(o.yv,{children:(0,l.jsx)(eR.R,{children:(0,l.jsx)(s.j,{errorHandlingBehavior:t,locationStack:P,onErrorReported:n,loadId:f.loadId,selectedSkuId:E??null,selectedPlanId:_??null,isGift:y,skuIds:a,purchaseType:C,checkoutStepsHistory:x,additionalAnalyticsData:A,children:h})})})}}