(globalThis.webpackChunkwebpackWcBlocksFrontendJsonp=globalThis.webpackChunkwebpackWcBlocksFrontendJsonp||[]).push([[578],{3895:(e,t,s)=>{"use strict";s.r(t),s.d(t,{Block:()=>i,default:()=>l});var r=s(2796),n=s(3754),o=s(1616),a=s(6980),c=(s(7545),s(790));const i=e=>{const{textAlign:t="",shouldDisplayMockedReviewsWhenProductHasNoReviews:s}=e,o=(0,n.p)(e),{parentClassName:i}=(0,r.useInnerBlockLayoutContext)(),{product:l}=(0,r.useProductDataContext)(),u=(0,a.p3)(l),m=(0,a.Nm)(l);return(0,c.jsx)(a.fb,{className:"wc-block-components-product-rating-stars",showMockedReviews:s,styleProps:o,parentClassName:i,reviews:m,rating:u,textAlign:t})},l=(0,o.withProductDataContext)(i)},3754:(e,t,s)=>{"use strict";s.d(t,{p:()=>l});var r=s(4921),n=s(3993),o=s(7356),a=s(9786);function c(e={}){const t={};return(0,a.getCSSRules)(e,{selector:""}).forEach(e=>{t[e.key]=e.value}),t}function i(e,t){return e&&t?`has-${(0,o.c)(t)}-${e}`:""}const l=e=>{const t=(e=>{const t=(0,n.isObject)(e)?e:{style:{}};let s=t.style;return(0,n.isString)(s)&&(s=JSON.parse(s)||{}),(0,n.isObject)(s)||(s={}),{...t,style:s}})(e),s=function(e){const{backgroundColor:t,textColor:s,gradient:o,style:a}=e,l=i("background-color",t),u=i("color",s),m=function(e){if(e)return`has-${e}-gradient-background`}(o),d=m||a?.color?.gradient;return{className:(0,r.A)(u,m,{[l]:!d&&!!l,"has-text-color":s||a?.color?.text,"has-background":t||a?.color?.background||o||a?.color?.gradient,"has-link-color":(0,n.isObject)(a?.elements?.link)?a?.elements?.link?.color:void 0}),style:c({color:a?.color||{}})}}(t),o=function(e){const t=e.style?.border||{};return{className:function(e){const{borderColor:t,style:s}=e,n=t?i("border-color",t):"";return(0,r.A)({"has-border-color":!!t||!!s?.border?.color,[n]:!!n})}(e),style:c({border:t})}}(t),a=function(e){return{className:void 0,style:c({spacing:e.style?.spacing||{}})}}(t),l=(e=>{const t=(0,n.isObject)(e.style.typography)?e.style.typography:{},s=(0,n.isString)(t.fontFamily)?t.fontFamily:"";return{className:e.fontFamily?`has-${e.fontFamily}-font-family`:s,style:{fontSize:e.fontSize?`var(--wp--preset--font-size--${e.fontSize})`:t.fontSize,fontStyle:t.fontStyle,fontWeight:t.fontWeight,letterSpacing:t.letterSpacing,lineHeight:t.lineHeight,textDecoration:t.textDecoration,textTransform:t.textTransform}}})(t);return{className:(0,r.A)(l.className,s.className,o.className,a.className),style:{...l.style,...s.style,...o.style,...a.style}}}},6980:(e,t,s)=>{"use strict";s.d(t,{Nm:()=>i,fb:()=>g,p3:()=>c});var r=s(7723),n=s(4921),o=s(3993),a=s(790);const c=e=>{const t=parseFloat(e.average_rating);return Number.isFinite(t)&&t>0?t:0},i=e=>{if("review_count"in e){const t=(0,o.isNumber)(e.review_count)?e.review_count:parseInt(e.review_count,10);return Number.isFinite(t)&&t>0?t:0}if("rating_count"in e){const t=(0,o.isNumber)(e.rating_count)?e.rating_count:parseInt(e.rating_count,10);return Number.isFinite(t)&&t>0?t:0}return 0},l=e=>({width:e/5*100+"%"}),u=({className:e,parentClassName:t})=>{const s=l(0);return(0,a.jsxs)("div",{className:(0,n.A)(`${e}__norating-container`,`${t}-product-rating__norating-container`),children:[(0,a.jsx)("div",{className:`${e}__norating`,role:"img",children:(0,a.jsx)("span",{style:s})}),(0,a.jsx)("span",{children:(0,r.__)("No Reviews","woocommerce")})]})},m=e=>{const{className:t,rating:s,reviews:o,parentClassName:c}=e,i=l(s),u=(0,r.sprintf)(/* translators: %f is referring to the average rating value */ /* translators: %f is referring to the average rating value */
(0,r.__)("Rated %f out of 5","woocommerce"),s),m={__html:(0,r.sprintf)(/* translators: %1$s is referring to the average rating value, %2$s is referring to the number of ratings */ /* translators: %1$s is referring to the average rating value, %2$s is referring to the number of ratings */
(0,r._n)("Rated %1$s out of 5 based on %2$s customer rating","Rated %1$s out of 5 based on %2$s customer ratings",o,"woocommerce"),(0,r.sprintf)('<strong class="rating">%f</strong>',s),(0,r.sprintf)('<span class="rating">%d</span>',o))};return(0,a.jsx)("div",{className:(0,n.A)(`${t}__stars`,`${c}__product-rating__stars`),role:"img","aria-label":u,children:(0,a.jsx)("span",{style:i,dangerouslySetInnerHTML:m})})},d=e=>{const{className:t,reviews:s}=e,n=(0,r.sprintf)(/* translators: %s is referring to the total of reviews for a product */ /* translators: %s is referring to the total of reviews for a product */
(0,r._n)("(%s customer review)","(%s customer reviews)",s,"woocommerce"),s);return(0,a.jsx)("span",{className:`${t}__reviews_count`,children:n})},g=e=>{const{className:t="wc-block-components-product-rating",showReviewCount:s,showMockedReviews:r,parentClassName:o="",rating:c,reviews:i,styleProps:l,textAlign:g}=e,p=(0,n.A)(l.className,t,{[`${o}__product-rating`]:o,[`has-text-align-${g}`]:g}),f=r&&(0,a.jsx)(u,{className:t,parentClassName:o}),N=i?(0,a.jsx)(m,{className:t,rating:c,reviews:i,parentClassName:o}):f,y=i&&s;return(0,a.jsx)("div",{className:p,style:l.style,children:(0,a.jsxs)("div",{className:`${t}__container`,children:[N,y?(0,a.jsx)(d,{className:t,reviews:i}):null]})})}},7545:()=>{}}]);