import b from"./QMEN6lyk.js";import w from"./CxeYIrhH.js";import{d as k,u as j,e as n,f as B,t as d,x as m,g as o,F,o as a}from"./BxiWQxwE.js";const C=k({__name:"index",props:{product:{type:Object,required:!0},forceShow:{type:String,required:!1,default:null}},setup(f){const r=f,P=j(),_=n(()=>u("regular")),h=n(()=>u("offer")),g=n(()=>u("mixmatch")),u=e=>{if(r.forceShow===e)return!0;if(r.forceShow===null)switch(e){case"regular":return!r.product.price.isOffer||!r.product.price.offerPrice||!r.product.price.isOffer&&r.product.price.normalPrice!==r.product.price.offerPrice;case"offer":return r.product.price.isOffer&&r.product.price.offerPrice!==r.product.price.normalPrice;case"mixmatch":return r.product.price.isOffer&&r.product.price.offerPrice&&r.product.price.offerPrice===r.product.price.normalPrice;default:return!1}return!1},x=["offerPrice","normalPrice"],O=n(()=>{var e,t,c,p,i,s;return((t=(e=r.product)==null?void 0:e.price)==null?void 0:t.isOffer)&&((p=(c=r.product)==null?void 0:c.price)==null?void 0:p.normalPrice)===((s=(i=r.product)==null?void 0:i.price)==null?void 0:s.offerPrice)}),l=n(()=>Object.keys(r.product.price).reduce((t,c)=>(x.includes(c)&&(t[c]=S(c)),t),{})),S=e=>({integer:Math.floor(r.product.price[e]).toString()+".",decimals:Math.round(r.product.price[e]%1*100).toString().padStart(2,"0"),original:r.product.price.normalPrice!==0?r.product.price.normalPrice.toFixed(2):null});return(e,t)=>{var i;const c=b,p=w;return a(),B(F,null,[o(_)?(a(),d(c,{key:0,price:o(l).normalPrice},null,8,["price"])):m("",!0),o(h)||o(g)?(a(),d(p,{key:1,price:o(l).offerPrice,label:(i=f.product.price)==null?void 0:i.textPriceSign,"hide-label":!!o(P).params.product,"hide-original-price":o(O)},null,8,["price","label","hide-label","hide-original-price"])):m("",!0)],64)}}});export{C as _};
