this.wc=this.wc||{},this.wc.blocks=this.wc.blocks||{},this.wc.blocks["featured-category"]=function(e){function t(t){for(var n,a,i=t[0],u=t[1],l=t[2],d=0,p=[];d100,l={per_page:u?100:0,catalog_visibility:"any",search:o,orderby:"title",order:"asc"},d=[Object(c.addQueryArgs)("/wc/store/products",p(p({},l),i))];return u&&r.length&&d.push(Object(c.addQueryArgs)("/wc/store/products",{catalog_visibility:"any",include:r,per_page:0})),d}({selected:r,search:o,queryArgs:void 0===a?{}:a});return Promise.all(l.map((function(e){return i()({path:e})}))).then((function(e){return Object(u.uniqBy)(Object(u.flatten)(e),"id").map((function(e){return p(p({},e),{},{parent:0})}))})).catch((function(e){throw e}))},b=function(e){return i()({path:"/wc/store/products/".concat(e)})},f=function(){return i()({path:"wc/store/products/attributes"})},m=function(e){return i()({path:"wc/store/products/attributes/".concat(e,"/terms")})},w=function(e){var t=e.selected,r=function(e){var t=e.selected,r=void 0===t?[]:t,n=e.search,o=Object(l.getSetting)("limitTags",!1),a=[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&&a.push(Object(c.addQueryArgs)("wc/store/products/tags",{include:r})),a}({selected:void 0===t?[]:t,search:e.search});return Promise.all(r.map((function(e){return i()({path:e})}))).then((function(e){return Object(u.uniqBy)(Object(u.flatten)(e),"id")}))},h=function(e){return i()({path:Object(c.addQueryArgs)("wc/store/products/categories",p({per_page:0},e))})},O=function(e){return i()({path:"wc/store/products/categories/".concat(e)})},y=function(e){return i()({path:Object(c.addQueryArgs)("wc/store/products",{per_page:0,type:"variation",parent:e})})},j=function(e,t){if(!e.title.raw)return e.slug;var r=1===t.filter((function(t){return t.title.raw===e.title.raw})).length;return e.title.raw+(r?"":" - ".concat(e.slug))}},4:function(e,t){e.exports=window.wp.components},42:function(e,t,r){"use strict";r.d(t,"a",(function(){return u})),r.d(t,"b",(function(){return l}));var n=r(29),o=r.n(n),c=r(22),a=r.n(c),i=r(1),u=function(){var e=o()(a.a.mark((function e(t){var r;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("function"!=typeof t.json){e.next=11;break}return e.prev=1,e.next=4,t.json();case 4:return r=e.sent,e.abrupt("return",{message:r.message,type:r.type||"api"});case 8:return e.prev=8,e.t0=e.catch(1),e.abrupt("return",{message:e.t0.message,type:"general"});case 11:return e.abrupt("return",{message:t.message,type:t.type||"general"});case 12:case"end":return e.stop()}}),e,null,[[1,8]])})));return function(_x){return e.apply(this,arguments)}}(),l=function(e){if(e.data&&"rest_invalid_param"===e.code){var t=Object.values(e.data.params);if(t[0])return t[0]}return(null==e?void 0:e.message)||Object(i.__)("Something went wrong. Please contact us to get assistance.",'woocommerce')}},46:function(e,t){e.exports=window.wp.keycodes},48:function(e,t){e.exports=window.wp.escapeHtml},52:function(e,t,r){"use strict";var n=r(0),o=r(1),c=(r(2),r(48));t.a=function(e){var t,r,a,i=e.error;return Object(n.createElement)("div",{className:"wc-block-error-message"},(r=(t=i).message,a=t.type,r?"general"===a?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"===a?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')))}},55:function(e,t){e.exports=window.wp.hooks},56:function(e,t){e.exports=window.wp.deprecated},66:function(e,t,r){"use strict";var n=r(5),o=r.n(n),c=r(16),a=r.n(c),i=r(0),u=["srcElement","size"];function l(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}t.a=function(e){var t=e.srcElement,r=e.size,n=void 0===r?24:r,c=a()(e,u);return Object(i.isValidElement)(t)?Object(i.cloneElement)(t,function(e){for(var t=1;t0&&void 0!==arguments[0]?arguments[0]:[],t=e[0]?e[0].id:0;m({categoryId:t,mediaId:0,mediaSrc:""}),E()},isSingle:!0}),Object(n.createElement)(C.Button,{isPrimary:!0,onClick:function(){m({editMode:!1}),k(Object(o.__)("Showing Featured Product block preview.",'woocommerce'))}},Object(o.__)("Done",'woocommerce')))):Object(n.createElement)(n.Fragment,null,(d=b.contentAlign,p=b.mediaSrc,g=b.mediaId||function(e){return e&&Object(I.isObject)(e.image)?e.image.id:0}(y),Object(n.createElement)(c.BlockControls,null,Object(n.createElement)(c.AlignmentToolbar,{value:d,onChange:function(e){m({contentAlign:e})}}),Object(n.createElement)(c.MediaReplaceFlow,{mediaId:g,mediaURL:p,accept:"image/*",onSelect:function(e){m({mediaId:e.id,mediaSrc:e.url})},allowedTypes:["image"]}),Object(n.createElement)(C.ToolbarGroup,{controls:[{icon:"edit",title:Object(o.__)("Edit"),onClick:function(){return m({editMode:!S})},isActive:S}]}))),(t=b.mediaSrc||D(y),a=void 0===(r=b.focalPoint)?{x:.5,y:.5}:r,l="function"==typeof C.FocalPointPicker,Object(n.createElement)(c.InspectorControls,{key:"inspector"},Object(n.createElement)(C.PanelBody,{title:Object(o.__)("Content",'woocommerce')},Object(n.createElement)(C.ToggleControl,{label:Object(o.__)("Show description",'woocommerce'),checked:b.showDesc,onChange:function(){return m({showDesc:!b.showDesc})}})),Object(n.createElement)(c.PanelColorSettings,{title:Object(o.__)("Overlay",'woocommerce'),colorSettings:[{value:j.color,onChange:v,label:Object(o.__)("Overlay Color",'woocommerce')}]},!!t&&Object(n.createElement)(n.Fragment,null,Object(n.createElement)(C.RangeControl,{label:Object(o.__)("Background Opacity",'woocommerce'),value:b.dimRatio,onChange:function(e){return m({dimRatio:e})},min:0,max:100,step:10}),l&&Object(n.createElement)(C.FocalPointPicker,{label:Object(o.__)("Focal Point Picker"),url:t,value:a,onChange:function(e){return m({focalPoint:e})}}))))),y?function(){var e,t,r,a=b.className,u=b.contentAlign,l=b.dimRatio,s=b.focalPoint,d=b.height,p=b.showDesc,g=x()("wc-block-featured-category",{"is-selected":f&&"preview"!==b.productId,"is-loading":!y&&O,"is-not-found":!y&&!O,"has-background-dim":0!==l},0===(e=l)||50===e?null:"has-background-dim-".concat(10*Math.round(e/10)),"center"!==u&&"has-".concat(u,"-content"),a),w=b.mediaSrc||D(y),h=y&&(t=w)?{backgroundImage:"url(".concat(t,")")}:{};if(j.color&&(h.backgroundColor=j.color),s){var v=100*s.x,k=100*s.y;h.backgroundPosition="".concat(v,"% ").concat(k,"%")}return Object(n.createElement)(C.ResizableBox,{className:g,size:{height:d},minHeight:Object(i.getSetting)("min_height",500),enable:{bottom:!0},onResizeStop:function(e,t,r){m({height:parseInt(r.style.height,10)})},style:h},Object(n.createElement)("div",{className:"wc-block-featured-category__wrapper"},Object(n.createElement)("h2",{className:"wc-block-featured-category__title",dangerouslySetInnerHTML:{__html:y.name}}),p&&Object(n.createElement)("div",{className:"wc-block-featured-category__description",dangerouslySetInnerHTML:{__html:y.description}}),Object(n.createElement)("div",{className:"wc-block-featured-category__link"},(r=x()("wp-block-button__link","is-style-fill"),"preview"===b.categoryId?Object(n.createElement)("div",{className:"wp-block-button aligncenter",style:{width:"100%"}},Object(n.createElement)(c.RichText.Content,{tagName:"a",className:r,href:y.permalink,title:b.linkText,style:{backgroundColor:"vivid-green-cyan",borderRadius:"5px"},value:b.linkText,target:y.permalink})):Object(n.createElement)(c.InnerBlocks,{template:[["core/button",{text:Object(o.__)("Shop now",'woocommerce'),url:y.permalink,align:"center"}]],templateLock:"all"})))))}():Object(n.createElement)(C.Placeholder,{className:"wc-block-featured-category",icon:Object(n.createElement)(u.a,{srcElement:s}),label:Object(o.__)("Featured Category",'woocommerce')},O?Object(n.createElement)(C.Spinner,null):Object(o.__)("No product category is selected.",'woocommerce')))})),Q=r(37),q=[{id:1,name:Object(o.__)("Clothing",'woocommerce'),slug:"clothing",parent:0,count:10,description:"

".concat(Object(o.__)("Branded t-shirts, jumpers, pants and more!",'woocommerce'),"

\n"),image:{id:1,date_created:"2019-07-15T17:05:04",date_created_gmt:"2019-07-15T17:05:04",date_modified:"2019-07-15T17:05:04",date_modified_gmt:"2019-07-15T17:05:04",src:Q.m+"previews/collection.jpg",name:"",alt:""},permalink:"#"}],W={attributes:{contentAlign:"center",dimRatio:50,editMode:!1,height:Object(i.getSetting)("default_height",500),mediaSrc:"",showDesc:!0,categoryId:"preview",previewCategory:q[0]}};Object(a.registerBlockType)("woocommerce/featured-category",{title:Object(o.__)("Featured Category",'woocommerce'),icon:{src:Object(n.createElement)(u.a,{srcElement:s}),foreground:"#96588a"},category:"woocommerce",keywords:[Object(o.__)("WooCommerce",'woocommerce')],description:Object(o.__)("Visually highlight a product category and encourage prompt action.",'woocommerce'),supports:{align:["wide","full"],html:!1},example:W,attributes:{contentAlign:{type:"string",default:"center"},dimRatio:{type:"number",default:50},editMode:{type:"boolean",default:!0},focalPoint:{type:"object"},height:{type:"number",default:Object(i.getSetting)("default_height",500)},mediaId:{type:"number",default:0},mediaSrc:{type:"string",default:""},overlayColor:{type:"string"},customOverlayColor:{type:"string"},linkText:{type:"string",default:Object(o.__)("Shop now",'woocommerce')},categoryId:{type:"number"},showDesc:{type:"boolean",default:!0},previewCategory:{type:"object",default:null}},edit:function(e){return Object(n.createElement)($,e)},save:function(){return Object(n.createElement)(c.InnerBlocks.Content,null)}})},87:function(e,t){e.exports=window.ReactDOM},89:function(e,t){e.exports=window.wp.viewport},96:function(e,t){e.exports=window.wp.date},97:function(e,t,r){"use strict";var n=r(9),o=r.n(n),c=r(0),a=r(1),i=(r(2),r(49)),u=r(4),l=r(29),s=r.n(l),d=r(17),p=r.n(d),g=r(18),b=r.n(g),f=r(13),m=r.n(f),w=r(19),h=r.n(w),O=r(20),y=r.n(O),j=r(10),v=r.n(j),k=r(22),_=r.n(k),E=r(21),S=r(39),C=r(42);var P=Object(E.createHigherOrderComponent)((function(e){return function(t){h()(i,t);var r,n,a=(r=i,n=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(e){return!1}}(),function(){var e,t=v()(r);if(n){var o=v()(this).constructor;e=Reflect.construct(t,arguments,o)}else e=t.apply(this,arguments);return y()(this,e)});function i(){var e;return p()(this,i),(e=a.apply(this,arguments)).state={error:null,loading:!1,categories:[]},e.loadCategories=e.loadCategories.bind(m()(e)),e}return b()(i,[{key:"componentDidMount",value:function(){this.loadCategories()}},{key:"loadCategories",value:function(){var e=this;this.setState({loading:!0}),Object(S.c)().then((function(t){e.setState({categories:t,loading:!1,error:null})})).catch(function(){var t=s()(_.a.mark((function t(r){var n;return _.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(C.a)(r);case 2:n=t.sent,e.setState({categories:[],loading:!1,error:n});case 4:case"end":return t.stop()}}),t)})));return function(_x){return t.apply(this,arguments)}}())}},{key:"render",value:function(){var t=this.state,r=t.error,n=t.loading,a=t.categories;return Object(c.createElement)(e,o()({},this.props,{error:r,isLoading:n,categories:a}))}}]),i}(c.Component)}),"withCategories"),x=r(52),R=r(6),A=r.n(R),T=(r(139),function(e){var t=e.categories,r=e.error,n=e.isLoading,l=e.onChange,s=e.onOperatorChange,d=e.operator,p=e.selected,g=e.isCompact,b=e.isSingle,f=e.showReviewCount,m={clear:Object(a.__)("Clear all product categories",'woocommerce'),list:Object(a.__)("Product Categories",'woocommerce'),noItems:Object(a.__)("Your store doesn't have any product categories.",'woocommerce'),search:Object(a.__)("Search for product categories",'woocommerce'),selected:function(e){return Object(a.sprintf)( /* translators: %d is the count of selected categories. */ Object(a._n)("%d category selected","%d categories selected",e,'woocommerce'),e)},updated:Object(a.__)("Category search results updated.",'woocommerce')};return r?Object(c.createElement)(x.a,{error:r}):Object(c.createElement)(c.Fragment,null,Object(c.createElement)(i.b,{className:"woocommerce-product-categories",list:t,isLoading:n,selected:p.map((function(e){return t.find((function(t){return t.id===e}))})).filter(Boolean),onChange:l,renderItem:function(e){var t=e.item,r=e.search,n=e.depth,u=void 0===n?0:n,l=t.breadcrumbs.length?"".concat(t.breadcrumbs.join(", "),", ").concat(t.name):t.name,s=f?Object(a.sprintf)( /* translators: %1$s is the item name, %2$d is the count of reviews for the item. */ Object(a._n)("%1$s, has %2$d review","%1$s, has %2$d reviews",t.review_count,'woocommerce'),l,t.review_count):Object(a.sprintf)( /* translators: %1$s is the item name, %2$d is the count of products for the item. */ Object(a._n)("%1$s, has %2$d product","%1$s, has %2$d products",t.count,'woocommerce'),l,t.count),d=f?Object(a.sprintf)( /* translators: %d is the count of reviews. */ Object(a._n)("%d review","%d reviews",t.review_count,'woocommerce'),t.review_count):Object(a.sprintf)( /* translators: %d is the count of products. */ Object(a._n)("%d product","%d products",t.count,'woocommerce'),t.count);return Object(c.createElement)(i.c,o()({className:A()("woocommerce-product-categories__item","has-count",{"is-searching":r.length>0,"is-skip-level":0===u&&0!==t.parent})},e,{countLabel:d,"aria-label":s}))},messages:m,isCompact:g,isHierarchical:!0,isSingle:b}),!!s&&Object(c.createElement)("div",{hidden:p.length<2},Object(c.createElement)(u.SelectControl,{className:"woocommerce-product-categories__operator",label:Object(a.__)("Display products matching",'woocommerce'),help:Object(a.__)("Pick at least two categories to use this setting.",'woocommerce'),value:d,onChange:s,options:[{label:Object(a.__)("Any selected categories",'woocommerce'),value:"any"},{label:Object(a.__)("All selected categories",'woocommerce'),value:"all"}]})))});T.defaultProps={operator:"any",isCompact:!1,isSingle:!1},t.a=P(T)}});