"use strict";var execute=function execute(){var interval=setInterval(function(){var _window$Hi;if(!((_window$Hi=window.Hi)!==null&&_window$Hi!==void 0&&_window$Hi.Chat))return;clearInterval(interval);var btnChat=document.querySelectorAll(".btnChatNutri");btnChat.forEach(function(btn){btn.addEventListener("click",function(e){e.preventDefault();window.Hi.Chat.start()})})},100)};execute();var openChatNutri=function openChatNutri(){var interval=setInterval(function(){var _window$Hi2;if(!((_window$Hi2=window.Hi)!==null&&_window$Hi2!==void 0&&_window$Hi2.Chat))return;clearInterval(interval);var url=new URL(document.location.href);var params=url.searchParams;var openChat=params.has("chatnutri");if(openChat){window.Hi.Chat.start()}},100)};openChatNutri();var executeCustom=function executeCustom(){var interval=setInterval(function(){var _window$Hi3;if(!((_window$Hi3=window.Hi)!==null&&_window$Hi3!==void 0&&_window$Hi3.Chat))return;clearInterval(interval);var boxChat=document.querySelector(".custom-hichat");if(!boxChat)return;var close=document.querySelector(".custom-hichat__btn-close-msg");var roundeButton=document.querySelector(".roudend-button__button");boxChat.classList.add("chatIn");roundeButton.classList.add("chatIn");boxChat.addEventListener("click",function(e){e.stopPropagation();window.Hi.Chat.start();boxChat.classList.toggle("chatIn");boxChat.classList.add("chatOut");roundeButton.classList.toggle("chatIn");roundeButton.classList.add("chatOut")});roundeButton.addEventListener("click",function(e){e.stopPropagation();window.Hi.Chat.start();boxChat.classList.toggle("chatIn");boxChat.classList.add("chatOut");roundeButton.classList.toggle("chatIn");roundeButton.classList.add("chatOut")});close.addEventListener("click",function(e){e.stopPropagation();window.Hi.Chat.minimize();boxChat.classList.toggle("chatIn");boxChat.classList.add("chatOut");roundeButton.classList.add("chatIn")});/** * Eventos, possibilitam captar com alguns eventos internos */window.addEventListener("message",function(evt){if(evt.origin!="https://chat.directtalk.com.br")return;var _evt$data=evt.data,message=_evt$data.message,type=_evt$data.type;console.log(message,type);if(type==="HI_CHAT_WIDGET"&&message==="CHAT_IS_MINIMIZED"){boxChat.style.display="block";boxChat.classList.toggle("chatOut");boxChat.classList.add("chatIn");roundeButton.classList.toggle("chatOut");roundeButton.classList.add("chatIn")}})},100)};executeCustom();