"use strict";(function(){var t=window.addEventListener?"addEventListener":"attachEvent";var e=window[t];var a=t==="attachEvent"?"onmessage":"message";function i(){var t=this;t.ready=false;var i="octadesk-octachat-app";var o="octadesk-octachat-app-hide";var c="octachatAppClose";var n=1e3;var s=void 0;var r=void 0;var d={id:"chat",startHide:false,hideOnClose:false};t.id=d.id;d.startHide="false"==="true";d.hideOnClose="true"==="false"&&d.startHide;function p(){e(a,function(e){if(e.data.id===t.id){x(e);if(s){if(e.data.octachat&&e.data.octachat.classes){l(e.data.octachat.classes,e.data.id)}else if(e.data.octachat&&typeof e.data.octachat.isReady!=="undefined"){h(e.data.octachat.isReady)}else if(e.data.octachatNotification){C(e.data.octachatNotification)}}}},false)}function h(e){var a=new CustomEvent("onOctaChatReady",{detail:{isReady:e,id:t.id}});window.dispatchEvent(a);t.ready=e}function l(t){var e=k();if(e){t.push(i);if(e.classList.contains(o)||t.indexOf(c)>=0&&d.hideOnClose){t.push(o)}g(e);e.className=t.join(" ")}}function u(e){e.id=t.id||"chat";if(s){s.postMessage(e,"*");return true}else{return false}}function f(){if(r!=window.location.toString()){r=window.location.toString();u({name:"newurl",data:r})}}function m(){var t=document.documentElement,e=document.body,a="scrollTop",i="scrollHeight";return(t[a]||e[a])/((t[i]||e[i])-t.clientHeight)*100}var w=void 0;window.addEventListener("scroll",function(t){if(w){clearTimeout(w)}w=setTimeout(function(){var t=m();u({name:"scrollPercent",data:t})},n)});function g(t){var e=[];if(t.classList){e=t.classList}else{e=t.className.split(" ")}for(var a=0;a=0){a.splice(i,1)}e.className=a.join(" ")}}}function b(t,e){e=k(e);if(e){if(e.classList){e.classList.add(t)}else{var a=e.className.split(" ");var i=e.indexOf(t);if(i<0){a.push(t)}e.className=a.join(" ")}}}function k(e){if(e){return e}else{return document.getElementById(i+(t.id||"chat"))}}function x(t){s=t.source;f();setInterval(f,500)}var y=void 0;var A=void 0;function O(t){z();y=setInterval(function(){if(window.document.title!=t.title){A=window.document.title;window.document.title=t.title}else if(A)window.document.title=A},1e3)}function z(){if(y&&A){clearInterval(y);window.document.title=A;A=undefined}}function C(t){if(t.start)O(t);else z()}function L(){var t=document.createElement("div");t.className=i;t.id=i+d.id;if(d.startHide){t.className=i+" "+o}document.body.appendChild(t)}function E(){var t=document.createElement("style");t.type="text/css";var e=".octadesk-octachat-app{position:fixed;margin:0;padding:0;border:0;overflow:hidden;z-index:2147483645;zoom:1}.octadesk-octachat-app-hide{display:none}.octadesk-octachat-app--topLeft{top:2rem;left:2rem;margin-top:70px}.octadesk-octachat-app--topRight{top:2rem;right:2rem;margin-top:70px}.octadesk-octachat-app--bottomLeft{bottom:2rem;left:2rem}.octadesk-octachat-app--bottomRight{right:2rem;bottom:2rem}.octadesk-octachat-app.octachatAppClose{width:85px;height:85px;-webkit-transition:width .32s cubic-bezier(.4,0,.2,1) 55ms,height .32s cubic-bezier(.4,0,.2,1),opacity .18s 85ms;transition:width .32s cubic-bezier(.4,0,.2,1) 55ms,height .32s cubic-bezier(.4,0,.2,1),opacity .18s 85ms}.octadesk-octachat-app.octachatAppClose.octachatProactiveMsg{width:365px;max-width:100%;height:calc(140px + 4rem);max-height:100%!important;-webkit-transition:width .28s cubic-bezier(.4,0,.2,1),height .34s cubic-bezier(.4,0,.2,1) 35ms,opacity .08s;transition:width .28s cubic-bezier(.4,0,.2,1),height .34s cubic-bezier(.4,0,.2,1) 35ms,opacity .08s}.octadesk-octachat-app.octachatAppClose.octachatProactiveMsg--senderless{width:301px;max-width:100%;height:calc(140px + 4rem);max-height:100%!important;-webkit-transition:width .28s cubic-bezier(.4,0,.2,1),height .34s cubic-bezier(.4,0,.2,1) 35ms,opacity .08s;transition:width .28s cubic-bezier(.4,0,.2,1),height .34s cubic-bezier(.4,0,.2,1) 35ms,opacity .08s}.octadesk-octachat-app.octachatAppOpen{width:363px;max-height:calc(100% - 4rem)!important;-webkit-transition:width .28s cubic-bezier(.4,0,.2,1),height .34s cubic-bezier(.4,0,.2,1) 35ms,opacity .08s;transition:width .28s cubic-bezier(.4,0,.2,1),height .34s cubic-bezier(.4,0,.2,1) 35ms,opacity .08s}.octadesk-octachat-app.octachatAppOpen.octadesk-octachat-login{height:540px}.octadesk-octachat-app.octachatAppOpen.login{height:540px}.octadesk-octachat-app.octachatAppOpen.conversation{height:652px}.octadesk-octachat-app.octachatAppOpen.contact{height:480px}.octadesk-octachat-app.octachatAppOpen.contact.contact-kb{height:650px}.octadesk-octachat-app iframe{position:absolute;top:0;right:0;left:0;bottom:0}@media only screen and (max-device-width:767px){.octadesk-octachat-app{overflow:auto}.octadesk-octachat-app--topLeft{top:0;left:0;margin-top:0}.octadesk-octachat-app--topRight{top:0;right:0;margin-top:0}.octadesk-octachat-app--bottomLeft{left:0;bottom:0}.octadesk-octachat-app--bottomRight{right:0;bottom:0}.octadesk-octachat-app.octachatAppOpen{width:100%!important;height:100%!important;max-width:767px!important;max-height:1023px!important}.octachatAppOpen.conversation iframe,.octachatAppOpen.login iframe{min-height:280px}.octachatAppOpen.contact iframe{min-height:350px}}";if(t.styleSheet)t.styleSheet.cssText=e;else t.appendChild(document.createTextNode(e));k().appendChild(t)}function N(){var t=document.createElement("iframe");t.frameBorder=0;t.width="100%";t.height="100%";t.allowFullscreen=true;var e="https://chat.octadesk.services/embed/?subdomain=gruporioquenteresorts&id=chat&showButton=true&openOnMessage=true&url="+window.location.toString();t.setAttribute("src",e);k().appendChild(t)}L();E();N();p();t.toggleApp=function(){return u({name:"toggle"})};t.showApp=function(){return u({name:"show"})};t.hideApp=function(){return u({name:"hide"})};t.loginApp=function(t){return u({name:"login",data:t})};t.setCustomFields=function(t){return u({data:t,name:"setCustomFields"})};t.hide=function(){b(o);return true};t.show=function(){v(o);return true};t.isReady=function(){return t.ready};t.clearSession=function(){return u({name:"clearSession"})};return t}var o=new i;var c=function t(e){return octadesk.chat.apps[e||"chat"]};if(typeof window.octadesk=="undefined"){window.octadesk={}}if(typeof window.octadesk.chat=="undefined"){window.octadesk.chat={isReady:function t(e){var a=c(e);if(a){return a.isReady()}else{return false}},hide:function t(e){var a=c(e);if(a){return a.hide()}else{return false}},show:function t(e){var a=c(e);if(a){return a.show()}else{return false}},showApp:function t(e){var a=c(e);if(a){return a.showApp()}else{return false}},hideApp:function t(e){var a=c(e);if(a){return a.hideApp()}else{return false}},toggle:function t(e){var a=c(e);if(a){return a.toggleApp()}else{return false}},login:function t(e,a){var i=c(a);if(i){return i.loginApp(e)}else{return false}},setCustomFields:function t(e,a){var i=c(a);if(i){return i.setCustomFields(e)}else{return false}},clearSession:function t(e){var a=c(e);if(a){return a.clearSession()}else{return false}},apps:{}}}window.octadesk.chat.apps[o.id]=o})();