import*as e from"@wordpress/interactivity";var t={438:e=>{e.exports=import("@wordpress/interactivity-router")}},r={};function o(e){var a=r[e];if(void 0!==a)return a.exports;var i=r[e]={exports:{}};return t[e](i,i.exports,o),i.exports}o.d=(e,t)=>{for(var r in t)o.o(t,r)&&!o.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);const a=(m={getConfig:()=>e.getConfig,getContext:()=>e.getContext,getServerContext:()=>e.getServerContext,store:()=>e.store},v={},o.d(v,m),v),i=e=>{if("string"!=typeof e)return"";const t=document.implementation.createHTMLDocument("");return t.body.innerHTML=e,t.body.textContent||""},{getContext:n,store:c,getServerContext:s,getConfig:l}=a,p="woocommerce/product-filters";var m,v;const u={state:{get params(){const{activeFilters:e}=n(),t={};function r(e,r){if(e in t&&t[e].length>0)return t[e]=`${t[e]},${r}`;t[e]=r}const o=l(p),a=o?.taxonomyParamsMap||{};return e.forEach((e=>{const{type:o,value:i}=e;if(i){if("price"===o){const[e,r]=i.split("|");e&&(t.min_price=e),r&&(t.max_price=r)}if("status"===o&&r("filter_stock_status",i),"rating"===o&&r("rating_filter",i),o.includes("attribute")){const[,a]=o.split("/");r(`filter_${a}`,i),t[`query_type_${a}`]=e.attributeQueryType||"or"}if(o.includes("taxonomy")){const[,e]=o.split("/");r(a[e],i)}}})),t},get activeFilters(){const{activeFilters:e}=n();return e.filter((e=>!!e.value)).sort(((e,t)=>e.activeLabel.toLowerCase().localeCompare(t.activeLabel.toLowerCase()))).map((e=>({...e,activeLabel:i(e.activeLabel),uid:`${e.type}/${e.value}`})))},get isFilterSelected(){const{activeFilters:e,item:t}=n();return e.some((e=>e.type===t.type&&e.value===t.value))}},actions:{openOverlay:()=>{if(n().isOverlayOpened=!0,document.getElementById("wpadminbar")){const e=(document.documentElement||document.body.parentNode||document.body).scrollTop;document.body.style.setProperty("--adminbar-mobile-padding",`max(calc(var(--wp-admin--admin-bar--height) - ${e}px), 0px)`)}},closeOverlay:()=>{n().isOverlayOpened=!1},closeOverlayOnEscape:e=>{n().isOverlayOpened&&"Escape"===e.key&&y.closeOverlay()},removeActiveFiltersBy:e=>{const t=n();t.activeFilters=t.activeFilters.filter((t=>!e(t)))},toggleFilter:()=>{d.isFilterSelected?function(){const{item:e}=n();y.removeActiveFiltersBy((t=>t.type===e.type&&t.value===e.value))}():function(){const e=n(),t={value:e.item.value,type:e.item.type,attributeQueryType:e.item.attributeQueryType,activeLabel:e.activeLabelTemplate.replace("{{label}}",e.item?.ariaLabel||e.item.label)},r=e.activeFilters.filter((e=>!(e.value===t.value&&e.type===t.type)));r.push(t),e.activeFilters=r}(),y.navigate()},*navigate(){const e=s?s():n(),t=l(p).canonicalUrl,r=new URL(t),{searchParams:a}=r;for(const t in e.params)a.delete(t);for(const e in d.params){const t=d.params[e];let r=t;try{r=decodeURIComponent(t)}catch(t){t instanceof URIError&&console.warn("woocommerce/product-filters: Failed to decode filter parameter",e,t)}a.set(e,r)}if(window.location.href===r.href)return;const i=yield Promise.resolve().then(o.bind(o,438));yield i.actions.navigate(r.href)}},callbacks:{scrollLimit:()=>{const{isOverlayOpened:e}=n();document.body.style.overflow=e?"hidden":"auto"}}},{state:d,actions:y}=c(p,u);