diff --git a/build/active-filters-frontend.asset.php b/build/active-filters-frontend.asset.php new file mode 100644 index 00000000000..a571dab059f --- /dev/null +++ b/build/active-filters-frontend.asset.php @@ -0,0 +1 @@ + array('lodash', 'react', 'wc-blocks-data-store', 'wc-price-format', 'wc-settings', 'wp-data', 'wp-element', 'wp-html-entities', 'wp-i18n', 'wp-is-shallow-equal', 'wp-polyfill', 'wp-primitives', 'wp-url'), 'version' => '742b443abca84d4a3a0525dbb1fef0ac'); \ No newline at end of file diff --git a/build/active-filters-frontend.js b/build/active-filters-frontend.js new file mode 100644 index 00000000000..1d2e494ce74 --- /dev/null +++ b/build/active-filters-frontend.js @@ -0,0 +1,15 @@ +!function(e){var t={};function r(n){if(t[n])return t[n].exports;var c=t[n]={i:n,l:!1,exports:{}};return e[n].call(c.exports,c,c.exports,r),c.l=!0,c.exports}r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var c in e)r.d(n,c,function(t){return e[t]}.bind(null,c));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=235)}({0:function(e,t){e.exports=window.wp.element},1:function(e,t){e.exports=window.wp.i18n},102:function(e,t){},112:function(e,t,r){"use strict";r.d(t,"a",(function(){return c})),r.d(t,"b",(function(){return o}));var n=r(5);const c=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0,r=arguments.length>2?arguments[2]:void 0,c=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";const o=e.filter(e=>e.attribute===r.taxonomy),s=o.length?o[0]:null;if(!(s&&s.slug&&Array.isArray(s.slug)&&s.slug.includes(c)))return;const l=s.slug.filter(e=>e!==c),a=e.filter(e=>e.attribute!==r.taxonomy);l.length>0&&(s.slug=l.sort(),a.push(s)),t(Object(n.sortBy)(a,"attribute"))},o=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0,r=arguments.length>2?arguments[2]:void 0,c=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"in";if(!r||!r.taxonomy)return[];const s=e.filter(e=>e.attribute!==r.taxonomy);return 0===c.length?t(s):(s.push({attribute:r.taxonomy,operator:o,slug:c.map(e=>{let{slug:t}=e;return t}).sort()}),t(Object(n.sortBy)(s,"attribute"))),s}},12:function(e,t){e.exports=window.wp.primitives},122:function(e,t,r){"use strict";r.d(t,"a",(function(){return o})),r.d(t,"b",(function(){return s}));var n=r(2);const c=Object(n.getSetting)("attributes",[]).reduce((e,t)=>{const r=(n=t)&&n.attribute_name?{id:parseInt(n.attribute_id,10),name:n.attribute_name,taxonomy:"pa_"+n.attribute_name,label:n.attribute_label}:null;var n;return r&&r.id&&e.push(r),e},[]),o=e=>{if(e)return c.find(t=>t.id===e)},s=e=>{if(e)return c.find(t=>t.taxonomy===e)}},13:function(e,t){e.exports=window.wp.isShallowEqual},14:function(e,t){e.exports=window.wp.url},144:function(e){e.exports=JSON.parse('{"name":"woocommerce/active-filters","version":"1.0.0","title":"Active Filters Controls","description":"Display the currently active filters.","category":"woocommerce","keywords":["WooCommerce"],"supports":{"html":false,"multiple":false,"inserter":false,"color":{"text":true,"background":false},"lock":false},"attributes":{"displayStyle":{"type":"string","default":"list"},"headingLevel":{"type":"number","default":3}},"textdomain":"woo-gutenberg-products-block","apiVersion":2,"$schema":"https://schemas.wp.org/trunk/block.json"}')},15:function(e,t){function r(){return e.exports=r=Object.assign?Object.assign.bind():function(e){for(var t=1;t{let{attributeObject:t,slugs:r=[],operator:l="in",displayStyle:a,isLoadingCallback:i}=e;const{results:b,isLoading:d}=Object(O.a)({namespace:"/wc/store/v1",resourceName:"products/attributes/terms",resourceValues:[t.id]}),[f,m]=Object(o.b)("attributes",[]);if(Object(n.useEffect)(()=>{i(d)},[d,i]),!Array.isArray(b)||!Object(p.b)(b)||!Object(p.a)(f))return null;const _=t.label,w=Object(s.getSettingWithCoercion)("is_rendering_php_template",!1,u.a);return Object(n.createElement)("li",null,Object(n.createElement)("span",{className:"wc-block-active-filters__list-item-type"},_,":"),Object(n.createElement)("ul",null,r.map((e,r)=>{const o=b.find(t=>t.slug===e);if(!o)return null;let s="";return r>0&&"and"===l&&(s=Object(n.createElement)("span",{className:"wc-block-active-filters__list-item-operator"},Object(c.__)("All","woo-gutenberg-products-block"))),Object(g.f)({type:_,name:Object(j.decodeEntities)(o.name||e),prefix:s,isLoading:d,removeCallback:()=>{const r=f.find(e=>{let{attribute:r}=e;return r==="pa_"+t.name});1===(null==r?void 0:r.slug.length)?Object(g.e)("query_type_"+t.name,"filter_"+t.name):Object(g.e)({["filter_"+t.name]:e}),w||Object(y.a)(f,m,t,e)},showLabel:!1,displayStyle:a})})))},w=e=>{let{displayStyle:t,isLoading:r}=e;return r?Object(n.createElement)(n.Fragment,null,[...Array("list"===t?2:3)].map((e,r)=>Object(n.createElement)("li",{className:"list"===t?"show-loading-state-list":"show-loading-state-chips",key:r},Object(n.createElement)("span",{className:"show-loading-state__inner"})))):null},h=r(46);t.a=e=>{let{attributes:t,isEditor:r=!1}=e;const l=Object(h.b)(),O=function(){const e=Object(n.useRef)(!1);return Object(n.useEffect)(()=>(e.current=!0,()=>{e.current=!1}),[]),Object(n.useCallback)(()=>e.current,[])}()(),j=Object(s.getSettingWithCoercion)("is_rendering_php_template",!1,u.a),[y,v]=Object(n.useState)(!0),E=Object(g.c)()&&!r&&y,[k,S]=Object(o.b)("attributes",[]),[x,A]=Object(o.b)("stock_status",[]),[P,N]=Object(o.b)("min_price"),[C,R]=Object(o.b)("max_price"),[T,L]=Object(o.b)("rating"),B=Object(s.getSetting)("stockStatusOptions",[]),M=Object(s.getSetting)("attributes",[]),F=Object(n.useMemo)(()=>{if(E||0===x.length||(e=x,!Array.isArray(e)||!e.every(e=>["instock","outofstock","onbackorder"].includes(e)))||!(e=>Object(b.a)(e)&&Object.keys(e).every(e=>["instock","outofstock","onbackorder"].includes(e)))(B))return null;var e;const r=Object(c.__)("Stock Status","woo-gutenberg-products-block");return Object(n.createElement)("li",null,Object(n.createElement)("span",{className:"wc-block-active-filters__list-item-type"},r,":"),Object(n.createElement)("ul",null,x.map(e=>Object(g.f)({type:r,name:B[e],removeCallback:()=>{if(Object(g.e)({filter_stock_status:e}),!j){const t=x.filter(t=>t!==e);A(t)}},showLabel:!1,displayStyle:t.displayStyle}))))},[E,B,x,A,t.displayStyle,j]),Q=Object(n.useMemo)(()=>E||!Number.isFinite(P)&&!Number.isFinite(C)?null:Object(g.f)({type:Object(c.__)("Price","woo-gutenberg-products-block"),name:Object(g.b)(P,C),removeCallback:()=>{Object(g.e)("max_price","min_price"),j||(N(void 0),R(void 0))},displayStyle:t.displayStyle}),[E,P,C,t.displayStyle,N,R,j]),G=Object(n.useMemo)(()=>!Object(p.a)(k)&&O||!k.length&&!Object(g.g)(M)?(y&&v(!1),null):k.map(e=>{const r=Object(m.b)(e.attribute);return r?Object(n.createElement)(_,{attributeObject:r,displayStyle:t.displayStyle,slugs:e.slug,key:e.attribute,operator:e.operator,isLoadingCallback:v}):(y&&v(!1),null)}),[k,O,M,y,t.displayStyle]);Object(n.useEffect)(()=>{var e;if(!j)return;if(T.length&&T.length>0)return;const t=null===(e=Object(d.d)("rating_filter"))||void 0===e?void 0:e.toString();t&&L(t.split(","))},[j,T,L]);const U=Object(n.useMemo)(()=>{if(E||0===T.length||(e=T,!Array.isArray(e)||!e.every(e=>["1","2","3","4","5"].includes(e))))return null;var e;const r=Object(c.__)("Rating","woo-gutenberg-products-block");return Object(n.createElement)("li",null,Object(n.createElement)("span",{className:"wc-block-active-filters__list-item-type"},r,":"),Object(n.createElement)("ul",null,T.map(e=>Object(g.f)({type:r,name:Object(c.sprintf)( +/* translators: %s is referring to the average rating value */ +Object(c.__)("Rated %s out of 5","woo-gutenberg-products-block"),e),removeCallback:()=>{if(Object(g.e)({rating_filter:e}),!j){const t=T.filter(t=>t!==e);L(t)}},showLabel:!1,displayStyle:t.displayStyle}))))},[E,T,L,t.displayStyle,j]);if(!E&&!(k.length>0||x.length>0||T.length>0||Number.isFinite(P)||Number.isFinite(C))&&!r)return l(!1),null;const Y="h"+t.headingLevel,q=Object(n.createElement)(Y,{className:"wc-block-active-filters__title"},t.heading),V=E?Object(n.createElement)(f.a,null,q):q;if(!Object(s.getSettingWithCoercion)("has_filterable_products",!1,u.a))return l(!1),null;l(!0);const D=a()("wc-block-active-filters__list",{"wc-block-active-filters__list--chips":"chips"===t.displayStyle,"wc-block-active-filters--loading":E});return Object(n.createElement)(n.Fragment,null,!r&&t.heading&&V,Object(n.createElement)("div",{className:"wc-block-active-filters"},Object(n.createElement)("ul",{className:D},r?Object(n.createElement)(n.Fragment,null,Object(g.f)({type:Object(c.__)("Size","woo-gutenberg-products-block"),name:Object(c.__)("Small","woo-gutenberg-products-block"),displayStyle:t.displayStyle}),Object(g.f)({type:Object(c.__)("Color","woo-gutenberg-products-block"),name:Object(c.__)("Blue","woo-gutenberg-products-block"),displayStyle:t.displayStyle})):Object(n.createElement)(n.Fragment,null,Object(n.createElement)(w,{isLoading:E,displayStyle:t.displayStyle}),Q,F,G,U)),E?Object(n.createElement)("span",{className:"wc-block-active-filters__clear-all-placeholder"}):Object(n.createElement)("button",{className:"wc-block-active-filters__clear-all",onClick:()=>{Object(g.a)(),j||(N(void 0),R(void 0),S([]),A([]),L([]))}},Object(n.createElement)(i.a,{label:Object(c.__)("Clear All","woo-gutenberg-products-block"),screenReaderLabel:Object(c.__)("Clear All Filters","woo-gutenberg-products-block")}))))}},16:function(e,t,r){"use strict";var n=r(17),c=r.n(n),o=r(0),s=r(8),l=r(1),a=r(37),i=e=>{let{imageUrl:t=a.m+"/block-error.svg",header:r=Object(l.__)("Oops!","woo-gutenberg-products-block"),text:n=Object(l.__)("There was an error loading the content.","woo-gutenberg-products-block"),errorMessage:c,errorMessagePrefix:s=Object(l.__)("Error:","woo-gutenberg-products-block"),button:i,showErrorBlock:u=!0}=e;return u?Object(o.createElement)("div",{className:"wc-block-error wc-block-components-error"},t&&Object(o.createElement)("img",{className:"wc-block-error__image wc-block-components-error__image",src:t,alt:""}),Object(o.createElement)("div",{className:"wc-block-error__content wc-block-components-error__content"},r&&Object(o.createElement)("p",{className:"wc-block-error__header wc-block-components-error__header"},r),n&&Object(o.createElement)("p",{className:"wc-block-error__text wc-block-components-error__text"},n),c&&Object(o.createElement)("p",{className:"wc-block-error__message wc-block-components-error__message"},s?s+" ":"",c),i&&Object(o.createElement)("p",{className:"wc-block-error__button wc-block-components-error__button"},i))):null};r(40);class u extends s.Component{constructor(){super(...arguments),c()(this,"state",{errorMessage:"",hasError:!1})}static getDerivedStateFromError(e){return void 0!==e.statusText&&void 0!==e.status?{errorMessage:Object(o.createElement)(o.Fragment,null,Object(o.createElement)("strong",null,e.status),": ",e.statusText),hasError:!0}:{errorMessage:e.message,hasError:!0}}render(){const{header:e,imageUrl:t,showErrorMessage:r=!0,showErrorBlock:n=!0,text:c,errorMessagePrefix:s,renderError:l,button:a}=this.props,{errorMessage:u,hasError:b}=this.state;return b?"function"==typeof l?l({errorMessage:u}):Object(o.createElement)(i,{showErrorBlock:n,errorMessage:r?u:null,header:e,imageUrl:t,text:c,errorMessagePrefix:s,button:a}):this.props.children}}t.a=u},17:function(e,t,r){var n=r(38);e.exports=function(e,t,r){return(t=n(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e},e.exports.__esModule=!0,e.exports.default=e.exports},2:function(e,t){e.exports=window.wc.wcSettings},20:function(e,t,r){"use strict";r.d(t,"a",(function(){return n})),r.d(t,"b",(function(){return c}));const n=e=>!(e=>null===e)(e)&&e instanceof Object&&e.constructor===Object;function c(e,t){return n(e)&&t in e}},21:function(e,t,r){"use strict";var n=r(0),c=r(6),o=r.n(c);t.a=e=>{let t,{label:r,screenReaderLabel:c,wrapperElement:s,wrapperProps:l={}}=e;const a=null!=r,i=null!=c;return!a&&i?(t=s||"span",l={...l,className:o()(l.className,"screen-reader-text")},Object(n.createElement)(t,l,c)):(t=s||n.Fragment,a&&i&&r!==c?Object(n.createElement)(t,l,Object(n.createElement)("span",{"aria-hidden":"true"},r),Object(n.createElement)("span",{className:"screen-reader-text"},c)):Object(n.createElement)(t,l,r))}},217:function(e,t){},219:function(e,t,r){"use strict";var n=r(0),c=r(12);const o=Object(n.createElement)(c.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(n.createElement)(c.Path,{d:"M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z"}));t.a=o},220:function(e,t){},221:function(e,t,r){"use strict";r.d(t,"b",(function(){return o})),r.d(t,"a",(function(){return l}));var n=r(20);const c=e=>Object(n.b)(e,"count")&&Object(n.b)(e,"description")&&Object(n.b)(e,"id")&&Object(n.b)(e,"name")&&Object(n.b)(e,"parent")&&Object(n.b)(e,"slug")&&"number"==typeof e.count&&"string"==typeof e.description&&"number"==typeof e.id&&"string"==typeof e.name&&"number"==typeof e.parent&&"string"==typeof e.slug,o=e=>Array.isArray(e)&&e.every(c),s=e=>Object(n.b)(e,"attribute")&&Object(n.b)(e,"operator")&&Object(n.b)(e,"slug")&&"string"==typeof e.attribute&&"string"==typeof e.operator&&Array.isArray(e.slug)&&e.slug.every(e=>"string"==typeof e),l=e=>Array.isArray(e)&&e.every(s)},229:function(e,t,r){"use strict";var n=r(15),c=r.n(n),o=r(0),s=r(6),l=r.n(s),a=r(1),i=r(76),u=r(219);r(217);var b=e=>{let{text:t,screenReaderText:r="",element:n="li",className:s="",radius:a="small",children:i=null,...u}=e;const b=n,p=l()(s,"wc-block-components-chip","wc-block-components-chip--radius-"+a),d=Boolean(r&&r!==t);return Object(o.createElement)(b,c()({className:p},u),Object(o.createElement)("span",{"aria-hidden":d,className:"wc-block-components-chip__text"},t),d&&Object(o.createElement)("span",{className:"screen-reader-text"},r),i)};t.a=e=>{let{ariaLabel:t="",className:r="",disabled:n=!1,onRemove:s=(()=>{}),removeOnAnyClick:p=!1,text:d,screenReaderText:f="",...m}=e;const g=p?"span":"button";if(!t){const e=f&&"string"==typeof f?f:d;t="string"!=typeof e? +/* translators: Remove chip. */ +Object(a.__)("Remove","woo-gutenberg-products-block"):Object(a.sprintf)( +/* translators: %s text of the chip to remove. */ +Object(a.__)('Remove "%s"',"woo-gutenberg-products-block"),e)}const O={"aria-label":t,disabled:n,onClick:s,onKeyDown:e=>{"Backspace"!==e.key&&"Delete"!==e.key||s()}},j=p?O:{},y=p?{"aria-hidden":!0}:O;return Object(o.createElement)(b,c()({},m,j,{className:l()(r,"is-removable"),element:p?"button":m.element,screenReaderText:f,text:d}),Object(o.createElement)(g,c()({className:"wc-block-components-chip__remove"},y),Object(o.createElement)(i.a,{className:"wc-block-components-chip__remove-icon",icon:u.a,size:16})))}},23:function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));const n=e=>"string"==typeof e},235:function(e,t,r){e.exports=r(236)},236:function(e,t,r){"use strict";r.r(t);var n=r(50),c=r(157),o=r(44);Object(n.a)({selector:".wp-block-woocommerce-active-filters",Block:c.a,getProps:e=>({attributes:Object(o.d)(e.dataset),isEditor:!1})})},25:function(e,t,r){"use strict";r.d(t,"a",(function(){return o}));var n=r(0);const c=Object(n.createContext)("page"),o=()=>Object(n.useContext)(c);c.Provider},27:function(e,t){function r(t){return e.exports=r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,r(t)}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports},3:function(e,t){e.exports=window.wc.wcBlocksData},30:function(e,t,r){"use strict";r.d(t,"a",(function(){return s}));var n=r(0),c=r(13),o=r.n(c);function s(e){const t=Object(n.useRef)(e);return o()(e,t.current)||(t.current=e),t.current}},31:function(e,t){e.exports=window.wp.htmlEntities},32:function(e,t,r){"use strict";r.d(t,"a",(function(){return b})),r.d(t,"b",(function(){return p})),r.d(t,"c",(function(){return d}));var n=r(3),c=r(7),o=r(0),s=r(13),l=r.n(s),a=r(30),i=r(64),u=r(25);const b=e=>{const t=Object(u.a)();e=e||t;const r=Object(c.useSelect)(t=>t(n.QUERY_STATE_STORE_KEY).getValueForQueryContext(e,void 0),[e]),{setValueForQueryContext:s}=Object(c.useDispatch)(n.QUERY_STATE_STORE_KEY);return[r,Object(o.useCallback)(t=>{s(e,t)},[e,s])]},p=(e,t,r)=>{const s=Object(u.a)();r=r||s;const l=Object(c.useSelect)(c=>c(n.QUERY_STATE_STORE_KEY).getValueForQueryKey(r,e,t),[r,e]),{setQueryValue:a}=Object(c.useDispatch)(n.QUERY_STATE_STORE_KEY);return[l,Object(o.useCallback)(t=>{a(r,e,t)},[r,e,a])]},d=(e,t)=>{const r=Object(u.a)();t=t||r;const[n,c]=b(t),s=Object(a.a)(n),p=Object(a.a)(e),d=Object(i.a)(p),f=Object(o.useRef)(!1);return Object(o.useEffect)(()=>{l()(d,p)||(c(Object.assign({},s,p)),f.current=!0)},[s,p,d,c]),f.current?[n,c]:[e,c]}},37:function(e,t,r){"use strict";r.d(t,"o",(function(){return o})),r.d(t,"m",(function(){return s})),r.d(t,"l",(function(){return l})),r.d(t,"n",(function(){return a})),r.d(t,"j",(function(){return i})),r.d(t,"d",(function(){return u})),r.d(t,"g",(function(){return b})),r.d(t,"k",(function(){return p})),r.d(t,"c",(function(){return d})),r.d(t,"f",(function(){return f})),r.d(t,"h",(function(){return m})),r.d(t,"a",(function(){return g})),r.d(t,"i",(function(){return O})),r.d(t,"b",(function(){return j})),r.d(t,"e",(function(){return y}));var n,c=r(2);const o=Object(c.getSetting)("wcBlocksConfig",{buildPhase:1,pluginUrl:"",productCount:0,defaultAvatar:"",restApiRoutes:{},wordCountType:"words"}),s=o.pluginUrl+"images/",l=o.pluginUrl+"build/",a=o.buildPhase,i=null===(n=c.STORE_PAGES.shop)||void 0===n?void 0:n.permalink,u=(c.STORE_PAGES.checkout.id,c.STORE_PAGES.checkout.permalink),b=c.STORE_PAGES.privacy.permalink,p=(c.STORE_PAGES.privacy.title,c.STORE_PAGES.terms.permalink),d=(c.STORE_PAGES.terms.title,c.STORE_PAGES.cart.id,c.STORE_PAGES.cart.permalink),f=c.STORE_PAGES.myaccount.permalink?c.STORE_PAGES.myaccount.permalink:Object(c.getSetting)("wpLoginUrl","/wp-login.php"),m=Object(c.getSetting)("shippingCountries",{}),g=Object(c.getSetting)("allowedCountries",{}),O=Object(c.getSetting)("shippingStates",{}),j=Object(c.getSetting)("allowedStates",{}),y=Object(c.getSetting)("localPickupEnabled",!1)},38:function(e,t,r){var n=r(27).default,c=r(39);e.exports=function(e){var t=c(e,"string");return"symbol"===n(t)?t:String(t)},e.exports.__esModule=!0,e.exports.default=e.exports},39:function(e,t,r){var n=r(27).default;e.exports=function(e,t){if("object"!==n(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var c=r.call(e,t||"default");if("object"!==n(c))return c;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)},e.exports.__esModule=!0,e.exports.default=e.exports},40:function(e,t){},43:function(e,t){e.exports=window.wc.priceFormat},44:function(e,t,r){"use strict";r.d(t,"b",(function(){return f})),r.d(t,"f",(function(){return m})),r.d(t,"e",(function(){return g})),r.d(t,"a",(function(){return y})),r.d(t,"c",(function(){return _})),r.d(t,"g",(function(){return w})),r.d(t,"d",(function(){return h}));var n=r(0),c=r(1),o=r(43),s=r(229),l=r(21),a=r(14),i=r(72),u=r(76),b=r(219),p=r(23),d=r(144);const f=(e,t)=>Number.isFinite(e)&&Number.isFinite(t)?Object(c.sprintf)( +/* translators: %1$s min price, %2$s max price */ +Object(c.__)("Between %1$s and %2$s","woo-gutenberg-products-block"),Object(o.formatPrice)(e),Object(o.formatPrice)(t)):Number.isFinite(e)?Object(c.sprintf)( +/* translators: %s min price */ +Object(c.__)("From %s","woo-gutenberg-products-block"),Object(o.formatPrice)(e)):Object(c.sprintf)( +/* translators: %s max price */ +Object(c.__)("Up to %s","woo-gutenberg-products-block"),Object(o.formatPrice)(t)),m=e=>{let{type:t,name:r,prefix:o="",removeCallback:a=(()=>null),showLabel:i=!0,displayStyle:p}=e;const d=o?Object(n.createElement)(n.Fragment,null,o," ",r):r,f=Object(c.sprintf)( +/* translators: %s attribute value used in the filter. For example: yellow, green, small, large. */ +Object(c.__)("Remove %s filter","woo-gutenberg-products-block"),r);return Object(n.createElement)("li",{className:"wc-block-active-filters__list-item",key:t+":"+r},i&&Object(n.createElement)("span",{className:"wc-block-active-filters__list-item-type"},t+": "),"chips"===p?Object(n.createElement)(s.a,{element:"span",text:d,onRemove:a,radius:"large",ariaLabel:f}):Object(n.createElement)("span",{className:"wc-block-active-filters__list-item-name"},Object(n.createElement)("button",{className:"wc-block-active-filters__list-item-remove",onClick:a},Object(n.createElement)(u.a,{className:"wc-block-components-chip__remove-icon",icon:b.a,size:16}),Object(n.createElement)(l.a,{screenReaderLabel:f})),d))},g=function(){if(!window)return;const e=window.location.href,t=Object(a.getQueryArgs)(e),r=Object(a.removeQueryArgs)(e,...Object.keys(t));for(var n=arguments.length,c=new Array(n),o=0;o{if("string"==typeof e)return delete t[e];if("object"==typeof e){const r=Object.keys(e)[0],n=t[r].toString().split(",");t[r]=n.filter(t=>t!==e[r]).join(",")}});const s=Object.fromEntries(Object.entries(t).filter(e=>{let[,t]=e;return t})),l=Object(a.addQueryArgs)(r,s);Object(i.c)(l)},O=["min_price","max_price","rating_filter","filter_","query_type_"],j=e=>{let t=!1;for(let r=0;O.length>r;r++){const n=O[r];if(n===e.substring(0,n.length)){t=!0;break}}return t},y=()=>{if(!window)return;const e=window.location.href,t=Object(a.getQueryArgs)(e),r=Object(a.removeQueryArgs)(e,...Object.keys(t)),n=Object.fromEntries(Object.keys(t).filter(e=>!j(e)).map(e=>[e,t[e]])),c=Object(a.addQueryArgs)(r,n);Object(i.c)(c)},_=()=>{if(!window)return!1;const e=window.location.href,t=Object(a.getQueryArgs)(e),r=Object.keys(t);let n=!1;for(let e=0;r.length>e;e++){const t=r[e];if(j(t)){n=!0;break}}return n},w=e=>{if(!window)return!1;const t=e.map(e=>"filter_"+e.attribute_name),r=window.location.href,n=Object(a.getQueryArgs)(r),c=Object.keys(n);let o=!1;for(let e=0;c.length>e;e++){const r=c[e];if(t.includes(r)){o=!0;break}}return o},h=e=>({heading:Object(p.a)(null==e?void 0:e.heading)?e.heading:"",headingLevel:Object(p.a)(null==e?void 0:e.headingLevel)&&parseInt(e.headingLevel,10)||d.attributes.headingLevel.default,displayStyle:Object(p.a)(null==e?void 0:e.displayStyle)&&e.displayStyle||d.attributes.displayStyle.default})},46:function(e,t,r){"use strict";r.d(t,"a",(function(){return c})),r.d(t,"b",(function(){return o}));var n=r(0);const c=Object(n.createContext)({}),o=()=>{const{wrapper:e}=Object(n.useContext)(c);return t=>{e&&e.current&&(e.current.hidden=!t)}}},5:function(e,t){e.exports=window.lodash},50:function(e,t,r){"use strict";r.d(t,"a",(function(){return i}));var n=r(15),c=r.n(n),o=r(0),s=r(16);const l=[".wp-block-woocommerce-cart"],a=e=>{let{Block:t,containers:r,getProps:n=(()=>({})),getErrorBoundaryProps:l=(()=>({}))}=e;0!==r.length&&Array.prototype.forEach.call(r,(e,r)=>{const a=n(e,r),i=l(e,r),u={...e.dataset,...a.attributes||{}};(e=>{let{Block:t,container:r,attributes:n={},props:l={},errorBoundaryProps:a={}}=e;Object(o.render)(Object(o.createElement)(s.a,a,Object(o.createElement)(o.Suspense,{fallback:Object(o.createElement)("div",{className:"wc-block-placeholder"})},t&&Object(o.createElement)(t,c()({},l,{attributes:n})))),r,()=>{r.classList&&r.classList.remove("is-loading")})})({Block:t,container:e,props:a,attributes:u,errorBoundaryProps:i})})},i=e=>{const t=document.body.querySelectorAll(l.join(",")),{Block:r,getProps:n,getErrorBoundaryProps:c,selector:o}=e;(e=>{let{Block:t,getProps:r,getErrorBoundaryProps:n,selector:c,wrappers:o}=e;const s=document.body.querySelectorAll(c);o&&o.length>0&&Array.prototype.filter.call(s,e=>!((e,t)=>Array.prototype.some.call(t,t=>t.contains(e)&&!t.isSameNode(e)))(e,o)),a({Block:t,containers:s,getProps:r,getErrorBoundaryProps:n})})({Block:r,getProps:n,getErrorBoundaryProps:c,selector:o,wrappers:t}),Array.prototype.forEach.call(t,t=>{t.addEventListener("wc-blocks_render_blocks_frontend",()=>{(e=>{let{Block:t,getProps:r,getErrorBoundaryProps:n,selector:c,wrapper:o}=e;const s=o.querySelectorAll(c);a({Block:t,containers:s,getProps:r,getErrorBoundaryProps:n})})({...e,wrapper:t})})})}},6:function(e,t,r){var n;!function(){"use strict";var r={}.hasOwnProperty;function c(){for(var e=[],t=0;t{const{namespace:t,resourceName:r,resourceValues:l=[],query:a={},shouldSelect:i=!0}=e;if(!t||!r)throw new Error("The options object must have valid values for the namespace and the resource properties.");const u=Object(o.useRef)({results:[],isLoading:!0}),b=Object(s.a)(a),p=Object(s.a)(l),d=(()=>{const[,e]=Object(o.useState)();return Object(o.useCallback)(t=>{e(()=>{throw t})},[])})(),f=Object(c.useSelect)(e=>{if(!i)return null;const c=e(n.COLLECTIONS_STORE_KEY),o=[t,r,b,p],s=c.getCollectionError(...o);if(s){if(!(s instanceof Error))throw new Error("TypeError: `error` object is not an instance of Error constructor");d(s)}return{results:c.getCollection(...o),isLoading:!c.hasFinishedResolution("getCollection",o)}},[t,r,p,b,i]);return null!==f&&(u.current=f),u.current}},64:function(e,t,r){"use strict";r.d(t,"a",(function(){return c}));var n=r(8);function c(e,t){const r=Object(n.useRef)();return Object(n.useEffect)(()=>{r.current===e||t&&!t(e,r.current)||(r.current=e)},[e,t]),r.current}},69:function(e,t,r){"use strict";var n=r(0);r(102),t.a=e=>{let{children:t}=e;return Object(n.createElement)("div",{className:"wc-block-filter-title-placeholder"},t)}},7:function(e,t){e.exports=window.wp.data},72:function(e,t,r){"use strict";r.d(t,"b",(function(){return l})),r.d(t,"a",(function(){return a})),r.d(t,"d",(function(){return i})),r.d(t,"c",(function(){return u}));var n=r(14),c=r(2),o=r(74);const s=Object(c.getSettingWithCoercion)("is_rendering_php_template",!1,o.a),l="query_type_",a="filter_";function i(e){return window?Object(n.getQueryArg)(window.location.href,e):null}function u(e){s?window.location.href=e:window.history.replaceState({},"",e)}},74:function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));const n=e=>"boolean"==typeof e},76:function(e,t,r){"use strict";var n=r(0);t.a=function(e){let{icon:t,size:r=24,...c}=e;return Object(n.cloneElement)(t,{width:r,height:r,...c})}},8:function(e,t){e.exports=window.React}}); \ No newline at end of file diff --git a/build/active-filters-wrapper-frontend.js b/build/active-filters-wrapper-frontend.js new file mode 100644 index 00000000000..43d64e8d2df --- /dev/null +++ b/build/active-filters-wrapper-frontend.js @@ -0,0 +1,15 @@ +(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[11],{102:function(e,t){},112:function(e,t,r){"use strict";r.d(t,"a",(function(){return c})),r.d(t,"b",(function(){return a}));var n=r(5);const c=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0,r=arguments.length>2?arguments[2]:void 0,c=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";const a=e.filter(e=>e.attribute===r.taxonomy),l=a.length?a[0]:null;if(!(l&&l.slug&&Array.isArray(l.slug)&&l.slug.includes(c)))return;const s=l.slug.filter(e=>e!==c),i=e.filter(e=>e.attribute!==r.taxonomy);s.length>0&&(l.slug=s.sort(),i.push(l)),t(Object(n.sortBy)(i,"attribute"))},a=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0,r=arguments.length>2?arguments[2]:void 0,c=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"in";if(!r||!r.taxonomy)return[];const l=e.filter(e=>e.attribute!==r.taxonomy);return 0===c.length?t(l):(l.push({attribute:r.taxonomy,operator:a,slug:c.map(e=>{let{slug:t}=e;return t}).sort()}),t(Object(n.sortBy)(l,"attribute"))),l}},115:function(e,t,r){"use strict";r.d(t,"a",(function(){return c})),r(53);var n=r(37);const c=()=>n.n>1},116:function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var n=r(23),c=r(20);const a=e=>Object(n.a)(e)?JSON.parse(e)||{}:Object(c.a)(e)?e:{}},122:function(e,t,r){"use strict";r.d(t,"a",(function(){return a})),r.d(t,"b",(function(){return l}));var n=r(2);const c=Object(n.getSetting)("attributes",[]).reduce((e,t)=>{const r=(n=t)&&n.attribute_name?{id:parseInt(n.attribute_id,10),name:n.attribute_name,taxonomy:"pa_"+n.attribute_name,label:n.attribute_label}:null;var n;return r&&r.id&&e.push(r),e},[]),a=e=>{if(e)return c.find(t=>t.id===e)},l=e=>{if(e)return c.find(t=>t.taxonomy===e)}},144:function(e){e.exports=JSON.parse('{"name":"woocommerce/active-filters","version":"1.0.0","title":"Active Filters Controls","description":"Display the currently active filters.","category":"woocommerce","keywords":["WooCommerce"],"supports":{"html":false,"multiple":false,"inserter":false,"color":{"text":true,"background":false},"lock":false},"attributes":{"displayStyle":{"type":"string","default":"list"},"headingLevel":{"type":"number","default":3}},"textdomain":"woo-gutenberg-products-block","apiVersion":2,"$schema":"https://schemas.wp.org/trunk/block.json"}')},157:function(e,t,r){"use strict";var n=r(0),c=r(1),a=r(32),l=r(2),s=r(6),i=r.n(s),o=r(21),u=r(74),b=r(20),f=r(221),d=r(72),p=r(69);r(220);var m=r(122),O=r(44),j=r(63),g=r(31),y=r(112),_=e=>{let{attributeObject:t,slugs:r=[],operator:s="in",displayStyle:i,isLoadingCallback:o}=e;const{results:b,isLoading:d}=Object(j.a)({namespace:"/wc/store/v1",resourceName:"products/attributes/terms",resourceValues:[t.id]}),[p,m]=Object(a.b)("attributes",[]);if(Object(n.useEffect)(()=>{o(d)},[d,o]),!Array.isArray(b)||!Object(f.b)(b)||!Object(f.a)(p))return null;const _=t.label,v=Object(l.getSettingWithCoercion)("is_rendering_php_template",!1,u.a);return Object(n.createElement)("li",null,Object(n.createElement)("span",{className:"wc-block-active-filters__list-item-type"},_,":"),Object(n.createElement)("ul",null,r.map((e,r)=>{const a=b.find(t=>t.slug===e);if(!a)return null;let l="";return r>0&&"and"===s&&(l=Object(n.createElement)("span",{className:"wc-block-active-filters__list-item-operator"},Object(c.__)("All","woo-gutenberg-products-block"))),Object(O.f)({type:_,name:Object(g.decodeEntities)(a.name||e),prefix:l,isLoading:d,removeCallback:()=>{const r=p.find(e=>{let{attribute:r}=e;return r==="pa_"+t.name});1===(null==r?void 0:r.slug.length)?Object(O.e)("query_type_"+t.name,"filter_"+t.name):Object(O.e)({["filter_"+t.name]:e}),v||Object(y.a)(p,m,t,e)},showLabel:!1,displayStyle:i})})))},v=e=>{let{displayStyle:t,isLoading:r}=e;return r?Object(n.createElement)(n.Fragment,null,[...Array("list"===t?2:3)].map((e,r)=>Object(n.createElement)("li",{className:"list"===t?"show-loading-state-list":"show-loading-state-chips",key:r},Object(n.createElement)("span",{className:"show-loading-state__inner"})))):null},h=r(46);t.a=e=>{let{attributes:t,isEditor:r=!1}=e;const s=Object(h.b)(),j=function(){const e=Object(n.useRef)(!1);return Object(n.useEffect)(()=>(e.current=!0,()=>{e.current=!1}),[]),Object(n.useCallback)(()=>e.current,[])}()(),g=Object(l.getSettingWithCoercion)("is_rendering_php_template",!1,u.a),[y,w]=Object(n.useState)(!0),k=Object(O.c)()&&!r&&y,[E,S]=Object(a.b)("attributes",[]),[N,x]=Object(a.b)("stock_status",[]),[A,C]=Object(a.b)("min_price"),[L,R]=Object(a.b)("max_price"),[F,T]=Object(a.b)("rating"),Q=Object(l.getSetting)("stockStatusOptions",[]),P=Object(l.getSetting)("attributes",[]),B=Object(n.useMemo)(()=>{if(k||0===N.length||(e=N,!Array.isArray(e)||!e.every(e=>["instock","outofstock","onbackorder"].includes(e)))||!(e=>Object(b.a)(e)&&Object.keys(e).every(e=>["instock","outofstock","onbackorder"].includes(e)))(Q))return null;var e;const r=Object(c.__)("Stock Status","woo-gutenberg-products-block");return Object(n.createElement)("li",null,Object(n.createElement)("span",{className:"wc-block-active-filters__list-item-type"},r,":"),Object(n.createElement)("ul",null,N.map(e=>Object(O.f)({type:r,name:Q[e],removeCallback:()=>{if(Object(O.e)({filter_stock_status:e}),!g){const t=N.filter(t=>t!==e);x(t)}},showLabel:!1,displayStyle:t.displayStyle}))))},[k,Q,N,x,t.displayStyle,g]),Y=Object(n.useMemo)(()=>k||!Number.isFinite(A)&&!Number.isFinite(L)?null:Object(O.f)({type:Object(c.__)("Price","woo-gutenberg-products-block"),name:Object(O.b)(A,L),removeCallback:()=>{Object(O.e)("max_price","min_price"),g||(C(void 0),R(void 0))},displayStyle:t.displayStyle}),[k,A,L,t.displayStyle,C,R,g]),V=Object(n.useMemo)(()=>!Object(f.a)(E)&&j||!E.length&&!Object(O.g)(P)?(y&&w(!1),null):E.map(e=>{const r=Object(m.b)(e.attribute);return r?Object(n.createElement)(_,{attributeObject:r,displayStyle:t.displayStyle,slugs:e.slug,key:e.attribute,operator:e.operator,isLoadingCallback:w}):(y&&w(!1),null)}),[E,j,P,y,t.displayStyle]);Object(n.useEffect)(()=>{var e;if(!g)return;if(F.length&&F.length>0)return;const t=null===(e=Object(d.d)("rating_filter"))||void 0===e?void 0:e.toString();t&&T(t.split(","))},[g,F,T]);const K=Object(n.useMemo)(()=>{if(k||0===F.length||(e=F,!Array.isArray(e)||!e.every(e=>["1","2","3","4","5"].includes(e))))return null;var e;const r=Object(c.__)("Rating","woo-gutenberg-products-block");return Object(n.createElement)("li",null,Object(n.createElement)("span",{className:"wc-block-active-filters__list-item-type"},r,":"),Object(n.createElement)("ul",null,F.map(e=>Object(O.f)({type:r,name:Object(c.sprintf)( +/* translators: %s is referring to the average rating value */ +Object(c.__)("Rated %s out of 5","woo-gutenberg-products-block"),e),removeCallback:()=>{if(Object(O.e)({rating_filter:e}),!g){const t=F.filter(t=>t!==e);T(t)}},showLabel:!1,displayStyle:t.displayStyle}))))},[k,F,T,t.displayStyle,g]);if(!k&&!(E.length>0||N.length>0||F.length>0||Number.isFinite(A)||Number.isFinite(L))&&!r)return s(!1),null;const W="h"+t.headingLevel,U=Object(n.createElement)(W,{className:"wc-block-active-filters__title"},t.heading),z=k?Object(n.createElement)(p.a,null,U):U;if(!Object(l.getSettingWithCoercion)("has_filterable_products",!1,u.a))return s(!1),null;s(!0);const D=i()("wc-block-active-filters__list",{"wc-block-active-filters__list--chips":"chips"===t.displayStyle,"wc-block-active-filters--loading":k});return Object(n.createElement)(n.Fragment,null,!r&&t.heading&&z,Object(n.createElement)("div",{className:"wc-block-active-filters"},Object(n.createElement)("ul",{className:D},r?Object(n.createElement)(n.Fragment,null,Object(O.f)({type:Object(c.__)("Size","woo-gutenberg-products-block"),name:Object(c.__)("Small","woo-gutenberg-products-block"),displayStyle:t.displayStyle}),Object(O.f)({type:Object(c.__)("Color","woo-gutenberg-products-block"),name:Object(c.__)("Blue","woo-gutenberg-products-block"),displayStyle:t.displayStyle})):Object(n.createElement)(n.Fragment,null,Object(n.createElement)(v,{isLoading:k,displayStyle:t.displayStyle}),Y,B,V,K)),k?Object(n.createElement)("span",{className:"wc-block-active-filters__clear-all-placeholder"}):Object(n.createElement)("button",{className:"wc-block-active-filters__clear-all",onClick:()=>{Object(O.a)(),g||(C(void 0),R(void 0),S([]),x([]),T([]))}},Object(n.createElement)(o.a,{label:Object(c.__)("Clear All","woo-gutenberg-products-block"),screenReaderLabel:Object(c.__)("Clear All Filters","woo-gutenberg-products-block")}))))}},20:function(e,t,r){"use strict";r.d(t,"a",(function(){return n})),r.d(t,"b",(function(){return c}));const n=e=>!(e=>null===e)(e)&&e instanceof Object&&e.constructor===Object;function c(e,t){return n(e)&&t in e}},21:function(e,t,r){"use strict";var n=r(0),c=r(6),a=r.n(c);t.a=e=>{let t,{label:r,screenReaderLabel:c,wrapperElement:l,wrapperProps:s={}}=e;const i=null!=r,o=null!=c;return!i&&o?(t=l||"span",s={...s,className:a()(s.className,"screen-reader-text")},Object(n.createElement)(t,s,c)):(t=l||n.Fragment,i&&o&&r!==c?Object(n.createElement)(t,s,Object(n.createElement)("span",{"aria-hidden":"true"},r),Object(n.createElement)("span",{className:"screen-reader-text"},c)):Object(n.createElement)(t,s,r))}},217:function(e,t){},219:function(e,t,r){"use strict";var n=r(0),c=r(12);const a=Object(n.createElement)(c.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(n.createElement)(c.Path,{d:"M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z"}));t.a=a},220:function(e,t){},221:function(e,t,r){"use strict";r.d(t,"b",(function(){return a})),r.d(t,"a",(function(){return s}));var n=r(20);const c=e=>Object(n.b)(e,"count")&&Object(n.b)(e,"description")&&Object(n.b)(e,"id")&&Object(n.b)(e,"name")&&Object(n.b)(e,"parent")&&Object(n.b)(e,"slug")&&"number"==typeof e.count&&"string"==typeof e.description&&"number"==typeof e.id&&"string"==typeof e.name&&"number"==typeof e.parent&&"string"==typeof e.slug,a=e=>Array.isArray(e)&&e.every(c),l=e=>Object(n.b)(e,"attribute")&&Object(n.b)(e,"operator")&&Object(n.b)(e,"slug")&&"string"==typeof e.attribute&&"string"==typeof e.operator&&Array.isArray(e.slug)&&e.slug.every(e=>"string"==typeof e),s=e=>Array.isArray(e)&&e.every(l)},229:function(e,t,r){"use strict";var n=r(15),c=r.n(n),a=r(0),l=r(6),s=r.n(l),i=r(1),o=r(76),u=r(219);r(217);var b=e=>{let{text:t,screenReaderText:r="",element:n="li",className:l="",radius:i="small",children:o=null,...u}=e;const b=n,f=s()(l,"wc-block-components-chip","wc-block-components-chip--radius-"+i),d=Boolean(r&&r!==t);return Object(a.createElement)(b,c()({className:f},u),Object(a.createElement)("span",{"aria-hidden":d,className:"wc-block-components-chip__text"},t),d&&Object(a.createElement)("span",{className:"screen-reader-text"},r),o)};t.a=e=>{let{ariaLabel:t="",className:r="",disabled:n=!1,onRemove:l=(()=>{}),removeOnAnyClick:f=!1,text:d,screenReaderText:p="",...m}=e;const O=f?"span":"button";if(!t){const e=p&&"string"==typeof p?p:d;t="string"!=typeof e? +/* translators: Remove chip. */ +Object(i.__)("Remove","woo-gutenberg-products-block"):Object(i.sprintf)( +/* translators: %s text of the chip to remove. */ +Object(i.__)('Remove "%s"',"woo-gutenberg-products-block"),e)}const j={"aria-label":t,disabled:n,onClick:l,onKeyDown:e=>{"Backspace"!==e.key&&"Delete"!==e.key||l()}},g=f?j:{},y=f?{"aria-hidden":!0}:j;return Object(a.createElement)(b,c()({},m,g,{className:s()(r,"is-removable"),element:f?"button":m.element,screenReaderText:p,text:d}),Object(a.createElement)(O,c()({className:"wc-block-components-chip__remove"},y),Object(a.createElement)(o.a,{className:"wc-block-components-chip__remove-icon",icon:u.a,size:16})))}},23:function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));const n=e=>"string"==typeof e},25:function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var n=r(0);const c=Object(n.createContext)("page"),a=()=>Object(n.useContext)(c);c.Provider},287:function(e,t,r){"use strict";r.d(t,"a",(function(){return s}));var n=r(66),c=r(115),a=r(20),l=r(116);const s=e=>{if(!Object(c.a)())return{className:"",style:{}};const t=Object(a.a)(e)?e:{},r=Object(l.a)(t.style);return Object(n.__experimentalUseColorProps)({...t,style:r})}},30:function(e,t,r){"use strict";r.d(t,"a",(function(){return l}));var n=r(0),c=r(13),a=r.n(c);function l(e){const t=Object(n.useRef)(e);return a()(e,t.current)||(t.current=e),t.current}},32:function(e,t,r){"use strict";r.d(t,"a",(function(){return b})),r.d(t,"b",(function(){return f})),r.d(t,"c",(function(){return d}));var n=r(3),c=r(7),a=r(0),l=r(13),s=r.n(l),i=r(30),o=r(64),u=r(25);const b=e=>{const t=Object(u.a)();e=e||t;const r=Object(c.useSelect)(t=>t(n.QUERY_STATE_STORE_KEY).getValueForQueryContext(e,void 0),[e]),{setValueForQueryContext:l}=Object(c.useDispatch)(n.QUERY_STATE_STORE_KEY);return[r,Object(a.useCallback)(t=>{l(e,t)},[e,l])]},f=(e,t,r)=>{const l=Object(u.a)();r=r||l;const s=Object(c.useSelect)(c=>c(n.QUERY_STATE_STORE_KEY).getValueForQueryKey(r,e,t),[r,e]),{setQueryValue:i}=Object(c.useDispatch)(n.QUERY_STATE_STORE_KEY);return[s,Object(a.useCallback)(t=>{i(r,e,t)},[r,e,i])]},d=(e,t)=>{const r=Object(u.a)();t=t||r;const[n,c]=b(t),l=Object(i.a)(n),f=Object(i.a)(e),d=Object(o.a)(f),p=Object(a.useRef)(!1);return Object(a.useEffect)(()=>{s()(d,f)||(c(Object.assign({},l,f)),p.current=!0)},[l,f,d,c]),p.current?[n,c]:[e,c]}},44:function(e,t,r){"use strict";r.d(t,"b",(function(){return p})),r.d(t,"f",(function(){return m})),r.d(t,"e",(function(){return O})),r.d(t,"a",(function(){return y})),r.d(t,"c",(function(){return _})),r.d(t,"g",(function(){return v})),r.d(t,"d",(function(){return h}));var n=r(0),c=r(1),a=r(43),l=r(229),s=r(21),i=r(14),o=r(72),u=r(76),b=r(219),f=r(23),d=r(144);const p=(e,t)=>Number.isFinite(e)&&Number.isFinite(t)?Object(c.sprintf)( +/* translators: %1$s min price, %2$s max price */ +Object(c.__)("Between %1$s and %2$s","woo-gutenberg-products-block"),Object(a.formatPrice)(e),Object(a.formatPrice)(t)):Number.isFinite(e)?Object(c.sprintf)( +/* translators: %s min price */ +Object(c.__)("From %s","woo-gutenberg-products-block"),Object(a.formatPrice)(e)):Object(c.sprintf)( +/* translators: %s max price */ +Object(c.__)("Up to %s","woo-gutenberg-products-block"),Object(a.formatPrice)(t)),m=e=>{let{type:t,name:r,prefix:a="",removeCallback:i=(()=>null),showLabel:o=!0,displayStyle:f}=e;const d=a?Object(n.createElement)(n.Fragment,null,a," ",r):r,p=Object(c.sprintf)( +/* translators: %s attribute value used in the filter. For example: yellow, green, small, large. */ +Object(c.__)("Remove %s filter","woo-gutenberg-products-block"),r);return Object(n.createElement)("li",{className:"wc-block-active-filters__list-item",key:t+":"+r},o&&Object(n.createElement)("span",{className:"wc-block-active-filters__list-item-type"},t+": "),"chips"===f?Object(n.createElement)(l.a,{element:"span",text:d,onRemove:i,radius:"large",ariaLabel:p}):Object(n.createElement)("span",{className:"wc-block-active-filters__list-item-name"},Object(n.createElement)("button",{className:"wc-block-active-filters__list-item-remove",onClick:i},Object(n.createElement)(u.a,{className:"wc-block-components-chip__remove-icon",icon:b.a,size:16}),Object(n.createElement)(s.a,{screenReaderLabel:p})),d))},O=function(){if(!window)return;const e=window.location.href,t=Object(i.getQueryArgs)(e),r=Object(i.removeQueryArgs)(e,...Object.keys(t));for(var n=arguments.length,c=new Array(n),a=0;a{if("string"==typeof e)return delete t[e];if("object"==typeof e){const r=Object.keys(e)[0],n=t[r].toString().split(",");t[r]=n.filter(t=>t!==e[r]).join(",")}});const l=Object.fromEntries(Object.entries(t).filter(e=>{let[,t]=e;return t})),s=Object(i.addQueryArgs)(r,l);Object(o.c)(s)},j=["min_price","max_price","rating_filter","filter_","query_type_"],g=e=>{let t=!1;for(let r=0;j.length>r;r++){const n=j[r];if(n===e.substring(0,n.length)){t=!0;break}}return t},y=()=>{if(!window)return;const e=window.location.href,t=Object(i.getQueryArgs)(e),r=Object(i.removeQueryArgs)(e,...Object.keys(t)),n=Object.fromEntries(Object.keys(t).filter(e=>!g(e)).map(e=>[e,t[e]])),c=Object(i.addQueryArgs)(r,n);Object(o.c)(c)},_=()=>{if(!window)return!1;const e=window.location.href,t=Object(i.getQueryArgs)(e),r=Object.keys(t);let n=!1;for(let e=0;r.length>e;e++){const t=r[e];if(g(t)){n=!0;break}}return n},v=e=>{if(!window)return!1;const t=e.map(e=>"filter_"+e.attribute_name),r=window.location.href,n=Object(i.getQueryArgs)(r),c=Object.keys(n);let a=!1;for(let e=0;c.length>e;e++){const r=c[e];if(t.includes(r)){a=!0;break}}return a},h=e=>({heading:Object(f.a)(null==e?void 0:e.heading)?e.heading:"",headingLevel:Object(f.a)(null==e?void 0:e.headingLevel)&&parseInt(e.headingLevel,10)||d.attributes.headingLevel.default,displayStyle:Object(f.a)(null==e?void 0:e.displayStyle)&&e.displayStyle||d.attributes.displayStyle.default})},483:function(e,t,r){"use strict";r.r(t);var n=r(0),c=r(287),a=r(23),l=r(157),s=r(44);t.default=e=>{const t=Object(c.a)(e);return Object(n.createElement)("div",{className:Object(a.a)(e.className)?e.className:"",style:{...t.style}},Object(n.createElement)(l.a,{isEditor:!1,attributes:Object(s.d)(e)}))}},6:function(e,t,r){var n;!function(){"use strict";var r={}.hasOwnProperty;function c(){for(var e=[],t=0;t{const{namespace:t,resourceName:r,resourceValues:s=[],query:i={},shouldSelect:o=!0}=e;if(!t||!r)throw new Error("The options object must have valid values for the namespace and the resource properties.");const u=Object(a.useRef)({results:[],isLoading:!0}),b=Object(l.a)(i),f=Object(l.a)(s),d=(()=>{const[,e]=Object(a.useState)();return Object(a.useCallback)(t=>{e(()=>{throw t})},[])})(),p=Object(c.useSelect)(e=>{if(!o)return null;const c=e(n.COLLECTIONS_STORE_KEY),a=[t,r,b,f],l=c.getCollectionError(...a);if(l){if(!(l instanceof Error))throw new Error("TypeError: `error` object is not an instance of Error constructor");d(l)}return{results:c.getCollection(...a),isLoading:!c.hasFinishedResolution("getCollection",a)}},[t,r,f,b,o]);return null!==p&&(u.current=p),u.current}},64:function(e,t,r){"use strict";r.d(t,"a",(function(){return c}));var n=r(8);function c(e,t){const r=Object(n.useRef)();return Object(n.useEffect)(()=>{r.current===e||t&&!t(e,r.current)||(r.current=e)},[e,t]),r.current}},69:function(e,t,r){"use strict";var n=r(0);r(102),t.a=e=>{let{children:t}=e;return Object(n.createElement)("div",{className:"wc-block-filter-title-placeholder"},t)}},72:function(e,t,r){"use strict";r.d(t,"b",(function(){return s})),r.d(t,"a",(function(){return i})),r.d(t,"d",(function(){return o})),r.d(t,"c",(function(){return u}));var n=r(14),c=r(2),a=r(74);const l=Object(c.getSettingWithCoercion)("is_rendering_php_template",!1,a.a),s="query_type_",i="filter_";function o(e){return window?Object(n.getQueryArg)(window.location.href,e):null}function u(e){l?window.location.href=e:window.history.replaceState({},"",e)}},74:function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));const n=e=>"boolean"==typeof e},76:function(e,t,r){"use strict";var n=r(0);t.a=function(e){let{icon:t,size:r=24,...c}=e;return Object(n.cloneElement)(t,{width:r,height:r,...c})}}}]); \ No newline at end of file diff --git a/build/active-filters.asset.php b/build/active-filters.asset.php new file mode 100644 index 00000000000..babdf851606 --- /dev/null +++ b/build/active-filters.asset.php @@ -0,0 +1 @@ + array('lodash', 'react', 'wc-blocks-data-store', 'wc-price-format', 'wc-settings', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-element', 'wp-html-entities', 'wp-i18n', 'wp-is-shallow-equal', 'wp-polyfill', 'wp-primitives', 'wp-url'), 'version' => '035526aa931db0060256c8b546e27d05'); \ No newline at end of file diff --git a/build/active-filters.js b/build/active-filters.js new file mode 100644 index 00000000000..6e6a560dc4c --- /dev/null +++ b/build/active-filters.js @@ -0,0 +1,15 @@ +this.wc=this.wc||{},this.wc.blocks=this.wc.blocks||{},this.wc.blocks["active-filters"]=function(e){function t(t){for(var n,l,a=t[0],i=t[1],s=t[2],b=0,p=[];b{const{wrapper:e}=Object(n.useContext)(c);return t=>{e&&e.current&&(e.current.hidden=!t)}}},103:function(e,t,r){"use strict";r.d(t,"a",(function(){return c}));var n=r(13);function c(e,t){const r=Object(n.useRef)();return Object(n.useEffect)(()=>{r.current===e||t&&!t(e,r.current)||(r.current=e)},[e,t]),r.current}},106:function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var n=r(10),c=r(7),o=r(0),l=r(42);const a=e=>{const{namespace:t,resourceName:r,resourceValues:a=[],query:i={},shouldSelect:s=!0}=e;if(!t||!r)throw new Error("The options object must have valid values for the namespace and the resource properties.");const u=Object(o.useRef)({results:[],isLoading:!0}),b=Object(l.a)(i),p=Object(l.a)(a),d=(()=>{const[,e]=Object(o.useState)();return Object(o.useCallback)(t=>{e(()=>{throw t})},[])})(),m=Object(c.useSelect)(e=>{if(!s)return null;const c=e(n.COLLECTIONS_STORE_KEY),o=[t,r,b,p],l=c.getCollectionError(...o);if(l){if(!(l instanceof Error))throw new Error("TypeError: `error` object is not an instance of Error constructor");d(l)}return{results:c.getCollection(...o),isLoading:!c.hasFinishedResolution("getCollection",o)}},[t,r,p,b,s]);return null!==m&&(u.current=m),u.current}},11:function(e,t){e.exports=window.wp.primitives},12:function(e,t){e.exports=window.wp.compose},121:function(e,t,r){"use strict";r.d(t,"a",(function(){return s}));var n=r(0),c=r(1),o=r(9),l=r(7),a=r(3),i=r(5);const s=e=>{let{clientId:t,setAttributes:r,filterType:s,attributes:u}=e;const{replaceBlock:b}=Object(l.useDispatch)("core/block-editor"),{heading:p,headingLevel:d}=u;if(Object(l.useSelect)(e=>{const{getBlockParentsByBlockName:r}=e("core/block-editor");return r(t,"woocommerce/filter-wrapper").length>0},[t])||!s)return null;const m=[Object(n.createElement)(a.Button,{key:"convert",onClick:()=>{const e=[Object(o.createBlock)("woocommerce/"+s,{...u,heading:""})];p&&""!==p&&e.unshift(Object(o.createBlock)("core/heading",{content:p,level:null!=d?d:2})),b(t,Object(o.createBlock)("woocommerce/filter-wrapper",{heading:p,filterType:s},[...e])),r({heading:"",lock:{remove:!0}})},variant:"primary"},Object(c.__)("Upgrade block","woo-gutenberg-products-block"))];return Object(n.createElement)(i.Warning,{actions:m},Object(c.__)("Filter block: We have improved this block to make styling easier. Upgrade it using the button below.","woo-gutenberg-products-block"))}},122:function(e,t,r){"use strict";var n=r(0),c=r(5),o=r(12),l=r(1);r(161),t.a=Object(o.withInstanceId)(e=>{let{className:t,headingLevel:r,onChange:o,heading:a,instanceId:i}=e;const s="h"+r;return Object(n.createElement)(s,{className:t},Object(n.createElement)("label",{className:"screen-reader-text",htmlFor:"block-title-"+i},Object(l.__)("Block title","woo-gutenberg-products-block")),Object(n.createElement)(c.PlainText,{id:"block-title-"+i,className:"wc-block-editor-components-title",value:a,onChange:o,style:{backgroundColor:"transparent"}}))})},123:function(e,t,r){"use strict";var n=r(0);r(162),t.a=e=>{let{children:t}=e;return Object(n.createElement)("div",{className:"wc-block-filter-title-placeholder"},t)}},127:function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));const n=e=>"boolean"==typeof e},13:function(e,t){e.exports=window.React},161:function(e,t){},162:function(e,t){},17:function(e,t){e.exports=window.wp.url},175:function(e,t,r){"use strict";r.d(t,"a",(function(){return c})),r.d(t,"b",(function(){return o}));var n=r(8);const c=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0,r=arguments.length>2?arguments[2]:void 0,c=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";const o=e.filter(e=>e.attribute===r.taxonomy),l=o.length?o[0]:null;if(!(l&&l.slug&&Array.isArray(l.slug)&&l.slug.includes(c)))return;const a=l.slug.filter(e=>e!==c),i=e.filter(e=>e.attribute!==r.taxonomy);a.length>0&&(l.slug=a.sort(),i.push(l)),t(Object(n.sortBy)(i,"attribute"))},o=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0,r=arguments.length>2?arguments[2]:void 0,c=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"in";if(!r||!r.taxonomy)return[];const l=e.filter(e=>e.attribute!==r.taxonomy);return 0===c.length?t(l):(l.push({attribute:r.taxonomy,operator:o,slug:c.map(e=>{let{slug:t}=e;return t}).sort()}),t(Object(n.sortBy)(l,"attribute"))),l}},179:function(e){e.exports=JSON.parse('{"name":"woocommerce/active-filters","version":"1.0.0","title":"Active Filters Controls","description":"Display the currently active filters.","category":"woocommerce","keywords":["WooCommerce"],"supports":{"html":false,"multiple":false,"inserter":false,"color":{"text":true,"background":false},"lock":false},"attributes":{"displayStyle":{"type":"string","default":"list"},"headingLevel":{"type":"number","default":3}},"textdomain":"woo-gutenberg-products-block","apiVersion":2,"$schema":"https://schemas.wp.org/trunk/block.json"}')},18:function(e,t){e.exports=window.wp.htmlEntities},184:function(e,t){},2:function(e,t){e.exports=window.wc.wcSettings},207:function(e,t,r){"use strict";r.d(t,"a",(function(){return o})),r.d(t,"b",(function(){return l}));var n=r(2);const c=Object(n.getSetting)("attributes",[]).reduce((e,t)=>{const r=(n=t)&&n.attribute_name?{id:parseInt(n.attribute_id,10),name:n.attribute_name,taxonomy:"pa_"+n.attribute_name,label:n.attribute_label}:null;var n;return r&&r.id&&e.push(r),e},[]),o=e=>{if(e)return c.find(t=>t.id===e)},l=e=>{if(e)return c.find(t=>t.taxonomy===e)}},232:function(e,t,r){"use strict";r.d(t,"b",(function(){return a})),r.d(t,"a",(function(){return i})),r.d(t,"d",(function(){return s})),r.d(t,"c",(function(){return u}));var n=r(17),c=r(2),o=r(127);const l=Object(c.getSettingWithCoercion)("is_rendering_php_template",!1,o.a),a="query_type_",i="filter_";function s(e){return window?Object(n.getQueryArg)(window.location.href,e):null}function u(e){l?window.location.href=e:window.history.replaceState({},"",e)}},24:function(e,t){e.exports=window.wc.priceFormat},246:function(e,t,r){"use strict";var n=r(6),c=r.n(n),o=r(0),l=r(4),a=r.n(l),i=r(1),s=r(80),u=r(532);r(184);var b=e=>{let{text:t,screenReaderText:r="",element:n="li",className:l="",radius:i="small",children:s=null,...u}=e;const b=n,p=a()(l,"wc-block-components-chip","wc-block-components-chip--radius-"+i),d=Boolean(r&&r!==t);return Object(o.createElement)(b,c()({className:p},u),Object(o.createElement)("span",{"aria-hidden":d,className:"wc-block-components-chip__text"},t),d&&Object(o.createElement)("span",{className:"screen-reader-text"},r),s)};t.a=e=>{let{ariaLabel:t="",className:r="",disabled:n=!1,onRemove:l=(()=>{}),removeOnAnyClick:p=!1,text:d,screenReaderText:m="",...f}=e;const g=p?"span":"button";if(!t){const e=m&&"string"==typeof m?m:d;t="string"!=typeof e? +/* translators: Remove chip. */ +Object(i.__)("Remove","woo-gutenberg-products-block"):Object(i.sprintf)( +/* translators: %s text of the chip to remove. */ +Object(i.__)('Remove "%s"',"woo-gutenberg-products-block"),e)}const O={"aria-label":t,disabled:n,onClick:l,onKeyDown:e=>{"Backspace"!==e.key&&"Delete"!==e.key||l()}},j=p?O:{},y=p?{"aria-hidden":!0}:O;return Object(o.createElement)(b,c()({},f,j,{className:a()(r,"is-removable"),element:p?"button":f.element,screenReaderText:m,text:d}),Object(o.createElement)(g,c()({className:"wc-block-components-chip__remove"},y),Object(o.createElement)(s.a,{className:"wc-block-components-chip__remove-icon",icon:u.a,size:16})))}},25:function(e,t){e.exports=window.wp.isShallowEqual},3:function(e,t){e.exports=window.wp.components},30:function(e,t,r){"use strict";var n=r(0),c=r(4),o=r.n(c);t.a=e=>{let t,{label:r,screenReaderLabel:c,wrapperElement:l,wrapperProps:a={}}=e;const i=null!=r,s=null!=c;return!i&&s?(t=l||"span",a={...a,className:o()(a.className,"screen-reader-text")},Object(n.createElement)(t,a,c)):(t=l||n.Fragment,i&&s&&r!==c?Object(n.createElement)(t,a,Object(n.createElement)("span",{"aria-hidden":"true"},r),Object(n.createElement)("span",{className:"screen-reader-text"},c)):Object(n.createElement)(t,a,r))}},32:function(e,t,r){"use strict";r.d(t,"b",(function(){return n})),r.d(t,"c",(function(){return c})),r.d(t,"a",(function(){return o}));const n=e=>!(e=>null===e)(e)&&e instanceof Object&&e.constructor===Object;function c(e,t){return n(e)&&t in e}const o=e=>0===Object.keys(e).length},361:function(e,t,r){e.exports=r(489)},362:function(e,t,r){"use strict";var n=r(0),c=r(11);const o=Object(n.createElement)(c.SVG,{xmlns:"http://www.w3.org/2000/SVG",viewBox:"0 0 24 24"},Object(n.createElement)("path",{fill:"none",d:"M0 0h24v24H0z"}),Object(n.createElement)("path",{d:"M17 6H7c-3.31 0-6 2.69-6 6s2.69 6 6 6h10c3.31 0 6-2.69 6-6s-2.69-6-6-6zm0 10H7c-2.21 0-4-1.79-4-4s1.79-4 4-4h10c2.21 0 4 1.79 4 4s-1.79 4-4 4zm0-7c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3z"}));t.a=o},363:function(e,t){},364:function(e,t){},365:function(e,t,r){"use strict";r.d(t,"b",(function(){return o})),r.d(t,"a",(function(){return a}));var n=r(32);const c=e=>Object(n.c)(e,"count")&&Object(n.c)(e,"description")&&Object(n.c)(e,"id")&&Object(n.c)(e,"name")&&Object(n.c)(e,"parent")&&Object(n.c)(e,"slug")&&"number"==typeof e.count&&"string"==typeof e.description&&"number"==typeof e.id&&"string"==typeof e.name&&"number"==typeof e.parent&&"string"==typeof e.slug,o=e=>Array.isArray(e)&&e.every(c),l=e=>Object(n.c)(e,"attribute")&&Object(n.c)(e,"operator")&&Object(n.c)(e,"slug")&&"string"==typeof e.attribute&&"string"==typeof e.operator&&Array.isArray(e.slug)&&e.slug.every(e=>"string"==typeof e),a=e=>Array.isArray(e)&&e.every(l)},42:function(e,t,r){"use strict";r.d(t,"a",(function(){return l}));var n=r(0),c=r(25),o=r.n(c);function l(e){const t=Object(n.useRef)(e);return o()(e,t.current)||(t.current=e),t.current}},47:function(e,t,r){"use strict";r.d(t,"a",(function(){return o}));var n=r(0);const c=Object(n.createContext)("page"),o=()=>Object(n.useContext)(c);c.Provider},489:function(e,t,r){"use strict";r.r(t);var n=r(6),c=r.n(n),o=r(0),l=r(9),a=r(362),i=r(80),s=r(4),u=r.n(s),b=r(5),p=r(1),d=r(122),m=r(3),f=r(54),g=r(2),O=r(30),j=r(127),y=r(32),w=r(365),_=r(232),h=r(123);r(364);var v=r(207),k=r(24),E=r(246),S=r(17),x=r(532),N=(r(74),r(179));const C=(e,t)=>Number.isFinite(e)&&Number.isFinite(t)?Object(p.sprintf)( +/* translators: %1$s min price, %2$s max price */ +Object(p.__)("Between %1$s and %2$s","woo-gutenberg-products-block"),Object(k.formatPrice)(e),Object(k.formatPrice)(t)):Number.isFinite(e)?Object(p.sprintf)( +/* translators: %s min price */ +Object(p.__)("From %s","woo-gutenberg-products-block"),Object(k.formatPrice)(e)):Object(p.sprintf)( +/* translators: %s max price */ +Object(p.__)("Up to %s","woo-gutenberg-products-block"),Object(k.formatPrice)(t)),A=e=>{let{type:t,name:r,prefix:n="",removeCallback:c=(()=>null),showLabel:l=!0,displayStyle:a}=e;const s=n?Object(o.createElement)(o.Fragment,null,n," ",r):r,u=Object(p.sprintf)( +/* translators: %s attribute value used in the filter. For example: yellow, green, small, large. */ +Object(p.__)("Remove %s filter","woo-gutenberg-products-block"),r);return Object(o.createElement)("li",{className:"wc-block-active-filters__list-item",key:t+":"+r},l&&Object(o.createElement)("span",{className:"wc-block-active-filters__list-item-type"},t+": "),"chips"===a?Object(o.createElement)(E.a,{element:"span",text:s,onRemove:c,radius:"large",ariaLabel:u}):Object(o.createElement)("span",{className:"wc-block-active-filters__list-item-name"},Object(o.createElement)("button",{className:"wc-block-active-filters__list-item-remove",onClick:c},Object(o.createElement)(i.a,{className:"wc-block-components-chip__remove-icon",icon:x.a,size:16}),Object(o.createElement)(O.a,{screenReaderLabel:u})),s))},R=function(){if(!window)return;const e=window.location.href,t=Object(S.getQueryArgs)(e),r=Object(S.removeQueryArgs)(e,...Object.keys(t));for(var n=arguments.length,c=new Array(n),o=0;o{if("string"==typeof e)return delete t[e];if("object"==typeof e){const r=Object.keys(e)[0],n=t[r].toString().split(",");t[r]=n.filter(t=>t!==e[r]).join(",")}});const l=Object.fromEntries(Object.entries(t).filter(e=>{let[,t]=e;return t})),a=Object(S.addQueryArgs)(r,l);Object(_.c)(a)},T=["min_price","max_price","rating_filter","filter_","query_type_"],L=e=>{let t=!1;for(let r=0;T.length>r;r++){const n=T[r];if(n===e.substring(0,n.length)){t=!0;break}}return t};var B=r(106),F=r(18),P=r(175),Q=e=>{let{attributeObject:t,slugs:r=[],operator:n="in",displayStyle:c,isLoadingCallback:l}=e;const{results:a,isLoading:i}=Object(B.a)({namespace:"/wc/store/v1",resourceName:"products/attributes/terms",resourceValues:[t.id]}),[s,u]=Object(f.b)("attributes",[]);if(Object(o.useEffect)(()=>{l(i)},[i,l]),!Array.isArray(a)||!Object(w.b)(a)||!Object(w.a)(s))return null;const b=t.label,d=Object(g.getSettingWithCoercion)("is_rendering_php_template",!1,j.a);return Object(o.createElement)("li",null,Object(o.createElement)("span",{className:"wc-block-active-filters__list-item-type"},b,":"),Object(o.createElement)("ul",null,r.map((e,r)=>{const l=a.find(t=>t.slug===e);if(!l)return null;let m="";return r>0&&"and"===n&&(m=Object(o.createElement)("span",{className:"wc-block-active-filters__list-item-operator"},Object(p.__)("All","woo-gutenberg-products-block"))),A({type:b,name:Object(F.decodeEntities)(l.name||e),prefix:m,isLoading:i,removeCallback:()=>{const r=s.find(e=>{let{attribute:r}=e;return r==="pa_"+t.name});1===(null==r?void 0:r.slug.length)?R("query_type_"+t.name,"filter_"+t.name):R({["filter_"+t.name]:e}),d||Object(P.a)(s,u,t,e)},showLabel:!1,displayStyle:c})})))},M=e=>{let{displayStyle:t,isLoading:r}=e;return r?Object(o.createElement)(o.Fragment,null,[...Array("list"===t?2:3)].map((e,r)=>Object(o.createElement)("li",{className:"list"===t?"show-loading-state-list":"show-loading-state-chips",key:r},Object(o.createElement)("span",{className:"show-loading-state__inner"})))):null},D=r(101),I=e=>{let{attributes:t,isEditor:r=!1}=e;const n=Object(D.a)(),c=function(){const e=Object(o.useRef)(!1);return Object(o.useEffect)(()=>(e.current=!0,()=>{e.current=!1}),[]),Object(o.useCallback)(()=>e.current,[])}()(),l=Object(g.getSettingWithCoercion)("is_rendering_php_template",!1,j.a),[a,i]=Object(o.useState)(!0),s=(()=>{if(!window)return!1;const e=window.location.href,t=Object(S.getQueryArgs)(e),r=Object.keys(t);let n=!1;for(let e=0;r.length>e;e++){const t=r[e];if(L(t)){n=!0;break}}return n})()&&!r&&a,[b,d]=Object(f.b)("attributes",[]),[m,k]=Object(f.b)("stock_status",[]),[E,x]=Object(f.b)("min_price"),[N,T]=Object(f.b)("max_price"),[B,F]=Object(f.b)("rating"),P=Object(g.getSetting)("stockStatusOptions",[]),I=Object(g.getSetting)("attributes",[]),V=Object(o.useMemo)(()=>{if(s||0===m.length||(e=m,!Array.isArray(e)||!e.every(e=>["instock","outofstock","onbackorder"].includes(e)))||!(e=>Object(y.b)(e)&&Object.keys(e).every(e=>["instock","outofstock","onbackorder"].includes(e)))(P))return null;var e;const r=Object(p.__)("Stock Status","woo-gutenberg-products-block");return Object(o.createElement)("li",null,Object(o.createElement)("span",{className:"wc-block-active-filters__list-item-type"},r,":"),Object(o.createElement)("ul",null,m.map(e=>A({type:r,name:P[e],removeCallback:()=>{if(R({filter_stock_status:e}),!l){const t=m.filter(t=>t!==e);k(t)}},showLabel:!1,displayStyle:t.displayStyle}))))},[s,P,m,k,t.displayStyle,l]),W=Object(o.useMemo)(()=>s||!Number.isFinite(E)&&!Number.isFinite(N)?null:A({type:Object(p.__)("Price","woo-gutenberg-products-block"),name:C(E,N),removeCallback:()=>{R("max_price","min_price"),l||(x(void 0),T(void 0))},displayStyle:t.displayStyle}),[s,E,N,t.displayStyle,x,T,l]),Y=Object(o.useMemo)(()=>!Object(w.a)(b)&&c||!b.length&&!(e=>{if(!window)return!1;const t=e.map(e=>"filter_"+e.attribute_name),r=window.location.href,n=Object(S.getQueryArgs)(r),c=Object.keys(n);let o=!1;for(let e=0;c.length>e;e++){const r=c[e];if(t.includes(r)){o=!0;break}}return o})(I)?(a&&i(!1),null):b.map(e=>{const r=Object(v.b)(e.attribute);return r?Object(o.createElement)(Q,{attributeObject:r,displayStyle:t.displayStyle,slugs:e.slug,key:e.attribute,operator:e.operator,isLoadingCallback:i}):(a&&i(!1),null)}),[b,c,I,a,t.displayStyle]);Object(o.useEffect)(()=>{var e;if(!l)return;if(B.length&&B.length>0)return;const t=null===(e=Object(_.d)("rating_filter"))||void 0===e?void 0:e.toString();t&&F(t.split(","))},[l,B,F]);const z=Object(o.useMemo)(()=>{if(s||0===B.length||(e=B,!Array.isArray(e)||!e.every(e=>["1","2","3","4","5"].includes(e))))return null;var e;const r=Object(p.__)("Rating","woo-gutenberg-products-block");return Object(o.createElement)("li",null,Object(o.createElement)("span",{className:"wc-block-active-filters__list-item-type"},r,":"),Object(o.createElement)("ul",null,B.map(e=>A({type:r,name:Object(p.sprintf)( +/* translators: %s is referring to the average rating value */ +Object(p.__)("Rated %s out of 5","woo-gutenberg-products-block"),e),removeCallback:()=>{if(R({rating_filter:e}),!l){const t=B.filter(t=>t!==e);F(t)}},showLabel:!1,displayStyle:t.displayStyle}))))},[s,B,F,t.displayStyle,l]);if(!s&&!(b.length>0||m.length>0||B.length>0||Number.isFinite(E)||Number.isFinite(N))&&!r)return n(!1),null;const K="h"+t.headingLevel,U=Object(o.createElement)(K,{className:"wc-block-active-filters__title"},t.heading),q=s?Object(o.createElement)(h.a,null,U):U;if(!Object(g.getSettingWithCoercion)("has_filterable_products",!1,j.a))return n(!1),null;n(!0);const G=u()("wc-block-active-filters__list",{"wc-block-active-filters__list--chips":"chips"===t.displayStyle,"wc-block-active-filters--loading":s});return Object(o.createElement)(o.Fragment,null,!r&&t.heading&&q,Object(o.createElement)("div",{className:"wc-block-active-filters"},Object(o.createElement)("ul",{className:G},r?Object(o.createElement)(o.Fragment,null,A({type:Object(p.__)("Size","woo-gutenberg-products-block"),name:Object(p.__)("Small","woo-gutenberg-products-block"),displayStyle:t.displayStyle}),A({type:Object(p.__)("Color","woo-gutenberg-products-block"),name:Object(p.__)("Blue","woo-gutenberg-products-block"),displayStyle:t.displayStyle})):Object(o.createElement)(o.Fragment,null,Object(o.createElement)(M,{isLoading:s,displayStyle:t.displayStyle}),W,V,Y,z)),s?Object(o.createElement)("span",{className:"wc-block-active-filters__clear-all-placeholder"}):Object(o.createElement)("button",{className:"wc-block-active-filters__clear-all",onClick:()=>{(()=>{if(!window)return;const e=window.location.href,t=Object(S.getQueryArgs)(e),r=Object(S.removeQueryArgs)(e,...Object.keys(t)),n=Object.fromEntries(Object.keys(t).filter(e=>!L(e)).map(e=>[e,t[e]])),c=Object(S.addQueryArgs)(r,n);Object(_.c)(c)})(),l||(x(void 0),T(void 0),d([]),k([]),F([]))}},Object(o.createElement)(O.a,{label:Object(p.__)("Clear All","woo-gutenberg-products-block"),screenReaderLabel:Object(p.__)("Clear All Filters","woo-gutenberg-products-block")}))))},V=(r(363),r(121)),W=Object(m.withSpokenMessages)(e=>{let{attributes:t,setAttributes:r,clientId:n}=e;const{className:c,displayStyle:l,heading:a,headingLevel:i}=t,s=Object(b.useBlockProps)({className:c});return Object(o.createElement)("div",s,Object(o.createElement)(b.InspectorControls,{key:"inspector"},Object(o.createElement)(m.PanelBody,{title:Object(p.__)("Display Settings","woo-gutenberg-products-block")},Object(o.createElement)(m.__experimentalToggleGroupControl,{label:Object(p.__)("Display Style","woo-gutenberg-products-block"),value:l,onChange:e=>r({displayStyle:e}),className:"wc-block-active-filter__style-toggle"},Object(o.createElement)(m.__experimentalToggleGroupControlOption,{value:"list",label:Object(p.__)("List","woo-gutenberg-products-block")}),Object(o.createElement)(m.__experimentalToggleGroupControlOption,{value:"chips",label:Object(p.__)("Chips","woo-gutenberg-products-block")})))),Object(o.createElement)(V.a,{attributes:t,clientId:n,setAttributes:r,filterType:"active-filters"}),a&&Object(o.createElement)(d.a,{className:"wc-block-active-filters__title",headingLevel:i,heading:a,onChange:e=>r({heading:e})}),Object(o.createElement)(m.Disabled,null,Object(o.createElement)(I,{attributes:t,isEditor:!0})))});const Y={heading:{type:"string",default:Object(p.__)("Active filters","woo-gutenberg-products-block")}};Object(l.registerBlockType)(N,{icon:{src:Object(o.createElement)(i.a,{icon:a.a,className:"wc-block-editor-components-block-icon"})},attributes:{...N.attributes,...Y},edit:W,save(e){let{attributes:t}=e;const{className:r,displayStyle:n,heading:l,headingLevel:a}=t,i={"data-display-style":n,"data-heading":l,"data-heading-level":a};return Object(o.createElement)("div",c()({},b.useBlockProps.save({className:u()("is-loading",r)}),i),Object(o.createElement)("span",{"aria-hidden":!0,className:"wc-block-active-filters__placeholder"}))}})},5:function(e,t){e.exports=window.wp.blockEditor},54:function(e,t,r){"use strict";r.d(t,"a",(function(){return b})),r.d(t,"b",(function(){return p})),r.d(t,"c",(function(){return d}));var n=r(10),c=r(7),o=r(0),l=r(25),a=r.n(l),i=r(42),s=r(103),u=r(47);const b=e=>{const t=Object(u.a)();e=e||t;const r=Object(c.useSelect)(t=>t(n.QUERY_STATE_STORE_KEY).getValueForQueryContext(e,void 0),[e]),{setValueForQueryContext:l}=Object(c.useDispatch)(n.QUERY_STATE_STORE_KEY);return[r,Object(o.useCallback)(t=>{l(e,t)},[e,l])]},p=(e,t,r)=>{const l=Object(u.a)();r=r||l;const a=Object(c.useSelect)(c=>c(n.QUERY_STATE_STORE_KEY).getValueForQueryKey(r,e,t),[r,e]),{setQueryValue:i}=Object(c.useDispatch)(n.QUERY_STATE_STORE_KEY);return[a,Object(o.useCallback)(t=>{i(r,e,t)},[r,e,i])]},d=(e,t)=>{const r=Object(u.a)();t=t||r;const[n,c]=b(t),l=Object(i.a)(n),p=Object(i.a)(e),d=Object(s.a)(p),m=Object(o.useRef)(!1);return Object(o.useEffect)(()=>{a()(d,p)||(c(Object.assign({},l,p)),m.current=!0)},[l,p,d,c]),m.current?[n,c]:[e,c]}},7:function(e,t){e.exports=window.wp.data},74:function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));const n=e=>"string"==typeof e},8:function(e,t){e.exports=window.lodash},9:function(e,t){e.exports=window.wp.blocks}}); \ No newline at end of file diff --git a/build/active-filters/block.json b/build/active-filters/block.json new file mode 100644 index 00000000000..b940d66f7d3 --- /dev/null +++ b/build/active-filters/block.json @@ -0,0 +1,31 @@ +{ + "name": "woocommerce/active-filters", + "version": "1.0.0", + "title": "Active Filters Controls", + "description": "Display the currently active filters.", + "category": "woocommerce", + "keywords": [ "WooCommerce" ], + "supports": { + "html": false, + "multiple": false, + "inserter": false, + "color": { + "text": true, + "background": false + }, + "lock": false + }, + "attributes": { + "displayStyle": { + "type": "string", + "default": "list" + }, + "headingLevel": { + "type": "number", + "default": 3 + } + }, + "textdomain": "woo-gutenberg-products-block", + "apiVersion": 2, + "$schema": "https://schemas.wp.org/trunk/block.json" +} diff --git a/build/all-products-frontend.asset.php b/build/all-products-frontend.asset.php new file mode 100644 index 00000000000..4ec5630c311 --- /dev/null +++ b/build/all-products-frontend.asset.php @@ -0,0 +1 @@ + array('lodash', 'react', 'wc-blocks-checkout', 'wc-blocks-data-store', 'wc-blocks-registry', 'wc-blocks-shared-context', 'wc-blocks-shared-hocs', 'wc-price-format', 'wc-settings', 'wp-a11y', 'wp-api-fetch', 'wp-autop', 'wp-block-editor', 'wp-blocks', 'wp-compose', 'wp-data', 'wp-deprecated', 'wp-dom', 'wp-element', 'wp-hooks', 'wp-html-entities', 'wp-i18n', 'wp-is-shallow-equal', 'wp-polyfill', 'wp-primitives', 'wp-url', 'wp-warning', 'wp-wordcount'), 'version' => 'ceb9c31bd13ae4423f6d4abd7effb9df'); \ No newline at end of file diff --git a/build/all-products-frontend.js b/build/all-products-frontend.js new file mode 100644 index 00000000000..83bc03c2871 --- /dev/null +++ b/build/all-products-frontend.js @@ -0,0 +1,11 @@ +!function(e){function t(t){for(var r,o,n=t[0],a=t[1],s=0,i=[];swindow.performance&&window.performance.getEntriesByType("navigation").length?window.performance.getEntriesByType("navigation")[0].type:"";t.a=c},11:function(e,t){e.exports=window.wc.blocksCheckout},12:function(e,t){e.exports=window.wp.primitives},124:function(e,t){},126:function(e,t,r){"use strict";var c=r(0),o=r(6),n=r.n(o),a=r(21),s=r(9);r(143),t.a=Object(s.withInstanceId)(e=>{let{className:t,instanceId:r,label:o="",onChange:s,options:l,screenReaderLabel:i,value:u=""}=e;const d="wc-block-components-sort-select__select-"+r;return Object(c.createElement)("div",{className:n()("wc-block-sort-select","wc-block-components-sort-select",t)},Object(c.createElement)(a.a,{label:o,screenReaderLabel:i,wrapperElement:"label",wrapperProps:{className:"wc-block-sort-select__label wc-block-components-sort-select__label",htmlFor:d}}),Object(c.createElement)("select",{id:d,className:"wc-block-sort-select__select wc-block-components-sort-select__select",onChange:s,value:u},l&&l.map(e=>Object(c.createElement)("option",{key:e.key,value:e.key},e.label))))})},13:function(e,t){e.exports=window.wp.isShallowEqual},132:function(e,t){e.exports=window.wp.wordcount},133:function(e,t){e.exports=window.wp.autop},134:function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));var c=r(60),o=(r(14),r(2));const n=e=>{const t=Object.keys(o.defaultAddressFields),r=Object(c.a)(t,{},e.country),n=Object.assign({},e);return r.forEach(t=>{let{key:r="",hidden:c=!1}=t;c&&((e,t)=>e in t)(r,e)&&(n[r]="")}),n}},137:function(e,t){e.exports=window.wc.wcBlocksSharedHocs},14:function(e,t){e.exports=window.wp.url},143:function(e,t){},147:function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var c=r(18),o=r(0),n=r(37);r.p=n.l,Object(c.registerBlockComponent)({blockName:"woocommerce/product-price",component:Object(o.lazy)(()=>Promise.all([r.e(1),r.e(72)]).then(r.bind(null,381)))}),Object(c.registerBlockComponent)({blockName:"woocommerce/product-image",component:Object(o.lazy)(()=>r.e(71).then(r.bind(null,532)))}),Object(c.registerBlockComponent)({blockName:"woocommerce/product-title",component:Object(o.lazy)(()=>r.e(79).then(r.bind(null,533)))}),Object(c.registerBlockComponent)({blockName:"woocommerce/product-rating",component:Object(o.lazy)(()=>r.e(73).then(r.bind(null,382)))}),Object(c.registerBlockComponent)({blockName:"woocommerce/product-button",component:Object(o.lazy)(()=>r.e(69).then(r.bind(null,383)))}),Object(c.registerBlockComponent)({blockName:"woocommerce/product-summary",component:Object(o.lazy)(()=>r.e(77).then(r.bind(null,464)))}),Object(c.registerBlockComponent)({blockName:"woocommerce/product-sale-badge",component:Object(o.lazy)(()=>r.e(74).then(r.bind(null,328)))}),Object(c.registerBlockComponent)({blockName:"woocommerce/product-sku",component:Object(o.lazy)(()=>r.e(75).then(r.bind(null,465)))}),Object(c.registerBlockComponent)({blockName:"woocommerce/product-category-list",component:Object(o.lazy)(()=>r.e(70).then(r.bind(null,466)))}),Object(c.registerBlockComponent)({blockName:"woocommerce/product-tag-list",component:Object(o.lazy)(()=>r.e(78).then(r.bind(null,467)))}),Object(c.registerBlockComponent)({blockName:"woocommerce/product-stock-indicator",component:Object(o.lazy)(()=>r.e(76).then(r.bind(null,468)))}),Object(c.registerBlockComponent)({blockName:"woocommerce/product-add-to-cart",component:Object(o.lazy)(()=>Promise.all([r.e(0),r.e(2),r.e(9),r.e(68)]).then(r.bind(null,534)))});const a=e=>Object(c.getRegisteredBlockComponents)(e)},15:function(e,t){function r(){return e.exports=r=Object.assign?Object.assign.bind():function(e){for(var t=1;t{let{imageUrl:t=l.m+"/block-error.svg",header:r=Object(s.__)("Oops!","woo-gutenberg-products-block"),text:c=Object(s.__)("There was an error loading the content.","woo-gutenberg-products-block"),errorMessage:o,errorMessagePrefix:a=Object(s.__)("Error:","woo-gutenberg-products-block"),button:i,showErrorBlock:u=!0}=e;return u?Object(n.createElement)("div",{className:"wc-block-error wc-block-components-error"},t&&Object(n.createElement)("img",{className:"wc-block-error__image wc-block-components-error__image",src:t,alt:""}),Object(n.createElement)("div",{className:"wc-block-error__content wc-block-components-error__content"},r&&Object(n.createElement)("p",{className:"wc-block-error__header wc-block-components-error__header"},r),c&&Object(n.createElement)("p",{className:"wc-block-error__text wc-block-components-error__text"},c),o&&Object(n.createElement)("p",{className:"wc-block-error__message wc-block-components-error__message"},a?a+" ":"",o),i&&Object(n.createElement)("p",{className:"wc-block-error__button wc-block-components-error__button"},i))):null};r(40);class u extends a.Component{constructor(){super(...arguments),o()(this,"state",{errorMessage:"",hasError:!1})}static getDerivedStateFromError(e){return void 0!==e.statusText&&void 0!==e.status?{errorMessage:Object(n.createElement)(n.Fragment,null,Object(n.createElement)("strong",null,e.status),": ",e.statusText),hasError:!0}:{errorMessage:e.message,hasError:!0}}render(){const{header:e,imageUrl:t,showErrorMessage:r=!0,showErrorBlock:c=!0,text:o,errorMessagePrefix:a,renderError:s,button:l}=this.props,{errorMessage:u,hasError:d}=this.state;return d?"function"==typeof s?s({errorMessage:u}):Object(n.createElement)(i,{showErrorBlock:c,errorMessage:r?u:null,header:e,imageUrl:t,text:o,errorMessagePrefix:a,button:l}):this.props.children}}t.a=u},17:function(e,t,r){var c=r(38);e.exports=function(e,t,r){return(t=c(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e},e.exports.__esModule=!0,e.exports.default=e.exports},18:function(e,t){e.exports=window.wc.wcBlocksRegistry},2:function(e,t){e.exports=window.wc.wcSettings},21:function(e,t,r){"use strict";var c=r(0),o=r(6),n=r.n(o);t.a=e=>{let t,{label:r,screenReaderLabel:o,wrapperElement:a,wrapperProps:s={}}=e;const l=null!=r,i=null!=o;return!l&&i?(t=a||"span",s={...s,className:n()(s.className,"screen-reader-text")},Object(c.createElement)(t,s,o)):(t=a||c.Fragment,l&&i&&r!==o?Object(c.createElement)(t,s,Object(c.createElement)("span",{"aria-hidden":"true"},r),Object(c.createElement)("span",{className:"screen-reader-text"},o)):Object(c.createElement)(t,s,r))}},22:function(e,t){e.exports=window.wp.deprecated},23:function(e,t,r){"use strict";r.d(t,"a",(function(){return c}));const c=e=>"string"==typeof e},237:function(e,t,r){e.exports=r(263)},238:function(e,t){},239:function(e,t){},240:function(e,t){},25:function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));var c=r(0);const o=Object(c.createContext)("page"),n=()=>Object(c.useContext)(o);o.Provider},263:function(e,t,r){"use strict";r.r(t);var c=r(0),o=r(50),n=r(8),a=r(1),s=r(5),l=r(6),i=r.n(l),u=r(21);r(240);var d=e=>{let{currentPage:t,displayFirstAndLastPages:r=!0,displayNextAndPreviousArrows:o=!0,pagesToDisplay:n=3,onPageChange:s,totalPages:l}=e,{minIndex:d,maxIndex:b}=((e,t,r)=>{if(r<=2)return{minIndex:null,maxIndex:null};const c=e-1,o=Math.max(Math.floor(t-c/2),2),n=Math.min(Math.ceil(t+(c-(t-o))),r-1);return{minIndex:Math.max(Math.floor(t-(c-(n-t))),2),maxIndex:n}})(n,t,l);const p=r&&Boolean(1!==d),m=r&&Boolean(b!==l),g=r&&Boolean(d&&d>3),E=r&&Boolean(b&&bs(t-1),title:Object(a.__)("Previous page","woo-gutenberg-products-block"),disabled:t<=1},Object(c.createElement)(u.a,{label:"←",screenReaderLabel:Object(a.__)("Previous page","woo-gutenberg-products-block")})),p&&Object(c.createElement)("button",{className:i()("wc-block-pagination-page","wc-block-components-pagination__page",{"wc-block-pagination-page--active":1===t,"wc-block-components-pagination__page--active":1===t}),onClick:()=>s(1),disabled:1===t},Object(c.createElement)(u.a,{label:"1",screenReaderLabel:Object(a.sprintf)( +/* translators: %d is the page number (1, 2, 3...). */ +Object(a.__)("Page %d","woo-gutenberg-products-block"),1)})),g&&Object(c.createElement)("span",{className:"wc-block-pagination-ellipsis wc-block-components-pagination__ellipsis","aria-hidden":"true"},Object(a.__)("…","woo-gutenberg-products-block")),f.map(e=>Object(c.createElement)("button",{key:e,className:i()("wc-block-pagination-page","wc-block-components-pagination__page",{"wc-block-pagination-page--active":t===e,"wc-block-components-pagination__page--active":t===e}),onClick:t===e?void 0:()=>s(e),disabled:t===e},Object(c.createElement)(u.a,{label:e.toString(),screenReaderLabel:Object(a.sprintf)( +/* translators: %d is the page number (1, 2, 3...). */ +Object(a.__)("Page %d","woo-gutenberg-products-block"),e)}))),E&&Object(c.createElement)("span",{className:"wc-block-pagination-ellipsis wc-block-components-pagination__ellipsis","aria-hidden":"true"},Object(a.__)("…","woo-gutenberg-products-block")),m&&Object(c.createElement)("button",{className:i()("wc-block-pagination-page","wc-block-components-pagination__page",{"wc-block-pagination-page--active":t===l,"wc-block-components-pagination__page--active":t===l}),onClick:()=>s(l),disabled:t===l},Object(c.createElement)(u.a,{label:l.toString(),screenReaderLabel:Object(a.sprintf)( +/* translators: %d is the page number (1, 2, 3...). */ +Object(a.__)("Page %d","woo-gutenberg-products-block"),l)})),o&&Object(c.createElement)("button",{className:"wc-block-pagination-page wc-block-components-pagination__page wc-block-components-pagination-page--arrow",onClick:()=>s(t+1),title:Object(a.__)("Next page","woo-gutenberg-products-block"),disabled:t>=l},Object(c.createElement)(u.a,{label:"→",screenReaderLabel:Object(a.__)("Next page","woo-gutenberg-products-block")})))},b=r(64),p=r(32),m=r(63),g=r(3),E=r(7),f=r(30);var h=r(73),w=r(99),O=r(52),j=r(28),_=r(76),y=r(12),x=Object(c.createElement)(y.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"-2 -2 24 24"},Object(c.createElement)(y.Path,{d:"M10 2c4.42 0 8 3.58 8 8s-3.58 8-8 8-8-3.58-8-8 3.58-8 8-8zm1.13 9.38l.35-6.46H8.52l.35 6.46h2.26zm-.09 3.36c.24-.23.37-.55.37-.96 0-.42-.12-.74-.36-.97s-.59-.35-1.06-.35-.82.12-1.07.35-.37.55-.37.97c0 .41.13.73.38.96.26.23.61.34 1.06.34s.8-.11 1.05-.34z"})),k=()=>{const{parentClassName:e}=Object(O.useInnerBlockLayoutContext)();return Object(c.createElement)("div",{className:e+"__no-products"},Object(c.createElement)(_.a,{className:e+"__no-products-image",icon:x,size:100}),Object(c.createElement)("strong",{className:e+"__no-products-title"},Object(a.__)("No products","woo-gutenberg-products-block")),Object(c.createElement)("p",{className:e+"__no-products-description"},Object(a.__)("There are currently no products available to display.","woo-gutenberg-products-block")))},v=Object(c.createElement)(y.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(c.createElement)(y.Path,{d:"M13.5 6C10.5 6 8 8.5 8 11.5c0 1.1.3 2.1.9 3l-3.4 3 1 1.1 3.4-2.9c1 .9 2.2 1.4 3.6 1.4 3 0 5.5-2.5 5.5-5.5C19 8.5 16.5 6 13.5 6zm0 9.5c-2.2 0-4-1.8-4-4s1.8-4 4-4 4 1.8 4 4-1.8 4-4 4z"})),S=e=>{let{resetCallback:t=(()=>{})}=e;const{parentClassName:r}=Object(O.useInnerBlockLayoutContext)();return Object(c.createElement)("div",{className:r+"__no-products"},Object(c.createElement)(_.a,{className:r+"__no-products-image",icon:v,size:100}),Object(c.createElement)("strong",{className:r+"__no-products-title"},Object(a.__)("No products found","woo-gutenberg-products-block")),Object(c.createElement)("p",{className:r+"__no-products-description"},Object(a.__)("We were unable to find any results based on your search.","woo-gutenberg-products-block")),Object(c.createElement)("button",{onClick:t},Object(a.__)("Reset Search","woo-gutenberg-products-block")))},C=r(126);r(239);var P=e=>{let{onChange:t,value:r}=e;return Object(c.createElement)(C.a,{className:"wc-block-product-sort-select wc-block-components-product-sort-select",onChange:t,options:[{key:"menu_order",label:Object(a.__)("Default sorting","woo-gutenberg-products-block")},{key:"popularity",label:Object(a.__)("Popularity","woo-gutenberg-products-block")},{key:"rating",label:Object(a.__)("Average rating","woo-gutenberg-products-block")},{key:"date",label:Object(a.__)("Latest","woo-gutenberg-products-block")},{key:"price",label:Object(a.__)("Price: low to high","woo-gutenberg-products-block")},{key:"price-desc",label:Object(a.__)("Price: high to low","woo-gutenberg-products-block")}],screenReaderLabel:Object(a.__)("Order products by","woo-gutenberg-products-block"),value:r})},N=r(9),R=r(15),T=r.n(R),B=r(147);const A=(e,t,r,o)=>{if(!r)return;const n=Object(B.a)(e);return r.map((r,a)=>{let[s,l={}]=r,i=[];l.children&&l.children.length>0&&(i=A(e,t,l.children,o));const u=n[s];if(!u)return null;const d=t.id||0,b=["layout",s,a,o,d];return Object(c.createElement)(c.Suspense,{key:b.join("_"),fallback:Object(c.createElement)("div",{className:"wc-block-placeholder"})},Object(c.createElement)(u,T()({},l,{children:i,product:t})))})};var L=Object(N.withInstanceId)(e=>{let{product:t={},attributes:r,instanceId:o}=e;const{layoutConfig:n}=r,{parentClassName:a,parentName:s}=Object(O.useInnerBlockLayoutContext)(),l=0===Object.keys(t).length,u=i()(a+"__product","wc-block-layout",{"is-loading":l});return Object(c.createElement)("li",{className:u,"aria-hidden":l},A(s,t,n,o))});r(238);const M=e=>{switch(e){case"menu_order":case"popularity":case"rating":case"price":return{orderby:e,order:"asc"};case"price-desc":return{orderby:"price",order:"desc"};case"date":return{orderby:"date",order:"desc"}}},I=function(e){let{totalQuery:t,totalProducts:r}=e,{totalQuery:c}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return!Object(s.isEqual)(t,c)&&Number.isFinite(r)};var F=Object(w.a)(e=>{let{attributes:t,currentPage:r,onPageChange:o,onSortChange:n,sortValue:l,scrollToTop:u}=e;const[w,_]=Object(p.b)("attributes",[]),[y,x]=Object(p.b)("stock_status",[]),[v,C]=Object(p.b)("rating",[]),[N,R]=Object(p.b)("min_price"),[T,B]=Object(p.b)("max_price"),[A]=Object(p.c)((e=>{let{sortValue:t,currentPage:r,attributes:c}=e;const{columns:o,rows:n}=c;return{...M(t),catalog_visibility:"catalog",per_page:o*n,page:r}})({attributes:t,sortValue:l,currentPage:r})),{products:F,totalProducts:Y,productsLoading:q}=(e=>{const t={namespace:"/wc/store/v1",resourceName:"products"},{results:r,isLoading:c}=Object(m.a)({...t,query:e}),{value:o}=((e,t)=>{const{namespace:r,resourceName:c,resourceValues:o=[],query:n={}}=t;if(!r||!c)throw new Error("The options object must have valid values for the namespace and the resource name properties.");const a=Object(f.a)(n),s=Object(f.a)(o),{value:l,isLoading:i=!0}=Object(E.useSelect)(e=>{const t=e(g.COLLECTIONS_STORE_KEY),o=["x-wp-total",r,c,a,s];return{value:t.getCollectionHeader(...o),isLoading:t.hasFinishedResolution("getCollectionHeader",o)}},["x-wp-total",r,c,s,a]);return{value:l,isLoading:i}})(0,{...t,query:e});return{products:r,totalProducts:parseInt(o,10),productsLoading:c}})(A),{parentClassName:z,parentName:Q}=Object(O.useInnerBlockLayoutContext)(),D=(e=>{const{order:t,orderby:r,page:c,per_page:o,...n}=e;return n||{}})(A),{dispatchStoreEvent:G}=Object(h.a)(),U=Object(b.a)({totalQuery:D,totalProducts:Y},I);Object(c.useEffect)(()=>{G("product-list-render",{products:F,listName:Q})},[F,Q,G]),Object(c.useEffect)(()=>{Object(s.isEqual)(D,null==U?void 0:U.totalQuery)||(o(1),null!=U&&U.totalQuery&&(e=>{Number.isFinite(e)&&(0===e?Object(j.speak)(Object(a.__)("No products found","woo-gutenberg-products-block")):Object(j.speak)(Object(a.sprintf)( +/* translators: %s is an integer higher than 0 (1, 2, 3...) */ +Object(a._n)("%d product found","%d products found",e,"woo-gutenberg-products-block"),e)))})(Y))},[null==U?void 0:U.totalQuery,Y,o,D]);const{contentVisibility:V}=t,K=t.columns*t.rows,H=!Number.isFinite(Y)&&Number.isFinite(null==U?void 0:U.totalProducts)&&Object(s.isEqual)(D,null==U?void 0:U.totalQuery)?Math.ceil(((null==U?void 0:U.totalProducts)||0)/K):Math.ceil(Y/K),W=F.length?F:Array.from({length:K}),J=0!==F.length||q,X=w.length>0||y.length>0||v.length>0||Number.isFinite(N)||Number.isFinite(T);return Object(c.createElement)("div",{className:(()=>{const{columns:e,rows:r,alignButtons:c,align:o}=t,n=void 0!==o?"align"+o:"";return i()(z,n,"has-"+e+"-columns",{"has-multiple-rows":r>1,"has-aligned-buttons":c})})()},(null==V?void 0:V.orderBy)&&J&&Object(c.createElement)(P,{onChange:n,value:l}),!J&&X&&Object(c.createElement)(S,{resetCallback:()=>{_([]),x([]),C([]),R(null),B(null)}}),!J&&!X&&Object(c.createElement)(k,null),J&&Object(c.createElement)("ul",{className:i()(z+"__products",{"is-loading-products":q})},W.map((function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;return Object(c.createElement)(L,{key:e.id||r,attributes:t,product:e})}))),H>1&&Object(c.createElement)(d,{currentPage:r,onPageChange:e=>{u({focusableSelector:"a, button"}),o(e)},totalPages:H}))}),Y=e=>{let{attributes:t}=e;const[r,o]=Object(c.useState)(1),[n,a]=Object(c.useState)(t.orderby);return Object(c.useEffect)(()=>{a(t.orderby)},[t.orderby]),Object(c.createElement)(F,{attributes:t,currentPage:r,onPageChange:e=>{o(e)},onSortChange:e=>{var t;const r=null==e||null===(t=e.target)||void 0===t?void 0:t.value;a(r),o(1)},sortValue:n})};const q=Object(c.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 230 250",style:{width:"100%"}},Object(c.createElement)("title",null,"Grid Block Preview"),Object(c.createElement)("rect",{width:"65.374",height:"65.374",x:".162",y:".779",fill:"#E1E3E6",rx:"3"}),Object(c.createElement)("rect",{width:"47.266",height:"5.148",x:"9.216",y:"76.153",fill:"#E1E3E6",rx:"2.574"}),Object(c.createElement)("rect",{width:"62.8",height:"15",x:"1.565",y:"101.448",fill:"#E1E3E6",rx:"5"}),Object(c.createElement)("rect",{width:"65.374",height:"65.374",x:".162",y:"136.277",fill:"#E1E3E6",rx:"3"}),Object(c.createElement)("rect",{width:"47.266",height:"5.148",x:"9.216",y:"211.651",fill:"#E1E3E6",rx:"2.574"}),Object(c.createElement)("rect",{width:"62.8",height:"15",x:"1.565",y:"236.946",fill:"#E1E3E6",rx:"5"}),Object(c.createElement)("rect",{width:"65.374",height:"65.374",x:"82.478",y:".779",fill:"#E1E3E6",rx:"3"}),Object(c.createElement)("rect",{width:"47.266",height:"5.148",x:"91.532",y:"76.153",fill:"#E1E3E6",rx:"2.574"}),Object(c.createElement)("rect",{width:"62.8",height:"15",x:"83.882",y:"101.448",fill:"#E1E3E6",rx:"5"}),Object(c.createElement)("rect",{width:"65.374",height:"65.374",x:"82.478",y:"136.277",fill:"#E1E3E6",rx:"3"}),Object(c.createElement)("rect",{width:"47.266",height:"5.148",x:"91.532",y:"211.651",fill:"#E1E3E6",rx:"2.574"}),Object(c.createElement)("rect",{width:"62.8",height:"15",x:"83.882",y:"236.946",fill:"#E1E3E6",rx:"5"}),Object(c.createElement)("rect",{width:"65.374",height:"65.374",x:"164.788",y:".779",fill:"#E1E3E6",rx:"3"}),Object(c.createElement)("rect",{width:"47.266",height:"5.148",x:"173.843",y:"76.153",fill:"#E1E3E6",rx:"2.574"}),Object(c.createElement)("rect",{width:"62.8",height:"15",x:"166.192",y:"101.448",fill:"#E1E3E6",rx:"5"}),Object(c.createElement)("rect",{width:"65.374",height:"65.374",x:"164.788",y:"136.277",fill:"#E1E3E6",rx:"3"}),Object(c.createElement)("rect",{width:"47.266",height:"5.148",x:"173.843",y:"211.651",fill:"#E1E3E6",rx:"2.574"}),Object(c.createElement)("rect",{width:"62.8",height:"15",x:"166.192",y:"236.946",fill:"#E1E3E6",rx:"5"}),Object(c.createElement)("rect",{width:"6.177",height:"6.177",x:"13.283",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(c.createElement)("rect",{width:"6.177",height:"6.177",x:"21.498",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(c.createElement)("rect",{width:"6.177",height:"6.177",x:"29.713",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(c.createElement)("rect",{width:"6.177",height:"6.177",x:"37.927",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(c.createElement)("rect",{width:"6.177",height:"6.177",x:"46.238",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(c.createElement)("rect",{width:"6.177",height:"6.177",x:"95.599",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(c.createElement)("rect",{width:"6.177",height:"6.177",x:"103.814",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(c.createElement)("rect",{width:"6.177",height:"6.177",x:"112.029",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(c.createElement)("rect",{width:"6.177",height:"6.177",x:"120.243",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(c.createElement)("rect",{width:"6.177",height:"6.177",x:"128.554",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(c.createElement)("rect",{width:"6.177",height:"6.177",x:"177.909",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(c.createElement)("rect",{width:"6.177",height:"6.177",x:"186.124",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(c.createElement)("rect",{width:"6.177",height:"6.177",x:"194.339",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(c.createElement)("rect",{width:"6.177",height:"6.177",x:"202.553",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(c.createElement)("rect",{width:"6.177",height:"6.177",x:"210.864",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(c.createElement)("rect",{width:"6.177",height:"6.177",x:"13.283",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(c.createElement)("rect",{width:"6.177",height:"6.177",x:"21.498",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(c.createElement)("rect",{width:"6.177",height:"6.177",x:"29.713",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(c.createElement)("rect",{width:"6.177",height:"6.177",x:"37.927",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(c.createElement)("rect",{width:"6.177",height:"6.177",x:"46.238",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(c.createElement)("rect",{width:"6.177",height:"6.177",x:"95.599",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(c.createElement)("rect",{width:"6.177",height:"6.177",x:"103.814",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(c.createElement)("rect",{width:"6.177",height:"6.177",x:"112.029",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(c.createElement)("rect",{width:"6.177",height:"6.177",x:"120.243",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(c.createElement)("rect",{width:"6.177",height:"6.177",x:"128.554",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(c.createElement)("rect",{width:"6.177",height:"6.177",x:"177.909",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(c.createElement)("rect",{width:"6.177",height:"6.177",x:"186.124",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(c.createElement)("rect",{width:"6.177",height:"6.177",x:"194.339",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(c.createElement)("rect",{width:"6.177",height:"6.177",x:"202.553",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(c.createElement)("rect",{width:"6.177",height:"6.177",x:"210.864",y:"221.798",fill:"#E1E3E6",rx:"3"}));var z=r(11);class Q extends n.Component{render(){const{attributes:e,urlParameterSuffix:t}=this.props;return e.isPreview?q:Object(c.createElement)(O.InnerBlockLayoutContextProvider,{parentName:"woocommerce/all-products",parentClassName:"wc-block-grid"},Object(c.createElement)(z.StoreNoticesContainer,{context:"wc/all-products"}),Object(c.createElement)(Y,{attributes:e,urlParameterSuffix:t}))}}var D=Q;Object(o.a)({selector:".wp-block-woocommerce-all-products",Block:e=>Object(c.createElement)(D,e),getProps:e=>({attributes:JSON.parse(e.dataset.attributes)})})},27:function(e,t){function r(t){return e.exports=r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,r(t)}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports},28:function(e,t){e.exports=window.wp.a11y},3:function(e,t){e.exports=window.wc.wcBlocksData},30:function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var c=r(0),o=r(13),n=r.n(o);function a(e){const t=Object(c.useRef)(e);return n()(e,t.current)||(t.current=e),t.current}},31:function(e,t){e.exports=window.wp.htmlEntities},32:function(e,t,r){"use strict";r.d(t,"a",(function(){return d})),r.d(t,"b",(function(){return b})),r.d(t,"c",(function(){return p}));var c=r(3),o=r(7),n=r(0),a=r(13),s=r.n(a),l=r(30),i=r(64),u=r(25);const d=e=>{const t=Object(u.a)();e=e||t;const r=Object(o.useSelect)(t=>t(c.QUERY_STATE_STORE_KEY).getValueForQueryContext(e,void 0),[e]),{setValueForQueryContext:a}=Object(o.useDispatch)(c.QUERY_STATE_STORE_KEY);return[r,Object(n.useCallback)(t=>{a(e,t)},[e,a])]},b=(e,t,r)=>{const a=Object(u.a)();r=r||a;const s=Object(o.useSelect)(o=>o(c.QUERY_STATE_STORE_KEY).getValueForQueryKey(r,e,t),[r,e]),{setQueryValue:l}=Object(o.useDispatch)(c.QUERY_STATE_STORE_KEY);return[s,Object(n.useCallback)(t=>{l(r,e,t)},[r,e,l])]},p=(e,t)=>{const r=Object(u.a)();t=t||r;const[c,o]=d(t),a=Object(l.a)(c),b=Object(l.a)(e),p=Object(i.a)(b),m=Object(n.useRef)(!1);return Object(n.useEffect)(()=>{s()(p,b)||(o(Object.assign({},a,b)),m.current=!0)},[a,b,p,o]),m.current?[c,o]:[e,o]}},34:function(e,t){e.exports=window.wp.apiFetch},37:function(e,t,r){"use strict";r.d(t,"o",(function(){return n})),r.d(t,"m",(function(){return a})),r.d(t,"l",(function(){return s})),r.d(t,"n",(function(){return l})),r.d(t,"j",(function(){return i})),r.d(t,"d",(function(){return u})),r.d(t,"g",(function(){return d})),r.d(t,"k",(function(){return b})),r.d(t,"c",(function(){return p})),r.d(t,"f",(function(){return m})),r.d(t,"h",(function(){return g})),r.d(t,"a",(function(){return E})),r.d(t,"i",(function(){return f})),r.d(t,"b",(function(){return h})),r.d(t,"e",(function(){return w}));var c,o=r(2);const n=Object(o.getSetting)("wcBlocksConfig",{buildPhase:1,pluginUrl:"",productCount:0,defaultAvatar:"",restApiRoutes:{},wordCountType:"words"}),a=n.pluginUrl+"images/",s=n.pluginUrl+"build/",l=n.buildPhase,i=null===(c=o.STORE_PAGES.shop)||void 0===c?void 0:c.permalink,u=(o.STORE_PAGES.checkout.id,o.STORE_PAGES.checkout.permalink),d=o.STORE_PAGES.privacy.permalink,b=(o.STORE_PAGES.privacy.title,o.STORE_PAGES.terms.permalink),p=(o.STORE_PAGES.terms.title,o.STORE_PAGES.cart.id,o.STORE_PAGES.cart.permalink),m=o.STORE_PAGES.myaccount.permalink?o.STORE_PAGES.myaccount.permalink:Object(o.getSetting)("wpLoginUrl","/wp-login.php"),g=Object(o.getSetting)("shippingCountries",{}),E=Object(o.getSetting)("allowedCountries",{}),f=Object(o.getSetting)("shippingStates",{}),h=Object(o.getSetting)("allowedStates",{}),w=Object(o.getSetting)("localPickupEnabled",!1)},38:function(e,t,r){var c=r(27).default,o=r(39);e.exports=function(e){var t=o(e,"string");return"symbol"===c(t)?t:String(t)},e.exports.__esModule=!0,e.exports.default=e.exports},39:function(e,t,r){var c=r(27).default;e.exports=function(e,t){if("object"!==c(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,t||"default");if("object"!==c(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)},e.exports.__esModule=!0,e.exports.default=e.exports},40:function(e,t){},42:function(e,t,r){"use strict";r.d(t,"a",(function(){return j}));var c=r(5),o=r(0),n=r(3),a=r(7),s=r(31),l=r(134),i=r(45),u=r(107),d=r(90);const b=e=>{const t=null==e?void 0:e.detail;t&&t.preserveCartData||Object(a.dispatch)(n.CART_STORE_KEY).invalidateResolutionForStore()},p=e=>{(null!=e&&e.persisted||"back_forward"===Object(u.b)())&&Object(a.dispatch)(n.CART_STORE_KEY).invalidateResolutionForStore()},m=()=>{1===window.wcBlocksStoreCartListeners.count&&window.wcBlocksStoreCartListeners.remove(),window.wcBlocksStoreCartListeners.count--},g=()=>{Object(o.useEffect)(()=>((()=>{if(window.wcBlocksStoreCartListeners||(window.wcBlocksStoreCartListeners={count:0,remove:()=>{}}),(null===(e=window.wcBlocksStoreCartListeners)||void 0===e?void 0:e.count)>0)return void window.wcBlocksStoreCartListeners.count++;var e;document.body.addEventListener("wc-blocks_added_to_cart",b),document.body.addEventListener("wc-blocks_removed_from_cart",b),window.addEventListener("pageshow",p);const t=Object(d.b)("added_to_cart","wc-blocks_added_to_cart"),r=Object(d.b)("removed_from_cart","wc-blocks_removed_from_cart");window.wcBlocksStoreCartListeners.count=1,window.wcBlocksStoreCartListeners.remove=()=>{document.body.removeEventListener("wc-blocks_added_to_cart",b),document.body.removeEventListener("wc-blocks_removed_from_cart",b),window.removeEventListener("pageshow",p),t(),r()}})(),m),[])},E={first_name:"",last_name:"",company:"",address_1:"",address_2:"",city:"",state:"",postcode:"",country:"",phone:""},f={...E,email:""},h={total_items:"",total_items_tax:"",total_fees:"",total_fees_tax:"",total_discount:"",total_discount_tax:"",total_shipping:"",total_shipping_tax:"",total_price:"",total_tax:"",tax_lines:n.EMPTY_TAX_LINES,currency_code:"",currency_symbol:"",currency_minor_unit:2,currency_decimal_separator:"",currency_thousand_separator:"",currency_prefix:"",currency_suffix:""},w=e=>Object.fromEntries(Object.entries(e).map(e=>{let[t,r]=e;return[t,Object(s.decodeEntities)(r)]})),O={cartCoupons:n.EMPTY_CART_COUPONS,cartItems:n.EMPTY_CART_ITEMS,cartFees:n.EMPTY_CART_FEES,cartItemsCount:0,cartItemsWeight:0,crossSellsProducts:n.EMPTY_CART_CROSS_SELLS,cartNeedsPayment:!0,cartNeedsShipping:!0,cartItemErrors:n.EMPTY_CART_ITEM_ERRORS,cartTotals:h,cartIsLoading:!0,cartErrors:n.EMPTY_CART_ERRORS,billingAddress:f,shippingAddress:E,shippingRates:n.EMPTY_SHIPPING_RATES,isLoadingRates:!1,cartHasCalculatedShipping:!1,paymentRequirements:n.EMPTY_PAYMENT_REQUIREMENTS,receiveCart:()=>{},receiveCartContents:()=>{},extensions:n.EMPTY_EXTENSIONS},j=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{shouldSelect:!0};const{isEditor:t,previewData:r}=Object(i.a)(),s=null==r?void 0:r.previewCart,{shouldSelect:u}=e,d=Object(o.useRef)();g();const b=Object(a.useSelect)((e,r)=>{let{dispatch:c}=r;if(!u)return O;if(t)return{cartCoupons:s.coupons,cartItems:s.items,crossSellsProducts:s.cross_sells,cartFees:s.fees,cartItemsCount:s.items_count,cartItemsWeight:s.items_weight,cartNeedsPayment:s.needs_payment,cartNeedsShipping:s.needs_shipping,cartItemErrors:n.EMPTY_CART_ITEM_ERRORS,cartTotals:s.totals,cartIsLoading:!1,cartErrors:n.EMPTY_CART_ERRORS,billingData:f,billingAddress:f,shippingAddress:E,extensions:n.EMPTY_EXTENSIONS,shippingRates:s.shipping_rates,isLoadingRates:!1,cartHasCalculatedShipping:s.has_calculated_shipping,paymentRequirements:s.paymentRequirements,receiveCart:"function"==typeof(null==s?void 0:s.receiveCart)?s.receiveCart:()=>{},receiveCartContents:"function"==typeof(null==s?void 0:s.receiveCartContents)?s.receiveCartContents:()=>{}};const o=e(n.CART_STORE_KEY),a=o.getCartData(),i=o.getCartErrors(),d=o.getCartTotals(),b=!o.hasFinishedResolution("getCartData"),p=o.isCustomerDataUpdating(),{receiveCart:m,receiveCartContents:g}=c(n.CART_STORE_KEY),h=w(a.billingAddress),j=a.needsShipping?w(a.shippingAddress):h,_=a.fees.length>0?a.fees.map(e=>w(e)):n.EMPTY_CART_FEES;return{cartCoupons:a.coupons.length>0?a.coupons.map(e=>({...e,label:e.code})):n.EMPTY_CART_COUPONS,cartItems:a.items,crossSellsProducts:a.crossSells,cartFees:_,cartItemsCount:a.itemsCount,cartItemsWeight:a.itemsWeight,cartNeedsPayment:a.needsPayment,cartNeedsShipping:a.needsShipping,cartItemErrors:a.errors,cartTotals:d,cartIsLoading:b,cartErrors:i,billingData:Object(l.a)(h),billingAddress:Object(l.a)(h),shippingAddress:Object(l.a)(j),extensions:a.extensions,shippingRates:a.shippingRates,isLoadingRates:p,cartHasCalculatedShipping:a.hasCalculatedShipping,paymentRequirements:a.paymentRequirements,receiveCart:m,receiveCartContents:g}},[u]);return d.current&&Object(c.isEqual)(d.current,b)||(d.current=b),d.current}},43:function(e,t){e.exports=window.wc.priceFormat},45:function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));var c=r(0);r(7);const o=Object(c.createContext)({isEditor:!1,currentPostId:0,currentView:"",previewData:{},getPreviewData:()=>({})}),n=()=>Object(c.useContext)(o)},48:function(e,t){e.exports=window.wp.warning},49:function(e,t){e.exports=window.wp.dom},5:function(e,t){e.exports=window.lodash},50:function(e,t,r){"use strict";r.d(t,"a",(function(){return i}));var c=r(15),o=r.n(c),n=r(0),a=r(16);const s=[".wp-block-woocommerce-cart"],l=e=>{let{Block:t,containers:r,getProps:c=(()=>({})),getErrorBoundaryProps:s=(()=>({}))}=e;0!==r.length&&Array.prototype.forEach.call(r,(e,r)=>{const l=c(e,r),i=s(e,r),u={...e.dataset,...l.attributes||{}};(e=>{let{Block:t,container:r,attributes:c={},props:s={},errorBoundaryProps:l={}}=e;Object(n.render)(Object(n.createElement)(a.a,l,Object(n.createElement)(n.Suspense,{fallback:Object(n.createElement)("div",{className:"wc-block-placeholder"})},t&&Object(n.createElement)(t,o()({},s,{attributes:c})))),r,()=>{r.classList&&r.classList.remove("is-loading")})})({Block:t,container:e,props:l,attributes:u,errorBoundaryProps:i})})},i=e=>{const t=document.body.querySelectorAll(s.join(",")),{Block:r,getProps:c,getErrorBoundaryProps:o,selector:n}=e;(e=>{let{Block:t,getProps:r,getErrorBoundaryProps:c,selector:o,wrappers:n}=e;const a=document.body.querySelectorAll(o);n&&n.length>0&&Array.prototype.filter.call(a,e=>!((e,t)=>Array.prototype.some.call(t,t=>t.contains(e)&&!t.isSameNode(e)))(e,n)),l({Block:t,containers:a,getProps:r,getErrorBoundaryProps:c})})({Block:r,getProps:c,getErrorBoundaryProps:o,selector:n,wrappers:t}),Array.prototype.forEach.call(t,t=>{t.addEventListener("wc-blocks_render_blocks_frontend",()=>{(e=>{let{Block:t,getProps:r,getErrorBoundaryProps:c,selector:o,wrapper:n}=e;const a=n.querySelectorAll(o);l({Block:t,containers:a,getProps:r,getErrorBoundaryProps:c})})({...e,wrapper:t})})})}},51:function(e,t){e.exports=window.wp.hooks},52:function(e,t){e.exports=window.wc.wcBlocksSharedContext},53:function(e,t){e.exports=window.wp.blocks},6:function(e,t,r){var c;!function(){"use strict";var r={}.hasOwnProperty;function o(){for(var e=[],t=0;t{const t={};return void 0!==e.label&&(t.label=e.label),void 0!==e.required&&(t.required=e.required),void 0!==e.hidden&&(t.hidden=e.hidden),void 0===e.label||e.optionalLabel||(t.optionalLabel=Object(o.sprintf)( +/* translators: %s Field label. */ +Object(o.__)("%s (optional)","woo-gutenberg-products-block"),e.label)),e.priority&&(Object(n.a)(e.priority)&&(t.index=e.priority),Object(a.a)(e.priority)&&(t.index=parseInt(e.priority,10))),e.hidden&&(t.required=!1),t},i=Object.entries(s).map(e=>{let[t,r]=e;return[t,Object.entries(r).map(e=>{let[t,r]=e;return[t,l(r)]}).reduce((e,t)=>{let[r,c]=t;return e[r]=c,e},{})]}).reduce((e,t)=>{let[r,c]=t;return e[r]=c,e},{});t.a=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";const o=r&&void 0!==i[r]?i[r]:{};return e.map(e=>({key:e,...c.defaultAddressFields[e]||{},...o[e]||{},...t[e]||{}})).sort((e,t)=>e.index-t.index)}},63:function(e,t,r){"use strict";r.d(t,"a",(function(){return s}));var c=r(3),o=r(7),n=r(0),a=r(30);const s=e=>{const{namespace:t,resourceName:r,resourceValues:s=[],query:l={},shouldSelect:i=!0}=e;if(!t||!r)throw new Error("The options object must have valid values for the namespace and the resource properties.");const u=Object(n.useRef)({results:[],isLoading:!0}),d=Object(a.a)(l),b=Object(a.a)(s),p=(()=>{const[,e]=Object(n.useState)();return Object(n.useCallback)(t=>{e(()=>{throw t})},[])})(),m=Object(o.useSelect)(e=>{if(!i)return null;const o=e(c.COLLECTIONS_STORE_KEY),n=[t,r,d,b],a=o.getCollectionError(...n);if(a){if(!(a instanceof Error))throw new Error("TypeError: `error` object is not an instance of Error constructor");p(a)}return{results:o.getCollection(...n),isLoading:!o.hasFinishedResolution("getCollection",n)}},[t,r,b,d,i]);return null!==m&&(u.current=m),u.current}},64:function(e,t,r){"use strict";r.d(t,"a",(function(){return o}));var c=r(8);function o(e,t){const r=Object(c.useRef)();return Object(c.useEffect)(()=>{r.current===e||t&&!t(e,r.current)||(r.current=e)},[e,t]),r.current}},66:function(e,t){e.exports=window.wp.blockEditor},7:function(e,t){e.exports=window.wp.data},73:function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var c=r(51),o=r(0),n=r(42);const a=()=>{const e=Object(n.a)(),t=Object(o.useRef)(e);return Object(o.useEffect)(()=>{t.current=e},[e]),{dispatchStoreEvent:Object(o.useCallback)((function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};try{Object(c.doAction)("experimental__woocommerce_blocks-"+e,t)}catch(e){console.error(e)}}),[]),dispatchCheckoutEvent:Object(o.useCallback)((function(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};try{Object(c.doAction)("experimental__woocommerce_blocks-checkout-"+e,{...r,storeCart:t.current})}catch(e){console.error(e)}}),[])}}},76:function(e,t,r){"use strict";var c=r(0);t.a=function(e){let{icon:t,size:r=24,...o}=e;return Object(c.cloneElement)(t,{width:r,height:r,...o})}},8:function(e,t){e.exports=window.React},9:function(e,t){e.exports=window.wp.compose},90:function(e,t,r){"use strict";r.d(t,"a",(function(){return o})),r.d(t,"c",(function(){return n})),r.d(t,"b",(function(){return a}));const c=window.CustomEvent||null,o=(e,t)=>{let{bubbles:r=!1,cancelable:o=!1,element:n,detail:a={}}=t;if(!c)return;n||(n=document.body);const s=new c(e,{bubbles:r,cancelable:o,detail:a});n.dispatchEvent(s)},n=e=>{let{preserveCartData:t=!1}=e;o("wc-blocks_added_to_cart",{bubbles:!0,cancelable:!0,detail:{preserveCartData:t}})},a=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],c=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if("function"!=typeof jQuery)return()=>{};const n=()=>{o(t,{bubbles:r,cancelable:c})};return jQuery(document).on(e,n),()=>jQuery(document).off(e,n)}},91:function(e,t,r){"use strict";r.d(t,"a",(function(){return c}));const c=e=>"number"==typeof e},99:function(e,t,r){"use strict";var c=r(15),o=r.n(c),n=r(0);r(124);const a=e=>{if(!e)return;const t=e.getBoundingClientRect().bottom;t>=0&&t<=window.innerHeight||e.scrollIntoView()};t.a=e=>t=>{const r=Object(n.useRef)(null);return Object(n.createElement)(n.Fragment,null,Object(n.createElement)("div",{className:"with-scroll-to-top__scroll-point",ref:r,"aria-hidden":!0}),Object(n.createElement)(e,o()({},t,{scrollToTop:e=>{null!==r.current&&((e,t)=>{const{focusableSelector:r}=t||{};window&&Number.isFinite(window.innerHeight)&&(r?((e,t)=>{var r;const c=(null===(r=e.parentElement)||void 0===r?void 0:r.querySelectorAll(t))||[];if(c.length){const e=c[0];a(e),null==e||e.focus()}else a(e)})(e,r):a(e))})(r.current,e)}})))}}}); \ No newline at end of file diff --git a/build/all-products.asset.php b/build/all-products.asset.php new file mode 100644 index 00000000000..da6e696f536 --- /dev/null +++ b/build/all-products.asset.php @@ -0,0 +1 @@ + array('lodash', 'react', 'wc-blocks-checkout', 'wc-blocks-data-store', 'wc-blocks-registry', 'wc-blocks-shared-context', 'wc-blocks-shared-hocs', 'wc-price-format', 'wc-settings', 'wp-a11y', 'wp-api-fetch', 'wp-autop', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-deprecated', 'wp-dom', 'wp-element', 'wp-escape-html', 'wp-hooks', 'wp-html-entities', 'wp-i18n', 'wp-is-shallow-equal', 'wp-polyfill', 'wp-primitives', 'wp-url', 'wp-warning', 'wp-wordcount'), 'version' => '93aef45b35f02ff90d7d3494e6d5921b'); \ No newline at end of file diff --git a/build/all-products.js b/build/all-products.js new file mode 100644 index 00000000000..fe0c4e618d1 --- /dev/null +++ b/build/all-products.js @@ -0,0 +1,36 @@ +this.wc=this.wc||{},this.wc.blocks=this.wc.blocks||{},this.wc.blocks["all-products"]=function(e){function t(t){for(var r,a,s=t[0],l=t[1],i=t[2],d=0,b=[];dObject(n.sprintf)( +/* translators: Number of items selected from list. */ +Object(n._n)("%d item selected","%d items selected",e,"woo-gutenberg-products-block"),e),updated:Object(n.__)("Search results updated.","woo-gutenberg-products-block")},s=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e;const c=Object(o.groupBy)(e,"parent"),r=Object(o.keyBy)(t,"id"),n=["0"],a=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!e.parent)return e.name?[e.name]:[];const t=a(r[e.parent]);return[...t,e.name]},s=e=>e.map(e=>{const t=c[e.id];return n.push(""+e.id),{...e,breadcrumbs:a(r[e.parent]),children:t&&t.length?s(t):[]}}),l=s(c[0]||[]);return Object.entries(c).forEach(e=>{let[t,c]=e;n.includes(t)||l.push(...s(c||[]))}),l},l=(e,t,c)=>{if(!t)return c?s(e):e;const r=new RegExp(t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"),"i"),o=e.map(e=>!!r.test(e.name)&&e).filter(Boolean);return c?s(o,e):o},i=(e,t)=>{if(!t)return e;const c=new RegExp(`(${t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")})`,"ig");return e.split(c).map((e,t)=>c.test(e)?Object(r.createElement)("strong",{key:t},e):Object(r.createElement)(r.Fragment,{key:t},e))},u=e=>1===e.length?e.slice(0,1).toString():2===e.length?e.slice(0,1).toString()+" › "+e.slice(-1).toString():e.slice(0,1).toString()+" … "+e.slice(-1).toString()},function(e,t,c){"use strict";c.d(t,"o",(function(){return n})),c.d(t,"m",(function(){return a})),c.d(t,"l",(function(){return s})),c.d(t,"n",(function(){return l})),c.d(t,"j",(function(){return i})),c.d(t,"e",(function(){return u})),c.d(t,"g",(function(){return d})),c.d(t,"k",(function(){return b})),c.d(t,"c",(function(){return p})),c.d(t,"d",(function(){return m})),c.d(t,"h",(function(){return g})),c.d(t,"a",(function(){return O})),c.d(t,"i",(function(){return j})),c.d(t,"b",(function(){return h})),c.d(t,"f",(function(){return _}));var r,o=c(2);const n=Object(o.getSetting)("wcBlocksConfig",{buildPhase:1,pluginUrl:"",productCount:0,defaultAvatar:"",restApiRoutes:{},wordCountType:"words"}),a=n.pluginUrl+"images/",s=n.pluginUrl+"build/",l=n.buildPhase,i=null===(r=o.STORE_PAGES.shop)||void 0===r?void 0:r.permalink,u=o.STORE_PAGES.checkout.id,d=(o.STORE_PAGES.checkout.permalink,o.STORE_PAGES.privacy.permalink),b=(o.STORE_PAGES.privacy.title,o.STORE_PAGES.terms.permalink),p=(o.STORE_PAGES.terms.title,o.STORE_PAGES.cart.id),m=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",{})),O=Object(o.getSetting)("allowedCountries",{}),j=Object(o.getSetting)("shippingStates",{}),h=Object(o.getSetting)("allowedStates",{}),_=Object(o.getSetting)("localPickupEnabled",!1)},,function(e,t){e.exports=window.wc.wcBlocksSharedContext},,function(e,t){e.exports=window.wc.priceFormat},function(e,t){e.exports=window.wp.isShallowEqual},function(e,t,c){"use strict";c.d(t,"h",(function(){return i})),c.d(t,"e",(function(){return u})),c.d(t,"b",(function(){return d})),c.d(t,"i",(function(){return b})),c.d(t,"f",(function(){return p})),c.d(t,"c",(function(){return m})),c.d(t,"d",(function(){return g})),c.d(t,"g",(function(){return O})),c.d(t,"a",(function(){return j}));var r=c(17),o=c(15),n=c.n(o),a=c(8),s=c(2),l=c(20);const i=e=>{let{selected:t=[],search:c="",queryArgs:o={}}=e;const s=(e=>{let{selected:t=[],search:c="",queryArgs:o={}}=e;const n=l.o.productCount>100,a={per_page:n?100:0,catalog_visibility:"any",search:c,orderby:"title",order:"asc"},s=[Object(r.addQueryArgs)("/wc/store/v1/products",{...a,...o})];return n&&t.length&&s.push(Object(r.addQueryArgs)("/wc/store/v1/products",{catalog_visibility:"any",include:t,per_page:0})),s})({selected:t,search:c,queryArgs:o});return Promise.all(s.map(e=>n()({path:e}))).then(e=>Object(a.uniqBy)(Object(a.flatten)(e),"id").map(e=>({...e,parent:0}))).catch(e=>{throw e})},u=e=>n()({path:"/wc/store/v1/products/"+e}),d=()=>n()({path:"wc/store/v1/products/attributes"}),b=e=>n()({path:`wc/store/v1/products/attributes/${e}/terms`}),p=e=>{let{selected:t=[],search:c}=e;const o=(e=>{let{selected:t=[],search:c}=e;const o=Object(s.getSetting)("limitTags",!1),n=[Object(r.addQueryArgs)("wc/store/v1/products/tags",{per_page:o?100:0,orderby:o?"count":"name",order:o?"desc":"asc",search:c})];return o&&t.length&&n.push(Object(r.addQueryArgs)("wc/store/v1/products/tags",{include:t})),n})({selected:t,search:c});return Promise.all(o.map(e=>n()({path:e}))).then(e=>Object(a.uniqBy)(Object(a.flatten)(e),"id"))},m=e=>n()({path:Object(r.addQueryArgs)("wc/store/v1/products/categories",{per_page:0,...e})}),g=e=>n()({path:"wc/store/v1/products/categories/"+e}),O=e=>n()({path:Object(r.addQueryArgs)("wc/store/v1/products",{per_page:0,type:"variation",parent:e})}),j=(e,t)=>{if(!e.title.raw)return e.slug;const c=1===t.filter(t=>t.title.raw===e.title.raw).length;return e.title.raw+(c?"":" - "+e.slug)}},,,function(e,t,c){"use strict";c.d(t,"a",(function(){return r}));const r=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"}}},function(e,t,c){"use strict";var r=c(0),o=c(4),n=c.n(o);t.a=e=>{let t,{label:c,screenReaderLabel:o,wrapperElement:a,wrapperProps:s={}}=e;const l=null!=c,i=null!=o;return!l&&i?(t=a||"span",s={...s,className:n()(s.className,"screen-reader-text")},Object(r.createElement)(t,s,o)):(t=a||r.Fragment,l&&i&&c!==o?Object(r.createElement)(t,s,Object(r.createElement)("span",{"aria-hidden":"true"},c),Object(r.createElement)("span",{className:"screen-reader-text"},o)):Object(r.createElement)(t,s,c))}},,function(e,t,c){"use strict";c.d(t,"b",(function(){return r})),c.d(t,"c",(function(){return o})),c.d(t,"a",(function(){return n}));const r=e=>!(e=>null===e)(e)&&e instanceof Object&&e.constructor===Object;function o(e,t){return r(e)&&t in e}const n=e=>0===Object.keys(e).length},,function(e,t,c){"use strict";var r=c(0),o=c(1),n=c(35);t.a=e=>{let{error:t}=e;return Object(r.createElement)("div",{className:"wc-block-error-message"},(e=>{let{message:t,type:c}=e;return t?"general"===c?Object(r.createElement)("span",null,Object(o.__)("The following error was returned","woo-gutenberg-products-block"),Object(r.createElement)("br",null),Object(r.createElement)("code",null,Object(n.escapeHTML)(t))):"api"===c?Object(r.createElement)("span",null,Object(o.__)("The following error was returned from the API","woo-gutenberg-products-block"),Object(r.createElement)("br",null),Object(r.createElement)("code",null,Object(n.escapeHTML)(t))):t:Object(o.__)("An error has prevented the block from being updated.","woo-gutenberg-products-block")})(t))}},function(e,t){e.exports=window.wp.escapeHtml},function(e,t){e.exports=window.wc.wcBlocksRegistry},function(e,t,c){"use strict";var r=c(6),o=c.n(r),n=c(0),a=c(133),s=c(4),l=c.n(s);c(139);const i=e=>({thousandSeparator:null==e?void 0:e.thousandSeparator,decimalSeparator:null==e?void 0:e.decimalSeparator,decimalScale:null==e?void 0:e.minorUnit,fixedDecimalScale:!0,prefix:null==e?void 0:e.prefix,suffix:null==e?void 0:e.suffix,isNumericString:!0});t.a=e=>{let{className:t,value:c,currency:r,onValueChange:s,displayType:u="text",...d}=e;const b="string"==typeof c?parseInt(c,10):c;if(!Number.isFinite(b))return null;const p=b/10**r.minorUnit;if(!Number.isFinite(p))return null;const m=l()("wc-block-formatted-money-amount","wc-block-components-formatted-money-amount",t),g={...d,...i(r),value:void 0,currency:void 0,onValueChange:void 0},O=s?e=>{const t=+e.value*10**r.minorUnit;s(t)}:()=>{};return Object(n.createElement)(a.a,o()({className:m,displayType:u},g,{value:p,onValueChange:O}))}},function(e,t,c){"use strict";c.d(t,"a",(function(){return s}));var r=c(6),o=c.n(r),n=c(0),a=c(19);const s=e=>{let{countLabel:t,className:c,depth:r=0,controlId:s="",item:l,isSelected:i,isSingle:u,onSelect:d,search:b="",...p}=e;const m=null!=t&&void 0!==l.count&&null!==l.count,g=[c,"woocommerce-search-list__item"];g.push("depth-"+r),u&&g.push("is-radio-button"),m&&g.push("has-count");const O=l.breadcrumbs&&l.breadcrumbs.length,j=p.name||"search-list-item-"+s,h=`${j}-${l.id}`;return Object(n.createElement)("label",{htmlFor:h,className:g.join(" ")},u?Object(n.createElement)("input",o()({type:"radio",id:h,name:j,value:l.value,onChange:d(l),checked:i,className:"woocommerce-search-list__item-input"},p)):Object(n.createElement)("input",o()({type:"checkbox",id:h,name:j,value:l.value,onChange:d(l),checked:i,className:"woocommerce-search-list__item-input"},p)),Object(n.createElement)("span",{className:"woocommerce-search-list__item-label"},O?Object(n.createElement)("span",{className:"woocommerce-search-list__item-prefix"},Object(a.b)(l.breadcrumbs)):null,Object(n.createElement)("span",{className:"woocommerce-search-list__item-name"},Object(a.d)(l.name,b))),!!m&&Object(n.createElement)("span",{className:"woocommerce-search-list__item-count"},t||l.count))};t.b=s},,,function(e,t){e.exports=window.wp.deprecated},function(e,t,c){"use strict";c.d(t,"a",(function(){return a}));var r=c(0),o=c(25),n=c.n(o);function a(e){const t=Object(r.useRef)(e);return n()(e,t.current)||(t.current=e),t.current}},function(e,t,c){"use strict";c.d(t,"a",(function(){return E}));var r=c(8),o=c(0),n=c(10),a=c(7),s=c(18),l=c(251),i=c(81);var u=c(250);const d=e=>{const t=null==e?void 0:e.detail;t&&t.preserveCartData||Object(a.dispatch)(n.CART_STORE_KEY).invalidateResolutionForStore()},b=e=>{(null!=e&&e.persisted||"back_forward"===(window.performance&&window.performance.getEntriesByType("navigation").length?window.performance.getEntriesByType("navigation")[0].type:""))&&Object(a.dispatch)(n.CART_STORE_KEY).invalidateResolutionForStore()},p=()=>{1===window.wcBlocksStoreCartListeners.count&&window.wcBlocksStoreCartListeners.remove(),window.wcBlocksStoreCartListeners.count--},m=()=>{Object(o.useEffect)(()=>((()=>{if(window.wcBlocksStoreCartListeners||(window.wcBlocksStoreCartListeners={count:0,remove:()=>{}}),(null===(e=window.wcBlocksStoreCartListeners)||void 0===e?void 0:e.count)>0)return void window.wcBlocksStoreCartListeners.count++;var e;document.body.addEventListener("wc-blocks_added_to_cart",d),document.body.addEventListener("wc-blocks_removed_from_cart",d),window.addEventListener("pageshow",b);const t=Object(u.a)("added_to_cart","wc-blocks_added_to_cart"),c=Object(u.a)("removed_from_cart","wc-blocks_removed_from_cart");window.wcBlocksStoreCartListeners.count=1,window.wcBlocksStoreCartListeners.remove=()=>{document.body.removeEventListener("wc-blocks_added_to_cart",d),document.body.removeEventListener("wc-blocks_removed_from_cart",d),window.removeEventListener("pageshow",b),t(),c()}})(),p),[])},g={first_name:"",last_name:"",company:"",address_1:"",address_2:"",city:"",state:"",postcode:"",country:"",phone:""},O={...g,email:""},j={total_items:"",total_items_tax:"",total_fees:"",total_fees_tax:"",total_discount:"",total_discount_tax:"",total_shipping:"",total_shipping_tax:"",total_price:"",total_tax:"",tax_lines:n.EMPTY_TAX_LINES,currency_code:"",currency_symbol:"",currency_minor_unit:2,currency_decimal_separator:"",currency_thousand_separator:"",currency_prefix:"",currency_suffix:""},h=e=>Object.fromEntries(Object.entries(e).map(e=>{let[t,c]=e;return[t,Object(s.decodeEntities)(c)]})),_={cartCoupons:n.EMPTY_CART_COUPONS,cartItems:n.EMPTY_CART_ITEMS,cartFees:n.EMPTY_CART_FEES,cartItemsCount:0,cartItemsWeight:0,crossSellsProducts:n.EMPTY_CART_CROSS_SELLS,cartNeedsPayment:!0,cartNeedsShipping:!0,cartItemErrors:n.EMPTY_CART_ITEM_ERRORS,cartTotals:j,cartIsLoading:!0,cartErrors:n.EMPTY_CART_ERRORS,billingAddress:O,shippingAddress:g,shippingRates:n.EMPTY_SHIPPING_RATES,isLoadingRates:!1,cartHasCalculatedShipping:!1,paymentRequirements:n.EMPTY_PAYMENT_REQUIREMENTS,receiveCart:()=>{},receiveCartContents:()=>{},extensions:n.EMPTY_EXTENSIONS},E=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{shouldSelect:!0};const{isEditor:t,previewData:c}=Object(i.b)(),s=null==c?void 0:c.previewCart,{shouldSelect:u}=e,d=Object(o.useRef)();m();const b=Object(a.useSelect)((e,c)=>{let{dispatch:r}=c;if(!u)return _;if(t)return{cartCoupons:s.coupons,cartItems:s.items,crossSellsProducts:s.cross_sells,cartFees:s.fees,cartItemsCount:s.items_count,cartItemsWeight:s.items_weight,cartNeedsPayment:s.needs_payment,cartNeedsShipping:s.needs_shipping,cartItemErrors:n.EMPTY_CART_ITEM_ERRORS,cartTotals:s.totals,cartIsLoading:!1,cartErrors:n.EMPTY_CART_ERRORS,billingData:O,billingAddress:O,shippingAddress:g,extensions:n.EMPTY_EXTENSIONS,shippingRates:s.shipping_rates,isLoadingRates:!1,cartHasCalculatedShipping:s.has_calculated_shipping,paymentRequirements:s.paymentRequirements,receiveCart:"function"==typeof(null==s?void 0:s.receiveCart)?s.receiveCart:()=>{},receiveCartContents:"function"==typeof(null==s?void 0:s.receiveCartContents)?s.receiveCartContents:()=>{}};const o=e(n.CART_STORE_KEY),a=o.getCartData(),i=o.getCartErrors(),d=o.getCartTotals(),b=!o.hasFinishedResolution("getCartData"),p=o.isCustomerDataUpdating(),{receiveCart:m,receiveCartContents:j}=r(n.CART_STORE_KEY),E=h(a.billingAddress),f=a.needsShipping?h(a.shippingAddress):E,w=a.fees.length>0?a.fees.map(e=>h(e)):n.EMPTY_CART_FEES;return{cartCoupons:a.coupons.length>0?a.coupons.map(e=>({...e,label:e.code})):n.EMPTY_CART_COUPONS,cartItems:a.items,crossSellsProducts:a.crossSells,cartFees:w,cartItemsCount:a.itemsCount,cartItemsWeight:a.itemsWeight,cartNeedsPayment:a.needsPayment,cartNeedsShipping:a.needsShipping,cartItemErrors:a.errors,cartTotals:d,cartIsLoading:b,cartErrors:i,billingData:Object(l.a)(E),billingAddress:Object(l.a)(E),shippingAddress:Object(l.a)(f),extensions:a.extensions,shippingRates:a.shippingRates,isLoadingRates:p,cartHasCalculatedShipping:a.hasCalculatedShipping,paymentRequirements:a.paymentRequirements,receiveCart:m,receiveCartContents:j}},[u]);return d.current&&Object(r.isEqual)(d.current,b)||(d.current=b),d.current}},function(e,t){e.exports=window.wp.hooks},function(e,t){e.exports=window.wc.wcBlocksSharedHocs},function(e,t){e.exports=window.wp.a11y},function(e,t,c){"use strict";c.d(t,"a",(function(){return n}));var r=c(0);const o=Object(r.createContext)("page"),n=()=>Object(r.useContext)(o);o.Provider},,,,,,,function(e,t,c){"use strict";c.d(t,"a",(function(){return d})),c.d(t,"b",(function(){return b})),c.d(t,"c",(function(){return p}));var r=c(10),o=c(7),n=c(0),a=c(25),s=c.n(a),l=c(42),i=c(103),u=c(47);const d=e=>{const t=Object(u.a)();e=e||t;const c=Object(o.useSelect)(t=>t(r.QUERY_STATE_STORE_KEY).getValueForQueryContext(e,void 0),[e]),{setValueForQueryContext:a}=Object(o.useDispatch)(r.QUERY_STATE_STORE_KEY);return[c,Object(n.useCallback)(t=>{a(e,t)},[e,a])]},b=(e,t,c)=>{const a=Object(u.a)();c=c||a;const s=Object(o.useSelect)(o=>o(r.QUERY_STATE_STORE_KEY).getValueForQueryKey(c,e,t),[c,e]),{setQueryValue:l}=Object(o.useDispatch)(r.QUERY_STATE_STORE_KEY);return[s,Object(n.useCallback)(t=>{l(c,e,t)},[c,e,l])]},p=(e,t)=>{const c=Object(u.a)();t=t||c;const[r,o]=d(t),a=Object(l.a)(r),b=Object(l.a)(e),p=Object(i.a)(b),m=Object(n.useRef)(!1);return Object(n.useEffect)(()=>{s()(p,b)||(o(Object.assign({},a,b)),m.current=!0)},[a,b,p,o]),m.current?[r,o]:[e,o]}},function(e,t,c){"use strict";c.d(t,"c",(function(){return n})),c.d(t,"a",(function(){return a})),c.d(t,"b",(function(){return s}));var r=c(9),o=c(20);const n=(e,t)=>{if(o.n>2)return Object(r.registerBlockType)(e,t)},a=()=>o.n>2,s=()=>o.n>1},,,function(e,t,c){"use strict";var r=c(6),o=c.n(r),n=c(0),a=c(138),s=c(4),l=c.n(s),i=c(95);c(159),t.a=e=>{let{className:t,showSpinner:c=!1,children:r,variant:s="contained",...u}=e;const d=l()("wc-block-components-button","wp-element-button",t,s,{"wc-block-components-button--loading":c});return Object(n.createElement)(a.a,o()({className:d},u),c&&Object(n.createElement)(i.a,null),Object(n.createElement)("span",{className:"wc-block-components-button__text"},r))}},,function(e,t,c){"use strict";c.d(t,"a",(function(){return o})),c.d(t,"e",(function(){return n})),c.d(t,"d",(function(){return a})),c.d(t,"b",(function(){return l})),c.d(t,"c",(function(){return i}));var r=c(32);const o=(e,t)=>e[t]?Array.from(e[t].values()).sort((e,t)=>e.priority-t.priority):[];let n,a;!function(e){e.SUCCESS="success",e.FAIL="failure",e.ERROR="error"}(n||(n={})),function(e){e.CART="wc/cart",e.CHECKOUT="wc/checkout",e.PAYMENTS="wc/checkout/payments",e.EXPRESS_PAYMENTS="wc/checkout/express-payments",e.CONTACT_INFORMATION="wc/checkout/contact-information",e.SHIPPING_ADDRESS="wc/checkout/shipping-address",e.BILLING_ADDRESS="wc/checkout/billing-address",e.SHIPPING_METHODS="wc/checkout/shipping-methods",e.CHECKOUT_ACTIONS="wc/checkout/checkout-actions"}(a||(a={}));const s=(e,t)=>Object(r.b)(e)&&"type"in e&&e.type===t,l=e=>s(e,n.ERROR),i=e=>s(e,n.FAIL)},function(e,t){e.exports=window.wp.autop},,function(e,t,c){"use strict";var r=c(0),o=c(1),n=c(8),a=c(3);t.a=e=>{let{columns:t,rows:c,setAttributes:s,alignButtons:l,minColumns:i=1,maxColumns:u=6,minRows:d=1,maxRows:b=6}=e;return Object(r.createElement)(r.Fragment,null,Object(r.createElement)(a.RangeControl,{label:Object(o.__)("Columns","woo-gutenberg-products-block"),value:t,onChange:e=>{const t=Object(n.clamp)(e,i,u);s({columns:Number.isNaN(t)?"":t})},min:i,max:u}),Object(r.createElement)(a.RangeControl,{label:Object(o.__)("Rows","woo-gutenberg-products-block"),value:c,onChange:e=>{const t=Object(n.clamp)(e,d,b);s({rows:Number.isNaN(t)?"":t})},min:d,max:b}),Object(r.createElement)(a.ToggleControl,{label:Object(o.__)("Align the last block to the bottom","woo-gutenberg-products-block"),help:l?Object(o.__)("Align the last block to the bottom.","woo-gutenberg-products-block"):Object(o.__)("The last inner block will follow other content.","woo-gutenberg-products-block"),checked:l,onChange:()=>s({alignButtons:!l})}))}},,,,function(e,t){e.exports=window.wp.dom},,,,,,,function(e,t,c){"use strict";c.d(t,"a",(function(){return r}));const r=e=>"string"==typeof e},,,,function(e,t,c){"use strict";var r=c(0),o=c(1),n=c(37),a=c(4),s=c.n(a),l=c(24);c(158);const i=e=>{let{currency:t,maxPrice:c,minPrice:a,priceClassName:i,priceStyle:u={}}=e;return Object(r.createElement)(r.Fragment,null,Object(r.createElement)("span",{className:"screen-reader-text"},Object(o.sprintf)( +/* translators: %1$s min price, %2$s max price */ +Object(o.__)("Price between %1$s and %2$s","woo-gutenberg-products-block"),Object(l.formatPrice)(a),Object(l.formatPrice)(c))),Object(r.createElement)("span",{"aria-hidden":!0},Object(r.createElement)(n.a,{className:s()("wc-block-components-product-price__value",i),currency:t,value:a,style:u})," — ",Object(r.createElement)(n.a,{className:s()("wc-block-components-product-price__value",i),currency:t,value:c,style:u})))},u=e=>{let{currency:t,regularPriceClassName:c,regularPriceStyle:a,regularPrice:l,priceClassName:i,priceStyle:u,price:d}=e;return Object(r.createElement)(r.Fragment,null,Object(r.createElement)("span",{className:"screen-reader-text"},Object(o.__)("Previous price:","woo-gutenberg-products-block")),Object(r.createElement)(n.a,{currency:t,renderText:e=>Object(r.createElement)("del",{className:s()("wc-block-components-product-price__regular",c),style:a},e),value:l}),Object(r.createElement)("span",{className:"screen-reader-text"},Object(o.__)("Discounted price:","woo-gutenberg-products-block")),Object(r.createElement)(n.a,{currency:t,renderText:e=>Object(r.createElement)("ins",{className:s()("wc-block-components-product-price__value","is-discounted",i),style:u},e),value:d}))};t.a=e=>{let{align:t,className:c,currency:o,format:a="",maxPrice:l,minPrice:d,price:b,priceClassName:p,priceStyle:m,regularPrice:g,regularPriceClassName:O,regularPriceStyle:j,spacingStyle:h}=e;const _=s()(c,"price","wc-block-components-product-price",{["wc-block-components-product-price--align-"+t]:t});a.includes("")||(a="",console.error("Price formats need to include the `` tag."));const E=g&&b!==g;let f=Object(r.createElement)("span",{className:s()("wc-block-components-product-price__value",p)});return E?f=Object(r.createElement)(u,{currency:o,price:b,priceClassName:p,priceStyle:m,regularPrice:g,regularPriceClassName:O,regularPriceStyle:j}):void 0!==d&&void 0!==l?f=Object(r.createElement)(i,{currency:o,maxPrice:l,minPrice:d,priceClassName:p,priceStyle:m}):b&&(f=Object(r.createElement)(n.a,{className:s()("wc-block-components-product-price__value",p),currency:o,value:b,style:m})),Object(r.createElement)("span",{className:_,style:h},Object(r.createInterpolateElement)(a,{price:f}))}},,,function(e,t,c){"use strict";c.d(t,"b",(function(){return a})),c.d(t,"a",(function(){return s}));var r=c(0),o=c(7);const n=Object(r.createContext)({isEditor:!1,currentPostId:0,currentView:"",previewData:{},getPreviewData:()=>({})}),a=()=>Object(r.useContext)(n),s=e=>{let{children:t,currentPostId:c=0,previewData:a={},currentView:s=""}=e;const l=Object(o.useSelect)(e=>c||e("core/editor").getCurrentPostId(),[c]),i=Object(r.useCallback)(e=>a&&e in a?a[e]:{},[a]),u={isEditor:!0,currentPostId:l,currentView:s,previewData:a,getPreviewData:i};return Object(r.createElement)(n.Provider,{value:u},t)}},function(e,t,c){"use strict";c.d(t,"a",(function(){return a}));var r=c(44),o=c(0),n=c(43);const a=()=>{const e=Object(n.a)(),t=Object(o.useRef)(e);return Object(o.useEffect)(()=>{t.current=e},[e]),{dispatchStoreEvent:Object(o.useCallback)((function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};try{Object(r.doAction)("experimental__woocommerce_blocks-"+e,t)}catch(e){console.error(e)}}),[]),dispatchCheckoutEvent:Object(o.useCallback)((function(e){let c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};try{Object(r.doAction)("experimental__woocommerce_blocks-checkout-"+e,{...c,storeCart:t.current})}catch(e){console.error(e)}}),[])}}},function(e,t,c){"use strict";var r=c(6),o=c.n(r),n=c(0),a=c(38),s=c(3),l=c(4),i=c.n(l);t.a=e=>{let{className:t,item:c,isSelected:r,isLoading:l,onSelect:u,disabled:d,...b}=e;return Object(n.createElement)(n.Fragment,null,Object(n.createElement)(a.a,o()({},b,{key:c.id,className:t,isSelected:r,item:c,onSelect:u,isSingle:!0,disabled:d})),r&&l&&Object(n.createElement)("div",{key:"loading",className:i()("woocommerce-search-list__item","woocommerce-product-attributes__item","depth-1","is-loading","is-not-active")},Object(n.createElement)(s.Spinner,null)))}},,,,,function(e,t,c){"use strict";c.d(t,"a",(function(){return a}));var r=c(32),o=c(74),n=c(98);const a=e=>{const t=Object(r.b)(e)?e:{},c=Object(n.a)(t.style),a=Object(r.b)(c.typography)?c.typography:{},s=Object(o.a)(a.fontFamily)?a.fontFamily:"";return{className:t.fontFamily?`has-${t.fontFamily}-font-family`:s,style:{fontSize:t.fontSize?`var(--wp--preset--font-size--${t.fontSize})`:a.fontSize,fontStyle:a.fontStyle,fontWeight:a.fontWeight,letterSpacing:a.letterSpacing,lineHeight:a.lineHeight,textDecoration:a.textDecoration,textTransform:a.textTransform}}}},,function(e,t){e.exports=window.wp.wordcount},,function(e,t,c){"use strict";var r=c(2),o=c(1),n=c(145),a=c(74);const s=Object(r.getSetting)("countryLocale",{}),l=e=>{const t={};return void 0!==e.label&&(t.label=e.label),void 0!==e.required&&(t.required=e.required),void 0!==e.hidden&&(t.hidden=e.hidden),void 0===e.label||e.optionalLabel||(t.optionalLabel=Object(o.sprintf)( +/* translators: %s Field label. */ +Object(o.__)("%s (optional)","woo-gutenberg-products-block"),e.label)),e.priority&&(Object(n.a)(e.priority)&&(t.index=e.priority),Object(a.a)(e.priority)&&(t.index=parseInt(e.priority,10))),e.hidden&&(t.required=!1),t},i=Object.entries(s).map(e=>{let[t,c]=e;return[t,Object.entries(c).map(e=>{let[t,c]=e;return[t,l(c)]}).reduce((e,t)=>{let[c,r]=t;return e[c]=r,e},{})]}).reduce((e,t)=>{let[c,r]=t;return e[c]=r,e},{});t.a=function(e,t){let c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";const o=c&&void 0!==i[c]?i[c]:{};return e.map(e=>({key:e,...r.defaultAddressFields[e]||{},...o[e]||{},...t[e]||{}})).sort((e,t)=>e.index-t.index)}},,function(e,t){e.exports=window.wp.warning},function(e,t,c){"use strict";var r=c(0);c(160),t.a=()=>Object(r.createElement)("span",{className:"wc-block-components-spinner","aria-hidden":"true"})},function(e,t,c){"use strict";var r=c(6),o=c.n(r),n=c(0),a=c(1),s=c(8),l=c(38),i=c(100),u=c(12),d=Object(u.createHigherOrderComponent)(e=>{class t extends n.Component{render(){const{selected:t}=this.props,c=null==t;return Array.isArray(t)?Object(n.createElement)(e,this.props):Object(n.createElement)(e,o()({},this.props,{selected:c?[]:[t]}))}}return t.defaultProps={selected:null},t},"withTransformSingleSelectToMultipleSelect"),b=c(186),p=c(23),m=c.n(p),g=c(25),O=c.n(g),j=c(26),h=c(29),_=Object(u.createHigherOrderComponent)(e=>{class t extends n.Component{constructor(){super(...arguments),m()(this,"state",{error:null,loading:!1,variations:{}}),m()(this,"loadVariations",()=>{const{products:e}=this.props,{loading:t,variations:c}=this.state;if(t)return;const r=this.getExpandedProduct();if(!r||c[r])return;const o=e.find(e=>e.id===r);o.variations&&0!==o.variations.length?(this.setState({loading:!0}),Object(j.g)(r).then(e=>{const t=e.map(e=>({...e,parent:r}));this.setState({variations:{...this.state.variations,[r]:t},loading:!1,error:null})}).catch(async e=>{const t=await Object(h.a)(e);this.setState({variations:{...this.state.variations,[r]:null},loading:!1,error:t})})):this.setState({variations:{...this.state.variations,[r]:null},loading:!1,error:null})})}componentDidMount(){const{selected:e,showVariations:t}=this.props;e&&t&&this.loadVariations()}componentDidUpdate(e){const{isLoading:t,selected:c,showVariations:r}=this.props;r&&(!O()(e.selected,c)||e.isLoading&&!t)&&this.loadVariations()}isProductId(e){const{products:t}=this.props;return t.some(t=>t.id===e)}findParentProduct(e){var t;const{products:c}=this.props;return null===(t=c.filter(t=>t.variations&&t.variations.find(t=>{let{id:c}=t;return c===e}))[0])||void 0===t?void 0:t.id}getExpandedProduct(){const{isLoading:e,selected:t,showVariations:c}=this.props;if(!c)return null;let r=t&&t.length?t[0]:null;return r?this.prevSelectedItem=r:this.prevSelectedItem&&(e||this.isProductId(this.prevSelectedItem)||(r=this.prevSelectedItem)),!e&&r?this.isProductId(r)?r:this.findParentProduct(r):null}render(){const{error:t,isLoading:c}=this.props,{error:r,loading:a,variations:s}=this.state;return Object(n.createElement)(e,o()({},this.props,{error:r||t,expandedProduct:this.getExpandedProduct(),isLoading:c,variations:s,variationsLoading:a}))}}return m()(t,"defaultProps",{selected:[],showVariations:!1}),t},"withProductVariations"),E=c(34),f=c(4),w=c.n(f),y=c(83);c(140);const k={list:Object(a.__)("Products","woo-gutenberg-products-block"),noItems:Object(a.__)("Your store doesn't have any products.","woo-gutenberg-products-block"),search:Object(a.__)("Search for a product to display","woo-gutenberg-products-block"),updated:Object(a.__)("Product search results updated.","woo-gutenberg-products-block")},v=e=>{let{expandedProduct:t,error:c,instanceId:r,isCompact:u,isLoading:d,onChange:b,onSearch:p,products:m,renderItem:g,selected:O,showVariations:j,variations:h,variationsLoading:_}=e;if(c)return Object(n.createElement)(E.a,{error:c});const f=[...m,...h&&h[t]?h[t]:[]];return Object(n.createElement)(i.a,{className:"woocommerce-products",list:f,isCompact:u,isLoading:d,isSingle:!0,selected:f.filter(e=>{let{id:t}=e;return O.includes(t)}),onChange:b,renderItem:g||(j?e=>{const{item:t,search:c,depth:i=0,isSelected:u,onSelect:b}=e,p=t.variations&&Array.isArray(t.variations)?t.variations.length:0,m=w()("woocommerce-search-product__item","woocommerce-search-list__item","depth-"+i,"has-count",{"is-searching":c.length>0,"is-skip-level":0===i&&0!==t.parent,"is-variable":p>0});if(!t.breadcrumbs.length)return Object(n.createElement)(y.a,o()({},e,{className:w()(m,{"is-selected":u}),isSelected:u,item:t,onSelect:()=>()=>{b(t)()},isLoading:d||_,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","woo-gutenberg-products-block"),t.variations.length):null,name:"products-"+r,"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,"woo-gutenberg-products-block"),t.name,t.variations.length)}));const g=Object(s.isEmpty)(t.variation)?e:{...e,item:{...e.item,name:t.variation},"aria-label":`${t.breadcrumbs[0]}: ${t.variation}`};return Object(n.createElement)(l.a,o()({},g,{className:m,name:"variations-"+r}))}:null),onSearch:p,messages:k,isHierarchical:!0})};v.defaultProps={isCompact:!1,expandedProduct:null,selected:[],showVariations:!1},t.a=d(Object(b.a)(_(Object(u.withInstanceId)(v))))},function(e,t,c){"use strict";c.d(t,"a",(function(){return n})),c.d(t,"b",(function(){return s}));var r=c(8);let o;!function(e){e.ADD_EVENT_CALLBACK="add_event_callback",e.REMOVE_EVENT_CALLBACK="remove_event_callback"}(o||(o={}));const n={addEventCallback:function(e,t){let c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:10;return{id:Object(r.uniqueId)(),type:o.ADD_EVENT_CALLBACK,eventType:e,callback:t,priority:c}},removeEventCallback:(e,t)=>({id:t,type:o.REMOVE_EVENT_CALLBACK,eventType:e})},a={},s=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:a,{type:t,eventType:c,id:r,callback:n,priority:s}=arguments.length>1?arguments[1]:void 0;const l=e.hasOwnProperty(c)?new Map(e[c]):new Map;switch(t){case o.ADD_EVENT_CALLBACK:return l.set(r,{priority:s,callback:n}),{...e,[c]:l};case o.REMOVE_EVENT_CALLBACK:return l.delete(r),{...e,[c]:l}}}},function(e,t,c){"use strict";c.d(t,"a",(function(){return n}));var r=c(74),o=c(32);const n=e=>Object(r.a)(e)?JSON.parse(e)||{}:Object(o.b)(e)?e:{}},function(e,t,c){"use strict";c.d(t,"a",(function(){return s}));var r=c(5),o=c(55),n=c(32),a=c(98);const s=e=>{if(!Object(o.b)())return{className:"",style:{}};const t=Object(n.b)(e)?e:{},c=Object(a.a)(t.style);return Object(r.__experimentalUseColorProps)({...t,style:c})}},function(e,t,c){"use strict";c.d(t,"a",(function(){return y}));var r=c(6),o=c.n(r),n=c(0),a=c(1),s=c(3),l=c(80),i=c(535),u=c(4),d=c.n(u),b=c(12),p=c(19),m=c(38),g=c(534),O=c(18);const j=e=>{let{id:t,label:c,popoverContents:r,remove:o,screenReaderLabel:i,className:u=""}=e;const[p,m]=Object(n.useState)(!1),h=Object(b.useInstanceId)(j);if(i=i||c,!c)return null;c=Object(O.decodeEntities)(c);const _=d()("woocommerce-tag",u,{"has-remove":!!o}),E="woocommerce-tag__label-"+h,f=Object(n.createElement)(n.Fragment,null,Object(n.createElement)("span",{className:"screen-reader-text"},i),Object(n.createElement)("span",{"aria-hidden":"true"},c));return Object(n.createElement)("span",{className:_},r?Object(n.createElement)(s.Button,{className:"woocommerce-tag__text",id:E,onClick:()=>m(!0)},f):Object(n.createElement)("span",{className:"woocommerce-tag__text",id:E},f),r&&p&&Object(n.createElement)(s.Popover,{onClose:()=>m(!1)},r),o&&Object(n.createElement)(s.Button,{className:"woocommerce-tag__remove",onClick:o(t),label:Object(a.sprintf)(// Translators: %s label. +Object(a.__)("Remove %s","woo-gutenberg-products-block"),c),"aria-describedby":E},Object(n.createElement)(l.a,{icon:g.a,size:20,className:"clear-icon"})))};var h=j;const _=e=>Object(n.createElement)(m.b,e),E=e=>{const{list:t,selected:c,renderItem:r,depth:a=0,onSelect:s,instanceId:l,isSingle:i,search:u}=e;return t?Object(n.createElement)(n.Fragment,null,t.map(t=>{const d=-1!==c.findIndex(e=>{let{id:c}=e;return c===t.id});return Object(n.createElement)(n.Fragment,{key:t.id},Object(n.createElement)("li",null,r({item:t,isSelected:d,onSelect:s,isSingle:i,search:u,depth:a,controlId:l})),Object(n.createElement)(E,o()({},e,{list:t.children,depth:a+1})))})):null},f=e=>{let{isLoading:t,isSingle:c,selected:r,messages:o,onChange:l,onRemove:i}=e;if(t||c||!r)return null;const u=r.length;return Object(n.createElement)("div",{className:"woocommerce-search-list__selected"},Object(n.createElement)("div",{className:"woocommerce-search-list__selected-header"},Object(n.createElement)("strong",null,o.selected(u)),u>0?Object(n.createElement)(s.Button,{isLink:!0,isDestructive:!0,onClick:()=>l([]),"aria-label":o.clear},Object(a.__)("Clear all","woo-gutenberg-products-block")):null),u>0?Object(n.createElement)("ul",null,r.map((e,t)=>Object(n.createElement)("li",{key:t},Object(n.createElement)(h,{label:e.name,id:e.id,remove:i})))):null)},w=e=>{let{filteredList:t,search:c,onSelect:r,instanceId:o,...s}=e;const{messages:u,renderItem:d,selected:b,isSingle:p}=s,m=d||_;return 0===t.length?Object(n.createElement)("div",{className:"woocommerce-search-list__list is-not-found"},Object(n.createElement)("span",{className:"woocommerce-search-list__not-found-icon"},Object(n.createElement)(l.a,{icon:i.a})),Object(n.createElement)("span",{className:"woocommerce-search-list__not-found-text"},c?Object(a.sprintf)(u.noResults,c):u.noItems)):Object(n.createElement)("ul",{className:"woocommerce-search-list__list"},Object(n.createElement)(E,{list:t,selected:b,renderItem:m,onSelect:r,instanceId:o,isSingle:p,search:c}))},y=e=>{const{className:t="",isCompact:c,isHierarchical:r,isLoading:a,isSingle:l,list:i,messages:u=p.a,onChange:m,onSearch:g,selected:O,debouncedSpeak:j}=e,[h,_]=Object(n.useState)(""),E=Object(b.useInstanceId)(y),k=Object(n.useMemo)(()=>({...p.a,...u}),[u]),v=Object(n.useMemo)(()=>Object(p.c)(i,h,r),[i,h,r]);Object(n.useEffect)(()=>{j&&j(k.updated)},[j,k]),Object(n.useEffect)(()=>{"function"==typeof g&&g(h)},[h,g]);const S=Object(n.useCallback)(e=>()=>{l&&m([]);const t=O.findIndex(t=>{let{id:c}=t;return c===e});m([...O.slice(0,t),...O.slice(t+1)])},[l,O,m]),C=Object(n.useCallback)(e=>()=>{-1===O.findIndex(t=>{let{id:c}=t;return c===e.id})?m(l?[e]:[...O,e]):S(e.id)()},[l,S,m,O]);return Object(n.createElement)("div",{className:d()("woocommerce-search-list",t,{"is-compact":c})},Object(n.createElement)(f,o()({},e,{onRemove:S,messages:k})),Object(n.createElement)("div",{className:"woocommerce-search-list__search"},Object(n.createElement)(s.TextControl,{label:k.search,type:"search",value:h,onChange:e=>_(e)})),a?Object(n.createElement)("div",{className:"woocommerce-search-list__list is-loading"},Object(n.createElement)(s.Spinner,null)):Object(n.createElement)(w,o()({},e,{search:h,filteredList:v,messages:k,onSelect:C,instanceId:E})))};Object(s.withSpokenMessages)(y)},,,function(e,t,c){"use strict";c.d(t,"a",(function(){return o}));var r=c(13);function o(e,t){const c=Object(r.useRef)();return Object(r.useEffect)(()=>{c.current===e||t&&!t(e,c.current)||(c.current=e)},[e,t]),c.current}},,function(e,t,c){"use strict";var r=c(6),o=c.n(r),n=c(0),a=c(18),s=c(4),l=c.n(s);c(157),t.a=e=>{let{className:t="",disabled:c=!1,name:r,permalink:s="",target:i,rel:u,style:d,onClick:b,...p}=e;const m=l()("wc-block-components-product-name",t);if(c){const e=p;return Object(n.createElement)("span",o()({className:m},e,{dangerouslySetInnerHTML:{__html:Object(a.decodeEntities)(r)}}))}return Object(n.createElement)("a",o()({className:m,href:s,target:i},p,{dangerouslySetInnerHTML:{__html:Object(a.decodeEntities)(r)},style:d}))}},function(e,t,c){"use strict";c.d(t,"a",(function(){return s}));var r=c(10),o=c(7),n=c(0),a=c(42);const s=e=>{const{namespace:t,resourceName:c,resourceValues:s=[],query:l={},shouldSelect:i=!0}=e;if(!t||!c)throw new Error("The options object must have valid values for the namespace and the resource properties.");const u=Object(n.useRef)({results:[],isLoading:!0}),d=Object(a.a)(l),b=Object(a.a)(s),p=(()=>{const[,e]=Object(n.useState)();return Object(n.useCallback)(t=>{e(()=>{throw t})},[])})(),m=Object(o.useSelect)(e=>{if(!i)return null;const o=e(r.COLLECTIONS_STORE_KEY),n=[t,c,d,b],a=o.getCollectionError(...n);if(a){if(!(a instanceof Error))throw new Error("TypeError: `error` object is not an instance of Error constructor");p(a)}return{results:o.getCollection(...n),isLoading:!o.hasFinishedResolution("getCollection",n)}},[t,c,b,d,i]);return null!==m&&(u.current=m),u.current}},function(e,t,c){"use strict";var r=c(0),o=c(1),n=c(80),a=c(228),s=c(2),l=c(5),i=c(22);t.a=e=>{const t=(Object(i.useProductDataContext)().product||{}).id||e.productId||0;return t?Object(r.createElement)(l.InspectorControls,null,Object(r.createElement)("div",{className:"wc-block-single-product__edit-card"},Object(r.createElement)("div",{className:"wc-block-single-product__edit-card-title"},Object(r.createElement)("a",{href:`${s.ADMIN_URL}post.php?post=${t}&action=edit`,target:"_blank",rel:"noopener noreferrer"},Object(o.__)("Edit this product's details","woo-gutenberg-products-block"),Object(r.createElement)(n.a,{icon:a.a,size:16}))),Object(r.createElement)("div",{className:"wc-block-single-product__edit-card-description"},Object(o.__)("Edit details such as title, price, description and more.","woo-gutenberg-products-block")))):null}},,,,,function(e,t,c){"use strict";c.d(t,"a",(function(){return s}));var r=c(5),o=c(55),n=c(32),a=c(98);const s=e=>{if(!Object(o.b)())return{style:{}};const t=Object(n.b)(e)?e:{},c=Object(a.a)(t.style);return Object(r.__experimentalGetSpacingClassesAndStyles)({...t,style:c})}},,,function(e,t,c){"use strict";c.d(t,"c",(function(){return s})),c.d(t,"b",(function(){return l})),c.d(t,"a",(function(){return i}));var r=c(0),o=c(1),n=c(80),a=c(344);const s=Object(o.__)("Product Summary","woo-gutenberg-products-block"),l=Object(r.createElement)(n.a,{icon:a.a,className:"wc-block-editor-components-block-icon"}),i=Object(o.__)("Display a short description about a product.","woo-gutenberg-products-block")},,,,function(e,t,c){"use strict";var r=c(0),o=c(90),n=c(61);const a=e=>{const t=e.indexOf("

");return-1===t?e:e.substr(0,t+4)},s=e=>e.replace(/<\/?[a-z][^>]*?>/gi,""),l=(e,t)=>e.replace(/[\s|\.\,]+$/i,"")+t,i=function(e,t){let c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"…";const r=s(e),o=r.split(" ").splice(0,t).join(" ");return Object(n.autop)(l(o,c))},u=function(e,t){let c=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"…";const o=s(e),a=o.slice(0,t);if(c)return Object(n.autop)(l(a,r));const i=a.match(/([\s]+)/g),u=i?i.length:0,d=o.slice(0,t+u);return Object(n.autop)(l(d,r))};t.a=e=>{let{source:t,maxLength:c=15,countType:s="words",className:l="",style:d={}}=e;const b=Object(r.useMemo)(()=>function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:15,c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"words";const r=Object(n.autop)(e),s=Object(o.count)(r,c);if(s<=t)return r;const l=a(r),d=Object(o.count)(l,c);return d<=t?l:"words"===c?i(l,t):u(l,t,"characters_including_spaces"===c)}(t,c,s),[t,c,s]);return Object(r.createElement)(r.RawHTML,{style:d,className:l},b)}},,,,,function(e,t,c){"use strict";var r=c(0),o=c(4),n=c.n(o),a=c(30),s=c(12);c(163),t.a=Object(s.withInstanceId)(e=>{let{className:t,instanceId:c,label:o="",onChange:s,options:l,screenReaderLabel:i,value:u=""}=e;const d="wc-block-components-sort-select__select-"+c;return Object(r.createElement)("div",{className:n()("wc-block-sort-select","wc-block-components-sort-select",t)},Object(r.createElement)(a.a,{label:o,screenReaderLabel:i,wrapperElement:"label",wrapperProps:{className:"wc-block-sort-select__label wc-block-components-sort-select__label",htmlFor:d}}),Object(r.createElement)("select",{id:d,className:"wc-block-sort-select__select wc-block-components-sort-select__select",onChange:s,value:u},l&&l.map(e=>Object(r.createElement)("option",{key:e.key,value:e.key},e.label))))})},,,function(e,t,c){"use strict";c.d(t,"a",(function(){return r}));const r=e=>"boolean"==typeof e},,,function(e,t,c){"use strict";c.d(t,"c",(function(){return s})),c.d(t,"b",(function(){return l})),c.d(t,"a",(function(){return i}));var r=c(0),o=c(1),n=c(80),a=c(343);const s=Object(o.__)("Product Title","woo-gutenberg-products-block"),l=Object(r.createElement)(n.a,{icon:a.a,className:"wc-block-editor-components-block-icon"}),i=Object(o.__)("Display the title of a product.","woo-gutenberg-products-block")},,function(e,t,c){"use strict";c.d(t,"a",(function(){return s}));var r=c(5),o=c(55),n=c(32),a=c(98);const s=e=>{if(!Object(o.b)())return{className:"",style:{}};const t=Object(n.b)(e)?e:{},c=Object(a.a)(t.style);return Object(r.__experimentalUseBorderProps)({...t,style:c})}},,,,,,,function(e,t){},function(e,t){},function(e,t,c){"use strict";c.r(t),c.d(t,"Block",(function(){return m}));var r=c(0),o=c(1),n=c(4),a=c.n(n),s=c(30),l=c(22),i=c(132),u=c(99),d=c(88),b=c(112),p=c(45);c(252);const m=e=>{const{className:t,align:c}=e,{parentClassName:n}=Object(l.useInnerBlockLayoutContext)(),{product:p}=Object(l.useProductDataContext)(),m=Object(i.a)(e),g=Object(u.a)(e),O=Object(d.a)(e),j=Object(b.a)(e);if(!p.id||!p.on_sale)return null;const h="string"==typeof c?"wc-block-components-product-sale-badge--align-"+c:"";return Object(r.createElement)("div",{className:a()("wc-block-components-product-sale-badge",t,h,{[n+"__product-onsale"]:n},g.className,m.className,O.className),style:{...g.style,...m.style,...O.style,...j.style}},Object(r.createElement)(s.a,{label:Object(o.__)("Sale","woo-gutenberg-products-block"),screenReaderLabel:Object(o.__)("Product on sale","woo-gutenberg-products-block")}))};t.default=Object(p.withProductDataContext)(m)},,,,function(e,t,c){"use strict";c.d(t,"a",(function(){return r}));const r=e=>"number"==typeof e},,,,function(e,t,c){"use strict";c.d(t,"a",(function(){return o}));var r=c(0);const o=Object(r.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 230 250",style:{width:"100%"}},Object(r.createElement)("title",null,"Grid Block Preview"),Object(r.createElement)("rect",{width:"65.374",height:"65.374",x:".162",y:".779",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"47.266",height:"5.148",x:"9.216",y:"76.153",fill:"#E1E3E6",rx:"2.574"}),Object(r.createElement)("rect",{width:"62.8",height:"15",x:"1.565",y:"101.448",fill:"#E1E3E6",rx:"5"}),Object(r.createElement)("rect",{width:"65.374",height:"65.374",x:".162",y:"136.277",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"47.266",height:"5.148",x:"9.216",y:"211.651",fill:"#E1E3E6",rx:"2.574"}),Object(r.createElement)("rect",{width:"62.8",height:"15",x:"1.565",y:"236.946",fill:"#E1E3E6",rx:"5"}),Object(r.createElement)("rect",{width:"65.374",height:"65.374",x:"82.478",y:".779",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"47.266",height:"5.148",x:"91.532",y:"76.153",fill:"#E1E3E6",rx:"2.574"}),Object(r.createElement)("rect",{width:"62.8",height:"15",x:"83.882",y:"101.448",fill:"#E1E3E6",rx:"5"}),Object(r.createElement)("rect",{width:"65.374",height:"65.374",x:"82.478",y:"136.277",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"47.266",height:"5.148",x:"91.532",y:"211.651",fill:"#E1E3E6",rx:"2.574"}),Object(r.createElement)("rect",{width:"62.8",height:"15",x:"83.882",y:"236.946",fill:"#E1E3E6",rx:"5"}),Object(r.createElement)("rect",{width:"65.374",height:"65.374",x:"164.788",y:".779",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"47.266",height:"5.148",x:"173.843",y:"76.153",fill:"#E1E3E6",rx:"2.574"}),Object(r.createElement)("rect",{width:"62.8",height:"15",x:"166.192",y:"101.448",fill:"#E1E3E6",rx:"5"}),Object(r.createElement)("rect",{width:"65.374",height:"65.374",x:"164.788",y:"136.277",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"47.266",height:"5.148",x:"173.843",y:"211.651",fill:"#E1E3E6",rx:"2.574"}),Object(r.createElement)("rect",{width:"62.8",height:"15",x:"166.192",y:"236.946",fill:"#E1E3E6",rx:"5"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"13.283",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"21.498",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"29.713",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"37.927",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"46.238",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"95.599",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"103.814",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"112.029",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"120.243",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"128.554",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"177.909",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"186.124",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"194.339",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"202.553",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"210.864",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"13.283",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"21.498",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"29.713",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"37.927",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"46.238",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"95.599",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"103.814",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"112.029",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"120.243",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"128.554",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"177.909",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"186.124",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"194.339",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"202.553",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"210.864",y:"221.798",fill:"#E1E3E6",rx:"3"}))},function(e,t,c){"use strict";var r=c(6),o=c.n(r),n=c(0),a=c(3),s=c(4),l=c.n(s);c(187),t.a=function(e){let{className:t="",...c}=e;const r=l()("wc-block-text-toolbar-button",t);return Object(n.createElement)(a.Button,o()({className:r},c))}},,,,,,,function(e,t){},function(e,t){},function(e,t){},function(e,t){},,,function(e,t){},,,,,,,,,,,,,,,,,,,,,,function(e,t,c){"use strict";c.d(t,"a",(function(){return g}));var r=c(0),o=c(4),n=c.n(o),a=c(22),s=c(55),l=c(45),i=c(105),u=c(82),d=c(99),b=c(112),p=c(88);c(253);const m=e=>{let{children:t,headingLevel:c,elementType:o="h"+c,...n}=e;return Object(r.createElement)(o,n,t)},g=e=>{const{className:t,headingLevel:c=2,showProductLink:o=!0,linkTarget:l,align:g}=e,{parentClassName:O}=Object(a.useInnerBlockLayoutContext)(),{product:j}=Object(a.useProductDataContext)(),{dispatchStoreEvent:h}=Object(u.a)(),_=Object(d.a)(e),E=Object(b.a)(e),f=Object(p.a)(e);return j.id?Object(r.createElement)(m,{headingLevel:c,className:n()(t,_.className,"wc-block-components-product-title",{[O+"__product-title"]:O,["wc-block-components-product-title--align-"+g]:g&&Object(s.b)()}),style:Object(s.b)()?{...E.style,...f.style,..._.style}:{}},Object(r.createElement)(i.a,{disabled:!o,name:j.name,permalink:j.permalink,target:l,onClick:()=>{h("product-view-link",{product:j})}})):Object(r.createElement)(m,{headingLevel:c,className:n()(t,_.className,"wc-block-components-product-title",{[O+"__product-title"]:O,["wc-block-components-product-title--align-"+g]:g&&Object(s.b)()}),style:Object(s.b)()?{...E.style,...f.style,..._.style}:{}})};t.b=Object(l.withProductDataContext)(g)},function(e,t,c){"use strict";var r=c(6),o=c.n(r),n=c(0),a=c(20),s=c(26),l=c(117),i=c(29);t.a=e=>t=>{let{selected:c,...r}=t;const[u,d]=Object(n.useState)(!0),[b,p]=Object(n.useState)(null),[m,g]=Object(n.useState)([]),O=a.o.productCount>100,j=async e=>{const t=await Object(i.a)(e);p(t),d(!1)},h=Object(n.useRef)(c);Object(n.useEffect)(()=>{Object(s.h)({selected:h.current}).then(e=>{g(e),d(!1)}).catch(j)},[h]);const _=Object(l.a)(e=>{Object(s.h)({selected:c,search:e}).then(e=>{g(e),d(!1)}).catch(j)},400),E=Object(n.useCallback)(e=>{d(!0),_(e)},[d,_]);return Object(n.createElement)(e,o()({},r,{selected:c,error:b,products:m,isLoading:u,onSearch:O?E:null}))}},function(e,t){},function(e,t,c){"use strict";c.d(t,"a",(function(){return _}));var r=c(6),o=c.n(r),n=c(0),a=c(1),s=c(4),l=c.n(s),i=c(2),u=c(22),d=c(88),b=c(132),p=c(112),m=c(45),g=c(82),O=c(141);c(255);const j=()=>Object(n.createElement)("img",{src:i.PLACEHOLDER_IMG_SRC,alt:"",width:void 0,height:void 0}),h=e=>{let{image:t,loaded:c,showFullSize:r,fallbackAlt:a}=e;const{thumbnail:s,src:l,srcset:i,sizes:u,alt:d}=t||{},b={alt:d||a,hidden:!c,src:s,...r&&{src:l,srcSet:i,sizes:u}};return Object(n.createElement)(n.Fragment,null,b.src&&Object(n.createElement)("img",o()({"data-testid":"product-image"},b)),!t&&Object(n.createElement)(j,null))},_=e=>{const{className:t,imageSizing:c="full-size",showProductLink:r=!0,showSaleBadge:o,saleBadgeAlign:s="right"}=e,{parentClassName:i}=Object(u.useInnerBlockLayoutContext)(),{product:m,isLoading:_}=Object(u.useProductDataContext)(),{dispatchStoreEvent:E}=Object(g.a)(),f=Object(d.a)(e),w=Object(b.a)(e),y=Object(p.a)(e);if(!m.id)return Object(n.createElement)("div",{className:l()(t,"wc-block-components-product-image",{[i+"__product-image"]:i},w.className),style:{...f.style,...w.style,...y.style}},Object(n.createElement)(j,null));const k=!!m.images.length,v=k?m.images[0]:null,S=r?"a":n.Fragment,C=Object(a.sprintf)( +/* translators: %s is referring to the product name */ +Object(a.__)("Link to %s","woo-gutenberg-products-block"),m.name),x={href:m.permalink,...!k&&{"aria-label":C},onClick:()=>{E("product-view-link",{product:m})}};return Object(n.createElement)("div",{className:l()(t,"wc-block-components-product-image",{[i+"__product-image"]:i},w.className),style:{...f.style,...w.style,...y.style}},Object(n.createElement)(S,r&&x,!!o&&Object(n.createElement)(O.default,{align:s,product:m}),Object(n.createElement)(h,{fallbackAlt:m.name,image:v,loaded:!_,showFullSize:"cropped"!==c})))};t.b=Object(m.withProductDataContext)(_)},,,,,,,,,,,,,,,function(e,t,c){"use strict";var r=c(0),o=c(4),n=c.n(o),a=c(1),s=c(42),l=c(351),i=c(7),u=c(10);const d={PRISTINE:"pristine",IDLE:"idle",DISABLED:"disabled",PROCESSING:"processing",BEFORE_PROCESSING:"before_processing",AFTER_PROCESSING:"after_processing"},b={status:d.PRISTINE,hasError:!1,quantity:0,processingResponse:null,requestParams:{}},p={SET_PRISTINE:"set_pristine",SET_IDLE:"set_idle",SET_DISABLED:"set_disabled",SET_PROCESSING:"set_processing",SET_BEFORE_PROCESSING:"set_before_processing",SET_AFTER_PROCESSING:"set_after_processing",SET_PROCESSING_RESPONSE:"set_processing_response",SET_HAS_ERROR:"set_has_error",SET_NO_ERROR:"set_no_error",SET_QUANTITY:"set_quantity",SET_REQUEST_PARAMS:"set_request_params"},{SET_PRISTINE:m,SET_IDLE:g,SET_DISABLED:O,SET_PROCESSING:j,SET_BEFORE_PROCESSING:h,SET_AFTER_PROCESSING:_,SET_PROCESSING_RESPONSE:E,SET_HAS_ERROR:f,SET_NO_ERROR:w,SET_QUANTITY:y,SET_REQUEST_PARAMS:k}=p,v=()=>({type:g}),S=function(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const t=e?f:w;return{type:t}},{SET_PRISTINE:C,SET_IDLE:x,SET_DISABLED:N,SET_PROCESSING:P,SET_BEFORE_PROCESSING:T,SET_AFTER_PROCESSING:I,SET_PROCESSING_RESPONSE:A,SET_HAS_ERROR:R,SET_NO_ERROR:B,SET_QUANTITY:L,SET_REQUEST_PARAMS:D}=p,{PRISTINE:F,IDLE:V,DISABLED:z,PROCESSING:M,BEFORE_PROCESSING:q,AFTER_PROCESSING:H}=d,G=function(){let e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:b,{quantity:c,type:r,data:o}=arguments.length>1?arguments[1]:void 0;switch(r){case C:e=b;break;case x:e=t.status!==V?{...t,status:V}:t;break;case N:e=t.status!==z?{...t,status:z}:t;break;case L:e=c!==t.quantity?{...t,quantity:c}:t;break;case D:e={...t,requestParams:{...t.requestParams,...o}};break;case A:e={...t,processingResponse:o};break;case P:e=t.status!==M?{...t,status:M,hasError:!1}:t,e=!1===e.hasError?e:{...e,hasError:!1};break;case T:e=t.status!==q?{...t,status:q,hasError:!1}:t;break;case I:e=t.status!==H?{...t,status:H}:t;break;case R:e=t.hasError?t:{...t,hasError:!0},e=t.status===M||t.status===q?{...e,status:V}:e;break;case B:e=t.hasError?{...t,hasError:!1}:t}return e!==t&&r!==C&&e.status===F&&(e.status=V),e};var Q=c(97),Y=c(259);const U=e=>({onAddToCartAfterProcessingWithSuccess:Object(Y.a)("add_to_cart_after_processing_with_success",e),onAddToCartProcessingWithError:Object(Y.a)("add_to_cart_after_processing_with_error",e),onAddToCartBeforeProcessing:Object(Y.a)("add_to_cart_before_processing",e)});var W=c(309),K=c(60);const $=Object(r.createContext)({product:{},productType:"simple",productIsPurchasable:!0,productHasOptions:!1,supportsFormElements:!0,showFormElements:!1,quantity:0,minQuantity:1,maxQuantity:99,requestParams:{},isIdle:!1,isDisabled:!1,isProcessing:!1,isBeforeProcessing:!1,isAfterProcessing:!1,hasError:!1,eventRegistration:{onAddToCartAfterProcessingWithSuccess:e=>{},onAddToCartAfterProcessingWithError:e=>{},onAddToCartBeforeProcessing:e=>{}},dispatchActions:{resetForm:()=>{},submitForm:()=>{},setQuantity:e=>{},setHasError:e=>{},setAfterProcessing:e=>{},setRequestParams:e=>{}}}),J=()=>Object(r.useContext)($),X=e=>{var t,c,o,n;let{children:p,product:g,showFormElements:f}=e;const[w,C]=Object(r.useReducer)(G,b),[x,N]=Object(r.useReducer)(Q.b,{}),P=Object(s.a)(x),{createErrorNotice:T}=Object(i.useDispatch)("core/notices"),{setValidationErrors:I}=Object(i.useDispatch)(u.VALIDATION_STORE_KEY),A=Object(r.useMemo)(()=>({onAddToCartAfterProcessingWithSuccess:U(N).onAddToCartAfterProcessingWithSuccess,onAddToCartAfterProcessingWithError:U(N).onAddToCartAfterProcessingWithError,onAddToCartBeforeProcessing:U(N).onAddToCartBeforeProcessing}),[N]),R=Object(r.useMemo)(()=>({resetForm:()=>{C({type:m})},submitForm:()=>{C({type:h})},setQuantity:e=>{C((e=>({type:y,quantity:e}))(e))},setHasError:e=>{C(S(e))},setRequestParams:e=>{C((e=>({type:k,data:e}))(e))},setAfterProcessing:e=>{C({type:E,data:e}),C({type:_})}}),[]);Object(r.useEffect)(()=>{const e=w.status,t=!g.id||!Object(l.a)(g);e!==d.DISABLED||t?e!==d.DISABLED&&t&&C({type:O}):C(v())},[w.status,g,C]),Object(r.useEffect)(()=>{w.status===d.BEFORE_PROCESSING&&(((e,t)=>{const c=Object(i.select)("core/notices").getNotices("wc/add-to-cart"),{removeNotice:r}=Object(i.dispatch)("core/notices");c.filter(e=>"error"===e.status).forEach(e=>r(e.id,"wc/add-to-cart"))})(),Object(W.a)(P,"add_to_cart_before_processing",{}).then(e=>{!0!==e?(Array.isArray(e)&&e.forEach(e=>{let{errorMessage:t,validationErrors:c}=e;t&&T(t,{context:"wc/add-to-cart"}),c&&I(c)}),C(v())):C({type:j})}))},[w.status,I,T,C,P,null==g?void 0:g.id]),Object(r.useEffect)(()=>{if(w.status===d.AFTER_PROCESSING){const e={processingResponse:w.processingResponse},t=e=>{let t=!1;return e.forEach(e=>{const{message:c,messageContext:r}=e;(Object(K.b)(e)||Object(K.c)(e))&&c&&(t=!0,T(c,r?{context:r}:void 0))}),t};if(w.hasError)return void Object(W.b)(P,"add_to_cart_after_processing_with_error",e).then(c=>{if(!t(c)){var r;const t=(null===(r=e.processingResponse)||void 0===r?void 0:r.message)||Object(a.__)("Something went wrong. Please contact us for assistance.","woo-gutenberg-products-block");T(t,{id:"add-to-cart",context:"woocommerce/single-product/"+((null==g?void 0:g.id)||0)})}C(v())});Object(W.b)(P,"add_to_cart_after_processing_with_success",e).then(e=>{t(e)?C(S(!0)):C(v())})}},[w.status,w.hasError,w.processingResponse,R,T,P,null==g?void 0:g.id]);const B=Object(l.b)(g),L={product:g,productType:g.type||"simple",productIsPurchasable:Object(l.a)(g),productHasOptions:g.has_options||!1,supportsFormElements:B,showFormElements:f&&B,quantity:w.quantity||(null==g||null===(t=g.add_to_cart)||void 0===t?void 0:t.minimum)||1,minQuantity:(null==g||null===(c=g.add_to_cart)||void 0===c?void 0:c.minimum)||1,maxQuantity:(null==g||null===(o=g.add_to_cart)||void 0===o?void 0:o.maximum)||99,multipleOf:(null==g||null===(n=g.add_to_cart)||void 0===n?void 0:n.multiple_of)||1,requestParams:w.requestParams,isIdle:w.status===d.IDLE,isDisabled:w.status===d.DISABLED,isProcessing:w.status===d.PROCESSING,isBeforeProcessing:w.status===d.BEFORE_PROCESSING,isAfterProcessing:w.status===d.AFTER_PROCESSING,hasError:w.hasError,eventRegistration:A,dispatchActions:R};return Object(r.createElement)($.Provider,{value:L},p)};var Z=c(15),ee=c.n(Z),te=c(18),ce=c(250),re=c(43),oe=()=>{const{dispatchActions:e,product:t,quantity:c,eventRegistration:o,hasError:n,isProcessing:s,requestParams:l}=J(),{showAllValidationErrors:d}=Object(i.useDispatch)(u.VALIDATION_STORE_KEY),b=Object(i.useSelect)(e=>e(u.VALIDATION_STORE_KEY).hasValidationErrors),{createErrorNotice:p,removeNotice:m}=Object(i.useDispatch)("core/notices"),{receiveCart:g}=Object(re.a)(),[O,j]=Object(r.useState)(!1),h=!n&&s,_=Object(r.useCallback)(()=>!b()||(d(),{type:"error"}),[b,d]);Object(r.useEffect)(()=>{const e=o.onAddToCartBeforeProcessing(_,0);return()=>{e()}},[o,_]);const E=Object(r.useCallback)(()=>{j(!0),m("add-to-cart","woocommerce/single-product/"+((null==t?void 0:t.id)||0));const r={id:t.id||0,quantity:c,...l};ee()({path:"/wc/store/v1/cart/add-item",method:"POST",data:r,cache:"no-store",parse:!1}).then(c=>{ee.a.setNonce(c.headers),c.json().then((function(r){c.ok?g(r):(r.body&&r.body.message?p(Object(te.decodeEntities)(r.body.message),{id:"add-to-cart",context:"woocommerce/single-product/"+((null==t?void 0:t.id)||0)}):p(Object(a.__)("Something went wrong. Please contact us for assistance.","woo-gutenberg-products-block"),{id:"add-to-cart",context:"woocommerce/single-product/"+((null==t?void 0:t.id)||0)}),e.setHasError()),Object(ce.b)({preserveCartData:!0}),e.setAfterProcessing(r),j(!1)}))}).catch(t=>{t.json().then((function(t){var c;null!==(c=t.data)&&void 0!==c&&c.cart&&g(t.data.cart),e.setHasError(),e.setAfterProcessing(t),j(!1)}))})},[t,p,m,g,e,c,l]);return Object(r.useEffect)(()=>{h&&!O&&E()},[h,E,O]),null};const ne=e=>{let{children:t,product:c,showFormElements:o}=e;return Object(r.createElement)(X,{product:c,showFormElements:o},t,Object(r.createElement)(oe,null))};var ae=c(22),se=c(8),le=c(45),ie=(c(229),c(58)),ue=c(80),de=c(544),be=c(82),pe=c(261);const me=e=>{let{className:t,href:c,text:o,onClick:n}=e;return Object(r.createElement)(ie.a,{className:t,href:c,onClick:n,rel:"nofollow"},o)},ge=e=>{let{className:t,quantityInCart:c,isProcessing:o,isDisabled:n,isDone:s,onClick:l}=e;return Object(r.createElement)(ie.a,{className:t,disabled:n,showSpinner:o,onClick:l},s&&c>0?Object(a.sprintf)( +/* translators: %s number of products in cart. */ +Object(a._n)("%d in cart","%d in cart",c,"woo-gutenberg-products-block"),c):Object(a.__)("Add to cart","woo-gutenberg-products-block"),!!s&&Object(r.createElement)(ue.a,{icon:de.a}))};var Oe=()=>{const{showFormElements:e,productIsPurchasable:t,productHasOptions:c,product:o,productType:n,isDisabled:s,isProcessing:l,eventRegistration:i,hasError:u,dispatchActions:d}=J(),{parentName:b}=Object(ae.useInnerBlockLayoutContext)(),{dispatchStoreEvent:p}=Object(be.a)(),{cartQuantity:m}=Object(pe.a)(o.id||0),[g,O]=Object(r.useState)(!1),j=o.add_to_cart||{url:"",text:""};return Object(r.useEffect)(()=>{const e=i.onAddToCartAfterProcessingWithSuccess(()=>(u||O(!0),!0),0);return()=>{e()}},[i,u]),(e||!c&&"simple"===n)&&t?Object(r.createElement)(ge,{className:"wc-block-components-product-add-to-cart-button",quantityInCart:m,isDisabled:s,isProcessing:l,isDone:g,onClick:()=>{d.submitForm("woocommerce/single-product/"+((null==o?void 0:o.id)||0)),p("cart-add-item",{product:o,listName:b})}}):Object(r.createElement)(me,{className:"wc-block-components-product-add-to-cart-button",href:j.url,text:j.text||Object(a.__)("View Product","woo-gutenberg-products-block"),onClick:()=>{p("product-view-link",{product:o,listName:b})}})},je=c(117),he=e=>{let{disabled:t,min:c,max:o,step:n=1,value:a,onChange:s}=e;const l=void 0!==o,i=Object(je.a)(e=>{let t=e;l&&(t=Math.min(t,Math.floor(o/n)*n)),t=Math.max(t,Math.ceil(c/n)*n),t=Math.floor(t/n)*n,t!==e&&(null==s||s(t))},300);return Object(r.createElement)("input",{className:"wc-block-components-product-add-to-cart-quantity",type:"number",value:a,min:c,max:o,step:n,hidden:1===o,disabled:t,onChange:e=>{null==s||s(e.target.value),i(Number(e.target.value))}})},_e=e=>{let{reason:t=Object(a.__)("Sorry, this product cannot be purchased.","woo-gutenberg-products-block")}=e;return Object(r.createElement)("div",{className:"wc-block-components-product-add-to-cart-unavailable"},t)},Ee=()=>{const{product:e,quantity:t,minQuantity:c,maxQuantity:o,multipleOf:n,dispatchActions:s,isDisabled:l}=J();return e.id&&!e.is_purchasable?Object(r.createElement)(_e,null):e.id&&!e.is_in_stock?Object(r.createElement)(_e,{reason:Object(a.__)("This product is currently out of stock and cannot be purchased.","woo-gutenberg-products-block")}):Object(r.createElement)(r.Fragment,null,Object(r.createElement)(he,{value:t,min:c,max:o,step:n,disabled:l,onChange:s.setQuantity}),Object(r.createElement)(Oe,null))},fe=(c(258),c(573)),we=c(13),ye=c(14);const ke={value:"",label:Object(a.__)("Select an option","woo-gutenberg-products-block")};var ve=e=>{let{attributeName:t,options:c=[],value:o="",onChange:s=(()=>{}),errorMessage:l=Object(a.__)("Please select a value.","woo-gutenberg-products-block")}=e;const d=t,{setValidationErrors:b,clearValidationError:p}=Object(i.useDispatch)(u.VALIDATION_STORE_KEY),{error:m}=Object(i.useSelect)(e=>({error:e(u.VALIDATION_STORE_KEY).getValidationError(d)||{}}));return Object(we.useEffect)(()=>{o?p(d):b({[d]:{message:l,hidden:!0}})},[o,d,l,p,b]),Object(we.useEffect)(()=>()=>{p(d)},[d,p]),Object(r.createElement)("div",{className:"wc-block-components-product-add-to-cart-attribute-picker__container"},Object(r.createElement)(fe.a,{label:Object(te.decodeEntities)(t),value:o||"",options:[ke,...c],onChange:s,required:!0,className:n()("wc-block-components-product-add-to-cart-attribute-picker__select",{"has-error":(null==m?void 0:m.message)&&!(null!=m&&m.hidden)})}),Object(r.createElement)(ye.ValidationInputError,{propertyName:d,elementId:d}))},Se=c(32);const Ce=(e,t,c)=>{const r=Object.values(t).map(e=>{let{id:t}=e;return t});if(Object.values(c).every(e=>""===e))return r;const o=Object.keys(e);return r.filter(e=>o.every(r=>{const o=c[r]||"",n=t["id:"+e].attributes[r];return""===o||null===n||n===o}))};var xe=e=>{let{attributes:t,variationAttributes:c,setRequestParams:o}=e;const n=Object(s.a)(t),a=Object(s.a)(c),[l,i]=Object(r.useState)(0),[u,d]=Object(r.useState)({}),[b,p]=Object(r.useState)(!1),m=Object(r.useMemo)(()=>((e,t,c)=>{const r={},o=Object.keys(e),n=Object.values(c).filter(Boolean).length>0;return o.forEach(o=>{const a=e[o],s={...c,[o]:null},l=n?Ce(e,t,s):null,i=null!==l?l.map(e=>t["id:"+e].attributes[o]):null;r[o]=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return Object.values(e).map(e=>{let{name:c,slug:r}=e;return null===t||t.includes(null)||t.includes(r)?{value:r,label:Object(te.decodeEntities)(c)}:null}).filter(Boolean)}(a.terms,i)}),r})(n,a,u),[u,n,a]);return Object(r.useEffect)(()=>{if(!b){const e=(e=>Object(Se.b)(e)?0===Object.keys(e).length?{}:Object.values(e).reduce((e,t)=>{const c=t.terms.filter(e=>e.default);var r;return c.length>0&&(e[t.name]=null===(r=c[0])||void 0===r?void 0:r.slug),e},{}):{})(t);e&&d({...e}),p(!0)}},[u,t,b]),Object(r.useEffect)(()=>{Object.values(u).filter(e=>""!==e).length===Object.keys(n).length?i(((e,t,c)=>Ce(e,t,c)[0]||0)(n,a,u)):l>0&&i(0)},[u,l,n,a]),Object(r.useEffect)(()=>{o({id:l,variation:Object.keys(u).map(e=>({attribute:e,value:u[e]}))})},[o,l,u]),Object(r.createElement)("div",{className:"wc-block-components-product-add-to-cart-attribute-picker"},Object.keys(n).map(e=>Object(r.createElement)(ve,{key:e,attributeName:e,options:m[e].filter(Boolean),value:u[e],onChange:t=>{d({...u,[e]:t})}})))},Ne=e=>{let{dispatchers:t,product:c}=e;const o=(e=>e?Object(se.keyBy)(Object.values(e).filter(e=>{let{has_variations:t}=e;return t}),"name"):{})(c.attributes),n=(e=>{if(!e)return{};const t={};return e.forEach(e=>{let{id:c,attributes:r}=e;t["id:"+c]={id:c,attributes:r.reduce((e,t)=>{let{name:c,value:r}=t;return e[c]=r,e},{})}}),t})(c.variations);return 0===Object.keys(o).length||0===Object.keys(n).length?null:Object(r.createElement)(xe,{attributes:o,variationAttributes:n,setRequestParams:t.setRequestParams})},Pe=()=>{const{product:e,quantity:t,minQuantity:c,maxQuantity:o,multipleOf:n,dispatchActions:s,isDisabled:l}=J();return e.id&&!e.is_purchasable?Object(r.createElement)(_e,null):e.id&&!e.is_in_stock?Object(r.createElement)(_e,{reason:Object(a.__)("This product is currently out of stock and cannot be purchased.","woo-gutenberg-products-block")}):Object(r.createElement)(r.Fragment,null,Object(r.createElement)(Ne,{product:e,dispatchers:s}),Object(r.createElement)(he,{value:t,min:c,max:o,step:n,disabled:l,onChange:s.setQuantity}),Object(r.createElement)(Oe,null))},Te=()=>Object(r.createElement)(Oe,null),Ie=c(546),Ae=()=>Object(r.createElement)(Ie.a,{className:"wc-block-components-product-add-to-cart-group-list"},"This is a placeholder for the grouped products form element."),Re=()=>Object(r.createElement)(Ae,null);const Be=()=>{const{showFormElements:e,productType:t}=J();return e?"variable"===t?Object(r.createElement)(Pe,null):"grouped"===t?Object(r.createElement)(Re,null):"external"===t?Object(r.createElement)(Te,null):"simple"===t||"variation"===t?Object(r.createElement)(Ee,null):null:Object(r.createElement)(Oe,null)};t.a=Object(le.withProductDataContext)(e=>{let{className:t,showFormElements:c}=e;const{product:o}=Object(ae.useProductDataContext)(),a=n()(t,"wc-block-components-product-add-to-cart",{"wc-block-components-product-add-to-cart--placeholder":Object(se.isEmpty)(o)});return Object(r.createElement)(ne,{product:o,showFormElements:c},Object(r.createElement)("div",{className:a},Object(r.createElement)(Be,null)))})},function(e,t,c){"use strict";c.r(t),c.d(t,"Block",(function(){return p}));var r=c(0),o=c(4),n=c.n(o),a=c(78),s=c(24),l=c(22),i=c(99),u=c(112),d=c(88),b=c(45);c(254);const p=e=>{var t,c;const{className:o,textAlign:b}=e,{parentClassName:p}=Object(l.useInnerBlockLayoutContext)(),{product:m}=Object(l.useProductDataContext)(),g=Object(i.a)(e),O=Object(u.a)(e),j=Object(d.a)(e),h=n()("wc-block-components-product-price",o,g.className,{[p+"__product-price"]:p});if(!m.id)return Object(r.createElement)(a.a,{align:b,className:h});const _={...g.style,...j.style},E={...O.style},f=m.prices,w=Object(s.getCurrencyFromPriceResponse)(f),y=f.price!==f.regular_price,k=n()({[p+"__product-price__value"]:p,[p+"__product-price__value--on-sale"]:y});return Object(r.createElement)(a.a,{align:b,className:h,regularPriceStyle:_,priceStyle:_,priceClassName:k,currency:w,price:f.price,minPrice:null==f||null===(t=f.price_range)||void 0===t?void 0:t.min_amount,maxPrice:null==f||null===(c=f.price_range)||void 0===c?void 0:c.max_amount,regularPrice:f.regular_price,regularPriceClassName:n()({[p+"__product-price__regular"]:p}),spacingStyle:E})};t.default=Object(b.withProductDataContext)(p)},function(e,t,c){"use strict";c.r(t),c.d(t,"Block",(function(){return g}));var r=c(0),o=c(1),n=c(4),a=c.n(n),s=c(22),l=c(99),i=c(88),u=c(112),d=c(45),b=c(145);c(256);const p=e=>{const{rating:t,reviews:c,parentClassName:n}=e,s={width:t/5*100+"%"},l=Object(o.sprintf)( +/* translators: %f is referring to the average rating value */ +Object(o.__)("Rated %f out of 5","woo-gutenberg-products-block"),t),i={__html:Object(o.sprintf)( +/* translators: %1$s is referring to the average rating value, %2$s is referring to the number of ratings */ +Object(o._n)("Rated %1$s out of 5 based on %2$s customer rating","Rated %1$s out of 5 based on %2$s customer ratings",c,"woo-gutenberg-products-block"),Object(o.sprintf)('%f',t),Object(o.sprintf)('%d',c))};return Object(r.createElement)("div",{className:a()("wc-block-components-product-rating__stars",n+"__product-rating__stars"),role:"img","aria-label":l},Object(r.createElement)("span",{style:s,dangerouslySetInnerHTML:i}))},m=e=>{const{href:t}=e,c=Object(o.__)("Add review","woo-gutenberg-products-block");return t?Object(r.createElement)("a",{className:"wc-block-components-product-rating__link",href:t},c):null},g=e=>{const{textAlign:t}=e,{parentClassName:c}=Object(s.useInnerBlockLayoutContext)(),{product:o}=Object(s.useProductDataContext)(),n=(e=>{const t=parseFloat(e.average_rating);return Number.isFinite(t)&&t>0?t:0})(o),d=Object(l.a)(e),g=Object(i.a)(e),O=Object(u.a)(e),j=(e=>{const t=Object(b.a)(e.review_count)?e.review_count:parseInt(e.review_count,10);return Number.isFinite(t)&&t>0?t:0})(o),h=(e=>{const{permalink:t}=e;return t+"#reviews"})(o),_=a()(d.className,"wc-block-components-product-rating",{[c+"__product-rating"]:c,["has-text-align-"+t]:t}),E=j?Object(r.createElement)(p,{rating:n,reviews:j,parentClassName:c}):Object(r.createElement)(m,{href:h});return Object(r.createElement)("div",{className:_,style:{...d.style,...g.style,...O.style}},E)};t.default=Object(d.withProductDataContext)(g)},function(e,t,c){"use strict";c.r(t),c.d(t,"Block",(function(){return w}));var r=c(6),o=c.n(r),n=c(0),a=c(4),s=c.n(a),l=c(1),i=c(82),u=c(261),d=c(99),b=c(132),p=c(88),m=c(112),g=c(18),O=c(20),j=c(2),h=c(22),_=c(45);c(257);const E=e=>{let{product:t,colorStyles:c,borderStyles:r,typographyStyles:a,spacingStyles:d,textAlign:b}=e;const{id:p,permalink:m,add_to_cart:h,has_options:_,is_purchasable:E,is_in_stock:f}=t,{dispatchStoreEvent:w}=Object(i.a)(),{cartQuantity:y,addingToCart:k,addToCart:v}=Object(u.a)(p),S=Number.isFinite(y)&&y>0,C=!_&&E&&f,x=Object(g.decodeEntities)((null==h?void 0:h.description)||""),N=S?Object(l.sprintf)( +/* translators: %s number of products in cart. */ +Object(l._n)("%d in cart","%d in cart",y,"woo-gutenberg-products-block"),y):Object(g.decodeEntities)((null==h?void 0:h.text)||Object(l.__)("Add to cart","woo-gutenberg-products-block")),P=C?"button":"a",T={};return C?T.onClick=async()=>{await v(),w("cart-add-item",{product:t});const{cartRedirectAfterAdd:e}=Object(j.getSetting)("productsSettings");e&&(window.location.href=O.d)}:(T.href=m,T.rel="nofollow",T.onClick=()=>{w("product-view-link",{product:t})}),Object(n.createElement)(P,o()({"aria-label":x,className:s()("wp-block-button__link","wp-element-button","add_to_cart_button","wc-block-components-product-button__button",c.className,r.className,{loading:k,added:S},{["has-text-align-"+b]:b}),style:{...c.style,...r.style,...a.style,...d.style},disabled:k},T),N)},f=e=>{let{colorStyles:t,borderStyles:c,typographyStyles:r,spacingStyles:o}=e;return Object(n.createElement)("button",{className:s()("wp-block-button__link","wp-element-button","add_to_cart_button","wc-block-components-product-button__button","wc-block-components-product-button__button--placeholder",t.className,c.className),style:{...t.style,...c.style,...r.style,...o.style},disabled:!0})},w=e=>{const{className:t,textAlign:c}=e,{parentClassName:r}=Object(h.useInnerBlockLayoutContext)(),{product:o}=Object(h.useProductDataContext)(),a=Object(d.a)(e),l=Object(b.a)(e),i=Object(p.a)(e),u=Object(m.a)(e);return Object(n.createElement)("div",{className:s()(t,"wp-block-button","wc-block-components-product-button",{[r+"__product-add-to-cart"]:r},{["has-text-align-"+c]:c})},o.id?Object(n.createElement)(E,{product:o,colorStyles:a,borderStyles:l,typographyStyles:i,spacingStyles:u}):Object(n.createElement)(f,{colorStyles:a,borderStyles:l,typographyStyles:i,spacingStyles:u}))};t.default=Object(_.withProductDataContext)(w)},,,function(e){e.exports=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":1,"textdomain":"woo-gutenberg-products-block","name":"woocommerce/all-products","title":"All Products","category":"woocommerce","keywords":["WooCommerce"],"description":"Display products from your store in a grid layout.","supports":{"align":["wide","full"],"html":false,"multiple":false},"attributes":{"columns":{"type":"number"},"rows":{"type":"number"},"alignButtons":{"type":"boolean"},"contentVisibility":{"type":"object"},"orderby":{"type":"string"},"layoutConfig":{"type":"array"},"isPreview":{"type":"boolean","default":false}}}')},,,,,,,,,,,,,,,,,,,,function(e,t){},,,,,,,,,,,,,,,,,,function(e){e.exports=JSON.parse('{"name":"woocommerce/product-image-gallery","version":"1.0.0","title":"Product Image Gallery","icon":"gallery","description":"Display a product\'s images.","category":"woocommerce","supports":{"align":true,"reusable":false},"keywords":["WooCommerce"],"usesContext":["postId","postType","queryId"],"textdomain":"woo-gutenberg-products-block","apiVersion":2,"$schema":"https://schemas.wp.org/trunk/block.json"}')},,,function(e,t,c){"use strict";c.d(t,"b",(function(){return n})),c.d(t,"a",(function(){return a}));const r=window.CustomEvent||null,o=(e,t)=>{let{bubbles:c=!1,cancelable:o=!1,element:n,detail:a={}}=t;if(!r)return;n||(n=document.body);const s=new r(e,{bubbles:c,cancelable:o,detail:a});n.dispatchEvent(s)},n=e=>{let{preserveCartData:t=!1}=e;o("wc-blocks_added_to_cart",{bubbles:!0,cancelable:!0,detail:{preserveCartData:t}})},a=function(e,t){let c=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if("function"!=typeof jQuery)return()=>{};const n=()=>{o(t,{bubbles:c,cancelable:r})};return jQuery(document).on(e,n),()=>jQuery(document).off(e,n)}},function(e,t,c){"use strict";c.d(t,"a",(function(){return n}));var r=c(92),o=(c(17),c(2));const n=e=>{const t=Object.keys(o.defaultAddressFields),c=Object(r.a)(t,{},e.country),n=Object.assign({},e);return c.forEach(t=>{let{key:c="",hidden:r=!1}=t;r&&((e,t)=>e in t)(c,e)&&(n[c]="")}),n}},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t,c){"use strict";c.d(t,"a",(function(){return o}));var r=c(97);const o=(e,t)=>function(c){let o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;const n=r.a.addEventCallback(e,c,o);return t(n),()=>{t(r.a.removeEventCallback(e,n.id))}}},,function(e,t,c){"use strict";c.d(t,"a",(function(){return i}));var r=c(0),o=c(7),n=c(10),a=c(18),s=c(43);const l=(e,t)=>{const c=e.find(e=>{let{id:c}=e;return c===t});return c?c.quantity:0},i=e=>{const{addItemToCart:t}=Object(o.useDispatch)(n.CART_STORE_KEY),{cartItems:c,cartIsLoading:i}=Object(s.a)(),{createErrorNotice:u,removeNotice:d}=Object(o.useDispatch)("core/notices"),[b,p]=Object(r.useState)(!1),m=Object(r.useRef)(l(c,e));return Object(r.useEffect)(()=>{const t=l(c,e);t!==m.current&&(m.current=t)},[c,e]),{cartQuantity:Number.isFinite(m.current)?m.current:0,addingToCart:b,cartIsLoading:i,addToCart:function(){let c=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return p(!0),t(e,c).then(()=>{d("add-to-cart")}).catch(e=>{u(Object(a.decodeEntities)(e.message),{id:"add-to-cart",context:"wc/all-products",isDismissible:!0})}).finally(()=>{p(!1)})}}}},function(e,t,c){"use strict";var r=c(0),o=c(11);const n=Object(r.createElement)(o.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(r.createElement)("path",{fill:"none",d:"M0 0h24v24H0V0z"}),Object(r.createElement)("path",{d:"M15.55 13c.75 0 1.41-.41 1.75-1.03l3.58-6.49c.37-.66-.11-1.48-.87-1.48H5.21l-.94-2H1v2h2l3.6 7.59-1.35 2.44C4.52 15.37 5.48 17 7 17h12v-2H7l1.1-2h7.45zM6.16 6h12.15l-2.76 5H8.53L6.16 6zM7 18c-1.1 0-1.99.9-1.99 2S5.9 22 7 22s2-.9 2-2-.9-2-2-2zm10 0c-1.1 0-1.99.9-1.99 2s.89 2 1.99 2 2-.9 2-2-.9-2-2-2z"}));t.a=n},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t,c){"use strict";var r=c(55);let o={headingLevel:{type:"number",default:2},showProductLink:{type:"boolean",default:!0},linkTarget:{type:"string"},productId:{type:"number",default:0}};Object(r.b)()&&(o={...o,align:{type:"string"}}),t.a=o},function(e,t,c){"use strict";t.a={showProductLink:{type:"boolean",default:!0},showSaleBadge:{type:"boolean",default:!0},saleBadgeAlign:{type:"string",default:"right"},imageSizing:{type:"string",default:"full-size"},productId:{type:"number",default:0},isDescendentOfQueryLoop:{type:"boolean",default:!1}}},function(e,t,c){"use strict";t.a={showFormElements:{type:"boolean",default:!1},productId:{type:"number",default:0}}},function(e,t,c){"use strict";c.d(t,"a",(function(){return a})),c.d(t,"b",(function(){return s}));var r=c(60),o=c(32);const n=e=>Object(o.b)(e)&&Object(o.c)(e,"type"),a=async(e,t,c)=>{const o=Object(r.a)(e,t),n=[];for(const e of o)try{const t=await Promise.resolve(e.callback(c));"object"==typeof t&&n.push(t)}catch(e){console.error(e)}return!n.length||n},s=async(e,t,c)=>{const o=[],a=Object(r.a)(e,t);for(const e of a)try{const t=await Promise.resolve(e.callback(c));if(!n(t))continue;if(!t.hasOwnProperty("type"))throw new Error("Returned objects from event emitter observers must return an object with a type property");if(Object(r.b)(t)||Object(r.c)(t))return o.push(t),o;o.push(t)}catch(e){return console.error(e),o.push({type:r.e.ERROR}),o}return o}},,,,,function(e,t,c){"use strict";c.r(t);var r=c(0),o=c(4),n=c.n(o),a=c(119),s=c(20),l=c(22),i=c(99),u=c(88),d=c(45);c(346),t.default=Object(d.withProductDataContext)(e=>{const{className:t}=e,{parentClassName:c}=Object(l.useInnerBlockLayoutContext)(),{product:o}=Object(l.useProductDataContext)(),d=Object(i.a)(e),b=Object(u.a)(e);if(!o)return Object(r.createElement)("div",{className:n()(t,"wc-block-components-product-summary",{[c+"__product-summary"]:c})});const p=o.short_description?o.short_description:o.description;return p?Object(r.createElement)(a.a,{className:n()(t,d.className,"wc-block-components-product-summary",{[c+"__product-summary"]:c}),source:p,maxLength:150,countType:s.o.wordCountType||"words",style:{...d.style,...b.style}}):null})},function(e,t,c){"use strict";c.r(t);var r=c(0),o=c(1),n=c(4),a=c.n(n),s=c(22),l=c(45);c(347),t.default=Object(l.withProductDataContext)(e=>{const{className:t}=e,{parentClassName:c}=Object(s.useInnerBlockLayoutContext)(),{product:n}=Object(s.useProductDataContext)(),l=n.sku;return l?Object(r.createElement)("div",{className:a()(t,"wc-block-components-product-sku",{[c+"__product-sku"]:c})},Object(o.__)("SKU:","woo-gutenberg-products-block")," ",Object(r.createElement)("strong",null,l)):null})},function(e,t,c){"use strict";c.r(t);var r=c(0),o=c(1),n=c(4),a=c.n(n),s=c(22),l=c(99),i=c(88),u=c(8),d=c(45);c(348),t.default=Object(d.withProductDataContext)(e=>{const{className:t}=e,{parentClassName:c}=Object(s.useInnerBlockLayoutContext)(),{product:n}=Object(s.useProductDataContext)(),d=Object(l.a)(e),b=Object(i.a)(e);return Object(u.isEmpty)(n.categories)?null:Object(r.createElement)("div",{className:a()(t,"wc-block-components-product-category-list",d.className,{[c+"__product-category-list"]:c}),style:{...d.style,...b.style}},Object(o.__)("Categories:","woo-gutenberg-products-block")," ",Object(r.createElement)("ul",null,Object.values(n.categories).map(e=>{let{name:t,link:c,slug:o}=e;return Object(r.createElement)("li",{key:"category-list-item-"+o},Object(r.createElement)("a",{href:c},t))})))})},function(e,t,c){"use strict";c.r(t);var r=c(0),o=c(1),n=c(4),a=c.n(n),s=c(22),l=c(99),i=c(88),u=c(8),d=c(45);c(349),t.default=Object(d.withProductDataContext)(e=>{const{className:t}=e,{parentClassName:c}=Object(s.useInnerBlockLayoutContext)(),{product:n}=Object(s.useProductDataContext)(),d=Object(l.a)(e),b=Object(i.a)(e);return Object(u.isEmpty)(n.tags)?null:Object(r.createElement)("div",{className:a()(t,d.className,"wc-block-components-product-tag-list",{[c+"__product-tag-list"]:c}),style:{...d.style,...b.style}},Object(o.__)("Tags:","woo-gutenberg-products-block")," ",Object(r.createElement)("ul",null,Object.values(n.tags).map(e=>{let{name:t,link:c,slug:o}=e;return Object(r.createElement)("li",{key:"tag-list-item-"+o},Object(r.createElement)("a",{href:c},t))})))})},function(e,t,c){"use strict";c.r(t),c.d(t,"Block",(function(){return d}));var r=c(0),o=c(1),n=c(4),a=c.n(n),s=c(22),l=c(99),i=c(88),u=c(45);c(350);const d=e=>{const{className:t}=e,{parentClassName:c}=Object(s.useInnerBlockLayoutContext)(),{product:n}=Object(s.useProductDataContext)(),u=Object(l.a)(e),d=Object(i.a)(e);if(!n.id||!n.is_purchasable)return null;const b=!!n.is_in_stock,p=n.low_stock_remaining,m=n.is_on_backorder;return Object(r.createElement)("div",{className:a()(t,u.className,"wc-block-components-product-stock-indicator",{[c+"__stock-indicator"]:c,"wc-block-components-product-stock-indicator--in-stock":b,"wc-block-components-product-stock-indicator--out-of-stock":!b,"wc-block-components-product-stock-indicator--low-stock":!!p,"wc-block-components-product-stock-indicator--available-on-backorder":!!m}),style:{...u.style,...d.style}},p?(e=>Object(o.sprintf)( +/* translators: %d stock amount (number of items in stock for product) */ +Object(o.__)("%d left in stock","woo-gutenberg-products-block"),e))(p):((e,t)=>t?Object(o.__)("Available on backorder","woo-gutenberg-products-block"):e?Object(o.__)("In Stock","woo-gutenberg-products-block"):Object(o.__)("Out of Stock","woo-gutenberg-products-block"))(b,m))};t.default=Object(u.withProductDataContext)(d)},,,,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t,c){"use strict";c.d(t,"a",(function(){return r})),c.d(t,"b",(function(){return o}));const r=e=>e.is_purchasable||!1,o=e=>["simple","variable"].includes(e.type||"simple")},,,,,,,,,,,,,,,function(e,t,c){e.exports=c(484)},function(e,t){},function(e,t){},function(e,t){},function(e,t){},,,function(e,t){},function(e,t){},function(e,t,c){"use strict";c.d(t,"a",(function(){return n}));var r=c(1),o=c(20);const n=[{id:1,name:"WordPress Pennant",variation:"",permalink:"https://example.org",sku:"wp-pennant",short_description:Object(r.__)("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!","woo-gutenberg-products-block"),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:'$7.99',images:[{id:1,src:o.m+"previews/pennant.jpg",thumbnail:o.m+"previews/pennant.jpg",name:"pennant-1.jpg",alt:"WordPress Pennant",srcset:"",sizes:""}],average_rating:5,categories:[{id:1,name:"Decor",slug:"decor",link:"https://example.org"}],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(r.__)("Add to cart","woo-gutenberg-products-block"),description:Object(r.__)("Add to cart","woo-gutenberg-products-block")},has_options:!1,is_purchasable:!0,is_in_stock:!0,on_sale:!0}]},function(e,t){},function(e,t){},function(e,t){},function(e,t){},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t,c){"use strict";c.r(t),c.d(t,"metadata",(function(){return Ot})),c.d(t,"name",(function(){return oc}));var r=c(0),o=c(9),n=c(80),a=c(533),s=c(55),l=c(5),i=c(1),u=c(4),d=c.n(u),b={category:"woocommerce-product-elements",keywords:[Object(i.__)("WooCommerce","woo-gutenberg-products-block")],icon:{src:Object(r.createElement)(n.a,{icon:a.a,className:"wc-block-editor-components-block-icon"})},supports:{html:!1},ancestor:["woocommerce/all-products","woocommerce/single-product"],save:e=>{let{attributes:t}=e;return t.isDescendentOfQueryLoop?null:Object(r.createElement)("div",{className:d()("is-loading",t.className)})},deprecated:[{attributes:{},save:()=>null}]},p=c(306),m=c(3),g=c(12),O=c(8),j=c(11);function h(e){let{level:t}=e;const c={1:"M9 5h2v10H9v-4H5v4H3V5h2v4h4V5zm6.6 0c-.6.9-1.5 1.7-2.6 2v1h2v7h2V5h-1.4z",2:"M7 5h2v10H7v-4H3v4H1V5h2v4h4V5zm8 8c.5-.4.6-.6 1.1-1.1.4-.4.8-.8 1.2-1.3.3-.4.6-.8.9-1.3.2-.4.3-.8.3-1.3 0-.4-.1-.9-.3-1.3-.2-.4-.4-.7-.8-1-.3-.3-.7-.5-1.2-.6-.5-.2-1-.2-1.5-.2-.4 0-.7 0-1.1.1-.3.1-.7.2-1 .3-.3.1-.6.3-.9.5-.3.2-.6.4-.8.7l1.2 1.2c.3-.3.6-.5 1-.7.4-.2.7-.3 1.2-.3s.9.1 1.3.4c.3.3.5.7.5 1.1 0 .4-.1.8-.4 1.1-.3.5-.6.9-1 1.2-.4.4-1 .9-1.6 1.4-.6.5-1.4 1.1-2.2 1.6V15h8v-2H15z",3:"M12.1 12.2c.4.3.8.5 1.2.7.4.2.9.3 1.4.3.5 0 1-.1 1.4-.3.3-.1.5-.5.5-.8 0-.2 0-.4-.1-.6-.1-.2-.3-.3-.5-.4-.3-.1-.7-.2-1-.3-.5-.1-1-.1-1.5-.1V9.1c.7.1 1.5-.1 2.2-.4.4-.2.6-.5.6-.9 0-.3-.1-.6-.4-.8-.3-.2-.7-.3-1.1-.3-.4 0-.8.1-1.1.3-.4.2-.7.4-1.1.6l-1.2-1.4c.5-.4 1.1-.7 1.6-.9.5-.2 1.2-.3 1.8-.3.5 0 1 .1 1.6.2.4.1.8.3 1.2.5.3.2.6.5.8.8.2.3.3.7.3 1.1 0 .5-.2.9-.5 1.3-.4.4-.9.7-1.5.9v.1c.6.1 1.2.4 1.6.8.4.4.7.9.7 1.5 0 .4-.1.8-.3 1.2-.2.4-.5.7-.9.9-.4.3-.9.4-1.3.5-.5.1-1 .2-1.6.2-.8 0-1.6-.1-2.3-.4-.6-.2-1.1-.6-1.6-1l1.1-1.4zM7 9H3V5H1v10h2v-4h4v4h2V5H7v4z",4:"M9 15H7v-4H3v4H1V5h2v4h4V5h2v10zm10-2h-1v2h-2v-2h-5v-2l4-6h3v6h1v2zm-3-2V7l-2.8 4H16z",5:"M12.1 12.2c.4.3.7.5 1.1.7.4.2.9.3 1.3.3.5 0 1-.1 1.4-.4.4-.3.6-.7.6-1.1 0-.4-.2-.9-.6-1.1-.4-.3-.9-.4-1.4-.4H14c-.1 0-.3 0-.4.1l-.4.1-.5.2-1-.6.3-5h6.4v1.9h-4.3L14 8.8c.2-.1.5-.1.7-.2.2 0 .5-.1.7-.1.5 0 .9.1 1.4.2.4.1.8.3 1.1.6.3.2.6.6.8.9.2.4.3.9.3 1.4 0 .5-.1 1-.3 1.4-.2.4-.5.8-.9 1.1-.4.3-.8.5-1.3.7-.5.2-1 .3-1.5.3-.8 0-1.6-.1-2.3-.4-.6-.2-1.1-.6-1.6-1-.1-.1 1-1.5 1-1.5zM9 15H7v-4H3v4H1V5h2v4h4V5h2v10z",6:"M9 15H7v-4H3v4H1V5h2v4h4V5h2v10zm8.6-7.5c-.2-.2-.5-.4-.8-.5-.6-.2-1.3-.2-1.9 0-.3.1-.6.3-.8.5l-.6.9c-.2.5-.2.9-.2 1.4.4-.3.8-.6 1.2-.8.4-.2.8-.3 1.3-.3.4 0 .8 0 1.2.2.4.1.7.3 1 .6.3.3.5.6.7.9.2.4.3.8.3 1.3s-.1.9-.3 1.4c-.2.4-.5.7-.8 1-.4.3-.8.5-1.2.6-1 .3-2 .3-3 0-.5-.2-1-.5-1.4-.9-.4-.4-.8-.9-1-1.5-.2-.6-.3-1.3-.3-2.1s.1-1.6.4-2.3c.2-.6.6-1.2 1-1.6.4-.4.9-.7 1.4-.9.6-.3 1.1-.4 1.7-.4.7 0 1.4.1 2 .3.5.2 1 .5 1.4.8 0 .1-1.3 1.4-1.3 1.4zm-2.4 5.8c.2 0 .4 0 .6-.1.2 0 .4-.1.5-.2.1-.1.3-.3.4-.5.1-.2.1-.5.1-.7 0-.4-.1-.8-.4-1.1-.3-.2-.7-.3-1.1-.3-.3 0-.7.1-1 .2-.4.2-.7.4-1 .7 0 .3.1.7.3 1 .1.2.3.4.4.6.2.1.3.3.5.3.2.1.5.2.7.1z"};return c.hasOwnProperty(t)?Object(r.createElement)(j.SVG,{width:"20",height:"20",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg"},Object(r.createElement)(j.Path,{d:c[t]})):null}class _ extends r.Component{createLevelControl(e,t,c){const o=e===t;return{icon:Object(r.createElement)(h,{level:e}),title:Object(i.sprintf)( +/* translators: %s: heading level e.g: "2", "3", "4" */ +Object(i.__)("Heading %d","woo-gutenberg-products-block"),e),isActive:o,onClick:()=>c(e)}}render(){const{isCollapsed:e=!0,minLevel:t,maxLevel:c,selectedLevel:o,onChange:n}=this.props;return Object(r.createElement)(m.ToolbarGroup,{isCollapsed:e,icon:Object(r.createElement)(h,{level:o}),controls:Object(O.range)(t,c).map(e=>this.createLevelControl(e,o,n))})}}var E=_,f=c(185),w=c(96),y=c(150),k=c(22);c(367);var v=e=>t=>c=>{var o;const n=Object(k.useProductDataContext)(),{attributes:a,setAttributes:s}=c,{productId:u}=a,[d,b]=Object(r.useState)(!u);return n.hasContext||Number.isFinite(null===(o=c.context)||void 0===o?void 0:o.queryId)?Object(r.createElement)(t,c):Object(r.createElement)(r.Fragment,null,d?Object(r.createElement)(m.Placeholder,{icon:e.icon||"",label:e.label||"",className:"wc-atomic-blocks-product"},!!e.description&&Object(r.createElement)("div",null,e.description),Object(r.createElement)("div",{className:"wc-atomic-blocks-product__selection"},Object(r.createElement)(w.a,{selected:u||0,showVariations:!0,onChange:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];s({productId:e[0]?e[0].id:0})}}),Object(r.createElement)(m.Button,{isSecondary:!0,disabled:!u,onClick:()=>{b(!1)}},Object(i.__)("Done","woo-gutenberg-products-block")))):Object(r.createElement)(r.Fragment,null,Object(r.createElement)(l.BlockControls,null,Object(r.createElement)(m.ToolbarGroup,null,Object(r.createElement)(y.a,{onClick:()=>b(!0)},Object(i.__)("Switch product…","woo-gutenberg-products-block")))),Object(r.createElement)(t,c)))},S=c(130);c(368);const C=e=>{let{attributes:t,setAttributes:c}=e;const o=Object(l.useBlockProps)(),{headingLevel:n,showProductLink:a,align:u,linkTarget:d}=t;return Object(r.createElement)("div",o,Object(r.createElement)(l.BlockControls,null,Object(r.createElement)(E,{isCollapsed:!0,minLevel:1,maxLevel:7,selectedLevel:n,onChange:e=>c({headingLevel:e})}),Object(s.b)()&&Object(r.createElement)(l.AlignmentToolbar,{value:u,onChange:e=>{c({align:e})}})),Object(r.createElement)(l.InspectorControls,null,Object(r.createElement)(m.PanelBody,{title:Object(i.__)("Link settings","woo-gutenberg-products-block")},Object(r.createElement)(m.ToggleControl,{label:Object(i.__)("Make title a link","woo-gutenberg-products-block"),checked:a,onChange:()=>c({showProductLink:!a})}),a&&Object(r.createElement)(r.Fragment,null,Object(r.createElement)(m.ToggleControl,{label:Object(i.__)("Open in new tab","woo-gutenberg-products-block"),onChange:e=>c({linkTarget:e?"_blank":"_self"}),checked:"_blank"===d})))),Object(r.createElement)(m.Disabled,null,Object(r.createElement)(f.b,t)))};var x=Object(s.b)()?Object(g.compose)([v({icon:S.b,label:S.c,description:Object(i.__)("Choose a product to display its title.","woo-gutenberg-products-block")})])(C):C;const N={...b,apiVersion:2,title:S.c,description:S.a,icon:{src:S.b},attributes:p.a,edit:x,save:e=>{let{attributes:t}=e;return Object(r.createElement)("div",l.useBlockProps.save({className:d()("is-loading",t.className)}))},supports:{...b.supports,...Object(s.b)()&&{typography:{fontSize:!0,lineHeight:!0,__experimentalFontWeight:!0,__experimentalTextTransform:!0,__experimentalFontFamily:!0},color:{text:!0,background:!0,link:!1,gradients:!0,__experimentalSkipSerialization:!0},..."function"==typeof l.__experimentalGetSpacingClassesAndStyles&&{spacing:{margin:!0,__experimentalSkipSerialization:!0}},__experimentalSelector:".wc-block-components-product-title"}}};Object(o.registerBlockType)("woocommerce/product-title",N);var P=c(13),T=c(204),I=c(536);const A=Object(i.__)("Product Price","woo-gutenberg-products-block"),R=Object(r.createElement)(n.a,{icon:I.a,className:"wc-block-editor-components-block-icon"}),B=Object(i.__)("Display the price of a product.","woo-gutenberg-products-block");var L=v({icon:R,label:A})(e=>{let{attributes:t,setAttributes:c,context:o}=e;const n=Object(l.useBlockProps)(),a={...t,...o},s=Number.isFinite(o.queryId);return Object(P.useEffect)(()=>c({isDescendentOfQueryLoop:s}),[c,s]),Object(r.createElement)(r.Fragment,null,Object(r.createElement)(l.BlockControls,null,s&&Object(r.createElement)(l.AlignmentToolbar,{value:t.textAlign,onChange:e=>{c({textAlign:e})}})),Object(r.createElement)("div",n,Object(r.createElement)(T.default,a)))});const D={...b.supports,...Object(s.b)()&&{color:{text:!0,background:!1,link:!1,__experimentalSkipSerialization:!0},typography:{fontSize:!0,__experimentalFontWeight:!0,__experimentalFontStyle:!0,__experimentalSkipSerialization:!0},__experimentalSelector:".wc-block-components-product-price"},..."function"==typeof l.__experimentalGetSpacingClassesAndStyles&&{spacing:{margin:!0}}},F={...b,apiVersion:2,title:A,description:B,ancestor:["woocommerce/all-products","woocommerce/single-product","core/post-template"],usesContext:["query","queryId","postId"],icon:{src:R},attributes:{productId:{type:"number",default:0},isDescendentOfQueryLoop:{type:"boolean",default:!1},textAlign:{type:"string"}},supports:D,edit:L};Object(o.registerBlockType)("woocommerce/product-price",F);var V=c(6),z=c.n(V),M=c(2),q=c(127),H=c(188),G=c(537);const Q=Object(i.__)("Product Image","woo-gutenberg-products-block"),Y=Object(r.createElement)(n.a,{icon:G.a,className:"wc-block-editor-components-block-icon"}),U=Object(i.__)("Display the main product image.","woo-gutenberg-products-block");var W=v({icon:Y,label:Q,description:U})(e=>{let{attributes:t,setAttributes:c,context:o}=e;const{showProductLink:n,imageSizing:a,showSaleBadge:s,saleBadgeAlign:u}=t,d=Object(l.useBlockProps)(),b=Number.isFinite(o.queryId),p=Object(M.getSettingWithCoercion)("is_block_theme_enabled",!1,q.a);return Object(r.useEffect)(()=>c({isDescendentOfQueryLoop:b}),[c,b]),Object(r.useEffect)(()=>{p&&"full-size"!==t.imageSizing&&c({imageSizing:"full-size"})},[t.imageSizing,p,c]),Object(r.createElement)("div",d,Object(r.createElement)(l.InspectorControls,null,Object(r.createElement)(m.PanelBody,{title:Object(i.__)("Content","woo-gutenberg-products-block")},Object(r.createElement)(m.ToggleControl,{label:Object(i.__)("Link to Product Page","woo-gutenberg-products-block"),help:Object(i.__)("Links the image to the single product listing.","woo-gutenberg-products-block"),checked:n,onChange:()=>c({showProductLink:!n})}),Object(r.createElement)(m.ToggleControl,{label:Object(i.__)("Show On-Sale Badge","woo-gutenberg-products-block"),help:Object(i.__)("Display a “sale” badge if the product is on-sale.","woo-gutenberg-products-block"),checked:s,onChange:()=>c({showSaleBadge:!s})}),s&&Object(r.createElement)(m.__experimentalToggleGroupControl,{label:Object(i.__)("Sale Badge Alignment","woo-gutenberg-products-block"),value:u,onChange:e=>c({saleBadgeAlign:e})},Object(r.createElement)(m.__experimentalToggleGroupControlOption,{value:"left",label:Object(i.__)("Left","woo-gutenberg-products-block")}),Object(r.createElement)(m.__experimentalToggleGroupControlOption,{value:"center",label:Object(i.__)("Center","woo-gutenberg-products-block")}),Object(r.createElement)(m.__experimentalToggleGroupControlOption,{value:"right",label:Object(i.__)("Right","woo-gutenberg-products-block")})),!p&&Object(r.createElement)(m.__experimentalToggleGroupControl,{label:Object(i.__)("Image Sizing","woo-gutenberg-products-block"),help:Object(r.createInterpolateElement)(Object(i.__)("Product image cropping can be modified in the Customizer.","woo-gutenberg-products-block"),{a:Object(r.createElement)("a",{href:Object(M.getAdminLink)("customize.php")+"?autofocus[panel]=woocommerce&autofocus[section]=woocommerce_product_images",target:"_blank",rel:"noopener noreferrer"})}),value:a,onChange:e=>c({imageSizing:e})},Object(r.createElement)(m.__experimentalToggleGroupControlOption,{value:"full-size",label:Object(i.__)("Full Size","woo-gutenberg-products-block")}),Object(r.createElement)(m.__experimentalToggleGroupControlOption,{value:"cropped",label:Object(i.__)("Cropped","woo-gutenberg-products-block")})))),Object(r.createElement)(m.Disabled,null,Object(r.createElement)(H.b,z()({},t,o))))});const K={html:!1,...Object(s.b)()&&{__experimentalBorder:{radius:!0,__experimentalSkipSerialization:!0},typography:{fontSize:!0,__experimentalSkipSerialization:!0},..."function"==typeof l.__experimentalGetSpacingClassesAndStyles&&{spacing:{margin:!0,__experimentalSkipSerialization:!0}},__experimentalSelector:".wc-block-components-product-image"}};var $=c(307);const J={...b,apiVersion:2,name:"woocommerce/product-image",title:Q,icon:{src:Y},keywords:["WooCommerce"],description:U,usesContext:["query","queryId","postId"],ancestor:["woocommerce/all-products","woocommerce/single-product","core/post-template"],textdomain:"woo-gutenberg-products-block",attributes:$.a,supports:K,edit:W};Object(o.registerBlockType)("woocommerce/product-image",{...J});var X=c(205),Z=c(538);const ee=Object(i.__)("Product Rating","woo-gutenberg-products-block"),te=Object(r.createElement)(n.a,{icon:Z.a,className:"wc-block-editor-components-block-icon"}),ce=Object(i.__)("Display the average rating of a product.","woo-gutenberg-products-block");c(369);var re=v({icon:te,label:ee,description:Object(i.__)("Choose a product to display its rating.","woo-gutenberg-products-block")})(e=>{let{attributes:t,setAttributes:c,context:o}=e;const n=Object(l.useBlockProps)({className:"wp-block-woocommerce-product-rating"}),a={...t,...o},s=Number.isFinite(o.queryId);return Object(P.useEffect)(()=>c({isDescendentOfQueryLoop:s}),[c,s]),Object(r.createElement)(r.Fragment,null,Object(r.createElement)(l.BlockControls,null,s&&Object(r.createElement)(l.AlignmentToolbar,{value:t.textAlign,onChange:e=>{c({textAlign:e||""})}})),Object(r.createElement)("div",n,Object(r.createElement)(X.default,a)))});const oe={...Object(s.b)()&&{color:{text:!0,background:!1,link:!1,__experimentalSkipSerialization:!0},spacing:{margin:!0,padding:!0},typography:{fontSize:!0,__experimentalSkipSerialization:!0},__experimentalSelector:".wc-block-components-product-rating"},...!Object(s.b)()&&"function"==typeof l.__experimentalGetSpacingClassesAndStyles&&{spacing:{margin:!0}}},ne={...b,apiVersion:2,title:ee,description:ce,usesContext:["query","queryId","postId"],ancestor:["woocommerce/all-products","woocommerce/single-product","core/post-template"],icon:{src:te},attributes:{productId:{type:"number",default:0},isDescendentOfQueryLoop:{type:"boolean",default:!1},textAlign:{type:"string",default:""}},supports:oe,edit:re};Object(o.registerBlockType)("woocommerce/product-rating",{...ne});const ae={...Object(s.b)()&&{color:{text:!0,background:!0,link:!1,__experimentalSkipSerialization:!0},__experimentalBorder:{radius:!0,__experimentalSkipSerialization:!0},..."function"==typeof l.__experimentalGetSpacingClassesAndStyles&&{spacing:{margin:!0,padding:!0,__experimentalSkipSerialization:!0}},typography:{fontSize:!0,__experimentalFontWeight:!0,__experimentalSkipSerialization:!0},__experimentalSelector:".wp-block-button.wc-block-components-product-button .wc-block-components-product-button__button"},..."function"==typeof l.__experimentalGetSpacingClassesAndStyles&&!Object(s.b)()&&{spacing:{margin:!0}}};var se=c(206),le=c(539);const ie=Object(i.__)("Add to Cart Button","woo-gutenberg-products-block"),ue=Object(r.createElement)(n.a,{icon:le.a,className:"wc-block-editor-components-block-icon"}),de=Object(i.__)("Display a call to action button which either adds the product to the cart, or links to the product page.","woo-gutenberg-products-block"),be={...b,apiVersion:2,title:ie,description:de,ancestor:["woocommerce/all-products","woocommerce/single-product","core/post-template"],usesContext:["query","queryId","postId"],icon:{src:ue},attributes:{productId:{type:"number",default:0},isDescendentOfQueryLoop:{type:"boolean",default:!1},textAlign:{type:"string",default:""}},supports:ae,edit:e=>{let{attributes:t,setAttributes:c,context:o}=e;const n=Object(l.useBlockProps)(),a=Number.isFinite(null==o?void 0:o.queryId);return Object(r.useEffect)(()=>c({isDescendentOfQueryLoop:a}),[c,a]),Object(r.createElement)(r.Fragment,null,Object(r.createElement)(l.BlockControls,null,a&&Object(r.createElement)(l.AlignmentToolbar,{value:t.textAlign,onChange:e=>{c({textAlign:e||""})}})),Object(r.createElement)("div",n,Object(r.createElement)(m.Disabled,null,Object(r.createElement)(se.default,z()({},t,o)))))}};Object(o.registerBlockType)("woocommerce/product-button",{...be});var pe=c(314),me=c(115);c(370);var ge=v({icon:me.b,label:me.c,description:me.a})(e=>{let{attributes:t}=e;const c=Object(l.useBlockProps)();return Object(r.createElement)("div",c,Object(r.createElement)(pe.default,t))});const Oe={...Object(s.b)()&&{color:{background:!1},typography:{fontSize:!0},__experimentalSelector:".wc-block-components-product-summary"}},je={...b,apiVersion:2,title:me.c,description:me.a,icon:{src:me.b},attributes:{productId:{type:"number",default:0}},supports:Oe,edit:ge,save:e=>{let{attributes:t}=e;return Object(r.createElement)("div",l.useBlockProps.save({className:d()("is-loading",t.className)}))}};Object(o.registerBlockType)("woocommerce/product-summary",je);var he=c(141),_e=c(540);const Ee=Object(i.__)("On-Sale Badge","woo-gutenberg-products-block"),fe=Object(r.createElement)(n.a,{icon:_e.a,className:"wc-block-editor-components-block-icon"}),we=Object(i.__)("Displays an on-sale badge if the product is on-sale.","woo-gutenberg-products-block");var ye=v({icon:fe,label:Ee,description:we})(e=>{let{attributes:t,setAttributes:c,context:o}=e;const n=Object(l.useBlockProps)(),a={...t,...o},s=Number.isFinite(o.queryId);return Object(P.useEffect)(()=>c({isDescendentOfQueryLoop:s}),[c,s]),Object(r.createElement)("div",n,Object(r.createElement)(he.default,a))});const ke={html:!1,...Object(s.b)()&&{color:{gradients:!0,background:!0,link:!1,__experimentalSkipSerialization:!0},typography:{fontSize:!0,lineHeight:!0,__experimentalFontFamily:!0,__experimentalFontWeight:!0,__experimentalFontStyle:!0,__experimentalSkipSerialization:!0,__experimentalLetterSpacing:!0,__experimentalTextTransform:!0,__experimentalTextDecoration:!0},__experimentalBorder:{color:!0,radius:!0,width:!0,__experimentalSkipSerialization:!0},..."function"==typeof l.__experimentalGetSpacingClassesAndStyles&&{spacing:{margin:!0,padding:!0}},__experimentalSelector:".wc-block-components-product-sale-badge"},..."function"==typeof l.__experimentalGetSpacingClassesAndStyles&&!Object(s.b)()&&{spacing:{margin:!0}}},ve={...b,title:Ee,description:we,icon:{src:fe},apiVersion:2,supports:ke,attributes:{productId:{type:"number",default:0},isDescendentOfQueryLoop:{type:"boolean",default:!1}},edit:ye,usesContext:["query","queryId","postId"],ancestor:["woocommerce/all-products","woocommerce/single-product","core/post-template"]};Object(o.registerBlockType)("woocommerce/product-sale-badge",{...ve});var Se=c(107),Ce=c(315),xe=Object(r.createElement)(j.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(r.createElement)("path",{d:"M2 6h2v12H2V6m3 0h1v12H5V6m2 0h3v12H7V6m4 0h1v12h-1V6m3 0h2v12h-2V6m3 0h3v12h-3V6m4 0h1v12h-1V6z"}));const Ne=Object(i.__)("Product SKU","woo-gutenberg-products-block"),Pe=Object(r.createElement)(n.a,{icon:xe,className:"wc-block-editor-components-block-icon"}),Te=Object(i.__)("Display the SKU of a product.","woo-gutenberg-products-block");var Ie=v({icon:Pe,label:Ne,description:Object(i.__)("Choose a product to display its SKU.","woo-gutenberg-products-block")})(e=>{let{attributes:t,setAttributes:c,context:o}=e;const n={...t,...o},a=Number.isFinite(o.queryId);return Object(P.useEffect)(()=>c({isDescendentOfQueryLoop:a}),[c,a]),Object(r.createElement)(r.Fragment,null,Object(r.createElement)(Se.a,null),Object(r.createElement)(Ce.default,n))});const Ae={...b,apiVersion:2,title:Ne,description:Te,icon:{src:Pe},usesContext:["query","queryId","postId"],ancestor:["woocommerce/all-products","woocommerce/single-product","core/post-template"],attributes:{productId:{type:"number",default:0},isDescendentOfQueryLoop:{type:"boolean",default:!1}},edit:Ie};Object(o.registerBlockType)("woocommerce/product-sku",{...Ae});var Re=c(316),Be=c(541);const Le=Object(i.__)("Product Category List","woo-gutenberg-products-block"),De=Object(r.createElement)(n.a,{icon:Be.a,className:"wc-block-editor-components-block-icon"}),Fe=Object(i.__)("Display the list of categories that are assigned to a product.","woo-gutenberg-products-block");var Ve=v({icon:De,label:Le,description:Object(i.__)("Choose a product to display its categories.","woo-gutenberg-products-block")})(e=>{let{attributes:t}=e;const c=Object(l.useBlockProps)();return Object(r.createElement)("div",c,Object(r.createElement)(Se.a,null),Object(r.createElement)(m.Disabled,null,Object(r.createElement)(Re.default,t)))});const ze={...b,apiVersion:2,title:Le,description:Fe,icon:{src:De},attributes:{productId:{type:"number",default:0}},supports:{...Object(s.b)()&&{color:{text:!0,link:!0,background:!1,__experimentalSkipSerialization:!0},typography:{fontSize:!0,lineHeight:!0,__experimentalFontStyle:!0,__experimentalFontWeight:!0,__experimentalSkipSerialization:!0},__experimentalSelector:".wc-block-components-product-category-list"}},save:e=>{let{attributes:t}=e;return Object(r.createElement)("div",l.useBlockProps.save({className:d()("is-loading",t.className)}))},edit:Ve};Object(s.c)("woocommerce/product-category-list",ze);var Me=c(317),qe=c(542);const He=Object(i.__)("Product Tag List","woo-gutenberg-products-block"),Ge=Object(r.createElement)(n.a,{icon:qe.a,className:"wc-block-editor-components-block-icon"}),Qe=Object(i.__)("Display the list of tags that are assigned to a product.","woo-gutenberg-products-block");var Ye=v({icon:Ge,label:He,description:Object(i.__)("Choose a product to display its tags.","woo-gutenberg-products-block")})(e=>{let{attributes:t}=e;const c=Object(l.useBlockProps)();return Object(r.createElement)("div",c,Object(r.createElement)(Se.a,null),Object(r.createElement)(m.Disabled,null,Object(r.createElement)(Me.default,t)))});const Ue={...Object(s.b)()&&{color:{text:!0,background:!1,link:!0},typography:{fontSize:!0},__experimentalSelector:".wc-block-components-product-tag-list"}},We={...b,apiVersion:2,title:He,description:Qe,icon:{src:Ge},attributes:{productId:{type:"number",default:0}},supports:Ue,edit:Ye,save:e=>{let{attributes:t}=e;return Object(r.createElement)("div",l.useBlockProps.save({className:d()("is-loading",t.className)}))}};Object(s.c)("woocommerce/product-tag-list",{...b,...We});var Ke=c(318),$e=c(543);const Je=Object(i.__)("Product Stock Indicator","woo-gutenberg-products-block"),Xe=Object(r.createElement)(n.a,{icon:$e.a,className:"wc-block-editor-components-block-icon"}),Ze=Object(i.__)("Display product stock status.","woo-gutenberg-products-block");var et=v({icon:Xe,label:Je,description:Ze})(e=>{let{attributes:t,setAttributes:c,context:o}=e;const n=Object(l.useBlockProps)(),a={...t,...o},s=Number.isFinite(o.queryId);return Object(P.useEffect)(()=>c({isDescendentOfQueryLoop:s}),[c,s]),Object(r.createElement)("div",n,Object(r.createElement)(Se.a,null),Object(r.createElement)(Ke.default,a))});const tt={...Object(s.b)()&&{color:{text:!0,background:!1,link:!1},typography:{fontSize:!0},__experimentalSelector:".wc-block-components-product-stock-indicator"}},ct={...b,apiVersion:2,title:Je,description:Ze,icon:{src:Xe},attributes:{productId:{type:"number",default:0},isDescendentOfQueryLoop:{type:"boolean",default:!1}},supports:tt,edit:et,usesContext:["query","queryId","postId"],ancestor:["woocommerce/all-products","woocommerce/single-product","core/post-template"]};Object(o.registerBlockType)("woocommerce/product-stock-indicator",{...ct});var rt=c(351),ot=(c(229),c(203)),nt=c(262);const at=Object(i.__)("Add to Cart","woo-gutenberg-products-block"),st=Object(r.createElement)(n.a,{icon:nt.a,className:"wc-block-editor-components-block-icon"}),lt={title:at,description:Object(i.__)("Displays an add to cart button. Optionally displays other add to cart form elements.","woo-gutenberg-products-block"),icon:{src:st},edit:v({icon:st,label:at,description:Object(i.__)("Choose a product to display its add to cart form.","woo-gutenberg-products-block")})(e=>{let{attributes:t,setAttributes:c}=e;const{product:o}=Object(k.useProductDataContext)(),{className:n,showFormElements:a}=t;return Object(r.createElement)("div",{className:d()(n,"wc-block-components-product-add-to-cart")},Object(r.createElement)(Se.a,{productId:o.id}),Object(r.createElement)(l.InspectorControls,null,Object(r.createElement)(m.PanelBody,{title:Object(i.__)("Layout","woo-gutenberg-products-block")},Object(rt.b)(o)?Object(r.createElement)(m.ToggleControl,{label:Object(i.__)("Display form elements","woo-gutenberg-products-block"),help:Object(i.__)("Depending on product type, allow customers to select a quantity, variations etc.","woo-gutenberg-products-block"),checked:a,onChange:()=>c({showFormElements:!a})}):Object(r.createElement)(m.Notice,{className:"wc-block-components-product-add-to-cart-notice",isDismissible:!1,status:"info"},Object(i.__)("This product does not support the block based add to cart form. A link to the product page will be shown instead.","woo-gutenberg-products-block")))),Object(r.createElement)(m.Disabled,null,Object(r.createElement)(ot.a,t)))}),attributes:c(308).a};Object(s.c)("woocommerce/product-add-to-cart",{...b,...lt});var it=c(547),ut=c(7),dt=c(20),bt=c(32);c(373);const pt=()=>Object(r.createElement)("div",{className:"wc-block-editor-product-gallery"},Object(r.createElement)("img",{src:dt.m+"block-placeholders/product-image-gallery.svg",alt:"Placeholder"}),Object(r.createElement)("div",{className:"wc-block-editor-product-gallery__other-images"},[...Array(4).keys()].map(e=>Object(r.createElement)("img",{key:e,src:dt.m+"block-placeholders/product-image-gallery.svg",alt:"Placeholder"}))));var mt=e=>{let{context:t}=e;const c=Object(l.useBlockProps)();return Object(bt.a)(t)?Object(r.createElement)("div",c,Object(r.createElement)(m.Disabled,null,Object(r.createElement)(pt,null))):""},gt=c(247);(e=>{let t,{registerBlockFn:c,unregisterBlockFn:r,blockName:n}=e;Object(ut.subscribe)(()=>{var e;const a=t,s=Object(ut.select)("core/edit-site");if(t=null==s?void 0:s.getEditedPostId(),a===t)return;const l=null===(e=t)||void 0===e?void 0:e.split("//")[1];if(null==l)return;const i=Object(o.getBlockType)(n);void 0===i&&l.includes("single-product")&&c(),void 0!==i&&r()},"core/edit-site")})({registerBlockFn:()=>{Object(o.registerBlockType)(gt,{icon:it.a,edit:mt})},unregisterBlockFn:()=>{Object(o.unregisterBlockType)(gt.name)},blockName:gt.name});var Ot=c(209);const jt=(e,t)=>{const{className:c,contentVisibility:r}=t;return d()(e,c,{"has-image":r&&r.image,"has-title":r&&r.title,"has-rating":r&&r.rating,"has-price":r&&r.price,"has-button":r&&r.button})},{attributes:ht}=Ot;var _t=[{attributes:Object.assign({},ht,{rows:{type:"number",default:1}}),save(e){let{attributes:t}=e;const c={"data-attributes":JSON.stringify(t)};return Object(r.createElement)("div",z()({className:jt("wc-block-all-products",t)},c),Object(r.createElement)(l.InnerBlocks.Content,null))}}],Et=c(23),ft=c.n(Et),wt=c(63),yt=c(520),kt=c(375),vt=c(228);const St=[["woocommerce/product-image",{imageSizing:"cropped"}],["woocommerce/product-title"],["woocommerce/product-price"],["woocommerce/product-rating"],["woocommerce/product-button"]],Ct=e=>e&&0!==e.length?e.map(e=>[e.name,{...e.attributes,product:void 0,children:e.innerBlocks.length>0?Ct(e.innerBlocks):[]}]):[];var xt=c(30);c(378);var Nt=e=>{let{currentPage:t,displayFirstAndLastPages:c=!0,displayNextAndPreviousArrows:o=!0,pagesToDisplay:n=3,onPageChange:a,totalPages:s}=e,{minIndex:l,maxIndex:u}=((e,t,c)=>{if(c<=2)return{minIndex:null,maxIndex:null};const r=e-1,o=Math.max(Math.floor(t-r/2),2),n=Math.min(Math.ceil(t+(r-(t-o))),c-1);return{minIndex:Math.max(Math.floor(t-(r-(n-t))),2),maxIndex:n}})(n,t,s);const b=c&&Boolean(1!==l),p=c&&Boolean(u!==s),m=c&&Boolean(l&&l>3),g=c&&Boolean(u&&ua(t-1),title:Object(i.__)("Previous page","woo-gutenberg-products-block"),disabled:t<=1},Object(r.createElement)(xt.a,{label:"←",screenReaderLabel:Object(i.__)("Previous page","woo-gutenberg-products-block")})),b&&Object(r.createElement)("button",{className:d()("wc-block-pagination-page","wc-block-components-pagination__page",{"wc-block-pagination-page--active":1===t,"wc-block-components-pagination__page--active":1===t}),onClick:()=>a(1),disabled:1===t},Object(r.createElement)(xt.a,{label:"1",screenReaderLabel:Object(i.sprintf)( +/* translators: %d is the page number (1, 2, 3...). */ +Object(i.__)("Page %d","woo-gutenberg-products-block"),1)})),m&&Object(r.createElement)("span",{className:"wc-block-pagination-ellipsis wc-block-components-pagination__ellipsis","aria-hidden":"true"},Object(i.__)("…","woo-gutenberg-products-block")),O.map(e=>Object(r.createElement)("button",{key:e,className:d()("wc-block-pagination-page","wc-block-components-pagination__page",{"wc-block-pagination-page--active":t===e,"wc-block-components-pagination__page--active":t===e}),onClick:t===e?void 0:()=>a(e),disabled:t===e},Object(r.createElement)(xt.a,{label:e.toString(),screenReaderLabel:Object(i.sprintf)( +/* translators: %d is the page number (1, 2, 3...). */ +Object(i.__)("Page %d","woo-gutenberg-products-block"),e)}))),g&&Object(r.createElement)("span",{className:"wc-block-pagination-ellipsis wc-block-components-pagination__ellipsis","aria-hidden":"true"},Object(i.__)("…","woo-gutenberg-products-block")),p&&Object(r.createElement)("button",{className:d()("wc-block-pagination-page","wc-block-components-pagination__page",{"wc-block-pagination-page--active":t===s,"wc-block-components-pagination__page--active":t===s}),onClick:()=>a(s),disabled:t===s},Object(r.createElement)(xt.a,{label:s.toString(),screenReaderLabel:Object(i.sprintf)( +/* translators: %d is the page number (1, 2, 3...). */ +Object(i.__)("Page %d","woo-gutenberg-products-block"),s)})),o&&Object(r.createElement)("button",{className:"wc-block-pagination-page wc-block-components-pagination__page wc-block-components-pagination-page--arrow",onClick:()=>a(t+1),title:Object(i.__)("Next page","woo-gutenberg-products-block"),disabled:t>=s},Object(r.createElement)(xt.a,{label:"→",screenReaderLabel:Object(i.__)("Next page","woo-gutenberg-products-block")})))},Pt=c(103),Tt=c(54),It=c(106),At=c(10),Rt=c(42);var Bt=c(82);c(379);const Lt=e=>{if(!e)return;const t=e.getBoundingClientRect().bottom;t>=0&&t<=window.innerHeight||e.scrollIntoView()};var Dt=c(46),Ft=c(181),Vt=()=>{const{parentClassName:e}=Object(k.useInnerBlockLayoutContext)();return Object(r.createElement)("div",{className:e+"__no-products"},Object(r.createElement)(n.a,{className:e+"__no-products-image",icon:Ft.a,size:100}),Object(r.createElement)("strong",{className:e+"__no-products-title"},Object(i.__)("No products","woo-gutenberg-products-block")),Object(r.createElement)("p",{className:e+"__no-products-description"},Object(i.__)("There are currently no products available to display.","woo-gutenberg-products-block")))},zt=c(548),Mt=e=>{let{resetCallback:t=(()=>{})}=e;const{parentClassName:c}=Object(k.useInnerBlockLayoutContext)();return Object(r.createElement)("div",{className:c+"__no-products"},Object(r.createElement)(n.a,{className:c+"__no-products-image",icon:zt.a,size:100}),Object(r.createElement)("strong",{className:c+"__no-products-title"},Object(i.__)("No products found","woo-gutenberg-products-block")),Object(r.createElement)("p",{className:c+"__no-products-description"},Object(i.__)("We were unable to find any results based on your search.","woo-gutenberg-products-block")),Object(r.createElement)("button",{onClick:t},Object(i.__)("Reset Search","woo-gutenberg-products-block")))},qt=c(124);c(377);var Ht=e=>{let{onChange:t,value:c}=e;return Object(r.createElement)(qt.a,{className:"wc-block-product-sort-select wc-block-components-product-sort-select",onChange:t,options:[{key:"menu_order",label:Object(i.__)("Default sorting","woo-gutenberg-products-block")},{key:"popularity",label:Object(i.__)("Popularity","woo-gutenberg-products-block")},{key:"rating",label:Object(i.__)("Average rating","woo-gutenberg-products-block")},{key:"date",label:Object(i.__)("Latest","woo-gutenberg-products-block")},{key:"price",label:Object(i.__)("Price: low to high","woo-gutenberg-products-block")},{key:"price-desc",label:Object(i.__)("Price: high to low","woo-gutenberg-products-block")}],screenReaderLabel:Object(i.__)("Order products by","woo-gutenberg-products-block"),value:c})};const Gt=(e,t,c,o)=>{if(!c)return;const n=Object(yt.a)(e);return c.map((c,a)=>{let[s,l={}]=c,i=[];l.children&&l.children.length>0&&(i=Gt(e,t,l.children,o));const u=n[s];if(!u)return null;const d=t.id||0,b=["layout",s,a,o,d];return Object(r.createElement)(r.Suspense,{key:b.join("_"),fallback:Object(r.createElement)("div",{className:"wc-block-placeholder"})},Object(r.createElement)(u,z()({},l,{children:i,product:t})))})};var Qt=Object(g.withInstanceId)(e=>{let{product:t={},attributes:c,instanceId:o}=e;const{layoutConfig:n}=c,{parentClassName:a,parentName:s}=Object(k.useInnerBlockLayoutContext)(),l=0===Object.keys(t).length,i=d()(a+"__product","wc-block-layout",{"is-loading":l});return Object(r.createElement)("li",{className:i,"aria-hidden":l},Gt(s,t,n,o))});c(376);const Yt=e=>{switch(e){case"menu_order":case"popularity":case"rating":case"price":return{orderby:e,order:"asc"};case"price-desc":return{orderby:"price",order:"desc"};case"date":return{orderby:"date",order:"desc"}}},Ut=function(e){let{totalQuery:t,totalProducts:c}=e,{totalQuery:r}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return!Object(O.isEqual)(t,r)&&Number.isFinite(c)};var Wt,Kt=(Wt=e=>{let{attributes:t,currentPage:c,onPageChange:o,onSortChange:n,sortValue:a,scrollToTop:s}=e;const[l,u]=Object(Tt.b)("attributes",[]),[b,p]=Object(Tt.b)("stock_status",[]),[m,g]=Object(Tt.b)("rating",[]),[j,h]=Object(Tt.b)("min_price"),[_,E]=Object(Tt.b)("max_price"),[f]=Object(Tt.c)((e=>{let{sortValue:t,currentPage:c,attributes:r}=e;const{columns:o,rows:n}=r;return{...Yt(t),catalog_visibility:"catalog",per_page:o*n,page:c}})({attributes:t,sortValue:a,currentPage:c})),{products:w,totalProducts:y,productsLoading:v}=(e=>{const t={namespace:"/wc/store/v1",resourceName:"products"},{results:c,isLoading:r}=Object(It.a)({...t,query:e}),{value:o}=((e,t)=>{const{namespace:c,resourceName:r,resourceValues:o=[],query:n={}}=t;if(!c||!r)throw new Error("The options object must have valid values for the namespace and the resource name properties.");const a=Object(Rt.a)(n),s=Object(Rt.a)(o),{value:l,isLoading:i=!0}=Object(ut.useSelect)(e=>{const t=e(At.COLLECTIONS_STORE_KEY),o=["x-wp-total",c,r,a,s];return{value:t.getCollectionHeader(...o),isLoading:t.hasFinishedResolution("getCollectionHeader",o)}},["x-wp-total",c,r,s,a]);return{value:l,isLoading:i}})(0,{...t,query:e});return{products:c,totalProducts:parseInt(o,10),productsLoading:r}})(f),{parentClassName:S,parentName:C}=Object(k.useInnerBlockLayoutContext)(),x=(e=>{const{order:t,orderby:c,page:r,per_page:o,...n}=e;return n||{}})(f),{dispatchStoreEvent:N}=Object(Bt.a)(),P=Object(Pt.a)({totalQuery:x,totalProducts:y},Ut);Object(r.useEffect)(()=>{N("product-list-render",{products:w,listName:C})},[w,C,N]),Object(r.useEffect)(()=>{Object(O.isEqual)(x,null==P?void 0:P.totalQuery)||(o(1),null!=P&&P.totalQuery&&(e=>{Number.isFinite(e)&&(0===e?Object(Dt.speak)(Object(i.__)("No products found","woo-gutenberg-products-block")):Object(Dt.speak)(Object(i.sprintf)( +/* translators: %s is an integer higher than 0 (1, 2, 3...) */ +Object(i._n)("%d product found","%d products found",e,"woo-gutenberg-products-block"),e)))})(y))},[null==P?void 0:P.totalQuery,y,o,x]);const{contentVisibility:T}=t,I=t.columns*t.rows,A=!Number.isFinite(y)&&Number.isFinite(null==P?void 0:P.totalProducts)&&Object(O.isEqual)(x,null==P?void 0:P.totalQuery)?Math.ceil(((null==P?void 0:P.totalProducts)||0)/I):Math.ceil(y/I),R=w.length?w:Array.from({length:I}),B=0!==w.length||v,L=l.length>0||b.length>0||m.length>0||Number.isFinite(j)||Number.isFinite(_);return Object(r.createElement)("div",{className:(()=>{const{columns:e,rows:c,alignButtons:r,align:o}=t,n=void 0!==o?"align"+o:"";return d()(S,n,"has-"+e+"-columns",{"has-multiple-rows":c>1,"has-aligned-buttons":r})})()},(null==T?void 0:T.orderBy)&&B&&Object(r.createElement)(Ht,{onChange:n,value:a}),!B&&L&&Object(r.createElement)(Mt,{resetCallback:()=>{u([]),p([]),g([]),h(null),E(null)}}),!B&&!L&&Object(r.createElement)(Vt,null),B&&Object(r.createElement)("ul",{className:d()(S+"__products",{"is-loading-products":v})},R.map((function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},c=arguments.length>1?arguments[1]:void 0;return Object(r.createElement)(Qt,{key:e.id||c,attributes:t,product:e})}))),A>1&&Object(r.createElement)(Nt,{currentPage:c,onPageChange:e=>{s({focusableSelector:"a, button"}),o(e)},totalPages:A}))},e=>{const t=Object(r.useRef)(null);return Object(r.createElement)(r.Fragment,null,Object(r.createElement)("div",{className:"with-scroll-to-top__scroll-point",ref:t,"aria-hidden":!0}),Object(r.createElement)(Wt,z()({},e,{scrollToTop:e=>{null!==t.current&&((e,t)=>{const{focusableSelector:c}=t||{};window&&Number.isFinite(window.innerHeight)&&(c?((e,t)=>{var c;const r=(null===(c=e.parentElement)||void 0===c?void 0:c.querySelectorAll(t))||[];if(r.length){const e=r[0];Lt(e),null==e||e.focus()}else Lt(e)})(e,c):Lt(e))})(t.current,e)}})))}),$t=e=>{let{attributes:t}=e;const[c,o]=Object(r.useState)(1),[n,a]=Object(r.useState)(t.orderby);return Object(r.useEffect)(()=>{a(t.orderby)},[t.orderby]),Object(r.createElement)(Kt,{attributes:t,currentPage:c,onPageChange:e=>{o(e)},onSortChange:e=>{var t;const c=null==e||null===(t=e.target)||void 0===t?void 0:t.value;a(c),o(1)},sortValue:n})},Jt=c(149),Xt=c(14);class Zt extends P.Component{render(){const{attributes:e,urlParameterSuffix:t}=this.props;return e.isPreview?Jt.a:Object(r.createElement)(k.InnerBlockLayoutContextProvider,{parentName:"woocommerce/all-products",parentClassName:"wc-block-grid"},Object(r.createElement)(Xt.StoreNoticesContainer,{context:"wc/all-products"}),Object(r.createElement)($t,{attributes:e,urlParameterSuffix:t}))}}var ec=Zt;c(374);class tc extends r.Component{constructor(){super(...arguments),ft()(this,"state",{isEditing:!1,innerBlocks:[]}),ft()(this,"blockMap",Object(yt.a)("woocommerce/all-products")),ft()(this,"componentDidMount",()=>{const{block:e}=this.props;this.setState({innerBlocks:e.innerBlocks})}),ft()(this,"getTitle",()=>Object(i.__)("All Products","woo-gutenberg-products-block")),ft()(this,"getIcon",()=>Object(r.createElement)(n.a,{icon:a.a})),ft()(this,"togglePreview",()=>{const{debouncedSpeak:e}=this.props;this.setState({isEditing:!this.state.isEditing}),this.state.isEditing||e(Object(i.__)("Showing All Products block preview.","woo-gutenberg-products-block"))}),ft()(this,"getInspectorControls",()=>{const{attributes:e,setAttributes:t}=this.props,{columns:c,rows:o,alignButtons:n}=e;return Object(r.createElement)(l.InspectorControls,{key:"inspector"},Object(r.createElement)(m.PanelBody,{title:Object(i.__)("Layout Settings","woo-gutenberg-products-block"),initialOpen:!0},Object(r.createElement)(wt.a,{columns:c,rows:o,alignButtons:n,setAttributes:t,minColumns:Object(M.getSetting)("min_columns",1),maxColumns:Object(M.getSetting)("max_columns",6),minRows:Object(M.getSetting)("min_rows",1),maxRows:Object(M.getSetting)("max_rows",6)})),Object(r.createElement)(m.PanelBody,{title:Object(i.__)("Content Settings","woo-gutenberg-products-block")},((e,t)=>{const{contentVisibility:c}=e;return Object(r.createElement)(m.ToggleControl,{label:Object(i.__)("Show Sorting Dropdown","woo-gutenberg-products-block"),checked:c.orderBy,onChange:()=>t({contentVisibility:{...c,orderBy:!c.orderBy}})})})(e,t),((e,t)=>Object(r.createElement)(m.SelectControl,{label:Object(i.__)("Order Products By","woo-gutenberg-products-block"),value:e.orderby,options:[{label:Object(i.__)("Default sorting (menu order)","woo-gutenberg-products-block"),value:"menu_order"},{label:Object(i.__)("Popularity","woo-gutenberg-products-block"),value:"popularity"},{label:Object(i.__)("Average rating","woo-gutenberg-products-block"),value:"rating"},{label:Object(i.__)("Latest","woo-gutenberg-products-block"),value:"date"},{label:Object(i.__)("Price: low to high","woo-gutenberg-products-block"),value:"price"},{label:Object(i.__)("Price: high to low","woo-gutenberg-products-block"),value:"price-desc"}],onChange:e=>t({orderby:e})}))(e,t)))}),ft()(this,"getBlockControls",()=>{const{isEditing:e}=this.state;return Object(r.createElement)(l.BlockControls,null,Object(r.createElement)(m.ToolbarGroup,{controls:[{icon:"edit",title:Object(i.__)("Edit the layout of each product","woo-gutenberg-products-block"),onClick:()=>this.togglePreview(),isActive:e}]}))}),ft()(this,"renderEditMode",()=>{const e={template:this.props.attributes.layoutConfig,templateLock:!1,allowedBlocks:Object.keys(this.blockMap)};return 0!==this.props.attributes.layoutConfig.length&&(e.renderAppender=!1),Object(r.createElement)(m.Placeholder,{icon:this.getIcon(),label:this.getTitle()},Object(i.__)("Display all products from your store as a grid.","woo-gutenberg-products-block"),Object(r.createElement)("div",{className:"wc-block-all-products-grid-item-template"},Object(r.createElement)(m.Tip,null,Object(i.__)("Edit the blocks inside the example below to change the content displayed for all products within the product grid.","woo-gutenberg-products-block")),Object(r.createElement)(k.InnerBlockLayoutContextProvider,{parentName:"woocommerce/all-products",parentClassName:"wc-block-grid"},Object(r.createElement)("div",{className:"wc-block-grid wc-block-layout has-1-columns"},Object(r.createElement)("ul",{className:"wc-block-grid__products"},Object(r.createElement)("li",{className:"wc-block-grid__product"},Object(r.createElement)(k.ProductDataContextProvider,{product:kt.a[0]},Object(r.createElement)(l.InnerBlocks,e)))))),Object(r.createElement)("div",{className:"wc-block-all-products__actions"},Object(r.createElement)(m.Button,{className:"wc-block-all-products__done-button",isPrimary:!0,onClick:()=>{const{block:e,setAttributes:t}=this.props;t({layoutConfig:Ct(e.innerBlocks)}),this.setState({innerBlocks:e.innerBlocks}),this.togglePreview()}},Object(i.__)("Done","woo-gutenberg-products-block")),Object(r.createElement)(m.Button,{className:"wc-block-all-products__cancel-button",isTertiary:!0,onClick:()=>{const{block:e,replaceInnerBlocks:t}=this.props,{innerBlocks:c}=this.state;t(e.clientId,c,!1),this.togglePreview()}},Object(i.__)("Cancel","woo-gutenberg-products-block")),Object(r.createElement)(m.Button,{className:"wc-block-all-products__reset-button",icon:Object(r.createElement)(n.a,{icon:a.a}),label:Object(i.__)("Reset layout to default","woo-gutenberg-products-block"),onClick:()=>{const{block:e,replaceInnerBlocks:t}=this.props,c=[];St.map(e=>{let[t,r]=e;return c.push(Object(o.createBlock)(t,r)),!0}),t(e.clientId,c,!1),this.setState({innerBlocks:e.innerBlocks})}},Object(i.__)("Reset Layout","woo-gutenberg-products-block")))))}),ft()(this,"renderViewMode",()=>{const{attributes:e}=this.props,{layoutConfig:t}=e,c=t&&0!==t.length,o=this.getTitle(),n=this.getIcon();return c?Object(r.createElement)(m.Disabled,null,Object(r.createElement)(ec,{attributes:e})):((e,t)=>Object(r.createElement)(m.Placeholder,{className:"wc-block-products",icon:t,label:e},Object(i.__)("The content for this block is hidden due to block settings.","woo-gutenberg-products-block")))(o,n)}),ft()(this,"render",()=>{const{attributes:e}=this.props,{isEditing:t}=this.state,c=this.getTitle(),o=this.getIcon();return 0===dt.o.productCount?((e,t)=>Object(r.createElement)(m.Placeholder,{className:"wc-block-products",icon:t,label:e},Object(r.createElement)("p",null,Object(i.__)("You haven't published any products to list here yet.","woo-gutenberg-products-block")),Object(r.createElement)(m.Button,{className:"wc-block-products__add-product-button",isSecondary:!0,href:M.ADMIN_URL+"post-new.php?post_type=product"},Object(i.__)("Add new product","woo-gutenberg-products-block")+" ",Object(r.createElement)(n.a,{icon:vt.a})),Object(r.createElement)(m.Button,{className:"wc-block-products__read_more_button",isTertiary:!0,href:"https://docs.woocommerce.com/document/managing-products/"},Object(i.__)("Learn more","woo-gutenberg-products-block"))))(c,o):Object(r.createElement)("div",{className:jt("wc-block-all-products",e)},this.getBlockControls(),this.getInspectorControls(),t?this.renderEditMode():this.renderViewMode())})}}var cc=Object(g.compose)(m.withSpokenMessages,Object(ut.withSelect)((e,t)=>{let{clientId:c}=t;const{getBlock:r}=e("core/block-editor");return{block:r(c)}}),Object(ut.withDispatch)(e=>{const{replaceInnerBlocks:t}=e("core/block-editor");return{replaceInnerBlocks:t}}))(tc),rc={columns:Object(M.getSetting)("default_columns",3),rows:Object(M.getSetting)("default_rows",3),alignButtons:!1,contentVisibility:{orderBy:!0},orderby:"date",layoutConfig:St,isPreview:!1};const{name:oc}=Ot,nc={icon:{src:Object(r.createElement)(n.a,{icon:a.a,className:"wc-block-editor-components-block-icon"})},edit:cc,save:function(e){let{attributes:t}=e;const c={};Object.keys(t).sort().forEach(e=>{c[e]=t[e]});const o={"data-attributes":JSON.stringify(c)};return Object(r.createElement)("div",z()({className:jt("wc-block-all-products",t)},o),Object(r.createElement)(l.InnerBlocks.Content,null))},deprecated:_t,defaults:rc};Object(o.registerBlockType)(oc,nc)},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t,c){"use strict";c.d(t,"a",(function(){return a}));var r=c(36),o=c(0),n=c(20);c.p=n.l,Object(r.registerBlockComponent)({blockName:"woocommerce/product-price",component:Object(o.lazy)(()=>Promise.all([c.e(0),c.e(1),c.e(2),c.e(3),c.e(31)]).then(c.bind(null,204)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-image",component:Object(o.lazy)(()=>Promise.all([c.e(1),c.e(2),c.e(3),c.e(4),c.e(28)]).then(c.bind(null,576)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-title",component:Object(o.lazy)(()=>Promise.all([c.e(1),c.e(2),c.e(3),c.e(4),c.e(42)]).then(c.bind(null,577)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-rating",component:Object(o.lazy)(()=>Promise.all([c.e(1),c.e(2),c.e(3),c.e(4),c.e(33)]).then(c.bind(null,205)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-button",component:Object(o.lazy)(()=>Promise.all([c.e(1),c.e(2),c.e(3),c.e(4),c.e(24)]).then(c.bind(null,206)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-summary",component:Object(o.lazy)(()=>Promise.all([c.e(1),c.e(2),c.e(39)]).then(c.bind(null,314)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-sale-badge",component:Object(o.lazy)(()=>Promise.all([c.e(1),c.e(2),c.e(3),c.e(35)]).then(c.bind(null,141)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-sku",component:Object(o.lazy)(()=>c.e(37).then(c.bind(null,315)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-category-list",component:Object(o.lazy)(()=>Promise.all([c.e(1),c.e(2),c.e(27)]).then(c.bind(null,316)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-tag-list",component:Object(o.lazy)(()=>Promise.all([c.e(1),c.e(2),c.e(41)]).then(c.bind(null,317)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-stock-indicator",component:Object(o.lazy)(()=>Promise.all([c.e(1),c.e(2),c.e(38)]).then(c.bind(null,318)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-add-to-cart",component:Object(o.lazy)(()=>Promise.all([c.e(0),c.e(1),c.e(4),c.e(22)]).then(c.bind(null,578)))});const a=e=>Object(r.getRegisteredBlockComponents)(e)}]); \ No newline at end of file diff --git a/build/all-products/block.json b/build/all-products/block.json new file mode 100644 index 00000000000..2e3b080c046 --- /dev/null +++ b/build/all-products/block.json @@ -0,0 +1,39 @@ +{ + "$schema": "https://schemas.wp.org/trunk/block.json", + "apiVersion": 1, + "textdomain": "woo-gutenberg-products-block", + "name": "woocommerce/all-products", + "title": "All Products", + "category": "woocommerce", + "keywords": [ "WooCommerce" ], + "description": "Display products from your store in a grid layout.", + "supports": { + "align": [ "wide", "full" ], + "html": false, + "multiple": false + }, + "attributes": { + "columns": { + "type": "number" + }, + "rows": { + "type": "number" + }, + "alignButtons": { + "type": "boolean" + }, + "contentVisibility": { + "type": "object" + }, + "orderby": { + "type": "string" + }, + "layoutConfig": { + "type": "array" + }, + "isPreview": { + "type": "boolean", + "default": false + } + } +} diff --git a/build/all-reviews.asset.php b/build/all-reviews.asset.php new file mode 100644 index 00000000000..03348d87334 --- /dev/null +++ b/build/all-reviews.asset.php @@ -0,0 +1 @@ + array('lodash', 'react', 'wc-settings', 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-element', 'wp-escape-html', 'wp-i18n', 'wp-is-shallow-equal', 'wp-polyfill', 'wp-primitives'), 'version' => '1309737463f367d64379cf160b3e41fa'); \ No newline at end of file diff --git a/build/all-reviews.js b/build/all-reviews.js new file mode 100644 index 00000000000..50f15e5b1e4 --- /dev/null +++ b/build/all-reviews.js @@ -0,0 +1,9 @@ +this.wc=this.wc||{},this.wc.blocks=this.wc.blocks||{},this.wc.blocks["all-reviews"]=function(e){function t(t){for(var o,a,i=t[0],s=t[1],l=t[2],u=0,b=[];uObject(o.createElement)(c.BlockControls,null,Object(o.createElement)(i.ToolbarGroup,{controls:[{icon:"edit",title:r,onClick:()=>t({editMode:!e}),isActive:e}]})),l=(e,t)=>{const r=Object(a.getSetting)("showAvatars",!0),c=Object(a.getSetting)("reviewRatingsEnabled",!0);return Object(o.createElement)(o.Fragment,null,Object(o.createElement)(i.ToggleControl,{label:Object(n.__)("Product rating","woo-gutenberg-products-block"),checked:e.showReviewRating,onChange:()=>t({showReviewRating:!e.showReviewRating})}),e.showReviewRating&&!c&&Object(o.createElement)(i.Notice,{className:"wc-block-base-control-notice",isDismissible:!1},Object(o.createInterpolateElement)(Object(n.__)("Product rating is disabled in your store settings.","woo-gutenberg-products-block"),{a:Object(o.createElement)("a",{href:Object(a.getAdminLink)("admin.php?page=wc-settings&tab=products"),target:"_blank",rel:"noopener noreferrer"})})),Object(o.createElement)(i.ToggleControl,{label:Object(n.__)("Reviewer name","woo-gutenberg-products-block"),checked:e.showReviewerName,onChange:()=>t({showReviewerName:!e.showReviewerName})}),Object(o.createElement)(i.ToggleControl,{label:Object(n.__)("Image","woo-gutenberg-products-block"),checked:e.showReviewImage,onChange:()=>t({showReviewImage:!e.showReviewImage})}),Object(o.createElement)(i.ToggleControl,{label:Object(n.__)("Review date","woo-gutenberg-products-block"),checked:e.showReviewDate,onChange:()=>t({showReviewDate:!e.showReviewDate})}),Object(o.createElement)(i.ToggleControl,{label:Object(n.__)("Review content","woo-gutenberg-products-block"),checked:e.showReviewContent,onChange:()=>t({showReviewContent:!e.showReviewContent})}),e.showReviewImage&&Object(o.createElement)(o.Fragment,null,Object(o.createElement)(i.__experimentalToggleGroupControl,{label:Object(n.__)("Review image","woo-gutenberg-products-block"),value:e.imageType,onChange:e=>t({imageType:e})},Object(o.createElement)(i.__experimentalToggleGroupControlOption,{value:"reviewer",label:Object(n.__)("Reviewer photo","woo-gutenberg-products-block")}),Object(o.createElement)(i.__experimentalToggleGroupControlOption,{value:"product",label:Object(n.__)("Product","woo-gutenberg-products-block")})),"reviewer"===e.imageType&&!r&&Object(o.createElement)(i.Notice,{className:"wc-block-base-control-notice",isDismissible:!1},Object(o.createInterpolateElement)(Object(n.__)("Reviewer photo is disabled in your site settings.","woo-gutenberg-products-block"),{a:Object(o.createElement)("a",{href:Object(a.getAdminLink)("options-discussion.php"),target:"_blank",rel:"noopener noreferrer"})}))))},d=(e,t)=>Object(o.createElement)(o.Fragment,null,Object(o.createElement)(i.ToggleControl,{label:Object(n.__)("Order by","woo-gutenberg-products-block"),checked:e.showOrderby,onChange:()=>t({showOrderby:!e.showOrderby})}),Object(o.createElement)(i.SelectControl,{label:Object(n.__)("Order Product Reviews by","woo-gutenberg-products-block"),value:e.orderby,options:[{label:"Most recent",value:"most-recent"},{label:"Highest Rating",value:"highest-rating"},{label:"Lowest Rating",value:"lowest-rating"}],onChange:e=>t({orderby:e})}),Object(o.createElement)(i.RangeControl,{label:Object(n.__)("Starting Number of Reviews","woo-gutenberg-products-block"),value:e.reviewsOnPageLoad,onChange:e=>t({reviewsOnPageLoad:e}),max:20,min:1}),Object(o.createElement)(i.ToggleControl,{label:Object(n.__)("Load more","woo-gutenberg-products-block"),checked:e.showLoadMore,onChange:()=>t({showLoadMore:!e.showLoadMore})}),e.showLoadMore&&Object(o.createElement)(i.RangeControl,{label:Object(n.__)("Load More Reviews","woo-gutenberg-products-block"),value:e.reviewsOnLoadMore,onChange:e=>t({reviewsOnLoadMore:e}),max:20,min:1}))},118:function(e,t){},12:function(e,t){e.exports=window.wp.compose},124:function(e,t,r){"use strict";var o=r(0),n=r(4),c=r.n(n),a=r(30),i=r(12);r(163),t.a=Object(i.withInstanceId)(e=>{let{className:t,instanceId:r,label:n="",onChange:i,options:s,screenReaderLabel:l,value:d=""}=e;const u="wc-block-components-sort-select__select-"+r;return Object(o.createElement)("div",{className:c()("wc-block-sort-select","wc-block-components-sort-select",t)},Object(o.createElement)(a.a,{label:n,screenReaderLabel:l,wrapperElement:"label",wrapperProps:{className:"wc-block-sort-select__label wc-block-components-sort-select__label",htmlFor:u}}),Object(o.createElement)("select",{id:u,className:"wc-block-sort-select__select wc-block-components-sort-select__select",onChange:i,value:d},s&&s.map(e=>Object(o.createElement)("option",{key:e.key,value:e.key},e.label))))})},129:function(e,t,r){"use strict";r.d(t,"a",(function(){return c}));var o=r(1),n=r(20);const c={attributes:{editMode:!1,imageType:"reviewer",orderby:"most-recent",reviewsOnLoadMore:10,reviewsOnPageLoad:10,showLoadMore:!0,showOrderby:!0,showReviewDate:!0,showReviewerName:!0,showReviewImage:!0,showReviewRating:!0,showReviewContent:!0,previewReviews:[{id:1,date_created:"2019-07-15T17:05:04",formatted_date_created:Object(o.__)("July 15, 2019","woo-gutenberg-products-block"),date_created_gmt:"2019-07-15T15:05:04",product_id:0,product_name:Object(o.__)("WordPress Pennant","woo-gutenberg-products-block"),product_permalink:"#", +/* translators: An example person name used for the block previews. */ +reviewer:Object(o.__)("Alice","woo-gutenberg-products-block"),review:`

${Object(o.__)("I bought this product last week and I'm very happy with it.","woo-gutenberg-products-block")}

\n`,reviewer_avatar_urls:{48:n.o.defaultAvatar,96:n.o.defaultAvatar},rating:5,verified:!0},{id:2,date_created:"2019-07-12T12:39:39",formatted_date_created:Object(o.__)("July 12, 2019","woo-gutenberg-products-block"),date_created_gmt:"2019-07-12T10:39:39",product_id:0,product_name:Object(o.__)("WordPress Pennant","woo-gutenberg-products-block"),product_permalink:"#", +/* translators: An example person name used for the block previews. */ +reviewer:Object(o.__)("Bob","woo-gutenberg-products-block"),review:`

${Object(o.__)("This product is awesome, I love it!","woo-gutenberg-products-block")}

\n`,reviewer_avatar_urls:{48:n.o.defaultAvatar,96:n.o.defaultAvatar},rating:null,verified:!1}]}}},13:function(e,t){e.exports=window.React},15:function(e,t){e.exports=window.wp.apiFetch},151:function(e,t,r){"use strict";t.a={editMode:{type:"boolean",default:!0},imageType:{type:"string",default:"reviewer"},orderby:{type:"string",default:"most-recent"},reviewsOnLoadMore:{type:"number",default:10},reviewsOnPageLoad:{type:"number",default:10},showLoadMore:{type:"boolean",default:!0},showOrderby:{type:"boolean",default:!0},showReviewDate:{type:"boolean",default:!0},showReviewerName:{type:"boolean",default:!0},showReviewImage:{type:"boolean",default:!0},showReviewRating:{type:"boolean",default:!0},showReviewContent:{type:"boolean",default:!0},previewReviews:{type:"array",default:null}}},152:function(e,t,r){"use strict";var o=r(6),n=r.n(o),c=r(0),a=r(5),i=(r(164),r(59));t.a=e=>{let{attributes:t}=e;return Object(c.createElement)("div",n()({},a.useBlockProps.save({className:Object(i.a)(t)}),Object(i.b)(t)))}},155:function(e,t,r){"use strict";var o=r(0),n=r(1),c=r(8),a=r(3),i=r(5),s=r(13),l=r(2),d=r(73),u=r(30);r(192);var b=e=>{let{onClick:t,label:r=Object(n.__)("Load more","woo-gutenberg-products-block"),screenReaderLabel:c=Object(n.__)("Load more","woo-gutenberg-products-block")}=e;return Object(o.createElement)("div",{className:"wp-block-button wc-block-load-more wc-block-components-load-more"},Object(o.createElement)("button",{className:"wp-block-button__link",onClick:t},Object(o.createElement)(u.a,{label:r,screenReaderLabel:c})))},w=r(124);r(189);var p=e=>{let{onChange:t,readOnly:r,value:c}=e;return Object(o.createElement)(w.a,{className:"wc-block-review-sort-select wc-block-components-review-sort-select",label:Object(n.__)("Order by","woo-gutenberg-products-block"),onChange:t,options:[{key:"most-recent",label:Object(n.__)("Most recent","woo-gutenberg-products-block")},{key:"highest-rating",label:Object(n.__)("Highest rating","woo-gutenberg-products-block")},{key:"lowest-rating",label:Object(n.__)("Lowest rating","woo-gutenberg-products-block")}],readOnly:r,screenReaderLabel:Object(n.__)("Order reviews by","woo-gutenberg-products-block"),value:c})},m=r(4),g=r.n(m),h=r(23),v=r.n(h),_=r(178),O=r.n(_);const j=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"...";const o=O()(e,{suffix:r,limit:t});return o.html},f=(e,t,r)=>(t<=r?e.start=e.middle+1:e.end=e.middle-1,e),k=(e,t,r,o)=>{const n=((e,t,r)=>{let o={start:0,middle:0,end:e.length};for(;o.start<=o.end;)o.middle=Math.floor((o.start+o.end)/2),t.innerHTML=j(e,o.middle),o=f(o,t.clientHeight,r);return o.middle})(e,t,r);return j(e,n-o.length,o)},y={className:"read-more-content",ellipsis:"…",lessText:Object(n.__)("Read less","woo-gutenberg-products-block"),maxLines:3,moreText:Object(n.__)("Read more","woo-gutenberg-products-block")};class R extends s.Component{constructor(e){super(e),this.state={isExpanded:!1,clampEnabled:null,content:e.children,summary:"."},this.reviewContent=Object(s.createRef)(),this.reviewSummary=Object(s.createRef)(),this.getButton=this.getButton.bind(this),this.onClick=this.onClick.bind(this)}componentDidMount(){this.setSummary()}componentDidUpdate(e){e.maxLines===this.props.maxLines&&e.children===this.props.children||this.setState({clampEnabled:null,summary:"."},this.setSummary)}setSummary(){if(this.props.children){const{maxLines:e,ellipsis:t}=this.props;if(!this.reviewSummary.current||!this.reviewContent.current)return;const r=(this.reviewSummary.current.clientHeight+1)*e+1,o=this.reviewContent.current.clientHeight+1>r;this.setState({clampEnabled:o}),o&&this.setState({summary:k(this.reviewContent.current.innerHTML,this.reviewSummary.current,r,t)})}}getButton(){const{isExpanded:e}=this.state,{className:t,lessText:r,moreText:n}=this.props,c=e?r:n;if(c)return Object(o.createElement)("a",{href:"#more",className:t+"__read_more",onClick:this.onClick,"aria-expanded":!e,role:"button"},c)}onClick(e){e.preventDefault();const{isExpanded:t}=this.state;this.setState({isExpanded:!t})}render(){const{className:e}=this.props,{content:t,summary:r,clampEnabled:n,isExpanded:c}=this.state;return t?!1===n?Object(o.createElement)("div",{className:e},Object(o.createElement)("div",{ref:this.reviewContent},t)):Object(o.createElement)("div",{className:e},(!c||null===n)&&Object(o.createElement)("div",{ref:this.reviewSummary,"aria-hidden":c,dangerouslySetInnerHTML:{__html:r}}),(c||null===n)&&Object(o.createElement)("div",{ref:this.reviewContent,"aria-hidden":!c},t),this.getButton()):null}}v()(R,"defaultProps",y);var E=R;r(191);var S=e=>{let{attributes:t,review:r={}}=e;const{imageType:c,showReviewDate:a,showReviewerName:i,showReviewImage:s,showReviewRating:l,showReviewContent:d,showProductName:u}=t,{rating:b}=r,w=!(Object.keys(r).length>0),p=Number.isFinite(b)&&l;return Object(o.createElement)("li",{className:g()("wc-block-review-list-item__item","wc-block-components-review-list-item__item",{"is-loading":w,"wc-block-components-review-list-item__item--has-image":s}),"aria-hidden":w},(u||a||i||s||p)&&Object(o.createElement)("div",{className:"wc-block-review-list-item__info wc-block-components-review-list-item__info"},s&&function(e,t,r){var c,a;return r||!e?Object(o.createElement)("div",{className:"wc-block-review-list-item__image wc-block-components-review-list-item__image"}):Object(o.createElement)("div",{className:"wc-block-review-list-item__image wc-block-components-review-list-item__image"},"product"===t?Object(o.createElement)("img",{"aria-hidden":"true",alt:(null===(c=e.product_image)||void 0===c?void 0:c.alt)||"",src:(null===(a=e.product_image)||void 0===a?void 0:a.thumbnail)||""}):Object(o.createElement)("img",{"aria-hidden":"true",alt:"",src:e.reviewer_avatar_urls[96]||""}),e.verified&&Object(o.createElement)("div",{className:"wc-block-review-list-item__verified wc-block-components-review-list-item__verified",title:Object(n.__)("Verified buyer","woo-gutenberg-products-block")},Object(n.__)("Verified buyer","woo-gutenberg-products-block")))}(r,c,w),(u||i||p||a)&&Object(o.createElement)("div",{className:"wc-block-review-list-item__meta wc-block-components-review-list-item__meta"},p&&function(e){const{rating:t}=e,r={width:t/5*100+"%"},c=Object(n.sprintf)( +/* translators: %f is referring to the average rating value */ +Object(n.__)("Rated %f out of 5","woo-gutenberg-products-block"),t),a={__html:Object(n.sprintf)( +/* translators: %s is referring to the average rating value */ +Object(n.__)("Rated %s out of 5","woo-gutenberg-products-block"),Object(n.sprintf)('%f',t))};return Object(o.createElement)("div",{className:"wc-block-review-list-item__rating wc-block-components-review-list-item__rating"},Object(o.createElement)("div",{className:"wc-block-review-list-item__rating__stars wc-block-components-review-list-item__rating__stars",role:"img","aria-label":c},Object(o.createElement)("span",{style:r,dangerouslySetInnerHTML:a})))}(r),u&&function(e){return Object(o.createElement)("div",{className:"wc-block-review-list-item__product wc-block-components-review-list-item__product"},Object(o.createElement)("a",{href:e.product_permalink,dangerouslySetInnerHTML:{__html:e.product_name}}))}(r),i&&function(e){const{reviewer:t=""}=e;return Object(o.createElement)("div",{className:"wc-block-review-list-item__author wc-block-components-review-list-item__author"},t)}(r),a&&function(e){const{date_created:t,formatted_date_created:r}=e;return Object(o.createElement)("time",{className:"wc-block-review-list-item__published-date wc-block-components-review-list-item__published-date",dateTime:t},r)}(r))),d&&function(e){return Object(o.createElement)(E,{maxLines:10,moreText:Object(n.__)("Read full review","woo-gutenberg-products-block"),lessText:Object(n.__)("Hide full review","woo-gutenberg-products-block"),className:"wc-block-review-list-item__text wc-block-components-review-list-item__text"},Object(o.createElement)("div",{dangerouslySetInnerHTML:{__html:e.review||""}}))}(r))};r(190);var C=e=>{let{attributes:t,reviews:r}=e;const n=Object(l.getSetting)("showAvatars",!0),c=Object(l.getSetting)("reviewRatingsEnabled",!0),a=(n||"product"===t.imageType)&&t.showReviewImage,i=c&&t.showReviewRating,s={...t,showReviewImage:a,showReviewRating:i};return Object(o.createElement)("ul",{className:"wc-block-review-list wc-block-components-review-list"},0===r.length?Object(o.createElement)(S,{attributes:s}):r.map((e,t)=>Object(o.createElement)(S,{key:e.id||t,attributes:s,review:e})))},T=r(6),P=r.n(T),N=r(25),L=r.n(N),x=r(59),A=r(29);class M extends s.Component{render(){const{attributes:e,error:t,isLoading:r,noReviewsPlaceholder:c,reviews:i,totalReviews:s}=this.props;if(t)return Object(o.createElement)(d.a,{className:"wc-block-featured-product-error",error:t,isLoading:r});if(0===i.length&&!r)return Object(o.createElement)(c,{attributes:e});const u=Object(l.getSetting)("reviewRatingsEnabled",!0);return Object(o.createElement)(a.Disabled,null,e.showOrderby&&u&&Object(o.createElement)(p,{readOnly:!0,value:e.orderby,onChange:()=>null}),Object(o.createElement)(C,{attributes:e,reviews:i}),e.showLoadMore&&s>i.length&&Object(o.createElement)(b,{screenReaderLabel:Object(n.__)("Load more reviews","woo-gutenberg-products-block")}))}}var I=(e=>{class t extends s.Component{constructor(){super(...arguments),v()(this,"isPreview",!!this.props.attributes.previewReviews),v()(this,"delayedAppendReviews",this.props.delayFunction(this.appendReviews)),v()(this,"isMounted",!1),v()(this,"state",{error:null,loading:!0,reviews:this.isPreview?this.props.attributes.previewReviews:[],totalReviews:this.isPreview?this.props.attributes.previewReviews.length:0}),v()(this,"setError",async e=>{if(!this.isMounted)return;const{onReviewsLoadError:t}=this.props,r=await Object(A.a)(e);this.setState({reviews:[],loading:!1,error:r}),t(r)})}componentDidMount(){this.isMounted=!0,this.replaceReviews()}componentDidUpdate(e){e.reviewsToDisplay0&&void 0!==arguments[0]?arguments[0]:[];const{reviewsToDisplay:t}=this.props,{totalReviews:r}=this.state,o=Math.min(r,t)-e.length;return this.setState({loading:!0,reviews:e.concat(Array(o).fill({}))}),Object(x.c)(this.getArgs(e.length)).then(t=>{let{reviews:r,totalReviews:o}=t;return this.isMounted&&this.setState({reviews:e.filter(e=>Object.keys(e).length).concat(r),totalReviews:o,loading:!1,error:null}),{newReviews:r}}).catch(this.setError)}render(){const{reviewsToDisplay:t}=this.props,{error:r,loading:n,reviews:c,totalReviews:a}=this.state;return Object(o.createElement)(e,P()({},this.props,{error:r,isLoading:n,reviews:c.slice(0,t),totalReviews:a}))}}v()(t,"defaultProps",{delayFunction:e=>e,onReviewsAppended:()=>{},onReviewsLoadError:()=>{},onReviewsReplaced:()=>{}});const{displayName:r=e.name||"Component"}=e;return t.displayName=`WithReviews( ${r} )`,t})(M);t.a=e=>{let{attributes:t,icon:r,name:s,noReviewsPlaceholder:l}=e;const{categoryIds:d,productId:u,reviewsOnPageLoad:b,showProductName:w,showReviewDate:p,showReviewerName:m,showReviewContent:g,showReviewImage:h,showReviewRating:v}=t,{order:_,orderby:O}=Object(x.d)(t.orderby),j=!(g||v||p||m||h||w),f=Object(i.useBlockProps)({className:Object(x.a)(t)});return j?Object(o.createElement)(a.Placeholder,{icon:r,label:s},Object(n.__)("The content for this block is hidden due to block settings.","woo-gutenberg-products-block")):Object(o.createElement)("div",f,Object(o.createElement)(I,{attributes:t,categoryIds:d,delayFunction:e=>Object(c.debounce)(e,400),noReviewsPlaceholder:l,orderby:O,order:_,productId:u,reviewsToDisplay:b}))}},163:function(e,t){},164:function(e,t){},189:function(e,t){},190:function(e,t){},191:function(e,t){},192:function(e,t){},2:function(e,t){e.exports=window.wc.wcSettings},20: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 d})),r.d(t,"g",(function(){return u})),r.d(t,"k",(function(){return b})),r.d(t,"c",(function(){return w})),r.d(t,"d",(function(){return p})),r.d(t,"h",(function(){return m})),r.d(t,"a",(function(){return g})),r.d(t,"i",(function(){return h})),r.d(t,"b",(function(){return v})),r.d(t,"f",(function(){return _}));var o,n=r(2);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,d=n.STORE_PAGES.checkout.id,u=(n.STORE_PAGES.checkout.permalink,n.STORE_PAGES.privacy.permalink),b=(n.STORE_PAGES.privacy.title,n.STORE_PAGES.terms.permalink),w=(n.STORE_PAGES.terms.title,n.STORE_PAGES.cart.id),p=n.STORE_PAGES.cart.permalink,m=(n.STORE_PAGES.myaccount.permalink?n.STORE_PAGES.myaccount.permalink:Object(n.getSetting)("wpLoginUrl","/wp-login.php"),Object(n.getSetting)("shippingCountries",{})),g=Object(n.getSetting)("allowedCountries",{}),h=Object(n.getSetting)("shippingStates",{}),v=Object(n.getSetting)("allowedStates",{}),_=Object(n.getSetting)("localPickupEnabled",!1)},25:function(e,t){e.exports=window.wp.isShallowEqual},29:function(e,t,r){"use strict";r.d(t,"a",(function(){return o}));const o=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"}}},3:function(e,t){e.exports=window.wp.components},30:function(e,t,r){"use strict";var o=r(0),n=r(4),c=r.n(n);t.a=e=>{let t,{label:r,screenReaderLabel:n,wrapperElement:a,wrapperProps:i={}}=e;const s=null!=r,l=null!=n;return!s&&l?(t=a||"span",i={...i,className:c()(i.className,"screen-reader-text")},Object(o.createElement)(t,i,n)):(t=a||o.Fragment,s&&l&&r!==n?Object(o.createElement)(t,i,Object(o.createElement)("span",{"aria-hidden":"true"},r),Object(o.createElement)("span",{className:"screen-reader-text"},n)):Object(o.createElement)(t,i,r))}},34:function(e,t,r){"use strict";var o=r(0),n=r(1),c=r(35);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","woo-gutenberg-products-block"),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","woo-gutenberg-products-block"),Object(o.createElement)("br",null),Object(o.createElement)("code",null,Object(c.escapeHTML)(t))):t:Object(n.__)("An error has prevented the block from being updated.","woo-gutenberg-products-block")})(t))}},35:function(e,t){e.exports=window.wp.escapeHtml},380:function(e,t,r){e.exports=r(505)},5:function(e,t){e.exports=window.wp.blockEditor},505:function(e,t,r){"use strict";r.r(t);var o=r(0),n=r(1),c=r(9),a=r(80),i=r(549),s=(r(164),r(5)),l=r(3),d=r(155),u=()=>Object(o.createElement)(l.Placeholder,{className:"wc-block-all-reviews",icon:Object(o.createElement)(a.a,{icon:i.a,className:"block-editor-block-icon"}),label:Object(n.__)("All Reviews","woo-gutenberg-products-block")},Object(n.__)("This block shows a list of all product reviews. Your store does not have any reviews yet, but they will show up here when it does.","woo-gutenberg-products-block")),b=r(110),w=r(151),p=r(152),m=r(129);Object(c.registerBlockType)("woocommerce/all-reviews",{apiVersion:2,title:Object(n.__)("All Reviews","woo-gutenberg-products-block"),icon:{src:Object(o.createElement)(a.a,{icon:i.a,className:"wc-block-editor-components-block-icon"})},category:"woocommerce",keywords:[Object(n.__)("WooCommerce","woo-gutenberg-products-block")],description:Object(n.__)("Show a list of all product reviews.","woo-gutenberg-products-block"),supports:{html:!1,color:{background:!1},typography:{fontSize:!0}},example:{...m.a,attributes:{...m.a.attributes,showProductName:!0}},attributes:{...w.a,showProductName:{type:"boolean",default:!0}},transforms:{from:[{type:"block",blocks:["core/legacy-widget"],isMatch:e=>{let{idBase:t,instance:r}=e;return"woocommerce_recent_reviews"===t&&!(null==r||!r.raw)},transform:e=>{let{instance:t}=e;return Object(c.createBlock)("woocommerce/all-reviews",{reviewsOnPageLoad:t.raw.number,imageType:"product",showLoadMore:!1,showOrderby:!1,showReviewDate:!1,showReviewContent:!1})}}]},edit:e=>{let{attributes:t,setAttributes:r}=e;return Object(o.createElement)(o.Fragment,null,Object(o.createElement)(s.InspectorControls,{key:"inspector"},Object(o.createElement)(l.PanelBody,{title:Object(n.__)("Content","woo-gutenberg-products-block")},Object(o.createElement)(l.ToggleControl,{label:Object(n.__)("Product name","woo-gutenberg-products-block"),checked:t.showProductName,onChange:()=>r({showProductName:!t.showProductName})}),Object(b.b)(t,r)),Object(o.createElement)(l.PanelBody,{title:Object(n.__)("List Settings","woo-gutenberg-products-block")},Object(b.c)(t,r))),Object(o.createElement)(d.a,{attributes:t,icon:Object(o.createElement)(a.a,{icon:i.a,className:"block-editor-block-icon"}),name:Object(n.__)("All Reviews","woo-gutenberg-products-block"),noReviewsPlaceholder:u}))},save:p.a})},59:function(e,t,r){"use strict";r.d(t,"d",(function(){return s})),r.d(t,"c",(function(){return l})),r.d(t,"a",(function(){return d})),r.d(t,"b",(function(){return u}));var o=r(15),n=r.n(o),c=r(4),a=r.n(c),i=r(2);const s=e=>{if(Object(i.getSetting)("reviewRatingsEnabled",!0)){if("lowest-rating"===e)return{order:"asc",orderby:"rating"};if("highest-rating"===e)return{order:"desc",orderby:"rating"}}return{order:"desc",orderby:"date_gmt"}},l=e=>n()({path:"/wc/store/v1/products/reviews?"+Object.entries(e).map(e=>e.join("=")).join("&"),parse:!1}).then(e=>e.json().then(t=>({reviews:t,totalReviews:parseInt(e.headers.get("x-wp-total"),10)}))),d=e=>{const{className:t,categoryIds:r,productId:o,showReviewDate:n,showReviewerName:c,showReviewContent:i,showProductName:s,showReviewImage:l,showReviewRating:d}=e;let u="wc-block-all-reviews";return o&&(u="wc-block-reviews-by-product"),Array.isArray(r)&&(u="wc-block-reviews-by-category"),a()(u,t,{"has-image":l,"has-name":c,"has-date":n,"has-rating":d,"has-content":i,"has-product-name":s})},u=e=>{const{categoryIds:t,imageType:r,orderby:o,productId:n,reviewsOnPageLoad:c,reviewsOnLoadMore:a,showLoadMore:i,showOrderby:s}=e,l={"data-image-type":r,"data-orderby":o,"data-reviews-on-page-load":c,"data-reviews-on-load-more":a,"data-show-load-more":i,"data-show-orderby":s};return n&&(l["data-product-id"]=n),Array.isArray(t)&&(l["data-category-ids"]=t.join(",")),l}},73:function(e,t,r){"use strict";var o=r(0),n=r(1),c=r(80),a=r(181),i=r(4),s=r.n(i),l=r(3),d=r(34);r(118),t.a=e=>{let{className:t,error:r,isLoading:i=!1,onRetry:u}=e;return Object(o.createElement)(l.Placeholder,{icon:Object(o.createElement)(c.a,{icon:a.a}),label:Object(n.__)("Sorry, an error occurred","woo-gutenberg-products-block"),className:s()("wc-block-api-error",t)},Object(o.createElement)(d.a,{error:r}),u&&Object(o.createElement)(o.Fragment,null,i?Object(o.createElement)(l.Spinner,null):Object(o.createElement)(l.Button,{isSecondary:!0,onClick:u},Object(n.__)("Retry","woo-gutenberg-products-block"))))}},8:function(e,t){e.exports=window.lodash},9:function(e,t){e.exports=window.wp.blocks}}); \ No newline at end of file diff --git a/build/attribute-filter-frontend.asset.php b/build/attribute-filter-frontend.asset.php new file mode 100644 index 00000000000..eccab48de57 --- /dev/null +++ b/build/attribute-filter-frontend.asset.php @@ -0,0 +1 @@ + array('lodash', 'react', 'wc-blocks-checkout', 'wc-blocks-data-store', 'wc-settings', 'wp-a11y', 'wp-block-editor', 'wp-blocks', 'wp-compose', 'wp-data', 'wp-deprecated', 'wp-dom', 'wp-element', 'wp-html-entities', 'wp-i18n', 'wp-is-shallow-equal', 'wp-keycodes', 'wp-polyfill', 'wp-primitives', 'wp-url', 'wp-warning'), 'version' => 'cd2c66b56351eaf80e2daa5ab4765e75'); \ No newline at end of file diff --git a/build/attribute-filter-frontend.js b/build/attribute-filter-frontend.js new file mode 100644 index 00000000000..fff404f2150 --- /dev/null +++ b/build/attribute-filter-frontend.js @@ -0,0 +1,25 @@ +!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=241)}([function(e,t){e.exports=window.wp.element},function(e,t){e.exports=window.wp.i18n},function(e,t){e.exports=window.wc.wcSettings},function(e,t){e.exports=window.wc.wcBlocksData},,function(e,t){e.exports=window.lodash},function(e,t,n){var r;!function(){"use strict";var n={}.hasOwnProperty;function o(){for(var e=[],t=0;t{let{imageUrl:t=a.m+"/block-error.svg",header:n=Object(c.__)("Oops!","woo-gutenberg-products-block"),text:r=Object(c.__)("There was an error loading the content.","woo-gutenberg-products-block"),errorMessage:o,errorMessagePrefix:i=Object(c.__)("Error:","woo-gutenberg-products-block"),button:l,showErrorBlock:u=!0}=e;return u?Object(s.createElement)("div",{className:"wc-block-error wc-block-components-error"},t&&Object(s.createElement)("img",{className:"wc-block-error__image wc-block-components-error__image",src:t,alt:""}),Object(s.createElement)("div",{className:"wc-block-error__content wc-block-components-error__content"},n&&Object(s.createElement)("p",{className:"wc-block-error__header wc-block-components-error__header"},n),r&&Object(s.createElement)("p",{className:"wc-block-error__text wc-block-components-error__text"},r),o&&Object(s.createElement)("p",{className:"wc-block-error__message wc-block-components-error__message"},i?i+" ":"",o),l&&Object(s.createElement)("p",{className:"wc-block-error__button wc-block-components-error__button"},l))):null};n(40);class u extends i.Component{constructor(){super(...arguments),o()(this,"state",{errorMessage:"",hasError:!1})}static getDerivedStateFromError(e){return void 0!==e.statusText&&void 0!==e.status?{errorMessage:Object(s.createElement)(s.Fragment,null,Object(s.createElement)("strong",null,e.status),": ",e.statusText),hasError:!0}:{errorMessage:e.message,hasError:!0}}render(){const{header:e,imageUrl:t,showErrorMessage:n=!0,showErrorBlock:r=!0,text:o,errorMessagePrefix:i,renderError:c,button:a}=this.props,{errorMessage:u,hasError:d}=this.state;return d?"function"==typeof c?c({errorMessage:u}):Object(s.createElement)(l,{showErrorBlock:r,errorMessage:n?u:null,header:e,imageUrl:t,text:o,errorMessagePrefix:i,button:a}):this.props.children}}t.a=u},function(e,t,n){var r=n(38);e.exports=function(e,t,n){return(t=r(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e},e.exports.__esModule=!0,e.exports.default=e.exports},,,function(e,t,n){"use strict";n.d(t,"a",(function(){return r})),n.d(t,"b",(function(){return o}));const r=e=>!(e=>null===e)(e)&&e instanceof Object&&e.constructor===Object;function o(e,t){return r(e)&&t in e}},function(e,t,n){"use strict";var r=n(0),o=n(6),s=n.n(o);t.a=e=>{let t,{label:n,screenReaderLabel:o,wrapperElement:i,wrapperProps:c={}}=e;const a=null!=n,l=null!=o;return!a&&l?(t=i||"span",c={...c,className:s()(c.className,"screen-reader-text")},Object(r.createElement)(t,c,o)):(t=i||r.Fragment,a&&l&&n!==o?Object(r.createElement)(t,c,Object(r.createElement)("span",{"aria-hidden":"true"},n),Object(r.createElement)("span",{className:"screen-reader-text"},o)):Object(r.createElement)(t,c,n))}},function(e,t){e.exports=window.wp.deprecated},function(e,t,n){"use strict";n.d(t,"a",(function(){return r}));const r=e=>"string"==typeof e},function(e,t){e.exports=window.wp.keycodes},function(e,t,n){"use strict";n.d(t,"a",(function(){return s}));var r=n(0);const o=Object(r.createContext)("page"),s=()=>Object(r.useContext)(o);o.Provider},,function(e,t){function n(t){return e.exports=n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,n(t)}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t){e.exports=window.wp.a11y},,function(e,t,n){"use strict";n.d(t,"a",(function(){return i}));var r=n(0),o=n(13),s=n.n(o);function i(e){const t=Object(r.useRef)(e);return s()(e,t.current)||(t.current=e),t.current}},function(e,t){e.exports=window.wp.htmlEntities},function(e,t,n){"use strict";n.d(t,"a",(function(){return d})),n.d(t,"b",(function(){return p})),n.d(t,"c",(function(){return f}));var r=n(3),o=n(7),s=n(0),i=n(13),c=n.n(i),a=n(30),l=n(64),u=n(25);const d=e=>{const t=Object(u.a)();e=e||t;const n=Object(o.useSelect)(t=>t(r.QUERY_STATE_STORE_KEY).getValueForQueryContext(e,void 0),[e]),{setValueForQueryContext:i}=Object(o.useDispatch)(r.QUERY_STATE_STORE_KEY);return[n,Object(s.useCallback)(t=>{i(e,t)},[e,i])]},p=(e,t,n)=>{const i=Object(u.a)();n=n||i;const c=Object(o.useSelect)(o=>o(r.QUERY_STATE_STORE_KEY).getValueForQueryKey(n,e,t),[n,e]),{setQueryValue:a}=Object(o.useDispatch)(r.QUERY_STATE_STORE_KEY);return[c,Object(s.useCallback)(t=>{a(n,e,t)},[n,e,a])]},f=(e,t)=>{const n=Object(u.a)();t=t||n;const[r,o]=d(t),i=Object(a.a)(r),p=Object(a.a)(e),f=Object(l.a)(p),b=Object(s.useRef)(!1);return Object(s.useEffect)(()=>{c()(f,p)||(o(Object.assign({},i,p)),b.current=!0)},[i,p,f,o]),b.current?[r,o]:[e,o]}},function(e,t,n){"use strict";(function(e){var r=n(0);n(48);const o=Object(r.createContext)({slots:{},fills:{},registerSlot:()=>{void 0!==e&&e.env},updateSlot:()=>{},unregisterSlot:()=>{},registerFill:()=>{},unregisterFill:()=>{}});t.a=o}).call(this,n(105))},,,,function(e,t,n){"use strict";n.d(t,"o",(function(){return s})),n.d(t,"m",(function(){return i})),n.d(t,"l",(function(){return c})),n.d(t,"n",(function(){return a})),n.d(t,"j",(function(){return l})),n.d(t,"d",(function(){return u})),n.d(t,"g",(function(){return d})),n.d(t,"k",(function(){return p})),n.d(t,"c",(function(){return f})),n.d(t,"f",(function(){return b})),n.d(t,"h",(function(){return m})),n.d(t,"a",(function(){return h})),n.d(t,"i",(function(){return g})),n.d(t,"b",(function(){return O})),n.d(t,"e",(function(){return v}));var r,o=n(2);const s=Object(o.getSetting)("wcBlocksConfig",{buildPhase:1,pluginUrl:"",productCount:0,defaultAvatar:"",restApiRoutes:{},wordCountType:"words"}),i=s.pluginUrl+"images/",c=s.pluginUrl+"build/",a=s.buildPhase,l=null===(r=o.STORE_PAGES.shop)||void 0===r?void 0:r.permalink,u=(o.STORE_PAGES.checkout.id,o.STORE_PAGES.checkout.permalink),d=o.STORE_PAGES.privacy.permalink,p=(o.STORE_PAGES.privacy.title,o.STORE_PAGES.terms.permalink),f=(o.STORE_PAGES.terms.title,o.STORE_PAGES.cart.id,o.STORE_PAGES.cart.permalink),b=o.STORE_PAGES.myaccount.permalink?o.STORE_PAGES.myaccount.permalink:Object(o.getSetting)("wpLoginUrl","/wp-login.php"),m=Object(o.getSetting)("shippingCountries",{}),h=Object(o.getSetting)("allowedCountries",{}),g=Object(o.getSetting)("shippingStates",{}),O=Object(o.getSetting)("allowedStates",{}),v=Object(o.getSetting)("localPickupEnabled",!1)},function(e,t,n){var r=n(27).default,o=n(39);e.exports=function(e){var t=o(e,"string");return"symbol"===r(t)?t:String(t)},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t,n){var r=n(27).default;e.exports=function(e,t){if("object"!==r(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t||"default");if("object"!==r(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t){},function(e,t,n){"use strict";var r=n(6),o=n.n(r),s=n(0);t.a=Object(s.forwardRef)((function({as:e="div",className:t,...n},r){return function({as:e="div",...t}){return"function"==typeof t.children?t.children(t):Object(s.createElement)(e,t)}({as:e,className:o()("components-visually-hidden",t),...n,ref:r})}))},,,,,function(e,t,n){"use strict";n.d(t,"a",(function(){return o})),n.d(t,"b",(function(){return s}));var r=n(0);const o=Object(r.createContext)({}),s=()=>{const{wrapper:e}=Object(r.useContext)(o);return t=>{e&&e.current&&(e.current.hidden=!t)}}},,function(e,t){e.exports=window.wp.warning},function(e,t){e.exports=window.wp.dom},function(e,t,n){"use strict";n.d(t,"a",(function(){return l}));var r=n(15),o=n.n(r),s=n(0),i=n(16);const c=[".wp-block-woocommerce-cart"],a=e=>{let{Block:t,containers:n,getProps:r=(()=>({})),getErrorBoundaryProps:c=(()=>({}))}=e;0!==n.length&&Array.prototype.forEach.call(n,(e,n)=>{const a=r(e,n),l=c(e,n),u={...e.dataset,...a.attributes||{}};(e=>{let{Block:t,container:n,attributes:r={},props:c={},errorBoundaryProps:a={}}=e;Object(s.render)(Object(s.createElement)(i.a,a,Object(s.createElement)(s.Suspense,{fallback:Object(s.createElement)("div",{className:"wc-block-placeholder"})},t&&Object(s.createElement)(t,o()({},c,{attributes:r})))),n,()=>{n.classList&&n.classList.remove("is-loading")})})({Block:t,container:e,props:a,attributes:u,errorBoundaryProps:l})})},l=e=>{const t=document.body.querySelectorAll(c.join(",")),{Block:n,getProps:r,getErrorBoundaryProps:o,selector:s}=e;(e=>{let{Block:t,getProps:n,getErrorBoundaryProps:r,selector:o,wrappers:s}=e;const i=document.body.querySelectorAll(o);s&&s.length>0&&Array.prototype.filter.call(i,e=>!((e,t)=>Array.prototype.some.call(t,t=>t.contains(e)&&!t.isSameNode(e)))(e,s)),a({Block:t,containers:i,getProps:n,getErrorBoundaryProps:r})})({Block:n,getProps:r,getErrorBoundaryProps:o,selector:s,wrappers:t}),Array.prototype.forEach.call(t,t=>{t.addEventListener("wc-blocks_render_blocks_frontend",()=>{(e=>{let{Block:t,getProps:n,getErrorBoundaryProps:r,selector:o,wrapper:s}=e;const i=s.querySelectorAll(o);a({Block:t,containers:i,getProps:n,getErrorBoundaryProps:r})})({...e,wrapper:t})})})}},,,function(e,t){e.exports=window.wp.blocks},function(e,t,n){"use strict";var r=n(10),o=n(0),s=n(12),i=function({icon:e,className:t,...n}){const s=["dashicon","dashicons","dashicons-"+e,t].filter(Boolean).join(" ");return Object(o.createElement)("span",Object(r.a)({className:s},n))};t.a=function({icon:e=null,size:t=24,...n}){if("string"==typeof e)return Object(o.createElement)(i,Object(r.a)({icon:e},n));if(Object(o.isValidElement)(e)&&i===e.type)return Object(o.cloneElement)(e,{...n});if("function"==typeof e)return e.prototype instanceof o.Component?Object(o.createElement)(e,{size:t,...n}):e({size:t,...n});if(e&&("svg"===e.type||e.type===s.SVG)){const r={width:t,height:t,...e.props,...n};return Object(o.createElement)(s.SVG,r)}return Object(o.isValidElement)(e)?Object(o.cloneElement)(e,{size:t,...n}):e}},function(e,t,n){"use strict";var r=n(10),o=n(0),s=n(6),i=n.n(s),c=n(5),a=n(22),l=n.n(a),u=n(9),d=n(49),p=n(125),f=n(1);function b(e,t,n){const{defaultView:r}=t,{frameElement:o}=r;if(!o||t===n.ownerDocument)return e;const s=o.getBoundingClientRect();return new r.DOMRect(e.left+s.left,e.top+s.top,e.width,e.height)}let m=0;function h(e){const t=document.scrollingElement||document.body;e&&(m=t.scrollTop);const n=e?"add":"remove";t.classList[n]("lockscroll"),document.documentElement.classList[n]("lockscroll"),e||(t.scrollTop=m)}let g=0;function O(){return Object(o.useEffect)(()=>(0===g&&h(!0),++g,()=>{1===g&&h(!1),--g}),[]),null}var v=n(33);function j(e){const t=Object(o.useContext)(v.a),n=t.slots[e]||{},r=t.fills[e],s=Object(o.useMemo)(()=>r||[],[r]);return{...n,updateSlot:Object(o.useCallback)(n=>{t.updateSlot(e,n)},[e,t.updateSlot]),unregisterSlot:Object(o.useCallback)(n=>{t.unregisterSlot(e,n)},[e,t.unregisterSlot]),fills:s,registerFill:Object(o.useCallback)(n=>{t.registerFill(e,n)},[e,t.registerFill]),unregisterFill:Object(o.useCallback)(n=>{t.unregisterFill(e,n)},[e,t.unregisterFill])}}var w=Object(o.createContext)({registerSlot:()=>{},unregisterSlot:()=>{},registerFill:()=>{},unregisterFill:()=>{},getSlot:()=>{},getFills:()=>{},subscribe:()=>{}});function y({name:e,children:t,registerFill:n,unregisterFill:r}){const s=(e=>{const{getSlot:t,subscribe:n}=Object(o.useContext)(w),[r,s]=Object(o.useState)(t(e));return Object(o.useEffect)(()=>(s(t(e)),n(()=>{s(t(e))})),[e]),r})(e),i=Object(o.useRef)({name:e,children:t});return Object(o.useLayoutEffect)(()=>(n(e,i.current),()=>r(e,i.current)),[]),Object(o.useLayoutEffect)(()=>{i.current.children=t,s&&s.forceUpdate()},[t]),Object(o.useLayoutEffect)(()=>{e!==i.current.name&&(r(i.current.name,i.current),i.current.name=e,n(e,i.current))},[e]),s&&s.node?(Object(c.isFunction)(t)&&(t=t(s.props.fillProps)),Object(o.createPortal)(t,s.node)):null}var E=e=>Object(o.createElement)(w.Consumer,null,({registerFill:t,unregisterFill:n})=>Object(o.createElement)(y,Object(r.a)({},e,{registerFill:t,unregisterFill:n})));class k extends o.Component{constructor(){super(...arguments),this.isUnmounted=!1,this.bindNode=this.bindNode.bind(this)}componentDidMount(){const{registerSlot:e}=this.props;e(this.props.name,this)}componentWillUnmount(){const{unregisterSlot:e}=this.props;this.isUnmounted=!0,e(this.props.name,this)}componentDidUpdate(e){const{name:t,unregisterSlot:n,registerSlot:r}=this.props;e.name!==t&&(n(e.name),r(t,this))}bindNode(e){this.node=e}forceUpdate(){this.isUnmounted||super.forceUpdate()}render(){const{children:e,name:t,fillProps:n={},getFills:r}=this.props,s=Object(c.map)(r(t,this),e=>{const t=Object(c.isFunction)(e.children)?e.children(n):e.children;return o.Children.map(t,(e,t)=>{if(!e||Object(c.isString)(e))return e;const n=e.key||t;return Object(o.cloneElement)(e,{key:n})})}).filter(Object(c.negate)(o.isEmptyElement));return Object(o.createElement)(o.Fragment,null,Object(c.isFunction)(e)?e(s):s)}}var _=e=>Object(o.createElement)(w.Consumer,null,({registerSlot:t,unregisterSlot:n,getFills:s})=>Object(o.createElement)(k,Object(r.a)({},e,{registerSlot:t,unregisterSlot:n,getFills:s})));function S(){const[,e]=Object(o.useState)({}),t=Object(o.useRef)(!0);return Object(o.useEffect)(()=>()=>{t.current=!1},[]),()=>{t.current&&e({})}}function x({name:e,children:t}){const n=j(e),r=Object(o.useRef)({rerender:S()});return Object(o.useEffect)(()=>(n.registerFill(r),()=>{n.unregisterFill(r)}),[n.registerFill,n.unregisterFill]),n.ref&&n.ref.current?("function"==typeof t&&(t=t(n.fillProps)),Object(o.createPortal)(t,n.ref.current)):null}var T=Object(o.forwardRef)((function({name:e,fillProps:t={},as:n="div",...s},i){const c=Object(o.useContext)(v.a),a=Object(o.useRef)();return Object(o.useLayoutEffect)(()=>(c.registerSlot(e,a,t),()=>{c.unregisterSlot(e,a)}),[c.registerSlot,c.unregisterSlot,e]),Object(o.useLayoutEffect)(()=>{c.updateSlot(e,t)}),Object(o.createElement)(n,Object(r.a)({ref:Object(u.useMergeRefs)([i,a])},s))}));function C(e){return Object(o.createElement)(o.Fragment,null,Object(o.createElement)(E,e),Object(o.createElement)(x,e))}n(13),o.Component;const L=Object(o.forwardRef)(({bubblesVirtually:e,...t},n)=>e?Object(o.createElement)(T,Object(r.a)({},t,{ref:n})):Object(o.createElement)(_,t));function I(e){return"appear"===e?"top":"left"}function A(e,t){const{paddingTop:n,paddingBottom:r,paddingLeft:o,paddingRight:s}=(i=t).ownerDocument.defaultView.getComputedStyle(i);var i;const c=n?parseInt(n,10):0,a=r?parseInt(r,10):0,l=o?parseInt(o,10):0,u=s?parseInt(s,10):0;return{x:e.left+l,y:e.top+c,width:e.width-l-u,height:e.height-c-a,left:e.left+l,right:e.right-u,top:e.top+c,bottom:e.bottom-a}}function R(e,t,n){n?e.getAttribute(t)!==n&&e.setAttribute(t,n):e.hasAttribute(t)&&e.removeAttribute(t)}function P(e,t,n=""){e.style[t]!==n&&(e.style[t]=n)}function F(e,t,n){n?e.classList.contains(t)||e.classList.add(t):e.classList.contains(t)&&e.classList.remove(t)}const N=Object(o.forwardRef)(({headerTitle:e,onClose:t,children:n,className:s,noArrow:c=!0,isAlternate:a,position:m="bottom right",range:h,focusOnMount:g="firstElement",anchorRef:v,shouldAnchorIncludePadding:w,anchorRect:y,getAnchorRect:E,expandOnMobile:k,animate:_=!0,onClickOutside:S,onFocusOutside:x,__unstableStickyBoundaryElement:T,__unstableSlotName:L="Popover",__unstableObserveElement:N,__unstableBoundaryParent:M,__unstableForcePosition:B,__unstableForceXAlignment:D,...V},W)=>{const H=Object(o.useRef)(null),q=Object(o.useRef)(null),U=Object(o.useRef)(),z=Object(u.useViewportMatch)("medium","<"),[K,$]=Object(o.useState)(),Q=j(L),Y=k&&z,[J,X]=Object(u.useResizeObserver)();c=Y||c,Object(o.useLayoutEffect)(()=>{if(Y)return F(U.current,"is-without-arrow",c),F(U.current,"is-alternate",a),R(U.current,"data-x-axis"),R(U.current,"data-y-axis"),P(U.current,"top"),P(U.current,"left"),P(q.current,"maxHeight"),void P(q.current,"maxWidth");const e=()=>{if(!U.current||!q.current)return;let e=function(e,t,n,r=!1,o,s){if(t)return t;if(n){if(!e.current)return;const t=n(e.current);return b(t,t.ownerDocument||e.current.ownerDocument,s)}if(!1!==r){if(!(r&&window.Range&&window.Element&&window.DOMRect))return;if("function"==typeof(null==r?void 0:r.cloneRange))return b(Object(d.getRectangleFromRange)(r),r.endContainer.ownerDocument,s);if("function"==typeof(null==r?void 0:r.getBoundingClientRect)){const e=b(r.getBoundingClientRect(),r.ownerDocument,s);return o?e:A(e,r)}const{top:e,bottom:t}=r,n=e.getBoundingClientRect(),i=t.getBoundingClientRect(),c=b(new window.DOMRect(n.left,n.top,n.width,i.bottom-n.top),e.ownerDocument,s);return o?c:A(c,r)}if(!e.current)return;const{parentNode:i}=e.current,c=i.getBoundingClientRect();return o?c:A(c,i)}(H,y,E,v,w,U.current);if(!e)return;const{offsetParent:t,ownerDocument:n}=U.current;let r,o=0;if(t&&t!==n.body){const n=t.getBoundingClientRect();o=n.top,e=new window.DOMRect(e.left-n.left,e.top-n.top,e.width,e.height)}var s;M&&(r=null===(s=U.current.closest(".popover-slot"))||void 0===s?void 0:s.parentNode);const i=X.height?X:q.current.getBoundingClientRect(),{popoverTop:l,popoverLeft:u,xAxis:p,yAxis:h,contentHeight:g,contentWidth:O}=function(e,t,n="top",r,o,s,i,c,a){const[l,u="center",d]=n.split(" "),p=function(e,t,n,r,o,s,i,c){const{height:a}=t;if(o){const t=o.getBoundingClientRect().top+a-i;if(e.top<=t)return{yAxis:n,popoverTop:Math.min(e.bottom,t)}}let l=e.top+e.height/2;"bottom"===r?l=e.bottom:"top"===r&&(l=e.top);const u={popoverTop:l,contentHeight:(l-a/2>0?a/2:l)+(l+a/2>window.innerHeight?window.innerHeight-l:a/2)},d={popoverTop:e.top,contentHeight:e.top-10-a>0?a:e.top-10},p={popoverTop:e.bottom,contentHeight:e.bottom+10+a>window.innerHeight?window.innerHeight-10-e.bottom:a};let f,b=n,m=null;if(!o&&!c)if("middle"===n&&u.contentHeight===a)b="middle";else if("top"===n&&d.contentHeight===a)b="top";else if("bottom"===n&&p.contentHeight===a)b="bottom";else{b=d.contentHeight>p.contentHeight?"top":"bottom";const e="top"===b?d.contentHeight:p.contentHeight;m=e!==a?e:null}return f="middle"===b?u.popoverTop:"top"===b?d.popoverTop:p.popoverTop,{yAxis:b,popoverTop:f,contentHeight:m}}(e,t,l,d,r,0,s,c);return{...function(e,t,n,r,o,s,i,c,a){const{width:l}=t;"left"===n&&Object(f.isRTL)()?n="right":"right"===n&&Object(f.isRTL)()&&(n="left"),"left"===r&&Object(f.isRTL)()?r="right":"right"===r&&Object(f.isRTL)()&&(r="left");const u=Math.round(e.left+e.width/2),d={popoverLeft:u,contentWidth:(u-l/2>0?l/2:u)+(u+l/2>window.innerWidth?window.innerWidth-u:l/2)};let p=e.left;"right"===r?p=e.right:"middle"===s||a||(p=u);let b=e.right;"left"===r?b=e.left:"middle"===s||a||(b=u);const m={popoverLeft:p,contentWidth:p-l>0?l:p},h={popoverLeft:b,contentWidth:b+l>window.innerWidth?window.innerWidth-b:l};let g,O=n,v=null;if(!o&&!c)if("center"===n&&d.contentWidth===l)O="center";else if("left"===n&&m.contentWidth===l)O="left";else if("right"===n&&h.contentWidth===l)O="right";else{O=m.contentWidth>h.contentWidth?"left":"right";const e="left"===O?m.contentWidth:h.contentWidth;l>window.innerWidth&&(v=window.innerWidth),e!==l&&(O="center",d.popoverLeft=window.innerWidth/2)}if(g="center"===O?d.popoverLeft:"left"===O?m.popoverLeft:h.popoverLeft,i){const e=i.getBoundingClientRect();g=Math.min(g,e.right-l),Object(f.isRTL)()||(g=Math.max(g,0))}return{xAxis:O,popoverLeft:g,contentWidth:v}}(e,t,u,d,r,p.yAxis,i,c,a),...p}}(e,i,m,T,U.current,o,r,B,D);"number"==typeof l&&"number"==typeof u&&(P(U.current,"top",l+"px"),P(U.current,"left",u+"px")),F(U.current,"is-without-arrow",c||"center"===p&&"middle"===h),F(U.current,"is-alternate",a),R(U.current,"data-x-axis",p),R(U.current,"data-y-axis",h),P(q.current,"maxHeight","number"==typeof g?g+"px":""),P(q.current,"maxWidth","number"==typeof O?O+"px":""),$(({left:"right",right:"left"}[p]||"center")+" "+({top:"bottom",bottom:"top"}[h]||"middle"))};e();const{ownerDocument:t}=U.current,{defaultView:n}=t,r=n.setInterval(e,500);let o;const s=()=>{n.cancelAnimationFrame(o),o=n.requestAnimationFrame(e)};n.addEventListener("click",s),n.addEventListener("resize",e),n.addEventListener("scroll",e,!0);const i=function(e){if(e)return e.endContainer?e.endContainer.ownerDocument:e.top?e.top.ownerDocument:e.ownerDocument}(v);let l;return i&&i!==t&&(i.defaultView.addEventListener("resize",e),i.defaultView.addEventListener("scroll",e,!0)),N&&(l=new n.MutationObserver(e),l.observe(N,{attributes:!0})),()=>{n.clearInterval(r),n.removeEventListener("resize",e),n.removeEventListener("scroll",e,!0),n.removeEventListener("click",s),n.cancelAnimationFrame(o),i&&i!==t&&(i.defaultView.removeEventListener("resize",e),i.defaultView.removeEventListener("scroll",e,!0)),l&&l.disconnect()}},[Y,y,E,v,w,m,X,T,N,M]);const Z=(e,n)=>{if("focus-outside"===e&&x)x(n);else if("focus-outside"===e&&S){const e=new window.MouseEvent("click");Object.defineProperty(e,"target",{get:()=>n.relatedTarget}),l()("Popover onClickOutside prop",{since:"5.3",alternative:"onFocusOutside"}),S(e)}else t&&t()},[ee,te]=Object(u.__experimentalUseDialog)({focusOnMount:g,__unstableOnClose:Z,onClose:Z}),ne=Object(u.useMergeRefs)([U,ee,W]),re=Boolean(_&&K)&&function(e){if("loading"===e.type)return i()("components-animate__loading");const{type:t,origin:n=I(t)}=e;if("appear"===t){const[e,t="center"]=n.split(" ");return i()("components-animate__appear",{["is-from-"+t]:"center"!==t,["is-from-"+e]:"middle"!==e})}return"slide-in"===t?i()("components-animate__slide-in","is-from-"+n):void 0}({type:"appear",origin:K});let oe=Object(o.createElement)("div",Object(r.a)({className:i()("components-popover",s,re,{"is-expanded":Y,"is-without-arrow":c,"is-alternate":a})},V,{ref:ne},te,{tabIndex:"-1"}),Y&&Object(o.createElement)(O,null),Y&&Object(o.createElement)("div",{className:"components-popover__header"},Object(o.createElement)("span",{className:"components-popover__header-title"},e),Object(o.createElement)(G,{className:"components-popover__close",icon:p.a,onClick:t})),Object(o.createElement)("div",{ref:q,className:"components-popover__content"},Object(o.createElement)("div",{style:{position:"relative"}},J,n)));return Q.ref&&(oe=Object(o.createElement)(C,{name:L},oe)),v||y?oe:Object(o.createElement)("span",{ref:H},oe)});N.Slot=Object(o.forwardRef)((function({name:e="Popover"},t){return Object(o.createElement)(L,{bubblesVirtually:!0,name:e,className:"popover-slot",ref:t})}));var M=N,B=function({shortcut:e,className:t}){if(!e)return null;let n,r;return Object(c.isString)(e)&&(n=e),Object(c.isObject)(e)&&(n=e.display,r=e.ariaLabel),Object(o.createElement)("span",{className:t,"aria-label":r},n)};const D=Object(o.createElement)("div",{className:"event-catcher"}),V=({eventHandlers:e,child:t,childrenWithPopover:n})=>Object(o.cloneElement)(Object(o.createElement)("span",{className:"disabled-element-wrapper"},Object(o.cloneElement)(D,e),Object(o.cloneElement)(t,{children:n}),","),e),W=({child:e,eventHandlers:t,childrenWithPopover:n})=>Object(o.cloneElement)(e,{...t,children:n}),H=(e,t,n)=>{if(1!==o.Children.count(e))return;const r=o.Children.only(e);"function"==typeof r.props[t]&&r.props[t](n)};var q=function({children:e,position:t,text:n,shortcut:r}){const[s,i]=Object(o.useState)(!1),[a,l]=Object(o.useState)(!1),d=Object(u.useDebounce)(l,700),p=t=>{H(e,"onMouseDown",t),document.addEventListener("mouseup",m),i(!0)},f=t=>{H(e,"onMouseUp",t),document.removeEventListener("mouseup",m),i(!1)},b=e=>"mouseUp"===e?f:"mouseDown"===e?p:void 0,m=b("mouseUp"),h=(t,n)=>r=>{if(H(e,t,r),r.currentTarget.disabled)return;if("focus"===r.type&&s)return;d.cancel();const o=Object(c.includes)(["focus","mouseenter"],r.type);o!==a&&(n?d(o):l(o))},g=()=>{d.cancel(),document.removeEventListener("mouseup",m)};if(Object(o.useEffect)(()=>g,[]),1!==o.Children.count(e))return e;const O={onMouseEnter:h("onMouseEnter",!0),onMouseLeave:h("onMouseLeave"),onClick:h("onClick"),onFocus:h("onFocus"),onBlur:h("onBlur"),onMouseDown:b("mouseDown")},v=o.Children.only(e),{children:j,disabled:w}=v.props;return(w?V:W)({child:v,eventHandlers:O,childrenWithPopover:(({grandchildren:e,isOver:t,position:n,text:r,shortcut:s})=>Object(o.concatChildren)(e,t&&Object(o.createElement)(M,{focusOnMount:!1,position:n,className:"components-tooltip","aria-hidden":"true",animate:!1,noArrow:!0},r,Object(o.createElement)(B,{className:"components-tooltip__shortcut",shortcut:s}))))({grandchildren:j,isOver:a,position:t,text:n,shortcut:r})})},U=n(54),z=n(41);const K=["onMouseDown","onClick"];var G=t.a=Object(o.forwardRef)((function(e,t){const{href:n,target:s,isSmall:a,isPressed:u,isBusy:d,isDestructive:p,className:f,disabled:b,icon:m,iconPosition:h="left",iconSize:g,showTooltip:O,tooltipPosition:v,shortcut:j,label:w,children:y,text:E,variant:k,__experimentalIsFocusable:_,describedBy:S,...x}=function({isDefault:e,isPrimary:t,isSecondary:n,isTertiary:r,isLink:o,variant:s,...i}){let c=s;var a,u,d,p,f;return t&&(null!==(a=c)&&void 0!==a||(c="primary")),r&&(null!==(u=c)&&void 0!==u||(c="tertiary")),n&&(null!==(d=c)&&void 0!==d||(c="secondary")),e&&(l()("Button isDefault prop",{since:"5.4",alternative:'variant="secondary"'}),null!==(p=c)&&void 0!==p||(c="secondary")),o&&(null!==(f=c)&&void 0!==f||(c="link")),{...i,variant:c}}(e),T=i()("components-button",f,{"is-secondary":"secondary"===k,"is-primary":"primary"===k,"is-small":a,"is-tertiary":"tertiary"===k,"is-pressed":u,"is-busy":d,"is-link":"link"===k,"is-destructive":p,"has-text":!!m&&!!y,"has-icon":!!m}),C=b&&!_,L=void 0===n||C?"button":"a",I="a"===L?{href:n,target:s}:{type:"button",disabled:C,"aria-pressed":u};if(b&&_){I["aria-disabled"]=!0;for(const e of K)x[e]=e=>{e.stopPropagation(),e.preventDefault()}}const A=!C&&(O&&w||j||!!w&&(!y||Object(c.isArray)(y)&&!y.length)&&!1!==O),R=S?Object(c.uniqueId)():null,P=x["aria-describedby"]||R,F=Object(o.createElement)(L,Object(r.a)({},I,x,{className:T,"aria-label":x["aria-label"]||w,"aria-describedby":P,ref:t}),m&&"left"===h&&Object(o.createElement)(U.a,{icon:m,size:g}),E&&Object(o.createElement)(o.Fragment,null,E),m&&"right"===h&&Object(o.createElement)(U.a,{icon:m,size:g}),y);return A?Object(o.createElement)(o.Fragment,null,Object(o.createElement)(q,{text:S||w,shortcut:j,position:v},F),S&&Object(o.createElement)(z.a,null,Object(o.createElement)("span",{id:R},S))):Object(o.createElement)(o.Fragment,null,F,S&&Object(o.createElement)(z.a,null,Object(o.createElement)("span",{id:R},S)))}))},function(e,t,n){"use strict";n.d(t,"d",(function(){return c})),n.d(t,"h",(function(){return a})),n.d(t,"b",(function(){return l})),n.d(t,"a",(function(){return u})),n.d(t,"e",(function(){return d})),n.d(t,"f",(function(){return p})),n.d(t,"c",(function(){return f})),n.d(t,"g",(function(){return b}));var r=n(14),o=n(72),s=n(23),i=n(128);function c(){return Math.floor(Math.random()*Date.now())}const a=e=>e.replace("pa_",""),l=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const n={};t.forEach(e=>{const{attribute:t,slug:r,operator:s}=e,i=a(t),c=r.join(","),l=`${o.b}${i}`,u="in"===s?"or":"and";n[`${o.a}${i}`]=c,n[l]=u});const s=Object(r.removeQueryArgs)(e,...Object.keys(n));return Object(r.addQueryArgs)(s,n)},u=e=>{let{currentCheckedFilters:t,hasSetFilterDefaultsFromUrl:n}=e;return n&&0===t.length},d=e=>{if(e){const t=Object(o.d)("filter_"+e.name);return("string"==typeof t?t.split(","):[]).map(e=>encodeURIComponent(e).toLowerCase())}return[]},p=(e,t)=>{const n=Object.entries(t).reduce((e,t)=>{let[n,r]=t;return n.includes("query_type")?e:{...e,[n]:r}},{});return Object.entries(n).reduce((t,n)=>{let[r,o]=n;return e[r]===o&&t},!0)},f=e=>e.trim().replace(/\s/g,"-").replace(/_/g,"-").replace(/-+/g,"-").replace(/[^a-zA-Z0-9-]/g,""),b=e=>({className:Object(s.a)(null==e?void 0:e.className)?e.className:"",attributeId:parseInt(Object(s.a)(null==e?void 0:e.attributeId)?e.attributeId:"0",10),showCounts:"false"!==(null==e?void 0:e.showCounts),queryType:Object(s.a)(null==e?void 0:e.queryType)&&e.queryType||i.attributes.queryType.default,heading:Object(s.a)(null==e?void 0:e.heading)?e.heading:"",headingLevel:Object(s.a)(null==e?void 0:e.headingLevel)&&parseInt(e.headingLevel,10)||i.attributes.headingLevel.default,displayStyle:Object(s.a)(null==e?void 0:e.displayStyle)&&e.displayStyle||i.attributes.displayStyle.default,showFilterButton:"true"===(null==e?void 0:e.showFilterButton),selectType:Object(s.a)(null==e?void 0:e.selectType)&&e.selectType||i.attributes.selectType.default,isPreview:!1})},function(e,t,n){"use strict";n.d(t,"a",(function(){return o}));var r=n(8);function o(e,t,n){var o=this,s=Object(r.useRef)(null),i=Object(r.useRef)(0),c=Object(r.useRef)(null),a=Object(r.useRef)([]),l=Object(r.useRef)(),u=Object(r.useRef)(),d=Object(r.useRef)(e),p=Object(r.useRef)(!0);d.current=e;var f=!t&&0!==t&&"undefined"!=typeof window;if("function"!=typeof e)throw new TypeError("Expected a function");t=+t||0;var b=!!(n=n||{}).leading,m=!("trailing"in n)||!!n.trailing,h="maxWait"in n,g=h?Math.max(+n.maxWait||0,t):null;return Object(r.useEffect)((function(){return p.current=!0,function(){p.current=!1}}),[]),Object(r.useMemo)((function(){var e=function(e){var t=a.current,n=l.current;return a.current=l.current=null,i.current=e,u.current=d.current.apply(n,t)},n=function(e,t){f&&cancelAnimationFrame(c.current),c.current=f?requestAnimationFrame(e):setTimeout(e,t)},r=function(e){if(!p.current)return!1;var n=e-s.current,r=e-i.current;return!s.current||n>=t||n<0||h&&r>=g},O=function(t){return c.current=null,m&&a.current?e(t):(a.current=l.current=null,u.current)},v=function(){var e=Date.now();if(r(e))return O(e);if(p.current){var o=e-s.current,c=e-i.current,a=t-o,l=h?Math.min(a,g-c):a;n(v,l)}},j=function(){for(var d=[],f=0;f{const{namespace:t,resourceName:n,resourceValues:c=[],query:a={},shouldSelect:l=!0}=e;if(!t||!n)throw new Error("The options object must have valid values for the namespace and the resource properties.");const u=Object(s.useRef)({results:[],isLoading:!0}),d=Object(i.a)(a),p=Object(i.a)(c),f=(()=>{const[,e]=Object(s.useState)();return Object(s.useCallback)(t=>{e(()=>{throw t})},[])})(),b=Object(o.useSelect)(e=>{if(!l)return null;const o=e(r.COLLECTIONS_STORE_KEY),s=[t,n,d,p],i=o.getCollectionError(...s);if(i){if(!(i instanceof Error))throw new Error("TypeError: `error` object is not an instance of Error constructor");f(i)}return{results:o.getCollection(...s),isLoading:!o.hasFinishedResolution("getCollection",s)}},[t,n,p,d,l]);return null!==b&&(u.current=b),u.current}},function(e,t,n){"use strict";n.d(t,"a",(function(){return o}));var r=n(8);function o(e,t){const n=Object(r.useRef)();return Object(r.useEffect)(()=>{n.current===e||t&&!t(e,n.current)||(n.current=e)},[e,t]),n.current}},function(e,t,n){"use strict";var r=n(0),o=n(1),s=n(21);n(138),t.a=e=>{let{name:t,count:n}=e;return Object(r.createElement)(r.Fragment,null,t,null!==n&&Number.isFinite(n)&&Object(r.createElement)(s.a,{label:n.toString(),screenReaderLabel:Object(o.sprintf)( +/* translators: %s number of products. */ +Object(o._n)("%s product","%s products",n,"woo-gutenberg-products-block"),n),wrapperElement:"span",wrapperProps:{className:"wc-filter-element-label-list-count"}}))}},function(e,t){e.exports=window.wp.blockEditor},,,function(e,t,n){"use strict";var r=n(0);n(102),t.a=e=>{let{children:t}=e;return Object(r.createElement)("div",{className:"wc-block-filter-title-placeholder"},t)}},function(e,t,n){"use strict";var r=n(0),o=n(1),s=n(6),i=n.n(s),c=n(21);n(103),t.a=e=>{let{className:t,label: +/* translators: Reset button text for filters. */ +n=Object(o.__)("Reset","woo-gutenberg-products-block"),onClick:s,screenReaderLabel:a=Object(o.__)("Reset filter","woo-gutenberg-products-block")}=e;return Object(r.createElement)("button",{className:i()("wc-block-components-filter-reset-button",t),onClick:s},Object(r.createElement)(c.a,{label:n,screenReaderLabel:a}))}},function(e,t,n){"use strict";var r=n(0),o=n(1),s=n(6),i=n.n(s),c=n(21);n(104),t.a=e=>{let{className:t,isLoading:n,disabled:s,label: +/* translators: Submit button text for filters. */ +a=Object(o.__)("Apply","woo-gutenberg-products-block"),onClick:l,screenReaderLabel:u=Object(o.__)("Apply filter","woo-gutenberg-products-block")}=e;return Object(r.createElement)("button",{type:"submit",className:i()("wp-block-button__link","wc-block-filter-submit-button","wc-block-components-filter-submit-button",{"is-loading":n},t),disabled:s,onClick:l},Object(r.createElement)(c.a,{label:a,screenReaderLabel:u}))}},function(e,t,n){"use strict";n.d(t,"b",(function(){return c})),n.d(t,"a",(function(){return a})),n.d(t,"d",(function(){return l})),n.d(t,"c",(function(){return u}));var r=n(14),o=n(2),s=n(74);const i=Object(o.getSettingWithCoercion)("is_rendering_php_template",!1,s.a),c="query_type_",a="filter_";function l(e){return window?Object(r.getQueryArg)(window.location.href,e):null}function u(e){i?window.location.href=e:window.history.replaceState({},"",e)}},,function(e,t,n){"use strict";n.d(t,"a",(function(){return r}));const r=e=>"boolean"==typeof e},,function(e,t,n){"use strict";var r=n(0);t.a=function(e){let{icon:t,size:n=24,...o}=e;return Object(r.cloneElement)(t,{width:n,height:n,...o})}},,,,,,,,,,,,,,,,,function(e,t,n){"use strict";var r=n(15),o=n.n(r),s=n(0),i=n(130),c=n(6),a=n.n(c);n(117),t.a=e=>{let{className:t,style:n,suggestions:r,multiple:c=!0,saveTransform:l=(e=>e.trim().replace(/\s/g,"-")),messages:u={},validateInput:d=(e=>r.includes(e)),label:p="",...f}=e;return Object(s.createElement)("div",{className:a()("wc-blocks-components-form-token-field-wrapper",t,{"single-selection":!c}),style:n},Object(s.createElement)(i.a,o()({label:p,__experimentalExpandOnFocus:!0,__experimentalShowHowTo:!1,__experimentalValidateInput:d,saveTransform:l,maxLength:c?void 0:1,suggestions:r,messages:u},f)))}},function(e,t,n){"use strict";var r=n(0),o=n(1),s=n(6),i=n.n(s),c=n(11);n(118),t.a=e=>{let{className:t,onChange:n,options:s=[],checked:a=[],isLoading:l=!1,isDisabled:u=!1,limit:d=10}=e;const[p,f]=Object(r.useState)(!1),b=Object(r.useMemo)(()=>[...Array(5)].map((e,t)=>Object(r.createElement)("li",{key:t,style:{width:Math.floor(75*Math.random())+25+"%"}})),[]),m=Object(r.useMemo)(()=>{const e=s.length-d;return!p&&Object(r.createElement)("li",{key:"show-more",className:"show-more"},Object(r.createElement)("button",{onClick:()=>{f(!0)},"aria-expanded":!1,"aria-label":Object(o.sprintf)( +/* translators: %s is referring the remaining count of options */ +Object(o._n)("Show %s more option","Show %s more options",e,"woo-gutenberg-products-block"),e)},Object(o.sprintf)( +/* translators: %s number of options to reveal. */ +Object(o._n)("Show %s more","Show %s more",e,"woo-gutenberg-products-block"),e)))},[s,d,p]),h=Object(r.useMemo)(()=>p&&Object(r.createElement)("li",{key:"show-less",className:"show-less"},Object(r.createElement)("button",{onClick:()=>{f(!1)},"aria-expanded":!0,"aria-label":Object(o.__)("Show less options","woo-gutenberg-products-block")},Object(o.__)("Show less","woo-gutenberg-products-block"))),[p]),g=Object(r.useMemo)(()=>{const e=s.length>d+5;return Object(r.createElement)(r.Fragment,null,s.map((t,o)=>Object(r.createElement)(r.Fragment,{key:t.value},Object(r.createElement)("li",e&&!p&&o>=d&&{hidden:!0},Object(r.createElement)(c.CheckboxControl,{id:t.value,className:"wc-block-checkbox-list__checkbox",label:t.label,checked:a.includes(t.value),onChange:()=>{n(t.value)},disabled:u})),e&&o===d-1&&m)),e&&h)},[s,n,a,p,d,h,m,u]),O=i()("wc-block-checkbox-list","wc-block-components-checkbox-list",{"is-loading":l},t);return Object(r.createElement)("ul",{className:O},l?b:g)}},function(e,t,n){"use strict";var r=n(10),o=n(0),s=n(6),i=n.n(s);class c extends o.Component{constructor(){super(...arguments),this.onChange=this.onChange.bind(this),this.bindInput=this.bindInput.bind(this)}focus(){this.input.focus()}hasFocus(){return this.input===this.input.ownerDocument.activeElement}bindInput(e){this.input=e}onChange(e){this.props.onChange({value:e.target.value})}render(){const{value:e,isExpanded:t,instanceId:n,selectedSuggestionIndex:s,className:c,...a}=this.props,l=e?e.length+1:0;return Object(o.createElement)("input",Object(r.a)({ref:this.bindInput,id:"components-form-token-input-"+n,type:"text"},a,{value:e||"",onChange:this.onChange,size:l,className:i()(c,"components-form-token-field__input"),autoComplete:"off",role:"combobox","aria-expanded":t,"aria-autocomplete":"list","aria-owns":t?"components-form-token-suggestions-"+n:void 0,"aria-activedescendant":-1!==s?`components-form-token-suggestions-${n}-${s}`:void 0,"aria-describedby":"components-form-token-suggestions-howto-"+n}))}}t.a=c},function(e,t,n){"use strict";var r=n(0),o=n(5),s=n(97),i=n.n(s),c=n(6),a=n.n(c),l=n(9);class u extends r.Component{constructor(){super(...arguments),this.handleMouseDown=this.handleMouseDown.bind(this),this.bindList=this.bindList.bind(this)}componentDidUpdate(){this.props.selectedIndex>-1&&this.props.scrollIntoView&&this.list.children[this.props.selectedIndex]&&(this.scrollingIntoView=!0,i()(this.list.children[this.props.selectedIndex],this.list,{onlyScrollIfNeeded:!0}),this.props.setTimeout(()=>{this.scrollingIntoView=!1},100))}bindList(e){this.list=e}handleHover(e){return()=>{this.scrollingIntoView||this.props.onHover(e)}}handleClick(e){return()=>{this.props.onSelect(e)}}handleMouseDown(e){e.preventDefault()}computeSuggestionMatch(e){const t=this.props.displayTransform(this.props.match||"").toLocaleLowerCase();if(0===t.length)return null;const n=(e=this.props.displayTransform(e)).toLocaleLowerCase().indexOf(t);return{suggestionBeforeMatch:e.substring(0,n),suggestionMatch:e.substring(n,n+t.length),suggestionAfterMatch:e.substring(n+t.length)}}render(){return Object(r.createElement)("ul",{ref:this.bindList,className:"components-form-token-field__suggestions-list",id:"components-form-token-suggestions-"+this.props.instanceId,role:"listbox"},Object(o.map)(this.props.suggestions,(e,t)=>{const n=this.computeSuggestionMatch(e),o=a()("components-form-token-field__suggestion",{"is-selected":t===this.props.selectedIndex});return Object(r.createElement)("li",{id:`components-form-token-suggestions-${this.props.instanceId}-${t}`,role:"option",className:o,key:null!=e&&e.value?e.value:this.props.displayTransform(e),onMouseDown:this.handleMouseDown,onClick:this.handleClick(e),onMouseEnter:this.handleHover(e),"aria-selected":t===this.props.selectedIndex},n?Object(r.createElement)("span",{"aria-label":this.props.displayTransform(e)},n.suggestionBeforeMatch,Object(r.createElement)("strong",{className:"components-form-token-field__suggestion-match"},n.suggestionMatch),n.suggestionAfterMatch):this.props.displayTransform(e))}))}}u.defaultProps={match:"",onHover:()=>{},onSelect:()=>{},suggestions:Object.freeze([])},t.a=Object(l.withSafeTimeout)(u)},function(e,t,n){"use strict";e.exports=n(119)},function(e,t,n){"use strict";n.d(t,"a",(function(){return c}));var r=n(8),o=n(57);function s(e,t){return e===t}function i(e){return"function"==typeof e?function(){return e}:e}function c(e,t,n){var c=n&&n.equalityFn||s,a=function(e){var t=Object(r.useState)(i(e)),n=t[0],o=t[1];return[n,Object(r.useCallback)((function(e){return o(i(e))}),[])]}(e),l=a[0],u=a[1],d=Object(o.a)(Object(r.useCallback)((function(e){return u(e)}),[u]),t,n),p=Object(r.useRef)(e);return c(p.current,e)||(d(e),p.current=e),[l,d]}},,,,function(e,t){},function(e,t){},function(e,t){},function(e,t){var n,r,o=e.exports={};function s(){throw new Error("setTimeout has not been defined")}function i(){throw new Error("clearTimeout has not been defined")}function c(e){if(n===setTimeout)return setTimeout(e,0);if((n===s||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:s}catch(e){n=s}try{r="function"==typeof clearTimeout?clearTimeout:i}catch(e){r=i}}();var a,l=[],u=!1,d=-1;function p(){u&&a&&(u=!1,a.length?l=a.concat(l):d=-1,l.length&&f())}function f(){if(!u){var e=c(p);u=!0;for(var t=l.length;t;){for(a=l,l=[];++d1)for(var n=1;n0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";const s=e.filter(e=>e.attribute===n.taxonomy),i=s.length?s[0]:null;if(!(i&&i.slug&&Array.isArray(i.slug)&&i.slug.includes(o)))return;const c=i.slug.filter(e=>e!==o),a=e.filter(e=>e.attribute!==n.taxonomy);c.length>0&&(i.slug=c.sort(),a.push(i)),t(Object(r.sortBy)(a,"attribute"))},s=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"in";if(!n||!n.taxonomy)return[];const i=e.filter(e=>e.attribute!==n.taxonomy);return 0===o.length?t(i):(i.push({attribute:n.taxonomy,operator:s,slug:o.map(e=>{let{slug:t}=e;return t}).sort()}),t(Object(r.sortBy)(i,"attribute"))),i}},,,function(e,t,n){"use strict";n.d(t,"a",(function(){return o})),n(53);var r=n(37);const o=()=>r.n>1},function(e,t,n){"use strict";n.d(t,"a",(function(){return s}));var r=n(23),o=n(20);const s=e=>Object(r.a)(e)?JSON.parse(e)||{}:Object(o.a)(e)?e:{}},function(e,t){},function(e,t){},function(e,t,n){"use strict";var r=n(120);e.exports=function(e,t,n){n=n||{},9===t.nodeType&&(t=r.getWindow(t));var o=n.allowHorizontalScroll,s=n.onlyScrollIfNeeded,i=n.alignWithTop,c=n.alignWithLeft,a=n.offsetTop||0,l=n.offsetLeft||0,u=n.offsetBottom||0,d=n.offsetRight||0;o=void 0===o||o;var p=r.isWindow(t),f=r.offset(e),b=r.outerHeight(e),m=r.outerWidth(e),h=void 0,g=void 0,O=void 0,v=void 0,j=void 0,w=void 0,y=void 0,E=void 0,k=void 0,_=void 0;p?(y=t,_=r.height(y),k=r.width(y),E={left:r.scrollLeft(y),top:r.scrollTop(y)},j={left:f.left-E.left-l,top:f.top-E.top-a},w={left:f.left+m-(E.left+k)+d,top:f.top+b-(E.top+_)+u},v=E):(h=r.offset(t),g=t.clientHeight,O=t.clientWidth,v={left:t.scrollLeft,top:t.scrollTop},j={left:f.left-(h.left+(parseFloat(r.css(t,"borderLeftWidth"))||0))-l,top:f.top-(h.top+(parseFloat(r.css(t,"borderTopWidth"))||0))-a},w={left:f.left+m-(h.left+O+(parseFloat(r.css(t,"borderRightWidth"))||0))+d,top:f.top+b-(h.top+g+(parseFloat(r.css(t,"borderBottomWidth"))||0))+u}),j.top<0||w.top>0?!0===i?r.scrollTop(t,v.top+j.top):!1===i?r.scrollTop(t,v.top+w.top):j.top<0?r.scrollTop(t,v.top+j.top):r.scrollTop(t,v.top+w.top):s||((i=void 0===i||!!i)?r.scrollTop(t,v.top+j.top):r.scrollTop(t,v.top+w.top)),o&&(j.left<0||w.left>0?!0===c?r.scrollLeft(t,v.left+j.left):!1===c?r.scrollLeft(t,v.left+w.left):j.left<0?r.scrollLeft(t,v.left+j.left):r.scrollLeft(t,v.left+w.left):s||((c=void 0===c||!!c)?r.scrollLeft(t,v.left+j.left):r.scrollLeft(t,v.left+w.left)))}},function(e,t,n){"use strict";var r=Object.assign||function(e){for(var t=1;t{const n=(r=t)&&r.attribute_name?{id:parseInt(r.attribute_id,10),name:r.attribute_name,taxonomy:"pa_"+r.attribute_name,label:r.attribute_label}:null;var r;return n&&n.id&&e.push(n),e},[]),s=e=>{if(e)return o.find(t=>t.id===e)},i=e=>{if(e)return o.find(t=>t.taxonomy===e)}},,,function(e,t,n){"use strict";var r=n(0),o=n(12);const s=Object(r.createElement)(o.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(r.createElement)(o.Path,{d:"M13 11.8l6.1-6.3-1-1-6.1 6.2-6.1-6.2-1 1 6.1 6.3-6.5 6.7 1 1 6.5-6.6 6.5 6.6 1-1z"}));t.a=s},,,function(e){e.exports=JSON.parse('{"name":"woocommerce/attribute-filter","version":"1.0.0","title":"Filter by Attribute Controls","description":"Enable customers to filter the product grid by selecting one or more attributes, such as color.","category":"woocommerce","keywords":["WooCommerce"],"supports":{"html":false,"color":{"text":true,"background":false},"inserter":false,"lock":false},"attributes":{"className":{"type":"string","default":""},"attributeId":{"type":"number","default":0},"showCounts":{"type":"boolean","default":true},"queryType":{"type":"string","default":"or"},"headingLevel":{"type":"number","default":3},"displayStyle":{"type":"string","default":"list"},"showFilterButton":{"type":"boolean","default":false},"selectType":{"type":"string","default":"multiple"},"isPreview":{"type":"boolean","default":false}},"textdomain":"woo-gutenberg-products-block","apiVersion":2,"$schema":"https://schemas.wp.org/trunk/block.json"}')},,function(e,t,n){"use strict";var r=n(0),o=n(5),s=n(6),i=n.n(s),c=n(1),a=n(9),l=n(24),u=n(13),d=n.n(u),p=n(142),f=n(55),b=n(41);function m({value:e,status:t,title:n,displayTransform:s,isBorderless:l=!1,disabled:u=!1,onClickRemove:d=o.noop,onMouseEnter:h,onMouseLeave:g,messages:O,termPosition:v,termsCount:j}){const w=Object(a.useInstanceId)(m),y=i()("components-form-token-field__token",{"is-error":"error"===t,"is-success":"success"===t,"is-validating":"validating"===t,"is-borderless":l,"is-disabled":u}),E=s(e),k=Object(c.sprintf)( +/* translators: 1: term name, 2: term position in a set of terms, 3: total term set count. */ +Object(c.__)("%1$s (%2$s of %3$s)"),E,v,j);return Object(r.createElement)("span",{className:y,onMouseEnter:h,onMouseLeave:g,title:n},Object(r.createElement)("span",{className:"components-form-token-field__token-text",id:"components-form-token-field__token-text-"+w},Object(r.createElement)(b.a,{as:"span"},k),Object(r.createElement)("span",{"aria-hidden":"true"},E)),Object(r.createElement)(f.a,{className:"components-form-token-field__remove-token",icon:p.a,onClick:!u&&(()=>d({value:e})),label:O.remove,"aria-describedby":"components-form-token-field__token-text-"+w}))}var h=n(95),g=n(96),O=n(10),v=n(28),j=Object(a.createHigherOrderComponent)(e=>t=>Object(r.createElement)(e,Object(O.a)({},t,{speak:v.speak,debouncedSpeak:Object(a.useDebounce)(v.speak,500)})),"withSpokenMessages");const w={incompleteTokenValue:"",inputOffsetFromEnd:0,isActive:!1,isExpanded:!1,selectedSuggestionIndex:-1,selectedSuggestionScroll:!1};class y extends r.Component{constructor(){super(...arguments),this.state=w,this.onKeyDown=this.onKeyDown.bind(this),this.onKeyPress=this.onKeyPress.bind(this),this.onFocus=this.onFocus.bind(this),this.onBlur=this.onBlur.bind(this),this.deleteTokenBeforeInput=this.deleteTokenBeforeInput.bind(this),this.deleteTokenAfterInput=this.deleteTokenAfterInput.bind(this),this.addCurrentToken=this.addCurrentToken.bind(this),this.onContainerTouched=this.onContainerTouched.bind(this),this.renderToken=this.renderToken.bind(this),this.onTokenClickRemove=this.onTokenClickRemove.bind(this),this.onSuggestionHovered=this.onSuggestionHovered.bind(this),this.onSuggestionSelected=this.onSuggestionSelected.bind(this),this.onInputChange=this.onInputChange.bind(this),this.bindInput=this.bindInput.bind(this),this.bindTokensAndInput=this.bindTokensAndInput.bind(this),this.updateSuggestions=this.updateSuggestions.bind(this)}componentDidUpdate(e){this.state.isActive&&!this.input.hasFocus()&&this.input.focus();const{suggestions:t,value:n}=this.props,r=!d()(t,e.suggestions);(r||n!==e.value)&&this.updateSuggestions(r)}static getDerivedStateFromProps(e,t){return e.disabled&&t.isActive?{isActive:!1,incompleteTokenValue:""}:null}bindInput(e){this.input=e}bindTokensAndInput(e){this.tokensAndInput=e}onFocus(e){const{__experimentalExpandOnFocus:t}=this.props;this.input.hasFocus()||e.target===this.tokensAndInput?this.setState({isActive:!0,isExpanded:!!t||this.state.isExpanded}):this.setState({isActive:!1}),"function"==typeof this.props.onFocus&&this.props.onFocus(e)}onBlur(){this.inputHasValidValue()?this.setState({isActive:!1}):this.setState(w)}onKeyDown(e){let t=!1;switch(e.keyCode){case l.BACKSPACE:t=this.handleDeleteKey(this.deleteTokenBeforeInput);break;case l.ENTER:t=this.addCurrentToken();break;case l.LEFT:t=this.handleLeftArrowKey();break;case l.UP:t=this.handleUpArrowKey();break;case l.RIGHT:t=this.handleRightArrowKey();break;case l.DOWN:t=this.handleDownArrowKey();break;case l.DELETE:t=this.handleDeleteKey(this.deleteTokenAfterInput);break;case l.SPACE:this.props.tokenizeOnSpace&&(t=this.addCurrentToken());break;case l.ESCAPE:t=this.handleEscapeKey(e),e.stopPropagation()}t&&e.preventDefault()}onKeyPress(e){let t=!1;switch(e.charCode){case 44:t=this.handleCommaKey()}t&&e.preventDefault()}onContainerTouched(e){e.target===this.tokensAndInput&&this.state.isActive&&e.preventDefault()}onTokenClickRemove(e){this.deleteToken(e.value),this.input.focus()}onSuggestionHovered(e){const t=this.getMatchingSuggestions().indexOf(e);t>=0&&this.setState({selectedSuggestionIndex:t,selectedSuggestionScroll:!1})}onSuggestionSelected(e){this.addNewToken(e)}onInputChange(e){const t=e.value,n=this.props.tokenizeOnSpace?/[ ,\t]+/:/[,\t]+/,r=t.split(n),s=Object(o.last)(r)||"";r.length>1&&this.addNewTokens(r.slice(0,-1)),this.setState({incompleteTokenValue:s},this.updateSuggestions),this.props.onInputChange(s)}handleDeleteKey(e){let t=!1;return this.input.hasFocus()&&this.isInputEmpty()&&(e(),t=!0),t}handleLeftArrowKey(){let e=!1;return this.isInputEmpty()&&(this.moveInputBeforePreviousToken(),e=!0),e}handleRightArrowKey(){let e=!1;return this.isInputEmpty()&&(this.moveInputAfterNextToken(),e=!0),e}handleUpArrowKey(){return this.setState((e,t)=>({selectedSuggestionIndex:(0===e.selectedSuggestionIndex?this.getMatchingSuggestions(e.incompleteTokenValue,t.suggestions,t.value,t.maxSuggestions,t.saveTransform).length:e.selectedSuggestionIndex)-1,selectedSuggestionScroll:!0})),!0}handleDownArrowKey(){return this.setState((e,t)=>({selectedSuggestionIndex:(e.selectedSuggestionIndex+1)%this.getMatchingSuggestions(e.incompleteTokenValue,t.suggestions,t.value,t.maxSuggestions,t.saveTransform).length,selectedSuggestionScroll:!0})),!0}handleEscapeKey(e){return this.setState({incompleteTokenValue:e.target.value,isExpanded:!1,selectedSuggestionIndex:-1,selectedSuggestionScroll:!1}),!0}handleCommaKey(){return this.inputHasValidValue()&&this.addNewToken(this.state.incompleteTokenValue),!0}moveInputToIndex(e){this.setState((t,n)=>({inputOffsetFromEnd:n.value.length-Math.max(e,-1)-1}))}moveInputBeforePreviousToken(){this.setState((e,t)=>({inputOffsetFromEnd:Math.min(e.inputOffsetFromEnd+1,t.value.length)}))}moveInputAfterNextToken(){this.setState(e=>({inputOffsetFromEnd:Math.max(e.inputOffsetFromEnd-1,0)}))}deleteTokenBeforeInput(){const e=this.getIndexOfInput()-1;e>-1&&this.deleteToken(this.props.value[e])}deleteTokenAfterInput(){const e=this.getIndexOfInput();e!this.valueContainsToken(e)));if(t.length>0){const e=Object(o.clone)(this.props.value);e.splice.apply(e,[this.getIndexOfInput(),0].concat(t)),this.props.onChange(e)}}addNewToken(e){const{__experimentalExpandOnFocus:t,__experimentalValidateInput:n}=this.props;n(e)?(this.addNewTokens([e]),this.props.speak(this.props.messages.added,"assertive"),this.setState({incompleteTokenValue:"",selectedSuggestionIndex:-1,selectedSuggestionScroll:!1,isExpanded:!t}),this.state.isActive&&this.input.focus()):this.props.speak(this.props.messages.__experimentalInvalid,"assertive")}deleteToken(e){const t=this.props.value.filter(t=>this.getTokenValue(t)!==this.getTokenValue(e));this.props.onChange(t),this.props.speak(this.props.messages.removed,"assertive")}getTokenValue(e){return"object"==typeof e?e.value:e}getMatchingSuggestions(e=this.state.incompleteTokenValue,t=this.props.suggestions,n=this.props.value,r=this.props.maxSuggestions,s=this.props.saveTransform){let i=s(e);const c=[],a=[];return 0===i.length?t=Object(o.difference)(t,n):(i=i.toLocaleLowerCase(),Object(o.each)(t,e=>{const t=e.toLocaleLowerCase().indexOf(i);-1===n.indexOf(e)&&(0===t?c.push(e):t>0&&a.push(e))}),t=c.concat(a)),Object(o.take)(t,r)}getSelectedSuggestion(){if(-1!==this.state.selectedSuggestionIndex)return this.getMatchingSuggestions()[this.state.selectedSuggestionIndex]}valueContainsToken(e){return Object(o.some)(this.props.value,t=>this.getTokenValue(e)===this.getTokenValue(t))}getIndexOfInput(){return this.props.value.length-this.state.inputOffsetFromEnd}isInputEmpty(){return 0===this.state.incompleteTokenValue.length}inputHasValidValue(){return this.props.saveTransform(this.state.incompleteTokenValue).length>0}updateSuggestions(e=!0){const{__experimentalExpandOnFocus:t}=this.props,{incompleteTokenValue:n}=this.state,r=n.trim().length>1,o=this.getMatchingSuggestions(n),s=o.length>0,i={isExpanded:t||r&&s};if(e&&(i.selectedSuggestionIndex=-1,i.selectedSuggestionScroll=!1),this.setState(i),r){const{debouncedSpeak:e}=this.props;e(s?Object(c.sprintf)( +/* translators: %d: number of results. */ +Object(c._n)("%d result found, use up and down arrow keys to navigate.","%d results found, use up and down arrow keys to navigate.",o.length),o.length):Object(c.__)("No results."),"assertive")}}renderTokensAndInput(){const e=Object(o.map)(this.props.value,this.renderToken);return e.splice(this.getIndexOfInput(),0,this.renderInput()),e}renderToken(e,t,n){const o=this.getTokenValue(e),s=e.status?e.status:void 0,i=t+1,c=n.length;return Object(r.createElement)(m,{key:"token-"+o,value:o,status:s,title:e.title,displayTransform:this.props.displayTransform,onClickRemove:this.onTokenClickRemove,isBorderless:e.isBorderless||this.props.isBorderless,onMouseEnter:e.onMouseEnter,onMouseLeave:e.onMouseLeave,disabled:"error"!==s&&this.props.disabled,messages:this.props.messages,termsCount:c,termPosition:i})}renderInput(){const{autoCapitalize:e,autoComplete:t,maxLength:n,placeholder:o,value:s,instanceId:i}=this.props;let c={instanceId:i,autoCapitalize:e,autoComplete:t,placeholder:0===s.length?o:"",ref:this.bindInput,key:"input",disabled:this.props.disabled,value:this.state.incompleteTokenValue,onBlur:this.onBlur,isExpanded:this.state.isExpanded,selectedSuggestionIndex:this.state.selectedSuggestionIndex};return n&&s.length>=n||(c={...c,onChange:this.onInputChange}),Object(r.createElement)(h.a,c)}render(){const{disabled:e,label:t=Object(c.__)("Add item"),instanceId:n,className:o,__experimentalShowHowTo:s}=this.props,{isExpanded:a}=this.state,l=i()(o,"components-form-token-field__input-container",{"is-active":this.state.isActive,"is-disabled":e});let u={className:"components-form-token-field",tabIndex:"-1"};const d=this.getMatchingSuggestions();return e||(u=Object.assign({},u,{onKeyDown:this.onKeyDown,onKeyPress:this.onKeyPress,onFocus:this.onFocus})),Object(r.createElement)("div",u,Object(r.createElement)("label",{htmlFor:"components-form-token-input-"+n,className:"components-form-token-field__label"},t),Object(r.createElement)("div",{ref:this.bindTokensAndInput,className:l,tabIndex:"-1",onMouseDown:this.onContainerTouched,onTouchStart:this.onContainerTouched},this.renderTokensAndInput(),a&&Object(r.createElement)(g.a,{instanceId:n,match:this.props.saveTransform(this.state.incompleteTokenValue),displayTransform:this.props.displayTransform,suggestions:d,selectedIndex:this.state.selectedSuggestionIndex,scrollIntoView:this.state.selectedSuggestionScroll,onHover:this.onSuggestionHovered,onSelect:this.onSuggestionSelected})),s&&Object(r.createElement)("p",{id:"components-form-token-suggestions-howto-"+n,className:"components-form-token-field__help"},this.props.tokenizeOnSpace?Object(c.__)("Separate with commas, spaces, or the Enter key."):Object(c.__)("Separate with commas or the Enter key.")))}}y.defaultProps={suggestions:Object.freeze([]),maxSuggestions:100,value:Object.freeze([]),displayTransform:o.identity,saveTransform:e=>e.trim(),onChange:()=>{},onInputChange:()=>{},isBorderless:!1,disabled:!1,tokenizeOnSpace:!1,messages:{added:Object(c.__)("Item added."),removed:Object(c.__)("Item removed."),remove:Object(c.__)("Remove item"),__experimentalInvalid:Object(c.__)("Invalid item")},__experimentalExpandOnFocus:!1,__experimentalValidateInput:()=>!0,__experimentalShowHowTo:!0},t.a=j(Object(a.withInstanceId)(y))},,,,,,,,function(e,t){},function(e,t,n){"use strict";n.d(t,"a",(function(){return d}));var r=n(0),o=n(98),s=n(5),i=n(30),c=n(20),a=n(32),l=n(63),u=n(25);const d=e=>{let{queryAttribute:t,queryPrices:n,queryStock:d,queryRating:p,queryState:f,productIds:b,isEditor:m=!1}=e,h=Object(u.a)();h+="-collection-data";const[g]=Object(a.a)(h),[O,v]=Object(a.b)("calculate_attribute_counts",[],h),[j,w]=Object(a.b)("calculate_price_range",null,h),[y,E]=Object(a.b)("calculate_stock_status_counts",null,h),[k,_]=Object(a.b)("calculate_rating_counts",null,h),S=Object(i.a)(t||{}),x=Object(i.a)(n),T=Object(i.a)(d),C=Object(i.a)(p);Object(r.useEffect)(()=>{"object"==typeof S&&Object.keys(S).length&&(O.find(e=>Object(c.b)(S,"taxonomy")&&e.taxonomy===S.taxonomy)||v([...O,S]))},[S,O,v]),Object(r.useEffect)(()=>{j!==x&&void 0!==x&&w(x)},[x,w,j]),Object(r.useEffect)(()=>{y!==T&&void 0!==T&&E(T)},[T,E,y]),Object(r.useEffect)(()=>{k!==C&&void 0!==C&&_(C)},[C,_,k]);const[L,I]=Object(r.useState)(m),[A]=Object(o.a)(L,200);L||I(!0);const R=Object(r.useMemo)(()=>(e=>{const t=e;return Array.isArray(e.calculate_attribute_counts)&&(t.calculate_attribute_counts=Object(s.sortBy)(e.calculate_attribute_counts.map(e=>{let{taxonomy:t,queryType:n}=e;return{taxonomy:t,query_type:n}}),["taxonomy","query_type"])),t})(g),[g]);return Object(l.a)({namespace:"/wc/store/v1",resourceName:"products/collection-data",query:{...f,page:void 0,per_page:void 0,orderby:void 0,order:void 0,...!Object(s.isEmpty)(b)&&{include:b},...R},shouldSelect:A})}},,,function(e,t,n){"use strict";var r=n(0),o=n(12);const s=Object(r.createElement)(o.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(r.createElement)(o.Path,{d:"M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z"}));t.a=s},,,,,,,,,function(e,t,n){"use strict";n.d(t,"a",(function(){return c}));var r=n(66),o=n(115),s=n(20),i=n(116);const c=e=>{if(!Object(o.a)())return{className:"",style:{}};const t=Object(s.a)(e)?e:{},n=Object(i.a)(t.style);return Object(r.__experimentalUseBorderProps)({...t,style:n})}},function(e,t,n){"use strict";var r=n(0),o=n(12);const s=Object(r.createElement)(o.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},Object(r.createElement)(o.Path,{d:"M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z"}));t.a=s},,,,,,,function(e,t,n){"use strict";var r=n(0),o=n(1),s=n(151),i=n(30),c=n(64),a=n(32),l=n(63),u=n(139),d=n(65),p=n(70),f=n(71),b=n(13),m=n.n(b),h=n(31),g=n(218),O=n(2),v=n(14),j=n(74),w=n(23),y=n(20),E=n(221),k=n(76),_=n(152),S=n(72),x=n(5),T=n(93),C=n(69),L=n(6),I=n.n(L),A=n(122),R=n(112);const P=[{value:"preview-1",formattedValue:"preview-1",name:"Blue",label:Object(r.createElement)(d.a,{name:"Blue",count:3}),textLabel:"Blue (3)"},{value:"preview-2",formattedValue:"preview-2",name:"Green",label:Object(r.createElement)(d.a,{name:"Green",count:3}),textLabel:"Green (3)"},{value:"preview-3",formattedValue:"preview-3",name:"Red",label:Object(r.createElement)(d.a,{name:"Red",count:2}),textLabel:"Red (2)"}],F={id:0,name:"preview",taxonomy:"preview",label:"Preview"};n(222);var N=n(56),M=n(94),B=e=>{let{isLoading:t=!1,options:n,checked:o,onChange:s}=e;return t?Object(r.createElement)(r.Fragment,null,Object(r.createElement)("span",{className:"is-loading"}),Object(r.createElement)("span",{className:"is-loading"})):Object(r.createElement)(M.a,{className:"wc-block-attribute-filter-list",options:n,checked:o,onChange:s,isLoading:t,isDisabled:t})},D=n(46);t.a=e=>{let{attributes:t,isEditor:n=!1}=e;const b=Object(O.getSettingWithCoercion)("has_filterable_products",!1,j.a),L=Object(O.getSettingWithCoercion)("is_rendering_php_template",!1,j.a),M=Object(O.getSettingWithCoercion)("page_url",window.location.href,w.a),V=n?[]:Object(O.getSettingWithCoercion)("product_ids",[],Array.isArray),[W,H]=Object(r.useState)(!1),q=t.isPreview&&!t.attributeId?F:Object(A.a)(t.attributeId),U=Object(r.useMemo)(()=>Object(N.e)(q),[q]),[z,K]=Object(r.useState)(U),[G,$]=Object(r.useState)(Object(N.d)()),[Q,Y]=Object(r.useState)(t.isPreview&&!t.attributeId?P:[]),J=Object(s.a)(t),[X]=Object(a.a)(),[Z,ee]=Object(a.b)("attributes",[]),{results:te,isLoading:ne}=Object(l.a)({namespace:"/wc/store/v1",resourceName:"products/attributes/terms",resourceValues:[(null==q?void 0:q.id)||0],shouldSelect:t.attributeId>0}),re="dropdown"!==t.displayStyle&&"and"===t.queryType,{results:oe,isLoading:se}=Object(u.a)({queryAttribute:{taxonomy:(null==q?void 0:q.taxonomy)||"",queryType:t.queryType},queryState:{...X,attributes:re?X.attributes:null},productIds:V,isEditor:n}),ie=Object(r.useCallback)(e=>Object(y.b)(oe,"attribute_counts")&&Array.isArray(oe.attribute_counts)?oe.attribute_counts.find(t=>{let{term:n}=t;return n===e}):null,[oe]);Object(r.useEffect)(()=>{if(ne||se)return;if(!Array.isArray(te))return;const e=te.map(e=>{const n=ie(e.id);if(!(n||z.includes(e.slug)||(o=e.slug,null!=X&&X.attributes&&X.attributes.some(e=>{let{attribute:t,slug:n=[]}=e;return t===(null==q?void 0:q.taxonomy)&&n.includes(o)}))))return null;var o;const s=n?n.count:0;return{formattedValue:Object(N.c)(e.slug),value:e.slug,name:Object(h.decodeEntities)(e.name),label:Object(r.createElement)(d.a,{name:Object(h.decodeEntities)(e.name),count:t.showCounts?s:null}),textLabel:t.showCounts?`${Object(h.decodeEntities)(e.name)} (${s})`:Object(h.decodeEntities)(e.name)}}).filter(e=>!!e);Y(e),$(Object(N.d)())},[null==q?void 0:q.taxonomy,te,ne,t.showCounts,se,ie,z,X.attributes]);const ce=Object(r.useCallback)(e=>Array.isArray(te)?te.reduce((t,n)=>(e.includes(n.slug)&&t.push(n),t),[]):[],[te]),ae=Object(r.useCallback)((function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(e=e.map(e=>({...e,slug:e.slug.map(e=>decodeURIComponent(e))})),t){if(null==q||!q.taxonomy)return;const t=Object.keys(Object(v.getQueryArgs)(window.location.href)),n=Object(N.h)(q.taxonomy),r=t.reduce((e,t)=>t.includes(S.b+n)||t.includes(S.a+n)?Object(v.removeQueryArgs)(e,t):e,window.location.href),o=Object(N.b)(r,e);Object(S.c)(o)}else{const t=Object(N.b)(M,e),n=Object(v.getQueryArgs)(window.location.href),r=Object(v.getQueryArgs)(t);Object(N.f)(n,r)||Object(S.c)(t)}}),[M,null==q?void 0:q.taxonomy]),le=e=>{const n=Object(R.b)(Z,ee,q,ce(e),"or"===t.queryType?"in":"and");ae(n,0===e.length)},ue=Object(r.useCallback)((function(e){let r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];n||(K(e),!r&&t.showFilterButton||Object(R.b)(Z,ee,q,ce(e),"or"===t.queryType?"in":"and"))}),[n,K,Z,ee,q,ce,t.queryType,t.showFilterButton]),de=Object(r.useMemo)(()=>Object(E.a)(Z)?Z.filter(e=>{let{attribute:t}=e;return t===(null==q?void 0:q.taxonomy)}).flatMap(e=>{let{slug:t}=e;return t}):[],[Z,null==q?void 0:q.taxonomy]),pe=Object(i.a)(de),fe=Object(c.a)(pe);Object(r.useEffect)(()=>{!fe||m()(fe,pe)||m()(z,pe)||ue(pe)},[z,pe,fe,ue]);const be="single"!==t.selectType,me=Object(r.useCallback)(e=>{const t=z.includes(e);let n;be?(n=z.filter(t=>t!==e),t||(n.push(e),n.sort())):n=t?[]:[e],ue(n)},[z,be,ue]);Object(r.useEffect)(()=>{q&&!t.showFilterButton&&(Object(N.a)({currentCheckedFilters:z,hasSetFilterDefaultsFromUrl:W})?ae(Z,!0):ae(Z,!1))},[W,ae,Z,q,z,t.showFilterButton]),Object(r.useEffect)(()=>{if(!W&&!ne)return U.length>0?(H(!0),void ue(U,!0)):void(L||H(!0))},[q,W,ne,ue,U,L]);const he=Object(D.b)();if(!b)return he(!1),null;if(!q)return n?Object(r.createElement)(g.a,{status:"warning",isDismissible:!1},Object(r.createElement)("p",null,Object(o.__)("Please select an attribute to use this filter!","woo-gutenberg-products-block"))):(he(!1),null);if(0===Q.length&&!ne&&n)return Object(r.createElement)(g.a,{status:"warning",isDismissible:!1},Object(r.createElement)("p",null,Object(o.__)("There are no products with the selected attributes.","woo-gutenberg-products-block")));const ge="h"+t.headingLevel,Oe=!t.isPreview&&ne,ve=!t.isPreview&&se,je=(Oe||ve)&&0===Q.length;if(!je&&0===Q.length)return he(!1),null;const we=be?!je&&z.length!z.includes(e.value)).map(e=>e.formattedValue),disabled:je,placeholder:Object(o.sprintf)( +/* translators: %s attribute name. */ +Object(o.__)("Select %s","woo-gutenberg-products-block"),q.label),onChange:e=>{!be&&e.length>1&&(e=[e[e.length-1]]),e=e.map(e=>{const t=Q.find(t=>t.formattedValue===e);return t?t.value:e});const t=Object(x.difference)(e,z);if(1===t.length)return me(t[0]);const n=Object(x.difference)(z,e);1===n.length&&me(n[0])},value:z,displayTransform:e=>{const t=Q.find(t=>[t.value,t.formattedValue].includes(e));return t?t.textLabel:e},saveTransform:N.c,messages:{added:Object(o.sprintf)( +/* translators: %s is the attribute label. */ +Object(o.__)("%s filter added.","woo-gutenberg-products-block"),q.label),removed:Object(o.sprintf)( +/* translators: %s is the attribute label. */ +Object(o.__)("%s filter removed.","woo-gutenberg-products-block"),q.label),remove:Object(o.sprintf)( +/* translators: %s is the attribute label. */ +Object(o.__)("Remove %s filter.","woo-gutenberg-products-block"),q.label.toLocaleLowerCase()),__experimentalInvalid:Object(o.sprintf)( +/* translators: %s is the attribute label. */ +Object(o.__)("Invalid %s filter.","woo-gutenberg-products-block"),q.label.toLocaleLowerCase())}}),we&&Object(r.createElement)(k.a,{icon:_.a,size:30})):Object(r.createElement)(B,{options:Q,checked:z,onChange:me,isLoading:je,isDisabled:je})),Object(r.createElement)("div",{className:"wc-block-attribute-filter__actions"},(z.length>0||n)&&!je&&Object(r.createElement)(p.a,{onClick:()=>{K([]),$(Object(N.d)()),W&&le([])},screenReaderLabel:Object(o.__)("Reset attribute filter","woo-gutenberg-products-block")}),t.showFilterButton&&Object(r.createElement)(f.a,{className:"wc-block-attribute-filter__button",isLoading:je,disabled:(()=>{if(Oe||ve)return!0;const e=Object(N.e)(q);return e.length===z.length&&z.every(t=>e.includes(t))})(),onClick:()=>le(z)})))}},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t,n){"use strict";var r=n(0),o=n(5),s=n(6),i=n.n(s),c=n(1),a=n(28),l=n(125),u=n(55);function d(e){switch(e){case"success":case"warning":case"info":return"polite";case"error":default:return"assertive"}}t.a=function({className:e,status:t="info",children:n,spokenMessage:s=n,onRemove:p=o.noop,isDismissible:f=!0,actions:b=[],politeness:m=d(t),__unstableHTML:h,onDismiss:g=o.noop}){!function(e,t){const n="string"==typeof e?e:Object(r.renderToString)(e);Object(r.useEffect)(()=>{n&&Object(a.speak)(n,t)},[n,t])}(s,m);const O=i()(e,"components-notice","is-"+t,{"is-dismissible":f});return h&&(n=Object(r.createElement)(r.RawHTML,null,n)),Object(r.createElement)("div",{className:O},Object(r.createElement)("div",{className:"components-notice__content"},n,Object(r.createElement)("div",{className:"components-notice__actions"},b.map(({className:e,label:t,isPrimary:n,variant:o,noDefaultClasses:s=!1,onClick:c,url:a},l)=>{let d=o;return"primary"===o||s||(d=a?"link":"secondary"),void 0===d&&n&&(d="primary"),Object(r.createElement)(u.a,{key:l,href:a,variant:d,onClick:a?void 0:c,className:i()("components-notice__action",e)},t)}))),f&&Object(r.createElement)(u.a,{className:"components-notice__dismiss",icon:l.a,label:Object(c.__)("Dismiss this notice"),onClick:e=>{var t;null==e||null===(t=e.preventDefault)||void 0===t||t.call(e),g(),p()},showTooltip:!1}))}},,,function(e,t,n){"use strict";n.d(t,"b",(function(){return s})),n.d(t,"a",(function(){return c}));var r=n(20);const o=e=>Object(r.b)(e,"count")&&Object(r.b)(e,"description")&&Object(r.b)(e,"id")&&Object(r.b)(e,"name")&&Object(r.b)(e,"parent")&&Object(r.b)(e,"slug")&&"number"==typeof e.count&&"string"==typeof e.description&&"number"==typeof e.id&&"string"==typeof e.name&&"number"==typeof e.parent&&"string"==typeof e.slug,s=e=>Array.isArray(e)&&e.every(o),i=e=>Object(r.b)(e,"attribute")&&Object(r.b)(e,"operator")&&Object(r.b)(e,"slug")&&"string"==typeof e.attribute&&"string"==typeof e.operator&&Array.isArray(e.slug)&&e.slug.every(e=>"string"==typeof e),c=e=>Array.isArray(e)&&e.every(i)},function(e,t){},,,,,,,,,,,,,,,,,,,function(e,t,n){e.exports=n(242)},function(e,t,n){"use strict";n.r(t);var r=n(50),o=n(159),s=n(56);Object(r.a)({selector:".wp-block-woocommerce-attribute-filter",Block:o.a,getProps:e=>({isEditor:!1,attributes:Object(s.g)(e.dataset)})})}]); \ No newline at end of file diff --git a/build/attribute-filter-wrapper-frontend.js b/build/attribute-filter-wrapper-frontend.js new file mode 100644 index 00000000000..2827e7b04c0 --- /dev/null +++ b/build/attribute-filter-wrapper-frontend.js @@ -0,0 +1,21 @@ +(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[14],{102:function(e,t){},103:function(e,t){},104:function(e,t){},112:function(e,t,n){"use strict";n.d(t,"a",(function(){return c})),n.d(t,"b",(function(){return a}));var r=n(5);const c=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0,c=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";const a=e.filter(e=>e.attribute===n.taxonomy),o=a.length?a[0]:null;if(!(o&&o.slug&&Array.isArray(o.slug)&&o.slug.includes(c)))return;const s=o.slug.filter(e=>e!==c),l=e.filter(e=>e.attribute!==n.taxonomy);s.length>0&&(o.slug=s.sort(),l.push(o)),t(Object(r.sortBy)(l,"attribute"))},a=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0,c=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"in";if(!n||!n.taxonomy)return[];const o=e.filter(e=>e.attribute!==n.taxonomy);return 0===c.length?t(o):(o.push({attribute:n.taxonomy,operator:a,slug:c.map(e=>{let{slug:t}=e;return t}).sort()}),t(Object(r.sortBy)(o,"attribute"))),o}},115:function(e,t,n){"use strict";n.d(t,"a",(function(){return c})),n(53);var r=n(37);const c=()=>r.n>1},116:function(e,t,n){"use strict";n.d(t,"a",(function(){return a}));var r=n(23),c=n(20);const a=e=>Object(r.a)(e)?JSON.parse(e)||{}:Object(c.a)(e)?e:{}},117:function(e,t){},118:function(e,t){},122:function(e,t,n){"use strict";n.d(t,"a",(function(){return a})),n.d(t,"b",(function(){return o}));var r=n(2);const c=Object(r.getSetting)("attributes",[]).reduce((e,t)=>{const n=(r=t)&&r.attribute_name?{id:parseInt(r.attribute_id,10),name:r.attribute_name,taxonomy:"pa_"+r.attribute_name,label:r.attribute_label}:null;var r;return n&&n.id&&e.push(n),e},[]),a=e=>{if(e)return c.find(t=>t.id===e)},o=e=>{if(e)return c.find(t=>t.taxonomy===e)}},128:function(e){e.exports=JSON.parse('{"name":"woocommerce/attribute-filter","version":"1.0.0","title":"Filter by Attribute Controls","description":"Enable customers to filter the product grid by selecting one or more attributes, such as color.","category":"woocommerce","keywords":["WooCommerce"],"supports":{"html":false,"color":{"text":true,"background":false},"inserter":false,"lock":false},"attributes":{"className":{"type":"string","default":""},"attributeId":{"type":"number","default":0},"showCounts":{"type":"boolean","default":true},"queryType":{"type":"string","default":"or"},"headingLevel":{"type":"number","default":3},"displayStyle":{"type":"string","default":"list"},"showFilterButton":{"type":"boolean","default":false},"selectType":{"type":"string","default":"multiple"},"isPreview":{"type":"boolean","default":false}},"textdomain":"woo-gutenberg-products-block","apiVersion":2,"$schema":"https://schemas.wp.org/trunk/block.json"}')},138:function(e,t){},139:function(e,t,n){"use strict";n.d(t,"a",(function(){return b}));var r=n(0),c=n(98),a=n(5),o=n(30),s=n(20),l=n(32),i=n(63),u=n(25);const b=e=>{let{queryAttribute:t,queryPrices:n,queryStock:b,queryRating:d,queryState:m,productIds:f,isEditor:p=!1}=e,O=Object(u.a)();O+="-collection-data";const[j]=Object(l.a)(O),[g,y]=Object(l.b)("calculate_attribute_counts",[],O),[h,v]=Object(l.b)("calculate_price_range",null,O),[w,_]=Object(l.b)("calculate_stock_status_counts",null,O),[E,k]=Object(l.b)("calculate_rating_counts",null,O),C=Object(o.a)(t||{}),S=Object(o.a)(n),x=Object(o.a)(b),N=Object(o.a)(d);Object(r.useEffect)(()=>{"object"==typeof C&&Object.keys(C).length&&(g.find(e=>Object(s.b)(C,"taxonomy")&&e.taxonomy===C.taxonomy)||y([...g,C]))},[C,g,y]),Object(r.useEffect)(()=>{h!==S&&void 0!==S&&v(S)},[S,v,h]),Object(r.useEffect)(()=>{w!==x&&void 0!==x&&_(x)},[x,_,w]),Object(r.useEffect)(()=>{E!==N&&void 0!==N&&k(N)},[N,k,E]);const[T,L]=Object(r.useState)(p),[A]=Object(c.a)(T,200);T||L(!0);const R=Object(r.useMemo)(()=>(e=>{const t=e;return Array.isArray(e.calculate_attribute_counts)&&(t.calculate_attribute_counts=Object(a.sortBy)(e.calculate_attribute_counts.map(e=>{let{taxonomy:t,queryType:n}=e;return{taxonomy:t,query_type:n}}),["taxonomy","query_type"])),t})(j),[j]);return Object(i.a)({namespace:"/wc/store/v1",resourceName:"products/collection-data",query:{...m,page:void 0,per_page:void 0,orderby:void 0,order:void 0,...!Object(a.isEmpty)(f)&&{include:f},...R},shouldSelect:A})}},151:function(e,t,n){"use strict";n.d(t,"a",(function(){return s}));var r=n(66),c=n(115),a=n(20),o=n(116);const s=e=>{if(!Object(c.a)())return{className:"",style:{}};const t=Object(a.a)(e)?e:{},n=Object(o.a)(t.style);return Object(r.__experimentalUseBorderProps)({...t,style:n})}},159:function(e,t,n){"use strict";var r=n(0),c=n(1),a=n(151),o=n(30),s=n(64),l=n(32),i=n(63),u=n(139),b=n(65),d=n(70),m=n(71),f=n(13),p=n.n(f),O=n(31),j=n(218),g=n(2),y=n(14),h=n(74),v=n(23),w=n(20),_=n(221),E=n(76),k=n(152),C=n(72),S=n(5),x=n(93),N=n(69),T=n(6),L=n.n(T),A=n(122),R=n(112);const F=[{value:"preview-1",formattedValue:"preview-1",name:"Blue",label:Object(r.createElement)(b.a,{name:"Blue",count:3}),textLabel:"Blue (3)"},{value:"preview-2",formattedValue:"preview-2",name:"Green",label:Object(r.createElement)(b.a,{name:"Green",count:3}),textLabel:"Green (3)"},{value:"preview-3",formattedValue:"preview-3",name:"Red",label:Object(r.createElement)(b.a,{name:"Red",count:2}),textLabel:"Red (2)"}],q={id:0,name:"preview",taxonomy:"preview",label:"Preview"};n(222);var I=n(56),B=n(94),D=e=>{let{isLoading:t=!1,options:n,checked:c,onChange:a}=e;return t?Object(r.createElement)(r.Fragment,null,Object(r.createElement)("span",{className:"is-loading"}),Object(r.createElement)("span",{className:"is-loading"})):Object(r.createElement)(B.a,{className:"wc-block-attribute-filter-list",options:n,checked:c,onChange:a,isLoading:t,isDisabled:t})},M=n(46);t.a=e=>{let{attributes:t,isEditor:n=!1}=e;const f=Object(g.getSettingWithCoercion)("has_filterable_products",!1,h.a),T=Object(g.getSettingWithCoercion)("is_rendering_php_template",!1,h.a),B=Object(g.getSettingWithCoercion)("page_url",window.location.href,v.a),P=n?[]:Object(g.getSettingWithCoercion)("product_ids",[],Array.isArray),[Q,V]=Object(r.useState)(!1),U=t.isPreview&&!t.attributeId?q:Object(A.a)(t.attributeId),Y=Object(r.useMemo)(()=>Object(I.e)(U),[U]),[W,$]=Object(r.useState)(Y),[K,J]=Object(r.useState)(Object(I.d)()),[G,H]=Object(r.useState)(t.isPreview&&!t.attributeId?F:[]),z=Object(a.a)(t),[Z]=Object(l.a)(),[X,ee]=Object(l.b)("attributes",[]),{results:te,isLoading:ne}=Object(i.a)({namespace:"/wc/store/v1",resourceName:"products/attributes/terms",resourceValues:[(null==U?void 0:U.id)||0],shouldSelect:t.attributeId>0}),re="dropdown"!==t.displayStyle&&"and"===t.queryType,{results:ce,isLoading:ae}=Object(u.a)({queryAttribute:{taxonomy:(null==U?void 0:U.taxonomy)||"",queryType:t.queryType},queryState:{...Z,attributes:re?Z.attributes:null},productIds:P,isEditor:n}),oe=Object(r.useCallback)(e=>Object(w.b)(ce,"attribute_counts")&&Array.isArray(ce.attribute_counts)?ce.attribute_counts.find(t=>{let{term:n}=t;return n===e}):null,[ce]);Object(r.useEffect)(()=>{if(ne||ae)return;if(!Array.isArray(te))return;const e=te.map(e=>{const n=oe(e.id);if(!(n||W.includes(e.slug)||(c=e.slug,null!=Z&&Z.attributes&&Z.attributes.some(e=>{let{attribute:t,slug:n=[]}=e;return t===(null==U?void 0:U.taxonomy)&&n.includes(c)}))))return null;var c;const a=n?n.count:0;return{formattedValue:Object(I.c)(e.slug),value:e.slug,name:Object(O.decodeEntities)(e.name),label:Object(r.createElement)(b.a,{name:Object(O.decodeEntities)(e.name),count:t.showCounts?a:null}),textLabel:t.showCounts?`${Object(O.decodeEntities)(e.name)} (${a})`:Object(O.decodeEntities)(e.name)}}).filter(e=>!!e);H(e),J(Object(I.d)())},[null==U?void 0:U.taxonomy,te,ne,t.showCounts,ae,oe,W,Z.attributes]);const se=Object(r.useCallback)(e=>Array.isArray(te)?te.reduce((t,n)=>(e.includes(n.slug)&&t.push(n),t),[]):[],[te]),le=Object(r.useCallback)((function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(e=e.map(e=>({...e,slug:e.slug.map(e=>decodeURIComponent(e))})),t){if(null==U||!U.taxonomy)return;const t=Object.keys(Object(y.getQueryArgs)(window.location.href)),n=Object(I.h)(U.taxonomy),r=t.reduce((e,t)=>t.includes(C.b+n)||t.includes(C.a+n)?Object(y.removeQueryArgs)(e,t):e,window.location.href),c=Object(I.b)(r,e);Object(C.c)(c)}else{const t=Object(I.b)(B,e),n=Object(y.getQueryArgs)(window.location.href),r=Object(y.getQueryArgs)(t);Object(I.f)(n,r)||Object(C.c)(t)}}),[B,null==U?void 0:U.taxonomy]),ie=e=>{const n=Object(R.b)(X,ee,U,se(e),"or"===t.queryType?"in":"and");le(n,0===e.length)},ue=Object(r.useCallback)((function(e){let r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];n||($(e),!r&&t.showFilterButton||Object(R.b)(X,ee,U,se(e),"or"===t.queryType?"in":"and"))}),[n,$,X,ee,U,se,t.queryType,t.showFilterButton]),be=Object(r.useMemo)(()=>Object(_.a)(X)?X.filter(e=>{let{attribute:t}=e;return t===(null==U?void 0:U.taxonomy)}).flatMap(e=>{let{slug:t}=e;return t}):[],[X,null==U?void 0:U.taxonomy]),de=Object(o.a)(be),me=Object(s.a)(de);Object(r.useEffect)(()=>{!me||p()(me,de)||p()(W,de)||ue(de)},[W,de,me,ue]);const fe="single"!==t.selectType,pe=Object(r.useCallback)(e=>{const t=W.includes(e);let n;fe?(n=W.filter(t=>t!==e),t||(n.push(e),n.sort())):n=t?[]:[e],ue(n)},[W,fe,ue]);Object(r.useEffect)(()=>{U&&!t.showFilterButton&&(Object(I.a)({currentCheckedFilters:W,hasSetFilterDefaultsFromUrl:Q})?le(X,!0):le(X,!1))},[Q,le,X,U,W,t.showFilterButton]),Object(r.useEffect)(()=>{if(!Q&&!ne)return Y.length>0?(V(!0),void ue(Y,!0)):void(T||V(!0))},[U,Q,ne,ue,Y,T]);const Oe=Object(M.b)();if(!f)return Oe(!1),null;if(!U)return n?Object(r.createElement)(j.a,{status:"warning",isDismissible:!1},Object(r.createElement)("p",null,Object(c.__)("Please select an attribute to use this filter!","woo-gutenberg-products-block"))):(Oe(!1),null);if(0===G.length&&!ne&&n)return Object(r.createElement)(j.a,{status:"warning",isDismissible:!1},Object(r.createElement)("p",null,Object(c.__)("There are no products with the selected attributes.","woo-gutenberg-products-block")));const je="h"+t.headingLevel,ge=!t.isPreview&&ne,ye=!t.isPreview&&ae,he=(ge||ye)&&0===G.length;if(!he&&0===G.length)return Oe(!1),null;const ve=fe?!he&&W.length!W.includes(e.value)).map(e=>e.formattedValue),disabled:he,placeholder:Object(c.sprintf)( +/* translators: %s attribute name. */ +Object(c.__)("Select %s","woo-gutenberg-products-block"),U.label),onChange:e=>{!fe&&e.length>1&&(e=[e[e.length-1]]),e=e.map(e=>{const t=G.find(t=>t.formattedValue===e);return t?t.value:e});const t=Object(S.difference)(e,W);if(1===t.length)return pe(t[0]);const n=Object(S.difference)(W,e);1===n.length&&pe(n[0])},value:W,displayTransform:e=>{const t=G.find(t=>[t.value,t.formattedValue].includes(e));return t?t.textLabel:e},saveTransform:I.c,messages:{added:Object(c.sprintf)( +/* translators: %s is the attribute label. */ +Object(c.__)("%s filter added.","woo-gutenberg-products-block"),U.label),removed:Object(c.sprintf)( +/* translators: %s is the attribute label. */ +Object(c.__)("%s filter removed.","woo-gutenberg-products-block"),U.label),remove:Object(c.sprintf)( +/* translators: %s is the attribute label. */ +Object(c.__)("Remove %s filter.","woo-gutenberg-products-block"),U.label.toLocaleLowerCase()),__experimentalInvalid:Object(c.sprintf)( +/* translators: %s is the attribute label. */ +Object(c.__)("Invalid %s filter.","woo-gutenberg-products-block"),U.label.toLocaleLowerCase())}}),ve&&Object(r.createElement)(E.a,{icon:k.a,size:30})):Object(r.createElement)(D,{options:G,checked:W,onChange:pe,isLoading:he,isDisabled:he})),Object(r.createElement)("div",{className:"wc-block-attribute-filter__actions"},(W.length>0||n)&&!he&&Object(r.createElement)(d.a,{onClick:()=>{$([]),J(Object(I.d)()),Q&&ie([])},screenReaderLabel:Object(c.__)("Reset attribute filter","woo-gutenberg-products-block")}),t.showFilterButton&&Object(r.createElement)(m.a,{className:"wc-block-attribute-filter__button",isLoading:he,disabled:(()=>{if(ge||ye)return!0;const e=Object(I.e)(U);return e.length===W.length&&W.every(t=>e.includes(t))})(),onClick:()=>ie(W)})))}},20:function(e,t,n){"use strict";n.d(t,"a",(function(){return r})),n.d(t,"b",(function(){return c}));const r=e=>!(e=>null===e)(e)&&e instanceof Object&&e.constructor===Object;function c(e,t){return r(e)&&t in e}},21:function(e,t,n){"use strict";var r=n(0),c=n(6),a=n.n(c);t.a=e=>{let t,{label:n,screenReaderLabel:c,wrapperElement:o,wrapperProps:s={}}=e;const l=null!=n,i=null!=c;return!l&&i?(t=o||"span",s={...s,className:a()(s.className,"screen-reader-text")},Object(r.createElement)(t,s,c)):(t=o||r.Fragment,l&&i&&n!==c?Object(r.createElement)(t,s,Object(r.createElement)("span",{"aria-hidden":"true"},n),Object(r.createElement)("span",{className:"screen-reader-text"},c)):Object(r.createElement)(t,s,n))}},218:function(e,t,n){"use strict";var r=n(0),c=n(5),a=n(6),o=n.n(a),s=n(1),l=n(28),i=n(125),u=n(55);function b(e){switch(e){case"success":case"warning":case"info":return"polite";case"error":default:return"assertive"}}t.a=function({className:e,status:t="info",children:n,spokenMessage:a=n,onRemove:d=c.noop,isDismissible:m=!0,actions:f=[],politeness:p=b(t),__unstableHTML:O,onDismiss:j=c.noop}){!function(e,t){const n="string"==typeof e?e:Object(r.renderToString)(e);Object(r.useEffect)(()=>{n&&Object(l.speak)(n,t)},[n,t])}(a,p);const g=o()(e,"components-notice","is-"+t,{"is-dismissible":m});return O&&(n=Object(r.createElement)(r.RawHTML,null,n)),Object(r.createElement)("div",{className:g},Object(r.createElement)("div",{className:"components-notice__content"},n,Object(r.createElement)("div",{className:"components-notice__actions"},f.map(({className:e,label:t,isPrimary:n,variant:c,noDefaultClasses:a=!1,onClick:s,url:l},i)=>{let b=c;return"primary"===c||a||(b=l?"link":"secondary"),void 0===b&&n&&(b="primary"),Object(r.createElement)(u.a,{key:i,href:l,variant:b,onClick:l?void 0:s,className:o()("components-notice__action",e)},t)}))),m&&Object(r.createElement)(u.a,{className:"components-notice__dismiss",icon:i.a,label:Object(s.__)("Dismiss this notice"),onClick:e=>{var t;null==e||null===(t=e.preventDefault)||void 0===t||t.call(e),j(),d()},showTooltip:!1}))}},221:function(e,t,n){"use strict";n.d(t,"b",(function(){return a})),n.d(t,"a",(function(){return s}));var r=n(20);const c=e=>Object(r.b)(e,"count")&&Object(r.b)(e,"description")&&Object(r.b)(e,"id")&&Object(r.b)(e,"name")&&Object(r.b)(e,"parent")&&Object(r.b)(e,"slug")&&"number"==typeof e.count&&"string"==typeof e.description&&"number"==typeof e.id&&"string"==typeof e.name&&"number"==typeof e.parent&&"string"==typeof e.slug,a=e=>Array.isArray(e)&&e.every(c),o=e=>Object(r.b)(e,"attribute")&&Object(r.b)(e,"operator")&&Object(r.b)(e,"slug")&&"string"==typeof e.attribute&&"string"==typeof e.operator&&Array.isArray(e.slug)&&e.slug.every(e=>"string"==typeof e),s=e=>Array.isArray(e)&&e.every(o)},222:function(e,t){},23:function(e,t,n){"use strict";n.d(t,"a",(function(){return r}));const r=e=>"string"==typeof e},25:function(e,t,n){"use strict";n.d(t,"a",(function(){return a}));var r=n(0);const c=Object(r.createContext)("page"),a=()=>Object(r.useContext)(c);c.Provider},287:function(e,t,n){"use strict";n.d(t,"a",(function(){return s}));var r=n(66),c=n(115),a=n(20),o=n(116);const s=e=>{if(!Object(c.a)())return{className:"",style:{}};const t=Object(a.a)(e)?e:{},n=Object(o.a)(t.style);return Object(r.__experimentalUseColorProps)({...t,style:n})}},30:function(e,t,n){"use strict";n.d(t,"a",(function(){return o}));var r=n(0),c=n(13),a=n.n(c);function o(e){const t=Object(r.useRef)(e);return a()(e,t.current)||(t.current=e),t.current}},32:function(e,t,n){"use strict";n.d(t,"a",(function(){return b})),n.d(t,"b",(function(){return d})),n.d(t,"c",(function(){return m}));var r=n(3),c=n(7),a=n(0),o=n(13),s=n.n(o),l=n(30),i=n(64),u=n(25);const b=e=>{const t=Object(u.a)();e=e||t;const n=Object(c.useSelect)(t=>t(r.QUERY_STATE_STORE_KEY).getValueForQueryContext(e,void 0),[e]),{setValueForQueryContext:o}=Object(c.useDispatch)(r.QUERY_STATE_STORE_KEY);return[n,Object(a.useCallback)(t=>{o(e,t)},[e,o])]},d=(e,t,n)=>{const o=Object(u.a)();n=n||o;const s=Object(c.useSelect)(c=>c(r.QUERY_STATE_STORE_KEY).getValueForQueryKey(n,e,t),[n,e]),{setQueryValue:l}=Object(c.useDispatch)(r.QUERY_STATE_STORE_KEY);return[s,Object(a.useCallback)(t=>{l(n,e,t)},[n,e,l])]},m=(e,t)=>{const n=Object(u.a)();t=t||n;const[r,c]=b(t),o=Object(l.a)(r),d=Object(l.a)(e),m=Object(i.a)(d),f=Object(a.useRef)(!1);return Object(a.useEffect)(()=>{s()(m,d)||(c(Object.assign({},o,d)),f.current=!0)},[o,d,m,c]),f.current?[r,c]:[e,c]}},486:function(e,t,n){"use strict";n.r(t);var r=n(0),c=n(287),a=n(23),o=n(159),s=n(56);t.default=e=>{const t=Object(c.a)(e);return Object(r.createElement)("div",{className:Object(a.a)(e.className)?e.className:"",style:{...t.style}},Object(r.createElement)(o.a,{isEditor:!1,attributes:Object(s.g)(e)}))}},56:function(e,t,n){"use strict";n.d(t,"d",(function(){return s})),n.d(t,"h",(function(){return l})),n.d(t,"b",(function(){return i})),n.d(t,"a",(function(){return u})),n.d(t,"e",(function(){return b})),n.d(t,"f",(function(){return d})),n.d(t,"c",(function(){return m})),n.d(t,"g",(function(){return f}));var r=n(14),c=n(72),a=n(23),o=n(128);function s(){return Math.floor(Math.random()*Date.now())}const l=e=>e.replace("pa_",""),i=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const n={};t.forEach(e=>{const{attribute:t,slug:r,operator:a}=e,o=l(t),s=r.join(","),i=`${c.b}${o}`,u="in"===a?"or":"and";n[`${c.a}${o}`]=s,n[i]=u});const a=Object(r.removeQueryArgs)(e,...Object.keys(n));return Object(r.addQueryArgs)(a,n)},u=e=>{let{currentCheckedFilters:t,hasSetFilterDefaultsFromUrl:n}=e;return n&&0===t.length},b=e=>{if(e){const t=Object(c.d)("filter_"+e.name);return("string"==typeof t?t.split(","):[]).map(e=>encodeURIComponent(e).toLowerCase())}return[]},d=(e,t)=>{const n=Object.entries(t).reduce((e,t)=>{let[n,r]=t;return n.includes("query_type")?e:{...e,[n]:r}},{});return Object.entries(n).reduce((t,n)=>{let[r,c]=n;return e[r]===c&&t},!0)},m=e=>e.trim().replace(/\s/g,"-").replace(/_/g,"-").replace(/-+/g,"-").replace(/[^a-zA-Z0-9-]/g,""),f=e=>({className:Object(a.a)(null==e?void 0:e.className)?e.className:"",attributeId:parseInt(Object(a.a)(null==e?void 0:e.attributeId)?e.attributeId:"0",10),showCounts:"false"!==(null==e?void 0:e.showCounts),queryType:Object(a.a)(null==e?void 0:e.queryType)&&e.queryType||o.attributes.queryType.default,heading:Object(a.a)(null==e?void 0:e.heading)?e.heading:"",headingLevel:Object(a.a)(null==e?void 0:e.headingLevel)&&parseInt(e.headingLevel,10)||o.attributes.headingLevel.default,displayStyle:Object(a.a)(null==e?void 0:e.displayStyle)&&e.displayStyle||o.attributes.displayStyle.default,showFilterButton:"true"===(null==e?void 0:e.showFilterButton),selectType:Object(a.a)(null==e?void 0:e.selectType)&&e.selectType||o.attributes.selectType.default,isPreview:!1})},63:function(e,t,n){"use strict";n.d(t,"a",(function(){return s}));var r=n(3),c=n(7),a=n(0),o=n(30);const s=e=>{const{namespace:t,resourceName:n,resourceValues:s=[],query:l={},shouldSelect:i=!0}=e;if(!t||!n)throw new Error("The options object must have valid values for the namespace and the resource properties.");const u=Object(a.useRef)({results:[],isLoading:!0}),b=Object(o.a)(l),d=Object(o.a)(s),m=(()=>{const[,e]=Object(a.useState)();return Object(a.useCallback)(t=>{e(()=>{throw t})},[])})(),f=Object(c.useSelect)(e=>{if(!i)return null;const c=e(r.COLLECTIONS_STORE_KEY),a=[t,n,b,d],o=c.getCollectionError(...a);if(o){if(!(o instanceof Error))throw new Error("TypeError: `error` object is not an instance of Error constructor");m(o)}return{results:c.getCollection(...a),isLoading:!c.hasFinishedResolution("getCollection",a)}},[t,n,d,b,i]);return null!==f&&(u.current=f),u.current}},64:function(e,t,n){"use strict";n.d(t,"a",(function(){return c}));var r=n(8);function c(e,t){const n=Object(r.useRef)();return Object(r.useEffect)(()=>{n.current===e||t&&!t(e,n.current)||(n.current=e)},[e,t]),n.current}},65:function(e,t,n){"use strict";var r=n(0),c=n(1),a=n(21);n(138),t.a=e=>{let{name:t,count:n}=e;return Object(r.createElement)(r.Fragment,null,t,null!==n&&Number.isFinite(n)&&Object(r.createElement)(a.a,{label:n.toString(),screenReaderLabel:Object(c.sprintf)( +/* translators: %s number of products. */ +Object(c._n)("%s product","%s products",n,"woo-gutenberg-products-block"),n),wrapperElement:"span",wrapperProps:{className:"wc-filter-element-label-list-count"}}))}},69:function(e,t,n){"use strict";var r=n(0);n(102),t.a=e=>{let{children:t}=e;return Object(r.createElement)("div",{className:"wc-block-filter-title-placeholder"},t)}},70:function(e,t,n){"use strict";var r=n(0),c=n(1),a=n(6),o=n.n(a),s=n(21);n(103),t.a=e=>{let{className:t,label: +/* translators: Reset button text for filters. */ +n=Object(c.__)("Reset","woo-gutenberg-products-block"),onClick:a,screenReaderLabel:l=Object(c.__)("Reset filter","woo-gutenberg-products-block")}=e;return Object(r.createElement)("button",{className:o()("wc-block-components-filter-reset-button",t),onClick:a},Object(r.createElement)(s.a,{label:n,screenReaderLabel:l}))}},71:function(e,t,n){"use strict";var r=n(0),c=n(1),a=n(6),o=n.n(a),s=n(21);n(104),t.a=e=>{let{className:t,isLoading:n,disabled:a,label: +/* translators: Submit button text for filters. */ +l=Object(c.__)("Apply","woo-gutenberg-products-block"),onClick:i,screenReaderLabel:u=Object(c.__)("Apply filter","woo-gutenberg-products-block")}=e;return Object(r.createElement)("button",{type:"submit",className:o()("wp-block-button__link","wc-block-filter-submit-button","wc-block-components-filter-submit-button",{"is-loading":n},t),disabled:a,onClick:i},Object(r.createElement)(s.a,{label:l,screenReaderLabel:u}))}},72:function(e,t,n){"use strict";n.d(t,"b",(function(){return s})),n.d(t,"a",(function(){return l})),n.d(t,"d",(function(){return i})),n.d(t,"c",(function(){return u}));var r=n(14),c=n(2),a=n(74);const o=Object(c.getSettingWithCoercion)("is_rendering_php_template",!1,a.a),s="query_type_",l="filter_";function i(e){return window?Object(r.getQueryArg)(window.location.href,e):null}function u(e){o?window.location.href=e:window.history.replaceState({},"",e)}},74:function(e,t,n){"use strict";n.d(t,"a",(function(){return r}));const r=e=>"boolean"==typeof e},93:function(e,t,n){"use strict";var r=n(15),c=n.n(r),a=n(0),o=n(130),s=n(6),l=n.n(s);n(117),t.a=e=>{let{className:t,style:n,suggestions:r,multiple:s=!0,saveTransform:i=(e=>e.trim().replace(/\s/g,"-")),messages:u={},validateInput:b=(e=>r.includes(e)),label:d="",...m}=e;return Object(a.createElement)("div",{className:l()("wc-blocks-components-form-token-field-wrapper",t,{"single-selection":!s}),style:n},Object(a.createElement)(o.a,c()({label:d,__experimentalExpandOnFocus:!0,__experimentalShowHowTo:!1,__experimentalValidateInput:b,saveTransform:i,maxLength:s?void 0:1,suggestions:r,messages:u},m)))}},94:function(e,t,n){"use strict";var r=n(0),c=n(1),a=n(6),o=n.n(a),s=n(11);n(118),t.a=e=>{let{className:t,onChange:n,options:a=[],checked:l=[],isLoading:i=!1,isDisabled:u=!1,limit:b=10}=e;const[d,m]=Object(r.useState)(!1),f=Object(r.useMemo)(()=>[...Array(5)].map((e,t)=>Object(r.createElement)("li",{key:t,style:{width:Math.floor(75*Math.random())+25+"%"}})),[]),p=Object(r.useMemo)(()=>{const e=a.length-b;return!d&&Object(r.createElement)("li",{key:"show-more",className:"show-more"},Object(r.createElement)("button",{onClick:()=>{m(!0)},"aria-expanded":!1,"aria-label":Object(c.sprintf)( +/* translators: %s is referring the remaining count of options */ +Object(c._n)("Show %s more option","Show %s more options",e,"woo-gutenberg-products-block"),e)},Object(c.sprintf)( +/* translators: %s number of options to reveal. */ +Object(c._n)("Show %s more","Show %s more",e,"woo-gutenberg-products-block"),e)))},[a,b,d]),O=Object(r.useMemo)(()=>d&&Object(r.createElement)("li",{key:"show-less",className:"show-less"},Object(r.createElement)("button",{onClick:()=>{m(!1)},"aria-expanded":!0,"aria-label":Object(c.__)("Show less options","woo-gutenberg-products-block")},Object(c.__)("Show less","woo-gutenberg-products-block"))),[d]),j=Object(r.useMemo)(()=>{const e=a.length>b+5;return Object(r.createElement)(r.Fragment,null,a.map((t,c)=>Object(r.createElement)(r.Fragment,{key:t.value},Object(r.createElement)("li",e&&!d&&c>=b&&{hidden:!0},Object(r.createElement)(s.CheckboxControl,{id:t.value,className:"wc-block-checkbox-list__checkbox",label:t.label,checked:l.includes(t.value),onChange:()=>{n(t.value)},disabled:u})),e&&c===b-1&&p)),e&&O)},[a,n,l,d,b,O,p,u]),g=o()("wc-block-checkbox-list","wc-block-components-checkbox-list",{"is-loading":i},t);return Object(r.createElement)("ul",{className:g},i?f:j)}}}]); \ No newline at end of file diff --git a/build/attribute-filter.asset.php b/build/attribute-filter.asset.php new file mode 100644 index 00000000000..92c2544c735 --- /dev/null +++ b/build/attribute-filter.asset.php @@ -0,0 +1 @@ + array('lodash', 'react', 'wc-blocks-checkout', 'wc-blocks-data-store', 'wc-settings', 'wp-a11y', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-deprecated', 'wp-dom', 'wp-element', 'wp-html-entities', 'wp-i18n', 'wp-is-shallow-equal', 'wp-keycodes', 'wp-polyfill', 'wp-primitives', 'wp-url', 'wp-warning'), 'version' => 'c6f6447c76999c4a292b904545af82eb'); \ No newline at end of file diff --git a/build/attribute-filter.js b/build/attribute-filter.js new file mode 100644 index 00000000000..cf1126d9933 --- /dev/null +++ b/build/attribute-filter.js @@ -0,0 +1,28 @@ +this.wc=this.wc||{},this.wc.blocks=this.wc.blocks||{},this.wc.blocks["attribute-filter"]=function(e){function t(t){for(var c,l,a=t[0],s=t[1],i=t[2],b=0,d=[];b{let{id:t,label:n,popoverContents:c,remove:r,screenReaderLabel:i,className:u=""}=e;const[m,p]=Object(o.useState)(!1),f=Object(d.useInstanceId)(j);if(i=i||n,!n)return null;n=Object(O.decodeEntities)(n);const h=b()("woocommerce-tag",u,{"has-remove":!!r}),w="woocommerce-tag__label-"+f,_=Object(o.createElement)(o.Fragment,null,Object(o.createElement)("span",{className:"screen-reader-text"},i),Object(o.createElement)("span",{"aria-hidden":"true"},n));return Object(o.createElement)("span",{className:h},c?Object(o.createElement)(a.Button,{className:"woocommerce-tag__text",id:w,onClick:()=>p(!0)},_):Object(o.createElement)("span",{className:"woocommerce-tag__text",id:w},_),c&&m&&Object(o.createElement)(a.Popover,{onClose:()=>p(!1)},c),r&&Object(o.createElement)(a.Button,{className:"woocommerce-tag__remove",onClick:r(t),label:Object(l.sprintf)(// Translators: %s label. +Object(l.__)("Remove %s","woo-gutenberg-products-block"),n),"aria-describedby":w},Object(o.createElement)(s.a,{icon:g.a,size:20,className:"clear-icon"})))};var f=j;const h=e=>Object(o.createElement)(p.b,e),w=e=>{const{list:t,selected:n,renderItem:c,depth:l=0,onSelect:a,instanceId:s,isSingle:i,search:u}=e;return t?Object(o.createElement)(o.Fragment,null,t.map(t=>{const b=-1!==n.findIndex(e=>{let{id:n}=e;return n===t.id});return Object(o.createElement)(o.Fragment,{key:t.id},Object(o.createElement)("li",null,c({item:t,isSelected:b,onSelect:a,isSingle:i,search:u,depth:l,controlId:s})),Object(o.createElement)(w,r()({},e,{list:t.children,depth:l+1})))})):null},_=e=>{let{isLoading:t,isSingle:n,selected:c,messages:r,onChange:s,onRemove:i}=e;if(t||n||!c)return null;const u=c.length;return Object(o.createElement)("div",{className:"woocommerce-search-list__selected"},Object(o.createElement)("div",{className:"woocommerce-search-list__selected-header"},Object(o.createElement)("strong",null,r.selected(u)),u>0?Object(o.createElement)(a.Button,{isLink:!0,isDestructive:!0,onClick:()=>s([]),"aria-label":r.clear},Object(l.__)("Clear all","woo-gutenberg-products-block")):null),u>0?Object(o.createElement)("ul",null,c.map((e,t)=>Object(o.createElement)("li",{key:t},Object(o.createElement)(f,{label:e.name,id:e.id,remove:i})))):null)},y=e=>{let{filteredList:t,search:n,onSelect:c,instanceId:r,...a}=e;const{messages:u,renderItem:b,selected:d,isSingle:m}=a,p=b||h;return 0===t.length?Object(o.createElement)("div",{className:"woocommerce-search-list__list is-not-found"},Object(o.createElement)("span",{className:"woocommerce-search-list__not-found-icon"},Object(o.createElement)(s.a,{icon:i.a})),Object(o.createElement)("span",{className:"woocommerce-search-list__not-found-text"},n?Object(l.sprintf)(u.noResults,n):u.noItems)):Object(o.createElement)("ul",{className:"woocommerce-search-list__list"},Object(o.createElement)(w,{list:t,selected:d,renderItem:p,onSelect:c,instanceId:r,isSingle:m,search:n}))},E=e=>{const{className:t="",isCompact:n,isHierarchical:c,isLoading:l,isSingle:s,list:i,messages:u=m.a,onChange:p,onSearch:g,selected:O,debouncedSpeak:j}=e,[f,h]=Object(o.useState)(""),w=Object(d.useInstanceId)(E),k=Object(o.useMemo)(()=>({...m.a,...u}),[u]),v=Object(o.useMemo)(()=>Object(m.c)(i,f,c),[i,f,c]);Object(o.useEffect)(()=>{j&&j(k.updated)},[j,k]),Object(o.useEffect)(()=>{"function"==typeof g&&g(f)},[f,g]);const S=Object(o.useCallback)(e=>()=>{s&&p([]);const t=O.findIndex(t=>{let{id:n}=t;return n===e});p([...O.slice(0,t),...O.slice(t+1)])},[s,O,p]),C=Object(o.useCallback)(e=>()=>{-1===O.findIndex(t=>{let{id:n}=t;return n===e.id})?p(s?[e]:[...O,e]):S(e.id)()},[s,S,p,O]);return Object(o.createElement)("div",{className:b()("woocommerce-search-list",t,{"is-compact":n})},Object(o.createElement)(_,r()({},e,{onRemove:S,messages:k})),Object(o.createElement)("div",{className:"woocommerce-search-list__search"},Object(o.createElement)(a.TextControl,{label:k.search,type:"search",value:f,onChange:e=>h(e)})),l?Object(o.createElement)("div",{className:"woocommerce-search-list__list is-loading"},Object(o.createElement)(a.Spinner,null)):Object(o.createElement)(y,r()({},e,{search:f,filteredList:v,messages:k,onSelect:C,instanceId:w})))};Object(a.withSpokenMessages)(E)},101:function(e,t,n){"use strict";n.d(t,"a",(function(){return o}));var c=n(0);const r=Object(c.createContext)({}),o=()=>{const{wrapper:e}=Object(c.useContext)(r);return t=>{e&&e.current&&(e.current.hidden=!t)}}},103:function(e,t,n){"use strict";n.d(t,"a",(function(){return r}));var c=n(13);function r(e,t){const n=Object(c.useRef)();return Object(c.useEffect)(()=>{n.current===e||t&&!t(e,n.current)||(n.current=e)},[e,t]),n.current}},106:function(e,t,n){"use strict";n.d(t,"a",(function(){return a}));var c=n(10),r=n(7),o=n(0),l=n(42);const a=e=>{const{namespace:t,resourceName:n,resourceValues:a=[],query:s={},shouldSelect:i=!0}=e;if(!t||!n)throw new Error("The options object must have valid values for the namespace and the resource properties.");const u=Object(o.useRef)({results:[],isLoading:!0}),b=Object(l.a)(s),d=Object(l.a)(a),m=(()=>{const[,e]=Object(o.useState)();return Object(o.useCallback)(t=>{e(()=>{throw t})},[])})(),p=Object(r.useSelect)(e=>{if(!i)return null;const r=e(c.COLLECTIONS_STORE_KEY),o=[t,n,b,d],l=r.getCollectionError(...o);if(l){if(!(l instanceof Error))throw new Error("TypeError: `error` object is not an instance of Error constructor");m(l)}return{results:r.getCollection(...o),isLoading:!r.hasFinishedResolution("getCollection",o)}},[t,n,d,b,i]);return null!==p&&(u.current=p),u.current}},11:function(e,t){e.exports=window.wp.primitives},111:function(e,t,n){"use strict";var c=n(0),r=n(1),o=n(30);n(263),t.a=e=>{let{name:t,count:n}=e;return Object(c.createElement)(c.Fragment,null,t,null!==n&&Number.isFinite(n)&&Object(c.createElement)(o.a,{label:n.toString(),screenReaderLabel:Object(r.sprintf)( +/* translators: %s number of products. */ +Object(r._n)("%s product","%s products",n,"woo-gutenberg-products-block"),n),wrapperElement:"span",wrapperProps:{className:"wc-filter-element-label-list-count"}}))}},12:function(e,t){e.exports=window.wp.compose},121:function(e,t,n){"use strict";n.d(t,"a",(function(){return i}));var c=n(0),r=n(1),o=n(9),l=n(7),a=n(3),s=n(5);const i=e=>{let{clientId:t,setAttributes:n,filterType:i,attributes:u}=e;const{replaceBlock:b}=Object(l.useDispatch)("core/block-editor"),{heading:d,headingLevel:m}=u;if(Object(l.useSelect)(e=>{const{getBlockParentsByBlockName:n}=e("core/block-editor");return n(t,"woocommerce/filter-wrapper").length>0},[t])||!i)return null;const p=[Object(c.createElement)(a.Button,{key:"convert",onClick:()=>{const e=[Object(o.createBlock)("woocommerce/"+i,{...u,heading:""})];d&&""!==d&&e.unshift(Object(o.createBlock)("core/heading",{content:d,level:null!=m?m:2})),b(t,Object(o.createBlock)("woocommerce/filter-wrapper",{heading:d,filterType:i},[...e])),n({heading:"",lock:{remove:!0}})},variant:"primary"},Object(r.__)("Upgrade block","woo-gutenberg-products-block"))];return Object(c.createElement)(s.Warning,{actions:p},Object(r.__)("Filter block: We have improved this block to make styling easier. Upgrade it using the button below.","woo-gutenberg-products-block"))}},122:function(e,t,n){"use strict";var c=n(0),r=n(5),o=n(12),l=n(1);n(161),t.a=Object(o.withInstanceId)(e=>{let{className:t,headingLevel:n,onChange:o,heading:a,instanceId:s}=e;const i="h"+n;return Object(c.createElement)(i,{className:t},Object(c.createElement)("label",{className:"screen-reader-text",htmlFor:"block-title-"+s},Object(l.__)("Block title","woo-gutenberg-products-block")),Object(c.createElement)(r.PlainText,{id:"block-title-"+s,className:"wc-block-editor-components-title",value:a,onChange:o,style:{backgroundColor:"transparent"}}))})},123:function(e,t,n){"use strict";var c=n(0);n(162),t.a=e=>{let{children:t}=e;return Object(c.createElement)("div",{className:"wc-block-filter-title-placeholder"},t)}},125:function(e,t,n){"use strict";var c=n(0),r=n(1),o=n(4),l=n.n(o),a=n(30);n(165),t.a=e=>{let{className:t,label: +/* translators: Reset button text for filters. */ +n=Object(r.__)("Reset","woo-gutenberg-products-block"),onClick:o,screenReaderLabel:s=Object(r.__)("Reset filter","woo-gutenberg-products-block")}=e;return Object(c.createElement)("button",{className:l()("wc-block-components-filter-reset-button",t),onClick:o},Object(c.createElement)(a.a,{label:n,screenReaderLabel:s}))}},126:function(e,t,n){"use strict";var c=n(0),r=n(1),o=n(4),l=n.n(o),a=n(30);n(166),t.a=e=>{let{className:t,isLoading:n,disabled:o,label: +/* translators: Submit button text for filters. */ +s=Object(r.__)("Apply","woo-gutenberg-products-block"),onClick:i,screenReaderLabel:u=Object(r.__)("Apply filter","woo-gutenberg-products-block")}=e;return Object(c.createElement)("button",{type:"submit",className:l()("wp-block-button__link","wc-block-filter-submit-button","wc-block-components-filter-submit-button",{"is-loading":n},t),disabled:o,onClick:i},Object(c.createElement)(a.a,{label:s,screenReaderLabel:u}))}},127:function(e,t,n){"use strict";n.d(t,"a",(function(){return c}));const c=e=>"boolean"==typeof e},13:function(e,t){e.exports=window.React},132:function(e,t,n){"use strict";n.d(t,"a",(function(){return a}));var c=n(5),r=n(55),o=n(32),l=n(98);const a=e=>{if(!Object(r.b)())return{className:"",style:{}};const t=Object(o.b)(e)?e:{},n=Object(l.a)(t.style);return Object(c.__experimentalUseBorderProps)({...t,style:n})}},14:function(e,t){e.exports=window.wc.blocksCheckout},147:function(e){e.exports=JSON.parse('{"name":"woocommerce/attribute-filter","version":"1.0.0","title":"Filter by Attribute Controls","description":"Enable customers to filter the product grid by selecting one or more attributes, such as color.","category":"woocommerce","keywords":["WooCommerce"],"supports":{"html":false,"color":{"text":true,"background":false},"inserter":false,"lock":false},"attributes":{"className":{"type":"string","default":""},"attributeId":{"type":"number","default":0},"showCounts":{"type":"boolean","default":true},"queryType":{"type":"string","default":"or"},"headingLevel":{"type":"number","default":3},"displayStyle":{"type":"string","default":"list"},"showFilterButton":{"type":"boolean","default":false},"selectType":{"type":"string","default":"multiple"},"isPreview":{"type":"boolean","default":false}},"textdomain":"woo-gutenberg-products-block","apiVersion":2,"$schema":"https://schemas.wp.org/trunk/block.json"}')},153:function(e,t,n){"use strict";var c=n(6),r=n.n(c),o=n(0),l=n(305),a=n(4),s=n.n(a);n(193),t.a=e=>{let{className:t,style:n,suggestions:c,multiple:a=!0,saveTransform:i=(e=>e.trim().replace(/\s/g,"-")),messages:u={},validateInput:b=(e=>c.includes(e)),label:d="",...m}=e;return Object(o.createElement)("div",{className:s()("wc-blocks-components-form-token-field-wrapper",t,{"single-selection":!a}),style:n},Object(o.createElement)(l.a,r()({label:d,__experimentalExpandOnFocus:!0,__experimentalShowHowTo:!1,__experimentalValidateInput:b,saveTransform:i,maxLength:a?void 0:1,suggestions:c,messages:u},m)))}},154:function(e,t,n){"use strict";var c=n(0),r=n(1),o=n(4),l=n.n(o),a=n(14);n(194),t.a=e=>{let{className:t,onChange:n,options:o=[],checked:s=[],isLoading:i=!1,isDisabled:u=!1,limit:b=10}=e;const[d,m]=Object(c.useState)(!1),p=Object(c.useMemo)(()=>[...Array(5)].map((e,t)=>Object(c.createElement)("li",{key:t,style:{width:Math.floor(75*Math.random())+25+"%"}})),[]),g=Object(c.useMemo)(()=>{const e=o.length-b;return!d&&Object(c.createElement)("li",{key:"show-more",className:"show-more"},Object(c.createElement)("button",{onClick:()=>{m(!0)},"aria-expanded":!1,"aria-label":Object(r.sprintf)( +/* translators: %s is referring the remaining count of options */ +Object(r._n)("Show %s more option","Show %s more options",e,"woo-gutenberg-products-block"),e)},Object(r.sprintf)( +/* translators: %s number of options to reveal. */ +Object(r._n)("Show %s more","Show %s more",e,"woo-gutenberg-products-block"),e)))},[o,b,d]),O=Object(c.useMemo)(()=>d&&Object(c.createElement)("li",{key:"show-less",className:"show-less"},Object(c.createElement)("button",{onClick:()=>{m(!1)},"aria-expanded":!0,"aria-label":Object(r.__)("Show less options","woo-gutenberg-products-block")},Object(r.__)("Show less","woo-gutenberg-products-block"))),[d]),j=Object(c.useMemo)(()=>{const e=o.length>b+5;return Object(c.createElement)(c.Fragment,null,o.map((t,r)=>Object(c.createElement)(c.Fragment,{key:t.value},Object(c.createElement)("li",e&&!d&&r>=b&&{hidden:!0},Object(c.createElement)(a.CheckboxControl,{id:t.value,className:"wc-block-checkbox-list__checkbox",label:t.label,checked:s.includes(t.value),onChange:()=>{n(t.value)},disabled:u})),e&&r===b-1&&g)),e&&O)},[o,n,s,d,b,O,g,u]),f=l()("wc-block-checkbox-list","wc-block-components-checkbox-list",{"is-loading":i},t);return Object(c.createElement)("ul",{className:f},i?p:j)}},161:function(e,t){},162:function(e,t){},165:function(e,t){},166:function(e,t){},17:function(e,t){e.exports=window.wp.url},175:function(e,t,n){"use strict";n.d(t,"a",(function(){return r})),n.d(t,"b",(function(){return o}));var c=n(8);const r=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";const o=e.filter(e=>e.attribute===n.taxonomy),l=o.length?o[0]:null;if(!(l&&l.slug&&Array.isArray(l.slug)&&l.slug.includes(r)))return;const a=l.slug.filter(e=>e!==r),s=e.filter(e=>e.attribute!==n.taxonomy);a.length>0&&(l.slug=a.sort(),s.push(l)),t(Object(c.sortBy)(s,"attribute"))},o=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"in";if(!n||!n.taxonomy)return[];const l=e.filter(e=>e.attribute!==n.taxonomy);return 0===r.length?t(l):(l.push({attribute:n.taxonomy,operator:o,slug:r.map(e=>{let{slug:t}=e;return t}).sort()}),t(Object(c.sortBy)(l,"attribute"))),l}},18:function(e,t){e.exports=window.wp.htmlEntities},19:function(e,t,n){"use strict";n.d(t,"a",(function(){return l})),n.d(t,"c",(function(){return s})),n.d(t,"d",(function(){return i})),n.d(t,"b",(function(){return u}));var c=n(0),r=n(8),o=n(1);const l={clear:Object(o.__)("Clear all selected items","woo-gutenberg-products-block"),noItems:Object(o.__)("No items found.","woo-gutenberg-products-block"), +/* Translators: %s search term */ +noResults:Object(o.__)("No results for %s","woo-gutenberg-products-block"),search:Object(o.__)("Search for items","woo-gutenberg-products-block"),selected:e=>Object(o.sprintf)( +/* translators: Number of items selected from list. */ +Object(o._n)("%d item selected","%d items selected",e,"woo-gutenberg-products-block"),e),updated:Object(o.__)("Search results updated.","woo-gutenberg-products-block")},a=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e;const n=Object(r.groupBy)(e,"parent"),c=Object(r.keyBy)(t,"id"),o=["0"],l=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!e.parent)return e.name?[e.name]:[];const t=l(c[e.parent]);return[...t,e.name]},a=e=>e.map(e=>{const t=n[e.id];return o.push(""+e.id),{...e,breadcrumbs:l(c[e.parent]),children:t&&t.length?a(t):[]}}),s=a(n[0]||[]);return Object.entries(n).forEach(e=>{let[t,n]=e;o.includes(t)||s.push(...a(n||[]))}),s},s=(e,t,n)=>{if(!t)return n?a(e):e;const c=new RegExp(t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"),"i"),r=e.map(e=>!!c.test(e.name)&&e).filter(Boolean);return n?a(r,e):r},i=(e,t)=>{if(!t)return e;const n=new RegExp(`(${t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")})`,"ig");return e.split(n).map((e,t)=>n.test(e)?Object(c.createElement)("strong",{key:t},e):Object(c.createElement)(c.Fragment,{key:t},e))},u=e=>1===e.length?e.slice(0,1).toString():2===e.length?e.slice(0,1).toString()+" › "+e.slice(-1).toString():e.slice(0,1).toString()+" … "+e.slice(-1).toString()},193:function(e,t){},194:function(e,t){},2:function(e,t){e.exports=window.wc.wcSettings},20:function(e,t,n){"use strict";n.d(t,"o",(function(){return o})),n.d(t,"m",(function(){return l})),n.d(t,"l",(function(){return a})),n.d(t,"n",(function(){return s})),n.d(t,"j",(function(){return i})),n.d(t,"e",(function(){return u})),n.d(t,"g",(function(){return b})),n.d(t,"k",(function(){return d})),n.d(t,"c",(function(){return m})),n.d(t,"d",(function(){return p})),n.d(t,"h",(function(){return g})),n.d(t,"a",(function(){return O})),n.d(t,"i",(function(){return j})),n.d(t,"b",(function(){return f})),n.d(t,"f",(function(){return h}));var c,r=n(2);const o=Object(r.getSetting)("wcBlocksConfig",{buildPhase:1,pluginUrl:"",productCount:0,defaultAvatar:"",restApiRoutes:{},wordCountType:"words"}),l=o.pluginUrl+"images/",a=o.pluginUrl+"build/",s=o.buildPhase,i=null===(c=r.STORE_PAGES.shop)||void 0===c?void 0:c.permalink,u=r.STORE_PAGES.checkout.id,b=(r.STORE_PAGES.checkout.permalink,r.STORE_PAGES.privacy.permalink),d=(r.STORE_PAGES.privacy.title,r.STORE_PAGES.terms.permalink),m=(r.STORE_PAGES.terms.title,r.STORE_PAGES.cart.id),p=r.STORE_PAGES.cart.permalink,g=(r.STORE_PAGES.myaccount.permalink?r.STORE_PAGES.myaccount.permalink:Object(r.getSetting)("wpLoginUrl","/wp-login.php"),Object(r.getSetting)("shippingCountries",{})),O=Object(r.getSetting)("allowedCountries",{}),j=Object(r.getSetting)("shippingStates",{}),f=Object(r.getSetting)("allowedStates",{}),h=Object(r.getSetting)("localPickupEnabled",!1)},207:function(e,t,n){"use strict";n.d(t,"a",(function(){return o})),n.d(t,"b",(function(){return l}));var c=n(2);const r=Object(c.getSetting)("attributes",[]).reduce((e,t)=>{const n=(c=t)&&c.attribute_name?{id:parseInt(c.attribute_id,10),name:c.attribute_name,taxonomy:"pa_"+c.attribute_name,label:c.attribute_label}:null;var c;return n&&n.id&&e.push(n),e},[]),o=e=>{if(e)return r.find(t=>t.id===e)},l=e=>{if(e)return r.find(t=>t.taxonomy===e)}},232:function(e,t,n){"use strict";n.d(t,"b",(function(){return a})),n.d(t,"a",(function(){return s})),n.d(t,"d",(function(){return i})),n.d(t,"c",(function(){return u}));var c=n(17),r=n(2),o=n(127);const l=Object(r.getSettingWithCoercion)("is_rendering_php_template",!1,o.a),a="query_type_",s="filter_";function i(e){return window?Object(c.getQueryArg)(window.location.href,e):null}function u(e){l?window.location.href=e:window.history.replaceState({},"",e)}},25:function(e,t){e.exports=window.wp.isShallowEqual},263:function(e,t){},264:function(e,t,n){"use strict";n.d(t,"a",(function(){return b}));var c=n(0),r=n(249),o=n(8),l=n(42),a=n(32),s=n(54),i=n(106),u=n(47);const b=e=>{let{queryAttribute:t,queryPrices:n,queryStock:b,queryRating:d,queryState:m,productIds:p,isEditor:g=!1}=e,O=Object(u.a)();O+="-collection-data";const[j]=Object(s.a)(O),[f,h]=Object(s.b)("calculate_attribute_counts",[],O),[w,_]=Object(s.b)("calculate_price_range",null,O),[y,E]=Object(s.b)("calculate_stock_status_counts",null,O),[k,v]=Object(s.b)("calculate_rating_counts",null,O),S=Object(l.a)(t||{}),C=Object(l.a)(n),x=Object(l.a)(b),N=Object(l.a)(d);Object(c.useEffect)(()=>{"object"==typeof S&&Object.keys(S).length&&(f.find(e=>Object(a.c)(S,"taxonomy")&&e.taxonomy===S.taxonomy)||h([...f,S]))},[S,f,h]),Object(c.useEffect)(()=>{w!==C&&void 0!==C&&_(C)},[C,_,w]),Object(c.useEffect)(()=>{y!==x&&void 0!==x&&E(x)},[x,E,y]),Object(c.useEffect)(()=>{k!==N&&void 0!==N&&v(N)},[N,v,k]);const[T,A]=Object(c.useState)(g),[R]=Object(r.a)(T,200);T||A(!0);const L=Object(c.useMemo)(()=>(e=>{const t=e;return Array.isArray(e.calculate_attribute_counts)&&(t.calculate_attribute_counts=Object(o.sortBy)(e.calculate_attribute_counts.map(e=>{let{taxonomy:t,queryType:n}=e;return{taxonomy:t,query_type:n}}),["taxonomy","query_type"])),t})(j),[j]);return Object(i.a)({namespace:"/wc/store/v1",resourceName:"products/collection-data",query:{...m,page:void 0,per_page:void 0,orderby:void 0,order:void 0,...!Object(o.isEmpty)(p)&&{include:p},...L},shouldSelect:R})}},3:function(e,t){e.exports=window.wp.components},30:function(e,t,n){"use strict";var c=n(0),r=n(4),o=n.n(r);t.a=e=>{let t,{label:n,screenReaderLabel:r,wrapperElement:l,wrapperProps:a={}}=e;const s=null!=n,i=null!=r;return!s&&i?(t=l||"span",a={...a,className:o()(a.className,"screen-reader-text")},Object(c.createElement)(t,a,r)):(t=l||c.Fragment,s&&i&&n!==r?Object(c.createElement)(t,a,Object(c.createElement)("span",{"aria-hidden":"true"},n),Object(c.createElement)("span",{className:"screen-reader-text"},r)):Object(c.createElement)(t,a,n))}},32:function(e,t,n){"use strict";n.d(t,"b",(function(){return c})),n.d(t,"c",(function(){return r})),n.d(t,"a",(function(){return o}));const c=e=>!(e=>null===e)(e)&&e instanceof Object&&e.constructor===Object;function r(e,t){return c(e)&&t in e}const o=e=>0===Object.keys(e).length},365:function(e,t,n){"use strict";n.d(t,"b",(function(){return o})),n.d(t,"a",(function(){return a}));var c=n(32);const r=e=>Object(c.c)(e,"count")&&Object(c.c)(e,"description")&&Object(c.c)(e,"id")&&Object(c.c)(e,"name")&&Object(c.c)(e,"parent")&&Object(c.c)(e,"slug")&&"number"==typeof e.count&&"string"==typeof e.description&&"number"==typeof e.id&&"string"==typeof e.name&&"number"==typeof e.parent&&"string"==typeof e.slug,o=e=>Array.isArray(e)&&e.every(r),l=e=>Object(c.c)(e,"attribute")&&Object(c.c)(e,"operator")&&Object(c.c)(e,"slug")&&"string"==typeof e.attribute&&"string"==typeof e.operator&&Array.isArray(e.slug)&&e.slug.every(e=>"string"==typeof e),a=e=>Array.isArray(e)&&e.every(l)},38:function(e,t,n){"use strict";n.d(t,"a",(function(){return a}));var c=n(6),r=n.n(c),o=n(0),l=n(19);const a=e=>{let{countLabel:t,className:n,depth:c=0,controlId:a="",item:s,isSelected:i,isSingle:u,onSelect:b,search:d="",...m}=e;const p=null!=t&&void 0!==s.count&&null!==s.count,g=[n,"woocommerce-search-list__item"];g.push("depth-"+c),u&&g.push("is-radio-button"),p&&g.push("has-count");const O=s.breadcrumbs&&s.breadcrumbs.length,j=m.name||"search-list-item-"+a,f=`${j}-${s.id}`;return Object(o.createElement)("label",{htmlFor:f,className:g.join(" ")},u?Object(o.createElement)("input",r()({type:"radio",id:f,name:j,value:s.value,onChange:b(s),checked:i,className:"woocommerce-search-list__item-input"},m)):Object(o.createElement)("input",r()({type:"checkbox",id:f,name:j,value:s.value,onChange:b(s),checked:i,className:"woocommerce-search-list__item-input"},m)),Object(o.createElement)("span",{className:"woocommerce-search-list__item-label"},O?Object(o.createElement)("span",{className:"woocommerce-search-list__item-prefix"},Object(l.b)(s.breadcrumbs)):null,Object(o.createElement)("span",{className:"woocommerce-search-list__item-name"},Object(l.d)(s.name,d))),!!p&&Object(o.createElement)("span",{className:"woocommerce-search-list__item-count"},t||s.count))};t.b=a},381:function(e,t,n){e.exports=n(494)},382:function(e,t){},383:function(e,t){},41:function(e,t){e.exports=window.wp.deprecated},42:function(e,t,n){"use strict";n.d(t,"a",(function(){return l}));var c=n(0),r=n(25),o=n.n(r);function l(e){const t=Object(c.useRef)(e);return o()(e,t.current)||(t.current=e),t.current}},46:function(e,t){e.exports=window.wp.a11y},47:function(e,t,n){"use strict";n.d(t,"a",(function(){return o}));var c=n(0);const r=Object(c.createContext)("page"),o=()=>Object(c.useContext)(r);r.Provider},494:function(e,t,n){"use strict";n.r(t);var c=n(6),r=n.n(c),o=n(0),l=n(9),a=n(5),s=n(55),i=n(80),u=n(550),b=n(4),d=n.n(b),m=n(1),p=n(228),g=n(100),O=n(8),j=n(2),f=n(122),h=n(3),w=n(132),_=n(42),y=n(103),E=n(54),k=n(106),v=n(264),S=n(111),C=n(125),x=n(126),N=n(25),T=n.n(N),A=n(18),R=n(551),L=n(17),P=n(127),B=n(74),I=n(32),F=n(365),q=n(553),G=n(232),D=n(153),M=n(123),Q=n(207),U=n(175);const V=[{value:"preview-1",formattedValue:"preview-1",name:"Blue",label:Object(o.createElement)(S.a,{name:"Blue",count:3}),textLabel:"Blue (3)"},{value:"preview-2",formattedValue:"preview-2",name:"Green",label:Object(o.createElement)(S.a,{name:"Green",count:3}),textLabel:"Green (3)"},{value:"preview-3",formattedValue:"preview-3",name:"Red",label:Object(o.createElement)(S.a,{name:"Red",count:2}),textLabel:"Red (2)"}],$={id:0,name:"preview",taxonomy:"preview",label:"Preview"};n(383);var Y=n(147);function W(){return Math.floor(Math.random()*Date.now())}const K=e=>e.replace("pa_",""),J=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const n={};t.forEach(e=>{const{attribute:t,slug:c,operator:r}=e,o=K(t),l=c.join(","),a=`${G.b}${o}`,s="in"===r?"or":"and";n[`${G.a}${o}`]=l,n[a]=s});const c=Object(L.removeQueryArgs)(e,...Object.keys(n));return Object(L.addQueryArgs)(c,n)},z=e=>{if(e){const t=Object(G.d)("filter_"+e.name);return("string"==typeof t?t.split(","):[]).map(e=>encodeURIComponent(e).toLowerCase())}return[]},H=(e,t)=>{const n=Object.entries(t).reduce((e,t)=>{let[n,c]=t;return n.includes("query_type")?e:{...e,[n]:c}},{});return Object.entries(n).reduce((t,n)=>{let[c,r]=n;return e[c]===r&&t},!0)},Z=e=>e.trim().replace(/\s/g,"-").replace(/_/g,"-").replace(/-+/g,"-").replace(/[^a-zA-Z0-9-]/g,"");var X=n(154),ee=e=>{let{isLoading:t=!1,options:n,checked:c,onChange:r}=e;return t?Object(o.createElement)(o.Fragment,null,Object(o.createElement)("span",{className:"is-loading"}),Object(o.createElement)("span",{className:"is-loading"})):Object(o.createElement)(X.a,{className:"wc-block-attribute-filter-list",options:n,checked:c,onChange:r,isLoading:t,isDisabled:t})},te=n(101),ne=e=>{let{attributes:t,isEditor:n=!1}=e;const c=Object(j.getSettingWithCoercion)("has_filterable_products",!1,P.a),r=Object(j.getSettingWithCoercion)("is_rendering_php_template",!1,P.a),l=Object(j.getSettingWithCoercion)("page_url",window.location.href,B.a),a=n?[]:Object(j.getSettingWithCoercion)("product_ids",[],Array.isArray),[s,u]=Object(o.useState)(!1),b=t.isPreview&&!t.attributeId?$:Object(Q.a)(t.attributeId),p=Object(o.useMemo)(()=>z(b),[b]),[g,f]=Object(o.useState)(p),[h,N]=Object(o.useState)(W()),[Y,X]=Object(o.useState)(t.isPreview&&!t.attributeId?V:[]),ne=Object(w.a)(t),[ce]=Object(E.a)(),[re,oe]=Object(E.b)("attributes",[]),{results:le,isLoading:ae}=Object(k.a)({namespace:"/wc/store/v1",resourceName:"products/attributes/terms",resourceValues:[(null==b?void 0:b.id)||0],shouldSelect:t.attributeId>0}),se="dropdown"!==t.displayStyle&&"and"===t.queryType,{results:ie,isLoading:ue}=Object(v.a)({queryAttribute:{taxonomy:(null==b?void 0:b.taxonomy)||"",queryType:t.queryType},queryState:{...ce,attributes:se?ce.attributes:null},productIds:a,isEditor:n}),be=Object(o.useCallback)(e=>Object(I.c)(ie,"attribute_counts")&&Array.isArray(ie.attribute_counts)?ie.attribute_counts.find(t=>{let{term:n}=t;return n===e}):null,[ie]);Object(o.useEffect)(()=>{if(ae||ue)return;if(!Array.isArray(le))return;const e=le.map(e=>{const n=be(e.id);if(!(n||g.includes(e.slug)||(c=e.slug,null!=ce&&ce.attributes&&ce.attributes.some(e=>{let{attribute:t,slug:n=[]}=e;return t===(null==b?void 0:b.taxonomy)&&n.includes(c)}))))return null;var c;const r=n?n.count:0;return{formattedValue:Z(e.slug),value:e.slug,name:Object(A.decodeEntities)(e.name),label:Object(o.createElement)(S.a,{name:Object(A.decodeEntities)(e.name),count:t.showCounts?r:null}),textLabel:t.showCounts?`${Object(A.decodeEntities)(e.name)} (${r})`:Object(A.decodeEntities)(e.name)}}).filter(e=>!!e);X(e),N(W())},[null==b?void 0:b.taxonomy,le,ae,t.showCounts,ue,be,g,ce.attributes]);const de=Object(o.useCallback)(e=>Array.isArray(le)?le.reduce((t,n)=>(e.includes(n.slug)&&t.push(n),t),[]):[],[le]),me=Object(o.useCallback)((function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(e=e.map(e=>({...e,slug:e.slug.map(e=>decodeURIComponent(e))})),t){if(null==b||!b.taxonomy)return;const t=Object.keys(Object(L.getQueryArgs)(window.location.href)),n=K(b.taxonomy),c=t.reduce((e,t)=>t.includes(G.b+n)||t.includes(G.a+n)?Object(L.removeQueryArgs)(e,t):e,window.location.href),r=J(c,e);Object(G.c)(r)}else{const t=J(l,e),n=Object(L.getQueryArgs)(window.location.href),c=Object(L.getQueryArgs)(t);H(n,c)||Object(G.c)(t)}}),[l,null==b?void 0:b.taxonomy]),pe=e=>{const n=Object(U.b)(re,oe,b,de(e),"or"===t.queryType?"in":"and");me(n,0===e.length)},ge=Object(o.useCallback)((function(e){let c=arguments.length>1&&void 0!==arguments[1]&&arguments[1];n||(f(e),!c&&t.showFilterButton||Object(U.b)(re,oe,b,de(e),"or"===t.queryType?"in":"and"))}),[n,f,re,oe,b,de,t.queryType,t.showFilterButton]),Oe=Object(o.useMemo)(()=>Object(F.a)(re)?re.filter(e=>{let{attribute:t}=e;return t===(null==b?void 0:b.taxonomy)}).flatMap(e=>{let{slug:t}=e;return t}):[],[re,null==b?void 0:b.taxonomy]),je=Object(_.a)(Oe),fe=Object(y.a)(je);Object(o.useEffect)(()=>{!fe||T()(fe,je)||T()(g,je)||ge(je)},[g,je,fe,ge]);const he="single"!==t.selectType,we=Object(o.useCallback)(e=>{const t=g.includes(e);let n;he?(n=g.filter(t=>t!==e),t||(n.push(e),n.sort())):n=t?[]:[e],ge(n)},[g,he,ge]);Object(o.useEffect)(()=>{b&&!t.showFilterButton&&((e=>{let{currentCheckedFilters:t,hasSetFilterDefaultsFromUrl:n}=e;return n&&0===t.length})({currentCheckedFilters:g,hasSetFilterDefaultsFromUrl:s})?me(re,!0):me(re,!1))},[s,me,re,b,g,t.showFilterButton]),Object(o.useEffect)(()=>{if(!s&&!ae)return p.length>0?(u(!0),void ge(p,!0)):void(r||u(!0))},[b,s,ae,ge,p,r]);const _e=Object(te.a)();if(!c)return _e(!1),null;if(!b)return n?Object(o.createElement)(R.a,{status:"warning",isDismissible:!1},Object(o.createElement)("p",null,Object(m.__)("Please select an attribute to use this filter!","woo-gutenberg-products-block"))):(_e(!1),null);if(0===Y.length&&!ae&&n)return Object(o.createElement)(R.a,{status:"warning",isDismissible:!1},Object(o.createElement)("p",null,Object(m.__)("There are no products with the selected attributes.","woo-gutenberg-products-block")));const ye="h"+t.headingLevel,Ee=!t.isPreview&&ae,ke=!t.isPreview&&ue,ve=(Ee||ke)&&0===Y.length;if(!ve&&0===Y.length)return _e(!1),null;const Se=he?!ve&&g.length!g.includes(e.value)).map(e=>e.formattedValue),disabled:ve,placeholder:Object(m.sprintf)( +/* translators: %s attribute name. */ +Object(m.__)("Select %s","woo-gutenberg-products-block"),b.label),onChange:e=>{!he&&e.length>1&&(e=[e[e.length-1]]),e=e.map(e=>{const t=Y.find(t=>t.formattedValue===e);return t?t.value:e});const t=Object(O.difference)(e,g);if(1===t.length)return we(t[0]);const n=Object(O.difference)(g,e);1===n.length&&we(n[0])},value:g,displayTransform:e=>{const t=Y.find(t=>[t.value,t.formattedValue].includes(e));return t?t.textLabel:e},saveTransform:Z,messages:{added:Object(m.sprintf)( +/* translators: %s is the attribute label. */ +Object(m.__)("%s filter added.","woo-gutenberg-products-block"),b.label),removed:Object(m.sprintf)( +/* translators: %s is the attribute label. */ +Object(m.__)("%s filter removed.","woo-gutenberg-products-block"),b.label),remove:Object(m.sprintf)( +/* translators: %s is the attribute label. */ +Object(m.__)("Remove %s filter.","woo-gutenberg-products-block"),b.label.toLocaleLowerCase()),__experimentalInvalid:Object(m.sprintf)( +/* translators: %s is the attribute label. */ +Object(m.__)("Invalid %s filter.","woo-gutenberg-products-block"),b.label.toLocaleLowerCase())}}),Se&&Object(o.createElement)(i.a,{icon:q.a,size:30})):Object(o.createElement)(ee,{options:Y,checked:g,onChange:we,isLoading:ve,isDisabled:ve})),Object(o.createElement)("div",{className:"wc-block-attribute-filter__actions"},(g.length>0||n)&&!ve&&Object(o.createElement)(C.a,{onClick:()=>{f([]),N(W()),s&&pe([])},screenReaderLabel:Object(m.__)("Reset attribute filter","woo-gutenberg-products-block")}),t.showFilterButton&&Object(o.createElement)(x.a,{className:"wc-block-attribute-filter__button",isLoading:ve,disabled:(()=>{if(Ee||ke)return!0;const e=z(b);return e.length===g.length&&g.every(t=>e.includes(t))})(),onClick:()=>pe(g)})))},ce=(n(382),n(121));const re=Object(j.getSetting)("attributes",[]);var oe=Object(h.withSpokenMessages)(e=>{let{attributes:t,setAttributes:n,debouncedSpeak:c,clientId:r}=e;const{attributeId:l,className:s,displayStyle:b,heading:w,headingLevel:_,isPreview:y,queryType:E,showCounts:k,showFilterButton:v,selectType:S}=t,[C,x]=Object(o.useState)(!l&&!y),N=Object(a.useBlockProps)(),T=e=>{if(!e||!e.length)return;const t=e[0].id;re.find(e=>e.attribute_id===t.toString())&&l!==t&&n({attributeId:t})},A=e=>{let{isCompact:t}=e;const n={clear:Object(m.__)("Clear selected attribute","woo-gutenberg-products-block"),list:Object(m.__)("Product Attributes","woo-gutenberg-products-block"),noItems:Object(m.__)("Your store doesn't have any product attributes.","woo-gutenberg-products-block"),search:Object(m.__)("Search for a product attribute:","woo-gutenberg-products-block"),selected:e=>Object(m.sprintf)( +/* translators: %d is the number of attributes selected. */ +Object(m._n)("%d attribute selected","%d attributes selected",e,"woo-gutenberg-products-block"),e),updated:Object(m.__)("Product attribute search results updated.","woo-gutenberg-products-block")},c=Object(O.sortBy)(re.map(e=>({id:parseInt(e.attribute_id,10),name:e.attribute_label})),"name");return Object(o.createElement)(g.a,{className:"woocommerce-product-attributes",list:c,selected:c.filter(e=>{let{id:t}=e;return t===l}),onChange:T,messages:n,isSingle:!0,isCompact:t})};return 0===Object.keys(re).length?Object(o.createElement)(h.Placeholder,{className:"wc-block-attribute-filter",icon:Object(o.createElement)(i.a,{icon:u.a}),label:Object(m.__)("Filter by Attribute","woo-gutenberg-products-block"),instructions:Object(m.__)("Display a list of filters based on the selected attributes.","woo-gutenberg-products-block")},Object(o.createElement)("p",null,Object(m.__)("Attributes are needed for filtering your products. You haven't created any attributes yet.","woo-gutenberg-products-block")),Object(o.createElement)(h.Button,{className:"wc-block-attribute-filter__add-attribute-button",isSecondary:!0,href:Object(j.getAdminLink)("edit.php?post_type=product&page=product_attributes")},Object(m.__)("Add new attribute","woo-gutenberg-products-block")+" ",Object(o.createElement)(i.a,{icon:p.a})),Object(o.createElement)(h.Button,{className:"wc-block-attribute-filter__read_more_button",isTertiary:!0,href:"https://docs.woocommerce.com/document/managing-product-taxonomies/"},Object(m.__)("Learn more","woo-gutenberg-products-block"))):Object(o.createElement)("div",N,Object(o.createElement)(a.BlockControls,null,Object(o.createElement)(h.ToolbarGroup,{controls:[{icon:"edit",title:Object(m.__)("Edit","woo-gutenberg-products-block"),onClick:()=>x(!C),isActive:C}]})),Object(o.createElement)(a.InspectorControls,{key:"inspector"},Object(o.createElement)(h.PanelBody,{title:Object(m.__)("Display Settings","woo-gutenberg-products-block")},Object(o.createElement)(h.ToggleControl,{label:Object(m.__)("Display product count","woo-gutenberg-products-block"),checked:k,onChange:()=>n({showCounts:!k})}),Object(o.createElement)(h.__experimentalToggleGroupControl,{label:Object(m.__)("Allow selecting multiple options?","woo-gutenberg-products-block"),value:S||"multiple",onChange:e=>n({selectType:e}),className:"wc-block-attribute-filter__multiple-toggle"},Object(o.createElement)(h.__experimentalToggleGroupControlOption,{value:"multiple",label:Object(m.__)("Multiple","woo-gutenberg-products-block")}),Object(o.createElement)(h.__experimentalToggleGroupControlOption,{value:"single",label:Object(m.__)("Single","woo-gutenberg-products-block")})),"multiple"===S&&Object(o.createElement)(h.__experimentalToggleGroupControl,{label:Object(m.__)("Filter Conditions","woo-gutenberg-products-block"),help:"and"===E?Object(m.__)("Choose to return filter results for all of the attributes selected.","woo-gutenberg-products-block"):Object(m.__)("Choose to return filter results for any of the attributes selected.","woo-gutenberg-products-block"),value:E,onChange:e=>n({queryType:e}),className:"wc-block-attribute-filter__conditions-toggle"},Object(o.createElement)(h.__experimentalToggleGroupControlOption,{value:"and",label:Object(m.__)("All","woo-gutenberg-products-block")}),Object(o.createElement)(h.__experimentalToggleGroupControlOption,{value:"or",label:Object(m.__)("Any","woo-gutenberg-products-block")})),Object(o.createElement)(h.__experimentalToggleGroupControl,{label:Object(m.__)("Display Style","woo-gutenberg-products-block"),value:b,onChange:e=>n({displayStyle:e}),className:"wc-block-attribute-filter__display-toggle"},Object(o.createElement)(h.__experimentalToggleGroupControlOption,{value:"list",label:Object(m.__)("List","woo-gutenberg-products-block")}),Object(o.createElement)(h.__experimentalToggleGroupControlOption,{value:"dropdown",label:Object(m.__)("Dropdown","woo-gutenberg-products-block")})),Object(o.createElement)(h.ToggleControl,{label:Object(m.__)("Show 'Apply filters' button","woo-gutenberg-products-block"),help:Object(m.__)("Products will update when the button is clicked.","woo-gutenberg-products-block"),checked:v,onChange:e=>n({showFilterButton:e})})),Object(o.createElement)(h.PanelBody,{title:Object(m.__)("Content Settings","woo-gutenberg-products-block"),initialOpen:!1},A({isCompact:!0}))),Object(o.createElement)(ce.a,{clientId:r,attributes:t,setAttributes:n,filterType:"attribute-filter"}),C?Object(o.createElement)(h.Placeholder,{className:"wc-block-attribute-filter",icon:Object(o.createElement)(i.a,{icon:u.a}),label:Object(m.__)("Filter by Attribute","woo-gutenberg-products-block")},Object(o.createElement)("div",{className:"wc-block-attribute-filter__instructions"},Object(m.__)("Display a list of filters based on the selected attributes.","woo-gutenberg-products-block")),Object(o.createElement)("div",{className:"wc-block-attribute-filter__selection"},A({isCompact:!1}),Object(o.createElement)(h.Button,{isPrimary:!0,onClick:()=>{x(!1),c(Object(m.__)("Now displaying a preview of the Filter Products by Attribute block.","woo-gutenberg-products-block"))}},Object(m.__)("Done","woo-gutenberg-products-block")))):Object(o.createElement)("div",{className:d()(s,"wc-block-attribute-filter")},w&&Object(o.createElement)(f.a,{className:"wc-block-attribute-filter__title",headingLevel:_,heading:w,onChange:e=>n({heading:e})}),Object(o.createElement)(h.Disabled,null,Object(o.createElement)(ne,{attributes:t,isEditor:!0}))))});const le={heading:{type:"string",default:Object(m.__)("Filter by attribute","woo-gutenberg-products-block")}};Object(l.registerBlockType)(Y,{icon:{src:Object(o.createElement)(i.a,{icon:u.a,className:"wc-block-editor-components-block-icon"})},supports:{...Y.supports,...Object(s.b)()&&{__experimentalBorder:{radius:!1,color:!0,width:!1}}},attributes:{...Y.attributes,...le},edit:oe,save(e){let{attributes:t}=e;const{className:n,showCounts:c,queryType:l,attributeId:s,heading:i,headingLevel:u,displayStyle:b,showFilterButton:m,selectType:p}=t,g={"data-attribute-id":s,"data-show-counts":c,"data-query-type":l,"data-heading":i,"data-heading-level":u};return"list"!==b&&(g["data-display-style"]=b),m&&(g["data-show-filter-button"]=m),"single"===p&&(g["data-select-type"]=p),Object(o.createElement)("div",r()({},a.useBlockProps.save({className:d()("is-loading",n)}),g),Object(o.createElement)("span",{"aria-hidden":!0,className:"wc-block-product-attribute-filter__placeholder"}))}})},5:function(e,t){e.exports=window.wp.blockEditor},53:function(e,t){e.exports=window.wp.keycodes},54:function(e,t,n){"use strict";n.d(t,"a",(function(){return b})),n.d(t,"b",(function(){return d})),n.d(t,"c",(function(){return m}));var c=n(10),r=n(7),o=n(0),l=n(25),a=n.n(l),s=n(42),i=n(103),u=n(47);const b=e=>{const t=Object(u.a)();e=e||t;const n=Object(r.useSelect)(t=>t(c.QUERY_STATE_STORE_KEY).getValueForQueryContext(e,void 0),[e]),{setValueForQueryContext:l}=Object(r.useDispatch)(c.QUERY_STATE_STORE_KEY);return[n,Object(o.useCallback)(t=>{l(e,t)},[e,l])]},d=(e,t,n)=>{const l=Object(u.a)();n=n||l;const a=Object(r.useSelect)(r=>r(c.QUERY_STATE_STORE_KEY).getValueForQueryKey(n,e,t),[n,e]),{setQueryValue:s}=Object(r.useDispatch)(c.QUERY_STATE_STORE_KEY);return[a,Object(o.useCallback)(t=>{s(n,e,t)},[n,e,s])]},m=(e,t)=>{const n=Object(u.a)();t=t||n;const[c,r]=b(t),l=Object(s.a)(c),d=Object(s.a)(e),m=Object(i.a)(d),p=Object(o.useRef)(!1);return Object(o.useEffect)(()=>{a()(m,d)||(r(Object.assign({},l,d)),p.current=!0)},[l,d,m,r]),p.current?[c,r]:[e,r]}},55:function(e,t,n){"use strict";n.d(t,"c",(function(){return o})),n.d(t,"a",(function(){return l})),n.d(t,"b",(function(){return a}));var c=n(9),r=n(20);const o=(e,t)=>{if(r.n>2)return Object(c.registerBlockType)(e,t)},l=()=>r.n>2,a=()=>r.n>1},67:function(e,t){e.exports=window.wp.dom},7:function(e,t){e.exports=window.wp.data},74:function(e,t,n){"use strict";n.d(t,"a",(function(){return c}));const c=e=>"string"==typeof e},8:function(e,t){e.exports=window.lodash},9:function(e,t){e.exports=window.wp.blocks},94:function(e,t){e.exports=window.wp.warning},98:function(e,t,n){"use strict";n.d(t,"a",(function(){return o}));var c=n(74),r=n(32);const o=e=>Object(c.a)(e)?JSON.parse(e)||{}:Object(r.b)(e)?e:{}}}); \ No newline at end of file diff --git a/build/attribute-filter/block.json b/build/attribute-filter/block.json new file mode 100644 index 00000000000..8f4aa46c3e8 --- /dev/null +++ b/build/attribute-filter/block.json @@ -0,0 +1,58 @@ +{ + "name": "woocommerce/attribute-filter", + "version": "1.0.0", + "title": "Filter by Attribute Controls", + "description": "Enable customers to filter the product grid by selecting one or more attributes, such as color.", + "category": "woocommerce", + "keywords": [ "WooCommerce" ], + "supports": { + "html": false, + "color": { + "text": true, + "background": false + }, + "inserter": false, + "lock": false + }, + "attributes": { + "className": { + "type": "string", + "default": "" + }, + "attributeId": { + "type": "number", + "default": 0 + }, + "showCounts": { + "type": "boolean", + "default": true + }, + "queryType": { + "type": "string", + "default": "or" + }, + "headingLevel": { + "type": "number", + "default": 3 + }, + "displayStyle": { + "type": "string", + "default": "list" + }, + "showFilterButton": { + "type": "boolean", + "default": false + }, + "selectType": { + "type": "string", + "default": "multiple" + }, + "isPreview": { + "type": "boolean", + "default": false + } + }, + "textdomain": "woo-gutenberg-products-block", + "apiVersion": 2, + "$schema": "https://schemas.wp.org/trunk/block.json" +} diff --git a/build/blocks-checkout.asset.php b/build/blocks-checkout.asset.php new file mode 100644 index 00000000000..535f5613223 --- /dev/null +++ b/build/blocks-checkout.asset.php @@ -0,0 +1 @@ + array('lodash', 'react', 'wc-blocks-data-store', 'wc-blocks-registry', 'wc-settings', 'wp-a11y', 'wp-compose', 'wp-data', 'wp-deprecated', 'wp-dom', 'wp-element', 'wp-html-entities', 'wp-i18n', 'wp-is-shallow-equal', 'wp-polyfill', 'wp-primitives', 'wp-warning'), 'version' => 'cc718ade20a1cf002483e81dda4e58b8'); \ No newline at end of file diff --git a/build/blocks-checkout.js b/build/blocks-checkout.js new file mode 100644 index 00000000000..cc5baf1f0ac --- /dev/null +++ b/build/blocks-checkout.js @@ -0,0 +1,7 @@ +this.wc=this.wc||{},this.wc.blocksCheckout=function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=171)}([function(e,t){e.exports=window.wp.element},function(e,t){e.exports=window.wp.i18n},function(e,t){e.exports=window.wp.data},function(e,t){e.exports=window.wc.wcSettings},function(e,t,n){var r;!function(){"use strict";var n={}.hasOwnProperty;function o(){for(var e=[],t=0;te[t]?Array.from(e[t].values()).sort((e,t)=>e.priority-t.priority):[];let i,a;!function(e){e.SUCCESS="success",e.FAIL="failure",e.ERROR="error"}(i||(i={})),function(e){e.CART="wc/cart",e.CHECKOUT="wc/checkout",e.PAYMENTS="wc/checkout/payments",e.EXPRESS_PAYMENTS="wc/checkout/express-payments",e.CONTACT_INFORMATION="wc/checkout/contact-information",e.SHIPPING_ADDRESS="wc/checkout/shipping-address",e.BILLING_ADDRESS="wc/checkout/billing-address",e.SHIPPING_METHODS="wc/checkout/shipping-methods",e.CHECKOUT_ACTIONS="wc/checkout/checkout-actions"}(a||(a={}));const c=(e,t)=>Object(r.a)(e)&&"type"in e&&e.type===t,s=e=>c(e,i.SUCCESS),l=e=>c(e,i.ERROR),u=e=>c(e,i.FAIL),f=e=>!Object(r.a)(e)||void 0===e.retry||!0===e.retry},function(e,t){e.exports=window.wp.compose},function(e,t){e.exports=window.wc.wcBlocksData},function(e,t){e.exports=window.wp.htmlEntities},function(e,t){e.exports=window.wp.isShallowEqual},,function(e,t,n){"use strict";n(8)},,function(e,t,n){"use strict";n.d(t,"a",(function(){return o})),n.d(t,"b",(function(){return i}));var r=n(35);const o=e=>!Object(r.a)(e)&&e instanceof Object&&e.constructor===Object;function i(e,t){return o(e)&&t in e}},,function(e,t,n){"use strict";n.d(t,"a",(function(){return O})),n.d(t,"c",(function(){return E})),n.d(t,"b",(function(){return j})),n.d(t,"d",(function(){return x}));var r=n(12),o=n(0),i=n(5),a=Object(o.createContext)({registerSlot:()=>{},unregisterSlot:()=>{},registerFill:()=>{},unregisterFill:()=>{},getSlot:()=>{},getFills:()=>{},subscribe:()=>{}});function c({name:e,children:t,registerFill:n,unregisterFill:r}){const c=(e=>{const{getSlot:t,subscribe:n}=Object(o.useContext)(a),[r,i]=Object(o.useState)(t(e));return Object(o.useEffect)(()=>(i(t(e)),n(()=>{i(t(e))})),[e]),r})(e),s=Object(o.useRef)({name:e,children:t});return Object(o.useLayoutEffect)(()=>(n(e,s.current),()=>r(e,s.current)),[]),Object(o.useLayoutEffect)(()=>{s.current.children=t,c&&c.forceUpdate()},[t]),Object(o.useLayoutEffect)(()=>{e!==s.current.name&&(r(s.current.name,s.current),s.current.name=e,n(e,s.current))},[e]),c&&c.node?(Object(i.isFunction)(t)&&(t=t(c.props.fillProps)),Object(o.createPortal)(t,c.node)):null}var s=e=>Object(o.createElement)(a.Consumer,null,({registerFill:t,unregisterFill:n})=>Object(o.createElement)(c,Object(r.a)({},e,{registerFill:t,unregisterFill:n})));class l extends o.Component{constructor(){super(...arguments),this.isUnmounted=!1,this.bindNode=this.bindNode.bind(this)}componentDidMount(){const{registerSlot:e}=this.props;e(this.props.name,this)}componentWillUnmount(){const{unregisterSlot:e}=this.props;this.isUnmounted=!0,e(this.props.name,this)}componentDidUpdate(e){const{name:t,unregisterSlot:n,registerSlot:r}=this.props;e.name!==t&&(n(e.name),r(t,this))}bindNode(e){this.node=e}forceUpdate(){this.isUnmounted||super.forceUpdate()}render(){const{children:e,name:t,fillProps:n={},getFills:r}=this.props,a=Object(i.map)(r(t,this),e=>{const t=Object(i.isFunction)(e.children)?e.children(n):e.children;return o.Children.map(t,(e,t)=>{if(!e||Object(i.isString)(e))return e;const n=e.key||t;return Object(o.cloneElement)(e,{key:n})})}).filter(Object(i.negate)(o.isEmptyElement));return Object(o.createElement)(o.Fragment,null,Object(i.isFunction)(e)?e(a):a)}}var u=e=>Object(o.createElement)(a.Consumer,null,({registerSlot:t,unregisterSlot:n,getFills:i})=>Object(o.createElement)(l,Object(r.a)({},e,{registerSlot:t,unregisterSlot:n,getFills:i}))),f=n(33);function d(){const[,e]=Object(o.useState)({}),t=Object(o.useRef)(!0);return Object(o.useEffect)(()=>()=>{t.current=!1},[]),()=>{t.current&&e({})}}function p({name:e,children:t}){const n=Object(f.a)(e),r=Object(o.useRef)({rerender:d()});return Object(o.useEffect)(()=>(n.registerFill(r),()=>{n.unregisterFill(r)}),[n.registerFill,n.unregisterFill]),n.ref&&n.ref.current?("function"==typeof t&&(t=t(n.fillProps)),Object(o.createPortal)(t,n.ref.current)):null}var m=n(15),h=n(30),g=Object(o.forwardRef)((function({name:e,fillProps:t={},as:n="div",...i},a){const c=Object(o.useContext)(h.a),s=Object(o.useRef)();return Object(o.useLayoutEffect)(()=>(c.registerSlot(e,s,t),()=>{c.unregisterSlot(e,s)}),[c.registerSlot,c.unregisterSlot,e]),Object(o.useLayoutEffect)(()=>{c.updateSlot(e,t)}),Object(o.createElement)(n,Object(r.a)({ref:Object(m.useMergeRefs)([a,s])},i))})),b=n(18),v=n.n(b);function y({children:e}){const t=function(){const[e,t]=Object(o.useState)({}),[n,r]=Object(o.useState)({}),i=Object(o.useCallback)((e,n,r)=>{t(t=>{const o=t[e]||{};return{...t,[e]:{...o,ref:n||o.ref,fillProps:r||o.fillProps||{}}}})},[]),a=Object(o.useCallback)((e,n)=>{t(t=>{const{[e]:r,...o}=t;return(null==r?void 0:r.ref)===n?o:t})},[]),c=Object(o.useCallback)((t,r)=>{const o=e[t];if(o&&!v()(o.fillProps,r)){o.fillProps=r;const e=n[t];e&&e.map(e=>e.current.rerender())}},[e,n]),s=Object(o.useCallback)((e,t)=>{r(n=>({...n,[e]:[...n[e]||[],t]}))},[]),l=Object(o.useCallback)((e,t)=>{r(n=>n[e]?{...n,[e]:n[e].filter(e=>e!==t)}:n)},[]);return Object(o.useMemo)(()=>({slots:e,fills:n,registerSlot:i,updateSlot:c,unregisterSlot:a,registerFill:s,unregisterFill:l}),[e,n,i,c,a,s,l])}();return Object(o.createElement)(h.a.Provider,{value:t},e)}class w extends o.Component{constructor(){super(...arguments),this.registerSlot=this.registerSlot.bind(this),this.registerFill=this.registerFill.bind(this),this.unregisterSlot=this.unregisterSlot.bind(this),this.unregisterFill=this.unregisterFill.bind(this),this.getSlot=this.getSlot.bind(this),this.getFills=this.getFills.bind(this),this.hasFills=this.hasFills.bind(this),this.subscribe=this.subscribe.bind(this),this.slots={},this.fills={},this.listeners=[],this.contextValue={registerSlot:this.registerSlot,unregisterSlot:this.unregisterSlot,registerFill:this.registerFill,unregisterFill:this.unregisterFill,getSlot:this.getSlot,getFills:this.getFills,hasFills:this.hasFills,subscribe:this.subscribe}}registerSlot(e,t){const n=this.slots[e];this.slots[e]=t,this.triggerListeners(),this.forceUpdateSlot(e),n&&n.forceUpdate()}registerFill(e,t){this.fills[e]=[...this.fills[e]||[],t],this.forceUpdateSlot(e)}unregisterSlot(e,t){this.slots[e]===t&&(delete this.slots[e],this.triggerListeners())}unregisterFill(e,t){this.fills[e]=Object(i.without)(this.fills[e],t),this.forceUpdateSlot(e)}getSlot(e){return this.slots[e]}getFills(e,t){return this.slots[e]!==t?[]:this.fills[e]}hasFills(e){return this.fills[e]&&!!this.fills[e].length}forceUpdateSlot(e){const t=this.getSlot(e);t&&t.forceUpdate()}triggerListeners(){this.listeners.forEach(e=>e())}subscribe(e){return this.listeners.push(e),()=>{this.listeners=Object(i.without)(this.listeners,e)}}render(){return Object(o.createElement)(a.Provider,{value:this.contextValue},this.props.children)}}function O(e){return Object(o.createElement)(o.Fragment,null,Object(o.createElement)(s,e),Object(o.createElement)(p,e))}const E=Object(o.forwardRef)(({bubblesVirtually:e,...t},n)=>e?Object(o.createElement)(g,Object(r.a)({},t,{ref:n})):Object(o.createElement)(u,t));function j({children:e,...t}){return Object(o.createElement)(w,t,Object(o.createElement)(y,null,e))}function x(e){const t=t=>Object(o.createElement)(O,Object(r.a)({name:e},t));t.displayName=e+"Fill";const n=t=>Object(o.createElement)(E,Object(r.a)({name:e},t));return n.displayName=e+"Slot",n.__unstableName=e,{Fill:t,Slot:n}}},,function(e,t){e.exports=window.wc.wcBlocksRegistry},function(e,t,n){var r=n(49);e.exports=function(e,t,n){return(t=r(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t,n){"use strict";var r=n(12),o=n(0),i=n(4),a=n.n(i),c=n(5),s=n(7),l=n.n(s),u=n(42),f=n(36),d=n(38);const p=["onMouseDown","onClick"];t.a=Object(o.forwardRef)((function(e,t){const{href:n,target:i,isSmall:s,isPressed:m,isBusy:h,isDestructive:g,className:b,disabled:v,icon:y,iconPosition:w="left",iconSize:O,showTooltip:E,tooltipPosition:j,shortcut:x,label:S,children:k,text:N,variant:_,__experimentalIsFocusable:T,describedBy:C,...A}=function({isDefault:e,isPrimary:t,isSecondary:n,isTertiary:r,isLink:o,variant:i,...a}){let c=i;var s,u,f,d,p;return t&&(null!==(s=c)&&void 0!==s||(c="primary")),r&&(null!==(u=c)&&void 0!==u||(c="tertiary")),n&&(null!==(f=c)&&void 0!==f||(c="secondary")),e&&(l()("Button isDefault prop",{since:"5.4",alternative:'variant="secondary"'}),null!==(d=c)&&void 0!==d||(c="secondary")),o&&(null!==(p=c)&&void 0!==p||(c="link")),{...a,variant:c}}(e),R=a()("components-button",b,{"is-secondary":"secondary"===_,"is-primary":"primary"===_,"is-small":s,"is-tertiary":"tertiary"===_,"is-pressed":m,"is-busy":h,"is-link":"link"===_,"is-destructive":g,"has-text":!!y&&!!k,"has-icon":!!y}),M=v&&!T,F=void 0===n||M?"button":"a",D="a"===F?{href:n,target:i}:{type:"button",disabled:M,"aria-pressed":m};if(v&&T){D["aria-disabled"]=!0;for(const e of p)A[e]=e=>{e.stopPropagation(),e.preventDefault()}}const I=!M&&(E&&S||x||!!S&&(!k||Object(c.isArray)(k)&&!k.length)&&!1!==E),P=C?Object(c.uniqueId)():null,L=A["aria-describedby"]||P,V=Object(o.createElement)(F,Object(r.a)({},D,A,{className:R,"aria-label":A["aria-label"]||S,"aria-describedby":L,ref:t}),y&&"left"===w&&Object(o.createElement)(f.a,{icon:y,size:O}),N&&Object(o.createElement)(o.Fragment,null,N),y&&"right"===w&&Object(o.createElement)(f.a,{icon:y,size:O}),k);return I?Object(o.createElement)(o.Fragment,null,Object(o.createElement)(u.a,{text:C||S,shortcut:x,position:j},V),C&&Object(o.createElement)(d.a,null,Object(o.createElement)("span",{id:P},C))):Object(o.createElement)(o.Fragment,null,V,C&&Object(o.createElement)(d.a,null,Object(o.createElement)("span",{id:P},C)))}))},,function(e,t,n){"use strict";(function(e){var r=n(0);n(44);const o=Object(r.createContext)({slots:{},fills:{},registerSlot:()=>{void 0!==e&&e.env},updateSlot:()=>{},unregisterSlot:()=>{},registerFill:()=>{},unregisterFill:()=>{}});t.a=o}).call(this,n(32))},function(e,t){function n(t){return e.exports=n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,n(t)}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t){var n,r,o=e.exports={};function i(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function c(e){if(n===setTimeout)return setTimeout(e,0);if((n===i||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:i}catch(e){n=i}try{r="function"==typeof clearTimeout?clearTimeout:a}catch(e){r=a}}();var s,l=[],u=!1,f=-1;function d(){u&&s&&(u=!1,s.length?l=s.concat(l):f=-1,l.length&&p())}function p(){if(!u){var e=c(d);u=!0;for(var t=l.length;t;){for(s=l,l=[];++f1)for(var n=1;ni||[],[i]);return{...n,updateSlot:Object(r.useCallback)(n=>{t.updateSlot(e,n)},[e,t.updateSlot]),unregisterSlot:Object(r.useCallback)(n=>{t.unregisterSlot(e,n)},[e,t.unregisterSlot]),fills:a,registerFill:Object(r.useCallback)(n=>{t.registerFill(e,n)},[e,t.registerFill]),unregisterFill:Object(r.useCallback)(n=>{t.unregisterFill(e,n)},[e,t.unregisterFill])}}},function(e,t,n){"use strict";n.d(t,"a",(function(){return a}));var r=n(4),o=n.n(r);function i(e){return"appear"===e?"top":"left"}function a(e){if("loading"===e.type)return o()("components-animate__loading");const{type:t,origin:n=i(t)}=e;if("appear"===t){const[e,t="center"]=n.split(" ");return o()("components-animate__appear",{["is-from-"+t]:"center"!==t,["is-from-"+e]:"middle"!==e})}return"slide-in"===t?o()("components-animate__slide-in","is-from-"+n):void 0}},function(e,t,n){"use strict";n.d(t,"a",(function(){return r}));const r=e=>null===e},function(e,t,n){"use strict";var r=n(12),o=n(0),i=n(8),a=n(37);t.a=function({icon:e=null,size:t=24,...n}){if("string"==typeof e)return Object(o.createElement)(a.a,Object(r.a)({icon:e},n));if(Object(o.isValidElement)(e)&&a.a===e.type)return Object(o.cloneElement)(e,{...n});if("function"==typeof e)return e.prototype instanceof o.Component?Object(o.createElement)(e,{size:t,...n}):e({size:t,...n});if(e&&("svg"===e.type||e.type===i.SVG)){const r={width:t,height:t,...e.props,...n};return Object(o.createElement)(i.SVG,r)}return Object(o.isValidElement)(e)?Object(o.cloneElement)(e,{size:t,...n}):e}},function(e,t,n){"use strict";var r=n(12),o=n(0);t.a=function({icon:e,className:t,...n}){const i=["dashicon","dashicons","dashicons-"+e,t].filter(Boolean).join(" ");return Object(o.createElement)("span",Object(r.a)({className:i},n))}},function(e,t,n){"use strict";var r=n(4),o=n.n(r),i=n(0);t.a=Object(i.forwardRef)((function({as:e="div",className:t,...n},r){return function({as:e="div",...t}){return"function"==typeof t.children?t.children(t):Object(i.createElement)(e,t)}({as:e,className:o()("components-visually-hidden",t),...n,ref:r})}))},,function(e,t,n){"use strict";n.d(t,"a",(function(){return c}));var r=n(0);let o=0;function i(e){const t=document.scrollingElement||document.body;e&&(o=t.scrollTop);const n=e?"add":"remove";t.classList[n]("lockscroll"),document.documentElement.classList[n]("lockscroll"),e||(t.scrollTop=o)}let a=0;function c(){return Object(r.useEffect)(()=>(0===a&&i(!0),++a,()=>{1===a&&i(!1),--a}),[]),null}},function(e,t,n){"use strict";(function(e){var r=n(0),o=n(5),i=n(4),a=n.n(i),c=n(45),s=n(1),l=(n(44),n(28));t.a=Object(r.forwardRef)((function({className:t,children:n,spokenMessage:i=n,politeness:u="polite",actions:f=[],onRemove:d=o.noop,icon:p=null,explicitDismiss:m=!1,onDismiss:h=o.noop},g){function b(e){e&&e.preventDefault&&e.preventDefault(),h(),d()}h=h||o.noop,function(e,t){const n="string"==typeof e?e:Object(r.renderToString)(e);Object(r.useEffect)(()=>{n&&Object(c.speak)(n,t)},[n,t])}(i,u),Object(r.useEffect)(()=>{const e=setTimeout(()=>{m||(h(),d())},1e4);return()=>clearTimeout(e)},[h,d]);const v=a()(t,"components-snackbar",{"components-snackbar-explicit-dismiss":!!m});f&&f.length>1&&(void 0!==e&&e.env,f=[f[0]]);const y=a()("components-snackbar__content",{"components-snackbar__content-with-icon":!!p});return Object(r.createElement)("div",{ref:g,className:v,onClick:m?o.noop:b,tabIndex:"0",role:m?"":"button",onKeyPress:m?o.noop:b,"aria-label":m?"":Object(s.__)("Dismiss this notice")},Object(r.createElement)("div",{className:y},p&&Object(r.createElement)("div",{className:"components-snackbar__icon"},p),n,f.map(({label:e,onClick:t,url:n},o)=>Object(r.createElement)(l.a,{key:o,href:n,variant:"tertiary",onClick:e=>function(e,t){e.stopPropagation(),d(),t&&t(e)}(e,t),className:"components-snackbar__action"},e)),m&&Object(r.createElement)("span",{role:"button","aria-label":"Dismiss this notice",tabIndex:"0",className:"components-snackbar__dismiss-button",onClick:b,onKeyPress:b},"✕")))}))}).call(this,n(32))},function(e,t,n){"use strict";var r=n(0),o=n(5),i=n(15),a=n(43),c=function({shortcut:e,className:t}){if(!e)return null;let n,i;return Object(o.isString)(e)&&(n=e),Object(o.isObject)(e)&&(n=e.display,i=e.ariaLabel),Object(r.createElement)("span",{className:t,"aria-label":i},n)};const s=Object(r.createElement)("div",{className:"event-catcher"}),l=({eventHandlers:e,child:t,childrenWithPopover:n})=>Object(r.cloneElement)(Object(r.createElement)("span",{className:"disabled-element-wrapper"},Object(r.cloneElement)(s,e),Object(r.cloneElement)(t,{children:n}),","),e),u=({child:e,eventHandlers:t,childrenWithPopover:n})=>Object(r.cloneElement)(e,{...t,children:n}),f=(e,t,n)=>{if(1!==r.Children.count(e))return;const o=r.Children.only(e);"function"==typeof o.props[t]&&o.props[t](n)};t.a=function({children:e,position:t,text:n,shortcut:s}){const[d,p]=Object(r.useState)(!1),[m,h]=Object(r.useState)(!1),g=Object(i.useDebounce)(h,700),b=t=>{f(e,"onMouseDown",t),document.addEventListener("mouseup",w),p(!0)},v=t=>{f(e,"onMouseUp",t),document.removeEventListener("mouseup",w),p(!1)},y=e=>"mouseUp"===e?v:"mouseDown"===e?b:void 0,w=y("mouseUp"),O=(t,n)=>r=>{if(f(e,t,r),r.currentTarget.disabled)return;if("focus"===r.type&&d)return;g.cancel();const i=Object(o.includes)(["focus","mouseenter"],r.type);i!==m&&(n?g(i):h(i))},E=()=>{g.cancel(),document.removeEventListener("mouseup",w)};if(Object(r.useEffect)(()=>E,[]),1!==r.Children.count(e))return e;const j={onMouseEnter:O("onMouseEnter",!0),onMouseLeave:O("onMouseLeave"),onClick:O("onClick"),onFocus:O("onFocus"),onBlur:O("onBlur"),onMouseDown:y("mouseDown")},x=r.Children.only(e),{children:S,disabled:k}=x.props;return(k?l:u)({child:x,eventHandlers:j,childrenWithPopover:(({grandchildren:e,isOver:t,position:n,text:o,shortcut:i})=>Object(r.concatChildren)(e,t&&Object(r.createElement)(a.a,{focusOnMount:!1,position:n,className:"components-tooltip","aria-hidden":"true",animate:!1,noArrow:!0},o,Object(r.createElement)(c,{className:"components-tooltip__shortcut",shortcut:i}))))({grandchildren:S,isOver:m,position:t,text:n,shortcut:s})})}},function(e,t,n){"use strict";var r=n(12),o=n(0),i=n(4),a=n.n(i),c=n(61),s=n(7),l=n.n(s),u=n(15),f=n(178),d=n(1);function p(e,t,n){const{defaultView:r}=t,{frameElement:o}=r;if(!o||t===n.ownerDocument)return e;const i=o.getBoundingClientRect();return new r.DOMRect(e.left+i.left,e.top+i.top,e.width,e.height)}var m=n(28),h=n(40),g=n(33),b=n(24),v=n(34);function y(e,t){const{paddingTop:n,paddingBottom:r,paddingLeft:o,paddingRight:i}=(a=t).ownerDocument.defaultView.getComputedStyle(a);var a;const c=n?parseInt(n,10):0,s=r?parseInt(r,10):0,l=o?parseInt(o,10):0,u=i?parseInt(i,10):0;return{x:e.left+l,y:e.top+c,width:e.width-l-u,height:e.height-c-s,left:e.left+l,right:e.right-u,top:e.top+c,bottom:e.bottom-s}}function w(e,t,n){n?e.getAttribute(t)!==n&&e.setAttribute(t,n):e.hasAttribute(t)&&e.removeAttribute(t)}function O(e,t,n=""){e.style[t]!==n&&(e.style[t]=n)}function E(e,t,n){n?e.classList.contains(t)||e.classList.add(t):e.classList.contains(t)&&e.classList.remove(t)}const j=Object(o.forwardRef)(({headerTitle:e,onClose:t,children:n,className:i,noArrow:s=!0,isAlternate:j,position:x="bottom right",range:S,focusOnMount:k="firstElement",anchorRef:N,shouldAnchorIncludePadding:_,anchorRect:T,getAnchorRect:C,expandOnMobile:A,animate:R=!0,onClickOutside:M,onFocusOutside:F,__unstableStickyBoundaryElement:D,__unstableSlotName:I="Popover",__unstableObserveElement:P,__unstableBoundaryParent:L,__unstableForcePosition:V,__unstableForceXAlignment:U,...B},H)=>{const z=Object(o.useRef)(null),W=Object(o.useRef)(null),q=Object(o.useRef)(),G=Object(u.useViewportMatch)("medium","<"),[K,$]=Object(o.useState)(),Y=Object(g.a)(I),Z=A&&G,[Q,X]=Object(u.useResizeObserver)();s=Z||s,Object(o.useLayoutEffect)(()=>{if(Z)return E(q.current,"is-without-arrow",s),E(q.current,"is-alternate",j),w(q.current,"data-x-axis"),w(q.current,"data-y-axis"),O(q.current,"top"),O(q.current,"left"),O(W.current,"maxHeight"),void O(W.current,"maxWidth");const e=()=>{if(!q.current||!W.current)return;let e=function(e,t,n,r=!1,o,i){if(t)return t;if(n){if(!e.current)return;const t=n(e.current);return p(t,t.ownerDocument||e.current.ownerDocument,i)}if(!1!==r){if(!(r&&window.Range&&window.Element&&window.DOMRect))return;if("function"==typeof(null==r?void 0:r.cloneRange))return p(Object(c.getRectangleFromRange)(r),r.endContainer.ownerDocument,i);if("function"==typeof(null==r?void 0:r.getBoundingClientRect)){const e=p(r.getBoundingClientRect(),r.ownerDocument,i);return o?e:y(e,r)}const{top:e,bottom:t}=r,n=e.getBoundingClientRect(),a=t.getBoundingClientRect(),s=p(new window.DOMRect(n.left,n.top,n.width,a.bottom-n.top),e.ownerDocument,i);return o?s:y(s,r)}if(!e.current)return;const{parentNode:a}=e.current,s=a.getBoundingClientRect();return o?s:y(s,a)}(z,T,C,N,_,q.current);if(!e)return;const{offsetParent:t,ownerDocument:n}=q.current;let r,o=0;if(t&&t!==n.body){const n=t.getBoundingClientRect();o=n.top,e=new window.DOMRect(e.left-n.left,e.top-n.top,e.width,e.height)}var i;L&&(r=null===(i=q.current.closest(".popover-slot"))||void 0===i?void 0:i.parentNode);const a=X.height?X:W.current.getBoundingClientRect(),{popoverTop:l,popoverLeft:u,xAxis:f,yAxis:m,contentHeight:h,contentWidth:g}=function(e,t,n="top",r,o,i,a,c,s){const[l,u="center",f]=n.split(" "),p=function(e,t,n,r,o,i,a,c){const{height:s}=t;if(o){const t=o.getBoundingClientRect().top+s-a;if(e.top<=t)return{yAxis:n,popoverTop:Math.min(e.bottom,t)}}let l=e.top+e.height/2;"bottom"===r?l=e.bottom:"top"===r&&(l=e.top);const u={popoverTop:l,contentHeight:(l-s/2>0?s/2:l)+(l+s/2>window.innerHeight?window.innerHeight-l:s/2)},f={popoverTop:e.top,contentHeight:e.top-10-s>0?s:e.top-10},d={popoverTop:e.bottom,contentHeight:e.bottom+10+s>window.innerHeight?window.innerHeight-10-e.bottom:s};let p,m=n,h=null;if(!o&&!c)if("middle"===n&&u.contentHeight===s)m="middle";else if("top"===n&&f.contentHeight===s)m="top";else if("bottom"===n&&d.contentHeight===s)m="bottom";else{m=f.contentHeight>d.contentHeight?"top":"bottom";const e="top"===m?f.contentHeight:d.contentHeight;h=e!==s?e:null}return p="middle"===m?u.popoverTop:"top"===m?f.popoverTop:d.popoverTop,{yAxis:m,popoverTop:p,contentHeight:h}}(e,t,l,f,r,0,i,c);return{...function(e,t,n,r,o,i,a,c,s){const{width:l}=t;"left"===n&&Object(d.isRTL)()?n="right":"right"===n&&Object(d.isRTL)()&&(n="left"),"left"===r&&Object(d.isRTL)()?r="right":"right"===r&&Object(d.isRTL)()&&(r="left");const u=Math.round(e.left+e.width/2),f={popoverLeft:u,contentWidth:(u-l/2>0?l/2:u)+(u+l/2>window.innerWidth?window.innerWidth-u:l/2)};let p=e.left;"right"===r?p=e.right:"middle"===i||s||(p=u);let m=e.right;"left"===r?m=e.left:"middle"===i||s||(m=u);const h={popoverLeft:p,contentWidth:p-l>0?l:p},g={popoverLeft:m,contentWidth:m+l>window.innerWidth?window.innerWidth-m:l};let b,v=n,y=null;if(!o&&!c)if("center"===n&&f.contentWidth===l)v="center";else if("left"===n&&h.contentWidth===l)v="left";else if("right"===n&&g.contentWidth===l)v="right";else{v=h.contentWidth>g.contentWidth?"left":"right";const e="left"===v?h.contentWidth:g.contentWidth;l>window.innerWidth&&(y=window.innerWidth),e!==l&&(v="center",f.popoverLeft=window.innerWidth/2)}if(b="center"===v?f.popoverLeft:"left"===v?h.popoverLeft:g.popoverLeft,a){const e=a.getBoundingClientRect();b=Math.min(b,e.right-l),Object(d.isRTL)()||(b=Math.max(b,0))}return{xAxis:v,popoverLeft:b,contentWidth:y}}(e,t,u,f,r,p.yAxis,a,c,s),...p}}(e,a,x,D,q.current,o,r,V,U);"number"==typeof l&&"number"==typeof u&&(O(q.current,"top",l+"px"),O(q.current,"left",u+"px")),E(q.current,"is-without-arrow",s||"center"===f&&"middle"===m),E(q.current,"is-alternate",j),w(q.current,"data-x-axis",f),w(q.current,"data-y-axis",m),O(W.current,"maxHeight","number"==typeof h?h+"px":""),O(W.current,"maxWidth","number"==typeof g?g+"px":""),$(({left:"right",right:"left"}[f]||"center")+" "+({top:"bottom",bottom:"top"}[m]||"middle"))};e();const{ownerDocument:t}=q.current,{defaultView:n}=t,r=n.setInterval(e,500);let o;const i=()=>{n.cancelAnimationFrame(o),o=n.requestAnimationFrame(e)};n.addEventListener("click",i),n.addEventListener("resize",e),n.addEventListener("scroll",e,!0);const a=function(e){if(e)return e.endContainer?e.endContainer.ownerDocument:e.top?e.top.ownerDocument:e.ownerDocument}(N);let l;return a&&a!==t&&(a.defaultView.addEventListener("resize",e),a.defaultView.addEventListener("scroll",e,!0)),P&&(l=new n.MutationObserver(e),l.observe(P,{attributes:!0})),()=>{n.clearInterval(r),n.removeEventListener("resize",e),n.removeEventListener("scroll",e,!0),n.removeEventListener("click",i),n.cancelAnimationFrame(o),a&&a!==t&&(a.defaultView.removeEventListener("resize",e),a.defaultView.removeEventListener("scroll",e,!0)),l&&l.disconnect()}},[Z,T,C,N,_,x,X,D,P,L]);const J=(e,n)=>{if("focus-outside"===e&&F)F(n);else if("focus-outside"===e&&M){const e=new window.MouseEvent("click");Object.defineProperty(e,"target",{get:()=>n.relatedTarget}),l()("Popover onClickOutside prop",{since:"5.3",alternative:"onFocusOutside"}),M(e)}else t&&t()},[ee,te]=Object(u.__experimentalUseDialog)({focusOnMount:k,__unstableOnClose:J,onClose:J}),ne=Object(u.useMergeRefs)([q,ee,H]),re=Boolean(R&&K)&&Object(v.a)({type:"appear",origin:K});let oe=Object(o.createElement)("div",Object(r.a)({className:a()("components-popover",i,re,{"is-expanded":Z,"is-without-arrow":s,"is-alternate":j})},B,{ref:ne},te,{tabIndex:"-1"}),Z&&Object(o.createElement)(h.a,null),Z&&Object(o.createElement)("div",{className:"components-popover__header"},Object(o.createElement)("span",{className:"components-popover__header-title"},e),Object(o.createElement)(m.a,{className:"components-popover__close",icon:f.a,onClick:t})),Object(o.createElement)("div",{ref:W,className:"components-popover__content"},Object(o.createElement)("div",{style:{position:"relative"}},Q,n)));return Y.ref&&(oe=Object(o.createElement)(b.a,{name:I},oe)),N||T?oe:Object(o.createElement)("span",{ref:z},oe)});j.Slot=Object(o.forwardRef)((function({name:e="Popover"},t){return Object(o.createElement)(b.c,{bubblesVirtually:!0,name:e,className:"popover-slot",ref:t})})),t.a=j},function(e,t){e.exports=window.wp.warning},function(e,t){e.exports=window.wp.a11y},,,,function(e,t,n){var r=n(31).default,o=n(50);e.exports=function(e){var t=o(e,"string");return"symbol"===r(t)?t:String(t)},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t,n){var r=n(31).default;e.exports=function(e,t){if("object"!==r(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t||"default");if("object"!==r(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t,n){"use strict";function r(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(t,"__esModule",{value:!0});var o=r(n(9)),i=r(n(163)),a=n(10),c=r(a),s=r(n(164)),l=r(n(166)),u={arr:Array.isArray,obj:function(e){return"[object Object]"===Object.prototype.toString.call(e)},fun:function(e){return"function"==typeof e},str:function(e){return"string"==typeof e},num:function(e){return"number"==typeof e},und:function(e){return void 0===e},nul:function(e){return null===e},set:function(e){return e instanceof Set},map:function(e){return e instanceof Map},equ:function(e,t){if(typeof e!=typeof t)return!1;if(u.str(e)||u.num(e))return e===t;if(u.obj(e)&&u.obj(t)&&Object.keys(e).length+Object.keys(t).length===0)return!0;var n;for(n in e)if(!(n in t))return!1;for(n in t)if(e[n]!==t[n])return!1;return!u.und(n)||e===t}};function f(){var e=a.useState(!1)[1];return a.useCallback((function(){return e((function(e){return!e}))}),[])}function d(e,t){return u.und(e)||u.nul(e)?t:e}function p(e){return u.und(e)?[]:u.arr(e)?e:[e]}function m(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r=n.length)break;i=n[o++]}else{if((o=n.next()).done)break;i=o.value}for(var a=i,c=!1,s=0;s=p.startTime+l.duration;else if(l.decay)g=m+y/(1-.998)*(1-Math.exp(-(1-.998)*(t-p.startTime))),(u=Math.abs(p.lastPosition-g)<.1)&&(h=g);else{f=void 0!==p.lastTime?p.lastTime:t,y=void 0!==p.lastVelocity?p.lastVelocity:l.initialVelocity,t>f+64&&(f=t);for(var w=Math.floor(t-f),O=0;Oh:g=e);++n);return n-1}(e,i);return function(e,t,n,r,o,i,a,c,s){var l=s?s(e):e;if(ln){if("identity"===c)return l;"clamp"===c&&(l=n)}return r===o?r:t===n?e<=t?r:o:(t===-1/0?l=-l:n===1/0?l-=t:l=(l-t)/(n-t),l=i(l),r===-1/0?l=-l:o===1/0?l+=r:l=l*(o-r)+r,l)}(e,i[t],i[t+1],o[t],o[t+1],s,a,c,r.map)}}var U=function(e){function t(n,r,o,i){var a;return(a=e.call(this)||this).calc=void 0,a.payload=n instanceof y&&!(n instanceof t)?n.getPayload():Array.isArray(n)?n:[n],a.calc=V(r,o,i),a}s(t,e);var n=t.prototype;return n.getValue=function(){return this.calc.apply(this,this.payload.map((function(e){return e.getValue()})))},n.updateConfig=function(e,t,n){this.calc=V(e,t,n)},n.interpolate=function(e,n,r){return new t(this,e,n,r)},t}(y),B=function(e){function t(t){var n;return(n=e.call(this)||this).animatedStyles=new Set,n.value=void 0,n.startPosition=void 0,n.lastPosition=void 0,n.lastVelocity=void 0,n.startTime=void 0,n.lastTime=void 0,n.done=!1,n.setValue=function(e,t){void 0===t&&(t=!0),n.value=e,t&&n.flush()},n.value=t,n.startPosition=t,n.lastPosition=t,n}s(t,e);var n=t.prototype;return n.flush=function(){0===this.animatedStyles.size&&function e(t,n){"update"in t?n.add(t):t.getChildren().forEach((function(t){return e(t,n)}))}(this,this.animatedStyles),this.animatedStyles.forEach((function(e){return e.update()}))},n.clearStyles=function(){this.animatedStyles.clear()},n.getValue=function(){return this.value},n.interpolate=function(e,t,n){return new U(this,e,t,n)},t}(v),H=function(e){function t(t){var n;return(n=e.call(this)||this).payload=t.map((function(e){return new B(e)})),n}s(t,e);var n=t.prototype;return n.setValue=function(e,t){var n=this;void 0===t&&(t=!0),Array.isArray(e)?e.length===this.payload.length&&e.forEach((function(e,r){return n.payload[r].setValue(e,t)})):this.payload.forEach((function(n){return n.setValue(e,t)}))},n.getValue=function(){return this.payload.map((function(e){return e.getValue()}))},n.interpolate=function(e,t){return new U(this,e,t)},t}(y),z=0,W=function(){function e(){var e=this;this.id=void 0,this.idle=!0,this.hasChanged=!1,this.guid=0,this.local=0,this.props={},this.merged={},this.animations={},this.interpolations={},this.values={},this.configs=[],this.listeners=[],this.queue=[],this.localQueue=void 0,this.getValues=function(){return e.interpolations},this.id=z++}var t=e.prototype;return t.update=function(e){if(!e)return this;var t=h(e),n=t.delay,r=void 0===n?0:n,a=t.to,c=i(t,["delay","to"]);if(u.arr(a)||u.fun(a))this.queue.push(o({},c,{delay:r,to:a}));else if(a){var s={};Object.entries(a).forEach((function(e){var t,n=e[0],i=e[1],a=o({to:(t={},t[n]=i,t),delay:m(r,n)},c),l=s[a.delay]&&s[a.delay].to;s[a.delay]=o({},s[a.delay],a,{to:o({},l,a.to)})})),this.queue=Object.values(s)}return this.queue=this.queue.sort((function(e,t){return e.delay-t.delay})),this.diff(c),this},t.start=function(e){var t=this;if(this.queue.length){this.idle=!1,this.localQueue&&this.localQueue.forEach((function(e){var n=e.from,r=void 0===n?{}:n,i=e.to,a=void 0===i?{}:i;u.obj(r)&&(t.merged=o({},r,t.merged)),u.obj(a)&&(t.merged=o({},t.merged,a))}));var n=this.local=++this.guid,r=this.localQueue=this.queue;this.queue=[],r.forEach((function(o,a){var c=o.delay,s=i(o,["delay"]),l=function(o){a===r.length-1&&n===t.guid&&o&&(t.idle=!0,t.props.onRest&&t.props.onRest(t.merged)),e&&e()},f=u.arr(s.to)||u.fun(s.to);c?setTimeout((function(){n===t.guid&&(f?t.runAsync(s,l):t.diff(s).start(l))}),c):f?t.runAsync(s,l):t.diff(s).start(l)}))}else u.fun(e)&&this.listeners.push(e),this.props.onStart&&this.props.onStart(),this,P.has(this)||P.add(this),I||(I=!0,x(A||L));return this},t.stop=function(e){return this.listeners.forEach((function(t){return t(e)})),this.listeners=[],this},t.pause=function(e){return this.stop(!0),e&&(this,P.has(this)&&P.delete(this)),this},t.runAsync=function(e,t){var n=this,r=(e.delay,i(e,["delay"])),a=this.local,c=Promise.resolve(void 0);if(u.arr(r.to))for(var s=function(e){var t=e,i=o({},r,h(r.to[t]));u.arr(i.config)&&(i.config=i.config[t]),c=c.then((function(){if(a===n.guid)return new Promise((function(e){return n.diff(i).start(e)}))}))},l=0;l=r.length)return"break";a=r[i++]}else{if((i=r.next()).done)return"break";a=i.value}var n=a.key,c=function(e){return e.key!==n};(u.und(t)||t===n)&&(e.current.instances.delete(n),e.current.transitions=e.current.transitions.filter(c),e.current.deleted=e.current.deleted.filter(c))},r=e.current.deleted,o=Array.isArray(r),i=0;for(r=o?r:r[Symbol.iterator]();;){var a;if("break"===n())break}e.current.forceUpdate()}var Z=function(e){function t(t){var n;return void 0===t&&(t={}),n=e.call(this)||this,!t.transform||t.transform instanceof v||(t=g.transform(t)),n.payload=t,n}return s(t,e),t}(w),Q={transparent:0,aliceblue:4042850303,antiquewhite:4209760255,aqua:16777215,aquamarine:2147472639,azure:4043309055,beige:4126530815,bisque:4293182719,black:255,blanchedalmond:4293643775,blue:65535,blueviolet:2318131967,brown:2771004159,burlywood:3736635391,burntsienna:3934150143,cadetblue:1604231423,chartreuse:2147418367,chocolate:3530104575,coral:4286533887,cornflowerblue:1687547391,cornsilk:4294499583,crimson:3692313855,cyan:16777215,darkblue:35839,darkcyan:9145343,darkgoldenrod:3095792639,darkgray:2846468607,darkgreen:6553855,darkgrey:2846468607,darkkhaki:3182914559,darkmagenta:2332068863,darkolivegreen:1433087999,darkorange:4287365375,darkorchid:2570243327,darkred:2332033279,darksalmon:3918953215,darkseagreen:2411499519,darkslateblue:1211993087,darkslategray:793726975,darkslategrey:793726975,darkturquoise:13554175,darkviolet:2483082239,deeppink:4279538687,deepskyblue:12582911,dimgray:1768516095,dimgrey:1768516095,dodgerblue:512819199,firebrick:2988581631,floralwhite:4294635775,forestgreen:579543807,fuchsia:4278255615,gainsboro:3705462015,ghostwhite:4177068031,gold:4292280575,goldenrod:3668254975,gray:2155905279,green:8388863,greenyellow:2919182335,grey:2155905279,honeydew:4043305215,hotpink:4285117695,indianred:3445382399,indigo:1258324735,ivory:4294963455,khaki:4041641215,lavender:3873897215,lavenderblush:4293981695,lawngreen:2096890111,lemonchiffon:4294626815,lightblue:2916673279,lightcoral:4034953471,lightcyan:3774873599,lightgoldenrodyellow:4210742015,lightgray:3553874943,lightgreen:2431553791,lightgrey:3553874943,lightpink:4290167295,lightsalmon:4288707327,lightseagreen:548580095,lightskyblue:2278488831,lightslategray:2005441023,lightslategrey:2005441023,lightsteelblue:2965692159,lightyellow:4294959359,lime:16711935,limegreen:852308735,linen:4210091775,magenta:4278255615,maroon:2147483903,mediumaquamarine:1724754687,mediumblue:52735,mediumorchid:3126187007,mediumpurple:2473647103,mediumseagreen:1018393087,mediumslateblue:2070474495,mediumspringgreen:16423679,mediumturquoise:1221709055,mediumvioletred:3340076543,midnightblue:421097727,mintcream:4127193855,mistyrose:4293190143,moccasin:4293178879,navajowhite:4292783615,navy:33023,oldlace:4260751103,olive:2155872511,olivedrab:1804477439,orange:4289003775,orangered:4282712319,orchid:3664828159,palegoldenrod:4008225535,palegreen:2566625535,paleturquoise:2951671551,palevioletred:3681588223,papayawhip:4293907967,peachpuff:4292524543,peru:3448061951,pink:4290825215,plum:3718307327,powderblue:2967529215,purple:2147516671,rebeccapurple:1714657791,red:4278190335,rosybrown:3163525119,royalblue:1097458175,saddlebrown:2336560127,salmon:4202722047,sandybrown:4104413439,seagreen:780883967,seashell:4294307583,sienna:2689740287,silver:3233857791,skyblue:2278484991,slateblue:1784335871,slategray:1887473919,slategrey:1887473919,snow:4294638335,springgreen:16744447,steelblue:1182971135,tan:3535047935,teal:8421631,thistle:3636451583,tomato:4284696575,turquoise:1088475391,violet:4001558271,wheat:4125012991,white:4294967295,whitesmoke:4126537215,yellow:4294902015,yellowgreen:2597139199},X="[-+]?\\d*\\.?\\d+";function J(){for(var e=arguments.length,t=new Array(e),n=0;n1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function le(e,t,n){var r=n<.5?n*(1+t):n+t-n*t,o=2*n-r,i=se(o,r,e+1/3),a=se(o,r,e),c=se(o,r,e-1/3);return Math.round(255*i)<<24|Math.round(255*a)<<16|Math.round(255*c)<<8}function ue(e){var t=parseInt(e,10);return t<0?0:t>255?255:t}function fe(e){return(parseFloat(e)%360+360)%360/360}function de(e){var t=parseFloat(e);return t<0?0:t>1?255:Math.round(255*t)}function pe(e){var t=parseFloat(e);return t<0?0:t>100?1:t/100}function me(e){var t,n,r="number"==typeof(t=e)?t>>>0===t&&t>=0&&t<=4294967295?t:null:(n=ae.exec(t))?parseInt(n[1]+"ff",16)>>>0:Q.hasOwnProperty(t)?Q[t]:(n=ee.exec(t))?(ue(n[1])<<24|ue(n[2])<<16|ue(n[3])<<8|255)>>>0:(n=te.exec(t))?(ue(n[1])<<24|ue(n[2])<<16|ue(n[3])<<8|de(n[4]))>>>0:(n=oe.exec(t))?parseInt(n[1]+n[1]+n[2]+n[2]+n[3]+n[3]+"ff",16)>>>0:(n=ce.exec(t))?parseInt(n[1],16)>>>0:(n=ie.exec(t))?parseInt(n[1]+n[1]+n[2]+n[2]+n[3]+n[3]+n[4]+n[4],16)>>>0:(n=ne.exec(t))?(255|le(fe(n[1]),pe(n[2]),pe(n[3])))>>>0:(n=re.exec(t))?(le(fe(n[1]),pe(n[2]),pe(n[3]))|de(n[4]))>>>0:null;return null===r?e:"rgba("+((4278190080&(r=r||0))>>>24)+", "+((16711680&r)>>>16)+", "+((65280&r)>>>8)+", "+(255&r)/255+")"}var he=/[+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,ge=/(#(?:[0-9a-f]{2}){2,4}|(#[0-9a-f]{3})|(rgb|hsl)a?\((-?\d+%?[,\s]+){2,3}\s*[\d\.]+%?\))/gi,be=new RegExp("("+Object.keys(Q).join("|")+")","g"),ve={animationIterationCount:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},ye=["Webkit","Ms","Moz","O"];function we(e,t,n){return null==t||"boolean"==typeof t||""===t?"":n||"number"!=typeof t||0===t||ve.hasOwnProperty(e)&&ve[e]?(""+t).trim():t+"px"}ve=Object.keys(ve).reduce((function(e,t){return ye.forEach((function(n){return e[function(e,t){return e+t.charAt(0).toUpperCase()+t.substring(1)}(n,t)]=e[t]})),e}),ve);var Oe={};M((function(e){return new Z(e)})),T("div"),k((function(e){var t=e.output.map((function(e){return e.replace(ge,me)})).map((function(e){return e.replace(be,me)})),n=t[0].match(he).map((function(){return[]}));t.forEach((function(e){e.match(he).forEach((function(e,t){return n[t].push(+e)}))}));var r=t[0].match(he).map((function(t,r){return V(o({},e,{output:n[r]}))}));return function(e){var n=0;return t[0].replace(he,(function(){return r[n++](e)})).replace(/rgba\(([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+)\)/gi,(function(e,t,n,r,o){return"rgba("+Math.round(t)+", "+Math.round(n)+", "+Math.round(r)+", "+o+")"}))}})),E(Q),O((function(e,t){if(!e.nodeType||void 0===e.setAttribute)return!1;var n=t.style,r=t.children,o=t.scrollTop,a=t.scrollLeft,c=i(t,["style","children","scrollTop","scrollLeft"]),s="filter"===e.nodeName||e.parentNode&&"filter"===e.parentNode.nodeName;for(var l in void 0!==o&&(e.scrollTop=o),void 0!==a&&(e.scrollLeft=a),void 0!==r&&(e.textContent=r),n)if(n.hasOwnProperty(l)){var u=0===l.indexOf("--"),f=we(l,n[l],u);"float"===l&&(l="cssFloat"),u?e.style.setProperty(l,f):e.style[l]=f}for(var d in c){var p=s?d:Oe[d]||(Oe[d]=d.replace(/([A-Z])/g,(function(e){return"-"+e.toLowerCase()})));void 0!==e.getAttribute(p)&&e.setAttribute(p,c[d])}}),(function(e){return e}));var Ee,je,xe=(Ee=function(e){return a.forwardRef((function(t,n){var r=f(),s=a.useRef(!0),l=a.useRef(null),d=a.useRef(null),p=a.useCallback((function(e){var t=l.current;l.current=new D(e,(function(){var e=!1;d.current&&(e=g.fn(d.current,l.current.getAnimatedValue())),d.current&&!1!==e||r()})),t&&t.detach()}),[]);a.useEffect((function(){return function(){s.current=!1,l.current&&l.current.detach()}}),[]),a.useImperativeHandle(n,(function(){return R(d,s,r)})),p(t);var m,h=l.current.getValue(),b=(h.scrollTop,h.scrollLeft,i(h,["scrollTop","scrollLeft"])),v=(m=e,!u.fun(m)||m.prototype instanceof c.Component?function(e){return d.current=function(e,t){return t&&(u.fun(t)?t(e):u.obj(t)&&(t.current=e)),e}(e,n)}:void 0);return c.createElement(e,o({},b,{ref:v}))}))},void 0===(je=!1)&&(je=!0),function(e){return(u.arr(e)?e:Object.keys(e)).reduce((function(e,t){var n=je?t[0].toLowerCase()+t.substring(1):t;return e[n]=Ee(n),e}),Ee)}),Se=xe(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","tspan"]);t.apply=xe,t.config={default:{tension:170,friction:26},gentle:{tension:120,friction:14},wobbly:{tension:180,friction:12},stiff:{tension:210,friction:20},slow:{tension:280,friction:60},molasses:{tension:280,friction:120}},t.update=L,t.animated=Se,t.a=Se,t.interpolate=function(e,t,n){return e&&new U(e,t,n)},t.Globals=F,t.useSpring=function(e){var t=u.fun(e),n=q(1,t?e:[e]),r=n[0],o=n[1],i=n[2];return t?[r[0],o,i]:r},t.useTrail=function(e,t){var n=a.useRef(!1),r=u.fun(t),i=m(t),c=a.useRef(),s=q(e,(function(e,t){return 0===e&&(c.current=[]),c.current.push(t),o({},i,{config:m(i.config,e),attach:e>0&&function(){return c.current[e-1]}})})),l=s[0],f=s[1],d=s[2],p=a.useMemo((function(){return function(e){return f((function(t,n){e.reverse;var r=e.reverse?t+1:t-1,a=c.current[r];return o({},e,{config:m(e.config||i.config,t),attach:a&&function(){return a}})}))}}),[e,i.reverse]);return a.useEffect((function(){n.current&&!r&&p(t)})),a.useEffect((function(){n.current=!0}),[]),r?[l,p,d]:l},t.useTransition=function(e,t,n){var r=o({items:e,keys:t||function(e){return e}},n),c=$(r),s=c.lazy,l=void 0!==s&&s,u=(c.unique,c.reset),d=void 0!==u&&u,p=(c.enter,c.leave,c.update,c.onDestroyed),h=(c.keys,c.items,c.onFrame),g=c.onRest,b=c.onStart,v=c.ref,y=i(c,["lazy","unique","reset","enter","leave","update","onDestroyed","keys","items","onFrame","onRest","onStart","ref"]),w=f(),O=a.useRef(!1),E=a.useRef({mounted:!1,first:!0,deleted:[],current:{},transitions:[],prevProps:{},paused:!!r.ref,instances:!O.current&&new Map,forceUpdate:w});return a.useImperativeHandle(r.ref,(function(){return{start:function(){return Promise.all(Array.from(E.current.instances).map((function(e){var t=e[1];return new Promise((function(e){return t.start(e)}))})))},stop:function(e){return Array.from(E.current.instances).forEach((function(t){return t[1].stop(e)}))},get controllers(){return Array.from(E.current.instances).map((function(e){return e[1]}))}}})),E.current=function(e,t){for(var n=e.first,r=e.prevProps,a=i(e,["first","prevProps"]),c=$(t),s=c.items,l=c.keys,u=c.initial,f=c.from,d=c.enter,p=c.leave,h=c.update,g=c.trail,b=void 0===g?0:g,v=c.unique,y=c.config,w=c.order,O=void 0===w?["enter","leave","update"]:w,E=$(r),j=E.keys,x=E.items,S=o({},a.current),k=[].concat(a.deleted),N=Object.keys(S),_=new Set(N),T=new Set(l),C=l.filter((function(e){return!_.has(e)})),A=a.transitions.filter((function(e){return!e.destroyed&&!T.has(e.originalKey)})).map((function(e){return e.originalKey})),R=l.filter((function(e){return _.has(e)})),M=-b;O.length;)switch(O.shift()){case"enter":C.forEach((function(e,t){v&&k.find((function(t){return t.originalKey===e}))&&(k=k.filter((function(t){return t.originalKey!==e})));var r=l.indexOf(e),o=s[r],i=n&&void 0!==u?"initial":"enter";S[e]={slot:i,originalKey:e,key:v?String(e):G++,item:o,trail:M+=b,config:m(y,o,i),from:m(n&&void 0!==u?u||{}:f,o),to:m(d,o)}}));break;case"leave":A.forEach((function(e){var t=j.indexOf(e),n=x[t];k.unshift(o({},S[e],{slot:"leave",destroyed:!0,left:j[Math.max(0,t-1)],right:j[Math.min(j.length,t+1)],trail:M+=b,config:m(y,n,"leave"),to:m(p,n)})),delete S[e]}));break;case"update":R.forEach((function(e){var t=l.indexOf(e),n=s[t];S[e]=o({},S[e],{item:n,slot:"update",trail:M+=b,config:m(y,n,"update"),to:m(h,n)})}))}var F=l.map((function(e){return S[e]}));return k.forEach((function(e){var t,n=e.left,r=(e.right,i(e,["left","right"]));-1!==(t=F.findIndex((function(e){return e.originalKey===n})))&&(t+=1),t=Math.max(0,t),F=[].concat(F.slice(0,t),[r],F.slice(t))})),o({},a,{changed:C.length||A.length||R.length,first:n&&0===C.length,transitions:F,current:S,deleted:k,prevProps:t})}(E.current,r),E.current.changed&&E.current.transitions.forEach((function(e){var t=e.slot,n=e.from,r=e.to,i=e.config,a=e.trail,c=e.key,s=e.item;E.current.instances.has(c)||E.current.instances.set(c,new W);var u=E.current.instances.get(c),f=o({},y,{to:r,from:n,config:i,ref:v,onRest:function(n){E.current.mounted&&(e.destroyed&&(v||l||Y(E,c),p&&p(s)),!Array.from(E.current.instances).some((function(e){return!e[1].idle}))&&(v||l)&&E.current.deleted.length>0&&Y(E),g&&g(s,t,n))},onStart:b&&function(){return b(s,t)},onFrame:h&&function(e){return h(s,t,e)},delay:a,reset:d&&"enter"===t});u.update(f),E.current.paused||u.start()})),a.useEffect((function(){return E.current.mounted=O.current=!0,function(){E.current.mounted=O.current=!1,Array.from(E.current.instances).map((function(e){return e[1].destroy()})),E.current.instances.clear()}}),[]),E.current.transitions.map((function(e){var t=e.item,n=e.slot,r=e.key;return{item:t,key:r,state:n,props:E.current.instances.get(r).getValues()}}))},t.useChain=function(e,t,n){void 0===n&&(n=1e3);var r=a.useRef();a.useEffect((function(){u.equ(e,r.current)?e.forEach((function(e){var t=e.current;return t&&t.start()})):t?e.forEach((function(e,r){var i=e.current;if(i){var a=i.controllers;if(a.length){var c=n*t[r];a.forEach((function(e){e.queue=e.queue.map((function(e){return o({},e,{delay:e.delay+c})})),e.start()}))}}})):e.reduce((function(e,t,n){var r=t.current;return e.then((function(){return r.start()}))}),Promise.resolve()),r.current=e}))},t.useSprings=q},,,,,function(e,t,n){"use strict";var r=n(0),o=n(5),i=n(4),a=n.n(i),c=n(1),s=n(45),l=n(178),u=n(28);function f(e){switch(e){case"success":case"warning":case"info":return"polite";case"error":default:return"assertive"}}t.a=function({className:e,status:t="info",children:n,spokenMessage:i=n,onRemove:d=o.noop,isDismissible:p=!0,actions:m=[],politeness:h=f(t),__unstableHTML:g,onDismiss:b=o.noop}){!function(e,t){const n="string"==typeof e?e:Object(r.renderToString)(e);Object(r.useEffect)(()=>{n&&Object(s.speak)(n,t)},[n,t])}(i,h);const v=a()(e,"components-notice","is-"+t,{"is-dismissible":p});return g&&(n=Object(r.createElement)(r.RawHTML,null,n)),Object(r.createElement)("div",{className:v},Object(r.createElement)("div",{className:"components-notice__content"},n,Object(r.createElement)("div",{className:"components-notice__actions"},m.map(({className:e,label:t,isPrimary:n,variant:o,noDefaultClasses:i=!1,onClick:c,url:s},l)=>{let f=o;return"primary"===o||i||(f=s?"link":"secondary"),void 0===f&&n&&(f="primary"),Object(r.createElement)(u.a,{key:l,href:s,variant:f,onClick:s?void 0:c,className:a()("components-notice__action",e)},t)}))),p&&Object(r.createElement)(u.a,{className:"components-notice__dismiss",icon:l.a,label:Object(c.__)("Dismiss this notice"),onClick:e=>{var t;null==e||null===(t=e.preventDefault)||void 0===t||t.call(e),b(),d()},showTooltip:!1}))}},function(e,t,n){"use strict";var r=n(12),o=n(0),i=n(4),a=n.n(i),c=n(5),s=n(51),l=n(15),u=n(41);t.a=function({notices:e,className:t,children:n,onRemove:i=c.noop}){const f=Object(l.useReducedMotion)(),[d]=Object(o.useState)(()=>new WeakMap),p=Object(s.useTransition)(e,e=>e.id,{from:{opacity:0,height:0},enter:e=>async t=>await t({opacity:1,height:d.get(e).offsetHeight}),leave:()=>async e=>{await e({opacity:0}),await e({height:0})},immediate:f});t=a()("components-snackbar-list",t);const m=e=>()=>i(e.id);return Object(o.createElement)("div",{className:t},n,p.map(({item:e,key:t,props:n})=>Object(o.createElement)(s.animated.div,{key:t,style:n},Object(o.createElement)("div",{className:"components-snackbar-list__notice-container",ref:t=>t&&d.set(e,t)},Object(o.createElement)(u.a,Object(r.a)({},Object(c.omit)(e,["content"]),{onRemove:m(e)}),e.content)))))}},function(e,t){},,,function(e,t){e.exports=window.wp.dom},function(e,t,n){e.exports=function(){"use strict";function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(t)}function t(e,n){return(t=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,n)}function n(){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 r(e,o,i){return(r=n()?Reflect.construct:function(e,n,r){var o=[null];o.push.apply(o,n);var i=new(Function.bind.apply(e,o));return r&&t(i,r.prototype),i}).apply(null,arguments)}function o(e){return function(e){if(Array.isArray(e))return i(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return i(e,void 0);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?i(e,void 0):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n1?n-1:0),o=1;o/gm),q=d(/^data-[\-\w.\u00B7-\uFFFF]/),G=d(/^aria-[\-\w]+$/),K=d(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),$=d(/^(?:\w+script|data):/i),Y=d(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Z=d(/^html$/i),Q=function(){return"undefined"==typeof window?null:window},X=function(t,n){if("object"!==e(t)||"function"!=typeof t.createPolicy)return null;var r=null;n.currentScript&&n.currentScript.hasAttribute("data-tt-policy-suffix")&&(r=n.currentScript.getAttribute("data-tt-policy-suffix"));var o="dompurify"+(r?"#"+r:"");try{return t.createPolicy(o,{createHTML:function(e){return e},createScriptURL:function(e){return e}})}catch(e){return console.warn("TrustedTypes policy "+o+" could not be created."),null}};return function t(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Q(),r=function(e){return t(e)};if(r.version="2.4.0",r.removed=[],!n||!n.document||9!==n.document.nodeType)return r.isSupported=!1,r;var i=n.document,a=n.document,c=n.DocumentFragment,s=n.HTMLTemplateElement,l=n.Node,u=n.Element,d=n.NodeFilter,p=n.NamedNodeMap,m=void 0===p?n.NamedNodeMap||n.MozNamedAttrMap:p,h=n.HTMLFormElement,g=n.DOMParser,b=n.trustedTypes,_=u.prototype,J=A(_,"cloneNode"),ee=A(_,"nextSibling"),te=A(_,"childNodes"),ne=A(_,"parentNode");if("function"==typeof s){var re=a.createElement("template");re.content&&re.content.ownerDocument&&(a=re.content.ownerDocument)}var oe=X(b,i),ie=oe?oe.createHTML(""):"",ae=a,ce=ae.implementation,se=ae.createNodeIterator,le=ae.createDocumentFragment,ue=ae.getElementsByTagName,fe=i.importNode,de={};try{de=C(a).documentMode?a.documentMode:{}}catch(e){}var pe={};r.isSupported="function"==typeof ne&&ce&&void 0!==ce.createHTMLDocument&&9!==de;var me,he,ge=z,be=W,ve=q,ye=G,we=$,Oe=Y,Ee=K,je=null,xe=T({},[].concat(o(R),o(M),o(F),o(I),o(L))),Se=null,ke=T({},[].concat(o(V),o(U),o(B),o(H))),Ne=Object.seal(Object.create(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),_e=null,Te=null,Ce=!0,Ae=!0,Re=!1,Me=!1,Fe=!1,De=!1,Ie=!1,Pe=!1,Le=!1,Ve=!1,Ue=!0,Be=!1,He="user-content-",ze=!0,We=!1,qe={},Ge=null,Ke=T({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]),$e=null,Ye=T({},["audio","video","img","source","image","track"]),Ze=null,Qe=T({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Xe="http://www.w3.org/1998/Math/MathML",Je="http://www.w3.org/2000/svg",et="http://www.w3.org/1999/xhtml",tt=et,nt=!1,rt=["application/xhtml+xml","text/html"],ot="text/html",it=null,at=a.createElement("form"),ct=function(e){return e instanceof RegExp||e instanceof Function},st=function(t){it&&it===t||(t&&"object"===e(t)||(t={}),t=C(t),me=me=-1===rt.indexOf(t.PARSER_MEDIA_TYPE)?ot:t.PARSER_MEDIA_TYPE,he="application/xhtml+xml"===me?function(e){return e}:O,je="ALLOWED_TAGS"in t?T({},t.ALLOWED_TAGS,he):xe,Se="ALLOWED_ATTR"in t?T({},t.ALLOWED_ATTR,he):ke,Ze="ADD_URI_SAFE_ATTR"in t?T(C(Qe),t.ADD_URI_SAFE_ATTR,he):Qe,$e="ADD_DATA_URI_TAGS"in t?T(C(Ye),t.ADD_DATA_URI_TAGS,he):Ye,Ge="FORBID_CONTENTS"in t?T({},t.FORBID_CONTENTS,he):Ke,_e="FORBID_TAGS"in t?T({},t.FORBID_TAGS,he):{},Te="FORBID_ATTR"in t?T({},t.FORBID_ATTR,he):{},qe="USE_PROFILES"in t&&t.USE_PROFILES,Ce=!1!==t.ALLOW_ARIA_ATTR,Ae=!1!==t.ALLOW_DATA_ATTR,Re=t.ALLOW_UNKNOWN_PROTOCOLS||!1,Me=t.SAFE_FOR_TEMPLATES||!1,Fe=t.WHOLE_DOCUMENT||!1,Pe=t.RETURN_DOM||!1,Le=t.RETURN_DOM_FRAGMENT||!1,Ve=t.RETURN_TRUSTED_TYPE||!1,Ie=t.FORCE_BODY||!1,Ue=!1!==t.SANITIZE_DOM,Be=t.SANITIZE_NAMED_PROPS||!1,ze=!1!==t.KEEP_CONTENT,We=t.IN_PLACE||!1,Ee=t.ALLOWED_URI_REGEXP||Ee,tt=t.NAMESPACE||et,t.CUSTOM_ELEMENT_HANDLING&&ct(t.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(Ne.tagNameCheck=t.CUSTOM_ELEMENT_HANDLING.tagNameCheck),t.CUSTOM_ELEMENT_HANDLING&&ct(t.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(Ne.attributeNameCheck=t.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),t.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof t.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(Ne.allowCustomizedBuiltInElements=t.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Me&&(Ae=!1),Le&&(Pe=!0),qe&&(je=T({},o(L)),Se=[],!0===qe.html&&(T(je,R),T(Se,V)),!0===qe.svg&&(T(je,M),T(Se,U),T(Se,H)),!0===qe.svgFilters&&(T(je,F),T(Se,U),T(Se,H)),!0===qe.mathMl&&(T(je,I),T(Se,B),T(Se,H))),t.ADD_TAGS&&(je===xe&&(je=C(je)),T(je,t.ADD_TAGS,he)),t.ADD_ATTR&&(Se===ke&&(Se=C(Se)),T(Se,t.ADD_ATTR,he)),t.ADD_URI_SAFE_ATTR&&T(Ze,t.ADD_URI_SAFE_ATTR,he),t.FORBID_CONTENTS&&(Ge===Ke&&(Ge=C(Ge)),T(Ge,t.FORBID_CONTENTS,he)),ze&&(je["#text"]=!0),Fe&&T(je,["html","head","body"]),je.table&&(T(je,["tbody"]),delete _e.tbody),f&&f(t),it=t)},lt=T({},["mi","mo","mn","ms","mtext"]),ut=T({},["foreignobject","desc","title","annotation-xml"]),ft=T({},["title","style","font","a","script"]),dt=T({},M);T(dt,F),T(dt,D);var pt=T({},I);T(pt,P);var mt=function(e){var t=ne(e);t&&t.tagName||(t={namespaceURI:et,tagName:"template"});var n=O(e.tagName),r=O(t.tagName);return e.namespaceURI===Je?t.namespaceURI===et?"svg"===n:t.namespaceURI===Xe?"svg"===n&&("annotation-xml"===r||lt[r]):Boolean(dt[n]):e.namespaceURI===Xe?t.namespaceURI===et?"math"===n:t.namespaceURI===Je?"math"===n&&ut[r]:Boolean(pt[n]):e.namespaceURI===et&&!(t.namespaceURI===Je&&!ut[r])&&!(t.namespaceURI===Xe&&!lt[r])&&!pt[n]&&(ft[n]||!dt[n])},ht=function(e){w(r.removed,{element:e});try{e.parentNode.removeChild(e)}catch(t){try{e.outerHTML=ie}catch(t){e.remove()}}},gt=function(e,t){try{w(r.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){w(r.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e&&!Se[e])if(Pe||Le)try{ht(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}},bt=function(e){var t,n;if(Ie)e=""+e;else{var r=E(e,/^[\r\n\t ]+/);n=r&&r[0]}"application/xhtml+xml"===me&&(e=''+e+"");var o=oe?oe.createHTML(e):e;if(tt===et)try{t=(new g).parseFromString(o,me)}catch(e){}if(!t||!t.documentElement){t=ce.createDocument(tt,"template",null);try{t.documentElement.innerHTML=nt?"":o}catch(e){}}var i=t.body||t.documentElement;return e&&n&&i.insertBefore(a.createTextNode(n),i.childNodes[0]||null),tt===et?ue.call(t,Fe?"html":"body")[0]:Fe?t.documentElement:i},vt=function(e){return se.call(e.ownerDocument||e,e,d.SHOW_ELEMENT|d.SHOW_COMMENT|d.SHOW_TEXT,null,!1)},yt=function(e){return e instanceof h&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||!(e.attributes instanceof m)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore)},wt=function(t){return"object"===e(l)?t instanceof l:t&&"object"===e(t)&&"number"==typeof t.nodeType&&"string"==typeof t.nodeName},Ot=function(e,t,n){pe[e]&&v(pe[e],(function(e){e.call(r,t,n,it)}))},Et=function(e){var t;if(Ot("beforeSanitizeElements",e,null),yt(e))return ht(e),!0;if(k(/[\u0080-\uFFFF]/,e.nodeName))return ht(e),!0;var n=he(e.nodeName);if(Ot("uponSanitizeElement",e,{tagName:n,allowedTags:je}),e.hasChildNodes()&&!wt(e.firstElementChild)&&(!wt(e.content)||!wt(e.content.firstElementChild))&&k(/<[/\w]/g,e.innerHTML)&&k(/<[/\w]/g,e.textContent))return ht(e),!0;if("select"===n&&k(/