/*! * native-validator-bootstrap v0.0.6 * Copyright 2020 Iskandar Jamil */ function formatDateHuman(t){if(!t)return"";const e=new Date(t);if(isNaN(e.getTime()))return"";return`${String(e.getDate()).padStart(2,"0")}-${String(e.getMonth()+1).padStart(2,"0")}-${e.getFullYear()}`}function vc(t){var e=t.currentTarget,i=e.getAttribute("data-vc").trim(),n=i==e.value.trim();if(n){var o=e.parentNode.querySelector('[name="spamCheck"]');o.value=i,o.classList.remove("is-invalid")}return n}!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.Validator=e():t.Validator=e()}(window,function(){return i={},t.m=e=[function(t,e,i){(function(e){function i(){return u.Date.now()}var n=/^\s+|\s+$/g,o=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,r=/^0o[0-7]+$/i,s=parseInt,l="object"==typeof e&&e&&e.Object===Object&&e,c="object"==typeof self&&self&&self.Object===Object&&self,u=l||c||Function("return this")(),d=Object.prototype.toString,f=Math.max,h=Math.min;function m(t){var e=typeof t;return t&&("object"==e||"function"==e)}function v(t){if("number"==typeof t)return t;if("symbol"==typeof(e=t)||(i=e)&&"object"==typeof i&&"[object Symbol]"==d.call(e))return NaN;var e,i,l;if(m(t)&&(t=m(l="function"==typeof t.valueOf?t.valueOf():t)?l+"":l),"string"!=typeof t)return 0===t?t:+t;t=t.replace(n,"");var c=a.test(t);return c||r.test(t)?s(t.slice(2),c?2:8):o.test(t)?NaN:+t}t.exports=function(t,e,n){var o,a,r,s,l,c,u=0,d=!1,p=!1,y=!0;if("function"!=typeof t)throw new TypeError("Expected a function");function g(e){var i=o,n=a;return o=a=void 0,u=e,s=t.apply(n,i)}function b(t){var i=t-c;return void 0===c||e<=i||i<0||p&&r<=t-u}function E(){var t,n,o=i();if(b(o))return w(o);l=setTimeout(E,(n=e-((t=o)-c),p?h(n,r-(t-u)):n))}function w(t){return l=void 0,y&&o?g(t):(o=a=void 0,s)}function k(){var t,n=i(),r=b(n);if(o=arguments,a=this,c=n,r){if(void 0===l)return u=t=c,l=setTimeout(E,e),d?g(t):s;if(p)return l=setTimeout(E,e),g(c)}return void 0===l&&(l=setTimeout(E,e)),s}return e=v(e)||0,m(n)&&(d=!!n.leading,r=(p="maxWait"in n)?f(v(n.maxWait)||0,e):r,y="trailing"in n?!!n.trailing:y),k.cancel=function(){void 0!==l&&clearTimeout(l),o=c=a=l=void(u=0)},k.flush=function(){return void 0===l?s:w(i())},k}}).call(this,i(2))},function(t,e,i){var n=i(5).default;n.plugin=n.prototype.plugin,n.plugin("match",i(3).default),n.plugin("email",i(4).default),t.exports=n},function(t,e){var i=function(){return this}();try{i=i||new Function("return this")()}catch(t){"object"==typeof window&&(i=window)}t.exports=i},function(t,e,i){"use strict";i.r(e),e.default={install:function(){},validate:function(t,e){return t.value===document.querySelector(e).value}}},function(t,e,i){"use strict";i.r(e),e.default={install:function(){},validate:function(t){return/^[_A-z0-9._%+-]+@[_A-z0-9.-]+\.[_A-z]{2,}$/.test(t.value)}}},function(t,e,i){"use strict";i.r(e),i.d(e,"default",function(){return l});var n=i(0),o=i.n(n);function a(t,e){for(Element.prototype.matches||(Element.prototype.matches=Element.prototype.matchesSelector||Element.prototype.mozMatchesSelector||Element.prototype.msMatchesSelector||Element.prototype.oMatchesSelector||Element.prototype.webkitMatchesSelector||function(t){for(var e=(this.document||this.ownerDocument).querySelectorAll(t),i=e.length;0<=--i&&e.item(i)!==this;);return-1",".book-direct-popup { height: 100vh; width: 100%; display: flex; align-items: center; justify-content: center; padding: 20px; box-sizing: border-box; }",".book-direct-popup a { display: block; max-width: 100%; max-height: 100%; }",".book-direct-popup img { display: block; width: auto; height: auto; max-width: 100%; max-height: calc(100vh - 40px); margin: auto; box-shadow: 0 12px 35px rgba(0,0,0,0.35); }",".book-direct-popup-close { position: fixed; top: 12px; right: 16px; z-index: 10000; color: #fff; font-size: 34px; line-height: 1; text-decoration: none; text-shadow: 0 2px 8px rgba(0,0,0,0.65); }","@media only screen and (max-width:750px){ .book-direct-popup { padding: 48px 12px 16px; } .book-direct-popup img { max-height: calc(100vh - 64px); } }","","×","
","","Book direct at Empress Rooms","","
"].join("")}))}-1===t.indexOf("/backoffice")&&"y"!==n(e)&&setTimeout(function(){a()},8e3)}),Validator.plugin("phone",{install(){},validate:(t,e)=>/^(\+44|01|02|03|04|05|06|07|08|09)[0-9 ()-]+$/.test(t.value)}),Validator.plugin("spam",{install(){},validate:(t,e)=>vc({currentTarget:t})}),Validator.plugin("function",{install(){},validate(t,e){const i=e;return"function"==typeof window[i]?window[i](t,e):(console.error(`Validation function ${i} does not exist.`),!1)}});var validatorInit=function(){document.querySelectorAll("form").forEach(function(t){new Validator(t,{})});for(var t=document.getElementsByName("txtSpam"),e=0;e{if(t.ok)return t.json();throw t}).then(e=>{document.querySelectorAll(".error-message").forEach(t=>t.remove()),t.querySelector("button.af-submit").classList.remove("af-processing");var i=window[n];"function"==typeof i?i(t,e):af_success(t,e),setTimeout(function(){""!==a&&document.body.classList.remove(a)},1500)}).catch(e=>{e.text().then(e=>{var i=JSON.parse(e);for(var n in document.querySelectorAll(".invalid-feedback").forEach(t=>t.innerHTML=""),t.querySelector("button.af-submit").classList.remove("af-processing"),i.errors){var a=t.querySelector('[name="'+n+'"]');if(a){a.classList.remove("is-valid"),a.classList.add("is-invalid");for(var r=[],s=a.nextElementSibling;s;){if(s.classList.contains("invalid-feedback")){r.push(s);break}s=s.nextElementSibling}s&&(s.innerHTML=i.errors[n].msg)}}var l=window[o];"function"==typeof l?l(t,e):console.log(i)})})}}function af_load(t){document.querySelectorAll("form[data-af-success] button.af-submit").forEach(function(t){t.addEventListener("click",function(t){if(!t.target.classList.contains("af-processing")){var e=t.target.closest("form")||null;e&&AUTOFORM_NODE(e)}})})}function af_success(){parent.showAlert("icon-ok-circled","Success","Thank you for your interest","#FFFFFF",!1),"undefined"!=typeof modalClose&&modalClose()}function af_fail(){parent.showAlert("icon-cancel-circled","Fail","There was an error with the form, please make sure all required information is entered and try again.","#FFFFFF",!1),"undefined"!=typeof modalClose&&modalClose()}function af_loader(){showAlert("fa fa-spinner fa-pulse","","","#FFFFFF",!1)}validatorInit(),document.addEventListener("DOMContentLoaded",function(){af_load(document)});var modaloElement=document.querySelector(".modalo"),overlay_EventAttached=!1;function isIframe(){try{return window.self!==window.top}catch(t){return!0}}function showOverlay(t){if(void 0!==t&&null!=t){var e=t.URL||"",i=t.Contents||"",n=t.W||1024,o=t.H||600,a=(t.NoExit,{W:screen.width,H:screen.height});void 0!==window.matchMedia&&(window.matchMedia("(orientation: portrait)").matches?a.W=screen.width:window.matchMedia("(orientation: landscape)").matches&&screen.height>a.W&&(a.W=screen.height,a.H=screen.width)),t.NoExit&&document.body.classList.add("noexit"),modaloElement.style.maxWidth=n+"px",modaloElement.style.maxHeight=o+"px";var r=Math.max(a.H/2-o/2-a.H/2,0);if(modaloElement.style.top=r+"px",isIframe())return window.location=e;if(modaloElement.classList.remove("loaded"),modaloElement.innerHTML=i,""!==e){var s=n,l=o;s=s>a.W?a.W:s,l=l>a.H?a.H:l;var c="/_components/web_optimised/overlay-iframe.css";if(!document.head.querySelector('link[href="'+c+'"]')){var u=document.createElement("link");u.rel="stylesheet",u.href=c,document.head.appendChild(u)}var d=document.createElement("div");d.id="close",d.innerHTML="",modaloElement.appendChild(d);var f=document.createElement("iframe");f.width=s,f.id="iframeOverlay",f.src=e,modaloElement.appendChild(f),f.addEventListener("load",function(){modaloElement.classList.add("loaded")})}else modaloElement.classList.add("loaded");overlay_EventAttached||(document.body.addEventListener("click",clicked),overlay_EventAttached=!0),setTimeout(function(){document.body.classList.add("overlay")},0)}}function clicked(t){if(!document.body.classList.contains("noexit")){var e=t?.target||t?.srcElement;e&&3===e.nodeType&&(e=e.parentNode),e&&e.classList.contains("modal")||(document.body.classList.remove("overlay"),parent.document?.body.classList.remove("overlay"),window.lastLink&&(window.location.href=window.lastLink,window.lastLink=null),setTimeout(()=>{document.body.classList.contains("overlay")||(document.querySelector(".modalo").innerHTML="")},5e3))}}function showAlert(t,e,i,n,o){showOverlay({Contents:'

'+e+"

"+i+"

",NoExit:o})}