File "products-by-attribute.js"

Full Path: /home/vantageo/public_html/cache/cache/cache/.wp-cli/wp-content/plugins/woocommerce/packages/woocommerce-blocks/build/products-by-attribute.js
File size: 24.27 KB
MIME-type: text/plain
Charset: utf-8

this.wc=this.wc||{},this.wc.blocks=this.wc.blocks||{},this.wc.blocks["products-by-attribute"]=function(t){function e(e){for(var n,u,i=e[0],a=e[1],s=e[2],b=0,p=[];b<i.length;b++)u=i[b],Object.prototype.hasOwnProperty.call(o,u)&&o[u]&&p.push(o[u][0]),o[u]=0;for(n in a)Object.prototype.hasOwnProperty.call(a,n)&&(t[n]=a[n]);for(l&&l(e);p.length;)p.shift()();return c.push.apply(c,s||[]),r()}function r(){for(var t,e=0;e<c.length;e++){for(var r=c[e],n=!0,i=1;i<r.length;i++){var a=r[i];0!==o[a]&&(n=!1)}n&&(c.splice(e--,1),t=u(u.s=r[0]))}return t}var n={},o={35:0},c=[];function u(e){if(n[e])return n[e].exports;var r=n[e]={i:e,l:!1,exports:{}};return t[e].call(r.exports,r,r.exports,u),r.l=!0,r.exports}u.m=t,u.c=n,u.d=function(t,e,r){u.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},u.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},u.t=function(t,e){if(1&e&&(t=u(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(u.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)u.d(r,n,function(e){return t[e]}.bind(null,n));return r},u.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return u.d(e,"a",e),e},u.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},u.p="";var i=window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[],a=i.push.bind(i);i.push=e,i=i.slice();for(var s=0;s<i.length;s++)e(i[s]);var l=a;return c.push([824,0]),r()}({0:function(t,e){!function(){t.exports=this.wp.element}()},1:function(t,e){!function(){t.exports=this.wp.i18n}()},106:function(t,e){},107:function(t,e){},108:function(t,e){},109:function(t,e){},110:function(t,e){},111:function(t,e){},112:function(t,e){},113:function(t,e){},114:function(t,e){},115:function(t,e){},116:function(t,e){},117:function(t,e){},118:function(t,e){},12:function(t,e){!function(){t.exports=this.regeneratorRuntime}()},123:function(t,e,r){"use strict";var n=r(0),o=r(1),c=r(3);r(2);e.a=function(t){var e=t.value,r=t.setAttributes;return Object(n.createElement)(c.SelectControl,{label:Object(o.__)("Order products by",'woocommerce'),value:e,options:[{label:Object(o.__)("Newness - newest first",'woocommerce'),value:"date"},{label:Object(o.__)("Price - low to high",'woocommerce'),value:"price_asc"},{label:Object(o.__)("Price - high to low",'woocommerce'),value:"price_desc"},{label:Object(o.__)("Rating - highest first",'woocommerce'),value:"rating"},{label:Object(o.__)("Sales - most first",'woocommerce'),value:"popularity"},{label:Object(o.__)("Title - alphabetical",'woocommerce'),value:"title"},{label:Object(o.__)("Menu Order",'woocommerce'),value:"menu_order"}],onChange:function(t){return r({orderby:t})}})}},14:function(t,e,r){"use strict";r.d(e,"m",(function(){return c})),r.d(e,"k",(function(){return u})),r.d(e,"l",(function(){return i})),r.d(e,"h",(function(){return s})),r.d(e,"c",(function(){return l})),r.d(e,"d",(function(){return b})),r.d(e,"g",(function(){return p})),r.d(e,"f",(function(){return d})),r.d(e,"j",(function(){return f})),r.d(e,"i",(function(){return g})),r.d(e,"a",(function(){return O})),r.d(e,"b",(function(){return m})),r.d(e,"e",(function(){return h})),r.d(e,"p",(function(){return w})),r.d(e,"q",(function(){return y})),r.d(e,"n",(function(){return v})),r.d(e,"o",(function(){return _}));var n,o=r(5),c=Object(o.getSetting)("wcBlocksConfig",{buildPhase:1,pluginUrl:"",productCount:0,restApiRoutes:{},wordCountType:"words"}),u=c.pluginUrl+"assets/",i=c.pluginUrl+"build/",a=c.buildPhase,s=null===(n=o.STORE_PAGES.shop)||void 0===n?void 0:n.permalink,l=o.STORE_PAGES.checkout.id,b=o.STORE_PAGES.checkout.permalink,p=o.STORE_PAGES.privacy.permalink,d=o.STORE_PAGES.privacy.title,f=o.STORE_PAGES.terms.permalink,g=o.STORE_PAGES.terms.title,O=o.STORE_PAGES.cart.id,m=o.STORE_PAGES.cart.permalink,h=o.STORE_PAGES.myaccount.permalink?o.STORE_PAGES.myaccount.permalink:Object(o.getSetting)("wpLoginUrl","/wp-login.php"),j=r(25),w=function(t,e){if(a>2)return Object(j.registerBlockType)(t,e)},y=function(t,e){if(a>1)return Object(j.registerBlockType)(t,e)},v=function(){return a>2},_=function(){return a>1}},175:function(t,e,r){"use strict";r.d(e,"a",(function(){return c}));var n=r(0),o=r(14),c=Object(n.createElement)("img",{src:o.k+"img/grid.svg",alt:"Grid Preview",width:"230",height:"250",style:{width:"100%"}})},19:function(t,e){!function(){t.exports=this.wp.apiFetch}()},20:function(t,e){!function(){t.exports=this.wp.url}()},21:function(t,e){!function(){t.exports=this.wp.data}()},22:function(t,e){!function(){t.exports=this.wp.blockEditor}()},25:function(t,e){!function(){t.exports=this.wp.blocks}()},26:function(t,e){!function(){t.exports=this.wp.htmlEntities}()},27:function(t,e){!function(){t.exports=this.moment}()},3:function(t,e){!function(){t.exports=this.wp.components}()},31:function(t,e){!function(){t.exports=this.wp.primitives}()},34:function(t,e){!function(){t.exports=this.wp.dataControls}()},35:function(t,e,r){"use strict";r.d(e,"h",(function(){return d})),r.d(e,"e",(function(){return f})),r.d(e,"b",(function(){return g})),r.d(e,"i",(function(){return O})),r.d(e,"f",(function(){return m})),r.d(e,"c",(function(){return h})),r.d(e,"d",(function(){return j})),r.d(e,"g",(function(){return w})),r.d(e,"a",(function(){return y}));var n=r(4),o=r.n(n),c=r(20),u=r(19),i=r.n(u),a=r(6),s=r(5),l=r(14);function b(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function p(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?b(Object(r),!0).forEach((function(e){o()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):b(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var d=function(t){var e=t.selected,r=void 0===e?[]:e,n=t.search,o=void 0===n?"":n,u=t.queryArgs,s=function(t){var e=t.selected,r=void 0===e?[]:e,n=t.search,o=void 0===n?"":n,u=t.queryArgs,i=void 0===u?[]:u,a=l.m.productCount>100,s={per_page:a?100:0,catalog_visibility:"any",search:o,orderby:"title",order:"asc"},b=[Object(c.addQueryArgs)("/wc/store/products",p(p({},s),i))];return a&&r.length&&b.push(Object(c.addQueryArgs)("/wc/store/products",{catalog_visibility:"any",include:r})),b}({selected:r,search:o,queryArgs:void 0===u?[]:u});return Promise.all(s.map((function(t){return i()({path:t})}))).then((function(t){return Object(a.uniqBy)(Object(a.flatten)(t),"id").map((function(t){return p(p({},t),{},{parent:0})}))})).catch((function(t){throw t}))},f=function(t){return i()({path:"/wc/store/products/".concat(t)})},g=function(){return i()({path:"wc/store/products/attributes"})},O=function(t){return i()({path:"wc/store/products/attributes/".concat(t,"/terms")})},m=function(t){var e=t.selected,r=function(t){var e=t.selected,r=void 0===e?[]:e,n=t.search,o=Object(s.getSetting)("limitTags",!1),u=[Object(c.addQueryArgs)("wc/store/products/tags",{per_page:o?100:0,orderby:o?"count":"name",order:o?"desc":"asc",search:n})];return o&&r.length&&u.push(Object(c.addQueryArgs)("wc/store/products/tags",{include:r})),u}({selected:void 0===e?[]:e,search:t.search});return Promise.all(r.map((function(t){return i()({path:t})}))).then((function(t){return Object(a.uniqBy)(Object(a.flatten)(t),"id")}))},h=function(t){return i()({path:Object(c.addQueryArgs)("wc/store/products/categories",p({per_page:0},t))})},j=function(t){return i()({path:"wc/store/products/categories/".concat(t)})},w=function(t){return i()({path:Object(c.addQueryArgs)("wc/store/products",{per_page:0,type:"variation",parent:t})})},y=function(t,e){if(!t.title.raw)return t.slug;var r=1===e.filter((function(e){return e.title.raw===t.title.raw})).length;return t.title.raw+(r?"":" - ".concat(t.slug))}},37:function(t,e,r){"use strict";r.d(e,"a",(function(){return a})),r.d(e,"b",(function(){return s}));var n=r(28),o=r.n(n),c=r(12),u=r.n(c),i=r(1),a=function(){var t=o()(u.a.mark((function t(e){var r;return u.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if("function"!=typeof e.json){t.next=11;break}return t.prev=1,t.next=4,e.json();case 4:return r=t.sent,t.abrupt("return",{message:r.message,type:r.type||"api"});case 8:return t.prev=8,t.t0=t.catch(1),t.abrupt("return",{message:t.t0.message,type:"general"});case 11:return t.abrupt("return",{message:e.message,type:e.type||"general"});case 12:case"end":return t.stop()}}),t,null,[[1,8]])})));return function(e){return t.apply(this,arguments)}}(),s=function(t){if(t.data&&"rest_invalid_param"===t.code){var e=Object.values(t.data.params);if(e[0])return e[0]}return(null==t?void 0:t.message)||Object(i.__)("Something went wrong. Please contact us to get assistance.",'woocommerce')}},42:function(t,e){!function(){t.exports=this.wp.escapeHtml}()},43:function(t,e,r){"use strict";var n=r(0),o=r(1),c=(r(2),r(42));e.a=function(t){var e,r,u,i=t.error;return Object(n.createElement)("div",{className:"wc-block-error-message"},(r=(e=i).message,u=e.type,r?"general"===u?Object(n.createElement)("span",null,Object(o.__)("The following error was returned",'woocommerce'),Object(n.createElement)("br",null),Object(n.createElement)("code",null,Object(c.escapeHTML)(r))):"api"===u?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(c.escapeHTML)(r))):r:Object(o.__)("An unknown error occurred which prevented the block from being updated.",'woocommerce')))}},48:function(t,e){!function(){t.exports=this.wp.keycodes}()},5:function(t,e){!function(){t.exports=this.wc.wcSettings}()},54:function(t,e){!function(){t.exports=this.wp.hooks}()},57:function(t,e,r){"use strict";var n=r(4),o=r.n(n),c=r(23),u=r.n(c),i=r(0);function a(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}e.a=function(t){var e=t.srcElement,r=t.size,n=void 0===r?24:r,c=u()(t,["srcElement","size"]);return Object(i.isValidElement)(e)?Object(i.cloneElement)(e,function(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?a(Object(r),!0).forEach((function(e){o()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):a(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}({width:n,height:n},c)):null}},6:function(t,e){!function(){t.exports=this.lodash}()},66:function(t,e){!function(){t.exports=this.wp.deprecated}()},67:function(t,e){!function(){t.exports=this.wp.serverSideRender}()},70:function(t,e){!function(){t.exports=this.wp.dom}()},78:function(t,e){!function(){t.exports=this.ReactDOM}()},79:function(t,e,r){"use strict";var n=r(4),o=r.n(n),c=r(0),u=r(1),i=(r(2),r(3));function a(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function s(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?a(Object(r),!0).forEach((function(e){o()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):a(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}e.a=function(t){var e=t.onChange,r=t.settings,n=r.button,o=r.price,a=r.rating,l=r.title;return Object(c.createElement)(c.Fragment,null,Object(c.createElement)(i.ToggleControl,{label:Object(u.__)("Product title",'woocommerce'),help:l?Object(u.__)("Product title is visible.",'woocommerce'):Object(u.__)("Product title is hidden.",'woocommerce'),checked:l,onChange:function(){return e(s(s({},r),{},{title:!l}))}}),Object(c.createElement)(i.ToggleControl,{label:Object(u.__)("Product price",'woocommerce'),help:o?Object(u.__)("Product price is visible.",'woocommerce'):Object(u.__)("Product price is hidden.",'woocommerce'),checked:o,onChange:function(){return e(s(s({},r),{},{price:!o}))}}),Object(c.createElement)(i.ToggleControl,{label:Object(u.__)("Product rating",'woocommerce'),help:a?Object(u.__)("Product rating is visible.",'woocommerce'):Object(u.__)("Product rating is hidden.",'woocommerce'),checked:a,onChange:function(){return e(s(s({},r),{},{rating:!a}))}}),Object(c.createElement)(i.ToggleControl,{label:Object(u.__)("Add to Cart button",'woocommerce'),help:n?Object(u.__)("Add to Cart button is visible.",'woocommerce'):Object(u.__)("Add to Cart button is hidden.",'woocommerce'),checked:n,onChange:function(){return e(s(s({},r),{},{button:!n}))}}))}},8:function(t,e){!function(){t.exports=this.React}()},80:function(t,e,r){"use strict";var n=r(0),o=r(1),c=r(6),u=(r(2),r(3));e.a=function(t){var e=t.columns,r=t.rows,i=t.setAttributes,a=t.alignButtons,s=t.minColumns,l=void 0===s?1:s,b=t.maxColumns,p=void 0===b?6:b,d=t.minRows,f=void 0===d?1:d,g=t.maxRows,O=void 0===g?6:g;return Object(n.createElement)(n.Fragment,null,Object(n.createElement)(u.RangeControl,{label:Object(o.__)("Columns",'woocommerce'),value:e,onChange:function(t){var e=Object(c.clamp)(t,l,p);i({columns:Number.isNaN(e)?"":e})},min:l,max:p}),Object(n.createElement)(u.RangeControl,{label:Object(o.__)("Rows",'woocommerce'),value:r,onChange:function(t){var e=Object(c.clamp)(t,f,O);i({rows:Number.isNaN(e)?"":e})},min:f,max:O}),Object(n.createElement)(u.ToggleControl,{label:Object(o.__)("Align Last Block",'woocommerce'),help:a?Object(o.__)("The last inner block will be aligned vertically.",'woocommerce'):Object(o.__)("The last inner block will follow other content.",'woocommerce'),checked:a,onChange:function(){return i({alignButtons:!a})}}))}},824:function(t,e,r){t.exports=r(906)},825:function(t,e){},826:function(t,e){},83:function(t,e){!function(){t.exports=this.wp.viewport}()},84:function(t,e){!function(){t.exports=this.wp.date}()},906:function(t,e,r){"use strict";r.r(e);var n=r(0),o=r(1),c=r(57),u=r(31),i=Object(n.createElement)(u.SVG,{xmlns:"http://www.w3.org/2000/SVG",viewBox:"0 0 24 24"},Object(n.createElement)("path",{fill:"none",d:"M0 0h24v24H0V0z"}),Object(n.createElement)("path",{d:"M2.53 19.65l1.34.56v-9.03l-2.43 5.86c-.41 1.02.08 2.19 1.09 2.61zm19.5-3.7L17.07 3.98c-.31-.75-1.04-1.21-1.81-1.23-.26 0-.53.04-.79.15L7.1 5.95c-.75.31-1.21 1.03-1.23 1.8-.01.27.04.54.15.8l4.96 11.97c.31.76 1.05 1.22 1.83 1.23.26 0 .52-.05.77-.15l7.36-3.05c1.02-.42 1.51-1.59 1.09-2.6zm-9.2 3.8L7.87 7.79l7.35-3.04h.01l4.95 11.95-7.35 3.05z"}),Object(n.createElement)("circle",{cx:"11",cy:"9",r:"1"}),Object(n.createElement)("path",{d:"M5.88 19.75c0 1.1.9 2 2 2h1.45l-3.45-8.34v6.34z"})),a=r(25),s=r(5),l=(r(825),r(15)),b=r.n(l),p=r(16),d=r.n(p),f=r(17),g=r.n(f),O=r(18),m=r.n(O),h=r(9),j=r.n(h),w=r(22),y=r(67),v=r.n(y),_=r(3),k=(r(2),r(79)),E=r(80),P=r(30),S=r.n(P),x=r(10),C=r.n(x),A=r(6),T=r(45),R=r(28),B=r.n(R),D=r(4),M=r.n(D),N=r(13),G=r.n(N),L=r(12),z=r.n(L),V=r(35),q=r(37);function F(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function I(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?F(Object(r),!0).forEach((function(e){M()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):F(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var Q=function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"id";return Array.isArray(e)?e.find((function(e){return e[r]===t})):null},H=function(t){return function(e){var r=e.selected,o=void 0===r?[]:r,c=o.length?o[0].attr_slug:null,u=Object(n.useState)(null),i=G()(u,2),a=i[0],s=i[1],l=Object(n.useState)(0),b=G()(l,2),p=b[0],d=b[1],f=Object(n.useState)({}),g=G()(f,2),O=g[0],m=g[1],h=Object(n.useState)(!0),j=G()(h,2),w=j[0],y=j[1],v=Object(n.useState)(!1),_=G()(v,2),k=_[0],E=_[1],P=Object(n.useState)(null),S=G()(P,2),x=S[0],A=S[1];return Object(n.useEffect)((function(){null===a&&Object(V.b)().then((function(t){if(t=t.map((function(t){return I(I({},t),{},{parent:0})})),s(t),c){var e=Q(c,t,"taxonomy");e&&d(e.id)}})).catch(function(){var t=B()(z.a.mark((function t(e){return z.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.t0=A,t.next=3,Object(q.a)(e);case 3:t.t1=t.sent,(0,t.t0)(t.t1);case 5:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()).finally((function(){y(!1)}))}),[a,c]),Object(n.useEffect)((function(){var t=Q(p,a);t&&(E(!0),Object(V.i)(p).then((function(e){e=e.map((function(e){return I(I({},e),{},{parent:p,attr_slug:t.taxonomy})})),m((function(t){return I(I({},t),{},M()({},p,e))}))})).catch(function(){var t=B()(z.a.mark((function t(e){return z.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.t0=A,t.next=3,Object(q.a)(e);case 3:t.t1=t.sent,(0,t.t0)(t.t1);case 5:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()).finally((function(){E(!1)})))}),[p,a]),Object(n.createElement)(t,C()({},e,{attributes:a||[],error:x,expandedAttribute:p,onExpandAttribute:d,isLoading:w,termsAreLoading:k,termsList:O}))}},U=r(43),$=(r(826),function(t){var e=t.attributes,r=t.error,c=t.expandedAttribute,u=t.onChange,i=t.onExpandAttribute,a=t.onOperatorChange,s=t.isLoading,l=t.operator,b=t.selected,p=t.termsAreLoading,d=t.termsList,f=function(t){return function(){u([]),i(t.id)}},g=d[c]||[],O=[].concat(S()(e),S()(g)),m={clear:Object(o.__)("Clear all product attributes",'woocommerce'),list:Object(o.__)("Product Attributes",'woocommerce'),noItems:Object(o.__)("Your store doesn't have any product attributes.",'woocommerce'),search:Object(o.__)("Search for product attributes",'woocommerce'),selected:function(t){return Object(o.sprintf)(Object(o._n)("%d attribute selected","%d attributes selected",t,'woocommerce'),t)},updated:Object(o.__)("Product attribute search results updated.",'woocommerce')};return r?Object(n.createElement)(U.a,{error:r}):Object(n.createElement)(n.Fragment,null,Object(n.createElement)(T.a,{className:"woocommerce-product-attributes",list:O,isLoading:s,selected:b.map((function(t){var e=t.id;return Object(A.find)(O,{id:e})})).filter(Boolean),onChange:u,renderItem:function(t){var e=t.item,r=t.search,u=t.depth,i=void 0===u?0:u,a=["woocommerce-product-attributes__item","woocommerce-search-list__item"];return r.length&&a.push("is-searching"),0===i&&e.parent&&a.push("is-skip-level"),e.breadcrumbs.length?Object(n.createElement)(T.b,C()({className:a.join(" ")},t,{showCount:!0,"aria-label":"".concat(e.breadcrumbs[0],": ").concat(e.name)})):[Object(n.createElement)(T.b,C()({key:"attr-".concat(e.id)},t,{className:a.join(" "),isSelected:c===e.id,onSelect:f,isSingle:!0,disabled:"0"===e.count,"aria-expanded":c===e.id,"aria-label":Object(o.sprintf)(Object(o._n)("%1$s, has %2$d term","%1$s, has %2$d terms",e.count,'woocommerce'),e.name,e.count)})),c===e.id&&p&&Object(n.createElement)("div",{key:"loading",className:"woocommerce-search-list__item woocommerce-product-attributes__itemdepth-1 is-loading is-not-active"},Object(n.createElement)(_.Spinner,null))]},messages:m,isHierarchical:!0}),!!a&&Object(n.createElement)("div",{className:b.length<2?"screen-reader-text":""},Object(n.createElement)(_.SelectControl,{className:"woocommerce-product-attributes__operator",label:Object(o.__)("Display products matching",'woocommerce'),help:Object(o.__)("Pick at least two attributes to use this setting.",'woocommerce'),value:l,onChange:a,options:[{label:Object(o.__)("Any selected attributes",'woocommerce'),value:"any"},{label:Object(o.__)("All selected attributes",'woocommerce'),value:"all"}]})))});$.defaultProps={operator:"any"};var W=H($),J=r(123),Y=r(175);function K(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=j()(t);if(e){var o=j()(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return m()(this,r)}}var X=function(t){g()(r,t);var e=K(r);function r(){return b()(this,r),e.apply(this,arguments)}return d()(r,[{key:"getInspectorControls",value:function(){var t=this.props.setAttributes,e=this.props.attributes,r=e.attributes,c=e.attrOperator,u=e.columns,i=e.contentVisibility,a=e.orderby,l=e.rows,b=e.alignButtons;return Object(n.createElement)(w.InspectorControls,{key:"inspector"},Object(n.createElement)(_.PanelBody,{title:Object(o.__)("Layout",'woocommerce'),initialOpen:!0},Object(n.createElement)(E.a,{columns:u,rows:l,alignButtons:b,setAttributes:t,minColumns:Object(s.getSetting)("min_columns",1),maxColumns:Object(s.getSetting)("max_columns",6),minRows:Object(s.getSetting)("min_rows",1),maxRows:Object(s.getSetting)("max_rows",6)})),Object(n.createElement)(_.PanelBody,{title:Object(o.__)("Content",'woocommerce'),initialOpen:!0},Object(n.createElement)(k.a,{settings:i,onChange:function(e){return t({contentVisibility:e})}})),Object(n.createElement)(_.PanelBody,{title:Object(o.__)("Filter by Product Attribute",'woocommerce'),initialOpen:!1},Object(n.createElement)(W,{selected:r,onChange:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],r=e.map((function(t){return{id:t.id,attr_slug:t.attr_slug}}));t({attributes:r})},operator:c,onOperatorChange:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"any";return t({attrOperator:e})}})),Object(n.createElement)(_.PanelBody,{title:Object(o.__)("Order By",'woocommerce'),initialOpen:!1},Object(n.createElement)(J.a,{setAttributes:t,value:a})))}},{key:"renderEditMode",value:function(){var t=this.props,e=t.debouncedSpeak,r=t.setAttributes,u=this.props.attributes;return Object(n.createElement)(_.Placeholder,{icon:Object(n.createElement)(c.a,{srcElement:i}),label:Object(o.__)("Products by Attribute",'woocommerce'),className:"wc-block-products-grid wc-block-products-by-attribute"},Object(o.__)("Display a grid of products from your selected attributes.",'woocommerce'),Object(n.createElement)("div",{className:"wc-block-products-by-attribute__selection"},Object(n.createElement)(W,{selected:u.attributes,onChange:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=t.map((function(t){return{id:t.id,attr_slug:t.attr_slug}}));r({attributes:e})},operator:u.attrOperator,onOperatorChange:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"any";return r({attrOperator:t})}}),Object(n.createElement)(_.Button,{isPrimary:!0,onClick:function(){r({editMode:!1}),e(Object(o.__)("Showing Products by Attribute block preview.",'woocommerce'))}},Object(o.__)("Done",'woocommerce'))))}},{key:"render",value:function(){var t=this.props,e=t.attributes,r=t.name,c=t.setAttributes,u=e.editMode;return e.isPreview?Y.a:Object(n.createElement)(n.Fragment,null,Object(n.createElement)(w.BlockControls,null,Object(n.createElement)(_.ToolbarGroup,{controls:[{icon:"edit",title:Object(o.__)("Edit"),onClick:function(){return c({editMode:!u})},isActive:u}]})),this.getInspectorControls(),u?this.renderEditMode():Object(n.createElement)(_.Disabled,null,Object(n.createElement)(v.a,{block:r,attributes:e})))}}]),r}(n.Component),Z=Object(_.withSpokenMessages)(X);Object(a.registerBlockType)("woocommerce/products-by-attribute",{title:Object(o.__)("Products by Attribute",'woocommerce'),icon:{src:Object(n.createElement)(c.a,{srcElement:i}),foreground:"#96588a"},category:"woocommerce",keywords:[Object(o.__)("WooCommerce",'woocommerce')],description:Object(o.__)("Display a grid of products with selected attributes.",'woocommerce'),supports:{align:["wide","full"],html:!1},example:{attributes:{isPreview:!0}},attributes:{attributes:{type:"array",default:[]},attrOperator:{type:"string",default:"any"},columns:{type:"number",default:Object(s.getSetting)("default_columns",3)},editMode:{type:"boolean",default:!0},contentVisibility:{type:"object",default:{title:!0,price:!0,rating:!0,button:!0}},orderby:{type:"string",default:"date"},rows:{type:"number",default:Object(s.getSetting)("default_rows",3)},alignButtons:{type:"boolean",default:!1},isPreview:{type:"boolean",default:!1}},edit:function(t){return Object(n.createElement)(Z,t)},save:function(){return null}})}});