(globalThis.webpackChunkwebpackWcBlocksFrontendJsonp=globalThis.webpackChunkwebpackWcBlocksFrontendJsonp||[]).push([[462],{9812:(e,s,t)=>{"use strict";t.r(s),t.d(s,{Block:()=>l,default:()=>i});var r=t(2796),n=t(41),o=t(1616),a=t(5841),c=(t(4053),t(790));const l=e=>{const{textAlign:s="",isDescendentOfSingleProductBlock:t,shouldDisplayMockedReviewsWhenProductHasNoReviews:o}=e,l=(0,n.p)(e),{parentClassName:i}=(0,r.useInnerBlockLayoutContext)(),{product:u}=(0,r.useProductDataContext)(),m=(0,a.p3)(u),d=(0,a.Nm)(u);if(d||o)return(0,c.jsx)(a.fb,{className:"wc-block-components-product-rating",showReviewCount:t,showMockedReviews:o,styleProps:l,parentClassName:i,reviews:d,rating:m,textAlign:s})},i=(0,o.withProductDataContext)(l)},41:(e,s,t)=>{"use strict";t.d(s,{p:()=>i});var r=t(4921),n=t(3993),o=t(7356),a=t(9786);function c(e={}){const s={};return(0,a.getCSSRules)(e,{selector:""}).forEach((e=>{s[e.key]=e.value})),s}function l(e,s){return e&&s?`has-${(0,o.c)(s)}-${e}`:""}const i=e=>{const s=(e=>{const s=(0,n.isObject)(e)?e:{style:{}};let t=s.style;return(0,n.isString)(t)&&(t=JSON.parse(t)||{}),(0,n.isObject)(t)||(t={}),{...s,style:t}})(e),t=function(e){const{backgroundColor:s,textColor:t,gradient:o,style:a}=e,i=l("background-color",s),u=l("color",t),m=function(e){if(e)return`has-${e}-gradient-background`}(o),d=m||a?.color?.gradient;return{className:(0,r.A)(u,m,{[i]:!d&&!!i,"has-text-color":t||a?.color?.text,"has-background":s||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||{}})}}(s),o=function(e){const s=e.style?.border||{};return{className:function(e){const{borderColor:s,style:t}=e,n=s?l("border-color",s):"";return(0,r.A)({"has-border-color":!!s||!!t?.border?.color,[n]:!!n})}(e),style:c({border:s})}}(s),a=function(e){return{className:void 0,style:c({spacing:e.style?.spacing||{}})}}(s),i=(e=>{const s=(0,n.isObject)(e.style.typography)?e.style.typography:{},t=(0,n.isString)(s.fontFamily)?s.fontFamily:"";return{className:e.fontFamily?`has-${e.fontFamily}-font-family`:t,style:{fontSize:e.fontSize?`var(--wp--preset--font-size--${e.fontSize})`:s.fontSize,fontStyle:s.fontStyle,fontWeight:s.fontWeight,letterSpacing:s.letterSpacing,lineHeight:s.lineHeight,textDecoration:s.textDecoration,textTransform:s.textTransform}}})(s);return{className:(0,r.A)(i.className,t.className,o.className,a.className),style:{...i.style,...t.style,...o.style,...a.style}}}},5841:(e,s,t)=>{"use strict";t.d(s,{Nm:()=>l,fb:()=>p,p3:()=>c});var r=t(7723),n=t(4921),o=t(3993),a=t(790);const c=e=>{const s=parseFloat(e.average_rating);return Number.isFinite(s)&&s>0?s:0},l=e=>{const s=(0,o.isNumber)(e.review_count)?e.review_count:parseInt(e.review_count,10);return Number.isFinite(s)&&s>0?s:0},i=e=>({width:e/5*100+"%"}),u=({className:e,parentClassName:s})=>{const t=i(0);return(0,a.jsxs)("div",{className:(0,n.A)(`${e}__norating-container`,`${s}-product-rating__norating-container`),children:[(0,a.jsx)("div",{className:`${e}__norating`,role:"img",children:(0,a.jsx)("span",{style:t})}),(0,a.jsx)("span",{children:(0,r.__)("No Reviews","woocommerce")})]})},m=e=>{const{className:s,rating:t,reviews:o,parentClassName:c}=e,l=i(t),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"),t),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>',t),(0,r.sprintf)('<span class="rating">%d</span>',o))};return(0,a.jsx)("div",{className:(0,n.A)(`${s}__stars`,`${c}__product-rating__stars`),role:"img","aria-label":u,children:(0,a.jsx)("span",{style:l,dangerouslySetInnerHTML:m})})},d=e=>{const{className:s,reviews:t}=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)",t,"woocommerce"),t);return(0,a.jsx)("span",{className:`${s}__reviews_count`,children:n})},p=e=>{const{className:s="wc-block-components-product-rating",showReviewCount:t,showMockedReviews:r,parentClassName:o="",rating:c,reviews:l,styleProps:i,textAlign:p}=e,g=(0,n.A)(i.className,s,{[`${o}__product-rating`]:o,[`has-text-align-${p}`]:p}),f=r&&(0,a.jsx)(u,{className:s,parentClassName:o}),y=l?(0,a.jsx)(m,{className:s,rating:c,reviews:l,parentClassName:o}):f,N=l&&t;return(0,a.jsx)("div",{className:g,style:i.style,children:(0,a.jsxs)("div",{className:`${s}__container`,children:[y,N?(0,a.jsx)(d,{className:s,reviews:l}):null]})})}},4053:()=>{}}]);