this.wc=this.wc||{},this.wc.blocks=this.wc.blocks||{},this.wc.blocks["featured-product"]=function(e){function t(t){for(var n,i,a=t[0],u=t[1],s=t[2],d=0,p=[];d0,"is-skip-level":0===c&&0!==t.parent,"is-variable":b>0});if(!t.breadcrumbs.length)return Object(s.createElement)(F.a,u()({},e,{className:G()(g,{"is-selected":a}),isSelected:a,item:t,onSelect:function(){return function(){f(t)()}},isLoading:i||O,countLabel:t.variations.length>0?Object(l.sprintf)( /* translators: %1$d is the number of variations of a product product. */ Object(l.__)("%1$d variations",'woocommerce'),t.variations.length):null,name:"products-".concat(n),"aria-label":Object(l.sprintf)( /* translators: %1$s is the product name, %2$d is the number of variations of that product. */ Object(l._n)("%1$s, has %2$d variation","%1$s, has %2$d variations",t.variations.length,'woocommerce'),t.name,t.variations.length)}));var m=Object(d.isEmpty)(t.variation)?e:z(z({},e),{},{item:z(z({},e.item),{},{name:t.variation}),"aria-label":"".concat(t.breadcrumbs[0],": ").concat(t.variation)});return Object(s.createElement)(p.c,u()({},m,{className:g,name:"variations-".concat(n)}))}:null),onSearch:f,messages:q,isHierarchical:!0})};Q.defaultProps={isCompact:!1,expandedProduct:null,selected:[],showVariations:!1},t.a=k(Object(P.a)(N(Object(f.withInstanceId)(Q))))},15:function(e,t){e.exports=window.wp.apiFetch},150:function(e,t,r){"use strict";var n=r(0),o=r(28),c=Object(n.createElement)(o.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(n.createElement)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"}));t.a=c},153:function(e,t){},21:function(e,t){e.exports=window.wp.compose},214:function(e,t){},22:function(e,t){e.exports=window.regeneratorRuntime},23:function(e,t){e.exports=window.wp.url},25:function(e,t){e.exports=window.wp.htmlEntities},26:function(e,t){e.exports=window.wp.blocks},28:function(e,t){e.exports=window.wp.primitives},3:function(e,t){e.exports=window.wc.wcSettings},302:function(e,t,r){"use strict";var n=r(9),o=r.n(n),c=r(29),i=r.n(c),a=r(8),u=r.n(a),s=r(16),l=r.n(s),d=r(0),p=r(22),f=r.n(p),b=r(37),g=r(39),m=r(222),h=r(42),w=["selected"];t.a=function(e){return function(t){var r=t.selected,n=l()(t,w),c=Object(d.useState)(!0),a=u()(c,2),s=a[0],p=a[1],O=Object(d.useState)(null),v=u()(O,2),j=v[0],y=v[1],_=Object(d.useState)([]),k=u()(_,2),P=k[0],S=k[1],E=b.o.productCount>100,x=function(){var e=i()(f.a.mark((function e(t){var r;return f.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Object(h.a)(t);case 2:r=e.sent,y(r),p(!1);case 5:case"end":return e.stop()}}),e)})));return function(_x){return e.apply(this,arguments)}}();Object(d.useEffect)((function(){Object(g.h)({selected:r}).then((function(e){S(e),p(!1)})).catch(x)}),[r]);var C=Object(m.a)((function(e){Object(g.h)({selected:r,search:e}).then((function(e){S(e),p(!1)})).catch(x)}),400),R=u()(C,1)[0],A=Object(d.useCallback)((function(e){p(!0),R(e)}),[p,R]);return Object(d.createElement)(e,o()({},n,{selected:r,error:j,products:P,isLoading:s,onSearch:E?A:null}))}}},31:function(e,t){e.exports=window.moment},34:function(e,t){e.exports=window.wp.isShallowEqual},36:function(e,t){e.exports=window.wp.dataControls},37:function(e,t,r){"use strict";r.d(t,"o",(function(){return c})),r.d(t,"m",(function(){return i})),r.d(t,"l",(function(){return a})),r.d(t,"n",(function(){return u})),r.d(t,"j",(function(){return s})),r.d(t,"e",(function(){return l})),r.d(t,"f",(function(){return d})),r.d(t,"g",(function(){return p})),r.d(t,"k",(function(){return f})),r.d(t,"c",(function(){return b})),r.d(t,"d",(function(){return g})),r.d(t,"h",(function(){return m})),r.d(t,"a",(function(){return h})),r.d(t,"i",(function(){return w})),r.d(t,"b",(function(){return O}));var n,o=r(3),c=Object(o.getSetting)("wcBlocksConfig",{buildPhase:1,pluginUrl:"",productCount:0,defaultAvatar:"",restApiRoutes:{},wordCountType:"words"}),i=c.pluginUrl+"images/",a=c.pluginUrl+"build/",u=c.buildPhase,s=null===(n=o.STORE_PAGES.shop)||void 0===n?void 0:n.permalink,l=o.STORE_PAGES.checkout.id,d=o.STORE_PAGES.checkout.permalink,p=o.STORE_PAGES.privacy.permalink,f=(o.STORE_PAGES.privacy.title,o.STORE_PAGES.terms.permalink),b=(o.STORE_PAGES.terms.title,o.STORE_PAGES.cart.id),g=o.STORE_PAGES.cart.permalink,m=(o.STORE_PAGES.myaccount.permalink?o.STORE_PAGES.myaccount.permalink:Object(o.getSetting)("wpLoginUrl","/wp-login.php"),Object(o.getSetting)("shippingCountries",{})),h=Object(o.getSetting)("allowedCountries",{}),w=Object(o.getSetting)("shippingStates",{}),O=Object(o.getSetting)("allowedStates",{})},39:function(e,t,r){"use strict";r.d(t,"h",(function(){return f})),r.d(t,"e",(function(){return b})),r.d(t,"b",(function(){return g})),r.d(t,"i",(function(){return m})),r.d(t,"f",(function(){return h})),r.d(t,"c",(function(){return w})),r.d(t,"d",(function(){return O})),r.d(t,"g",(function(){return v})),r.d(t,"a",(function(){return j}));var n=r(5),o=r.n(n),c=r(23),i=r(15),a=r.n(i),u=r(7),s=r(3),l=r(37);function d(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}function p(e){for(var t=1;t100,s={per_page:u?100:0,catalog_visibility:"any",search:o,orderby:"title",order:"asc"},d=[Object(c.addQueryArgs)("/wc/store/products",p(p({},s),a))];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===i?{}:i});return Promise.all(s.map((function(e){return a()({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 a()({path:"/wc/store/products/".concat(e)})},g=function(){return a()({path:"wc/store/products/attributes"})},m=function(e){return a()({path:"wc/store/products/attributes/".concat(e,"/terms")})},h=function(e){var t=e.selected,r=function(e){var t=e.selected,r=void 0===t?[]:t,n=e.search,o=Object(s.getSetting)("limitTags",!1),i=[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&&i.push(Object(c.addQueryArgs)("wc/store/products/tags",{include:r})),i}({selected:void 0===t?[]:t,search:e.search});return Promise.all(r.map((function(e){return a()({path:e})}))).then((function(e){return Object(u.uniqBy)(Object(u.flatten)(e),"id")}))},w=function(e){return a()({path:Object(c.addQueryArgs)("wc/store/products/categories",p({per_page:0},e))})},O=function(e){return a()({path:"wc/store/products/categories/".concat(e)})},v=function(e){return a()({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 s}));var n=r(29),o=r.n(n),c=r(22),i=r.n(c),a=r(1),u=function(){var e=o()(i.a.mark((function e(t){var r;return i.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)}}(),s=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(a.__)("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},481:function(e,t,r){"use strict";var n=r(9),o=r.n(n),c=r(29),i=r.n(c),a=r(17),u=r.n(a),s=r(18),l=r.n(s),d=r(13),p=r.n(d),f=r(19),b=r.n(f),g=r(20),m=r.n(g),h=r(10),w=r.n(h),O=r(5),v=r.n(O),j=r(0),y=r(22),_=r.n(y),k=r(21),P=r(39),S=r(42);var E=Object(k.createHigherOrderComponent)((function(e){return function(t){b()(a,t);var r,n,c=(r=a,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=w()(r);if(n){var o=w()(this).constructor;e=Reflect.construct(t,arguments,o)}else e=t.apply(this,arguments);return m()(this,e)});function a(){var e;u()(this,a);for(var t=arguments.length,r=new Array(t),n=0;n$7.99',images:[{id:1,src:o.m+"previews/pennant.jpg",thumbnail:o.m+"previews/pennant.jpg",name:"pennant-1.jpg",alt:"WordPress Pennant",srcset:"",sizes:""}],average_rating:5,review_count:1,prices:{currency_code:"GBP",decimal_separator:".",thousand_separator:",",decimals:2,price_prefix:"£",price_suffix:"",price:"7.99",regular_price:"9.99",sale_price:"7.99",price_range:null},add_to_cart:{text:Object(n.__)("Add to cart",'woocommerce'),description:Object(n.__)("Add to cart",'woocommerce')},has_options:!1,is_purchasable:!0,is_in_stock:!0,on_sale:!0}]},862:function(e,t,r){"use strict";r.r(t);var n=r(0),o=r(1),c=r(12),i=r(26),a=r(3),u=r(66),s=r(772),l=(r(770),r(771),r(773)),d={attributes:{contentAlign:"center",dimRatio:50,editMode:!1,height:Object(a.getSetting)("default_height",500),mediaSrc:"",showDesc:!0,productId:"preview",previewProduct:l.a[0]}},p=r(9),f=r.n(p),b=r(17),g=r.n(b),m=r(18),h=r.n(m),w=r(13),O=r.n(w),v=r(19),j=r.n(v),y=r(20),_=r.n(y),k=r(10),P=r.n(k),S=r(5),E=r.n(S),x=r(14),C=r(4),R=r(6),A=r.n(R),I=r(21),D=r(7),T=(r(2),r(149)),B=r(106),L=r(481);function M(e){return e&&e.images&&e.images.length&&e.images[0].src||""}function N(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}function U(e){for(var t=1;t0&&void 0!==arguments[0]?arguments[0]:[],t=e[0]?e[0].id:0;O({productId:t,mediaId:0,mediaSrc:""}),y()}}),Object(n.createElement)(C.Button,{isPrimary:!0,onClick:function(){O({editMode:!1}),p(Object(o.__)("Showing Featured Product block preview.",'woocommerce'))}},Object(o.__)("Done",'woocommerce'))))):Object(n.createElement)(n.Fragment,null,_(),(t=d.mediaSrc||M(w),i=void 0===(r=d.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:d.showDesc,onChange:function(){return O({showDesc:!d.showDesc})}}),Object(n.createElement)(C.ToggleControl,{label:Object(o.__)("Show price",'woocommerce'),checked:d.showPrice,onChange:function(){return O({showPrice:!d.showPrice})}})),Object(n.createElement)(c.PanelColorSettings,{title:Object(o.__)("Overlay",'woocommerce'),colorSettings:[{value:h.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:d.dimRatio,onChange:function(e){return O({dimRatio:e})},min:0,max:100,step:10}),l&&Object(n.createElement)(C.FocalPointPicker,{label:Object(o.__)("Focal Point Picker"),url:t,value:i,onChange:function(e){return O({focalPoint:e})}}))))),w?function(){var e,t,r,i=d.className,u=d.contentAlign,s=d.dimRatio,l=d.focalPoint,p=d.height,f=d.showDesc,b=d.showPrice,v=A()("wc-block-featured-product",{"is-selected":m&&"preview"!==d.productId,"is-loading":!w&&g,"is-not-found":!w&&!g,"has-background-dim":0!==s},0===(e=s)||50===e?null:"has-background-dim-".concat(10*Math.round(e/10)),"center"!==u&&"has-".concat(u,"-content"),i),j=(t=d.mediaSrc||w,Object(D.isObject)(t)&&(t=M(t)),t?{backgroundImage:"url(".concat(t,")")}:{});if(h.color&&(j.backgroundColor=h.color),l){var y=100*l.x,_=100*l.y;j.backgroundPosition="".concat(y,"% ").concat(_,"%")}return Object(n.createElement)(C.ResizableBox,{className:v,size:{height:p},minHeight:Object(a.getSetting)("min_height",500),enable:{bottom:!0},onResizeStop:function(e,t,r){O({height:parseInt(r.style.height,10)})},style:j},Object(n.createElement)("div",{className:"wc-block-featured-product__wrapper"},Object(n.createElement)("h2",{className:"wc-block-featured-product__title",dangerouslySetInnerHTML:{__html:w.name}}),!Object(D.isEmpty)(w.variation)&&Object(n.createElement)("h3",{className:"wc-block-featured-product__variation",dangerouslySetInnerHTML:{__html:w.variation}}),f&&Object(n.createElement)("div",{className:"wc-block-featured-product__description",dangerouslySetInnerHTML:{__html:w.short_description}}),b&&Object(n.createElement)("div",{className:"wc-block-featured-product__price",dangerouslySetInnerHTML:{__html:w.price_html}}),Object(n.createElement)("div",{className:"wc-block-featured-product__link"},(r=A()("wp-block-button__link","is-style-fill"),"preview"===d.productId?Object(n.createElement)("div",{className:"wp-block-button aligncenter",style:{width:"100%"}},Object(n.createElement)(c.RichText.Content,{tagName:"a",className:r,href:w.permalink,title:d.linkText,style:{backgroundColor:"vivid-green-cyan",borderRadius:"5px"},value:d.linkText,target:w.permalink})):Object(n.createElement)(c.InnerBlocks,{template:[["core/button",{text:Object(o.__)("Shop now",'woocommerce'),url:w.permalink,align:"center"}]],templateLock:"all"})))))}():Object(n.createElement)(C.Placeholder,{className:"wc-block-featured-product",icon:Object(n.createElement)(u.a,{srcElement:s.a}),label:Object(o.__)("Featured Product",'woocommerce')},g?Object(n.createElement)(C.Spinner,null):Object(o.__)("No product is selected.",'woocommerce')))}));Object(i.registerBlockType)("woocommerce/featured-product",{title:Object(o.__)("Featured Product",'woocommerce'),icon:{src:Object(n.createElement)(u.a,{srcElement:s.a}),foreground:"#96588a"},category:"woocommerce",keywords:[Object(o.__)("WooCommerce",'woocommerce')],description:Object(o.__)("Visually highlight a product or variation and encourage prompt action.",'woocommerce'),supports:{align:["wide","full"],html:!1},example:d,attributes:{contentAlign:{type:"string",default:"center"},dimRatio:{type:"number",default:50},editMode:{type:"boolean",default:!0},focalPoint:{type:"object"},height:{type:"number",default:Object(a.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')},productId:{type:"number"},showDesc:{type:"boolean",default:!0},showPrice:{type:"boolean",default:!0},previewProduct:{type:"object",default:null}},edit:function(e){return Object(n.createElement)(V,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}});