!function(){"use strict";var e={css_class:{"filters-sidebar":"--filter-panel-active","shop-sidebar":"","filters-top-sidebar":""},selectors:{"filters-sidebar":"#js-filterPanel","shop-sidebar":".rey-filterSidebar.shop-sidebar.--supports-mobile","filters-top-sidebar":".rey-filterSidebar.filters-top-sidebar.--supports-mobile"},btn:null,panel:null,closeBtn:!0,init:function(){if(this.getTrigger()){this.createHeader();var t={name:"filter-panel",trigger:this.btn,panel:this.panel,closeBtn:".rey-filterPanel__header",animateSite:"mobile-sidebar"!==this.panelType,onOpen:()=>{var e=this.panel.querySelector(".rey-filterPanel-content");e&&"undefined"!=typeof SimpleScrollbar&&SimpleScrollbar.initEl(e)}};this.css_class[this.target]&&(t.extraBodyClass=this.css_class[this.target]);var r=rey.components.sidePanel(t),i=function(){e.getTrigger(),r.update((function(){this.panel=e.panel,this.trigger=e.btn}))};rey.hooks.addAction("ajaxfilters/finished",i),document.addEventListener("rey/filterpanel/update",i)}},getTrigger:function(){const e=Array.from(document.querySelectorAll(".js-rey-filterBtn-open")).filter((e=>!e.closest(".rey-mainNavigation")));if(e.length){this.btn=e[0];var t=this.btn.closest("[data-target]");if(this.target=t?t.getAttribute("data-target"):"filters-sidebar",this.getPanelType())return this.panel=document.querySelector(this.selectors[this.target]),!0}},getPanelType:function(){return"filters-sidebar"===this.target?(this.panelType="filters-sidebar",!0):rey.vars.is_desktop?void 0:(this.panelType="mobile-sidebar",!0)},createHeader:function(){if("mobile-sidebar"===this.panelType){var e=document.createElement("div");if(e.classList.add("rey-filterPanel__header"),this.panel)if((this.panel.querySelector(".rey-sidebarInner")||this.panel.querySelector(".rey-topSidebarInner")||this.panel.querySelector(".rey-ecommSidebar ")).prepend(e),"undefined"!=typeof reyajaxfilter_params&&reyajaxfilter_params.reset_filters_text&&reyajaxfilter_params.reset_filters_link){var t=document.createElement("button");t.classList.add("rey-filterPanel__reset","btn","btn-line-active","js-rey-filter-reset"),t.setAttribute("data-location",reyajaxfilter_params.reset_filters_link),t.setAttribute("aria-label",reyajaxfilter_params.reset_filters_text),t.textContent=reyajaxfilter_params.reset_filters_text,e.prepend(t)}}}};document.addEventListener("rey-DOMContentLoaded",(function(t){e.init()}))}();