!function(){"use strict";const e=()=>Object.prototype.hasOwnProperty.call(top,"ABTastyEditor"),t=t=>{const n=(()=>{if(e()||(()=>{const e=!!document.getElementById("ABTastyPreviewBar"),t=location.href.includes("ab_project=preview");return e||t})())return!1;const t=ABTasty.getTestsOnPage()[TEST_ID];return!!t&&Object.keys(t.targetings.qaParameters).length>0})(),r=window.document.cookie.includes("abTastyDebug=")||!0===window.abTastyDebug;if(n||r){const e=(()=>{const e=(()=>{const{type:e}=DATA;return`${PACKAGE.replace("@abtasty/","")}${e?`_${e}`:""}`})();return`${e.charAt(0).toUpperCase()}${e.slice(1)}`.split("-").join(" ")})();window.console.log(`%c${e} - ${n?"QA":"Debug"} Mode for campaign ${TEST_ID} %c ${t}`,"background-color: #D6FF01; color: #3100be; padding: 3px 0 3px 10px; border-radius: 5px 0 0 5px; font-weight: bold;","background-color: #3100be; color: white; padding: 3px 10px 3px 0; border-radius: 0 5px 5px 0;")}},n=e=>(e=>{if("string"!=typeof e||!e.trim().length)return null;const[t,n,r]=e.split("[]").map(e=>e.trim()),o=Boolean(r)?r:e,a=n?document.querySelector(t)?.[n]:document;return a?a.querySelector(o):null})(e),r=(e,t)=>{const r=document.querySelector("body")||document.documentElement,o={childList:!0,subtree:!0,attributes:!0},a=()=>c.disconnect(),c=new MutationObserver(()=>{const r=n(t);return r&&!a()&&e(r)});return{clear:a,observe:(e=r)=>c.observe(e,o)}},o=()=>{},a=(t,c)=>{const i=n(t),l={selector:t,clear:o,observe:o};if(i)return setTimeout(()=>c(i),0),l;if(e())return setTimeout(()=>a(t,c),1e3),l;if(t.includes("[]"))return((e,t)=>{const[o,a]=t.split("[]").map(e=>e.trim()),c=n(o),i=c?.[a],{clear:l,observe:u}=r(e,t),s=()=>{const r=n(t);return r&&!d()&&e(r)},d=()=>{l(),c?.removeEventListener("load",s)},v=()=>{u(i),"iframe"===c?.localName&&c.addEventListener("load",s)};return v(),{selector:t,clear:d,observe:v}})(c,t);const{clear:u,observe:s}=r(c,t);return s(),{selector:t,clear:u,observe:s}},c="abtasty_executedCampaign";var i,l=function(){return null},u=DATA,s=u.engagementGoal,d=u.customTarget,v=u.scrollTarget,p=function(){return s.sort(function(e,t){return e.percentage-t.percentage})},m=["scroll",function(){return y()},{passive:!0}],g=function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document;return(null===(e=t.body)||void 0===e?void 0:e.scrollTop)>0?t.body:t.documentElement},f=function(){var e,t,r=d?n(v):window;if("iframe"===r.localName)return null===(e=target)||void 0===e||null===(e=e.contentWindow)||void 0===e||e.removeEventListener.apply(e,m),void(null===(t=target)||void 0===t||t.removeEventListener("load",T));r&&r.removeEventListener.apply(r,m)},b=function(e){var t;if(i=p(),"iframe"===e.localName)return null==e||null===(t=e.contentWindow)||void 0===t||t.addEventListener.apply(t,m),void e.addEventListener("load",T);var n=d?e:window;n.addEventListener.apply(n,m)},y=function(){var e=function(){var e=function(){if(d){var e=n(v);return"iframe"===e.localName?g(e.contentDocument):e}return g()}();if(!e)return 0;var t=e.scrollTop,r=Math.min(e.clientHeight,window.innerHeight),o=e.scrollHeight-r;return Math.round(t/o*100)}();(i=i.filter(function(n){var r=n.percentage,o=n.name;return!(e>=r&&(ABTastyEvent(o,null,TEST_ID),t('Goal "'.concat(o,'" sent to campaign ').concat(TEST_ID,".")),1))})).length||f()},T=function(){l();var e=a(d?v:"body",b);l=e.clear},w=function(e){e.detail.campaignId===TEST_ID&&(T(),h())},E=function(){window.removeEventListener(c,w),f(),l(),i=p(),window.addEventListener(c,w)},h=function(){return document.addEventListener("abtasty_resetActionTracking",E,{once:!0})};t("Widget launch"),T(),h()}();
