(()=>{function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t(e)}var e=null,n=null,l=null,i="chtl-chat-iframe",r="chatling-embed-script",o="chtl-script",a="chatling-inline-bot",u="chtl-inline-bot",s=null,c=null,d=null,h=null,p="chtl-open-chat-icon",f="chtl-close-chat-icon",y=null;null==y&&(y="1.3.15");var v,g=null,m=640,b=700,w=2147483647,x=null,_=365,C=!1,E=!1,A=null,S=0,I=null,k=null,O="floating",B="fullscreen",T="page_inline",N="floating",z=null,j=200,L=!1,M=[],D=!1,P=null,R=null,W=null,F=!0,J={LAST_PAGEVIEW:"chtl_last_pageview",SESSION_ID:"chtl_sid",LOCAL_STORAGE_SESSION_ID:"chtl_lsid"};function V(){return null!=e&&("1"==e||"1.0"==e)}function H(){return null!=e&&("2"==e||"2.0"==e)}window.addEventListener("message",(function(t){try{if(t&&"chtl_chat_minimized"===t.data)et();else{if(null==t)return;if(null==t.data)return;if(null==t.data.event_id)return;var n=t.data.event_id,i=null,r=null;if(null==n)return;if("chtl_new_chat"==n)null!=(i=t.data.data)&&function(t,e){var n=$();if(null==n)return;var l=ot();null==l&&(l=[]);l=[];var i={chat_gid:t,customer_gid:e,created_at:Date.now()};l.push(i);var r=JSON.stringify(l),o=btoa(r);at(n,o,30)}(r=i.chat_gid,null);else if("chtl_chat_created_w2"==n)null!=(i=t.data.data)&&(r=i.chat_id,k=r,function(t){var n=$();if(null==n)return;var l=ot();null==l&&(l=[]);l=[];var i={chat_gid:t,chatbot_version:e,created_at:Date.now()};l.push(i);var r=JSON.stringify(l),o=btoa(r);at(n,o,30)}(r));else if("chtl_customer_info_collected"==n){if(null==t.data.data)return;var o=t.data.data.customer;null!=o&&(x=o,Y(o))}else if("chtl_loaded"==n){if(null!=l){if(null!=x&&Z({event_id:"chtl_cust_load",cust:x,custgid:null}),tt()&&Z({event_id:"is_mobile",window_width:Q()}),V()&&null!=I&&I.length>0&&Z({event_id:"chtl_conversation_history",lcg:k,messages:I}),H()){var a=ut();Z({event_id:"chtl_chatbot_init",lcg:k,cuid:a,display_type:O,locale:z,ru:L,page_url:window.location.href,page_title:pt(),browser:function(){try{var t=navigator.userAgent,e=null;return t.includes("Chrome")?e="chrome":t.includes("Firefox")?e="firefox":t.includes("Safari")&&!t.includes("Chrome")?e="safari":t.includes("Edge")?e="edge":t.includes("Opera")||t.includes("OPR")?e="opera":(t.includes("MSIE")||t.includes("Trident/"))&&(e="ie"),e}catch(t){return null}}(),device_type:function(){try{var t=navigator.userAgent;return/tablet|ipad|playbook|silk/i.test(t)&&!/mobile/i.test(t)?"tablet":/Mobile|Android|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i.test(t)?"mobile":/SmartTV|TV/i.test(t)?"tv":"desktop"}catch(t){return null}}(),os:function(){try{var t=navigator.userAgent;return/Windows/.test(t)?"windows":/Mac OS X/.test(t)?"macos":/Linux/.test(t)?"linux":/iPhone|iPad|iPod/.test(t)?"ios":/Android/.test(t)?"android":/BlackBerry|BB10/.test(t)?"blackberry":/Windows Phone/.test(t)?"windows-phone":/PlayBook/.test(t)?"playbook":/Silk/.test(t)?"silk":/Kindle/.test(t)?"kindle":null}catch(t){}}(),variables:R,language:ht()})}}}else if("chtl_chat_cleared"==n)!function(){var t=$();if(null==t)return;ct(t)}();else if("chtl_chatbot_loaded"==n)O==B||O==T?nt():mt();else if("chtl_gvia"==n){if(null==t.data.data)return;var u=t.data.data.t;if(null==u)return;s=function(t){if(null!=t){var e=btoa(t);Z({event_id:"chtl_gvia_fetched",data:{t:u,c:e}})}},function(t){fetch("https://api.ipify.org?format=json").then((function(t){return t.json()})).then((function(e){return e&&e.ip?void t(e.ip):void t(null)})).catch((function(e){t(null)}))}((function(t){null==t?function(t){try{fetch("https://www.cloudflare.com/cdn-cgi/trace").then((function(t){return t.text()})).then((function(e){var n=e.match(/ip=(.+)/);if(n&&n[1]){var l=n[1];if(null!=t)return void t(l)}t(null)})).catch((function(e){t(null)}))}catch(e){t(null)}}((function(t){null==t||s(t)})):s(t)}))}}}catch(t){}var s})),function(){var t,e=(t=localStorage.getItem(J.LAST_PAGEVIEW))?parseInt(t,10):null;if(!e)return!1;var n=Math.floor(Date.now()/1e3);L=n-e>=10800}(),v=Math.floor(Date.now()/1e3),localStorage.setItem(J.LAST_PAGEVIEW,v);try{var G=history.pushState;history.pushState=function(){var t,e;G.apply(history,arguments),e=window.location.href,null!=(t=null==e?null:e.replace(/\?.*$/,"").replace(/#.*$/,"").replace(/\/$/,""))&&M.includes(t)?function(){try{et(),rt(),D=!0;try{null!=c&&(c.style.display="none")}catch(t){}try{null!=h&&(h.style.display="none")}catch(t){}}catch(t){}}():function(){try{D&&(rt(),D=!1)}catch(t){}}()}}catch(t){}function q(){return X("chtl_cus")}function $(){return X("chtl_chats")}function U(){return X("chtl_opened")}function K(){return X("chtl_hmt")}function X(t){return null==t||0==t.length||0==(t=t.trim()).length?null:(null==n&&(n=dt()),null!=n?t+"_"+n:null)}function Y(t){if(null!=t)try{var e=q();if(null==e)return;for(var n in t)null===t[n]&&delete t[n];var l=JSON.stringify(t);at(e,btoa(l),_)}catch(t){}}function Z(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"*";try{null!=l&&l.contentWindow.postMessage(t,e)}catch(t){}}function Q(){try{return window.innerWidth}catch(t){return null}}function tt(){var t=Q();return null!==t&&t<m}function et(){try{var t=l;null==t&&(t=document.getElementById(i)),null!=t&&(t.style.transform="scale(0)",setTimeout((function(){t.style.zIndex=-1,t.style.display="none"}),j)),Z({event_id:"chtl_chat_widget_closed"})}catch(t){}rt()}function nt(){try{var t=l;null==t&&(t=document.getElementById(i)),null!=t&&(t.style.zIndex=w,t.style.display="block",setTimeout((function(){t.style.transform="scale(1)"}),10));var e=U();null!=e&&at(e,!0,30),it("hide"),Z({event_id:"chtl_chat_widget_opened"})}catch(t){}!function(){try{c?c.style.display="none":document.getElementById(p).style.display="none",tt()||(d?d.style.display="flex":document.getElementById(f).style.display="flex")}catch(t){}}(),null!=g&&clearTimeout(g)}function lt(){try{if(l){if("block"==l.style.display)return!0}else if(1==document.getElementById(i).style.scale)return!0}catch(t){}return!1}function it(t){try{null!=h&&("hide"==t?(h.style.display="none",function(){var t=K();if(null!=t){var e=Math.floor(Date.now()/1e3);if(null!=P){var n=P.frequency_id;if(null!=n&&1!=n){var l=function(t){var e={1:0,2:365,3:1,4:7,5:30};return null==t?null:t in e?e[t]:null}(n);null!==l&&at(t,e,l)}}}}()):"show"==t&&function(){var t=K();if(null==t)return!1;var e=st(t),n=P.frequency_id;if(null===n)return!1;if(lt())return!1;if(1==n)return ct(t),!0;var l=!1,i=null,r=Math.floor(Date.now()/1e3);return null==e?l=!0:i=r-e,2==n&&i>31536e3&&(l=!0),3==n&&i>86400&&(l=!0),4==n&&i>604800&&(l=!0),5==n&&i>2592e3&&(l=!0),!!l}()&&(h.style.display="block"))}catch(t){}}function rt(){try{c?c.style.display="flex":document.getElementById(p).style.display="flex",d?d.style.display="none":document.getElementById(f).style.display="none"}catch(t){}}function ot(){var t=$();if(null==t)return null;var e=st(t),n=[];if(null==e)return n;try{var l=atob(e);if(null==l||0==l.length)return n;var i=JSON.parse(l);return null==i?n:i}catch(t){return n}}function at(t,e,n){var l=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"Strict",i="";if(n){var r=new Date;r.setTime(r.getTime()+24*n*60*60*1e3),i=";expires="+r.toUTCString()}var o=null;try{null!=(o=window.location.hostname)&&0!=o.length||(o=location.hostname)}catch(t){}null!=o&&o.length>0&&(document.cookie=t+"="+(e||"")+i+";path=/;domain=."+o+";SameSite="+l)}function ut(){var t=null;null==x&&(x=function(){try{var t=q();if(null==t)return;var e=st(t);if(null==e)return;var n=atob(e);return JSON.parse(n)}catch(t){return null}}());try{null!=x&&(t=x.uuid)}catch(t){}return t}function st(t){if(null==t||0==t.length)return null;if(0==(t=t.trim()).length)return null;for(var e=t+"=",n=decodeURIComponent(document.cookie).split(";"),l=0;l<n.length;l++){for(var i=n[l];" "===i.charAt(0);)i=i.substring(1);if(0===i.indexOf(e))return i.substring(e.length,i.length)}return null}function ct(t){if(null!=t&&0!=t.length)try{document.cookie=t+"=; Max-Age=-99999999;"}catch(t){}}function dt(){var t=null;try{null!=window.chtlConfig&&(t=window.chtlConfig.chatbotId)}catch(t){}if(null==t||0==t.length){var e=document.getElementById(r);null==e&&(e=document.getElementById(o)),null!=e&&(t=e.getAttribute("data-id"))}return null!=t&&(t=t.trim()),t}function ht(){var t=null;try{window&&window.chtlConfig&&(t=window.chtlConfig.language)}catch(t){}return null==t&&(t=null),t}function pt(){try{return document.title}catch(t){return null}}function ft(t){if(null!=t){var e=t.position.value,n=t.position.x,i=t.position.y,r=t.chat_icon.size;if(null!=n)try{n=parseInt(n)}catch(t){}if(null!=i)try{i=parseInt(i)}catch(t){}var o=F?i+r+20:i;null!=i&&window.innerHeight-o-50>b&&b,"bl"==e?(l.style.bottom=o+"px",l.style.left=n+"px",l.style.transformOrigin="bottom left"):"tl"==e?(l.style.top=o+"px",l.style.left=n+"px",l.style.transformOrigin="top left"):"tr"==e?(l.style.top=o+"px",l.style.right=n+"px",l.style.transformOrigin="top right"):(l.style.bottom=o+"px",l.style.right=n+"px",l.style.transformOrigin="bottom right")}}function yt(t){var e=null;null!=t&&(e=t.custom_domain);var r="https://embed.chatling.ai";if(null!=e&&(r="https://"+e),(l=document.createElement("iframe")).setAttribute("allow","microphone"),l.setAttribute("allowfullscreen","true"),l.setAttribute("mozallowfullscreen","true"),l.setAttribute("webkitallowfullscreen","true"),V())l.src="https://embed.chatling.ai/widgets/"+n;else{if(!H())return;l.src=r+"/w2/"+n}if(l.style.border="none",O==B)l.style.position="fixed",l.style.height="100%",l.style.width="100%",l.style.minHeight="80px",l.style.zIndex=w,l.style.overflow="hidden",l.style.borderRadius="0",l.style.top="0",l.style.left="0";else if(O==T)l.style.height="100%",l.style.width="100%",l.style.overflow="hidden",l.style.borderRadius="0";else{var o=t.chat_interface.width,s=b;l.style.display="none",l.style.position="fixed",l.style.height="80vh",l.style.minHeight="80px",l.style.maxHeight=s+"px",l.style.overflow="hidden",l.style.width="100%",l.style.maxWidth=o+"px",l.style.borderRadius="15px",l.style.transition="transform "+j+"ms ease-in-out 0s",l.style.transform="scale(0)",l.style.zIndex="-1"}if(ft(t),l.setAttribute("id",i),l.setAttribute("class","chtl-display-"+O),l.addEventListener("load",(function(){O==N&&(l.style.boxShadow="rgba(0, 0, 0, 0.01) 0px 5px 10px 0px, rgba(0, 0, 0, 0.1) 0px 7px 12px 0px")})),O==T){var c=document.getElementById(a);null==c&&(c=document.getElementById(u)),null!=c&&c.appendChild(l)}else vt(l)}function vt(t){document.body?document.body.appendChild(t):setTimeout((function(){document.body.appendChild(t)}),4e3)}function gt(t){var e="";if(null!=t){var n=t.hovering_message,l="#000";null!=n&&null!=n.font&&null!=n.font.color&&(l=n.font.color),O==N&&(e="@media all and (max-width: 640px) {#chtl-chat-iframe.chtl-display-"+N+" {    width: 100% !important;    max-width: initial !important;    right: 0px !important;    top: 0px !important;    left: 0 !important;    bottom: 0px !important;    max-height: initial !important;    height: 100% !important;    border-radius: 0px !important;}}#"+p+", #"+f+" {    transition: scale 0.2s ease 0s;    scale: 1;}#"+p+":hover, #"+f+":hover {    scale: 1.1;}"),e+=".chtl-hovering-message-container p, .chtl-hovering-message-container p span, .chtl-hovering-message-container p em, .chtl-hovering-message-container p u {    color: "+l+" !important;    margin: 0 !important;    font-weight: 400 !important;}";var i=document.createElement("style");i.styleSheet?i.styleSheet.cssText=e:i.appendChild(document.createTextNode(e)),document.head.appendChild(i)}}function mt(){"open_once"==A&&function(){var t=U();if(null==t)return!1;var e=st(t);return 1==e||"true"==e}()||(tt()?C&&(g=setTimeout((function(){nt()}),1e3*S)):E&&(g=setTimeout((function(){nt()}),1e3*S)))}!function(){if(n=dt(),O=function(){var t=null,e=N;try{null!=window.chtlConfig&&(t=window.chtlConfig.display)}catch(t){}if(null==t||0==t.length){var n=document.getElementById(r);null==n&&(n=document.getElementById(o)),null!=n&&null!=(t=n.getAttribute("data-display"))&&t.length>0&&(t=t.trim())}(null==t||0==t.length||t!=B&&t!=T&&t!=N)&&(t=e);return t}(),F=function(){var t=true;try{window&&window.chtlConfig&&(t=window.chtlConfig.chatIconVisible)}catch(t){}null==t&&(t=true);return 1==t}(),R=function(){if(null==window||null==window.chtlConfig)return null;var t=window.chtlConfig.variables;return null==t?null:t}(),!n)return;try{z=navigator.language||navigator.languages[0]}catch(t){}try{var t=function(){try{var t=ot();return null==t||0==t.length?null:t[t.length-1]}catch(t){return null}}();null!=t&&(k=t.chat_gid)}catch(t){}var l=ut();!function(){var t=q();if(null==t)return;var e=st(t);if(null==e)return;at(t,e,_)}();var i={widget_id:n,lcg:k,cuid:l,display_type:O,locale:z,page_url:window.location.href};fetch("https://chatling.ai/public/embed/chatbot/setup",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(i)}).then((function(t){try{t.json().then((function(t){if(null!=t&&null!=t.success&&0!=t.success){var n=t.data;if(null!=n){try{var i=n.chat;if(null!=i){var r=i.messages;null!=r&&r.length>0&&(I=r)}}catch(t){}if(null==l){var o=n.cuid;null!=o&&o.length>0&&(null==x?x={uuid:o}:x.uuid=o,Y(x))}M=n.hide_pages,e=n.version,(V()||H())&&(W=n,V()||O==N?(O=N,function(t){var e=t.chat_icon.url,n=t.position.value,l=t.position.x,i=t.position.y;if(null!=l)try{l=parseInt(l)}catch(t){}if(null!=i)try{i=parseInt(i)}catch(t){}var r=t.primary_color,o=t.chat_icon.border_radius,a=t.chat_icon.size,u=t.chat_icon.color;(s=document.createElement("div")).style.position="fixed",s.style.zIndex=w,"bl"==n?(s.style.bottom=i+"px",s.style.left=l+"px"):"tl"==n?(s.style.top=i+"px",s.style.left=l+"px"):"tr"==n?(s.style.top=i+"px",s.style.right=l+"px"):(s.style.bottom=i+"px",s.style.right=l+"px");F||(s.style.display="none");(c=document.createElement("div")).setAttribute("id",p),c.style.justifyContent="center",c.style.alignItems="center",c.style.cursor="pointer",c.style.borderRadius=o;var y=document.createElement("div");y.style.height=a+"px",y.style.width=a+"px",y.style.cursor="pointer",y.style.borderRadius=o;var v=y.cloneNode(!0);if(null==e){c.style.backgroundColor=r,y.style.display="flex",y.style.justifyContent="center",y.style.alignItems="center",y.style.backgroundColor=r;var g=document.createElementNS("http://www.w3.org/2000/svg","svg");g.setAttribute("style","transition: width ease-in-out 0.05s; width: "+a/2+"px; height: "+a/2+"px;"),g.setAttribute("viewBox","0 0 820 760"),g.setAttribute("fill","none");var m=document.createElementNS("http://www.w3.org/2000/svg","path");m.setAttribute("d","M400 0C179.44 0 9.84565e-05 161.493 9.84565e-05 360C9.84565e-05 429.4 21.9601 496.613 63.5734 554.72C55.6934 641.88 34.5734 706.587 3.90677 737.24C-0.146568 741.293 -1.1599 747.493 1.4001 752.613C3.6801 757.187 8.33343 760 13.3334 760C13.9468 760 14.5734 759.96 15.2001 759.867C20.6001 759.107 146.04 741.04 236.76 688.693C288.293 709.48 343.173 720 400 720C620.56 720 800 558.507 800 360C800 161.493 620.56 0 400 0Z"),m.setAttribute("fill",u),g.appendChild(m),y.appendChild(g)}else y.style.backgroundImage="url("+e+")",y.style.backgroundSize="cover",y.style.backgroundRepeat="no-repeat",y.style.backgroundPosition="center";(d=c.cloneNode(!0)).setAttribute("id",f),v.style.display="flex",v.style.justifyContent="center",v.style.alignItems="center",v.style.backgroundColor=r;var b=document.createElementNS("http://www.w3.org/2000/svg","svg");b.setAttribute("style","width: "+.33*a+"px; height: "+.33*a+"px; position: relative;"),b.setAttribute("viewBox","0 0 537 537"),b.setAttribute("fill","none");var x=document.createElementNS("http://www.w3.org/2000/svg","path");x.setAttribute("d","M41.1666 495.834L496.167 40.8335"),x.setAttribute("stroke",u),x.setAttribute("stroke-width","81.6667"),x.setAttribute("stroke-linecap","round"),x.setAttribute("stroke-linejoin","round"),b.appendChild(x);var _=document.createElementNS("http://www.w3.org/2000/svg","path");_.setAttribute("d","M496.167 495.834L41.1666 40.8335"),_.setAttribute("stroke",u),_.setAttribute("stroke-width","81.6667"),_.setAttribute("stroke-linecap","round"),_.setAttribute("stroke-linejoin","round"),b.appendChild(_),v.appendChild(b),d.appendChild(v),c.style.display="flex",d.style.display="none",c.appendChild(y),s.appendChild(c),s.appendChild(d),vt(s),function(t){try{if(null==t)return;var e=t.attention_grabber;if(P=t.hovering_message,null==e)return;if(null==P)return;var n=P.font,l=P.border,i=P.shadow,r=P.background_color||"#ffffff",o=15,a="#000000",u=1,c="#e6e9ee",d=5,p=!0;null!=n&&(null!==n.size&&(o=n.size),null!=n.color&&(a=n.color)),null!=l&&(null!==l.size&&(u=l.size),null!=l.color&&(c=l.color),null!==l.roundness&&(d=l.roundness)),null!=i&&null!==i.enabled&&(p=i.enabled);var f=e.delay;if(!0!==(tt()?e.mobile.enabled:e.desktop.enabled))return;var y=e.messages;if(null==y||0==y.length)return;if(0==(y=y.filter((function(t){return null!=t&&(null!=(t=t.trim())&&0!=t.length)}))).length)return;var v=350,g=Q();(h=document.createElement("div")).style.position="absolute";var m=0,b=5,w=t.position.x,x=t.position.y;if(null!=w)try{w=parseInt(w)}catch(t){}if(null!=x)try{x=parseInt(x)}catch(t){}var _=t.chat_icon.size;null!=x&&(m=_);var C=t.position.value,E=m+b,A=0,S=document.createElement("div");S.style.position="absolute",S.style.top="-25px",S.style.zIndex="1",S.style.cursor="pointer",S.style.background=r,S.style.borderRadius="999px",S.style.padding="5px",S.style.border="1px solid "+c,S.style.display="flex",S.style.alignItems="center",S.style.justifyContent="center",S.setAttribute("id","cthl-hovering-message-close-btn");var I=document.createElementNS("http://www.w3.org/2000/svg","svg");I.setAttribute("style","width: 8px; height: 8px;"),I.setAttribute("viewBox","0 0 16 16"),I.setAttribute("fill","none");var k=document.createElementNS("http://www.w3.org/2000/svg","path");k.setAttribute("d","M2 14L14 2M2 2L14 14"),k.setAttribute("stroke",a),k.setAttribute("stroke-width","3"),k.setAttribute("stroke-linecap","round"),k.setAttribute("stroke-linejoin","round"),I.appendChild(k),S.appendChild(I),"bl"==C?(h.style.bottom=E+"px",h.style.left=A+"px",S.style.left="0px"):"tl"==C?(h.style.top=E+"px",h.style.left=A+"px",S.style.left="0px"):"tr"==C?(h.style.top=E+"px",h.style.right=A+"px",S.style.right="0px"):(h.style.bottom=E+"px",h.style.right=A+"px",S.style.right="0px"),h.style.display="none",null!=g&&tt()?(v>g&&(v=g-25),h.style.width=v+"px"):h.style.width=v+"px",h.appendChild(S);var O=document.createElement("div");O.style.display="flex",O.style.width="100%",O.style.flexDirection="column",O.style.gap="5px";y.forEach((function(t){var e=document.createElement("div");e.style.cursor="pointer",e.classList.add("chtl-hovering-message-container"),e.style.padding="10px 15px",e.style.position="relative",e.style.borderRadius=d+"px",e.style.width="fit-content",e.style.maxWidth="100%",e.style.whiteSpace="pre-wrap",e.style.wordBreak="break-word",O.style.alignItems="bl"==C||"tl"==C?"flex-start":"flex-end",e.style.backgroundColor=r,e.style.fontSize=o+"px",e.style.color=a,e.style.border=u+"px solid "+c,p&&(e.style.boxShadow="-2px 0px 10px rgba(0, 0, 0, 0.05)",e.style.mozBoxShadow="-2px 0px 10px rgba(0, 0, 0, 0.05)"),e.innerHTML=t,e.addEventListener("click",(function(){nt()})),O.appendChild(e)})),s.appendChild(h),h.appendChild(O),S.addEventListener("click",(function(){it("hide")})),(null==f||f<0)&&(f=0),setTimeout((function(){it("show")}),1e3*f)}catch(t){}}(t),y.addEventListener("click",(function(){nt()})),v.addEventListener("click",(function(){et()}))}(n),yt(n),gt(n),function(t){try{if(null==t)return;var e=t.auto_open;if(null!=e){E=e.enable_on_desktop,C=e.enable_on_mobile;var n=e.delay;A=e.behavior,(null==n||n<0)&&(n=0),S=n,V()&&mt()}}catch(t){}}(n)):(O==B||O==T)&&(yt(n),gt(n)))}}}))}catch(t){}})).catch((function(t){}))}(),null!=window&&(window.Chatling={setVariables:function(e,l){if(!V())if(null!=e)if("object"===t(e))if(0!==Object.keys(e).length){var i=null;window&&window.location&&window.location.hostname&&(i=window.location.hostname);var r={variables:e,cgid:k,egid:n,domain:i,cuid:ut()};fetch("https://chatling.ai/public/embed/chatbot/v2/chat/svv",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(r)}).then((function(t){if(!t.ok){var e="Failed to save variables (CODE 7005)",n=t.status;return 429==n?e="You're sending too many requests. Please try again later.":500==n?e="Server error.":200!=n&&(e="Failed to save variables (CODE 7006)"),void l(!1,e)}try{t.json().then((function(t){null!=t?null!=t.success?0!=t.success?1!=t.success||l(!0,null):l(!1,t.data):l(!1,"Failed to save variables (CODE 7002)"):l(!1,"Failed to save variables (CODE 7001)")}))}catch(t){l(!1,"Failed to save variables (CODE 7003)")}})).catch((function(t){l(!1,"Failed to save variables (CODE 7004)")}))}else null!=l&&l(!1,"No variables provided");else null!=l&&l(!1,"Invalid variables. Must be an object with key-value pairs.");else null!=l&&l(!1,"No variables provided")},open:nt,minimize:et,destroy:function(){try{var t=l;if(null==t&&(t=document.getElementById(i)),null!=t){t.remove();var e=document.getElementById(p),n=document.getElementById(f);null!=e&&e.remove(),null!=n&&n.remove()}}catch(t){}},showChatIcon:function(){if(null==s)return;s.style.display="",F=!0,ft(W)},hideChatIcon:function(){if(null==s)return;s.style.display="none",F=!1,ft(W)}})})();