import*as e from"@wordpress/interactivity";var t={d:(e,r)=>{for(var s in r)t.o(r,s)&&!t.o(e,s)&&Object.defineProperty(e,s,{enumerable:!0,get:r[s]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};const r=(a={getContext:()=>e.getContext,getElement:()=>e.getElement,store:()=>e.store},l={},t.d(l,a),l),{state:s,actions:o}=(0,r.store)("woocommerce/product-filter-status",{state:{get selectedFilters(){return((0,r.store)("woocommerce/product-filters").state.activeFilters||[]).filter((e=>"status"===e.type)).map((e=>e.value)).filter(Boolean)},get hasSelectedFilters(){return s.selectedFilters.length>0},get isItemSelected(){const{attributes:e}=(0,r.getElement)();return!!e.value&&s.selectedFilters.includes(e.value)}},actions:{getActiveLabel(e){const{activeLabelTemplate:t}=(0,r.getContext)();return t.replace("{{label}}",e)},toggleFilter:()=>{const{attributes:e}=(0,r.getElement)();let t=e["data-filter-item"];"string"==typeof t&&(t=JSON.parse(t));const{ariaLabel:a,value:l}=t;if(!l||!a)return;const i=(0,r.store)("woocommerce/product-filters");s.selectedFilters.includes(l)?i.actions.removeActiveFilter("status",l):i.actions.setActiveFilter({type:"status",value:l,label:o.getActiveLabel(a)}),i.actions.navigate()},clearFilters:()=>{const e=(0,r.store)("woocommerce/product-filters");e.actions.removeActiveFiltersByType("status"),e.actions.navigate()}}});var a,l;