this.wc=this.wc||{},this.wc.blocks=this.wc.blocks||{},this.wc.blocks["stock-filter"]=function(e){function t(t){for(var n,s,l=t[0],a=t[1],i=t[2],b=0,d=[];b<l.length;b++)s=l[b],Object.prototype.hasOwnProperty.call(o,s)&&o[s]&&d.push(o[s][0]),o[s]=0;for(n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n]);for(u&&u(t);d.length;)d.shift()();return r.push.apply(r,i||[]),c()}function c(){for(var e,t=0;t<r.length;t++){for(var c=r[t],n=!0,l=1;l<c.length;l++){var a=c[l];0!==o[a]&&(n=!1)}n&&(r.splice(t--,1),e=s(s.s=c[0]))}return e}var n={},o={47:0,1:0},r=[];function s(t){if(n[t])return n[t].exports;var c=n[t]={i:t,l:!1,exports:{}};return e[t].call(c.exports,c,c.exports,s),c.l=!0,c.exports}s.m=e,s.c=n,s.d=function(e,t,c){s.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:c})},s.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},s.t=function(e,t){if(1&t&&(e=s(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var c=Object.create(null);if(s.r(c),Object.defineProperty(c,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)s.d(c,n,function(t){return e[t]}.bind(null,n));return c},s.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return s.d(t,"a",t),t},s.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},s.p="";var l=window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[],a=l.push.bind(l);l.push=t,l=l.slice();for(var i=0;i<l.length;i++)t(l[i]);var u=a;return r.push([494,0]),c()}({0:function(e,t){e.exports=window.wp.element},1:function(e,t){e.exports=window.wp.i18n},10:function(e,t){e.exports=window.wc.wcBlocksData},101:function(e,t){e.exports=window.wp.warning},103:function(e,t,c){"use strict";c.d(t,"a",(function(){return o}));var n=c(0);function o(e,t){const c=Object(n.useRef)();return Object(n.useEffect)(()=>{c.current===e||t&&!t(e,c.current)||(c.current=e)},[e,t]),c.current}},106:function(e,t,c){"use strict";c.d(t,"a",(function(){return r}));var n=c(0);const o=Object(n.createContext)({}),r=()=>{const{wrapper:e}=Object(n.useContext)(o);return t=>{e&&e.current&&(e.current.hidden=!t)}}},11:function(e,t){e.exports=window.wp.primitives},112:function(e,t,c){"use strict";c.d(t,"a",(function(){return l}));var n=c(10),o=c(7),r=c(0),s=c(45);const l=e=>{const{namespace:t,resourceName:c,resourceValues:l=[],query:a={},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(r.useRef)({results:[],isLoading:!0}),b=Object(s.a)(a),d=Object(s.a)(l),p=(()=>{const[,e]=Object(r.useState)();return Object(r.useCallback)(t=>{e(()=>{throw t})},[])})(),f=Object(o.useSelect)(e=>{if(!i)return null;const o=e(n.COLLECTIONS_STORE_KEY),r=[t,c,b,d],s=o.getCollectionError(...r);if(s){if(!(s instanceof Error))throw new Error("TypeError: `error` object is not an instance of Error constructor");p(s)}return{results:o.getCollection(...r),isLoading:!o.hasFinishedResolution("getCollection",r)}},[t,c,d,b,i]);return null!==f&&(u.current=f),u.current}},117:function(e,t,c){"use strict";var n=c(0),o=c(1),r=c(30);c(276),t.a=e=>{let{name:t,count:c}=e;return Object(n.createElement)(n.Fragment,null,t,null!==c&&Number.isFinite(c)&&Object(n.createElement)(r.a,{label:c.toString(),screenReaderLabel:Object(o.sprintf)(
/* translators: %s number of products. */
Object(o._n)("%s product","%s products",c,"woocommerce"),c),wrapperElement:"span",wrapperProps:{className:"wc-filter-element-label-list-count"}}))}},119:function(e,t,c){"use strict";c.d(t,"a",(function(){return s}));var n=c(5),o=c(20),r=c(82);const s=e=>{const t=Object(o.b)(e)?e:{},c=Object(r.a)(t.style);return Object(n.__experimentalUseBorderProps)({...t,style:c})}},12:function(e,t){e.exports=window.wp.compose},127:function(e,t,c){"use strict";c.d(t,"a",(function(){return i}));var n=c(0),o=c(1),r=c(8),s=c(7),l=c(2),a=c(5);const i=e=>{let{clientId:t,setAttributes:c,filterType:i,attributes:u}=e;const{replaceBlock:b}=Object(s.useDispatch)("core/block-editor"),{heading:d,headingLevel:p}=u;if(Object(s.useSelect)(e=>{const{getBlockParentsByBlockName:c}=e("core/block-editor");return c(t,"woocommerce/filter-wrapper").length>0},[t])||!i)return null;const f=[Object(n.createElement)(l.Button,{key:"convert",onClick:()=>{const e=[Object(r.createBlock)("woocommerce/"+i,{...u,heading:""})];d&&""!==d&&e.unshift(Object(r.createBlock)("core/heading",{content:d,level:null!=p?p:2})),b(t,Object(r.createBlock)("woocommerce/filter-wrapper",{heading:d,filterType:i},[...e])),c({heading:"",lock:{remove:!0}})},variant:"primary"},Object(o.__)("Upgrade block","woocommerce"))];return Object(n.createElement)(a.Warning,{actions:f},Object(o.__)("Filter block: We have improved this block to make styling easier. Upgrade it using the button below.","woocommerce"))}},128:function(e,t,c){"use strict";var n=c(0),o=c(5),r=c(12),s=c(1);c(178),t.a=Object(r.withInstanceId)(e=>{let{className:t,headingLevel:c,onChange:r,heading:l,instanceId:a}=e;const i="h"+c;return Object(n.createElement)(i,{className:t},Object(n.createElement)("label",{className:"screen-reader-text",htmlFor:"block-title-"+a},Object(s.__)("Block title","woocommerce")),Object(n.createElement)(o.PlainText,{id:"block-title-"+a,className:"wc-block-editor-components-title",value:l,onChange:r,style:{backgroundColor:"transparent"}}))})},129:function(e,t,c){"use strict";var n=c(0);c(179),t.a=e=>{let{children:t}=e;return Object(n.createElement)("div",{className:"wc-block-filter-title-placeholder"},t)}},13:function(e,t){e.exports=window.wc.blocksCheckout},131:function(e,t,c){"use strict";var n=c(0),o=c(1),r=c(4),s=c.n(r),l=c(30);c(182),t.a=e=>{let{className:t,label:
/* translators: Reset button text for filters. */
c=Object(o.__)("Reset","woocommerce"),onClick:r,screenReaderLabel:a=Object(o.__)("Reset filter","woocommerce")}=e;return Object(n.createElement)("button",{className:s()("wc-block-components-filter-reset-button",t),onClick:r},Object(n.createElement)(l.a,{label:c,screenReaderLabel:a}))}},132:function(e,t,c){"use strict";var n=c(0),o=c(1),r=c(4),s=c.n(r),l=c(30);c(183),t.a=e=>{let{className:t,isLoading:c,disabled:r,label:
/* translators: Submit button text for filters. */
a=Object(o.__)("Apply","woocommerce"),onClick:i,screenReaderLabel:u=Object(o.__)("Apply filter","woocommerce")}=e;return Object(n.createElement)("button",{type:"submit",className:s()("wp-block-button__link","wc-block-filter-submit-button","wc-block-components-filter-submit-button",{"is-loading":c},t),disabled:r,onClick:i},Object(n.createElement)(l.a,{label:a,screenReaderLabel:u}))}},133:function(e,t,c){"use strict";c.d(t,"a",(function(){return n}));const n=e=>"boolean"==typeof e},15:function(e,t){e.exports=window.wp.htmlEntities},163:function(e,t,c){"use strict";var n=c(6),o=c.n(n),r=c(0),s=c(328),l=c(4),a=c.n(l);c(214),t.a=e=>{let{className:t,style:c,suggestions:n,multiple:l=!0,saveTransform:i=(e=>e.trim().replace(/\s/g,"-")),messages:u={},validateInput:b=(e=>n.includes(e)),label:d="",...p}=e;return Object(r.createElement)("div",{className:a()("wc-blocks-components-form-token-field-wrapper",t,{"single-selection":!l}),style:c},Object(r.createElement)(s.a,o()({label:d,__experimentalExpandOnFocus:!0,__experimentalShowHowTo:!1,__experimentalValidateInput:b,saveTransform:i,maxLength:l?void 0:1,suggestions:n,messages:u},p)))}},164:function(e,t,c){"use strict";var n=c(0),o=c(1),r=c(4),s=c.n(r),l=c(13);c(215),t.a=e=>{let{className:t,onChange:c,options:r=[],checked:a=[],isLoading:i=!1,isDisabled:u=!1,limit:b=10}=e;const[d,p]=Object(n.useState)(!1),f=Object(n.useMemo)(()=>[...Array(5)].map((e,t)=>Object(n.createElement)("li",{key:t,style:{width:Math.floor(75*Math.random())+25+"%"}})),[]),O=Object(n.useMemo)(()=>{const e=r.length-b;return!d&&Object(n.createElement)("li",{key:"show-more",className:"show-more"},Object(n.createElement)("button",{onClick:()=>{p(!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,"woocommerce"),e)},Object(o.sprintf)(
/* translators: %s number of options to reveal. */
Object(o._n)("Show %s more","Show %s more",e,"woocommerce"),e)))},[r,b,d]),m=Object(n.useMemo)(()=>d&&Object(n.createElement)("li",{key:"show-less",className:"show-less"},Object(n.createElement)("button",{onClick:()=>{p(!1)},"aria-expanded":!0,"aria-label":Object(o.__)("Show less options","woocommerce")},Object(o.__)("Show less","woocommerce"))),[d]),g=Object(n.useMemo)(()=>{const e=r.length>b+5;return Object(n.createElement)(n.Fragment,null,r.map((t,o)=>Object(n.createElement)(n.Fragment,{key:t.value},Object(n.createElement)("li",e&&!d&&o>=b&&{hidden:!0},Object(n.createElement)(l.CheckboxControl,{id:t.value,className:"wc-block-checkbox-list__checkbox",label:t.label,checked:a.includes(t.value),onChange:()=>{c(t.value)},disabled:u})),e&&o===b-1&&O)),e&&m)},[r,c,a,d,b,m,O,u]),j=s()("wc-block-checkbox-list","wc-block-components-checkbox-list",{"is-loading":i},t);return Object(n.createElement)("ul",{className:j},i?f:g)}},17:function(e,t){e.exports=window.wp.url},178:function(e,t){},179:function(e,t){},182:function(e,t){},183:function(e,t){},189:function(e){e.exports=JSON.parse('{"name":"woocommerce/stock-filter","version":"1.0.0","title":"Filter by Stock Controls","description":"Enable customers to filter the product grid by stock status.","category":"woocommerce","keywords":["WooCommerce"],"supports":{"html":false,"multiple":false,"color":true,"inserter":false,"lock":false},"attributes":{"className":{"type":"string","default":""},"headingLevel":{"type":"number","default":3},"showCounts":{"type":"boolean","default":true},"showFilterButton":{"type":"boolean","default":false},"displayStyle":{"type":"string","default":"list"},"selectType":{"type":"string","default":"multiple"},"isPreview":{"type":"boolean","default":false}},"textdomain":"woocommerce","apiVersion":2,"$schema":"https://schemas.wp.org/trunk/block.json"}')},2:function(e,t){e.exports=window.wp.components},20:function(e,t,c){"use strict";c.d(t,"b",(function(){return n})),c.d(t,"c",(function(){return o})),c.d(t,"a",(function(){return r}));const n=e=>!(e=>null===e)(e)&&e instanceof Object&&e.constructor===Object;function o(e,t){return n(e)&&t in e}const r=e=>0===Object.keys(e).length},214:function(e,t){},215:function(e,t){},248:function(e,t,c){"use strict";c.d(t,"b",(function(){return l})),c.d(t,"a",(function(){return a})),c.d(t,"d",(function(){return i})),c.d(t,"c",(function(){return u})),c.d(t,"e",(function(){return b}));var n=c(17),o=c(3),r=c(133);const s=Object(o.getSettingWithCoercion)("is_rendering_php_template",!1,r.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)}const b=e=>{const t=Object(n.getQueryArgs)(e);return Object(n.addQueryArgs)(e,t)}},26:function(e,t){e.exports=window.wp.isShallowEqual},276:function(e,t){},277:function(e,t,c){"use strict";c.d(t,"a",(function(){return b}));var n=c(0),o=c(261),r=c(9),s=c(45),l=c(20),a=c(56),i=c(112),u=c(50);const b=e=>{let{queryAttribute:t,queryPrices:c,queryStock:b,queryRating:d,queryState:p,productIds:f,isEditor:O=!1}=e,m=Object(u.a)();m+="-collection-data";const[g]=Object(a.a)(m),[j,w]=Object(a.b)("calculate_attribute_counts",[],m),[k,h]=Object(a.b)("calculate_price_range",null,m),[_,y]=Object(a.b)("calculate_stock_status_counts",null,m),[v,E]=Object(a.b)("calculate_rating_counts",null,m),S=Object(s.a)(t||{}),x=Object(s.a)(c),C=Object(s.a)(b),N=Object(s.a)(d);Object(n.useEffect)(()=>{"object"==typeof S&&Object.keys(S).length&&(j.find(e=>Object(l.c)(S,"taxonomy")&&e.taxonomy===S.taxonomy)||w([...j,S]))},[S,j,w]),Object(n.useEffect)(()=>{k!==x&&void 0!==x&&h(x)},[x,h,k]),Object(n.useEffect)(()=>{_!==C&&void 0!==C&&y(C)},[C,y,_]),Object(n.useEffect)(()=>{v!==N&&void 0!==N&&E(N)},[N,E,v]);const[T,R]=Object(n.useState)(O),[L]=Object(o.a)(T,200);T||R(!0);const A=Object(n.useMemo)(()=>(e=>{const t=e;return Array.isArray(e.calculate_attribute_counts)&&(t.calculate_attribute_counts=Object(r.sortBy)(e.calculate_attribute_counts.map(e=>{let{taxonomy:t,queryType:c}=e;return{taxonomy:t,query_type:c}}),["taxonomy","query_type"])),t})(g),[g]);return Object(i.a)({namespace:"/wc/store/v1",resourceName:"products/collection-data",query:{...p,page:void 0,per_page:void 0,orderby:void 0,order:void 0,...!Object(r.isEmpty)(f)&&{include:f},...A},shouldSelect:L})}},28:function(e,t){e.exports=window.React},3:function(e,t){e.exports=window.wc.wcSettings},30:function(e,t,c){"use strict";var n=c(0),o=c(4),r=c.n(o);t.a=e=>{let t,{label:c,screenReaderLabel:o,wrapperElement:s,wrapperProps:l={}}=e;const a=null!=c,i=null!=o;return!a&&i?(t=s||"span",l={...l,className:r()(l.className,"screen-reader-text")},Object(n.createElement)(t,l,o)):(t=s||n.Fragment,a&&i&&c!==o?Object(n.createElement)(t,l,Object(n.createElement)("span",{"aria-hidden":"true"},c),Object(n.createElement)("span",{className:"screen-reader-text"},o)):Object(n.createElement)(t,l,c))}},36:function(e,t){e.exports=window.wp.deprecated},44:function(e,t){e.exports=window.wp.a11y},45:function(e,t,c){"use strict";c.d(t,"a",(function(){return s}));var n=c(0),o=c(26),r=c.n(o);function s(e){const t=Object(n.useRef)(e);return r()(e,t.current)||(t.current=e),t.current}},494:function(e,t,c){e.exports=c(513)},495:function(e,t){},496:function(e,t){},5:function(e,t){e.exports=window.wp.blockEditor},50:function(e,t,c){"use strict";c.d(t,"a",(function(){return r}));var n=c(0);const o=Object(n.createContext)("page"),r=()=>Object(n.useContext)(o);o.Provider},513:function(e,t,c){"use strict";c.r(t);var n=c(6),o=c.n(n),r=c(0),s=c(8),l=c(72),a=c(556),i=c(4),u=c.n(i),b=c(5),d=c(1),p=c(128),f=c(2),O=c(44),m=c(564),g=c(119),j=c(45),w=c(103),k=c(56),h=c(277),_=c(3),y=c(164),v=c(132),E=c(131),S=c(129),x=c(117),C=c(163),N=c(26),T=c.n(N),R=c(15),L=c(133),A=c(20),B=c(17),F=c(248),P=c(9);const I=[{value:"preview-1",name:"In Stock",label:Object(r.createElement)(x.a,{name:"In Stock",count:3}),textLabel:"In Stock (3)"},{value:"preview-2",name:"Out of stock",label:Object(r.createElement)(x.a,{name:"Out of stock",count:3}),textLabel:"Out of stock (3)"},{value:"preview-3",name:"On backorder",label:Object(r.createElement)(x.a,{name:"On backorder",count:2}),textLabel:"On backorder (2)"}];c(496);var M=c(67),q=c(189);function Q(){return Math.floor(Math.random()*Date.now())}const D=e=>e.trim().replace(/\s/g,"").replace(/_/g,"-").replace(/-+/g,"-").replace(/[^a-zA-Z0-9-]/g,"");var W=c(106);const Y=F.a+"stock_status";var U=e=>{let{attributes:t,isEditor:c=!1}=e;const n=Object(W.a)(),o=Object(_.getSettingWithCoercion)("is_rendering_php_template",!1,L.a),[s,a]=Object(r.useState)(!1),{outofstock:i,...b}=Object(_.getSetting)("stockStatusOptions",{}),p=c?[]:Object(_.getSettingWithCoercion)("product_ids",[],Array.isArray),f=Object(r.useRef)(Object(_.getSetting)("hideOutOfStockItems",!1)?b:{outofstock:i,...b}),N=Object(r.useMemo)(()=>function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"filter_stock_status";const c=Object(F.d)(t);if(!c)return[];const n=Object(M.a)(c)?c.split(","):c;return Object.keys(e).filter(e=>n.includes(e))}(f.current,Y),[]),[q,U]=Object(r.useState)(N),[V,G]=Object(r.useState)(t.isPreview?I:[]),[K]=Object(r.useState)(Object.entries(f.current).map(e=>{let[t,c]=e;return{slug:t,name:c}}).filter(e=>!!e.name).sort((e,t)=>e.slug.localeCompare(t.slug))),[J]=Object(k.a)(),[$,z]=Object(k.b)("stock_status",N),{results:H,isLoading:Z}=Object(h.a)({queryStock:!0,queryState:J,productIds:p,isEditor:c}),X=Object(r.useCallback)(e=>Object(A.c)(H,"stock_status_counts")&&Array.isArray(H.stock_status_counts)?H.stock_status_counts.find(t=>{let{status:c,count:n}=t;return c===e&&0!==Number(n)}):null,[H]),[ee,te]=Object(r.useState)(Q()),ce=Object(g.a)(t);Object(r.useEffect)(()=>{if(Z||t.isPreview)return;const e=K.map(e=>{const c=X(e.slug);if(!(c||q.includes(e.slug)||(n=e.slug,null!=J&&J.stock_status&&J.stock_status.some(e=>{let{status:t=[]}=e;return t.includes(n)}))))return null;var n;const o=c?Number(c.count):0;return{value:e.slug,name:Object(R.decodeEntities)(e.name),label:Object(r.createElement)(x.a,{name:Object(R.decodeEntities)(e.name),count:t.showCounts?o:null}),textLabel:t.showCounts?`${Object(R.decodeEntities)(e.name)} (${o})`:Object(R.decodeEntities)(e.name)}}).filter(e=>!!e);G(e),te(Q())},[t.showCounts,t.isPreview,Z,X,q,J.stock_status,K]);const ne="single"!==t.selectType,oe=Object(r.useCallback)(e=>{c||(e&&!o&&z(e),(e=>{if(!window)return;if(0===e.length){const e=Object(B.removeQueryArgs)(window.location.href,Y);return void(e!==Object(F.e)(window.location.href)&&Object(F.c)(e))}const t=Object(B.addQueryArgs)(window.location.href,{[Y]:e.join(",")});t!==Object(F.e)(window.location.href)&&Object(F.c)(t)})(e))},[c,z,o]);Object(r.useEffect)(()=>{t.showFilterButton||oe(q)},[t.showFilterButton,q,oe]);const re=Object(r.useMemo)(()=>$,[$]),se=Object(j.a)(re),le=Object(w.a)(se);Object(r.useEffect)(()=>{T()(le,se)||T()(q,se)||U(se)},[q,se,le]),Object(r.useEffect)(()=>{s||(z(N),a(!0))},[z,s,a,N]);const ae=Object(r.useCallback)(e=>{const t=e=>{const t=V.find(t=>t.value===e);return t?t.name:null},c=e=>{let{filterAdded:c,filterRemoved:n}=e;const o=c?t(c):null,r=n?t(n):null;o?Object(O.speak)(Object(d.sprintf)(
/* translators: %s stock statuses (for example: 'instock'...) */
Object(d.__)("%s filter added.","woocommerce"),o)):r&&Object(O.speak)(Object(d.sprintf)(
/* translators: %s stock statuses (for example:'instock'...) */
Object(d.__)("%s filter removed.","woocommerce"),r))},n=q.includes(e);if(!ne){const t=n?[]:[e];return c(n?{filterRemoved:e}:{filterAdded:e}),void U(t)}if(n){const t=q.filter(t=>t!==e);return c({filterRemoved:e}),void U(t)}const o=[...q,e].sort();c({filterAdded:e}),U(o)},[q,ne,V]);if(!Z&&0===V.length)return n(!1),null;const ie="h"+t.headingLevel,ue=!t.isPreview&&!f.current||0===V.length,be=!t.isPreview&&Z;if(!Object(_.getSettingWithCoercion)("has_filterable_products",!1,L.a))return n(!1),null;const de=ne?!ue&&q.length<V.length:!ue&&0===q.length,pe=Object(r.createElement)(ie,{className:"wc-block-stock-filter__title"},t.heading),fe=ue?Object(r.createElement)(S.a,null,pe):pe;return n(!0),Object(r.createElement)(r.Fragment,null,!c&&t.heading&&fe,Object(r.createElement)("div",{className:u()("wc-block-stock-filter","style-"+t.displayStyle,{"is-loading":ue})},"dropdown"===t.displayStyle?Object(r.createElement)(r.Fragment,null,Object(r.createElement)(C.a,{key:ee,className:u()(ce.className,{"single-selection":!ne,"is-loading":ue}),style:{...ce.style},suggestions:V.filter(e=>!q.includes(e.value)).map(e=>e.value),disabled:ue,placeholder:Object(d.__)("Select stock status","woocommerce"),onChange:e=>{!ne&&e.length>1&&(e=e.slice(-1)),e=e.map(e=>{const t=V.find(t=>t.value===e);return t?t.value:e});const t=Object(P.difference)(e,q);if(1===t.length)return ae(t[0]);const c=Object(P.difference)(q,e);1===c.length&&ae(c[0])},value:q,displayTransform:e=>{const t=V.find(t=>t.value===e);return t?t.textLabel:e},saveTransform:D,messages:{added:Object(d.__)("Stock filter added.","woocommerce"),removed:Object(d.__)("Stock filter removed.","woocommerce"),remove:Object(d.__)("Remove stock filter.","woocommerce"),__experimentalInvalid:Object(d.__)("Invalid stock filter.","woocommerce")}}),de&&Object(r.createElement)(l.a,{icon:m.a,size:30})):Object(r.createElement)(y.a,{className:"wc-block-stock-filter-list",options:V,checked:q,onChange:ae,isLoading:ue,isDisabled:be})),Object(r.createElement)("div",{className:"wc-block-stock-filter__actions"},(q.length>0||c)&&!ue&&Object(r.createElement)(E.a,{onClick:()=>{U([]),oe([])},screenReaderLabel:Object(d.__)("Reset stock filter","woocommerce")}),t.showFilterButton&&Object(r.createElement)(v.a,{className:"wc-block-stock-filter__button",isLoading:ue,disabled:ue||be,onClick:()=>oe(q)})))},V=(c(495),c(127)),G=Object(f.withSpokenMessages)(e=>{let{clientId:t,attributes:c,setAttributes:n}=e;const{className:o,heading:s,headingLevel:l,showCounts:a,showFilterButton:i,selectType:O,displayStyle:m}=c,g=Object(b.useBlockProps)({className:u()("wc-block-stock-filter",o)});return Object(r.createElement)(r.Fragment,null,Object(r.createElement)(b.InspectorControls,{key:"inspector"},Object(r.createElement)(f.PanelBody,{title:Object(d.__)("Display Settings","woocommerce")},Object(r.createElement)(f.ToggleControl,{label:Object(d.__)("Display product count","woocommerce"),checked:a,onChange:()=>n({showCounts:!a})}),Object(r.createElement)(f.__experimentalToggleGroupControl,{label:Object(d.__)("Allow selecting multiple options?","woocommerce"),value:O||"multiple",onChange:e=>n({selectType:e}),className:"wc-block-attribute-filter__multiple-toggle"},Object(r.createElement)(f.__experimentalToggleGroupControlOption,{value:"multiple",label:Object(d.__)("Multiple","woocommerce")}),Object(r.createElement)(f.__experimentalToggleGroupControlOption,{value:"single",label:Object(d.__)("Single","woocommerce")})),Object(r.createElement)(f.__experimentalToggleGroupControl,{label:Object(d.__)("Display Style","woocommerce"),value:m,onChange:e=>n({displayStyle:e}),className:"wc-block-attribute-filter__display-toggle"},Object(r.createElement)(f.__experimentalToggleGroupControlOption,{value:"list",label:Object(d.__)("List","woocommerce")}),Object(r.createElement)(f.__experimentalToggleGroupControlOption,{value:"dropdown",label:Object(d.__)("Dropdown","woocommerce")})),Object(r.createElement)(f.ToggleControl,{label:Object(d.__)("Show 'Apply filters' button","woocommerce"),help:Object(d.__)("Products will update when the button is clicked.","woocommerce"),checked:i,onChange:e=>n({showFilterButton:e})}))),Object(r.createElement)(V.a,{clientId:t,attributes:c,setAttributes:n,filterType:"stock-filter"}),Object(r.createElement)("div",g,s&&Object(r.createElement)(p.a,{className:"wc-block-stock-filter__title",headingLevel:l,heading:s,onChange:e=>n({heading:e})}),Object(r.createElement)(f.Disabled,null,Object(r.createElement)(U,{attributes:c,isEditor:!0}))))});const K={heading:{type:"string",default:Object(d.__)("Filter by stock status","woocommerce")}};Object(s.registerBlockType)(q,{icon:{src:Object(r.createElement)(l.a,{icon:a.a,className:"wc-block-editor-components-block-icon"})},attributes:{...q.attributes,...K},edit:G,save(e){let{attributes:t}=e;const{className:c,showCounts:n,heading:s,headingLevel:l,showFilterButton:a}=t,i={"data-show-counts":n,"data-heading":s,"data-heading-level":l};return a&&(i["data-show-filter-button"]=a),Object(r.createElement)("div",o()({},b.useBlockProps.save({className:u()("is-loading",c)}),i),Object(r.createElement)("span",{"aria-hidden":!0,className:"wc-block-product-stock-filter__placeholder"}))}})},55:function(e,t){e.exports=window.wp.keycodes},56:function(e,t,c){"use strict";c.d(t,"a",(function(){return b})),c.d(t,"b",(function(){return d})),c.d(t,"c",(function(){return p}));var n=c(10),o=c(7),r=c(0),s=c(26),l=c.n(s),a=c(45),i=c(103),u=c(50);const b=e=>{const t=Object(u.a)();e=e||t;const c=Object(o.useSelect)(t=>t(n.QUERY_STATE_STORE_KEY).getValueForQueryContext(e,void 0),[e]),{setValueForQueryContext:s}=Object(o.useDispatch)(n.QUERY_STATE_STORE_KEY);return[c,Object(r.useCallback)(t=>{s(e,t)},[e,s])]},d=(e,t,c)=>{const s=Object(u.a)();c=c||s;const l=Object(o.useSelect)(o=>o(n.QUERY_STATE_STORE_KEY).getValueForQueryKey(c,e,t),[c,e]),{setQueryValue:a}=Object(o.useDispatch)(n.QUERY_STATE_STORE_KEY);return[l,Object(r.useCallback)(t=>{a(c,e,t)},[c,e,a])]},p=(e,t)=>{const c=Object(u.a)();t=t||c;const[n,o]=b(t),s=Object(a.a)(n),d=Object(a.a)(e),p=Object(i.a)(d),f=Object(r.useRef)(!1);return Object(r.useEffect)(()=>{l()(p,d)||(o(Object.assign({},s,d)),f.current=!0)},[s,d,p,o]),f.current?[n,o]:[e,o]}},67:function(e,t,c){"use strict";c.d(t,"a",(function(){return n}));const n=e=>"string"==typeof e},69:function(e,t){e.exports=window.wp.dom},7:function(e,t){e.exports=window.wp.data},8:function(e,t){e.exports=window.wp.blocks},82:function(e,t,c){"use strict";c.d(t,"a",(function(){return r}));var n=c(67),o=c(20);const r=e=>Object(n.a)(e)?JSON.parse(e)||{}:Object(o.b)(e)?e:{}},9:function(e,t){e.exports=window.lodash}});