((i,e)=>{"use strict";const s=[];let t=null;class h{constructor(i,e){this.element=i;const s={panel:"#mobile-menu",close:"",side:"right",hasOverlay:!0,beforeShow:null,afterShow:null,beforeHide:null,afterHide:null},t={"#":"",".":""," ":"-"};!e.panel&&i.hasAttribute("href")&&(e.panel=i.getAttribute("href"),e.panel&&"#"!==e.panel||(e.panel=s.panel)),this.settings={...s,...e},this.panelVisible=!1,this.panelCleanName=this.settings.panel.replace(/#|\.|\s/g,(i=>t[i])),this.init()}init(){null===t&&!0===this.settings.hasOverlay&&(t=e.createElement("div"),t.className="body-overlay",t.tfOn(i.click,(()=>{for(let i=s.length-1;i>-1;--i)s[i].hidePanel()}),{passive:!0}),e.body.appendChild(t)),this.element.tfOn("click",(i=>{i.preventDefault(),this.panelVisible?this.hidePanel():(this.showPanel(),i.screenX&&i.screenY||e.querySelector(this.settings.panel+" a")?.focus())})),""!==this.settings.close&&e.querySelector(this.settings.close)?.tfOn("click",(i=>{i.preventDefault(),this.hidePanel()}))}showPanel(){if(!1===this.panelVisible){i.trigger("tf_fixed_header_remove_revelaing");const s=this.settings.panel,h=e.querySelector(s);h.style.display="block",setTimeout((()=>{this.settings.beforeShow?.call(this),!1===this.panelVisible&&(null!==h&&(h.tfOn("transitionend",(()=>{this.settings.afterShow?.call(this),i.trigger("sidemenushow",[s,this.settings.side,this])}),{passive:!0,once:!0}).classList.remove("sidemenu-off"),h.classList.add("sidemenu-on")),e.body.classList.add(this.panelCleanName+"-visible","sidemenu-"+this.settings.side),t?.classList.add("body-overlay-on"),this.panelVisible=!0)}),5)}}hidePanel(s){if(!0===this.panelVisible){this.settings.beforeHide?.call(this);const h=e.querySelector(this.settings.panel);null!==h&&(h.tfOn("transitionend",(function(){this.style.display=""}),{passive:!0,once:!0}).classList.remove("sidemenu-on"),h.classList.add("sidemenu-off")),e.body.classList.remove(this.panelCleanName+"-visible"),s!==this.settings.side&&e.body.classList.remove("sidemenu-"+this.settings.side),this.settings.afterHide?.call(this),i.trigger("sidemenuhide.themify",[this.settings.panel]),t?.classList.remove("body-overlay-on"),this.panelVisible=!1}}}i.on("tf_sidemenu_init",((i,e)=>{void 0===i.length&&(i=[i]);for(let t=i.length-1;t>-1;--t)s.push(new h(i[t],e))})).on("tf_side_menu_hide_all",(()=>{for(let i=s.length-1;i>-1;--i)s[i].hidePanel()})),e.body.classList.add("sidemenu-active"),"undefined"!=typeof themify_vars&&i.on("tfsmartresize",(e=>{e?.w>themify_vars.menu_point&&i.trigger("tf_side_menu_hide_all")}))})(Themify,document);