!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.dist=e():t.dist=e()}(self,(function(){return function(t){"use strict";t.stpdInterscroller=function(e){var i={container:"x",height:0,width:null,showTitle:!1,titleText:"Advertisement",titleBackground:"#1AB6C5",titleColor:"#FFFFFF",overrideParentWidth:0};if(e.setConfig=function(t){for(var e in t){if(void 0===i[e])throw new Error("stpdInterscroller config key '"+e+"' not found");i[e]=t[e]}return i},e.run=function(){var e=i.height,n=i.width;n=n?n>document.documentElement.clientWidth?"100%":i.width+"px":"100%";var r=String(i.container),o=top.document.querySelector(r);t.addEventListener("stpdRendered",(function(t){var e=t.detail.name,n=t.detail.winner,o=top.document.querySelector(r+" > div"),l=e.split("/")[2],s=(i.container.split('"')[1],String(o.id).split("/",2).join("/").length),d=String(o.id).split("_",7).join("_").length;l==String(o.id).slice(s+1,d)&&"passback"!=n&&(p(),a(),u(),h())}));var l=document.createElement("div"),s=document.createElement("div"),d=document.createElement("div"),c=document.createElement("div");s.setAttribute("class","stpd-interscroller-in"),d.setAttribute("class","stpd-interscroller-in-wrapper"),c.setAttribute("class","stpd-interscroller-wrapper"),l.setAttribute("class","stpd-interscroller"),o.parentNode.insertBefore(s,o),s.parentNode.insertBefore(d,s),d.parentNode.insertBefore(c,d),c.parentNode.insertBefore(l,c),s.appendChild(o),d.appendChild(s),c.appendChild(d),l.appendChild(c);var a=function(){if(!top.document.querySelector(".stpd-interscroller-title")&&i.showTitle&&o.clientHeight>0){var t=document.createElement("div"),e=document.createElement("div");t.setAttribute("class","stpd-interscroller-title"),e.setAttribute("class","stpd-interscroller-title"),t.innerHTML=e.innerHTML=String(i.titleText),l.prepend(t),l.append(e),top.document.querySelectorAll(".stpd-interscroller-title").forEach((function(t){t.style.cssText+="background: "+i.titleBackground+"; color: "+i.titleColor+"; width: "+n+"; margin: auto; position: relative; font-size: 12px; text-align: center; height: 18px;"}))}},p=function(){o.clientHeight>0&&(l.style.cssText+="position: relative; padding: 0; overflow: hidden;",c.style.cssText+="position: relative; width: "+n+"; height: "+e+"px; margin: auto;",d.style.cssText+="position: absolute; width: "+n+"; height: "+e+"px; clip: rect(auto, auto, auto, auto);",s.style.cssText+="position: fixed; max-width: 100%; top: 0;")},u=function(){if(i.overrideParentWidth){var e=l.getBoundingClientRect().left,n=l.getBoundingClientRect().right-t.innerWidth;l.style.cssText+="margin-left: -"+e+"px; margin-right: "+n+"px;"}},h=function(){var i=(c.clientWidth-s.clientWidth)/2;s.style.cssText+="margin-left: "+i+"px;",s.style.height=o.clientHeight+"px";var n=t.outerHeight,r=c.clientHeight,l=c.getBoundingClientRect().top,d=o.clientHeight;if(o.clientHeightn)s.style.bottom="0",s.style.top="unset";else if(l<0)s.style.top="0",s.style.bottom="unset";else{var a=l/((n-r)/(n-d));s.style.cssText+="top: "+a+"px;"}else s.style.top="0",s.style.bottom="unset"};t.addEventListener("load",(function(){a(),p(),u()})),t.addEventListener("resize",(function(){a(),p(),u()})),t.addEventListener("load",h),t.addEventListener("scroll",h),t.addEventListener("resize",h)},e.que.length>0)for(;e.que.length>0;)try{e.que.shift()()}catch(t){throw new Error(t)}return e.que.push=function(t){t()},e}(t.stpdInterscroller||{que:[]})}(window),{}}));