// Copyright Ginigo Ltd, Funnelish™ 2024, All rights reserved. // Updated at Wed 03 Jul 2024, 04:31 "use strict";function _regeneratorRuntime(){_regeneratorRuntime=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",c=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function define(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{define({},"")}catch(t){define=function(t,e,r){return t[e]=r}}function wrap(t,e,r,n){e=e&&e.prototype instanceof Generator?e:Generator,e=Object.create(e.prototype),n=new Context(n||[]);return o(e,"_invoke",{value:makeInvokeMethod(t,r,n)}),e}function tryCatch(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=wrap;var h="suspendedStart",l="suspendedYield",f="executing",s="completed",y={};function Generator(){}function GeneratorFunction(){}function GeneratorFunctionPrototype(){}var i={},d=(define(i,a,function(){return this}),Object.getPrototypeOf),d=d&&d(d(values([]))),g=(d&&d!==r&&n.call(d,a)&&(i=d),GeneratorFunctionPrototype.prototype=Generator.prototype=Object.create(i));function defineIteratorMethods(t){["next","throw","return"].forEach(function(e){define(t,e,function(t){return this._invoke(e,t)})})}function AsyncIterator(t,e){function invoke(r,o,i,a){var u,r=tryCatch(t[r],t,o);if("throw"!==r.type)return(o=(u=r.arg).value)&&"object"==_typeof(o)&&n.call(o,"__await")?e.resolve(o.__await).then(function(t){invoke("next",t,i,a)},function(t){invoke("throw",t,i,a)}):e.resolve(o).then(function(t){u.value=t,i(u)},function(t){return invoke("throw",t,i,a)});a(r.arg)}var r;o(this,"_invoke",{value:function(t,n){function callInvokeWithMethodAndArg(){return new e(function(e,r){invoke(t,n,e,r)})}return r=r?r.then(callInvokeWithMethodAndArg,callInvokeWithMethodAndArg):callInvokeWithMethodAndArg()}})}function makeInvokeMethod(e,r,n){var o=h;return function(i,a){if(o===f)throw Error("Generator is already running");if(o===s){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){c=function maybeInvokeDelegate(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,maybeInvokeDelegate(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),y;n=tryCatch(o,e.iterator,r.arg);if("throw"===n.type)return r.method="throw",r.arg=n.arg,r.delegate=null,y;o=n.arg;return o?o.done?(r[e.resultName]=o.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,y):o:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,y)}(c,n);if(c){if(c===y)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===h)throw o=s,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=f;c=tryCatch(e,r,n);if("normal"===c.type){if(o=n.done?s:l,c.arg===y)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(o=s,n.method="throw",n.arg=c.arg)}}}function pushTryEntry(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function resetTryEntry(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function Context(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(pushTryEntry,this),this.reset(!0)}function values(e){if(e||""===e){var o,r=e[a];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return o=-1,(r=function next(){for(;++o=thumbs.length?thumbs.length-1:index],index=this.rect(thumbs),thumbs=this.rect(slider);return index.right-thumbs.left}},{key:"slideWidth",value:function(slider,index){slider=this.thumbs(slider);return index<0||index>=slider.length?0:slider[index].offsetWidth}},{key:"transition",value:function(slider,newIndex,prevIndex,coord,done){this.transitionCallback=done;done=slider.querySelector(".is-thumbnails");done.style.transition="transform 300ms ease-in-out",done.style.transform="translate(".concat(coord.x,"px,").concat(coord.y,"px)")}},{key:"isVertical",value:function(){return!1}},{key:"translate",value:function(slider,position){slider.querySelector(".is-thumbnails").style.transform="translate".concat(this.isVertical()?"Y":"X","(").concat(position,"px)")}},{key:"toPosition",value:function(slider,index){return-1*(this.totalWidth(slider,index)-this.slideWidth(slider,index)+this.offset(slider,index))}},{key:"offset",value:function(slider,index){index=this.slideWidth(slider,index);return-(slider.clientWidth-index)/2}},{key:"toCoord",value:function(position){return{x:this.isVertical()?0:position,y:this.isVertical()?position:0}}},{key:"length",value:function(slider){return this.thumbs(slider).length}},{key:"thumbs",value:function(slider){return slider.querySelectorAll(".is-thumbnail")}},{key:"select",value:function(slider,index){var _this4=this,thumbs=this.thumbs(slider),img=slider.querySelector(".is-image-wrapper img"),pos=(thumbs.forEach(function(thumb,i){i===index?(thumb.classList.add("selected"),img.setAttribute("src",thumb.dataset.img),img.setAttribute("srcset",thumb.dataset.img+" 1x")):thumb.classList.remove("selected")}),this.toPosition(slider,index));this.transition(slider,index,this.currentIndex(slider),this.toCoord(pos),function(){_this4.translate(slider,pos)})}}]);function modalTrigger(callback,options){function scrollTop(){return window.pageYOffset||(document.documentElement||document.body.parentNode||document.body).scrollTop}function winHeight(){return window.innerHeight||(document.documentElement||document.body).clientHeight}function docHeight(){var D=document;return Math.max(D.body.scrollHeight,D.documentElement.scrollHeight,D.body.offsetHeight,D.documentElement.offsetHeight,D.body.clientHeight,D.documentElement.clientHeight)}this.complete=!1,this.callback=callback,this.timer=null,this.interval=null,this.options=function(){for(var i=1;i=targetScroll&&(clearInterval(parentThis.interval),parentThis.interval=null,parentThis.complete||(parentThis.callback(),parentThis.complete=!0))},this.options.scrollInterval))):"scrollDown"===this.options.trigger?(scrollTop(),pageHeight=winHeight(),self=this,0=parseFloat(self.options.percentDown)&&(self.complete||(self.callback(),self.complete=!0))})):"scrollUp"===this.options.trigger?(trackLength=docHeight()-winHeight(),scrollStartPer=Math.floor(scrollTop()/trackLength*100),pageHeight=winHeight(),_self=this,0=parseFloat(_self.options.percentUp)&&(_self.complete||(_self.callback(),_self.complete=!0))})):"timeout"===this.options.trigger&&(this.timer=setTimeout(this.callback,this.options.timeout))},this.cancel=function(){null!==this.timer&&(clearTimeout(this.timer),this.timer=null),null!==this.interval&&(clearInterval(this.interval),this.interval=null),this.complete=!0},this.init()}var smoothScroll=_createClass(function smoothScroll(){_classCallCheck(this,smoothScroll),this.ignore='a[href="#submit-step"],a[href="#next-step"],a[href^="#yes-link"],a[href="#no-link"],a[href="#submit-1st-step"]',this.topOnEmptyHash=!1,this.animationInterval=null,this.easing="easeOutCubic",this.selector='a[href*="#"]:not(a[href="#submit-step"],a[href="#next-step"],a[href^="#yes-link"],a[href="#no-link"],a[href="#submit-1st-step"])',this.speed=500,this.speedAsDuration=!1,this.durationMax=1300,this.durationMin=300;try{this.init()}catch(e){console.warn(e)}},[{key:"escapeCharacters",value:function(id){"#"===id.charAt(0)&&(id=id.substr(1));for(var codeUnit,string=String(id),length=string.length,index=-1,result="",firstCodeUnit=string.charCodeAt(0);++index=documentHeight)return _this5.cancelScroll(!0),_this5.adjustFocus(anchor,endLocation,isNum),start=null,!(_this5.animationInterval=null)},anchorElem=function loopAnimateScroll(timestamp){timeLapsed+=timestamp-(start=start||timestamp),percentage=1<(percentage=0===speed?0:timeLapsed/speed)?1:percentage,percentage=startLocation+distance*_this5.easingPattern(percentage),window.scrollTo(0,Math.floor(percentage)),stopAnimateScroll(percentage,endLocation)||(_this5.animationInterval=window.requestAnimationFrame(loopAnimateScroll),start=timestamp)},0===window.pageYOffset&&window.scrollTo(0,0),updateUrl&&this.updateURL(anchor,isNum),this.reduceMotion()?this.adjustFocus(anchor,Math.floor(endLocation),!1):(this.cancelScroll(!0),window.requestAnimationFrame(anchorElem)))}},{key:"reduceMotion",value:function(){return!!("matchMedia"in window&&window.matchMedia("(prefers-reduced-motion)").matches)}},{key:"adjustFocus",value:function(anchor,endLocation,isNum){0===anchor&&document.body.focus(),isNum||(anchor.focus(),document.activeElement!==anchor&&(anchor.setAttribute("tabindex","-1"),anchor.focus(),anchor.style.outline="none"),window.scrollTo(0,endLocation))}},{key:"easingPattern",value:function(time){var pattern;return"easeInQuad"===this.easing&&(pattern=time*time),"easeOutQuad"===this.easing&&(pattern=time*(2-time)),"easeInOutQuad"===this.easing&&(pattern=time<.5?2*time*time:(4-2*time)*time-1),"easeInCubic"===this.easing&&(pattern=time*time*time),"easeOutCubic"===this.easing&&(pattern=--time*time*time+1),"easeInOutCubic"===this.easing&&(pattern=time<.5?4*time*time*time:(time-1)*(2*time-2)*(2*time-2)+1),"easeInQuart"===this.easing&&(pattern=time*time*time*time),"easeOutQuart"===this.easing&&(pattern=1- --time*time*time*time),"easeInOutQuart"===this.easing&&(pattern=time<.5?8*time*time*time*time:1-8*--time*time*time*time),"easeInQuint"===this.easing&&(pattern=time*time*time*time*time),"easeOutQuint"===this.easing&&(pattern=1+--time*time*time*time*time),(pattern="easeInOutQuint"===this.easing?time<.5?16*time*time*time*time*time:1+16*--time*time*time*time*time:pattern)||time}},{key:"getEndLocation",value:function(anchor){var location=0;if(anchor.offsetParent)for(;location+=anchor.offsetTop,anchor=anchor.offsetParent;);return location=Math.max(location,0),location=Math.min(location,this.getDocumentHeight()-window.innerHeight)}},{key:"getDocumentHeight",value:function(){return Math.max(document.body.scrollHeight,document.documentElement.scrollHeight,document.body.offsetHeight,document.documentElement.offsetHeight,document.body.clientHeight,document.documentElement.clientHeight)}},{key:"getSpeed",value:function(distance){distance=this.speedAsDuration?this.speed:Math.abs(distance/1e3*this.speed);return this.durationMax&&distance>this.durationMax?this.durationMax:this.durationMin&&distance');if("multi"===productList)input='');else if("qty"===productList){for(var input='"}var productList="",u=(p.imageUrl&&(u=p.imageUrl.replace("images.funnelish.com","img.funnelish.com"),productList='
\n \n
')),'")),productList=document.createElement("div");return productList.classList.add("pl-item"),productList.innerHTML=u,productList.dataset.pid=p.id,productList}},{key:"setupVariants",value:function(p,el,productList){if(p.variants)try{var variantsData=JSON.parse(p.variants);if(variantsData&&variantsData.variants){var variants=variantsData.variants;if(variants.length){var sa=productList.dataset.selecta,variantsEl=document.createElement("div");variantsEl.className="pl-variants";for(var i=0;i\n \n ').concat(o.name,"\n")}var variantEl=document.createElement("div");variantEl.className="pl-variant",variantEl.innerHTML='\n \n '.concat(sa||"","\n ").concat(v.name,'\n \n\n
\n ').concat(ops,"\n
"),variantsEl.appendChild(variantEl)}el.appendChild(variantsEl)}}}catch(e){console.error(e)}}},{key:"loadProducts",value:function(){var plists,defProducts,updateItems,_this7=this;this.products?(plists=document.querySelectorAll(".product-list"),defProducts=[],updateItems=function(){plists.forEach(function(plist){plist.querySelectorAll(".pl-item").forEach(function(item){var inp=item.querySelector(".pl-inner>.pl-name>input,.pl-inner>.pl-name>select");"INPUT"===inp.tagName&&inp.checked||"INPUT"!==inp.tagName&&0.pl-name>input,.pl-inner>.pl-name>select").addEventListener("change",function(ev){_this7.selectVariant(null,p,null,el),updateItems()}),_this7.setupVariants(p,el,plist),el.querySelectorAll(".pl-variant-option input,.pl-variant-option select").forEach(function(o){o.addEventListener("change",function(ev){var l=o.parentElement;("INPUT"===o.tagName&&o.checked||0.pl-items .pl-item:first-child input").forEach(function(i){i.checked=!0}),document.querySelectorAll(".product-list .pl-variant-option:first-child input").forEach(function(i){i.closest("label").classList.add("selected"),i.checked=!0}),updateItems()):(this.isOrderForm()||this.isOTO())&&console.error("no products in Order Form or OTO!")}},{key:"selectVariant",value:function(optionInput,p,optionLabel,productEl){var baseImg="",optionInput=(optionInput&&optionLabel&&(optionInput.closest(".pl-variant-options").querySelectorAll(".pl-variant-option").forEach(function(op){return op.classList.remove("selected")}),optionLabel.classList.add("selected")),productEl.querySelectorAll(".pl-variant-option.selected input")),opValue=[],title=(optionInput.forEach(function(x){return opValue.push(x.value)}),opValue.filter(Boolean).join(" / ")),optionLabel=p.imageUrl||"",optionInput=this.getPrice(p,1).dp,opt=p.options?p.options.find(function(x){return x.title===title}):null,p=(opt&&(optionLabel=opt.imageUrl||optionLabel,optionInput=this.getPrice(p,1,opt.price).dp),optionLabel&&(baseImg=optionLabel=optionLabel.replace("images.funnelish.com","img.funnelish.com"),optionLabel="".concat(optionLabel,"?height=220&width=220&auto=webp&fit=bounds")),productEl.querySelector(".pl-image img")),opt=(p&&p.setAttribute("src",optionLabel),productEl.querySelector(".pl-price .pl-pvalue"));opt&&(opt.innerHTML=optionInput),this.updateSummary(),this.updateProductPreviews(baseImg)}},{key:"updateProductPreviews",value:function(img){img&&(img="".concat(img,"?auto=webp&fit=bounds"),document.querySelectorAll(".product-image-preview").forEach(function(p){!p.getAttribute("initial-image")&&p.getAttribute("src")&&p.setAttribute("initial-image",p.getAttribute("src"));var imgEl=null;p.classList.contains("image-slider")?imgEl=p.querySelector(".is-image-wrapper img"):p.classList.contains("img")&&(imgEl=p.querySelector("img")),imgEl&&(imgEl.setAttribute("src",img),imgEl.setAttribute("srcset",img+" 1x"))}))}},{key:"findProduct",value:function(id){for(var i=0;ix '.concat(qty," pcs")),[p.variant_option1,p.variant_option2,p.variant_option3].filter(Boolean).join(" / ")),dp=_this9.getPrice(product,qty,!1,vt).dp,innerHtml="",innerHtml=hasImages&&(p.imageUrl||product.imageUrl)?(imgHtml="",(p.imageUrl||product.imageUrl)&&(qtyHtml=''.concat(qty||"1",""),imgHtml='')),'
\n '.concat(imgHtml,"\n ").concat(qtyHtml,'\n
\n
\n ').concat(product.name,"\n ").concat(vt?''.concat(vt,""):"","\n
")):'
'.concat(product.name+(vt?'   ●   '.concat(vt,""):""),"\n ").concat(qtyHtml,"
"),qty='
\n '.concat(innerHtml,'\n
').concat(dp,"
\n
");html+=qty}),items.innerHTML=html});document.querySelectorAll(".order-summary .__subtotal-row .os-price").forEach(function(x){x.innerHTML=_this9.currencies.formatPrice(_this9.fixedPrice(total),_this9.currency())}),this.discount&&this.discount.discount_value&&(value=this.discount.discount_value,"percentage"===this.discount.discount_type&&(value=total*(value/100)),document.querySelectorAll(".order-summary .__discount-row .os-price").forEach(function(x){x.innerHTML="- "+_this9.currencies.formatPrice(_this9.fixedPrice(value),_this9.currency())}),total-=value);var value,oSums=document.querySelectorAll(".order-summary .__tax-row");this.tax?(oSums.forEach(function(x){x.classList.remove("hidden"),x.closest(".os-subtotal").classList.remove("hidden"),x.querySelector(".os-price").innerHTML=_this9.currencies.formatPrice(_this9.fixedPrice(_this9.tax.amount||"0"),_this9.currency()),x.querySelector(".os-name .__value").innerHTML=" (% ".concat(_this9.fixedPrice(_this9.tax.rate||"0.00"),")")}),total+=this.tax.amount):oSums.forEach(function(x){x.classList.add("hidden")}),this.tax||this.discount?document.querySelectorAll(".order-summary .os-subtotal").forEach(function(x){x.classList.remove("hidden")}):document.querySelectorAll(".order-summary .os-subtotal").forEach(function(x){x.classList.add("hidden")}),total<0&&(console.error("negative total ",total),total=0),document.querySelectorAll(".order-summary .os-total .os-price, .order-summary .__total").forEach(function(x){x.innerHTML=_this9.currencies.formatPrice(_this9.fixedPrice(total),_this9.currency())})}},{key:"setupOrderSummary",value:function(){var _this10=this,oSums=(document.addEventListener("change",function(e){"product-id"!==e.target.name&&"product-qty"!==e.target.name||_this10.updateSummary()}),document.querySelectorAll(".order-summary")),d=(oSums.forEach(function(sum){var input,_rem,h=sum.querySelector(".os-collapse-header"),content=sum.querySelector(".os-content"),inner=sum.querySelector(".os-inner-container");content&&inner&&(sum.classList.contains("__collapsable")&&(new ResizeObserver(function(){var height=content.clientHeight;inner.style.height=sum.classList.contains("__open")?height+"px":"0px"}).observe(content),h)&&h.addEventListener("click",function(){var height=content.clientHeight,isOpen=(sum.classList.toggle("__open"),sum.classList.contains("__open"));inner.style.height=isOpen?height+"px":"0px"}),h=sum.querySelector(".os-discount-box .__apply"),input=sum.querySelector(".os-discount-box .__input"),_rem=sum.querySelector(".__current-discount .__remove"),input)&&h&&(input.addEventListener("keypress",function(e){"Enter"===e.key&&_this10.applyDiscount(input.value,oSums)}),h.addEventListener("click",function(){_this10.applyDiscount(input.value,oSums)}),_rem.addEventListener("click",function(){_this10.applyDiscount("",oSums)}))}),this.getQueryParam("discount"));d&&this.applyDiscount(d,oSums)}},{key:"applyDiscount",value:(_applyDiscount=_asyncToGenerator(_regeneratorRuntime().mark(function _callee(code,oSums){var setError,startLoading,stopLoading,res,_this11=this;return _regeneratorRuntime().wrap(function(_context){for(;;)switch(_context.prev=_context.next){case 0:if(setError=function(error){oSums.forEach(function(sum){sum=sum.querySelector(".os-discount-box .__discount-error");sum&&((sum.innerText=error)?sum.classList.remove("hidden"):sum.classList.add("hidden"))})},startLoading=function(){document.querySelectorAll(".order-summary .__apply").forEach(function(btn){var spinner=document.createElement("div");spinner.innerHTML=_this11.spinnerHtml,btn.classList.add("loading"),btn.appendChild(spinner)})},stopLoading=function(){document.querySelectorAll(".order-summary .__apply .spinner").forEach(function(s){s.closest(".__apply").classList.remove("loading"),s.remove()})},this.discount=null,setError(""),oSums.forEach(function(sum){var input=sum.querySelector(".os-discount-box .__input"),_curDiscount=sum.querySelector(".__current-discount"),_value=sum.querySelector(".__current-discount .__value"),_discRow=sum.querySelector(".__discount-row"),subtotal=sum.querySelector(".os-subtotal"),sum=sum.querySelector(".__discount-row .__value");input&&_curDiscount&&_discRow&&_value&&(input.value="",_value.innerText="",sum.innerText="",_curDiscount.classList.add("hidden"),_discRow.classList.add("hidden"),subtotal.classList.add("hidden"))}),_context.prev=6,code){_context.next=9;break}return _context.abrupt("return");case 9:return startLoading(),_context.next=13,this.post("/discounts/apply",_objectSpread(_objectSpread({},this.getAuthHeader()),{},{is_typ:this.isTYP(),discount_code:code,amount:0,cid:this.getCID()}));case 13:if((res=_context.sent).error)return setError(res.error),_context.abrupt("return");_context.next=17;break;case 17:this.discount=res,code=res.discount_code,_context.next=26;break;case 21:return _context.prev=21,_context.t0=_context.catch(6),setError("couldn't apply given discount code"),console.error(_context.t0),_context.abrupt("return");case 26:return _context.prev=26,stopLoading(),this.trigger("discount_applied",this.discount),_context.finish(26);case 30:oSums.forEach(function(sum){var input=sum.querySelector(".os-discount-box .__input"),_curDiscount=sum.querySelector(".__current-discount"),_value=sum.querySelector(".__current-discount .__value"),_discRow=sum.querySelector(".__discount-row"),subtotal=sum.querySelector(".os-subtotal"),sum=sum.querySelector(".__discount-row .__value");input&&_curDiscount&&_discRow&&_value&&(input.value=code,_value.innerText=code,sum.innerText=code,_curDiscount.classList.remove("hidden"),_discRow.classList.remove("hidden"),subtotal.classList.remove("hidden"))}),this.updateSummary();case 32:case"end":return _context.stop()}},_callee,this,[[6,21,26,30]])})),function(_x,_x2){return _applyDiscount.apply(this,arguments)})},{key:"setupCountries",value:(_setupCountries=_asyncToGenerator(_regeneratorRuntime().mark(function _callee3(){var els,elStates,elCities,frag,i,c,_e,_i,countryEl,_this12=this;return _regeneratorRuntime().wrap(function(_context3){for(;;)switch(_context3.prev=_context3.next){case 0:for(els=document.querySelectorAll('.fe-countries,select[data-type="country"],select[data-type="shipping_country"]'),elStates=document.querySelectorAll(".fe-states"),elCities=document.querySelectorAll(".fe-cities"),frag=document.createDocumentFragment(),i=0;i()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(str)}},{key:"getQueryParam",value:function(name){name=RegExp("[?&]"+name+"=([^&]*)").exec(window.location.search);return name&&decodeURIComponent(name[1].replace(/\+/g," "))}},{key:"storeUTMTags",value:function(){var _this15=this;this.utmTags.forEach(function(tag){var v=_this15.getQueryParam(tag)||"";v&&localStorage.setItem(tag,v)}),localStorage.getItem("referrer")||""||localStorage.setItem("referrer",document.referrer||"")}},{key:"getUTMTags",value:function(){var r=[],fbc=(this.utmTags.forEach(function(tag){try{var v=localStorage.getItem(tag)||"";v&&r.push({name:tag,value:v})}catch(ex){console.warn(ex)}}),this.getCookie("_fbc")),fbc=(fbc&&r.push({name:"fbc",value:fbc}),this.getCookie("_fbp"));return fbc&&r.push({name:"fbp",value:fbc}),r.push({name:"user_agent",value:navigator.userAgent}),r.push({name:"referrer",value:localStorage.getItem("referrer")||""}),r.push({name:"session_id",value:this.getCookie("session_id")||""}),r}},{key:"firstInvalidInput",value:function(){for(var els=document.querySelectorAll(".form-element .invalid"),i=0;i.vimeo-player");vs&&vs.length&&this.loadScript("https://player.vimeo.com/api/player.js",function(){vs.forEach(function(v){"true"===v.parentElement.dataset.lazyload&&setTimeout(function(){var iframe=v.querySelector("iframe");iframe.src=iframe.dataset.src,delete iframe.dataset.src},2500)})})}},{key:"trackVisit",value:(_trackVisit=_asyncToGenerator(_regeneratorRuntime().mark(function _callee10(){var meta,endpoint;return _regeneratorRuntime().wrap(function(_context10){for(;;)switch(_context10.prev=_context10.next){case 0:return _context10.prev=0,meta={},this.getUTMTags().forEach(function(m){try{var v=m.value;v&&["_raeid","_raid","_sms_id"].includes(m.name)&&(v=parseInt(v)),meta[m.name]=v}catch(e){console.warn(e)}}),endpoint="https://analytics."+(this.isBeta()?"beta":"app")+".funnelish.com/view",_context10.next=6,this.post(endpoint,_objectSpread(_objectSpread({},this.getAuthHeader()),{},{cid:this.getCID(),product_id:null,event_id:1,event_name:"pageview",test_mode:this.funnel.test_mode?1:0,currency:this.currency(),country:this.countries.country,city:this.countries.city,latitude:this.countries.latitude,longitude:this.countries.longitude},meta));case 6:(endpoint=_context10.sent)&&endpoint.success&&endpoint.session_id&&this.setCookie("session_id",endpoint.session_id),_context10.next=13;break;case 10:_context10.prev=10,_context10.t0=_context10.catch(0),console.warn(_context10.t0);case 13:case"end":return _context10.stop()}},_callee10,this,[[0,10]])})),function(){return _trackVisit.apply(this,arguments)})},{key:"debounce",value:function(func,wait,immediate){var timeout;return function(){var context=this,args=arguments,callNow=immediate&&!timeout;clearTimeout(timeout),timeout=setTimeout(function(){timeout=null,immediate||func.apply(context,args)},wait),callNow&&func.apply(context,args)}}},{key:"loadTYPSummary",value:(_loadTYPSummary=_asyncToGenerator(_regeneratorRuntime().mark(function _callee11(){var generateEntryRow,oSums,total,resp,totalTax,discounts,subTotal,totalDiscount,_this23=this;return _regeneratorRuntime().wrap(function(_context11){for(;;)switch(_context11.prev=_context11.next){case 0:if(generateEntryRow=function(o,sum){var imgUrl,qty=o.qty,qtyHtml="",hasImages=(1  ✖   '.concat(qty," pcs")),!1),sum=(sum&&sum.classList.contains("__images")&&(hasImages=!0),o.variant_title&&"Main Product"!==o.variant_title?o.variant_title:""),innerHtml="";return innerHtml=hasImages&&(o.image_url||o.variant_image_url)?(hasImages="",imgUrl=(imgUrl=o.variant_image_url||o.image_url).replace("images.funnelish.com","img.funnelish.com"),qtyHtml=''.concat(qty||"1",""),hasImages=''),'
\n '.concat(hasImages,"\n ").concat(qtyHtml,'\n
\n
\n ').concat(o.name,"\n ").concat(sum?''.concat(sum,""):"","\n
")):'
'.concat(o.name+(sum?'   ●   '.concat(sum,""):""),"\n ").concat(qtyHtml,"
"),'
\n '.concat(innerHtml,'\n
').concat(_this23.getCurrencySymbol()," ").concat(_this23.fixedPrice(o.amount*qty),"
\n
")},oSums=document.querySelectorAll(".order-summary"),this.isTYP()&&0a?e.classList.add("visible"):e.classList.remove("visible")})})}catch(e){console.warn(e)}}},{key:"init",value:(_init=_asyncToGenerator(_regeneratorRuntime().mark(function _callee12(){var _this25=this;return _regeneratorRuntime().wrap(function(_context12){for(;;)switch(_context12.prev=_context12.next){case 0:return console.log("core.js init"),_context12.prev=1,this.getFPay()&&(this.isOrderForm()||this.isOTO())&&(this.startLoading(),this.on("app_loaded",function(appName,appId){8===appId&&_this25.stopLoading()},this)),this.storeUTMTags(),this.smoothScroll=new smoothScroll,this.setup2StepForm(),this.setupOrderSummary(),this.loadProducts(),_context12.next=10,this.setupCountries();case 10:return this.setupInputs(),this.setupButtons(),this.setupBumps(),this.alive=!0,this.timers(),this.loadApps(),this.setupVideos(),this.updateSummary(),new imagesSlider,_context12.next=21,this.loadTYPSummary();case 21:this.setupVimeo(),this.setupPopups(),this.setupFaq(),this.setupSticky(),this.setupLazyCodes(),new beforeAfterSlider,_context12.next=32;break;case 29:_context12.prev=29,_context12.t0=_context12.catch(1),console.error(_context12.t0);case 32:return _context12.prev=32,_context12.finish(32);case 34:this.restoreCustomer();try{this.trigger("load")}catch(e){console.warn(e)}try{setTimeout(function(){_this25.trackVisit()},4e3)}catch(e){console.warn(e)}case 37:case"end":return _context12.stop()}},_callee12,this,[[1,29,32,34]])})),function(){return _init.apply(this,arguments)})},{key:"checkForms",value:function(){}},{key:"initEvents",value:function(){this.events={oto_yes:[],oto_no:[],optin:[],of_purchase:[],next_step:[],load:[],app_loaded:[],summary_loaded:[],discount_applied:[]}}},{key:"trigger",value:function(event){for(var _len=arguments.length,params=new Array(1<_len?_len-1:0),_key=1;_key<_len;_key++)params[_key-1]=arguments[_key];try{var _e3,_cat$_e3$handler,cat=this.events[event];for(_e3 in cat)try{(_cat$_e3$handler=cat[_e3].handler).call.apply(_cat$_e3$handler,[cat[_e3].scope].concat(params))}catch(ex){console.warn(ex)}}catch(ex){console.error(ex)}try{switch(event){case"of_purchase":console.log("of_purchase",params);break;case"optin":this.submitFirstForm();break;case"oto_yes":console.log("OTO YES",params);break;case"oto_no":console.log("OTO NO",params),this.gotoNextStep(!0);break;case"next_step":console.log("next_step",params),this.gotoNextStep(!0)}}catch(ex){console.error(ex)}}},{key:"getCID",value:function(){return funnelish.getCookie("fnsh.core.cid")}},{key:"gotoNextStep",value:(_gotoNextStep=_asyncToGenerator(_regeneratorRuntime().mark(function _callee13(){var customer,cid,_args13=arguments;return _regeneratorRuntime().wrap(function(_context13){for(;;)switch(_context13.prev=_context13.next){case 0:if(customer={},0<_args13.length&&void 0!==_args13[0]&&_args13[0]){_context13.next=8;break}if(customer=funnelish.validateFields()){_context13.next=6;break}return _context13.abrupt("return");case 6:_context13.next=9;break;case 8:customer={meta:this.getUTMTags()};case 9:return cid=this.getCID(),_context13.next=12,funnelish.post("/next-step",_objectSpread(_objectSpread({},funnelish.getAuthHeader()),{},{event:"next-step",cid:cid,customer:customer,is_oto:!0,test_mode:this.funnel.test_mode?1:0,currency:this.currency(),country:this.countries.country}));case 12:"ok"===(cid=_context13.sent).status&&cid.data?window.location.href=cid.data.next:(alert("We couldn't process your request at this time!"),console.error("gotoNextStep",cid));case 14:case"end":return _context13.stop()}},_callee13,this)})),function(){return _gotoNextStep.apply(this,arguments)})},{key:"on",value:function(event,handler,scope){try{for(var i in this.events)if(i==event){this.events[i].push({handler:handler,scope:scope});break}}catch(ex){console.warn(ex)}}},{key:"setCookie",value:function(cname,cvalue,exdays){var d=new Date,exdays=(d.setTime(d.getTime()+24*exdays*60*60*1e3),"expires="+d.toUTCString());document.cookie=cname+"="+cvalue+";"+exdays+";path=/"}},{key:"getCookie",value:function(cname){try{for(var name=cname+"=",ca=decodeURIComponent(document.cookie).split(";"),i=0;i