api3.evelean.com
Open in
urlscan Pro
52.47.81.51
Public Scan
URL:
https://api3.evelean.com/js/evelean.min.js?6290adb7b0b3302e805874e3
Submission: On August 01 via api from IT — Scanned from FR
Submission: On August 01 via api from IT — Scanned from FR
Form analysis
0 forms found in the DOMText Content
var Evelean=function(pid){this.version=3.2,this.archiver=new Archiver,this.segments={gadget:"economy",price:"caring",luxe:"brand",quality:"innovation"},"true"!==this.archiver.getData("evelean_o")?(this.preflight(pid),"complete"===document.readyState||"loaded"===document.readyState?this.init():"interactive"===document.readyState?document.onreadystatechange=function(){"complete"===document.readyState&&this.init()}.bind(this):window.addEventListener("DOMContentLoaded",function(){this.init()}.bind(this),!1)):console.log("evelean - user preferences prevent enriched experience")};Evelean.prototype.preflight=function(pid){var scripts=document.getElementsByTagName("script"),index,myScript=scripts[scripts.length-1],matches=myScript.src.match(/^https?\:\/\/([^\/?#]+)(?:[\/?#]|$)/i),domain=matches&&matches[1];if(null===domain&&(domain=""),domain.includes("evelean.com")||(domain=(matches=(myScript=document.getElementById("evelean_script")).src.match(/^https?\:\/\/([^\/?#]+)(?:[\/?#]|$)/i))&&matches[1]),null===domain)return void console.log("Evelean cannot start. No API domain found.");this.api="https://"+domain,this.property=pid,this.url=new URL(window.location.href),this.debug="true"==this.url.searchParams.get("debug")||"1"==this.url.searchParams.get("debug")||!1;let forcedgeoloc=this.url.searchParams.get("geoloc")||!1;forcedgeoloc?(forcedgeoloc=forcedgeoloc.split(","),this.geoloc={latitude:parseFloat(forcedgeoloc[0]),longitude:parseFloat(forcedgeoloc[1])},this.forcedgeoloc=!0,console.log("evelean - forced geoloc",this.geoloc)):this.forcedgeoloc=!1;var vendor=document.createElement("script");vendor.src=this.api+"/js/evelean.vendor.js?"+(new Date).getUTCMilliseconds(),document.getElementsByTagName("head")[0].appendChild(vendor),this.initdone=!1,this.vendorsready=!1},Evelean.prototype.init=function(){void 0!==this.api&&(this.initdone||(this.vendorsready?(this.initdone=!0,window.onload=function(){}.bind(this),window.onkeypress=function(e){167===e.keyCode&&this.parseTouchpoints(!0),42===e.keyCode&&console.log(this.heatmap.getData()),113===e.keyCode&&console.log(this.leavepage())}.bind(this),window.onbeforeunload=function(){this.leavepage()}.bind(this),this.bouncer=new Bouncer,this.utils=new Utils,this.transmitter=new Transmitter,this.designer=new Designer,this.leadtransmitted=!1,this.requestid=null,this.segment=null,TimeMe.initialize({currentPageName:"main",idleTimeoutInSeconds:30}),this.bouncer.getAuthCode(),this.initScrapers()):setTimeout(function(){this.init()}.bind(this),500)))},Evelean.prototype.initScrapers=function(){if(void 0!==this.token){console.log("evelean - token received, getting scrapers's parameters");var data={activity:{what:"scrapeinfo"},pathname:this.url.pathname};this.transmitter.post(this.api+"/activity/external/null",{"Content-Type":"application/json",Authorization:"Bearer "+this.token},JSON.stringify(data),!0,function(xhr){var r=JSON.parse(xhr.responseText);this.startScrapers(r.data)}.bind(this))}else console.log("evelean - wait for token"),setTimeout(this.initScrapers.bind(this),1e3)},Evelean.prototype.startScrapers=function(data){if(data.disallow)for(var ddll=data.disallow.split(","),i=0;i<ddll.length;i++){var d=ddll[i].trim();if(this.url.href.indexOf(d)>=0)return void console.log('evelean - page is disallowed by rule "'+d+'"')}console.log("evelean - starting scrapers"),this.type="integrated",window.self!==window.top&&(this.type="separated");var dostart=!0;!this.forcedgeoloc&&data.geoloc&&navigator.geolocation&&(this.geoloc=null,this.utils.askGeoloc()),this.page=this.utils.scrapePage(data),this.utils.scrapeCover(data),this.utils.scrapeContentImages(),this.utils.scrapeGalleries(data),this.utils.scrapeFileList(data),this.utils.scrapeCustoms(data),this.touchpoints=this.addFormListeners(data),this.page.signature=this.utils.MD5(JSON.stringify(this.page)),this.page.publishdate=this.utils.scrapePublishdate(data),this.start()},Evelean.prototype.start=function(){console.log("evelean - starting view"),"separated"===this.type?(process={env:{NODE_ENV:"production"}},this.postmate=new Postmate.Model({height:()=>document.height||document.body.offsetHeight,set_segment:segment=>_e.setSegment(segment)})):"integrated"===this.type&&this.event("art_view")},Evelean.prototype.setSegment=function(segment){this.segment=segment,this.event("art_view",{forcesegment:segment})},Evelean.prototype.addFormListeners=function(){var touchpoints=[],forms,i,form,touchpoint;return touchpoints},Evelean.prototype.addFormListener=function(form){form.addEventListener?form.addEventListener("submit",function(e){this.lead(e)}.bind(this),!1):form.attachEvent&&form.attachEvent("onsubmit",function(e){this.lead(e)}.bind(this))},Evelean.prototype.leavepage=function(e){if("separated"!==this.type){var why={};if(void 0!==this.requestid){var timeOnPage=Math.ceil(TimeMe.getTimeOnCurrentPageInSeconds("main")),hm=this.heatmap.getData(),data={data:{what:"art_view",where:this.page.id,requestid:this.requestid,type:"article",time:parseInt(timeOnPage),segment:this.segment,heatmap:hm,why:why},token:this.token,action:"Activity:edit",property:this.property};this.utils.isEmpty(data.touchpoint)&&delete data.touchpoint,this.transmitter.send(this.api+"/api/beaconcall",{},JSON.stringify(data),!1,(()=>{}).bind(this))}else console.log("evelean - No REQUEST_ID found, skipping")}else console.log("evelean - I am in analysis mode, no need to send data")},Evelean.prototype.event=function(what,custom){var data={origin:this.url.origin,pathname:this.url.pathname,activity:{what:what,where:this.url.origin+this.url.pathname,why:{art_title:this.page.title,navigation:{user_agent:navigator.userAgent,referral:document.referrer,browser:{name:this.utils.getBrowser()},os:{name:this.utils.getOs(),ismobile:this.utils.isMobile()},device:this.utils.getDevice(),screen_size:screen.width+"x"+screen.height}}},page:this.page,touchpoints:this.touchpoints};let attr=this.utils.readAttribution();attr&&Object.keys(attr).length>0&&(data.activity.why.attribution=attr,window.dataLayer?(console.log("evelean - send attribution information to GTM",attr),window.dataLayer.push(attr)):console.log("evelean - GTM not available, cannot send attribution",attr));let gl=this.utils.readGeoloc();if(gl&&(data.activity.why.geoloc=gl,console.log("evelean - event "+what+" geoloc value:",gl),window.dataLayer?(console.log("evelean - send geoloc information to GTM"),window.dataLayer.push({latitude:gl.latitude,longitude:gl.longitude})):console.log("evelean - GTM not available, cannot send geoloc")),"art_view"===what){data.activity.why.doctype="Article",data.activity.why.docsubtype=this.page.type;const forcesegment=location.search.split("segment=")[1];void 0!==forcesegment&&(data.forcesegment=forcesegment)}else if("lead"===what){let tp;if(custom.lead.hasOwnProperty("touchpoint_id"))tp=document.querySelector('form[data-touchpoint_id="'+custom.lead.touchpoint_id+'"]');else{if(!custom.lead.hasOwnProperty("touchpoint_signature"))return!1;tp=document.querySelector('form[data-touchpoint_signature="'+custom.lead.touchpoint_signature+'"]')}data.activity.why.doctype="Article",data.activity.why.position=tp.getAttribute("data-position")}else if("geoloc_content"===what){data.activity.why.doctype="Article",data.activity.segment=this.segment,data.widgets=[];for(let wi in this.contentwidget)if("geolocalized"==this.contentwidget[wi].strategy){const clone=JSON.parse(JSON.stringify(this.contentwidget[wi]));delete clone.content,delete clone.script,delete clone.style,data.widgets.push(clone)}data.page={url:this.page.url},delete data.touchpoints,delete data.pathname}if(null!==custom)for(var i in custom)data[i]=custom[i];this.transmitter.post(this.api+"/activity/external/null",{"Content-Type":"application/json",Authorization:"Bearer "+this.token},JSON.stringify(data),!0,function(xhr){var r,activity=JSON.parse(xhr.responseText).data;"art_view"===activity.what&&void 0!==activity.article?(window.dataLayer&&activity.segment?(console.log("evelean - send segment information to GTM",this.segments[activity.segment]),window.dataLayer.push({segment:this.segments[activity.segment]}),window.dataLayer.push({event:"pageview"})):console.log("evelean - GTM not available, cannot send segment",this.segments[activity.segment]),this.personalizePage(activity)):"geoloc_content"===activity.what?this.handleContentWidget(activity):"lead"===activity.what&&this.finalizeLead(activity)}.bind(this))},Evelean.prototype.finalizeLead=function(activity){if(!activity.hasOwnProperty("touchpoint_id"))return void console.error("evelean - missing touchpoint id in finalizeLead, unable to proceed");const form=document.querySelector('[data-touchpoint_id="'+activity.touchpoint_id+'"]');if(null!=form)if(activity.hasOwnProperty("error")){const submit=form.querySelector('input[type="submit"]');let em=document.createElement("div");em.setAttribute("class","errormessage"),em.innerHTML=activity.error,form.insertBefore(em,submit),submit.removeAttribute("disabled"),submit.value=submit.getAttribute("data-original-value")}else{let cnt="";var formByID;if(form.classList.add("thankyou"),activity.thankyou?cnt+=activity.thankyou.message:cnt+="Your request has been recorded",!(form.classList.contains(".bottomright")&&form.classList.contains(".bottomleft")&&form.classList.contains(".right")&&form.classList.contains(".left")&&form.classList.contains(".bottom")&&form.classList.contains(".modal")))document.getElementById(activity.touchpoint_id).scrollIntoView({behavior:"smooth"});if(form.innerHTML=cnt,activity.hasOwnProperty("access_token")&&(this.token=activity.access_token,this.archiver.setData("evelean_t",this.token),this.archiver.setData("evelean_r",activity.refresh_token),this.archiver.setData("evelean_i",activity.cmc_id)),activity.hasOwnProperty("finalize")&&activity.finalize.hasOwnProperty("processUI"))for(var i in activity.finalize.processUI){var iframe=document.createElement("iframe");iframe.setAttribute("style","width:100%; overflow: hidden;"),form.innerHTML="",form.appendChild(iframe),iframe.setAttribute("srcdoc",window.atob(activity.finalize.processUI[i]).replace('<div class="conference','<div class="conference frame"'))}}else console.log("evelean - form not found in finalizeLead, unable to proceed",activity.touchpoint_id)},Evelean.prototype.handleHTMLWidget=function(activity){if(activity.hasOwnProperty("htmlwidget")&&activity.htmlwidget.hasOwnProperty("list")&&activity.htmlwidget.list.length>0){this.htmlwidget=activity.htmlwidget.list,console.log("enter handleHTMLWidget",this.htmlwidget),activity.htmlwidget.hasOwnProperty("general")&&null!=activity.htmlwidget.general&&(activity.htmlwidget.general.hasOwnProperty("style")&&this.designer.addStyle(activity.htmlwidget.general.style,"htmlwidget"),activity.htmlwidget.general.hasOwnProperty("script")&&this.designer.addScript(activity.htmlwidget.general.script));for(let i in this.htmlwidget){const widget=this.htmlwidget[i];widget.active&&this.designer.htmlWidget(widget,this.dashboard)}}},Evelean.prototype.handleContentWidget=function(activity){if(activity.hasOwnProperty("contentwidget")&&activity.contentwidget.hasOwnProperty("list")&&activity.contentwidget.list.length>0){activity.contentwidget.hasOwnProperty("general")&&activity.contentwidget.general.hasOwnProperty("style")&&this.designer.addStyle(activity.contentwidget.general.style,"contentwidget"),this.contentwidget=activity.contentwidget.list;for(let i in this.contentwidget){const widget=this.contentwidget[i];widget.active&&this.designer.contentWidget(widget,this.dashboard)}}},Evelean.prototype.personalizePage=function(activity){this.page.id=activity.article,this.page.segmentedcontent=activity.segmentedcontent,this.dashboard=activity.dashboard,this.handleContentWidget(activity),this.handleHTMLWidget(activity),activity.optoutwidget.active&&this.designer.drawWidgetOptout(activity.optoutwidget),activity.shaper&&this.designer.liveshape(activity.shaper),this.segment=activity.segment,this.requestid=activity.requestid,0===activity.scraper.page.length&&(activity.scraper.page=".container"),this.startHeatmap(activity.scraper.page),"separated"===this.type&&this.postmate.then(parent=>{parent.emit("art_view_done",{boundaries:{left:this.heatmap.left,right:this.heatmap.right,top:this.heatmap.top,width:this.heatmap.width}})}),void 0!==this.page.segmentedcontent.title&&this.utils.setNodeInnerContent(this.page.segmentedcontent.title,activity.scraper.title),void 0!==this.page.segmentedcontent.description&&this.utils.setNodeInnerContent(this.page.segmentedcontent.description,activity.scraper.description);for(var i=0;i<activity.touchpoints.length;i++)this.designer.touchpoint(activity.touchpoints[i])},Evelean.prototype.startHeatmap=function(containerclass){this.heatmap=new Heatmap(containerclass),document.querySelector("body").onmousemove=document.querySelector("body").onmousemove=function(e){var x=e.pageX,y=e.pageY;e.touches&&(x=e.touches[0].pageX,y=e.touches[0].pageY),this.heatmap.addData("move",{x:x,y:y})}.bind(this),document.querySelector("body").onclick=function(e){var x=e.pageX,y=e.pageY;this.heatmap.addData("click",{x:x,y:y})}.bind(this),document.querySelector("body").onscroll=function(e){var doc=document.documentElement,top=(window.pageYOffset||doc.scrollTop)-(doc.clientTop||0);this.heatmap.addData("scroll",{y:top})}.bind(this)},Evelean.prototype.lead=function(e){if(!this.leadtransmitted){e.preventDefault();var form=e.target,lead={};lead.data=this.utils.getFormValues(form);var dosubmit=!0;if(null!==form.getAttribute("data-touchpoint_signature")&&(lead.touchpoint_signature=form.getAttribute("data-touchpoint_signature")),null!==form.getAttribute("data-touchpoint_id")){lead.touchpoint_id=form.getAttribute("data-touchpoint_id");const submit=document.querySelector('form[data-touchpoint_id="'+form.id+'"] input[type="submit"]');submit.setAttribute("disabled","disabled"),submit.setAttribute("data-original-value",submit.value),submit.value="Loading",dosubmit=!1}if(this.event("lead",{lead:lead}),this.leadtransmitted=!0,form.onsubmit instanceof Function&&dosubmit)form.submit();else if(dosubmit){const sub=form.querySelector('input[type="submit"]');sub?form.removeChild(sub):form.submit.parentNode&&form.submit.parentNode.removeChild(form.submit),form.submit()}}},Evelean.prototype.parseTouchpoints=function(dryrun){return this.touchpoints},Evelean.prototype.optout=function(){var el;this.archiver.setData("evelean_o",!0),document.querySelector(".eveleanoptout").innerHTML="Thank you, your preference has been recorded. Please refresh to make it active."};var Bouncer=function(){};Bouncer.prototype.getAuthCode=function(){var t=_e.archiver.getData("evelean_t"),r=_e.archiver.getData("evelean_r");null!==t?_e.token=t:null!==r?this.refreshToken(null):_e.transmitter.get(_e.api+"/api/authorize?client_id=cmc_tracking_js_1_0_0&response_type=code&state=1&scope=user&redirect_uri="+_e.api+"/api/hydrate",{"Content-Type":"application/json"},function(xhr){_e.code=JSON.parse(xhr.responseText).data,this.getToken(_e.code)}.bind(this))},Bouncer.prototype.getToken=function(code){_e.transmitter.post(_e.api+"/api/token",{"Content-Type":"application/json"},JSON.stringify({client_id:"cmc_tracking_js_1_0_0",property:_e.property,username:"anonymous",password:"an0n1m0u5",scope:"user",grant_type:"authorization_code",redirect_uri:_e.api+"/api/hydrate",code:code}),!0,function(xhr){_e.token=JSON.parse(xhr.responseText).access_token,_e.archiver.setData("evelean_t",_e.token),_e.archiver.setData("evelean_r",JSON.parse(xhr.responseText).refresh_token),_e.archiver.setData("evelean_i",JSON.parse(xhr.responseText).cmc_id)}.bind(this))},Bouncer.prototype.refreshToken=function(url,headers,body,callback){var rt=_e.archiver.getData("evelean_r");null!=rt&&"undefined"!==rt?_e.transmitter.post(_e.api+"/api/refreshToken",{"Content-Type":"application/json"},JSON.stringify({client_id:"cmc_tracking_js_1_0_0",property:_e.property,username:"anonymous",password:"an0n1m0u5",scope:"user",grant_type:"refresh_token",refresh_token:rt}),!0,function(xhr){_e.token=JSON.parse(xhr.responseText).access_token,_e.archiver.setData("evelean_t",_e.token),_e.archiver.setData("evelean_i",JSON.parse(xhr.responseText).cmc_id),null!==url&&_e.transmitter.redoCall(url,headers,body,!0,callback)}.bind(this)):this.rebootConnection(url,headers,body,callback)},Bouncer.prototype.rebootConnection=function(url,headers,body,callback){this.invalidate(),this.getAuthCode()},Bouncer.prototype.invalidate=function(){_e.token=null,_e.archiver.removeData("evelean_t"),_e.archiver.removeData("evelean_r"),_e.archiver.removeData("evelean_i")};var Designer=function(){if(!window.jQuery){var script=document.createElement("script");script.src="https://code.jquery.com/jquery-3.4.1.min.js",script.integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=",script.crossorigin="anonymous",document.getElementsByTagName("head")[0].appendChild(script)}this.touchpoints=[]};Designer.prototype.touchpoint=function(touchpoint,redone){if(window.jQuery&&window.jQuery.fn.formRender){var data=[];for(var id in touchpoint.form)data.push(touchpoint.form[id]);if(0===data.length)return console.log("evelean - touchpoint "+touchpoint.id+" has no fields, skipping"),!1;var formData=JSON.stringify(data),clearer=document.createElement("div");clearer.setAttribute("style","clear:both;");var form=document.createElement("form");if(form.setAttribute("id",touchpoint.id),form.setAttribute("action","#"),form.setAttribute("class","evelean touchpoint"),form.setAttribute("data-touchpoint_id",touchpoint.id),form.setAttribute("data-name",touchpoint.name.replace(/'/g,"\\'")+" "+touchpoint.position),form.setAttribute("data-position",touchpoint.position),null!==touchpoint.display&&(form.setAttribute("data-autoopen",touchpoint.display.autoopen),form.setAttribute("data-delay",touchpoint.display.delay),form.setAttribute("data-scroll",touchpoint.display.scroll)),-1===touchpoint.position.indexOf(".")&&-1===touchpoint.position.indexOf("#"))document.body.appendChild(form),form.classList.add(touchpoint.position);else{var p=document.querySelector(touchpoint.position);if(!p)return void console.log("evelean - touchpoint inline selector not found: "+touchpoint.position);p.innerHTML="",p.appendChild(form),form.classList.add("inline")}if(this.touchpoints.push(jQuery("#"+touchpoint.id).formRender({formData:formData})),form.appendChild(clearer.cloneNode()),null!==touchpoint.richfeatures){var rf=touchpoint.richfeatures,ci;if(rf.ribbon&&1==rf.ribbon.visible){var rb=document.createElement("div");rb.setAttribute("class","ribbon"),rb.setAttribute("style","background-image:url("+_e.dashboard+rf.ribbon.type+")"),form.querySelector("h3").appendChild(rb)}if(rf.cover&&rf.cover.video&&1==rf.cover.video.active)(ci=document.createElement("video")).setAttribute("class","cover video"),ci.setAttribute("src",_e.dashboard+rf.cover.video.url),1==rf.cover.video.autoplay&&ci.setAttribute("autoplay","true"),1==rf.cover.video.loop&&ci.setAttribute("loop","true"),1==rf.cover.video.controls&&ci.setAttribute("controls","true"),form.querySelector("p").appendChild(ci),1==rf.cover.video.muted&&(ci.setAttribute("muted","true"),ci.muted=!0);else if(rf.cover&&rf.cover.image&&1==rf.cover.image.active){var ci;(ci=document.createElement("div")).setAttribute("class","cover image"),ci.setAttribute("style","background-image:url("+_e.dashboard+rf.cover.image.url+");"+rf.cover.image.style.computed),form.querySelector("p").appendChild(ci)}}var submitlabel="send";null!==touchpoint.submit&&null!==touchpoint.submit.label&&(submitlabel=touchpoint.submit.label);var sub=document.createElement("input");sub.setAttribute("type","submit"),sub.setAttribute("name","send"),sub.setAttribute("value",submitlabel),null!==touchpoint.submit&&touchpoint.submit.style&&sub.setAttribute("style",touchpoint.submit.style),form.appendChild(sub),form.appendChild(clearer.cloneNode());var credits=document.createElement("div"),script;if(credits.setAttribute("class","credits"),credits.setAttribute("style","margin-top:10px;padding-top:10px;font-size:9px;border-top:1px solid rgba(255,255,255,0.4)"),credits.innerHTML='Powered by <a href="https://www.evelean.com" title="Artificial Intelligence Content Marketing"><img src="'+_e.api+'/img/logo_white.svg" style="margin-left:5px;height:9px"></a>',form.appendChild(credits),form.appendChild(clearer.cloneNode()),null!==touchpoint.style){var style=document.createElement("style");style.innerText=touchpoint.style.value,document.body.appendChild(style)}if(null!==touchpoint.script)(script=document.createElement("script")).innerText=touchpoint.script.value.replace(/§/g,"(").replace(/£/g,")"),document.body.appendChild(script);_e.addFormListener(form)}else if(!0!==redone){var script;if(console.log("evelean - jQuery or jQuery.formRender is not here, relaunch in seconds"),window.jQuery)console.log("jQuery is loaded, try lo load formRender"),(script=document.createElement("script")).src="https://formbuilder.online/assets/js/form-render.min.js",document.getElementsByTagName("head")[0].appendChild(script);setTimeout((function(){_e.designer.touchpoint(touchpoint,!0)}),2e3)}else console.log("evelean - jQuery or jQuery.formRender is still not here, stopping touchpoint design")},Designer.prototype.toggletouchpoint=function(form){if(form.hasClass("bottomleft")||form.hasClass("bottomright")||form.hasClass("bottom")){var t,hh3=form.find("h3").height()+18+parseInt(form.css("paddingTop").replace("px","")),bottom=form.attr("data-oh")-hh3;form.css("bottom","-"+bottom+"px"),form.hasClass("bottomright")&&jQuery("#btn-install-app").length>0&&form.css("right","160px")}else if(form.hasClass("left"))form.css("left","-"+form.attr("data-ow")+"px");else if(form.hasClass("right"))form.css("right","-"+form.attr("data-ow")+"px");else if(form.hasClass("modal")){var height=form.children(".rendered-form").height()+form.children('input[type="submit"]').height()+form.children(".credits").height()+100;form.css("height",height+"px")}form.removeClass("openform")},Designer.prototype.htmlWidget=function(widget,dashboard){let content=widget.html;if(!content||0==content.length)return void console.log("evelean - HTML Widget empty");var oldwra=document.querySelector('.evelean.wrapper[data-id="'+widget.id+'"]');oldwra&&oldwra.remove();var wra=document.createElement("div");wra.setAttribute("class","evelean wrapper html"),wra.setAttribute("data-id",widget.id),widget.hasOwnProperty("devmode")&&1==widget.devmode&&!_e.debug&&wra.setAttribute("style","display:none"),wra.innerHTML=content,this.placeInlineWidget(widget,wra,!0);let scr=wra.getElementsByTagName("script");for(let n=0;n<scr.length;n++)eval(scr[n].innerHTML)},Designer.prototype.contentWidget=function(widget,dashboard){let content=widget.content;if(!content||0==content.length)return void console.log("evelean - Content Widget empty");var oldwra=document.querySelector('.evelean.wrapper[data-id="'+widget.id+'"]');oldwra&&oldwra.remove();var wra=document.createElement("div");wra.setAttribute("class","evelean wrapper "+widget.position.type),wra.setAttribute("data-id",widget.id),widget.hasOwnProperty("devmode")&&1==widget.devmode&&!_e.debug&&wra.setAttribute("style","display:none");const con=this.drawWidgetContainer(widget,wra);if(wra.appendChild(con),"1"===widget.credits){const cre=this.drawWidgetCredits(widget,wra);wra.appendChild(cre)}if("1"===widget.slider){var slider=document.createElement("div"),sliderwrapper=document.createElement("div"),sliderid="swiper_"+(new Date).getTime();slider.setAttribute("class","swiper-container"),slider.setAttribute("id",sliderid),sliderwrapper.setAttribute("class","swiper-wrapper"),slider.appendChild(sliderwrapper)}let origin=_e.url.origin;for(var i=0;i<content.length;i++){var item=content[i];item.richfeatures.url=item.richfeatures.url.replace(origin,""),void 0!==item.richfeatures.cover&&(item.richfeatures.cover.hasOwnProperty("image")&&1==item.richfeatures.cover.image.active?item.richfeatures.cover.image.url.includes(origin)?item.richfeatures.cover.image.url=item.richfeatures.cover.image.url.replace(origin,""):item.richfeatures.cover.image.url=dashboard+item.richfeatures.cover.image.url:item.richfeatures.cover.hasOwnProperty("video")&&1==item.richfeatures.cover.video.active&&(item.richfeatures.cover.video.url.includes(origin)?item.richfeatures.cover.video.url=item.richfeatures.cover.video.url.replace(origin,""):item.richfeatures.cover.video.url=dashboard+item.richfeatures.cover.video.url));var payload={item:item,itemid:item.id,tile:widget.template,counter:i};if("1"===widget.slider)payload.slider=widget.slider;else switch(payload.class="evelean-col-1",widget.columns){case"1":payload.class="evelean-col-1";break;case"2":payload.class="evelean-col-2";break;case"3":payload.class="evelean-col-3";break;case"4":payload.class="evelean-col-4"}_e.transmitter.post(dashboard+"/misc/getTileHtml",{"Content-Type":"application/html"},JSON.stringify(payload),!0,(function(xhr){let tile=xhr.responseText;var item=null;const regex=/data-id="[a-z0-9]{24}"/gm,id=tile.match(regex)[0].slice(9,33);for(let i=0;i<content.length;i++)content[i].id===id&&(item=content[i]);if(tile=tile.replace(origin+dashboard,dashboard),item&&void 0!==item.richfeatures.distance){let lname=void 0!==item.richfeatures.custom["address-locality"]&&void 0!==item.richfeatures.custom["address-locality"].value?item.richfeatures.custom["address-locality"].value+" | ":"";tile=tile.replace("</h3>",'</h3> <p class="distance">'+lname+widget.distancelabel+" "+item.richfeatures.distance+"</p>")}"1"===widget.slider?sliderwrapper.insertAdjacentHTML("beforeend",tile):con.insertAdjacentHTML("beforeend",tile)}))}if("1"===widget.slider){var btnSliderNext=document.createElement("div");btnSliderNext.setAttribute("class","swiper-button-next");var btnSliderPrev=document.createElement("div");btnSliderPrev.setAttribute("class","swiper-button-prev"),slider.appendChild(btnSliderNext),slider.appendChild(btnSliderPrev),con.appendChild(slider)}if("sticky"==widget.position.type||"stickyleft"==widget.position.type||"stickyright"==widget.position.type){const ope=this.drawWidgetOpener(widget,wra);wra.appendChild(ope);const clo=this.drawWidgetCloser(widget,wra);wra.appendChild(clo),document.body.appendChild(wra),"delay"===widget.autoopen?setTimeout(function(){this.querySelector(".opener").click()}.bind(wra),widget.delay):"scroll"===widget.autoopen&&window.addEventListener("scroll",(function(e){this.scrollY>widget.scroll&&""===wra.style.bottom&&wra.querySelector(".opener").click()}))}else this.placeInlineWidget(widget,wra,!1);"1"===widget.slider&&this.addScript("var swiper = new Swiper('#"+sliderid+"', { loop: false, slidesPerView: "+widget.columns+", spaceBetween: 30, preventClicks: false, breakpoints: {991: { slidesPerView: 2, spaceBetween: 30},628: { slidesPerView: 1,spaceBetween: 0}}, preventClicksPropagation: false, navigation: { nextEl: '.swiper-button-next', prevEl: '.swiper-button-prev'}}); setTimeout(function(){swiper.update();}, 1500)"),this.addScript('var lazyLoadInstance = new LazyLoad({elements_selector: ".lazy"}); setTimeout(function(){lazyLoadInstance.update();}, 1500)'),this.addScript(widget.script),this.addStyle(widget.style),console.log("evelean - added widget "+widget.name+" ("+widget.id+") devmode= "+widget.devmode+" to page",wra)},Designer.prototype.placeInlineWidget=function(widget,wra,clone){var p=document.querySelectorAll(widget.position.parent);if(null!==p)switch(widget.position.where){case"replace":for(let i=0;i<p.length;i++)console.log("evelean - replacing widget",{widget:widget,element:wra,parent:p[i]}),p[i].parentNode.insertBefore(clone?wra.cloneNode(!0):wra,p[i]),p[i].remove();break;case"before":for(let i=0;i<p.length;i++)console.log("evelean - inserting widget before",{widget:widget,element:wra,parent:p[i]}),p[i].parentNode.insertBefore(clone?wra.cloneNode(!0):wra,p[i]);break;case"first":for(let i=0;i<p.length;i++)console.log("evelean - inserting widget as first child",{widget:widget,element:wra,parent:p[i]}),p[i].prepend(clone?wra.cloneNode(!0):wra);break;case"last":for(let i=0;i<p.length;i++)console.log("evelean - inserting widget as last child",{widget:widget,element:wra,parent:p[i]}),p[i].append(clone?wra.cloneNode(!0):wra);break;case"after":for(let i=0;i<p.length;i++)console.log("evelean - inserting widget after",{widget:widget,element:wra,parent:p[i]}),p[i].parentNode.insertBefore(clone?wra.cloneNode(!0):wra,p[i].nextSibling)}else console.log("evelean - can't add widget "+widget.name+" ("+widget.id+") devmode= "+widget.devmode+" to page because no parent found with class "+widget.position.parent,wra)},Designer.prototype.drawWidgetContainer=function(widget,wra){let con=document.createElement("div"),conclass="wide";"1"===widget.contain&&(conclass="contain"),con.setAttribute("class",conclass);let head=document.createElement("div");if(head.setAttribute("class","head"),widget.title.length>0){let stit=document.createElement("h2");stit.innerText=widget.title,head.appendChild(stit),con.appendChild(head)}if("geolocalized"==widget.strategy){let gl;if(!_e.utils.readGeoloc()){let sgeo=document.createElement("a");sgeo.setAttribute("class","geoloc"),sgeo.setAttribute("href","javascript:_e.utils.askGeoloc();"),sgeo.innerText=widget.geoloccta,head.appendChild(sgeo)}}return con},Designer.prototype.drawWidgetOpener=function(widget,wra){let ope=document.createElement("div");ope.setAttribute("class","opener");let opeicon=document.createElement("div");return opeicon.setAttribute("class","openicon"),ope.appendChild(opeicon),ope.addEventListener("click",function(e){if(this.classList)this.classList.toggle("isopen");else{let classes=this.className.split(" "),i=classes.indexOf("isopen");i>=0?classes.splice(i,1):classes.push("mystyle"),this.className=classes.join(" ")}"sticky"==widget.position.type&&("0px"!==this.style.bottom?this.style.bottom="0px":this.style.bottom="-"+(widget.height-widget.openerheight)+"px")}.bind(wra)),ope},Designer.prototype.drawWidgetCloser=function(widget,wra){let clo=document.createElement("div");return clo.setAttribute("class","closer"),clo.addEventListener("click",function(e){this.classList.remove("isopen"),"sticky"==widget.position.type?this.style.bottom="-"+(widget.height-widget.openerheight)+"px":"stickyright"==widget.position.type?this.style.right="-500px":"stickyleft"==widget.position.type&&(this.style.left="-500px")}.bind(wra)),clo},Designer.prototype.drawWidgetCredits=function(widget,wra){let cre=document.createElement("a");cre.setAttribute("class","credits"),cre.setAttribute("href","https://www.evelean.com"),cre.setAttribute("target","_blank");let pow=document.createElement("p");pow.innerText="Powered by";let log=document.createElement("img");return log.setAttribute("src",_e.api+"/img/logo_red.svg"),cre.appendChild(pow),cre.appendChild(log),cre},Designer.prototype.drawWidgetOptout=function(widget){let p=document.querySelector(widget.position.parent),div=document.createElement("div");div.innerHTML=widget.content.trim();let wra=div.firstChild;switch(widget.position.where){case"before":p.parentNode.insertBefore(wra,p);break;case"first":p.prepend(wra);break;case"last":p.append(wra);break;case"after":p.parentNode.insertBefore(wra,p.nextSibling)}},Designer.prototype.liveshape=function(shapers){for(let id in shapers){let shaper=shapers[id];("all"==id||shaper.hasOwnProperty("active")&&_e.url.href.indexOf(shaper.condition)>=0)&&(this.addScript(shaper.script),this.addStyle(shaper.style))}},Designer.prototype.addScript=function(script){if(script&&script.trim().length>0){let el=document.createElement("script");el.innerText=script.replace(/§/g,"(").replace(/£/g,")").replace(/(\r\n|\n|\r)/gm,""),document.body.appendChild(el)}},Designer.prototype.addStyle=function(style,id=null){if(style&&style.trim().length>0){let el,isnew=!1;id&&(el=document.getElementById(id)),el||(isnew=!0,el=document.createElement("style"),id&&el.setAttribute("id",id)),el.innerText=style,isnew&&document.body.appendChild(el)}};var Transmitter=function(){};Transmitter.prototype.get=function(url,headers,callback){let xhr=new XMLHttpRequest;xhr.open("GET",url);for(let k in headers)xhr.setRequestHeader(k,headers[k]);xhr.send(),xhr.onreadystatechange=function(){4===xhr.readyState&&(200===xhr.status?callback(xhr):401===xhr.status?_e.bouncer.refreshToken(url,headers,null,callback):xhr.status)}},Transmitter.prototype.post=function(url,headers,body,sync,onsuccess,onfailure=!1){let xhr=new XMLHttpRequest;xhr.open("POST",url,sync);for(let k in headers)xhr.setRequestHeader(k,headers[k]);xhr.send(body),xhr.onreadystatechange=function(){4===xhr.readyState&&(200===xhr.status?onsuccess(xhr):400===xhr.status&&(xhr.responseText.indexOf("Refresh token has expired")>0||xhr.responseText.indexOf("Invalid refresh token")>0)?(console.log("evelean - reboot because error 400 in post: "+xhr.responseText),_e.bouncer.rebootConnection(url,headers,body,onsuccess)):401===xhr.status?(console.log("evelean - refresh token because error 401 in post: "+xhr.responseText),_e.bouncer.refreshToken(url,headers,body,onsuccess)):0===xhr.status||"function"==typeof onfailure&&onfailure(xhr))}},Transmitter.prototype.send=function(url,headers,body,sync,callback){if("sendBeacon"in navigator){let status=navigator.sendBeacon(url,body)}else this.post(url,headers,body,sync,callback)},Transmitter.prototype.redoCall=function(url,headers,body,sync,callback){headers.Authorization&&(headers.Authorization="Bearer "+_e.token),null===body?this.get(url,headers,callback):this.post(url,headers,body,sync,callback)};var Archiver=function(s){if(null==s)s=!0===this.lsTest()?"ls":"ck",this.storage=s;else if("object"==typeof s&&!Array.isArray(s))for(const[k,v]of Object.entries(s))this[k]=v};Archiver.prototype.lsTest=function(){let test="test";try{return localStorage.setItem(test,test),localStorage.removeItem(test),!0}catch(e){return!1}},Archiver.prototype.setData=function(k,v){"ls"==this.storage?localStorage.setItem(k,v):"ck"==this.storage&&this.setCookie(k,v,30)},Archiver.prototype.getData=function(k){return"ls"==this.storage?localStorage.getItem(k):"ck"==this.storage?this.getCookie(k):void 0},Archiver.prototype.removeData=function(k){"ls"==this.storage?localStorage.removeItem(k):"ck"==this.storage&&this.removeCookie(k)},Archiver.prototype.setCookie=function(k,v,d){let date=new Date;date.setTime(date.getTime()+24*d*60*60*1e3),document.cookie=k+"="+v+"; expires="+date.toGMTString()},Archiver.prototype.getCookie=function(k){let name=k+"=",cc=document.cookie.split(";");for(let i=0;i<cc.length;i++){let temp=cc[i].trim();if(0==temp.indexOf(name))return temp.substring(name.length,temp.length)}return""},Archiver.prototype.removeCookie=function(k){document.cookie=k+"=; expires=Thu, 01 Jan 1970 00:00:01 GMT;"};var Heatmap=function(containerclass){this.mindelta=1,this.click=[],this.tclick=0,this.move=[],this.tmove=0,this.scroll=[],this.tscroll=0,this.maxscroll=0,this.dw=document.documentElement.scrollWidth,this.dh=document.documentElement.scrollHeight,this.container=document.querySelector(containerclass),this.setBoundaries(),window.onresize=function(event){this.setBoundaries()}.bind(this)};Heatmap.prototype.addData=function(scope,data){let tdata=this.trim(data);!1!==tdata&&(tdata.w=TimeMe.getTimeOnCurrentPageInSeconds("main"),tdata.w-this["t"+scope]>this.mindelta&&(this["t"+scope]=tdata.w,this[scope].push(tdata),"scroll"===scope&&tdata.y>this.maxscroll&&(this.maxscroll=tdata.y)))},Heatmap.prototype.getData=function(){return{dw:this.dw,dh:this.dh,click:this.click,move:this.move,scroll:this.scroll,maxscroll:this.maxscroll}},Heatmap.prototype.setBoundaries=function(){if(null!==this.container){let viewportOffset=this.container.getBoundingClientRect();this.left=viewportOffset.left,this.width=viewportOffset.width,this.right=viewportOffset.left+viewportOffset.width,this.top=0,null!==document.getElementById("ccm-toolbar")&&(this.top=document.getElementById("ccm-toolbar").clientHeight)}},Heatmap.prototype.trim=function(data){return data.x<this.left||data.x>this.right?data=!1:data.hasOwnProperty("x")&&(data.x=data.x-this.left),data.y<this.top?data=!1:data.hasOwnProperty("y")&&(data.y=data.y-this.top),data},Heatmap.prototype.showheatmap=function(data){let hc=document.querySelector(".heatmapContainer"),btn=document.querySelector("li.ccm-evelean-article-heatmap > div");if(null===hc){let body=document.body,html=document.documentElement,height=Math.max(body.scrollHeight,body.offsetHeight,html.clientHeight,html.scrollHeight,html.offsetHeight);hc=document.createElement("div"),document.body.appendChild(hc),hc.classList.add("heatmapContainer"),hc.style.left=this.left+"px",hc.style.top=this.top+"px",hc.style.width=this.width+"px",hc.style.height=height-this.top+"px";let heatmap=h337.create({container:hc,radius:100,maxOpacity:.5,minOpacity:0,blur:.75}),move=HEATMAPS.move.flat();for(var i=0;i<move.length;i++)move[i].value=5;heatmap.setData({max:5,data:move}),hc.style.position="absolute";let mscroll=HEATMAPS.maxscroll.flat(),mean=_e.utils.mean(mscroll),meanhc=document.createElement("div");document.body.appendChild(meanhc),meanhc.classList.add("scrollIndicator"),meanhc.classList.add("mean"),meanhc.style.left=this.left+"px",meanhc.style.top=this.top+mean+"px",meanhc.style.width=this.width+"px";let median=_e.utils.median(mscroll),medianhc=document.createElement("div");document.body.appendChild(medianhc),medianhc.classList.add("scrollIndicator"),medianhc.classList.add("median"),medianhc.style.left=this.left+"px",medianhc.style.top=this.top+median+"px",medianhc.style.width=this.width+"px",btn.classList.add("active")}else"none"===hc.style.display?(hc.style.display="block",document.querySelector(".mean").style.display="block",document.querySelector(".median").style.display="block",btn.classList.add("active")):(hc.style.display="none",document.querySelector(".mean").style.display="none",document.querySelector(".median").style.display="none",btn.classList.remove("active"))};var Utils=function(){};Utils.prototype.MD5=function(d){let result;return this.M(this.V(this.Y(this.X(d),8*d.length))).toLowerCase()},Utils.prototype.M=function(d){for(var _,m="0123456789ABCDEF",f="",r=0;r<d.length;r++)_=d.charCodeAt(r),f+=m.charAt(_>>>4&15)+m.charAt(15&_);return f},Utils.prototype.X=function(d){for(var _=Array(d.length>>2),m=0;m<_.length;m++)_[m]=0;for(m=0;m<8*d.length;m+=8)_[m>>5]|=(255&d.charCodeAt(m/8))<<m%32;return _},Utils.prototype.V=function(d){for(var _="",m=0;m<32*d.length;m+=8)_+=String.fromCharCode(d[m>>5]>>>m%32&255);return _},Utils.prototype.Y=function(d,_){d[_>>5]|=128<<_%32,d[14+(_+64>>>9<<4)]=_;for(var m=1732584193,f=-271733879,r=-1732584194,i=271733878,n=0;n<d.length;n+=16){var h=m,t=f,g=r,e=i;f=this.md5_ii(f=this.md5_ii(f=this.md5_ii(f=this.md5_ii(f=this.md5_hh(f=this.md5_hh(f=this.md5_hh(f=this.md5_hh(f=this.md5_gg(f=this.md5_gg(f=this.md5_gg(f=this.md5_gg(f=this.md5_ff(f=this.md5_ff(f=this.md5_ff(f=this.md5_ff(f,r=this.md5_ff(r,i=this.md5_ff(i,m=this.md5_ff(m,f,r,i,d[n+0],7,-680876936),f,r,d[n+1],12,-389564586),m,f,d[n+2],17,606105819),i,m,d[n+3],22,-1044525330),r=this.md5_ff(r,i=this.md5_ff(i,m=this.md5_ff(m,f,r,i,d[n+4],7,-176418897),f,r,d[n+5],12,1200080426),m,f,d[n+6],17,-1473231341),i,m,d[n+7],22,-45705983),r=this.md5_ff(r,i=this.md5_ff(i,m=this.md5_ff(m,f,r,i,d[n+8],7,1770035416),f,r,d[n+9],12,-1958414417),m,f,d[n+10],17,-42063),i,m,d[n+11],22,-1990404162),r=this.md5_ff(r,i=this.md5_ff(i,m=this.md5_ff(m,f,r,i,d[n+12],7,1804603682),f,r,d[n+13],12,-40341101),m,f,d[n+14],17,-1502002290),i,m,d[n+15],22,1236535329),r=this.md5_gg(r,i=this.md5_gg(i,m=this.md5_gg(m,f,r,i,d[n+1],5,-165796510),f,r,d[n+6],9,-1069501632),m,f,d[n+11],14,643717713),i,m,d[n+0],20,-373897302),r=this.md5_gg(r,i=this.md5_gg(i,m=this.md5_gg(m,f,r,i,d[n+5],5,-701558691),f,r,d[n+10],9,38016083),m,f,d[n+15],14,-660478335),i,m,d[n+4],20,-405537848),r=this.md5_gg(r,i=this.md5_gg(i,m=this.md5_gg(m,f,r,i,d[n+9],5,568446438),f,r,d[n+14],9,-1019803690),m,f,d[n+3],14,-187363961),i,m,d[n+8],20,1163531501),r=this.md5_gg(r,i=this.md5_gg(i,m=this.md5_gg(m,f,r,i,d[n+13],5,-1444681467),f,r,d[n+2],9,-51403784),m,f,d[n+7],14,1735328473),i,m,d[n+12],20,-1926607734),r=this.md5_hh(r,i=this.md5_hh(i,m=this.md5_hh(m,f,r,i,d[n+5],4,-378558),f,r,d[n+8],11,-2022574463),m,f,d[n+11],16,1839030562),i,m,d[n+14],23,-35309556),r=this.md5_hh(r,i=this.md5_hh(i,m=this.md5_hh(m,f,r,i,d[n+1],4,-1530992060),f,r,d[n+4],11,1272893353),m,f,d[n+7],16,-155497632),i,m,d[n+10],23,-1094730640),r=this.md5_hh(r,i=this.md5_hh(i,m=this.md5_hh(m,f,r,i,d[n+13],4,681279174),f,r,d[n+0],11,-358537222),m,f,d[n+3],16,-722521979),i,m,d[n+6],23,76029189),r=this.md5_hh(r,i=this.md5_hh(i,m=this.md5_hh(m,f,r,i,d[n+9],4,-640364487),f,r,d[n+12],11,-421815835),m,f,d[n+15],16,530742520),i,m,d[n+2],23,-995338651),r=this.md5_ii(r,i=this.md5_ii(i,m=this.md5_ii(m,f,r,i,d[n+0],6,-198630844),f,r,d[n+7],10,1126891415),m,f,d[n+14],15,-1416354905),i,m,d[n+5],21,-57434055),r=this.md5_ii(r,i=this.md5_ii(i,m=this.md5_ii(m,f,r,i,d[n+12],6,1700485571),f,r,d[n+3],10,-1894986606),m,f,d[n+10],15,-1051523),i,m,d[n+1],21,-2054922799),r=this.md5_ii(r,i=this.md5_ii(i,m=this.md5_ii(m,f,r,i,d[n+8],6,1873313359),f,r,d[n+15],10,-30611744),m,f,d[n+6],15,-1560198380),i,m,d[n+13],21,1309151649),r=this.md5_ii(r,i=this.md5_ii(i,m=this.md5_ii(m,f,r,i,d[n+4],6,-145523070),f,r,d[n+11],10,-1120210379),m,f,d[n+2],15,718787259),i,m,d[n+9],21,-343485551),m=this.safe_add(m,h),f=this.safe_add(f,t),r=this.safe_add(r,g),i=this.safe_add(i,e)}return Array(m,f,r,i)},Utils.prototype.md5_cmn=function(d,_,m,f,r,i){return this.safe_add(this.bit_rol(this.safe_add(this.safe_add(_,d),this.safe_add(f,i)),r),m)},Utils.prototype.md5_ff=function(d,_,m,f,r,i,n){return this.md5_cmn(_&m|~_&f,d,_,r,i,n)},Utils.prototype.md5_gg=function(d,_,m,f,r,i,n){return this.md5_cmn(_&f|m&~f,d,_,r,i,n)},Utils.prototype.md5_hh=function(d,_,m,f,r,i,n){return this.md5_cmn(_^m^f,d,_,r,i,n)},Utils.prototype.md5_ii=function(d,_,m,f,r,i,n){return this.md5_cmn(m^(_|~f),d,_,r,i,n)},Utils.prototype.safe_add=function(d,_){var m=(65535&d)+(65535&_);return(d>>16)+(_>>16)+(m>>16)<<16|65535&m},Utils.prototype.bit_rol=function(d,_){return d<<_|d>>>32-_},Utils.prototype.isObject=function(item){return item&&"object"==typeof item&&!Array.isArray(item)},Utils.prototype.mergeDeep=function(target,source){let output=Object.assign({},target);return this.isObject(target)&&this.isObject(source)&&Object.keys(source).forEach(key=>{this.isObject(source[key])&&key in target?output[key]=this.mergeDeep(target[key],source[key]):Object.assign(output,{[key]:source[key]})}),output},Utils.prototype.askGeoloc=function(){if(_e.forcedgeoloc)return!1;navigator.geolocation.getCurrentPosition(pos=>{_e.geoloc=pos,_e.event("geoloc_content")},err=>{console.log("evelean - geolocation is forbidden by user");var a=document.querySelector(".head a.geoloc");a&&(a.innerText="Unable to retrieve geolocation, please correct browser's privileges"),_e.geoloc=err})},Utils.prototype.readAttribution=function(){let searchParams,s,m,c,gclid,fbclid,attr;if("URLSearchParams"in window)searchParams=new URLSearchParams(window.location.search),s=searchParams.get("utm_source"),m=searchParams.get("utm_medium"),c=searchParams.get("utm_campaign"),t=searchParams.get("utm_term"),gclid=searchParams.get("gclid"),gclid&&(m="Google Ads"),fbclid=searchParams.get("fbclid"),fbclid&&(m="Facebook Ads");else{let sPageURL=window.location.search.substring(1);searchParams=window.location.search.substring(1).split("&");for(let i=0;i<searchParams.length;i++){let searchParam=searchParams[i].split("=");"utm_source"===searchParam[0]?s=decodeURIComponent(searchParam[1]):"utm_medium"===searchParam[0]?m=decodeURIComponent(searchParam[1]):"utm_campaign"===searchParam[0]?c=decodeURIComponent(searchParam[1]):"utm_term"===searchParam[0]&&(t=decodeURIComponent(searchParam[1])),"gclid"===searchParam[0]&&(m="Google Ads",gclid=decodeURIComponent(searchParam[1])),"fbclid"===searchParam[0]&&(m="Facebook Ads",fbclid=decodeURIComponent(searchParam[1]))}}return Object.fromEntries(Object.entries({utm_source:s,utm_medium:m,utm_campaign:c,utm_term:t,gclid:gclid,fbclid:fbclid}).filter(([_,v])=>null!=v))},Utils.prototype.readGeoloc=function(){if("https:"!==location.protocol)return!1;switch(_e.geoloc){case null:return!1;default:if(_e.geoloc instanceof GeolocationPositionError)return!1;if(_e.geoloc instanceof GeolocationPosition)return{latitude:_e.geoloc.coords.latitude,longitude:_e.geoloc.coords.longitude};if(_e.forcedgeoloc)return _e.geoloc}},Utils.prototype.scrapePage=function(config){var pagePath=decodeURIComponent(window.location.href),data={title:this.getNodeInnerContent(config.title,"text"),content:this.getNodeInnerContent(config.content,"html"),description:this.getNodeInnerContent(config.description,"text"),type:"post",template:"3_article",metatitle:document.title,metadescription:this.getMetaDescription(),status:"public",listable:1,trackable:1,url:pagePath,slug:pagePath.split("/").pop().split("#")[0].split("?")[0].split(".")[0],handle:pagePath.split("/").pop().split("#")[0].split("?")[0],authorName:this.getNodeInnerContent(config.author,"text"),files:[]},lo=document.documentElement.lang;if(null!==lo&&lo.length>0&&(data.language=lo.split("-")[0]),""===location.pathname||"/"===location.pathname)data.type="homepage",data.template="1_homepage",data.listable=0;else if(config.template){var t=this.scrapeTemplate(config.template);data.type=t.type,data.template=t.template}for(var c=document.createRange().createContextualFragment(data.content),forms=c.querySelectorAll("form"),i=0;i<forms.length;i++){var form=forms[i],placeholder="";if(form.getAttribute("action").length>0?placeholder=config.content+' form[action="'+form.getAttribute("action")+'"]':form.id.length>0?placeholder=config.content+" form#"+form.id:form.getAttribute("class").length>0&&(placeholder=config.content+" form."+form.getAttribute("class").split(" ").join(".")),placeholder.length>0){var snippet=document.createElement("span");snippet.setAttribute("class","ccm-content-editor-snippet"),snippet.setAttribute("contenteditable","false"),snippet.setAttribute("data-scshandle","touchpoint_area"),snippet.textContent=placeholder,form.after(snippet)}form.remove()}if(config.contentshaper){var shapers=config.contentshaper[data.template];if(shapers)for(var i=0;i<shapers.length;i++)c=this.shapeContent(c,shapers[i])}const serializer=new XMLSerializer;return data.content=serializer.serializeToString(c).split(' xmlns="http://www.w3.org/1999/xhtml"').join(""),data},Utils.prototype.scrapeTemplate=function(config){for(var loc=location.pathname,i=0;i<config.length;i++){var cond=config[i];cond.rule||(cond.rule="");var rules=cond.rule.split(",");for(let k=0;k<rules.length;k++){var rule=rules[k].trim();if(this.validateQuery(rule)||loc.indexOf(rule)>=0)return{template:cond.template,type:cond.type}}}},Utils.prototype.validateQuery=function(str){try{if(null!=document.querySelector(str))return!0}catch(e){}return!1},Utils.prototype.shapeContent=function(c,shaper){var fromnode=c.querySelectorAll(shaper.fromnode);for(let j=0;j<fromnode.length;j++){var snippet=document.createElement(shaper.tonode),insertat=null;snippet.setAttribute("class",shaper.class),snippet[shaper.fromcontent]=fromnode[j][shaper.fromcontent],shaper.insertat&&0==shaper.insertat.length?insertat=fromnode[j]:(insertat=fromnode[j].closest(shaper.insertat))||(insertat=fromnode[j]),insertat.after(snippet),insertat.remove()}return c},Utils.prototype.scrapeContentImages=function(){var c=document.createRange().createContextualFragment(_e.page.content),imgs=c.querySelectorAll("img");if(imgs.length>0){var domain=window.location.href.split("/");domain=domain[0]+"//"+domain[2];for(var i=0;i<imgs.length;i++){var img=imgs[i],src=this.cleanSrc(img.src,domain);img.src=src,_e.page.files.push({type:"Image",url:src,filename:src.split("/").pop(),alt:img.getAttribute("alt")?img.getAttribute("alt"):"",title:img.getAttribute("title")?img.getAttribute("title"):"",extension:this.getExtension(src),status:1})}const serializer=new XMLSerializer;_e.page.content=serializer.serializeToString(c).split(' xmlns="http://www.w3.org/1999/xhtml"').join("")}},Utils.prototype.scrapeGalleries=function(config){if(config.gallery){var domain=window.location.href.split("/");domain=domain[0]+"//"+domain[2];var c,inside=document.createRange().createContextualFragment(_e.page.content).querySelectorAll(config.gallery.container);if(inside.length>0)return void this.scrapeGalleriesByContext(config,inside,domain,"inner");var outside=document.querySelectorAll(config.gallery.container);outside.length>0&&this.scrapeGalleriesByContext(config,outside,domain,"outer")}},Utils.prototype.scrapeGalleriesByContext=function(config,galleries,domain,context){for(var files=[],skip=[],skipfound=0,i=0;i<galleries.length;i++){gallery=galleries[i];var hash=this.MD5(gallery),images=gallery.querySelectorAll(config.gallery.image);if(-1===config.gallery.image.indexOf("["))return void console.log("evelean - gallery scraping stopped: the selector "+config.gallery.image+" doesn't point to an attribute");for(var attr=this.getAttributeFromQuery(config.gallery.image),k=0;k<images.length;k++){var f=this.getGroupedFileByAttr(images[k],attr,domain,hash);f?files.push(f):skip.push(k)}files=this.getGroupedFileDesc(gallery,config.gallery.desc,skip,0,files),_e.page.files=_e.page.files.concat(files);var snippet=document.createElement("span");if(snippet.setAttribute("class","ccm-content-editor-snippet"),snippet.setAttribute("contenteditable","false"),snippet.setAttribute("data-scshandle","foto_gallery"),snippet.textContent=hash+":slideshow:cmc_regular","inner"===context){var c=document.createRange().createContextualFragment(_e.page.content),gallerynode=c.querySelectorAll(config.gallery.container);for(j=0;j<gallerynode.length;j++)gallerynode[j].after(snippet),gallerynode[j].remove();const serializer=new XMLSerializer;_e.page.content=serializer.serializeToString(c).split(' xmlns="http://www.w3.org/1999/xhtml"').join("")}else _e.page.content+=snippet.outerHTML}},Utils.prototype.scrapeFileList=function(config){if(config.filelist){var domain=window.location.href.split("/");domain=domain[0]+"//"+domain[2];var c,inside=document.createRange().createContextualFragment(_e.page.content).querySelectorAll(config.filelist.container);if(inside.length>0)return void this.scrapeFileListsByContext(config,inside,domain,"inner");var outside=document.querySelectorAll(config.filelist.container);outside.length>0&&this.scrapeFileListsByContext(config,outside,domain,"outer")}},Utils.prototype.scrapeFileListsByContext=function(config,filelists,domain,context){for(var files=[],skip=[],skipfound=0,i=0;i<filelists.length;i++){filelist=filelists[i];var hash=this.MD5(filelist),filesinlist=filelist.querySelectorAll(config.filelist.file);if(-1===config.filelist.file.indexOf("["))return void console.log("evelean - filelist scraping stopped: the selector "+config.filelist.file+" doesn't point to an attribute");for(var attr=this.getAttributeFromQuery(config.filelist.file),k=0;k<filesinlist.length;k++){var f=this.getGroupedFileByAttr(filesinlist[k],attr,domain,hash);f?files.push(f):skip.push(k)}files=this.getGroupedFileDesc(filelist,config.filelist.desc,skip,0,files),_e.page.files=_e.page.files.concat(files);var snippet=document.createElement("span");if(snippet.setAttribute("class","ccm-content-editor-snippet"),snippet.setAttribute("contenteditable","false"),snippet.setAttribute("data-scshandle","file_list"),snippet.textContent=hash+":list","inner"===context){var c=document.createRange().createContextualFragment(_e.page.content),filelistnode=c.querySelectorAll(config.filelist.container);for(j=0;j<filelistnode.length;j++)filelistnode[j].after(snippet),filelistnode[j].remove();const serializer=new XMLSerializer;_e.page.content=serializer.serializeToString(c).split(' xmlns="http://www.w3.org/1999/xhtml"').join("")}else _e.page.content+=snippet.outerHTML}},Utils.prototype.getGroupedFileByAttr=function(file,attr,domain,hash){var src=file.getAttribute(attr);if("style"===attr&&(src=this.getBackgroundImage(file)),""===src)return null;var src=this.cleanSrc(src,domain);this.removeFileByURL(src);var ext=this.getExtension(src);return{type:this.getTypeByExtension(ext),url:src,filename:src.split("/").pop(),extension:ext,tag:hash,status:1}},Utils.prototype.getGroupedFileDesc=function(container,qs,skip,skipfound,files){var descs=container.querySelectorAll(qs);if(qs.indexOf("[")>-1)for(var attr=this.getAttributeFromQuery(qs),k=0;k<descs.length;k++)if(skip.indexOf(k)>0)skipfound++;else{var desc=descs[k];files[k-skipfound].caption=desc.getAttribute(attr)}else for(var k=0;k<descs.length;k++)if(skip.indexOf(k)>0)skipfound++;else{var desc=descs[k];files[k-skipfound].caption=desc.innerHTML}return files},Utils.prototype.scrapePublishdate=function(config){var publishdate=new Date(document.lastModified).toISOString();if(config.publishdate)if(moment){var pdw=document.querySelector(config.publishdate),pd;if(pdw&&(pd=pdw.innerText),pd&&config.publishdateformat)try{var mpd;publishdate=moment(pd,config.publishdateformat).format("YYYY-MM-DD HH:mm:ss")}catch(e){console.log("evelean - error while parsing "+config.publishdate+" with format "+config.publishdateformat+" -> "+e.message)}}else console.log("evelean - moment.js is still not here, cannot scrape publishdate");return publishdate},Utils.prototype.scrapeCustoms=function(config){var customs=config.custom;if(void 0!==customs&&0!==Object.keys(customs).length){_e.page.custom={};for(const[key,value]of Object.entries(customs)){var article_type="",customValue="",customtype="",customlabel="",overwrite="",data="";if((article_type=customs[key].article_type)==_e.page.type){customtype=customs[key].customtype,customlabel=customs[key].customlabel,null==(overwrite=customs[key].overwrite)&&(overwrite="0");var selectors=customs[key].rules.split(",");for(let k=0;k<selectors.length;k++){var selector=selectors[k].trim();if(this.validateQuery(selector)){var selectorElement=document.querySelector(selector);if((customValue=null!=selectorElement.value?selectorElement.value:selectorElement.innerText).length>0){data={value:customValue,type:customtype,label:customlabel,overwrite:overwrite},_e.page.custom[customs[key].custom]=data;break}}}}}}},Utils.prototype.scrapeCover=function(config){var selectors=config.image.split(","),domain=window.location.href.split("/");domain=domain[0]+"//"+domain[2];for(var k=0;k<selectors.length;k++){var selector=selectors[k].trim(),images=document.querySelectorAll(selector);if(0!==images.length){for(var data,max=0,i=0;i<images.length;i++){var image=images[i],tagname=image.tagName.toLowerCase(),area=image.clientWidth*image.clientHeight,src="";if(selector.indexOf("[")>=0){var attr=this.getAttributeFromQuery(selector);src="style"===attr?this.getBackgroundImage(image):image.getAttribute(attr)}else src="img"===tagname?image.src:this.getBackgroundImage(image);if(""!==src&&src){src=this.cleanSrc(src,domain);var extension=this.getExtension(src);if("svg"!==extension&&void 0!==extension&&area>=max&&(max=area,data={type:"Image",url:src,filename:src.split("/").pop(),extension:extension,status:1},"img"===tagname)){var al=image.getAttribute("alt");null!==al&&al.length>0&&(data.alt=al);var ti=image.getAttribute("title");null!==ti&&ti.length>0&&(data.title=ti)}}}if(void 0!==data){_e.page.richfeatures={},_e.page.richfeatures.cover={},_e.page.richfeatures.cover.image=data;for(var found=!1,z=0;z<_e.page.files.length;z++)if(_e.page.files[z].url==data.url){found=!0;break}found||_e.page.files.push(data)}}}},Utils.prototype.scrapeForm=function(form){for(var data={name:"",status:"public",goal:"service",location:window.location.href,form:{}},signature=[],eell=form.elements,index=0,i=0;i<eell.length;i++){var el=eell[i];if(el.name){var eld={};eld.name=el.getAttribute("name");var cn=el.getAttribute("class");null!==cn&&cn.length>0&&(eld.className=cn);var ph=el.getAttribute("placeholder");if(null!==ph&&ph.length>0&&(eld.placeholder=ph),el.id.length>0){var l=document.querySelectorAll('[for="'+el.id+'"]');1===l.length&&(eld.label=l[0].innerText)}switch(el.tagName){case"INPUT":var va;if("hidden"===el.getAttribute("type"))eld.type="hidden",null!==(va=el.getAttribute("value"))&&va.length>0&&(eld.value=va);else if("checkbox"===el.getAttribute("type")||"radio"===el.getAttribute("type")){"radio"===el.getAttribute("type")?eld.type="checkbox-group":"radio"===el.getAttribute("type")&&(eld.type="radio-group"),eld.values=[];var value={},va;null!==(va=el.getAttribute("value"))&&va.length>0&&(value.value=va),el.checked&&(value.selected=!0),null!==eld.label&&(value.label=eld.label,delete eld.label);var prev=data.form[Object.keys(data.form).length-1];if(void 0===prev)eld.values.push(value);else{if(prev.type===eld.type&&prev.name===eld.name){prev.values.push(value);continue}eld.values.push(value)}}else{if("submit"===el.getAttribute("type"))continue;var va;eld.type="text",eld.subtype=el.getAttribute("type"),null!==(va=el.getAttribute("value"))&&va.length>0&&(eld.value=va)}break;case"TEXTAREA":var va;null!==(va=el.value)&&va.length>0&&(eld.value=va);break;case"SELECT":var values=[];for(var opti in el.options){var opt=el.options[opti];if("OPTION"===opt.tagName){var value={value:opt.getAttribute("value"),label:opt.innerText};values.push(value)}}eld.values=values}data.form[index]=eld,index++,signature.push({tagName:el.tagName,type:el.getAttribute("type")})}}var name=this.MD5(JSON.stringify(signature));return data.name=name,data.signature=name,data},Utils.prototype.getAttributeFromQuery=function(qs){var qsa=qs.split("[");return qsa[qsa.length-1].replace("]","")},Utils.prototype.removeFileByURL=function(src){for(var z=0;z<_e.page.files.length;z++){var f;_e.page.files[z].url==src&&_e.page.files.splice(z,1)}},Utils.prototype.getExtension=function(src){return/(?:\.([^.]+))?$/.exec(src.split("/").pop())[1]},Utils.prototype.getBackgroundImage=function(image){var style;return(image.currentStyle||window.getComputedStyle(image,!1)).backgroundImage.slice(4,-1).replace(/"/g,"")},Utils.prototype.cleanSrc=function(src,domain){return(src=src.split("#")[0].split("?")[0]).indexOf("http")<0&&(src=domain+src),src},Utils.prototype.getTypeByExtension=function(ext){var image,document=["doc","docx","pdf","ppt","pptx","xls","xlsx"],video=["mp4"];return["jpg","jpeg","gif","png"].indexOf(ext.toLowerCase())>=0?"Image":document.indexOf(ext.toLowerCase())>=0?"Document":video.indexOf(ext.toLowerCase())>=0?"Video":void 0},Utils.prototype.getFormValues=function(form){var data={};if(null!==form.getAttribute("data-touchpoint_signature"))for(var eell=form.elements,i=0;i<eell.length;i++){var el=eell[i];if(el.name)switch(el.tagName){case"INPUT":if("checkbox"===el.getAttribute("type")||"radio"===el.getAttribute("type"))void 0===data[el.name]&&(data[el.name]=[]),el.checked&&data[el.name].push(el.value);else{if("submit"===el.getAttribute("type"))continue;data[el.name]=el.value}break;case"TEXTAREA":case"SELECT":data[el.name]=el.value}}else if(null!==form.getAttribute("data-touchpoint_id")){var fri;for(var id in _e.designer.touchpoints){var instance=_e.designer.touchpoints[id],container;if(instance.instanceContainers[0]===form){fri=instance;break}}if(null!==fri){userdata=fri.userData;var standardfields=["text","hidden","select","radio-group","textarea"];for(i=0;i<userdata.length;i++){var field=userdata[i];if(void 0!==field.name){var keystring=field.name.replace(/\[\]/g,""),keys=field.name.replace(/\[\]/g,"").replace(/\]/g,"").split(/\[/);if(standardfields.indexOf(field.type)>=0)void 0===field.userData&&(field.userData=[""]),data=this.buildNestedObject(data,keys,field.userData[0]);else if("checkbox-group"===field.type){for(var value=[],k=0;k<field.values.length;k++){var cv=field.values[k].value;void 0!==field.userData&&field.userData.indexOf(cv)>=0&&value.push(cv)}Array.isArray(value)&&"1"===value[0]&&(value="1"),data=this.buildNestedObject(data,keys,value)}}}}}return data},Utils.prototype.buildNestedObject=function(parent,keys,value){var key=keys.shift();return parent.hasOwnProperty(key)||(parent[key]={}),0===keys.length?Array.isArray(parent[key])&&("string"==typeof value||value instanceof String)?parent[key].push(value):Array.isArray(parent[key])&&Array.isArray(value)?parent[key]=parent[key].concat(value):parent[key]=value:parent[key]=this.buildNestedObject(parent[key],keys,value),parent},Utils.prototype.setNodeInnerContent=function(title,selectors){for(var selectors=selectors.split(","),k=0;k<selectors.length;k++){var selector=selectors[k],ti=document.querySelector(selector);if(null!==ti)return ti.innerText=title,!0}return!1},Utils.prototype.getNodeInnerContent=function(selectors,type){for(var selectors=selectors.split(","),k=0;k<selectors.length;k++){var selector=selectors[k];if("string"==typeof selector){selector=selector.split('"').join("'");var ti=document.querySelector(selector);if(null!==ti&&"text"===type)return ti.innerText;if(null!==ti&&"html"===type)return ti.innerHTML}}return""},Utils.prototype.getMetaDescription=function(){var meta=document.getElementsByTagName("meta");for(var i in meta)if(typeof meta[i]==typeof{}&&"description"===meta[i].name.toLowerCase())return meta[i].content;return""},Utils.prototype.isMobile=function(){return!!/Mobi|Android/.test(navigator.userAgent)},Utils.prototype.getDevice=function(){return navigator.userAgent.indexOf("iPad")>-1?"iPad":navigator.userAgent.indexOf("iPhone")>-1?"iPhone":navigator.userAgent.indexOf("Huawei")>-1?"Huawei":navigator.userAgent.indexOf("SAMSUNG")>-1?"Samsung":!1===this.isMobile()?"Desktop":"unknown"},Utils.prototype.getBrowser=function(){return/Mobi|Android/.test(navigator.userAgent)&&/SamsungBrowser/.test(navigator.userAgent)?"Samsung Browser":window.chrome?"Chrome":!document.documentMode&&window.StyleMedia||/Edge/.test(navigator.userAgent)?"Microsoft Edge":document.documentMode?"Internet Explorer":"undefined"!=typeof InstallTrigger?"Firefox":window.opr&&window.opr.addons||window.opera||navigator.userAgent.indexOf(" OPR/")>=0?"Opera":/constructor/i.test(window.HTMLElement)||"[object SafariRemoteNotification]"===(p=!window.safari||safari.pushNotification).toString()?"Safari":void 0;var p},Utils.prototype.getOs=function(){var os;if(/Mobi|Android/.test(navigator.userAgent))if(/Windows/.test(navigator.userAgent))os="Windows",/Phone 8.0/.test(navigator.userAgent)?os+=" Phone 8.0":/Phone 10.0/.test(navigator.userAgent)&&(os+=" Phone 10.0");else if(/Android/.test(navigator.userAgent)){function androidVersion(){if(/Android/.test(navigator.appVersion)){var v=navigator.appVersion.match(/Android (\d+).(\d+)/);return v||(v=navigator.appVersion.match(/Android (\d+)/)),v}}var ver;os=(ver=androidVersion())[0]}else if(/iPhone;/.test(navigator.userAgent)){function iOSversion(){if(/iP(hone|od|ad)/.test(navigator.appVersion)){var v=navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/);return[parseInt(v[1],10),parseInt(v[2],10),parseInt(v[3]||0,10)]}}var ver;os="iOS "+(ver=iOSversion())[0]+"."+ver[1]+"."+ver[2]}else if(/iPad;/.test(navigator.userAgent)){function iOSversion(){if(/iP(hone|od|ad)/.test(navigator.appVersion)){var v=navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/);return[parseInt(v[1],10),parseInt(v[2],10),parseInt(v[3]||0,10)]}}var ver;os="iOS "+(ver=iOSversion())[0]+"."+ver[1]+"."+ver[2]}else/BBd*/.test(navigator.userAgent)&&(os="BlackBerry");else/Macintosh/.test(navigator.userAgent)?(os="Macintosh",/OS X/.test(navigator.userAgent)&&(os+=" OS X")):/Windows/.test(navigator.userAgent)?(os="Windows",/5.1;/.test(navigator.userAgent)?os+=" XP":/6.0;/.test(navigator.userAgent)?os+=" Vista":/6.1;/.test(navigator.userAgent)?os+=" 7":/6.2/.test(navigator.userAgent)?os+=" 8":/10.0;/.test(navigator.userAgent)&&(os+=" 10"),/64/.test(navigator.userAgent)?os+=" 64-bit":os+=" 32-bit"):navigator.userAgent.indexOf("Linux")>-1&&(os="Linux");return os},Utils.prototype.mode=function(numbers){var modes=[],count=[],i,number,maxIndex=0;for(i=0;i<numbers.length;i+=1)count[number=numbers[i]]=(count[number]||0)+1,count[number]>maxIndex&&(maxIndex=count[number]);for(i in count)count.hasOwnProperty(i)&&count[i]===maxIndex&&modes.push(Number(i));return modes},Utils.prototype.median=function(numbers){var median=0,numsLen=numbers.length;return numbers.sort(),median=numsLen%2==0?(numbers[numsLen/2-1]+numbers[numsLen/2])/2:numbers[(numsLen-1)/2]},Utils.prototype.mean=function(numbers){var total=0,i;for(i=0;i<numbers.length;i+=1)total+=numbers[i];return total/numbers.length},Utils.prototype.isEmpty=function(obj){for(var key in obj)if(obj.hasOwnProperty(key))return!1;return!0},function(){var root,factory;root=this,factory=function(){var TimeMe={startStopTimes:{},idleTimeoutMs:3e4,currentIdleTimeMs:0,checkStateRateMs:250,active:!1,idle:!1,currentPageName:"default-page-name",timeElapsedCallbacks:[],userLeftCallbacks:[],userReturnCallbacks:[],trackTimeOnElement:function(elementId){var element=document.getElementById(elementId);element&&(element.addEventListener("mouseover",(function(){TimeMe.startTimer(elementId)})),element.addEventListener("mousemove",(function(){TimeMe.startTimer(elementId)})),element.addEventListener("mouseleave",(function(){TimeMe.stopTimer(elementId)})),element.addEventListener("keypress",(function(){TimeMe.startTimer(elementId)})),element.addEventListener("focus",(function(){TimeMe.startTimer(elementId)})))},getTimeOnElementInSeconds:function(elementId){var time=TimeMe.getTimeOnPageInSeconds(elementId);return time||0},startTimer:function(pageName,startTime){if(pageName||(pageName=TimeMe.currentPageName),void 0===TimeMe.startStopTimes[pageName])TimeMe.startStopTimes[pageName]=[];else{var arrayOfTimes=TimeMe.startStopTimes[pageName],latestStartStopEntry=arrayOfTimes[arrayOfTimes.length-1];if(void 0!==latestStartStopEntry&&void 0===latestStartStopEntry.stopTime)return}TimeMe.startStopTimes[pageName].push({startTime:startTime||new Date,stopTime:void 0}),TimeMe.active=!0,TimeMe.idle=!1},stopAllTimers:function(){for(var pageNames=Object.keys(TimeMe.startStopTimes),i=0;i<pageNames.length;i++)TimeMe.stopTimer(pageNames[i])},stopTimer:function(pageName,stopTime){pageName||(pageName=TimeMe.currentPageName);var arrayOfTimes=TimeMe.startStopTimes[pageName];void 0!==arrayOfTimes&&0!==arrayOfTimes.length&&(void 0===arrayOfTimes[arrayOfTimes.length-1].stopTime&&(arrayOfTimes[arrayOfTimes.length-1].stopTime=stopTime||new Date),TimeMe.active=!1)},getTimeOnCurrentPageInSeconds:function(){return TimeMe.getTimeOnPageInSeconds(TimeMe.currentPageName)},getTimeOnPageInSeconds:function(pageName){var timeInMs=TimeMe.getTimeOnPageInMilliseconds(pageName);return void 0===timeInMs?void 0:timeInMs/1e3},getTimeOnCurrentPageInMilliseconds:function(){return TimeMe.getTimeOnPageInMilliseconds(TimeMe.currentPageName)},getTimeOnPageInMilliseconds:function(pageName){var totalTimeOnPage=0,arrayOfTimes=TimeMe.startStopTimes[pageName];if(void 0!==arrayOfTimes){for(var timeSpentOnPageInSeconds=0,i=0;i<arrayOfTimes.length;i++){var startTime=arrayOfTimes[i].startTime,stopTime=arrayOfTimes[i].stopTime,difference;void 0===stopTime&&(stopTime=new Date),timeSpentOnPageInSeconds+=stopTime-startTime}return totalTimeOnPage=Number(timeSpentOnPageInSeconds)}},getTimeOnAllPagesInSeconds:function(){for(var allTimes=[],pageNames=Object.keys(TimeMe.startStopTimes),i=0;i<pageNames.length;i++){var pageName=pageNames[i],timeOnPage=TimeMe.getTimeOnPageInSeconds(pageName);allTimes.push({pageName:pageName,timeOnPage:timeOnPage})}return allTimes},setIdleDurationInSeconds:function(duration){var durationFloat=parseFloat(duration);if(!1!==isNaN(durationFloat))throw{name:"InvalidDurationException",message:"An invalid duration time ("+duration+") was provided."};return TimeMe.idleTimeoutMs=1e3*duration,this},setCurrentPageName:function(pageName){return TimeMe.currentPageName=pageName,this},resetRecordedPageTime:function(pageName){delete TimeMe.startStopTimes[pageName]},resetAllRecordedPageTimes:function(){for(var pageNames=Object.keys(TimeMe.startStopTimes),i=0;i<pageNames.length;i++)TimeMe.resetRecordedPageTime(pageNames[i])},resetIdleCountdown:function(){TimeMe.idle&&TimeMe.triggerUserHasReturned(),TimeMe.idle=!1,TimeMe.currentIdleTimeMs=0},callWhenUserLeaves:function(callback,numberOfTimesToInvoke){this.userLeftCallbacks.push({callback:callback,numberOfTimesToInvoke:numberOfTimesToInvoke})},callWhenUserReturns:function(callback,numberOfTimesToInvoke){this.userReturnCallbacks.push({callback:callback,numberOfTimesToInvoke:numberOfTimesToInvoke})},triggerUserHasReturned:function(){if(!TimeMe.active)for(var i=0;i<this.userReturnCallbacks.length;i++){var userReturnedCallback=this.userReturnCallbacks[i],numberTimes=userReturnedCallback.numberOfTimesToInvoke;(isNaN(numberTimes)||void 0===numberTimes||numberTimes>0)&&(userReturnedCallback.numberOfTimesToInvoke-=1,userReturnedCallback.callback())}TimeMe.startTimer()},triggerUserHasLeftPage:function(){if(TimeMe.active)for(var i=0;i<this.userLeftCallbacks.length;i++){var userHasLeftCallback=this.userLeftCallbacks[i],numberTimes=userHasLeftCallback.numberOfTimesToInvoke;(isNaN(numberTimes)||void 0===numberTimes||numberTimes>0)&&(userHasLeftCallback.numberOfTimesToInvoke-=1,userHasLeftCallback.callback())}TimeMe.stopAllTimers()},callAfterTimeElapsedInSeconds:function(timeInSeconds,callback){TimeMe.timeElapsedCallbacks.push({timeInSeconds:timeInSeconds,callback:callback,pending:!0})},checkState:function(){for(var i=0;i<TimeMe.timeElapsedCallbacks.length;i++)TimeMe.timeElapsedCallbacks[i].pending&&TimeMe.getTimeOnCurrentPageInSeconds()>TimeMe.timeElapsedCallbacks[i].timeInSeconds&&(TimeMe.timeElapsedCallbacks[i].callback(),TimeMe.timeElapsedCallbacks[i].pending=!1);!1===TimeMe.idle&&TimeMe.currentIdleTimeMs>TimeMe.idleTimeoutMs?(TimeMe.idle=!0,TimeMe.triggerUserHasLeftPage()):TimeMe.currentIdleTimeMs+=TimeMe.checkStateRateMs},visibilityChangeEventName:void 0,hiddenPropName:void 0,listenForVisibilityEvents:function(){void 0!==document.hidden?(TimeMe.hiddenPropName="hidden",TimeMe.visibilityChangeEventName="visibilitychange"):void 0!==document.mozHidden?(TimeMe.hiddenPropName="mozHidden",TimeMe.visibilityChangeEventName="mozvisibilitychange"):void 0!==document.msHidden?(TimeMe.hiddenPropName="msHidden",TimeMe.visibilityChangeEventName="msvisibilitychange"):void 0!==document.webkitHidden&&(TimeMe.hiddenPropName="webkitHidden",TimeMe.visibilityChangeEventName="webkitvisibilitychange"),document.addEventListener(TimeMe.visibilityChangeEventName,(function(){document[TimeMe.hiddenPropName]?TimeMe.triggerUserHasLeftPage():TimeMe.triggerUserHasReturned()}),!1),window.addEventListener("blur",(function(){TimeMe.triggerUserHasLeftPage()})),window.addEventListener("focus",(function(){TimeMe.triggerUserHasReturned()})),document.addEventListener("mousemove",(function(){TimeMe.resetIdleCountdown()})),document.addEventListener("keyup",(function(){TimeMe.resetIdleCountdown()})),document.addEventListener("touchstart",(function(){TimeMe.resetIdleCountdown()})),window.addEventListener("scroll",(function(){TimeMe.resetIdleCountdown()})),setInterval((function(){TimeMe.checkState()}),TimeMe.checkStateRateMs)},websocket:void 0,websocketHost:void 0,setUpWebsocket:function(websocketOptions){if(window.WebSocket&&websocketOptions){var websocketHost=websocketOptions.websocketHost;try{TimeMe.websocket=new WebSocket(websocketHost),window.onbeforeunload=function(event){TimeMe.sendCurrentTime(websocketOptions.appId)},TimeMe.websocket.onopen=function(){TimeMe.sendInitWsRequest(websocketOptions.appId)},TimeMe.websocket.onerror=function(error){console&&console.log("Error occurred in websocket connection: "+error)},TimeMe.websocket.onmessage=function(event){console&&console.log(event.data)}}catch(error){console&&console.error("Failed to connect to websocket host. Error:"+error)}}return this},websocketSend:function(data){TimeMe.websocket.send(JSON.stringify(data))},sendCurrentTime:function(appId){var timeSpentOnPage,data={type:"INSERT_TIME",appId:appId,timeOnPageMs:TimeMe.getTimeOnCurrentPageInMilliseconds(),pageName:TimeMe.currentPageName};TimeMe.websocketSend(data)},sendInitWsRequest:function(appId){var data={type:"INIT",appId:appId};TimeMe.websocketSend(data)},initialize:function(options){var idleTimeoutInSeconds=TimeMe.idleTimeoutMs||30,currentPageName=TimeMe.currentPageName||"default-page-name",websocketOptions=void 0,initialStartTime=void 0;options&&(idleTimeoutInSeconds=options.idleTimeoutInSeconds||idleTimeoutInSeconds,currentPageName=options.currentPageName||currentPageName,websocketOptions=options.websocketOptions,initialStartTime=options.initialStartTime),TimeMe.setIdleDurationInSeconds(idleTimeoutInSeconds).setCurrentPageName(currentPageName).setUpWebsocket(websocketOptions).listenForVisibilityEvents(),TimeMe.startTimer(void 0,initialStartTime)}};return TimeMe},"undefined"!=typeof module&&module.exports?module.exports=factory():"function"==typeof define&&define.amd?define([],(function(){return root.TimeMe=factory()})):root.TimeMe=factory()}.call(this),function(name,context,factory){"undefined"!=typeof module&&module.exports?module.exports=factory():"function"==typeof define&&define.amd?define(factory):context.h337=factory()}("h337",this,(function(){var HeatmapConfig={defaultRadius:40,defaultRenderer:"canvas2d",defaultGradient:{.25:"rgb(0,0,255)",.55:"rgb(0,255,0)",.85:"yellow",1:"rgb(255,0,0)"},defaultMaxOpacity:1,defaultMinOpacity:0,defaultBlur:.85,defaultXField:"x",defaultYField:"y",defaultValueField:"value",plugins:{}},Store=function StoreClosure(){var Store=function Store(config){this._coordinator={},this._data=[],this._radi=[],this._min=10,this._max=1,this._xField=config.xField||config.defaultXField,this._yField=config.yField||config.defaultYField,this._valueField=config.valueField||config.defaultValueField,config.radius&&(this._cfgRadius=config.radius)},defaultRadius=HeatmapConfig.defaultRadius;return Store.prototype={_organiseData:function(dataPoint,forceRender){var x=dataPoint[this._xField],y=dataPoint[this._yField],radi=this._radi,store=this._data,max=this._max,min=this._min,value=dataPoint[this._valueField]||1,radius=dataPoint.radius||this._cfgRadius||defaultRadius;store[x]||(store[x]=[],radi[x]=[]),store[x][y]?store[x][y]+=value:(store[x][y]=value,radi[x][y]=radius);var storedVal=store[x][y];return storedVal>max?(forceRender?this.setDataMax(storedVal):this._max=storedVal,!1):storedVal<min?(forceRender?this.setDataMin(storedVal):this._min=storedVal,!1):{x:x,y:y,value:value,radius:radius,min:min,max:max}},_unOrganizeData:function(){var unorganizedData=[],data=this._data,radi=this._radi;for(var x in data)for(var y in data[x])unorganizedData.push({x:x,y:y,radius:radi[x][y],value:data[x][y]});return{min:this._min,max:this._max,data:unorganizedData}},_onExtremaChange:function(){this._coordinator.emit("extremachange",{min:this._min,max:this._max})},addData:function(){if(arguments[0].length>0)for(var dataArr=arguments[0],dataLen=dataArr.length;dataLen--;)this.addData.call(this,dataArr[dataLen]);else{var organisedEntry=this._organiseData(arguments[0],!0);organisedEntry&&(0===this._data.length&&(this._min=this._max=organisedEntry.value),this._coordinator.emit("renderpartial",{min:this._min,max:this._max,data:[organisedEntry]}))}return this},setData:function(data){var dataPoints=data.data,pointsLen=dataPoints.length;this._data=[],this._radi=[];for(var i=0;i<pointsLen;i++)this._organiseData(dataPoints[i],!1);return this._max=data.max,this._min=data.min||0,this._onExtremaChange(),this._coordinator.emit("renderall",this._getInternalData()),this},removeData:function(){},setDataMax:function(max){return this._max=max,this._onExtremaChange(),this._coordinator.emit("renderall",this._getInternalData()),this},setDataMin:function(min){return this._min=min,this._onExtremaChange(),this._coordinator.emit("renderall",this._getInternalData()),this},setCoordinator:function(coordinator){this._coordinator=coordinator},_getInternalData:function(){return{max:this._max,min:this._min,data:this._data,radi:this._radi}},getData:function(){return this._unOrganizeData()}},Store}(),Canvas2dRenderer=function Canvas2dRendererClosure(){var _getColorPalette=function(config){var gradientConfig=config.gradient||config.defaultGradient,paletteCanvas=document.createElement("canvas"),paletteCtx=paletteCanvas.getContext("2d");paletteCanvas.width=256,paletteCanvas.height=1;var gradient=paletteCtx.createLinearGradient(0,0,256,1);for(var key in gradientConfig)gradient.addColorStop(key,gradientConfig[key]);return paletteCtx.fillStyle=gradient,paletteCtx.fillRect(0,0,256,1),paletteCtx.getImageData(0,0,256,1).data},_getPointTemplate=function(radius,blurFactor){var tplCanvas=document.createElement("canvas"),tplCtx=tplCanvas.getContext("2d"),x=radius,y=radius;if(tplCanvas.width=tplCanvas.height=2*radius,1==blurFactor)tplCtx.beginPath(),tplCtx.arc(x,y,radius,0,2*Math.PI,!1),tplCtx.fillStyle="rgba(0,0,0,1)",tplCtx.fill();else{var gradient=tplCtx.createRadialGradient(x,y,radius*blurFactor,x,y,radius);gradient.addColorStop(0,"rgba(0,0,0,1)"),gradient.addColorStop(1,"rgba(0,0,0,0)"),tplCtx.fillStyle=gradient,tplCtx.fillRect(0,0,2*radius,2*radius)}return tplCanvas},_prepareData=function(data){for(var renderData=[],min=data.min,max=data.max,radi=data.radi,data=data.data,xValues=Object.keys(data),xValuesLen=xValues.length;xValuesLen--;)for(var xValue=xValues[xValuesLen],yValues=Object.keys(data[xValue]),yValuesLen=yValues.length;yValuesLen--;){var yValue=yValues[yValuesLen],value=data[xValue][yValue],radius=radi[xValue][yValue];renderData.push({x:xValue,y:yValue,value:value,radius:radius})}return{min:min,max:max,data:renderData}};function Canvas2dRenderer(config){var container=config.container,shadowCanvas=this.shadowCanvas=document.createElement("canvas"),canvas=this.canvas=config.canvas||document.createElement("canvas"),renderBoundaries=this._renderBoundaries=[1e4,1e4,0,0],computed=getComputedStyle(config.container)||{};canvas.className="heatmap-canvas",this._width=canvas.width=shadowCanvas.width=config.width||+computed.width.replace(/px/,""),this._height=canvas.height=shadowCanvas.height=config.height||+computed.height.replace(/px/,""),this.shadowCtx=shadowCanvas.getContext("2d"),this.ctx=canvas.getContext("2d"),canvas.style.cssText=shadowCanvas.style.cssText="position:absolute;left:0;top:0;",container.style.position="relative",container.appendChild(canvas),this._palette=_getColorPalette(config),this._templates={},this._setStyles(config)}return Canvas2dRenderer.prototype={renderPartial:function(data){data.data.length>0&&(this._drawAlpha(data),this._colorize())},renderAll:function(data){this._clear(),data.data.length>0&&(this._drawAlpha(_prepareData(data)),this._colorize())},_updateGradient:function(config){this._palette=_getColorPalette(config)},updateConfig:function(config){config.gradient&&this._updateGradient(config),this._setStyles(config)},setDimensions:function(width,height){this._width=width,this._height=height,this.canvas.width=this.shadowCanvas.width=width,this.canvas.height=this.shadowCanvas.height=height},_clear:function(){this.shadowCtx.clearRect(0,0,this._width,this._height),this.ctx.clearRect(0,0,this._width,this._height)},_setStyles:function(config){this._blur=0==config.blur?0:config.blur||config.defaultBlur,config.backgroundColor&&(this.canvas.style.backgroundColor=config.backgroundColor),this._width=this.canvas.width=this.shadowCanvas.width=config.width||this._width,this._height=this.canvas.height=this.shadowCanvas.height=config.height||this._height,this._opacity=255*(config.opacity||0),this._maxOpacity=255*(config.maxOpacity||config.defaultMaxOpacity),this._minOpacity=255*(config.minOpacity||config.defaultMinOpacity),this._useGradientOpacity=!!config.useGradientOpacity},_drawAlpha:function(data){for(var min=this._min=data.min,max=this._max=data.max,data,dataLen=(data=data.data||[]).length,blur=1-this._blur;dataLen--;){var point=data[dataLen],x=point.x,y=point.y,radius=point.radius,value=Math.min(point.value,max),rectX=x-radius,rectY=y-radius,shadowCtx=this.shadowCtx,tpl;this._templates[radius]?tpl=this._templates[radius]:this._templates[radius]=tpl=_getPointTemplate(radius,blur);var templateAlpha=(value-min)/(max-min);shadowCtx.globalAlpha=templateAlpha<.01?.01:templateAlpha,shadowCtx.drawImage(tpl,rectX,rectY),rectX<this._renderBoundaries[0]&&(this._renderBoundaries[0]=rectX),rectY<this._renderBoundaries[1]&&(this._renderBoundaries[1]=rectY),rectX+2*radius>this._renderBoundaries[2]&&(this._renderBoundaries[2]=rectX+2*radius),rectY+2*radius>this._renderBoundaries[3]&&(this._renderBoundaries[3]=rectY+2*radius)}},_colorize:function(){var x=this._renderBoundaries[0],y=this._renderBoundaries[1],width=this._renderBoundaries[2]-x,height=this._renderBoundaries[3]-y,maxWidth=this._width,maxHeight=this._height,opacity=this._opacity,maxOpacity=this._maxOpacity,minOpacity=this._minOpacity,useGradientOpacity=this._useGradientOpacity;x<0&&(x=0),y<0&&(y=0),x+width>maxWidth&&(width=maxWidth-x),y+height>maxHeight&&(height=maxHeight-y);for(var img=this.shadowCtx.getImageData(x,y,width,height),imgData=img.data,len=imgData.length,palette=this._palette,i=3;i<len;i+=4){var alpha=imgData[i],offset=4*alpha,finalAlpha;if(offset)finalAlpha=opacity>0?opacity:alpha<maxOpacity?alpha<minOpacity?minOpacity:alpha:maxOpacity,imgData[i-3]=palette[offset],imgData[i-2]=palette[offset+1],imgData[i-1]=palette[offset+2],imgData[i]=useGradientOpacity?palette[offset+3]:finalAlpha}img.data=imgData,this.ctx.putImageData(img,x,y),this._renderBoundaries=[1e3,1e3,0,0]},getValueAt:function(point){var value,shadowCtx,img,data=this.shadowCtx.getImageData(point.x,point.y,1,1).data[3],max=this._max,min=this._min;return value=Math.abs(max-min)*(data/255)>>0},getDataURL:function(){return this.canvas.toDataURL()}},Canvas2dRenderer}(),Renderer=function RendererClosure(){var rendererFn=!1;return"canvas2d"===HeatmapConfig.defaultRenderer&&(rendererFn=Canvas2dRenderer),rendererFn}(),Util_merge=function(){for(var merged={},argsLen=arguments.length,i=0;i<argsLen;i++){var obj=arguments[i];for(var key in obj)merged[key]=obj[key]}return merged},Heatmap=function HeatmapClosure(){var Coordinator=function CoordinatorClosure(){function Coordinator(){this.cStore={}}return Coordinator.prototype={on:function(evtName,callback,scope){var cStore=this.cStore;cStore[evtName]||(cStore[evtName]=[]),cStore[evtName].push((function(data){return callback.call(scope,data)}))},emit:function(evtName,data){var cStore=this.cStore;if(cStore[evtName])for(var len=cStore[evtName].length,i=0;i<len;i++){var callback;(0,cStore[evtName][i])(data)}}},Coordinator}(),_connect=function(scope){var renderer=scope._renderer,coordinator=scope._coordinator,store=scope._store;coordinator.on("renderpartial",renderer.renderPartial,renderer),coordinator.on("renderall",renderer.renderAll,renderer),coordinator.on("extremachange",(function(data){scope._config.onExtremaChange&&scope._config.onExtremaChange({min:data.min,max:data.max,gradient:scope._config.gradient||scope._config.defaultGradient})})),store.setCoordinator(coordinator)};function Heatmap(){var config=this._config=Util_merge(HeatmapConfig,arguments[0]||{});if(this._coordinator=new Coordinator,config.plugin){var pluginToLoad=config.plugin;if(!HeatmapConfig.plugins[pluginToLoad])throw new Error("Plugin '"+pluginToLoad+"' not found. Maybe it was not registered.");var plugin=HeatmapConfig.plugins[pluginToLoad];this._renderer=new plugin.renderer(config),this._store=new plugin.store(config)}else this._renderer=new Renderer(config),this._store=new Store(config);_connect(this)}return Heatmap.prototype={addData:function(){return this._store.addData.apply(this._store,arguments),this},removeData:function(){return this._store.removeData&&this._store.removeData.apply(this._store,arguments),this},setData:function(){return this._store.setData.apply(this._store,arguments),this},setDataMax:function(){return this._store.setDataMax.apply(this._store,arguments),this},setDataMin:function(){return this._store.setDataMin.apply(this._store,arguments),this},configure:function(config){return this._config=Util_merge(this._config,config),this._renderer.updateConfig(this._config),this._coordinator.emit("renderall",this._store._getInternalData()),this},repaint:function(){return this._coordinator.emit("renderall",this._store._getInternalData()),this},getData:function(){return this._store.getData()},getDataURL:function(){return this._renderer.getDataURL()},getValueAt:function(point){return this._store.getValueAt?this._store.getValueAt(point):this._renderer.getValueAt?this._renderer.getValueAt(point):null}},Heatmap}(),heatmapFactory;return{create:function(config){return new Heatmap(config)},register:function(pluginKey,plugin){HeatmapConfig.plugins[pluginKey]=plugin}}}));var messageType="application/x-postmate-v1+json",maxHandshakeRequests=5,_messageId=0,generateNewMessageId=function generateNewMessageId(){return++_messageId},log=function log(){var _console;return Postmate.debug?(_console=console).log.apply(_console,arguments):null},resolveOrigin=function resolveOrigin(url){var a=document.createElement("a");a.href=url;var protocol=a.protocol.length>4?a.protocol:window.location.protocol,host=a.host.length?"80"===a.port||"443"===a.port?a.hostname:a.host:window.location.host;return a.origin||protocol+"//"+host},messageTypes={handshake:1,"handshake-reply":1,call:1,emit:1,reply:1,request:1},sanitize=function sanitize(message,allowedOrigin){return("string"!=typeof allowedOrigin||message.origin===allowedOrigin)&&(!!message.data&&(("object"!=typeof message.data||"postmate"in message.data)&&(message.data.type===messageType&&!!messageTypes[message.data.postmate])))},resolveValue=function resolveValue(model,property){var unwrappedContext="function"==typeof model[property]?model[property]():model[property];return Postmate.Promise.resolve(unwrappedContext)},ParentAPI=function(){function ParentAPI(info){var _this=this;this.parent=info.parent,this.frame=info.frame,this.child=info.child,this.childOrigin=info.childOrigin,this.events={},"production"!==process.env.NODE_ENV&&(log("Parent: Registering API"),log("Parent: Awaiting messages...")),this.listener=function(e){if(!sanitize(e,_this.childOrigin))return!1;var _ref=((e||{}).data||{}).value||{},data=_ref.data,name=_ref.name;"emit"===e.data.postmate&&("production"!==process.env.NODE_ENV&&log("Parent: Received event emission: "+name),name in _this.events&&_this.events[name].forEach((function(callback){callback.call(_this,data)})))},this.parent.addEventListener("message",this.listener,!1),"production"!==process.env.NODE_ENV&&log("Parent: Awaiting event emissions from Child")}var _proto=ParentAPI.prototype;return _proto.get=function get(property){var _this2=this;return new Postmate.Promise((function(resolve){var uid=generateNewMessageId(),transact=function transact(e){e.data.uid===uid&&"reply"===e.data.postmate&&(_this2.parent.removeEventListener("message",transact,!1),resolve(e.data.value))};_this2.parent.addEventListener("message",transact,!1),_this2.child.postMessage({postmate:"request",type:messageType,property:property,uid:uid},_this2.childOrigin)}))},_proto.call=function call(property,data){this.child.postMessage({postmate:"call",type:messageType,property:property,data:data},this.childOrigin)},_proto.on=function on(eventName,callback){this.events[eventName]||(this.events[eventName]=[]),this.events[eventName].push(callback)},_proto.destroy=function destroy(){"production"!==process.env.NODE_ENV&&log("Parent: Destroying Postmate instance"),window.removeEventListener("message",this.listener,!1),this.frame.parentNode.removeChild(this.frame)},ParentAPI}(),ChildAPI=function(){function ChildAPI(info){var _this3=this;this.model=info.model,this.parent=info.parent,this.parentOrigin=info.parentOrigin,this.child=info.child,"production"!==process.env.NODE_ENV&&(log("Child: Registering API"),log("Child: Awaiting messages...")),this.child.addEventListener("message",(function(e){if(sanitize(e,_this3.parentOrigin)){"production"!==process.env.NODE_ENV&&log("Child: Received request",e.data);var _e$data=e.data,property=_e$data.property,uid=_e$data.uid,data=_e$data.data;"call"!==e.data.postmate?resolveValue(_this3.model,property).then((function(value){return e.source.postMessage({property:property,postmate:"reply",type:messageType,uid:uid,value:value},e.origin)})):property in _this3.model&&"function"==typeof _this3.model[property]&&_this3.model[property](data)}}))}var _proto2;return ChildAPI.prototype.emit=function emit(name,data){"production"!==process.env.NODE_ENV&&log('Child: Emitting Event "'+name+'"',data),this.parent.postMessage({postmate:"emit",type:messageType,value:{name:name,data:data}},this.parentOrigin)},ChildAPI}(),Postmate=function(){function Postmate(_ref2){var _ref2$container=_ref2.container,container=void 0===_ref2$container?void 0!==container?container:document.body:_ref2$container,model=_ref2.model,url=_ref2.url,name=_ref2.name,_ref2$classListArray=_ref2.classListArray,classListArray=void 0===_ref2$classListArray?[]:_ref2$classListArray;return this.parent=window,this.frame=document.createElement("iframe"),this.frame.name=name||"",this.frame.classList.add.apply(this.frame.classList,classListArray),container.appendChild(this.frame),this.child=this.frame.contentWindow||this.frame.contentDocument.parentWindow,this.model=model||{},this.sendHandshake(url)}var _proto3;return Postmate.prototype.sendHandshake=function sendHandshake(url){var _this4=this,childOrigin=resolveOrigin(url),attempt=0,responseInterval;return new Postmate.Promise((function(resolve,reject){var reply=function reply(e){return!!sanitize(e,childOrigin)&&("handshake-reply"===e.data.postmate?(clearInterval(responseInterval),"production"!==process.env.NODE_ENV&&log("Parent: Received handshake reply from Child"),_this4.parent.removeEventListener("message",reply,!1),_this4.childOrigin=e.origin,"production"!==process.env.NODE_ENV&&log("Parent: Saving Child origin",_this4.childOrigin),resolve(new ParentAPI(_this4))):("production"!==process.env.NODE_ENV&&log("Parent: Invalid handshake reply"),reject("Failed handshake")))};_this4.parent.addEventListener("message",reply,!1);var doSend=function doSend(){attempt++,"production"!==process.env.NODE_ENV&&log("Parent: Sending handshake attempt "+attempt,{childOrigin:childOrigin}),_this4.child.postMessage({postmate:"handshake",type:messageType,model:_this4.model},childOrigin),attempt===maxHandshakeRequests&&clearInterval(responseInterval)},loaded=function loaded(){doSend(),responseInterval=setInterval(doSend,500)};_this4.frame.attachEvent?_this4.frame.attachEvent("onload",loaded):_this4.frame.addEventListener("load",loaded),"production"!==process.env.NODE_ENV&&log("Parent: Loading frame",{url:url}),_this4.frame.src=url}))},Postmate}();Postmate.debug=!1,Postmate.Promise=function(){try{return window?window.Promise:Promise}catch(e){return null}}(),Postmate.Model=function(){function Model(model){return this.child=window,this.model=model,this.parent=this.child.parent,this.sendHandshakeReply()}var _proto4;return Model.prototype.sendHandshakeReply=function sendHandshakeReply(){var _this5=this;return new Postmate.Promise((function(resolve,reject){var shake=function shake(e){if(e.data.postmate){if("handshake"===e.data.postmate){"production"!==process.env.NODE_ENV&&log("Child: Received handshake from Parent"),_this5.child.removeEventListener("message",shake,!1),"production"!==process.env.NODE_ENV&&log("Child: Sending handshake reply to Parent"),e.source.postMessage({postmate:"handshake-reply",type:messageType},e.origin),_this5.parentOrigin=e.origin;var defaults=e.data.model;return defaults&&(Object.keys(defaults).forEach((function(key){_this5.model[key]=defaults[key]})),"production"!==process.env.NODE_ENV&&log("Child: Inherited and extended model from Parent")),"production"!==process.env.NODE_ENV&&log("Child: Saving Parent origin",_this5.parentOrigin),resolve(new ChildAPI(_this5))}return reject("Handshake Reply Failed")}};_this5.child.addEventListener("message",shake,!1)}))},Model}(),"undefined"==typeof module&&(module={}),_e=new Evelean(document.getElementById("evelean_script").getAttribute("src").replace(/^[^\?]+\??/,"").substring(0,24));