woocommerce/packages/woocommerce-blocks/build/single-product.js
2021-12-10 12:03:04 +00:00

5 lines
35 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

this.wc=this.wc||{},this.wc.blocks=this.wc.blocks||{},this.wc.blocks["single-product"]=function(e){function t(t){for(var n,a,i=t[0],s=t[1],u=t[2],d=0,p=[];d<i.length;d++)a=i[d],Object.prototype.hasOwnProperty.call(o,a)&&o[a]&&p.push(o[a][0]),o[a]=0;for(n in s)Object.prototype.hasOwnProperty.call(s,n)&&(e[n]=s[n]);for(l&&l(t);p.length;)p.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,i=1;i<r.length;i++){var s=r[i];0!==o[s]&&(n=!1)}n&&(c.splice(t--,1),e=a(a.s=r[0]))}return e}var n={},o={39:0},c=[];function a(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,a),r.l=!0,r.exports}a.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,i=document.createElement("script");i.charset="utf-8",i.timeout=120,a.nc&&i.setAttribute("nonce",a.nc),i.src=function(e){return a.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){i.onerror=i.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:i})}),12e4);i.onerror=i.onload=c,document.head.appendChild(i)}return Promise.all(t)},a.m=e,a.c=n,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 n in e)a.d(r,n,function(t){return e[t]}.bind(null,n));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="",a.oe=function(e){throw console.error(e),e};var i=window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[],s=i.push.bind(i);i.push=t,i=i.slice();for(var u=0;u<i.length;u++)t(i[u]);var l=s;return c.push([849,0]),r()}({0:function(e,t){e.exports=window.wp.element},1:function(e,t){e.exports=window.wp.i18n},106:function(e,t,r){"use strict";var n=r(0),o=r(1),c=(r(2),r(66)),a=r(150),i=r(6),s=r.n(i),u=r(4),l=r(52);r(153),t.a=function(e){var t=e.className,r=e.error,i=e.isLoading,d=e.onRetry;return Object(n.createElement)(u.Placeholder,{icon:Object(n.createElement)(c.a,{srcElement:a.a}),label:Object(o.__)("Sorry, an error occurred",'woocommerce'),className:s()("wc-block-api-error",t)},Object(n.createElement)(l.a,{error:r}),d&&Object(n.createElement)(n.Fragment,null,i?Object(n.createElement)(u.Spinner,null):Object(n.createElement)(u.Button,{isSecondary:!0,onClick:d},Object(o.__)("Retry",'woocommerce'))))}},11:function(e,t){e.exports=window.React},119:function(e,t){e.exports=window.wp.wordcount},12:function(e,t){e.exports=window.wp.blockEditor},121:function(e,t){},122:function(e,t){e.exports=window.wp.coreData},125:function(e,t,r){"use strict";var n=r(17),o=r.n(n),c=r(18),a=r.n(c),i=r(13),s=r.n(i),u=r(19),l=r.n(u),d=r(20),p=r.n(d),b=r(10),m=r.n(b),f=r(5),g=r.n(f),w=r(0),h=(r(2),r(11)),O=r(1),v=r(37),j=function(e){var t=e.imageUrl,r=void 0===t?"".concat(v.m,"/block-error.svg"):t,n=e.header,o=void 0===n?Object(O.__)("Oops!",'woocommerce'):n,c=e.text,a=void 0===c?Object(O.__)("There was an error loading the content.",'woocommerce'):c,i=e.errorMessage,s=e.errorMessagePrefix,u=void 0===s?Object(O.__)("Error:",'woocommerce'):s,l=e.button;return Object(w.createElement)("div",{className:"wc-block-error wc-block-components-error"},r&&Object(w.createElement)("img",{className:"wc-block-error__image wc-block-components-error__image",src:r,alt:""}),Object(w.createElement)("div",{className:"wc-block-error__content wc-block-components-error__content"},o&&Object(w.createElement)("p",{className:"wc-block-error__header wc-block-components-error__header"},o),a&&Object(w.createElement)("p",{className:"wc-block-error__text wc-block-components-error__text"},a),i&&Object(w.createElement)("p",{className:"wc-block-error__message wc-block-components-error__message"},u?u+" ":"",i),l&&Object(w.createElement)("p",{className:"wc-block-error__button wc-block-components-error__button"},l)))};r(218);var y=function(e){l()(c,e);var t,r,n=(t=c,r=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,n=m()(t);if(r){var o=m()(this).constructor;e=Reflect.construct(n,arguments,o)}else e=n.apply(this,arguments);return p()(this,e)});function c(){var e;o()(this,c);for(var t=arguments.length,r=new Array(t),a=0;a<t;a++)r[a]=arguments[a];return e=n.call.apply(n,[this].concat(r)),g()(s()(e),"state",{errorMessage:"",hasError:!1}),e}return a()(c,[{key:"render",value:function(){var e=this.props,t=e.header,r=e.imageUrl,n=e.showErrorMessage,o=e.text,c=e.errorMessagePrefix,a=e.renderError,i=e.button,s=this.state,u=s.errorMessage;return s.hasError?"function"==typeof a?a({errorMessage:u}):Object(w.createElement)(j,{errorMessage:n?u:null,header:t,imageUrl:r,text:o,errorMessagePrefix:c,button:i}):this.props.children}}],[{key:"getDerivedStateFromError",value:function(e){return void 0!==e.statusText&&void 0!==e.status?{errorMessage:Object(w.createElement)(w.Fragment,null,Object(w.createElement)("strong",null,e.status),": ",e.statusText),hasError:!0}:{errorMessage:e.message,hasError:!0}}}]),c}(h.Component);y.defaultProps={showErrorMessage:!0},t.a=y},131:function(e,t,r){"use strict";var n=r(9),o=r.n(n),c=r(16),a=r.n(c),i=r(0),s=r(49),u=r(4),l=r(6),d=r.n(l),p=["className","item","isSelected","isLoading","onSelect","disabled"];t.a=function(e){var t=e.className,r=e.item,n=e.isSelected,c=e.isLoading,l=e.onSelect,b=e.disabled,m=a()(e,p);return Object(i.createElement)(i.Fragment,null,Object(i.createElement)(s.c,o()({},m,{key:r.id,className:t,isSelected:n,item:r,onSelect:l,isSingle:!0,disabled:b})),n&&c&&Object(i.createElement)("div",{key:"loading",className:d()("woocommerce-search-list__item","woocommerce-product-attributes__item","depth-1","is-loading","is-not-active")},Object(i.createElement)(u.Spinner,null)))}},14:function(e,t){e.exports=window.wp.data},143:function(e,t,r){"use strict";var n=r(0),o=r(1),c=r(66),a=r(158),i=r(3),s=r(12),u=r(45);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(i.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:a.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}},149:function(e,t,r){"use strict";var n=r(33),o=r.n(n),c=r(5),a=r.n(c),i=r(9),s=r.n(i),u=r(0),l=r(1),d=r(7),p=(r(2),r(49)),b=r(21),m=r(17),f=r.n(m),g=r(18),w=r.n(g),h=r(19),O=r.n(h),v=r(20),j=r.n(v),y=r(10),k=r.n(y);var E=Object(b.createHigherOrderComponent)((function(e){var t=function(t){O()(c,t);var r,n,o=(r=c,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=k()(r);if(n){var o=k()(this).constructor;e=Reflect.construct(t,arguments,o)}else e=t.apply(this,arguments);return j()(this,e)});function c(){return f()(this,c),o.apply(this,arguments)}return w()(c,[{key:"render",value:function(){var t=this.props.selected,r=null==t;return Object(u.createElement)(e,s()({},this.props,{selected:r?[]:[t]}))}}]),c}(u.Component);return t.defaultProps={selected:null},t}),"withTransformSingleSelectToMultipleSelect"),_=r(302),P=r(29),S=r.n(P),x=r(13),C=r.n(x),B=r(22),N=r.n(B),R=r(34),A=r.n(R),z=r(39),I=r(42);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}function M(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?L(Object(r),!0).forEach((function(t){a()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):L(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var D=Object(b.createHigherOrderComponent)((function(e){var t=function(t){O()(c,t);var r,n,o=(r=c,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=k()(r);if(n){var o=k()(this).constructor;e=Reflect.construct(t,arguments,o)}else e=t.apply(this,arguments);return j()(this,e)});function c(){var e;f()(this,c);for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return e=o.call.apply(o,[this].concat(r)),a()(C()(e),"state",{error:null,loading:!1,variations:{}}),a()(C()(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(z.g)(c).then((function(t){var r=t.map((function(e){return M(M({},e),{},{parent:c})}));e.setState({variations:M(M({},e.state.variations),{},a()({},c,r)),loading:!1,error:null})})).catch(function(){var t=S()(N.a.mark((function t(r){var n;return N.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(I.a)(r);case 2:n=t.sent,e.setState({variations:M(M({},e.state.variations),{},a()({},c,null)),loading:!1,error:n});case 4:case"end":return t.stop()}}),t)})));return function(_x){return t.apply(this,arguments)}}())):e.setState({variations:M(M({},e.state.variations),{},a()({},c,null)),loading:!1,error:null})}}})),e}return w()(c,[{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&&(!A()(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,a=o.loading,i=o.variations;return Object(u.createElement)(e,s()({},this.props,{error:c||r,expandedProduct:this.getExpandedProduct(),isLoading:n,variations:i,variationsLoading:a}))}}]),c}(u.Component);return a()(t,"defaultProps",{selected:[],showVariations:!1}),t}),"withProductVariations"),T=r(52),V=r(6),H=r.n(V),G=r(131);function U(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 F(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?U(Object(r),!0).forEach((function(t){a()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):U(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}r(214);var q={list:Object(l.__)("Products",'woocommerce'),noItems:Object(l.__)("Your store doesn't have any products.",'woocommerce'),search:Object(l.__)("Search for a product to display",'woocommerce'),updated:Object(l.__)("Product search results updated.",'woocommerce')},Q=function(e){var t=e.expandedProduct,r=e.error,n=e.instanceId,c=e.isCompact,a=e.isLoading,i=e.onChange,b=e.onSearch,m=e.products,f=e.renderItem,g=e.selected,w=e.showVariations,h=e.variations,O=e.variationsLoading;if(r)return Object(u.createElement)(T.a,{error:r});var v=h&&h[t]?h[t]:[],j=[].concat(o()(m),o()(v));return Object(u.createElement)(p.b,{className:"woocommerce-products",list:j,isCompact:c,isLoading:a,isSingle:!0,selected:j.filter((function(e){var t=e.id;return g.includes(t)})),onChange:i,renderItem:f||(w?function(e){var t=e.item,r=e.search,o=e.depth,c=void 0===o?0:o,i=e.isSelected,b=e.onSelect,m=t.variations&&Array.isArray(t.variations)?t.variations.length:0,f=H()("woocommerce-search-product__item","woocommerce-search-list__item","depth-".concat(c),"has-count",{"is-searching":r.length>0,"is-skip-level":0===c&&0!==t.parent,"is-variable":m>0});if(!t.breadcrumbs.length)return Object(u.createElement)(G.a,s()({},e,{className:H()(f,{"is-selected":i}),isSelected:i,item:t,onSelect:function(){return function(){b(t)()}},isLoading:a||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 g=Object(d.isEmpty)(t.variation)?e:F(F({},e),{},{item:F(F({},e.item),{},{name:t.variation}),"aria-label":"".concat(t.breadcrumbs[0],": ").concat(t.variation)});return Object(u.createElement)(p.c,s()({},g,{className:f,name:"variations-".concat(n)}))}:null),onSearch:b,messages:q,isHierarchical:!0})};Q.defaultProps={isCompact:!1,expandedProduct:null,selected:[],showVariations:!1},t.a=E(Object(_.a)(D(Object(b.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){},158: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)("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},159:function(e,t,r){"use strict";r.d(t,"c",(function(){return c})),r.d(t,"d",(function(){return a})),r.d(t,"a",(function(){return i})),r.d(t,"b",(function(){return s}));var n=r(26),o=r(37),c=function(e,t){if(o.n>2)return Object(n.registerBlockType)(e,t)},a=function(e,t){if(o.n>1)return Object(n.registerBlockType)(e,t)},i=function(){return o.n>2},s=function(){return o.n>1}},191:function(e,t){e.exports=window.wp.warning},21:function(e,t){e.exports=window.wp.compose},214:function(e,t){},218:function(e,t){},22:function(e,t){e.exports=window.regeneratorRuntime},23:function(e,t){e.exports=window.wp.url},24:function(e,t){e.exports=window.wc.wcBlocksData},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),a=r.n(c),i=r(8),s=r.n(i),u=r(16),l=r.n(u),d=r(0),p=r(22),b=r.n(p),m=r(37),f=r(39),g=r(222),w=r(42),h=["selected"];t.a=function(e){return function(t){var r=t.selected,n=l()(t,h),c=Object(d.useState)(!0),i=s()(c,2),u=i[0],p=i[1],O=Object(d.useState)(null),v=s()(O,2),j=v[0],y=v[1],k=Object(d.useState)([]),E=s()(k,2),_=E[0],P=E[1],S=m.o.productCount>100,x=function(){var e=a()(b.a.mark((function e(t){var r;return b.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Object(w.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(f.h)({selected:r}).then((function(e){P(e),p(!1)})).catch(x)}),[r]);var C=Object(g.a)((function(e){Object(f.h)({selected:r,search:e}).then((function(e){P(e),p(!1)})).catch(x)}),400),B=s()(C,1)[0],N=Object(d.useCallback)((function(e){p(!0),B(e)}),[p,B]);return Object(d.createElement)(e,o()({},n,{selected:r,error:j,products:_,isLoading:u,onSearch:S?N: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 a})),r.d(t,"l",(function(){return i})),r.d(t,"n",(function(){return s})),r.d(t,"j",(function(){return u})),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 b})),r.d(t,"c",(function(){return m})),r.d(t,"d",(function(){return f})),r.d(t,"h",(function(){return g})),r.d(t,"a",(function(){return w})),r.d(t,"i",(function(){return h})),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"}),a=c.pluginUrl+"images/",i=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,d=o.STORE_PAGES.checkout.permalink,p=o.STORE_PAGES.privacy.permalink,b=(o.STORE_PAGES.privacy.title,o.STORE_PAGES.terms.permalink),m=(o.STORE_PAGES.terms.title,o.STORE_PAGES.cart.id),f=o.STORE_PAGES.cart.permalink,g=(o.STORE_PAGES.myaccount.permalink?o.STORE_PAGES.myaccount.permalink:Object(o.getSetting)("wpLoginUrl","/wp-login.php"),Object(o.getSetting)("shippingCountries",{})),w=Object(o.getSetting)("allowedCountries",{}),h=Object(o.getSetting)("shippingStates",{}),O=Object(o.getSetting)("allowedStates",{})},39:function(e,t,r){"use strict";r.d(t,"h",(function(){return b})),r.d(t,"e",(function(){return m})),r.d(t,"b",(function(){return f})),r.d(t,"i",(function(){return g})),r.d(t,"f",(function(){return w})),r.d(t,"c",(function(){return h})),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),a=r(15),i=r.n(a),s=r(7),u=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;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?d(Object(r),!0).forEach((function(t){o()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):d(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var b=function(e){var t=e.selected,r=void 0===t?[]:t,n=e.search,o=void 0===n?"":n,a=e.queryArgs,u=function(e){var t=e.selected,r=void 0===t?[]:t,n=e.search,o=void 0===n?"":n,a=e.queryArgs,i=void 0===a?{}:a,s=l.o.productCount>100,u={per_page:s?100:0,catalog_visibility:"any",search:o,orderby:"title",order:"asc"},d=[Object(c.addQueryArgs)("/wc/store/products",p(p({},u),i))];return s&&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(u.map((function(e){return i()({path:e})}))).then((function(e){return Object(s.uniqBy)(Object(s.flatten)(e),"id").map((function(e){return p(p({},e),{},{parent:0})}))})).catch((function(e){throw e}))},m=function(e){return i()({path:"/wc/store/products/".concat(e)})},f=function(){return i()({path:"wc/store/products/attributes"})},g=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(u.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(s.uniqBy)(Object(s.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)})},v=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 s})),r.d(t,"b",(function(){return u}));var n=r(29),o=r.n(n),c=r(22),a=r.n(c),i=r(1),s=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)}}(),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(i.__)("Something went wrong. Please contact us to get assistance.",'woocommerce')}},45:function(e,t){e.exports=window.wc.wcBlocksSharedContext},46:function(e,t){e.exports=window.wp.keycodes},47:function(e,t){e.exports=window.wc.priceFormat},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),a=r.n(c),i=r(17),s=r.n(i),u=r(18),l=r.n(u),d=r(13),p=r.n(d),b=r(19),m=r.n(b),f=r(20),g=r.n(f),w=r(10),h=r.n(w),O=r(5),v=r.n(O),j=r(0),y=r(22),k=r.n(y),E=r(21),_=r(39),P=r(42);var S=Object(E.createHigherOrderComponent)((function(e){return function(t){m()(i,t);var r,n,c=(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=h()(r);if(n){var o=h()(this).constructor;e=Reflect.construct(t,arguments,o)}else e=t.apply(this,arguments);return g()(this,e)});function i(){var e;s()(this,i);for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return e=c.call.apply(c,[this].concat(r)),v()(p()(e),"state",{error:null,loading:!1,product:"preview"===e.props.attributes.productId?e.props.attributes.previewProduct:null}),v()(p()(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=a()(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(_x){return t.apply(this,arguments)}}())):e.setState({product:null,loading:!1,error:null}))})),e}return l()(i,[{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}))}}]),i}(j.Component)}),"withProduct");t.a=S},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},60:function(e,t){e.exports=window.wc.wcBlocksRegistry},64:function(e,t){e.exports=window.wp.a11y},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),s=["srcElement","size"];function u(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,s);return Object(i.isValidElement)(t)?Object(i.cloneElement)(t,function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?u(Object(r),!0).forEach((function(t){o()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):u(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({width:n,height:n},c)):null}},7:function(e,t){e.exports=window.lodash},74:function(e,t){e.exports=window.wp.dom},849:function(e,t,r){e.exports=r(854)},850:function(e,t){},854:function(e,t,r){"use strict";r.r(t);var n=r(1),o=r(159),c=r(8),a=r.n(c),i=r(0),s=r(4),u=r(481),l=r(125),d=r(143),p=Object(i.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 230 100"},Object(i.createElement)("path",{fill:"#E1E3E6",d:"M76 0h11v6H76zm0 11h88v11H76zm0 16h28v6H76zm0 17h154v28H76zm0 39h22v17H76zm28 0h44v17h-44zM0 0h66v66H0z",style:{width:"100%"}})),b=r(12),m=(r(850),r(106)),f=function(e){var t=e.error,r=e.isLoading,n=e.getProduct;return Object(i.createElement)(m.a,{className:"wc-block-single-product-error",error:t,isLoading:r,onRetry:n})},g=r(149),w=function(e){var t=e.attributes,r=e.setAttributes;return Object(i.createElement)(g.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})}})},h=function(e){var t=e.isEditing,r=e.setIsEditing;return Object(i.createElement)(b.BlockControls,null,Object(i.createElement)(s.ToolbarGroup,{controls:[{icon:"edit",title:Object(n.__)("Edit",'woocommerce'),onClick:function(){return r(!t)},isActive:t}]}))},O=r(14),v=r(45),j=r(26),y=r(66),k=r(28),E=Object(i.createElement)(k.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(i.createElement)("path",{fill:"none",d:"M0 0h24v24H0z"}),Object(i.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(33),P=r.n(_),S=Object(i.createElement)(k.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(i.createElement)("path",{fill:"none",d:"M0 0h24v24H0V0z"}),Object(i.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(877),C="woocommerce/single-product",B=Object(n.__)("Single Product",'woocommerce'),N=Object(i.createElement)(y.a,{srcElement:S}),R=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"]]]]]],z=["core/columns","core/column"].concat(P()(Object.keys(Object(x.a)(C)))),I=function(e){var t=e.isLoading,r=e.product,o=e.clientId,c=Object(O.useDispatch)("core/block-editor").replaceInnerBlocks,u=Object(i.useCallback)((function(){c(o,function e(t){return t.map((function(t){var r=a()(t,3),n=r[0],o=r[1],c=void 0===o?{}:o,i=r[2],s=void 0===i?[]:i,u=s?e(s):[];return Object(j.createBlock)(n,c,u)}))}(A),!1)}),[o,c]);return Object(i.createElement)(v.InnerBlockLayoutContextProvider,{parentName:C,parentClassName:"wc-block-single-product wc-block-layout"},Object(i.createElement)(v.ProductDataContextProvider,{product:r,isLoading:t},Object(i.createElement)(b.InspectorControls,null,Object(i.createElement)(s.PanelBody,{title:Object(n.__)("Layout",'woocommerce'),initialOpen:!0},Object(i.createElement)(s.Button,{label:Object(n.__)("Reset layout to default",'woocommerce'),onClick:u,isTertiary:!0,className:"wc-block-single-product__reset-layout"},Object(i.createElement)(y.a,{srcElement:E})," ",Object(n.__)("Reset layout",'woocommerce')))),Object(i.createElement)("div",{className:"wc-block-single-product wc-block-layout"},Object(i.createElement)(b.InnerBlocks,{template:A,allowedBlocks:z,templateLock:!1,renderAppender:!1}))))},L=Object(u.a)((function(e){var t=e.className,r=e.attributes,o=e.setAttributes,c=e.error,u=e.getProduct,m=e.product,g=e.isLoading,O=e.clientId,v=r.productId,j=r.isPreview,y=Object(i.useState)(!v),k=a()(y,2),E=k[0],_=k[1];return j?p:c?Object(i.createElement)(f,{error:c,isLoading:g,getProduct:u}):Object(i.createElement)("div",{className:t},Object(i.createElement)(l.a,{header:Object(n.__)("Single Product Block Error",'woocommerce')},Object(i.createElement)(h,{setIsEditing:_,isEditing:E}),E?Object(i.createElement)(s.Placeholder,{icon:N,label:B,className:"wc-block-single-product"},R,Object(i.createElement)("div",{className:"wc-block-single-product__selection"},Object(i.createElement)(w,{attributes:r,setAttributes:o}),Object(i.createElement)(s.Button,{isSecondary:!0,onClick:function(){_(!1)}},Object(n.__)("Done",'woocommerce')))):Object(i.createElement)(i.Fragment,null,Object(i.createElement)(b.InspectorControls,null,Object(i.createElement)(s.PanelBody,{title:Object(n.__)("Product",'woocommerce'),initialOpen:!1},Object(i.createElement)(w,{attributes:r,setAttributes:o}))),Object(i.createElement)(d.a,{productId:v}),Object(i.createElement)(I,{clientId:O,product:m,isLoading:g}))))})),M=r(6),D=r.n(M),T={title:B,icon:{src:N,foreground:"#96588a"},category:"woocommerce",keywords:[Object(n.__)("WooCommerce",'woocommerce')],description:R,supports:{align:["wide","full"],html:!1},example:{attributes:{isPreview:!0}},attributes:{isPreview:{type:"boolean",default:!1,save:!1},productId:{type:"number"}},edit:L,save:function(e){var t=e.attributes;return Object(i.createElement)("div",{className:D()("is-loading",t.className)},Object(i.createElement)(b.InnerBlocks.Content,null))}};Object(o.c)(C,T)},86:function(e,t){e.exports=window.wc.wcBlocksSharedHocs},87:function(e,t){e.exports=window.ReactDOM},877:function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var n=r(60),o=r(0),c=r(37);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,482))}))}),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,901))}))}),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,902))}))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-rating",component:Object(o.lazy)((function(){return r.e(13).then(r.bind(null,483))}))}),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,484))}))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-summary",component:Object(o.lazy)((function(){return r.e(16).then(r.bind(null,486))}))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-sale-badge",component:Object(o.lazy)((function(){return r.e(4).then(r.bind(null,304))}))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-sku",component:Object(o.lazy)((function(){return r.e(14).then(r.bind(null,487))}))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-category-list",component:Object(o.lazy)((function(){return r.e(10).then(r.bind(null,488))}))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-tag-list",component:Object(o.lazy)((function(){return r.e(17).then(r.bind(null,489))}))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-stock-indicator",component:Object(o.lazy)((function(){return r.e(15).then(r.bind(null,490))}))}),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,903))}))});var a=function(e){return Object(n.getRegisteredBlockComponents)(e)}},89:function(e,t){e.exports=window.wp.viewport},91:function(e,t){e.exports=window.wp.autop},96:function(e,t){e.exports=window.wp.date}});