(() => { var bundles = [['dynamicEngagements', () => { var define = true; !function(e,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?exports.obBundle=n():(e.obBundle=e.obBundle||{},e.obBundle.dynamicEngagement=n())}(self,()=>(()=>{"use strict";var t={d:(e,n)=>{for(var o in n)t.o(n,o)&&!t.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:n[o]})},o:(e,n)=>Object.prototype.hasOwnProperty.call(e,n),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{DynamicEngagements:()=>i,factory:()=>r});function n(){for(var e=[],n=0;n { var define = true; !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.obBundle=e():(t.obBundle=t.obBundle||{},t.obBundle.dresscode=e())}(self,()=>(()=>{"use strict";var i={d:(t,e)=>{for(var n in e)i.o(e,n)&&!i.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},t={};i.r(t),i.d(t,{DressCode:()=>c,factory:()=>e});function o(){for(var t=[],e=0;e ")}function u(t){if(t)return t.id||(t.attribs?t.attribs.id:void 0)}function m(t){if(t)return t.className||(t.attribs?t.attribs.class:void 0)}function f(t,e){var n;if(void 0===e&&(e=window),!t)return[];var i=[];try{i=Array.from(null==(n=e.document)?void 0:n.querySelectorAll(t))}catch(n){a("ERROR: in querySelectorAll ".concat(n.message," ").concat(t," trying with sanitized selector")),i=Array.from(null==(e=e.document)?void 0:e.querySelectorAll(t.replace(/[^a-zA-Z0-9-_:.#\s()]/g,"")))}return a("last selector used ".concat(t," results ").concat(i.length)),i}function p(t){try{var e=new URL(t).hostname,n=e.split(".").reverse();return 2<=n.length?n[1]+"."+n[0]:e}catch(e){return console.error("Invalid URL:",t),""}}function b(s){var c,t,l,d,e,n=document.createElement("style");function i(){window.clearTimeout(t),t=setTimeout(function(){d=null},2e3)}document.head.appendChild(n),n.innerHTML="@keyframes heartfade {\n 0% {\n opacity: 1;\n }\n 50% {\n opacity: 0;\n }\n }\n .heart {\n z-index: 999;\n animation: heartfade 6s linear;\n position: absolute;\n }",c=document.createElement("DIV"),document.body.prepend(c),l=[],d=null,document.onmousedown=function(t){d=t,i()},document.onmouseup=function(t){i()},document.onmousemove=function(t){d=t,i()},document.ontouchstart=function(t){d=t.touches[0],i()},document.ontouchend=function(t){i()},document.ontouchmove=function(t){d=t.touches[0],i()},e=Date.now(),setInterval(function(){var t=Date.now(),i=t-e;e=t,l.forEach(function(t,e){var n=t.heart,t=t.heartEl;n.time-=i,0s[0]&&e[1] "),i=e.split(" > ");if(0===n.length||0===i.length)return 1;for(var o=Math.max(n.length,i.length);n.length=i)return this.log("(sticky)Randomly selected variation idx ".concat(a," random: ").concat(i,", i: ").concat(a),t[a]),a;throw new Error("weightedRandomSelection: should never get here")},l.prototype.getPinnedMutationAndVariation=function(){var t=null==(t=new URL(this._window.location.href).searchParams.get("ob-var"))?void 0:t.trim();if(t){t=parseInt(t);if(!isNaN(t))return t}},l.prototype.setImageSource=function(n,i){var t=new Image;t.src=i,t.onload=function(){var t,e;"img"===n.tagName.toLowerCase()?(t=n.parentElement,e=[],t&&"picture"===t.tagName.toLowerCase()&&(e=Array.from(t.querySelectorAll("source"))),n.style.transition="opacity 0.5s ease-in-out",n.style.opacity=0,setTimeout(function(){n.src=i,e.forEach(function(t){return t.srcset=i}),n.srcset&&(n.srcset=i),n.style.opacity=1},500)):"div"===n.tagName.toLowerCase()&&(n.style.transition="opacity 0.5s ease-in-out",n.style.opacity=0,setTimeout(function(){n.style.setProperty("background-image","url(".concat(i,")"),"important"),n.style.opacity=1},500))},t.onerror=function(){console.error("Failed to load image: ".concat(i))}},l.prototype.setCssAttributes=function(t,m,f){return g(this,void 0,void 0,function(){var e,n,i,o,a,r,s,c,l,d,u,h;return S(this,function(t){if(!(m instanceof window.Element))return[2,!1];if(f){if(e=f.attributes,n=f.css,e)for(i=0,o=Object.entries(e);io||i.top>a)&&(t.contains(e(i.left+(i.right-i.left)/2,i.top))||t.contains(e(i.left,i.top))||t.contains(e(i.right,i.top))||t.contains(e(i.right,i.bottom))||t.contains(e(i.left,i.bottom)))},l.prototype.doMutate=function(y,w){var v;return g(this,void 0,void 0,function(){var h,m,f,p,g;return S(this,function(t){switch(t.label){case 0:return t.trys.push([0,9,,10]),(h=this.similarityCalculator.extractWithSimilarity([],y.domTrail,y.cssSelectors,{name:y.name,id:"".concat(y.id)}))?(m=h.el,f=(null==(v=null==(v=w.cssAttributes.attributes)?void 0:v.textContent)?void 0:v.trim().toLocaleLowerCase())||"",p=function(){var t=f.match(/^(.+):(.+)$/);if(t){t[0];var e=t[1],t=t[2];if(x.includes(e)&&C.includes(t))return[e,t]}return[]}(),g=p[0],p=p[1],g&&"flow"===p?(b(g),[3,8]):[3,1]):[2,{status:"NOT_FOUND"}];case 1:return"soccer ball"!=f?[3,2]:(I(m,f),[3,8]);case 2:return["valentines heart","slot machine"].includes(f)?(this.log("adding ".concat(f," icon")),I(m,f),[3,8]):[3,3];case 3:return"pumpkins fall"!=f&&"pumpkins flow"!==f?[3,4]:(b("pumpkin"),[3,8]);case 4:if("xmas snow"!==f)return[3,5];else{this.log("XMS XMS XMS - adding a xmas snow");{function e(){if(r)for(var t=window.innerWidth,e=window.innerHeight,n=(a.width=t*s,a.height=e*s,a.style.width="".concat(t,"px"),a.style.height="".concat(e,"px"),r.scale(s,s),c.length=0,Math.floor(t*e/2e3)),i=0;ia.height+this.size},d.prototype.reset=function(){this.x=Math.random()*a.width,this.y=-this.size},d.prototype.update=function(){this.windAngle+=this.windSpeed,this.wind=.5*Math.cos(this.windAngle),this.x+=this.wind,this.y+=this.velocity,this.isOutsideCanvas()&&this.reset()},d.prototype.draw=function(){r&&(r.beginPath(),r.arc(this.x,this.y,this.size,0,2*Math.PI),r.fillStyle=this.fill,r.shadowColor="rgba(0, 0, 0, 0.3)",r.shadowBlur=2,r.fill(),r.closePath())},d);function d(){this.x=Math.random()*a.width,this.y=Math.random()*a.height,this.size=2*Math.random()+1,this.velocity=.35*this.size;var t=Math.min(this.size/3+.3,1);this.fill="rgba(255, 255, 255, ".concat(t,")"),this.windSpeed=.1*(Math.random()-.5),this.windAngle=Math.random()*Math.PI*2,this.wind=0}window.addEventListener("resize",e),e();function u(){r&&(requestAnimationFrame(u),r.clearRect(0,0,a.width,a.height),c.forEach(function(t){t.update(),t.draw()}))}u()}return[3,8]}case 5:return[4,this.resolveCssAttributes(y,m,w.cssAttributes)];case 6:return p=t.sent(),[4,this.setCssAttributes(y,m,p)];case 7:if(!t.sent())return[2,{domEl:m,status:"ERROR"}];t.label=8;case 8:return this.boundElements.push(m),[2,{status:"APPLIED",method:h.method,domEl:m}];case 9:return g=t.sent(),this.log("error while trying to mutate",g),[2,{status:"ERROR"}];case 10:return[2]}})})},l.prototype.resolveCssAttributes=function(i,o,a){var r;return g(this,void 0,void 0,function(){var e,n;return S(this,function(t){switch(t.label){case 0:return"ac-image"!==i.name?[3,4]:(e=this.getMacroParam("ad_id"))?[4,fetch("https://my.outbrain.com/mtGetImageExternalUrlFromAdID/handler?adId=".concat(e,"&width=").concat(o.offsetWidth,"&height=").concat(o.offsetHeight))]:[2,a];case 1:return(e=t.sent()).ok?[4,e.json()]:[3,3];case 2:n=t.sent().cachedImageUrl,null!=(r=a.attributes)&&r.src?a.attributes.src=n:null!=(r=a.css)&&r.backgroundImage&&(a.css.backgroundImage=n),t.label=3;case 3:case 4:return[2,a]}})})},l.prototype.loadVariationIdFromStorage=function(t){var e=this._window.document.cookie;if(e){e=e.split(";").find(function(t){return t.trim().startsWith("dicbo_id")});if(e){e=e.split("=")[1];if(e){e=decodeURIComponent(e);try{var n=JSON.parse(e);if(null!=n.variations){var i=n.variations;if(this.log("we have vars in cookies",JSON.stringify(i)),null!=i&&0!=i.length){var o=i.split(",").filter(function(t){return!isNaN(parseInt(t))}).map(function(t){return parseInt(t)});if(0==o.length)this.log("could not find any variation id in cookies [".concat(o,"]"));else{var a,r=t.map(function(t){return t.variations.map(function(t){return t.id})}).flat(),s=o.filter(function(t){return r.includes(t)});if(this.log("we have ".concat(s.length," relevant variations in cookies"),s),0!=s.length)return a=s[Math.floor(Math.random()*s.length)],this.log("we picked variationId ".concat(a," from cookies")),a}}}}catch(t){}}}}},l.prototype.getMutationAndVariationFromStorage=function(t){var e,n=this.loadVariationIdFromStorage(t);if(null!=n)return e=t.findIndex(function(t){return-1!=t.variations.findIndex(function(t){return t.id==n})}),t=t[e].variations.findIndex(function(t){return t.id==n}),this.log("found variation id ".concat(t," part of ").concat(e," in cookies, will use it")),{mIdx:e,vIdx:t};this.log("could not find variation id in cookies, will randomize")},l.prototype.selectAndMutate=function(s){return g(this,void 0,void 0,function(){var e,n,i,o,a,r;return S(this,function(t){switch(t.label){case 0:if(i=this.getPinnedMutationAndVariation())for(o=0;o").map(function(t){return t.trim()}),i=/#([\w-]+)/,(o=n.filter(function(t){return i.test(t)})).length)?(n=n[n.length-1],o=o.join(" ").trim()+" "+n,f(o,t._window)):[]},function(t,e,n){if(null==n||!n.length)return[];n[0],n[1];var n=n[2].split(">").map(function(t){return t.trim()}),i=n.pop(),o=n.filter(function(t){return t.match(/.\w+$/)});if(!o.length)return[];for(var a=[],r=!0;!a.length&&o.length;)r||o.shift(),a=f(o.join(" ").trim()+" "+i,t._window),r=!1;return a},function(t,e,n){if(null==n||!n.length)return[];for(var i=n[0],o=i.replace(/:nth-of-type\(\d+\)/gi,""),a=[];i!==o&&a.length<3;)i=i.replace(/:nth-of-type\(\d+\)/,""),a=f(i,t._window);return a}],this.locationHref=t}return t})()),"undefined"!=typeof obBundle&&(new obBundle.dresscode.DressCode).execute([{id:369,name:"ac-header",finalUrl:"https://www.hear.com/d/best_hearing_aids_dis01/?ad_id=&ad_title=",status:2,modificationDate:"2024-09-16T14:54:59.000Z",creationDate:"2024-09-16T14:55:00.000Z",winnerVariationId:null,completionDate:null,campaignId:null,variations:[{id:1277,mutationId:369,content:"",cssAttributes:{attributes:{textContent:"Why this tiny German hearing aid is taking the U.S. by storm, according to the experts"}},type:0,allocation:50,status:1,modificationDate:"2024-09-16T14:55:00.000Z",creationDate:"2024-09-16T14:55:00.000Z"},{id:1278,mutationId:369,content:"",cssAttributes:{attributes:{textContent:"{{ad_title}}"}},type:1,allocation:0,status:1,modificationDate:"2024-09-16T14:55:00.000Z",creationDate:"2024-09-16T14:55:00.000Z"}],cssSelectors:["html > body > div:nth-of-type(3) > div > h1","html > body > div.o-wrapper > div.o-row-3 > h1.c-headline","html > body > div.o-wrapper > div.o-row-3.o-row-3p5-d > h1.c-headline","html > body > div.o-wrapper > div.o-row-3.o-row-3p5-d > h1.c-headline"],domTrail:[{entityId:369,creationDate:"Mon Sep 16 2024 10:55:00 GMT-0400 (Eastern Daylight Time)",domTrailId:60630,elementCssClasses:"c-headline",elementAttributeNames:"class:c-headline;elementtiming:PageTitle;",tagName:"H1",elementId:"",elementNthChild:0,type:1},{entityId:369,creationDate:"Mon Sep 16 2024 10:55:00 GMT-0400 (Eastern Daylight Time)",domTrailId:60631,elementCssClasses:"o-row-3 o-row-3p5-d",elementAttributeNames:"class:o-row-3 o-row-3p5-d;",tagName:"DIV",elementId:"",elementNthChild:0,type:1},{entityId:369,creationDate:"Mon Sep 16 2024 10:55:00 GMT-0400 (Eastern Daylight Time)",domTrailId:60632,elementCssClasses:"o-wrapper",elementAttributeNames:"class:o-wrapper;",tagName:"DIV",elementId:"",elementNthChild:3,type:1},{entityId:369,creationDate:"Mon Sep 16 2024 10:55:00 GMT-0400 (Eastern Daylight Time)",domTrailId:60633,elementCssClasses:"",elementAttributeNames:"",tagName:"BODY",elementId:"",elementNthChild:0,type:1},{entityId:369,creationDate:"Mon Sep 16 2024 10:55:00 GMT-0400 (Eastern Daylight Time)",domTrailId:60634,elementCssClasses:"",elementAttributeNames:"lang:en;",tagName:"HTML",elementId:"",elementNthChild:0,type:1}]},{id:370,name:"ac-image",finalUrl:"https://www.hear.com/d/best_hearing_aids_dis01/?ad_id=&ad_title=",status:2,modificationDate:"2024-09-16T14:55:01.000Z",creationDate:"2024-09-16T14:55:01.000Z",winnerVariationId:null,completionDate:null,campaignId:null,variations:[{id:1279,mutationId:370,content:"",cssAttributes:{attributes:{src:"https://res.cloudinary.com/dhqvlsb3l/image/upload/f_auto,q_auto:best/v1/assets/na/teasers/founders-lightbulb-desk.jpg"}},type:0,allocation:50,status:1,modificationDate:"2024-09-16T14:55:01.000Z",creationDate:"2024-09-16T14:55:01.000Z"},{id:1280,mutationId:370,content:"",cssAttributes:{attributes:{src:"image of {{ad_id}}"}},type:1,allocation:0,status:1,modificationDate:"2024-09-16T14:55:01.000Z",creationDate:"2024-09-16T14:55:01.000Z"}],cssSelectors:["html > body > div:nth-of-type(4) > div > div > picture > img","html > body > div.o-row-4 > div.o-wrapper > div.o-flush-mobile > picture > img.o-fluid-img","html > body > div.o-row-4.o-row-3-d > div.o-wrapper.o-wrapper--wide > div.o-flush-mobile > picture > img.o-fluid-img","html > body > div.o-row-4.o-row-3-d > div.o-wrapper.o-wrapper--wide.track-visibility > div.o-flush-mobile > picture > img.o-fluid-img"],domTrail:[{entityId:370,creationDate:"Mon Sep 16 2024 10:55:01 GMT-0400 (Eastern Daylight Time)",domTrailId:60635,elementCssClasses:"o-fluid-img",elementAttributeNames:"class:o-fluid-img;src:https://res.cloudinary.com/dhqvlsb3l/image/upload/f_auto,q_auto:best/v1/assets/na/teasers/founders-lightbulb-desk.jpg;alt:Hearing aids;",tagName:"IMG",elementId:"",elementNthChild:0,type:1},{entityId:370,creationDate:"Mon Sep 16 2024 10:55:01 GMT-0400 (Eastern Daylight Time)",domTrailId:60636,elementCssClasses:"",elementAttributeNames:"",tagName:"PICTURE",elementId:"",elementNthChild:0,type:1},{entityId:370,creationDate:"Mon Sep 16 2024 10:55:01 GMT-0400 (Eastern Daylight Time)",domTrailId:60637,elementCssClasses:"o-flush-mobile",elementAttributeNames:"class:o-flush-mobile;",tagName:"DIV",elementId:"",elementNthChild:0,type:1},{entityId:370,creationDate:"Mon Sep 16 2024 10:55:01 GMT-0400 (Eastern Daylight Time)",domTrailId:60638,elementCssClasses:"o-wrapper o-wrapper--wide track-visibility track-visibility-img-1",elementAttributeNames:"class:o-wrapper o-wrapper--wide track-visibility track-visibility-img-1;",tagName:"DIV",elementId:"",elementNthChild:0,type:1},{entityId:370,creationDate:"Mon Sep 16 2024 10:55:01 GMT-0400 (Eastern Daylight Time)",domTrailId:60639,elementCssClasses:"o-row-4 o-row-3-d",elementAttributeNames:"class:o-row-4 o-row-3-d;",tagName:"DIV",elementId:"",elementNthChild:4,type:1},{entityId:370,creationDate:"Mon Sep 16 2024 10:55:01 GMT-0400 (Eastern Daylight Time)",domTrailId:60640,elementCssClasses:"",elementAttributeNames:"",tagName:"BODY",elementId:"",elementNthChild:0,type:1},{entityId:370,creationDate:"Mon Sep 16 2024 10:55:01 GMT-0400 (Eastern Daylight Time)",domTrailId:60641,elementCssClasses:"",elementAttributeNames:"lang:en;",tagName:"HTML",elementId:"",elementNthChild:0,type:1}]}]); }]]; for (var i = 0; i < bundles.length; i++) { var bundle = bundles[i]; bundle[1].call(window, bundle[2]); } })()