b0y-101 Mini Shell


Current Path : E:/www3/chiangrai/wp-content/plugins/chaty/admin/assets/js/
File Upload :
Current File : E:/www3/chiangrai/wp-content/plugins/chaty/admin/assets/js/cht-scripts.min.js

function checkForUserCountry(){""!=getUserCountry()&&setWhatsAppCountryFlag()}function getUserCountry(){var e=chatyGetCookie("cht_country_code");return e||setClientCountry(),e}function setClientCountry(){if(!chatyGetCookie("cht_country_code")){jQuery.get("https://www.cloudflare.com/cdn-cgi/trace",(function(e){if(e){var t="-",a=e.match("loc=(.*)");a.length>1&&(a=a[1])&&""==(t=a.toUpperCase())&&(t="-")}chatySetCookie("cht_country_code",t,720),setWhatsAppCountryFlag()}))}}function setWhatsAppCountryFlag(){if(jQuery("#channel_input_Whatsapp").length){cht_settings.channel_settings.Whatsapp=document.querySelector("#channel_input_Whatsapp"),cht_settings.channel_settings.Whatsapp_Country=window.intlTelInput(cht_settings.channel_settings.Whatsapp,{formatOnDisplay:!1,hiddenInput:"full_number",initialCountry:"auto",nationalMode:!1,autoHideDialCode:!1,utilsScript:cht_settings.plugin_url+"admin/assets/js/utils.js"});var e=getUserCountry();"-"!=e&&""==jQuery("#channel_input_Whatsapp").val()?setTimeout((function(){cht_settings.channel_settings.Whatsapp_Country.setCountry(e),jQuery("#channel_input_Whatsapp").trigger("keyup")}),200):""!=jQuery("#channel_input_Whatsapp").val()&&setTimeout((function(){jQuery("#channel_input_Whatsapp").trigger("keyup")}),200)}jQuery(".custom-channel-Whatsapp:not(#channel_input_Whatsapp)").length&&jQuery(".custom-channel-Whatsapp:not(#channel_input_Whatsapp)").each((function(){var e=jQuery(this).closest("li.chaty-channel").data("id");null!=e&&jQuery("#channel_input_"+e).length&&(cht_settings.channel_settings[e]=document.querySelector("#channel_input_"+e),window.intlTelInput(cht_settings.channel_settings[e],{dropdownContainer:document.body,formatOnDisplay:!0,hiddenInput:"full_number",initialCountry:"auto",nationalMode:!1,utilsScript:cht_settings.plugin_url+"admin/assets/js/utils.js"}))}))}function check_for_number_chaty(e,t){return!(""==e||("+"==e[0]&&(e=e.substr(1,e.length)),"Phone"==t&&"*"==e[0]&&(e=e.substr(1,e.length)),!isNaN(e)))}function check_for_preview_pos(){if(jQuery(".chaty-setting-form").length)if(jQuery(window).width()>1179){var e=parseInt(jQuery(".chaty-setting-form").offset().top);jQuery(".btn-save-sticky").css("top",e+58),jQuery(".btn-help, .preview-help-btn").css("top",e+58+145),jQuery("a.remove-chaty-widget-sticky").css("top",e+58+145+119)}else jQuery(".btn-save-sticky").attr("style",""),jQuery(".btn-help, .preview-help-btn").attr("style",""),jQuery("a.remove-chaty-widget-sticky").attr("style","")}jQuery((function(e){"use strict";var t=!1,a=!1,n=!1,c=!1,o=!1,i=!1,s=!1;function l(){if(e(".chaty-popup").hide(),0==e("#cht-form .js-chanel-desktop").length||0==e("#cht-form .js-chanel-mobile").length)return e("#no-device-popup").show(),!1;if(0==e("#cht-form .js-chanel-desktop:checked").length&&0==e("#cht-form .js-chanel-mobile:checked").length)return e("#device-popup").show(),!1;var t=0;return e("#channels-selected-list > li:not(#chaty-social-close)").find(".channels__input").each((function(){(""==jQuery.trim(e(this).val())||jQuery(this).hasClass("custom-channel-Whatsapp")&&-1==jQuery.trim(e(this).val()).indexOf("-"))&&t++})),t!=e("#channels-selected-list > li:not(#chaty-social-close)").find(".channels__input").length||e("#chaty-social-Contact_Us").length||e("#chaty-social-Chatway").length?u():(e("#no-device-value").show(),!1)}function r(){e.ajax({type:"POST",url:ajaxurl,data:{action:"get_chatway_status"},success:function(t){"completed"==t?(e(".chatway--notice--info").addClass("hidden"),e(".chatway--notice").addClass("hidden")):(e(".chatway--notice").removeClass("hidden"),e(".chatway--notice--info").addClass("hidden"),e(".plugin-"+t).removeClass("hidden")),"not-installed"==t||"not-activated"==t?e(".chaty-widget-tab").removeClass("chatway--active"):e(".chaty-widget-tab").addClass("chatway--active")}})}function u(){return e(".chaty-popup").hide(),e("#trigger_on_time").is(":checked")||e("#chaty_trigger_on_exit").is(":checked")||e("#chaty_trigger_on_scroll").is(":checked")?h():(e("#trigger-popup").show(),!1)}function h(){return e(".chaty-popup").hide(),e(".cht_active").is(":checked")?(t=!0,e("#cht-form").trigger("submit"),!0):(e("#status-popup").show(),!1)}function d(){if(p=!0,a){if(n){if(c){if(o){if(i)s||(s=!0,e("#channels-selected-list .phone-number").length&&e("#channels-selected-list .phone-number").each((function(){if(""!=jQuery.trim(e(this).val())&&jQuery.trim(e(this).val()).length>13)return e("#custom-message-popup .chaty-popup-header").text(e(this).data("label")+" number is not valid"),e("#custom-message-popup .chaty-popup-body").text("Seems like the "+e(this).data("label")+" number you're trying to enter isn't valid. Would you like to publish it anyway?"),e("#custom-message-popup").show(),!1})));else if(i=!0,e("#cht-form #Viber").length&&""!=e("#cht-form #Viber").val()){t=jQuery.trim(e("#cht-form #Viber").val());if(check_for_number_chaty(t,"Viber"))return e("#custom-message-popup .chaty-popup-header").text("Viber number is not valid"),e("#custom-message-popup .chaty-popup-body").text("Seems like the Viber number you're trying to enter isn't in the right syntax. Would you like to publish it anyway?"),e("#custom-message-popup").show(),!1}}else if(o=!0,e("#cht-form #SMS").length&&""!=e("#cht-form #SMS").val()){t=jQuery.trim(e("#cht-form #SMS").val());if(check_for_number_chaty(t,"SMS"))return e("#custom-message-popup .chaty-popup-header").text("SMS number is not valid"),e("#custom-message-popup .chaty-popup-body").text("Seems like the SMS number you're trying to enter isn't in the right syntax. Would you like to publish it anyway?"),e("#custom-message-popup").show(),!1}}else if(c=!0,e("#cht-form #Facebook_Messenger").length&&""!=e("#cht-form #Facebook_Messenger").val()){var t=jQuery.trim(e("#Facebook_Messenger").val());if(e("#cht-form #Facebook_Messenger").val(t),!/(?:http:\/\/)?facebook\.com\/(?:(?:\w)*#!\/)?(?:pages\/)?(?:[\w\-]*\/)*([\w\-]*)/.test(t)&&!/(?:http:\/\/)?m\.me\/(?:(?:\w)*#!\/)?(?:pages\/)?(?:[\w\-]*\/)*([\w\-]*)/.test(t))return e("#custom-message-popup .chaty-popup-header").text("Facebook page's URL is not valid"),e("#custom-message-popup .chaty-popup-body").text("Please make sure your Facebook page's URL looks like, <br/>https://m.me/YOURPAGE"),e("#custom-message-popup").show(),!1}}else if(n=!0,e("#cht-form #Phone").length&&""!=e("#cht-form #Phone").val()){var t=jQuery.trim(e("#cht-form #Phone").val());if(check_for_number_chaty(t,"Phone"))return e("#custom-message-popup .chaty-popup-header").text("Phone number is not valid"),e("#custom-message-popup .chaty-popup-body").text("Seems like the phone number you're trying to enter isn't in the right syntax. Would you like to publish it anyway?"),e("#custom-message-popup").show(),!1}}else{a=!0;if(e("#cht-form #Whatsapp").length&&""!=e("#cht-form #Whatsapp").val()){var t=jQuery.trim(e("#cht-form #Whatsapp").val());if(check_for_number_chaty(t,"Whatsapp"))return e("#custom-message-popup .chaty-popup-header").text("Whatsapp number is not valid"),e("#custom-message-popup .chaty-popup-body").text("Seems like the WhatsApp number you're trying to enter isn't in the right syntax. Would you like to publish it anyway?"),e("#custom-message-popup").show(),!1}}return l()}e(document).on("change",'input[name="cht_social_Chatway[chatway_position]"]:checked',(function(t){e("#chaty-social-Chatway").removeClass(["above-chaty","inside-chaty","outside-chaty"]),e("#chaty-social-Chatway").addClass(e(this).val()),change_custom_preview()})),e(window).on("load",(function(){setTimeout((()=>{e(".wp-editor-container iframe").contents().find("body").css({backgroundColor:"#fff",margin:0,padding:"0px 10px"})}),500)}));let p=!0;e(document).ready((function(){e(document).on("click",".btn-cancel.is-chatway, .icon.chat-channel-Chatway",(function(t){t.preventDefault(),e("#remove-chatway-channel").show()})),e(document).on("click",".btn-cancel.is-chatway",(function(t){t.preventDefault(),e("#remove-chatway-channel").show()})),e(document).on("click","#chatway-view-button",(function(t){let a="free";e("section").is("#pro")&&(a="pro"),e("#chatyway-info-popup .chaty-popup-inner").removeClass(["step-1","step-2","step-3"]),e("#chatyway-info-popup .chaty-popup-inner").addClass("step-3");const n=e('input[name="chatway_position"]:checked').val();if(e("#chaty_widget_url").length)return e("#chatyway-info-popup").hide(),void(window.location=e("#chaty_widget_url").val()+"&chatway_position="+n);e.ajax({type:"POST",dataType:"json",url:ajaxurl,data:{action:"choose_social",social:"Chatway",position:n,nonce_code:cht_nonce_ajax.cht_nonce,version:a,widget_index:e("#widget_index").val()},beforeSend:function(e){},success:function(t){e("#channels-selected-list").prepend(t);let a="Chatway";var n={material:{regular:{"list-icon":"","icon-style":"mt-regular",icons:["some","some2"]}}};e("#icon-picker-"+a).length&&e("#select-icon-"+a).length&&AestheticIconPicker({selector:"#icon-picker-"+a,onClick:"#select-icon-"+a,iconLibrary:n}),e("#icon-picker-agent-"+a).length&&e("#select-icon-agent-"+a).length&&AestheticIconPicker({selector:"#icon-picker-agent-"+a,onClick:"#select-icon-agent-"+a,iconLibrary:n}),e(document).trigger("chatyColorPicker/trigger",[{$scope:e("#chaty-social-Chatway"),element:".chaty-color-field"}]);const c=[];e(".channels-icons > .icon.active").each(((e,t)=>{c.push(t.dataset.social)})),wp.hooks.doAction("chaty.channel_update",{channel:c,target:"Chatway",action:"added",isExceeded:!1}),e("#chaty-chatway").hasClass("completed")&&e("#chaty-social-channel").trigger("click"),r(),change_custom_preview()}})})),document.addEventListener("visibilitychange",(function(){e("#chaty-social-Chatway").length&&"visible"===document.visibilityState&&r()})),e(".add-live-chat-btn").on("click",(function(){e("#chatyway-info-popup").hide()})),e(document).on("change",'input[name="cht_social_Chatway[chatway_icon]"]:checked',(function(){let t=e('label[for="icon-'+e(this).val()+'"] .chatway-icon').html(),a=e('input[name="cht_social_Chatway[bg_color]"]').val(),n="Chatway";e("#chaty-social-Chatway .chaty-main-svg").html(t),e("#chaty-social-Chatway .chaty-main-svg .color-element").css({fill:a}),jQuery("#cht_social_image_"+n).val(""),jQuery("#cht_social_image_src_"+n).attr("src",default_image),jQuery("#chaty_image_"+n).removeClass("icon-active").removeClass("img-active"),jQuery("#chaty_image_"+n+" .fa-icon").val(""),change_custom_preview()})),e(document).on("click","#chatway-custom-image",(function(t){t.preventDefault();let a="Chatway";var n=wp.media({title:"Upload Image",multiple:!1,library:{type:"image"}}).open().on("select",(function(t){let c=n.state().get("selection").first().toJSON();e("#cht_social_image_"+a).val(c.id),e(".custom-image-"+a+" img").attr("src",c.url),e(".chatway-custom-image img").attr("src",c.url),e("#chaty_image_"+a).addClass("img-active").removeClass("icon-active"),e("#chaty_image_"+a+" .fa-icon").val(""),e(".chatway-custom-image").addClass("img-active"),change_custom_preview(),e("#chatway-custom-image").prop("checked",!0)}))})),e(document).on("click","#chatway-remove-custom-image",(function(t){e(".chatway-custom-image").removeClass("img-active"),e("#chaty_image_Chatway").removeClass("img-active").removeClass("icon-active"),e("#chaty_image_Chatway .fa-icon").val(""),e("#cht_social_image_Chatway").val("")})),e(document).on("click",".remove--chatway",(function(t){t.preventDefault(),e("#chaty-social-Chatway").remove(),e(".chat-channel-Chatway").removeClass("active"),change_custom_preview(),e("#remove-chatway-channel").hide();const a=[];jQuery(".channels-icons > .icon.active").each(((e,t)=>{a.push(t.dataset.social)})),wp.hooks.doAction("chaty.channel_update",{channel:a,target:"Chatway",action:"removed",isExceeded:!1})})),e(document).on("change","input[name='cht_position']:checked",(function(){"custom"==e(this).val()?e("#positionPro").show():e("#positionPro").hide(),change_custom_preview()})),jQuery(".add-live-chat-btn").on("click",(function(){jQuery("#chatyway-info-popup").hide()}));var m=/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|ipad|iris|kindle|Android|Silk|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(navigator.userAgent)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(navigator.userAgent.substr(0,4))?1:0;e(document).on("change","input[name='cta_type']:checked",(function(){"simple-view"==e(this).val()?(e("#simple-view").removeClass("hide-it"),e("#chat-view").addClass("hide-it"),e(".chaty-chat-view-option").removeClass("hide-option"),e("#cta-header-color-setting").addClass("hide-it")):(e("#simple-view").addClass("hide-it"),e("#chat-view").removeClass("hide-it"),e(".chaty-chat-view-option").addClass("hide-option"),e("#cta-header-color-setting").removeClass("hide-it")),change_custom_preview()})),e(document).on("click",".add-properties",(function(t){t.preventDefault(),e(this).closest(".properties-box").toggleClass("active")})),e(document).on("click",".properties-list a",(function(t){t.preventDefault();var a=e.trim(e(this).data("txt"));if(e(this).closest(".form-horizontal__item").hasClass("has-iframe")){var n=e(this).closest(".form-horizontal__item").find("iframe");n.contents().find("p").length?n.contents().find("p:last-child").append(" "+a):n.contents().find(".mce-content-body").append(" "+a)}else a=e.trim(e.trim(e(this).closest(".form-horizontal__item").find(".add-properties").val())+" "+a),e(this).closest(".form-horizontal__item").find(".add-properties").val(a);change_custom_preview()})),e(document).on("click","#cta_woocommerce_status",(function(){e(this).is(":checked")?e(".woocommerce-settings").addClass("active"):e(".woocommerce-settings").removeClass("active")})),e(".form-fonts").SumoSelect({placeholder:"Select font family",csvDispCount:3}),e(".url-options, .url-select, .country-list").SumoSelect(),e("#chaty_attention_effect, #chaty_default_state").SumoSelect({placeholder:"Select font family",csvDispCount:3}),e(document).on("click","#chaty-social-channel",(function(){e("#current_step").val(0)})),e(document).on("click","#chaty-app-customize-widget",(function(){e("#current_step").val(1)})),e(document).on("click","#chaty-triger-targeting",(function(){e("#current_step").val(2)})),jQuery(document).on("click","#update-chaty-traffic-source-rule",(function(e){jQuery(".traffic-options-box").addClass("active"),jQuery("#chaty_traffic_source").val("yes")})),jQuery(document).on("click","#remove-traffic-rules",(function(e){jQuery(".traffic-options-box").removeClass("active"),jQuery("#chaty_traffic_source").val("no")})),jQuery(document).on("click",".remove-traffic-option",(function(e){jQuery(this).closest(".custom-traffic-rule").remove()})),e(document).on("click",".field-setting-col:not(.hide-label-setting) .field-label",(function(t){t.preventDefault(),e(this).closest(".label-flex").toggleClass("input-active")})),e(document).on("click",".chaty-switch-toggle",(function(){setTimeout((function(){e(".chaty-field-setting").each((function(){e(this).is(":checked")?(e(this).closest(".field-setting-col").find(".field-settings").addClass("active"),e(this).closest(".field-setting-col").removeClass("hide-label-setting")):(e(this).closest(".field-setting-col").find(".field-settings").removeClass("active"),e(this).closest(".field-setting-col").addClass("hide-label-setting"))}))}),100)})),e(document).on("change",".chaty-close_form_after-setting",(function(){setTimeout((function(){e(".chaty-close_form_after-setting").each((function(){e(this).is(":checked")?e(this).closest(".form-field-setting-col").find(".close_form_after-settings").addClass("active"):e(this).closest(".form-field-setting-col").find(".close_form_after-settings").removeClass("active")}))}),100)})),e(document).on("click",".agent-button-action, .add-agent-btn",(function(e){e.preventDefault(),jQuery("#agent-popup").show()})),e(document).on("keyup","#channel_input_Whatsapp",(function(){if(""!=e.trim(e(this).val())){var t=cht_settings.channel_settings.Whatsapp_Country.getSelectedCountryData(),a=e.trim(e(this).val());if("+"!=a[0]&&(a="+"+a,e(this).val(a),e(this).trigger("change")),Reflect.has(t,"dialCode")){var n=t.dialCode;if(a.length>n.length+1&&!a.includes("-")&&a.startsWith(`+${n}`)){var c=a.replace(`+${n}`,"");c=c.replaceAll(" ",""),e(this).val("+"+n+"-"+c)}}t.dialCode&&(a.length<=t.dialCode.length+1?e(this).closest(".test-btn").find(".wf-test-button").removeClass("active"):e(this).closest(".test-btn").find(".wf-test-button").addClass("active")),a.length>0&&!t.dialCode&&e(this).closest(".test-btn").find(".wf-test-button").removeClass("active"),"+"==a[0]&&1==e(this).val().length&&(e(this).closest(".channels__input-box").find(".iti__selected-flag").find(".iti__flag").attr("class","iti__flag"),e(this).closest(".channels__input-box").find(".iti__selected-flag").attr("title",""))}else""==e.trim(e(this).val())&&(e(this).closest(".channels__input-box").find(".iti__selected-flag").find(".iti__flag").attr("class","iti__flag"),e(this).closest(".channels__input-box").find(".iti__selected-flag").attr("title",""))})),e(document).on("click",".remove-zero-btn",(function(){let t=e("#channel_input_Whatsapp").val();t=t.replace(/-0+/,"-"),e("#channel_input_Whatsapp").val(t),e(".chaty-popup").hide(),p=!0,d()})),e(document).on("change",".custom-channel-Whatsapp",(function(){p=!1})),e(document).on("change",".chaty-redirect-setting",(function(){setTimeout((function(){e(".chaty-redirect-setting").each((function(){e(this).is(":checked")?e(this).closest(".form-field-setting-col").find(".redirect_action-settings").addClass("active"):e(this).closest(".form-field-setting-col").find(".redirect_action-settings").removeClass("active")}))}),100)})),e(document).on("click",".email-setting",(function(){setTimeout((function(){e(".email-setting-field").each((function(){e(this).is(":checked")?e(this).closest(".form-field-setting-col").find(".email-settings").addClass("active"):e(this).closest(".form-field-setting-col").find(".email-settings").removeClass("active")}))}),100)}));const y=[];jQuery(".channels-icons > .icon.active").each(((e,t)=>{y.push(t.dataset.social)})),wp.hooks.doAction("chaty.channel_update",{channel:y,target:null,action:"added",isExceeded:!1}),setTimeout((()=>{e(".whatsapp-welcome-message iframe").contents().find("body").css({backgroundColor:"#fff"})}),100),e(document).on("click",".chaty-embedded-window",(function(){setTimeout((function(){e(".embedded_window-checkbox").each((function(){if(e(this).is(":checked")){e(this).closest("li.chaty-channel").find(".whatsapp-welcome-message").addClass("active");e(this).closest("li.chaty-channel").find(".whatsapp-welcome-message iframe").contents().find("body").css({backgroundColor:"#fff"});var t=e(".csaas-widget").find(".csaas-cta-close").find("button").html();e("#"+(a="csaas-form-0-Whatsapp")).addClass("is-active"),e(".csaas-widget").removeClass("csaas-open"),e(".csaas").addClass("form-open"),e("#"+a).addClass("active"),e(".csaas-widget").find(".open-csaas-channel").html(t)}else{var a;e(this).closest("li.chaty-channel").find(".whatsapp-welcome-message").removeClass("active"),e("#"+(a="csaas-form-0-Whatsapp")).removeClass("is-active"),e(".csaas-widget").addClass("csaas-open"),e(".csaas").removeClass("form-open"),e("#"+a).removeClass("active")}}))}),300)})),jQuery("input[name='switchPreview']:checked").trigger("change"),e(document).on("change","#cht-form input",(function(){a=!1,n=!1,c=!1,o=!1,i=!1,s=!1})),e(document).on("click",".remove-js-script",(function(t){t.preventDefault(),e(this).closest(".channels__input-box").find("input").val(""),e(this).closest(".channels__input-box").find("input").removeClass("cht-input-error").removeClass("cht-js-error"),e(this).closest(".channels__input-box").find(".cht-error-message").remove(),e(this).remove()})),e("#cht-form").on("submit",(function(){if(t)return!0;e(this).find(".cht-input-error").removeClass("cht-input-error"),e(this).find(".cht-js-error").removeClass("cht-input-error"),e(this).find(".cht-error-message").remove(),e(this).find(".remove-js-script").remove(),set_social_channel_order();var a=0;return e("#chaty-page-options .cht-required").length&&e("#chaty-page-options .cht-required").each((function(){""==jQuery.trim(e(this).val())&&(e(this).addClass("cht-input-error"),a++)})),e(".chaty-data-and-time-rules .cht-required").length&&e(".chaty-data-and-time-rules .cht-required").each((function(){""==jQuery.trim(e(this).val())&&(e(this).addClass("cht-input-error"),a++)})),cht_nonce_ajax.has_js_access||e("#channels-selected-list .channels__input").each((function(){""!=e.trim(e(this).val())&&-1!=e.trim(e(this).val()).toLowerCase().indexOf("javascript")&&(e("body, html").scrollTop(0),e("#chaty-social-channel").trigger("click"),e(this).addClass("cht-input-error cht-js-error"),e(this).after("<span class='cht-error-message'>"+cht_nonce_ajax.js_message+"</span><a href='#' class='remove-js-script'>"+cht_nonce_ajax.remove+"</a>"),a++)})),0==a?function(){if(p)return d();if(e(".phone-number-list").html(""),e("#channel_input_Whatsapp").length&&""!=e("#channel_input_Whatsapp").val()&&-1!=e("#channel_input_Whatsapp").val().indexOf("-0")){let t=e("#channel_input_Whatsapp").val(),a=`<div class='number-list is-not-agent'>${e(".phone-number-list").data("label")}: <b>${t}</b> <a class="whatsapp-test-btn" target="_blank" href='${"https://wa.me/"+toHtmlEntities(e.trim(t).replace(/[^a-zA-Z0-9 ]/g,""))}'>Test</a></div>`;return e(".phone-number-list").html(a),e("#whatsapp-message-popup").show(),!1}return d()}():(e(".cht-input-error:first").focus(),!1)})),e(".chaty-popup-outer").on("click",(function(t){e(".chaty-popup").hide()})),e(".check-for-numbers").on("click",(function(){d()})),e(".check-for-device").on("click",(function(){l()})),e(".check-for-triggers").on("click",(function(){u()})),e(".check-for-status").on("click",(function(){h()})),e(".change-status-and-save").on("click",(function(){e(".cht_active").prop("checked",!0),t=!0,e(".chaty-popup").hide(),e("#cht-form").trigger("submit")})),e(".status-and-save").on("click",(function(){e(".cht_active").prop("checked",!1),t=!0,e(".chaty-popup").hide(),e("#cht-form").trigger("submit")})),jQuery(document).on("click","#create-date-rule",(function(e){jQuery("#date-schedule").addClass("active"),jQuery("#cht_date_rules").val("yes")})),jQuery(document).on("click","#remove-date-rule",(function(e){jQuery("#date-schedule").removeClass("active"),jQuery("#cht_date_rules").val("no")})),jQuery(document).on("click",".wf-test-button",(function(){var t=jQuery(this).data("slug");jQuery("#"+t+"_popup").addClass("active");var a="",n=e(".custom-channel-"+t).val();if(console.log(n),"Whatsapp"==t){var c=n.replaceAll("+","").replaceAll(" ","").replaceAll("-","");a=m?"https://wa.me/"+c:"https://web.whatsapp.com/send?phone="+c,e("#"+t+"_popup").find(".phone-value").text(n)}"Facebook_Messenger"==t&&(a=n,e("#"+t+"_popup").find(".phone-value").text(n)),window.open(a,"_blank")})),e(document).on("click",".edit-number",(function(){var t=e(this).closest(".test-popup").data("label");e(".custom-channel-"+t).focus(),e(".test-popup").removeClass("active")})),jQuery(document).on("click",".test-popup-bg, .test-popup-close-btn, .test-popup .save-btn",(function(){jQuery(".test-popup").removeClass("active")})),e(document).on("keyup",".custom-channel-Facebook_Messenger",(function(){""!=e(this).val()?e(this).closest(".test-btn").find(".wf-test-button").addClass("active"):e(this).closest(".test-btn").find(".wf-test-button").removeClass("active")})),e(document).on("click",".test-popup .contact-link",(function(){e(".chaty-help-form").addClass("active"),e(".test-popup").removeClass("active")})),e(document).on("keyup","#wp_popup_headline, #wp_popup_nickname",(function(){change_custom_preview()}));var g="";e(document).on("click",".upload-wp-profile",(function(){g=e(this).data("for");var t=wp.media({title:"Select Whatsapp Profile",multiple:!1,library:{type:"image"}}).open().on("select",(function(a){var n=t.state().get("selection").first().toJSON();e("#"+g+"-custom-image-upload .img-value").val(n.url),e("#"+g+"-custom-image-upload").addClass("active"),e("#"+g+"-custom-image-upload .image-info").html("<img src='"+n.url+"'>"),change_custom_preview()}))})),e(document).on("click",".remove-custom-img",(function(){e(this).closest(".custom-img-upload").removeClass("active"),e(this).closest(".custom-img-upload").find(".image-info").html(""),e(this).closest(".custom-img-upload").find(".img-value").val(""),change_custom_preview()})),checkForUserCountry()}))})),function(e){jQuery(window).on("popstate",(function(e){window.onbeforeunload=null,window.history&&window.history.pushState&&window.history.back()})),jQuery(document).ready((function(){jQuery(".chaty-table").length||jQuery("body input, body .icon, body textarea, body .btn-cancel:not(.close-btn-set) ").on("click",(function(e){window.onbeforeunload=function(e){(e=e||window.event).preventDefault=!0,e.cancelBubble=!0,e.returnValue="Your beautiful goodbye message"}})),jQuery(document).on("submit","form",(function(e){window.onbeforeunload=null})),jQuery(document).on("change",".channel-select-input",(function(t){var a=e(this).closest("li").attr("data-id");jQuery.ajax({type:"POST",url:ajaxurl,dataType:"json",data:{social:jQuery(this).val(),channel:a,action:"get_chaty_settings"},success:function(t){1==t.status&&("Whatsapp"==t.data.slug?e("#channel_input_"+t.channel).length&&(cht_settings.channel_settings[t.channel]=document.querySelector("#channel_input_"+t.channel),window.intlTelInput(cht_settings.channel_settings[t.channel],{dropdownContainer:document.body,formatOnDisplay:!0,hiddenInput:"full_number",initialCountry:"auto",nationalMode:!1,utilsScript:cht_settings.plugin_url+"admin/assets/js/utils.js"})):e("#chaty-social-"+t.channel+" .channels__input-box").html("<input type='text' class='channels__input' name='cht_social_"+t.channel+"[value]' id='channel_input_"+t.channel+"' />"),jQuery(".custom-icon-"+t.channel+" svg").html(t.data.svg),jQuery("#chaty-social-"+t.channel).attr("data-channel",t.data.slug),jQuery("#chaty-social-"+t.channel).find(".sp-preview-inner").css("background-color",t.data.color),jQuery("#chaty-social-"+t.channel).find(".chaty-color-field").val(t.data.color),jQuery("#chaty-social-"+t.channel).find(".channels__input").attr("placeholder",t.data.placeholder),jQuery("#chaty-social-"+t.channel).find(".channel-example").text(t.data.example),jQuery("#chaty-social-"+t.channel).find(".chaty-title").val(t.data.title),jQuery("#chaty-social-"+t.channel).find(".icon").attr("data-title",t.data.title),jQuery("#chaty-social-"+t.channel).find(".chaty-color-field").trigger("change"),jQuery(".help-section").html(""),""!=t.data.help_link?jQuery(".help-section").html('<div class="viber-help"><a target="_blank" href="'+t.data.help_link+'">'+t.data.help_title+"</a></div>"):""!=t.data.help_text&&jQuery(".help-section").html('<div class="viber-help"><span class="help-text">'+t.data.help_text+'</span><span class="help-title">'+t.data.help_title+"</span></div>"))}})})),jQuery(document).on("click","#chaty_icons_view",(function(e){jQuery(".page-body .chaty-widget").removeClass("vertical").removeClass("horizontal"),jQuery(".page-body .chaty-widget").addClass(jQuery(this).val())})),jQuery(".upg").on("click",(function(e){jQuery(".valid_domain_input").val(jQuery(".valid_domain_input").val().replace(" ","")),/^(http(s)?:\/\/)?(www\.)?[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(:[0-9]{1,5})?(\/.*)?$/.test(jQuery(".valid_domain_input").val())||(e.preventDefault(),jQuery(".valid_domain").fadeIn().css({display:"block"}))})),jQuery(document).on("blur","#channels-selected-list > li:not(#chaty-social-close) .channels__input",(function(){jQuery(this).hasClass("border-red")&&""!=jQuery(this).val()&&jQuery(this).removeClass("border-red")}));var t=1000000003;jQuery(".show_up").on("click",(function(){t+=10,jQuery("#upgrade-modal").css({"z-index":t,display:"block","margin-left":"-258px"})})),jQuery(".color-picker-btn, .color-picker-btn-close, .color-picker-custom button").on("click",(function(e){e.preventDefault(),jQuery(".color-picker-box").toggle(),jQuery(".color-picker-btn").toggle()})),e(window).on("click",(function(e){0===jQuery(e.target).parents(".color-picker-dropdown").length&&(jQuery(".color-picker-btn").show(),jQuery(".color-picker-box").hide())})),jQuery(".color-picker-radio input").on("change",(function(){var e=jQuery(this);if(jQuery('.color-picker-custom input[name="cht_custom_color"]').val(""),jQuery(".color-picker-custom .circle").html("?").css({"background-color":"#fff"}),e.prop("checked")){jQuery(".color-picker-radio input").prop("checked",!1),e.prop("checked",!0);var t=e.val(),a=e.prop("title")}else t=jQuery(".color-picker-custom input").val(),a="Custom";""!=t&&-1==t.indexOf("#")&&(t="#"+t),jQuery(".color-picker-btn .circle").css({backgroundColor:t}),jQuery(".color-picker-btn .text").text(a),jQuery("#chaty-social-close ellipse").attr("fill",t)})),jQuery(".color-picker-custom input").on("change",(function(){jQuery(".color-picker-radio input").prop("checked",!1);var e=jQuery(this).val();""!=e&&-1==e.indexOf("#")&&(e="#"+e),jQuery(".color-picker-btn .circle").css({backgroundColor:e}),jQuery(".color-picker-btn .text").text("Custom"),jQuery("#chaty-social-close ellipse").attr("fill",e)})),jQuery('[name="cht_position"]').on("change",(function(){jQuery("#positionCustom").prop("checked")?jQuery("#positionPro").show():jQuery("#positionPro").hide()})),jQuery(".update_token").on("click",(function(t){t.preventDefault();var a=jQuery('input[name="cht_token"]').val();e.ajax({type:"POST",url:ajaxurl,data:{action:"add_token",nonce_code:cht_nonce_ajax.cht_nonce,token:a},beforeSend:function(e){},success:function(e){e?(alert("Your pro plan is activated"),location.reload()):alert("You`ve entered a wrong token")},error:function(e,t,a){}})}))}))}(jQuery),function(e){jQuery(document).ready((function(){n();var t=jQuery(".channels-icons > .icon-sm:not(.chat-channel-Chatway)"),a=jQuery(".social-inputs");function n(){jQuery("section").is("#pro")||(jQuery(".channels-selected__item").length<=1?jQuery(".channels-selected__item").hide():jQuery(".channels-selected__item").length>=2&&jQuery(".channels-selected__item").show())}jQuery("input[name=cht_custom_color]").on("keyup",(function(e){var t=jQuery(this).val();(jQuery(".circle").html(""),""!=t)&&(-1==t.indexOf("#")&&(t="#"+t),jQuery(".color-picker-custom .circle").css({"background-color":t}));jQuery(this).val().length<1&&jQuery(".color-picker-custom .circle").html("?")})),t.on("click",(function(){jQuery(".popover").removeClass("shake-it"),n();var c=jQuery(this),o=c.data("social");a.find(".social-form-group");if(c.hasClass("active")){var s=","+jQuery(this).attr("data-social");l=(l=jQuery(".add_slug").val()).replace(s,""),jQuery(".add_slug").val(l),l=l.replace(s,""),jQuery(".add_slug").val(l),l=l.replace(s,""),jQuery(".add_slug").val(l),l=l.replace(s,""),jQuery(".add_slug").val(l),c.toggleClass("active");const e=[];return jQuery(".channels-icons > .icon.active").each(((t,a)=>{e.push(a.dataset.social)})),void wp.hooks.doAction("chaty.channel_update",{channel:e,target:o,action:"removed",isExceeded:!1})}if(t.addClass("disabled"),icon=jQuery(this).data("social"),"1"==jQuery(".add_slug").val().indexOf(icon)&&""!=jQuery(".add_slug").val()){var l;s=","+icon;l=(l=jQuery(".add_slug").val()).replace(s,""),jQuery(".add_slug").val(l),l=l.replace(s,""),jQuery(".add_slug").val(l),l=l.replace(s,""),jQuery(".add_slug").val(l)}else jQuery(".add_slug").val(jQuery(".add_slug").val()+","+jQuery(this).attr("data-social"));c.toggleClass("active"),e.ajax({type:"POST",dataType:"json",url:ajaxurl,data:{action:"choose_social",social:o,nonce_code:cht_nonce_ajax.cht_nonce,version:"free",widget_index:jQuery("#widget_index").val()},beforeSend:function(e){},success:function(a){var c=jQuery(a),s=c.find(".icon").data("title");c.data("channel");if(jQuery('.channels-selected div[data-social="'+s+'"]').length||(jQuery("#chaty-social-close").before(c),jQuery("#chaty-social-"+o+" .chaty-whatsapp-setting-textarea").length&&(editorId=jQuery("#chaty-social-"+o+" .chaty-whatsapp-setting-textarea").attr("id"),tinymce.init({selector:jQuery("#chaty-social-"+o+" .chaty-whatsapp-setting-textarea").attr("id"),toolbar:"bold, italic, underline | emoji",menubar:!1,branding:!1,setup:function(e){e.addButton("emoji",{image:cht_nonce_ajax.icon_img,onclick:function(){const{createPopup:e}=window.picmoPopup,t=jQuery(".mce-emoji-custom-icon button").attr("id"),a=document.querySelector("#"+t),n=e({},{referenceElement:a,triggerElement:a,position:"right-start",hideOnEmojiSelect:!1});n.toggle(),n.addEventListener("emoji:select",(e=>{let t=tinyMCE.get(editorId);t.selection.getNode()&&t.selection.getNode()!==t.getBody()||(t.focus(),t.selection.select(t.getBody(),!0),t.selection.collapse(!1)),tinymce.activeEditor.execCommand("mceInsertContent",!1,e.emoji),change_custom_preview(),jQuery("#csaas-form-0-Whatsapp .csaas-whatsapp-message .csaas-whatsapp-message-content").html(t.getContent())}))},classes:"emoji-custom-icon"}),e.on("keyup",(function(t){change_custom_preview(),jQuery("#csaas-form-0-Whatsapp .csaas-whatsapp-message .csaas-whatsapp-message-content").html(e.getContent())}))}}),tinymce.execCommand("mceAddEditor",!0,editorId))),t.removeClass("disabled"),e("#iconWidget").show(),i(),n(),set_social_channel_order(),check_for_chaty_close_button(),e("#channel_input_Whatsapp").length){cht_settings.channel_settings.Whatsapp=document.querySelector("#channel_input_Whatsapp"),cht_settings.channel_settings.Whatsapp_Country=window.intlTelInput(cht_settings.channel_settings.Whatsapp,{formatOnDisplay:!1,hiddenInput:"full_number",initialCountry:"auto",nationalMode:!1,autoHideDialCode:!1,utilsScript:cht_settings.plugin_url+"admin/assets/js/utils.js"});var l=getUserCountry();"-"!=l&&""==e("#channel_input_Whatsapp").val()?setTimeout((function(){cht_settings.channel_settings.Whatsapp_Country.setCountry(l),e("#channel_input_Whatsapp").closest(".channels__input-box").find(".iti__selected-flag").find(".iti__flag").addClass("iti__"+l),e("#channel_input_Whatsapp").trigger("keyup")}),200):""!=e("#channel_input_Whatsapp").val()&&setTimeout((function(){e("#channel_input_Whatsapp").trigger("keyup")}),200)}jQuery(".custom-channel-Whatsapp").length&&jQuery(".custom-channel-Whatsapp").each((function(){if(!jQuery(this).closest(".iti__flag-container").length){var e=jQuery(this).closest("li.chaty-channel").data("id");jQuery("#channel_input_"+e).length&&(cht_settings.channel_settings[e]=document.querySelector("#channel_input_"+e),window.intlTelInput(cht_settings.channel_settings[e],{dropdownContainer:document.body,formatOnDisplay:!0,hiddenInput:"full_number",initialCountry:"auto",nationalMode:!1,utilsScript:cht_settings.plugin_url+"admin/assets/js/utils.js"}))}})),jQuery(document).trigger("chatyColorPicker/trigger",[{$scope:jQuery(`#chaty-social-${o}`),element:".chaty-color-field"}]);const r=[];jQuery(".channels-icons > .icon.active").each(((e,t)=>{r.push(t.dataset.social)})),wp.hooks.doAction("chaty.channel_update",{channel:r,target:o,action:"added",isExceeded:!1})},error:function(e,t,a){}}),n()})),jQuery("body").on("click",".icon, .btn-cancel:not(.close-btn-set):not(.is-chatway)",(function(e){if(!jQuery(this).hasClass("close-btn-set")&&(e.preventDefault(),!jQuery(this).hasClass("icon")||!jQuery(this).hasClass("active"))){if(icon=jQuery(this).data("social"),jQuery(this).hasClass("btn-cancel")){jQuery('.icon.active[data-social^="'+icon+'"]').removeClass("active");var t=","+icon,a=jQuery(".add_slug").val();a=a.replace(t,""),jQuery(".add_slug").val(a);const e=[];jQuery(".channels-icons > .icon.active").each(((t,a)=>{e.push(a.dataset.social)})),wp.hooks.doAction("chaty.channel_update",{channel:e,target:icon,action:"removed",isExceeded:!1})}jQuery("#chaty-social-"+icon).remove();jQuery(this).parent(".channels-selected__item");i(),n(),set_social_channel_order(),check_for_chaty_close_button()}})),jQuery(".btn-help").on("click",(function(e){window.open("https://premio.io/help/chaty/","_blank")})),jQuery(".free-custom-radio, .free-custom-checkbox").on("click",(function(e){e.stopPropagation()}));var c=jQuery("[name=cht_cta]"),o=jQuery(".preview .tooltip-show");c.on("keyup",(function(){var e=jQuery(".preview .page .icon");c.val().length>=1?e.removeClass("no-tooltip"):e.addClass("no-tooltip"),o.attr("data-title",c.val())}));document.getElementById("iconWidget"),jQuery(".color-picker-radio input:checked").val();function i(){change_custom_preview()}function s(){return!!jQuery("#previewDesktop").is(":checked")}jQuery(document).on("keyup","textarea.test_textarea, .chaty-title",(function(){i()})),jQuery(".js-switch-preview").on("change",(function(){s()?jQuery(this).closest(".preview").removeClass("mobiel-view"):jQuery(this).closest(".preview").addClass("mobiel-view"),i()})),jQuery(document).on("change","input[name='cht_pending_messages']",(function(){jQuery("#cht_pending_messages").is(":checked")?jQuery(".pending-message-items").addClass("active"):jQuery(".pending-message-items").removeClass("active"),i()})),jQuery(document).on("change","#cht_number_of_messages",(function(){i()})),jQuery(document).on("change","#cht_number_color, #cht_number_bg_color",(function(){i()})),jQuery(document).on("keyup","#cht_number_of_messages",(function(){i()})),jQuery(document).on("blur","#cht_number_of_messages",(function(){i()})),jQuery(document).on("change",".js-chanel-icon",(function(){i()})),jQuery(document).on("change",".js-widget-i",(function(e){e.target.classList.contains("js-upload")?jQuery(".file-preview-image").last().parent().html():jQuery("i[data-type="+jQuery(".js-widget-i:checked").val()+"]").html(),i()})),"chat-image"!==jQuery(".js-widget-i:checked").attr("data-type")&&(jQuery("i[data-type="+jQuery(".js-widget-i:checked").attr("data-type")+"]").html(),i())})),jQuery(document).ready((function(){jQuery(".toast-message").length&&(jQuery(".toast-message").show(),jQuery(".toast-message").addClass("active"),setTimeout((function(){jQuery(".toast-message").removeClass("active")}),5e3)),jQuery(document).on("click",".toast-close-btn a",(function(e){e.preventDefault(),jQuery(".toast-message").removeClass("active")})),jQuery(document).on("click",".chaty-popup-box button, #chaty-intro-popup",(function(t){t.stopPropagation();var a=jQuery("#chaty_update_popup_status").val();e("#chaty-intro-popup").remove(),e.ajax({type:"POST",url:ajaxurl,data:{action:"chaty_update_popup_status",nonce:a},beforeSend:function(e){},success:function(e){},error:function(e,t,a){}})})),jQuery(document).on("click",".chaty-popup-box",(function(e){})),jQuery(document).on("click",".remove-chaty-options",(function(t){t.preventDefault(),t.stopPropagation(),confirm("Are you sure you want to delete this widget?")&&e.ajax({type:"POST",url:ajaxurl,data:{action:"remove_chaty_widget",nonce_code:cht_nonce_ajax.cht_nonce,widget_index:jQuery("#widget_index").val()},beforeSend:function(e){},success:function(e){window.location=e},error:function(e,t,a){}})}));window.location.href;window.location.href.indexOf("page=chaty-app&widget=")>-1&&jQuery("#toplevel_page_chaty-app .wp-submenu.wp-submenu-wrap li").each((function(){var e=jQuery(this).find("a").attr("href");void 0!==e&&(jQuery(this).removeClass("current"),window.location.href.indexOf(e)>-1&&e.indexOf("&widget=")>-1&&jQuery(this).addClass("current"))}))}))}(jQuery),jQuery(window).on("resize",(function(){check_for_preview_pos()})),jQuery(window).on("scroll",(function(){check_for_preview_pos()})),jQuery(document).ready((function(){check_for_preview_pos()}));var totalPageOptions=0,pageOptionContent="",totalDateAndTimeOptions=0,dateAndTimeOptionContent="";jQuery(document).ready((function(){var e=!1;function t(){jQuery(".chaty-whatsapp-setting-textarea").length&&jQuery(".chaty-whatsapp-setting-textarea").each((function(){jQuery("#cht_social_embedded_message_"+jQuery(this).data("id")+"_ifr").length&&tinymce.get(jQuery(this).attr("id")).remove();var e=jQuery(this).attr("id");tinymce.init({selector:jQuery(this).attr("id"),toolbar:"bold, italic, underline | emoji",menubar:!1,branding:!1,setup:function(t){t.addButton("emoji",{image:cht_nonce_ajax.icon_img,onclick:function(){const{createPopup:t}=window.picmoPopup,a=jQuery(".mce-emoji-custom-icon button").attr("id"),n=document.querySelector("#"+a),c=t({},{referenceElement:n,triggerElement:n,position:"right-start",hideOnEmojiSelect:!1});c.toggle(),c.addEventListener("emoji:select",(t=>{let a=tinyMCE.get(e);a.selection.getNode()&&a.selection.getNode()!==a.getBody()||(a.focus(),a.selection.select(a.getBody(),!0),a.selection.collapse(!1)),tinymce.activeEditor.execCommand("mceInsertContent",!1,t.emoji),change_custom_preview(),jQuery("#csaas-form-0-Whatsapp .csaas-whatsapp-message .csaas-whatsapp-message-content").html(a.getContent())}))},classes:"emoji-custom-icon"}),t.on("keyup",(function(e){change_custom_preview(),jQuery("#csaas-form-0-Whatsapp .csaas-whatsapp-message .csaas-whatsapp-message-content").html(t.getContent())}))}}),tinymce.execCommand("mceAddEditor",!0,jQuery(this).attr("id"))}))}if((/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|ipad|iris|kindle|Android|Silk|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(navigator.userAgent)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(navigator.userAgent.substr(0,4)))&&(e=!0),totalPageOptions=parseInt(jQuery(".chaty-page-option").length),pageOptionContent=jQuery(".chaty-page-options-html").html(),jQuery(".chaty-page-options-html").remove(),totalDateAndTimeOptions=parseInt(jQuery(".chaty-date-time-option").length),dateAndTimeOptionContent=jQuery(".chaty-date-and-time-options-html").html(),jQuery(".chaty-date-and-time-options-html").remove(),t(),jQuery(".create-rule").on("click",(function(){const e=jQuery(this).parents(".chaty-option-box");e.find(".chaty-page-options").removeClass("hidden"),e.find(".remove-rules").removeClass("hidden").addClass("inline-block")})),jQuery(".remove-rules").on("click",(function(){const e=jQuery(this).parents(".chaty-option-box");e.find(".chaty-page-options").addClass("hidden"),e.find(".remove-rules").removeClass("inline-block").addClass("hidden")})),jQuery(document).on("change","#chaty_attention_effect",(function(){change_custom_preview()})),jQuery(document).on("change","input[name='cht_color']:checked",(function(){var e=jQuery(this),t=e.val(),a=e.prop("title");jQuery(".color-picker-btn .circle").css({backgroundColor:t}),jQuery(".color-picker-btn .text").text(a),jQuery("#chaty-social-close ellipse").attr("fill",t),jQuery(".preview .page #iconWidget svg circle").css({fill:t}),jQuery(".preview .page .chaty-close-icon ellipse").css({fill:t}),jQuery("#cht_custom_color").val(jQuery(this).val()),change_custom_preview()})),jQuery(document).on("change","input[name='cht_position']:checked",(function(){change_custom_preview()})),setInterval((function(){var e=jQuery("#chaty_attention_effect").attr("data-effect");""!=e?(jQuery("#iconWidget").removeClass("chaty-animation-"+e),jQuery("#iconWidget").removeClass("start-now"),setTimeout((function(){jQuery("#iconWidget").addClass("chaty-animation-"+jQuery("#chaty_attention_effect").val()).addClass("start-now")}),1e3)):jQuery("#chaty_attention_effect").attr("data-effect",jQuery("#chaty_attention_effect").val())}),5e3),jQuery(document).on("click",".remove-chaty",(function(){jQuery(".page-options").toggle()})),jQuery(document).on("click",".remove-page-option",(function(){jQuery(".chaty-data-and-time-rules ").toggle()})),jQuery("#image-upload-content .custom-control-label").on("click",(function(e){return e.stopPropagation(),jQuery(this).closest(".custom-control").find("input[type=radio]").attr("checked",!0),jQuery(".js-widget-i").trigger("change"),!1})),jQuery(document).trigger("chatyColorPicker/trigger",[{$scope:jQuery(document),element:".chaty-color-field"}]),jQuery(".chaty-color-field").on("change",(function(){chaty_set_bg_color(),change_custom_preview()})),jQuery(".remove-chaty-img").on("click",(function(e){e.stopPropagation()})),e||jQuery("#channels-selected-list").sortable({placeholder:"ui-chaty-state-hl",items:"li.chaty-channel:not(#chaty-social-close)",handle:".move-icon",stop:function(){t()},update:function(e,a){set_social_channel_order(),change_custom_preview(),t()}}),jQuery(".close-button-img img, .close-button-img .image-upload").on("click",(function(){var e=wp.media({title:"Upload Image",multiple:!1,library:{type:"image"}}).open().on("select",(function(t){var a=e.state().get("selection").first();imageData=a.toJSON(),jQuery(".close-button-img").addClass("active"),jQuery(".close-button-img input").val(imageData.id),jQuery(".close-button-img img").attr("src",imageData.url),change_custom_preview()}))})),jQuery(".remove-close-img").on("click",(function(){default_image=jQuery("#default_image").val(),jQuery(".close-button-img").removeClass("active"),jQuery(".close-button-img input").val(""),jQuery(".close-button-img img").attr("src",default_image),change_custom_preview()})),jQuery(document).on("click",".chaty-widget.click",(function(e){e.preventDefault(),jQuery(".chaty-widget").toggleClass("active")})),jQuery(document).on("change",".url-options.cht-required",(function(e){thisVal=jQuery(this).val(),siteURL=jQuery("#chaty_site_url").val(),newURL=siteURL,"page_has_url"==thisVal?newURL=siteURL:"page_contains"==thisVal?newURL=siteURL+"%s%":"page_start_with"==thisVal?newURL=siteURL+"s%":"page_end_with"==thisVal&&(newURL=siteURL+"%s"),jQuery(this).closest(".url-content").find(".chaty-url").text(newURL)})),check_for_chaty_close_button(),chaty_set_bg_color(),change_custom_preview(),jQuery(".chaty-settings.cls-btn a, .close-btn-set").on("click",(function(e){e.preventDefault(),jQuery(".cls-btn-settings, .close-btn-set").toggleClass("active")})),0==jQuery("input[name='cht_position']:checked").length&&(jQuery("#right-position").attr("checked",!0),jQuery("input[name='cht_position']:checked").trigger("change")),0==jQuery("input[name='widget_icon']:checked").length&&(jQuery("input[name='widget_icon']:first").attr("checked",!0),jQuery("input[name='widget_icon']:checked").trigger("change")),jQuery(document).on("change","#cht_widget_font",(function(){var e=jQuery("#cht_widget_font").val();"System Stack"==e&&(e="-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif");var t=jQuery("#cht_widget_font option:selected").data("group");jQuery(".chaty-google-font").remove(),"Google Fonts"==t&&(jQuery("head").append('<link class="chaty-google-font" rel="preload" as="style" href="https://fonts.googleapis.com/css?family='+e+'&display=swap">'),jQuery("head").append('<link class="chaty-google-font" rel="stylesheet" href="https://fonts.googleapis.com/css?family='+e+'&display=swap">')),change_custom_preview()})),""!=jQuery("#cht_widget_font").val()){var a=jQuery("#cht_widget_font").val();"System Stack"==a&&(a="-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif"),jQuery("#csaas-widget-0").css("font-family",a);var n=jQuery("#cht_widget_font option:selected").data("group");jQuery(".chaty-google-font").remove(),"Google Fonts"==n&&(jQuery("head").append('<link class="chaty-google-font" rel="preload" as="style" href="https://fonts.googleapis.com/css?family='+a+'&display=swap">'),jQuery("head").append('<link class="chaty-google-font" rel="stylesheet" href="https://fonts.googleapis.com/css?family='+a+'&display=swap">'))}})),jQuery(window).on("load",(function(){check_for_chaty_close_button(),chaty_set_bg_color(),jQuery(".chaty-page-options .chaty-page-option").removeClass("last"),jQuery(".chaty-page-options .chaty-page-option:last").addClass("last"),jQuery(".url-options.cht-required").each((function(){jQuery(this).trigger("change")}))}));var selectedsocialSlug="";function upload_chaty_image(e){selectedsocialSlug=e;var t=wp.media({title:"Upload Image",multiple:!1,library:{type:"image"}}).open().on("select",(function(e){var a=t.state().get("selection").first();imageData=a.toJSON(),jQuery("#cht_social_image_"+selectedsocialSlug).val(imageData.id),jQuery(".custom-image-"+selectedsocialSlug+" img").attr("src",imageData.url),jQuery("#chaty-social-"+selectedsocialSlug+" .channels-selected__item").addClass("img-active"),change_custom_preview()}))}function toggle_chaty_setting(e){if(jQuery("#chaty-social-"+e).find(".chaty-advance-settings").toggle(),jQuery("#chaty-social-"+e).find(".chaty-advance-settings").toggleClass("active"),"Contact_Us"==e&&jQuery("#Contact_Us-close-btn").length){var t=jQuery("#Contact_Us-close-btn").data("nonce");jQuery("#Contact_Us-close-btn").hasClass("active")||(jQuery("#Contact_Us-close-btn").addClass("active"),jQuery.ajax({type:"POST",url:ajaxurl,data:{nonce:t,action:"update_channel_setting"},success:function(e){}}))}jQuery("#chaty-social-"+e+" .chaty-advance-settings.active").length&&jQuery("body,html").animate({scrollTop:jQuery("#chaty-social-"+e+" .chaty-advance-settings.active").offset().top-50},500)}function chaty_set_bg_color(){jQuery(".chaty-color-field:not(.button-color)").each((function(){""!=jQuery(this).val()&&"#ffffff"!=jQuery(this).val()&&("Linkedin"!=jQuery(this).closest("li").data("id")||"Linkedin"==jQuery(this).closest("li").data("id")&&"#ffffff"!=jQuery(this).val())&&(defaultColor=jQuery(this).val(),jQuery(this).closest(".channels-selected__item").find(".color-element").css("fill",defaultColor),jQuery(this).closest(".channels-selected__item").find(".custom-chaty-image").css("background",defaultColor),jQuery(this).closest(".channels-selected__item").find(".facustom-icon").css("background",defaultColor))})),change_custom_preview()}function upload_qr_code(){var e=wp.media({title:"Upload QR Image",multiple:!1,library:{type:"image"}}).open().on("select",(function(t){var a=e.state().get("selection").first();imageData=a.toJSON(),jQuery("#upload_qr_code_val").val(imageData.id),jQuery("#upload_qr_code img").attr("src",imageData.url),jQuery(".remove-qr-code").addClass("active"),change_custom_preview()}))}function remove_qr_code(){jQuery(".remove-qr-code").removeClass("active"),jQuery("#upload_qr_code_val").val(""),default_image=jQuery("#default_image").val(),jQuery("#upload_qr_code img").attr("src",default_image),change_custom_preview()}function remove_chaty_image(e){default_image=jQuery("#default_image").val(),jQuery("#chaty-social-"+e+" .channels-selected__item").removeClass("img-active"),jQuery("#cht_social_image_"+e).val(""),jQuery("#cht_social_image_src_"+e).attr("src",default_image),change_custom_preview()}var baseIcon='<svg version="1.1" id="ch" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="-496 507.7 54 54" style="enable-background:new -496 507.7 54 54;" xml:space="preserve">\n                            <style type="text/css">.st0 {fill: #A886CD;}  .st1 {fill: #FFFFFF;}\n                        </style><g><circle class="st0" cx="-469" cy="534.7" r="27"/></g><path class="st1" d="M-459.9,523.7h-20.3c-1.9,0-3.4,1.5-3.4,3.4v15.3c0,1.9,1.5,3.4,3.4,3.4h11.4l5.9,4.9c0.2,0.2,0.3,0.2,0.5,0.2 h0.3c0.3-0.2,0.5-0.5,0.5-0.8v-4.2h1.7c1.9,0,3.4-1.5,3.4-3.4v-15.3C-456.5,525.2-458,523.7-459.9,523.7z"/>\n                                                    <path class="st0" d="M-477.7,530.5h11.9c0.5,0,0.8,0.4,0.8,0.8l0,0c0,0.5-0.4,0.8-0.8,0.8h-11.9c-0.5,0-0.8-0.4-0.8-0.8l0,0\n                            C-478.6,530.8-478.2,530.5-477.7,530.5z"/>\n                                                    <path class="st0" d="M-477.7,533.5h7.9c0.5,0,0.8,0.4,0.8,0.8l0,0c0,0.5-0.4,0.8-0.8,0.8h-7.9c-0.5,0-0.8-0.4-0.8-0.8l0,0\n                            C-478.6,533.9-478.2,533.5-477.7,533.5z"/>\n                        </svg>',defaultIcon='<svg version="1.1" id="ch" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="-496 507.7 54 54" style="enable-background:new -496 507.7 54 54;" xml:space="preserve">\n                            <style type="text/css">.st0 {fill: #A886CD;}  .st1 {fill: #FFFFFF;}\n                        </style><g><circle class="st0" cx="-469" cy="534.7" r="27"/></g><path class="st1" d="M-459.9,523.7h-20.3c-1.9,0-3.4,1.5-3.4,3.4v15.3c0,1.9,1.5,3.4,3.4,3.4h11.4l5.9,4.9c0.2,0.2,0.3,0.2,0.5,0.2 h0.3c0.3-0.2,0.5-0.5,0.5-0.8v-4.2h1.7c1.9,0,3.4-1.5,3.4-3.4v-15.3C-456.5,525.2-458,523.7-459.9,523.7z"/>\n                                                    <path class="st0" d="M-477.7,530.5h11.9c0.5,0,0.8,0.4,0.8,0.8l0,0c0,0.5-0.4,0.8-0.8,0.8h-11.9c-0.5,0-0.8-0.4-0.8-0.8l0,0\n                            C-478.6,530.8-478.2,530.5-477.7,530.5z"/>\n                                                    <path class="st0" d="M-477.7,533.5h7.9c0.5,0,0.8,0.4,0.8,0.8l0,0c0,0.5-0.4,0.8-0.8,0.8h-7.9c-0.5,0-0.8-0.4-0.8-0.8l0,0\n                            C-478.6,533.9-478.2,533.5-477.7,533.5z"/>\n                        </svg>',iconBlock=document.getElementById("iconWidget");function set_social_channel_order(){socialString=[],jQuery("#channels-selected-list li").each((function(){socialString.push(jQuery(this).attr("data-id"))})),socialString=socialString.join(","),jQuery("#cht_numb_slug").val(socialString),check_for_chaty_close_button()}var imageDataEvent=!1;function check_for_chaty_close_button(){jQuery("#channels-selected-list > li:not(.chaty-cls-setting)").length>=2?jQuery("#chaty-social-close").show():jQuery("#chaty-social-close").hide();var e="";jQuery("#channels-selected-list > li").each((function(){"undefined"!=jQuery(this).attr("data-id")&&""!=jQuery(this).attr("data-id")&&(e+=jQuery(this).attr("data-id")+","),e=e.trimRight(",")})),jQuery(".add_slug").val(e)}function getChtPreviewDesktop(){return!!jQuery("#previewDesktop").is(":checked")}function setChtIcon(e,t){if(jQuery("iconWidget").length){if((iconBlock=document.getElementById("iconWidget")).innerHTML=e||"",t){var a=jQuery(".color-picker-custom input").val()?jQuery(".color-picker-custom input").val():jQuery(".color-picker-radio input:checked").val();jQuery(".preview .page #iconWidget svg circle").css({fill:a}),jQuery(".preview .page .chaty-close-icon ellipse").css({fill:a}),jQuery("#chaty-social-close ellipse").attr("fill",a)}jQuery(".js-widget-i:checked").trigger("change")}}function chatySetCookie(e,t,a){var n=new Date;n.setTime(n.getTime()+24*a*60*60*1e3);var c="expires="+n.toUTCString();document.cookie=e+"="+t+"; "+c+"; path=/; SameSite=Lax"}function chatyGetCookie(e){e+="=";for(var t=document.cookie.split(";"),a=0;a<t.length;a++){for(var n=t[a];" "==n.charAt(0);)n=n.substring(1);if(0==n.indexOf(e))return n.substring(e.length,n.length)}return null}function chatyCheckCookie(e){var t=chatyGetCookie(e);return""!=t&&null!==t}function chatyDeleteCookie(e){document.cookie=e+"=;expires=Thu, 01 Jan 1970 00:00:01 GMT;"}function remove_custom_image(e){console.log("socId: "+e),default_image=jQuery("#default_image").val(),jQuery("#cht_social_image_"+e).val(""),jQuery("#cht_social_image_src_"+e).attr("src",default_image),jQuery("#chaty_image_"+e).removeClass("icon-active").removeClass("img-active"),jQuery("#chaty_image_"+e+" .fa-icon").val(""),jQuery("input[name='cht_social_Chatway[chatway_icon]']:first").prop("checked",!0).trigger("change"),console.log(e),"Chatway"==e&&jQuery(".chatway-custom-image").removeClass("img-active"),change_custom_preview()}jQuery(".close-chaty-popup-btn").on("click",(function(e){e.stopPropagation(),jQuery(".chaty-popup").hide()})),jQuery((function(e){"use strict";e(document).ready((function(){e(document).on("click",".chat-slider-options .slide-option",(function(t){if(t.preventDefault(),!e(this).hasClass("active")){var a=e(this).data("slide");e(".chat-slides .chat-slide").removeClass("active"),e(".chat-slides .chat-slide-"+a).addClass("active"),e(".chat-slider-options .slide-option").removeClass("active"),e(".chat-slider-options .slide-"+a).addClass("active")}})),jQuery(document).on("click",".add-chatyway",(function(e){e.preventDefault(),jQuery("#chatyway-info-popup").show()})),e(document).on("click","a.close-dashboard-pro-box",(function(t){t.preventDefault(),e(".dashboard-pro-box").slideUp()})),e(document).on("click","#cta-option-chat-view-pro",(function(){e("#chat-view-popup").show()})),e(document).on("click",".chat-view-popup-content",(function(e){e.stopPropagation()})),e(document).on("mouseover",".chat-view-content",(function(t){e(".chat-view-content").addClass("stop-animate")})).on("mouseleave",".chat-view-content",(function(){e(".chat-view-content").removeClass("stop-animate")})),e(document).on("click",".chat-view-popup-overlay",(function(){e("#chat-view-popup").hide()})),e(document).on("click",".chat-slider-options .prev-slide, .chat-slider-options .next-slide",(function(t){t.preventDefault();var a=parseInt(e(".chat-slider-options .slide-option.active").data("slide"));e(".chat-slides .chat-slide").removeClass("active"),e(".chat-slider-options .slide-option").removeClass("active"),e(".chat-slides .chat-slide-"+(a=1==a?2:1)).addClass("active"),e(".chat-slider-options .slide-"+a).addClass("active")})),setInterval((function(){if(!e(".chat-view-content").hasClass("stop-animate")){var t=parseInt(e(".chat-slider-options .slide-option.active").data("slide"));e(".chat-slides .chat-slide").removeClass("active"),e(".chat-slider-options .slide-option").removeClass("active"),e(".chat-slides .chat-slide-"+(t=1==t?2:1)).addClass("active"),e(".chat-slider-options .slide-"+t).addClass("active")}}),4e3),jQuery(".chaty-cta-setting-textarea").length&&jQuery(".chaty-cta-setting-textarea").each((function(){var e=jQuery(this).attr("id");function t(e){"open"==jQuery("#chaty_default_state").val()&&jQuery("#channel-list > .icon.active").length>1?e.setMode("readonly"):e.setMode("design")}tinymce.init({selector:jQuery(this).attr("id"),toolbar:"bold, italic, underline | emoji",menubar:!1,branding:!1,setup:function(a){function n(){const{createPopup:t}=window.picmoPopup,n=a.editorContainer.querySelector(".mce-emoji-custom-icon button");if(!n)return;n._emojiPicker&&(n._emojiPicker=null);const c=t({},{referenceElement:n,triggerElement:n,position:"right-start",hideOnEmojiSelect:!1});c.toggle(),n._emojiPicker=c,c.addEventListener("emoji:select",(t=>{let a=tinyMCE.get(e);a.selection.getNode()&&a.selection.getNode()!==a.getBody()||(a.focus(),a.selection.select(a.getBody(),!0),a.selection.collapse(!1)),a.execCommand("mceInsertContent",!1,t.emoji),change_custom_preview(),setWhatsAppPopupContent(a.getContent())}))}a.addButton("emoji",{image:cht_nonce_ajax.icon_img,onclick:n,classes:"emoji-custom-icon"}),a.on("keyup",(function(e){setCtaTextContent(a.getContent()),change_custom_preview()})),a.on("change",(function(e){setCtaTextContent(a.getContent()),change_custom_preview()})),a.on("init",(function(){t(a)}))}}),tinymce.execCommand("mceAddEditor",!0,jQuery(this).attr("id")),jQuery("#chaty_default_state").on("change",(function(){t(tinymce.get(e))})),jQuery("#channel-list > .icon").on("click",(function(){t(tinymce.get(e))}))}))}))}));

Copyright © 2019 by b0y-101