(globalThis.webpackChunkwebpackWcBlocksMainJsonp=globalThis.webpackChunkwebpackWcBlocksMainJsonp||[]).push([[8578],{950:(e,t,s)=>{"use strict";s.r(t),s.d(t,{Block:()=>i,default:()=>l});var r=s(415),n=s(2721),o=s(1616),a=s(6571),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)},2721:(e,t,s)=>{"use strict";s.d(t,{p:()=>c});var r=s(4921),n=s(3993),o=s(1605),a=s(3099);const c=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=(0,a.BK)(t),c=(0,a.aR)(t),i=(0,a.fo)(t),l=(0,o.x)(t);return{className:(0,r.A)(l.className,s.className,c.className,i.className),style:{...l.style,...s.style,...c.style,...i.style}}}},1605:(e,t,s)=>{"use strict";s.d(t,{x:()=>n});var r=s(3993);const n=e=>{const t=(0,r.isObject)(e.style.typography)?e.style.typography:{},s=(0,r.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}}}},3099:(e,t,s)=>{"use strict";s.d(t,{BK:()=>l,aR:()=>u,fo:()=>m});var r=s(4921),n=s(7356),o=s(9786),a=s(3993);function c(e={}){const t={};return(0,o.getCSSRules)(e,{selector:""}).forEach((e=>{t[e.key]=e.value})),t}function i(e,t){return e&&t?`has-${(0,n.c)(t)}-${e}`:""}function l(e){const{backgroundColor:t,textColor:s,gradient:n,style:o}=e,l=i("background-color",t),u=i("color",s),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":s||o?.color?.text,"has-background":t||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 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})}}function m(e){return{className:void 0,style:c({spacing:e.style?.spacing||{}})}}},6571:(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:()=>{}}]);