(function() {
try {
    try {
    if (typeof MtVoid === 'undefined') {
	var MtVoid = {
            loc_data : {},
            scr_data : {
  "mt_pqc":"mt_aid",
  "primary-x-request-id":"cd2f66b68506b03c0927db9ab71a5ca4",
  "mt_fpa":"1",
  "s3":"",
  "mt_gfp":"mt_fp_mt_aid",
  "v2":"",
  "v3":"",
  "mt_id":"1653127",
  "mt_adid":"429145",
  "s1":"",
  "s2":"",
  "mt_excl":"",
  "mt_exem":"",
  "v1":""
},
            acq_data : {},
            get: function(obj_name, var_name) {
		return this[obj_name][var_name];
	    },
            set: function(obj_name, var_name, value) {
		this[obj_name][var_name] = value;
		return value;
	    },

            parse_qry: function(qs, destination) {
		qs.replace(/[?&]([^=]+)=([^&]*)/g, function(all, key, value) {
		    destination[key]= value;
		});
            },

            makeqs : function() {
		var qs = "";
		var keys = [].concat.call(arguments);
		if (keys.length < 2) {
		    keys = Object.keys(this.acq_data);
		}
		var pairs = [];
		var self = this;
		keys.forEach(function(key) {
		    pairs.push(key+'='+encodeURIComponent(self.acq_data[key]));
		});
		return pairs.join("&");
	    },

	    gcook: function(name) {
		if (document.cookie == null)
		    return null;
		const fetch_cookie = RegExp(name+"=([^;]+)");
		if (fetch_cookie == null)
                    return null;
		const values = document.cookie.match(fetch_cookie);
		if (values == null)
		    return null;
		this.set('acq_data', name, values[1]);
		var abbrev = name.replace(/mt_fp_/g, '');
		this.set('acq_data', abbrev, values[1]);
		return values[1];
	    },

 	    scook: function(name, value, expire_secs) {
        	var date = new Date();
		date.setTime(date.getTime() + expire_secs);
       		var expire = date.toUTCString();
		var domain = window.location.hostname.match("[^.]+\.[^.]+$")[0];
       		var cookie_str = name+'='+value +
		    '; domain='+domain +
                    '; expires='+expire +
                    '; path=/; Secure; SameSite=None';
		document.cookie = cookie_str;
		return document.cookie;
	    }
	}

	MtVoid.parse_qry(window.location.search, MtVoid.loc_data);
	MtVoid.set('acq_data', 'primary-x-request-id', "f140c22b7e59c845b09756b3142250ac");
	MtVoid.set('acq_data', 'mt_sec', 'kv');

	var mt_fp_uuid = MtVoid.gcook("mt_fp_uuid")
	if (mt_fp_uuid == null) {
            if (MtVoid.get('scr_data', 'mt_sfp') != null) {
		MtVoid.scook('mt_fp_uuid', "06e468e3-3358-4b00-8dbb-ed1c2ce9fd33", 396*24*60*60*1000);
            }
	}

        if (MtVoid.get('scr_data', 'mt_fpa') != null) {
	    var mt_aid = MtVoid.get("loc_data", "mt_aid");
	    if (mt_aid != null) {
		MtVoid.scook('mt_fp_mt_aid', mt_aid, 30*60*60*24*1000);
            }
	}

	var mt_pqc = MtVoid.get('scr_data', 'mt_pqc');
	if (mt_pqc != null) {
            var pqc = mt_pqc.split(/[:,|]/);
	    pqc.forEach(function(key) {
		if (MtVoid.get('loc_data', key) != null)
    		    MtVoid.set('acq_data', key, MtVoid.get('loc_data', key));
	    })
	}

	var mt_gfp = MtVoid.get('scr_data', 'mt_gfp');
	if (mt_gfp != null) {
	    var gfp = mt_gfp.split(/[:,|]/);
	    gfp.forEach(function(key) {
    		MtVoid.gcook(key)
	    })
	}
    }
}
catch(ex) {
    new Image().src = "//pixel.mathtag.com/error/img?error_domain=jskvstore&what=" + encodeURIComponent(ex.message);
}
if (typeof window.MtBts === 'undefined') {
    window.MtBts = function() {
	metric = function(url, wait)
	{	
            setTimeout(function() {
                var e = new Image();
                e.src = url;
            }, wait);
	}
	var intervals = [0, 10];
	var inlen = intervals.length;
	for (var k = 0; k < inlen; ++k)
            this.metric("https://pixel.mathtag.com/comp/img?mt_id=99&ns=xx&bcdv="+k, intervals[k] * 1000);
    };
    window.MtBts()
}
       (function() {
	   try {
 	       var stat = '';

               var mt_aid = MtVoid.get('acq_data', 'mt_aid');
               var mt_fp_mt_aid = MtVoid.get('acq_data', 'mt_fp_mt_aid');

               if (!(mt_aid || mt_fp_mt_aid)) {
		   return
	       }

               if (MtVoid.get('loc_data', 'mt_aid'))
		   stat += 'p2_landing_page,';
               if (mt_aid)
 		   stat += 'p2_mt_aid,';
  	       if (mt_fp_mt_aid)
                  stat += 'p2_mt_fp_mt_aid,';
               stat += "immediate";

       	       var refire = 'https://pixel.mathtag.com/event/img?primary-x-request-id=cd2f66b68506b03c0927db9ab71a5ca4&mt_id=1653127&mt_adid=429145&mt_exem=&mt_excl=&v1=&v2=&v3=&s1=&s2=&s3=&mt_pqc=mt_aid&mt_fpa=1&stat='+stat+'&primary_mt_timestamp=1759720280&'+MtVoid.makeqs();
               new Image().src= refire;
	   } catch(ex) {
	       new Image().src="//%s/error/img?error_domain=immediate&what="+encodeURIComponent(ex.message);
	   }
       }
       )();
(function(){
/**/

})();
(function() {
    try {
        if (document.getElementById('mm_sync_back_ground'))
           return;
        var frm = document.createElement('iframe');
        frm.style.visibility = 'hidden';
        frm.style.display = 'none';
        frm.src = "https://pixel.mathtag.com/sync/iframe?mt_uuid=06e468e3-3358-4b00-8dbb-ed1c2ce9fd33&no_iframe=1&mt_adid=429145&source=mathtag";
        frm.setAttribute("id", "mm_sync_back_ground");
        frm.title="MediaMath Advertising";

        if (document.body)
            document.body.appendChild(frm);
        else
            if (document.head)
                document.head.appendChild(frm);
    }
    catch(ex)
    {
        new Image().src="//pixel.mathtag.com/error/img?error_domain=synciframe&what="+encodeURIComponent(ex.message);
    }
})();

}
catch(ex)
{
   new Image().src="//pixel.mathtag.com/error/img?error_domain=wrap_js&what="+encodeURIComponent(ex.message);
}
})();
