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]=`f0eaf8e2-01a7-4990-ad36-33f9f6244abd`,e._sentryDebugIdIdentifier=`sentry-dbid-f0eaf8e2-01a7-4990-ad36-33f9f6244abd`)}catch{}import{o as e}from"./rolldown-runtime-eb2nym32.js";import{Ag as t,Eg as n,Fg as r,Ig as i,Qn as a,U as o,Yn as s,dn as c,or as l,sh as u}from"./entry.client-dr7r6s9a.js";import{n as d,o as f}from"./priceHelpers-jmxztd6p.js";var p=r(),m=e(l(),1),h=e(i(),1),g=t(),_={priceBaseContainer:`price-base-container`,originalPrice:`original-price`,originalPriceText:`original-price-text`,currentPrice:`current-price`,currentPriceText:`current-price-text`,afterPriceText:`after-price-text`,afterPriceTextContainer:`after-price-text-container`};function v(e){let t=(0,p.c)(5),{className:n,children:r}=e,i;t[0]===n?i=t[1]:(i=o(`flex flex-wrap items-baseline gap-x-1`,n),t[0]=n,t[1]=i);let a;return t[2]!==i||t[3]!==r?(a=(0,g.jsx)(`div`,{"data-testid":_.priceBaseContainer,className:i,children:r}),t[2]=i,t[3]=r,t[4]=a):a=t[4],a}function y(e){let t=(0,p.c)(8),{originalPrice:n,hasBrandStyling:r,className:i}=e;if(!n)return null;let a=r?`font-light`:`text-gray-400`,s;t[0]!==a||t[1]!==i?(s=o(`margin-inline-end-4 line-through`,a,i),t[0]=a,t[1]=i,t[2]=s):s=t[2];let c;t[3]===n?c=t[4]:(c=(0,g.jsx)(`span`,{"data-testid":_.originalPriceText,children:n}),t[3]=n,t[4]=c);let l;return t[5]!==s||t[6]!==c?(l=(0,g.jsx)(`span`,{"data-testid":_.originalPrice,"aria-hidden":`true`,className:s,children:c}),t[5]=s,t[6]=c,t[7]=l):l=t[7],l}function b(e){let t=(0,p.c)(8),{currentPrice:n,hasAddOns:r,className:i,standalone:a,hasBrandStyling:s}=e,c=!s&&!(a!==void 0&&a)&&`text-white`,l;t[0]!==i||t[1]!==c?(l=o(`text-bold`,i,c),t[0]=i,t[1]=c,t[2]=l):l=t[2];let u=`${n}${r?`+`:``}`,d;t[3]===u?d=t[4]:(d=(0,g.jsx)(`span`,{"data-testid":_.currentPriceText,children:u}),t[3]=u,t[4]=d);let f;return t[5]!==l||t[6]!==d?(f=(0,g.jsx)(`span`,{"data-testid":_.currentPrice,className:l,children:d}),t[5]=l,t[6]=d,t[7]=f):f=t[7],f}function x(e){let t=(0,p.c)(3),{text:n}=e;if(!n||n.length===0)return null;let r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,m.default)(`inline-flex items-baseline gap-2`),t[0]=r):r=t[0];let i;return t[1]===n?i=t[2]:(i=(0,g.jsx)(`span`,{"data-testid":_.afterPriceTextContainer,className:r,children:(0,g.jsx)(`span`,{"data-testid":_.afterPriceText,children:n})}),t[1]=n,t[2]=i),i}var S={productPrice:`product-price`,loadingShimmer:`product-price-loading-shimmer`},C=c(({marketInfo:e,product:t,sku:n,availability:r,className:i,listedPriceClassName:o,hasBrandStyling:c=!1})=>{if(!t||!n||!r)return null;let l=d({product:t,sku:n,availability:r},e);if(!l)return null;let{originalPrice:u,lowestPrice:f,afterText:p}=l;return(0,g.jsx)(h.Suspense,{fallback:(0,g.jsx)(a,{children:(0,g.jsx)(s,{className:i,"data-testid":S.loadingShimmer})}),children:(0,g.jsx)(`div`,{"data-testid":S.productPrice,children:(0,g.jsxs)(v,{className:i,children:[(0,g.jsx)(b,{className:o,hasAddOns:!!t.hasAddOns,currentPrice:f,standalone:!u,hasBrandStyling:c}),(0,g.jsx)(y,{originalPrice:u,hasBrandStyling:c}),(0,g.jsx)(x,{text:p})]})})})},({productId:e,skuId:t,availabilityId:r,className:i,listedPriceClassName:a,hasBrandStyling:o})=>{let{authentication:s,internationalization:c,xboxcomFD:l}=u(),{data:d}=n(s.queries.isFullySignedIn.getOptions()),{data:p}=n(d?l.queries.product.getActiveUserQuery().getOptions({productId:e}):l.queries.product.getAnonymousQuery().getOptions({productId:e})),m=p.productSummaries.find(t=>t.productId===e),h;m&&(h=f({product:m,skuSummaries:p.skuSummaries,availabilitySummaries:p.availabilitySummaries,skuId:t,availabilityId:r}));let{data:g}=n(c.queries.territory.getOptions()),{data:_}=n(c.queries.locale.getOptions()),v={market:g,language:_.split(`-`)[0],locale:_,localeWithScript:_};return{...h,marketInfo:v,product:m,className:i,listedPriceClassName:a,hasBrandStyling:o}});export{C as t};