(()=>{"use strict";function t(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(t);e&&(c=c.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,c)}return n}function e(e){for(var c=1;c1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",c=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"",i=y(t);if(r)return".ctc_opt_in"===t?void r(t).fadeOut(200).fadeIn(200).fadeOut(200).fadeIn(200):void r(t).show(e||void 0);i.forEach(function(t){c&&c.split(/\s+/).forEach(function(e){e.trim()&&t.classList.add(e.trim())}),a&&a.split(/\s+/).forEach(function(e){e.trim()&&t.classList.remove(e.trim())}),e?t.style.setProperty("--ht-ctc-el-duration","".concat(e,"ms")):t.style.removeProperty("--ht-ctc-el-duration"),n&&function(t,e){if(t&&e){"none"===t.style.display&&(t.style.display="");var n=e.split(/\s+/).filter(Boolean);n.forEach(function(e){t.classList.remove(e),t.offsetWidth,t.classList.add(e)});var c=function(){n.forEach(function(e){return t.classList.remove(e)}),t.removeEventListener("animationend",c),clearTimeout(r)},r=setTimeout(c,2e3);t.addEventListener("animationend",c)}}(t,n),c||a||e||n||(t.style.display="block")})},hide:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",c=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"",i=y(t);r?r(t).hide(e):i.forEach(function(t){c&&t.classList.add(c),a&&t.classList.remove(a),e?t.style.setProperty("--ht-ctc-el-duration","".concat(e,"ms")):t.style.removeProperty("--ht-ctc-el-duration"),n&&t.classList.add("ht-ctc-".concat(n)),c||a||e||n||(t.style.display="none")})}};function m(){n.dispatchEvent(new CustomEvent("ht_ctc_event_configure",{detail:{ctc:s,ctc_values:_}}));var t=n.querySelector(".ht_ctc_chat_data");t&&t.remove();var e={config:{ctc:s,ctc_values:_,is_mobile:l,url:a,post_title:i},api:{storage:{get:p,set:f,raw:u},ui:g,greetings:{open:w,close:S,closeAfterClick:E,initListeners:b,display:k},notifications:{display:A,stop:C},chat:{openLink:T,displaySettings:O},utils:{isSafeObjectKey:h}}};n.dispatchEvent(new CustomEvent("ht_ctc_event_init",{detail:e})),n.dispatchEvent(new CustomEvent("ht_ctc_event_settings",{detail:{ctc:s}})),function(){if(o){n.dispatchEvent(new CustomEvent("ht_ctc_event_chat")),O(o),o.addEventListener("click",function(){n.querySelector(".ht_ctc_chat_greetings_box")||T(o)}),b(),o&&o.addEventListener("click",function(t){if(t.target.closest(".ht_ctc_chat_greetings_box_link")){t.preventDefault();var e=n.querySelector("#ctc_opt");e?e.checked||p("g_optin")?(T(o),E()):g.show(".ctc_opt_in","","ht-ctc-fade-in","",""):(T(o),E()),n.dispatchEvent(new CustomEvent("ht_ctc_event_greetings"))}});var t=n.querySelector("#ctc_opt");t&&t.addEventListener("change",function(){t.checked&&(n.querySelector(".ctc_opt_in")&&g.hide(".ctc_opt_in",100),f("g_optin","y"),setTimeout(function(){T(o),E()},500))})}}(),n.addEventListener("click",function(t){var e=t.target.closest(".ht-ctc-sc-chat");e&&T(e)}),n.addEventListener("click",function(t){var e=t.target.closest(".ctc_chat, #ctc_chat");e&&(T(e),e.classList.contains("ctc_woo_place")&&t.preventDefault());var n=t.target.closest('[href="#ctc_chat"]');n&&(t.preventDefault(),T(n))})}function b(){if(o){var t=n.querySelector(".ht_ctc_chat_greetings_box");t&&o.addEventListener("click",function(e){e.target.closest(".ht_ctc_chat_style")&&(t.classList.contains("ctc_greetings_opened")?S("user_closed"):w("user_opened"))}),o.addEventListener("click",function(t){t.target.closest(".ctc_greetings_close_btn")&&S("user_closed")})}}function k(){var t=n.querySelector(".ht_ctc_chat_greetings_box");if(t){if(s.g_device){if("yes"!==l&&"mobile"===s.g_device)return void t.remove();if("yes"===l&&"desktop"===s.g_device)return void t.remove()}n.dispatchEvent(new CustomEvent("ht_ctc_event_after_chat_displayed",{detail:{ctc:s,greetings_open:w,greetings_close:S}})),s.g_init&&"user_closed"!==p("g_user_action")&&("default"===s.g_init?"yes"!==l&&w("init"):"open"===s.g_init&&w("init"));var e=n.querySelectorAll('.ctc_greetings, #ctc_greetings, .ctc_greetings_now, [href="#ctc_greetings"]');e.length>0&&e.forEach(function(t){t.addEventListener("click",function(t){t.preventDefault(),S("element"),w("element")})})}}function w(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"open";C();var e=n.querySelector(".ht-ctc-chat .ctc_cta_stick");e&&e.remove();var c=n.querySelector(".ht_ctc_chat_greetings_box");c&&(g.show(".ht_ctc_chat_greetings_box","init"===t?70:400,"","ht_ctc_greetings_box_open",""),c.classList.add("ctc_greetings_opened"),c.classList.remove("ctc_greetings_closed")),f("g_action",t),"user_opened"===t&&f("g_user_action",t),function(){if(!n.querySelector(".ctc_greetings_modal"))return;if(!n.querySelector(".ht_ctc_modal_backdrop")){var t=function(e){"Escape"===e.key&&(S("user_closed"),n.removeEventListener("keydown",t))},e=n.createElement("div");e.className="ht_ctc_modal_backdrop",n.body.appendChild(e),e.addEventListener("click",function(){S("user_closed")}),n.addEventListener("keydown",t)}}()}function E(){L(),setTimeout(function(){S("chat_clicked")},500)}function S(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"close";L(),"element"===t?g.hide(".ht_ctc_chat_greetings_box",70,"","ht-ctc-display-unset",""):g.hide(".ht_ctc_chat_greetings_box",400,"","","ht_ctc_greetings_box_open");var e=n.querySelector(".ht_ctc_chat_greetings_box");e&&(e.classList.add("ctc_greetings_closed"),e.classList.remove("ctc_greetings_opened")),f("g_action",t),"user_closed"===t&&f("g_user_action",t)}function L(){var t=n.querySelector(".ht_ctc_modal_backdrop");t&&t.remove()}function O(t){s.schedule&&"yes"===s.schedule?n.dispatchEvent(new CustomEvent("ht_ctc_event_display",{detail:{ctc:s,display_chat:x,ht_ctc_chat:t,online_content:q}})):(x(t),q())}function x(t){if("yes"===l){if("show"===s.dis_m){var e=n.querySelector(".ht_ctc_desktop_chat");e&&e.remove(),t.style.cssText=s.pos_m+s.css,s.side_m&&t.style.setProperty("--side",s.side_m),j(t)}}else if("show"===s.dis_d){var c=n.querySelector(".ht_ctc_mobile_chat");c&&c.remove(),t.style.cssText=s.pos_d+s.css,s.side_d&&t.style.setProperty("--side",s.side_d),j(t)}}function j(t){var e=s.se;e=parseInt(s.se),isNaN(e)?g.show(t,"","","ht-ctc-display-unset",""):g.show(t,e,"","ht-ctc-display-unset",""),k(),A(),function(t){var e=t.classList.contains("ht_ctc_entry_animation")?1200:120;setTimeout(function(){t.classList.add("ht_ctc_animation",s.ani)},e);var c=n.querySelector(".ht-ctc-chat"),r=n.querySelector(".ht-ctc-chat .ht-ctc-cta-hover");c&&r&&(c.addEventListener("mouseenter",function(){g.show(".ht-ctc-chat .ht-ctc-cta-hover",120,"","ht-ctc-cta-stick","ht-ctc-opacity-hide")}),c.addEventListener("mouseleave",function(){g.hide(".ht-ctc-chat .ht-ctc-cta-hover",100,"","ht-ctc-opacity-hide","ht-ctc-cta-stick")}))}(t)}function q(){n.querySelector(".for_greetings_header_image_badge")&&(n.querySelectorAll(".for_greetings_header_image_badge").forEach(function(t){t.classList.add("g_header_badge_online")}),g.show(".for_greetings_header_image_badge","","","ht-ctc-display-unset",""))}function A(){var t=n.querySelector(".ht_ctc_notification");if(t&&"stop"!==p("n_badge")){var e=n.querySelector(".ctc_nb");if(e){var c=e.closest(".ht_ctc_style"),r=n.querySelector(".ht_ctc_badge");if(c&&r){var a,i,o=null===(a=c.querySelector(".ctc_nb"))||void 0===a?void 0:a.getAttribute("data-nb_top"),_=null===(i=c.querySelector(".ctc_nb"))||void 0===i?void 0:i.getAttribute("data-nb_right");null!==o&&(r.style.top=o),null!==_&&(r.style.right=_)}}var l=s.n_time?1e3*s.n_time:150;setTimeout(function(){t.style.display=""},l)}}function C(){var t=n.querySelector(".ht_ctc_notification");t&&(f("n_badge","stop"),t.remove())}function P(r){if(s.analytics&&"session"===s.analytics){if(sessionStorage.getItem("ht_ctc_analytics"))return;sessionStorage.setItem("ht_ctc_analytics","done")}function o(e){var c=s.chat_number&&""!==s.chat_number?s.chat_number:s.number;try{n.dispatchEvent(new CustomEvent("ht_ctc_event_apply_variables",{detail:{templateString:e}})),e=(e=(e=(e=void 0!==t.apply_variables_value?t.apply_variables_value:e).replace("{number}",c)).replace("{title}",i)).replace("{url}",a)}catch(t){}return e}var l="event_"+Math.floor(1e4+9e4*Math.random());s.ctc_pixel_event_id=l,n.dispatchEvent(new CustomEvent("ht_ctc_event_analytics"));var u=s.chat_number&&""!==s.chat_number?s.chat_number:s.number,d=new Map,v=function(){return Object.fromEntries(d)},p="Click to Chat for WhatsApp",f="chat: "+u,y=i+", "+a;if(s.ga){var g=s.g_an_event_name&&""!==s.g_an_event_name?s.g_an_event_name:"click to chat";g=o(g),Array.isArray(_.g_an_params)&&_.g_an_params.forEach(function(t){if("string"==typeof t&&h(t)){var e=Object.getOwnPropertyDescriptor(_,t);if(e&&e.value&&"object"===c(e.value)){var n=e.value,r=n.key,a=n.value;"string"==typeof r&&(r=o(r),a=o(a),h(r)&&d.set(r,a))}}});var m=0,b="no",k=[];if("undefined"!=typeof dataLayer)try{var w=function(t,e){t&&"string"==typeof t&&""!==t.trim()&&(k.includes(t)||k.push(t))};"undefined"==typeof gtag&&(t.gtag=function(){var t;(t=dataLayer).push.apply(t,arguments)},b="yes");var E=[];try{var S,L=null===(S=t.google_tag_data)||void 0===S?void 0:S.tidr;null!=L&&L.destination&&"object"===c(L.destination)&&Object.keys(L.destination).forEach(function(t){w(t)})}catch(t){}try{var O,x=null===(O=t.google_tag_data)||void 0===O||null===(O=O.tidr)||void 0===O?void 0:O.container;x&&"object"===c(x)&&Object.values(x).forEach(function(t){Array.isArray(t.destinations)&&t.destinations.forEach(function(t){"string"==typeof t&&t.startsWith("G-")&&w(t)})})}catch(t){}try{Array.isArray(t.dataLayer)&&t.dataLayer.forEach(function(t){Array.isArray(t)&&"config"===t[0]&&"string"==typeof t[1]?w(t[1]):null!=t&&t.send_to&&"string"==typeof t.send_to&&w(t.send_to)})}catch(t){}k.forEach(function(t){var e;e=(e=t).toUpperCase(),E.includes(e)||(E.push(e),(e.startsWith("G-")||e.startsWith("GT-"))&&(d.set("send_to",e),gtag("event",g,v()),m++))})}catch(t){}if(0===m&&"no"===b)if("undefined"!=typeof gtag)gtag("event",g,v());else if("undefined"!=typeof ga&&void 0!==ga.getAll){ga.getAll()[0].send("event",p,f,y)}else"undefined"!=typeof __gaTracker&&__gaTracker("send","event",p,f,y)}if("undefined"!=typeof dataLayer){if(s.gtm){var j=s.gtm_event_name||"Click to chat";j=o(j);var q={};q.event=j,Array.isArray(_.gtm_params)&&_.gtm_params.forEach(function(t){if("string"==typeof t&&h(t)){var e=_[t];if(e&&"object"===c(e)){var n=o(e.key),r=o(e.value);h(n)&&(q[n]=r)}}}),dataLayer.push(q)}if(s.g_an_gtm){var A=e(e({},v()),{},{event:null!=g?g:"chat_click",ref:"dataLayer push ga admin values"});dataLayer.push(A)}}if(s.ads&&"undefined"!=typeof gtag_report_conversion&>ag_report_conversion(),s.fb&&"undefined"!=typeof fbq){var C=s.pixel_event_name&&""!==s.pixel_event_name?s.pixel_event_name:"Click to Chat by HoliThemes",P=_.pixel_event_type&&""!==_.pixel_event_type?_.pixel_event_type:"trackCustom",T=new Map;Array.isArray(_.pixel_params)&&_.pixel_params.forEach(function(t){if("string"==typeof t&&h(t)){var e=Object.getOwnPropertyDescriptor(_,t);if(e&&e.value&&"object"===c(e.value)){var n=e.value,r=n.key,a=n.value;"string"==typeof r&&(r=o(r),a=o(a),h(r)&&T.set(r,a))}}}),s.ctc_pixel_event_id="",fbq(P,C,Object.fromEntries(T),{eventID:l})}}function T(e){n.dispatchEvent(new CustomEvent("ht_ctc_event_number",{detail:{ctc:s}}));var c=s.number,r=s.pre_filled;if(e.hasAttribute("data-number")&&""!==e.getAttribute("data-number")&&(c=e.getAttribute("data-number")),e.hasAttribute("data-pre_filled")){var a=e.getAttribute("data-pre_filled")||"";r=(s.prefix_pre_filled?s.prefix_pre_filled:"")+a}try{r=r.replaceAll("%","%25");var i=t.location.href;r=r.replace(/\[url]/gi,i),r=encodeURIComponent(decodeURI(r))}catch(t){}if(""!==c||s.custom_url_m&&""!==s.custom_url_m||s.custom_url_d&&""!==s.custom_url_d){var o="https://wa.me/"+c+"?text="+r,_=s.url_target_d?s.url_target_d:"_blank";"yes"===l?(s.url_structure_m&&"wa_colon"===s.url_structure_m&&(o="whatsapp://send?phone="+c+"&text="+r,_="_self"),s.custom_url_m&&""!==s.custom_url_m&&(o=s.custom_url_m)):(s.url_structure_d&&"web"===s.url_structure_d&&(o="https://web.whatsapp.com/send?phone="+c+"&text="+r),s.custom_url_d&&""!==s.custom_url_d&&(o=s.custom_url_d));var u="popup"===_?"scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no,width=788,height=514,left=100,top=100":"noopener";t.open(o,_,u),s.chat_number=c,P(),function(t){if(!s.hook_url)return;var e={},c={};if(s.hook_v){if(e=void 0!==D?D:s.hook_v,!Array.isArray(e))return;var r={},a=1;e.forEach(function(t){r["value"+a]=t,a++}),s.hook_v=r}n.dispatchEvent(new CustomEvent("ht_ctc_event_hook",{detail:{ctc:s,number:t}}));var i,o=s.hook_url;e=s.hook_v,"json"===s.webhook_format?(c["Content-Type"]="application/json",i=JSON.stringify(e)):(c["Content-Type"]="application/x-www-form-urlencoded;charset=UTF-8",i=new URLSearchParams(e).toString());fetch(o,{method:"POST",headers:c,body:i}).then(function(t){}).catch(function(t){})}(c),C()}else if(s.no_number){var d=n.querySelector(".ctc-no-number-message");d&&(d.style.display="block")}}"undefined"!=typeof ht_ctc_chat_var&&(s=ht_ctc_chat_var),"undefined"!=typeof ht_ctc_variables&&(_=ht_ctc_variables),0===Object.keys(s).length||0===Object.keys(_).length?function(){var e=n.querySelector(".ht_ctc_chat_data");if(0===Object.keys(s).length&&e)try{var c=(null==e?void 0:e.getAttribute("data-settings"))||"";s=JSON.parse(c),t.ht_ctc_chat_var=s}catch(t){}0===Object.keys(_).length&&(_={g_an_event_name:"click to chat",pixel_event_name:"Click to Chat by HoliThemes",pixel_event_type:"trackCustom",g_an_params:["g_an_param_1","g_an_param_2","g_an_param_3"],g_an_param_1:{key:"number",value:"{number}"},g_an_param_2:{key:"title",value:"{title}"},g_an_param_3:{key:"url",value:"{url}"},pixel_params:["pixel_param_1","pixel_param_2","pixel_param_3","pixel_param_4"],pixel_param_1:{key:"Category",value:"Click to Chat for WhatsApp"},pixel_param_2:{key:"return_type",value:"chat"},pixel_param_3:{key:"ID",value:"{number}"},pixel_param_4:{key:"Title",value:"{title}"}},t.ht_ctc_variables=_);m()}():m();var D=s.hook_v?s.hook_v:""}r||function(){var t=n.querySelector(".ht_ctc_chat_greetings_box"),e=n.querySelector(".ht_ctc_greetings");t&&e&&(e.style.setProperty("pointer-events","none"),t.classList.add("ht_ctc_greetings_box"),t.style.removeProperty("display"),t.style.setProperty("pointer-events","auto"));var c=n.querySelector(".ht-ctc-chat .ht-ctc-cta-hover");c&&(c.classList.add("ht-ctc-opacity-hide"),c.style.removeProperty("display"))}(),"loading"!==n.readyState?a():n.addEventListener("DOMContentLoaded",a)}(window,document,r)})();