'use client';
import{jsxs as e,jsx as r}from"react/jsx-runtime";import{useCurrentVariant as p,useProduct as t,shopifyPriceRounding as o,useProductOfferDiscount as c,useFormatMoney as i,cls as a}from"@gem-sdk/core";import{useMemo as s}from"react";import m from"../../text/components/Text.js";import{useDynamicProduct as l}from"../hooks/useDynamicProduct.js";let PostPurchaseProductPrice=({styles:u,style:d,builderAttrs:y,builderProps:n,children:P})=>{let h=p(),T=t(),g=h?.price??0,f=h?.salePrice??0,x=parseFloat(o(c(),2)),{isDynamicProduct:j}=l(),F=s(()=>x?u?.priceType==="compare"?g:g-x:u?.priceType==="compare"?f:g,[x,u?.priceType,g,f]),k=i(parseFloat(F.toFixed(2)),!1),D=T?.baseID?.replace("gid://shopify/Product/",""),N=s(()=>u?.priceType==="compare"&&(!x&&f<g||g<=0),[x,g,f,u?.priceType]);return N?null:e("div",{...y,className:a(n?.uid),style:{...d},id:`shopify-text-element-${n?.uid}`,"data-product-id":D,children:[r(m,{styles:u,setting:{text:j?"$???":k},className:a({"gp-money":u?.priceType==="regular","gp-product-compare-price":u?.priceType==="compare","gp-line-through":u?.priceType==="compare"&&u?.lineThrough})}),P]})};export{PostPurchaseProductPrice as default};
