!function(m,f,v,b){"use strict";function t(){m(v).trigger("joinchat:starting");var t,e,n=1e3*b.settings.button_delay,i=1e3*b.settings.message_delay,s=!!b.settings.message_hash,o=!!b.$(".joinchat__box").length,a=parseInt(b.store.getItem("joinchat_views")||1)>=b.settings.message_views,h=(b.store.getItem("joinchat_hashes")||"").split(",").filter(Boolean),c=void 0!==b.settings.is_viewed?b.settings.is_viewed:-1!==h.indexOf(b.settings.message_hash||"none");function r(){clearTimeout(e),b.chatbox_show()}function _(){b.save_hash(),b.chatbox_hide()}var l,g,d=!c&&(b.settings.message_badge||!s||!i||!a);function u(){var t=(v.activeElement.type||"").toLowerCase();0<=["date","datetime","email","month","number","password","search","tel","text","textarea","time","url","week"].indexOf(t)?b.chatbox?(b.chatbox_hide(),setTimeout(function(){b.hide()},400)):b.hide():b.show()}setTimeout(function(){b.show(d)},n),s&&i&&!c&&(b.settings.message_badge?e=setTimeout(function(){b.$(".joinchat__badge").addClass("joinchat__badge--in")},n+i):a&&(e=setTimeout(r,n+i))),o&&!b.is_mobile&&b.$(".joinchat__button").on("mouseenter",function(){t=setTimeout(r,1500)}).on("mouseleave",function(){clearTimeout(t)}),b.$(".joinchat__button").on("click",function(){o&&!b.chatbox?r():Date.now()>b.showed_at+600&&(_(),b.open_whatsapp())}),b.$(".joinchat__close").on("click",_),b.$("#joinchat_optin").on("change",function(){b.$div.toggleClass("joinchat--optout",!this.checked)}),b.$(".joinchat__box__scroll").on("mousewheel DOMMouseScroll",function(t){t.preventDefault();t=t.originalEvent.wheelDelta||-t.originalEvent.detail;this.scrollTop+=30*(t<0?1:-1)}),b.is_mobile&&(m(v).on("focus blur","input, textarea",function(t){m(t.target).closest(b.$div).length||(clearTimeout(l),l=setTimeout(u,200))}),m(f).on("resize",function(){clearTimeout(g),g=setTimeout(function(){b.$div[0].style.setProperty("--vh",f.innerHeight+"px")},200)}).trigger("resize"));var p,h=new URL(f.location);"#joinchat"==h.hash&&(b.show(),setTimeout(r,700)),h.searchParams.has("joinchat")&&(s=1e3*(parseInt(h.searchParams.get("joinchat"))||0),setTimeout(function(){b.show()},s),setTimeout(r,700+s)),m(v).on("click",'.joinchat_open, .joinchat_app, a[href="#joinchat"], a[href="#whatsapp"]',function(t){t.preventDefault(),!o||b.optin()&&!m(this).is('.joinchat_open, a[href="#joinchat"]')?b.open_whatsapp(m(this).data("phone"),m(this).data("message")):r()}),m(v).on("click",".joinchat_close",function(t){t.preventDefault(),b.chatbox_hide()}),o&&"IntersectionObserver"in f&&0<(a=m(".joinchat_show, .joinchat_force_show")).length&&(p=new IntersectionObserver(function(t){m.each(t,function(){if(0.*<\/sku>/g,e)})),b.store.setItem("joinchat_views",parseInt(b.store.getItem("joinchat_views")||0)+1)}};m(e),m(f).on("load",e),v.addEventListener("DOMContentLoaded",e)}(jQuery,window,document,window.joinchat_obj||{});