import*as e from"@wordpress/interactivity";var t={d:(e,r)=>{for(var o in r)t.o(r,o)&&!t.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:r[o]})},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:o,actions:i}=(0,r.store)("woocommerce/product-filter-rating",{state:{get selectedFilters(){return((0,r.store)("woocommerce/product-filters").state.activeFilters||[]).filter((e=>"rating"===e.type)).map((e=>e.value)).filter(Boolean)},get hasSelectedFilters(){return o.selectedFilters.length>0},get isItemSelected(){const{attributes:e}=(0,r.getElement)();return!!e.value&&o.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 s=(0,r.store)("woocommerce/product-filters");o.selectedFilters.includes(l)?s.actions.removeActiveFilter("rating",l):s.actions.setActiveFilter({type:"rating",value:l,label:i.getActiveLabel(a)}),s.actions.navigate()},clearFilters:()=>{const e=(0,r.store)("woocommerce/product-filters");e.actions.removeActiveFiltersByType("rating"),e.actions.navigate()}}});var a,l;