import{j as e,w as x}from"./vendor-BKmmeuxg.js";import{P as d}from"./progress-DinXkPLd.js";import{u as o}from"./use-lang-YfV87_zl.js";const p=({totalReviews:r})=>{const{common:l,frontend:m}=o(),n=(()=>{var t;if(!((t=r==null?void 0:r.rating_distribution)!=null&&t.length)||r.total_reviews===0)return 0;const s=r.rating_distribution.reduce((i,a)=>i+a.stars*(a.percentage/100),0);return Math.round(s*10)/10})(),c=(s,t=!0)=>Array.from({length:5},(i,a)=>e.jsx(x,{className:`h-4 w-4 ${t&&ae.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"flex w-20 flex-shrink-0 gap-1",children:c(s.stars)}),e.jsx("div",{className:"min-w-0 flex-1",children:e.jsx(d,{value:s.percentage})}),e.jsx("div",{className:"w-12 flex-shrink-0 text-right",children:e.jsxs("span",{className:"text-sm font-medium",children:[s.percentage?Number(s.percentage).toFixed(2):"0","%"]})})]},s.stars))})]})]})};export{p as S};