File "single-product.js"

Full Path: /home/vantageo/public_html/cache/cache/cache/cache/cache/.wp-cli/wp-content/plugins/woocommerce/packages/woocommerce-blocks/build/single-product.js
File size: 35.83 KB
MIME-type: text/plain
Charset: utf-8

this.wc=this.wc||{},this.wc.blocks=this.wc.blocks||{},this.wc.blocks["single-product"]=function(e){function t(t){for(var n,i,a=t[0],s=t[1],u=t[2],p=0,d=[];p<a.length;p++)i=a[p],Object.prototype.hasOwnProperty.call(o,i)&&o[i]&&d.push(o[i][0]),o[i]=0;for(n in s)Object.prototype.hasOwnProperty.call(s,n)&&(e[n]=s[n]);for(l&&l(t);d.length;)d.shift()();return c.push.apply(c,u||[]),r()}function r(){for(var e,t=0;t<c.length;t++){for(var r=c[t],n=!0,a=1;a<r.length;a++){var s=r[a];0!==o[s]&&(n=!1)}n&&(c.splice(t--,1),e=i(i.s=r[0]))}return e}var n={},o={38:0},c=[];function i(t){if(n[t])return n[t].exports;var r=n[t]={i:t,l:!1,exports:{}};return e[t].call(r.exports,r,r.exports,i),r.l=!0,r.exports}i.e=function(e){var t=[],r=o[e];if(0!==r)if(r)t.push(r[2]);else{var n=new Promise((function(t,n){r=o[e]=[t,n]}));t.push(r[2]=n);var c,a=document.createElement("script");a.charset="utf-8",a.timeout=120,i.nc&&a.setAttribute("nonce",i.nc),a.src=function(e){return i.p+""+({1:"atomic-block-components/add-to-cart--atomic-block-components/button--atomic-block-components/image---a7e2bb9b",2:"atomic-block-components/add-to-cart--atomic-block-components/image--atomic-block-components/title",3:"atomic-block-components/add-to-cart--atomic-block-components/button",4:"atomic-block-components/sale-badge",8:"atomic-block-components/add-to-cart",9:"atomic-block-components/button",10:"atomic-block-components/category-list",11:"atomic-block-components/image",12:"atomic-block-components/price",13:"atomic-block-components/rating",14:"atomic-block-components/sku",15:"atomic-block-components/stock-indicator",16:"atomic-block-components/summary",17:"atomic-block-components/tag-list",18:"atomic-block-components/title"}[e]||e)+".js"}(e);var s=new Error;c=function(t){a.onerror=a.onload=null,clearTimeout(u);var r=o[e];if(0!==r){if(r){var n=t&&("load"===t.type?"missing":t.type),c=t&&t.target&&t.target.src;s.message="Loading chunk "+e+" failed.\n("+n+": "+c+")",s.name="ChunkLoadError",s.type=n,s.request=c,r[1](s)}o[e]=void 0}};var u=setTimeout((function(){c({type:"timeout",target:a})}),12e4);a.onerror=a.onload=c,document.head.appendChild(a)}return Promise.all(t)},i.m=e,i.c=n,i.d=function(e,t,r){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(i.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)i.d(r,n,function(t){return e[t]}.bind(null,n));return r},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="",i.oe=function(e){throw console.error(e),e};var a=window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[],s=a.push.bind(a);a.push=t,a=a.slice();for(var u=0;u<a.length;u++)t(a[u]);var l=s;return c.push([893,0]),r()}({0:function(e,t){!function(){e.exports=this.wp.element}()},1:function(e,t){!function(){e.exports=this.wp.i18n}()},106:function(e,t){},107:function(e,t){},108:function(e,t){},109:function(e,t){},110:function(e,t){},111:function(e,t){},112:function(e,t){},113:function(e,t){},114:function(e,t){},115:function(e,t){},116:function(e,t){},117:function(e,t){},118:function(e,t){},12:function(e,t){!function(){e.exports=this.regeneratorRuntime}()},127:function(e,t,r){"use strict";var n=r(0),o=r(1),c=r(57),i=r(165),a=r(5),s=r(22),u=r(38);t.a=function(e){var t=(Object(u.useProductDataContext)().product||{}).id||e.productId||0;return t?Object(n.createElement)(s.InspectorControls,null,Object(n.createElement)("div",{className:"wc-block-single-product__edit-card"},Object(n.createElement)("div",{className:"wc-block-single-product__edit-card-title"},Object(n.createElement)("a",{href:"".concat(a.ADMIN_URL,"post.php?post=").concat(t,"&action=edit"),target:"_blank",rel:"noopener noreferrer"},Object(o.__)("Edit this product's details",'woocommerce'),Object(n.createElement)(c.a,{srcElement:i.a,size:16}))),Object(n.createElement)("div",{className:"wc-block-single-product__edit-card-description"},Object(o.__)("Edit details such as title, price, description and more.",'woocommerce')))):null}},137:function(e,t){!function(){e.exports=this.wp.wordcount}()},139:function(e,t,r){"use strict";var n=r(30),o=r.n(n),c=r(10),i=r.n(c),a=r(0),s=r(1),u=r(6),l=(r(2),r(45)),p=r(3),d=r(7),f=r.n(d),m=r(15),b=r.n(m),h=r(16),g=r.n(h),v=r(17),O=r.n(v),w=r(18),j=r.n(w),y=r(9),k=r.n(y),E=r(142);function _(e){var t=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}}();return function(){var r,n=k()(e);if(t){var o=k()(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return j()(this,r)}}var P=Object(E.a)((function(e){var t=function(t){O()(n,t);var r=_(n);function n(){return b()(this,n),r.apply(this,arguments)}return g()(n,[{key:"render",value:function(){var t=this.props.selected,r=null==t;return Object(a.createElement)(e,i()({},this.props,{selected:r?[]:[t]}))}}]),n}(a.Component);return t.defaultProps={selected:null},t}),"withTransformSingleSelectToMultipleSelect"),S=r(285),x=r(28),B=r.n(x),C=r(11),R=r.n(C),N=r(4),A=r.n(N),I=r(12),M=r.n(I),z=r(33),T=r.n(z),L=r(35),D=r(37);function V(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 G(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?V(Object(r),!0).forEach((function(t){A()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):V(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function H(e){var t=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}}();return function(){var r,n=k()(e);if(t){var o=k()(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return j()(this,r)}}var U=Object(E.a)((function(e){var t=function(t){O()(n,t);var r=H(n);function n(){var e;b()(this,n);for(var t=arguments.length,o=new Array(t),c=0;c<t;c++)o[c]=arguments[c];return e=r.call.apply(r,[this].concat(o)),A()(R()(e),"state",{error:null,loading:!1,variations:{}}),A()(R()(e),"loadVariations",(function(){var t=e.props.products,r=e.state,n=r.loading,o=r.variations;if(!n){var c=e.getExpandedProduct();if(c&&!o[c]){var i=t.find((function(e){return e.id===c}));i.variations&&0!==i.variations.length?(e.setState({loading:!0}),Object(L.g)(c).then((function(t){var r=t.map((function(e){return G(G({},e),{},{parent:c})}));e.setState({variations:G(G({},e.state.variations),{},A()({},c,r)),loading:!1,error:null})})).catch(function(){var t=B()(M.a.mark((function t(r){var n;return M.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(D.a)(r);case 2:n=t.sent,e.setState({variations:G(G({},e.state.variations),{},A()({},c,null)),loading:!1,error:n});case 4:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}())):e.setState({variations:G(G({},e.state.variations),{},A()({},c,null)),loading:!1,error:null})}}})),e}return g()(n,[{key:"componentDidMount",value:function(){var e=this.props,t=e.selected,r=e.showVariations;t&&r&&this.loadVariations()}},{key:"componentDidUpdate",value:function(e){var t=this.props,r=t.isLoading,n=t.selected;t.showVariations&&(!T()(e.selected,n)||e.isLoading&&!r)&&this.loadVariations()}},{key:"isProductId",value:function(e){return this.props.products.some((function(t){return t.id===e}))}},{key:"findParentProduct",value:function(e){return this.props.products.filter((function(t){return t.variations&&t.variations.find((function(t){return t.id===e}))}))[0].id}},{key:"getExpandedProduct",value:function(){var e=this.props,t=e.isLoading,r=e.selected;if(!e.showVariations)return null;var n=r&&r.length?r[0]:null;return n?this.prevSelectedItem=n:this.prevSelectedItem&&(t||this.isProductId(this.prevSelectedItem)||(n=this.prevSelectedItem)),!t&&n?this.isProductId(n)?n:this.findParentProduct(n):null}},{key:"render",value:function(){var t=this.props,r=t.error,n=t.isLoading,o=this.state,c=o.error,s=o.loading,u=o.variations;return Object(a.createElement)(e,i()({},this.props,{error:c||r,expandedProduct:this.getExpandedProduct(),isLoading:n,variations:u,variationsLoading:s}))}}]),n}(a.Component);return A()(t,"defaultProps",{selected:[],showVariations:!1}),t}),"withProductVariations"),q=r(57),F=r(31),Q=Object(a.createElement)(F.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(a.createElement)("path",{fill:"#1E8CBE",d:"M12 7c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5zm0-5C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"})),W=Object(a.createElement)(F.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(a.createElement)("path",{fill:"#757575",d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"})),J=r(43);r(195);function Y(e,t){if(!t)return e;var r=new RegExp(Object(u.escapeRegExp)(t),"ig");return e.replace(r,"<strong>$&</strong>")}var $=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return e?Object(a.createElement)(q.a,{srcElement:Q}):Object(a.createElement)(q.a,{srcElement:W})},K={list:Object(s.__)("Products",'woocommerce'),noItems:Object(s.__)("Your store doesn't have any products.",'woocommerce'),search:Object(s.__)("Search for a product to display",'woocommerce'),updated:Object(s.__)("Product search results updated.",'woocommerce')},X=function(e){var t=e.expandedProduct,r=e.error,n=e.isLoading,c=e.onChange,d=e.onSearch,m=e.products,b=e.renderItem,h=e.selected,g=e.showVariations,v=e.variations,O=e.variationsLoading,w=function(e){var r=e.item,n=e.search,o=e.depth,c=void 0===o?0:o,d=e.isSelected,m=e.onSelect,b=r.variations&&Array.isArray(r.variations)?r.variations.length:0,h=f()("woocommerce-search-product__item","woocommerce-search-list__item","depth-".concat(c),{"is-searching":n.length>0,"is-skip-level":0===c&&0!==r.parent,"is-variable":b>0}),g=Object.assign({},e);delete g.isSingle;var v={role:"menuitemradio"};return r.breadcrumbs.length&&(v["aria-label"]="".concat(r.breadcrumbs[0],": ").concat(r.name)),b&&(v["aria-expanded"]=r.id===t),r.breadcrumbs.length?(Object(u.isEmpty)(r.variation)||(r.name=r.variation),Object(a.createElement)(l.b,i()({className:h},e,v))):[Object(a.createElement)(p.MenuItem,i()({key:"product-".concat(r.id),isSelected:d},g,v,{className:h,onClick:function(){m(r)()}}),Object(a.createElement)("span",{className:"woocommerce-search-list__item-state"},$(d)),Object(a.createElement)("span",{className:"woocommerce-search-list__item-label"},Object(a.createElement)("span",{className:"woocommerce-search-list__item-name",dangerouslySetInnerHTML:{__html:Y(r.name,n)}})),b?Object(a.createElement)("span",{className:"woocommerce-search-list__item-variation-count"},Object(s.sprintf)(Object(s._n)("%d variation","%d variations",b,'woocommerce'),b)):null),t===r.id&&b>0&&O&&Object(a.createElement)("div",{key:"loading",className:"woocommerce-search-list__item woocommerce-search-product__itemdepth-1 is-loading is-not-active"},Object(a.createElement)(p.Spinner,null))]};if(r)return Object(a.createElement)(J.a,{error:r});var j=v&&v[t]?v[t]:[],y=[].concat(o()(m),o()(j));return Object(a.createElement)(l.a,{className:"woocommerce-products",list:y,isLoading:n,isSingle:!0,selected:y.filter((function(e){var t=e.id;return h.includes(t)})),onChange:c,renderItem:b||(g?w:null),onSearch:d,messages:K,isHierarchical:!0})};X.defaultProps={expandedProduct:null,selected:[],showVariations:!1};t.a=P(Object(S.a)(U(X)))},14:function(e,t,r){"use strict";r.d(t,"m",(function(){return c})),r.d(t,"k",(function(){return i})),r.d(t,"l",(function(){return a})),r.d(t,"h",(function(){return u})),r.d(t,"c",(function(){return l})),r.d(t,"d",(function(){return p})),r.d(t,"g",(function(){return d})),r.d(t,"f",(function(){return f})),r.d(t,"j",(function(){return m})),r.d(t,"i",(function(){return b})),r.d(t,"a",(function(){return h})),r.d(t,"b",(function(){return g})),r.d(t,"e",(function(){return v})),r.d(t,"p",(function(){return w})),r.d(t,"q",(function(){return j})),r.d(t,"n",(function(){return y})),r.d(t,"o",(function(){return k}));var n,o=r(5),c=Object(o.getSetting)("wcBlocksConfig",{buildPhase:1,pluginUrl:"",productCount:0,restApiRoutes:{},wordCountType:"words"}),i=c.pluginUrl+"assets/",a=c.pluginUrl+"build/",s=c.buildPhase,u=null===(n=o.STORE_PAGES.shop)||void 0===n?void 0:n.permalink,l=o.STORE_PAGES.checkout.id,p=o.STORE_PAGES.checkout.permalink,d=o.STORE_PAGES.privacy.permalink,f=o.STORE_PAGES.privacy.title,m=o.STORE_PAGES.terms.permalink,b=o.STORE_PAGES.terms.title,h=o.STORE_PAGES.cart.id,g=o.STORE_PAGES.cart.permalink,v=o.STORE_PAGES.myaccount.permalink?o.STORE_PAGES.myaccount.permalink:Object(o.getSetting)("wpLoginUrl","/wp-login.php"),O=r(25),w=function(e,t){if(s>2)return Object(O.registerBlockType)(e,t)},j=function(e,t){if(s>1)return Object(O.registerBlockType)(e,t)},y=function(){return s>2},k=function(){return s>1}},140:function(e,t,r){"use strict";var n=r(15),o=r.n(n),c=r(16),i=r.n(c),a=r(11),s=r.n(a),u=r(17),l=r.n(u),p=r(18),d=r.n(p),f=r(9),m=r.n(f),b=r(4),h=r.n(b),g=r(0),v=(r(2),r(8)),O=r(1),w=r(14),j=function(e){var t=e.imageUrl,r=void 0===t?"".concat(w.k,"img/block-error.svg"):t,n=e.header,o=void 0===n?Object(O.__)("Oops!",'woocommerce'):n,c=e.text,i=void 0===c?Object(O.__)("There was an error loading the content.",'woocommerce'):c,a=e.errorMessage,s=e.errorMessagePrefix,u=void 0===s?Object(O.__)("Error:",'woocommerce'):s;return Object(g.createElement)("div",{className:"wc-block-error wc-block-components-error"},r&&Object(g.createElement)("img",{className:"wc-block-error__image wc-block-components-error__image",src:r,alt:""}),Object(g.createElement)("div",{className:"wc-block-error__content wc-block-components-error__content"},o&&Object(g.createElement)("p",{className:"wc-block-error__header wc-block-components-error__header"},o),i&&Object(g.createElement)("p",{className:"wc-block-error__text wc-block-components-error__text"},i),a&&Object(g.createElement)("p",{className:"wc-block-error__message wc-block-components-error__message"},u?u+" ":"",a)))};r(250);function y(e){var t=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}}();return function(){var r,n=m()(e);if(t){var o=m()(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return d()(this,r)}}var k=function(e){l()(r,e);var t=y(r);function r(){var e;o()(this,r);for(var n=arguments.length,c=new Array(n),i=0;i<n;i++)c[i]=arguments[i];return e=t.call.apply(t,[this].concat(c)),h()(s()(e),"state",{errorMessage:"",hasError:!1}),e}return i()(r,[{key:"render",value:function(){var e=this.props,t=e.header,r=e.imageUrl,n=e.showErrorMessage,o=e.text,c=e.errorMessagePrefix,i=e.renderError,a=this.state,s=a.errorMessage;return a.hasError?"function"==typeof i?i({errorMessage:s}):Object(g.createElement)(j,{errorMessage:n?s:null,header:t,imageUrl:r,text:o,errorMessagePrefix:c}):this.props.children}}],[{key:"getDerivedStateFromError",value:function(e){return void 0!==e.statusText&&void 0!==e.status?{errorMessage:Object(g.createElement)(g.Fragment,null,Object(g.createElement)("strong",null,e.status),": ",e.statusText),hasError:!0}:{errorMessage:e.message,hasError:!0}}}]),r}(v.Component);k.defaultProps={showErrorMessage:!0};t.a=k},141:function(e,t,r){"use strict";var n=r(0),o=r(31),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},144:function(e,t){},165:function(e,t,r){"use strict";var n=r(0),o=r(31),c=Object(n.createElement)(o.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(n.createElement)("mask",{id:"external-mask",width:"24",height:"24",x:"0",y:"0",maskUnits:"userSpaceOnUse"},Object(n.createElement)("path",{fill:"#fff",d:"M6.3431 6.3431v1.994l7.8984.0072-8.6055 8.6054 1.4142 1.4143 8.6055-8.6055.0071 7.8984h1.994V6.3431H6.3431z"})),Object(n.createElement)("g",{mask:"url(#external-mask)"},Object(n.createElement)("path",{d:"M0 0h24v24H0z"})));t.a=c},19:function(e,t){!function(){e.exports=this.wp.apiFetch}()},195:function(e,t){},199:function(e,t){!function(){e.exports=this.wp.warning}()},20:function(e,t){!function(){e.exports=this.wp.url}()},21:function(e,t){!function(){e.exports=this.wp.data}()},22:function(e,t){!function(){e.exports=this.wp.blockEditor}()},25:function(e,t){!function(){e.exports=this.wp.blocks}()},250:function(e,t){},26:function(e,t){!function(){e.exports=this.wp.htmlEntities}()},27:function(e,t){!function(){e.exports=this.moment}()},285:function(e,t,r){"use strict";var n=r(10),o=r.n(n),c=r(28),i=r.n(c),a=r(15),s=r.n(a),u=r(16),l=r.n(u),p=r(11),d=r.n(p),f=r(17),m=r.n(f),b=r(18),h=r.n(b),g=r(9),v=r.n(g),O=r(0),w=r(12),j=r.n(w),y=r(6),k=r(142),E=(r(2),r(14)),_=r(35),P=r(37);function S(e){var t=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}}();return function(){var r,n=v()(e);if(t){var o=v()(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return h()(this,r)}}var x=Object(k.a)((function(e){var t=function(t){m()(c,t);var r,n=S(c);function c(){var e;return s()(this,c),(e=n.apply(this,arguments)).state={list:[],loading:!0},e.setError=e.setError.bind(d()(e)),e.debouncedOnSearch=Object(y.debounce)(e.onSearch.bind(d()(e)),400),e}return l()(c,[{key:"componentDidMount",value:function(){var e=this,t=this.props.selected;Object(_.h)({selected:t}).then((function(t){e.setState({list:t,loading:!1})})).catch(this.setError)}},{key:"componentWillUnmount",value:function(){this.debouncedOnSearch.cancel()}},{key:"onSearch",value:function(e){var t=this,r=this.props.selected;Object(_.h)({selected:r,search:e}).then((function(e){t.setState({list:e,loading:!1})})).catch(this.setError)}},{key:"setError",value:(r=i()(j.a.mark((function e(t){var r;return j.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Object(P.a)(t);case 2:r=e.sent,this.setState({list:[],loading:!1,error:r});case 4:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"render",value:function(){var t=this,r=this.state,n=r.error,c=r.list,i=r.loading;return Object(O.createElement)(e,o()({},this.props,{error:n,products:c,isLoading:i,onSearch:E.m.productCount>100?function(e){t.setState({loading:!0}),t.debouncedOnSearch(e)}:null}))}}]),c}(O.Component);return t.defaultProps={selected:[]},t}),"withSearchedProducts");t.a=x},3:function(e,t){!function(){e.exports=this.wp.components}()},31:function(e,t){!function(){e.exports=this.wp.primitives}()},33:function(e,t){!function(){e.exports=this.wp.isShallowEqual}()},34:function(e,t){!function(){e.exports=this.wp.dataControls}()},35:function(e,t,r){"use strict";r.d(t,"h",(function(){return f})),r.d(t,"e",(function(){return m})),r.d(t,"b",(function(){return b})),r.d(t,"i",(function(){return h})),r.d(t,"f",(function(){return g})),r.d(t,"c",(function(){return v})),r.d(t,"d",(function(){return O})),r.d(t,"g",(function(){return w})),r.d(t,"a",(function(){return j}));var n=r(4),o=r.n(n),c=r(20),i=r(19),a=r.n(i),s=r(6),u=r(5),l=r(14);function p(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 d(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?p(Object(r),!0).forEach((function(t){o()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):p(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var f=function(e){var t=e.selected,r=void 0===t?[]:t,n=e.search,o=void 0===n?"":n,i=e.queryArgs,u=function(e){var t=e.selected,r=void 0===t?[]:t,n=e.search,o=void 0===n?"":n,i=e.queryArgs,a=void 0===i?[]:i,s=l.m.productCount>100,u={per_page:s?100:0,catalog_visibility:"any",search:o,orderby:"title",order:"asc"},p=[Object(c.addQueryArgs)("/wc/store/products",d(d({},u),a))];return s&&r.length&&p.push(Object(c.addQueryArgs)("/wc/store/products",{catalog_visibility:"any",include:r})),p}({selected:r,search:o,queryArgs:void 0===i?[]:i});return Promise.all(u.map((function(e){return a()({path:e})}))).then((function(e){return Object(s.uniqBy)(Object(s.flatten)(e),"id").map((function(e){return d(d({},e),{},{parent:0})}))})).catch((function(e){throw e}))},m=function(e){return a()({path:"/wc/store/products/".concat(e)})},b=function(){return a()({path:"wc/store/products/attributes"})},h=function(e){return a()({path:"wc/store/products/attributes/".concat(e,"/terms")})},g=function(e){var t=e.selected,r=function(e){var t=e.selected,r=void 0===t?[]:t,n=e.search,o=Object(u.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(s.uniqBy)(Object(s.flatten)(e),"id")}))},v=function(e){return a()({path:Object(c.addQueryArgs)("wc/store/products/categories",d({per_page:0},e))})},O=function(e){return a()({path:"wc/store/products/categories/".concat(e)})},w=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))}},36:function(e,t){!function(){e.exports=this.wc.wcBlocksData}()},37:function(e,t,r){"use strict";r.d(t,"a",(function(){return s})),r.d(t,"b",(function(){return u}));var n=r(28),o=r.n(n),c=r(12),i=r.n(c),a=r(1),s=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(t){return e.apply(this,arguments)}}(),u=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')}},38:function(e,t){!function(){e.exports=this.wc.wcSharedContext}()},42:function(e,t){!function(){e.exports=this.wp.escapeHtml}()},43:function(e,t,r){"use strict";var n=r(0),o=r(1),c=(r(2),r(42));t.a=function(e){var t,r,i,a=e.error;return Object(n.createElement)("div",{className:"wc-block-error-message"},(r=(t=a).message,i=t.type,r?"general"===i?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"===i?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')))}},48:function(e,t){!function(){e.exports=this.wp.keycodes}()},5:function(e,t){!function(){e.exports=this.wc.wcSettings}()},50:function(e,t){!function(){e.exports=this.wc.wcBlocksRegistry}()},529:function(e,t,r){"use strict";var n=r(10),o=r.n(n),c=r(28),i=r.n(c),a=r(15),s=r.n(a),u=r(16),l=r.n(u),p=r(11),d=r.n(p),f=r(17),m=r.n(f),b=r(18),h=r.n(b),g=r(9),v=r.n(g),O=r(4),w=r.n(O),j=r(0),y=r(12),k=r.n(y),E=r(142),_=r(35),P=r(37);function S(e){var t=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}}();return function(){var r,n=v()(e);if(t){var o=v()(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return h()(this,r)}}var x=Object(E.a)((function(e){return function(t){m()(n,t);var r=S(n);function n(){var e;s()(this,n);for(var t=arguments.length,o=new Array(t),c=0;c<t;c++)o[c]=arguments[c];return e=r.call.apply(r,[this].concat(o)),w()(d()(e),"state",{error:null,loading:!1,product:"preview"===e.props.attributes.productId?e.props.attributes.previewProduct:null}),w()(d()(e),"loadProduct",(function(){var t=e.props.attributes.productId;"preview"!==t&&(t?(e.setState({loading:!0}),Object(_.e)(t).then((function(t){e.setState({product:t,loading:!1,error:null})})).catch(function(){var t=i()(k.a.mark((function t(r){var n;return k.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(P.a)(r);case 2:n=t.sent,e.setState({product:null,loading:!1,error:n});case 4:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}())):e.setState({product:null,loading:!1,error:null}))})),e}return l()(n,[{key:"componentDidMount",value:function(){this.loadProduct()}},{key:"componentDidUpdate",value:function(e){e.attributes.productId!==this.props.attributes.productId&&this.loadProduct()}},{key:"render",value:function(){var t=this.state,r=t.error,n=t.loading,c=t.product;return Object(j.createElement)(e,o()({},this.props,{error:r,getProduct:this.loadProduct,isLoading:n,product:c}))}}]),n}(j.Component)}),"withProduct");t.a=x},54:function(e,t){!function(){e.exports=this.wp.hooks}()},57:function(e,t,r){"use strict";var n=r(4),o=r.n(n),c=r(23),i=r.n(c),a=r(0);function s(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=i()(e,["srcElement","size"]);return Object(a.isValidElement)(t)?Object(a.cloneElement)(t,function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?s(Object(r),!0).forEach((function(t){o()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):s(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({width:n,height:n},c)):null}},58:function(e,t){!function(){e.exports=this.wc.priceFormat}()},6:function(e,t){!function(){e.exports=this.lodash}()},66:function(e,t){!function(){e.exports=this.wp.deprecated}()},69:function(e,t){!function(){e.exports=this.wc.wcSharedHocs}()},70:function(e,t){!function(){e.exports=this.wp.dom}()},77:function(e,t){!function(){e.exports=this.wp.a11y}()},78:function(e,t){!function(){e.exports=this.ReactDOM}()},8:function(e,t){!function(){e.exports=this.React}()},83:function(e,t){!function(){e.exports=this.wp.viewport}()},84:function(e,t){!function(){e.exports=this.wp.date}()},893:function(e,t,r){e.exports=r(899)},894:function(e,t){},899:function(e,t,r){"use strict";r.r(t);var n=r(1),o=r(14),c=r(13),i=r.n(c),a=r(0),s=r(3),u=r(529),l=r(140),p=r(127),d=Object(a.createElement)("img",{src:o.k+"img/single-product-preview.svg",alt:"",width:"230",height:"250",style:{width:"100%"}}),f=r(22),m=(r(894),r(94)),b=function(e){var t=e.error,r=e.isLoading,n=e.getProduct;return Object(a.createElement)(m.a,{className:"wc-block-single-product-error",error:t,isLoading:r,onRetry:n})},h=r(139),g=function(e){var t=e.attributes,r=e.setAttributes;return Object(a.createElement)(h.a,{selected:t.productId||0,showVariations:!0,onChange:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=e[0]?e[0].id:0;r({productId:t})}})},v=function(e){var t=e.isEditing,r=e.setIsEditing;return Object(a.createElement)(f.BlockControls,null,Object(a.createElement)(s.ToolbarGroup,{controls:[{icon:"edit",title:Object(n.__)("Edit",'woocommerce'),onClick:function(){return r(!t)},isActive:t}]}))},O=r(21),w=r(38),j=r(25),y=r(57),k=r(31),E=Object(a.createElement)(k.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(a.createElement)("path",{fill:"none",d:"M0 0h24v24H0z"}),Object(a.createElement)("path",{d:"M14 12c0-1.1-.9-2-2-2s-2 .9-2 2 .9 2 2 2 2-.9 2-2zm-2-9c-5 0-9 4-9 9H0l4 4 4-4H5a7 7 0 113 5.7l-1.5 1.4A9 9 0 1012 3z"})),_=r(30),P=r.n(_),S=Object(a.createElement)(k.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(a.createElement)("path",{fill:"none",d:"M0 0h24v24H0V0z"}),Object(a.createElement)("path",{d:"M21 4H3a2 2 0 00-2 2v13c0 1.1.9 2 2 2h18a2 2 0 002-2V6a2 2 0 00-2-2zM3 19V6h8v13H3zm18 0h-8V6h8v13zm-7-9.5h6V11h-6zm0 2.5h6v1.5h-6zm0 2.5h6V16h-6z"})),x=r(921),B="woocommerce/single-product",C=Object(n.__)("Single Product",'woocommerce'),R=Object(a.createElement)(y.a,{srcElement:S}),N=Object(n.__)("Display a single product.",'woocommerce'),A=[["core/columns",{},[["core/column",{},[["woocommerce/product-image",{showSaleBadge:!1}]]],["core/column",{},[["woocommerce/product-sale-badge"],["woocommerce/product-title",{headingLevel:2}],["woocommerce/product-rating"],["woocommerce/product-price"],["woocommerce/product-summary"],["woocommerce/product-stock-indicator"],["woocommerce/product-add-to-cart",{showFormElements:!0}],["woocommerce/product-sku"],["woocommerce/product-category-list"],["woocommerce/product-tag-list"]]]]]],I=["core/columns","core/column"].concat(P()(Object.keys(Object(x.a)(B)))),M=function(e){var t=e.isLoading,r=e.product,o=e.clientId,c=Object(O.useDispatch)("core/block-editor").replaceInnerBlocks,u=Object(a.useCallback)((function(){c(o,function e(t){return t.map((function(t){var r=i()(t,3),n=r[0],o=r[1],c=void 0===o?{}:o,a=r[2],s=void 0===a?[]:a,u=s?e(s):[];return Object(j.createBlock)(n,c,u)}))}(A),!1)}),[o,c]);return Object(a.createElement)(w.InnerBlockLayoutContextProvider,{parentName:B,parentClassName:"wc-block-single-product wc-block-layout"},Object(a.createElement)(w.ProductDataContextProvider,{product:r,isLoading:t},Object(a.createElement)(f.InspectorControls,null,Object(a.createElement)(s.PanelBody,{title:Object(n.__)("Layout",'woocommerce'),initialOpen:!0},Object(a.createElement)(s.Button,{label:Object(n.__)("Reset layout to default",'woocommerce'),onClick:u,isTertiary:!0,className:"wc-block-single-product__reset-layout"},Object(a.createElement)(y.a,{srcElement:E})," ",Object(n.__)("Reset layout",'woocommerce')))),Object(a.createElement)("div",{className:"wc-block-single-product wc-block-layout"},Object(a.createElement)(f.InnerBlocks,{template:A,allowedBlocks:I,templateLock:!1,renderAppender:!1}))))},z=Object(u.a)((function(e){var t=e.className,r=e.attributes,o=e.setAttributes,c=e.error,u=e.getProduct,m=e.product,h=e.isLoading,O=e.clientId,w=r.productId,j=r.isPreview,y=Object(a.useState)(!w),k=i()(y,2),E=k[0],_=k[1];return j?d:c?Object(a.createElement)(b,{error:c,isLoading:h,getProduct:u}):Object(a.createElement)("div",{className:t},Object(a.createElement)(l.a,{header:Object(n.__)("Single Product Block Error",'woocommerce')},Object(a.createElement)(v,{setIsEditing:_,isEditing:E}),E?Object(a.createElement)(s.Placeholder,{icon:R,label:C,className:"wc-block-single-product"},N,Object(a.createElement)("div",{className:"wc-block-single-product__selection"},Object(a.createElement)(g,{attributes:r,setAttributes:o}),Object(a.createElement)(s.Button,{isSecondary:!0,onClick:function(){_(!1)}},Object(n.__)("Done",'woocommerce')))):Object(a.createElement)(a.Fragment,null,Object(a.createElement)(f.InspectorControls,null,Object(a.createElement)(s.PanelBody,{title:Object(n.__)("Product",'woocommerce'),initialOpen:!1},Object(a.createElement)(g,{attributes:r,setAttributes:o}))),Object(a.createElement)(p.a,{productId:w}),Object(a.createElement)(M,{clientId:O,product:m,isLoading:h}))))})),T=r(7),L=r.n(T),D=function(e){var t=e.attributes;return Object(a.createElement)("div",{className:L()("is-loading",t.className)},Object(a.createElement)(f.InnerBlocks.Content,null))},V={isPreview:{type:"boolean",default:!1,save:!1},productId:{type:"number"}},G={title:C,icon:{src:R,foreground:"#96588a"},category:"woocommerce",keywords:[Object(n.__)("WooCommerce",'woocommerce')],description:N,supports:{align:["wide","full"],html:!1},example:{attributes:{isPreview:!0}},attributes:V,edit:z,save:D};Object(o.p)(B,G)},921:function(e,t,r){"use strict";r.d(t,"a",(function(){return i}));var n=r(50),o=r(0),c=r(14);r.p=c.l,Object(n.registerBlockComponent)({blockName:"woocommerce/product-price",component:Object(o.lazy)((function(){return Promise.all([r.e(0),r.e(12)]).then(r.bind(null,530))}))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-image",component:Object(o.lazy)((function(){return Promise.all([r.e(1),r.e(2),r.e(4),r.e(11)]).then(r.bind(null,943))}))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-title",component:Object(o.lazy)((function(){return Promise.all([r.e(1),r.e(2),r.e(18)]).then(r.bind(null,944))}))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-rating",component:Object(o.lazy)((function(){return r.e(13).then(r.bind(null,531))}))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-button",component:Object(o.lazy)((function(){return Promise.all([r.e(0),r.e(1),r.e(3),r.e(9)]).then(r.bind(null,532))}))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-summary",component:Object(o.lazy)((function(){return r.e(16).then(r.bind(null,533))}))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-sale-badge",component:Object(o.lazy)((function(){return r.e(4).then(r.bind(null,286))}))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-sku",component:Object(o.lazy)((function(){return r.e(14).then(r.bind(null,534))}))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-category-list",component:Object(o.lazy)((function(){return r.e(10).then(r.bind(null,535))}))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-tag-list",component:Object(o.lazy)((function(){return r.e(17).then(r.bind(null,536))}))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-stock-indicator",component:Object(o.lazy)((function(){return r.e(15).then(r.bind(null,537))}))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-add-to-cart",component:Object(o.lazy)((function(){return Promise.all([r.e(0),r.e(1),r.e(2),r.e(3),r.e(8)]).then(r.bind(null,945))}))});var i=function(e){return Object(n.getRegisteredBlockComponents)(e)}},94:function(e,t,r){"use strict";var n=r(0),o=r(1),c=(r(2),r(57)),i=r(141),a=r(7),s=r.n(a),u=r(3),l=r(43);r(144);t.a=function(e){var t=e.className,r=e.error,a=e.isLoading,p=e.onRetry;return Object(n.createElement)(u.Placeholder,{icon:Object(n.createElement)(c.a,{srcElement:i.a}),label:Object(o.__)("Sorry, an error occurred",'woocommerce'),className:s()("wc-block-api-error",t)},Object(n.createElement)(l.a,{error:r}),p&&Object(n.createElement)(n.Fragment,null,a?Object(n.createElement)(u.Spinner,null):Object(n.createElement)(u.Button,{isSecondary:!0,onClick:p},Object(o.__)("Retry",'woocommerce'))))}},96:function(e,t){!function(){e.exports=this.wp.autop}()}});