function e(){var e=document.querySelector(".notifal-onpage-preview-banner");if(e){var n=document.getElementById("notifal-onpage-preview-url"),t=document.getElementById("notifal-onpage-preview-url-btn"),i=document.getElementById("notifal-onpage-preview-url-error"),r=e.querySelectorAll(".notifal-onpage-preview-banner-device"),o=window.notifalOnPagePreviewConfig||{},a=o.notificationId,l=o.nonce,d=o.homeUrl||"";if(a&&l){n&&t&&(t.addEventListener("click",function(){f();var e=(n.value||"").trim();if(e){var t=function(e,n){var t=(e||"").trim();if(!t)return null;if(-1!==t.indexOf("://"))try{return new URL(t).href}catch(r){return null}var i=n?n.replace(/\/$/,""):"";return i?i+(0===t.indexOf("/")?t:"/"+t):null}(e,d);if(t){var i=function(e,n,t){var i=-1!==e.indexOf("?")?"&":"?";return e+i+"notifal_onpage_preview="+encodeURIComponent(n)+"&_wpnonce="+encodeURIComponent(t)}(t,a,l);window.location.href=i}else{v(o.strings&&o.strings.preview_url_invalid||"Please enter a valid path or URL.")}}else{v(o.strings&&o.strings.preview_url_required||"Please enter a path or URL.")}}),n.addEventListener("input",f),n.addEventListener("keydown",function(e){"Enter"===e.key&&(e.preventDefault(),t.click())}));var c={desktop:null,tablet:{width:768,height:1024},mobile:{width:375,height:667}};r.length&&r.forEach(function(e){e.addEventListener("click",function(){var n=e.getAttribute("data-viewport");if(n){r.forEach(function(e){e.classList.remove("notifal-onpage-preview-banner-device--active")}),e.classList.add("notifal-onpage-preview-banner-device--active");var t=c[n];if(t){var i="width="+t.width+",height="+t.height+",scrollbars=yes,resizable=yes,location=yes";window.open(window.location.href,"notifal_preview_"+n,i)}}})})}}function v(e){i&&(i.textContent=e,i.hidden=!1)}function f(){i&&(i.textContent="",i.hidden=!0)}}"loading"===document.readyState?document.addEventListener("DOMContentLoaded",e):e();
