void 0!==jQuery&&function(a){window.EngageBox&&EngageBox.onReady(function(){var e=a(".eb-inst");if(0!=e.length){var o=["beforeOpen","beforeClose","afterOpen","afterClose"];EngageBox.getInstances().forEach(function(t){$box=a(t.el),t.el.box.setAttribute("id","rstbox_"+t.id),t.el.box.classList.add("rstbox"),t.el.classList.add("rstbox"),t.el.querySelector(".eb-container").classList.add("rstbox-container"),t.el.querySelector(".eb-content").classList.add("rstbox-content"),t.el.querySelector(".eb-close")&&t.el.querySelector(".eb-close").classList.add("rstbox-close"),t.el.querySelector(".eb-header")&&t.el.querySelector(".eb-header").classList.add("rstbox-header"),t.on("open",function(){document.querySelector("body").classList.add("rstboxes")}).on("close",function(){document.querySelector("body").classList.remove("rstboxes")}),o.forEach(function(e){t.on(e,function(){$box.trigger(e),a(document).trigger("ebox"+function(e){return"string"!=typeof e?"":e.charAt(0).toUpperCase()+e.slice(1)}(e),[t.id,$box])})})}),a(document).trigger("eboxInit",[e]);var t=a._data(e[0],"events");t&&Object.keys(t).forEach(function(e){o.includes(e)&&console.warn("EngageBox:","Attaching jQuery events is deprecated and it will be no longer possible in EngageBox v5. Use EngageBox.getInstance(ID).on(EVENT, CALLBACK) instead. To read more details about the new Javascript API, visit: https://www.tassos.gr/joomla-extensions/engagebox/docs/using-javascript-api",t[e])}),e.on("open close toggle closeKeep setCookie",function(e,t,o){var a=e.target.classList.contains("eb-dialog")?e.target.closest(".eb-inst").dataset.id:e.target.dataset.id,s=EngageBox.getInstance(a),n="The trigger() method is deprecated and it will be removed in EngageBox v5.0. ";"open"==e.type&&(s.open(),n+="To open a box, use EngageBox.getInstance(ID).open() instead."),"close"!=e.type&&"closeKeep"!=e.type||(s.close(),n+="To close a box, use EngageBox.getInstance(ID).close() instead."),"toggle"==e.type&&(s.toggle(),n+="To toggle the visibility of a box, use EngageBox.getInstance(ID).toggle() instead."),"setCookie"==e.type&&(function(e,t,o){var a="";if("session"!=t){var s,n=new Date,r=n.getTime();switch(t){case"days":s=24*o*60*60;break;case"hours":s=60*o*60;break;case"minutes":s=60*o;break;case"seconds":s=o;break;case"ever":s=31536e4;break;case"remove":s=-1}n.setTime(r+1e3*s),a="; expires="+n.toGMTString()}document.cookie="engagebox_"+e+"=true"+a+"; path=/"}(a,t,o),n+="To set a cookie, use document.cookie instead."),console.warn("EngageBox:",n,e)}),document.addEventListener("click",function(e){var t=e.target;if(t.hasAttribute("data-rstbox")||t.hasAttribute("data-rstbox-cmd")||t.hasAttribute("data-rstbox-command")){var o=t.dataset.rstbox?t.dataset.rstbox:t.closest(".eb-inst").dataset.id;if(o){var a=EngageBox.getInstance(o);if(a){var s=t.getAttribute("data-rstbox-cmd");switch(s){case"open":a.open();break;case"close":a.close();break;case"closeKeep":case"hide":console.warn('The "'+s+'" command is deprecated. Please, use "close" command instead.'),a.close();break;default:a.toggle()}"0"!=t.getAttribute("data-rstbox-prevent")&&(console.warn("EngageBox:",'The "rstbox" HTML data attributes are deprecated and they will be removed in EngageBox v5.0. Please update your code to use "ebox" data attributes. ',e),e.preventDefault())}else console.warn('EngageBox with ID "#'+o+'" not found on the page. Make sure it is published.')}}})}})}(jQuery);
