OwlCyberSecurity - MANAGER
Edit File: featured-product.js
this.wc=this.wc||{},this.wc.blocks=this.wc.blocks||{},this.wc.blocks["featured-product"]=function(e){function t(t){for(var o,a,i=t[0],s=t[1],l=t[2],d=0,p=[];d<i.length;d++)a=i[d],Object.prototype.hasOwnProperty.call(n,a)&&n[a]&&p.push(n[a][0]),n[a]=0;for(o in s)Object.prototype.hasOwnProperty.call(s,o)&&(e[o]=s[o]);for(u&&u(t);p.length;)p.shift()();return c.push.apply(c,l||[]),r()}function r(){for(var e,t=0;t<c.length;t++){for(var r=c[t],o=!0,i=1;i<r.length;i++){var s=r[i];0!==n[s]&&(o=!1)}o&&(c.splice(t--,1),e=a(a.s=r[0]))}return e}var o={},n={22:0},c=[];function a(t){if(o[t])return o[t].exports;var r=o[t]={i:t,l:!1,exports:{}};return e[t].call(r.exports,r,r.exports,a),r.l=!0,r.exports}a.m=e,a.c=o,a.d=function(e,t,r){a.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},a.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.t=function(e,t){if(1&t&&(e=a(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(a.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)a.d(r,o,function(t){return e[t]}.bind(null,o));return r},a.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(t,"a",t),t},a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},a.p="";var i=window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[],s=i.push.bind(i);i.push=t,i=i.slice();for(var l=0;l<i.length;l++)t(i[l]);var u=s;return c.push([758,0]),r()}({0:function(e,t){e.exports=window.wp.element},1:function(e,t){e.exports=window.wp.i18n},10:function(e,t){e.exports=window.wp.data},100:function(e,t,r){"use strict";var o=r(0),n=r(1),c=r(55),a=r(136),i=r(5),s=r.n(i),l=r(4),u=r(41);r(137),t.a=e=>{let{className:t,error:r,isLoading:i=!1,onRetry:d}=e;return Object(o.createElement)(l.Placeholder,{icon:Object(o.createElement)(c.a,{srcElement:a.a}),label:Object(n.__)("Sorry, an error occurred",'woocommerce'),className:s()("wc-block-api-error",t)},Object(o.createElement)(u.a,{error:r}),d&&Object(o.createElement)(o.Fragment,null,i?Object(o.createElement)(l.Spinner,null):Object(o.createElement)(l.Button,{isSecondary:!0,onClick:d},Object(n.__)("Retry",'woocommerce'))))}},11:function(e,t){e.exports=window.wp.apiFetch},115:function(e,t){},116:function(e,t){e.exports=window.wp.coreData},12:function(e,t){e.exports=window.wp.compose},120:function(e,t,r){"use strict";var o=r(7),n=r.n(o),c=r(0),a=r(40),i=r(4),s=r(5),l=r.n(s);t.a=e=>{let{className:t,item:r,isSelected:o,isLoading:s,onSelect:u,disabled:d,...p}=e;return Object(c.createElement)(c.Fragment,null,Object(c.createElement)(a.c,n()({},p,{key:r.id,className:t,isSelected:o,item:r,onSelect:u,isSingle:!0,disabled:d})),o&&s&&Object(c.createElement)("div",{key:"loading",className:l()("woocommerce-search-list__item","woocommerce-product-attributes__item","depth-1","is-loading","is-not-active")},Object(c.createElement)(i.Spinner,null)))}},13:function(e,t){e.exports=window.wp.url},135:function(e,t,r){"use strict";var o=r(7),n=r.n(o),c=r(0),a=r(1),i=r(6),s=(r(2),r(40)),l=r(12),u=Object(l.createHigherOrderComponent)(e=>{class t extends c.Component{render(){const{selected:t}=this.props,r=null==t;return Object(c.createElement)(e,n()({},this.props,{selected:r?[]:[t]}))}}return t.defaultProps={selected:null},t},"withTransformSingleSelectToMultipleSelect"),d=r(273),p=r(16),b=r.n(p),g=r(31),m=r.n(g),h=r(34),w=r(35),f=Object(l.createHigherOrderComponent)(e=>{class t extends c.Component{constructor(){super(...arguments),b()(this,"state",{error:null,loading:!1,variations:{}}),b()(this,"loadVariations",()=>{const{products:e}=this.props,{loading:t,variations:r}=this.state;if(t)return;const o=this.getExpandedProduct();if(!o||r[o])return;const n=e.find(e=>e.id===o);n.variations&&0!==n.variations.length?(this.setState({loading:!0}),Object(h.g)(o).then(e=>{const t=e.map(e=>({...e,parent:o}));this.setState({variations:{...this.state.variations,[o]:t},loading:!1,error:null})}).catch(async e=>{const t=await Object(w.a)(e);this.setState({variations:{...this.state.variations,[o]:null},loading:!1,error:t})})):this.setState({variations:{...this.state.variations,[o]:null},loading:!1,error:null})})}componentDidMount(){const{selected:e,showVariations:t}=this.props;e&&t&&this.loadVariations()}componentDidUpdate(e){const{isLoading:t,selected:r,showVariations:o}=this.props;o&&(!m()(e.selected,r)||e.isLoading&&!t)&&this.loadVariations()}isProductId(e){const{products:t}=this.props;return t.some(t=>t.id===e)}findParentProduct(e){const{products:t}=this.props;return t.filter(t=>t.variations&&t.variations.find(t=>{let{id:r}=t;return r===e}))[0].id}getExpandedProduct(){const{isLoading:e,selected:t,showVariations:r}=this.props;if(!r)return null;let o=t&&t.length?t[0]:null;return o?this.prevSelectedItem=o:this.prevSelectedItem&&(e||this.isProductId(this.prevSelectedItem)||(o=this.prevSelectedItem)),!e&&o?this.isProductId(o)?o:this.findParentProduct(o):null}render(){const{error:t,isLoading:r}=this.props,{error:o,loading:a,variations:i}=this.state;return Object(c.createElement)(e,n()({},this.props,{error:o||t,expandedProduct:this.getExpandedProduct(),isLoading:r,variations:i,variationsLoading:a}))}}return b()(t,"defaultProps",{selected:[],showVariations:!1}),t},"withProductVariations"),O=r(41),j=r(5),_=r.n(j),v=r(120);r(191);const k={list:Object(a.__)("Products",'woocommerce'),noItems:Object(a.__)("Your store doesn't have any products.",'woocommerce'),search:Object(a.__)("Search for a product to display",'woocommerce'),updated:Object(a.__)("Product search results updated.",'woocommerce')},y=e=>{let{expandedProduct:t,error:r,instanceId:o,isCompact:l,isLoading:u,onChange:d,onSearch:p,products:b,renderItem:g,selected:m,showVariations:h,variations:w,variationsLoading:f}=e;if(r)return Object(c.createElement)(O.a,{error:r});const j=[...b,...w&&w[t]?w[t]:[]];return Object(c.createElement)(s.b,{className:"woocommerce-products",list:j,isCompact:l,isLoading:u,isSingle:!0,selected:j.filter(e=>{let{id:t}=e;return m.includes(t)}),onChange:d,renderItem:g||(h?e=>{const{item:t,search:r,depth:l=0,isSelected:d,onSelect:p}=e,b=t.variations&&Array.isArray(t.variations)?t.variations.length:0,g=_()("woocommerce-search-product__item","woocommerce-search-list__item","depth-"+l,"has-count",{"is-searching":r.length>0,"is-skip-level":0===l&&0!==t.parent,"is-variable":b>0});if(!t.breadcrumbs.length)return Object(c.createElement)(v.a,n()({},e,{className:_()(g,{"is-selected":d}),isSelected:d,item:t,onSelect:()=>()=>{p(t)()},isLoading:u||f,countLabel:t.variations.length>0?Object(a.sprintf)( /* translators: %1$d is the number of variations of a product product. */ Object(a.__)("%1$d variations",'woocommerce'),t.variations.length):null,name:"products-"+o,"aria-label":Object(a.sprintf)( /* translators: %1$s is the product name, %2$d is the number of variations of that product. */ Object(a._n)("%1$s, has %2$d variation","%1$s, has %2$d variations",t.variations.length,'woocommerce'),t.name,t.variations.length)}));const m=Object(i.isEmpty)(t.variation)?e:{...e,item:{...e.item,name:t.variation},"aria-label":`${t.breadcrumbs[0]}: ${t.variation}`};return Object(c.createElement)(s.c,n()({},m,{className:g,name:"variations-"+o}))}:null),onSearch:p,messages:k,isHierarchical:!0})};y.defaultProps={isCompact:!1,expandedProduct:null,selected:[],showVariations:!1},t.a=u(Object(d.a)(f(Object(l.withInstanceId)(y))))},136:function(e,t,r){"use strict";var o=r(0),n=r(18);const c=Object(o.createElement)(n.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(o.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},137:function(e,t){},14:function(e,t){e.exports=window.wp.blocks},18:function(e,t){e.exports=window.wp.primitives},191:function(e,t){},20:function(e,t){e.exports=window.wp.htmlEntities},21:function(e,t){e.exports=window.moment},273:function(e,t,r){"use strict";var o=r(7),n=r.n(o),c=r(0),a=r(32),i=r(34),s=r(165),l=r(35);t.a=e=>t=>{let{selected:r,...o}=t;const[u,d]=Object(c.useState)(!0),[p,b]=Object(c.useState)(null),[g,m]=Object(c.useState)([]),h=a.o.productCount>100,w=async e=>{const t=await Object(l.a)(e);b(t),d(!1)},f=Object(c.useRef)(r);Object(c.useEffect)(()=>{Object(i.h)({selected:f.current}).then(e=>{m(e),d(!1)}).catch(w)},[f]);const O=Object(s.a)(e=>{Object(i.h)({selected:r,search:e}).then(e=>{m(e),d(!1)}).catch(w)},400),j=Object(c.useCallback)(e=>{d(!0),O(e)},[d,O]);return Object(c.createElement)(e,n()({},o,{selected:r,error:p,products:g,isLoading:u,onSearch:h?j:null}))}},3:function(e,t){e.exports=window.wc.wcSettings},30:function(e,t){e.exports=window.wp.dataControls},31:function(e,t){e.exports=window.wp.isShallowEqual},32:function(e,t,r){"use strict";r.d(t,"o",(function(){return c})),r.d(t,"m",(function(){return a})),r.d(t,"l",(function(){return i})),r.d(t,"n",(function(){return s})),r.d(t,"j",(function(){return l})),r.d(t,"e",(function(){return u})),r.d(t,"f",(function(){return d})),r.d(t,"g",(function(){return p})),r.d(t,"k",(function(){return b})),r.d(t,"c",(function(){return g})),r.d(t,"d",(function(){return m})),r.d(t,"h",(function(){return h})),r.d(t,"a",(function(){return w})),r.d(t,"i",(function(){return f})),r.d(t,"b",(function(){return O}));var o,n=r(3);const c=Object(n.getSetting)("wcBlocksConfig",{buildPhase:1,pluginUrl:"",productCount:0,defaultAvatar:"",restApiRoutes:{},wordCountType:"words"}),a=c.pluginUrl+"images/",i=c.pluginUrl+"build/",s=c.buildPhase,l=null===(o=n.STORE_PAGES.shop)||void 0===o?void 0:o.permalink,u=n.STORE_PAGES.checkout.id,d=n.STORE_PAGES.checkout.permalink,p=n.STORE_PAGES.privacy.permalink,b=(n.STORE_PAGES.privacy.title,n.STORE_PAGES.terms.permalink),g=(n.STORE_PAGES.terms.title,n.STORE_PAGES.cart.id),m=n.STORE_PAGES.cart.permalink,h=(n.STORE_PAGES.myaccount.permalink?n.STORE_PAGES.myaccount.permalink:Object(n.getSetting)("wpLoginUrl","/wp-login.php"),Object(n.getSetting)("shippingCountries",{})),w=Object(n.getSetting)("allowedCountries",{}),f=Object(n.getSetting)("shippingStates",{}),O=Object(n.getSetting)("allowedStates",{})},34:function(e,t,r){"use strict";r.d(t,"h",(function(){return l})),r.d(t,"e",(function(){return u})),r.d(t,"b",(function(){return d})),r.d(t,"i",(function(){return p})),r.d(t,"f",(function(){return b})),r.d(t,"c",(function(){return g})),r.d(t,"d",(function(){return m})),r.d(t,"g",(function(){return h})),r.d(t,"a",(function(){return w}));var o=r(13),n=r(11),c=r.n(n),a=r(6),i=r(3),s=r(32);const l=e=>{let{selected:t=[],search:r="",queryArgs:n={}}=e;const i=(e=>{let{selected:t=[],search:r="",queryArgs:n={}}=e;const c=s.o.productCount>100,a={per_page:c?100:0,catalog_visibility:"any",search:r,orderby:"title",order:"asc"},i=[Object(o.addQueryArgs)("/wc/store/products",{...a,...n})];return c&&t.length&&i.push(Object(o.addQueryArgs)("/wc/store/products",{catalog_visibility:"any",include:t,per_page:0})),i})({selected:t,search:r,queryArgs:n});return Promise.all(i.map(e=>c()({path:e}))).then(e=>Object(a.uniqBy)(Object(a.flatten)(e),"id").map(e=>({...e,parent:0}))).catch(e=>{throw e})},u=e=>c()({path:"/wc/store/products/"+e}),d=()=>c()({path:"wc/store/products/attributes"}),p=e=>c()({path:`wc/store/products/attributes/${e}/terms`}),b=e=>{let{selected:t=[],search:r}=e;const n=(e=>{let{selected:t=[],search:r}=e;const n=Object(i.getSetting)("limitTags",!1),c=[Object(o.addQueryArgs)("wc/store/products/tags",{per_page:n?100:0,orderby:n?"count":"name",order:n?"desc":"asc",search:r})];return n&&t.length&&c.push(Object(o.addQueryArgs)("wc/store/products/tags",{include:t})),c})({selected:t,search:r});return Promise.all(n.map(e=>c()({path:e}))).then(e=>Object(a.uniqBy)(Object(a.flatten)(e),"id"))},g=e=>c()({path:Object(o.addQueryArgs)("wc/store/products/categories",{per_page:0,...e})}),m=e=>c()({path:"wc/store/products/categories/"+e}),h=e=>c()({path:Object(o.addQueryArgs)("wc/store/products",{per_page:0,type:"variation",parent:e})}),w=(e,t)=>{if(!e.title.raw)return e.slug;const r=1===t.filter(t=>t.title.raw===e.title.raw).length;return e.title.raw+(r?"":" - "+e.slug)}},35:function(e,t,r){"use strict";r.d(t,"a",(function(){return n})),r.d(t,"b",(function(){return c}));var o=r(1);const n=async e=>{if("function"==typeof e.json)try{const t=await e.json();return{message:t.message,type:t.type||"api"}}catch(e){return{message:e.message,type:"general"}}return{message:e.message,type:e.type||"general"}},c=e=>{if(e.data&&"rest_invalid_param"===e.code){const t=Object.values(e.data.params);if(t[0])return t[0]}return(null==e?void 0:e.message)||Object(o.__)("Something went wrong. Please contact us to get assistance.",'woocommerce')}},38:function(e,t){e.exports=window.wp.keycodes},39:function(e,t){e.exports=window.wp.escapeHtml},4:function(e,t){e.exports=window.wp.components},41:function(e,t,r){"use strict";var o=r(0),n=r(1),c=r(39);t.a=e=>{let{error:t}=e;return Object(o.createElement)("div",{className:"wc-block-error-message"},(e=>{let{message:t,type:r}=e;return t?"general"===r?Object(o.createElement)("span",null,Object(n.__)("The following error was returned",'woocommerce'),Object(o.createElement)("br",null),Object(o.createElement)("code",null,Object(c.escapeHTML)(t))):"api"===r?Object(o.createElement)("span",null,Object(n.__)("The following error was returned from the API",'woocommerce'),Object(o.createElement)("br",null),Object(o.createElement)("code",null,Object(c.escapeHTML)(t))):t:Object(n.__)("An unknown error occurred which prevented the block from being updated.",'woocommerce')})(t))}},45:function(e,t){e.exports=window.wp.hooks},476:function(e,t,r){"use strict";var o=r(7),n=r.n(o),c=r(16),a=r.n(c),i=r(0),s=r(12),l=r(34),u=r(35);const d=Object(s.createHigherOrderComponent)(e=>class extends i.Component{constructor(){super(...arguments),a()(this,"state",{error:null,loading:!1,product:"preview"===this.props.attributes.productId?this.props.attributes.previewProduct:null}),a()(this,"loadProduct",()=>{const{productId:e}=this.props.attributes;"preview"!==e&&(e?(this.setState({loading:!0}),Object(l.e)(e).then(e=>{this.setState({product:e,loading:!1,error:null})}).catch(async e=>{const t=await Object(u.a)(e);this.setState({product:null,loading:!1,error:t})})):this.setState({product:null,loading:!1,error:null}))})}componentDidMount(){this.loadProduct()}componentDidUpdate(e){e.attributes.productId!==this.props.attributes.productId&&this.loadProduct()}render(){const{error:t,loading:r,product:o}=this.state;return Object(i.createElement)(e,n()({},this.props,{error:t,getProduct:this.loadProduct,isLoading:r,product:o}))}},"withProduct");t.a=d},51:function(e,t){e.exports=window.wp.deprecated},55:function(e,t,r){"use strict";var o=r(0);t.a=function(e){let{srcElement:t,size:r=24,...n}=e;return Object(o.isValidElement)(t)?Object(o.cloneElement)(t,{width:r,height:r,...n}):null}},6:function(e,t){e.exports=window.lodash},61:function(e,t){e.exports=window.wp.dom},64:function(e,t){e.exports=window.regeneratorRuntime},758:function(e,t,r){e.exports=r(858)},759:function(e,t){},760:function(e,t){},761:function(e,t,r){"use strict";var o=r(0),n=r(18);const c=Object(o.createElement)(n.SVG,{xmlns:"http://www.w3.org/2000/SVG",viewBox:"0 0 24 24"},Object(o.createElement)("path",{fill:"none",d:"M0 0h24v24H0V0z"}),Object(o.createElement)("path",{d:"M22 9.24l-7.19-.62L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21 12 17.27 18.18 21l-1.63-7.03L22 9.24zM12 15.4l-3.76 2.27 1-4.28-3.32-2.88 4.38-.38L12 6.1l1.71 4.04 4.38.38-3.32 2.88 1 4.28L12 15.4z"}));t.a=c},762:function(e,t,r){"use strict";r.d(t,"a",(function(){return c}));var o=r(1),n=r(32);const c=[{id:1,name:"WordPress Pennant",variation:"",permalink:"https://example.org",sku:"wp-pennant",short_description:Object(o.__)("Fly your WordPress banner with this beauty! Deck out your office space or add it to your kids walls. This banner will spruce up any space it’s hung!",'woocommerce'),description:"Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.",price:"7.99",price_html:'<span class="woocommerce-Price-amount amount"><span class="woocommerce-Price-currencySymbol">$</span>7.99</span>',images:[{id:1,src:n.m+"previews/pennant.jpg",thumbnail:n.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(o.__)("Add to cart",'woocommerce'),description:Object(o.__)("Add to cart",'woocommerce')},has_options:!1,is_purchasable:!0,is_in_stock:!0,on_sale:!0}]},79:function(e,t){e.exports=window.ReactDOM},8:function(e,t){e.exports=window.React},82:function(e,t){e.exports=window.wp.viewport},858:function(e,t,r){"use strict";r.r(t);var o=r(0),n=r(1),c=r(9),a=r(14),i=r(3),s=r(55),l=r(761),u=(r(759),r(760),r(762));const d={attributes:{contentAlign:"center",dimRatio:50,editMode:!1,height:Object(i.getSetting)("default_height",500),mediaSrc:"",showDesc:!0,productId:"preview",previewProduct:u.a[0]}};var p=r(7),b=r.n(p),g=r(16),m=r.n(g),h=r(10),w=r(4),f=r(5),O=r.n(f),j=r(12),_=r(6),v=(r(2),r(135)),k=r(100),y=r(476);function S(e){return e&&e.images&&e.images.length&&e.images[0].src||""}var E=Object(j.compose)([y.a,Object(c.withColors)({overlayColor:"background-color"}),w.withSpokenMessages,Object(h.withSelect)((e,t,r)=>{var o,n;let{clientId:c}=t,{dispatch:a}=r;const i=e("core/block-editor").getBlock(c),s=(null==i||null===(o=i.innerBlocks[0])||void 0===o?void 0:o.clientId)||"";return{updateBlockAttributes:e=>{s&&a("core/block-editor").updateBlockAttributes(s,e)},currentButtonAttributes:(null==i||null===(n=i.innerBlocks[0])||void 0===n?void 0:n.attributes)||{}}}),Object(j.createHigherOrderComponent)(e=>{class t extends o.Component{constructor(){super(...arguments),m()(this,"state",{doUrlUpdate:!1}),m()(this,"triggerUrlUpdate",()=>{this.setState({doUrlUpdate:!0})})}componentDidUpdate(){const{attributes:e,updateBlockAttributes:t,currentButtonAttributes:r,product:o}=this.props;this.state.doUrlUpdate&&!e.editMode&&null!=o&&o.permalink&&null!=r&&r.url&&o.permalink!==r.url&&(t({...r,url:o.permalink}),this.setState({doUrlUpdate:!1}))}render(){return Object(o.createElement)(e,b()({triggerUrlUpdate:this.triggerUrlUpdate},this.props))}}return t},"withUpdateButtonAttributes")])(e=>{let{attributes:t,debouncedSpeak:r,error:a,getProduct:u,isLoading:d,isSelected:p,overlayColor:b,product:g,setAttributes:m,setOverlayColor:h,triggerUrlUpdate:f=(()=>{})}=e;const j=()=>{const{contentAlign:e,editMode:r,mediaSrc:a}=t,i=t.mediaId||function(e){return e&&e.images&&e.images.length&&e.images[0].id||0}(g);return Object(o.createElement)(c.BlockControls,null,Object(o.createElement)(c.AlignmentToolbar,{value:e,onChange:e=>{m({contentAlign:e})}}),Object(o.createElement)(c.MediaReplaceFlow,{mediaId:i,mediaURL:a,accept:"image/*",onSelect:e=>{m({mediaId:e.id,mediaSrc:e.url})},allowedTypes:["image"]}),Object(o.createElement)(w.ToolbarGroup,{controls:[{icon:"edit",title:Object(n.__)("Edit selected product",'woocommerce'),onClick:()=>m({editMode:!r}),isActive:r}]}))},{editMode:y}=t;return a?Object(o.createElement)(k.a,{className:"wc-block-featured-product-error",error:a,isLoading:d,onRetry:u}):y?Object(o.createElement)(o.Fragment,null,j(),Object(o.createElement)(w.Placeholder,{icon:Object(o.createElement)(s.a,{srcElement:l.a}),label:Object(n.__)("Featured Product",'woocommerce'),className:"wc-block-featured-product"},Object(n.__)("Visually highlight a product or variation and encourage prompt action",'woocommerce'),Object(o.createElement)("div",{className:"wc-block-featured-product__selection"},Object(o.createElement)(v.a,{selected:t.productId||0,showVariations:!0,onChange:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];const t=e[0]?e[0].id:0;m({productId:t,mediaId:0,mediaSrc:""}),f()}}),Object(o.createElement)(w.Button,{isPrimary:!0,onClick:()=>{m({editMode:!1}),r(Object(n.__)("Showing Featured Product block preview.",'woocommerce'))}},Object(n.__)("Done",'woocommerce'))))):Object(o.createElement)(o.Fragment,null,j(),(()=>{const e=t.mediaSrc||S(g),{focalPoint:r={x:.5,y:.5}}=t,a="function"==typeof w.FocalPointPicker;return Object(o.createElement)(c.InspectorControls,{key:"inspector"},Object(o.createElement)(w.PanelBody,{title:Object(n.__)("Content",'woocommerce')},Object(o.createElement)(w.ToggleControl,{label:Object(n.__)("Show description",'woocommerce'),checked:t.showDesc,onChange:()=>m({showDesc:!t.showDesc})}),Object(o.createElement)(w.ToggleControl,{label:Object(n.__)("Show price",'woocommerce'),checked:t.showPrice,onChange:()=>m({showPrice:!t.showPrice})})),Object(o.createElement)(c.PanelColorSettings,{title:Object(n.__)("Overlay",'woocommerce'),colorSettings:[{value:b.color,onChange:h,label:Object(n.__)("Overlay Color",'woocommerce')}]},!!e&&Object(o.createElement)(o.Fragment,null,Object(o.createElement)(w.RangeControl,{label:Object(n.__)("Background Opacity",'woocommerce'),value:t.dimRatio,onChange:e=>m({dimRatio:e}),min:0,max:100,step:10}),a&&Object(o.createElement)(w.FocalPointPicker,{label:Object(n.__)("Focal Point Picker",'woocommerce'),url:e,value:r,onChange:e=>m({focalPoint:e})}))))})(),g?(()=>{const{className:e,contentAlign:r,dimRatio:a,focalPoint:s,height:l,showDesc:u,showPrice:h}=t,f=O()("wc-block-featured-product",{"is-selected":p&&"preview"!==t.productId,"is-loading":!g&&d,"is-not-found":!g&&!d,"has-background-dim":0!==a},0===(j=a)||50===j?null:"has-background-dim-"+10*Math.round(j/10),"center"!==r&&`has-${r}-content`,e);var j;const v=(k=t.mediaSrc||g,Object(_.isObject)(k)&&(k=S(k)),k?{backgroundImage:`url(${k})`}:{});var k;if(b.color&&(v.backgroundColor=b.color),s){const e=100*s.x,t=100*s.y;v.backgroundPosition=`${e}% ${t}%`}return Object(o.createElement)(w.ResizableBox,{className:f,size:{height:l},minHeight:Object(i.getSetting)("min_height",500),enable:{bottom:!0},onResizeStop:(e,t,r)=>{m({height:parseInt(r.style.height,10)})},style:v},Object(o.createElement)("div",{className:"wc-block-featured-product__wrapper"},Object(o.createElement)("h2",{className:"wc-block-featured-product__title",dangerouslySetInnerHTML:{__html:g.name}}),!Object(_.isEmpty)(g.variation)&&Object(o.createElement)("h3",{className:"wc-block-featured-product__variation",dangerouslySetInnerHTML:{__html:g.variation}}),u&&Object(o.createElement)("div",{className:"wc-block-featured-product__description",dangerouslySetInnerHTML:{__html:g.short_description}}),h&&Object(o.createElement)("div",{className:"wc-block-featured-product__price",dangerouslySetInnerHTML:{__html:g.price_html}}),Object(o.createElement)("div",{className:"wc-block-featured-product__link"},(()=>{const e=O()("wp-block-button__link","is-style-fill");return"preview"===t.productId?Object(o.createElement)("div",{className:"wp-block-button aligncenter",style:{width:"100%"}},Object(o.createElement)(c.RichText.Content,{tagName:"a",className:e,href:g.permalink,title:t.linkText,style:{backgroundColor:"vivid-green-cyan",borderRadius:"5px"},value:t.linkText,target:g.permalink})):Object(o.createElement)(c.InnerBlocks,{template:[["core/button",{text:Object(n.__)("Shop now",'woocommerce'),url:g.permalink,align:"center"}]],templateLock:"all"})})())))})():Object(o.createElement)(w.Placeholder,{className:"wc-block-featured-product",icon:Object(o.createElement)(s.a,{srcElement:l.a}),label:Object(n.__)("Featured Product",'woocommerce')},d?Object(o.createElement)(w.Spinner,null):Object(n.__)("No product is selected.",'woocommerce')))});Object(a.registerBlockType)("woocommerce/featured-product",{title:Object(n.__)("Featured Product",'woocommerce'),icon:{src:Object(o.createElement)(s.a,{srcElement:l.a}),foreground:"#7f54b3"},category:"woocommerce",keywords:[Object(n.__)("WooCommerce",'woocommerce')],description:Object(n.__)("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(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(n.__)("Shop now",'woocommerce')},productId:{type:"number"},showDesc:{type:"boolean",default:!0},showPrice:{type:"boolean",default:!0},previewProduct:{type:"object",default:null}},edit:e=>Object(o.createElement)(E,e),save:()=>Object(o.createElement)(c.InnerBlocks.Content,null)})},89:function(e,t){e.exports=window.wp.date},9:function(e,t){e.exports=window.wp.blockEditor}});