(globalThis.webpackChunkwebpackWcBlocksMainJsonp=globalThis.webpackChunkwebpackWcBlocksMainJsonp||[]).push([[8578],{7220:(e,s,t)=>{"use strict";t.r(s),t.d(s,{Block:()=>i,default:()=>l});var r=t(415),n=t(371),o=t(1616),a=t(5841),c=(t(7545),t(790));const i=e=>{const{textAlign:s="",shouldDisplayMockedReviewsWhenProductHasNoReviews:t}=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:t,styleProps:o,parentClassName:i,reviews:m,rating:u,textAlign:s})},l=(0,o.withProductDataContext)(i)},371:(e,s,t)=>{"use strict";t.d(s,{p:()=>c});var r=t(4921),n=t(3993),o=t(219),a=t(17);const c=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=(0,a.BK)(s),c=(0,a.aR)(s),i=(0,a.fo)(s),l=(0,o.x)(s);return{className:(0,r.A)(l.className,t.className,c.className,i.className),style:{...l.style,...t.style,...c.style,...i.style}}}},219:(e,s,t)=>{"use strict";t.d(s,{x:()=>n});var r=t(3993);const n=e=>{const s=(0,r.isObject)(e.style.typography)?e.style.typography:{},t=(0,r.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}}}},17:(e,s,t)=>{"use strict";t.d(s,{BK:()=>l,aR:()=>u,fo:()=>m});var r=t(4921),n=t(7356),o=t(9786),a=t(3993);function c(e={}){const s={};return(0,o.getCSSRules)(e,{selector:""}).forEach((e=>{s[e.key]=e.value})),s}function i(e,s){return e&&s?`has-${(0,n.c)(s)}-${e}`:""}function l(e){const{backgroundColor:s,textColor:t,gradient:n,style:o}=e,l=i("background-color",s),u=i("color",t),m=function(e){if(e)return`has-${e}-gradient-background`}(n),d=m||o?.color?.gradient;return{className:(0,r.A)(u,m,{[l]:!d&&!!l,"has-text-color":t||o?.color?.text,"has-background":s||o?.color?.background||n||o?.color?.gradient,"has-link-color":(0,a.isObject)(o?.elements?.link)?o?.elements?.link?.color:void 0}),style:c({color:o?.color||{}})}}function u(e){const s=e.style?.border||{};return{className:function(e){const{borderColor:s,style:t}=e,n=s?i("border-color",s):"";return(0,r.A)({"has-border-color":!!s||!!t?.border?.color,[n]:!!n})}(e),style:c({border:s})}}function m(e){return{className:void 0,style:c({spacing:e.style?.spacing||{}})}}},5841:(e,s,t)=>{"use strict";t.d(s,{Nm:()=>i,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},i=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},l=e=>({width:e/5*100+"%"}),u=({className:e,parentClassName:s})=>{const t=l(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,i=l(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:i,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:i,styleProps:l,textAlign:p}=e,g=(0,n.A)(l.className,s,{[`${o}__product-rating`]:o,[`has-text-align-${p}`]:p}),f=r&&(0,a.jsx)(u,{className:s,parentClassName:o}),y=i?(0,a.jsx)(m,{className:s,rating:c,reviews:i,parentClassName:o}):f,N=i&&t;return(0,a.jsx)("div",{className:g,style:l.style,children:(0,a.jsxs)("div",{className:`${s}__container`,children:[y,N?(0,a.jsx)(d,{className:s,reviews:i}):null]})})}},7545:()=>{}}]);