"use strict";var _createClass=function(){function t(t,e){for(var a=0;a=0&&this.settings.hideOnClose){e.push(o)}this.clearClasses(a);a.className=e.join(" ")}}},{key:"onOctaChatNotification",value:function t(e){if(e.start){this.startNotification(e)}else{this.stopNotification()}}},{key:"postMessageToChat",value:function t(e){e.id=this.id||"chat";if(this.source){this.source.postMessage(e,"*");return true}else{return false}}},{key:"updateUrl",value:function t(){if(this.lasturl!=window.location.toString()){this.lasturl=window.location.toString();this.postMessageToChat({name:"newurl",data:this.lasturl})}}},{key:"getScrollPercent",value:function t(){var e=document.documentElement,a=document.body,i="scrollTop",o="scrollHeight";return(e[i]||a[i])/((e[o]||a[o])-e.clientHeight)*100}},{key:"setScrollEvent",value:function t(){var e=this;var a=void 0;window.addEventListener("scroll",function(t){if(a){clearTimeout(a)}a=setTimeout(function(){var t=e.getScrollPercent();e.postMessageToChat({name:"scrollPercent",data:t})},n)})}},{key:"clearClasses",value:function t(e){var a=this;var i=[];if(e.classList){i=e.classList}else{i=e.className.split(" ")}i.forEach(function(t){return a.removeClass(t,e)})}},{key:"removeClass",value:function t(e,a){a=this.getAppElement(a);if(a){if(a.classList){a.classList.remove(e)}else{var i=a.className.split(" ");var o=a.indexOf(e);if(o>=0){i.splice(o,1)}a.className=i.join(" ")}}}},{key:"addClass",value:function t(e,a){a=this.getAppElement(a);if(a){if(a.classList){a.classList.add(e)}else{var i=a.className.split(" ");var o=a.indexOf(e);if(o<0){i.push(e)}a.className=i.join(" ")}}}},{key:"getAppElement",value:function t(e){return e||document.getElementById(i+(this.id||"chat"))}},{key:"createAppSourceEvent",value:function t(e){var a=this;this.source=e.source;this.updateUrl();setInterval(function(){return a.updateUrl()},500)}},{key:"startNotification",value:function t(e){var a=this;this.stopNotification();this.notificationInterval=setInterval(function(){if(window.document.title!=e.title){a.originalTitle=window.document.title;window.document.title=e.title}else if(a.originalTitle){window.document.title=a.originalTitle}},1e3)}},{key:"stopNotification",value:function t(){if(this.notificationInterval&&this.originalTitle){clearInterval(this.notificationInterval);window.document.title=this.originalTitle;originalTitle=undefined}}},{key:"createApp",value:function t(){var e=document.createElement("div");e.className=i;e.id=i+this.settings.id;if(this.settings.startHide){e.className=i+" "+o}document.body.appendChild(e)}},{key:"createStyle",value:function t(){var e=document.createElement("style");e.type="text/css";var a=".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:204px;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:204px;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;height:100%!important;width:100%!important}@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(e.styleSheet){e.styleSheet.cssText=a}else{e.appendChild(document.createTextNode(a))}this.getAppElement().appendChild(e)}},{key:"createFrame",value:function t(){var e=document.createElement("iframe");e.frameBorder=0;e.width="100%";e.height="100%";e.allowFullscreen=true;var a="https://chat.octadesk.services/embed?subdomain=gruporioquenteresorts&id=chat&showButton=true&openOnMessage=true&url="+window.location.toString();e.setAttribute("src",a);this.getAppElement().appendChild(e)}},{key:"toggleApp",value:function t(){return this.postMessageToChat({name:"toggle"})}},{key:"showApp",value:function t(){return this.postMessageToChat({name:"show"})}},{key:"hideApp",value:function t(){return this.postMessageToChat({name:"hide"})}},{key:"loginApp",value:function t(e){return this.postMessageToChat({name:"login",data:e})}},{key:"setCustomFields",value:function t(e){return this.postMessageToChat({data:e,name:"setCustomFields"})}},{key:"hide",value:function t(){this.addClass(o);return true}},{key:"show",value:function t(){this.removeClass(o);return true}},{key:"isReady",value:function t(){return this.ready}},{key:"clearSession",value:function t(){return this.postMessageToChat({name:"clearSession"})}}]);return t}();var r=new c;var h=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=h(e);if(a){return a.isReady()}else{return false}},hide:function t(e){var a=h(e);return a?a.hide():false},show:function t(e){var a=h(e);return a?a.show():false},showApp:function t(e){var a=h(e);return a?a.showApp():false},hideApp:function t(e){var a=h(e);return a?a.hideApp():false},toggle:function t(e){var a=h(e);return a?a.toggleApp():false},login:function t(e,a){var i=h(a);return i?i.loginApp(e):false},setCustomFields:function t(e,a){var i=h(a);return i?i.setCustomFields(e):false},clearSession:function t(e){var a=h(e);return a?a.clearSession():false},apps:{}}}window.octadesk.chat.apps[r.id]=r})();