{"version":3,"sources":["../../dev/j/hmct-floating-element.js"],"names":["hmct","classToggler","helpBox","classList","toggle","helpBoxCollapsed","position","hero","top","outerHeight","window","scrollY","innerHeight","remove","add","close","document","querySelector","expand","$","timer","addEventListener","length","wait","time","Date","now","clearTimeout","setTimeout","interval","downloadButton","querySelectorAll","buttonClicked","forEach","button","sessionStorage","getItem","on"],"mappings":"AAAA,GAAIA,MAAO,WAgBV,QAASC,KACRC,EAAQC,UAAUC,OAAO,YACzBC,EAAiBF,UAAUC,OAAO,UAsBlC,QAASE,KACLC,EAAKD,WAAWE,IAAMD,EAAKE,aAAY,GAAUC,OAAOC,QAAUD,OAAOE,YAAe,KAC1FV,EAAQC,UAAUU,OAAO,iBACzBR,EAAiBF,UAAUU,OAAO,mBAElCX,EAAQC,UAAUW,IAAI,iBACtBT,EAAiBF,UAAUW,IAAI,kBA7ClC,GAAIC,GAAQC,SAASC,cAAc,sBAC/BC,EAASF,SAASC,cAAc,+BACnCf,EAAUc,SAASC,cAAc,qBACjCZ,EAAmBW,SAASC,cAAc,+BAC1CV,EAAOY,EAAE,sBACTC,EAAQ,IA6CT,OA3CAL,GAAMM,iBAAiB,QAAS,WAC/BpB,MAGDiB,EAAOG,iBAAiB,QAAS,WAChCpB,MAQGM,EAAKe,OAAS,GACjBZ,OAAOW,iBAAiB,SAExB,SAAkBE,GACjB,GAAIC,GAAOC,KAAKC,KAChB,OAAO,YACDF,EAAOD,EAAOE,KAAKC,MAAS,IAChCpB,IACa,OAAVc,GACFO,aAAaP,GAEdA,EAAQQ,WAAW,WAClBtB,KACE,KACHkB,EAAOC,KAAKC,SAb4B,OA8B3CG,SAAW,SAASA,GACnB,GAAIC,GAAiBd,SAASe,iBAAiB,oCAC9CC,GAAgB,CAEbF,GAAeR,OAAS,GAC3BQ,EAAeG,QAAQ,SAAUC,GAChCA,EAAOb,iBAAiB,QAAS,WAChCW,GAAgB,MAIhBG,eAAeC,QAAQ,QACzBlC,EAAQC,UAAUW,IAAI,aAEtBK,EAAET,QAAQ2B,GAAG,OAAQ,WACpBT,WAAW,WACNrB,EAAKe,OAAS,GACjBhB,IAEI0B,GACJ9B,EAAQC,UAAUW,IAAI,cAErBe","file":"hmct-floating-element.js","sourcesContent":["var hmct = function () {\n\tvar close = document.querySelector('.js-floating-close'),\n\t expand = document.querySelector('.hmct-floating-el-collapsed'),\n\t\thelpBox = document.querySelector('.hmct-floating-el'),\n\t\thelpBoxCollapsed = document.querySelector('.hmct-floating-el-collapsed'),\n\t\thero = $('.banner.banner-top'),\n\t\ttimer = null;\n\n\tclose.addEventListener('click', function() {\n\t\tclassToggler();\n\t});\n\n\texpand.addEventListener('click', function() {\n\t\tclassToggler();\n\t});\n\n\tfunction classToggler() {\n\t\thelpBox.classList.toggle(\"collapse\");\n\t\thelpBoxCollapsed.classList.toggle(\"expand\");\n\t}\n\n\tif (hero.length > 0) {\n\t\twindow.addEventListener('scroll', throttle(300));\n\n\t\tfunction throttle(wait) {\n\t\t\tvar time = Date.now();\n\t\t\treturn function() {\n\t\t\t\tif ((time + wait - Date.now()) < 0) {\n\t\t\t\t\tposition();\n\t\t\t\t\tif(timer !== null) {\n\t\t\t\t\t\tclearTimeout(timer); \n\t\t\t\t\t}\n\t\t\t\t\ttimer = setTimeout(function() {\n\t\t\t\t\t\tposition();\n\t\t\t\t\t}, 310);\n\t\t\t\t\ttime = Date.now();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfunction position() {\n\t\t\tif(hero.position().top + hero.outerHeight(true) < ((window.scrollY + window.innerHeight) - 150)) {\n\t\t\t\thelpBox.classList.remove(\"hero-overflow\");\n\t\t\t\thelpBoxCollapsed.classList.remove(\"hero-overflow\");\n\t\t\t} else {\n\t\t\t\thelpBox.classList.add(\"hero-overflow\");\n\t\t\t\thelpBoxCollapsed.classList.add(\"hero-overflow\");\n\t\t\t}\n\t\t}\n\t}\n\n\treturn {\n\t\tinterval : function(interval) {\n\t\t\tvar downloadButton = document.querySelectorAll('[href*=\"download-thank-you.php\"]'),\n\t\t\t\tbuttonClicked = false;\n\n\t\t\tif (downloadButton.length > 0) {\n\t\t\t\tdownloadButton.forEach(function (button) {\n\t\t\t\t\tbutton.addEventListener('click', function() {\n\t\t\t\t\t\tbuttonClicked = true;\n\t\t\t\t\t})\n\t\t\t\t});\n\t\t\t}\n\t\t\tif(sessionStorage.getItem('hmct')) {\n\t\t\t\thelpBox.classList.add(\"hmct-show\");\n\t\t\t} else {\n\t\t\t\t$(window).on('load', function() {\n\t\t\t\t\tsetTimeout(function() {\n\t\t\t\t\t\tif (hero.length > 0) {\n\t\t\t\t\t\t\tposition();\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (!buttonClicked) {\n\t\t\t\t\t\t\thelpBox.classList.add(\"hmct-show\");\n\t\t\t\t\t\t}\n\t\t\t\t\t}, interval);\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}\n\t\n}();\n"]}