!function(){"use strict";var e={n:function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(r,{a:r}),r},d:function(t,r){for(var c in r)e.o(r,c)&&!e.o(t,c)&&Object.defineProperty(t,c,{enumerable:!0,get:r[c]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}},t=window.ctEvents,r=e.n(t),c=window.ctFrontend;let n=!1;const o=function(e,t){e.closest(".ct-filter-widget-wrapper").id;const c=e.closest(".ct-filter-widget-wrapper").querySelector(".ct-filter-widget"),o=c.parentNode.querySelector(".ct-filter-search-results");if(o&&o.remove(),!t)return e.closest(".ct-filter-widget-wrapper").classList.remove("ct-active"),void r().trigger("blocksy:frontend:init");e.closest(".ct-filter-widget-wrapper").classList.add("ct-active");const i=function(e,t){const r=[];return t.querySelectorAll(".ct-filter-label").forEach(function(e){var t;const c=e.cloneNode(!0);null===(t=c.querySelector(".ct-filter-count"))||void 0===t||t.remove(),r.push(c.textContent.trim().toLowerCase())}),r}(0,c),l=[];c.querySelectorAll(".ct-filter-item").forEach(function(e){const r=e.querySelector("a").ariaLabel;if(!r)return;const c=r.trim().toLowerCase();if(i.includes(c)&&c.includes(t)){var n,o;const t=e.cloneNode(!0);null===(n=t.querySelector(".ct-expandable-trigger"))||void 0===n||n.remove(),null===(o=t.querySelector(".ct-filter-children"))||void 0===o||o.remove(),l.push(t)}});const s=c.cloneNode(!0);s.classList.add("ct-filter-search-results"),s.innerHTML="",0===l.length?s.innerHTML=`<li class="ct-filter-item ct-no-results">${ct_localizations.search_live_no_results}</li>`:l.forEach(function(e){s.appendChild(e)}),c.parentNode.insertBefore(s,c.nextSibling),n||(e.closest(".ct-filter-search").querySelector(".ct-filter-search-icon").addEventListener("click",function(t){e.closest(".ct-filter-search").classList.remove("ct-active"),e.value="",r().trigger("blocksy:filters:search",{el:e,value:""}),r().trigger("blocksy:frontend:init")}),n=!0),r().trigger("blocksy:frontend:init")};(0,c.registerDynamicChunk)("blocksy_ext_woo_extra_filters_search",{mount:function(e,{event:t}){o(e,t.target.value.trim().toLowerCase())}}),r().on("blocksy:filters:search",function({el:e,value:t}){t&&(n=!1),o(e,t)})}();