try{let e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]=`c1ad01b1-23b5-4334-bbe8-3889a7e537a8`,e._sentryDebugIdIdentifier=`sentry-dbid-c1ad01b1-23b5-4334-bbe8-3889a7e537a8`)}catch{}import{o as e}from"./rolldown-runtime-eb2nym32.js";import{R as t,z as n}from"./vendor-misc-hfpbxrii.js";import{$d as r,Ag as i,Dp as a,Ep as o,Fg as s,Ig as c,Ym as l,_r as u,dn as d,sh as f,st as p,th as m}from"./entry.client-dr7r6s9a.js";import{t as h}from"./commercePreloadLinks-7ptujqoo.js";import{n as g,t as _}from"./createGetAuthToken-gzsh85ms.js";import{t as v}from"./useFlowId-n9vqrww9.js";import{t as y}from"./purchasePageReadyUtils-n2r38x2a.js";import{n as b,r as x,t as S}from"./parseSearchParams-lzmzldiy.js";import{t as C}from"./RedeemHost-jvewtwjr.js";var w=s(),T=e(c(),1),E=i(),D=(0,T.createContext)(null),O=d(e=>{let t=(0,w.c)(3),n=C.useComponent(),r;return t[0]!==n||t[1]!==e?(r=(0,E.jsx)(n,{...e}),t[0]=n,t[1]=e,t[2]=r):r=t[2],r},()=>{let{token:e}=n(r.external.commerce.redeem),[i]=t(r.external.commerce.redeem),{getLogger:s}=m(),{adaptor:{native:c}}=f();p();let l=v(),u=(0,T.useContext)(D),d=s(`RedeemPage`);if(!u)throw new o(`HostCommunicationContext`,a.Missing);let{mode:h,getXToken:g,getToken:C,getMsaToken:w,onExit:E,onPageReady:O}=u,k=x(i.clientName),A=S(i.callerApplicationId),j=b(i.purchaseSource),M=i.identityMismatch??!1;return{redeemFlowConfiguration:e?{type:`RedeemCode`,code:e,disallowUserInput:!0}:{type:`RedeemCode`,code:void 0,disallowUserInput:!1},getAuthToken:_({mode:h,getXToken:g,getToken:C,getMsaToken:w,isNhpAvailable:()=>c.bridge.isSupported(),logger:d,msaVersion:`MSAv1`}),onExit:async e=>{d.info(`onExit — status: ${e.status}`),await E({productId:e.status===`Succeeded`&&e.product.scenario!==`GiftCard`?e.product.productId:``,status:e.status,orderId:e.status===`Succeeded`?e.orderId:void 0})},disallowCsvRedemption:!1,campaignId:void 0,optionalCampaignId:void 0,allowedStoreIds:``,redeemLaunchStartTime:0,callerApplicationId:A,sourceClientName:k,purchaseSource:j,flowId:l,identityMismatch:M,onPurchasePageReady:y(O)}}),k=l(u(()=>{let e=g({resultReporting:`onExit`}),{isReady:t,error:n}=e,r=O.useComponent();if(n)throw n;return t?(0,E.jsx)(D.Provider,{value:e,children:(0,E.jsx)(T.Suspense,{children:(0,E.jsx)(r,{})})}):null},`RedeemPage`)),A=()=>h;export{k as default,A as links};