import{useProductOfferDiscount as e,useCurrentVariant as t,useQuantity as l,useFormatMoney as i,shopifyPriceRounding as o}from"@gem-sdk/core";import{useDynamicProduct as a}from"./useDynamicProduct.js";let useGetMoneyLines=(u,s)=>{let{isDynamicProduct:n,dynamicPrice:p,dynamicDiscount:b,isEnableDynamicDiscount:r}=a(),L=e(),h=t(),{quantity:c}=l(),d=L*(c||1),m=i(d,!1),w=h?.price??0,S=w*(c||1),f=i(S,!1),g=o(d,2),y=i(S-parseFloat(g),!1),T=()=>{let e=[];return!1!==u.isShowSubTotalLabel&&e.push({title:s.subTotalLabel,money:n?p:f,uniqueId:"subTotalLabel"}),!1!==u.isShowDiscountLabel&&e.push({title:s.discountLabel,money:n&&b&&r?`${b.value}%`:L>0?m:"No discount",uniqueId:"discountLabel"}),!1!==u.isShowShippingLabel&&e.push({title:s.shippingLabel,uniqueId:"shippingLabel",tooltip:{content:"Shipping fee will be calculated on real offer page",width:"23em"}}),!1!==u.isShowTaxesLabel&&e.push({title:s.taxesLabel,uniqueId:"taxesLabel",tooltip:{content:"Taxes will be calculated on real offer page",width:"20em"}}),!1!==u.isShowTotalLabel&&e.push({title:s.totalLabel,money:n?p:y,uniqueId:"totalLabel"}),e};return{getMoneyLines:T}};export{useGetMoneyLines};
