!function(){"use strict";var r=function(){return(r=Object.assign||function(n){for(var e,t=1,r=arguments.length;t<r;t++)for(var i in e=arguments[t])Object.prototype.hasOwnProperty.call(e,i)&&(n[i]=e[i]);return n}).apply(this,arguments)};function n(t,r){var i,o,c,n,a={label:0,sent:function(){if(1&c[0])throw c[1];return c[1]},trys:[],ops:[]};return n={next:e(0),throw:e(1),return:e(2)},"function"==typeof Symbol&&(n[Symbol.iterator]=function(){return this}),n;function e(e){return function(n){return function(e){if(i)throw new TypeError("Generator is already executing.");for(;a;)try{if(i=1,o&&(c=2&e[0]?o.return:e[0]?o.throw||((c=o.return)&&c.call(o),0):o.next)&&!(c=c.call(o,e[1])).done)return c;switch(o=0,c&&(e=[2&e[0],c.value]),e[0]){case 0:case 1:c=e;break;case 4:return a.label++,{value:e[1],done:!1};case 5:a.label++,o=e[1],e=[0];continue;case 7:e=a.ops.pop(),a.trys.pop();continue;default:if(!(c=0<(c=a.trys).length&&c[c.length-1])&&(6===e[0]||2===e[0])){a=0;continue}if(3===e[0]&&(!c||e[1]>c[0]&&e[1]<c[3])){a.label=e[1];break}if(6===e[0]&&a.label<c[1]){a.label=c[1],c=e;break}if(c&&a.label<c[2]){a.label=c[2],a.ops.push(e);break}c[2]&&a.ops.pop(),a.trys.pop();continue}e=r.call(t,a)}catch(n){e=[6,n],o=0}finally{i=c=0}if(5&e[0])throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}([e,n])}}}var t,i={POST_CLICK_CDN_URL:"https://ads-engagement.presage.io",SCROLL_STEPS:[25,50,75,90]};function o(n){return void 0===n&&(n=""),function(n){void 0===n&&(n="");var e=n.length-1;return"/"===n.charAt(e)?n.slice(0,e):n}(function(n){return void 0===n&&(n=""),"/"===n.charAt(0)?n.slice(1,n.length):n}(n))}function c(){if(!t){var n=document.querySelector('script[src^="'+i.POST_CLICK_CDN_URL+'"]'),e={};n&&(e=function(n){var e=n.split("?")[1];return e?e.split("&").reduce(function(e,n){var t=n.split("="),r=t[0],i=t[1];try{e[r]=JSON.parse(i)}catch(n){e[r]=i}return e},{}):{}}(n.src)),t=r({currentUrl:window.location.href||document.URL||""},e,{scrollSteps:i.SCROLL_STEPS})}return t}var a=(e.prototype.ping=function(r){return r=this.craftUrl(r),new Promise(function(n,e){var t=new Image;t.onload=function(){return n()},t.onerror=function(){return e()},t.src=r})},e.prototype.craftUrl=function(n){try{var e=new URL(n);-1===e.pathname.indexOf("img.gif")&&(e.pathname+="/img.gif"),n=e.toString()}catch(n){}return n},e);function e(){}var s=(u.prototype.ping=function(n){return this.hasSendBeaconMethod()?!0===navigator.sendBeacon(n)?Promise.resolve():Promise.reject():this.pixelPing(n)},u.prototype.pixelPing=function(n){return this.imagePixelTrackSender.ping(n)},u.prototype.hasSendBeaconMethod=function(){return!!navigator.sendBeacon&&typeof navigator.sendBeacon==typeof Function},u);function u(n){void 0===n&&(n=new a),this.imagePixelTrackSender=n}var l=(d.prototype.getSenderMethod=function(n){return"pv"===n?this.imageSender:this.beaconSender},d);function d(n,e){void 0===n&&(n=new s),void 0===e&&(e=new a),this.beaconSender=n,this.imageSender=e}var f=(p.getInstance=function(){return p.instance||(p.instance=new p),p.instance},p.prototype.sendTrack=function(n,e){void 0===e&&(e={});var t=this.getTrackEndPoint(n,e);return this.sendWityRetry(t,this.trackSenderFactory.getSenderMethod(n))},p.prototype.sendWityRetry=function(t,r,i){var o=this;return void 0===i&&(i=3),i<1?Promise.reject():r.ping(t).catch(function(){return new Promise(function(n,e){setTimeout(function(){o.sendWityRetry(t,r,i-1).then(n,e)},p.RETRY_INTERVAL)})})},p.prototype.getTrackEndPoint=function(n,e){return void 0===e&&(e={}),function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];return n.map(o).filter(function(n){return n}).join("/").replace("/?","?")}(i.POST_CLICK_CDN_URL,"pv"===n?"v2/pv":"pixel",this.getQueryString(n,e))},p.prototype.getQueryString=function(n,e){void 0===e&&(e={});var t=c();return function(e){var n=Object.keys(e).map(function(n){return e[n]?n+"="+encodeURIComponent(e[n]):""}).filter(function(n){return n}).join("&");return n?"?"+n:""}(r({e:n,site:t.site,t:(new Date).getTime()},e,t.src&&"gtm"===t.src&&{src:t.src},{full_url:e.full_url||t.currentUrl}))},p.RETRY_INTERVAL=100,p);function p(n){void 0===n&&(n=new l),this.trackSenderFactory=n}var g=(h.getInstance=function(){return h.instance||(h.instance=new h),h.instance},h.prototype.sendTrack=function(e,t){return void 0===t&&(t={}),function(o,c,a,s){return new(a=a||Promise)(function(n,e){function t(n){try{i(s.next(n))}catch(n){e(n)}}function r(n){try{i(s.throw(n))}catch(n){e(n)}}function i(e){e.done?n(e.value):new a(function(n){n(e.value)}).then(t,r)}i((s=s.apply(o,c||[])).next())})}(this,void 0,void 0,function(){return n(this,function(n){switch(n.label){case 0:return[4,this.isTrackingEnabled()];case 1:return n.sent()&&"pv"!==e?[4,this.getTrackSender()(e,t)]:[2];case 2:return n.sent(),[2]}})})},Object.defineProperty(h.prototype,"trackingEnablingPromise",{get:function(){return window.ogyTrackingEnablingPromise},set:function(n){window.ogyTrackingEnablingPromise=n},enumerable:!0,configurable:!0}),h.prototype.isTrackingEnabled=function(){var e=this;return this.trackingEnablingPromise||(this.trackingEnablingPromise=new Promise(function(n){e.getTrackSender()("pv").then(function(){return n(!0)},function(){return n(!1)})})),this.trackingEnablingPromise},h.prototype.getTrackSender=function(){return f.getInstance().sendTrack.bind(f.getInstance())},h);function h(){}function v(n){var e=n&&n.target||{},t=function(n){return n?n.toLowerCase():""}(e.nodeName)+function(n){return n?"#"+n:""}(e.id)+function(n){var e="";return"string"==typeof n?e=n:n&&"object"==typeof n&&"baseVal"in n&&(e=n.baseVal||""),e?"."+e.replace(/ /g,"."):""}(e.className)||"unknown";g.getInstance().sendTrack("click",{id:t})}window.ogyPageviewSent=!1;var w=(y.prototype.handlePreLoadingScrollSteps=function(){var n=this;this.remainingSteps.concat().every(function(){return n.handleUserScroll()})},y.prototype.start=function(n){this.onStepReached=n,this.handlePreLoadingScrollSteps(),window.addEventListener("scroll",this.handleUserScrollEventHandler)},y.prototype.getCurrentScrollLevel=function(){var n=document.documentElement.scrollHeight-window.innerHeight;return(window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0)/n*100},y.prototype.handleUserScroll=function(){return 0===this.remainingSteps.length&&window.top.removeEventListener("scroll",this.handleUserScrollEventHandler),this.getCurrentScrollLevel()>=this.remainingSteps[0]&&(this.onStepReached(this.remainingSteps.shift()),!0)},y);function y(){this.handleUserScrollEventHandler=this.handleUserScroll.bind(this),window.ogyScrollSteps=window.ogyScrollSteps||c().scrollSteps,this.remainingSteps=window.ogyScrollSteps}var S="user_exit",m=Date.now(),b=0;function T(n){var e=Date.now();g.getInstance().sendTrack("scroll",{time:e-m,scrollStep:n}),m=e}function k(){if("visible"===document.visibilityState){var n=Date.now();b=n-m}}function P(){if("visible"===document.visibilityState){var n=Date.now();m=n-b,b=0}}function E(){var n=Date.now();g.getInstance().sendTrack(S,{time:n-m}),m=n}(new w).start(T),window.addEventListener("blur",k),window.addEventListener("pagehide",E),window.document.addEventListener("visibilitychange",P),window.ogyPageviewSent||(window.ogyPageviewSent=!0,g.getInstance().sendTrack("pv")),document.addEventListener("click",v)}();
