!function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=19)}([function(e,t){!function(){e.exports=this.React}()},function(e,t){e.exports=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}},function(e,t){e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}},function(e,t){function r(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}e.exports=function(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}},function(e,t,r){var n=r(13),o=r(1);e.exports=function(e,t){return!t||"object"!==n(t)&&"function"!=typeof t?o(e):t}},function(e,t){function r(t){return e.exports=r=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},r(t)}e.exports=r},function(e,t,r){var n=r(14);e.exports=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&n(e,t)}},function(e,t){!function(){e.exports=this.wp.i18n}()},function(e,t){!function(){e.exports=this.ReactDOM}()},function(e,t,r){var n;
/*!
  Copyright (c) 2017 Jed Watson.
  Licensed under the MIT License (MIT), see
  http://jedwatson.github.io/classnames
*/
/*!
  Copyright (c) 2017 Jed Watson.
  Licensed under the MIT License (MIT), see
  http://jedwatson.github.io/classnames
*/
!function(){"use strict";var r={}.hasOwnProperty;function o(){for(var e=[],t=0;t<arguments.length;t++){var n=arguments[t];if(n){var i=typeof n;if("string"===i||"number"===i)e.push(n);else if(Array.isArray(n)&&n.length){var c=o.apply(null,n);c&&e.push(c)}else if("object"===i)for(var a in n)r.call(n,a)&&n[a]&&e.push(a)}}return e.join(" ")}e.exports?(o.default=o,e.exports=o):void 0===(n=function(){return o}.apply(t,[]))||(e.exports=n)}()},function(e,t){function r(){return e.exports=r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},r.apply(this,arguments)}e.exports=r},function(e,t,r){var n=r(15),o=r(16),i=r(17);e.exports=function(e){return n(e)||o(e)||i()}},function(e,t,r){var n=r(18);e.exports=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},o=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),o.forEach(function(t){n(e,t,r[t])})}return e}},function(e,t){function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function n(t){return"function"==typeof Symbol&&"symbol"===r(Symbol.iterator)?e.exports=n=function(e){return r(e)}:e.exports=n=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":r(e)},n(t)}e.exports=n},function(e,t){function r(t,n){return e.exports=r=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},r(t,n)}e.exports=r},function(e,t){e.exports=function(e){if(Array.isArray(e)){for(var t=0,r=new Array(e.length);t<e.length;t++)r[t]=e[t];return r}}},function(e,t){e.exports=function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}},function(e,t){e.exports=function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}},function(e,t){e.exports=function(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}},function(e,t,r){"use strict";r.r(t);var n=r(8),o=r(2),i=r.n(o),c=r(3),a=r.n(c),u=r(4),l=r.n(u),s=r(5),f=r.n(s),p=r(1),d=r.n(p),y=r(6),b=r.n(y),h=r(7),m=r(0),v=r(9),g=r.n(v),O=r(10),w=r.n(O),x=[],_=function(e){return function(t){function r(){return i()(this,r),l()(this,f()(r).apply(this,arguments))}return b()(r,t),a()(r,[{key:"generateUniqueID",value:function(){var e=r.name;return x[e]||(x[e]=0),x[e]++,x[e]}},{key:"render",value:function(){var t=this.generateUniqueID();return React.createElement(e,w()({},this.props,{componentId:t}))}}]),r}(m.Component)}(function(e){function t(){var e;return i()(this,t),(e=l()(this,f()(t).apply(this,arguments))).select=Object(m.createRef)(),e.onNavigate=e.onNavigate.bind(d()(e)),e.renderList=e.renderList.bind(d()(e)),e.renderOptions=e.renderOptions.bind(d()(e)),e}return b()(t,e),a()(t,[{key:"onNavigate",value:function(){var e=this.props.isPreview,t=void 0!==e&&e,r=this.select.current.value;if("false"!==r){var n=wc_product_block_data.homeUrl;t||0!==r.indexOf(n)||(document.location.href=r)}}},{key:"renderList",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.props.isPreview,o=void 0!==n&&n,i=this.props.attributes.hasCount,c="parent-"+e[0].term_id;return React.createElement("ul",{key:c},e.map(function(e){var n=i?React.createElement("span",null,"(",e.count,")"):null;return[React.createElement("li",{key:e.term_id},React.createElement("a",{href:o?null:e.link},e.name)," ",n," "),!!e.children&&!!e.children.length&&t.renderList(e.children,r+1)]}))}},{key:"renderOptions",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.props.attributes.hasCount;return e.map(function(e){var o=n?"(".concat(e.count,")"):null;return[React.createElement("option",{key:e.term_id,value:e.link},"–".repeat(r)," ",e.name," ",o),!!e.children&&!!e.children.length&&t.renderOptions(e.children,r+1)]})}},{key:"render",value:function(){var e=this.props,t=e.attributes,r=e.categories,n=e.componentId,o=t.className,i=t.isDropdown,c=g()("wc-block-product-categories",o,{"is-dropdown":i,"is-list":!i}),a="prod-categories-".concat(n);return React.createElement(m.Fragment,null,r.length>0&&React.createElement("div",{className:c},i?React.createElement(m.Fragment,null,React.createElement("div",{className:"wc-block-product-categories__dropdown"},React.createElement("label",{className:"screen-reader-text",htmlFor:a},Object(h.__)("Select a category","woo-gutenberg-products-block")),React.createElement("select",{id:a,ref:this.select},React.createElement("option",{value:"false",hidden:!0},Object(h.__)("Select a category","woo-gutenberg-products-block")),this.renderOptions(r))),React.createElement("button",{type:"button",className:"wc-block-product-categories__button","aria-label":Object(h.__)("Go to category","woo-gutenberg-products-block"),icon:"arrow-right-alt2",onClick:this.onNavigate},React.createElement("svg",{"aria-hidden":"true",role:"img",focusable:"false",className:"dashicon dashicons-arrow-right-alt2",xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20"},React.createElement("path",{d:"M6 15l5-5-5-5 1-2 7 7-7 7z"})))):this.renderList(r)))}}]),t}(m.Component)),j=r(11),E=r.n(j),S=r(12),k=r.n(S);var R=function(e){var t=e.hasEmpty,r=e.isHierarchical,n=wc_product_block_data.productCategories.filter(function(e){return t||!!e.count});return r?function(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).reduce(function(e,t,r,n){var o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:t.parent;return(e[o]||(e[o]=[])).push(t),e},{}),t=function t(r){return r.map(function(r){var n=e[r.term_id];return delete e[r.term_id],k()({},r,{children:n&&n.length?t(n):[]})})},r=t(e[0]||[]);return delete e[0],Object.keys(e).forEach(function(e){r.push.apply(r,E()(t(e||[])))}),r}(n):n},P=document.querySelectorAll(".wp-block-woocommerce-product-categories");P.length&&Array.prototype.forEach.call(P,function(e){var t=JSON.parse(JSON.stringify(e.dataset)),r={hasCount:"true"===t.hasCount,hasEmpty:"true"===t.hasEmpty,isDropdown:"true"===t.isDropdown,isHierarchical:"true"===t.isHierarchical},o=R(r);e.classList.remove("is-loading"),Object(n.render)(React.createElement(_,{attributes:r,categories:o}),e)})}]);