(()=>{"use strict";var e,t,r,o={1787:(e,t,r)=>{const o=window.wp.blocks;var n=r(9187);const i=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3,"name":"woocommerce/product-review-rating","title":"Review Rating","category":"woocommerce","ancestor":["woocommerce/product-reviews"],"description":"Displays the rating of a product review.","textdomain":"woocommerce","usesContext":["commentId"],"attributes":{"textAlign":{"type":"string"}},"supports":{"interactivity":{"clientNavigation":true},"color":{"gradients":true,"__experimentalDefaultControls":{"background":true,"text":true}}}}');var c=r(4921),a=r(7723);const s=window.wp.blockEditor,l=window.wp.data,u=window.wc.data;var p=r(790);(0,o.registerBlockType)(i,{edit:function({context:{commentId:e},attributes:t,setAttributes:r}){const{textAlign:o}=t,n=(0,c.A)("wc-block-product-review-rating",{[`has-text-align-${o}`]:o}),i=(0,s.useBlockProps)({className:n}),d=(0,l.useSelect)(t=>{const{getReview:r}=t(u.REVIEWS_STORE_NAME),o=e?r(Number(e)):null;return o?.rating??4},[e]),w={width:d/5*100+"%"},f=(0,a.sprintf)(/* translators: %f is referring to the average rating value */ /* translators: %f is referring to the average rating value */
(0,a.__)("Rated %f out of 5","woocommerce"),d),g={__html:(0,a.sprintf)(/* translators: %s is the rating value wrapped in HTML strong tags. */ /* translators: %s is the rating value wrapped in HTML strong tags. */
(0,a.__)("Rated %s out of 5","woocommerce"),(0,a.sprintf)('<strong class="rating">%f</strong>',d))};return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(s.BlockControls,{children:(0,p.jsx)(s.AlignmentToolbar,{value:t.textAlign,onChange:e=>{r({textAlign:e||""})}})}),(0,p.jsx)("div",{...i,children:(0,p.jsx)("div",{className:"wc-block-product-review-rating__stars",role:"img","aria-label":f,children:(0,p.jsx)("span",{style:w,dangerouslySetInnerHTML:g})})})]})},icon:n.A})},790:e=>{e.exports=window.ReactJSXRuntime},7723:e=>{e.exports=window.wp.i18n},5573:e=>{e.exports=window.wp.primitives}},n={};function i(e){var t=n[e];if(void 0!==t)return t.exports;var r=n[e]={exports:{}};return o[e](r,r.exports,i),r.exports}i.m=o,e=[],i.O=(t,r,o,n)=>{if(!r){var c=1/0;for(u=0;u<e.length;u++){for(var[r,o,n]=e[u],a=!0,s=0;s<r.length;s++)(!1&n||c>=n)&&Object.keys(i.O).every(e=>i.O[e](r[s]))?r.splice(s--,1):(a=!1,n<c&&(c=n));if(a){e.splice(u--,1);var l=o();void 0!==l&&(t=l)}}return t}n=n||0;for(var u=e.length;u>0&&e[u-1][2]>n;u--)e[u]=e[u-1];e[u]=[r,o,n]},i.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return i.d(t,{a:t}),t},r=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,i.t=function(e,o){if(1&o&&(e=this(e)),8&o)return e;if("object"==typeof e&&e){if(4&o&&e.__esModule)return e;if(16&o&&"function"==typeof e.then)return e}var n=Object.create(null);i.r(n);var c={};t=t||[null,r({}),r([]),r(r)];for(var a=2&o&&e;"object"==typeof a&&!~t.indexOf(a);a=r(a))Object.getOwnPropertyNames(a).forEach(t=>c[t]=()=>e[t]);return c.default=()=>e,i.d(n,c),n},i.d=(e,t)=>{for(var r in t)i.o(t,r)&&!i.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},i.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.j=8833,(()=>{var e={8833:0};i.O.j=t=>0===e[t];var t=(t,r)=>{var o,n,[c,a,s]=r,l=0;if(c.some(t=>0!==e[t])){for(o in a)i.o(a,o)&&(i.m[o]=a[o]);if(s)var u=s(i)}for(t&&t(r);l<c.length;l++)n=c[l],i.o(e,n)&&e[n]&&e[n][0](),e[n]=0;return i.O(u)},r=globalThis.webpackChunkwebpackWcBlocksMainJsonp=globalThis.webpackChunkwebpackWcBlocksMainJsonp||[];r.forEach(t.bind(null,0)),r.push=t.bind(null,r.push.bind(r))})();var c=i.O(void 0,[94],()=>i(1787));c=i.O(c),((this.wc=this.wc||{}).blocks=this.wc.blocks||{})["product-review-rating"]=c})();