(function(){"use strict";var a=Math.floor;function b(){return Math.round(Date.now()/1e3)}function c(){try{return(document.location.href+"").match(/[^&?]*(q|search|s|query|keyword)=([^&#?]*)/)?.[2]||null}catch{return null}}function d(){try{const b=document.body,c=window.scrollY||b.scrollTop,{scrollHeight:d,offsetHeight:e,clientHeight:f}=document.documentElement,g=Math.max(b.scrollHeight,d,b.offsetHeight,e,b.clientHeight,f),h=g-window.innerHeight;return a(100*Math.abs(c/h))}catch{}}function e(a,b=300,c=0){return(...d)=>(clearTimeout(c),c=setTimeout(a,b,...d))}function f(a){return a.reduce((a,[b,c=Date.now()])=>a+=c-b,0)}function g(a){try{return window.location.origin!==new URL(a).origin}catch{return!1}}function h(a){return"undefined"==typeof a?void 0:(+a).toString()}function i(a,b=null){const c=document.referrer?document.referrer:"";return{v:aa,sr:c,su:location.href,th:b?b:a}}function j(){const a=s(ea);if("string"!=typeof a)return null;if(!a||1>a.length)return null;const[b,c,d,e,f]=a.split(".").map(a=>+a);return{sessionId:c,sessionCount:d,lastEventAt:e,isSessionEngaged:!!f}}function k(a,c){const d=m(a),e=n(a),f=b(),g=o(a,c);return{sessionId:d,sessionCount:e,lastEventAt:f,isSessionEngaged:g}}function l(a){const{sessionId:b,sessionCount:c,lastEventAt:d,isSessionEngaged:e}=a,f=[1,b,c,d,+e].map(a=>a+"").join(".");r({key:ea,expires:_,value:f})}function m(a){return a&&a.sessionId&&a.lastEventAt?1800>b()-a.lastEventAt?a.sessionId:b():b()}function n(a){return a&&a.sessionCount&&a.lastEventAt?1800>b()-a.lastEventAt?a.sessionCount:a.sessionCount+1:1}function o(a,b){const c=0"pageView"===a).length;if(q(a))return!1;if(a.isSessionEngaged)return!0;if(c)return!0;const d=0a>10000).length;return!!d}function p(a){if(!(a&&a.lastEventAt))return!0}function q(a){return!!(a&&1800encodeURIComponent(`${a};${b}`)).join("|");return{...a,userAgentFullVersion:c}}catch{return null}}function w(){const a=window.screen?window.screen.width:0,b=window.screen?window.screen.height:0;return`${a}x${b}`}function x(){const{hostname:a,origin:b,pathname:c,search:d}=document.location,e=document.title,f=document.referrer;return{location:b+c+d,hostname:a,pathname:c,referrer:f,title:e}}function y({engagementEvents:a,scriptVersion:b,taggingHash:c,dataCenter:d,navigatorInfo:e,storageTags:f,pageLoadHash:g}){try{const h=f.filter(({eventType:a})=>"lid"===a);if(!Array.isArray(h)||Array.isArray(h)&&1>h.length)return;const i=j(),m=q(i),n=k(i,a);l(n);const o=t(n,e,g,m);navigator.sendBeacon(`https://${d}.creativecdn.com/ga4`,JSON.stringify({v:b,th:c,su:document.location.href,sr:document.referrer,tags:h,engagementEvents:a,engagementParams:o}))}catch{}}function z(a,b){let c;const g=e(()=>{const e=d();90>e||(y({engagementEvents:[{eventType:"scroll",engagementTimeMsec:f(b.engagementTimes)}],...b,navigatorInfo:a}),A(b.engagementTimes),document.removeEventListener("scroll",c))});c=g.bind(null),document.addEventListener("scroll",c)}function A(a){const[,b]=a.at(-1)||[];return b?(a.length=0,void a.push([Date.now(),Date.now()])):void(a.length=0,a.push([Date.now()]))}function B(a,b){const c=[];let d=null;return function(h){const e=h.target,{nodeName:i,href:j}=C(e);h.target&&"A"===i&&j&&(0===h.button||1===h.button)&&g(j)&&(c.push({eventType:"click",engagementTimeMsec:f(b.engagementTimes),linkUrl:encodeURIComponent(j)}),d&&clearTimeout(d),d=setTimeout(()=>{y({engagementEvents:c,...b,navigatorInfo:a}),d=null,c.length=0},3e3),A(b.engagementTimes))}}function C(a){try{let b="",c="";for(let d=0;4>d;d++){if(b=a.tagName,c=a.getAttribute("href"),"BODY"===b)return{nodeName:b,href:c};if("A"===b)return{nodeName:b,href:c};a=a.parentElement}return{nodeName:b,href:c}}catch{return{nodeName:"",href:""}}}function D(a,b){let d=location.href;return function(){const e=location.href;if(d===e)return;d=e;const g=c(),h=[],i=j();g&&h.push({eventType:"viewSearchResults",searchTerm:g}),q(i)&&h.push({eventType:"sessionStart"}),h.push({eventType:"pageView",engagementTimeMsec:f(b.engagementTimes)}),y({engagementEvents:h,...b,navigatorInfo:a}),A(b.engagementTimes)}}function E(a,b,d){return function(){const e=[];p(a)&&e.push({eventType:"firstVisit"}),q(a)&&e.push({eventType:"sessionStart"}),e.push({eventType:"pageView"});const f=c();f&&e.push({eventType:"viewSearchResults",searchTerm:f}),y({engagementEvents:e,...d,navigatorInfo:b})}}function F(a){return function(){const[,b]=a.at(-1)||[];b||a.at(-1).push(Date.now())}}function G(a){return function(){const[,b]=a.at(-1)||[];b&&a.push([Date.now()])}}function H(a){return function(){const[,b]=a.at(-1),c=["hidden","visible"].indexOf(document.visibilityState);return-1===c||!!c?void 0:void(b||a.at(-1).push(Date.now()))}}function I(a,b){return()=>{1e3>=f(a.engagementTimes)||y({engagementEvents:[{eventType:"userEngagement",engagementTimeMsec:f(a.engagementTimes)}],...a,navigatorInfo:b})}}function J(a,b){try{const c=new MutationObserver(D(a,b));c.observe(document.body,{subtree:!0,childList:!0}),window.addEventListener("pagehide",()=>{c.disconnect()})}catch{}}function K(a){try{window.addEventListener("blur",F(a.engagementTimes)),window.addEventListener("focus",G(a.engagementTimes)),document.addEventListener("visibilitychange",H(a.engagementTimes));const b=j();u().then(c=>{window.addEventListener("load",E(b,c,a)),J(c,a),z(c,a),document.body.addEventListener("mousedown",B(c,a)),window.addEventListener("pagehide",I(a,c))})}catch{}}function L(){function a({key:a,expires:b,sameSite:c,domain:d,value:e}){const f=d&&""!==d?";domain="+encodeURIComponent(d):"",g=b&&"number"==typeof b?";expires="+new Date(new Date().getTime()+b).toString():"",h=c&&"none"===c.toLowerCase(),i=h?" ;Secure":"";document.cookie=a+"="+encodeURIComponent(e)+g+";path=/"+f+(c?";SameSite="+c:"")+i}function b(a){const b=window.document.cookie.match("(^|;)\\s*"+a+"\\s*=\\s*([^;]*)\\s*(;|$)");return b?decodeURIComponent(b[2]):null}function c(a,b){window.localStorage.setItem(a,b)}function d(a){return window.localStorage.getItem(a)}function e(a,b){window.sessionStorage.setItem(a,b)}function f(a){return window.sessionStorage.getItem(a)}return{getAllStorages:function(a){const c=f(a);return c?c:b(a)||d(a)},setAllStorages:function({key:b,value:d,expires:f,sameSite:g,domain:h}){b&&d&&(a({key:b,value:d,expires:f,sameSite:g,domain:h}),c(b,d),e(b,d))},getStorageTags:function(a){const b=[];for(const c of $){const d=a.getAllStorages(Z+c),e=M(d);e&&e.eventType&&b.push(e)}return b}}}function M(a){try{return JSON.parse(a)}catch{return null}}function N(a,b,c,d="ams"){const e=document.referrer?document.referrer:"";return null===a?void 0:function(f,g,h,i=null){try{const j=g.filter(a=>!b.includes(a.eventType)&&"init"!==a.eventType);return O(`https://${d}.creativecdn.com/tags/v2?type=json`,{method:"POST",mode:"cors",credentials:"include",referrerPolicy:"no-referrer-when-downgrade",headers:{"Content-Type":"application/json"},redirect:"follow",body:JSON.stringify({v:c,sr:e,su:location.href,th:i?i:a,tags:[...j,...h]})},f)}catch{}}}async function O(a,b,c,d){try{const e="function"==typeof c?c:()=>{},f=await fetch(a,b),g=f.status;if(200<=g&&300>g)return e(d?await f.json():await f.text(),f)}catch{}}function P(){const b="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".length;let c="";for(let d=0;20>d;d++)c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".charAt(a(Math.random()*b));return c}function Q(){const a=window[Y].filter(a=>a.eventType&&"init"===a.eventType)[0];return a||null}function R(a=null){return a&&a.value?a.value:null}function S(a=null){return a&&a.dc&&["ams","us","phx","sin","ash","asia"].includes(a.dc)?a.dc:"ams"}function T(a,b){if(b){const b=a||[];for(const a of b)a()}}function U(a){try{const b=JSON.parse(a),c=Array.isArray(b)?b:[];for(const a of c)if(a&&a.url&&a.type)if("img"===(a.type+"").toLowerCase()){const b=new Image;b.src=a.url,b.setAttribute("width","1"),b.setAttribute("height","1"),b.setAttribute("scrolling","no"),b.setAttribute("frameBorder","0"),b.setAttribute("style","display:none"),document.body.appendChild(b)}else if("iframe"===(a.type+"").toLowerCase()){const b=document.createElement("iframe");b.setAttribute("width","1"),b.setAttribute("height","1"),b.setAttribute("scrolling","no"),b.setAttribute("frameBorder","0"),b.setAttribute("style","display:none"),b.setAttribute("src",a.url),document.body.appendChild(b)}}catch{}}function V(a,b,c,d){try{const e=W(a,d),f=Object.keys(e);for(const a of f)b(U,e[a],c,a)}catch{}}function W(a,b){try{return a.reduce((a,c)=>{const d=c.hash?c.hash:b;return(a[d]=a[d]||[]).push(c),a},{})}catch{}}function X(a,b,c,d){try{window.document.addEventListener("visibilitychange",()=>{const e=W(a,b);for(const a in e){if(!Object.hasOwn(e,a))continue;const f=0![...$,"init"].includes(a)).length;"hidden"!==document.visibilityState||f||navigator.sendBeacon(`https://${c}.creativecdn.com/tags/v2?type=json`,JSON.stringify({...i(b,a),tags:[{eventType:"placebo"},...d]}))}})}catch{}}const Y="rtbhEvents",Z="__rtbh.",$=["uid","sid","aid","eid","lid"],_=31536000000,aa="v0.1.6-ga4-v3",ba=["platform","platformVersion","architecture","model","bitness","fullVersionList","wow64"],ca=a(2147483648*Math.random()),da=function(){return function(){let a=0;return function(){return a++,a}}}()(),ea=Z+"ev";(function(){const a=[];if(Array.isArray(window[Y])||(window[Y]=[]),window[Y].length&&!window[Y].push.prototype)try{const b=new RegExp(`^(${$.join("|")})$`),c=L();let d=c.getStorageTags(c),e=Q(),f=S(e),g=R(e),h=N(g,$,aa,f);const i=[[Date.now()]];T(a,g);for(const a of $){const b=Z+a,e=c.getAllStorages(`__rtbhouse.${a}`),f=c.getAllStorages(b),g=window[Y].find(b=>b.eventType===a&&b.id);if(g&&c.setAllStorages({key:b,value:JSON.stringify(g),expires:_}),!f&&e&&!e.includes("eventType")){c.setAllStorages({key:Z+a,value:JSON.stringify({eventType:a,id:e}),expires:_})}d=c.getStorageTags(c)}const j=Z+"lid";c.getAllStorages(j)||(c.setAllStorages({key:j,value:JSON.stringify({eventType:"lid",id:P()}),expires:_}),d=c.getStorageTags(c)),V(window[Y],h,d,g),window[Y].push=function(){try{const i=Array.prototype.slice.call(arguments).filter(a=>(b.test((a||{}).eventType+"")&&(c.setAllStorages({key:Z+a.eventType,value:JSON.stringify(a),expires:_}),d=c.getStorageTags(c)),!0));return null===g&&(e=Q(),f=S(e),g=R(e),h=N(g,$,aa,f),T(a,g)),Array.prototype.push.apply(this,arguments),V(i,h,d,g),!0}catch{}},X(window[Y],g,f,d),K({scriptVersion:aa,taggingHash:g,dataCenter:f,engagementTimes:i,storageTags:d,pageLoadHash:ca})}catch{}})()})();