this.wc=this.wc||{},this.wc.blocks=this.wc.blocks||{},this.wc.blocks["featured-product"]=function(o){function i(i){for(var A,r,n=i[0],f=i[1],a=i[2],c=0,C=[];c$&")}var G=function(){var o=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return o?Object(n.createElement)(J,null):Object(n.createElement)(W,null)},E={list:Object(f.__)("Products",'woocommerce'),noItems:Object(f.__)("Your store doesn't have any products.",'woocommerce'),search:Object(f.__)("Search for a product to display",'woocommerce'),updated:Object(f.__)("Product search results updated.",'woocommerce')},V=function(o){var i=o.expandedProduct,K=o.error,A=o.isLoading,e=o.onChange,C=o.onSearch,u=o.products,w=o.renderItem,v=o.selected,l=o.showVariations,P=o.variations,b=o.variationsLoading,d=function(o){var K=o.item,A=o.search,t=o.depth,e=void 0===t?0:t,C=o.isSelected,u=o.onSelect,w=K.variations&&Array.isArray(K.variations)?K.variations.length:0,v=s()("woocommerce-search-product__item","woocommerce-search-list__item","depth-".concat(e),{"is-searching":A.length>0,"is-skip-level":0===e&&0!==K.parent,"is-variable":w>0}),l=Object.assign({},o);delete l.isSingle;var P={role:"menuitemradio"};return K.breadcrumbs.length&&(P["aria-label"]="".concat(K.breadcrumbs[0],": ").concat(K.name)),w&&(P["aria-expanded"]=K.id===i),K.breadcrumbs.length?(Object(a.isEmpty)(K.variation)||(K.name=K.variation),Object(n.createElement)(g.b,r()({className:v},o,P))):[Object(n.createElement)(c.MenuItem,r()({key:"product-".concat(K.id),isSelected:C},l,P,{className:v,onClick:function(){u(K)()}}),Object(n.createElement)("span",{className:"woocommerce-search-list__item-state"},G(C)),Object(n.createElement)("span",{className:"woocommerce-search-list__item-label"},Object(n.createElement)("span",{className:"woocommerce-search-list__item-name",dangerouslySetInnerHTML:{__html:z(K.name,A)}})),w?Object(n.createElement)("span",{className:"woocommerce-search-list__item-variation-count"},Object(f.sprintf)(Object(f._n)("%d variation","%d variations",w,'woocommerce'),w)):null),i===K.id&&w>0&&b&&Object(n.createElement)("div",{key:"loading",className:"woocommerce-search-list__item woocommerce-search-product__itemdepth-1 is-loading is-not-active"},Object(n.createElement)(c.Spinner,null))]};if(K)return Object(n.createElement)(Z.a,{error:K});var p=P&&P[i]?P[i]:[],j=[].concat(t()(u),t()(p));return Object(n.createElement)(g.a,{className:"woocommerce-products",list:j,isLoading:A,isSingle:!0,selected:j.filter((function(o){var i=o.id;return v.includes(i)})),onChange:e,renderItem:w||(l?d:null),onSearch:C,messages:E,isHierarchical:!0})};V.defaultProps={expandedProduct:null,selected:[],showVariations:!1};i.a=H(Object(h.a)(T(V)))},11:function(o,i){!function(){o.exports=this.moment}()},12:function(o,i,K){"use strict";K.d(i,"d",(function(){return t})),K.d(i,"n",(function(){return e})),K.d(i,"i",(function(){return r})),K.d(i,"k",(function(){return n})),K.d(i,"a",(function(){return f})),K.d(i,"j",(function(){return a})),K.d(i,"m",(function(){return g})),K.d(i,"c",(function(){return c})),K.d(i,"l",(function(){return C})),K.d(i,"b",(function(){return s})),K.d(i,"g",(function(){return u})),K.d(i,"h",(function(){return w})),K.d(i,"e",(function(){return v})),K.d(i,"f",(function(){return l})),K.d(i,"o",(function(){return P}));var A=K(5),t=Object(A.getSetting)("enableReviewRating",!0),e=Object(A.getSetting)("showAvatars",!0),r=Object(A.getSetting)("max_columns",6),n=Object(A.getSetting)("min_columns",1),f=Object(A.getSetting)("default_columns",3),a=Object(A.getSetting)("max_rows",6),g=Object(A.getSetting)("min_rows",1),c=Object(A.getSetting)("default_rows",2),C=Object(A.getSetting)("min_height",500),s=Object(A.getSetting)("default_height",500),u=(Object(A.getSetting)("placeholderImgSrc",""),Object(A.getSetting)("thumbnail_size",300),Object(A.getSetting)("isLargeCatalog")),w=Object(A.getSetting)("limitTags"),v=(Object(A.getSetting)("hasProducts",!0),Object(A.getSetting)("hasTags",!0)),l=Object(A.getSetting)("homeUrl",""),P=(Object(A.getSetting)("productCount",0),Object(A.getSetting)("attributes",[]),Object(A.getSetting)("wcBlocksAssetUrl",""))},13:function(o,i){!function(){o.exports=this.React}()},21:function(o,i){!function(){o.exports=this.wp.editor}()},22:function(o,i){!function(){o.exports=this.wp.compose}()},24:function(o,i){!function(){o.exports=this.wp.escapeHtml}()},25:function(o,i){!function(){o.exports=this.wp.blocks}()},26:function(o,i,K){"use strict";K.d(i,"a",(function(){return e}));var A=K(10),t=K.n(A),e=function(o){var i;return t.a.async((function(K){for(;;)switch(K.prev=K.next){case 0:if("function"!=typeof o.json){K.next=11;break}return K.prev=1,K.next=4,t.a.awrap(o.json());case 4:return i=K.sent,K.abrupt("return",{message:i.message,type:i.type||"api"});case 8:return K.prev=8,K.t0=K.catch(1),K.abrupt("return",{message:K.t0.message,type:"general"});case 11:return K.abrupt("return",{message:o.message,type:o.type||"general"});case 12:case"end":return K.stop()}}),null,null,[[1,8]])}},27:function(o,i,K){"use strict";var A=K(9),t=K.n(A),e=K(8),r=K(7),n=K.n(r),f=K(4),a=K(12),g={root:"/wc/blocks",products:"".concat("/wc/blocks","/products"),categories:"".concat("/wc/blocks","/products/categories")};function c(o,i){var K=Object.keys(o);if(Object.getOwnPropertySymbols){var A=Object.getOwnPropertySymbols(o);i&&(A=A.filter((function(i){return Object.getOwnPropertyDescriptor(o,i).enumerable}))),K.push.apply(K,A)}return K}function C(o){for(var i=1;i$7.99',images:[{id:1,src:f,thumbnail:f,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(t.__)("Add to cart",'woocommerce'),description:Object(t.__)("Add to cart",'woocommerce')},has_options:!1,is_purchasable:!0,is_in_stock:!0,on_sale:!0}],g={attributes:{contentAlign:"center",dimRatio:50,editMode:!1,height:n.b,mediaSrc:"",showDesc:!0,productId:"preview",previewProduct:a[0]}},c=K(3),C=K(6),s=K.n(C),u=K(22),w=K(4),v=(K(2),K(104)),l=K(53),P=K(572);function b(o){return o&&o.images&&o.images.length&&o.images[0].src||""}var d=Object(u.compose)([P.a,Object(e.withColors)({overlayColor:"background-color"}),c.withSpokenMessages])((function(o){var i,K,r,f,a=o.attributes,g=o.debouncedSpeak,C=o.error,u=o.getProduct,P=o.isLoading,d=o.isSelected,p=o.overlayColor,j=o.product,F=o.setAttributes,X=o.setOverlayColor,H=function(){var o=a.contentAlign,i=a.editMode,K=a.mediaId||function(o){return o&&o.images&&o.images.length&&o.images[0].id||0}(j);return Object(A.createElement)(e.BlockControls,null,Object(A.createElement)(e.AlignmentToolbar,{value:o,onChange:function(o){F({contentAlign:o})}}),Object(A.createElement)(e.MediaUploadCheck,null,Object(A.createElement)(c.Toolbar,null,Object(A.createElement)(e.MediaUpload,{onSelect:function(o){F({mediaId:o.id,mediaSrc:o.url})},allowedTypes:["image"],value:K,render:function(o){var i=o.open;return Object(A.createElement)(c.IconButton,{className:"components-toolbar__control",label:Object(t.__)("Edit media"),icon:"format-image",onClick:i,disabled:!j})}}))),Object(A.createElement)(c.Toolbar,{controls:[{icon:"edit",title:Object(t.__)("Edit"),onClick:function(){return F({editMode:!i})},isActive:i}]}))},h=function(){var o=s()("wp-block-button__link","is-style-fill");return"preview"===a.productId?Object(A.createElement)("div",{className:"wp-block-button aligncenter",style:{width:"100%"}},Object(A.createElement)(e.RichText.Content,{tagName:"a",className:o,href:j.url,title:a.linkText,style:{backgroundColor:"vivid-green-cyan",borderRadius:"5px"},value:a.linkText,target:j.url})):Object(A.createElement)(e.InnerBlocks,{template:[["core/button",{text:Object(t.__)("Shop now",'woocommerce'),url:j.permalink,align:"center"}]],templateLock:"all"})},x=a.editMode;return C?Object(A.createElement)(l.a,{className:"wc-block-featured-product-error",error:C,isLoading:P,onRetry:u}):x?Object(A.createElement)(A.Fragment,null,H(),Object(A.createElement)(c.Placeholder,{icon:"star-filled",label:Object(t.__)("Featured Product",'woocommerce'),className:"wc-block-featured-product"},Object(t.__)("Visually highlight a product or variation and encourage prompt action",'woocommerce'),Object(A.createElement)("div",{className:"wc-block-featured-product__selection"},Object(A.createElement)(v.a,{selected:a.productId||0,showVariations:!0,onChange:function(){var o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],i=o[0]?o[0].id:0;F({productId:i,mediaId:0,mediaSrc:""})}}),Object(A.createElement)(c.Button,{isDefault:!0,onClick:function(){F({editMode:!1}),g(Object(t.__)("Showing Featured Product block preview.",'woocommerce'))}},Object(t.__)("Done",'woocommerce'))))):Object(A.createElement)(A.Fragment,null,H(),(i=a.mediaSrc||b(j),K=a.focalPoint,r=void 0===K?{x:.5,y:.5}:K,f="function"==typeof c.FocalPointPicker,Object(A.createElement)(e.InspectorControls,{key:"inspector"},Object(A.createElement)(c.PanelBody,{title:Object(t.__)("Content",'woocommerce')},Object(A.createElement)(c.ToggleControl,{label:Object(t.__)("Show description",'woocommerce'),checked:a.showDesc,onChange:function(){return F({showDesc:!a.showDesc})}}),Object(A.createElement)(c.ToggleControl,{label:Object(t.__)("Show price",'woocommerce'),checked:a.showPrice,onChange:function(){return F({showPrice:!a.showPrice})}})),Object(A.createElement)(e.PanelColorSettings,{title:Object(t.__)("Overlay",'woocommerce'),colorSettings:[{value:p.color,onChange:X,label:Object(t.__)("Overlay Color",'woocommerce')}]},!!i&&Object(A.createElement)(A.Fragment,null,Object(A.createElement)(c.RangeControl,{label:Object(t.__)("Background Opacity",'woocommerce'),value:a.dimRatio,onChange:function(o){return F({dimRatio:o})},min:0,max:100,step:10}),f&&Object(A.createElement)(c.FocalPointPicker,{label:Object(t.__)("Focal Point Picker"),url:i,value:r,onChange:function(o){return F({focalPoint:o})}}))))),j?function(){var o,i,K=a.className,t=a.contentAlign,e=a.dimRatio,r=a.focalPoint,f=a.height,g=a.showDesc,C=a.showPrice,u=s()("wc-block-featured-product",{"is-selected":d&&"preview"!==a.productId,"is-loading":!j&&P,"is-not-found":!j&&!P,"has-background-dim":0!==e},0===(o=e)||50===o?null:"has-background-dim-".concat(10*Math.round(o/10)),"center"!==t&&"has-".concat(t,"-content"),K),v=(i=a.mediaSrc||j,Object(w.isObject)(i)&&(i=b(i)),i?{backgroundImage:"url(".concat(i,")")}:{});if(p.color&&(v.backgroundColor=p.color),r){var l=100*r.x,X=100*r.y;v.backgroundPosition="".concat(l,"% ").concat(X,"%")}return Object(A.createElement)(c.ResizableBox,{className:u,size:{height:f},minHeight:n.l,enable:{bottom:!0},onResizeStop:function(o,i,K){F({height:parseInt(K.style.height)})},style:v},Object(A.createElement)("div",{className:"wc-block-featured-product__wrapper"},Object(A.createElement)("h2",{className:"wc-block-featured-product__title",dangerouslySetInnerHTML:{__html:j.name}}),!Object(w.isEmpty)(j.variation)&&Object(A.createElement)("h3",{className:"wc-block-featured-product__variation",dangerouslySetInnerHTML:{__html:j.variation}}),g&&Object(A.createElement)("div",{className:"wc-block-featured-product__description",dangerouslySetInnerHTML:{__html:j.description}}),C&&Object(A.createElement)("div",{className:"wc-block-featured-product__price",dangerouslySetInnerHTML:{__html:j.price_html}}),Object(A.createElement)("div",{className:"wc-block-featured-product__link"},h())))}():Object(A.createElement)(c.Placeholder,{className:"wc-block-featured-product",icon:"star-filled",label:Object(t.__)("Featured Product",'woocommerce')},P?Object(A.createElement)(c.Spinner,null):Object(t.__)("No product is selected.",'woocommerce')))}));Object(r.registerBlockType)("woocommerce/featured-product",{title:Object(t.__)("Featured Product",'woocommerce'),icon:{src:"star-filled",foreground:"#96588a"},category:"woocommerce",keywords:[Object(t.__)("WooCommerce",'woocommerce')],description:Object(t.__)("Visually highlight a product or variation and encourage prompt action.",'woocommerce'),supports:{align:["wide","full"],html:!1},example:g,attributes:{contentAlign:{type:"string",default:"center"},dimRatio:{type:"number",default:50},editMode:{type:"boolean",default:!0},focalPoint:{type:"object"},height:{type:"number",default:n.b},mediaId:{type:"number",default:0},mediaSrc:{type:"string",default:""},overlayColor:{type:"string"},customOverlayColor:{type:"string"},linkText:{type:"string",default:Object(t.__)("Shop now",'woocommerce')},productId:{type:"number"},showDesc:{type:"boolean",default:!0},showPrice:{type:"boolean",default:!0},previewProduct:{type:"object",default:null}},edit:function(o){return Object(A.createElement)(d,o)},save:function(){return Object(A.createElement)(e.InnerBlocks.Content,null)}})},63:function(o,i){!function(){o.exports=this.wp.dom}()},64:function(o,i){!function(){o.exports=this.wp.isShallowEqual}()},67:function(o,i){},68:function(o,i){},69:function(o,i){},7:function(o,i){!function(){o.exports=this.wp.apiFetch}()},71:function(o,i){},72:function(o,i){},8:function(o,i){!function(){o.exports=this.wp.url}()}});