function _typeof(e){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_typeof(e)}var brandquizEmbed=brandquizEmbed||{};brandquizEmbed.baseurl="https://app.involve.me",brandquizEmbed.divSelector=".brandquiz_embed, .involveme_embed",brandquizEmbed.embeds=[],brandquizEmbed.init=function(){this.oneTimeInit(),this.polyfills();var e=document.querySelector(this.divSelector);e&&e.getAttribute("data-baseurl")&&(this.baseurl=e.getAttribute("data-baseurl")),this.embed()},brandquizEmbed.oneTimeInit=function(){if(!this.initialized){if(this.initialized=!0,document.getElementsByTagName("meta").viewport)document.getElementsByTagName("meta").viewport.content="width=device-width, initial-scale=1, maximum-scale=1";else{var e=document.createElement("meta");e.setAttribute("name","viewport"),e.setAttribute("content","width=device-width, initial-scale=1, maximum-scale=1"),document.querySelector("head").appendChild(e)}window.postMessage&&window.addEventListener("message",function(e){if("object"===_typeof(e.data)&&"involveme_embed"===e.data.source){var t=e.data.sourceId,i=document.querySelector("iframe#"+t);if(void 0===t||null===i)return void this.sendFrameIds();switch(e.data.type){case"scrollToTop":(null===i.parentNode.getAttribute("data-autoscroll")||"true"===i.parentNode.getAttribute("data-autoscroll"))&&!this.isElementInViewport(i)&&i.scrollIntoView();break;case"forceScrollToTop":this.isElementInViewport(i)||window.scrollTo({top:i.getBoundingClientRect().top+document.documentElement.scrollTop+(e.data.payload||0),behavior:"smooth"});break;case"outerHeight":this.setHeight(i,e.data.payload);break;case"visibleRectangle":this.updateVisibleRectangle(i);break;case"tracking":"ga"===e.data.payload.type&&"function"==typeof gtag?gtag("event",e.data.payload.eventName,e.data.payload.payload):"gtm"===e.data.payload.type&&"object"===("undefined"==typeof dataLayer?"undefined":_typeof(dataLayer))?dataLayer.push(e.data.payload.payload):"fbq"===e.data.payload.type&&"function"==typeof fbq?fbq("trackCustom",e.data.payload.name,e.data.payload.payload):"linkedin"===e.data.payload.type&&"function"==typeof lintrk?lintrk("track",e.data.payload.payload):"tiktok"===e.data.payload.type&&"object"===("undefined"==typeof ttq?"undefined":_typeof(ttq))&&ttq.track(e.data.payload.payload.eventName,e.data.payload.payload);break;case"redirect":var a=brandquizEmbed.getDivDataAttributes(i.parentNode),o=a.transparentEmbed,n=a.noResize,r=a.loadColor,d=a.embedMode,s=new URL(e.data.payload);s.searchParams.set("embed",1),d&&s.searchParams.set("embedmode",d),n&&s.searchParams.set("noresize",1),o&&s.searchParams.set("transparent-embed",o),r&&s.searchParams.set("loadcolor",encodeURIComponent(r)),i.src=s.toString(),n||brandquizEmbed.makeResponsive(i);break;default:console.log("Parent received a message",e)}}}.bind(this),!1)}},brandquizEmbed.embed=function(){document.querySelectorAll(this.divSelector).forEach(function(e){if(null===e.querySelector("iframe")){var t=e.getAttribute("data-embed")||e.getAttribute("data-project"),i=e.getAttribute("data-baseurl"),a=e.querySelector("script.involve-embed-script");if(null===i&&a&&(i=new URL(a.src).origin),null===i&&(i=this.baseurl),-1===this.embeds.indexOf(t)){this.embeds.push(t);var o=e.getAttribute("data-width");e.style["max-width"]=o?o+"px":"100%";var n=brandquizEmbed.getDivDataAttributes(e),r=n.transparentEmbed,d=n.minHeight,s=n.noResize,l=n.loadColor,u=n.embedMode,m=n.embedTabPosition,c=n.isPreview;"fullscreen"===u&&(e.style.height="100%",e.style.width="100%",e.style.margin=0,e.style["line-height"]=0,e.style.position="fixed",e.style["z-index"]=2147483645,e.style.top=0,e.style.left=0,document.getElementsByTagName("body")[0].style="overflow: hidden",s=!0);var b=e.getAttribute("data-params"),p="";null!==b&&b.split(",").forEach((function(e){p+="&"+e.trim()}));var h=["src","embed","embedmode","share","noresize","score","calculator","outcome","o","loadcolor","transparent-embed"],y=this.getAllUrlParams();for(var g in y)y.hasOwnProperty(g)&&(h.includes(g)||(p+="&"+g+"="+y[g]));s&&(e.style.height="100%",e.style["-webkit-overflow-scrolling"]="touch",d||(e.style.height="100%"));var f=document.createElement("iframe");f.setAttribute("frameborder","0"),f.style.width="100%",f.style.overflow="hidden",["popup","chatButton"].includes(u)&&(f.style["border-radius"]="0.5rem"),["sideTab"].includes(u)&&("left"===m?(f.style["border-top-right-radius"]="0.5rem",f.style["border-bottom-right-radius"]="0.5rem"):"right"===m&&(f.style["border-top-left-radius"]="0.5rem",f.style["border-bottom-left-radius"]="0.5rem")),f.id="_"+Math.random().toString(36).substr(2,9),s&&(f.style.height="100%"),d&&(f.style["min-height"]=d+"px"),c&&(f.style.transform="scale(0.6)",f.style["transform-origin"]="0 0",f.style.width="167%",f.style.height="167%"),e.getAttribute("data-loading")&&(f.loading=e.getAttribute("data-loading")),f.src=i+"/"+t+"?embed=1"+(u?"&embedmode="+u:"")+(s?"&noresize=1":"")+(r?"&transparent-embed="+r:"")+(l?"&loadcolor="+encodeURIComponent(l):"")+"&src="+encodeURIComponent(document.location.href)+p,e.appendChild(f);var v=e.querySelector("iframe#"+f.id);v.onload=function(){brandquizEmbed.sendFrameId(v)},s||this.makeResponsive(e.querySelector("iframe#"+f.id))}}}.bind(this))},brandquizEmbed.sendFrameIds=function(){document.querySelectorAll(this.divSelector).forEach(function(e){var t=e.querySelector("iframe");t&&t.id&&this.sendFrameId(t)}.bind(this))},brandquizEmbed.sendFrameId=function(e){e.contentWindow.postMessage({source:"involveme_parent",type:"setId",payload:e.id},"*")},brandquizEmbed.ready=function(e){var t=new URL(document.currentScript.src).origin||null;t&&(this.baseurl=t,document.currentScript.className="involve-embed-script"),(document.attachEvent?"complete"===document.readyState:"loading"!==document.readyState)?e():document.addEventListener("DOMContentLoaded",e)},brandquizEmbed.polyfills=function(){window.NodeList&&!NodeList.prototype.forEach&&(NodeList.prototype.forEach=Array.prototype.forEach),Array.prototype.includes||Object.defineProperty(Array.prototype,"includes",{value:function(e,t){if(null==this)throw new TypeError('"this" is null or not defined');var i=Object(this),a=i.length>>>0;if(0===a)return!1;var o,n,r=0|t,d=Math.max(r>=0?r:a-Math.abs(r),0);for(;d0&&(i.top<0&&(t.top=Math.abs(i.top)),i.bottom<=window.innerHeight?t.height=i.height-t.top:i.top<0?t.height=window.innerHeight:t.height=window.innerHeight-i.top),e.contentWindow.postMessage({source:"involveme_parent",type:"visibleRectangle",payload:{top:Math.floor(t.top),height:Math.floor(t.height)}},"*")},brandquizEmbed.setHeight=function(e,t){var i=e.parentNode.getAttribute("data-min-height");i&&t=0&&t.top<=(window.innerHeight||document.documentElement.clientHeight)},brandquizEmbed.ready((function(){brandquizEmbed.init()}));