this.wc=this.wc||{},this.wc.blocks=this.wc.blocks||{},this.wc.blocks["reviews-by-category"]=function(e){function t(t){for(var n,a,i=t[0],l=t[1],s=t[2],b=0,d=[];b<i.length;b++)a=i[b],Object.prototype.hasOwnProperty.call(o,a)&&o[a]&&d.push(o[a][0]),o[a]=0;for(n in l)Object.prototype.hasOwnProperty.call(l,n)&&(e[n]=l[n]);for(u&&u(t);d.length;)d.shift()();return c.push.apply(c,s||[]),r()}function r(){for(var e,t=0;t<c.length;t++){for(var r=c[t],n=!0,i=1;i<r.length;i++){var l=r[i];0!==o[l]&&(n=!1)}n&&(c.splice(t--,1),e=a(a.s=r[0]))}return e}var n={},o={17:0},c=[];function a(t){if(n[t])return n[t].exports;var r=n[t]={i:t,l:!1,exports:{}};return e[t].call(r.exports,r,r.exports,a),r.l=!0,r.exports}a.m=e,a.c=n,a.d=function(e,t,r){a.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},a.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.t=function(e,t){if(1&t&&(e=a(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(a.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)a.d(r,n,function(t){return e[t]}.bind(null,n));return r},a.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(t,"a",t),t},a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},a.p="";var i=window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[],l=i.push.bind(i);i.push=t,i=i.slice();for(var s=0;s<i.length;s++)t(i[s]);var u=l;return c.push([552,2,1,0]),r()}({0:function(e,t){!function(){e.exports=this.wp.element}()},1:function(e,t){!function(){e.exports=this.wp.i18n}()},114:function(e,t,r){},13:function(e,t){!function(){e.exports=this.React}()},14:function(e,t){!function(){e.exports=this.moment}()},17:function(e,t){!function(){e.exports=this.wp.apiFetch}()},18:function(e,t){!function(){e.exports=this.wp.editor}()},19:function(e,t){!function(){e.exports=this.wp.url}()},2:function(e,t){!function(){e.exports=this.wp.components}()},21:function(e,t){!function(){e.exports=this.wp.compose}()},23:function(e,t){!function(){e.exports=this.wp.blocks}()},24:function(e,t,r){"use strict";var n=r(0),o=r(2),c=function(e){var t=e.className,r=e.fillColor;return Object(n.createElement)(o.Icon,{className:t,icon:Object(n.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 22.41"},Object(n.createElement)("g",null,Object(n.createElement)("g",null,Object(n.createElement)("path",{fill:r,d:"M16.55 0H1.75C.56 0 0 .52 0 1.68v9.24c0 1.15.56 1.92 1.75 1.92H2V4.76a2.51 2.51 0 0 1 2.74-2.68H18v-.4A1.51 1.51 0 0 0 16.55 0z"}),Object(n.createElement)("path",{fill:r,d:"M19.54 3.11H4.74C3.55 3.11 3 3.64 3 4.79V14c0 1.19.55 2 1.74 2H5V7.88A2.51 2.51 0 0 1 7.73 5.2H21v-.41a1.51 1.51 0 0 0-1.46-1.68z"}),Object(n.createElement)("path",{fill:r,d:"M22.53 6.23H7.73C6.54 6.23 6 6.75 6 7.91v9.24c0 1.15.56 1.92 1.75 1.92h7a.59.59 0 0 1 .32.11l1.61 1.15 2.83 2a.31.31 0 0 0 .18.05.3.3 0 0 0 .31-.3v-2.73a.3.3 0 0 1 .28-.28h2.31A1.47 1.47 0 0 0 24 17.6V7.91a1.52 1.52 0 0 0-1.47-1.68z"}),Object(n.createElement)("path",{fill:"#ffffff",d:"M10.2 10.92l1.06-2.14 1.05 2.14 2.37.35-1.71 1.66.4 2.36-2.11-1.11-.17.09-.52.27-.51.26-.92.49.18-1.02.09-.57.1-.56.03-.21-1.71-1.66 2.37-.35zM21.46 14.25h-4.4a.69.69 0 0 1-.69-.69.68.68 0 0 1 .69-.68h4.4a.68.68 0 0 1 .69.68.69.69 0 0 1-.69.69zM21.46 11.19h-4.4a.69.69 0 1 1 0-1.37h4.4a.69.69 0 1 1 0 1.37z"}))))})},a=function(){return Object(n.createElement)(o.Icon,{icon:Object(n.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(n.createElement)("path",{fillRule:"nonzero",d:"M21.913 7.0946H2.0254c-1.1708 0-2.0984.9908-2.0205 2.16l.741 11.0724c.0714 1.0638.9552 1.8892 2.0206 1.8892h18.4054c1.0654 0 1.9492-.8254 2.0205-1.8892l.7411-11.0724c.0779-1.1692-.8497-2.16-2.0205-2.16zm-8.8006-4.6573h5.987c1.119 0 2.0255.9065 2.0255 2.0254v.934H2.8103V2.0255C2.8103.9064 3.7168 0 4.8357 0h6.2513c1.119 0 2.0254.9065 2.0254 2.0254v.4119zm-7.0589 11.619a.926.926 0 1 1 0-1.852h11.8297a.926.926 0 1 1 0 1.852H6.0535z"}))})},i=function(){return Object(n.createElement)(o.Icon,{icon:Object(n.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(n.createElement)("path",{d:"M22 7.5H2c-1.2 0-2.1 1-2 2.2l.7 11.1c.1 1.1 1 1.9 2 1.9h18.5c1.1 0 2-.8 2-1.9L24 9.6c.1-1.1-.9-2.1-2-2.1zM13.1 2.8v-.4c0-1.1-.9-2-2-2H4.8c-1.1 0-2 .9-2 2v3.4h18.4v-1c0-1.1-.9-2-2-2h-6.1z"}),Object(n.createElement)("path",{fill:"#fff",d:"M14.4 18.7L12 17.4l-2.4 1.3.5-2.6-1.9-1.9 2.6-.4 1.2-2.4 1.2 2.4 2.6.4-1.9 1.9z"}))})},l=function(){return Object(n.createElement)(o.Icon,{className:"material-icon",icon:Object(n.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(n.createElement)("path",{d:"M0 0h24v24H0z",fill:"none"}),Object(n.createElement)("path",{d:"M23 12l-2.44-2.78.34-3.68-3.61-.82-1.89-3.18L12 3 8.6 1.54 6.71 4.72l-3.61.81.34 3.68L1 12l2.44 2.78-.34 3.69 3.61.82 1.89 3.18L12 21l3.4 1.46 1.89-3.18 3.61-.82-.34-3.68L23 12zm-10 5h-2v-2h2v2zm0-4h-2V7h2v6z"}))})},s=function(){return Object(n.createElement)(o.Icon,{icon:Object(n.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(n.createElement)("path",{fill:"#1E8CBE",d:"M12 7c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5zm0-5C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"}))})},u=function(){return Object(n.createElement)(o.Icon,{icon:Object(n.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(n.createElement)("path",{fill:"#6C7781",d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"}))})},b=function(e){var t=e.className,r=e.fillColor;return Object(n.createElement)(o.Icon,{className:t,icon:Object(n.createElement)("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},Object(n.createElement)("path",{fill:r,d:"M2.3,17.3h9.3c0.1,0,0.3,0,0.4,0.1l5.9,4.2c0.3,0.2,0.7,0,0.7-0.3v-3.7c0-0.2,0.2-0.4,0.4-0.4H22 c1.1,0,2-0.9,2-2V2.5c0-1.2-0.7-2.2-2-2.2H2.3C0.7,0.2,0,0.9,0,2.5v12.3C0,16.3,0.7,17.3,2.3,17.3z"}),Object(n.createElement)("polygon",{fill:"#ffffff",points:"8.8,12.1 6.5,10.9 4.1,12.1 4.5,9.5 2.6,7.6 5.3,7.2 6.5,4.8 7.6,7.2 10.3,7.6 8.4,9.5"}),Object(n.createElement)("path",{fill:"#ffffff",d:"M20.7,7.9h-7c-0.5,0-0.9-0.4-0.9-0.9S13.2,6,13.7,6h7c0.5,0,0.9,0.4,0.9,0.9S21.2,7.9,20.7,7.9z"}),Object(n.createElement)("path",{fill:"#ffffff",d:"M20.7,11.5h-7c-0.5,0-0.9-0.4-0.9-0.9s0.4-0.9,0.9-0.9h7c0.5,0,0.9,0.4,0.9,0.9S21.2,11.5,20.7,11.5z"}))})},d=function(e){var t=e.className,r=e.fillColor;return Object(n.createElement)(o.Icon,{className:t,icon:Object(n.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 23"},Object(n.createElement)("path",{fill:r,d:"M21.9943 7.0957H2.00638C0.807102 7.0957 -0.0923543 8.0951 0.0075853 9.29437L0.707162 20.3877C0.807102 21.487 1.70656 22.2865 2.70595 22.2865H21.1948C22.2941 22.2865 23.1936 21.487 23.1936 20.3877L23.9931 9.29437C24.093 8.0951 23.0936 7.0957 21.9943 7.0957Z"}),Object(n.createElement)("path",{fill:r,d:"M13.0921 2.39855V1.99879C13.0921 0.899456 12.1926 0 11.0933 0H4.7971C3.69777 0 2.79831 0.899456 2.79831 1.99879V5.39674H21.1872V4.49728C21.1872 3.39795 20.2877 2.49849 19.1884 2.49849H13.0921V2.39855Z"}),Object(n.createElement)("path",{fill:"white",d:"M8.63115 17.126L6.5415 15.9449L4.361 17.126L4.72442 14.6729L2.99819 13.0376L5.45125 12.6742L6.5415 10.4937L7.5409 12.6742L9.99396 13.0376L8.26773 14.6729L8.63115 17.126Z"}),Object(n.createElement)("path",{fill:"white",d:"M19.1907 13.5918H12.9899C12.547 13.5918 12.1926 13.1921 12.1926 12.6924C12.1926 12.1927 12.547 11.7929 12.9899 11.7929H19.1907C19.6336 11.7929 19.9879 12.1927 19.9879 12.6924C19.9879 13.1921 19.6336 13.5918 19.1907 13.5918Z"}),Object(n.createElement)("path",{fill:"white",d:"M19.1907 17.1897H12.9899C12.547 17.1897 12.1926 16.7899 12.1926 16.2902C12.1926 15.7905 12.547 15.3907 12.9899 15.3907H19.1907C19.6336 15.3907 19.9879 15.7905 19.9879 16.2902C19.9879 16.7899 19.6336 17.1897 19.1907 17.1897Z"}))})},p=function(){return Object(n.createElement)(o.Icon,{className:"material-icon",icon:Object(n.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(n.createElement)("path",{d:"M13 13v8h8v-8h-8zM3 21h8v-8H3v8zM3 3v8h8V3H3zm13.66-1.31L11 7.34 16.66 13l5.66-5.66-5.66-5.65z"}),Object(n.createElement)("path",{d:"M0 0h24v24H0z",fill:"none"}))})},w=r(6),m=r.n(w),h=(r(7),function(e){var t=e.size,r=void 0===t?20:t,c=e.className;return Object(n.createElement)(o.Icon,{className:m()("woo-icon",c),icon:Object(n.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",height:r,width:Math.floor(1.67*r),viewBox:"0 0 245 145"},Object(n.createElement)("path",{fill:"#96588A",d:"M22.76 0h199.1a22.77 22.77 0 0 1 22.8 22.76v75.92a22.77 22.77 0 0 1-22.78 22.78h-71.41l9.77 24-43.13-24H22.76C10.1946 121.449.011 111.2654 0 98.7V22.76C.011 10.1946 10.1946.011 22.76 0z"}),Object(n.createElement)("path",{fill:"#FFF",fillRule:"nonzero",d:"M12.32 20.63a8.16 8.16 0 0 1 6.25-3.09c5.0733-.36 7.9867 2.0333 8.74 7.18 3.14 20.86 6.4933 38.5633 10.06 53.11l21.92-41.69c2-3.76 4.49-5.76 7.52-6 4.3867-.3067 7.13 2.49 8.23 8.39a186 186 0 0 0 9.47 34.23c2.62-25.38 7.0133-43.7133 13.18-55a7.73 7.73 0 0 1 6.6-4.43 8.8 8.8 0 0 1 6.32 2 7.75 7.75 0 0 1 3.05 5.74 8.52 8.52 0 0 1-1 4.77c-3.9 7.24-7.12 19.28-9.66 36.12-2.48 16.2533-3.3967 28.9633-2.75 38.13a12.25 12.25 0 0 1-1.16 6.56 6.32 6.32 0 0 1-5.33 3.53c-2.6667.18-5.3033-1.0567-7.91-3.71-9.2933-9.54-16.6567-23.7267-22.09-42.56C57.3 76.7167 52.48 86.3333 49.3 92.76c-5.86 11.3333-10.89 17.13-15.09 17.39-2.7333.1933-5.0667-2.0933-7-6.86-5.1-13.0933-10.5833-38.4033-16.45-75.93a8.56 8.56 0 0 1 1.56-6.73zM227.23 36.34a23.17 23.17 0 0 0-16-11.59 26.25 26.25 0 0 0-5.42-.58c-9.5867 0-17.41 5-23.47 15a53 53 0 0 0-7.78 28.16c0 7.7333 1.6167 14.3333 4.85 19.8a23.15 23.15 0 0 0 16 11.59 26.28 26.28 0 0 0 5.42.59c9.68 0 17.5033-5 23.47-15A53.89 53.89 0 0 0 232.08 56c0-7.7333-1.6167-14.2867-4.85-19.66zm-12.61 27.72c-1.3733 6.56-3.9167 11.5-7.63 14.82-2.9267 2.6667-5.6133 3.7433-8.06 3.23-2.4467-.5133-4.4033-2.6667-5.87-6.46a25.68 25.68 0 0 1-1.76-9.09 35.9 35.9 0 0 1 .73-7.34 33 33 0 0 1 5.28-11.88c3.3333-4.8933 6.8067-6.9467 10.42-6.16 2.44.4867 4.3933 2.64 5.86 6.46a25.68 25.68 0 0 1 1.76 9.12 35.73 35.73 0 0 1-.73 7.33v-.03zM164.57 36.34a23.2 23.2 0 0 0-16-11.59 26.42 26.42 0 0 0-5.43-.58c-9.5933 0-17.4167 5-23.47 15a53 53 0 0 0-7.78 28.16c0 7.7333 1.6133 14.3333 4.84 19.8a23.19 23.19 0 0 0 16 11.59 26.44 26.44 0 0 0 5.43.59c9.68 0 17.5033-5 23.47-15A53.88 53.88 0 0 0 169.4 56c0-7.7333-1.6133-14.2867-4.84-19.66h.01zm-12.61 27.72c-1.3667 6.56-3.91 11.5-7.63 14.82-2.93 2.64-5.63 3.72-8.07 3.23-2.44-.49-4.4-2.64-5.86-6.46a25.7 25.7 0 0 1-1.77-9.09 35.9 35.9 0 0 1 .74-7.34 33 33 0 0 1 5.28-11.88c3.3333-4.8933 6.8067-6.9467 10.42-6.16 2.44.4867 4.3933 2.64 5.86 6.46a25.91 25.91 0 0 1 1.76 9.12 35.73 35.73 0 0 1-.73 7.33v-.03z"}))})});r.d(t,"a",function(){return c}),r.d(t,"b",function(){return a}),r.d(t,"c",function(){return i}),r.d(t,"d",function(){return l}),r.d(t,"e",function(){return s}),r.d(t,"f",function(){return u}),r.d(t,"h",function(){return b}),r.d(t,"g",function(){return d}),r.d(t,"i",function(){return p}),r.d(t,"j",function(){return h})},33:function(e,t){!function(){e.exports=this.wp.keycodes}()},39:function(e,t){!function(){e.exports=this.wp.escapeHtml}()},4:function(e,t){!function(){e.exports=this.lodash}()},40:function(e,t,r){"use strict";r.d(t,"b",function(){return l}),r.d(t,"c",function(){return s}),r.d(t,"a",function(){return u});var n=r(17),o=r.n(n),c=r(6),a=r.n(c),i=r(5),l=function(e){if(i.ENABLE_REVIEW_RATING){if("lowest-rating"===e)return{order:"asc",orderby:"rating"};if("highest-rating"===e)return{order:"desc",orderby:"rating"}}return{order:"desc",orderby:"date_gmt"}},s=function(e){return o()({path:"/wc/blocks/products/reviews?"+Object.entries(e).map(function(e){return e.join("=")}).join("&"),parse:!1}).then(function(e){return e.json().then(function(t){return{reviews:t,totalReviews:parseInt(e.headers.get("x-wp-total"),10)}})})},u=function(e,t){var r=t.className,n=t.showReviewDate,o=t.showReviewerName,c=t.showReviewContent,i=t.showProductName,l=t.showReviewImage,s=t.showReviewRating;return a()(e,r,{"has-image":l,"has-name":o,"has-date":n,"has-rating":s,"has-content":c,"has-product-name":i})}},41:function(e,t,r){"use strict";var n=r(16),o=r.n(n),c=r(8),a=r.n(c),i=r(9),l=r.n(i),s=r(10),u=r.n(s),b=r(11),d=r.n(b),p=r(15),w=r.n(p),m=r(12),h=r.n(m),g=r(0),v=r(1),f=r(19),O=r(17),j=r.n(O),y=r(4),_=(r(7),r(26)),E=r(2),k=r(5),R=(r(86),function(e){function t(){var e;return a()(this,t),(e=u()(this,d()(t).apply(this,arguments))).state={list:[],loading:!0},e.renderItem=e.renderItem.bind(w()(e)),e}return h()(t,e),l()(t,[{key:"componentDidMount",value:function(){var e=this;j()({path:Object(f.addQueryArgs)("".concat(k.ENDPOINTS.products,"/categories"),{per_page:-1})}).then(function(t){e.setState({list:t,loading:!1})}).catch(function(){e.setState({list:[],loading:!1})})}},{key:"renderItem",value:function(e){var t=e.item,r=e.search,n=e.depth,c=void 0===n?0:n,a=["woocommerce-product-categories__item"];r.length&&a.push("is-searching"),0===c&&0!==t.parent&&a.push("is-skip-level");var i=t.breadcrumbs.length?"".concat(t.breadcrumbs.join(", "),", ").concat(t.name):t.name;return Object(g.createElement)(_.b,o()({className:a.join(" ")},e,{showCount:!0,"aria-label":Object(v.sprintf)(Object(v._n)("%s, has %d product","%s, has %d products",t.count,'woocommerce'),i,t.count)}))}},{key:"render",value:function(){var e=this.state,t=e.list,r=e.loading,n=this.props,o=n.onChange,c=n.onOperatorChange,a=n.operator,i=n.selected,l=n.isSingle,s={clear:Object(v.__)("Clear all product categories",'woocommerce'),list:Object(v.__)("Product Categories",'woocommerce'),noItems:Object(v.__)("Your store doesn't have any product categories.",'woocommerce'),search:Object(v.__)("Search for product categories",'woocommerce'),selected:function(e){return Object(v.sprintf)(Object(v._n)("%d category selected","%d categories selected",e,'woocommerce'),e)},updated:Object(v.__)("Category search results updated.",'woocommerce')};return Object(g.createElement)(g.Fragment,null,Object(g.createElement)(_.a,{className:"woocommerce-product-categories",list:t,isLoading:r,selected:i.map(function(e){return Object(y.find)(t,{id:e})}).filter(Boolean),onChange:o,renderItem:this.renderItem,messages:s,isHierarchical:!0,isSingle:l}),!!c&&Object(g.createElement)("div",{className:i.length<2?"screen-reader-text":""},Object(g.createElement)(E.SelectControl,{className:"woocommerce-product-categories__operator",label:Object(v.__)("Display products matching",'woocommerce'),help:Object(v.__)("Pick at least two categories to use this setting.",'woocommerce'),value:a,onChange:c,options:[{label:Object(v.__)("Any selected categories",'woocommerce'),value:"any"},{label:Object(v.__)("All selected categories",'woocommerce'),value:"all"}]})))}}]),t}(g.Component));R.defaultProps={operator:"any",isSingle:!1},t.a=R},44:function(e,t){!function(){e.exports=this.ReactDOM}()},47:function(e,t){!function(){e.exports=this.wp.viewport}()},5:function(e,t){!function(){e.exports=this.wc["wc-block-settings"]}()},51:function(e,t){!function(){e.exports=this.wp.hooks}()},52:function(e,t,r){"use strict";var n=r(0),o=r(1),c=(r(7),r(29)),a=r.n(c),i=r(6),l=r.n(i),s=r(39),u=r(2);t.a=function(e){var t,r,c=e.className,i=e.error,b=e.isLoading,d=e.onRetry;return Object(n.createElement)(u.Placeholder,{icon:Object(n.createElement)(a.a,{icon:"notice"}),label:Object(o.__)("Sorry, an error occurred",'woocommerce'),className:l()("wc-block-api-error",c)},Object(n.createElement)("div",{className:"wc-block-error__message"},(r=(t=i).apiMessage,t.message||(r?Object(n.createElement)("span",null,Object(o.__)("The following error was returned from the API",'woocommerce'),Object(n.createElement)("br",null),Object(n.createElement)("code",null,Object(s.escapeHTML)(r))):Object(o.__)("An unknown error occurred which prevented the block from being updated.",'woocommerce')))),d&&Object(n.createElement)(n.Fragment,null,b?Object(n.createElement)(u.Spinner,null):Object(n.createElement)(u.Button,{isDefault:!0,onClick:d},Object(o.__)("Retry",'woocommerce'))))}},53:function(e,t){!function(){e.exports=this.wp.htmlEntities}()},54:function(e,t){!function(){e.exports=this.wp.date}()},552:function(e,t,r){"use strict";r.r(t);var n=r(20),o=r.n(n),c=r(0),a=r(1),i=r(23),l=(r(77),r(16)),s=r.n(l),u=r(18),b=r(2),d=r(26),p=(r(7),r(41)),w=r(24),m=r(81),h=function(){return Object(c.createElement)(b.Placeholder,{className:"wc-block-reviews-by-category",icon:Object(c.createElement)(w.g,{className:"block-editor-block-icon"}),label:Object(a.__)("Reviews by Category",'woocommerce')},Object(a.__)("This block lists reviews for products from selected categories. The selected categories do not have any reviews yet, but they will show up here when they do.",'woocommerce'))},g=r(63),v=Object(b.withSpokenMessages)(function(e){var t=e.attributes,r=e.debouncedSpeak,n=e.setAttributes,o=t.editMode,i=t.categoryIds,l=function(e){var t=e.item,r=e.search,n=e.depth,o=void 0===n?0:n,i=["woocommerce-product-categories__item"];r.length&&i.push("is-searching"),0===o&&0!==t.parent&&i.push("is-skip-level");var l=t.breadcrumbs.length?"".concat(t.breadcrumbs.join(", "),", ").concat(t.name):t.name;return Object(c.createElement)(d.b,s()({className:i.join(" ")},e,{showCount:!0,"aria-label":Object(a.sprintf)(Object(a._n)("%s, has %d product","%s, has %d products",t.count,'woocommerce'),l,t.count)}))};return!i||o?Object(c.createElement)(b.Placeholder,{icon:Object(c.createElement)(w.g,{className:"block-editor-block-icon"}),label:Object(a.__)("Reviews by Category",'woocommerce')},Object(a.__)("Show product reviews from specific categories.",'woocommerce'),Object(c.createElement)("div",{className:"wc-block-reviews__selection"},Object(c.createElement)(p.a,{selected:t.categoryIds,onChange:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=e.map(function(e){return e.id});n({categoryIds:t})}}),Object(c.createElement)(b.Button,{isDefault:!0,onClick:function(){n({editMode:!1}),r(Object(a.__)("Showing Reviews by Category block preview.",'woocommerce'))}},Object(a.__)("Done",'woocommerce')))):Object(c.createElement)(c.Fragment,null,Object(g.a)(o,n),Object(c.createElement)(u.InspectorControls,{key:"inspector"},Object(c.createElement)(b.PanelBody,{title:Object(a.__)("Category",'woocommerce'),initialOpen:!1},Object(c.createElement)(p.a,{selected:t.categoryIds,onChange:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=e.map(function(e){return e.id});n({categoryIds:t})},renderItem:l})),Object(c.createElement)(b.PanelBody,{title:Object(a.__)("Content",'woocommerce')},Object(c.createElement)(b.ToggleControl,{label:Object(a.__)("Product name",'woocommerce'),checked:t.showProductName,onChange:function(){return n({showProductName:!t.showProductName})}}),Object(g.b)(t,n)),Object(c.createElement)(b.PanelBody,{title:Object(a.__)("List Settings",'woocommerce')},Object(g.c)(t,n))),Object(c.createElement)(m.a,{attributes:t,className:"wc-block-reviews-by-category",icon:Object(c.createElement)(w.g,{className:"block-editor-block-icon"}),name:Object(a.__)("Reviews by Category",'woocommerce'),noReviewsPlaceholder:h}))}),f=r(79),O=r(80);function j(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}Object(i.registerBlockType)("woocommerce/reviews-by-category",{title:Object(a.__)("Reviews by Category",'woocommerce'),icon:Object(c.createElement)(w.g,{fillColor:"#96588a"}),category:"woocommerce",keywords:[Object(a.__)("WooCommerce",'woocommerce')],description:Object(a.__)("Show product reviews from specific categories.",'woocommerce'),attributes:function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?j(r,!0).forEach(function(t){o()(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):j(r).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}({},f.a,{categoryIds:{type:"array",default:[]},showProductName:{type:"boolean",default:!0}}),edit:function(e){return Object(c.createElement)(v,e)},save:O.a})},61:function(e,t){!function(){e.exports=this.wp.dom}()},63:function(e,t,r){"use strict";r.d(t,"a",function(){return b}),r.d(t,"b",function(){return d}),r.d(t,"c",function(){return p});var n=r(0),o=r(1),c=r(39),a=r(2),i=r(18),l=r(74),s=r(5),u=r(70),b=function(e,t){return Object(n.createElement)(i.BlockControls,null,Object(n.createElement)(a.Toolbar,{controls:[{icon:"edit",title:Object(o.__)("Edit",'woocommerce'),onClick:function(){return t({editMode:!e})},isActive:e}]}))},d=function(e,t){return Object(n.createElement)(n.Fragment,null,Object(n.createElement)(a.ToggleControl,{label:Object(o.__)("Product rating",'woocommerce'),checked:e.showReviewRating,onChange:function(){return t({showReviewRating:!e.showReviewRating})}}),e.showReviewRating&&!s.ENABLE_REVIEW_RATING&&Object(n.createElement)(a.Notice,{className:"wc-block-reviews__notice",isDismissible:!1},Object(n.createElement)(n.RawHTML,null,Object(o.sprintf)(Object(c.escapeHTML)(Object(o.__)("Product rating is disabled in your %sstore settings%s.",'woocommerce')),'<a href="'.concat(Object(l.a)("admin.php?page=wc-settings&tab=products"),'" target="_blank">'),"</a>"))),Object(n.createElement)(a.ToggleControl,{label:Object(o.__)("Reviewer name",'woocommerce'),checked:e.showReviewerName,onChange:function(){return t({showReviewerName:!e.showReviewerName})}}),Object(n.createElement)(a.ToggleControl,{label:Object(o.__)("Image",'woocommerce'),checked:e.showReviewImage,onChange:function(){return t({showReviewImage:!e.showReviewImage})}}),Object(n.createElement)(a.ToggleControl,{label:Object(o.__)("Review date",'woocommerce'),checked:e.showReviewDate,onChange:function(){return t({showReviewDate:!e.showReviewDate})}}),Object(n.createElement)(a.ToggleControl,{label:Object(o.__)("Review content",'woocommerce'),checked:e.showReviewContent,onChange:function(){return t({showReviewContent:!e.showReviewContent})}}),e.showReviewImage&&Object(n.createElement)(n.Fragment,null,Object(n.createElement)(u.a,{label:Object(o.__)("Review image",'woocommerce'),value:e.imageType,options:[{label:Object(o.__)("Reviewer photo",'woocommerce'),value:"reviewer"},{label:Object(o.__)("Product",'woocommerce'),value:"product"}],onChange:function(e){return t({imageType:e})}}),"reviewer"===e.imageType&&!s.SHOW_AVATARS&&Object(n.createElement)(a.Notice,{className:"wc-block-reviews__notice",isDismissible:!1},Object(n.createElement)(n.RawHTML,null,Object(o.sprintf)(Object(c.escapeHTML)(Object(o.__)("Reviewer photo is disabled in your %ssite settings%s.",'woocommerce')),'<a href="'.concat(Object(l.a)("options-discussion.php"),'" target="_blank">'),"</a>")))))},p=function(e,t){return Object(n.createElement)(n.Fragment,null,Object(n.createElement)(a.ToggleControl,{label:Object(o.__)("Order by",'woocommerce'),checked:e.showOrderby,onChange:function(){return t({showOrderby:!e.showOrderby})}}),Object(n.createElement)(a.SelectControl,{label:Object(o.__)("Order Product Reviews by",'woocommerce'),value:e.orderby,options:[{label:"Most recent",value:"most-recent"},{label:"Highest Rating",value:"highest-rating"},{label:"Lowest Rating",value:"lowest-rating"}],onChange:function(e){return t({orderby:e})}}),Object(n.createElement)(a.RangeControl,{label:Object(o.__)("Starting Number of Reviews",'woocommerce'),value:e.reviewsOnPageLoad,onChange:function(e){return t({reviewsOnPageLoad:e})},max:20,min:1}),Object(n.createElement)(a.ToggleControl,{label:Object(o.__)("Load more",'woocommerce'),checked:e.showLoadMore,onChange:function(){return t({showLoadMore:!e.showLoadMore})}}),e.showLoadMore&&Object(n.createElement)(a.RangeControl,{label:Object(o.__)("Load More Reviews",'woocommerce'),value:e.reviewsOnLoadMore,onChange:function(e){return t({reviewsOnLoadMore:e})},max:20,min:1}))}},64:function(e,t){},65:function(e,t){},67:function(e,t){},68:function(e,t){},69:function(e,t,r){"use strict";var n=r(16),o=r.n(n),c=r(8),a=r.n(c),i=r(9),l=r.n(i),s=r(10),u=r.n(s),b=r(11),d=r.n(b),p=r(12),w=r.n(p),m=r(0),h=r(13),g=[];t.a=function(e){return function(t){function r(){return a()(this,r),u()(this,d()(r).apply(this,arguments))}return w()(r,t),l()(r,[{key:"generateUniqueID",value:function(){var e=r.name;return g[e]||(g[e]=0),g[e]++,g[e]}},{key:"render",value:function(){var t=this.generateUniqueID();return Object(m.createElement)(e,o()({},this.props,{componentId:t}))}}]),r}(h.Component)}},70:function(e,t,r){"use strict";var n=r(16),o=r.n(n),c=r(8),a=r.n(c),i=r(9),l=r.n(i),s=r(10),u=r.n(s),b=r(11),d=r.n(b),p=r(15),w=r.n(p),m=r(12),h=r.n(m),g=r(0),v=r(4),f=r(6),O=r.n(f),j=r(2),y=r(21),_=(r(132),function(e){function t(){var e;return a()(this,t),(e=u()(this,d()(t).apply(this,arguments))).onClick=e.onClick.bind(w()(e)),e}return h()(t,e),l()(t,[{key:"onClick",value:function(e){this.props.onChange&&this.props.onChange(e.target.value)}},{key:"render",value:function(){var e,t=this,r=this.props,n=r.label,c=r.checked,a=r.instanceId,i=r.className,l=r.help,s=r.options,u=r.value,b="inspector-toggle-button-control-".concat(a);return l&&(e=Object(v.isFunction)(l)?l(c):l),Object(g.createElement)(j.BaseControl,{id:b,help:e,className:O()("components-toggle-button-control",i)},Object(g.createElement)("label",{id:b+"__label",htmlFor:b,className:"components-toggle-button-control__label"},n),Object(g.createElement)(j.ButtonGroup,{"aria-labelledby":b+"__label"},s.map(function(e,r){var c={};return u===e.value?(c.isPrimary=!0,c["aria-pressed"]=!0):(c.isDefault=!0,c["aria-pressed"]=!1),Object(g.createElement)(j.Button,o()({key:"".concat(e.label,"-").concat(e.value,"-").concat(r),value:e.value,onClick:t.onClick,"aria-label":n+": "+e.label},c),e.label)})))}}]),t}(g.Component));t.a=Object(y.withInstanceId)(_)},77:function(e,t,r){var n=r(114);"string"==typeof n&&(n=[[e.i,n,""]]);var o={insert:"head",singleton:!1};r(35)(n,o);n.locals&&(e.exports=n.locals)},78:function(e,t){!function(){e.exports=this.wp.isShallowEqual}()},79:function(e,t,r){"use strict";t.a={editMode:{type:"boolean",default:!0},imageType:{type:"string",default:"reviewer"},orderby:{type:"string",default:"most-recent"},reviewsOnLoadMore:{type:"number",default:10},reviewsOnPageLoad:{type:"number",default:10},showLoadMore:{type:"boolean",default:!0},showOrderby:{type:"boolean",default:!0},showReviewDate:{type:"boolean",default:!0},showReviewerName:{type:"boolean",default:!0},showReviewImage:{type:"boolean",default:!0},showReviewRating:{type:"boolean",default:!0},showReviewContent:{type:"boolean",default:!0}}},80:function(e,t,r){"use strict";var n=r(16),o=r.n(n),c=r(0),a=(r(77),r(40));t.a=function(e){var t=e.attributes,r=t.categoryIds,n=t.imageType,i=t.orderby,l=t.productId,s={"data-image-type":n,"data-orderby":i,"data-reviews-on-page-load":t.reviewsOnPageLoad,"data-reviews-on-load-more":t.reviewsOnLoadMore,"data-show-load-more":t.showLoadMore,"data-show-orderby":t.showOrderby},u="wc-block-all-reviews";return l&&(s["data-product-id"]=l,u="wc-block-reviews-by-product"),Array.isArray(r)&&(s["data-category-ids"]=r.join(","),u="wc-block-reviews-by-category"),Object(c.createElement)("div",o()({className:Object(a.a)(u,t)},s))}},81:function(e,t,r){"use strict";var n=r(8),o=r.n(n),c=r(9),a=r.n(c),i=r(10),l=r.n(i),s=r(11),u=r.n(s),b=r(12),d=r.n(b),p=r(0),w=r(1),m=r(13),h=(r(7),r(4)),g=r(2),v=r(5),f=r(52),O=r(20),j=r.n(O),y=r(6),_=r.n(y);function E(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}var k=function(e){var t,r=e.label,n=e.screenReaderLabel,o=e.wrapperElement,c=e.wrapperProps;return!r&&n?(t=o||"span",c=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?E(r,!0).forEach(function(t){j()(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):E(r).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}({},c,{className:_()(c.className,"screen-reader-text")}),Object(p.createElement)(t,c,n)):(t=o||m.Fragment,r&&n&&r!==n?Object(p.createElement)(t,c,Object(p.createElement)("span",{"aria-hidden":!0},r),Object(p.createElement)("span",{className:"screen-reader-text"},n)):Object(p.createElement)(t,c,r))};k.defaultProps={wrapperProps:{}};var R=k,C=(r(170),function(e){var t=e.onClick,r=e.label,n=e.screenReaderLabel;return Object(p.createElement)("div",{className:"wp-block-button wc-block-load-more"},Object(p.createElement)("button",{className:"wp-block-button__link",onClick:t},Object(p.createElement)(R,{label:r,screenReaderLabel:n})))});C.defaultProps={label:Object(w.__)("Load more",'woocommerce')};var N=C,L=r(15),P=r.n(L),M=r(100),x=r.n(M),I=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"...",n=x()(e,{suffix:r,limit:t});return n.html},T=function(e,t,r,n){var o=S(e,t,r);return I(e,o-n.length,n)},S=function(e,t,r){for(var n={start:0,middle:0,end:e.length};n.start<=n.end;)n.middle=Math.floor((n.start+n.end)/2),t.innerHTML=I(e,n.middle),n=H(n,t.clientHeight,r);return n.middle},H=function(e,t,r){return t<=r?e.start=e.middle+1:e.end=e.middle-1,e},D=function(e){function t(e){var r;return o()(this,t),(r=l()(this,u()(t).apply(this,arguments))).state={isExpanded:!1,clampEnabled:null,content:e.children,summary:"."},r.reviewSummary=Object(m.createRef)(),r.reviewContent=Object(m.createRef)(),r.getButton=r.getButton.bind(P()(r)),r.onClick=r.onClick.bind(P()(r)),r}return d()(t,e),a()(t,[{key:"componentDidMount",value:function(){if(this.props.children){var e=this.props,t=e.maxLines,r=e.ellipsis,n=(this.reviewSummary.current.clientHeight+1)*t+1,o=this.reviewContent.current.clientHeight+1>n;this.setState({clampEnabled:o}),o&&this.setState({summary:T(this.reviewContent.current.innerHTML,this.reviewSummary.current,n,r)})}}},{key:"getButton",value:function(){var e=this.state.isExpanded,t=this.props,r=t.className,n=t.lessText,o=t.moreText,c=e?n:o;if(c)return Object(p.createElement)("a",{href:"#more",className:r+"__read_more",onClick:this.onClick,"aria-expanded":!e,role:"button"},c)}},{key:"onClick",value:function(e){e.preventDefault();var t=this.state.isExpanded;this.setState({isExpanded:!t})}},{key:"render",value:function(){var e=this.props.className,t=this.state,r=t.content,n=t.summary,o=t.clampEnabled,c=t.isExpanded;return r?!1===o?Object(p.createElement)("div",{className:e},Object(p.createElement)("div",{ref:this.reviewContent},r)):Object(p.createElement)("div",{className:e},(!c||null===o)&&Object(p.createElement)("div",{ref:this.reviewSummary,"aria-hidden":c,dangerouslySetInnerHTML:{__html:n}}),(c||null===o)&&Object(p.createElement)("div",{ref:this.reviewContent,"aria-hidden":!c},r),this.getButton()):null}}]),t}(m.Component);D.defaultProps={maxLines:3,ellipsis:"&hellip;",moreText:Object(w.__)("Read more",'woocommerce'),lessText:Object(w.__)("Read less",'woocommerce'),className:"read-more-content"};var A=D;r(171);var z=function(e){var t=e.attributes,r=e.review,n=void 0===r?{}:r,o=t.imageType,c=t.showReviewDate,a=t.showReviewerName,i=t.showReviewImage,l=t.showReviewRating,s=t.showReviewContent,u=t.showProductName,b=n.rating,d=!Object.keys(n).length>0,m=Number.isFinite(b)&&l;return Object(p.createElement)("li",{className:_()("wc-block-review-list-item__item",{"is-loading":d}),"aria-hidden":d},(u||c||a||i||m)&&Object(p.createElement)("div",{className:"wc-block-review-list-item__info"},i&&function(e,t,r){return r||!e?Object(p.createElement)("div",{className:"wc-block-review-list-item__image",width:"48",height:"48"}):Object(p.createElement)("div",{className:"wc-block-review-list-item__image"},"product"===t?Object(p.createElement)("img",{"aria-hidden":"true",alt:"",src:e.product_picture||"",className:"wc-block-review-list-item__image",width:"48",height:"48"}):Object(p.createElement)("img",{"aria-hidden":"true",alt:"",src:e.reviewer_avatar_urls[48]||"",srcSet:e.reviewer_avatar_urls[96]+" 2x",className:"wc-block-review-list-item__image",width:"48",height:"48"}),e.verified&&Object(p.createElement)("div",{className:"wc-block-review-list-item__verified",title:Object(w.__)("Verified buyer",'woocommerce')},Object(w.__)("Verified buyer",'woocommerce')))}(n,o,d),(u||a||m||c)&&Object(p.createElement)("div",{className:"wc-block-review-list-item__meta"},m&&function(e){var t=e.rating,r={width:t/5*100+"%"};return Object(p.createElement)("div",{className:"wc-block-review-list-item__rating"},Object(p.createElement)("div",{className:"wc-block-review-list-item__rating__stars",role:"img"},Object(p.createElement)("span",{style:r},Object(w.sprintf)(Object(w.__)("Rated %d out of 5",'woocommerce'),t))))}(n),u&&function(e){return Object(p.createElement)("div",{className:"wc-block-review-list-item__product"},Object(p.createElement)("a",{href:e.product_permalink,dangerouslySetInnerHTML:{__html:e.product_name}}))}(n),a&&function(e){var t=e.reviewer,r=void 0===t?"":t;return Object(p.createElement)("div",{className:"wc-block-review-list-item__author"},r)}(n),c&&function(e){var t=e.date_created,r=e.formatted_date_created;return Object(p.createElement)("time",{className:"wc-block-review-list-item__published-date",dateTime:t},r)}(n))),s&&function(e){return Object(p.createElement)(A,{maxLines:10,moreText:Object(w.__)("Read full review",'woocommerce'),lessText:Object(w.__)("Hide full review",'woocommerce'),className:"wc-block-review-list-item__text"},Object(p.createElement)("div",{dangerouslySetInnerHTML:{__html:e.review||""}}))}(n))};r(172);function B(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}var V=function(e){var t=e.attributes,r=e.reviews,n=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?B(r,!0).forEach(function(t){j()(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):B(r).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}({},t,{showReviewImage:(v.SHOW_AVATARS||"product"===t.imageType)&&t.showReviewImage,showReviewRating:v.ENABLE_REVIEW_RATING&&t.showReviewRating});return Object(p.createElement)("ul",{className:"wc-block-review-list"},0===r.length?Object(p.createElement)(z,{attributes:n}):r.map(function(e,t){return Object(p.createElement)(z,{key:e.id||t,attributes:n,review:e})}))},F=r(69),W=(r(173),Object(F.a)(function(e){var t=e.className,r=e.componentId,n=e.defaultValue,o=e.label,c=e.onChange,a=e.options,i=e.screenReaderLabel,l=e.readOnly,s=e.value,u="wc-block-order-select__select-".concat(r);return Object(p.createElement)("p",{className:_()("wc-block-order-select",t)},Object(p.createElement)(R,{label:o,screenReaderLabel:i,wrapperElement:"label",wrapperProps:{className:"wc-block-order-select__label",htmlFor:u}}),Object(p.createElement)("select",{id:u,className:"wc-block-order-select__select",defaultValue:n,onChange:c,readOnly:l,value:s},a.map(function(e){return Object(p.createElement)("option",{key:e.key,value:e.key},e.label)})))})),G=(r(174),function(e){var t=e.defaultValue,r=e.onChange,n=e.readOnly,o=e.value;return Object(p.createElement)(W,{className:"wc-block-review-order-select",defaultValue:t,label:Object(w.__)("Order by",'woocommerce'),onChange:r,options:[{key:"most-recent",label:Object(w.__)("Most recent",'woocommerce')},{key:"highest-rating",label:Object(w.__)("Highest rating",'woocommerce')},{key:"lowest-rating",label:Object(w.__)("Lowest rating",'woocommerce')}],readOnly:n,screenReaderLabel:Object(w.__)("Order reviews by",'woocommerce'),value:o})}),Z=r(16),U=r.n(Z),q=r(38),J=r.n(q),Q=r(78),Y=r.n(Q),K=r(40),X=function(e){var t=function(t){function r(){var e;return o()(this,r),(e=l()(this,u()(r).apply(this,arguments))).state={error:null,loading:!0,reviews:[],totalReviews:0},e.setError=e.setError.bind(P()(e)),e.delayedAppendReviews=e.props.delayFunction(e.appendReviews),e}return d()(r,t),a()(r,[{key:"componentDidMount",value:function(){this.replaceReviews()}},{key:"componentDidUpdate",value:function(e){e.reviewsToDisplay<this.props.reviewsToDisplay?this.delayedAppendReviews():this.shouldReplaceReviews(e,this.props)&&this.replaceReviews()}},{key:"shouldReplaceReviews",value:function(e,t){return e.orderby!==t.orderby||e.order!==t.order||e.productId!==t.productId||!Y()(e.categoryIds,t.categoryIds)}},{key:"componentWillUnMount",value:function(){this.delayedAppendReviews.cancel&&this.delayedAppendReviews.cancel()}},{key:"getArgs",value:function(e){var t=this.props,r=t.categoryIds,n=t.order,o=t.orderby,c=t.productId,a={order:n,orderby:o,per_page:t.reviewsToDisplay-e,offset:e};return r&&r.length&&(a.category_id=Array.isArray(r)?r.join(","):r),c&&(a.product_id=c),a}},{key:"replaceReviews",value:function(){var e=this.props.onReviewsReplaced;this.updateListOfReviews().then(e)}},{key:"appendReviews",value:function(){var e=this.props,t=e.onReviewsAppended,r=e.reviewsToDisplay,n=this.state.reviews;r<=n.length||this.updateListOfReviews(n).then(t)}},{key:"updateListOfReviews",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],r=this.props.reviewsToDisplay,n=this.state.totalReviews,o=Math.min(n,r)-t.length;return this.setState({loading:!0,reviews:t.concat(Array(o).fill({}))}),Object(K.c)(this.getArgs(t.length)).then(function(r){var n=r.reviews,o=r.totalReviews;return e.setState({reviews:t.filter(function(e){return Object.keys(e).length}).concat(n),totalReviews:o,loading:!1,error:null}),{newReviews:n}}).catch(this.setError)}},{key:"setError",value:function(e){var t=this;e.json().then(function(e){var r=t.props.onReviewsLoadError,n="object"===J()(e)&&e.hasOwnProperty("message")?{apiMessage:e.message}:{apiMessage:null};t.setState({reviews:[],loading:!1,error:n}),r()})}},{key:"render",value:function(){var t=this.props.reviewsToDisplay,r=this.state,n=r.error,o=r.loading,c=r.reviews,a=r.totalReviews;return Object(p.createElement)(e,U()({},this.props,{error:n,isLoading:o,reviews:c.slice(0,t),totalReviews:a}))}}]),r}(m.Component);t.defaultProps={delayFunction:function(e){return e},onReviewsAppended:function(){},onReviewsLoadError:function(){},onReviewsReplaced:function(){}};var r=e.displayName,n=void 0===r?e.name||"Component":r;return t.displayName="WithReviews( ".concat(n," )"),t}(function(e){function t(){return o()(this,t),l()(this,u()(t).apply(this,arguments))}return d()(t,e),a()(t,[{key:"render",value:function(){var e=this.props,t=e.attributes,r=e.error,n=e.isLoading,o=e.noReviewsPlaceholder,c=e.reviews,a=e.totalReviews;return r?Object(p.createElement)(f.a,{className:"wc-block-featured-product-error",error:r,isLoading:n}):0!==c.length||n?Object(p.createElement)(g.Disabled,null,t.showOrderby&&v.ENABLE_REVIEW_RATING&&Object(p.createElement)(G,{readOnly:!0,value:t.orderby}),Object(p.createElement)(V,{attributes:t,reviews:c}),t.showLoadMore&&a>c.length&&Object(p.createElement)(N,{screenReaderLabel:Object(w.__)("Load more reviews",'woocommerce')})):Object(p.createElement)(o,{attributes:t})}}]),t}(m.Component)),$=function(e){function t(){return o()(this,t),l()(this,u()(t).apply(this,arguments))}return d()(t,e),a()(t,[{key:"renderHiddenContentPlaceholder",value:function(){var e=this.props,t=e.icon,r=e.name;return Object(p.createElement)(g.Placeholder,{icon:t,label:r},Object(w.__)("The content for this block is hidden due to block settings.",'woocommerce'))}},{key:"render",value:function(){var e=this.props,t=e.attributes,r=e.className,n=e.noReviewsPlaceholder,o=t.categoryIds,c=t.productId,a=t.reviewsOnPageLoad,i=t.showProductName,l=t.showReviewDate,s=t.showReviewerName,u=t.showReviewContent,b=t.showReviewImage,d=t.showReviewRating,w=Object(K.b)(t.orderby),m=w.order,g=w.orderby;return!(u||d||l||s||b||i)?this.renderHiddenContentPlaceholder():Object(p.createElement)("div",{className:Object(K.a)(r,t)},Object(p.createElement)(X,{attributes:t,categoryIds:o,delayFunction:function(e){return Object(h.debounce)(e,400)},noReviewsPlaceholder:n,orderby:g,order:m,productId:c,reviewsToDisplay:a}))}}]),t}(m.Component);t.a=$}});