(()=>{(function(o,c){let m=function(t){return t==="true"||t===1},e={instanceId:null,zone:"84",refreshInterval:parseInt("0"),site:"19",host:"https://d2.ads.rmbl.ws",sizing:{width:parseInt("300"),height:parseInt("250"),aspectRatio:null,minWidth:0,minHeight:0,minScalePercent:.35,activeWidth:parseInt("300"),activeHeight:parseInt("250"),maxShownWidth:0,forceFullHeight:m("false")},pub:"22994",type:"3",loaded:!1,lazy:"true",correlator:"3AiifbED0DaVJinQjqa2Y4zaqQ1",parent:!1,script:null,scriptSrc:"id",adContainer:null,adContainerId:null,doubleVerify:{enabled:m("false"),src:""},omidVerification:{enabled:m("false"),scripts:JSON.parse("[]")},control:{src:""},frame:{el:null,injected:!1,loaded:!1,count:0},log:!1,params:{},extra:[function(){let t="";return t.length>0?"keywords="+t:""},function(){let t=r.searchParam("rac_caid");if(t===null||t.length===0)return"";let n=r.searchParam("rac_crid"),i="";return i+="rac_caid="+t,n!==null&&n.length>0&&(i+="&rac_crid="+n),i}]},y={promises:[],add(t){this.promises.push(t)},async wait(){try{return await Promise.allSettled(this.promises)}catch(t){}}},r={log:function(){e.log&&console.log("[Zone "+e.zone+": "+e.instanceId+"] ",...arguments)},isParent:function(){try{return o.self!==o.top}catch(t){return!0}},get:function(t){for(var n=!1,i=[function(){return localStorage[t]},function(){return sessionStorage[t]},function(){var a,l,u,d=c.cookie.split(";");for(a=0;a<d.length;a++)if(l=d[a].substr(0,d[a].indexOf("=")),u=d[a].substr(d[a].indexOf("=")+1),l=l.replace(/^\s+|\s+$/g,""),l===t)return decodeURI(u)}],s=0;s<i.length;s++)if(n=this.safe(i[s]),!r.undef(n)&&n!==!1)return n;return""},set:function(t,n){var i=[function(){localStorage[t]=n},function(){sessionStorage[t]=n},function(){var s=new Date,a=encodeURI(n)+"; expires="+s.setSeconds(s.getSeconds()+10*365*24*60*60).toUTCString();c.cookie=t+"="+a}];i.forEach(function(s){r.safe(s)})},safe:function(t){try{return t()}catch(n){return e.log&&console.warn(n),!1}},attr:function(t){var n=e.script.getAttribute(t);return n===null?"":encodeURIComponent(n)},style:function(t,n){return c.defaultView.getComputedStyle(t,null)[n]},searchParam:function(t){let n=window.location.search;return n.length===0?null:new URLSearchParams(n).get(t)},url:function(t){try{let n=(e.parent?c.referrer:c.location.href).substring(0,255);return t?encodeURIComponent(n):n}catch(n){return""}},title:function(){if(e.parent)return this.url(!1).replace(/[^a-z0-9]/gmi," ").replace(/(https?|www)/gmi," ").replace(/\s+/g," ").substring(0,255);let t=c.getElementsByTagName("title")[0];return(r.undef(t)?"":t.innerText).substring(0,255)},undef:function(t){return typeof t>"u"},objToHttpArr:function(t){if(typeof t!="object")return[];var n=[];for(var i in t){var s=t[i];Array.isArray(s)&&(s=s.join(",")),n.push(i+"="+encodeURIComponent(s))}return n},visible:function(t,n,i,s,a,l,u){var d=t.parentNode,v=2;return t===c.body||c.body.contains(t)?d.nodeType===9||d.nodeName==="HTML"?!0:t.nodeName!=="SCRIPT"&&(this.style(t,"opacity")==="0"||this.style(t,"display")==="none"||this.style(t,"visibility")==="hidden")?!1:((this.undef(n)||this.undef(a)||this.undef(s)||this.undef(i)||this.undef(l)||this.undef(u))&&(n=t.offsetTop,i=t.offsetLeft,s=n+t.offsetHeight,a=i+t.offsetWidth,l=t.offsetWidth,u=t.offsetHeight),d?t.offsetParent===d&&(this.style(d,"overflow")==="hidden"||this.style(d,"overflow")==="scroll")&&(i+v>d.offsetWidth+d.scrollLeft||i+l<d.scrollLeft||n+v>d.offsetHeight+d.scrollTop||n+u<d.scrollTop)?!1:(t.offsetParent===d&&(i+=d.offsetLeft,n+=d.offsetTop),this.visible(d,n,i,s,a,l,u)):!0):!1},isInViewport:function(t,n=1){let i=t.getBoundingClientRect(),s=o.innerHeight||c.documentElement.clientHeight,a=i.top;a>=0&&(a=0);let l=Math.floor(100-a/-i.height*100),u=Math.floor(100-(i.bottom-s)/i.height*100);return!(l<n||u<n)},visiblePercent:function(t){let n=t.getBoundingClientRect(),i=o.innerHeight||c.documentElement.clientHeight,s=o.innerWidth,a=Math.max(0,Math.min(n.bottom,i)-Math.max(n.top,0)),l=Math.max(0,Math.min(n.right,s)-Math.max(n.left,0)),u=n.width*n.height;return a*l/u*100},elementsVisibleSize(t,n,i){typeof n>"u"&&(n=Number.MAX_SAFE_INTEGER),typeof i>"u"&&(i=Number.MAX_SAFE_INTEGER);let s=t.parentNode,a=t.getBoundingClientRect(),l=Math.floor(a.width),u=Math.floor(a.height);return!isNaN(l)&&l>0&&(n=Math.min(n,l)),!isNaN(u)&&u>0&&(i=Math.min(i,u)),s!==null&&s.nodeType!==9&&s.nodeName!=="HTML"?r.elementsVisibleSize(s,n,i):[n,i]},canUseIntersectionObserver:function(){return"IntersectionObserver"in window&&"IntersectionObserverEntry"in window&&"intersectionRatio"in window.IntersectionObserverEntry.prototype},canUseResizeObserver:function(){return"ResizeObserver"in window},getFirstApplicableScriptById:function(){let t=c.querySelectorAll("script#nrp-"+e.zone+":not([data-rac-instance-id])");return t.length===0?null:t[0]},purgeScripts:function(){c.querySelectorAll('script[data-rac-instance-id="'+e.instanceId+'"]').forEach(function(n){r.safe(function(){n.remove()})})},getFirstAvailableInstanceId:function(){let t=Math.floor(Math.random()*9999999);return c.querySelectorAll('script[data-rac-instance-id="'+t+'"]').length>0?r.getFirstAvailableInstanceId():t},greatestCommonDivisor:function(t,n){return n===0?t:this.greatestCommonDivisor(n,t%n)},aspectRatio:function(t,n){let i=this.greatestCommonDivisor(t,n);return{widthRatio:t/i,heightRatio:n/i,ratio:t/i/(n/i),toString:function(){return this.widthRatio+":"+this.heightRatio}}},round(t,n){return Math.round(t*Math.pow(10,n))/Math.pow(10,n)},debounce:function(t,n){let i;return function(...s){let a=this;clearTimeout(i),i=setTimeout(function(){t.apply(a,s)},n)}},injectScript(t,n){if(!t||(o[n]=o[n]||!1,o[n]||c.querySelector('script[src="'.concat(t,'"]'))))return!1;o[n]=!0;let i=c.createElement("script");return i.src=t,i.async=!0,c.head.appendChild(i),!0}},z={booted:!1,inject(t){r.injectScript(t,"_raControlInjectRun")||r.log("control: already injected"),r.log("control: injected")},init(){var i;if(!e.omidVerification.enabled||((i=e.control.src)==null?void 0:i.length)===0)return;r.log("control: init"),this.inject(e.control.src);let t=500,n=Date.now();y.add(new Promise(function(s){let a=function(){var l;if((l=o==null?void 0:o.rads)!=null&&l.control)o.rads.control.init(),o.rads.control.onReady(function(){r.log("control: ready"),s()});else{if(Date.now()-n>t){r.log("control: load timed out"),s();return}setTimeout(a,10)}};a()})),this.booted=!0},hasBooted(){return this.booted}},g={booted:!1,init:function(){var t;!e.doubleVerify.enabled||((t=e.doubleVerify.src)==null?void 0:t.length)===0||(g.inject(e.doubleVerify.src)&&(o.onDvtagReady=function(n,i=750){o.dvtag=window.dvtag||{},dvtag.cmd=dvtag.cmd||[];let s={callback:n,timeout:i,timestamp:new Date().getTime()};dvtag.cmd.push(function(){dvtag.queueAdRequest(s)}),setTimeout(function(){let a=s.callback;s.callback=null,a&&a()},i)},o.defineDvtagSlot=o.defineDvtagSlot||function(n,i){o.dvtag=o.dvtag||{},dvtag.cmd=dvtag.cmd||[],dvtag.cmd.push(()=>dvtag.defineSlot(n,i))},o.getDvtagTargeting=o.getDvtagTargeting||function(n){return o.dvtag=o.dvtag||{},dvtag.getTargeting?dvtag.getTargeting(n):{}}),y.add(new Promise(function(n){o.onDvtagReady(function(){r.log("dv: tag ready"),n()})})),e.extra.push(function(){let n="",i=g.getTargeting(e.adContainerId);return Object.keys(i).forEach(function(s){i[s].length!==0&&(n!==""&&(n+="&"),n+="".concat(s,"=")+encodeURIComponent(i[s].join(",")))}),n}),this.booted=!0)},hasBooted(){return this.booted},inject(t){return r.injectScript(t,"_raDvInjectRun")?(r.log("dv: injected"),!0):(r.log("dv: already injected"),!1)},defineAdSlot(t,n,i){!this.hasBooted()||!o.defineDvtagSlot||o.defineDvtagSlot(n,{id:t,sizes:i})},getTargeting(t){if(!o.getDvtagTargeting)return{};let n=o.getDvtagTargeting(t),i={};return Object.keys(n).forEach(function(s){i["dv_".concat(s.toLowerCase())]=n[s]}),i}},b={session:null,client:null,unloadRegistered:!1,hasSession(){return this.session&&this.client},createSession(){var t,n;return!e.omidVerification.enabled||!((t=o.rads)!=null&&t.control)||!((n=o.rads.control)!=null&&n.omid)?null:(this.client=o.rads.control.omid,this.session=this.client.create({partnerName:"rumble",partnerVersion:"1.0.0",slotElement:e.adContainer,verificationScripts:e.omidVerification.scripts,url:r.url(!1)}),this.session&&r.log("omid: session created, id:",this.session.id),this.session)},impression(){this.hasSession()&&(this.client.impression(this.session),r.log("omid: impression signaled"))},finish(){this.hasSession()&&(this.client.finish(this.session),this.session=null,r.log("omid: session finished"))},registerUnloadHandler(){if(this.unloadRegistered)return;this.unloadRegistered=!0;let t=this;o.addEventListener("pagehide",function(){t.finish()},{capture:!0})}},f={isVisible:function(){return e.adContainer.offsetParent!==null},maxPossibleWidth:function(t){if(!t.parentElement)return t.clientWidth;let n=t.parentElement,i=n.style.position;if(n.style.width!==""||n.style.maxWidth!=="")return n.clientWidth;getComputedStyle(n).position==="static"&&(n.style.position="relative");let s="rac-ad-cs-"+e.instanceId,a=c.getElementById(s);return a||(a=c.createElement("div"),a.style.width="100%",a.style.position="absolute",a.style.visibility="hidden",a.style.height="0",a.style.margin="0",a.style.border="none",a.style.padding="0",a.style.overflow="hidden",a.style.pointerEvents="none",a.id=s,n.appendChild(a)),n.style.position=i,a.clientWidth},onResize:function(){let t=e.adContainer,n=t.offsetParent;if(t){if(f._resizeTimer&&clearTimeout(f._resizeTimer),!f.isVisible()){f._resizeTimer=setTimeout(function(){f.onResize()},150);return}n&&r.canUseResizeObserver()?new ResizeObserver(s=>{f.resizeToFitParent()}).observe(n):window.addEventListener("resize",function(){f.resizeToFitParent()})}},resizeToFitParent:r.debounce(function(){let t=e.adContainer;if(!t||!t.parentElement)return;let i=e.sizing.aspectRatio.ratio,s=f.maxPossibleWidth(t),a=s/i;(!s||s===0)&&(s=e.sizing.width,a=e.sizing.height),s=r.round(Math.min(Math.max(s,e.sizing.minWidth),e.sizing.width),4),e.sizing.forceFullHeight?a=e.sizing.height:a=r.round(Math.min(Math.max(a,e.sizing.minHeight),e.sizing.height),4),f.resize(s,a),p.resize(s,a),e.sizing.activeWidth=s,e.sizing.activeHeight=a,e.sizing.maxShownWidth=Math.max(e.sizing.maxShownWidth,s)},150),resize(t,n){e.adContainer.style.position="relative",e.adContainer.style.width=t+"px",e.adContainer.style.height=n+"px"}},p={syncTimer:null,lastLoad:null,contentWindow:function(){return e.frame.el?e.frame.el.contentWindow:null},send(t){return this.contentWindow().postMessage(t,"*")},recv(){this.sync()},sync(){let t=this;this.syncTimer!==null&&clearInterval(this.syncTimer);let n=function(){if(t.contentWindow()===null){clearInterval(t.syncTimer);return}let i=t.inViewPercent();t.send({type:"sync",data:{inViewPercent:i}}),t.canBeRefreshed()&&(r.log("refreshing iframe source after ".concat(e.refreshInterval," seconds")),t.setSrc(h.src()))};n(),this.syncTimer=setInterval(n,750)},canBeRefreshed(){let t=this.lastLoad!==null&&Date.now()/1e3-this.lastLoad>=e.refreshInterval;return e.frame.loaded&&c.hasFocus()&&e.refreshInterval>0&&this.inViewPercent()>25&&t},inViewPercent(){return e.frame.injected?r.visiblePercent(e.adContainer):e.lazy&&r.isInViewport(e.adContainer)?1:0},setLoaded(){this.lastLoad=Date.now()/1e3},setSrc(t){if(!e.frame.el)return;let n=this;r.safe(function(){e.frame.el.src=t,n.setLoaded(),e.frame.count++})},resize(t,n){e.frame.el&&e.frame.el.style.width!=="100%"&&(t!==e.sizing.width||n!==e.sizing.height)&&(e.frame.el.style.position="absolute",e.frame.el.style.top="0",e.frame.el.style.left="0",e.frame.el.style.bottom="0",e.frame.el.style.right="0",e.frame.el.style.width="100%",e.frame.el.style.height="100%")}},h={pre:function(){return o.rads=r.undef(o.rads)?{}:o.rads,o.rads.loaded=r.undef(o.rads.loaded)?[]:o.rads.loaded,r.undef(o.rads.correlator)&&!r.undef(e.correlator)&&e.correlator.length>0?o.rads.correlator=e.correlator:e.correlator=o.rads.correlator,o.rads.loaded.indexOf(e.zone)===-1&&o.rads.loaded.push(e.zone),e.lazy=e.lazy==="true",e.instanceId=r.getFirstAvailableInstanceId(),this.setSizing(),r.safe(h.setParams),!0},setSizing(){e.sizing.aspectRatio=r.aspectRatio(e.sizing.width,e.sizing.height),e.sizing.minWidth=e.sizing.width*e.sizing.minScalePercent,e.sizing.minHeight=e.sizing.height*e.sizing.minScalePercent},handleLazyLoad:function(t){if(r.canUseIntersectionObserver()){let i=new IntersectionObserver(s=>{r.isInViewport(t)&&(i.disconnect(),h.frame())},{threshold:.01});i.observe(t);return}let n=function(){if(r.isInViewport(t)&&!e.loaded){h.frame();return}setTimeout(n,100)};n()},shouldLazyLoad(t){return r.undef(c.currentScript)?!1:r.undef(t)||r.undef(t.lazy)?e.lazy:e.lazy=t.lazy==="true"},init:function(){if(r.log("init"),e.parent=r.isParent(),e.parent&&r.log("invoked within an iframe"),r.safe(function(){z.init()}),r.safe(function(){g.init()}),e.script=r.getFirstApplicableScriptById(),e.scriptSrc="id",e.script===null)return r.log("script element unavailable"),!1;r.log("visibility",r.visible(e.script)),!r.undef(c.currentScript)&&!r.undef(c.currentScript.dataset)&&(c.currentScript.dataset.racInstanceId=e.instanceId.toString());let t=e.script.dataset;t.racInstanceId=e.instanceId.toString();let n=e.script.parentElement;if(e.adContainerId="rac-ad-"+e.instanceId.toString(),e.adContainer=c.createElement("div"),e.adContainer.id=e.adContainerId,e.adContainer.style.maxWidth="".concat(e.sizing.width,"px"),e.adContainer.style.maxHeight="".concat(e.sizing.height,"px"),e.adContainer.style.minWidth="".concat(e.sizing.minWidth,"px"),e.adContainer.style.minHeight="".concat(e.sizing.minHeight,"px"),n.appendChild(e.adContainer),f.onResize(),g.defineAdSlot(e.zone,e.adContainerId,[{width:e.sizing.width,height:e.sizing.height}]),h.shouldLazyLoad(t)){if(r.log("attempt lazy load"),n&&!r.isInViewport(e.adContainer))return this.handleLazyLoad(e.adContainer),!1;r.log("skipping lazy load")}return this.frame(),!0},src:function(){r.safe(h.setParams);var t=e.host+"/loader?a="+e.zone,n=r.url(!0),i=encodeURIComponent(r.title()),s=["if="+e.parent];return Object.keys(e.params).length>0&&s.push(r.objToHttpArr(e.params).join("&")),n.length!==0&&s.push("url="+n),i.length!==0&&s.push("title="+i),r.safe(function(){let[a,l]=r.elementsVisibleSize(e.adContainer);a>0&&a<Number.MAX_SAFE_INTEGER&&s.push("vw="+a),l>0&&l<Number.MAX_SAFE_INTEGER&&s.push("vh="+l)}),!r.undef(e.correlator)&&e.correlator.length>0&&s.push("pcorr="+e.correlator),e.extra.forEach(function(a){var l=r.safe(a);l=!l||l.length===0?"":s.push(l)}),t=t+"&"+s.join("&"),t},setParams:function(t){var n=t||o.rads.data||{};for(var i in n){let s=i.match(/s\d?\d\b/g);if(s!==null&&s.length>0){e.params[i]=n[i];continue}switch(i){case"debug":e.params.debug=n[i]==="true"||n[i]===!0;break;case"cpid":case"content_publisher_id":e.params.cpid=n[i];break;case"cuid":case"content_user_id":e.params.cuid=n[i];break;case"cvid":case"content_video_id":e.params.cvid=n[i];break;case"ccid":case"content_channel_id":e.params.ccid=n[i];break;case"keywords":e.params.keywords=n[i];break;case"categories":e.params.categories=Array.isArray(n[i])?n[i].join(","):n[i];break;case"log":e.log=n[i];break;case"cuab":e.params.cuab=n[i];break;case"cug":e.params.cug=n[i];break;case"cuuid":e.params.cuuid=n[i];break}}!r.undef(n.zones)&&!r.undef(n.zones[e.zone])&&h.setParams(n.zones[e.zone])},frame:async function(){r.log("inject iframe");let t=e.script.parentNode,n=t;if(e.adContainer!==null&&(n=e.adContainer),t===null)return!1;let i=c.createElement("iframe");if(await y.wait(),r.safe(function(){b.createSession()}),i.src=this.src(),i.width=String(e.sizing.width),i.height=String(e.sizing.height),i.scrolling="no",i.style.cssText="border:0;display:block;",i.sandbox="allow-popups allow-scripts allow-same-origin allow-forms",i.setAttribute("data-zone",e.zone),i.setAttribute("data-rac-instance-id",e.instanceId),i.onload=function(){e.frame.loaded=!0,p.recv(),r.safe(function(){b.impression(),b.registerUnloadHandler()})},e.frame.el=i,e.script.nodeName==="SCRIPT")return r.purgeScripts(),n.appendChild(i),e.frame.injected=!0,p.setLoaded(),f.resizeToFitParent(),!1;e.script.appendChild(i),e.frame.injected=!0,p.setLoaded(),f.resizeToFitParent()}};(function(){if(!h.pre())return!1;h.init()})()})(window,document);})();
