function hideSlideshow(){$(".ken-burns.kenBurnsSlideshow").addClass("hidden");$(".toggle-slideshow").addClass("hidden");sessionStorage.setItem("booking-hide-slideshow","true");document.querySelector(".toggle-slideshow-hide")?.addEventListener("click",changeSlideshowLabel())}function expandSlideshow(){sessionStorage.setItem("booking-hide-slideshow","false");$(".ken-burns.kenBurnsSlideshow").removeClass("hidden");$(".toggle-slideshow").removeClass("hidden");window.scrollTo({top:0,behavior:"smooth"});document.querySelector(".toggle-slideshow-expand")?.addEventListener("click",changeSlideshowLabel())}function changeSlideshowLabel(){const t=document.querySelector(".toggle-slideshow-hide"),n=document.querySelector(".toggle-slideshow-expand");n.hidden?(t.hidden=!0,n.hidden=!1):(t.hidden=!1,n.hidden=!0)}function removeParamFromParamListCaseInsensitive(n,t){for(let[i]of n)i.toLowerCase()===t.toLowerCase()&&n.delete(i)}function Ajax(n){if(n.url!=null&&(AJAX_CALLS_IN_PROGRESS==0||n.ignoreCallInProgress)){AJAX_CALLS_IN_PROGRESS++;(n.noLoadingSpinner==null||n.noLoadingSpinner==!1)&&$(".loading-overlay").addClass("visible");n.type==null&&(n.type="POST");var t=General.GetBaseURL();return n.baseUrl&&(t=n.baseUrl),$.ajax({url:t+n.url,type:n.type,data:n.data,headers:{"X-CSRF-Token":$("#MCSRF").val()},success:function(t,i,r){if(checkForErrorResponse(r),LoadAjaxResult(t,null),t.success!=null&&t.success==!0)n.success!=null&&n.success(t);else if(n.error!=null&&n.error(t),t.error!=null&&t.error.length>0){if(t.reloadPage===!0){window.location.reload();return}t.errorCode=="invalidGuests"&&$(".guest-filter").addClass("invalid");PopupMsg.showError(t.error)}},error:function(t,i,r){checkForErrorResponse(r);n.error!=null&&n.error(t)}}).always(function(){AJAX_CALLS_IN_PROGRESS--;AJAX_CALLS_IN_PROGRESS==0&&$(".loading-overlay").removeClass("visible")})}if(n.url!=null){let n=$.Deferred();return n.reject(CALL_IN_PROGRESS),console.error(CALL_IN_PROGRESS),n}}function LoadAjaxResult(n,t){if(n.redirect!=null&&n.redirect.length>0){if(history.state){const n=Object.assign({},history.state);delete n.additionalDetails;history.replaceState(n,"Updated State",document.location.href)}window.location.href=n.redirect}if(n.error==!0){$(location).attr("href","/resnexus/reservations/Error?source="+encodeURIComponent($(location).attr("href")));return}if(n.captcha==!0){$(location).attr("href","/resnexus/reservations/Error/banned?source="+encodeURIComponent(n.redirect));return}if(LoadMap(n),LoadBookingTabs(n),LoadCart(n),LoadReservationInfoBar(n),LoadListings(n),LoadRetailListings(n),LoadPackageGiftCertificateGrid(n),LoadPaypalExpress(n),LoadClassFilter(n),LoadLockFee(n),LoadSideBars(n),LoadDepositPolicies(n),n.availabilityGrid!=null&&n.availabilityGrid!=""){$(".availability-grid").replaceWith(n.availabilityGrid);try{AvailabilityGrid.Initialize()}catch(i){}}n.popupvalidationfailed!=null&&ToggleDialog(n.popupvalidationfailed,n.popupwidth);t!=null&&GoToByScroll(t);typeof Paperboy!="undefined"&&Paperboy.PriceCheck&&Paperboy.PriceCheck.reset()}function LoadSideBars(n){n.sideBarHtml!=null&&($(".search-filter-section.sidebar-section").remove(),$(".search-filters").append(n.sideBarHtml))}function LoadDepositPolicies(n){n.depositPoliciesHtml!=null&&$("#depositPolicies").html(n.depositPoliciesHtml)}function LoadClassFilter(n){n.classFilter!=null&&($(".class-filter-section").replaceWith(n.classFilter),requestAnimationFrame(()=>{classChangedEvent.detail.selectedClass=BookGen6.GetSelectedClass(),document.dispatchEvent(classChangedEvent)}))}function LoadMap(n){n.mapResult!=null&&n.mapResult.length>0&&($(".searchResultsContainer").html(n.mapResult),BookGen6.InitializeMaps())}function LoadBookingTabs(n){if(n.bookingTabsHtml){$("#BookingTabsCont").html(n.bookingTabsHtml);let t=$(".red-dropdown-bar .bookingTabs");t.length>0&&(window.bookingTabMenu=new OverflowMenu(t));BookGen6.InitializeCustomSelect();General.InitilizeKenBurns();General.SetHeaders()}}function LoadReservationInfoBar(n){if(n&&n.length!=0&&n.reservationInfoBar&&n.reservationInfoBar.length!=0){let t=$(".reservation-info-bar");if(t&&t.length!=0){let r=$(n.reservationInfoBar);r.removeClass("preloaded");let i=$(".checkout-panel.cart-view .scrollable-content .cart-item");if(i&&i.length!=0){let n=t.hasClass("visible");n&&r.addClass("visible")}else t.removeClass("visible");t.replaceWith(r);i&&i.length>0&&setTimeout(function(){$(".reservation-info-bar").addClass("visible")},20)}}}function LoadListings(n){if(n&&n.length!=0&&n.listings&&n.listings.length!=0){let t=$(".searchResultsContainer");t&&t.length!=0&&(t.hasClass("packageWizard")&&(t=t.find(".listingResultsContainer")),t.html(n.listings),BookGen6&&(BookGen6.InitializeRoomCards(),BookGen6.InitializePackageCards()))}}function LoadRetailListings(n){if(n&&n.length!=0&&n.retailListings&&n.retailListings.length!=0){let t=$(".searchResultsContainer");t&&t.length!=0&&(t.hasClass("packageWizard")&&(t=t.find(".retailListingResultsContainer")),t.html(n.retailListings),BookGen6&&(BookGen6.InitializeRoomCards(),BookGen6.InitializePackageCards()))}}function LoadPackageGiftCertificateGrid(n){if(n&&n.length!=0&&n.addPackageGiftCertificates&&n.addPackageGiftCertificates.length!=0){let t=$(".packageGiftCertificatesResultsContainer");t&&t.length!=0&&(t.html(n.addPackageGiftCertificates),BookGen6&&(BookGen6.InitializeRoomCards(),BookGen6.InitializePackageCards()))}}function LoadCart(n){if(n&&n.length!=0&&n.cart&&n.cart.length!=0){let t=$(".checkout-panel.cart-view");if(t&&t.length!=0){let i=$(n.cart),r=t.hasClass("visible");r&&i.addClass("visible");t.replaceWith(i);hideSlideshow();BookGen6.InitializeCustomSelect()}}}function LoadPaypalExpress(n){if(n&&n.length!=0&&n.paypalExpressHtml&&n.paypalExpressHtml.length!=0){let t=$(".pp-checkout-contents");t&&t.length!=0&&t.html(n.paypalExpressHtml)}}function LoadLockFee(n){if(n&&n.length!=0&&n.lockFee&&n.lockFee.length!=0){let t=$("#lockfeepopup-wrapper");t&&t.length!=0||(t=$('<div id="lockfeepopup-wrapper"><\/div>'),$("body").append(t));t.replaceWith(n.lockFee)}}function RegisterStopTransitionEffectsOnResize(){let n=null;window.addEventListener("resize",function(){Header.AdjustForRNWHeader();n?(clearTimeout(n),n=null):$("body").addClass("stop-transition");n=setTimeout(()=>{$("body").removeClass("stop-transition"),n=null},100)})}function checkForErrorResponse(n){n.getResponseHeader("SystemError")!==null&&(window.location.href=n.getResponseHeader("Location"))}function createCookie(n,t,i){var u,r;i?(r=new Date,r.setTime(r.getTime()+i*864e5),u="; expires="+r.toGMTString()):u="";document.cookie=n+"="+t+u+"; path=/"}function readCookie(n){for(var t,r=n+"=",u=document.cookie.split(";"),i=0;i<u.length;i++){for(t=u[i];t.charAt(0)==" ";)t=t.substring(1,t.length);if(t.indexOf(r)==0)return t.substring(r.length,t.length)}return null}function eraseCookie(n){createCookie(n,"",-1)}function areCookiesEnabled(){var n=!1;return createCookie("testing","Hello",1),readCookie("testing")!=null&&(n=!0,eraseCookie("testing")),n}function StateCountryDropdownLists(n,t,i){this.isCountry=i!=null?!0:!1;this.$state=i;this.$txt=n;this.data=t;this.elements=[];this.timeout=null;this.$container=null;this.matches=0;this.$selection=null;this.blurTimeout=null;this.Initialize()}function ExpirationDatePicker(n){this.$container=n;this.$txt=n.find("input");this.$month=n.find(".month-picker");this.$year=n.find(".year-picker");this.open=!1;let t=this;this.$txt.on("click",function(n){n.stopPropagation()});this.$txt.on("focus",function(){t.open?t.Close():t.ShowMonth()});let i=new RegExp(/^(\d{1,2})[-\/](\d{2,4})$/);this.$txt.on("blur",function(){let n=i.exec($(this).val());if(n!=null){console.log(n);let t=n[1];t.length==1&&(t="0"+t);let i=parseInt(n[2]);i<2e3&&(i+=2e3);$(this).val(t+"/"+i)}});this.$month.find("div:not(.title)").on("click",function(n){n.stopPropagation();t.$txt.val($(this).text()).trigger("change");t.ShowYear()});this.$year.find("div:not(.title)").on("click",function(n){n.stopPropagation();let i=t.$txt.val();t.$txt.val(i+"/20"+$(this).text()).trigger("change");t.Close()});$(window).on("click",function(){t.open&&t.Close()})}function combineURLSearchParams(n,t){for(var[i,r]of t.entries())n.append(i,r);return n}function disableCheckoutBtns(){$("button.checkout-button").prop("disabled",!0);$("a.checkout-button").addClass("disabled").on("click.disabled",function(n){n.preventDefault()})}function enableCheckoutBtns(){$("button.checkout-button").prop("disabled",!1);$("a.checkout-button").removeClass("disabled").off("click.disabled")}function SendAnalyticsViewItemEvent(){let r=$("#Currency").find('[selected="selected"]').text().substr(0,3),u=parseInt($(".visible .date-filter-header .nights").text()),n=$(".search-filters .rate-price-total").not(".more-rates .rate-price-total").text();if(n!=null&&n.length!=0){let t=parseFloat(n.match(/\d+\.\d+/)[0]),f=$(".detailsContainer .date-filter .start-date").val(),e=$(".detailsContainer .date-filter .end-date").val(),o=$(".detailsContainer .room-name").text(),i={currency:r,value:t,search_term:f+" - "+e,items:[{item_name:o,price:t,quantity:u,item_category:"Room"}]};HandleECommerceEvent("view_item",i);HandleECommerceEvent("select_item",Object.assign({},i))}}function initializeTooltips(){$(".tooltip-gen6, .mousetip-gen6").each(function(){let n=$(this),t;if(n.hasClass("autoLockedInputLabel")){let i=$("#"+n[0].htmlFor);if(!i.is(":visible")||i.css("visibility")==!1||!i.hasClass("autoLockedInput")||!i.is("[disabled]"))return;t=n.parent()}else n[0].htmlFor&&(t=$("#"+n[0].htmlFor));t===undefined&&(n.prev().length>0?t=n.prev():n.next().length>0?t=n.next():n.parent().length>0&&(t=n.parent()));t!==undefined&&t.hover(function(t){let i=$(this).offsetParent().offset(),r=$(this).offset();if(n.hasClass("mousetip-gen6"))n.css({top:r.top-i.top,left:t.pageX-i.left});else{let t=parseFloat($(this).css("padding-left"))+$(this).width()/2;n.css({top:r.top-i.top,left:r.left-i.left+t})}n.show()},function(){n.hide()})})}function SendAddRetailToCartEventToGoogle(n,t=false){let i=!t,r={reservableID:n,isAddingRetail:!0};SendEventToGoogleWithInfoFromServer(r,"GetECommerceRetailCartEvent",i)}function SendEventToGoogleWithInfoFromServer(n,t,i){let r=General.GetBaseURL();$.ajax({url:r+t,type:"GET",dataType:"json","async":i,data:n,success:function(n){HandleECommerceEvent(n.event_type,JSON.parse(n.event_info))},error:function(n,t,i){console.error("AJAX Error: ",t,i)}})}function HandleECommerceEvent(n,t){t!==null&&n!==null&&n!==""&&(typeof gtag!="undefined"&&gtag("event",n,t),t.event=n,window.dataLayerGTM=window.dataLayerGTM||[],window.dataLayerGTM.push(t))}function NormalizeDateFormat(n){return new Date(n).toDateString()}function getRateTypeID(n){let t=null;if(n!=null){let i=$(n).closest(".room-card").find(".room-rates-dropdown input[type=radio]:checked");if(i.length>0)t=i.data("rateid");else if($(n).closest("#ListingDetails-panel").length>0){let r=$(n).closest(".room-card").data("id"),i=$('.desktop-grid .room-card[data-id="'+r+'"]');if(i.length>0){let n=i.find(".room-rates-dropdown input[type=radio]:checked");n.length>0&&(t=n.data("rateid"))}}}return t}function ShowRetailPopup(n){Ajax({url:"RetailPopup",data:{id:n}}).then(n=>{n.success&&$("body").append(n.retailPopupHtml)})}function ShowRetailPopupForPackage(n,t){Ajax({url:"RetailPopupForPackage",data:{id:n,packageID:t}}).then(n=>{n.success&&$("body").append(n.retailPopupHtml)})}function RefreshStripeWidgetIfOnPaymentTab(){let n=$(".checkout-panel.payment-info-panel");n.length>0&&n.hasClass("embedded-checkout")&&n.hasClass("visible")&&createStripeWidget()}function getISODate(n){return n.getFullYear()+"-"+(n.getMonth()+1)+"-"+n.getDate()}async function IsDateOccupied(n,t,i,r){r==null&&(r=!1);let u=n.toString()+t.toString()+i;if(u in window.cachedOccupiedDates)return window.cachedOccupiedDates[u];else{let s=new Date(n),e=new Date(n);e.setDate(1);let o=await GetOccupancyForMonth(e,t,i,r),f=!1;for(let t=0;t<o.length;t++){let i=new Date(o[t]).getTime();if(i==n){f=!0;break}}return window.cachedOccupiedDates[u]=f,f}}function decompressAndParseJSON(n){const t=atob(n),i=new Uint8Array(t.length);for(let n=0;n<t.length;n++)i[n]=t.charCodeAt(n);const r=pako.inflate(i),u=(new TextDecoder).decode(r);return JSON.parse(u)}function GetOccupancyForMonth(n,t,i,r){return r==null&&(r=!1),new Promise(function(u,f){if(window.HideOccupancy===!0&&!r){u([]);return}let o=getISODate(n),e=getISODate(n)+t+i;if(i!=null&&(window.OccupancyByClass[i]==null||window.OccupancyByClass[i][o]==null)||i==null&&window.OccupancyByMonth[o]==null){if(OccupancyPromises[e]==null){OccupancyPromises[e]=[];let n=!1;window.location.href.toLowerCase().indexOf("/resnexus/reservations/worryfreeresnexus")>0&&(n=!0);$.ajax({url:General.GetBaseURL()+"GetCalendarOccupancy",method:"POST",data:{startOfMonth:o,classID:i,worryFreeMode:n},dataType:"text"}).done(function(n){var r=decompressAndParseJSON(n);if(!r.success){f();return}if(i==null||i==""){let n={ByRoom:r.ByRoom,Occupancy:r.Occupancy};if(window.OccupancyByMonth[o]=n,t!="all"){let i=n.ByRoom[t.toString()];u(i);OccupancyPromises[e]!=null&&OccupancyPromises[e].forEach(n=>{n(i)})}else u(n.Occupancy),OccupancyPromises[e]!=null&&OccupancyPromises[e].forEach(t=>{t(n.Occupancy)})}else{let n=r.Occupancy;window.OccupancyByClass[i]==null&&(window.OccupancyByClass[i]={});window.OccupancyByClass[i][o]=n;u(n);OccupancyPromises[e]!=null&&OccupancyPromises[e].forEach(t=>{t(n)})}}).fail(function(){f()})}else OccupancyPromises[e].push(u);return}i==null?t!="all"?u(window.OccupancyByMonth[o].ByRoom[t.toString()]):u(window.OccupancyByMonth[o].Occupancy):u(window.OccupancyByClass[i][o])})}var OVERFLOW_HTML,General,TextInputs,AJAX_CALLS_IN_PROGRESS,PopupMsg,BOOK_PATH,BookGen6,RoomGallery,packageWizard,miniCal,DEFAULT_RN_HEADER_HEIGHT,Header;class OverflowMenu{constructor(n,t){this.MenuItems=[];this.OverflowItems=[];this.$container=n;this.options=t;this.Initialize()}Initialize(){function n(){$(".overflow-items").toggle();let n=$(".overflow-items").is(":visible");$(".menu-overflow").attr("aria-expanded",n)}let t=this;this.$container.find(".menu-overflow").length==0&&this.$container.append(OVERFLOW_HTML);this.$container.children().each(function(){if(!$(this).hasClass("menu-overflow")){let n=getComputedStyle(this),i=this.getBoundingClientRect().width+parseFloat(n.marginLeft)+parseFloat(n.marginRight);t.MenuItems.push({width:i,$elem:$(this)})}});$(".menu-overflow").on("keydown",function(t){(t.key==="Enter"||t.key===" ")&&n()}).on("click",function(){n()});$(window).on("resize",()=>this.SizeChanged());this.SizeChanged()}SizeChanged(){let n=this.$container[0];if(n){n.style.overflow="hidden";let t=Math.ceil(n.getBoundingClientRect().width),i=n.scrollWidth>t;if(i)for(n.classList.add("overflow-visible");n.scrollWidth-2>t;){let n=this.MenuItems.pop();n.$elem.remove();this.$container.find(".overflow-items .spacer").after(n.$elem);this.OverflowItems.splice(0,0,n)}else for(;;)if(this.OverflowItems.length>0){let i=OverflowMenu.GetWidths(this.MenuItems);this.OverflowItems.length>1&&(i+=this.$container.find(".menu-overflow").width());let r=getComputedStyle(n),u=parseFloat(r.paddingLeft)+parseFloat(r.paddingRight);if(i+this.OverflowItems[0].width<=t-u){let n=this.OverflowItems.shift();this.MenuItems.push(n);n.$elem.remove();this.MenuItems[this.MenuItems.length-2].$elem.after(n.$elem)}else break}else{n.classList.remove("overflow-visible");break}n.style.overflow=null}}static GetWidths(n){let t=0;for(let i=0;i<n.length;i++)t+=n[i].width;return t}}$(document).ready(function(){var t=Resources.More;OVERFLOW_HTML='<div class="menu-overflow" tabindex="0" aria-haspopup="true" aria-expanded="false" aria-label="menu overflow"><div>'+t+'<\/div><span class="fa" style="padding: 4px;font-size: 9px; font-weight: 20;">&#xf078<\/span><div class="overflow-items" style="display: none;"><div class="spacer"><\/div><\/div><\/div>';let n=$(".red-dropdown-bar .bookingTabs");n.length>0&&(window.bookingTabMenu=new OverflowMenu(n))});class Semaphore{constructor(n){this.numPermits=n;this.currentNumRunning=0;this.queue=[]}async acquire(){this.currentNumRunning<this.numPermits?this.currentNumRunning++:await new Promise(n=>this.queue.push(n))}release(){if(this.currentNumRunning--,this.queue.length>0){const n=this.queue.shift();n();this.currentNumRunning++}}async use(n){await this.acquire();try{await n()}finally{this.release()}}}"use strict";let UUIDReg=new RegExp(/^\/resnexus\/reservations\/(?:book|worryfree|worryfreeresnexus|gateway)\/([0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12})/,"i"),DESKTOP_WIDTH=1260,TABLET_WIDTH=850,IS_DESKTOP=window.innerWidth>DESKTOP_WIDTH,IS_TABLET=!IS_DESKTOP&&window.innerWidth>TABLET_WIDTH,DISPLAY_LOCALE="en";General={WaitAsync:function(n){return new Promise(t=>{setTimeout(()=>t(),n)})},ShowWarningAlert:async function(n,t){t==undefined&&(t=3e3);let i=$('<div class="warningAlert floatingAlert"><span><\/span><div class="close">&times;<\/div><\/div>');i.find("span").text(n);i.appendTo($("body"));i.find(".close").on("click",function(){i.addClass("hidden")});await General.WaitAsync(t);i.addClass("hidden");await General.WaitAsync(1e3);i.remove()},StringFormat:function(){let n=arguments[0];for(let t=0;t<arguments.length-1;t++){let i="\\{"+t+"\\}",r=new RegExp(i,"g"),u=arguments[t+1];n=n.replace(r,u)}return n},ScrollData:{LastPosition:window.scrollY},WindowScroll:function(){Math.abs(window.scrollY-General.ScrollData.LastPosition)<10||General.SetHeaders()},SetHeaders(){const t=$("header, .rn-website-header"),i=$(".custom-header"),n=$(".red-dropdown-bar"),r=$(".kenBurnsSlideshow");let u=i.length>0?i.outerHeight()+i.offset().top:0,f=r.length>0?r.outerHeight()+r.offset().top:0,e=$(window).scrollTop(),o=e>Math.max(Math.max(t.outerHeight(),f),u);o?(n.css("position","fixed"),$("#BookingTabsCont").height(n.outerHeight()),window.scrollY>General.ScrollData.LastPosition?(t.addClass("hidden"),n.css("top","0")):(t.removeClass("hidden"),n.css("top",""))):(n.css("position","sticky"),$("#BookingTabsCont").height(""));General.ScrollData.LastPosition=window.scrollY},RegisterScroll:function(){window.addEventListener("scroll",General.WindowScroll,{passive:!0})},UnregisterScroll:function(){window.removeEventListener("scroll",General.WindowScroll,{passive:!0});$("header, .red-dropdown-bar").removeClass("hidden");General.ScrollData.LastPosition=0},DisableBodyScroll:function(){$("body").css({overflow:"hidden"})},EnableBodyScroll:function(){$("body").css({overflow:"auto"})},InitializeMenu:function(){$("header .triple-menu").off("click").on("click",function(){General.ToggleMenu()});$(window).on("resize",function(){IS_DESKTOP=window.innerWidth>DESKTOP_WIDTH;IS_TABLET=!IS_DESKTOP&&window.innerWidth>TABLET_WIDTH;Header.AdjustForRNWHeader();$(".cart-view").hasClass("visible")&&IS_DESKTOP&&BookGen6.HideCart()});General.RegisterScroll();General.SetHeaders();$(document).ready(Header.Initialize);Header.AdjustForRNWHeader();$(".internationalization-menu .setting-icon").on("click",function(){$(".internationalization-menu .menu-content").toggleClass("visible")});$(".internationalization-menu select").on("change",function(){$(".internationalization-menu .menu-content").removeClass("visible")})},InitializePopupPanels:function(){$(".popupPanelButton").on("click",function(){let t=$(this).data("id"),n=$("#"+t);n&&!n.hasClass("visible")&&n.addClass("visible");General.UnregisterScroll()});$(".popup-panel .close-button").on("click",function(){let n=$(this).closest(".popup-panel");n.removeClass("visible");General.RegisterScroll()})},InitilizeKenBurns:function(){let n=$(".desktop-grid > .search-filters .date-filter");n.length>0&&(window.searchPageWidget=new CalendarWidget($(".desktop-grid > .search-filters .date-filter")),miniCal=new MiniCalendar($(".desktop-grid > .search-filters .mini-calendar"),{calWidget:window.searchPageWidget,reservableID:"all"}));let t=$(".ken-burns.kenBurnsSlideshow");if(t.length==0){$(".toggle-slideshow").hide();$(".toggle-slideshow + div.divider").hide();return}sessionStorage.getItem("booking-hide-slideshow")=="true"?hideSlideshow():expandSlideshow();$("body").off("click",".toggle-slideshow").on("click",".toggle-slideshow",function(){$(this).hasClass("hidden")?expandSlideshow():hideSlideshow()});setTimeout(function(){$(".ken-burns.kenBurnsSlideshow").addClass("initialized")},500)},ToggleMenu:function(){$(".menu-items").toggleClass("open");$(".triple-menu").toggleClass("open");$(".menu-items").hasClass("open")&&$(".menu-items a:nth-of-type(1)").focus()},UID:null,GetUID:function(){if(this.UID==null){let t=window.location.pathname,n=UUIDReg.exec(t);if(n!=null)return n[1]}return UID},GetBaseURL:function(){return"/resnexus/reservations/book/"+this.GetUID()+"/"},IsValidNumber:function(n){var t=!0;return $.isNumeric(n)?isNaN(n)&&(t=!1):t=!1,t},RemoveNaNFromString:function(n){return n.replace(/\D/g,"")},RemoveProcessedQueryStringParams:function(n){return n&&(removeParamFromParamListCaseInsensitive(n,"startdate"),removeParamFromParamListCaseInsensitive(n,"enddate"),removeParamFromParamListCaseInsensitive(n,"adults"),removeParamFromParamListCaseInsensitive(n,"nights"),removeParamFromParamListCaseInsensitive(n,"capacity2"),removeParamFromParamListCaseInsensitive(n,"capacity3"),removeParamFromParamListCaseInsensitive(n,"capacity4"),removeParamFromParamListCaseInsensitive(n,"capacity5"),removeParamFromParamListCaseInsensitive(n,"capacity6"),removeParamFromParamListCaseInsensitive(n,"roomclass"),removeParamFromParamListCaseInsensitive(n,"packageid"),removeParamFromParamListCaseInsensitive(n,"bookroomid"),removeParamFromParamListCaseInsensitive(n,"numguests"),removeParamFromParamListCaseInsensitive(n,"resetfilters"),removeParamFromParamListCaseInsensitive(n,"aeunit")),n}};TextInputs={Initialize:function(){$(document).on("change",".text-input-animated input, .text-input-animated textarea",function(){$(this).val().length==0?$(this).removeClass("populated"):$(this).addClass("populated")});$(document).on("blur",".text-input-animated input, .text-input-animated textarea",function(){$(this).trigger("change")});$(".text-input-animated input, .text-input-animated textarea").trigger("change")}};AJAX_CALLS_IN_PROGRESS=0;const CALL_IN_PROGRESS="Error: Ajax call already in progress.";$(document).ready(function(){TextInputs.Initialize();General.InitializeMenu();General.InitializePopupPanels();RegisterStopTransitionEffectsOnResize();$("#Languages").length>0&&(DISPLAY_LOCALE=$("#Languages").val())});areCookiesEnabled()||$(location).attr("href","/resnexus/reservations/Error/nocookies");PopupMsg=function(){function i(t,i){i==null&&(i=5e3);n(t,i,"popupSuccess")}function r(t,i){i==null&&(i=5e3);n(t,i,"popupError")}function n(n,i,r){let f=$("#divPopupMsg");f&&f.length!=0||(f=$('<div id="divPopupMsg"><\/div>'),$("body").prepend(f));for(var u=0;u<100;u++)if($("#"+r+u).length==0){f.append('<table class="'+r+'" id="'+r+u+'"><tr>\n   <td><div class="'+r+'Img" /><\/td>\n   <td>'+n+'<\/td>\n   <td class="popupCloseImgContainer">\n      <a href="javascript:void(0)" class="popupCloseImg '+r+'CloseImg" />\n   <\/td>\n<\/tr><\/table>');$("#"+r+u).fadeIn(300);window.setTimeout(function(){t(r+u)},i);break}}function t(n){$("#"+n).fadeOut(400,function(){$("#"+n).remove()})}return $(document).ready(function(){$(document).on("click",".popupCloseImg",function(){t($(this).closest("table")[0].id)})}),{showMsg:i,showError:r}}();let Validation={EmailRegex:new RegExp(/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/),PhoneRegex:new RegExp(/^[-+0-9._ ()]+$/),PostalRegex:new RegExp(/^[- .0-9a-zA-Z]+$/),ValidateInputs:function(n){n==null&&(n=document);let t=!0;return $(n).find("*[validate-type]").each(function(){Validation.ValidateSingle($(this))||(t=!1)}),t},ValidateSingle:function(n){let i=n.attr("validate-type"),t=!1;if(Validation.Validate[i]!=null&&(t=Validation.Validate[i](n)),t)n.removeClass("invalid"),n.off("blur");else{n.addClass("invalid");n.off("blur").on("blur",function(){Validation.ValidateSingle(n)})}return t},Validate:{text:function(n){return(n.val()==null||n.val().length==0)&&Validation.IsRequired(n)?!1:!0},email:function(n){return!Validation.IsRequired(n)&&Validation.IsEmpty(n)?!0:Validation.EmailRegex.test(n.val())?!0:!1},phone:function(n){return!Validation.IsRequired(n)&&Validation.IsEmpty(n)?!0:Validation.PhoneRegex.test(n.val())?!0:!1},postal:function(n){return!Validation.IsRequired(n)&&Validation.IsEmpty(n)?!0:n.val()==null||n.val().trim().length==0||!Validation.PostalRegex.test(n.val())?!1:!0},dropdown:function(n){return n.val()===undefined?!1:Validation.IsRequired(n)&&n.val()=="0"?!1:!0},expiration:function(n){if(!Validation.IsRequired(n)&&Validation.IsEmpty(n))return!0;let t=new RegExp("^s*(0?[1-9]|1[012])[-/](20)?[0-9]{2}s*$");return t.test(n.val())},checkbox:function(n){return Validation.IsRequired(n)?n.is(":checked")?!0:!1:!0},CVV:function(n){if(!Validation.IsRequired(n)&&Validation.IsEmpty(n))return!0;let t=new RegExp("^s*[0-9]{3,4}s*$");return t.test(n.val())},CreditCard:function(n){if(!Validation.IsRequired(n)&&Validation.IsEmpty(n))return!0;let t=new RegExp("^[-. 0-9]{8,30}$");return t.test(n.val())},date:function(n){if(!Validation.IsRequired(n)&&Validation.IsEmpty(n))return!0;let t=new RegExp("^\\d{1,4}[-/]\\d{1,2}[-/]\\d{1,4}(T\\d{2}:\\d{2}(:\\d{2})?(\\.\\d{1,7})?(Z|[+-]\\d{2}:\\d{2})?)?$|^\\d{1,2}\\/\\d{1,2}\\/\\d{4}( \\d{2}:\\d{2}(:\\d{2})?(\\.\\d{1,7})?)?$");return t.test(n.val())}},IsEmpty:function(n){return n.val()==null||n.val().trim().length==0?!0:!1},IsRequired:function(n){return n.attr("required")!=null?!0:!1}};StateCountryDropdownLists.listenerOnWindow=!1;StateCountryDropdownLists.statesForCountry={};StateCountryDropdownLists.prototype.Initialize=function(){this.$txt.parent().append(this.BuildHTML());this.$txt.prop("readonly",!0);this.$txt.off("focus").on("focus",()=>{this.$container.addClass("visible")});this.$txt.off("click").on("click",()=>{this.$txt.val(""),clearTimeout(this.timeout),this.$container.addClass("visible"),this.timeout=setTimeout(()=>this.RunSearch(),200)});let n=this;this.$container.find("div").off("click").on("click",function(){clearTimeout(n.blurTimeout);n.$txt.val($(this).text());n.$selection=$(this);n.$txt.trigger("blur");n.$container.removeClass("visible");n.isCountry&&n.$state!=null&&n.$state.val("")});this.$txt.on("blur",function(){n.blurTimeout=setTimeout(()=>n.$container.removeClass("visible"),200)});if(this.isCountry&&this.$state!=null){this.$txt.on("blur",function(){if(n.$selection!=null){let t=n.$selection.data("id");n.LoadStatesForCountry(t)}else new StateCountryDropdownLists(n.$state,null)});let t=1;this.$txt.val().length>0&&(this.RunSearch(),this.$selection!=null&&(t=this.$selection.data("id")));this.LoadStatesForCountry(t)}};StateCountryDropdownLists.prototype.LoadStatesForCountry=function(n){let t=this;StateCountryDropdownLists.statesForCountry[n]==null?Ajax({url:"AutocompleteStates",data:{countryID:n},noLoadingSpinner:!0,ignoreCallInProgress:!0}).done(function(i){i.states!=null&&i.states.length>0&&(StateCountryDropdownLists.statesForCountry[n]=i.states);new StateCountryDropdownLists(t.$state,i.states)}):new StateCountryDropdownLists(this.$state,StateCountryDropdownLists.statesForCountry[n])};StateCountryDropdownLists.prototype.ScrollToSelection=function(){let n=this.$selection.position(),t=this.$selection.outerHeight(),i=this.$container.outerHeight();if(n.top>i-t||n.top<0){let u=this.$container.scrollTop(),r=u+n.top;n.top>0&&(r-=i-t);this.$container.scrollTop(r)}};StateCountryDropdownLists.prototype.RunSearch=function(){let t=this.$txt.val().toLowerCase();this.matches=0;this.$selection=null;$(this.elements).removeClass("selected");let n=this;$(this.elements).each(function(){$(this).text().toLowerCase().indexOf(t.toLowerCase())>=0?($(this).removeClass("hidden"),n.matches+=1,n.matches==1&&($(this).addClass("selected"),n.$selection=$(this))):$(this).addClass("hidden")})};StateCountryDropdownLists.prototype.BuildHTML=function(){let n=document.createElement("div");n.classList.add("autocomplete-data");this.$container=$(n);for(let t in this.data){let i=document.createElement("div");i.innerText=this.data[t];i.setAttribute("data-id",t);n.appendChild(i);this.elements.push(i)}return n};ExpirationDatePicker.prototype.ShowMonth=function(){this.open=!0;this.$month.addClass("visible");this.$year.removeClass("visible")};ExpirationDatePicker.prototype.ShowYear=function(){this.open=!0;this.$month.removeClass("visible");this.$year.addClass("visible")};ExpirationDatePicker.prototype.Close=function(){this.open=!1;this.$month.removeClass("visible");this.$year.removeClass("visible")};const countryStateLock=new Semaphore(1);$(document).on("change",".country-dropdown",async function(n,t){await countryStateLock.acquire();try{disableCheckoutBtns();var r=$(this).val(),i=$(this).closest(".country-state-dropdowns").find(".state-dropdown");let n=General.GetBaseURL(),u=await $.get(`${n}GetStatesByCountry`,{countryISOAlpha2Code:r});i.empty();$.each(u,function(n,t){i.append($("<option>").text(t.Text).val(t.Value))});t&&t();enableCheckoutBtns()}finally{countryStateLock.release()}});$(window).on("unload",function(){});BOOK_PATH="/resnexus/reservations/Book/";const SELECTED_CLASS_CHANGED_EVENT="selectedClassChanged";let classChangedEvent=new CustomEvent(SELECTED_CLASS_CHANGED_EVENT,{detail:{selectedClass:0}}),updateSearchParams=new CustomEvent("updateSearchParams",{detail:{params:new URLSearchParams}}),searchParamsUpdated=new CustomEvent("searchParamsUpdated",{detail:{params:null}});if(BookGen6={RetailDeliveryDateCal:null,Search:function(n,t){let i=!1,r=!1;if(n?i=!0:n=BookGen6.GetURLParams(),window.addAmenitySearchUrlParams&&window.addAmenitySearchUrlParams(n),window.isMissingRequiredAmenitySearchOptions&&isMissingRequiredAmenitySearchOptions()&&(PopupMsg.showError("Please make sure to select any required options before searching."),r=!0),i&&(searchParamsUpdated.detail.params=n,document.dispatchEvent(searchParamsUpdated)),$(".guest-filter").removeClass("invalid"),r)$("#filterspopup").addClass("dontRemoveVisible"),$("#searchBox").addClass("dontRemoveVisible");else return $("#filterspopup").removeClass("dontRemoveVisible"),$("#searchBox").removeClass("dontRemoveVisible"),Ajax({type:"GET",url:"Search?"+n}).done(()=>{BookGen6.AdditionalRoomDetailsLoaded()&&BookGen6.LoadRoomDetails(window.history.state.ID,window.history.state.classID),t&&(IS_DESKTOP||$(".searchResultsContainer")[0].scrollIntoView({behavior:"smooth"}))})},SearchListingsForPackage:function(n,t){let i=!1;if(t?i=!0:t=BookGen6.GetURLParams(),window.addAmenitySearchUrlParams&&window.addAmenitySearchUrlParams(t),window.isMissingRequiredAmenitySearchOptions&&isMissingRequiredAmenitySearchOptions()){PopupMsg.showError("Please make sure to select any required options before searching.");return}i&&(searchParamsUpdated.detail.params=t,document.dispatchEvent(searchParamsUpdated));Ajax({type:"GET",url:"SearchListingsForPackage?packageID="+n+"&"+t})},SearchRetailListingsForPackage:function(n){Ajax({type:"GET",url:"SearchRetailListingsForPackage?packageID="+n})},GetGiftCertificatesNeededOnPackage:function(n){Ajax({type:"GET",url:"GetGiftCertificatesNeededOnPackage?packageID="+n})},GetURLParams:function(){return document.dispatchEvent(updateSearchParams),searchParamsUpdated.detail.params=updateSearchParams.detail.params,document.dispatchEvent(searchParamsUpdated),updateSearchParams.detail.params},InitializeSearchButton:function(){$("button.search-button").on("click",function(){let n=new URLSearchParams,[t,i]=BookGen6.GetDatesToSearch();n.append("StartDate",t);n.append("EndDate",i);BookGen6.Search(n,!0);let r=NormalizeDateFormat(t),u=NormalizeDateFormat(i),f={search_term:r+" - "+u,start_date:r,end_date:u,amenities:n.get("amenityIDs"),search_class:n.get("roomClass")};HandleECommerceEvent("search",f)})},GetDatesToSearch:function(){let n,t;if(miniCal.calWidget.SavedStart)n=miniCal.calWidget.SavedStart,t=miniCal.calWidget.SavedEnd;else{let i=$(".search-filters .start-date").not(".mini-calendar .start-date"),r=$(".search-filters .end-date").not(".mini-calendar .end-date");n=i.data("val");t=r.data("val")}return[n,t]},InitializeShowMoreButton:function(){let n=$(".packageWizard");if(!n||n.length==0)$(".searchResultsContainer").on("click",".showMoreButton",function(){let n=$(this),t=n.data("next-page");Ajax({url:"ShowMore",data:{nextPage:t}})})},InitializeShowMoreButtonForPackage:function(){let n=$(".packageWizard");if(n&&n.length>0)$(".searchResultsContainer").on("click",".showMoreButton",function(){let n=$(this),t=n.data("next-page"),i=n.data("package-id");Ajax({url:"ShowMoreForPackage",data:{nextPage:t,packageID:i}})})},InitializeMaps:function(){$(document).ready(function(){$(".zoom-box").each(function(){function i(){let t=new ZoomBox(n);t.AddClickListener("div.outerBox",function(){let n=$(this).data("reservableid");$(".zoom-box.fullscreen").removeClass("fullscreen");BookGen6.LoadRoomDetails(n)})}let n=$(this),t=n.find("#MapImage");t[0].complete?i():t[0].onload=i})})},InitializeCollapsibleContainers:function(){$("body").on("click",".collapsible-container .collapse-button",function(){let n=$(this).closest(".collapsible-container"),t=n.children(".collapsible-content"),i=$(this).hasClass("hide-details");i?(t.slideUp(),n.find(".hide-details").hide(),n.find(".show-details").show(),sessionStorage.setItem("collapsedDetails","true")):(t.slideDown(),n.find(".hide-details").show(),n.find(".show-details").hide(),sessionStorage.removeItem("collapsedDetails"))})},InitializeWorryFreeBookings:async function(){$("body").on("change","#CoverageOptions input",async function(){let t=$(this).closest(".collapsible-container"),n=[];$("#CoverageOptions input[type=checkbox]:checked").each(function(){n.push($(this).val())});await Ajax({url:"UpdateTravelProtectionReservation",data:{selectedCoverages:n}}).done(function(){n.length==0?t.addClass("disabled"):t.removeClass("disabled")});RefreshStripeWidgetIfOnPaymentTab()})},InitializeCustomSelect:function(){function n(n){var t=n.prev("select").find("option:selected").text(),i;t!=null&&(i=n.find(".select-title").first(),i.length>0?i.text(t):n.prepend('<div class="select-title">'+t+"<\/div>"))}$("select.rn-select").each(function(){$(this).parent().find(".rn-select").not(this).remove();var t=document.createElement("div");t.classList.add("rn-select");t.setAttribute("aria-hidden","true");t.innerHTML='<span class="fa">&#xf078;<\/span>';$(this).after(t);n($(t))});$("select.rn-select").on("change",function(){var t=$(this).next("div.rn-select");n(t)})},SetRoomRate:function(n){var t=n.closest(".room-rates-dropdown").children(".rate");t.find(".rate-name").html(n.find(".rate-name").html());t.find(".rate-price-per-night").html(n.find(".rate-price-per-night").html());t.find(".rate-price-total").html(n.find(".rate-price-total").html())},InitializePackageCards:function(){$(".package-details a, .package-card .image-gallery, .package-card .room-name, .packageWizardStepContainer .packageRequirementLink, .sidebar-section .package-link").off("click").on("click",function(n){n.preventDefault();let t=$(this).data("id");if(!t){let n=$(this).closest(".package-card");t=n.data("id")}BookGen6.LoadPackageInfoPopup(t)})},InitializeRoomCards:function(){RoomGallery.InitializeItemCardGallery();$("#ListingDetails-panel").off("click",".room-card div.back-to-results button").on("click",".room-card div.back-to-results button",function(){window.history.back()});$(".room-details a, .room-gallery .images img, .room-card .card-content .room-name").off(".click").on("click",function(n){n.preventDefault();let r=$(this).closest(".room-card"),f=r.data("id"),t=r.data("class");t==""&&(t=null);let i=$("#PackageID"),u=null;i&&i.length>0&&(u=i.val());BookGen6.LoadRoomDetails(f,t,u)});$("body").off("keypress",".room-rates-dropdown").on("keypress",".room-rates-dropdown",function(n){(n.key=="Enter"||n.key==" ")&&($(this).find(".more-rates").slideToggle(),$(this).find(".more-rates input[type=radio]:checked").focus())}).off("click",".room-rates-dropdown").on("click",".room-rates-dropdown",function(){$(this).find(".more-rates").slideToggle()});$("body").off("click",".room-rates-dropdown .more-rates label.rate").on("click",".room-rates-dropdown .more-rates label.rate",function(){BookGen6.SetRoomRate($(this))});$("body").off("keypress",".room-rates-dropdown .more-rates input[type=radio]").on("keypress",".room-rates-dropdown .more-rates input[type=radio]",function(n){n.stopPropagation();(n.key==" "||n.key=="Enter")&&(n.preventDefault(),$(this).closest(".more-rates").slideToggle(),BookGen6.SetRoomRate($(this).next("label.rate")),$(this).blur())});$("body").off("click",".room-rates-dropdown .more-rates input[type=radio]").on("click",".room-rates-dropdown .more-rates input[type=radio]",function(n){n.stopPropagation()});$(".room-rates-dropdown del").attr("aria-hidden",!0)},UnregisterRoomDetailsSearch:null,InitializeAdditionalRoomDetails:function(n,t){RoomGallery.InitializeRoomDetailsGallery();let i=new CalendarWidget($("#ListingDetails-panel .date-filter"),n,t),r=new MiniCalendar($("#ListingDetails-panel .mini-calendar"),{calWidget:i,reservableID:n,classID:t});window.roomCalendar=i;let u=new GuestsFilter($("#ListingDetails-panel .guest-filter"));BookGen6.UnregisterRoomDetailsSearch=function(){r.UnregisterSearchEvent();i.UnregisterSearchEvent();u.UnregisterSearchFunc()};BookGen6.InitializeReservationInfoBarForDetails();BookGen6.ShowReservationInfoBar(null,!0)},HideCart:function(){$(".cart-view").removeClass("visible");General.RegisterScroll()},InitializeCart:function(){$("body").on("click",".cart-view .close-button",function(){BookGen6.HideCart()});$("body").on("click",".reservation-info-bar .package-requirement-error, .view-cart",function(){BookGen6.RefreshCart();$(".cart-view").addClass("visible");General.UnregisterScroll()});$("body").on("click",".start-over",function(){sessionStorage.removeItem("booking-hide-slideshow");$.ajax({url:"StartOver",type:"GET",dataType:"json"}).done(function(n){n.redirectUrl?(window.location.replace(n.redirectUrl),window.location.reload()):console.error("Redirect URL not provided.")}).fail(function(n,t,i){console.error("AJAX error: ",t,i)})});$("body").on("change",".cart-item .item-quantity",function(){$(this).closest(".cart-item-quantity").find(".updateQuantityButton").show()})},InitializeReservationInfoBarForDetails:function(){$(".reservation-info-bar .reservation-buttons").addClass("listingDetails");$(".reservation-info-bar .reservation-buttons > button:not(.back-button)").hide();var n,t=$("#ListingDetails-panel .reservable-status");t.length>0&&(n=[0].outerHTML);$(".reservation-info-bar .additionalButtons").html(n);$(".reservation-info-bar .back-button").show().off("click").on("click",function(){window.history.back()})},ResetReservationInfoBarButtons:function(){$(".reservation-info-bar .reservation-buttons > button").show();$(".reservation-info-bar .additionalButtons").html("");$(".reservation-info-bar .reservation-buttons").removeClass("listingDetails");$(".reservation-info-bar .back-button").hide().off("click")},ShowReservationInfoBar:function(n){let t=$(".reservation-info-bar");(!t.hasClass("visible")||n)&&(t.hasClass("preloaded")&&t.removeClass("preloaded"),t.addClass("visible"));t.is(":visible")&&BookGen6.AddClassToUserwayWidget()},AddClassToUserwayWidget:function(){window.userWayRetryCount=0;let n=document.querySelector(".uwy");n!=null?document.querySelectorAll(".uwy.userway_p3, .uwy.userway_p4, .uwy.userway_p5").forEach(n=>n.classList.add("res-bar-visible")):(window.userWayRetryCount+=1,window.userWayRetryCount<100&&setTimeout(BookGen6.AddClassToUserwayWidget,100))},HideReservationInfoBar:function(){let n=$(".reservation-info-bar .reservation-images img");n&&n.length!=0||($(".reservation-info-bar").removeClass("visible"),$(".uwy.userway_p3, .uwy.userway_p4, .uwy.userway_p5").removeClass("res-bar-visible"))},RefreshCart:function(){},LoadRoomDetails:function(n,t,i,r){BookGen6.UnregisterRoomDetailsSearch!=null&&BookGen6.UnregisterRoomDetailsSearch();Ajax({url:"RoomDetails",type:"GET",data:{id:n,classID:t,packageID:i,availExID:r}}).done(function(i){i&&i.length&&($("#ListingDetails-panel .detailsContainer").html(i),BookGen6.ShowAdditionalRoomDetails(n,t))})},AdditionalRoomDetailsLoaded:function(){let n=window.history.state;return n!=null&&n.additionalDetails==!0},ShowAdditionalRoomDetails:function(n,t){$("#ListingDetails-panel").addClass("visible");let i={additionalDetails:!0};n&&(i.ID=n);t&&(i.classID=t);let r=getRateTypeID($("#ListingDetails-panel .room-card")[0]),u=$("#ListingDetails-panel").find('.room-rates-dropdown label.rate[for*="rate'+r+'"]');BookGen6.SetRoomRate(u);$(window).on("popstate",BookGen6.HideOnPop);BookGen6.AdditionalRoomDetailsLoaded()?window.history.replaceState(i,null):window.history.pushState(i,null);BookGen6.InitializeAdditionalRoomDetails(n,t);$(document).on("updateSearchParams",BookGen6.AddUrlParams);document.querySelector("#ListingDetails-panel").scroll({top:0,behavior:"smooth"});SendAnalyticsViewItemEvent();General.UnregisterScroll();General.DisableBodyScroll();$(".back-to-results button").focus()},HideAdditionalRoomDetails:function(){$(window).off("popstate",BookGen6.HideOnPop);$(document).off("updateSearchParams",BookGen6.AddUrlParams);$("#ListingDetails-panel").removeClass("visible");BookGen6.HideReservationInfoBar();BookGen6.ResetReservationInfoBarButtons();BookGen6.UnregisterRoomDetailsSearch();General.RegisterScroll();General.EnableBodyScroll();window.roomCalendar=null},HideOnPop:function(){let n=window.history.state;n&&n.additionalDetails||BookGen6.HideAdditionalRoomDetails()},InitializeRetailAdditionalInfoPopup:function(){$("#RetailBookInfo-popup .close-button").on("click",function(){$("#RetailBookInfo-popup").removeClass("visible");General.EnableBodyScroll()});RoomGallery.InitializeItemCardGallery($("#RetailBookInfo-popup .reservable-card"));BookGen6.RetailDeliveryDateCal=null;let n=$("#RetailBookInfo-popup .retail-delivery-date .mini-calendar");n.length>0&&(BookGen6.RetailDeliveryDateCal=new MiniCalendar(n,{hideLegend:!0}));General.DisableBodyScroll()},LoadRetailAdditionalInfoPopup:function(n,t){Ajax({url:"RetailBookInfoPopup",type:"GET",data:{id:n,packageID:t}}).done(function(n){n&&n.length&&($("#RetailBookInfo-popup .detailsContainer").html(n),$("#RetailBookInfo-popup").addClass("visible"),BookGen6.InitializeRetailAdditionalInfoPopup())})},InitializePackageInfoPopup:function(){$("#PackageInfo-popup .close-button").on("click",function(){$("#PackageInfo-popup").removeClass("visible");General.EnableBodyScroll()});RoomGallery.InitializeItemCardGallery($("#PackageInfo-popup .reservable-card"));General.DisableBodyScroll()},LoadPackageInfoPopup:function(n){Ajax({url:"PackageInfoPopup",type:"GET",data:{id:n}}).done(function(n){n&&n.length?($("#PackageInfo-popup .detailsContainer").html(n),$("#PackageInfo-popup").addClass("visible"),BookGen6.InitializePackageInfoPopup()):location.reload()})},AddUrlParams:function(n){n.detail.params.set("unit",window.history.state.ID)},NewReservation:function(){Ajax({url:"NewReservation",type:"POST"}).done(n=>{n.url!=null&&(window.location.href=n.url)})},InitializeAvailabilityPopup:function(){$(".availability-popup-panel .availability-close-button").on("click",function(){$(this).closest(".availability-popup-panel").removeClass("visible")});$(".availability-popup-panel").on("click","div.date-grid > div:not(.disabled)",function(){$(this).closest(".availability-popup-panel").removeClass("visible")})},ShowAvailabilityPopup:function(n,t,i){let f=$('.searchResultsContainer .room-card[data-id="'+n+'"]').find(".room-name").text();$(".availability-popup-panel .room-name").text(f);let u=$(".availability-popup-panel .mini-calendar"),r=1;if(IS_TABLET&&(r=2),IS_DESKTOP&&(r=3),u.length>0){let o=new MiniCalendar(u,{hideLegend:!0,reservableID:n,classID:t,monthsToShow:r,calWidget:i,threeMonthPopup:!0}),f=$(".availability-popup-panel .close-button");function e(){f.off("click",e);o.UnregisterSearchEvent()}f.on("click",e)}$(".availability-popup-panel").addClass("visible")},ShowRoomAvailability:function(n,t){window.roomCalendar!=null?BookGen6.ShowAvailabilityPopup(n,t,window.roomCalendar):BookGen6.ShowAvailabilityPopup(n,t,window.searchPageWidget)},ApplyPromoCode:async function(){let n=$("#PromoCode").val();n!=null&&n.length!=0&&(await Ajax({url:"AddPromoCode",data:{newPromoCode:{PromoCode:n}}}),RefreshStripeWidgetIfOnPaymentTab())},GetSelectedClass:function(){let n=$(".class-filter-option.selected");if(n.length>0){let t=n.data("id");return t==0?null:t}return null}},RoomGallery={InitializeItemCardGallery:function(n){let t=$(".reservable-card");n&&(t=n);t.find(".image-gallery").each(function(){var t=$(this).find(".images img, .images video"),n;if(t.length<=1){$(this).find(".image-bar, .slider-controls").hide();return}let r=$(this).closest(".retail-card").length>0,u=$(this).closest(".popup-container").length==0;r&&u&&$(this).find(".image-bar").hide();let i=$(this).find(".image-bar-internal");i&&i.length!=0||(n=document.createElement("div"),n.classList.add("image-bar-internal"),t.each(function(){if($(this).is("img"))$(n).append(this.outerHTML);else if($(this).is("video")){var t=document.createElement("canvas");t.width=76;t.height=50;t.setAttribute("data-idx",$(this).data("idx"));$(n).append(t.outerHTML)}}),$(n).find("img, canvas").first().addClass("selected"),$(this).find(".image-bar").append(n))});t.find(".image-gallery .images video").on("click play",function(){$(this).closest(".image-gallery").find(".image-bar").hide()});t.find(".image-gallery .images video").each(function(){var n=$(this).closest(".image-gallery").find("canvas[data-idx="+$(this).data("idx")+"]").get(0),t;if(n.width===76){t=$(this).get(0);n.width=75;let i=n.getContext("2d");i.fillRect(0,0,76,50);i.drawImage(t,0,0,n.width,n.height);i.fillStyle="rgba(255, 255, 255, 0.5)";i.beginPath();i.moveTo(25,38);i.lineTo(25,12);i.lineTo(50,25);i.fill()}});t.find(".image-gallery img, .image-gallery canvas").on("click",function(){$(this).hasClass("selected")||RoomGallery.SetImage($(this))});t.find(".image-gallery .slider-controls").on("click",function(){RoomGallery.SliderImageChange($(this))});t.find(".images").on("touchstart",function(n){$(this).css("overflow-x","auto");RoomGallery.touchStart=n.changedTouches.length==1?n.changedTouches[0]:null});t.find(".images").on("touchend",function(n){var t,r,u,f,e,o,i,s;RoomGallery.touchStart!=null&&(t=n.changedTouches[0].clientX-RoomGallery.touchStart.clientX,r=!0,Math.abs(t)<80&&(r=!1),o=!1,$(this).find("img, video").each(function(){var n=$(this).position().left,i=!1;($(this).is("video")&&(this.paused||(i=!0,this.pause())),r&&(t>0&&n>0||t<0&&n<0))||(n=Math.abs(n),(u==null||n<u)&&(f=$(this).data("idx"),u=n,e=$(this),o=i))}),e.is("video")&&(i=e.get(0),i.paused&&!o?i.play():i.pause()),s=$(this).closest(".image-gallery").find('.image-bar img[data-idx="'+f+'"], .image-bar canvas[data-idx="'+f+'"]'),RoomGallery.SetImage(s,!0))})},InitializeRoomDetailsGallery:function(){$("#ListingDetails-panel .room-card .room-gallery").each(function(){var t=$(this).find(".images img, .images video"),n=document.createElement("div");n.classList.add("image-bar-internal");t.each(function(){if($(this).is("img"))$(n).append(this.outerHTML);else if($(this).is("video")){var t=document.createElement("canvas");t.setAttribute("data-idx",$(this).data("idx"));$(n).append(t.outerHTML)}});$(n).find("img, canvas").first().addClass("selected");$(this).find(".image-bar").append(n)});$("#ListingDetails-panel .room-card .room-gallery .image-bar img, #ListingDetails-panel .room-card .room-gallery .image-bar canvas").on("click",function(){$(this).hasClass("selected")||RoomGallery.SetImage($(this))});$("#ListingDetails-panel .room-card .room-gallery .slider-controls").on("click",function(){RoomGallery.SliderImageChange($(this))});$("#ListingDetails-panel .images").on("touchstart",function(n){$(this).css("overflow-x","auto");RoomGallery.touchStart=n.changedTouches.length==1?n.changedTouches[0]:null});$("#ListingDetails-panel .images").on("touchend",function(n){var t,r,u,f,e,o,i,s;RoomGallery.touchStart!=null&&(t=n.changedTouches[0].clientX-RoomGallery.touchStart.clientX,r=!0,Math.abs(t)<80&&(r=!1),o=!1,$(this).find("img, video").each(function(){var n=$(this).position().left,i=!1;($(this).is("video")&&(this.paused||(i=!0,this.pause())),r&&(t>0&&n>0||t<0&&n<0))||(n=Math.abs(n),(u==null||n<u)&&(f=$(this).data("idx"),u=n,e=$(this),o=i))}),e.is("video")&&(i=e.get(0),i.paused&&!o?i.play():i.pause()),s=$(this).closest(".image-gallery").find('.image-bar img[data-idx="'+f+'"], .image-bar canvas[data-idx="'+f+'"]'),RoomGallery.SetImage(s,!0))})},SetImage:function(n,t){var o,u,f,s;t==null&&(t=!1);n.parent().find("img.selected, canvas.selected").removeClass("selected");var e=n.data("idx"),i=n.closest(".image-gallery").find(".images"),r=i.find('img[data-idx="'+e+'"], video[data-idx="'+e+'"]');r.length!=0&&(o=i.scrollLeft()+r.position().left,t&&i.css("overflow-x","hidden"),i.animate({scrollLeft:o},500),n.addClass("selected"),u=n.closest(".image-gallery").find(".image-dots .dot"),u.removeClass("active"),f=i.find("img, video").index(r),u.eq(f).addClass("active"),s=i.find("img, video").length,n.closest(".image-gallery").find(".image-counter .current-index").text(f+1),n.closest(".image-gallery").find(".image-counter .total-count").text(s),t&&setTimeout(function(){i.css("overflow-x","auto")},500))},SliderImageChange:function(n){let i=$(n),u=i.closest(".image-gallery"),r=u.find(".image-bar img.selected, .image-bar canvas.selected"),t=null;if(i.hasClass("image-slider-left")){let n=r.prev();if(n&&n.length>0)t=n;else{let i=r.closest(".image-bar-internal"),n=i.children().last();n.hasClass("selected")||(t=n)}}else if(i.hasClass("image-slider-right")){let n=r.next();if(n&&n.length>0)t=n;else{let i=r.closest(".image-bar-internal"),n=i.children().first();n.hasClass("selected")||(t=n)}}t&&($(i).closest(".detailsContainer").length===0&&u.find(".image-bar").show(),u.find(".images video").each(function(){this.pause()}),RoomGallery.SetImage(t))}},$(document).ready(function(){BookGen6.InitializeCustomSelect();BookGen6.InitializeSearchButton();BookGen6.InitializeShowMoreButton();BookGen6.InitializeShowMoreButtonForPackage();BookGen6.InitializeRoomCards();BookGen6.InitializePackageCards();BookGen6.InitializeCart();BookGen6.InitializeAvailabilityPopup();BookGen6.InitializeMaps();BookGen6.InitializeCollapsibleContainers();BookGen6.InitializeWorryFreeBookings();initializeTooltips();let t=$(".reservation-info-bar");t.hasClass("preloaded")&&BookGen6.ShowReservationInfoBar();let n=window.history.state;if(n&&n.additionalDetails){let i=n.ID,r=n.classID,u=n.availExID;window.history.replaceState(null,null);let t=$(".packageWizard");t&&t.length!=0||BookGen6.LoadRoomDetails(i,r,u)}$("#BookingTabsMobileDropdown").on("change",function(){let n=$(this).val();window.location.href=n});$("body").on("click",".cart-view button.apply-promo",function(){BookGen6.ApplyPromoCode()});$("body").off("click",".callus").on("click",".callus",function(){/Mobile|Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)&&$(this).data("phone-number")&&(window.location.href=$(this).data("text")==="True"?"sms:"+$(this).data("phone-number"):"tel:"+$(this).data("phone-number"))});$("body").on("keypress",".cart-view #PromoCode",function(n){n.key=="Enter"&&BookGen6.ApplyPromoCode()});$("body").on("click",".class-filter-option",function(){let n=$(this).data("id");HandleECommerceEvent("search",{searchTerm:"class search: "+n,search_class:n});Ajax({url:"FilterByClass",data:{classID:n}}).then(()=>{document.querySelector(".searchResultsContainer").scrollIntoView({behavior:"smooth"})})});$("body").on("change","#Currency, .bottomCurrencySelect",function(){let t=$(this).val(),n=new URLSearchParams(window.location.search);n.set("currency",t);window.location.search=n.toString()});$("body").on("change","#Languages, .bottomLanguagesSelect",function(){let t=$(this).val(),n=new URLSearchParams(window.location.search);n.set("lang",t);window.location.search=n.toString()})}),window.BookRoom=function(n,t){let i=getRateTypeID(t);Ajax({url:"BookRoom",data:{id:n,rateID:i}}).done(function(){SendEventToGoogleWithInfoFromServer({reservableID:n,isAddingARoom:!0},"GetRoomInCartECommerceEvent",!1);let i=$(".red-dropdown-bar").outerHeight()+$("header").outerHeight(),r=$(".desktop-grid").offset().top;$(window).scrollTop(r-i);let t=window.history.state;t&&t.additionalDetails&&window.history.back()})},window.BookRoomForPackage=function(n,t,i,r){let u=getRateTypeID(r);Ajax({url:"BookRoomForPackage"+(i?"?"+BookGen6.GetURLParams():""),data:{id:n,packageID:t,extendStay:i?!0:!1,rateTypeID:u}}).done(function(t){if(t){SendEventToGoogleWithInfoFromServer({reservableID:n,isAddingARoom:!0},"GetRoomInCartECommerceEvent",!1);let i=window.history.state;if(i&&i.additionalDetails&&BookGen6.HideAdditionalRoomDetails(),t.success&&PopupMsg.showMsg(t.customUnitsLabel+" added to cart"),t.packageWizardStep){let n=$(".packageWizardStepContainer");if(!n||n.length==0)return;window.WizardWidget&&window.WizardWidget.ProcessLoadNextStep()}t.redirectUrl&&(window.location.href=t.redirectUrl)}})},window.CancelRoom=async function(n,t,i,r){r==null&&(r=0);let u={reservableID:n,isAddingARoom:!1,nights:i,startDate:t};SendEventToGoogleWithInfoFromServer(u,"GetRoomInCartECommerceEvent",!1);await Ajax({url:"CancelRoom",data:{id:n,startDate:t,nights:i,tabID:r}});RefreshStripeWidgetIfOnPaymentTab()},window.CancelTime=function(n,t){return Ajax({url:"CancelTime",data:{rentalOccupancyID:n,rentalBillingItemID:t}})},window.JoinWaitlist=function(n,t){let i=getRateTypeID(t),r=$("#PackageID").val();Ajax({url:"JoinWaitlist",data:{id:n,rateID:i,packageID:r}}).done(function(n){n&&n.customUnitsLabel&&PopupMsg.showMsg("You have been added to the waitlist for this "+n.customUnitsLabel)})},window.BookRetailItem=function(n,t,i){Ajax({url:"BookRetailItem",data:{id:n,quantity:t,deliverOn:i}}).done(function(){SendAddRetailToCartEventToGoogle(n,!1)})},window.BookRetailItemForPackage=function(n,t,i,r){Ajax({url:"BookRetailItemForPackage",data:{id:n,packageID:t,quantity:i,deliverOn:r}}).done(function(t){if(SendAddRetailToCartEventToGoogle(n,!0),t){if(t.success&&PopupMsg.showMsg("Retail item added to cart"),t.packageWizardStep){let n=$(".packageWizardStepContainer");if(!n||n.length==0)return;window.WizardWidget&&window.WizardWidget.ProcessLoadNextStep()}t.redirectUrl&&($("#RetailBookInfo-popup .close-button").click(),window.location.href=t.redirectUrl)}})},window.BookRetailItemAdditionalInfo=function(n){let t=null,i=null,r=$("#RetailBookInfo-popup .item-quantity");r.length>0&&(t=r.val());BookGen6.RetailDeliveryDateCal&&(i=BookGen6.RetailDeliveryDateCal.selectedDate.toDateString());BookRetailItem(n,t,i);$("#RetailBookInfo-popup .close-button").click()},window.BookRetailItemAdditionalInfoForPackage=function(n,t){let i=null,r=null,u=$("#RetailBookInfo-popup .item-quantity");u.length>0&&(i=u.val());BookGen6.RetailDeliveryDateCal&&(r=BookGen6.RetailDeliveryDateCal.selectedDate.toDateString());BookRetailItemForPackage(n,t,i,r);$("#RetailBookInfo-popup .close-button").click()},window.UpdateRetailItemQuantity=function(n,t,i){let r=1;n&&(r=$(n).closest(".cart-item-quantity").find(".item-quantity").val());Ajax({url:"UpdateRetailItemQuantity",data:{id:t,newQuantity:r,deliverOn:i}})},window.CancelRetailItem=async function(n,t){SendEventToGoogleWithInfoFromServer({reservableID:n,isAddingRetail:!1},"GetECommerceRetailCartEvent",!1);await Ajax({url:"CancelRetailItem",data:{id:n,deliverOn:t}});RefreshStripeWidgetIfOnPaymentTab()},window.BookPackage=function(n){SendEventToGoogleWithInfoFromServer({packageID:n},"GetECommerceSelectPromotionEvent",!1);Ajax({url:"BookPackage",data:{id:n}}).done(function(n){$("#PackageInfo-popup .close-button").click();n&&n.redirectUrl&&(window.location.href=n.redirectUrl)})},window.CancelPackage=async function(n){await Ajax({url:"CancelPackage",data:{id:n}});RefreshStripeWidgetIfOnPaymentTab()},window.CancelGiftCertificate=async function(n){await Ajax({url:"CancelGiftCertificate",data:{id:n}});RefreshStripeWidgetIfOnPaymentTab()},window.BookUniqueGiftCertificate=function(n){let i=$("#CertificateForm-popup input[name=SendMode]:checked").val();if($("#CertificateForm-popup .mail-inputs input").prop("required",i=="mail"),Validation.ValidateInputs($("#CertificateForm-popup form"))){let f=$("#FNamePopup").val(),e=$("#SendAnonymouslyPopup").is(":checked"),o=$("#RNamePopup").val(),s=$("#REmailPopup").val(),h=$("#GCNotePopup").val(),t={newGiftCertificate:{ID:n,FromName:f,SendAnonymously:e,ToName:o,ToEmail:s,Note:h}};if(i=="mail"){let n=$("#RAddressPopup").val(),i=$("#RCityPopup").val(),r=$("#RStatePopup").val(),u=$("#RPostalPopup").val(),f=$("#RCountryPopup").val();t.newGiftCertificate.Address=n;t.newGiftCertificate.City=i;t.newGiftCertificate.State=r;t.newGiftCertificate.Postal=u;t.newGiftCertificate.Country=f}let r=$("#PackageID").val(),u=!1;r&&(t.newGiftCertificate.PackageID=r,u=!0);Ajax({url:"BookUniqueGiftCertificate",data:t}).then(n=>{if(n.cart!=null&&($("#CertificateForm-popup form")[0].reset(),$("#SendAnonymouslyPopup").trigger("change")),u){if(n.packageWizardStep){let n=$(".packageWizardStepContainer");if(!n||n.length==0)return;window.WizardWidget&&window.WizardWidget.ProcessLoadNextStep()}n.redirectUrl&&(window.location.href=n.redirectUrl)}});$("#CertificateForm-popup .close-button").click()}},packageWizard=$(".packageWizard"),packageWizard&&packageWizard.length!=0)$(document).on("click",".wizardStepContainer .retail-card .retail-name, .wizardStepContainer .retail-card .retail-description",function(){let n=$(this).closest(".retail-card").data("id"),t=$("#PackageID").val();ShowRetailPopupForPackage(n,t)});else $(document).on("click",".retail-card .retail-name, .retail-card .retail-description",function(){let n=$(this).closest(".retail-card").data("id");ShowRetailPopup(n)});$(document).ready(function(){$(".additional-dropdown-area").on("click",function(){$(this).find(".drop-arrow span").toggleClass("flip-rates-arrow")});$('.more-rates input[type="radio"]').on("change",function(){$(".drop-arrow span").toggleClass("flip-rates-arrow")})});const ONE_DAY_IN_MS=864e5,MONTHS_TO_LOAD=1,MORE_MONTHS_TO_LOAD=2,DateRegex=new RegExp(/^\s*(\d{1,4})[.\/-] ?(\d{1,2})[.\/-] ?(\d{1,4})\s*$/),HIDE_DEPARTURE_DATE=$("body").hasClass("hide-depart-date");$(document).ready(function(){General.InitilizeKenBurns()});$(document).on("searchParamsUpdated",function(n){let t=n.detail.params,i=t.get("StartDate"),r=t.get("EndDate");i!=null&&$("#StartDate").val(i);r!=null&&$("#EndDate").val(r)});class CalendarWidget{constructor(n,t,i){this.reservableID=t==null?"all":t;this.classID=i;this.$container=n;this.MinDate=null;this.MaxDate=null;this.MaxNumNights=null;this.TextBox=null;this.IsOngoing=null;this.SavedStart=null;this.SavedEnd=null;this.WasOngoing=!1;this.$Start=n.find("input.start-date");this.$End=n.find("input.end-date");this.$Nights=n.find(".num-nights-input");this.Initialize()}RegisterSearchEvent(){let n=this;this.SearchUpdatedFunc=function(t){let i=t.detail.params,r=i.get("StartDate"),u=i.get("EndDate");if(r!=null&&u!=null){let t=new Date(i.get("StartDate")),r=new Date(i.get("EndDate"));n.SetRange(t,r,!1);n.$Nights.val(CalendarWidget.CalculateNumNights(t,r))}};$(document).on("searchParamsUpdated",this.SearchUpdatedFunc);if(this.ClassUpdatedFunc&&typeof this.ClassUpdatedFunc=="function")$(document).on(SELECTED_CLASS_CHANGED_EVENT,this.ClassUpdatedFunc)}UnregisterSearchEvent(){$(document).off("searchParamsUpdated",this.SearchUpdatedFunc);this.ClassUpdatedFunc&&typeof this.ClassUpdatedFunc=="function"&&$(document).off(SELECTED_CLASS_CHANGED_EVENT,this.ClassUpdatedFunc)}Initialize(){let i=new Date($("#StartDate").val()),r=new Date($("#EndDate").val());CalendarWidget.SetDate(this.$Start,i);CalendarWidget.SetDate(this.$End,r);this.$Nights.val(CalendarWidget.CalculateNumNights(i,r));let n=this,u=$(".class-filter-section");this.classID==null&&u.length>0&&u.data("availabilitybyclass")&&(this.classID=BookGen6.GetSelectedClass(),this.ClassUpdatedFunc=function(t){let i=t.detail.selectedClass;n.classID=i==0?null:i;n.UpdateAvailableDays()});let t=this.$container.find(".calendar-widget");if(t&&t.length!=0){this.MinDate=new Date(t.data("min-date"));this.MaxDate=new Date(t.data("max-date"));this.MaxNumNights=t.data("max-num-nights");this.RegisterSearchEvent();let f=t.find(".months-container");f.html("");var e=CalendarWidget.ParseDate(this.MinDate.getTime());for(let n=0;n<MONTHS_TO_LOAD;n++)f.append(CalendarWidget.LoadMonth(e,this.MinDate,this.MaxDate)),e.setDate(32);this.LoadMoreMonths();this.HighlightRange();this.$container.find(".ongoing-btn").on("click",function(){let i=n.$Start,t=n.$End;if(n.IsOngoing){n.IsOngoing=!1;$(this).removeClass("selected");t.attr("disabled",null);let r=CalendarWidget.ParseDate(i.data("val"));r.setDate(r.getDate()+1);n.SetDate(t,r);n.ValidateDates(t);n.HighlightRange()}else n.IsOngoing=!0,$(this).addClass("selected"),t.attr("disabled",""),t.val("Ongoing"),t.removeClass("selected"),i.addClass("selected"),n.TextBox=i,n.HighlightRange()});this.$container.find(".num-nights").on("click",()=>{this.$container.find("input.end-date").click()});this.$container.find("input.start-date, input.end-date").on("focus",function(){n.clicking||($(this).val($(this).data("val")),$(this).addClass("editing"));n.clicking=!1});this.$container.find("input.start-date, input.end-date").on("mousedown",function(t){t.buttons&!0&&(n.clicking=!0)});this.$container.find("input.start-date, input.end-date").on("click",function(){n.$container.hasClass("visible")||n.Show();$(this).hasClass("selected")?$(this).hasClass("editing")||($(this).val($(this).data("val")),$(this).addClass("editing")):$(this).blur();n.$container.find(".date-range-row .selected").removeClass("selected");$(this).addClass("selected");n.TextBox=$(this);n.UpdateAvailableDays($(this).is(".end-date"))});t.on("click",".date-grid div.disabled",function(){IS_DESKTOP||General.ShowWarningAlert(CalendarResources.UnavailableForBooking)});t.on("click",".date-grid div:not(.disabled)",function(){var i,f,o,s,h;if($(this).hasClass("overMax")){let t=CalendarWidget.ParseDate($(this).data("date")),i=CalendarWidget.ParseDate(n.$Start.data("val")),r=CalendarWidget.CalculateNumNights(i,t);if(r>n.MaxNumNights){General.ShowWarningAlert(CalendarResources.BookUpToXDates);return}General.ShowWarningAlert(CalendarResources.DateBetweenUnavailable);return}if(i=n.TextBox,f=$(this).data("date"),f!=null){let e=!1,t=CalendarWidget.ParseDate(f),r=n.$Start,u=n.$End;if(HIDE_DEPARTURE_DATE){n.SetStartDateForHiddenDepartMode(t).then(()=>{n.ValidateDates(i),n.HighlightRange(),n.UpdateAvailableDays()});return}n.$container.hasClass("book-anything")?(CalendarWidget.SetDate(r,t),r.removeClass("invalid"),o=new Date(t),o.setDate(t.getDate()+1),CalendarWidget.SetDate(u,t),e=!0):i.hasClass("start-date")?(CalendarWidget.SetDate(i,t),r.removeClass("invalid"),n.IsOngoing?n.HighlightRange():(u.addClass("selected"),n.TextBox=u,u.val(""),u.data("val",""),u.removeClass("invalid"),i.removeClass("selected"))):(s=r.data("val"),h=CalendarWidget.ParseDate(s),t<=h?(CalendarWidget.SetDate(r,t),r.removeClass("invalid")):(CalendarWidget.SetDate(i,t),n.TextBox=r,r.addClass("selected"),i.removeClass("selected"),n.HighlightRange(),u.removeClass("invalid"),e=!0));n.ValidateDates(i);n.HighlightRange();n.UpdateAvailableDays();e&&n.$container.data("valid")=="true"&&n.$container.find(".small-apply-button").first().click()}});t.on("mouseenter",".date-grid div",function(){if(IS_DESKTOP){let t=$(this);if(t.hasClass("disabled"))n.ShowDateHoverMessage(this,CalendarResources.UnavailableForBooking);else if(t.hasClass("overMax")){let i=CalendarWidget.ParseDate(n.$Start.data("val")),r=CalendarWidget.CalculateNumNights(i,CalendarWidget.ParseDate(t.data("date")));r<n.MaxNumNights?n.ShowDateHoverMessage(this,CalendarResources.DateBetweenUnavailable):n.ShowDateHoverMessage(this,CalendarResources.BookUpToXDates)}}});t.on("mouseleave",".date-grid div",function(){n.HideDateHoverMessage()});this.$container.find(".start-date, .end-date").on("keyup",function(n){n.key=="Enter"&&$(this).blur()});this.$container.find(".start-date, .end-date").on("keydown",function(){$(this).addClass("editing")});const o=new RegExp(/^\d+$/);this.$container.find(".num-nights-input").on("keyup",function(n){$(this).val($(this).val().replace(/[^\d]/g,""));n.key=="Enter"&&$(this).blur()});this.$container.find(".num-nights-input").on("blur",function(){if(!o.test($(this).val())){PopupMsg.showError(resources.InvalidNumber);return}let t=parseInt($(this).val());t<1&&(PopupMsg.showError(resources.NightsMustBeGreaterThanZero),$(this).val(1));t>n.MaxNumNights&&(PopupMsg.showError(General.StringFormat(resources.MaxNumberOfNights,n.MaxNumNights)),$(this).val(n.MaxNumNights));n.SetStartDateForHiddenDepartMode(CalendarWidget.ParseDate(n.$Start.data("val")),!0)});this.$container.find(".start-date, .end-date").on("blur",function(){if($(this).hasClass("editing")){$(this).removeClass("editing");var i=$(this).val();let t=CalendarWidget.ParseDate(i);if(t!=null){if($(this).removeClass("invalid"),HIDE_DEPARTURE_DATE){n.SetStartDateForHiddenDepartMode(t).then(t=>{t===!0&&(n.LoadMoreMonths(),n.HighlightRange())});return}let i=CalendarWidget.ParseDate(t.getTime());CalendarWidget.SetDate($(this),i);n.ValidateDates($(this));n.LoadMoreMonths();n.HighlightRange();$(this).hasClass("end-date")&&n.$container.data("valid")=="true"&&n.$container.find(".small-apply-button").first().click()}else n.$container.find(".apply-button").addClass("disabled"),$(this).addClass("invalid")}});this.$container.find(".close-button").click(function(){n.Cancel()});t.on("scroll",function(){let t=this.scrollHeight,i=$(this).outerHeight(),r=$(this).scrollTop();if(r+i+150>=t){let t=n.GetLastLoadedMonth();t.setDate(32);n.LoadMoreMonths(t)}});this.$container.find(".apply-button").on("click",function(){n.SavedStart=CalendarWidget.ParseDate(n.$Start.data("val"));n.SavedEnd=CalendarWidget.ParseDate(n.$End.data("val"));n.WasOngoing=n.IsOngoing;n.Hide();let r=n.GetUrlParams();BookGen6.Search(r);let t=NormalizeDateFormat(n.$Start.val()),i=NormalizeDateFormat(n.$End.val()),u={search_term:t+" - "+i,start_date:t,end_date:i};HandleECommerceEvent("search",u)})}}GetLastLoadedMonth(){let n=this.$container.find(".calendar-widget .month-section").last();return new Date(n.data("year"),n.data("month"))}ShowDateHoverMessage(n,t){let i=$(".date-hover-message");i.length==0&&(i=$('<div class="date-hover-message"><\/div>'),i.appendTo($("body")));i.text(t);i.addClass("visible");let r=n.getBoundingClientRect();i.css({top:r.top+r.height/2+"px",left:r.left+r.width+20+"px"})}HideDateHoverMessage(){let n=$(".date-hover-message");n.removeClass("visible")}Show(){this.$container.hasClass("book-anything")&&this.$container.closest("#ServicesWizard").length>0||document.documentElement.scroll({top:0});hideSlideshow();this.SavedStart=CalendarWidget.ParseDate(this.$Start.data("val"));this.SavedEnd=CalendarWidget.ParseDate(this.$End.data("val"));this.WasOngoing=this.IsOngoing;this.$container.addClass("visible");IS_DESKTOP||$("body").css({overflow:"hidden"});let n=this.$container.find(".calendar-widget .date-grid div.selected").first(),t=CalendarWidget.ParseDate(n.data("date"));t.setDate(32);this.LoadMoreMonths(t);let i=this.$container.find(".month-section");if(i.length<3){let n=this.GetLastLoadedMonth(),t=3-i.length;for(let i=0;i<t;i++)n.setDate(32),this.LoadMoreMonths(n)}let r=n.closest(".month-section"),u=this.$container.find(".calendar-widget");u.scrollTop(r.position().top-this.$container.find(".calendar-widget .months-container").position().top);this.UpdateAvailableDays();$(".guests-dropdown-content").slideUp();IS_DESKTOP||IS_TABLET||!$("#ListingDetails-panel").hasClass("visible")||($("#ListingDetails-panel").css("overflow","hidden").addClass("datePickerMobile"),$("#ListingDetails-panel .date-filter.visible").css("bottom","unset")[0].scrollIntoView(),$(".reservation-info-bar").removeClass("visible"))}Hide(){this.$container.removeClass("visible");this.$container.find("input.start-date, input.end-date").removeClass("selected");$("body").css({overflow:"unset"});this.$container.find(".apply-button").hide();$("#ListingDetails-panel").css("overflow","auto").removeClass("datePickerMobile");IS_DESKTOP||$(".reservation-info-bar").addClass("visible")}Cancel(){CalendarWidget.SetDate(this.$container.find("input.start-date"),this.SavedStart);this.IsOngoing!=this.WasOngoing&&this.$container.find(".ongoing-btn").trigger("click");this.WasOngoing||CalendarWidget.SetDate(this.$container.find("input.end-date"),this.SavedEnd);this.HighlightRange();this.Hide()}ClearInputs(){this.TextBox=this.$Start;this.$Start.addClass("selected");this.$Start.val("");this.$Start.data("val","");this.$End.val("");this.$End.data("val","");this.$End.removeClass("selected")}ValidateDates(n){this.$container.data("valid","false");var t=CalendarWidget.ParseDate(this.$Start.data("val")),i=CalendarWidget.ParseDate(this.$End.data("val"));if(t>this.MaxDate){PopupMsg.showError(CalendarResources.CantBookTooFarInAdvance);this.ClearInputs();return}if(t<this.MinDate){PopupMsg.showError(CalendarResources.CantBookBeforeMinDate);this.ClearInputs();return}if(!this.IsOngoing&&i!=null){let r=CalendarWidget.ParseDate(t.getTime());if(r.setDate(r.getDate()+this.MaxNumNights),i<this.MinDate){PopupMsg.showError(CalendarResources.CantBookBeforeMinDate);this.ClearInputs();return}if(i>r){PopupMsg.showError(CalendarResources.CantReserveMoreNights);CalendarWidget.SetDate(this.$End,r);i=CalendarWidget.ParseDate(r.getTime());return}n.hasClass("start-date")?t>=i&&(i=CalendarWidget.ParseDate(t.getTime()),i.setDate(t.getDate()+1),CalendarWidget.SetDate(this.$End,i)):n.hasClass("end-date")&&i<=t&&(t=CalendarWidget.ParseDate(t.getTime()),t.setDate(i.getDate()-1),CalendarWidget.SetDate(this.$Start,t))}(this.IsOngoing||i!=null)&&t!=null&&this.$container.data("valid","true")}UpdateNumNights(){let n=this.NumNights||"--";this.$container.find(".num-nights span.nights").text(n)}HighlightRange(){this.UpdateNumNights();this.$container.find(".calendar-widget .date-grid div.selected").removeClass("selected");this.$container.find(".calendar-widget .date-grid div.checkout-date").removeClass("checkout-date").removeAttr("title");let i=this;var t=CalendarWidget.ParseDate(this.$Start.data("val")).getTime(),n=CalendarWidget.ParseDate(this.$End.data("val"));n=n!=null?n.getTime():t;this.$container.find(".calendar-widget .date-grid div").each(function(){var r=$(this).data("date");r!=null&&(i.IsOngoing||r<=n)&&r>=t&&($(this).addClass("selected"),r==n&&n!=t&&$(this).addClass("checkout-date").attr("title",Resources.CheckOutDate))})}async GetNextOccupiedDate(n,t){if(n==null||t==null)throw"Null date passed in.";let i=null,r=new Date(n.getTime());r.setDate(1);let u=await GetOccupancyForMonth(r,this.reservableID,this.classID);for(let t=0;t<u.length;t++){let f=u[t],r=new Date(f);if(r>=n){i=r;break}}return i==null?(n.setDate(32),n.setDate(1),n>t?t:this.GetNextOccupiedDate(n,t)):i<t?i:t}async UpdateAvailableDays(){let n=this,i=CalendarWidget.ParseDate(n.MinDate.getTime()).getTime(),t=null,r=n.$End.hasClass("selected");if(r){let i=CalendarWidget.ParseDate(n.$Start.data("val"));i.setDate(i.getDate()+n.MaxNumNights);let r=CalendarWidget.ParseDate(n.$Start.data("val")),u=await n.GetNextOccupiedDate(r,i);t=u.getTime()}else{let i=CalendarWidget.ParseDate(n.MaxDate.getTime());t=i.getTime()}n.$container.find(".calendar-widget .month-section").each(function(){$(this).find(".date-grid div").each(async function(){var u=$(this).data("date");if(u!=null)if((u<i||u>t)&&!$(this).hasClass("selected"))u>n.MaxDate.getTime()||u<i?$(this).addClass("disabled"):$(this).addClass("overMax");else{let i=(!r||u!=t)&&await IsDateOccupied(u,n.reservableID,n.classID);$(this).removeClass("overMax");i?$(this).addClass("disabled"):$(this).removeClass("disabled")}})})}LoadMoreMonths(n){if(n==null){let n=CalendarWidget.ParseDate(this.$Start.data("val")),t=CalendarWidget.ParseDate(this.$End.data("val"));n&&this.LoadMoreMonths(n);t&&this.LoadMoreMonths(t);return}let i=null,u=null;this.$container.find(".calendar-widget .month-section").each(function(){let t=$(this).data("month"),r=$(this).data("year"),n=new Date(r,t);(i==null||n<i)&&(i=n);(u==null||n>u)&&(u=n)});let f=CalendarWidget.ParseDate(this.MaxDate.getTime());f.setDate(f.getDate()+this.MaxNumNights);let e=CalendarWidget.ParseDate(n.getTime());e.setDate(32);e.setDate(0);e>=f&&(n=f,this.$container.find(".calendar-widget").off("scroll"));n<this.MinDate&&(n=this.MinDate);let t=CalendarWidget.ParseDate(n.getTime()),r=document.createDocumentFragment();while(t.getFullYear()<i.getFullYear()||t.getFullYear()<=i.getFullYear()&&t.getMonth()<i.getMonth())r.appendChild(CalendarWidget.LoadMonth(t,this.MinDate,this.MaxDate)),t.setDate(32);for(this.$container.find(".calendar-widget .months-container").prepend(r),t=CalendarWidget.ParseDate(u.getTime()),t.setDate(32),r=document.createDocumentFragment();t.getFullYear()<n.getFullYear()||t.getFullYear()<=n.getFullYear()&&t.getMonth()<=n.getMonth();)r.appendChild(CalendarWidget.LoadMonth(t,this.MinDate,this.MaxDate)),t.setDate(32);this.$container.find(".calendar-widget .months-container").append(r);this.UpdateAvailableDays()}GetUrlParams(n){var i,r,u;n==null&&(n=new URLSearchParams);i=this.$Start.data("val");let t=CalendarWidget.ParseDate(i);return i!=null&&t!=null&&(n.set("StartDate",CalendarWidget.ToISODate(t)),r=this.$End.data("val"),t=CalendarWidget.ParseDate(r),r!=null&&t!=null&&(n.set("EndDate",CalendarWidget.ToISODate(t)),u=CalendarWidget.CalculateNumNights(CalendarWidget.ParseDate(i),CalendarWidget.ParseDate(r)),n.set("NumNights",u))),n}async SetStartDateForHiddenDepartMode(n,t){let i=new Date(n.getTime());i.setDate(i.getDate()+parseInt(this.$Nights.val()));let u=i.getTime();this.LoadMoreMonths(CalendarWidget.ParseDate(u));let r=new Date(n.getTime());for(let n=0;n<parseInt(this.$Nights.val());n++){let t=await IsDateOccupied(r.getTime(),this.reservableID,this.classID);if(t){if(n==0){PopupMsg.showError("Date is unavailable.");return}let t=parseInt(this.$Nights.val());PopupMsg.showMsg(General.StringFormat(resources.SelectionOfNightsNotAvailable,t,n));this.$Nights.val(n);i=r;continue}r.setDate(r.getDate()+1)}return CalendarWidget.SetDate(this.$Start,n),CalendarWidget.SetDate(this.$End,i),t&&this.$container.find(".apply-button").click(),!0}OpenWithDateSelected(n){if(HIDE_DEPARTURE_DATE){this.SetStartDateForHiddenDepartMode(n,!0);return}this.$Start.trigger("click");let i=n.getTime();this.LoadMoreMonths(CalendarWidget.ParseDate(i));let r=this.$container.find('.calendar-widget .date-grid > div[data-date="'+i+'"]');r.trigger("click");let t=this.$container.find(".calendar-widget"),u=t.scrollTop()+r.closest(".month-section").offset().top-t.offset().top;t.scrollTop(u)}get NumNights(){var n=CalendarWidget.ParseDate(this.$Start.data("val")),t=CalendarWidget.ParseDate(this.$End.data("val"));return n==null||t==null?null:CalendarWidget.CalculateNumNights(n,t)}async SetRange(n,t,i){if((t===undefined||t===null)&&(t=new Date(n.getTime()+this.NumNights*ONE_DAY_IN_MS)),i===undefined&&(i=!0),CalendarWidget.SetDate(this.$Start,n),CalendarWidget.SetDate(this.$End,t),this.HighlightRange(),i){let n=this.GetUrlParams();await BookGen6.Search(n)}}static CalculateNumNights(n,t){var i=t-n;return Math.round(i/ONE_DAY_IN_MS)}static SetDate(n,t){n.data("val",CalendarWidget.GetShortDateString(t));let i=t.toLocaleString("default",{weekday:"short"}),r=t.toLocaleString("default",{month:"short"});DISPLAY_LOCALE.substr(0,2).toLowerCase()=="en"?n.val(i+", "+r+" "+t.getDate()+", "+t.getFullYear()):n.val(CalendarWidget.GetShortDateString(t))}static ToISODate(n){return n.getMonth()+1+"/"+n.getDate()+"/"+n.getFullYear()}static GetParseOrder(){if(this.locale==DISPLAY_LOCALE&&this.positions!=null)return this.positions;let i=new Date(2003,1,1),r=CalendarWidget.GetShortDateString(i),t=DateRegex.exec(r),n={};for(let i=1;i<=3;i++)t[i]==2003?n.year=i:t[i]==2?n.month=i:t[i]==1&&(n.day=i);return this.positions=n,this.locale=DISPLAY_LOCALE,n}static ParseDate(n){if(typeof n=="number"&&n>9e11)return new Date(n);let i=DateRegex.exec(n);if(i==null)return null;let f=CalendarWidget.GetParseOrder(),t=parseInt(i[f.year]),r=parseInt(i[f.month]-1),u=parseInt(i[f.day]);if(t>=0&&t<100&&(t+=2e3),t==null||t<2e3||t>2100||r==null||r<0||r>11||u==null||u<1||u>31)return null;return new Date(t,r,u)}static GetShortDateString(n){return n.toLocaleDateString(DISPLAY_LOCALE)}static LoadMonth(n,t,i){var r=CalendarWidget.ParseDate(n.getTime()),h=CalendarWidget.ParseDate(r.getTime()),v,u,o,s,e,l,a,f;h.setDate(32);h.setDate(0);r.setDate(1);v=r.getDay();let y=r.getMonth();u=document.createElement("div");u.classList.add("month-section");u.setAttribute("data-month",y);u.setAttribute("data-year",r.getFullYear());o=document.createElement("div");o.classList.add("calendar-title");o.innerText=r.toLocaleString(DISPLAY_LOCALE,{month:"long",year:"numeric"});u.appendChild(o);r.setDate(-v+1);let c=CalendarWidget.ParseDate(r.getTime());s=document.createElement("div");s.classList.add("days-of-week");u.appendChild(s);for(let n=0;n<7;n++){let n=document.createElement("span");n.innerText=c.toLocaleString(DISPLAY_LOCALE,{weekday:"short"});s.appendChild(n);c.setDate(c.getDate()+1)}for(e=document.createElement("div"),e.classList.add("date-grid"),u.appendChild(e),l=0;r<=h||l%7!=0;)a=r.getDate(),r.getMonth()==y?(f=document.createElement("div"),f.innerText=a,(r<t||r>i)&&f.classList.add("disabled"),f.setAttribute("data-date",r.getTime()),e.appendChild(f)):(f=document.createElement("div"),e.appendChild(f)),r.setDate(a+1),l++;return u}}class MiniCalendar{constructor(n,t){if(t==null&&(t={}),t.monthsToShow==null&&(t.monthsToShow=1),this.options=t,this.$cal=n,this.calWidget=t.calWidget,this.displayDate=this.calWidget!=null?CalendarWidget.ParseDate(this.calWidget.$Start.data("val")):new Date($("#StartDate").val()),t.hideLegend&&this.$cal.find(".mini-calendar-legend").hide(),this.dateRangeMode=t.dateRangeMode,this.selectedDate=CalendarWidget.ParseDate(this.displayDate.getTime()),this.endDate=null,this.dateRangeMode&&!t.loadEndDate){let i=1;t.defaultNumDaysSelected&&(i=t.defaultNumDaysSelected);let n=CalendarWidget.ParseDate(this.selectedDate.getTime());n.setDate(n.getDate()+i);this.endDate=n}else t.loadEndDate&&(this.endDate=new Date($("#EndDate").val()));this.reservableID=t.reservableID;this.classID=t.classID;this.MinDate=new Date($("#MinDate").val());this.MaxDate=new Date($("#MaxDate").val());t.maxNumNights&&(this.MaxNumNights=t.maxNumNights);let i=$(".class-filter-section");if(this.ShouldSetAvailabilityBasedOnClass(n,i)){this.classID=BookGen6.GetSelectedClass();let n=this;this.ClassUpdatedFunc=function(t){let i=t.detail.selectedClass;n.classID=i==0?null:i;n.LoadMonth()}}this.RegisterSearchUpdatedEvent();this.detailedMode=t.detailedMode;this.detailedMode&&(this.$cal.addClass("detailedMode"),this.SetAdditionalDetailsState(!0),this.UpdateDateInputs());this.Initialize()}Initialize(){this.LoadMonth();let n=this;if(this.calWidget!=null){this.calWidget.$container.find(".apply-button").on("click",()=>{this.selectedDate=CalendarWidget.ParseDate(n.calWidget.$Start.data("val")),this.displayDate=CalendarWidget.ParseDate(n.calWidget.$Start.data("val")),this.LoadMonth()});this.$cal.off("click").on("click",".date-grid > div[data-date]:not(.disabled)",async function(){if(!n.options.threeMonthPopup){n.calWidget.OpenWithDateSelected(CalendarWidget.ParseDate($(this).data("date")));return}let i=CalendarWidget.ParseDate($(this).data("date")),r=n.calWidget.NumNights,t=new Date(i.getTime());t.setDate(t.getDate()+r);n.selectedDate=i;n.endDate=t;await n.calWidget.SetRange(i,t);n.options.threeMonthPopup===!0&&BookGen6.LoadRoomDetails(n.reservableID,n.classID)})}else this.$cal.on("click",".date-grid > div[data-date]:not(.disabled)",function(){n.ClickHandler(CalendarWidget.ParseDate($(this).data("date")))});this.$cal.find(".arrow-right").on("click",()=>{for(let t=0;t<n.options.monthsToShow;t++)this.displayDate.setDate(32),this.displayDate.setDate(1);this.LoadMonth();this.dateRangeMode&&this.reservableID!=null&&this.UpdateAvailableDays()});this.$cal.find(".arrow-left").on("click",()=>{for(let t=0;t<n.options.monthsToShow;t++)this.displayDate.setDate(-1),this.displayDate.setDate(1);this.LoadMonth();this.dateRangeMode&&this.reservableID!=null&&this.UpdateAvailableDays()});if(this.detailedMode){this.$cal.find("input.start-date, input.end-date").on("click",function(){$(this).hasClass("editing")||($(this).val($(this).data("val")),$(this).addClass("editing"));let t=!0;$(this).hasClass("end-date")&&(t=!1);n.SetAdditionalDetailsState(t)});this.$cal.find("input.start-date, input.end-date").on("blur",function(){n.ValidateDates($(this));n.detailedMode&&n.UpdateDateInputs();n.HighlightRange();$(this).removeClass("editing")})}if(this.options.isWorryFreeCalendar)$(document).off("click",".green.checkout-button.worry-free-reschedule").on("click",".green.checkout-button.worry-free-reschedule",async function(){let i=CalendarWidget.ToISODate(n.selectedDate),r=CalendarWidget.ToISODate(n.endDate),t=await Ajax({baseUrl:"/ResNexus/Reservations/WorryFreeResNexus/"+General.GetUID()+"/",url:"RescheduleReservation",data:{startDate:i,endDate:r}});t.success?window.location.url="/ResNexus/Reservations/WorryFreeResNexus/"+General.GetUID()+"/Rescheduled":alert(JSON.stringify(t))})}ClickHandler(n){if(this.dateRangeMode?this.endDate==null||this.$cal.find(".end-date").hasClass("selected")?n<=this.selectedDate?(this.selectedDate=n,this.endDate=null,this.options.defaultNumDaysSelected>0&&this.SetEndDateForMinStay()):(this.endDate=n,this.SetAdditionalDetailsState(!0)):this.options.defaultNumDaysSelected>0?(this.selectedDate=n,this.SetEndDateForMinStay(),this.SetAdditionalDetailsState(!1)):(this.selectedDate=n,this.endDate=null,this.SetAdditionalDetailsState(!1)):this.selectedDate=n,this.ValidateDates(null),this.detailedMode&&this.UpdateDateInputs(),this.HighlightRange(),this.dateRangeMode&&this.reservableID!=null&&this.UpdateAvailableDays(),this.endDate!=null&&this.options.isWorryFreeCalendar){let n=CalendarWidget.ToISODate(this.selectedDate),t=CalendarWidget.ToISODate(this.endDate);Ajax({baseUrl:"/ResNexus/Reservations/WorryFreeResNexus/"+General.GetUID()+"/",url:"BookRoom",data:{startDate:n,endDate:t}}).then(n=>{n.success&&n.cartHTML&&$(".checkout-panel.cart-view.worry-free-cart").replaceWith(n.cartHTML)})}}SetAvailability(n,t){t||this.$cal.find(".date-grid > div.disabled.occupied").removeClass("occupied").removeClass("disabled");n.forEach(n=>{let t=new Date(n).getTime();this.$cal.find('.date-grid > div[data-date="'+t+'"]').addClass("occupied").addClass("disabled")})}CheckDates(){let n=CalendarWidget.ParseDate(this.displayDate.getTime());n.setDate(1);n<=this.MinDate?this.$cal.find(".arrow-left").addClass("disabled"):this.$cal.find(".arrow-left").removeClass("disabled");n.setDate(32);n.setDate(0);n>=this.MaxDate?this.$cal.find(".arrow-right").addClass("disabled"):this.$cal.find(".arrow-right").removeClass("disabled")}ShouldSetAvailabilityBasedOnClass(n,t){let i=n.closest(".availability-popup-panel").length==0,r=$(".room-card").length==1,u=this.classID==null&&t.length>0,f=t.data("availabilitybyclass");return u&&f?i?!0:r:!1}LoadMonth(){let t=CalendarWidget.ParseDate(this.displayDate.getTime()),n=document.createDocumentFragment();this.SetAvailability([]);for(let t=0;t<this.options.monthsToShow;t++){t>0&&(this.displayDate.setDate(32),this.displayDate.setDate(1));n.appendChild(CalendarWidget.LoadMonth(this.displayDate,this.MinDate,this.MaxDate));let i=CalendarWidget.ParseDate(this.displayDate.getTime());i.setDate(1);this.reservableID!=null&&GetOccupancyForMonth(i,this.reservableID,this.classID,this.options.threeMonthPopup).then(n=>this.SetAvailability(n,!0))}this.displayDate=t;this.$cal.find(".month-section").html(n);this.CheckDates();this.HighlightRange()}HighlightRange(){this.UpdateNumNights();let i=this;if(this.$cal.find(".date-grid div.selected").removeClass("selected"),this.$cal.find(".date-grid div.checkout-date").removeClass("checkout-date").removeAttr("title"),this.calWidget!=null){var t=CalendarWidget.ParseDate(this.calWidget.$Start.data("val")).getTime(),n=CalendarWidget.ParseDate(this.calWidget.$End.data("val"));n=n!=null?n.getTime():t;this.$cal.find(".date-grid div").each(function(){var r=$(this).data("date");r!=null&&(i.calWidget.IsOngoing||r<=n)&&r>=t&&($(this).addClass("selected"),r==n&&n!=t&&$(this).addClass("checkout-date").attr("title",Resources.CheckOutDate))})}else{let t=this.selectedDate.getTime(),n;n=this.dateRangeMode&&this.endDate!=null?this.endDate.getTime():t;let i=this.$cal.find(".date-grid div:not(.disabled)");i.each(function(){let i=parseInt($(this).data("date"));i<=n&&i>=t&&($(this).addClass("selected"),i==n&&n!=t&&$(this).addClass("checkout-date").attr("title",Resources.CheckOutDate))})}}RegisterSearchUpdatedEvent(){let n=this;this.SearchUpdatedFunc=function(t){if(n.calWidget!=null)n.HighlightRange();else{let i=t.detail.params,r=i.get("StartDate"),u=i.get("EndDate");if(r!=null&&u!=null){let t=new Date(i.get("StartDate")),r=new Date(i.get("EndDate"));n.selectedDate=t;n.endDate=r}}n.options.threeMonthPopup===!0&&n.UnregisterSearchEvent()};$(document).on("searchParamsUpdated",this.SearchUpdatedFunc);if(this.ClassUpdatedFunc&&typeof this.ClassUpdatedFunc=="function")$(document).on(SELECTED_CLASS_CHANGED_EVENT,this.ClassUpdatedFunc)}UnregisterSearchEvent(){this.SearchUpdatedFunc!=null&&$(document).off("searchParamsUpdated",this.SearchUpdatedFunc);this.ClassUpdatedFunc&&typeof this.ClassUpdatedFunc=="function"&&$(document).off(SELECTED_CLASS_CHANGED_EVENT,this.ClassUpdatedFunc)}GetUrlParams(n){return n==null&&(n=new URLSearchParams),this.selectedDate!=null&&(n.set("StartDate",CalendarWidget.ToISODate(this.selectedDate)),this.endDate!=null&&(n.set("EndDate",CalendarWidget.ToISODate(this.endDate)),n.set("NumNights",CalendarWidget.CalculateNumNights(this.selectedDate,this.endDate)))),n}SetAdditionalDetailsState(n){this.detailedMode&&(n?(this.$cal.find(".cal-additional-details .select-start-date").show(),this.$cal.find(".cal-additional-details .select-end-date").hide(),this.$cal.find(".start-date").addClass("selected"),this.$cal.find(".end-date").removeClass("selected")):(this.$cal.find(".cal-additional-details .select-start-date").hide(),this.$cal.find(".cal-additional-details .select-end-date").show(),this.$cal.find(".start-date").removeClass("selected"),this.$cal.find(".end-date").addClass("selected")))}UpdateNumNights(){let n=this.NumNights||"--";this.$cal.find(".num-nights span.nights").text(n)}get NumNights(){return this.selectedDate==null||this.endDate==null?null:CalendarWidget.CalculateNumNights(this.selectedDate,this.endDate)}UpdateDateInputs(){CalendarWidget.SetDate(this.$cal.find(".start-date"),this.selectedDate);this.endDate!=null?CalendarWidget.SetDate(this.$cal.find(".end-date"),this.endDate):this.$cal.find(".end-date").val("")}ValidateDates(n){var t=this.selectedDate,i=this.endDate;if(n&&(n.hasClass("start-date")?t=CalendarWidget.ParseDate(n.val()):i=CalendarWidget.ParseDate(n.val())),t>this.MaxDate){PopupMsg.showError(CalendarResources.CantBookTooFarInAdvance);return}if(t<this.MinDate){PopupMsg.showError(CalendarResources.CantBookBeforeMinDate);return}if(i!=null){let r=CalendarWidget.ParseDate(t.getTime());if(r.setDate(r.getDate()+this.MaxNumNights),i<this.MinDate){PopupMsg.showError(CalendarResources.CantBookBeforeMinDate);return}if(i>r){PopupMsg.showError(CalendarResources.CantReserveMoreNights);this.endDate=r;this.displayDate=new Date(this.endDate.getTime());this.LoadMonth();return}n&&(n.hasClass("start-date")?(t>=i&&(i=CalendarWidget.ParseDate(t.getTime()),i.setDate(t.getDate()+1),this.endDate=i),this.selectedDate=t):n.hasClass("end-date")&&(i<=t&&(t=CalendarWidget.ParseDate(i.getTime()),t.setDate(i.getDate()-1),this.selectedDate=t),this.endDate=i))}}SetEndDateForMinStay(){if(this.options.defaultNumDaysSelected>0){let n=CalendarWidget.ParseDate(this.selectedDate.getTime());n.setDate(n.getDate()+this.options.defaultNumDaysSelected);this.endDate=n}}async GetNextOccupiedDate(n,t){if(n==null||t==null)throw"Null date passed in.";let i=null,r=new Date(n.getTime());r.setDate(1);let u=await GetOccupancyForMonth(r,this.reservableID,this.classID,this.options.threeMonthPopup);for(let t=0;t<u.length;t++){let f=u[t],r=new Date(f);if(r>n){i=r;break}}return i==null?(n.setDate(32),n.setDate(1),n>t?t:this.GetNextOccupiedDate(n,t)):i}async UpdateAvailableDays(){let n=this,r=CalendarWidget.ParseDate(n.MinDate.getTime()).getTime(),t=null,i=n.endDate==null;if(i){let i=new Date(n.selectedDate.getTime());i.setDate(i.getDate()+n.MaxNumNights);let r=new Date(n.selectedDate.getTime()),u=await n.GetNextOccupiedDate(r,i);t=u.getTime()}else{let i=CalendarWidget.ParseDate(n.MaxDate.getTime());t=i.getTime()}n.$cal.find(".month-section").each(function(){$(this).find(".date-grid div").each(async function(){var u=$(this).data("date");if(u!=null)if((u<r||u>t)&&!$(this).hasClass("selected"))$(this).addClass("disabled");else{let r=(!i||u!=t)&&await IsDateOccupied(u,n.reservableID,n.classID,n.options.threeMonthPopup);r?$(this).addClass("disabled"):$(this).removeClass("disabled")}})})}}window.OccupancyByMonth={};window.OccupancyByClass={};window.cachedOccupiedDates={};let OccupancyPromises={};class BookingCart{constructor(){this.CART_STATES={STICKY:"F",FLOAT_UP:"FU",FLOAT_DOWN:"FD"};let n="ontouchstart"in window||navigator.maxTouchPoints>0;(this.tpCanBeClosedKey="TPCBCK",n)||(this.setTpCanBeClosed(),this.currentState,this.cacheElements(),this.init())}setTpCanBeClosed(){this.tpCanBeMannuallyClosed=!1;let n=sessionStorage.getItem(this.tpCanBeClosedKey);(!n||JSON.parse(n))&&setTimeout(()=>{let t=n?JSON.parse(sessionStorage.getItem(this.tpCanBeClosedKey)):$(".hide-details").css("display")!=="none";this.tpCanBeMannuallyClosed=t},1e3)}init(){this.setEventListeners();this.cartOnScroll();setTimeout(()=>this.cartOnScroll(),500);this.$cartBottom.css("width",this.$cartTopSticky.width());this.setHeaderEvents();this.observeTPContent()}cacheElements(){this.$reservationButtons=$(".reservation-buttons");this.$cartTopSticky=$(".cart-top-sticky");this.$scrollableContent=$(".scrollable-content");this.$wholeCart=$(".checkout-panel.cart-view");this.$collapseButton=this.$wholeCart.find(".collapse-button");this.$hideDetailsButton=this.$wholeCart.find(".hide-details");this.$header=this.getHeader();this.$cartPromoSection=$(".cart-promo-section");this.$topCover=this.$wholeCart.find(".top-cover");this.$cartBottom=$(".cart-bottom")}setEventListeners(){let n=this;$(window).on("scroll.cart",()=>this.cartOnScroll());this.$collapseButton.on("click",function(){$(this).hasClass("show-details")&&(n.tpCanBeMannuallyClosed=!1,sessionStorage.setItem(n.tpCanBeClosedKey,!1));setTimeout(()=>n.cartOnScroll(),500)});$(".start-over").on("click",()=>{sessionStorage.setItem(this.tpCanBeClosedKey,!0)})}removeEventListeners(){if($(window).off("scroll.cart"),$(".start-over").off("click"),this.$collapseButton.off("click"),this.tpObserver?.disconnect(),this.$header&&this.transitionStartHandler&&this.transitionEndHandler){const n=this.$header[0];n.removeEventListener("transitionstart",this.transitionStartHandler);n.removeEventListener("transitionend",this.transitionEndHandler)}}cartOnScroll(){if(bookingCart==this){this.adjustCartForHeader();let n=this.$header.offset().top+this.$header.outerHeight()-$(window).scrollTop();n=n>0?n:0;let t=$(window).scrollTop()>this.getMinHeightOfCart()?this.$cartTopSticky.offset().top-$(window).scrollTop()-n:0,i=this.$cartTopSticky.outerHeight(),r=this.$cartBottom.outerHeight()+t+i+n;if(n<=0&&this.tpCanBeMannuallyClosed&&$(".hide-details").css("display")!=="none"){if($(".checkout-panel .no-purchases").length>0)return;this.tpCanBeMannuallyClosed=!1;sessionStorage.setItem(this.tpCanBeClosedKey,!1);setTimeout(function(){$(".hide-details").click()},200)}this.setIfTopCoverShows();let u=r<$(window).height();if(u){this.setCartBottomToSticky();return}let f=$(window).scrollTop()+$(window).height(),e=$(".cart-bottom").outerHeight()+$(".cart-top-sticky").outerHeight()+this.getMinHeightOfCart()+10;if(f<e){this.setCartBottomToFloatToTop();return}this.setCartBottomToFloatToBottom()}}getHeader(){return $(".red-dropdown-bar").length>0?$(".red-dropdown-bar"):$(".rn-website-header").length>0?$(".rn-website-header"):$("header")}adjustCartForHeader(){if($(".checkout-grid").length>0){this.$wholeCart.css("top","");return}let t=this.$header.offset().top+this.$header.outerHeight()+30,i=$(window).scrollTop(),n=t-i;n>0?this.$wholeCart.css("top",n):this.$wholeCart.css("top","")}adjustBottomOfCartForTPChange(){if(this.currentState==this.CART_STATES.FLOAT_UP){this.cartOnScroll();return}if(this.currentState==this.CART_STATES.FLOAT_DOWN){let n=this.$cartTopSticky.offset().top+this.$cartTopSticky.outerHeight(),t=this.$cartBottom.offset().top;t>n&&this.cartOnScroll();return}let n=this.$wholeCart.offset().top+this.$wholeCart.outerHeight()+10,t=$(window).scrollTop()+$(window).outerHeight();n>t&&this.cartOnScroll()}setCartBottomToSticky(){this.currentState=this.CART_STATES.STICKY;this.$cartBottom.removeClass("cart-bottom-float-down");this.$cartBottom.removeClass("cart-bottom-float-up");this.$cartBottom.css("top","")}setCartBottomToFloatToBottom(){this.currentState=this.CART_STATES.FLOAT_DOWN;this.$cartBottom.addClass("cart-bottom-float-down");this.$cartBottom.removeClass("cart-bottom-float-up");this.$cartBottom.css("top","")}setCartBottomToFloatToTop(){this.currentState=this.CART_STATES.FLOAT_UP;this.$cartBottom.addClass("cart-bottom-float-up");this.$cartBottom.removeClass("cart-bottom-float-down");this.$cartBottom.css("top",this.getMinHeightOfCart()+this.$cartTopSticky.outerHeight()-$(window).scrollTop())}setIfTopCoverShows(){$(window).scrollTop()>10?this.$topCover.show():this.$topCover.hide()}getBottomOfCartNoScroll(){let n=$(".cart-promo-section").length>0?$(".cart-promo-section").outerHeight():0;return $(".scrollable-content").outerHeight()+$(".cart-top-sticky").outerHeight()+this.getMinHeightOfCart()+n}getHeaderHeight(){return this.$header.offset().top+this.$header.outerHeight()}getMinHeightOfCart(){if(this.$wholeCart.parent().length)return this.$wholeCart.parent().offset().top+parseFloat(this.$wholeCart.parent().css("padding-top"))+parseFloat(this.$wholeCart.parent().css("margin-top"))}setHeaderEvents(){const t=this.$header[0];let n;const i=()=>{this.adjustCartForHeader(),this.cartOnScroll(),n=requestAnimationFrame(i)};t.addEventListener("transitionstart",()=>{n=requestAnimationFrame(i)});t.addEventListener("transitionend",()=>{cancelAnimationFrame(n),this.adjustCartForHeader()})}observeTPContent(){if($(".worry-free-booking .collapsible-content").length!=0){const n=new MutationObserver(()=>{this.adjustBottomOfCartForTPChange()});n.observe($(".worry-free-booking .collapsible-content")[0],{attributes:!0,attributeFilter:["style"],attributeOldValue:!0});this.tpObserver=n}}}DEFAULT_RN_HEADER_HEIGHT=70;Header={MenuItems:[],OverflowItems:[],Initialize:function(){$("header .menu-items").children("a").each(function(){Header.MenuItems.push({width:this.getBoundingClientRect().width,$elem:$(this)})});$(window).on("resize",Header.CheckForResize);IS_DESKTOP&&Header.CheckForResize()},GetWidths:function(n){let t=0;for(let i=0;i<n.length;i++)t+=n[i].width;return t},CheckForResize:function(){if(IS_DESKTOP){let n=document.querySelector("header div.menu-items");if(n){n.style.overflow="hidden";let t=Math.ceil(n.getBoundingClientRect().width),i=n.scrollWidth>t;if(i)for(n.classList.add("overflow-visible");n.scrollWidth-2>t;){let n=Header.MenuItems.pop();n.$elem.remove();$("header .menu-items .overflow-items .spacer").after(n.$elem);Header.OverflowItems.splice(0,0,n)}else for(;;)if(Header.OverflowItems.length>0){let n=Header.GetWidths(Header.MenuItems);if(Header.OverflowItems.length>1&&(n+=$("header .menu-items .menu-overflow").width()),n+Header.OverflowItems[0].width<=t-80){let n=Header.OverflowItems.shift();Header.MenuItems.push(n);n.$elem.remove();Header.MenuItems[Header.MenuItems.length-2].$elem.after(n.$elem)}else break}else{n.classList.remove("overflow-visible");break}n.style.overflow=null}}},AdjustForRNWHeader:function(){let n=$(".rn-website-header, .custom-header");if(n&&n.length>0){let n=DEFAULT_RN_HEADER_HEIGHT;IS_DESKTOP?($("header").hide(),$(".rn-website-header, .custom-header").show(),n=0):($(".rn-website-header, .custom-header").hide(),$("header").show());document.documentElement.style.setProperty("--header-height",n+"px")}}};class LabeledRangeInput{constructor(n,t){this.$container=$('<div class="length-input-container"><div class="length-input-label"><input type="text" class="length-label-input" /><span class="unit">'+(t||"")+'<\/span><div class="arrow"><\/div><\/div><\/div>');this.min=n.attr("min");this.max=n.attr("max");this.value=n.val();this.onChange=[];n.before(this.$container);n.appendTo(this.$container);this.Initialize()}change(n){this.onChange.push(n)}get percent(){return(this.value-this.min)/(this.max-this.min)*100}Initialize(){let n=this;this.$container.find("input[type=range]").on("change mousemove touchmove",function(){let f=$(this).val();$(".length-label-input").val(f);n.value=f;let i=n.$container.find(".length-input-label").outerWidth(),e=n.$container.outerWidth(),r=e-i,u=0,o=n.percent/100*e,s=(n.percent-50)/50*7,h=i/2+s,t=o-h;if(t>r){let u=t-r;u=Math.min(u,i/2-10);n.$container.find(".length-input-label .arrow").css("transform","translateX("+u+"px) rotate(45deg)");t=r}else if(t<u){let r=t-u;r=Math.max(r,i/-2+10);n.$container.find(".length-input-label .arrow").css("transform","translateX("+r+"px) rotate(45deg)");t=u}else n.$container.find(".length-input-label .arrow").css("transform","rotate(45deg) translateX(0px)");n.$container.find(".length-input-label").css("left",t);for(let t=0;t<n.onChange.length;t++)n.onChange[t](n.value)}).trigger("change");this.$container.find(".length-label-input").on("keyup",function(n){if(n.key=="Enter")$(this).trigger("blur");else{let n=$(this).val(),t=new RegExp(/^\d+\.?\d*$/);n.length>0&&!t.test(n)&&$(this).val(n.substr(0,n.length-1));$(".length-input-container input[type=range]").val($(this).val())}});this.$container.find(".length-label-input").on("blur",function(){$(".length-input-container input[type=range]").val($(this).val()).trigger("change")})}}