/*! For license information please see detail-controllers.min.js.LICENSE.txt */
(()=>{var e={5515:(e,t,n)=>{"use strict";n.d(t,{Z:()=>c});n(4697);function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e,t,n){return(t=s(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,s(r.key),r)}}function s(e){var t=function(e,t){if("object"!==r(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t||"default");if("object"!==r(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===r(t)?t:String(t)}var c=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.analytics=window.__pt.fn.analytics,this.settings=window.__pt.settings,this.events=window.__pt.fn.analytics.events,this.pages=window.__pt.fn.analytics.pages,this.fn=window.__pt.fn||{}}var t,n,r;return t=e,n=[{key:"metricBookerHotel",value:function(e,t){var n=t.data,r=t.vmData,o=t.element,i={PT:{event:this.events.trackEvent,eventName:this.events.search,checkIn:n.checkin,checkOut:n.checkout,placeId_destination:n.placeId,rooms:n.rooms,nights:this.countNight(n.checkin,n.checkout),adults:n.adults,layer:this.settings.page,children:n.infants+n.kids,place_name_destination:r.place_name,search_type:"hotel"},TB:{event:"ga4.".concat(this.events.trackEvent),eventName:this.events.search,eventParams:{action:this.events.click,search_term:r.place_name,element:o,search_type:this.events.hotel,field_destination:n.placeId,field_date1:n.checkin,field_date2:n.checkout,field_rooms:n.rooms,field_total_nights:this.countNight(n.checkin,n.checkout),travelers_adults:n.adults,travelers_children:n.infants+n.kids,content_type:this.events.button,page_type:this.pages[this.settings.page],layer:this.events.hotels}},US:{event:"ga4.".concat(this.events.trackEvent),eventName:this.events.search,eventParams:{action:this.events.click,search_term:r.place_name,element:o,search_type:this.events.hotel,field_destination:n.placeId,field_date1:n.checkin,field_date2:n.checkout,field_rooms:n.rooms,field_total_nights:this.countNight(n.checkin,n.checkout),travelers_adults:n.adults,travelers_children:n.infants+n.kids,content_type:this.events.button,page_type:this.pages[this.settings.page],layer:this.events.hotels}}}[this.settings.site.metricsSuffix];this.analytics.set(i.event,i)}},{key:"metricBookerFlight",value:function(e,t){var n=t.data,r=t.vmData,o={event:this.events.trackEvent,eventName:this.events.search,checkIn:n.startingFromDateTime,checkOut:n.returningFromDateTime,placeId_destination:r.place_selected_to.id,rooms:1,typeFlight:1==n.mode?"redondo":0==n.mode?"sencillo":"",nameOrigin:r.place_selected.displayText,nights:this.countNight(n.startingFromDateTime,n.returningFromDateTime),adults:n.adults,layer:this.settings.page,children:n.kids,place_name_destination:r.place_selected_to.displayText,search_type:"vuelo"};this.analytics.set(o.event,o)}},{key:"metricModifiedSearchRecomendation",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"recomendacion",t={event:this.events.trackEvent,eventName:this.events.selectContent,content_type:this.events.button,element:"".concat(e,"::modificar_busqueda"),layer:this.events.hotels,page_type:this.settings.page};this.analytics.set(this.events.trackEvent,t)}},{key:"metricBookerPackage",value:function(e,t){var n=t.data,r=t.vmData,o={event:this.events.trackEvent,eventName:this.events.search,field_date1:n.CheckIn,field_date2:n.CheckOut,field_destination:r.place_selected_to.placeId,field_rooms:n.rooms,field_total_nights:this.countNight(n.CheckIn,n.CheckOut),layer:this.settings.page,search_term:r.place_name,search_type:"hotel+vuelo",travelers_adults:n.adults,travelers_children:n.infants+n.kids};this.analytics.set(o.event,o)}},{key:"metricRecentSearch",value:function(e){var t={event:this.events.trackEvent,eventName:this.events.selectContent,layer:this.settings.page,content_type:this.events.link,element:"booker_recent_search:: ".concat(e),page_type:this.settings.page};this.analytics.set(t.event,t)}},{key:"availabilityCalendar",value:function(e){for(var t=e.length,n=0;n<t;n++){var r=e[n],o={event:this.events.gtmEvent,eventName:this.events.gtmEvent,eventCategory:"calendar no dispo",eventAction:r.action,eventLabel:r.label};this.analytics.set(o.event,o)}}},{key:"countNight",value:function(e,t){var n=this.fn.getDate(e),r=this.fn.getDate(t);return this.fn.diffBetweenDays(n,r)}},{key:"metricDatesRecommended",value:function(e,t){var n=t.data,r=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){i(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({},{event:this.events.trackEvent,eventName:e,hotelId:n.hotelId,checkIn:n.checkIn,checkOut:n.checkOut,nights:this.countNight(n.checkin,n.checkout),adults:n.adults,children:n.children,layer:this.settings.page,search_type:"hotel"});this.analytics.set(r.event,r)}}],n&&a(t.prototype,n),r&&a(t,r),Object.defineProperty(t,"prototype",{writable:!1}),e}()},4697:(e,t,n)=>{"use strict";function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}function o(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,(i=o.key,a=void 0,a=function(e,t){if("object"!==r(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t||"default");if("object"!==r(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(i,"string"),"symbol"===r(a)?a:String(a)),o)}var i,a}function i(e,t,n){return t&&o(e.prototype,t),n&&o(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}new(i((function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),window.__pt.fn=window.__pt.fn||{},window.__pt.fn.analytics=window.__pt.fn.analytics||{},window.__pt.fn.analytics.events={gtmEvent:"gtmEvent",trackEvent:"trackEvent",viewSearchResults:"view_search_results",gtmEventAB:"ABTesting",hotel:"Hotel",hotels:"hoteles",ads:"ad",list:"list",impressionView:"event-impression-view",impressionClick:"event-impression-click",hotelList:"Hotel List",selectContent:"select_content",link:"enlace",button:"boton",search:"search",hotelFilter:"hotel_filter",filter:"filtro",viewItemList:"view_item_list",viewPromotion:"view_promotion",selectPromotion:"select_promotion",user_interaction:"user_interaction",selectItem:"select_item",productDetail:"event-product-detail",addToCart:"event-add-to-cart",pageView:"Pageview",typeHotel:"hotel :: detalle",paymentFunnel:"Hotels Payment Funnel",hotelError:"Hotels Error",errorQuote:"error_quote",beginCheckout:"begin_checkout",click:"click",mapOpen:"map_open",hotelistMap:"hotelist_map",home:"home",nameHotel:"Nombre hotel"},window.__pt.fn.analytics.pages={home:"home",hotels:"listado",hotel:"detalle"},window.__pt.fn.analytics.set=function(e,t){window.dataLayer&&window.dataLayer.push(t)},window.__pt.fn.analytics.gtagSet=function(e,t){window.gtag&&window.gtag("event",e,t)}})))},4943:(e,t,n)=>{"use strict";n.d(t,{Tc:()=>i,UK:()=>c,Uo:()=>s,bs:()=>a});var r=null,o={checkin:null,checkout:null};function i(e){r=e}function a(e,t){r&&(r.setDateRange(e,t),o.checkin=e,o.checkout=t)}function s(){return o}function c(){o.checkin=null,o.checkout=null}},291:(e,t,n)=>{"use strict";n.d(t,{D:()=>l});var r=n(5515),o=n(7066);function i(e){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i(e)}function a(){a=function(){return e};var e={},t=Object.prototype,n=t.hasOwnProperty,r=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},s=o.iterator||"@@iterator",c=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function u(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,n){return e[t]=n}}function d(e,t,n,o){var i=t&&t.prototype instanceof f?t:f,a=Object.create(i.prototype),s=new T(o||[]);return r(a,"_invoke",{value:E(e,n,s)}),a}function h(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=d;var p={};function f(){}function m(){}function v(){}var g={};u(g,s,(function(){return this}));var y=Object.getPrototypeOf,w=y&&y(y(C([])));w&&w!==t&&n.call(w,s)&&(g=w);var b=v.prototype=f.prototype=Object.create(g);function k(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function _(e,t){function o(r,a,s,c){var l=h(e[r],e,a);if("throw"!==l.type){var u=l.arg,d=u.value;return d&&"object"==i(d)&&n.call(d,"__await")?t.resolve(d.__await).then((function(e){o("next",e,s,c)}),(function(e){o("throw",e,s,c)})):t.resolve(d).then((function(e){u.value=e,s(u)}),(function(e){return o("throw",e,s,c)}))}c(l.arg)}var a;r(this,"_invoke",{value:function(e,n){function r(){return new t((function(t,r){o(e,n,t,r)}))}return a=a?a.then(r,r):r()}})}function E(e,t,n){var r="suspendedStart";return function(o,i){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===o)throw i;return x()}for(n.method=o,n.arg=i;;){var a=n.delegate;if(a){var s=I(a,n);if(s){if(s===p)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var c=h(e,t,n);if("normal"===c.type){if(r=n.done?"completed":"suspendedYield",c.arg===p)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(r="completed",n.method="throw",n.arg=c.arg)}}}function I(e,t){var n=t.method,r=e.iterator[n];if(void 0===r)return t.delegate=null,"throw"===n&&e.iterator.return&&(t.method="return",t.arg=void 0,I(e,t),"throw"===t.method)||"return"!==n&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+n+"' method")),p;var o=h(r,e.iterator,t.arg);if("throw"===o.type)return t.method="throw",t.arg=o.arg,t.delegate=null,p;var i=o.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,p):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,p)}function P(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function S(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function T(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(P,this),this.reset(!0)}function C(e){if(e){var t=e[s];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,o=function t(){for(;++r<e.length;)if(n.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t};return o.next=o}}return{next:x}}function x(){return{value:void 0,done:!0}}return m.prototype=v,r(b,"constructor",{value:v,configurable:!0}),r(v,"constructor",{value:m,configurable:!0}),m.displayName=u(v,l,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===m||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,v):(e.__proto__=v,u(e,l,"GeneratorFunction")),e.prototype=Object.create(b),e},e.awrap=function(e){return{__await:e}},k(_.prototype),u(_.prototype,c,(function(){return this})),e.AsyncIterator=_,e.async=function(t,n,r,o,i){void 0===i&&(i=Promise);var a=new _(d(t,n,r,o),i);return e.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},k(b),u(b,l,"Generator"),u(b,s,(function(){return this})),u(b,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},e.values=C,T.prototype={constructor:T,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(S),!e)for(var t in this)"t"===t.charAt(0)&&n.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(n,r){return a.type="throw",a.arg=e,t.next=n,r&&(t.method="next",t.arg=void 0),!!r}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return r("end");if(i.tryLoc<=this.prev){var s=n.call(i,"catchLoc"),c=n.call(i,"finallyLoc");if(s&&c){if(this.prev<i.catchLoc)return r(i.catchLoc,!0);if(this.prev<i.finallyLoc)return r(i.finallyLoc)}else if(s){if(this.prev<i.catchLoc)return r(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return r(i.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=t,i?(this.method="next",this.next=i.finallyLoc,p):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),p},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),S(n),p}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;S(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:C(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),p}},e}function s(e,t,n,r,o,i,a){try{var s=e[i](a),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,o)}function c(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,(o=r.key,a=void 0,a=function(e,t){if("object"!==i(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==i(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(o,"string"),"symbol"===i(a)?a:String(a)),r)}var o,a}var l=new(function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.config=window.__pt.settings.site,this.params=window.__pt.box,this.fn=window.__pt.fn,this.language=window.__pt.ln,this.memory={},this.mainElement=null,this.eventHandler=new r.Z}var t,n,i,l,u;return t=e,n=[{key:"getAvailability",value:(l=a().mark((function e(t,n,r){var i,s,c,l,u;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=this.getParams(t,n,r),s=this.fn.objectToQueryParams(i),c="".concat(t,"_").concat(n,"_").concat(r),this.memory[c]){e.next=9;break}return l=(0,o.w)(),e.next=7,fetch("".concat(this.config.endPoints.calendarAvailabilityUrl,"?").concat(s),{method:"GET",headers:l}).then((function(e){return e.json()})).catch((function(e){return console.log("error quote availability:",e.message)}));case 7:(u=e.sent)&&(this.memory[c]=u,this.eventHandler.availabilityCalendar(u.events||[]));case 9:return e.abrupt("return",this.memory[c]);case 10:case"end":return e.stop()}}),e,this)})),u=function(){var e=this,t=arguments;return new Promise((function(n,r){var o=l.apply(e,t);function i(e){s(o,n,r,i,a,"next",e)}function a(e){s(o,n,r,i,a,"throw",e)}i(void 0)}))},function(e,t,n){return u.apply(this,arguments)})},{key:"build",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(t&&t.daysByDate){var n=t.daysByDate||{};for(var r in n){var o=n[r],i=e[o.checkinFormat];this.buildElement(i,o)}this.footerBuild()}}},{key:"buildElement",value:function(e,t){if(e){var n=e.target.querySelector(".day-price")||document.createElement("span");n.className=t.available?"day-price available":"day-price unavailable",n.innerHTML=t.available?"".concat(t.avgPrice):"  ",e.target.append(n),t.color&&t.color.length&&e.target.classList.add(t.color)}}},{key:"setFooterElement",value:function(e){this.mainElement=e}},{key:"footerBuild",value:function(){if(this.mainElement&&Object.keys(this.memory).length){var e=this.mainElement.querySelector(".footer-price")||document.createElement("span");e.className="footer-price",e.innerHTML=this.language.price_calendar_footer.replace("{currency}",this.config.currency),this.mainElement.append(e)}}},{key:"getMemoryDate",value:function(e,t,n){if(n)return e="".concat(n,"_").concat(e),this.memory[e]?this.memory[e].daysByDate[t]:null}},{key:"overFlow",value:function(){if(this.config.mobile){document.body.classList.toggle("modal-open");var e=document.querySelector(".modal-backdrop.fade.show.modal-backdrop-custom");e?e.remove():((e=document.createElement("div")).className="modal-backdrop fade show modal-backdrop-custom",document.body.append(e))}}},{key:"setCalendarPriceContainer",value:function(){this.mainElement&&this.mainElement.parentElement.classList.add("container-price")}},{key:"removeCalendarPriceContainer",value:function(){this.mainElement&&this.mainElement.parentElement.classList.remove("container-price")}},{key:"getParams",value:function(e,t,n){return{site:this.config.domain.replace("https://",""),mobile:this.config.mobile,hotelId:e,year:t,month:n,type:"json"}}}],n&&c(t.prototype,n),i&&c(t,i),Object.defineProperty(t,"prototype",{writable:!1}),e}())},694:(e,t,n)=>{"use strict";function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}function o(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,(i=o.key,a=void 0,a=function(e,t){if("object"!==r(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t||"default");if("object"!==r(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(i,"string"),"symbol"===r(a)?a:String(a)),o)}var i,a}n.d(t,{Z:()=>i});var i=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.paramQuery=t,this.config=n}var t,n,r;return t=e,(n=[{key:"getIsArray",value:function(e){return Array.isArray(e)}},{key:"getFirstPathSegment",value:function(){return window.location.pathname.split("/")[1]}},{key:"convertPaxesData",value:function(e){var t=e.reduce((function(e,t){return e.adults+=t.adults||0,e.children=e.children.concat(t.children||[]),e}),{adults:0,children:[]});return t.rooms=e.length,t}},{key:"getUserKey",value:function(e){var t=window.__pt.fn,n="anonimo-".concat(t.generateUUID()),r=t.getCookie("__ca__chat")||n,o=e.get("userKey");return!o||o||o.includes("anonimo")?r?(o&&o.includes("anonimo")||e.set("userKey",r),r):(setTimeout((function(){var r=t.getCookie("__ca__chat")||n;e.set("userKey",r)}),2e3),""):o}},{key:"getUserKeyFavorites",value:function(e){var t=window.__pt.fn,n=window.__pt.user||null,r="anonimo-".concat(t.generateUUID()),o=n&&n.firebaseId?n.firebaseId:t.getCookie("session_id")||r,i=e.get("userKey_fav");return i&&i===o?i:o?(e.set("userKey_fav",o),o):(setTimeout((function(){var o=n&&n.firebaseId?n.firebaseId:t.getCookie("session_id")||r;e.set("userKey_fav",o)}),2e3),"")}},{key:"getPaxes",value:function(e){for(var t=e.pax&&e.pax.length,n={adults:0,children:0,paxesFormat:[]},r=0;e.pax&&r<t;r++){var o=e.pax[r],i="";n.adults+=o.adults,i+="".concat(o.adults,"/"),o.children&&o.children.length?(n.children+=o.children.length,i+="".concat(o.children.map((function(e){return e.year})).join(","))):i+="n",n.paxesFormat.push(i)}return n}},{key:"getPaxesFavorites",value:function(e){for(var t=e&&e.length,n={adults:0,children:0,paxesFormat:[]},r=0;e&&r<t;r++){var o=e[r],i="";n.adults+=o.adults,i+="".concat(o.adults,"/"),o.children&&o.children.length?(n.children+=o.children.length,i+="".concat(o.children.map((function(e){return e.year})).join(","))):i+="n",n.paxesFormat.push(i)}return n}},{key:"getPaxesRates",value:function(e){for(var t=e.pax&&e.pax.length,n={adults:0,children:0,paxesFormat:[]},r=0;e.pax&&r<t;r++){var o=e.pax[r],i="";n.adults+=o.adults,i+="".concat(o.adults),o.children&&o.children.length&&(n.children+=o.children.length,i+="|".concat(o.children.map((function(e){return e.year})).join(","))),n.paxesFormat.push(i)}return n}},{key:"getPaxToMessages",value:function(e){return e.pax.map((function(e){return"".concat(e.adults).concat(e.children.length>0?"_":"").concat(e.children.map((function(e){return e.year})).join("_"))}))}},{key:"getAgeKids",value:function(e){return e.pax[0].children.map((function(e){return e.year})).join(",")}},{key:"getShowPromotion",value:function(e){var t=!1,n=!1,r=this.config.promotionKeyShow;if(r){var o=e?r.find((function(t){return t.key==e.promotionType})):"";o&&(t=o.active,n=o.blackFAndHotS)}return{activeKey:t,HotSBlackFri:n}}},{key:"windowScrollTop",value:function(){window.scrollTo(0,0)}}])&&o(t.prototype,n),r&&o(t,r),Object.defineProperty(t,"prototype",{writable:!1}),e}()},2805:(e,t,n)=>{"use strict";n.d(t,{Z:()=>p});var r=n(7066);function o(e){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o(e)}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function a(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach((function(t){s(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function s(e,t,n){return(t=h(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function c(){c=function(){return e};var e={},t=Object.prototype,n=t.hasOwnProperty,r=Object.defineProperty||function(e,t,n){e[t]=n.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",l=i.toStringTag||"@@toStringTag";function u(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,n){return e[t]=n}}function d(e,t,n,o){var i=t&&t.prototype instanceof f?t:f,a=Object.create(i.prototype),s=new T(o||[]);return r(a,"_invoke",{value:E(e,n,s)}),a}function h(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=d;var p={};function f(){}function m(){}function v(){}var g={};u(g,a,(function(){return this}));var y=Object.getPrototypeOf,w=y&&y(y(C([])));w&&w!==t&&n.call(w,a)&&(g=w);var b=v.prototype=f.prototype=Object.create(g);function k(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function _(e,t){function i(r,a,s,c){var l=h(e[r],e,a);if("throw"!==l.type){var u=l.arg,d=u.value;return d&&"object"==o(d)&&n.call(d,"__await")?t.resolve(d.__await).then((function(e){i("next",e,s,c)}),(function(e){i("throw",e,s,c)})):t.resolve(d).then((function(e){u.value=e,s(u)}),(function(e){return i("throw",e,s,c)}))}c(l.arg)}var a;r(this,"_invoke",{value:function(e,n){function r(){return new t((function(t,r){i(e,n,t,r)}))}return a=a?a.then(r,r):r()}})}function E(e,t,n){var r="suspendedStart";return function(o,i){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===o)throw i;return x()}for(n.method=o,n.arg=i;;){var a=n.delegate;if(a){var s=I(a,n);if(s){if(s===p)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var c=h(e,t,n);if("normal"===c.type){if(r=n.done?"completed":"suspendedYield",c.arg===p)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(r="completed",n.method="throw",n.arg=c.arg)}}}function I(e,t){var n=t.method,r=e.iterator[n];if(void 0===r)return t.delegate=null,"throw"===n&&e.iterator.return&&(t.method="return",t.arg=void 0,I(e,t),"throw"===t.method)||"return"!==n&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+n+"' method")),p;var o=h(r,e.iterator,t.arg);if("throw"===o.type)return t.method="throw",t.arg=o.arg,t.delegate=null,p;var i=o.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,p):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,p)}function P(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function S(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function T(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(P,this),this.reset(!0)}function C(e){if(e){var t=e[a];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,o=function t(){for(;++r<e.length;)if(n.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t};return o.next=o}}return{next:x}}function x(){return{value:void 0,done:!0}}return m.prototype=v,r(b,"constructor",{value:v,configurable:!0}),r(v,"constructor",{value:m,configurable:!0}),m.displayName=u(v,l,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===m||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,v):(e.__proto__=v,u(e,l,"GeneratorFunction")),e.prototype=Object.create(b),e},e.awrap=function(e){return{__await:e}},k(_.prototype),u(_.prototype,s,(function(){return this})),e.AsyncIterator=_,e.async=function(t,n,r,o,i){void 0===i&&(i=Promise);var a=new _(d(t,n,r,o),i);return e.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},k(b),u(b,l,"Generator"),u(b,a,(function(){return this})),u(b,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},e.values=C,T.prototype={constructor:T,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(S),!e)for(var t in this)"t"===t.charAt(0)&&n.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(n,r){return a.type="throw",a.arg=e,t.next=n,r&&(t.method="next",t.arg=void 0),!!r}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return r("end");if(i.tryLoc<=this.prev){var s=n.call(i,"catchLoc"),c=n.call(i,"finallyLoc");if(s&&c){if(this.prev<i.catchLoc)return r(i.catchLoc,!0);if(this.prev<i.finallyLoc)return r(i.finallyLoc)}else if(s){if(this.prev<i.catchLoc)return r(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return r(i.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=t,i?(this.method="next",this.next=i.finallyLoc,p):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),p},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),S(n),p}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;S(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:C(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),p}},e}function l(e,t,n,r,o,i,a){try{var s=e[i](a),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,o)}function u(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var i=e.apply(t,n);function a(e){l(i,r,o,a,s,"next",e)}function s(e){l(i,r,o,a,s,"throw",e)}a(void 0)}))}}function d(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,h(r.key),r)}}function h(e){var t=function(e,t){if("object"!==o(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==o(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===o(t)?t:String(t)}const p=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.baseUrl=t}var t,n,o,i,s,l,h,p;return t=e,n=[{key:"addHotel",value:(p=u(c().mark((function e(t){var n;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,fetch("".concat(this.baseUrl,"/api/LowPriceNotifier/addhotel"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});case 2:return n=e.sent,e.abrupt("return",n.json());case 4:case"end":return e.stop()}}),e,this)}))),function(e){return p.apply(this,arguments)})},{key:"removeHotel",value:(h=u(c().mark((function e(t){var n,r;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=new URL("".concat(this.baseUrl,"/api/LowPriceNotifier/removehotel")),Object.keys(t).forEach((function(e){return n.searchParams.append(e,t[e])})),e.next=4,fetch(n,{method:"GET",headers:{"Content-Type":"application/json"}});case 4:return r=e.sent,e.abrupt("return",r.json());case 6:case"end":return e.stop()}}),e,this)}))),function(e){return h.apply(this,arguments)})},{key:"getHotelsByUser",value:(l=u(c().mark((function e(t){var n,r;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=new URL("".concat(this.baseUrl,"/api/LowPriceNotifier/gethotelsbyuser")),Object.keys(t).forEach((function(e){return n.searchParams.append(e,t[e])})),e.next=4,fetch(n,{method:"GET",headers:{"Content-Type":"application/json"}});case 4:return r=e.sent,e.abrupt("return",r.json());case 6:case"end":return e.stop()}}),e,this)}))),function(e){return l.apply(this,arguments)})},{key:"getHotelsByUserFacade",value:(s=u(c().mark((function e(t){var n,o;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=new URL("".concat(this.baseUrl,"/api/Favorites/get")),Object.keys(t).forEach((function(e){return n.searchParams.append(e,t[e])})),e.next=4,fetch(n,{method:"GET",headers:a({"Content-Type":"application/json"},(0,r.w)())});case 4:return o=e.sent,e.abrupt("return",o.json());case 6:case"end":return e.stop()}}),e,this)}))),function(e){return s.apply(this,arguments)})},{key:"copyByUser",value:(i=u(c().mark((function e(t){var n,r;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=new URL("".concat(this.baseUrl,"/api/LowPriceNotifier/copyByUser")),Object.keys(t).forEach((function(e){return n.searchParams.append(e,t[e])})),e.next=4,fetch(n,{method:"GET",headers:{"Content-Type":"application/json"}});case 4:return r=e.sent,e.abrupt("return",r.json());case 6:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})}],n&&d(t.prototype,n),o&&d(t,o),Object.defineProperty(t,"prototype",{writable:!1}),e}()},7066:(e,t,n)=>{"use strict";function r(){return{"x-Token":window.__pt.settings.site.token}}n.d(t,{w:()=>r})},4155:e=>{var t,n,r=e.exports={};function o(){throw new Error("setTimeout has not been defined")}function i(){throw new Error("clearTimeout has not been defined")}function a(e){if(t===setTimeout)return setTimeout(e,0);if((t===o||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(n){try{return t.call(null,e,0)}catch(n){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:o}catch(e){t=o}try{n="function"==typeof clearTimeout?clearTimeout:i}catch(e){n=i}}();var s,c=[],l=!1,u=-1;function d(){l&&s&&(l=!1,s.length?c=s.concat(c):u=-1,c.length&&h())}function h(){if(!l){var e=a(d);l=!0;for(var t=c.length;t;){for(s=c,c=[];++u<t;)s&&s[u].run();u=-1,t=c.length}s=null,l=!1,function(e){if(n===clearTimeout)return clearTimeout(e);if((n===i||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(e);try{n(e)}catch(t){try{return n.call(null,e)}catch(t){return n.call(this,e)}}}(e)}}function p(e,t){this.fun=e,this.array=t}function f(){}r.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];c.push(new p(e,t)),1!==c.length||l||a(h)},p.prototype.run=function(){this.fun.apply(null,this.array)},r.title="browser",r.browser=!0,r.env={},r.argv=[],r.version="",r.versions={},r.on=f,r.addListener=f,r.once=f,r.off=f,r.removeListener=f,r.removeAllListeners=f,r.emit=f,r.prependListener=f,r.prependOnceListener=f,r.listeners=function(e){return[]},r.binding=function(e){throw new Error("process.binding is not supported")},r.cwd=function(){return"/"},r.chdir=function(e){throw new Error("process.chdir is not supported")},r.umask=function(){return 0}}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var i=t[r]={exports:{}};return e[r](i,i.exports,n),i.exports}n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),window.directives=window.directives||["LocalStorageModule","ngSanitize","firebase"],window.app=angular.module("app",window.directives).directive("offClick",["$document","$parse","$timeout",function(e,t,n){return{restrict:"A",compile:function(r,o){var i=t(o.offClick);return function(t,r,o){function a(n){var o=$(n.target);r[0].contains(n.target)||o.hasClass("no-autoclose")?e.one("click touchend",a):t.$apply((function(){i(t)}))}t.$watch(o.offClickActivator,(function(t){t?n((function(){e.one("click touchend",a)})):e.off("click touchend",a)}))}}}}]).directive("lazyLoad",(function(){return{restrict:"A",link:function(e,t,n){var r=new IntersectionObserver((function(e){e.forEach((function(e){e.intersectionRatio>0&&(e.target.src=e.target.getAttribute("data-src"),r.unobserve(e.target))}))})),o=angular.element(t)[0];r.observe(o)}}})).directive("bnLazySrc",["$window","$document",function(e,t){var n=function(){var n=[],r=null,o=$(e),i=t,a=i.height(),s=null,c=!1;function l(){if(!r){var e=i.height();e!==a&&(a=e,h())}}function u(){for(var e=[],t=[],r=o.height(),i=o.scrollTop(),a=i+r,s=0;s<n.length;s++){var c=n[s];c.isVisible(i,a)?e.push(c):t.push(c)}for(s=0;s<e.length;s++)e[s].render();n=t,d(),n.length||p()}function d(){clearTimeout(r),r=null}function h(){r=setTimeout(u,100)}function p(){c=!1,o.off("resize.bnLazySrc"),o.off("scroll.bnLazySrc"),clearInterval(s)}function f(){r||h()}return{addImage:function(e){n.push(e),r||h(),c||(c=!0,o.on("resize.bnLazySrc",f),o.on("scroll.bnLazySrc",f),s=setInterval(l,2e3))},removeImage:function(e){for(var t=0;t<n.length;t++)if(n[t]===e){n.splice(t,1);break}n.length||(d(),p())}}}();function r(e){var t=null,n=!1,r=null;function i(){e[0].onerror=function(){o(e[0],!0)},e[0].src=t,window.__pt.renderLazyload&&window.__pt.renderLazyload(e[0])}return o(e[0]),{isVisible:function(t,n){if(!e.is(":visible"))return!1;null===r&&(r=e.height());var o=e.offset().top,i=o+r;return o<=n&&o>=t||i<=n&&i>=t||o<=t&&i>=n},render:function(){n=!0,i()},setSource:function(e){t=e,n&&i()}}}function o(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];("hotel-card-img"===e.classList[0]&&!e.src||t)&&(e.src=window.__pt.settings.site.cloudCdn+"/assets/img/placeholder_img_".concat(window.__pt.settings.site.country,".png"))}return{link:function(e,t,o){var i=new r(t);n.addImage(i),o.$observe("bnLazySrc",(function(e){i.setSource(e)})),e.$on("$destroy",(function(){n.removeImage(i)}))},restrict:"A"}}]),window.app.config(["$locationProvider",function(e){e.html5Mode({enabled:!0,requireBase:!1,rewriteLinks:!1})}]),window.app.config(["localStorageServiceProvider",function(e){e.setPrefix("pt")}]),window.app.filter("asDate",(function(){return function(e){return window.__pt.fn.getDate(e)}})),window.app.filter("roundToInt",(function(){return function(e){return Math.round(e)}})),window.app.filter("resizeString",(function(){return function(e,t,n){return e.length<=t?e:n?e.substring(0,t)+"...":e}})),window.app.directive("inViewport",(function(){return{scope:{fn:"&inViewport"},restrict:"A",link:function(e,t,n){var r=new IntersectionObserver((function(t){t.forEach((function(t){e.fn({event:{isVisible:t.isIntersecting,element:o}})}))})),o=angular.element(t)[0];r.observe(o)}}})),window.app.filter("getIconStars",(function(){return function(e){return"icon-".concat(Math.floor(e)).concat(e%1==0?"-":"-half-","star")}})),window.app.filter("getRatingDesc",(function(){return function(e){for(var t=2*e,n=__pt.ln.rating_reviews_range,r=0;r<n.length;r++)if(t>=n[r].range[0]&&t<=n[r].range[1])return n[r].display}})),window.app.filter("highlights",(function(){return function(e){return e.slice(0,3).map((function(e){return e.info})).join(" \n• ")}})),window.app.filter("getUrlDetail",(function(){return function(e){return window.__pt.settings.site.siteUrl+"/hotel/"+e+window.location.search}})),window.app.filter("paginationRange",(function(){return function(e,t){var n={from:e.currentPage*e.pageSize,to:(e.currentPage+1)*e.pageSize,of:e.totalHotels};return t.replace("(from)",n.from+1).replace("(to)",n.to>=n.of?n.of:n.to).replace("(total)",n.of)}})),window.app.filter("commanseparatecolo",[function(){return function(e){var t=e?e.toString().replace(".",","):null;if(t){var n=t.split(",");n.length>1&&1===n[1].length&&(t+="0")}return t}}]),window.app.filter("capitalize",(function(){return function(e){return e?e.charAt(0).toUpperCase()+e.slice(1).toLowerCase():""}})),window.app.filter("orderObjectByKey",(function(){return function(e,t){if(!e)return[];var n=[];return angular.forEach(e,(function(e,t){n.push({key:Number(t),value:e})})),n.sort((function(e,t){return e.key-t.key})),t&&n.reverse(),n}})),window.app.filter("tel",(function(){return function(e){if(!e)return"";var t,n,r,o=e.toString().trim().replace(/^\+/,"");if(o.match(/[^0-9]/))return e;switch(o.length){case 10:t=1,n=o.slice(0,2),r=o.slice(2);break;case 11:t=o[0],n=o.slice(1,4),r=o.slice(4);break;case 12:t=o.slice(0,3),n=o.slice(3,5),r=o.slice(5);break;default:return e}return 1==t&&(t=""),(t+" "+n+" "+(r=r.slice(0,4)+" "+r.slice(4))).trim()}})),window.app.filter("capacityString",(function(){return function(e){return window.__pt.ln.capacity.replace("{0}",e)+(e>0&&"s")}})),window.app.filter("capitalize",(function(){return function(e){return e.charAt(0).toUpperCase()+e.slice(1)}})),window.app.filter("kidsAgeRange",(function(){return function(e){return window.__pt.ln.kidsFreeTo.replace("{0}",e)}})),window.app.filter("setSizeParams",(function(){return function(e){var t=window.__pt.settings.screenSizes,n=window.__pt.fn.mediaQueries(t),r=n.mediaQueryDesktop,o=n.mediaQueryTablet,i=n.mediaQuerySmall,a=n.mediaQueryMobile;return r().matches?"?tx=w_552,h_368":o().matches||i().matches?"?tx=w_464,h_309":(a().matches,"?tx=w_390")}})),window.app.filter("separateHistory",(function(){return function(e){var t=e.split(" - ");return 2===t.length?"\n                <span><b>".concat(t[0],"</b></span>\n                <div><small>").concat(t[1],"</small></div>\n            "):e}})),window.app.filter("singularize",(function(){return function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;return t>1?e:e.substring(0,e.length-n)}})),window.app.filter("andmsi",(function(){return function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0;if(!e.length)return"";var r=e[0]+" msi*";return e.length>1&&(r=e.slice(0,e.length-1).join(", ")+" ".concat(t," ")+e.slice(-1)[0]+" "+n),r}})),window.app.filter("removeSpaces",[function(){return function(e){return angular.isString(e)?e.replace(/[\s]/g,""):e}}]),window.app.filter("cityScpecialChar",[function(){return function(e){var t={Bogota:"Bogot�"};return t[e]?t[e]:e}}]),window.app.filter("pluralize",[function(){return function(e,t,n){return t>1?e+n:e}}]),window.app.filter("orderByMaxItem",[function(){return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return e.sort((function(e,n){var r=function(e){return Math.max.apply(null,e)};return r(e[t])<r(n[t])?1:r(e[t])>r(n[t])?-1:0}))}}]),window.app.filter("replace",(function(){return function(e,t,n){return e.replace(t,n)}})),window.app.filter("filter_titles",[function(){return function(e){var t=window.__pt.ln.overriteTitles;return t[e.replaceAll(" ","")]?t[e]:e}}]),(()=>{"use strict";var e=n(5515),t=n(291),r=n(694);function o(e){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o(e)}function i(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=s(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,c=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){c=!0,i=e},f:function(){try{a||null==n.return||n.return()}finally{if(c)throw i}}}}function a(e){return function(e){if(Array.isArray(e))return e}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||s(e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function s(e,t){if(e){if("string"==typeof e)return c(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?c(e,t):void 0}}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function l(){l=function(){return e};var e={},t=Object.prototype,n=t.hasOwnProperty,r=Object.defineProperty||function(e,t,n){e[t]=n.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",c=i.toStringTag||"@@toStringTag";function u(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,n){return e[t]=n}}function d(e,t,n,o){var i=t&&t.prototype instanceof f?t:f,a=Object.create(i.prototype),s=new T(o||[]);return r(a,"_invoke",{value:E(e,n,s)}),a}function h(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=d;var p={};function f(){}function m(){}function v(){}var g={};u(g,a,(function(){return this}));var y=Object.getPrototypeOf,w=y&&y(y(C([])));w&&w!==t&&n.call(w,a)&&(g=w);var b=v.prototype=f.prototype=Object.create(g);function k(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function _(e,t){function i(r,a,s,c){var l=h(e[r],e,a);if("throw"!==l.type){var u=l.arg,d=u.value;return d&&"object"==o(d)&&n.call(d,"__await")?t.resolve(d.__await).then((function(e){i("next",e,s,c)}),(function(e){i("throw",e,s,c)})):t.resolve(d).then((function(e){u.value=e,s(u)}),(function(e){return i("throw",e,s,c)}))}c(l.arg)}var a;r(this,"_invoke",{value:function(e,n){function r(){return new t((function(t,r){i(e,n,t,r)}))}return a=a?a.then(r,r):r()}})}function E(e,t,n){var r="suspendedStart";return function(o,i){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===o)throw i;return x()}for(n.method=o,n.arg=i;;){var a=n.delegate;if(a){var s=I(a,n);if(s){if(s===p)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var c=h(e,t,n);if("normal"===c.type){if(r=n.done?"completed":"suspendedYield",c.arg===p)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(r="completed",n.method="throw",n.arg=c.arg)}}}function I(e,t){var n=t.method,r=e.iterator[n];if(void 0===r)return t.delegate=null,"throw"===n&&e.iterator.return&&(t.method="return",t.arg=void 0,I(e,t),"throw"===t.method)||"return"!==n&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+n+"' method")),p;var o=h(r,e.iterator,t.arg);if("throw"===o.type)return t.method="throw",t.arg=o.arg,t.delegate=null,p;var i=o.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,p):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,p)}function P(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function S(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function T(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(P,this),this.reset(!0)}function C(e){if(e){var t=e[a];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,o=function t(){for(;++r<e.length;)if(n.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t};return o.next=o}}return{next:x}}function x(){return{value:void 0,done:!0}}return m.prototype=v,r(b,"constructor",{value:v,configurable:!0}),r(v,"constructor",{value:m,configurable:!0}),m.displayName=u(v,c,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===m||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,v):(e.__proto__=v,u(e,c,"GeneratorFunction")),e.prototype=Object.create(b),e},e.awrap=function(e){return{__await:e}},k(_.prototype),u(_.prototype,s,(function(){return this})),e.AsyncIterator=_,e.async=function(t,n,r,o,i){void 0===i&&(i=Promise);var a=new _(d(t,n,r,o),i);return e.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},k(b),u(b,c,"Generator"),u(b,a,(function(){return this})),u(b,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},e.values=C,T.prototype={constructor:T,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(S),!e)for(var t in this)"t"===t.charAt(0)&&n.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(n,r){return a.type="throw",a.arg=e,t.next=n,r&&(t.method="next",t.arg=void 0),!!r}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return r("end");if(i.tryLoc<=this.prev){var s=n.call(i,"catchLoc"),c=n.call(i,"finallyLoc");if(s&&c){if(this.prev<i.catchLoc)return r(i.catchLoc,!0);if(this.prev<i.finallyLoc)return r(i.finallyLoc)}else if(s){if(this.prev<i.catchLoc)return r(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return r(i.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=t,i?(this.method="next",this.next=i.finallyLoc,p):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),p},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),S(n),p}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;S(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:C(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),p}},e}function u(e,t,n,r,o,i,a){try{var s=e[i](a),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,o)}function d(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var i=e.apply(t,n);function a(e){u(i,r,o,a,s,"next",e)}function s(e){u(i,r,o,a,s,"throw",e)}a(void 0)}))}}function h(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function p(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?h(Object(n),!0).forEach((function(t){f(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):h(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function f(e,t,n){return(t=function(e){var t=function(e,t){if("object"!==o(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==o(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===o(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function m(n,s,c,u,h,f,m){var v=this,g={},y=window.__pt.settings.site,w=window.__pt.settings,b=window.__pt.ln,k=window.__pt.fn,_=k.getDate(),E=window.__pt.place||{},I="",P="",S={},T=null,C=new e.Z,x=window.__pt.box||null,D=w.bookerHistorySize,R={format:w.formatBoxDate,formatMobile:w.formatBoxDateMobile,firstDay:0,applyLabel:b.ok,cancelLabel:b.cancel},O={},A={};window.__pt.user;v.submit=!1,v.years=[],v.suggestion={from:{results:[],show:!1},paxes:!1},v.hasResult=!1,v.validation={paxes:!0,checkIn:!0,checkOut:!0,dates:!0},v.siteUrl=window.__pt.settings.site.siteUrl,v.algoliaUrl="TB"!=window.__pt.settings.site.metricsSuffix?"https://pricetravel.com/assets/recent-search-imgs/places/":"https://www.tiquetesbaratos.com/assets/recent-search-imgs/places/",v.settingPaxes={minAdults:1,maxAdults:8,minChildren:0,maxChildren:6,minAge:0,maxAge:17,rooms:8};var L=new r.Z,N=L.getUserKey(h),M={weeksPrequote:0,daysPrequote:0,startDate:0};function j(e){var t=e.data||[];t.length>0&&t.forEach((function(e){var t=a(11==e.type?e.displayHtml.split("-").map((function(e){return e.trim()})):e.displayHtml.split(",").map((function(e){return e.trim()}))),n=t[0],r=t.slice(1);e.city=11==e.type?"".concat(r.join(", ").replace(" "+e.code+" ","")," (").concat(e.code,")"):n,e.location=11===e.type?n.replace(e.code+" ",""):r.join(", ")})),v.suggestion[I].results=t,v.suggestion[I].show=!0,v.placeInputHasFocus=!0,k.mobileAndTabletCheck()&&K("".concat(P,"_modal"))}function U(e){console.log(e)}function B(){var e={analyticsTags:X(),from:0,language:y.language,placeTypes:0,site:y.code,size:5,usersearch:N,recommendation:!0};s.get(y.endPoints.suggestionHotelUrl,{params:e}).then(j,U)}function F(){k.mobileAndTabletCheck()?(M.weeksPrequote=y.configDaysPrequoteMobile.weeksPrequote,M.daysPrequote=y.configDaysPrequoteMobile.daysPrequote,M.startDate=y.configDaysPrequoteMobile.startDate):(M.weeksPrequote=y.configDaysPrequoteDesktop.weeksPrequote,M.daysPrequote=y.configDaysPrequoteDesktop.daysPrequote,M.startDate=y.configDaysPrequoteDesktop.startDate);var e=new Date(_);e.setDate(e.getDate()+7*M.weeksPrequote),e.setDate(e.getDate()-e.getDay()+M.startDate),v.data.checkIn=H(e),v.data.checkOut=H(e,M.daysPrequote)}function H(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:k.getDate(),t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=k.getDate(k.formatDate(e,w.formatDate));return n.setDate(n.getDate()+t),n}function V(){var e=0,t=0;if(L.getIsArray(v.data.paxes)){var n,r=i(v.data.paxes);try{for(r.s();!(n=r.n()).done;){var a=n.value;e+=a.adults||0,t+=a.children?a.children.length:0}}catch(e){r.e(e)}finally{r.f()}}else"object"===o(v.data.paxes)&&(e=v.data.paxes.adults||0,t=v.data.paxes.children?v.data.paxes.children.length:0);var s=L.getIsArray(v.data.paxes)?v.data.paxes.length:v.data.paxes.rooms,c=1===s?b.room:b.rooms,l=1===e?b.adult:b.adults,u=1===t?b.child:b.children,d="";t>0&&(d=" ".concat(t," ").concat(u,", ")),v.data.paxes_name="".concat(e," ").concat(l,",").concat(d," ").concat(s," ").concat(c),v.data.paxes_people="".concat(e+t," ").concat(b.new_pers," ").concat(s," ").concat(b.new_room),v.data.capacityTotal=e+t}function W(e){var t=y.pathHome;switch(e){case 6:case 3:case 11:case 7:case 12:t=y.pathHoteles;break;case 14:t=y.pathHotelDetail}return t}function q(e){var t={},n=e.adults,r=0,o=0,a=[];if(t.group_adults=n,t.no_rooms=e.rooms,e.children&&e.children.length>0){r=e.children.length,t.group_children=r;var s,c=i(e.children);try{for(c.s();!(s=c.n()).done;){var l=s.value;a.push(l.year),l.year>5?r+=1:o+=1}}catch(e){c.e(e)}finally{c.f()}}return a.length>0&&(t.age=a.join(",")),o>0&&(t.infant=o),t}function G(e,t){for(var n=!0,r=(e.rooms,e.children.length),o=0;o<r;o++){if(t["children_".concat(o)].$invalid){n=!1;break}}return n}function z(e,t){var n=!0;return e.setHours(0,0,0,0),+e>+t&&(n=!1),n}function K(e){setTimeout((function(){var t=e&&document.getElementById(e);t&&t.focus()}),200)}function Y(e){"paxes"==e&&(v.validation.paxes=G(v.data.paxes,v.form))}function J(){if(v.data&&v.data.paxes){var e=v.data.paxes;if(e&&e.children&&e.children.length>0&&e.children.some((function(e){return null===e.year||void 0===e.year})))return!0}return!1}function Q(e){try{var t=h.get(w.historyStorageParam),n=[];if(t&&(n=t).some((function(t){return t.place_selected.id.toString()===e.place_selected.id.toString()})))return;n.length>=D&&(n=n.splice(0,D-1)),n.unshift(e),h.set(w.historyStorageParam,n)}catch(e){}}function Z(e,t){g.setDataArgolia(e,t)}function X(){var e=[];k.mobileAndTabletCheck()?e.push("web_mobile"):e.push("web_desktop");var t=L.getFirstPathSegment();return"hotel"==t?e.push("detail"):"hoteles"!=t&&"hotels"!=t||"home"!=w.page?"hoteles"!=t&&"hotels"!=t||"hotels"!=w.page?"landings"==w.page?e.push("landings"):e.push("home"):(e.push("list"),e.push(window.location.pathname.split("/")[2])):e.push("home"),e.join(",")}function ee(){T.setDateRange(v.data.checkIn,v.data.checkOut),V(),f.url(f.path());var e=k.search(),t=q(v.data.paxes),n=e.campaignTokenApi||e.CampaignTokenApi||e.campaigntokenapi||null,r=e.CampaignToken||e.campaignToken||n,o={placeId:v.data.place_selected.id,placeType:v.data.place_selected.type,adults:v.data.paxes.adults,checkin:k.formatDate(v.data.checkIn,w.formatDate),checkout:k.formatDate(v.data.checkOut,w.formatDate),campaignToken:r||null};for(var i in o=o=p(p({},o),t))o[i]&&f.search(i,o[i])}function te(e){window.innerWidth<=479?"auto"==e?document.body.classList.remove("modal-open"):"hidden"==e&&document.body.classList.add("modal-open"):document.body.classList.remove("modal-open")}v.data=w.defaultHotel,v.display=!0,v.keyPosition=0,v.placeInputHasFocus=!1,v.history=[],v.dataCopyCancel=w.defaultHotel,m.$on(w.bookerValuesEvent,(function(e,t){t&&t.pax?(v.data.checkIn=k.getDate(t.checkIn),v.data.checkOut=k.getDate(t.checkOut),v.data.paxes=t.pax,ee(),m.$broadcast(w.bookerChangeEvent,v.data)):(v.data.place_selected=t.place,v.data.paxes=t.box.pax,v.data.checkIn=k.getDate(t.box.checkIn),v.data.checkOut=k.getDate(t.box.checkOut),v.data.campaignTokenApi=t.campaignTokenApi,v.data.campaignToken=t.campaignToken,v.onSubmit(v.form,!0))})),m.$on(w.bookerSearchEvent,(function(e,t){C.metricModifiedSearchRecomendation(t.typeEvent),v.data.paxes=t.paxes,v.data.checkIn=t.checkIn,v.data.checkOut=t.checkOut,ee(),v.data.typeEvent=t.typeEvent,m.$broadcast(w.bookerChangeEvent,v.data)})),v.onSearch=function(e,t,n,r){if((""===e||null==e||e.length<3)&&B(),e&&!(e&&e.length<3)&&(v.hasResult=!1,v.form[n].$valid)){P=r,I=t;var o={query:e,language:y.language,placeTypes:y.placesTypeHotel,from:0,size:10,usersearch:N,site:y.code,analyticsTags:X()};s.get(y.endPoints.suggestionHotelUrl,{params:o}).then(j,U)}},v.onSubmit=function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>3?arguments[3]:void 0,r=arguments.length>4?arguments[4]:void 0;return function(e){var o=L.getFirstPathSegment();if(v.validation.paxes=G(v.data.paxes,e),n&&"hotel"==o)e.$valid&&v.validation.paxes?(v.data.typeEvent=r,m.$broadcast(w.bookerSearchEvent,v.data),m.$broadcast(w.bookerSearchEventSmall,v.data),v.form.$pristine=!1,v.form.$dirty=!1,v.form.$submitted=!1):v.validation.paxes||(v.suggestion.paxes=!0);else{if(n&&"hotel"!=o)return;if(v.submit=!0,t?e.$valid=!0:(v.validation.paxes=G(v.data.paxes,e),v.validation.checkIn=z(_,v.data.checkIn),v.validation.checkOut=z(_,v.data.checkOut),v.validation.dates=z(v.data.checkIn,v.data.checkOut)),e.$valid&&v.validation.paxes&&v.validation.checkIn&&v.validation.checkOut&&v.validation.dates){var i=k.search(),a=q(v.data.paxes),s=i.coupon,c={placeId:v.data.place_selected.id,placeType:v.data.place_selected.type,adults:v.data.paxes.adults,checkin:k.formatDate(v.data.checkIn,w.formatDate),checkout:k.formatDate(v.data.checkOut,w.formatDate)};s&&(c.coupon=s),v.data.place_selected.cityUrl&&y.algoliaDetailIs&&(c.profileId=v.data.place_selected.code),i.CampaignToken&&(c.CampaignToken=i.CampaignToken),i.campaignTokenApi&&(c.campaignTokenApi=i.campaignTokenApi),i.ctInternal&&(c.ctInternal=i.ctInternal),i.source&&(c.source=i.source),c=p(p({},c),a);var l=W(v.data.place_selected.cityUrl&&y.algoliaDetailIs?6:v.data.place_selected.type);try{C.metricBookerHotel("booker",{vmData:v.data,data:c})}catch(e){console.log(e)}e=document.createElement("form");for(var u in e.setAttribute("method","get"),e.setAttribute("action","".concat(y.siteUrl).concat(l).concat(v.data.place_selected.cityUrl&&y.algoliaDetailIs?v.data.place_selected.cityUrl:v.data.place_selected.uri)),c)if(c[u]){var d=document.createElement("input");d.setAttribute("type","hidden"),d.setAttribute("name",u),d.setAttribute("value",c[u]),e.appendChild(d)}Q(v.data),h.set("bookerHotel_fam",v.data),$("#loader-page").removeClass("d-none"),document.body.appendChild(e),e.submit()}else v.validation.paxes||(v.suggestion.paxes=!0)}}(e)},v.onSelect=function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];v.isSelected=!0,te("auto"),v.data.place_name=e.displayText,v.data.place_selected=e,v.suggestion[t].show=!1,v.placeInputHasFocus=!1,Z(e,n),r&&C.metricRecentSearch(e.displayText)},v.showPaxes=function(){v.suggestion.paxes=!0,v.dataCopyCancel=angular.copy(v.data),te("hidden")},v.addRoom=function(e){v.settingPaxes.rooms<=v.data.paxes[e]||(v.data.paxes[e]+=1,V())},v.removeRoom=function(e){v.data.paxes[e]+1>2&&(v.data.paxes[e]-=1),V()},v.onFocus=function(e,t){I=e,P=t,v.hasResult=!0,setTimeout((function(){B()}),200),v.suggestion[e].results.length&&setTimeout((function(){n.$apply((function(){v.suggestion[e].show=!0,k.mobileAndTabletCheck()&&K("".concat(t,"_modal"))}))}),250)},v.getIcon=function(e){var t="icons-globe-outline";switch(e){case 6:t="icons-globe-outline";break;case 3:t="icons-location";break;case 11:t="icons-plane-airport";break;case 7:t="icons-compass";break;case 14:t="icons-hotel";break;case 12:t="icons-monument"}return[t]},v.removePax=function(e,t){v.data.paxes[e]-1>=t&&(v.data.paxes[e]-=1),V()},v.addPax=function(e,t){v.data.paxes[e]+1<=t&&(v.data.paxes[e]+=1),V()},v.removeChildren=function(e,t){v.data.paxes[e].length-1>=t&&v.data.paxes[e].splice(v.data.paxes[e].length-1,1),V()},v.addChildren=function(e,t){v.data.paxes[e].length+1<=t&&v.data.paxes[e].push({year:null}),V()},v.onClose=function(e,t){J()?v.form.$setSubmitted():(e[t]=!1,Y(t),v.placeInputHasFocus=!1,te("auto"))},v.onCloseCancel=function(e,t){v.data=v.dataCopyCancel,e[t]=!1,Y(t),te("auto")},v.onCloseSubmitForm=function(e,t,n){te("auto"),J()||v.form.$invalid?v.onClose(e,t):n?(v.onClose(e,t),m.$broadcast(w.bookerSearchEvent,v.data),m.$broadcast(w.bookerSearchEventSmall,v.data),v.form.$pristine=!1,v.form.$dirty=!1,v.form.$submitted=!1):v.onSubmit(v.form,!1)},v.onRemove=function(e,t,n){e[t].splice(n,1),V()},v.hasError=function(e,t){var n=e[t];return e.$submitted&&n.$invalid},v.isInvalidInput=function(e,t,n){return e.$submitted&&e["".concat(t,"_").concat(n)].$invalid},v.onClickOutside=function(e,t){v.placeInputHasFocus=!1,e[t]=!1,Y(t),v.placeInputHasFocus=!1,te("auto")},v.deleteSelection=function(e,t,n,r){v.data[e]=null,v.data["".concat(t).concat(n.length?"_"+n:"")]={},K(r)},v.showBooker=function(){v.display=!v.display},v.keysNavigation=function(){var e=d(l().mark((function e(t,n){var r;return l().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!((r=v.suggestion[n])&&r.results.length&&r.show)){e.next=10;break}if(40==t.keyCode&&(v.keyPosition=v.keyPosition<r.results.length-1?v.keyPosition+1:v.keyPosition),38==t.keyCode&&(v.keyPosition=v.keyPosition>0?v.keyPosition-1:v.keyPosition),13!=t.keyCode){e.next=10;break}return t.preventDefault(),v.onSelect(r.results[v.keyPosition],n,v.keyPosition),e.next=9,k.sleep(100);case 9:v.keySelected=0;case 10:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),v.clickInputInMobile=function(e){te("hidden"),P=e,v.placeInputHasFocus=!0,k.mobileAndTabletCheck()&&(K("".concat(P,"_modal")),v.data.place_name&&v.data.place_name.length>3&&setTimeout((function(){var e=document.getElementById("".concat(P,"_modal"));e&&e.setSelectionRange(0,e.value.length)}),200))},g.setDataArgolia=function(e,t){if(e&&e.items&&e.items.queryID&&e.items.objectID&&window.aa){var n=e.items.queryID,r=e.items.objectID,o=t+1,i=N;if(window.sessionStorage){var a={objectIDs:r,queryID:n,userToken:i,posicion:o,indexName:y.algoliaSearch};h.set("_key_argo_object",JSON.stringify(a))}window.aa("clickedObjectIDsAfterSearch",{userToken:i,eventName:"Buscador Click",index:y.algoliaSearch,queryID:n,objectIDs:[r],positions:[o]})}};var ne=function(){var e=d(l().mark((function e(){var n,r,o,i;return l().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!y.showCalendarAvailability){e.next=15;break}if(!(n=v.data.place_selected)||14!=n.type||!n.code&&!n.id){e.next=15;break}t.D.setCalendarPriceContainer(),e.t0=l().keys(A);case 5:if((e.t1=e.t0()).done){e.next=14;break}return r=e.t1.value,o=r.split("_"),e.next=10,t.D.getAvailability(n.code||n.id,o[0],o[1]);case 10:i=e.sent,t.D.build(O,i),e.next=5;break;case 14:t.D.footerBuild();case 15:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();!function(){var e;F(),function(){var e,t;"hotels"!=w.page&&"hotel"!=w.page||(v.display=!k.mobileAndTabletCheck());"home"!=w.page?e=function(){var e=k.search(),t={},n=E;t.place_name=n.displayText||"",t.place_selected=n,t.checkIn=e.checkin||v.data.checkIn,t.checkOut=e.checkout||v.data.checkOut;var r={adults:0,children:[],rooms:0};if(e["room1.adults"]){var o=+e.rooms;r.rooms=o;for(var i=0;i<o;i++){var a=i+1;r.adults=parseInt(r.adults)+parseInt(e["room".concat(a,".adults")])||2;var s=e["room".concat(a,".agekids")];if(s)for(var c=s.split(","),l=0;l<c.length;l++)r.children.push({year:+c[l]||0})}}else{for(var u=+e.group_adults||2,d=+e.no_rooms||1,h=[],p=+e.group_children||0,f=0;f<p;f++){var m=+(e.age||"").split(",")[f]||0;h.push({year:m})}r.adults=u,r.rooms=d,r.children=h}r||(r=v.data.paxes);return t.paxes=r,t}():t=h.get("bookerHotel_fam");t&&(t.place_name=null,t.place_selected={});v.data=e||t||v.data,L.getIsArray(v.data.paxes)&&(v.data.paxes=L.convertPaxesData(v.data.paxes));(e||t)&&(v.data.checkIn=k.getDate(v.data.checkIn),v.data.checkOut=k.getDate(v.data.checkOut),(+v.data.checkIn<=+_||+v.data.checkOut<=+_)&&F())}(),function(){var e=k.search();if((_<k.getDate(v.data.checkOut)||_>=k.getDate(v.data.checkOut))&&x)if(e.daysToArrival&&e.daystostay){var n=new Date;n.setDate(n.getDate()+parseInt(e.daysToArrival)),v.data.checkIn=n;var r=new Date(n);r.setDate(r.getDate()+parseInt(e.daystostay)),v.data.checkOut=r}else v.data.checkIn=k.getDate(x.checkIn),v.data.checkOut=k.getDate(x.checkOut);o=["calendar-checkIn-hotel","calendar-checkOut-hotel"],i=v.data.checkIn,a=v.data.checkOut,s="checkIn",c="checkOut",l=L.getFirstPathSegment(),u=w.rb?[]:["".concat(y.cloudCdn,"/assets/css/dist/").concat(y.siteName,"/booker.css?id=").concat(+new Date)],S={element:document.getElementById(o[0]),css:u,zIndex:10,grid:2,calendars:2,autoApply:!0,readonly:!0,lang:y.culture,date:i,format:k.mobileAndTabletCheck()&&"hotel"==l?R.formatMobile:R.format,plugins:["RangePlugin","LockPlugin"],LockPlugin:{minDate:_,minDays:2},RangePlugin:{tooltip:!0,startDate:i,endDate:a,tooltipNumber:function(e){return e-1},locale:{one:b.night,other:b.night+"s"}},setup:function(e){e.on("select",(function(e){var t=e.detail,n=t.start,r=t.end;v.data[s]=n.toJSDate(),v.data[c]=r.toJSDate(),v.onSubmit(v.form,!0,"",!0,"recomendacion")})),e.on("view",(function(e){var n=e.detail,r=n.view,o=n.date,i=n.target;if("CalendarDay"===r){var a=v.data.place_selected,s=o.format("YYYY_MM"),c=o.format("YYYY-MM-DD");A[s]=s,O[c]={date:o.format("YYYY-MM-DD"),target:i};var l=t.D.getMemoryDate(s,c,a.code||a.id);l&&t.D.buildElement(O[c],l)}"Main"===r&&(t.D.setFooterElement(i),t.D.footerBuild())})),e.on("show",(function(e){ne(),t.D.overFlow()})),e.on("hide",(function(e){t.D.overFlow(),O={},A={}})),e.on("click",(function(t){e.isCalendarHeaderButton(t.target)&&(O={},A={},setTimeout((function(){ne()}),100)),e.isCalendarDay(t.target)&&setTimeout((function(){ne()}),100)}))}},T=new easepick.create(S);var o,i,a,s,c,l,u}(),V(),(e=h.get(w.historyStorageParam))&&(v.history=e,v.history=v.history.every((function(e){return e.place_selected.hasOwnProperty("city")}))?v.history:[]);for(var n=v.settingPaxes.minAge;n<=v.settingPaxes.maxAge;n++)v.years.push({year:n})}()}window.app.controller("BookerHotelController",m),m.$inject=["$scope","$http","$q","$timeout","localStorageService","$location","$rootScope"]})(),(()=>{"use strict";n(4697);function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e(t)}function t(e){return function(e){if(Array.isArray(e))return o(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||r(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function r(e,t){if(e){if("string"==typeof e)return o(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?o(e,t):void 0}}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function i(t,n){for(var r=0;r<n.length;r++){var o=n[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,(i=o.key,a=void 0,a=function(t,n){if("object"!==e(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var o=r.call(t,n||"default");if("object"!==e(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===n?String:Number)(t)}(i,"string"),"symbol"===e(a)?a:String(a)),o)}var i,a}var a=function(){function e(t,n,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._paxes=t,this._roomRates={},this.analytics=window.__pt.fn.analytics,this.events=window.__pt.fn.analytics.events,this.pages=window.__pt.fn.analytics.pages,this.config=window.__pt.settings||{},this.place=window.__pt.place||{},this.hotel=window.__pt.hotel||{},this.placeContainer=window.__pt.placeContainer||{},this.box=window.__pt.box||{},this.fn=window.__pt.fn||{},this.roomsAval=n,this.roomsTax=r,this.initData()}var n,o,a;return n=e,o=[{key:"initData",value:function(){var e;this.nights=this.countNight(this.box.checkIn,this.box.checkOut),this.location=this.hotel.location||{},this.url="".concat(location.origin).concat(location.pathname),this.rating=null!==(e=this.hotel.surveyAverage)&&void 0!==e&&e.averageValue?2*this.hotel.surveyAverage.averageValue:0,this.checkIn=this.box.checkIn,this.checkOut=this.box.checkOut}},{key:"initialLayers",value:function(e){this._roomRates=e,this.setViewSearchResult(),this.detailPageViewEvent(),this.setHotelImpressionView(),this.sendPaymentFunnel()}},{key:"setHotelImpressionView",value:function(){var e=this.productDetailBase(),t={event:this.events.productDetail,EECProductDetailAdults:e.EECProductDetailBaseAdults,EECProductDetailBrand:e.EECProductDetailBaseBrand,EECProductDetailCheckin:e.EECProductDetailBaseCheckin,EECProductDetailCheckout:e.EECProductDetailBaseCheckout,EECProductDetailCity:e.EECProductDetailBaseCity,EECProductDetailContractOwner:e.EECProductDetailBaseContractOwner,EECProductDetailCountry:e.EECProductDetailBaseCountry,EECProductDetailDestination:e.EECProductDetailBaseDestination,EECProductDetailId:e.EECProductDetailBaseId,EECProductDetailKids:e.EECProductDetailBaseKids,EECProductDetailName:e.EECProductDetailBaseName,EECProductDetailNights:e.EECProductDetailBaseNights,EECProductDetailQuantity:e.EECProductDetailBaseQuantity,EECProductDetailRating:e.EECProductDetailBaseRating,EECProductDetailRoomTypes:e.EECProductDetailBaseRoomTypes,EECProductDetailRoomTypesAvailable:e.EECProductDetailBaseRoomTypesAvailable,EECProductDetailRoomTypesOnRequest:e.EECProductDetailBaseRoomTypesOnRequest,EECProductDetailRoomTypesUAllotment:e.EECProductDetailBaseRoomTypesUAllotment,EECProductDetailRoomTypesUClosedDate:e.EECProductDetailBaseRoomTypesUClosedDate,EECProductDetailRoomTypesUClosedToArrival:e.EECProductDetailBaseRoomTypesUClosedToArrival,EECProductDetailRoomTypesUCutoff:e.EECProductDetailBaseRoomTypesUCutoff,EECProductDetailRoomTypesUMaxStay:e.EECProductDetailBaseRoomTypesUMaxStay,EECProductDetailRoomTypesUMinStay:e.EECProductDetailBaseRoomTypesUMinStay,EECProductDetailRoomTypesUPax:e.EECProductDetailBaseRoomTypesUPax,EECProductDetailStars:e.EECProductDetailBaseStars,EECProductDetailState:e.EECProductDetailBaseState,EECProductDetailWeek:e.EECProductDetailBaseWeek,EECProductDetailWeekDay:e.EECProductDetailBaseWeekDay,EECProductDetailZone:e.EECProductDetailBaseZone,EECProductDetailPrice:e.EECProductDetailBasePrice,EECProductDetailPlaceId:e.EECProductBasePlaceId,EECProductDetailAvailable:e.EECProductDetailBaseAvailable,RAPA:e.BaseRAPA,RAPD:e.BaseRAPD,EECImpressionProductUrl:e.EECImpressionBaseProductUrl,EECIDestinationUrl:e.EECIBaseDestinationUrl,EECImpressionImageUrl:e.EECImpressionBaseImageUrl,EECProductDetailNoAvailable:e.EECProductDetailBaseNoAvailable,EECProductDetailNoAvailableMaxCapacity:e.EECProductDetailBaseNoAvailableMaxCapacity,EECProductDetailNoAvailableMinCapacity:e.EECProductDetailBaseNoAvailableMinCapacity,EECProductDetailNoAvailableMaxStay:e.EECProductDetailBaseNoAvailableMaxStay,EECProductDetailNoAvailableMinStay:e.EECProductDetailBaseNoAvailableMinStay,EECProductDetailChannel:e.EECProductDetailBaseChannel};this.analytics.set(this.events.productDetail,t)}},{key:"setAddToCart",value:function(e,t){var n=this.addToCartBase(e,t),r={event:this.events.addToCart,EECAddToCartName:n.EECAddToCartBaseName,EEAddToCartId:n.EEAddToCartBaseId,EECAddToCartRating:n.EECAddToCartBaseRating,EECAddToCartStars:n.EECAddToCartBaseStars,EECAddToCartPrice:n.EECAddToCartBasePrice,EECAddToCartQuantity:n.EECAddToCartBaseQuantity,EECAddToCartAdults:n.EECAddToCartBaseAdults,EEAddToCartKids:n.EEAddToCartBaseKids,EECAddToCartCity:n.EECAddToCartBaseCity,EECAddToCartState:n.EECAddToCartBaseState,EECAddToCartCountry:n.EECAddToCartBaseCountry,EECAddToCartCheckin:n.EECAddToCartBaseCheckin,EECAddToCartCheckout:n.EECAddToCartBaseCheckout,EECAddToCartNights:n.EECAddToCartBaseNights,EECAddToCartPlaceId:n.EECAddToCartBasePlaceId,EECAddToCartMealPlan:n.EECAddToCartBaseMealPlan,EECAddToCartAvailable:n.EECAddToCartBaseAvailable,EECAddToCartBookNowPayLater:n.EECAddToCartBaseBookNowPayLater};this.analytics.set(this.events.addToCart,r)}},{key:"productDetailBase",value:function(){var e=this.isoWeekNumber(),n=this.getWeekDay(this.box.checkIn),r=this._paxes,o=(this.hotel.rooms,this._roomRates.rooms||[]),i=this.hotel.gallery&&this.hotel.gallery.length?this.hotel.gallery[0]:{},a=((o.length&&o[0].rate.length?o[0].rate[0]:{}).Taxes,this.location),s=this.isRAPD(),c=this._roomRates.rooms.length>0,l="".concat(this.config.site.siteUrl).concat(this.config.site.pathHoteles).concat(this.placeContainer.uri);return{EECProductDetailBaseAdults:r.adults,EECProductDetailBaseBrand:"",EECProductDetailBaseCheckin:this.checkIn,EECProductDetailBaseCheckout:this.checkOut,EECProductDetailBaseCity:a.city,EECProductDetailBaseContractOwner:"",EECProductDetailBaseCountry:a.country,EECProductDetailBaseDestination:a.city,EECProductDetailBaseId:"".concat(this.hotel.hotelId),EECProductDetailBaseKids:r.children.length,EECProductDetailBaseName:this.hotel.name,EECProductDetailBaseNights:this.nights,EECProductDetailBaseQuantity:this.box.pax.rooms,EECProductDetailBaseRating:"".concat(this.rating),EECProductDetailBaseRoomTypes:this.roomsAval.length+o.length,EECProductDetailBaseRoomTypesAvailable:o.length,EECProductDetailBaseRoomTypesOnRequest:0,EECProductDetailBaseRoomTypesUAllotment:0,EECProductDetailBaseRoomTypesUClosedDate:0,EECProductDetailBaseRoomTypesUClosedToArrival:0,EECProductDetailBaseRoomTypesUCutoff:0,EECProductDetailBaseRoomTypesUMaxStay:0,EECProductDetailBaseRoomTypesUMinStay:0,EECProductDetailBaseRoomTypesUPax:0,EECProductDetailBaseStars:this.hotel.stars,EECProductDetailBaseState:a.state,EECProductDetailBaseWeek:Number(e),EECProductDetailBaseWeekDay:n,EECProductDetailBaseZone:"",EECProductDetailBasePrice:o.length>0?Math.min.apply(Math,t(o.map((function(e){return e.lessRate})))):0,EECProductBasePlaceId:this.hotel.placeId,EECProductDetailBaseAvailable:c,BaseRAPA:!this._roomRates.isBlockRAPD&&0!=o.length,BaseRAPD:s,EECImpressionBaseProductUrl:this.url,EECIBaseDestinationUrl:l,EECImpressionBaseImageUrl:i.cloudUri,EECProductDetailBaseNoAvailable:this.getavailableGetRooms(),EECProductDetailBaseNoAvailableMaxCapacity:this.getMaxMinCapacity(!0),EECProductDetailBaseNoAvailableMinCapacity:this.getMaxMinCapacity(!1),EECProductDetailBaseNoAvailableMaxStay:this.getMaxMinStay(!0),EECProductDetailBaseNoAvailableMinStay:this.getMaxMinStay(!1),EECProductDetailBaseChannel:this.config.site.channelFac}}},{key:"addToCartBase",value:function(e,t){var n=this.location,r=this._roomRates.rooms.length,o=r>0,i=t.map((function(e){return e.mealPlanCode})).join(":");return{EECAddToCartBaseName:this.hotel.name,EEAddToCartBaseId:"".concat(this.hotel.hotelId),EECAddToCartBaseRating:"".concat(this.rating),EECAddToCartBaseStars:this.hotel.stars,EECAddToCartBasePrice:e.Amount,EECAddToCartBaseQuantity:r,EECAddToCartBaseAdults:e.Adults,EEAddToCartBaseKids:e.Kids,EECAddToCartBaseCity:n.city,EECAddToCartBaseState:n.state,EECAddToCartBaseCountry:n.country,EECAddToCartBaseCheckin:this.checkIn,EECAddToCartBaseCheckout:this.checkOut,EECAddToCartBaseNights:this.nights,EECAddToCartBasePlaceId:this.hotel.placeId,EECAddToCartBaseBookNowPayLater:e.isBookNowPayLater,EECAddToCartBaseMealPlan:i,EECAddToCartBaseAvailable:o}}},{key:"detailPageViewEvent",value:function(){var e={event:this.events.pageView,pagePath:window.location.href,pageTitle:this.hotel.name};this.analytics.set(this.events.pageView,e)}},{key:"setViewSearchResult",value:function(){var e={event:this.events.trackEvent,eventName:this.events.viewSearchResults,search_term:"".concat(this.place.displayText),search_type:this.events.typeHotel};this.analytics.set(this.events.gtmEvent,e)}},{key:"selectedFilter",value:function(e){var t={event:this.events.trackEvent,eventName:this.events.selectContent,content_type:this.events.button,element:"".concat(this.events.typeHotel," :: ").concat(e),layer:this.events.hotels};this.analytics.set(this.events.trackEvent,t)}},{key:"selectedReviews",value:function(e){var t=this._paxes,n={event:this.events.trackEvent,eventName:this.events.selectContent,content_type:this.events[e.content_type],element:"".concat(e.elementText," :: ").concat(e.calf),layer:this.events.hotels,page_type:this.events.typeHotel,field_hotel_name:this.hotel.name,field_hotel_id:this.hotel.hotelId,field_date1:this.checkIn,field_date2:this.checkOut,field_rooms:this.box.pax.rooms,travelers_adults:t.adults,travelers_children:t.children.length,field_score_descr:e.calfDesc};this.analytics.set(this.events.trackEvent,n)}},{key:"sendPaymentFunnel",value:function(){var e=this._paxes,t=this.isRAPD()?"RAPD":"RAPA",n={event:this.events.gtmEvent,eventAction:"HotelDetail | hotelId:".concat(this.hotel.hotelId," | ").concat(this.hotel.name),eventCategory:this.events.paymentFunnel,eventLabel:"".concat(this.checkIn," | ").concat(this.checkOut," | adults:").concat(e.adults," | kids:").concat(e.children.length," | ").concat(t," ")};this.analytics.set(this.events.gtmEvent,n)}},{key:"unavailableHotel",value:function(e,t){if(!(this._roomRates.rooms.length>0)){var n=this.buildPaxLabel(t),r={event:this.events.gtmEvent,eventAction:"HotelDetail-".concat(e||"None"),eventCategory:this.events.hotelError,eventLabel:"hotelId:".concat(this.hotel.hotelId," | ci:").concat(this.checkIn," | co:").concat(this.checkOut," | ").concat(n)};this.analytics.set(this.events.gtmEvent,r)}}},{key:"setAB",value:function(e){var t=this._paxes,n=this.isRAPD()?"RAPD":"RAPA",r={event:this.events.gtmEventAB,eventCategory:e.cookieValue,eventAction:"HotelDetail | hotelId:".concat(this.hotel.hotelId," | ").concat(this.hotel.name," | ").concat(e.code),eventLabel:"".concat(this.checkIn," | ").concat(this.checkOut," | adults:").concat(t.adults," | kids:").concat(t.children.length," | ").concat(n)};this.analytics.set(this.events.gtmEvent,r)}},{key:"viewItemListTB",value:function(e){for(var t=this._paxes,n=e.length,r={event:"ga4.".concat(this.events.trackEvent),eventName:"view_item",eventParams:{currency:this.config.site.currency,field_destination:this.place.id,field_date1:this.checkIn,field_date2:this.checkOut,field_rooms:this.box.pax.rooms,field_total_nights:this.nights,travelers_adults:t.adults,travelers_children:t.children.length,page_type:this.pages[this.config.page],layer:this.events.hotel,timestamp:Date.now(),items:[]}},o=0;o<n;o++){var i=e[o];i.taxes=this.roomsTax[o].rate.rate[o].taxes;var a=this.itemBase(i);r.eventParams.items.push({item_id:a.itemId,item_name:a.itemName,item_brand:a.itemBrand,item_category:a.itemCategory,item_category2:a.itemCategory,item_variant:null,price:a.price,coupon:a.coupon,item_list_name:a.itemList,item_list_id:0})}this.analytics.set(this.events.viewItemList,r)}},{key:"itemBase",value:function(e){return{itemId:e.hotelId,itemName:e.name,price:e.taxes?e.taxes.totalRoomRatePerNight:0,itemBrand:e.uri,itemCategory:this.config.page,itemList:this.place.name,position:e.position,coupon:e.taxes?e.taxes.promotionType:null}}},{key:"setUserInteraction",value:function(e){var t=e?"Paga despues":"Paga ahora",n={event:"ga4.".concat(this.events.trackEvent),eventName:this.events.user_interaction,eventParams:{action:this.events.click,element:t,purchase_type:t,content_type:this.events.button,page_type:this.pages[this.config.page],layer:this.events.hotel}};this.analytics.set(this.events.gtmEvent,n)}},{key:"beginCheckOutTB",value:function(e,t){var n=this,r=this._paxes,o=(e.rate,t.map((function(e){return e.mealPlanCode})).join(":")),i=t.map((function(e){return{item_id:e.idRoom,item_name:e.name,item_brand:n.place.name,item_category:"habitaciones",item_category2:null,item_variant:null,price:e.totalRoomRatePerNight,coupon:e.promotionValue,item_list_name:"rooms",item_list_id:e.index}})),a={event:"ga4.".concat(this.events.trackEvent),eventName:this.events.beginCheckout,eventParams:{currency:this.config.site.currency,value:e.Amount,field_destination:this.place.id,field_date1:this.checkIn,field_date2:this.checkOut,field_rooms:this.box.pax.rooms,field_total_nights:this.nights,travelers_adults:r.adults,travelers_children:r.children.length,arrival_id:this.place.id,meal_plan:o,purchase_type:e.isBookNowPayLater?"pagar despues":"pagar ahora",content_type:this.events.button,page_type:this.pages[this.config.page],layer:this.events.hotel,timestamp:Date.now(),items:i}};this.analytics.set(this.events.gtmEvent,a)}},{key:"selectDateSuggested",value:function(e){var t=this._paxes,n={event:"ga4.".concat(this.events.trackEvent),eventName:this.events.selectContent,eventParams:{element:"available_dates:: <<".concat(e.CheckIn,"|").concat(e.CheckOut,">"),field_date1:e.CheckIn,field_date2:e.CheckOut,field_hotel_name:this.hotel.name,travelers_adults:t.adults,travelers_children:t.children.length,field_hotel_id:this.hotel.hotelId,field_rooms:this.box.pax.length,page_type:this.pages[this.config.page],layer:this.events.hotels,content_type:this.events.button}};this.analytics.set(this.events.gtmEvent,n)}},{key:"setEventFamilyDetail",value:function(e){var t={event:this.events.trackEvent,eventName:this.events.selectContent,content_type:this.events.button,element:"".concat(e),layer:this.events.hotels,page_type:this.pages[this.config.page]};this.analytics.set(this.events.trackEvent,t)}},{key:"countNight",value:function(e,t){return Math.abs(new Date(t).getTime()-new Date(e).getTime())/864e5}},{key:"getWeekDay",value:function(e){var t=e.split("-");return new Date(t.join("/")).getDay()}},{key:"isoWeekNumber",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Date,t=new Date(e),n=e.getUTCDay()||7;t.setUTCDate(t.getUTCDate()+4-n);var r=new Date(Date.UTC(t.getUTCFullYear(),0,1));return"".concat(Math.ceil(((t.getTime()-r.getTime())/864e5+1)/7))}},{key:"buildPaxLabel",value:function(e){var t,n=0,o=[],i=function(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=r(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var o=0,i=function(){};return{s:i,n:function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,s=!0,c=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return s=e.done,e},e:function(e){c=!0,a=e},f:function(){try{s||null==n.return||n.return()}finally{if(c)throw a}}}}(e);try{for(i.s();!(t=i.n()).done;){var a=t.value;n+=1;var s=a.split("|"),c=s[0]?Number(s[0]):0,l=s[1]?s[1].split(","):[];l.map((function(e){return{year:Number(e)}})),o.push("room".concat(n,".adults:").concat(c,"|room").concat(n,".kids:").concat(l))}}catch(e){i.e(e)}finally{i.f()}return o.join(",")}},{key:"isRAPD",value:function(){return!!this._roomRates.rooms&&this._roomRates.rooms.map((function(e){return e.rate.some((function(e){return e.IsBookNowPayLaterApplicable}))})).some((function(e){return e}))}},{key:"getavailableGetRooms",value:function(){var e=this,t="";return this.roomsTax.map((function(n){e.roomsAval.find((function(e){return e.roomId==n.roomId}))&&(n.unavailableStatus.availabilityStatus.includes("RoomCapacity")?t="capacity":n.unavailableStatus.availabilityStatus.includes("MinimumStay")&&(t="stay"))})),t}},{key:"getMaxMinStay",value:function(e){var t=this,n=0;return this.roomsTax.map((function(e){if(t.roomsAval.find((function(t){return t.roomId==e.roomId}))&&e.unavailableStatus.availabilityStatus.includes("MinimumStay")){var r=parseInt(e.unavailableStatus.availabilityValue);n<r&&(n=r)}})),e?0:n}},{key:"getMaxMinCapacity",value:function(e){var n=this,r=0,o=0;return this.roomsTax.map((function(e){n.roomsAval.find((function(t){return t.roomId==e.roomId}))&&e.unavailableStatus.availabilityStatus.includes("RoomCapacity")&&(r<Math.max.apply(Math,t(e.capacityList))+1&&(r=Math.max.apply(Math,t(e.capacityList))+1),o<Math.min.apply(Math,t(e.capacityList))+1&&(o=Math.min.apply(Math,t(e.capacityList))+1))})),e?r:o}}],o&&i(n.prototype,o),a&&i(n,a),Object.defineProperty(n,"prototype",{writable:!1}),e}();function s(e){return s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},s(e)}function c(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,(o=r.key,i=void 0,i=function(e,t){if("object"!==s(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==s(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(o,"string"),"symbol"===s(i)?i:String(i)),r)}var o,i}var l=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.analytics=window.__pt.fn.analytics,this.settings=window.__pt.settings,this.events=window.__pt.fn.analytics.events}var t,n,r;return t=e,(n=[{key:"clickLink",value:function(e){var t={content_type:this.events.link,element:e,event:this.events.trackEvent,eventName:this.events.selectContent,layer:this.settings.page};this.analytics.set(t.event,t)}},{key:"selectContent",value:function(e,t){var n={content_type:this.events.button,element:"".concat(e," :: ").concat(t),event:this.events.trackEvent,eventName:this.events.selectContent,layer:this.settings.page};this.analytics.set(n.event,n)}}])&&c(t.prototype,n),r&&c(t,r),Object.defineProperty(t,"prototype",{writable:!1}),e}();function u(e){return u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},u(e)}function d(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function h(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?d(Object(n),!0).forEach((function(t){p(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):d(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function p(e,t,n){return(t=function(e){var t=function(e,t){if("object"!==u(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==u(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===u(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var f=n(7066);function m(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=e.adults,o=e.children,i=e.rooms,a=o.length,s=n?g({adults:r,kids:a,kidsSlit:o,rooms:t?1:i}):v({adults:r,kids:a,kidsSlit:o,rooms:t?1:i});return s.distribution||(s.distribution=[],s.distribution.push("".concat(r).concat(o.length>0?"|":"").concat(o.map((function(e){return null==e?void 0:e.year})).join(",")))),{paxes:{adults:r,children:o,rooms:i},adults:r,children:a,paxesFormat:s.distribution,roomExtra:s.roomExtra}}function v(e){var t=e.adults,n=e.kids,r=e.kidsSlit;return y(t,n,e.rooms,r)}function g(e){var t,n,r,o,i,a,s,c,l,u,d,h,p,f,m,v,g,w,b,k,_,E,I,P,S,T,C,x,D,R,O,A,L,N,M=e.adults,j=e.kids,U=e.kidsSlit,B=e.rooms,F={"2x2":["1|".concat(null===(t=U[0])||void 0===t?void 0:t.year),"1|".concat(null===(n=U[1])||void 0===n?void 0:n.year)],"2x3":["1|".concat(null===(r=U[0])||void 0===r?void 0:r.year),"1|".concat(null===(o=U[1])||void 0===o?void 0:o.year,",").concat(null===(i=U[2])||void 0===i?void 0:i.year)],"3x1":["2","1|".concat(null===(a=U[0])||void 0===a?void 0:a.year)],"3x2":["2|".concat(null===(s=U[0])||void 0===s?void 0:s.year),"1|".concat(null===(c=U[1])||void 0===c?void 0:c.year)],"3x3":["2|".concat(null===(l=U[0])||void 0===l?void 0:l.year,",").concat(null===(u=U[1])||void 0===u?void 0:u.year),"1|".concat(null===(d=U[2])||void 0===d?void 0:d.year)],"2x4":["1|".concat(null===(h=U[0])||void 0===h?void 0:h.year,",").concat(null===(p=U[1])||void 0===p?void 0:p.year),"1|".concat(null===(f=U[2])||void 0===f?void 0:f.year,",").concat(null===(m=U[3])||void 0===m?void 0:m.year)],"3x4":["2|".concat(null===(v=U[0])||void 0===v?void 0:v.year,",").concat(null===(g=U[1])||void 0===g?void 0:g.year),"1|".concat(null===(w=U[2])||void 0===w?void 0:w.year,",").concat(null===(b=U[3])||void 0===b?void 0:b.year)],"4x4":["2|".concat(null===(k=U[0])||void 0===k?void 0:k.year,",").concat(null===(_=U[1])||void 0===_?void 0:_.year),"2|".concat(null===(E=U[2])||void 0===E?void 0:E.year,",").concat(null===(I=U[3])||void 0===I?void 0:I.year)],"5x0":["3","2"],"5x1":["3","2|".concat(null===(P=U[0])||void 0===P?void 0:P.year)],"5x2":["3|".concat(null===(S=U[0])||void 0===S?void 0:S.year),"2|".concat(null===(T=U[1])||void 0===T?void 0:T.year)],"4x2":["2|".concat(null===(C=U[0])||void 0===C?void 0:C.year),"2|".concat(null===(x=U[1])||void 0===x?void 0:x.year)],"6x0":["3","3"],"6x1":["2","2","2|".concat(null===(D=U[0])||void 0===D?void 0:D.year)],"7x1":["3","2","2|".concat(null===(R=U[0])||void 0===R?void 0:R.year)],"7x2":["3","2|".concat(null===(O=U[0])||void 0===O?void 0:O.year),"2|".concat(null===(A=U[1])||void 0===A?void 0:A.year)],"8x2":["3","3|".concat(null===(L=U[0])||void 0===L?void 0:L.year),"2|".concat(null===(N=U[1])||void 0===N?void 0:N.year)],"8x0":["4","4"]};return{distribution:F["".concat(M,"x").concat(j)]?F["".concat(M,"x").concat(j)]:null,roomExtra:y(M,j,B,U).roomExtra}}function y(e,t,n,r){var o=!1;if(0===e)return["No hay adultos para distribuir."];for(var i=Math.ceil(e/n),a=Math.ceil(t/n),s=e,c=Math.ceil(t%n),l=[],u=0;u<n;u++){var d=[];if(s>0?(d.push(i),s-=i):(d.push(i+1),o=!0),e/n%2!=0&&(i=Math.ceil(s/(n-(0==l.length?1:l.length+1)))),c>0){var h=r.slice(u*a).slice(0,a).map((function(e){return null==e?void 0:e.year}));h.length>0&&(d.push(h.join(",")),c--)}else{var p=r.slice(u*a).slice(0,a).map((function(e){return null==e?void 0:e.year}));p.length>0&&d.push(p.join(","))}d.length>0&&l.push(d.join("|"))}for(;l.length<n;)l.push("1"),o=!0;return{distribution:l,roomExtra:o}}var w={es:["domingo","lunes","martes","miércoles","jueves","viernes","sábado"],en:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},b={es:["enero","febrero","marzo","abril","mayo","junio","julio","agosto","septiembre","octubre","noviembre","diciembre"],en:["January","February","March","April","May","June","July","August","September","October","November","December"]};function k(e,t){var n=new Date(e),r=w[t][n.getUTCDay()],o=n.getUTCDate(),i=b[t][n.getUTCMonth()];return{dayOfWeek:r,dayAndMonth:"es"===t?"".concat(o," ").concat(i):"".concat(i," ").concat(o," ")}}var _=n(5515),E=n(4943),I=n(2805),P=n(694);function S(e){return S="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},S(e)}function T(){T=function(){return e};var e={},t=Object.prototype,n=t.hasOwnProperty,r=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",s=o.toStringTag||"@@toStringTag";function c(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(e){c=function(e,t,n){return e[t]=n}}function l(e,t,n,o){var i=t&&t.prototype instanceof h?t:h,a=Object.create(i.prototype),s=new P(o||[]);return r(a,"_invoke",{value:k(e,n,s)}),a}function u(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=l;var d={};function h(){}function p(){}function f(){}var m={};c(m,i,(function(){return this}));var v=Object.getPrototypeOf,g=v&&v(v(C([])));g&&g!==t&&n.call(g,i)&&(m=g);var y=f.prototype=h.prototype=Object.create(m);function w(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function b(e,t){function o(r,i,a,s){var c=u(e[r],e,i);if("throw"!==c.type){var l=c.arg,d=l.value;return d&&"object"==S(d)&&n.call(d,"__await")?t.resolve(d.__await).then((function(e){o("next",e,a,s)}),(function(e){o("throw",e,a,s)})):t.resolve(d).then((function(e){l.value=e,a(l)}),(function(e){return o("throw",e,a,s)}))}s(c.arg)}var i;r(this,"_invoke",{value:function(e,n){function r(){return new t((function(t,r){o(e,n,t,r)}))}return i=i?i.then(r,r):r()}})}function k(e,t,n){var r="suspendedStart";return function(o,i){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===o)throw i;return x()}for(n.method=o,n.arg=i;;){var a=n.delegate;if(a){var s=_(a,n);if(s){if(s===d)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var c=u(e,t,n);if("normal"===c.type){if(r=n.done?"completed":"suspendedYield",c.arg===d)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(r="completed",n.method="throw",n.arg=c.arg)}}}function _(e,t){var n=t.method,r=e.iterator[n];if(void 0===r)return t.delegate=null,"throw"===n&&e.iterator.return&&(t.method="return",t.arg=void 0,_(e,t),"throw"===t.method)||"return"!==n&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+n+"' method")),d;var o=u(r,e.iterator,t.arg);if("throw"===o.type)return t.method="throw",t.arg=o.arg,t.delegate=null,d;var i=o.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,d):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,d)}function E(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function I(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(E,this),this.reset(!0)}function C(e){if(e){var t=e[i];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,o=function t(){for(;++r<e.length;)if(n.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t};return o.next=o}}return{next:x}}function x(){return{value:void 0,done:!0}}return p.prototype=f,r(y,"constructor",{value:f,configurable:!0}),r(f,"constructor",{value:p,configurable:!0}),p.displayName=c(f,s,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===p||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,f):(e.__proto__=f,c(e,s,"GeneratorFunction")),e.prototype=Object.create(y),e},e.awrap=function(e){return{__await:e}},w(b.prototype),c(b.prototype,a,(function(){return this})),e.AsyncIterator=b,e.async=function(t,n,r,o,i){void 0===i&&(i=Promise);var a=new b(l(t,n,r,o),i);return e.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},w(y),c(y,s,"Generator"),c(y,i,(function(){return this})),c(y,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},e.values=C,P.prototype={constructor:P,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(I),!e)for(var t in this)"t"===t.charAt(0)&&n.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(n,r){return a.type="throw",a.arg=e,t.next=n,r&&(t.method="next",t.arg=void 0),!!r}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return r("end");if(i.tryLoc<=this.prev){var s=n.call(i,"catchLoc"),c=n.call(i,"finallyLoc");if(s&&c){if(this.prev<i.catchLoc)return r(i.catchLoc,!0);if(this.prev<i.finallyLoc)return r(i.finallyLoc)}else if(s){if(this.prev<i.catchLoc)return r(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return r(i.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=t,i?(this.method="next",this.next=i.finallyLoc,d):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),d},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),I(n),d}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;I(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:C(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),d}},e}function C(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function x(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?C(Object(n),!0).forEach((function(t){D(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):C(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function D(e,t,n){return(t=L(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function R(e,t,n,r,o,i,a){try{var s=e[i](a),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,o)}function O(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var i=e.apply(t,n);function a(e){R(i,r,o,a,s,"next",e)}function s(e){R(i,r,o,a,s,"throw",e)}a(void 0)}))}}function A(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,L(r.key),r)}}function L(e){var t=function(e,t){if("object"!==S(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==S(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===S(t)?t:String(t)}var N=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.analytics=window.__pt.fn.analytics,this.settings=window.__pt.settings,this.events=window.__pt.fn.analytics.events,this.pages=window.__pt.fn.analytics.pages,this.fn=window.__pt.fn||{}}var t,n,r,o,i,a,s;return t=e,n=[{key:"logAddFav",value:(s=O(T().mark((function e(t,n){var r;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r={event:this.events.trackEvent,layer:"hoteles",content_type:n.toString(),search_type:t.uri||"",element:"".concat(t.id," :: ").concat(t.name)},this.analytics.set(this.events.gtmEvent,x({eventName:"favs_add"},r));case 2:case"end":return e.stop()}}),e,this)}))),function(e,t){return s.apply(this,arguments)})},{key:"logDeleteFav",value:(a=O(T().mark((function e(t,n){var r;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r={event:this.events.trackEvent,layer:"hoteles",content_type:n.toString(),element:"".concat(t.id," :: ").concat(t.name)},this.analytics.set(this.events.gtmEvent,x({eventName:"favs_delete"},r));case 2:case"end":return e.stop()}}),e,this)}))),function(e,t){return a.apply(this,arguments)})},{key:"logOpenFav",value:(i=O(T().mark((function e(t,n,r){var o,i,a,s;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:o=t.checkin?this.fn.getDate(t.checkin):"",i=t.checkout?this.fn.getDate(t.checkout):"",a="=",t.totalRoomRatePerNight<t.originalPrice?a="bajó":t.totalRoomRatePerNight>t.originalPrice&&(a="subió"),s={event:this.events.trackEvent,layer:"hoteles",content_type:n.toString(),element:"".concat(t.id," :: ").concat(t.name),field_date1:o,field_date2:i,extra_info:"".concat(a," :: ").concat(r)},this.analytics.set(this.events.gtmEvent,x({eventName:"favs_open_item"},s));case 6:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return i.apply(this,arguments)})},{key:"logOpenFavsList",value:(o=O(T().mark((function e(t,n){var r;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r={event:this.events.trackEvent,layer:"hoteles",content_type:t.toString(),element:"".concat(n)},this.analytics.set(this.events.gtmEvent,x({eventName:"favs_open_list"},r));case 2:case"end":return e.stop()}}),e,this)}))),function(e,t){return o.apply(this,arguments)})}],n&&A(t.prototype,n),r&&A(t,r),Object.defineProperty(t,"prototype",{writable:!1}),e}();function M(e){return M="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},M(e)}function j(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,s=[],c=!0,l=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,o=e}finally{try{if(!c&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)throw o}}return s}}(e,t)||V(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function U(){U=function(){return e};var e={},t=Object.prototype,n=t.hasOwnProperty,r=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",s=o.toStringTag||"@@toStringTag";function c(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(e){c=function(e,t,n){return e[t]=n}}function l(e,t,n,o){var i=t&&t.prototype instanceof h?t:h,a=Object.create(i.prototype),s=new P(o||[]);return r(a,"_invoke",{value:k(e,n,s)}),a}function u(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=l;var d={};function h(){}function p(){}function f(){}var m={};c(m,i,(function(){return this}));var v=Object.getPrototypeOf,g=v&&v(v(S([])));g&&g!==t&&n.call(g,i)&&(m=g);var y=f.prototype=h.prototype=Object.create(m);function w(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function b(e,t){function o(r,i,a,s){var c=u(e[r],e,i);if("throw"!==c.type){var l=c.arg,d=l.value;return d&&"object"==M(d)&&n.call(d,"__await")?t.resolve(d.__await).then((function(e){o("next",e,a,s)}),(function(e){o("throw",e,a,s)})):t.resolve(d).then((function(e){l.value=e,a(l)}),(function(e){return o("throw",e,a,s)}))}s(c.arg)}var i;r(this,"_invoke",{value:function(e,n){function r(){return new t((function(t,r){o(e,n,t,r)}))}return i=i?i.then(r,r):r()}})}function k(e,t,n){var r="suspendedStart";return function(o,i){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===o)throw i;return T()}for(n.method=o,n.arg=i;;){var a=n.delegate;if(a){var s=_(a,n);if(s){if(s===d)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var c=u(e,t,n);if("normal"===c.type){if(r=n.done?"completed":"suspendedYield",c.arg===d)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(r="completed",n.method="throw",n.arg=c.arg)}}}function _(e,t){var n=t.method,r=e.iterator[n];if(void 0===r)return t.delegate=null,"throw"===n&&e.iterator.return&&(t.method="return",t.arg=void 0,_(e,t),"throw"===t.method)||"return"!==n&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+n+"' method")),d;var o=u(r,e.iterator,t.arg);if("throw"===o.type)return t.method="throw",t.arg=o.arg,t.delegate=null,d;var i=o.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,d):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,d)}function E(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function I(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(E,this),this.reset(!0)}function S(e){if(e){var t=e[i];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,o=function t(){for(;++r<e.length;)if(n.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t};return o.next=o}}return{next:T}}function T(){return{value:void 0,done:!0}}return p.prototype=f,r(y,"constructor",{value:f,configurable:!0}),r(f,"constructor",{value:p,configurable:!0}),p.displayName=c(f,s,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===p||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,f):(e.__proto__=f,c(e,s,"GeneratorFunction")),e.prototype=Object.create(y),e},e.awrap=function(e){return{__await:e}},w(b.prototype),c(b.prototype,a,(function(){return this})),e.AsyncIterator=b,e.async=function(t,n,r,o,i){void 0===i&&(i=Promise);var a=new b(l(t,n,r,o),i);return e.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},w(y),c(y,s,"Generator"),c(y,i,(function(){return this})),c(y,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},e.values=S,P.prototype={constructor:P,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(I),!e)for(var t in this)"t"===t.charAt(0)&&n.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(n,r){return a.type="throw",a.arg=e,t.next=n,r&&(t.method="next",t.arg=void 0),!!r}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return r("end");if(i.tryLoc<=this.prev){var s=n.call(i,"catchLoc"),c=n.call(i,"finallyLoc");if(s&&c){if(this.prev<i.catchLoc)return r(i.catchLoc,!0);if(this.prev<i.finallyLoc)return r(i.finallyLoc)}else if(s){if(this.prev<i.catchLoc)return r(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return r(i.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=t,i?(this.method="next",this.next=i.finallyLoc,d):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),d},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),I(n),d}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;I(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:S(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),d}},e}function B(e,t,n,r,o,i,a){try{var s=e[i](a),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,o)}function F(e){return function(e){if(Array.isArray(e))return W(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||V(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function H(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=V(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){s=!0,i=e},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw i}}}}function V(e,t){if(e){if("string"==typeof e)return W(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?W(e,t):void 0}}function W(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function q(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function G(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?q(Object(n),!0).forEach((function(t){z(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):q(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function z(e,t,n){return(t=function(e){var t=function(e,t){if("object"!==M(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==M(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===M(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function K(e,t,n,r,o,i,s){var c=window.__pt.settings.site,u=this,d=window.__pt.fn,p=".slider-gallery-view",v=window.__pt.hotel||{},g=window.__pt.settings,y=window.innerWidth||document.documentElement.clientWidth,w=window.__pt.settings.rb||!1,b=window.__pt.box||{},S=window.__pt.place||{},T=window.__pt.placeContainer||{},C=window.__pt.ln||{},x=window.__pt.user||null,D={},R=!0,O=null,A=null,L=new P.Z,M=L.getUserKey(i),V=L.getUserKeyFavorites(i),W=!!x,q="#price-modal-info",z=[" Special Price."," Precio Especial.","Precio especial"],K=d.search(),J={},Q=new l,Z=null,X=null,ee=d.mobileAndTabletCheck(),te="",ne={checkIn:b.checkIn,checkOut:b.checkOut},re=new _.Z,oe=new N,ie={checkInDate:null,checkOutDate:null,placeId:T.id,adultQuantity:0,kidQuantity:0,hotelId:v.hotelId,stepId:3};u.roomsTotal=K.rooms||0;var ae={checkin:b.checkIn,checkout:b.checkOut,hotelid:v.hotelId,CampaignToken:O,source:b.source?b.source:"SPA-Hotel-List",ispackage:!1,site:c.domain,rooms:2,promotions:K.promotions?K.promotions.split(","):null},se=[];u.customLimit=0,u.RAPDObject={totalSticky:0,totalHasTaxSticky:!1,totalImpSticky:0},u.defaultHotel=g.defaultHotel,u.checkIn=b.checkIn,u.checkOut=b.checkOut,u._isLogin=W,u.dateConfig=g.formatDateSlash,u.dateConfigbook=g.formatDateSlashBook,u.configPrefix=g.site.sufix,u.mealplans=C.mealplans,u.lnMessages=C,u.hotel=v,u.rooms=[],u.availableRooms=[],u.unavailableRooms=[],u.reviewsLoadingModal=!0,u.gallery=[],u.grid=[],u.isTrivagoModal=!1,u.modalRapdCurrentData=null,u.getRecomedationLabelSticky="",u.currentRoom=null,u.cheaperRoomRate={messages:"",disabled:!0,loading:!0},u.code=c.code,u.boxData={rooms:0,nights:0,totalPax:0},u.assigRateSet={},u.assigRoomRateModal={},u.isTrivagoRate=!!K.room_search,u.listReviews={},u.showDetailScoreReviews=!1,u.sliderIsInit=!1,u.loading=!0,u.toggleDescription=!0,u.toggleDescriptionAbout=!0,u.averageDetailToggle=!1,u.phoneBase=c.phoneDefault||"",u.currency=c.currencySymbol||"",u.roomsLimit=c.limitRoomsRates||0,u.ratesLimit=c.limitRates||0,u.roomsAvailables=0,u.limitRoomsFilter=u.roomsLimit,u.roomRateMobileSelected={},u.source_origin="",u.mealplanCodesList=[],u.sizeDescriptionString=c.hotelAboutConfigIdeal,u.responsePayment={fixedPayments:[],monthInterestFree:[]},u.TitleModalRAPD="",u.dateRAPDSticky="",u.isCancelation=!1,u.selectModalRoom=0,u.totalSticky=0,u.totalPromoDiscount=0,u.totalImpSticky=0,u.totalRoomSticky=0,u.viewDetailSticky=!1,u.totalHasTaxSticky=!1,u.datesRecommended=[],u.pageError={has:!1,type:null},u.responseroomsAvailables=[],u.monthInterestData={},u.ratesResponse={rooms:[]},u.sumTotalSticky=0,u.ratesResponse={},u.onSubmitLoading=!1,u.onSubmitLoadingRecomendation=!1,u.hasCancellationFree=!1,u.hasPayLater=!1,u.isBlockRAPD=!1,u.RateForRAPD={},u.roomsForRAPD="",u.headTabs={rooms:"#rooms",amenities:"#amenities",map:"#location",current:""},u.featuredRoom={},u.isRequote=!1,u.boxData={rooms:0,nights:0,totalPax:0},u.roomDelTrivago={},u.indexRoomTrivago=-1,u.recommendedDates=null,u.sourceTriGooHotelsIds=!1,u.isMsiAvailable=!1,u.msiMonthsAllow=[],u.notAmount=!1,u.notMessage=!1;u.isRAPDRecomendation=!1,u.hasErrorHandle=!1,u.rateModal={},u.roomModal={totalRooms:0},u.roomIndexModal={},u.isGoSection=!1;var ce=new I.Z(c.domainAPIUrl);u.alertsFavorites={notificationSuccess:!1,notificationError:!1,notificationWarning:!1,message:"",actionType:""},u.favoriteHotels=[],u.showTimer=!1;var le,ue,de,he=null;u.sourceOrigen="",u.filteredServices=(le=u.hotel.services,ue=le&&le.filter((function(e){return!0===e.hasExtraCharge})),de=le&&le.filter((function(e){return!1===e.hasExtraCharge})),{servicesHasCharge:ue,servicesNotHasCharge:de}),u.visibleServicesCount=9,u.visibleSInfoHotelCount=2,u.toggleDescription=!1,u.toggleServices=!1,u.stickyRates=[],u.totalTotalSticky=0,u.isRecomendationCheckout=!1,u.recomendationsList={loading:!0,rooms:[],checkoutHash:[]},u.recomendationsListCopy={rooms:[]},u.showStickyHeader=!1,u.quantityLoop=0;var pe=window.__pt.ln,fe={};function me(e){return e.reduce((function(e,t){return e.adults+=t.adults,e.children=e.children.concat(t.children.map((function(e){return{year:e}}))),e.rooms+=1,e}),{adults:0,children:[],rooms:0})}function ve(){J=function(){for(var e=b.pax&&b.pax.length,t={adults:0,children:0,paxesFormat:[]},n=0;b.pax&&n<e;n++){var r=b.pax[n],o="";t.adults+=r.adults,o+="".concat(r.adults),r.children&&r.children.length&&(o+="|",t.children+=r.children.length,o+="".concat(r.children.map((function(e){return e.year})).join(","))),t.paxesFormat.push(o)}return t}(),u.gallery=u.hotel.gallery,u.rooms=u.hotel.rooms,c.showReviews&&!g.rb&&(u.reviewsLoadingModal=!0,u.getReviews(u.hotel.hotelId,!1)),Ue()}function ge(e){var t=e.adults;return e.children&&e.children.length>0&&(t+=e.children.length),t}function ye(){x&&x.firebaseId?O=c.campaignTokenUser:Ue(),u.loading=!0,u.hasCancellationFree=!1,u.hasPayLater=!1,u.roomsAvailables=0,u.recommendedDates=null,u.checkIn=ae.checkin,u.checkOut=ae.checkout,ae.rooms=fe.paxesFormat,ae.CampaignToken=O,ae.userKey=M,ae.mobile=ee,ae.login=W,ae.responseTimeout=2e4,ae.source=b.source?b.source:"SPA-Hotel-List",ae.channelId=ee?c.chkSourceMobile:c.chkSourceDesktop,u.datesRecommended=[],setTimeout((function(){if("true"==K.isFromDateRecommended){var e=G({paxes:u.defaultHotel.paxes,checkIn:new Date("".concat(u.checkIn,"T00:00:00")),checkOut:new Date("".concat(u.checkOut,"T00:00:00"))},ae);K.isFromDateRecommended=!1,o.$broadcast(g.bookerSearchEvent,e)}}),100),t.get(u.appicableExperiment?c.endPoints.detailQuoteUrlFam:c.endPoints.detailQuoteUrl,{params:ae,headers:(0,f.w)()}).then(ke,(function(e){Ce(),Be(e)}))}function we(){if(!g.rb){var e=G({},ae);e.rooms=fe.paxesFormat,e.userKey=null,e.CampaignToken=null,e.login=!W,t.get(u.appicableExperiment?c.endPoints.detailQuoteUrlFam:c.endPoints.detailQuoteUrl,{params:e,headers:(0,f.w)()}).then(Ee,(function(e){}))}}function be(e){u.totalSticky=0,u.totalImpSticky=0,u.totalRoomSticky=0,u.totalPromoDiscount=0,u.totalTotalSticky=0,u.imgSticky="";var t=d.getDate(ae.checkin),n=d.getDate(ae.checkout),r=d.diffBetweenDays(t,n),o=0,i=0;u.totalHasTaxSticky=!1,u.getRecomedationLabelSticky="",u.sumTotalSticky=0,u.applicableRAPDSticky=!0,u.applicableMonthsIntereses=!0,u.dateRAPDSticky="",u.isCancelation=!1;var a,s=H(e);try{for(s.s();!(a=s.n()).done;){var c=a.value;if(c.selectedRoomValue){u.totalRoomSticky+=c.selectedRoomValue,u.totalSticky+=c.taxes.totalRoomRatePerNight*c.selectedRoomValue,u.totalTotalSticky+=c.taxes.totalRoomRate*c.selectedRoomValue,u.totalHasTaxSticky=c.taxes.hasTaxes,c.taxes.totalTaxesPerRoomPerNight>0&&(u.totalImpSticky+=c.taxes.totalTaxes*c.selectedRoomValue),u.imgSticky=c.img,u.isDiscount=c.taxes.discount,u.totalPromoDiscount+=c.taxes.totalRoomRateBeforePromoExclusive*c.selectedRoomValue;var l=c.paxFam.split("|"),h=l[0]?parseInt(l[0]):0,p=l[1]?parseInt(l[1].split(",").length):0;o+=h*c.selectedRoomValue,i+=p*c.selectedRoomValue,2==c.collectType&&(u.applicableMonthsIntereses=!1),!u.isBlockRAPD&&c.bookNowPayLaterTimeLimit&&c.isBookNowPayLaterApplicable&&2!=c.collectType?(u.dateRAPDSticky=c.bookNowPayLaterTimeLimit,u.isCancelation=!c.isNonRefundable&&c.cancellationPolicies.freeCancellationExpire):u.applicableRAPDSticky=!1}}}catch(e){s.e(e)}finally{s.f()}var f=1==r?pe.night:pe.nights,m=1==o?pe.adult:pe.adults,v=i>0?", ".concat(i," ").concat(1==i?pe.child:pe.children):"";if(u.sumTotalSticky=o+i,u.getRecomedationLabelSticky="".concat(r," ").concat(f,", ").concat(o," ").concat(m).concat(v),u.stickyRates&&u.stickyRates.length>0){var g,y=0,w=0,b=H(u.rooms);try{for(b.s();!(g=b.n()).done;){var k,_=H(g.value.rate.rate);try{for(_.s();!(k=_.n()).done;){var E=k.value;y+=E.selectedRoomValue||0,w+=E.selectedRoomValue&&0!=E.selectedRoomValue?1:0}}catch(e){_.e(e)}finally{_.f()}}}catch(e){b.e(e)}finally{b.f()}var I,P=8-y,S=H(u.rooms);try{var T=function(){var e=I.value;e.rate.rate.forEach((function(t,n){t.roomsSelectection=Array.from({length:t.selectedRoomValue>0?1==w?9:t.selectedRoomValue+1+P:P+1},(function(t,n){return{value:n,selected:n<=e.selectedRoomValue,title:n<=1?pe.room:pe.rooms,total:0,selectable:n>e.selectedRoomValue||0===e.selectedRoomValue}}))}))};for(S.s();!(I=S.n()).done;)T()}catch(e){S.e(e)}finally{S.f()}}else{!1?document.body.classList.add("modal-open"):document.body.classList.remove("modal-open");var C,x=H(u.rooms);try{for(x.s();!(C=x.n()).done;){var D,R;null===(D=C.value.rate)||void 0===D||null===(R=D.rate)||void 0===R||R.forEach((function(e,t){e.roomsSelectection=Array.from({length:9},(function(e,t){return{value:t,selected:!0,title:t<=1?pe.room:pe.rooms,total:0}}))}))}}catch(e){x.e(e)}finally{x.f()}}}function ke(e){var n;e.data.isBlockHotel&&e.data.channel>0&&(n=e.data.channel,c.chkSourceMobile=n.desktop.channelId,c.chkSourceDesktop=n.desktop.channelId,c.chkSourceGroupMobile=n.desktop.channelGroupId,c.chkSourceGroupDesktop=n.desktop.channelGroupId);e.data.rooms;var r=m(b.pax);if(u.isRequote=!1,Se(ae,r),0===e.data.rooms.length){r=m(b.pax,!0,!0);var o=d.clone(ae);o.rooms=r.paxesFormat,Se(o,r),t.get(u.appicableExperiment?c.endPoints.detailQuoteUrlFam:c.endPoints.detailQuoteUrl,{params:o,headers:(0,f.w)()}).then(Pe,Be)}else De(e)}function _e(e){var t=G(G(G({},b),v),J);re.metricDatesRecommended("show_suggested_dates",{data:t});var n=c.culture.split("-")[0],r=e.data;r.forEach((function(e){var t,r,o,i=k(e.checkin,n),a=k(e.checkout,n),s=(t=e.checkin,r=e.checkout,o=new Date(t),(new Date(r)-o)/864e5);e.checkinDayOfWeek=i.dayOfWeek,e.checkinDayAndMonth=i.dayAndMonth,e.checkoutDayOfWeek=a.dayOfWeek,e.checkoutDayAndMonth=a.dayAndMonth,e.dateDifference=s})),u.datesRecommended=r}function Ee(e){se=e.data.rooms,u.rooms.length&&Ie()}function Ie(){for(var e=W?-1:1,t=function(){var t=u.rooms[n],r=se.find((function(e){return""+e.roomId==""+t.roomId}));if(r&&t.rate)for(var o=function(){var n,o=t.rate.rate[i];if(n=r.rate.find((function(e){return e.rateId===o.rateId&&e.paxFam==o.paxFam}))){var a=(o.taxes.totalRoomRate-n.taxes.totalRoomRate)*e;(100*a/o.taxes.totalRoomRate>2||a>=50)&&!u.notMessage&&(o.total_saved=a)}},i=0;i<t.rate.rate.length;i++)o()},n=0;n<u.rooms.length;n++)t()}function Pe(e){if(!e.data.rooms.length){var n=new Date(ae.checkin),r={site:ae.site,mobile:ae.mobile,hotelId:ae.hotelid,year:n.getFullYear(),month:n.getMonth()+1,type:"json",checkin:ae.checkin,checkout:ae.checkout};t.get(c.endPoints.dateRecommended,{params:r,headers:(0,f.w)()}).then(_e,(function(e){}))}var o=m(b.pax,!0,!0);e.data.isRequote=!0,u.isRequote=!0,b.pax=o.paxesFormat,De(e)}function Se(e,t){var n=d.getDate(e.checkin),r=d.getDate(e.checkout),o=d.diffBetweenDays(n,r),i=e.rooms.length,a=t.adults+t.children;u.boxData={rooms:i,nights:o,totalPax:a}}function Te(){ie.adultQuantity=fe.adults,ie.kidQuantity=fe.children,ie.checkInDate=ne.checkIn,ie.checkOutDate=ne.checkOut,t.get(c.endPoints.skillBaseUrl,{params:ie}).then(Ne)}function Ce(){var e={rid:v.rooms.map((function(e){return e.roomId})),checkin:ne.checkIn,checkout:ne.checkOut,p:fe.paxesFormat.map((function(e){var t=e.split("|"),n=t[0],r=t.length>1?t[1].split(",").join("_"):"";return"".concat(n).concat(r?"_":"").concat(r)}))};t.get(c.endPoints.availabilityReasonsUrl,{params:e}).then(Me,Fe)}function xe(e){var t=e.data;u.recomendationsTrivago=t.rooms||u.recomendationsTrivago;for(var n=v.gallery.find((function(e){return e&&e.cloudUri&&e.cloudUri.includes(".jpg")}))||{},r=v.rooms.length,o=[],i=0;i<r;i++){var a=v.rooms[i],s=d.findObject(u.recomendationsTrivago,"roomId",a.roomId);if(s){var c=angular.copy(a);c.instructions="",c.capacityList=Array.from({length:c.capacity},(function(e,t){return t})),c.picture.cloudUri=c.picture.cloudUri||n.cloudUri,c.rate=s,o.push(c)}}u.recomendationsTrivago=o,u.recomendationsTrivago.loading=!1;var l=K.room_search||null;if(u.recomendationsTrivago.length>0&&l&&u.isTrivagoRate){var h=l.split("|").length<2?l.split("%"):l.split("|"),p=u.recomendationsTrivago.findIndex((function(e){return e.roomId==h[0]}));if(-1==p)u.isTrivagoRate=!1;else{var f=-1!=p?u.recomendationsTrivago[p].rate.rate.findIndex((function(e){return e.rateId==h[1]})):null;if(-1==f||null==f)u.isTrivagoRate=!1;else{var m=JSON.stringify(u.recomendationsTrivago);(m=(m=JSON.parse(m))[p]).rate.rate=m.rate.rate.filter((function(e){return e.rateId==h[1]})),m.rate.rate.selectedRoomValue=1,u.featuredRoom=m,setTimeout((function(){u.goSection("roomSection",320)}),500)}}}}function De(e){var t=e.data;u.recomendationsList=t.recomendations||u.recomendationsList;for(var n=v.gallery.find((function(e){return e&&e.cloudUri&&e.cloudUri.includes(".jpg")}))||{},o=v.rooms.length,i=[],s=0;s<o;s++){var c=v.rooms[s],l=d.findObject(u.recomendationsList.rooms,"roomId",c.roomId);if(l){var h=angular.copy(c);h.instructions="",h.capacityList=Array.from({length:h.capacity},(function(e,t){return t})),h.picture.cloudUri=h.picture.cloudUri||n.cloudUri,h.rate=l,i.push(h)}}u.recomendationsList.rooms=i;var p=Object.values(u.recomendationsList.rooms).every((function(e){var t=e.rate.rate;return!(!(t&&t.bookNowPayLaterTimeLimit&&t.isBookNowPayLaterApplicable)||u.isBlockRAPD||2==t.collectType)}));u.isRAPDRecomendation=p,Ce(),u.loading=!1,u.recomendationsList.loading=!1,u.ratesResponse=t,u.cheaperRoomRate=function(e){var t={messages:"",disabled:!0,loading:!1},n=K.room_search||null;if(n&&u.isTrivagoRate){var r=n.split("|").length<2?n.split("%"):n.split("|"),o=e.filter((function(e){return e.roomId==r[0]})),i=o&&o.length>0?o[0].rate.filter((function(e){return e.rateId==r[1]})):null;(t=i&&i.length>0?i[0]:e[0].rate[0]).disabled=!1,t.loading=!1}else e&&e.length&&e[0].rate&&e[0].rate.length&&((t=e[0].rate[0]).disabled=!1,t.loading=!1);return t}(u.ratesResponse.rooms);for(var f=v.rooms.length,m=new Set,g=0;g<f;g++){var y=v.rooms[g],b=d.findObject(u.ratesResponse.rooms,"roomId",y.roomId);if(y.instructions="",y.capacityList=Array.from(Array(y.capacity).keys()),y.picture.cloudUri=y.picture.cloudUri||n.cloudUri,b){y.recommended=b.recommended,y.recommendedRate=b.recommendedRate,y.recommendedRates=b.recommendedRates,u.roomsAvailables+=1,y.instructions=b.rate[0].externalSalesAdvisory||"",b.rate[0].selected=!0,$e(b);var k=Re(b.rate[0]);y.expedia=k.expedia,y.derbysoft=k.derbysoft,y.hotelbeds=k.hotelbeds,y.synxis=k.synxis,y.isRateSelectedMobile=!0,y.limitRoom=u.ratesLimit;var _,E=H(b.rate);try{for(E.s();!(_=E.n()).done;){var I=_.value;I.selectedRoomValue=0,I.roomsSelectection=Array.from({length:9},(function(e,t){return{value:t,selected:!0,title:t<=1?pe.room:pe.rooms,total:0}}))}}catch(e){E.e(e)}finally{E.f()}y.showMoreRate=!1,y.roomRateMobileSelected=b.rate[0]}else b={rate:[],disabled:!0},y.isRateSelectedMobile=!1,y.roomRateMobileSelected={};y.rate=b;var P,S=H(b.rate);try{for(S.s();!(P=S.n()).done;){var T=P.value;m.add(T.mealPlanCode)}}catch(e){S.e(e)}finally{S.f()}y.limitOriginal=y.rate.rate.length}u.isMsiAvailable=!(t.isMsiAvailable&&t.isMsiAvailableMonths.length>0),u.msiMonthsAllow=t.isMsiAvailableMonths,u.isGoSection&&setTimeout((function(){u.goSection("recomendations",350)}),500);var x=function(e,t){var n=e.rate.lessRate,r=t.rate.lessRate,o=void 0!==n&&!e.rate.disabled,i=void 0!==r&&!t.rate.disabled;return o&&!i?-1:!o&&i?1:o&&i?n-r:0},D=function(e){return e.rate.rate.some((function(e){return e.paxFam==fe.paxesFormat[0]}))},R=G({},v),A=R.rooms.filter(D),L=R.rooms.filter((function(e){return!D(e)}));A.sort(x),L.sort(x),R.rooms=[].concat(F(A),F(L)),v.rooms=R.rooms,u.rooms=v.rooms,u.isBlockRAPD=t.isBlockRAPD,t.campaignToken&&t.campaignToken.length&&r.search("ctInternal",t.campaignToken),u.customLimit=w?2:u.rooms.length,O=t.campaignToken;var N=K.room_search||null;if(u.rooms.length>0&&N&&u.isTrivagoRate){var M=N.split("|").length<2?N.split("%"):N.split("|"),j=u.rooms.findIndex((function(e){return e.roomId==M[0]}));if(-1==j)u.isTrivagoRate=!1;else{var U=-1!=j?u.rooms[j].rate.rate.findIndex((function(e){return e.rateId==M[1]})):null;if(-1==U||null==U)u.isTrivagoRate=!1;else{var B=JSON.stringify(u.rooms);(B=(B=JSON.parse(B))[j]).rate.rate=B.rate.rate.filter((function(e){return e.rateId==M[1]})),B.rate.rate.selectedRoomValue=1,u.featuredRoom=B,-1!=U&&-1!=j&&(u.rooms[j].rate.rate.length>1?u.rooms[j].rate.rate.splice(U,1):(u.roomDelTrivago=u.rooms[j],u.rooms.splice(j,1),u.indexRoomTrivago=j)),setTimeout((function(){u.goSection("highligth_rooms",320)}),500)}}}(Z=new a(fe.paxes,u.responseroomsAvailables,u.rooms)).initialLayers(u.ratesResponse),Z.unavailableHotel(X,fe.paxesFormat),u.availableRooms.length>0&&Z.viewItemListTB([v]),We("hotel_price"),se.length&&Ie();var $=new Map;u.rooms.forEach((function(e){var t=new Set;e.rate.rate.forEach((function(e){var n=e.mealPlanCode;if(!t.has(n))if(t.add(n),$.has(n))$.get(n).count+=1;else{var r=u.mealplans[n];$.set(n,{mealPlanCode:n,mealPlan:r,count:1,selected:!1})}}))})),u.mealplanCodesList=Array.from($.values());var V=u.mealplanCodesList.reduce((function(e,t){return e+t.count}),0);u.mealplanCodesList.unshift({mealPlanCode:"",mealPlan:C.all_options,count:V,selected:!0})}function Re(e){var t={expedia:"",derbysoft:"",hotelbeds:"",synxis:""};return 4==e.provider?t.expedia=".":97==e.provider?t.derbysoft=".":100==e.provider?t.hotelbeds=".":130==e.provider&&(t.synxis="."),t}u.lengthPaxes=ge(b.pax),u.paxFam=fe,u.applicableRAPDSticky=!1,u.appicableExperiment=y>=992,u.getFavoriteHotelDetails=function(){return u.favoriteHotels.find((function(e){return e.hotelId===u.hotel.hotelId&&e.checkin===b.checkIn&&e.checkout===b.checkOut&&angular.equals(me(e.rooms),b.pax)}))},u.updateHotelsState=function(){var e=u.getFavoriteHotelDetails();e?(u.hotel.isFavorite=!0,u.hotel.favoriteDetails=e):(u.hotel.isFavorite=!1,u.hotel.favoriteDetails=null)},u.addFavorites=function(t){t.preventDefault(),t.stopPropagation();var n=function(e){for(var t=e.adults,n=e.children,r=e.rooms,o=Math.floor(t/r),i=t%r,a=Math.floor(n.length/r),s=n.length%r,c=[],l=0,u=0;u<r;u++){for(var d=o+(u<i?1:0),h=a+(u<s?1:0),p=[],f=0;f<h;f++)p.push({year:n[l].year}),l++;c.push({adults:d,children:p})}return c}(b.pax),r={hotelId:v.hotelId,userId:V,uri:S.uri,site:c.domain,channel:ee?c.chkSourceMobile:c.chkSourceDesktop,originalPrice:u.cheaperRoomRate.disabled?0:u.cheaperRoomRate.taxes.totalRoomRatePerNight,checkin:b.checkIn,checkout:b.checkOut,rooms:n.map((function(e){return{adults:e.adults,children:e.children.map((function(e){return e.year}))}})),campaignToken:O||"",placeId:T.id,placeUri:T.uri,placeType:T.type,placeName:T.displayText,isMobile:ee};if(u.hotel.isFavorite){var o=u.getFavoriteId(v.favoriteDetails.id,b.checkIn,b.checkOut);o&&ce.removeHotel({Id:o,UserId:V}).then((function(t){e.$applyAsync((function(){u.favoriteHotels=u.favoriteHotels.filter((function(e){return!(e.hotelId===v.hotelId&&e.checkin===b.checkIn&&e.checkout===b.checkOut&&angular.equals(me(e.rooms),b.pax))}));var e=G(G({},r),{},{id:o,name:v.name});oe.logDeleteFav(e,"details"),u.updateHotelsState(),u.showNotification("error",v.name,"delete")}))})).catch((function(t){e.$applyAsync((function(){u.showNotification("error",t)}))}))}else ce.addHotel(r).then((function(t){e.$applyAsync((function(){if(t.value){var e=G(G({},r),{},{id:t.value,name:v.name});u.favoriteHotels.push(e),oe.logAddFav(e,"details"),u.updateHotelsState(),u.showNotification("success",v.name,"save")}else u.showNotification("warning","","")}))})).catch((function(t){e.$applyAsync((function(){u.showNotification("error",t)}))}))},u.showNotification=function(e,t,n){he&&s.cancel(he),u.showTimer=!1,s((function(){u.showTimer=!0})),u.alertsFavorites.notificationSuccess="success"===e,u.alertsFavorites.notificationError="error"===e,u.alertsFavorites.notificationWarning="warning"===e,u.alertsFavorites.message=t,u.alertsFavorites.actionType=n,he=s((function(){u.alertsFavorites.notificationSuccess=!1,u.alertsFavorites.notificationError=!1,u.alertsFavorites.notificationWarning=!1,u.alertsFavorites.message="",u.alertsFavorites.actionType=""}),6e3)},u.getFavoriteId=function(e,t,n){var r=u.favoriteHotels.find((function(r){return r.id===e&&r.checkin===t&&r.checkout===n&&angular.equals(me(r.rooms),b.pax)}));return r?r.id:null},u.isFavoriteHotel=function(){return u.favoriteHotels.some((function(e){return e.hotelId===v.hotelId&&e.checkin===b.checkIn&&e.checkout===b.checkOut&&angular.equals(me(e.rooms),b.pax)}))},o.$on(g.bookerChangeEvent,(function(e,t){u.recomendationsList={loading:!0,rooms:[],checkoutHash:[]},u.recomendationsListCopy={rooms:[]},u.hasErrorHandle=!1,se=[],u.isTrivagoRate=!1,b.pax=t.paxes,ae.checkin=d.formatDate(t.checkIn,g.formatDate),ae.checkout=d.formatDate(t.checkOut,g.formatDate),b.checkIn=ae.checkin,b.checkOut=ae.checkout,u.updateHotelsState(),fe=m(b.pax),u.lengthPaxes=ge(b.pax),d.clone(b),u.paxFam=fe,ve(),u.stickyRates=[],u.isGoSection=!0,ye(),u.notMessage||we(),""==c.sufix&&Te()})),u.setRecomedationLabel=function(){var e=1==u.recomendationsList.totalRooms?pe.room:pe.rooms,t=1==fe.paxes.adults?pe.adult:pe.adults,n=1==fe.paxes.children.length?pe.child:pe.children,r=fe.paxes.children.length>0?", ".concat(fe.paxes.children.length," ").concat(n):"";return"".concat(u.recomendationsList.totalRooms," ").concat(e," ").concat(pe.for," ").concat(fe.paxes.adults," ").concat(t).concat(r)},u.setRecomendationMetas=function(){var e=1==u.roomsTotal?pe.room:pe.rooms,t=1==fe.paxes.adults?pe.adult:pe.adults,n=1==fe.paxes.children.length?pe.child:pe.children,r=fe.paxes.children.length>0?", ".concat(fe.paxes.children.length," ").concat(n):"";return"".concat(u.roomsTotal," ").concat(e," ").concat(pe.for," ").concat(fe.paxes.adults," ").concat(t).concat(r)},u.getIsPaxesDefined=function(){return 2==fe.paxes.adults&&0==fe.paxes.children.length},u.getRoom=function(e){return"".concat(1==e?pe.room:pe.rooms)},u.getTitleStickyDetail=function(e,t){if(ne){var n=e.split("|"),r=n[0]*t.selectedRoomValue==1?pe.adult:pe.adults;if(n[1]?n[1].split(",").length*t.selectedRoomValue:""){var o=n[1].split(",").length*t.selectedRoomValue==1?pe.child:pe.children;return"".concat(n[0]*t.selectedRoomValue," ").concat(r,", ").concat(n[1].split(",").length*t.selectedRoomValue," ").concat(o)}return"".concat(n[0]*t.selectedRoomValue," ").concat(r)}},u.getNumDistri=function(e,t){if(e){var n=e.split("|"),r=1==n[0]?pe.adult:pe.adults;if(n.length>1){var o=1==n[1].split(",").length?pe.child:pe.children;return t?"".concat(n[0]," ").concat(r):"".concat(n[1].split(",").length," ").concat(o)}return t?"".concat(n[0]," ").concat(r):0}},u.getTitleRecomendedPax=function(e){if(e){var t=e.split("|"),n=1==t[0]?pe.adult:pe.adults;if(t.length>1){var r=1==t[1].split(",").length?pe.minore:pe.minores;return"".concat(t[0]," ").concat(n,", ").concat(t[1].split(",").length," ").concat(r)}return"".concat(t[0]," ").concat(n)}},u.getNumDistriToltip=function(e){var t=e.split("|"),n=(1==t[0]?pe.adult:pe.adults,t[1]?t[1].split(",").join(", "):"");if(n){1==t[1].length?pe.child:pe.children;return"(".concat(n," años)")}},u.getNumDistriMovil=function(e,t){if(e){var n=e.split("|");return n.length>1?t?parseInt(n[0]):parseInt(n[1].split(",").length):t?parseInt(n[0]):0}},u.getNumDistriToltipMovil=function(e){var t=e.split("|"),n=1==t[0]?pe.adult:pe.adults,r=t[1]?t[1].split(",").join(", "):"";if(r){var o=1==t[1].split(",").length?pe.child:pe.children;return"".concat(t[0]," ").concat(n," y ").concat(t[1].split(",").length," ").concat(o," (de ").concat(r," años)")}return"".concat(t[0]," ").concat(n)},u.getRecomendationTitlePax=function(e){var t=e.split("|"),n=fe.paxes.rooms>1?"".concat(pe.fora," ").concat(pe.room):"";if(t.length>1){var r=1==t[0]?pe.adult:pe.adults,o=1==t[1].split(",").length?pe.child:pe.children;return"".concat(pe.for," ").concat(t[0]," ").concat(r,",  ").concat(t[1].split(",").length," ").concat(o," ").concat(n)}var i=1==t[0]?pe.adult:pe.adults;return"".concat(pe.for," ").concat(t[0]," ").concat(i," ").concat(n)},u.titlePax=function(){var e=1==u.recomendationsList.totalRooms?pe.room:pe.rooms,t=d.getDate(ae.checkin),n=d.getDate(ae.checkout),r=d.diffBetweenDays(t,n),o=1==r?pe.night:pe.nights;return"".concat(u.recomendationsList.totalRooms," ").concat(e,", ").concat(r," ").concat(o," ")},u.titlePaxMeta=function(){var e=1==u.roomsTotal?pe.room:pe.rooms,t=d.getDate(ae.checkin),n=d.getDate(ae.checkout),r=d.diffBetweenDays(t,n),o=1==r?pe.night:pe.nights;return"".concat(u.roomsTotal," ").concat(e,", ").concat(r," ").concat(o," ")},u.getTitleSticky=function(){var e=1==u.getNights()?pe.night:pe.nights;return"".concat(u.totalRoomSticky," ").concat(u.totalRoomSticky>1?pe.rooms:pe.room,", ").concat(u.getNights()," ").concat(e)},u.getNights=function(){var e=d.getDate(ae.checkin),t=d.getDate(ae.checkout);return d.diffBetweenDays(e,t)},u.getTitleModalRAPD=function(e){if(e){var t=fe.paxes.adults+fe.children;return"".concat(pe.total," ").concat(u.recomendationsList.totalRooms," ").concat(u.recomendationsList.totalRooms>1?pe.rooms:pe.room,", ").concat(t," ").concat(t>1?pe.persons:pe.person,":")}return"".concat(pe.total," ").concat(u.totalRoomSticky," ").concat(u.totalRoomSticky>1?pe.rooms:pe.room,", ").concat(u.sumTotalSticky," ").concat(u.sumTotalSticky>1?pe.persons:pe.person,":")},u.getRecomendationTitleTotal=function(){var e=1==fe.paxes.adults?pe.adult:pe.adults,t=fe.children>0?", ".concat(fe.children," ").concat(1==fe.children?pe.child:pe.children):"",n=d.getDate(ae.checkin),r=d.getDate(ae.checkout),o=d.diffBetweenDays(n,r),i=1==o?pe.night:pe.nights;return"".concat(o," ").concat(i,", ").concat(fe.paxes.adults," ").concat(e).concat(t)},u.asigRateModal=function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};u.assigRateSet=e,u.selectModalRoom=null!==(t=u.assigRateSet.selectedRoomValue)&&void 0!==t?t:0,u.assigRoomRateModal=n},u.showModal=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";$("#".concat(e)).modal("show"),"modal-payform"!=e&&"modal-contact"!=e||Q.selectContent(t,n)},u.showModalReviews=function(e,t){var n=new Object;n.calf=u.listReviews.ratings.guest.overall,n.calfDesc=u.getOverallText(Math.round(u.listReviews.ratings.guest.overall)),n.content_type="link","galery"==t?n.elementText="reviews_header":(t="detail")&&(n.elementText="reviews_content"),Z.selectedReviews(n),u.getReviews(u.hotel.hotelId,!0),$("#".concat(e)).modal("show")},u.eventSetReviews=function(){u.showDetailScoreReviews=!u.showDetailScoreReviews;var e=new Object;e.calf=u.listReviews.ratings.guest.overall,e.calfDesc=u.getOverallText(Math.round(u.listReviews.ratings.guest.overall)),e.elementText="reviews_scoredetail",e.content_type="button",Z.selectedReviews(e)},u.showModalRAPD=function(e,t,n,r){var o=arguments.length>4&&void 0!==arguments[4]&&arguments[4];t&&(u.rateModal=t,u.roomModal=n,u.roomModal.totalRooms=fe.paxes.rooms,u.roomIndexModal=r,u.isTrivagoModal=o),$("#".concat(e)).modal("show")},u.showModalRAPDFam=function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(u.isTrivagoModal=!1,0!=u.stickyRates||t)if(u.hasErrorHandle=!1,u.modalRapdCurrentData=null,u.RAPDObject={totalSticky:0,totalHasTaxSticky:!1,totalImpSticky:0,totalTotalSticky:0},t){var n=0,r=0,o=Object.values(u.recomendationsList.rooms).every((function(e){var t=e.rate.rate,o=t.paxFam.split("|"),i=o[0]?parseInt(o[0]):0,a=o[1]?parseInt(o[1].split(",").length):0;return n+=i,r+=a,!(!(t&&t.bookNowPayLaterTimeLimit&&t.isBookNowPayLaterApplicable)||u.isBlockRAPD||2==t.collectType)&&(u.dateRAPDSticky=t.bookNowPayLaterTimeLimit,!0)}));if(o&&e){var i=d.getDate(ae.checkin),a=d.getDate(ae.checkout),s=d.diffBetweenDays(i,a),c=1==s?pe.night:pe.nights,l=1==n?pe.adult:pe.adults,h=r>0?", ".concat(r," ").concat(1==r?pe.child:pe.children):"";u.sumTotalSticky=n+r,u.getRecomedationLabelSticky="".concat(s," ").concat(c,", ").concat(n," ").concat(l).concat(h),u.isRecomendationCheckout=!0,u.applicableRAPDSticky=!0,u.RAPDObject.totalSticky=u.recomendationsList.totalRoomRatePerNight,u.RAPDObject.totalHasTaxSticky=u.recomendationsList.hasTaxes,u.RAPDObject.totalImpSticky=u.recomendationsList.totalTaxesPerRoomPerNight,u.RAPDObject.totalTotalSticky=u.recomendationsList.totalRoomRate;var p=fe.paxes.adults+fe.children;u.RAPDObject.TotalPersons=p,u.RAPDObject.TotalRooms=u.recomendationsList.totalRooms,u.TitleModalRAPD=u.getTitleModalRAPD(t),$("#".concat(e)).modal("show")}else u.applicableRAPDSticky=!1,u.onSubmit(null,null,null,!1,t)}else u.applicableRAPDSticky&&e?(u.isRecomendationCheckout=!1,u.RAPDObject.totalSticky=u.totalSticky,u.RAPDObject.totalHasTaxSticky=u.totalHasTaxSticky,u.RAPDObject.totalImpSticky=u.totalImpSticky,u.RAPDObject.TotalPersons=u.sumTotalSticky,u.RAPDObject.totalTotalSticky=u.totalTotalSticky,u.RAPDObject.TotalRooms=u.totalRoomSticky,u.TitleModalRAPD=u.getTitleModalRAPD(!1),$("#".concat(e)).modal("show")):u.onSubmit(null,null,null,!1,!1);else u.hasErrorHandle=!0},u.showModalShared=function(e){$("#".concat(e)).modal("show")},u.showAmenitiesModal=function(e,t){u.showModal(e),u.currentRoom=t},u.showInclusiveModal=function(e){u.showModal(e)},u.onClosed=function(e){$("#".concat(e)).modal("hide")},u.lazyLoadImage=function(e,t){var n=e.isVisible,r=e.element;r.style.backgroundImage=n?"url(".concat(t,")"):r.style.backgroundImage},u.openSlider=function(e,t){u.showModal(e),$("#".concat(e)).on("shown.bs.modal",(function(){u.sliderIsInit||($(p).slick({lazyLoad:"ondemand",slickSetOption:!0,initialSlide:t}),$(p).css("opacity",1),u.sliderIsInit=!0)})),u.sliderIsInit&&$(p).slick("slickGoTo",t)},u.renderMap=function(){var e=u;new Promise((function(e,t){"undefined"!=typeof google&&google.maps||document.querySelector('script[src*="maps.googleapis.com/maps/api/js"]')?e():d.getScript(c.endPoints.googleMapsApi,"",(function(){"undefined"!=typeof google&&google.maps?e():t(new Error("Failed to load Google Maps API"))}))})).then((function(){var t=document.getElementById("map");if(t&&e.hotel&&e.hotel.location&&void 0!==e.hotel.location.latitude&&void 0!==e.hotel.location.longitude){var n={lat:+e.hotel.location.latitude,lng:+e.hotel.location.longitude},r=new google.maps.Map(t,{center:n,zoom:13});r.setOptions({styles:Y});var o=new google.maps.Marker({position:n,map:r,title:e.hotel.name});d.mobileAndTabletCheck()&&function(e,t){var n=document.createElement("div");n.style.position="absolute",n.style.top="60px",n.style.width="40px",n.style.height="40px",n.style.backgroundColor="white",n.style.borderRadius="50%",n.style.display="flex",n.style.justifyContent="center",n.style.alignItems="center",n.style.left="88vw";var r=document.createElement("img");r.style.width="30px",r.style.height="30px",r.style.cursor="pointer",r.src="".concat(c.cloudCdn,"/assets/img/current_position.svg"),n.appendChild(r),t.controls[e].push(n),n.addEventListener("click",(function(){navigator.geolocation?navigator.geolocation.getCurrentPosition((function(e){var n={lat:e.coords.latitude,lng:e.coords.longitude};new google.maps.Marker({position:n,map:t,icon:{url:"".concat(c.cloudCdn,"/assets/img/point.png"),scaledSize:new google.maps.Size(25,25)}}),t.setCenter(n)}),(function(e){switch(e.code){case e.PERMISSION_DENIED:console.log("El usuario denegó la solicitud de geolocalización.");break;case e.POSITION_UNAVAILABLE:console.log("La información de ubicación no está disponible.");break;case e.TIMEOUT:console.log("Se ha agotado el tiempo de espera para obtener la ubicación del usuario.");break;case e.UNKNOWN_ERROR:console.log("Se produjo un error desconocido al obtener la ubicación del usuario.")}})):console.log("El navegador no soporta la geolocalización.")}))}(google.maps.ControlPosition.RIGHT_TOP,r);var i=new google.maps.InfoWindow,a=function(e){var t,n,r=null===(t=$(q).get(0))||void 0===t?void 0:t.outerHTML,o=null===(n=$(".stars-div").get(0))||void 0===n?void 0:n.outerHTML;if(r&&o)return r=r.replace("h6","font-weight-bold").replace("h3","h5"),'<p class="h5 mt-4"> '.concat(e.getTitle(),' </p> \n            <div class="d-flex justify-content-between align-items-start flex-column flex-md-row" style="gap: 20px;">\n                ').concat(o,"\n                ").concat(r,"\n            </div>");return'<p class="h5 mt-4"> '.concat(v.name,' </p> \n\n        <div class="d-flex justify-content-between align-items-start flex-column flex-md-row" style="gap: 20px;"> \n\n            <div class="d-flex align-items-center h4 text-warning mb-0 stars-div"><i class="icons-star"></i><i class="icons-star"></i></div> \n\n        </div> \n\n        <p class="hotel-heading-price-current skeleton-secondary h6 text-right text-pink  mt-2"> \n\n            ').concat(u.rooms[0].unavailableStatus.messages.title1,"\n        </p>")}(o);o.addListener("click",(function(){i.close(),i.setContent(a),i.open(o.getMap(),o)})),r.addListener("tilesloaded",(function(){qe(r,18,r.getZoom()),google.maps.event.clearListeners(r,"tilesloaded"),setTimeout((function(){i.close(),i.setContent(a),i.open(o.getMap(),o)}),1e3)}))}})).catch((function(){}))},u.sendContentFooter=function(e){Q.clickLink("footer :: ".concat(e))},u.showMoreRooms=function(){(R=!R)?(Z.selectedFilter("Ver todas las habitaciones"),u.limitRoomsFilter=u.roomsLimit):u.limitRoomsFilter=u.roomsAvailables},u.sharedBy=function(e){console.log(c.uriShared);var n={Key:""};n.Url=window.location.pathname+window.location.search+"&utm_source="+(e||"copy_link")+"&utm_medium=social&utm_campaign=share_hotel",t.get(c.uriShared,{params:n}).then((function(t){Oe(t,e)}),Le)},u.onSelectDate=function(e){var t=e.checkin,n=e.checkout;u.defaultHotel.checkIn=new Date("".concat(t,"T00:00:00")),u.defaultHotel.checkOut=new Date("".concat(n,"T00:00:00")),ae.CampaignToken=O,ae.userKey=M,ae.mobile=ee,ae.login=W,ae.responseTimeout=2e4,ae.source=b.source?b.source:"SPA-Hotel-List",ae.channelId=ee?c.chkSourceMobile:c.chkSourceDesktop,ae.checkin=t,ae.checkout=n,b.checkIn=t,b.checkOut=n,u.datesRecommended=[];var r=G({paxes:fe.paxes,checkIn:new Date("".concat(t,"T00:00:00")),checkOut:new Date("".concat(n,"T00:00:00"))},ae);o.$broadcast(g.bookerSearchEvent,r),(0,E.bs)(u.defaultHotel.checkIn,u.defaultHotel.checkOut)},u.handleClick=function(){var e=G(G(G({},b),v),J);void 0!==re&&"function"==typeof re.metricDatesRecommended&&re.metricDatesRecommended("click_suggested_dates",{data:e});var t=document.getElementById("rooms").getBoundingClientRect().top+window.pageYOffset;window.scrollTo({top:t-250,behavior:"smooth"})},u.isSubmitOrRAPD=function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];t.bookNowPayLaterTimeLimit&&t.isBookNowPayLaterApplicable&&!u.isBlockRAPD&&2!=t.collectType?u.showModalRAPD("modal-rapd-mini",t,e,n,r):u.onSubmit(e,t,n,!1,!1,!0)},u.onSubmit=function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],o=arguments.length>4&&void 0!==arguments[4]&&arguments[4],i=arguments.length>5&&void 0!==arguments[5]&&arguments[5],a=[];i?a=fe.paxesFormat:o||u.isRecomendationCheckout?(u.onSubmitLoadingRecomendation=!0,u.recomendationsList.checkoutHash.forEach((function(e){a.push(e.paxFam)}))):(u.onSubmitLoading=!0,u.stickyRates.forEach((function(e){var t=e.paxFam.split("|"),n=e.selectedRoomValue,r=parseInt(t)*n,o="";t[1]&&t[1].length>0&&(o=Array.from({length:n},(function(){return t[1]})).flat().join(","));var i=o&&""!=o?r.toString()+"|"+o:r.toString();a.push(i)})));var s=d.mapPaxToUrlNew(a,!0,!0),l=He(),h=[];i?h.push({idRate:t.rateId,idRoom:e.roomId,promotionValue:t.promotionValue,totalRoomRatePerNight:t.taxes.totalRoomRatePerNight,name:e.name,mealPlanCode:t.mealPlanCode,totalAmount:t.totalAmount,checkoutHash:t.checkoutHash,isBookNowPayLater:r,rooms:fe.paxes.rooms,pax:t.paxFam,index:n,provider:t.provider}):o||u.isRecomendationCheckout?u.recomendationsList.checkoutHash.forEach((function(e,t){h.push({idRate:e.rateId,idRoom:e.roomId,promotionValue:e.promotionValue,totalRoomRatePerNight:e.taxes.totalRoomRatePerNight,name:e.name,mealPlanCode:e.mealPlanCode,totalAmount:e.totalAmount,checkoutHash:e.checkoutHash,isBookNowPayLater:r,rooms:1,pax:e.paxFam,index:t+1,provider:e.provider})})):u.stickyRates.forEach((function(e,t){h.push({idRate:e.rateId,idRoom:e.roomId,promotionValue:e.promotionValue,totalRoomRatePerNight:e.taxes.totalRoomRatePerNight,name:e.name,mealPlanCode:e.mealPlanCode,totalAmount:e.totalAmount,checkoutHash:e.checkoutHash,isBookNowPayLater:r,rooms:e.selectedRoomValue,pax:e.paxFam,index:t+1,provider:e.provider})}));var p={idHotel:v.hotelId,hotelCheckIn:b.checkIn,CheckIn:b.checkIn,CheckOut:b.checkOut,Source:c.source,ChkSource:ee?c.chkSourceMobile:c.chkSourceDesktop,isBookNowPayLater:r,index:1,pageUrl:window.location.pathname+window.location.search,isMetaSearchEngine:""!==u.source_origin,Amount:i?t.totalAmount:o||u.isRecomendationCheckout?u.recomendationsList.totalRoomRatePerNight:u.totalSticky,useNewConfig:!0,applicable:i,promotions:ae.promotions};p=G(G(G(G({},p),s),l),{},{site:g.site.siteName});var f=document.createElement("form");for(var m in f.setAttribute("method","POST"),f.setAttribute("action","".concat(c.checkoutUrl)),Ge(p),p)if(null!=p[m]){var y=document.createElement("input");y.setAttribute("type","hidden"),y.setAttribute("name",m),y.setAttribute("value",p[m]),f.appendChild(y)}h.map((function(e,t){for(var n in e){var r=document.createElement("input");r.setAttribute("type","hidden"),r.setAttribute("name","roomList[".concat(t,"][").concat(n,"]")),r.setAttribute("value",e[n]),f.appendChild(r)}}));var w=G({},p);Z.setUserInteraction(r),Z.setAddToCart(w,h),Z.beginCheckOutTB(w,h),$("#loader-page").removeClass("d-none"),document.body.appendChild(f),f.submit()},u.getReviews=function(e,n){u.reviewsLoadingModal=!0;var r={};r.PropertyId=e,r.Language=c.cultureReviews,r.IsReviews=n,t.get(c.expediaReviewsURL,{params:r}).then((function(e){!function(e){var t=e.data;if(null!=t.verified){var n=e.data.verified.recent.sort((function(e,t){return new Date(t.date_submitted).getTime()-new Date(e.date_submitted).getTime()})),r=n.filter((function(e){return""==e.text&&""==e.title}));n=(n=n.filter((function(e){return""!=e.text||""!=e.title}))).concat(r),t.verified.recent=n}null!=t.ratings&&setTimeout((function(){!function(e){$(".condition").css({width:10*e.ratings.guest.condition+"%"}),$(".cleanliness").css({width:10*e.ratings.guest.cleanliness+"%"}),$(".service").css({width:10*e.ratings.guest.service+"%"}),$(".comfort").css({width:10*e.ratings.guest.comfort+"%"}),$(".amenities").css({width:10*e.ratings.guest.amenities+"%"}),$(".neighborhood").css({width:10*e.ratings.guest.neighborhood+"%"})}(t)}),300);u.reviewsLoadingModal=!1,u.listReviews=t}(e)}),Le)},u.getOverallText=function(e){return C.rating_reviews[e]},u.getStart=function(e){for(var t="",n=0;n<5;n++)t+=e>n?e-n==.5?"<i class='bi bi-star-half'></i>":"<i class='bi bi-star-fill'></i>":"";return t},u.goSection=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:45,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:100,r=document.getElementById("".concat(e));r&&r.scrollIntoView?setTimeout((function(){r.scrollIntoView({behavior:"smooth"})}),n):$("html, body").scrollTop($("#".concat(e)).offset().top-t)},u.goSectCloseModal=function(e,t){$("#".concat(e)).modal("hide"),u.goSection(t)},u.showSpecialPrice=function(e){return!(!e||0===Object.keys(e).length)&&(e.promotionValue&&z.includes(e.promotionValue)||z.includes(e.promotion)&&!e.bookingDates&&!e.travelDates)},u.setLimitRoom=function(){if(u.ratesResponse&&u.ratesResponse.rooms&&u.ratesResponse.rooms.length>0){var e=u.ratesResponse.rooms.length;if(u.roomsAvailables=e,e<5)return u.showMoreRoomsButton=!1,e;if(e>=5)return u.showMoreRoomsButton=e>u.limitRoomsFilter,Math.min(e,u.limitRoomsFilter)}return u.showMoreRoomsButton=!1,1},u.getShowPromotion=function(e){var t=c.promotionKeyShow;if(t){var n=e?t.find((function(t){return t.key==e.promotionType})):"";if(n)return n.blackFAndHotS}return!1},u.onSelectRecommenderDate=function(e,t){e.preventDefault(),e.stopPropagation(),Z.selectDateSuggested(t);var n=window.location.href.split("?"),r=d.searchUri(n[1]);r.checkin=t.CheckIn,r.checkout=t.CheckOut;var o=d.objectToQueryParams(r);window.location.href=n[0]+"?"+o},u.selectRateMobile=function(e,t,n){u.rooms[t].rate.rate.forEach((function(e){e.selected=!1})),u.rooms[t].rate.rate[n].selected=!!u.rooms[t].rate.rate[n].selected||!u.rooms[t].rate.rate[n].selected,u.rooms[t].roomRateMobileSelected=e},u.toggleDropdown=function(e){e.showDron=!e.showDron},u.selectedRateRoom=function(e,t,n){if(u.hasErrorHandle=!1,e.selectedRoomValue=t.value,0!==t.value){var r=u.stickyRates.findIndex((function(t){return t.rateId===e.rateId&&t.paxFam===e.paxFam}));-1!==r?u.stickyRates[r].selectedRoomValue=t.value:(e.name=n.name,e.roomId=n.roomId,e.img=n.picture.cloudUri,u.stickyRates.push(e))}else{var o=u.stickyRates.findIndex((function(t){return t.rateId===e.rateId&&t.paxFam===e.paxFam}));-1!==o&&u.stickyRates.splice(o,1)}},u.incrementQuantity=function(e){if(e.selectedRoomValue+1<e.roomsSelectection){var t=u.stickyRates.findIndex((function(t){return t.rateId===e.rateId&&t.paxFam===e.paxFam}));return-1!==t&&(u.stickyRates[t].selectedRoomValue+=1),e.selectedRoomValue+=1}},u.decrementQuantity=function(e,t){var n=u.stickyRates.findIndex((function(t){return t.rateId===e.rateId&&t.paxFam===e.paxFam}));return e.selectedRoomValue-1==0?(-1!==n&&u.stickyRates.splice(n,1),e.selectedRoomValue=0):(-1!==n&&(u.stickyRates[n].selectedRoomValue-=1),e.selectedRoomValue-=1)},u.setValueModalRoom=function(e){u.selectModalRoom=e,u.assigRateSet.roomsSelectection.forEach((function(e){e.active=!1,e.value==u.selectModalRoom&&(e.active=!0)}))},u.deleteStickyDetail=function(e){var t=u.stickyRates.findIndex((function(t){return t.rateId===e.rateId&&t.paxFam===e.paxFam}));if(-1!==t){u.stickyRates.splice(t,1);var n=u.rooms.find((function(t){return t.roomId===e.roomId}));if(n&&n.rate){var r=n.rate.rate.findIndex((function(t){return t.rateId===e.rateId&&t.paxFam===e.paxFam}));-1!==r&&(n.rate.rate[r].selectedRoomValue=0)}}},u.selectedRateRoomModal=function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if((t=0===Object.keys(n).length?u.rooms.find((function(t){return t.roomId===e.roomId})):n)&&t.rate){var r=t.rate.rate.findIndex((function(t){return t.rateId===e.rateId&&t.paxFam===e.paxFam}));if(-1!==r){var o=u.selectModalRoom,i=u.stickyRates.findIndex((function(t){return t.rateId===e.rateId&&t.paxFam===e.paxFam}));if(t.rate.rate[r].selectedRoomValue=o,-1!==i){if(u.stickyRates[i].selectedRoomValue=o,0===u.selectModalRoom){var a=u.stickyRates.indexOf(t.rate.rate[r]);-1!==a&&u.stickyRates.splice(a,1)}}else if(0!==o){t.rate.rate[r].name=n.name,t.rate.rate[r].roomId=n.roomId;var s=angular.copy(t.rate.rate[r]);u.stickyRates.push(s)}}}},e.$watch("vm.stickyRates",(function(e,t){angular.equals(e,t)||be(e)}),!0),e.$watch("vm.stickyRates",(function(e,t){angular.equals(e,t)||be(e)}),!0),u.cloneRate=function(e){return angular.copy(e)},u.onBlur=function(e){s((function(){e.showDron=!1}))};var Oe=function(){var e=function(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var i=e.apply(t,n);function a(e){B(i,r,o,a,s,"next",e)}function s(e){B(i,r,o,a,s,"throw",e)}a(void 0)}))}}(U().mark((function e(t,n){var r,o;return U().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(te=t.data.key,t.data.url,"facebook"!==n){e.next=6;break}window.open(c.uriFacebook+c.siteUrl+"/r?data="+te),e.next=21;break;case 6:if("whatsapp"!==n){e.next=10;break}window.open(c.uriwhatsapp+c.siteUrl+"/r?data="+te),e.next=21;break;case 10:return r=document.querySelector("body"),o=document.createElement("textarea"),r.appendChild(o),o.value=c.siteUrl+"/r?data="+te,o.select(),document.execCommand("copy"),r.removeChild(o),$(".copied-link").show("fast"),e.next=20,d.sleep(1500);case 20:$(".copied-link").hide("fast");case 21:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}();function Ae(e){var t=e.data||[];u.monthInterestData=t.monthInterestFree;var n=(t.monthInterestFree?t.monthInterestFree.options:[]).reduce((function(e,t){var n=Math.max.apply(Math,F(t.paymentPlans));return e[n]||(e[n]=[]),e[n].push(t),e}),{}),r=Object.entries(n).sort((function(e,t){var n=j(e,1)[0],r=j(t,1)[0];return Number(r)-Number(n)})),o={fixedPayments:t.fixedPayments.map((function(e){return e.options})).reduce((function(e,t){return e.concat(t)}),[]),monthInterestFree:r,quotasPayments:t.quotasPayments?t.quotasPayments.options:[],otherPayments:t.otherPayments?t.otherPayments.options:[],loading:!1,title:t.quotasPayments?t.quotasPayments.title:"",maxmsi:t.monthInterestFree?t.monthInterestFree.title:""};u.responsePayment=o}function Le(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;u.pageError.has=!0,u.pageError.type=t,u.loading=!1,u.reviewsLoadingModal=!1}function Ne(e){var t=e.data;"200 - OK"==t.message&&(D=t.result,u.phoneBase=D.did,$("#header-phonebase").attr("href","tel:".concat(u.phoneBase)),$(".skillbase_p").text(n("tel")(u.phoneBase)))}function Me(e){for(var n=e.data,r=n&&n.length?n:[],o=0;o<u.rooms.length;o++){var i=u.rooms[o],a=d.findObject(r,"roomId",i.roomId);u.rooms[o].unavailableStatus=Ve(a)}r.length&&(X=r[0].availabilityStatus),u.responseroomsAvailables=n,u.isRequote||u.ratesResponse.rooms.length||!c.recommenderDatesActive||function(e){var n={roomID:u.rooms[0].roomId,availabilityStatus:"None",availabilityValue:"",explanation:"No known problems"},r={checkIn:b.checkIn,checkOut:b.checkOut,availabilityReasons:e.length?e:[n],idHotel:v.hotelId,channelId:c.channelFac,token:ae.CampaignToken?ae.CampaignToken:"",adults:J.adults,kids:J.children,providerId:1,placeIdDestination:S.placeId,kidsAge:ze()};t.post(c.endPoints.recommenderDatesUrl,r).then(je,X)}(r)}function je(e){e.data&&"OK"===e.data.status&&(v.checkIn=b.checkIn,v.checkOut=b.checkOut,u.recommendedDates=e.data.message)}function Ue(){var e=K.campaignTokenApi||K.CampaignTokenApi||K.campaigntokenapi||null;O=K.CampaignToken||K.campaignToken||e,A=K.CampaignId||K.campaignid||null,x&&x.firebaseId&&(O=c.campaignTokenUser)}function Be(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;u.pageError.has=!0,u.pageError.type=t,u.recomendationsList={loading:!0,rooms:[]},u.recomendationsListCopy={rooms:[]},u.recomendationsList.loading=!1,u.loading=!1,u.cheaperRoomRate.loading=!1,u.rooms=u.rooms.map((function(e){return e.rate={disabled:!0},e})),We("hotel_price")}function Fe(e){u.rooms=u.rooms.map((function(e){return e.unavailableStatus=Ve(null),e}))}function $e(e){for(var t=e.rate.length,n=0;n<t;n++){var r=e.rate[n];r.paymentNow=!1,u.hasCancellationFree||(u.hasCancellationFree=!r.isNonRefundable),!u.hasPayLater&&r.isBookNowPayLaterApplicable&&(u.hasPayLater=r.isBookNowPayLaterApplicable)}}function He(){return{CampaignToken:O,CampaignId:A}}function Ve(e){var t=C.availabilityMessages;try{if(!e)return{explanation:"",availabilityValue:"",availabilityStatus:"None",messages:t.none};var n=e.availabilityStatus.toLocaleLowerCase();if("roomcapacity"==n&&b&&b.pax){var r=JSON.parse(e.availabilityValue);n=b.pax.some((function(e){return e.adults+e.children.length>r.Max}))?"peoplemax":b.pax.some((function(e){return e.adults>r.A}))?"adultsmax":b.pax.some((function(e){return e.children.length>r.K}))?r.K<1?"kidszero":"kidsmax":"peoplemax"}var o=G(G({},e),{},{messages:t["".concat(n)]});return"none"!=n&&(o.messages.title2=o.messages.title2.replace("{{days}}",+e.availabilityValue||t.defaults[n])),o}catch(e){return{explanation:"",availabilityValue:"",availabilityStatus:"None",messages:t.none}}}function We(e){var t=$(".".concat(e));t.length&&t.remove()}function qe(e,t,n){if(!(n>=t)){var r=google.maps.event.addListener(e,"zoom_changed",(function(o){google.maps.event.removeListener(r),qe(e,t,n+1)}));setTimeout((function(){e.setZoom(n)}),80)}}function Ge(e){window.sessionStorage&&sessionStorage.setItem(g.checkoutData,JSON.stringify(e))}function ze(){return b.pax[0].children.map((function(e){return e.year})).join(",")}u.getPathToList=function(){var e=r.search();e.checkout||e.checkin||(e.checkout=b.checkOut,e.checkin=b.checkIn),v.hotelId&&(e.profileId=v.hotelId.toString());var t="";if(T)t=c.siteUrl+c.pathHoteles+T.uri+"?"+$.param(e);else{var n=v.location.state;n&&(n=(n=n.normalize("NFD").replace(/[^a-zA-Z0-9 ]/g,"")).replace(/\s+/g,"-").toLowerCase()),t=c.siteUrl+c.pathHoteles+n+"?"+$.param(e)}return t},function(){u.recomendationsList={loading:!0,rooms:[]},u.recomendationsListCopy={rooms:[]},u.notAmount=!!c.hotelsTagLogin&&c.hotelsTagLogin.listA.includes(v.hotelId),u.notMessage=!!c.hotelsTagLogin&&c.hotelsTagLogin.listB.includes(v.hotelId);var n=K.source||null;d.setCookie("source_origin",n,"1"),u.source_origin=d.getCookie("source_origin");var r,o=K.coupon,a=d.getCookie("codept"),s=o||a;d.setCookie("codept",s,"1"),(c.hotelsIdsPR?c.hotelsIdsPR.find((function(e){return e==v.hotelId})):-1)>-1&&(u.sourceTriGooHotelsIds=!0),d.clone(b),ve(),fe=m(b.pax),u.isGoSection=!1,u.source_origin&&function(){x&&x.firebaseId?O=c.campaignTokenUser:Ue();u.loading=!0,u.recomendationsList.loading=!0,u.hasCancellationFree=!1,u.hasPayLater=!1,u.roomsAvailables=0,u.recommendedDates=null,u.checkIn=ae.checkin,u.checkOut=ae.checkout;var e=G({},ae);e.rooms=function(){for(var e=d.search(),t=+e.rooms,n=[],r=0;r<t;r++){var o=r+1,i={adults:+(e["room".concat(o,".adults")]||2),children:[]},a=e["room".concat(o,".agekids")];if(a)for(var s=a.split(","),c=0;c<s.length;c++)i.children.push({year:+s[c]||0});n.push(i)}return function(e){for(var t=e&&e.length,n={adults:0,children:0,paxesFormat:[]},r=0;e&&r<t;r++){var o=e[r],i="";n.adults+=o.adults,i+="".concat(o.adults),o.children&&o.children.length&&(n.children+=o.children.length,i+="|".concat(o.children.map((function(e){return e.year})).join(","))),n.paxesFormat.push(i)}return n}(n)}().paxesFormat,e.CampaignToken=O,e.userKey=M,e.mobile=ee,e.login=W,e.responseTimeout=2e4,e.source=b.source?b.source:"SPA-Hotel-List",e.channelId=ee?c.chkSourceMobile:c.chkSourceDesktop,t.get(c.endPoints.detailQuoteUrl,{params:e,headers:(0,f.w)()}).then(xe,(function(e){Be(e)}))}(),ye(),r={UserId:V,country:c.country.toUpperCase()},ce.getHotelsByUser(r).then((function(t){e.$applyAsync((function(){u.favoriteHotels=t.value,u.updateHotelsState()}))})).catch((function(e){console.error("Error fetching hotels by user:",e)})),u.notMessage||we(),g.rb||(""==c.sufix&&Te(),function(){if(u.responsePayment.fixedPayments.length||u.responsePayment.monthInterestFree.length)return;var e={channel:c.channel,language:c.culture,currency:c.currency};t.get(c.endPoints.paymentMethodUrl,{params:e}).then(Ae)}(),$(window).scroll((function(){var e=$(window).scrollTop(),t=$("#container-detail").offset();t&&(t.top<e?$("#searchbox").addClass("sticky"):$("#searchbox").removeClass("sticky"))})),function(){if(u.hotel.description){if(u.hotel.description.length<=u.sizeDescriptionString)return void(u.hotel.shortDescription=u.hotel.description);u.hotel.description=u.hotel.description?u.hotel.description.split("\n").map((function(e){return"\r"==e?"<p></p>":e})).join(""):u.hotel.description,u.hotel.shortDescription=u.hotel.description.substring(0,u.sizeDescriptionString)+" ..."}}(),$(window).on("scroll",(function(){d.isInViewport(u.headTabs.amenities)?u.headTabs.current=u.headTabs.amenities:d.isInViewport(u.headTabs.rooms,295)?u.headTabs.current=u.headTabs.rooms:d.isInViewport(u.headTabs.map)?u.headTabs.current=u.headTabs.map:u.headTabs.current="",e.$apply()})),u.grid=function(e){for(var t=e.map((function(e,t){return h(h({},e),{},{idx:t})})),n=[],r=[],o=0;o<t.length;o+=4){var i=t.slice(o,o+4);n.push(i)}for(var a,s,c=0,l=n;c<l.length;c++)for(var u=l[c],d=0;d<u.length;d++)r.push({classname:"grid-item ".concat((a=d,s=void 0,s="",0===a&&(s="tall"),1===a&&(s=""),2===a&&(s="wide"),3===a&&(s=""),s)),uri:u[d].cloudUri,index:u[d].idx});return r}(u.gallery),function(e){var t=i.get(g.recentDestinations)||[],n=t.findIndex((function(e){return e.place.id==S.id}));if(n>-1){var r=t[n];r.box=b,r.campaignTokenApi=O,t.splice(n,1),t.unshift(r)}else t.unshift({box:b,place:S,IdG:e.hotelId,campaignTokenApi:O,title:C.hotel_lang,icon:c.cloudCdn+"/assets/img/Hotel_icon.svg",origin:"H",image:e.gallery&&e.gallery.length>0?e.gallery[0].cloudUri:e.gallery[0]||""});t.length>g.limitDestinations&&(t=t.slice(0,g.limitDestinations));i.set(g.recentDestinations,t)}(v))}()}window.app.controller("DetailController",K),K.$inject=["$scope","$http","$filter","$location","$rootScope","localStorageService","$timeout"];var Y=[{featureType:"poi.business",stylers:[{visibility:"off"}]}]})(),(()=>{"use strict";var e=n(291),t=n(4943),r=n(694);function o(e){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o(e)}function i(){i=function(){return e};var e={},t=Object.prototype,n=t.hasOwnProperty,r=Object.defineProperty||function(e,t,n){e[t]=n.value},a="function"==typeof Symbol?Symbol:{},s=a.iterator||"@@iterator",c=a.asyncIterator||"@@asyncIterator",l=a.toStringTag||"@@toStringTag";function u(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,n){return e[t]=n}}function d(e,t,n,o){var i=t&&t.prototype instanceof f?t:f,a=Object.create(i.prototype),s=new T(o||[]);return r(a,"_invoke",{value:E(e,n,s)}),a}function h(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=d;var p={};function f(){}function m(){}function v(){}var g={};u(g,s,(function(){return this}));var y=Object.getPrototypeOf,w=y&&y(y(C([])));w&&w!==t&&n.call(w,s)&&(g=w);var b=v.prototype=f.prototype=Object.create(g);function k(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function _(e,t){function i(r,a,s,c){var l=h(e[r],e,a);if("throw"!==l.type){var u=l.arg,d=u.value;return d&&"object"==o(d)&&n.call(d,"__await")?t.resolve(d.__await).then((function(e){i("next",e,s,c)}),(function(e){i("throw",e,s,c)})):t.resolve(d).then((function(e){u.value=e,s(u)}),(function(e){return i("throw",e,s,c)}))}c(l.arg)}var a;r(this,"_invoke",{value:function(e,n){function r(){return new t((function(t,r){i(e,n,t,r)}))}return a=a?a.then(r,r):r()}})}function E(e,t,n){var r="suspendedStart";return function(o,i){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===o)throw i;return x()}for(n.method=o,n.arg=i;;){var a=n.delegate;if(a){var s=I(a,n);if(s){if(s===p)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var c=h(e,t,n);if("normal"===c.type){if(r=n.done?"completed":"suspendedYield",c.arg===p)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(r="completed",n.method="throw",n.arg=c.arg)}}}function I(e,t){var n=t.method,r=e.iterator[n];if(void 0===r)return t.delegate=null,"throw"===n&&e.iterator.return&&(t.method="return",t.arg=void 0,I(e,t),"throw"===t.method)||"return"!==n&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+n+"' method")),p;var o=h(r,e.iterator,t.arg);if("throw"===o.type)return t.method="throw",t.arg=o.arg,t.delegate=null,p;var i=o.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,p):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,p)}function P(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function S(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function T(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(P,this),this.reset(!0)}function C(e){if(e){var t=e[s];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,o=function t(){for(;++r<e.length;)if(n.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t};return o.next=o}}return{next:x}}function x(){return{value:void 0,done:!0}}return m.prototype=v,r(b,"constructor",{value:v,configurable:!0}),r(v,"constructor",{value:m,configurable:!0}),m.displayName=u(v,l,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===m||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,v):(e.__proto__=v,u(e,l,"GeneratorFunction")),e.prototype=Object.create(b),e},e.awrap=function(e){return{__await:e}},k(_.prototype),u(_.prototype,c,(function(){return this})),e.AsyncIterator=_,e.async=function(t,n,r,o,i){void 0===i&&(i=Promise);var a=new _(d(t,n,r,o),i);return e.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},k(b),u(b,l,"Generator"),u(b,s,(function(){return this})),u(b,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},e.values=C,T.prototype={constructor:T,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(S),!e)for(var t in this)"t"===t.charAt(0)&&n.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(n,r){return a.type="throw",a.arg=e,t.next=n,r&&(t.method="next",t.arg=void 0),!!r}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return r("end");if(i.tryLoc<=this.prev){var s=n.call(i,"catchLoc"),c=n.call(i,"finallyLoc");if(s&&c){if(this.prev<i.catchLoc)return r(i.catchLoc,!0);if(this.prev<i.finallyLoc)return r(i.finallyLoc)}else if(s){if(this.prev<i.catchLoc)return r(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return r(i.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=t,i?(this.method="next",this.next=i.finallyLoc,p):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),p},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),S(n),p}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;S(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:C(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),p}},e}function a(e,t,n,r,o,i,a){try{var s=e[i](a),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,o)}function s(n,o,s,c,l,u,d){var h=this,p=window.__pt.settings.site,f=window.__pt.settings,m=window.__pt.ln,v=window.__pt.fn,g=v.getDate(),y=window.__pt.place||{},w={},b=null,k=window.__pt.box||null,_=new r.Z,E={formatMobile:f.formatBoxDateMobile,firstDay:0,applyLabel:m.ok,cancelLabel:m.cancel},I={},P={};h.submit=!1,h.years=[],h.suggestion={paxes:!1},h.dataCopyCancel=f.defaultHotel,h.validation={paxes:!0,checkIn:!0,checkOut:!0,dates:!0},h.settingPaxes={minAdults:1,maxAdults:8,minChildren:0,maxChildren:6,minAge:0,maxAge:17,rooms:8};var S={weeksPrequote:0,daysPrequote:0,startDate:0};function T(){v.mobileAndTabletCheck()?(S.weeksPrequote=p.configDaysPrequoteMobile.weeksPrequote,S.daysPrequote=p.configDaysPrequoteMobile.daysPrequote,S.startDate=p.configDaysPrequoteMobile.startDate):(S.weeksPrequote=p.configDaysPrequoteDesktop.weeksPrequote,S.daysPrequote=p.configDaysPrequoteDesktop.daysPrequote,S.startDate=p.configDaysPrequoteDesktop.startDate);var e=new Date(g);e.setDate(e.getDate()+7*S.weeksPrequote),e.setDate(e.getDate()-e.getDay()+S.startDate),h.data.checkIn=C(e),h.data.checkOut=C(e,S.daysPrequote)}function C(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:v.getDate(),t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=v.getDate(v.formatDate(e,f.formatDate));return n.setDate(n.getDate()+t),n}function x(){var e,t,n=h.data.paxes.rooms;e=h.data.paxes.adults,t=h.data.paxes.children.length;var r=1==n?m.room:m.rooms,o=1==e?m.adult:m.adults,i=1==t?m.child:m.children,a="";t>0&&(a=" ".concat(t," ").concat(i,", ")),h.data.paxes_name="".concat(e," ").concat(o,",").concat(a," ").concat(n," ").concat(r),h.data.paxes_people="".concat(e+t," ").concat(m.new_pers," ").concat(n," ").concat(m.new_room),h.data.capacityTotal=e+t}function D(e,t){for(var n=!0,r=(e.rooms,e.children.length),o=0;o<r;o++){if(t["children_".concat(o)].$invalid){n=!1;break}}return n}function D(e,t){for(var n=!0,r=e.length,o=0;o<r;o++){for(var i=e[o].children.length,a=0;a<i;a++){var s=t["children_".concat(o,"_").concat(a)];if(s&&s.$invalid){n=!1;break}}if(!n)break}return n}function R(e){"paxes"==e&&(h.validation.paxes=D(h.data.paxes,h.form2))}function O(){if(h.data&&h.data.paxes){var e=h.data.paxes.children;if(e&&e.length>0&&e.some((function(e){return null===e.year||void 0===e.year})))return!0}return!1}function A(e){window.innerWidth<=479?"auto"==e?document.body.classList.remove("modal-open"):"hidden"==e&&document.body.classList.add("modal-open"):document.body.classList.remove("modal-open")}h.data=f.defaultHotel,h.display=!0,h.onSubmit=function(e){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=(0,t.Uo)(),o=r.checkin,i=r.checkout;o&&i&&!n&&(h.data.checkIn=o,h.data.checkOut=i),(0,t.UK)(),h.validation.paxes=D(h.data.paxes,e),e.$valid&&h.validation.paxes?(h.data.typeEvent="habitaciones",d.$broadcast(f.bookerSearchEvent,h.data),h.form2.$pristine=!1,h.form2.$dirty=!1,h.form2.$submitted=!1):h.validation.paxes||(h.suggestion.paxes=!0)},d.$on(f.bookerSearchEventSmall,(function(e,t){h.data.paxes=t.paxes,h.data.checkIn=t.checkIn,h.data.checkOut=t.checkOut,b.setDateRange(h.data.checkIn,h.data.checkOut),x()})),h.showPaxes=function(){h.suggestion.paxes=!0,h.dataCopyCancel=angular.copy(h.data),A("hidden")},h.addRoom=function(){if(h.settingPaxes.rooms>h.data.paxes.length){var e=v.clone(f.defaultPaxes);h.data.paxes.push(e),x()}},h.onFocus=function(e,t){h.suggestion[e].results.length&&setTimeout((function(){n.$apply((function(){var n;h.suggestion[e].show=!0,v.mobileAndTabletCheck()&&(n="".concat(t,"_modal"),setTimeout((function(){var e=n&&document.getElementById(n);e&&e.focus()}),200))}))}),250)},h.removePax=function(e,t){h.data.paxes[e]-1>=t&&(h.data.paxes[e]-=1),x()},h.addPax=function(e,t){h.data.paxes[e]+1<=t&&(h.data.paxes[e]+=1),x()},h.removeChildren=function(e,t){h.data.paxes[e].length-1>=t&&h.data.paxes[e].splice(h.data.paxes[e].length-1,1),x()},h.addChildren=function(e,t){h.data.paxes[e].length+1<=t&&h.data.paxes[e].push({year:null}),x()},h.addRoom=function(e){h.settingPaxes.rooms<=h.data.paxes[e]||(h.data.paxes[e]+=1,x())},h.removeRoom=function(e){h.data.paxes[e]+1>2&&(h.data.paxes[e]-=1),x()},h.onClose=function(e,t){O()?h.form2.$setSubmitted():(A("auto"),e[t]=!1,R(t))},h.onCloseCancel=function(e,t){h.data=h.dataCopyCancel,e[t]=!1,R(t),A("auto")},h.onCloseSubmitForm=function(e,t){O()||h.form2.$invalid?h.form2.$setSubmitted():(A("auto"),h.placeInputHasFocus=!1,e[t]=!1,h.onSubmit(h.form2))},h.onRemove=function(e,t,n){e[t].splice(n,1),x()},h.hasError=function(e,t){var n=e[t];return e.$submitted&&n.$invalid},h.onClickOutside=function(e,t){A("auto"),h.placeInputHasFocus=!1,e[t]=!1,R(t),h.placeInputHasFocus=!1},h.showBooker=function(){h.display=!h.display},h.isInvalidInput=function(e,t,n){return e.$submitted&&e["".concat(t,"_").concat(n)].$invalid};var L=function(){var t=function(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var i=e.apply(t,n);function s(e){a(i,r,o,s,c,"next",e)}function c(e){a(i,r,o,s,c,"throw",e)}s(void 0)}))}}(i().mark((function t(){var n,r,o,a;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!p.showCalendarAvailability){t.next=14;break}if(!(n=h.data.place_selected)||14!=n.type||!n.code&&!n.id){t.next=14;break}t.t0=i().keys(P);case 4:if((t.t1=t.t0()).done){t.next=13;break}return r=t.t1.value,o=r.split("_"),t.next=9,e.D.getAvailability(n.code||n.id,o[0],o[1]);case 9:a=t.sent,e.D.build(I,a),t.next=4;break;case 13:e.D.footerBuild();case 14:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}();!function(){T(),function(){var e,t;"hotels"!=f.page&&"hotel"!=f.page||(h.display=!v.mobileAndTabletCheck(),f.rb&&(h.display=!0));"home"!=f.page?e=function(){var e=v.search(),t={},n=y;t.place_name=n.displayText||"",t.place_selected=n,t.checkIn=e.checkin||h.data.checkIn,t.checkOut=e.checkout||h.data.checkOut;var r={adults:0,children:[],rooms:0};if(e["room1.adults"]){var o=+e.rooms;r.rooms=o;for(var i=0;i<o;i++){var a=i+1;r.adults=parseInt(r.adults)+parseInt(e["room".concat(a,".adults")])||2;var s=e["room".concat(a,".agekids")];if(s)for(var c=s.split(","),l=0;l<c.length;l++)r.children.push({year:+c[l]||0})}}else{for(var u=+e.group_adults||2,d=+e.no_rooms||1,p=[],f=+e.group_children||0,m=0;m<f;m++){var g=+(e.age||"").split(",")[m]||0;p.push({year:g})}r.adults=u,r.rooms=d,r.children=p}r||(r=h.data.paxes);return t.paxes=r,t}():t=l.get("bookerHotel_fam");t&&(t.place_name=null);h.data=e||t||h.data,_.getIsArray(h.data.paxes)&&(h.data.paxes=_.convertPaxesData(h.data.paxes));(e||t)&&(h.data.checkIn=v.getDate(h.data.checkIn),h.data.checkOut=v.getDate(h.data.checkOut),(+h.data.checkIn<=+g||+h.data.checkOut<=+g)&&T())}(),function(){(g<v.getDate(h.data.checkOut)||g>=v.getDate(h.data.checkOut))&&k&&(h.data.checkIn=v.getDate(k.checkIn),h.data.checkOut=v.getDate(k.checkOut));n=["calendar-checkIn-hotel-small","calendar-checkOut-hotel-small"],r=h.data.checkIn,o=h.data.checkOut,i="checkIn",a="checkOut",s=_.getFirstPathSegment(),c=f.rb?[]:["".concat(p.cloudCdn,"/assets/css/dist/").concat(p.siteName,"/booker.css?id=").concat(+new Date)],w={element:document.getElementById(n[0]),css:c,zIndex:100,grid:2,calendars:2,autoApply:!0,readonly:!0,lang:p.culture,date:r,format:v.mobileAndTabletCheck()&&"hotel"==s?E.formatMobile:E.format,plugins:["RangePlugin","LockPlugin"],LockPlugin:{minDate:g,minDays:2},RangePlugin:{tooltip:!0,startDate:r,endDate:o,tooltipNumber:function(e){return e-1},locale:{one:m.night,other:m.night+"s"}},setup:function(t){t.on("select",(function(e){var t=e.detail,n=t.start,r=t.end;h.data[i]=n.toJSDate(),h.data[a]=r.toJSDate(),h.onSubmit(h.form2,!0)})),t.on("view",(function(t){var n=t.detail,r=n.view,o=n.date,i=n.target;if("CalendarDay"===r){var a=h.data.place_selected,s=o.format("YYYY_MM"),c=o.format("YYYY-MM-DD");P[s]=s,I[c]={date:o.format("YYYY-MM-DD"),target:i};var l=e.D.getMemoryDate(s,c,a.code||a.id);l&&e.D.buildElement(I[c],l)}"Main"===r&&(e.D.setFooterElement(i),e.D.footerBuild())})),t.on("show",(function(t){L(),e.D.overFlow()})),t.on("hide",(function(t){e.D.overFlow(),I={},P={}})),t.on("click",(function(e){t.isCalendarHeaderButton(e.target)&&(I={},P={},setTimeout((function(){L()}),100)),t.isCalendarDay(e.target)&&setTimeout((function(){L()}),100)}))}},b=new easepick.create(w),(0,t.Tc)(b);var n,r,o,i,a,s,c}(),x();for(var n=h.settingPaxes.minAge;n<=h.settingPaxes.maxAge;n++)h.years.push({year:n})}()}window.app.controller("SmallBookerController",s),s.$inject=["$scope","$http","$q","$timeout","localStorageService","$location","$rootScope"]})(),(()=>{"use strict";n(4697);function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e(t)}function t(t,n){for(var r=0;r<n.length;r++){var o=n[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,(i=o.key,a=void 0,a=function(t,n){if("object"!==e(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var o=r.call(t,n||"default");if("object"!==e(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===n?String:Number)(t)}(i,"string"),"symbol"===e(a)?a:String(a)),o)}var i,a}var r=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.analytics=window.__pt.fn.analytics,this.settings=window.__pt.settings,this.events=window.__pt.fn.analytics.events}var n,r,o;return n=e,(r=[{key:"metricLoginAction",value:function(e,t){var n=t.action,r={event:this.events.gtmEvent,eventAction:n,eventCategory:"Login",eventName:"Login"};this.analytics.set(r.event,r)}},{key:"metricHeaderSelectContent",value:function(e){var t=e.title,n={content_type:this.events.button,element:"header :: ".concat(t),event:this.events.trackEvent,eventName:this.events.selectContent,layer:this.settings.page};this.analytics.set(n.event,n)}},{key:"metricsErrorsLogin",value:function(e){var t={event:this.events.gtmEvent,eventAction:"login error",eventCategory:"Login",eventName:"Login",eventLabel:"".concat(e)};this.analytics.set(t.event,t)}}])&&t(n.prototype,r),o&&t(n,o),Object.defineProperty(n,"prototype",{writable:!1}),e}(),o=n(4155);const i=function(e){const t=[];let n=0;for(let r=0;r<e.length;r++){let o=e.charCodeAt(r);o<128?t[n++]=o:o<2048?(t[n++]=o>>6|192,t[n++]=63&o|128):55296==(64512&o)&&r+1<e.length&&56320==(64512&e.charCodeAt(r+1))?(o=65536+((1023&o)<<10)+(1023&e.charCodeAt(++r)),t[n++]=o>>18|240,t[n++]=o>>12&63|128,t[n++]=o>>6&63|128,t[n++]=63&o|128):(t[n++]=o>>12|224,t[n++]=o>>6&63|128,t[n++]=63&o|128)}return t},a={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:"function"==typeof atob,encodeByteArray(e,t){if(!Array.isArray(e))throw Error("encodeByteArray takes an array as a parameter");this.init_();const n=t?this.byteToCharMapWebSafe_:this.byteToCharMap_,r=[];for(let t=0;t<e.length;t+=3){const o=e[t],i=t+1<e.length,a=i?e[t+1]:0,s=t+2<e.length,c=s?e[t+2]:0,l=o>>2,u=(3&o)<<4|a>>4;let d=(15&a)<<2|c>>6,h=63&c;s||(h=64,i||(d=64)),r.push(n[l],n[u],n[d],n[h])}return r.join("")},encodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?btoa(e):this.encodeByteArray(i(e),t)},decodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?atob(e):function(e){const t=[];let n=0,r=0;for(;n<e.length;){const o=e[n++];if(o<128)t[r++]=String.fromCharCode(o);else if(o>191&&o<224){const i=e[n++];t[r++]=String.fromCharCode((31&o)<<6|63&i)}else if(o>239&&o<365){const i=((7&o)<<18|(63&e[n++])<<12|(63&e[n++])<<6|63&e[n++])-65536;t[r++]=String.fromCharCode(55296+(i>>10)),t[r++]=String.fromCharCode(56320+(1023&i))}else{const i=e[n++],a=e[n++];t[r++]=String.fromCharCode((15&o)<<12|(63&i)<<6|63&a)}}return t.join("")}(this.decodeStringToByteArray(e,t))},decodeStringToByteArray(e,t){this.init_();const n=t?this.charToByteMapWebSafe_:this.charToByteMap_,r=[];for(let t=0;t<e.length;){const o=n[e.charAt(t++)],i=t<e.length?n[e.charAt(t)]:0;++t;const a=t<e.length?n[e.charAt(t)]:64;++t;const c=t<e.length?n[e.charAt(t)]:64;if(++t,null==o||null==i||null==a||null==c)throw new s;const l=o<<2|i>>4;if(r.push(l),64!==a){const e=i<<4&240|a>>2;if(r.push(e),64!==c){const e=a<<6&192|c;r.push(e)}}}return r},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let e=0;e<this.ENCODED_VALS.length;e++)this.byteToCharMap_[e]=this.ENCODED_VALS.charAt(e),this.charToByteMap_[this.byteToCharMap_[e]]=e,this.byteToCharMapWebSafe_[e]=this.ENCODED_VALS_WEBSAFE.charAt(e),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[e]]=e,e>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(e)]=e,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(e)]=e)}}};class s extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const c=function(e){return function(e){const t=i(e);return a.encodeByteArray(t,!0)}(e).replace(/\./g,"")},l=function(e){try{return a.decodeString(e,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};const u=()=>function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==n.g)return n.g;throw new Error("Unable to locate global object.")}().__FIREBASE_DEFAULTS__,d=()=>{try{return u()||(()=>{if(void 0===o||void 0===o.env)return;const e=o.env.__FIREBASE_DEFAULTS__;return e?JSON.parse(e):void 0})()||(()=>{if("undefined"==typeof document)return;let e;try{e=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch(e){return}const t=e&&l(e[1]);return t&&JSON.parse(t)})()}catch(e){return void console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${e}`)}},h=e=>{var t,n;return null===(n=null===(t=d())||void 0===t?void 0:t.emulatorHosts)||void 0===n?void 0:n[e]},p=()=>{var e;return null===(e=d())||void 0===e?void 0:e.config},f=e=>{var t;return null===(t=d())||void 0===t?void 0:t[`_${e}`]};class m{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise(((e,t)=>{this.resolve=e,this.reject=t}))}wrapCallback(e){return(t,n)=>{t?this.reject(t):this.resolve(n),"function"==typeof e&&(this.promise.catch((()=>{})),1===e.length?e(t):e(t,n))}}}function v(){return"undefined"!=typeof navigator&&"string"==typeof navigator.userAgent?navigator.userAgent:""}class g extends Error{constructor(e,t,n){super(t),this.code=e,this.customData=n,this.name="FirebaseError",Object.setPrototypeOf(this,g.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,y.prototype.create)}}class y{constructor(e,t,n){this.service=e,this.serviceName=t,this.errors=n}create(e,...t){const n=t[0]||{},r=`${this.service}/${e}`,o=this.errors[e],i=o?function(e,t){return e.replace(w,((e,n)=>{const r=t[n];return null!=r?String(r):`<${n}?>`}))}(o,n):"Error",a=`${this.serviceName}: ${i} (${r}).`;return new g(r,a,n)}}const w=/\{\$([^}]+)}/g;function b(e,t){if(e===t)return!0;const n=Object.keys(e),r=Object.keys(t);for(const o of n){if(!r.includes(o))return!1;const n=e[o],i=t[o];if(k(n)&&k(i)){if(!b(n,i))return!1}else if(n!==i)return!1}for(const e of r)if(!n.includes(e))return!1;return!0}function k(e){return null!==e&&"object"==typeof e}function _(e){const t=[];for(const[n,r]of Object.entries(e))Array.isArray(r)?r.forEach((e=>{t.push(encodeURIComponent(n)+"="+encodeURIComponent(e))})):t.push(encodeURIComponent(n)+"="+encodeURIComponent(r));return t.length?"&"+t.join("&"):""}function E(e){const t={};return e.replace(/^\?/,"").split("&").forEach((e=>{if(e){const[n,r]=e.split("=");t[decodeURIComponent(n)]=decodeURIComponent(r)}})),t}function I(e){const t=e.indexOf("?");if(!t)return"";const n=e.indexOf("#",t);return e.substring(t,n>0?n:void 0)}class P{constructor(e,t){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=t,this.task.then((()=>{e(this)})).catch((e=>{this.error(e)}))}next(e){this.forEachObserver((t=>{t.next(e)}))}error(e){this.forEachObserver((t=>{t.error(e)})),this.close(e)}complete(){this.forEachObserver((e=>{e.complete()})),this.close()}subscribe(e,t,n){let r;if(void 0===e&&void 0===t&&void 0===n)throw new Error("Missing Observer.");r=function(e,t){if("object"!=typeof e||null===e)return!1;for(const n of t)if(n in e&&"function"==typeof e[n])return!0;return!1}(e,["next","error","complete"])?e:{next:e,error:t,complete:n},void 0===r.next&&(r.next=S),void 0===r.error&&(r.error=S),void 0===r.complete&&(r.complete=S);const o=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then((()=>{try{this.finalError?r.error(this.finalError):r.complete()}catch(e){}})),this.observers.push(r),o}unsubscribeOne(e){void 0!==this.observers&&void 0!==this.observers[e]&&(delete this.observers[e],this.observerCount-=1,0===this.observerCount&&void 0!==this.onNoObservers&&this.onNoObservers(this))}forEachObserver(e){if(!this.finalized)for(let t=0;t<this.observers.length;t++)this.sendOne(t,e)}sendOne(e,t){this.task.then((()=>{if(void 0!==this.observers&&void 0!==this.observers[e])try{t(this.observers[e])}catch(e){"undefined"!=typeof console&&console.error&&console.error(e)}}))}close(e){this.finalized||(this.finalized=!0,void 0!==e&&(this.finalError=e),this.task.then((()=>{this.observers=void 0,this.onNoObservers=void 0})))}}function S(){}function T(e){return e&&e._delegate?e._delegate:e}class C{constructor(e,t,n){this.name=e,this.instanceFactory=t,this.type=n,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(e){return this.instantiationMode=e,this}setMultipleInstances(e){return this.multipleInstances=e,this}setServiceProps(e){return this.serviceProps=e,this}setInstanceCreatedCallback(e){return this.onInstanceCreated=e,this}}const x="[DEFAULT]";class D{constructor(e,t){this.name=e,this.container=t,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(e){const t=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(t)){const e=new m;if(this.instancesDeferred.set(t,e),this.isInitialized(t)||this.shouldAutoInitialize())try{const n=this.getOrInitializeService({instanceIdentifier:t});n&&e.resolve(n)}catch(e){}}return this.instancesDeferred.get(t).promise}getImmediate(e){var t;const n=this.normalizeInstanceIdentifier(null==e?void 0:e.identifier),r=null!==(t=null==e?void 0:e.optional)&&void 0!==t&&t;if(!this.isInitialized(n)&&!this.shouldAutoInitialize()){if(r)return null;throw Error(`Service ${this.name} is not available`)}try{return this.getOrInitializeService({instanceIdentifier:n})}catch(e){if(r)return null;throw e}}getComponent(){return this.component}setComponent(e){if(e.name!==this.name)throw Error(`Mismatching Component ${e.name} for Provider ${this.name}.`);if(this.component)throw Error(`Component for ${this.name} has already been provided`);if(this.component=e,this.shouldAutoInitialize()){if(function(e){return"EAGER"===e.instantiationMode}(e))try{this.getOrInitializeService({instanceIdentifier:x})}catch(e){}for(const[e,t]of this.instancesDeferred.entries()){const n=this.normalizeInstanceIdentifier(e);try{const e=this.getOrInitializeService({instanceIdentifier:n});t.resolve(e)}catch(e){}}}}clearInstance(e=x){this.instancesDeferred.delete(e),this.instancesOptions.delete(e),this.instances.delete(e)}async delete(){const e=Array.from(this.instances.values());await Promise.all([...e.filter((e=>"INTERNAL"in e)).map((e=>e.INTERNAL.delete())),...e.filter((e=>"_delete"in e)).map((e=>e._delete()))])}isComponentSet(){return null!=this.component}isInitialized(e=x){return this.instances.has(e)}getOptions(e=x){return this.instancesOptions.get(e)||{}}initialize(e={}){const{options:t={}}=e,n=this.normalizeInstanceIdentifier(e.instanceIdentifier);if(this.isInitialized(n))throw Error(`${this.name}(${n}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);const r=this.getOrInitializeService({instanceIdentifier:n,options:t});for(const[e,t]of this.instancesDeferred.entries()){n===this.normalizeInstanceIdentifier(e)&&t.resolve(r)}return r}onInit(e,t){var n;const r=this.normalizeInstanceIdentifier(t),o=null!==(n=this.onInitCallbacks.get(r))&&void 0!==n?n:new Set;o.add(e),this.onInitCallbacks.set(r,o);const i=this.instances.get(r);return i&&e(i,r),()=>{o.delete(e)}}invokeOnInitCallbacks(e,t){const n=this.onInitCallbacks.get(t);if(n)for(const r of n)try{r(e,t)}catch(e){}}getOrInitializeService({instanceIdentifier:e,options:t={}}){let n=this.instances.get(e);if(!n&&this.component&&(n=this.component.instanceFactory(this.container,{instanceIdentifier:(r=e,r===x?void 0:r),options:t}),this.instances.set(e,n),this.instancesOptions.set(e,t),this.invokeOnInitCallbacks(n,e),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,e,n)}catch(e){}var r;return n||null}normalizeInstanceIdentifier(e=x){return this.component?this.component.multipleInstances?e:x:e}shouldAutoInitialize(){return!!this.component&&"EXPLICIT"!==this.component.instantiationMode}}class R{constructor(e){this.name=e,this.providers=new Map}addComponent(e){const t=this.getProvider(e.name);if(t.isComponentSet())throw new Error(`Component ${e.name} has already been registered with ${this.name}`);t.setComponent(e)}addOrOverwriteComponent(e){this.getProvider(e.name).isComponentSet()&&this.providers.delete(e.name),this.addComponent(e)}getProvider(e){if(this.providers.has(e))return this.providers.get(e);const t=new D(e,this);return this.providers.set(e,t),t}getProviders(){return Array.from(this.providers.values())}}const O=[];var A;!function(e){e[e.DEBUG=0]="DEBUG",e[e.VERBOSE=1]="VERBOSE",e[e.INFO=2]="INFO",e[e.WARN=3]="WARN",e[e.ERROR=4]="ERROR",e[e.SILENT=5]="SILENT"}(A||(A={}));const L={debug:A.DEBUG,verbose:A.VERBOSE,info:A.INFO,warn:A.WARN,error:A.ERROR,silent:A.SILENT},N=A.INFO,M={[A.DEBUG]:"log",[A.VERBOSE]:"log",[A.INFO]:"info",[A.WARN]:"warn",[A.ERROR]:"error"},j=(e,t,...n)=>{if(t<e.logLevel)return;const r=(new Date).toISOString(),o=M[t];if(!o)throw new Error(`Attempted to log a message with an invalid logType (value: ${t})`);console[o](`[${r}]  ${e.name}:`,...n)};class U{constructor(e){this.name=e,this._logLevel=N,this._logHandler=j,this._userLogHandler=null,O.push(this)}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in A))throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel="string"==typeof e?L[e]:e}get logHandler(){return this._logHandler}set logHandler(e){if("function"!=typeof e)throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=e}get userLogHandler(){return this._userLogHandler}set userLogHandler(e){this._userLogHandler=e}debug(...e){this._userLogHandler&&this._userLogHandler(this,A.DEBUG,...e),this._logHandler(this,A.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,A.VERBOSE,...e),this._logHandler(this,A.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,A.INFO,...e),this._logHandler(this,A.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,A.WARN,...e),this._logHandler(this,A.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,A.ERROR,...e),this._logHandler(this,A.ERROR,...e)}}let B,F;const H=new WeakMap,V=new WeakMap,W=new WeakMap,q=new WeakMap,G=new WeakMap;let z={get(e,t,n){if(e instanceof IDBTransaction){if("done"===t)return V.get(e);if("objectStoreNames"===t)return e.objectStoreNames||W.get(e);if("store"===t)return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return J(e[t])},set:(e,t,n)=>(e[t]=n,!0),has:(e,t)=>e instanceof IDBTransaction&&("done"===t||"store"===t)||t in e};function K(e){return e!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(F||(F=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(e)?function(...t){return e.apply(Q(this),t),J(H.get(this))}:function(...t){return J(e.apply(Q(this),t))}:function(t,...n){const r=e.call(Q(this),t,...n);return W.set(r,t.sort?t.sort():[t]),J(r)}}function Y(e){return"function"==typeof e?K(e):(e instanceof IDBTransaction&&function(e){if(V.has(e))return;const t=new Promise(((t,n)=>{const r=()=>{e.removeEventListener("complete",o),e.removeEventListener("error",i),e.removeEventListener("abort",i)},o=()=>{t(),r()},i=()=>{n(e.error||new DOMException("AbortError","AbortError")),r()};e.addEventListener("complete",o),e.addEventListener("error",i),e.addEventListener("abort",i)}));V.set(e,t)}(e),t=e,(B||(B=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])).some((e=>t instanceof e))?new Proxy(e,z):e);var t}function J(e){if(e instanceof IDBRequest)return function(e){const t=new Promise(((t,n)=>{const r=()=>{e.removeEventListener("success",o),e.removeEventListener("error",i)},o=()=>{t(J(e.result)),r()},i=()=>{n(e.error),r()};e.addEventListener("success",o),e.addEventListener("error",i)}));return t.then((t=>{t instanceof IDBCursor&&H.set(t,e)})).catch((()=>{})),G.set(t,e),t}(e);if(q.has(e))return q.get(e);const t=Y(e);return t!==e&&(q.set(e,t),G.set(t,e)),t}const Q=e=>G.get(e);const Z=["get","getKey","getAll","getAllKeys","count"],X=["put","add","delete","clear"],ee=new Map;function te(e,t){if(!(e instanceof IDBDatabase)||t in e||"string"!=typeof t)return;if(ee.get(t))return ee.get(t);const n=t.replace(/FromIndex$/,""),r=t!==n,o=X.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!o&&!Z.includes(n))return;const i=async function(e,...t){const i=this.transaction(e,o?"readwrite":"readonly");let a=i.store;return r&&(a=a.index(t.shift())),(await Promise.all([a[n](...t),o&&i.done]))[0]};return ee.set(t,i),i}z=(e=>({...e,get:(t,n,r)=>te(t,n)||e.get(t,n,r),has:(t,n)=>!!te(t,n)||e.has(t,n)}))(z);class ne{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map((e=>{if(function(e){const t=e.getComponent();return"VERSION"===(null==t?void 0:t.type)}(e)){const t=e.getImmediate();return`${t.library}/${t.version}`}return null})).filter((e=>e)).join(" ")}}const re="@firebase/app",oe="0.9.20",ie=new U("@firebase/app"),ae="[DEFAULT]",se={[re]:"fire-core","@firebase/app-compat":"fire-core-compat","@firebase/analytics":"fire-analytics","@firebase/analytics-compat":"fire-analytics-compat","@firebase/app-check":"fire-app-check","@firebase/app-check-compat":"fire-app-check-compat","@firebase/auth":"fire-auth","@firebase/auth-compat":"fire-auth-compat","@firebase/database":"fire-rtdb","@firebase/database-compat":"fire-rtdb-compat","@firebase/functions":"fire-fn","@firebase/functions-compat":"fire-fn-compat","@firebase/installations":"fire-iid","@firebase/installations-compat":"fire-iid-compat","@firebase/messaging":"fire-fcm","@firebase/messaging-compat":"fire-fcm-compat","@firebase/performance":"fire-perf","@firebase/performance-compat":"fire-perf-compat","@firebase/remote-config":"fire-rc","@firebase/remote-config-compat":"fire-rc-compat","@firebase/storage":"fire-gcs","@firebase/storage-compat":"fire-gcs-compat","@firebase/firestore":"fire-fst","@firebase/firestore-compat":"fire-fst-compat","fire-js":"fire-js",firebase:"fire-js-all"},ce=new Map,le=new Map;function ue(e,t){try{e.container.addComponent(t)}catch(n){ie.debug(`Component ${t.name} failed to register with FirebaseApp ${e.name}`,n)}}function de(e){const t=e.name;if(le.has(t))return ie.debug(`There were multiple attempts to register component ${t}.`),!1;le.set(t,e);for(const t of ce.values())ue(t,e);return!0}function he(e,t){const n=e.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),e.container.getProvider(t)}const pe=new y("app","Firebase",{"no-app":"No Firebase App '{$appName}' has been created - call initializeApp() first","bad-app-name":"Illegal App name: '{$appName}","duplicate-app":"Firebase App named '{$appName}' already exists with different options or config","app-deleted":"Firebase App named '{$appName}' already deleted","no-options":"Need to provide options, when not being deployed to hosting via source.","invalid-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance.","invalid-log-argument":"First argument to `onLog` must be null or a function.","idb-open":"Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.","idb-get":"Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.","idb-set":"Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.","idb-delete":"Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}."});class fe{constructor(e,t,n){this._isDeleted=!1,this._options=Object.assign({},e),this._config=Object.assign({},t),this._name=t.name,this._automaticDataCollectionEnabled=t.automaticDataCollectionEnabled,this._container=n,this.container.addComponent(new C("app",(()=>this),"PUBLIC"))}get automaticDataCollectionEnabled(){return this.checkDestroyed(),this._automaticDataCollectionEnabled}set automaticDataCollectionEnabled(e){this.checkDestroyed(),this._automaticDataCollectionEnabled=e}get name(){return this.checkDestroyed(),this._name}get options(){return this.checkDestroyed(),this._options}get config(){return this.checkDestroyed(),this._config}get container(){return this._container}get isDeleted(){return this._isDeleted}set isDeleted(e){this._isDeleted=e}checkDestroyed(){if(this.isDeleted)throw pe.create("app-deleted",{appName:this._name})}}const me="10.5.0";function ve(e,t={}){let n=e;if("object"!=typeof t){t={name:t}}const r=Object.assign({name:ae,automaticDataCollectionEnabled:!1},t),o=r.name;if("string"!=typeof o||!o)throw pe.create("bad-app-name",{appName:String(o)});if(n||(n=p()),!n)throw pe.create("no-options");const i=ce.get(o);if(i){if(b(n,i.options)&&b(r,i.config))return i;throw pe.create("duplicate-app",{appName:o})}const a=new R(o);for(const e of le.values())a.addComponent(e);const s=new fe(n,r,a);return ce.set(o,s),s}function ge(e,t,n){var r;let o=null!==(r=se[e])&&void 0!==r?r:e;n&&(o+=`-${n}`);const i=o.match(/\s|\//),a=t.match(/\s|\//);if(i||a){const e=[`Unable to register library "${o}" with version "${t}":`];return i&&e.push(`library name "${o}" contains illegal characters (whitespace or "/")`),i&&a&&e.push("and"),a&&e.push(`version name "${t}" contains illegal characters (whitespace or "/")`),void ie.warn(e.join(" "))}de(new C(`${o}-version`,(()=>({library:o,version:t})),"VERSION"))}const ye="firebase-heartbeat-store";let we=null;function be(){return we||(we=function(e,t,{blocked:n,upgrade:r,blocking:o,terminated:i}={}){const a=indexedDB.open(e,t),s=J(a);return r&&a.addEventListener("upgradeneeded",(e=>{r(J(a.result),e.oldVersion,e.newVersion,J(a.transaction),e)})),n&&a.addEventListener("blocked",(e=>n(e.oldVersion,e.newVersion,e))),s.then((e=>{i&&e.addEventListener("close",(()=>i())),o&&e.addEventListener("versionchange",(e=>o(e.oldVersion,e.newVersion,e)))})).catch((()=>{})),s}("firebase-heartbeat-database",1,{upgrade:(e,t)=>{if(0===t)e.createObjectStore(ye)}}).catch((e=>{throw pe.create("idb-open",{originalErrorMessage:e.message})}))),we}async function ke(e,t){try{const n=(await be()).transaction(ye,"readwrite"),r=n.objectStore(ye);await r.put(t,_e(e)),await n.done}catch(e){if(e instanceof g)ie.warn(e.message);else{const t=pe.create("idb-set",{originalErrorMessage:null==e?void 0:e.message});ie.warn(t.message)}}}function _e(e){return`${e.name}!${e.options.appId}`}class Ee{constructor(e){this.container=e,this._heartbeatsCache=null;const t=this.container.getProvider("app").getImmediate();this._storage=new Pe(t),this._heartbeatsCachePromise=this._storage.read().then((e=>(this._heartbeatsCache=e,e)))}async triggerHeartbeat(){const e=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),t=Ie();if(null===this._heartbeatsCache&&(this._heartbeatsCache=await this._heartbeatsCachePromise),this._heartbeatsCache.lastSentHeartbeatDate!==t&&!this._heartbeatsCache.heartbeats.some((e=>e.date===t)))return this._heartbeatsCache.heartbeats.push({date:t,agent:e}),this._heartbeatsCache.heartbeats=this._heartbeatsCache.heartbeats.filter((e=>{const t=new Date(e.date).valueOf();return Date.now()-t<=2592e6})),this._storage.overwrite(this._heartbeatsCache)}async getHeartbeatsHeader(){if(null===this._heartbeatsCache&&await this._heartbeatsCachePromise,null===this._heartbeatsCache||0===this._heartbeatsCache.heartbeats.length)return"";const e=Ie(),{heartbeatsToSend:t,unsentEntries:n}=function(e,t=1024){const n=[];let r=e.slice();for(const o of e){const e=n.find((e=>e.agent===o.agent));if(e){if(e.dates.push(o.date),Se(n)>t){e.dates.pop();break}}else if(n.push({agent:o.agent,dates:[o.date]}),Se(n)>t){n.pop();break}r=r.slice(1)}return{heartbeatsToSend:n,unsentEntries:r}}(this._heartbeatsCache.heartbeats),r=c(JSON.stringify({version:2,heartbeats:t}));return this._heartbeatsCache.lastSentHeartbeatDate=e,n.length>0?(this._heartbeatsCache.heartbeats=n,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),r}}function Ie(){return(new Date).toISOString().substring(0,10)}class Pe{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return!!function(){try{return"object"==typeof indexedDB}catch(e){return!1}}()&&new Promise(((e,t)=>{try{let n=!0;const r="validate-browser-context-for-indexeddb-analytics-module",o=self.indexedDB.open(r);o.onsuccess=()=>{o.result.close(),n||self.indexedDB.deleteDatabase(r),e(!0)},o.onupgradeneeded=()=>{n=!1},o.onerror=()=>{var e;t((null===(e=o.error)||void 0===e?void 0:e.message)||"")}}catch(e){t(e)}})).then((()=>!0)).catch((()=>!1))}async read(){if(await this._canUseIndexedDBPromise){return await async function(e){try{const t=await be();return await t.transaction(ye).objectStore(ye).get(_e(e))}catch(e){if(e instanceof g)ie.warn(e.message);else{const t=pe.create("idb-get",{originalErrorMessage:null==e?void 0:e.message});ie.warn(t.message)}}}(this.app)||{heartbeats:[]}}return{heartbeats:[]}}async overwrite(e){var t;if(await this._canUseIndexedDBPromise){const n=await this.read();return ke(this.app,{lastSentHeartbeatDate:null!==(t=e.lastSentHeartbeatDate)&&void 0!==t?t:n.lastSentHeartbeatDate,heartbeats:e.heartbeats})}}async add(e){var t;if(await this._canUseIndexedDBPromise){const n=await this.read();return ke(this.app,{lastSentHeartbeatDate:null!==(t=e.lastSentHeartbeatDate)&&void 0!==t?t:n.lastSentHeartbeatDate,heartbeats:[...n.heartbeats,...e.heartbeats]})}}}function Se(e){return c(JSON.stringify({version:2,heartbeats:e})).length}var Te;Te="",de(new C("platform-logger",(e=>new ne(e)),"PRIVATE")),de(new C("heartbeat",(e=>new Ee(e)),"PRIVATE")),ge(re,oe,Te),ge(re,oe,"esm2017"),ge("fire-js","");ge("firebase","10.5.0","app");function Ce(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}Object.create;Object.create;function xe(e){return void 0!==e&&void 0!==e.enterprise}class De{constructor(e){if(this.siteKey="",this.emailPasswordEnabled=!1,void 0===e.recaptchaKey)throw new Error("recaptchaKey undefined");this.siteKey=e.recaptchaKey.split("/")[3],this.emailPasswordEnabled=e.recaptchaEnforcementState.some((e=>"EMAIL_PASSWORD_PROVIDER"===e.provider&&"OFF"!==e.enforcementState))}}function Re(){return{"dependent-sdk-initialized-before-auth":"Another Firebase SDK was initialized and is trying to use Auth before Auth is initialized. Please be sure to call `initializeAuth` or `getAuth` before starting any other Firebase SDK."}}const Oe=Re,Ae=new y("auth","Firebase",{"dependent-sdk-initialized-before-auth":"Another Firebase SDK was initialized and is trying to use Auth before Auth is initialized. Please be sure to call `initializeAuth` or `getAuth` before starting any other Firebase SDK."}),Le=new U("@firebase/auth");function Ne(e,...t){Le.logLevel<=A.ERROR&&Le.error(`Auth (${me}): ${e}`,...t)}function Me(e,...t){throw Fe(e,...t)}function je(e,...t){return Fe(e,...t)}function Ue(e,t,n){const r=Object.assign(Object.assign({},Oe()),{[t]:n});return new y("auth","Firebase",r).create(t,{appName:e.name})}function Be(e,t,n){if(!(t instanceof n))throw n.name!==t.constructor.name&&Me(e,"argument-error"),Ue(e,"argument-error",`Type of ${t.constructor.name} does not match expected instance.Did you pass a reference from a different Auth SDK?`)}function Fe(e,...t){if("string"!=typeof e){const n=t[0],r=[...t.slice(1)];return r[0]&&(r[0].appName=e.name),e._errorFactory.create(n,...r)}return Ae.create(e,...t)}function $e(e,t,...n){if(!e)throw Fe(t,...n)}function He(e){const t="INTERNAL ASSERTION FAILED: "+e;throw Ne(t),new Error(t)}function Ve(e,t){e||He(t)}function We(){var e;return"undefined"!=typeof self&&(null===(e=self.location)||void 0===e?void 0:e.href)||""}function qe(){return"http:"===Ge()||"https:"===Ge()}function Ge(){var e;return"undefined"!=typeof self&&(null===(e=self.location)||void 0===e?void 0:e.protocol)||null}function ze(){return!("undefined"!=typeof navigator&&navigator&&"onLine"in navigator&&"boolean"==typeof navigator.onLine&&(qe()||function(){const e="object"==typeof chrome?chrome.runtime:"object"==typeof browser?browser.runtime:void 0;return"object"==typeof e&&void 0!==e.id}()||"connection"in navigator))||navigator.onLine}class Ke{constructor(e,t){this.shortDelay=e,this.longDelay=t,Ve(t>e,"Short delay should be less than long delay!"),this.isMobile="undefined"!=typeof window&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(v())||"object"==typeof navigator&&"ReactNative"===navigator.product}get(){return ze()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}}function Ye(e,t){Ve(e.emulator,"Emulator should always be set here");const{url:n}=e.emulator;return t?`${n}${t.startsWith("/")?t.slice(1):t}`:n}class Je{static initialize(e,t,n){this.fetchImpl=e,t&&(this.headersImpl=t),n&&(this.responseImpl=n)}static fetch(){return this.fetchImpl?this.fetchImpl:"undefined"!=typeof self&&"fetch"in self?self.fetch:void He("Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static headers(){return this.headersImpl?this.headersImpl:"undefined"!=typeof self&&"Headers"in self?self.Headers:void He("Could not find Headers implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static response(){return this.responseImpl?this.responseImpl:"undefined"!=typeof self&&"Response"in self?self.Response:void He("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}}const Qe={CREDENTIAL_MISMATCH:"custom-token-mismatch",MISSING_CUSTOM_TOKEN:"internal-error",INVALID_IDENTIFIER:"invalid-email",MISSING_CONTINUE_URI:"internal-error",INVALID_PASSWORD:"wrong-password",MISSING_PASSWORD:"missing-password",EMAIL_EXISTS:"email-already-in-use",PASSWORD_LOGIN_DISABLED:"operation-not-allowed",INVALID_IDP_RESPONSE:"invalid-credential",INVALID_PENDING_TOKEN:"invalid-credential",FEDERATED_USER_ID_ALREADY_LINKED:"credential-already-in-use",MISSING_REQ_TYPE:"internal-error",EMAIL_NOT_FOUND:"user-not-found",RESET_PASSWORD_EXCEED_LIMIT:"too-many-requests",EXPIRED_OOB_CODE:"expired-action-code",INVALID_OOB_CODE:"invalid-action-code",MISSING_OOB_CODE:"internal-error",CREDENTIAL_TOO_OLD_LOGIN_AGAIN:"requires-recent-login",INVALID_ID_TOKEN:"invalid-user-token",TOKEN_EXPIRED:"user-token-expired",USER_NOT_FOUND:"user-token-expired",TOO_MANY_ATTEMPTS_TRY_LATER:"too-many-requests",PASSWORD_DOES_NOT_MEET_REQUIREMENTS:"password-does-not-meet-requirements",INVALID_CODE:"invalid-verification-code",INVALID_SESSION_INFO:"invalid-verification-id",INVALID_TEMPORARY_PROOF:"invalid-credential",MISSING_SESSION_INFO:"missing-verification-id",SESSION_EXPIRED:"code-expired",MISSING_ANDROID_PACKAGE_NAME:"missing-android-pkg-name",UNAUTHORIZED_DOMAIN:"unauthorized-continue-uri",INVALID_OAUTH_CLIENT_ID:"invalid-oauth-client-id",ADMIN_ONLY_OPERATION:"admin-restricted-operation",INVALID_MFA_PENDING_CREDENTIAL:"invalid-multi-factor-session",MFA_ENROLLMENT_NOT_FOUND:"multi-factor-info-not-found",MISSING_MFA_ENROLLMENT_ID:"missing-multi-factor-info",MISSING_MFA_PENDING_CREDENTIAL:"missing-multi-factor-session",SECOND_FACTOR_EXISTS:"second-factor-already-in-use",SECOND_FACTOR_LIMIT_EXCEEDED:"maximum-second-factor-count-exceeded",BLOCKING_FUNCTION_ERROR_RESPONSE:"internal-error",RECAPTCHA_NOT_ENABLED:"recaptcha-not-enabled",MISSING_RECAPTCHA_TOKEN:"missing-recaptcha-token",INVALID_RECAPTCHA_TOKEN:"invalid-recaptcha-token",INVALID_RECAPTCHA_ACTION:"invalid-recaptcha-action",MISSING_CLIENT_TYPE:"missing-client-type",MISSING_RECAPTCHA_VERSION:"missing-recaptcha-version",INVALID_RECAPTCHA_VERSION:"invalid-recaptcha-version",INVALID_REQ_TYPE:"invalid-req-type"},Ze=new Ke(3e4,6e4);function Xe(e,t){return e.tenantId&&!t.tenantId?Object.assign(Object.assign({},t),{tenantId:e.tenantId}):t}async function et(e,t,n,r,o={}){return tt(e,o,(async()=>{let o={},i={};r&&("GET"===t?i=r:o={body:JSON.stringify(r)});const a=_(Object.assign({key:e.config.apiKey},i)).slice(1),s=await e._getAdditionalHeaders();return s["Content-Type"]="application/json",e.languageCode&&(s["X-Firebase-Locale"]=e.languageCode),Je.fetch()(rt(e,e.config.apiHost,n,a),Object.assign({method:t,headers:s,referrerPolicy:"no-referrer"},o))}))}async function tt(e,t,n){e._canInitEmulator=!1;const r=Object.assign(Object.assign({},Qe),t);try{const t=new ot(e),o=await Promise.race([n(),t.promise]);t.clearNetworkTimeout();const i=await o.json();if("needConfirmation"in i)throw it(e,"account-exists-with-different-credential",i);if(o.ok&&!("errorMessage"in i))return i;{const t=o.ok?i.errorMessage:i.error.message,[n,a]=t.split(" : ");if("FEDERATED_USER_ID_ALREADY_LINKED"===n)throw it(e,"credential-already-in-use",i);if("EMAIL_EXISTS"===n)throw it(e,"email-already-in-use",i);if("USER_DISABLED"===n)throw it(e,"user-disabled",i);const s=r[n]||n.toLowerCase().replace(/[_\s]+/g,"-");if(a)throw Ue(e,s,a);Me(e,s)}}catch(t){if(t instanceof g)throw t;Me(e,"network-request-failed",{message:String(t)})}}async function nt(e,t,n,r,o={}){const i=await et(e,t,n,r,o);return"mfaPendingCredential"in i&&Me(e,"multi-factor-auth-required",{_serverResponse:i}),i}function rt(e,t,n,r){const o=`${t}${n}?${r}`;return e.config.emulator?Ye(e.config,o):`${e.config.apiScheme}://${o}`}class ot{constructor(e){this.auth=e,this.timer=null,this.promise=new Promise(((e,t)=>{this.timer=setTimeout((()=>t(je(this.auth,"network-request-failed"))),Ze.get())}))}clearNetworkTimeout(){clearTimeout(this.timer)}}function it(e,t,n){const r={appName:e.name};n.email&&(r.email=n.email),n.phoneNumber&&(r.phoneNumber=n.phoneNumber);const o=je(e,t,r);return o.customData._tokenResponse=n,o}async function at(e,t){return et(e,"GET","/v2/recaptchaConfig",Xe(e,t))}function st(e){if(e)try{const t=new Date(Number(e));if(!isNaN(t.getTime()))return t.toUTCString()}catch(e){}}function ct(e){return 1e3*Number(e)}function lt(e){const[t,n,r]=e.split(".");if(void 0===t||void 0===n||void 0===r)return Ne("JWT malformed, contained fewer than 3 sections"),null;try{const e=l(n);return e?JSON.parse(e):(Ne("Failed to decode base64 JWT payload"),null)}catch(e){return Ne("Caught error parsing JWT payload as JSON",null==e?void 0:e.toString()),null}}async function ut(e,t,n=!1){if(n)return t;try{return await t}catch(t){throw t instanceof g&&function({code:e}){return"auth/user-disabled"===e||"auth/user-token-expired"===e}(t)&&e.auth.currentUser===e&&await e.auth.signOut(),t}}class dt{constructor(e){this.user=e,this.isRunning=!1,this.timerId=null,this.errorBackoff=3e4}_start(){this.isRunning||(this.isRunning=!0,this.schedule())}_stop(){this.isRunning&&(this.isRunning=!1,null!==this.timerId&&clearTimeout(this.timerId))}getInterval(e){var t;if(e){const e=this.errorBackoff;return this.errorBackoff=Math.min(2*this.errorBackoff,96e4),e}{this.errorBackoff=3e4;const e=(null!==(t=this.user.stsTokenManager.expirationTime)&&void 0!==t?t:0)-Date.now()-3e5;return Math.max(0,e)}}schedule(e=!1){if(!this.isRunning)return;const t=this.getInterval(e);this.timerId=setTimeout((async()=>{await this.iteration()}),t)}async iteration(){try{await this.user.getIdToken(!0)}catch(e){return void("auth/network-request-failed"===(null==e?void 0:e.code)&&this.schedule(!0))}this.schedule()}}class ht{constructor(e,t){this.createdAt=e,this.lastLoginAt=t,this._initializeTime()}_initializeTime(){this.lastSignInTime=st(this.lastLoginAt),this.creationTime=st(this.createdAt)}_copy(e){this.createdAt=e.createdAt,this.lastLoginAt=e.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}}async function pt(e){var t;const n=e.auth,r=await e.getIdToken(),o=await ut(e,async function(e,t){return et(e,"POST","/v1/accounts:lookup",t)}(n,{idToken:r}));$e(null==o?void 0:o.users.length,n,"internal-error");const i=o.users[0];e._notifyReloadListener(i);const a=(null===(t=i.providerUserInfo)||void 0===t?void 0:t.length)?i.providerUserInfo.map((e=>{var{providerId:t}=e,n=Ce(e,["providerId"]);return{providerId:t,uid:n.rawId||"",displayName:n.displayName||null,email:n.email||null,phoneNumber:n.phoneNumber||null,photoURL:n.photoUrl||null}})):[];const s=(c=e.providerData,l=a,[...c.filter((e=>!l.some((t=>t.providerId===e.providerId)))),...l]);var c,l;const u=e.isAnonymous,d=!(e.email&&i.passwordHash||(null==s?void 0:s.length)),h=!!u&&d,p={uid:i.localId,displayName:i.displayName||null,photoURL:i.photoUrl||null,email:i.email||null,emailVerified:i.emailVerified||!1,phoneNumber:i.phoneNumber||null,tenantId:i.tenantId||null,providerData:s,metadata:new ht(i.createdAt,i.lastLoginAt),isAnonymous:h};Object.assign(e,p)}class ft{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(e){$e(e.idToken,"internal-error"),$e(void 0!==e.idToken,"internal-error"),$e(void 0!==e.refreshToken,"internal-error");const t="expiresIn"in e&&void 0!==e.expiresIn?Number(e.expiresIn):function(e){const t=lt(e);return $e(t,"internal-error"),$e(void 0!==t.exp,"internal-error"),$e(void 0!==t.iat,"internal-error"),Number(t.exp)-Number(t.iat)}(e.idToken);this.updateTokensAndExpiration(e.idToken,e.refreshToken,t)}async getToken(e,t=!1){return $e(!this.accessToken||this.refreshToken,e,"user-token-expired"),t||!this.accessToken||this.isExpired?this.refreshToken?(await this.refresh(e,this.refreshToken),this.accessToken):null:this.accessToken}clearRefreshToken(){this.refreshToken=null}async refresh(e,t){const{accessToken:n,refreshToken:r,expiresIn:o}=await async function(e,t){const n=await tt(e,{},(async()=>{const n=_({grant_type:"refresh_token",refresh_token:t}).slice(1),{tokenApiHost:r,apiKey:o}=e.config,i=rt(e,r,"/v1/token",`key=${o}`),a=await e._getAdditionalHeaders();return a["Content-Type"]="application/x-www-form-urlencoded",Je.fetch()(i,{method:"POST",headers:a,body:n})}));return{accessToken:n.access_token,expiresIn:n.expires_in,refreshToken:n.refresh_token}}(e,t);this.updateTokensAndExpiration(n,r,Number(o))}updateTokensAndExpiration(e,t,n){this.refreshToken=t||null,this.accessToken=e||null,this.expirationTime=Date.now()+1e3*n}static fromJSON(e,t){const{refreshToken:n,accessToken:r,expirationTime:o}=t,i=new ft;return n&&($e("string"==typeof n,"internal-error",{appName:e}),i.refreshToken=n),r&&($e("string"==typeof r,"internal-error",{appName:e}),i.accessToken=r),o&&($e("number"==typeof o,"internal-error",{appName:e}),i.expirationTime=o),i}toJSON(){return{refreshToken:this.refreshToken,accessToken:this.accessToken,expirationTime:this.expirationTime}}_assign(e){this.accessToken=e.accessToken,this.refreshToken=e.refreshToken,this.expirationTime=e.expirationTime}_clone(){return Object.assign(new ft,this.toJSON())}_performRefresh(){return He("not implemented")}}function mt(e,t){$e("string"==typeof e||void 0===e,"internal-error",{appName:t})}class vt{constructor(e){var{uid:t,auth:n,stsTokenManager:r}=e,o=Ce(e,["uid","auth","stsTokenManager"]);this.providerId="firebase",this.proactiveRefresh=new dt(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=t,this.auth=n,this.stsTokenManager=r,this.accessToken=r.accessToken,this.displayName=o.displayName||null,this.email=o.email||null,this.emailVerified=o.emailVerified||!1,this.phoneNumber=o.phoneNumber||null,this.photoURL=o.photoURL||null,this.isAnonymous=o.isAnonymous||!1,this.tenantId=o.tenantId||null,this.providerData=o.providerData?[...o.providerData]:[],this.metadata=new ht(o.createdAt||void 0,o.lastLoginAt||void 0)}async getIdToken(e){const t=await ut(this,this.stsTokenManager.getToken(this.auth,e));return $e(t,this.auth,"internal-error"),this.accessToken!==t&&(this.accessToken=t,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),t}getIdTokenResult(e){return async function(e,t=!1){const n=T(e),r=await n.getIdToken(t),o=lt(r);$e(o&&o.exp&&o.auth_time&&o.iat,n.auth,"internal-error");const i="object"==typeof o.firebase?o.firebase:void 0,a=null==i?void 0:i.sign_in_provider;return{claims:o,token:r,authTime:st(ct(o.auth_time)),issuedAtTime:st(ct(o.iat)),expirationTime:st(ct(o.exp)),signInProvider:a||null,signInSecondFactor:(null==i?void 0:i.sign_in_second_factor)||null}}(this,e)}reload(){return async function(e){const t=T(e);await pt(t),await t.auth._persistUserIfCurrent(t),t.auth._notifyListenersIfCurrent(t)}(this)}_assign(e){this!==e&&($e(this.uid===e.uid,this.auth,"internal-error"),this.displayName=e.displayName,this.photoURL=e.photoURL,this.email=e.email,this.emailVerified=e.emailVerified,this.phoneNumber=e.phoneNumber,this.isAnonymous=e.isAnonymous,this.tenantId=e.tenantId,this.providerData=e.providerData.map((e=>Object.assign({},e))),this.metadata._copy(e.metadata),this.stsTokenManager._assign(e.stsTokenManager))}_clone(e){const t=new vt(Object.assign(Object.assign({},this),{auth:e,stsTokenManager:this.stsTokenManager._clone()}));return t.metadata._copy(this.metadata),t}_onReload(e){$e(!this.reloadListener,this.auth,"internal-error"),this.reloadListener=e,this.reloadUserInfo&&(this._notifyReloadListener(this.reloadUserInfo),this.reloadUserInfo=null)}_notifyReloadListener(e){this.reloadListener?this.reloadListener(e):this.reloadUserInfo=e}_startProactiveRefresh(){this.proactiveRefresh._start()}_stopProactiveRefresh(){this.proactiveRefresh._stop()}async _updateTokensIfNecessary(e,t=!1){let n=!1;e.idToken&&e.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(e),n=!0),t&&await pt(this),await this.auth._persistUserIfCurrent(this),n&&this.auth._notifyListenersIfCurrent(this)}async delete(){const e=await this.getIdToken();return await ut(this,async function(e,t){return et(e,"POST","/v1/accounts:delete",t)}(this.auth,{idToken:e})),this.stsTokenManager.clearRefreshToken(),this.auth.signOut()}toJSON(){return Object.assign(Object.assign({uid:this.uid,email:this.email||void 0,emailVerified:this.emailVerified,displayName:this.displayName||void 0,isAnonymous:this.isAnonymous,photoURL:this.photoURL||void 0,phoneNumber:this.phoneNumber||void 0,tenantId:this.tenantId||void 0,providerData:this.providerData.map((e=>Object.assign({},e))),stsTokenManager:this.stsTokenManager.toJSON(),_redirectEventId:this._redirectEventId},this.metadata.toJSON()),{apiKey:this.auth.config.apiKey,appName:this.auth.name})}get refreshToken(){return this.stsTokenManager.refreshToken||""}static _fromJSON(e,t){var n,r,o,i,a,s,c,l;const u=null!==(n=t.displayName)&&void 0!==n?n:void 0,d=null!==(r=t.email)&&void 0!==r?r:void 0,h=null!==(o=t.phoneNumber)&&void 0!==o?o:void 0,p=null!==(i=t.photoURL)&&void 0!==i?i:void 0,f=null!==(a=t.tenantId)&&void 0!==a?a:void 0,m=null!==(s=t._redirectEventId)&&void 0!==s?s:void 0,v=null!==(c=t.createdAt)&&void 0!==c?c:void 0,g=null!==(l=t.lastLoginAt)&&void 0!==l?l:void 0,{uid:y,emailVerified:w,isAnonymous:b,providerData:k,stsTokenManager:_}=t;$e(y&&_,e,"internal-error");const E=ft.fromJSON(this.name,_);$e("string"==typeof y,e,"internal-error"),mt(u,e.name),mt(d,e.name),$e("boolean"==typeof w,e,"internal-error"),$e("boolean"==typeof b,e,"internal-error"),mt(h,e.name),mt(p,e.name),mt(f,e.name),mt(m,e.name),mt(v,e.name),mt(g,e.name);const I=new vt({uid:y,auth:e,email:d,emailVerified:w,displayName:u,isAnonymous:b,photoURL:p,phoneNumber:h,tenantId:f,stsTokenManager:E,createdAt:v,lastLoginAt:g});return k&&Array.isArray(k)&&(I.providerData=k.map((e=>Object.assign({},e)))),m&&(I._redirectEventId=m),I}static async _fromIdTokenResponse(e,t,n=!1){const r=new ft;r.updateFromServerResponse(t);const o=new vt({uid:t.localId,auth:e,stsTokenManager:r,isAnonymous:n});return await pt(o),o}}const gt=new Map;function yt(e){Ve(e instanceof Function,"Expected a class definition");let t=gt.get(e);return t?(Ve(t instanceof e,"Instance stored in cache mismatched with class"),t):(t=new e,gt.set(e,t),t)}class wt{constructor(){this.type="NONE",this.storage={}}async _isAvailable(){return!0}async _set(e,t){this.storage[e]=t}async _get(e){const t=this.storage[e];return void 0===t?null:t}async _remove(e){delete this.storage[e]}_addListener(e,t){}_removeListener(e,t){}}wt.type="NONE";const bt=wt;function kt(e,t,n){return`firebase:${e}:${t}:${n}`}class _t{constructor(e,t,n){this.persistence=e,this.auth=t,this.userKey=n;const{config:r,name:o}=this.auth;this.fullUserKey=kt(this.userKey,r.apiKey,o),this.fullPersistenceKey=kt("persistence",r.apiKey,o),this.boundEventHandler=t._onStorageEvent.bind(t),this.persistence._addListener(this.fullUserKey,this.boundEventHandler)}setCurrentUser(e){return this.persistence._set(this.fullUserKey,e.toJSON())}async getCurrentUser(){const e=await this.persistence._get(this.fullUserKey);return e?vt._fromJSON(this.auth,e):null}removeCurrentUser(){return this.persistence._remove(this.fullUserKey)}savePersistenceForRedirect(){return this.persistence._set(this.fullPersistenceKey,this.persistence.type)}async setPersistence(e){if(this.persistence===e)return;const t=await this.getCurrentUser();return await this.removeCurrentUser(),this.persistence=e,t?this.setCurrentUser(t):void 0}delete(){this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}static async create(e,t,n="authUser"){if(!t.length)return new _t(yt(bt),e,n);const r=(await Promise.all(t.map((async e=>{if(await e._isAvailable())return e})))).filter((e=>e));let o=r[0]||yt(bt);const i=kt(n,e.config.apiKey,e.name);let a=null;for(const n of t)try{const t=await n._get(i);if(t){const r=vt._fromJSON(e,t);n!==o&&(a=r),o=n;break}}catch(e){}const s=r.filter((e=>e._shouldAllowMigration));return o._shouldAllowMigration&&s.length?(o=s[0],a&&await o._set(i,a.toJSON()),await Promise.all(t.map((async e=>{if(e!==o)try{await e._remove(i)}catch(e){}}))),new _t(o,e,n)):new _t(o,e,n)}}function Et(e){const t=e.toLowerCase();if(t.includes("opera/")||t.includes("opr/")||t.includes("opios/"))return"Opera";if(Tt(t))return"IEMobile";if(t.includes("msie")||t.includes("trident/"))return"IE";if(t.includes("edge/"))return"Edge";if(It(t))return"Firefox";if(t.includes("silk/"))return"Silk";if(xt(t))return"Blackberry";if(Dt(t))return"Webos";if(Pt(t))return"Safari";if((t.includes("chrome/")||St(t))&&!t.includes("edge/"))return"Chrome";if(Ct(t))return"Android";{const t=/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/,n=e.match(t);if(2===(null==n?void 0:n.length))return n[1]}return"Other"}function It(e=v()){return/firefox\//i.test(e)}function Pt(e=v()){const t=e.toLowerCase();return t.includes("safari/")&&!t.includes("chrome/")&&!t.includes("crios/")&&!t.includes("android")}function St(e=v()){return/crios\//i.test(e)}function Tt(e=v()){return/iemobile/i.test(e)}function Ct(e=v()){return/android/i.test(e)}function xt(e=v()){return/blackberry/i.test(e)}function Dt(e=v()){return/webos/i.test(e)}function Rt(e=v()){return/iphone|ipad|ipod/i.test(e)||/macintosh/i.test(e)&&/mobile/i.test(e)}function Ot(){return function(){const e=v();return e.indexOf("MSIE ")>=0||e.indexOf("Trident/")>=0}()&&10===document.documentMode}function At(e=v()){return Rt(e)||Ct(e)||Dt(e)||xt(e)||/windows phone/i.test(e)||Tt(e)}function Lt(e,t=[]){let n;switch(e){case"Browser":n=Et(v());break;case"Worker":n=`${Et(v())}-${e}`;break;default:n=e}const r=t.length?t.join(","):"FirebaseCore-web";return`${n}/JsCore/${me}/${r}`}class Nt{constructor(e){this.auth=e,this.queue=[]}pushCallback(e,t){const n=t=>new Promise(((n,r)=>{try{n(e(t))}catch(e){r(e)}}));n.onAbort=t,this.queue.push(n);const r=this.queue.length-1;return()=>{this.queue[r]=()=>Promise.resolve()}}async runMiddleware(e){if(this.auth.currentUser===e)return;const t=[];try{for(const n of this.queue)await n(e),n.onAbort&&t.push(n.onAbort)}catch(e){t.reverse();for(const e of t)try{e()}catch(e){}throw this.auth._errorFactory.create("login-blocked",{originalMessage:null==e?void 0:e.message})}}}class Mt{constructor(e){var t,n,r,o;const i=e.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=null!==(t=i.minPasswordLength)&&void 0!==t?t:6,i.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=i.maxPasswordLength),void 0!==i.containsLowercaseCharacter&&(this.customStrengthOptions.containsLowercaseLetter=i.containsLowercaseCharacter),void 0!==i.containsUppercaseCharacter&&(this.customStrengthOptions.containsUppercaseLetter=i.containsUppercaseCharacter),void 0!==i.containsNumericCharacter&&(this.customStrengthOptions.containsNumericCharacter=i.containsNumericCharacter),void 0!==i.containsNonAlphanumericCharacter&&(this.customStrengthOptions.containsNonAlphanumericCharacter=i.containsNonAlphanumericCharacter),this.enforcementState=e.enforcementState,"ENFORCEMENT_STATE_UNSPECIFIED"===this.enforcementState&&(this.enforcementState="OFF"),this.allowedNonAlphanumericCharacters=null!==(r=null===(n=e.allowedNonAlphanumericCharacters)||void 0===n?void 0:n.join(""))&&void 0!==r?r:"",this.forceUpgradeOnSignin=null!==(o=e.forceUpgradeOnSignin)&&void 0!==o&&o,this.schemaVersion=e.schemaVersion}validatePassword(e){var t,n,r,o,i,a;const s={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(e,s),this.validatePasswordCharacterOptions(e,s),s.isValid&&(s.isValid=null===(t=s.meetsMinPasswordLength)||void 0===t||t),s.isValid&&(s.isValid=null===(n=s.meetsMaxPasswordLength)||void 0===n||n),s.isValid&&(s.isValid=null===(r=s.containsLowercaseLetter)||void 0===r||r),s.isValid&&(s.isValid=null===(o=s.containsUppercaseLetter)||void 0===o||o),s.isValid&&(s.isValid=null===(i=s.containsNumericCharacter)||void 0===i||i),s.isValid&&(s.isValid=null===(a=s.containsNonAlphanumericCharacter)||void 0===a||a),s}validatePasswordLengthOptions(e,t){const n=this.customStrengthOptions.minPasswordLength,r=this.customStrengthOptions.maxPasswordLength;n&&(t.meetsMinPasswordLength=e.length>=n),r&&(t.meetsMaxPasswordLength=e.length<=r)}validatePasswordCharacterOptions(e,t){let n;this.updatePasswordCharacterOptionsStatuses(t,!1,!1,!1,!1);for(let r=0;r<e.length;r++)n=e.charAt(r),this.updatePasswordCharacterOptionsStatuses(t,n>="a"&&n<="z",n>="A"&&n<="Z",n>="0"&&n<="9",this.allowedNonAlphanumericCharacters.includes(n))}updatePasswordCharacterOptionsStatuses(e,t,n,r,o){this.customStrengthOptions.containsLowercaseLetter&&(e.containsLowercaseLetter||(e.containsLowercaseLetter=t)),this.customStrengthOptions.containsUppercaseLetter&&(e.containsUppercaseLetter||(e.containsUppercaseLetter=n)),this.customStrengthOptions.containsNumericCharacter&&(e.containsNumericCharacter||(e.containsNumericCharacter=r)),this.customStrengthOptions.containsNonAlphanumericCharacter&&(e.containsNonAlphanumericCharacter||(e.containsNonAlphanumericCharacter=o))}}class jt{constructor(e,t,n,r){this.app=e,this.heartbeatServiceProvider=t,this.appCheckServiceProvider=n,this.config=r,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new Bt(this),this.idTokenSubscription=new Bt(this),this.beforeStateQueue=new Nt(this),this.redirectUser=null,this.isProactiveRefreshEnabled=!1,this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION=1,this._canInitEmulator=!0,this._isInitialized=!1,this._deleted=!1,this._initializationPromise=null,this._popupRedirectResolver=null,this._errorFactory=Ae,this._agentRecaptchaConfig=null,this._tenantRecaptchaConfigs={},this._projectPasswordPolicy=null,this._tenantPasswordPolicies={},this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=e.name,this.clientVersion=r.sdkClientVersion}_initializeWithPersistence(e,t){return t&&(this._popupRedirectResolver=yt(t)),this._initializationPromise=this.queue((async()=>{var n,r;if(!this._deleted&&(this.persistenceManager=await _t.create(this,e),!this._deleted)){if(null===(n=this._popupRedirectResolver)||void 0===n?void 0:n._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch(e){}await this.initializeCurrentUser(t),this.lastNotifiedUid=(null===(r=this.currentUser)||void 0===r?void 0:r.uid)||null,this._deleted||(this._isInitialized=!0)}})),this._initializationPromise}async _onStorageEvent(){if(this._deleted)return;const e=await this.assertedPersistence.getCurrentUser();return this.currentUser||e?this.currentUser&&e&&this.currentUser.uid===e.uid?(this._currentUser._assign(e),void await this.currentUser.getIdToken()):void await this._updateCurrentUser(e,!0):void 0}async initializeCurrentUser(e){var t;const n=await this.assertedPersistence.getCurrentUser();let r=n,o=!1;if(e&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();const n=null===(t=this.redirectUser)||void 0===t?void 0:t._redirectEventId,i=null==r?void 0:r._redirectEventId,a=await this.tryRedirectSignIn(e);n&&n!==i||!(null==a?void 0:a.user)||(r=a.user,o=!0)}if(!r)return this.directlySetCurrentUser(null);if(!r._redirectEventId){if(o)try{await this.beforeStateQueue.runMiddleware(r)}catch(e){r=n,this._popupRedirectResolver._overrideRedirectResult(this,(()=>Promise.reject(e)))}return r?this.reloadAndSetCurrentUserOrClear(r):this.directlySetCurrentUser(null)}return $e(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===r._redirectEventId?this.directlySetCurrentUser(r):this.reloadAndSetCurrentUserOrClear(r)}async tryRedirectSignIn(e){let t=null;try{t=await this._popupRedirectResolver._completeRedirectFn(this,e,!0)}catch(e){await this._setRedirectUser(null)}return t}async reloadAndSetCurrentUserOrClear(e){try{await pt(e)}catch(e){if("auth/network-request-failed"!==(null==e?void 0:e.code))return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(e)}useDeviceLanguage(){this.languageCode=function(){if("undefined"==typeof navigator)return null;const e=navigator;return e.languages&&e.languages[0]||e.language||null}()}async _delete(){this._deleted=!0}async updateCurrentUser(e){const t=e?T(e):null;return t&&$e(t.auth.config.apiKey===this.config.apiKey,this,"invalid-user-token"),this._updateCurrentUser(t&&t._clone(this))}async _updateCurrentUser(e,t=!1){if(!this._deleted)return e&&$e(this.tenantId===e.tenantId,this,"tenant-id-mismatch"),t||await this.beforeStateQueue.runMiddleware(e),this.queue((async()=>{await this.directlySetCurrentUser(e),this.notifyAuthListeners()}))}async signOut(){return await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0)}setPersistence(e){return this.queue((async()=>{await this.assertedPersistence.setPersistence(yt(e))}))}_getRecaptchaConfig(){return null==this.tenantId?this._agentRecaptchaConfig:this._tenantRecaptchaConfigs[this.tenantId]}async validatePassword(e){this._getPasswordPolicyInternal()||await this._updatePasswordPolicy();const t=this._getPasswordPolicyInternal();return t.schemaVersion!==this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION?Promise.reject(this._errorFactory.create("unsupported-password-policy-schema-version",{})):t.validatePassword(e)}_getPasswordPolicyInternal(){return null===this.tenantId?this._projectPasswordPolicy:this._tenantPasswordPolicies[this.tenantId]}async _updatePasswordPolicy(){const e=await async function(e,t={}){return et(e,"GET","/v2/passwordPolicy",Xe(e,t))}(this),t=new Mt(e);null===this.tenantId?this._projectPasswordPolicy=t:this._tenantPasswordPolicies[this.tenantId]=t}_getPersistence(){return this.assertedPersistence.persistence.type}_updateErrorMap(e){this._errorFactory=new y("auth","Firebase",e())}onAuthStateChanged(e,t,n){return this.registerStateListener(this.authStateSubscription,e,t,n)}beforeAuthStateChanged(e,t){return this.beforeStateQueue.pushCallback(e,t)}onIdTokenChanged(e,t,n){return this.registerStateListener(this.idTokenSubscription,e,t,n)}authStateReady(){return new Promise(((e,t)=>{if(this.currentUser)e();else{const n=this.onAuthStateChanged((()=>{n(),e()}),t)}}))}toJSON(){var e;return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:null===(e=this._currentUser)||void 0===e?void 0:e.toJSON()}}async _setRedirectUser(e,t){const n=await this.getOrInitRedirectPersistenceManager(t);return null===e?n.removeCurrentUser():n.setCurrentUser(e)}async getOrInitRedirectPersistenceManager(e){if(!this.redirectPersistenceManager){const t=e&&yt(e)||this._popupRedirectResolver;$e(t,this,"argument-error"),this.redirectPersistenceManager=await _t.create(this,[yt(t._redirectPersistence)],"redirectUser"),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager}async _redirectUserForId(e){var t,n;return this._isInitialized&&await this.queue((async()=>{})),(null===(t=this._currentUser)||void 0===t?void 0:t._redirectEventId)===e?this._currentUser:(null===(n=this.redirectUser)||void 0===n?void 0:n._redirectEventId)===e?this.redirectUser:null}async _persistUserIfCurrent(e){if(e===this.currentUser)return this.queue((async()=>this.directlySetCurrentUser(e)))}_notifyListenersIfCurrent(e){e===this.currentUser&&this.notifyAuthListeners()}_key(){return`${this.config.authDomain}:${this.config.apiKey}:${this.name}`}_startProactiveRefresh(){this.isProactiveRefreshEnabled=!0,this.currentUser&&this._currentUser._startProactiveRefresh()}_stopProactiveRefresh(){this.isProactiveRefreshEnabled=!1,this.currentUser&&this._currentUser._stopProactiveRefresh()}get _currentUser(){return this.currentUser}notifyAuthListeners(){var e,t;if(!this._isInitialized)return;this.idTokenSubscription.next(this.currentUser);const n=null!==(t=null===(e=this.currentUser)||void 0===e?void 0:e.uid)&&void 0!==t?t:null;this.lastNotifiedUid!==n&&(this.lastNotifiedUid=n,this.authStateSubscription.next(this.currentUser))}registerStateListener(e,t,n,r){if(this._deleted)return()=>{};const o="function"==typeof t?t:t.next.bind(t);let i=!1;const a=this._isInitialized?Promise.resolve():this._initializationPromise;if($e(a,this,"internal-error"),a.then((()=>{i||o(this.currentUser)})),"function"==typeof t){const o=e.addObserver(t,n,r);return()=>{i=!0,o()}}{const n=e.addObserver(t);return()=>{i=!0,n()}}}async directlySetCurrentUser(e){this.currentUser&&this.currentUser!==e&&this._currentUser._stopProactiveRefresh(),e&&this.isProactiveRefreshEnabled&&e._startProactiveRefresh(),this.currentUser=e,e?await this.assertedPersistence.setCurrentUser(e):await this.assertedPersistence.removeCurrentUser()}queue(e){return this.operations=this.operations.then(e,e),this.operations}get assertedPersistence(){return $e(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(e){e&&!this.frameworks.includes(e)&&(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=Lt(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){var e;const t={"X-Client-Version":this.clientVersion};this.app.options.appId&&(t["X-Firebase-gmpid"]=this.app.options.appId);const n=await(null===(e=this.heartbeatServiceProvider.getImmediate({optional:!0}))||void 0===e?void 0:e.getHeartbeatsHeader());n&&(t["X-Firebase-Client"]=n);const r=await this._getAppCheckToken();return r&&(t["X-Firebase-AppCheck"]=r),t}async _getAppCheckToken(){var e;const t=await(null===(e=this.appCheckServiceProvider.getImmediate({optional:!0}))||void 0===e?void 0:e.getToken());return(null==t?void 0:t.error)&&function(e,...t){Le.logLevel<=A.WARN&&Le.warn(`Auth (${me}): ${e}`,...t)}(`Error while retrieving App Check token: ${t.error}`),null==t?void 0:t.token}}function Ut(e){return T(e)}class Bt{constructor(e){this.auth=e,this.observer=null,this.addObserver=function(e,t){const n=new P(e,t);return n.subscribe.bind(n)}((e=>this.observer=e))}get next(){return $e(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}function Ft(e){return new Promise(((t,n)=>{const r=document.createElement("script");var o,i;r.setAttribute("src",e),r.onload=t,r.onerror=e=>{const t=je("internal-error");t.customData=e,n(t)},r.type="text/javascript",r.charset="UTF-8",(null!==(i=null===(o=document.getElementsByTagName("head"))||void 0===o?void 0:o[0])&&void 0!==i?i:document).appendChild(r)}))}function $t(e){return`__${e}${Math.floor(1e6*Math.random())}`}class Ht{constructor(e){this.type="recaptcha-enterprise",this.auth=Ut(e)}async verify(e="verify",t=!1){function n(t,n,r){const o=window.grecaptcha;xe(o)?o.enterprise.ready((()=>{o.enterprise.execute(t,{action:e}).then((e=>{n(e)})).catch((()=>{n("NO_RECAPTCHA")}))})):r(Error("No reCAPTCHA enterprise script loaded."))}return new Promise(((e,r)=>{(async function(e){if(!t){if(null==e.tenantId&&null!=e._agentRecaptchaConfig)return e._agentRecaptchaConfig.siteKey;if(null!=e.tenantId&&void 0!==e._tenantRecaptchaConfigs[e.tenantId])return e._tenantRecaptchaConfigs[e.tenantId].siteKey}return new Promise((async(t,n)=>{at(e,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}).then((r=>{if(void 0!==r.recaptchaKey){const n=new De(r);return null==e.tenantId?e._agentRecaptchaConfig=n:e._tenantRecaptchaConfigs[e.tenantId]=n,t(n.siteKey)}n(new Error("recaptcha Enterprise site key undefined"))})).catch((e=>{n(e)}))}))})(this.auth).then((o=>{if(!t&&xe(window.grecaptcha))n(o,e,r);else{if("undefined"==typeof window)return void r(new Error("RecaptchaVerifier is only supported in browser"));Ft("https://www.google.com/recaptcha/enterprise.js?render="+o).then((()=>{n(o,e,r)})).catch((e=>{r(e)}))}})).catch((e=>{r(e)}))}))}}async function Vt(e,t,n,r=!1){const o=new Ht(e);let i;try{i=await o.verify(n)}catch(e){i=await o.verify(n,!0)}const a=Object.assign({},t);return r?Object.assign(a,{captchaResp:i}):Object.assign(a,{captchaResponse:i}),Object.assign(a,{clientType:"CLIENT_TYPE_WEB"}),Object.assign(a,{recaptchaVersion:"RECAPTCHA_ENTERPRISE"}),a}function Wt(e,t,n){const r=Ut(e);$e(r._canInitEmulator,r,"emulator-config-failed"),$e(/^https?:\/\//.test(t),r,"invalid-emulator-scheme");const o=!!(null==n?void 0:n.disableWarnings),i=qt(t),{host:a,port:s}=function(e){const t=qt(e),n=/(\/\/)?([^?#/]+)/.exec(e.substr(t.length));if(!n)return{host:"",port:null};const r=n[2].split("@").pop()||"",o=/^(\[[^\]]+\])(:|$)/.exec(r);if(o){const e=o[1];return{host:e,port:Gt(r.substr(e.length+1))}}{const[e,t]=r.split(":");return{host:e,port:Gt(t)}}}(t),c=null===s?"":`:${s}`;r.config.emulator={url:`${i}//${a}${c}/`},r.settings.appVerificationDisabledForTesting=!0,r.emulatorConfig=Object.freeze({host:a,port:s,protocol:i.replace(":",""),options:Object.freeze({disableWarnings:o})}),o||function(){function e(){const e=document.createElement("p"),t=e.style;e.innerText="Running in emulator mode. Do not use with production credentials.",t.position="fixed",t.width="100%",t.backgroundColor="#ffffff",t.border=".1em solid #000000",t.color="#b50000",t.bottom="0px",t.left="0px",t.margin="0px",t.zIndex="10000",t.textAlign="center",e.classList.add("firebase-emulator-warning"),document.body.appendChild(e)}"undefined"!=typeof console&&"function"==typeof console.info&&console.info("WARNING: You are using the Auth Emulator, which is intended for local testing only.  Do not use with production credentials.");"undefined"!=typeof window&&"undefined"!=typeof document&&("loading"===document.readyState?window.addEventListener("DOMContentLoaded",e):e())}()}function qt(e){const t=e.indexOf(":");return t<0?"":e.substr(0,t+1)}function Gt(e){if(!e)return null;const t=Number(e);return isNaN(t)?null:t}class zt{constructor(e,t){this.providerId=e,this.signInMethod=t}toJSON(){return He("not implemented")}_getIdTokenResponse(e){return He("not implemented")}_linkToIdToken(e,t){return He("not implemented")}_getReauthenticationResolver(e){return He("not implemented")}}async function Kt(e,t){return et(e,"POST","/v1/accounts:update",t)}async function Yt(e,t){return nt(e,"POST","/v1/accounts:signInWithPassword",Xe(e,t))}async function Jt(e,t){return et(e,"POST","/v1/accounts:sendOobCode",Xe(e,t))}async function Qt(e,t){return Jt(e,t)}class Zt extends zt{constructor(e,t,n,r=null){super("password",n),this._email=e,this._password=t,this._tenantId=r}static _fromEmailAndPassword(e,t){return new Zt(e,t,"password")}static _fromEmailAndCode(e,t,n=null){return new Zt(e,t,"emailLink",n)}toJSON(){return{email:this._email,password:this._password,signInMethod:this.signInMethod,tenantId:this._tenantId}}static fromJSON(e){const t="string"==typeof e?JSON.parse(e):e;if((null==t?void 0:t.email)&&(null==t?void 0:t.password)){if("password"===t.signInMethod)return this._fromEmailAndPassword(t.email,t.password);if("emailLink"===t.signInMethod)return this._fromEmailAndCode(t.email,t.password,t.tenantId)}return null}async _getIdTokenResponse(e){var t;switch(this.signInMethod){case"password":const n={returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"};if(null===(t=e._getRecaptchaConfig())||void 0===t?void 0:t.emailPasswordEnabled){const t=await Vt(e,n,"signInWithPassword");return Yt(e,t)}return Yt(e,n).catch((async t=>{if("auth/missing-recaptcha-token"===t.code){console.log("Sign-in with email address and password is protected by reCAPTCHA for this project. Automatically triggering the reCAPTCHA flow and restarting the sign-in flow.");const t=await Vt(e,n,"signInWithPassword");return Yt(e,t)}return Promise.reject(t)}));case"emailLink":return async function(e,t){return nt(e,"POST","/v1/accounts:signInWithEmailLink",Xe(e,t))}(e,{email:this._email,oobCode:this._password});default:Me(e,"internal-error")}}async _linkToIdToken(e,t){switch(this.signInMethod){case"password":return Kt(e,{idToken:t,returnSecureToken:!0,email:this._email,password:this._password});case"emailLink":return async function(e,t){return nt(e,"POST","/v1/accounts:signInWithEmailLink",Xe(e,t))}(e,{idToken:t,email:this._email,oobCode:this._password});default:Me(e,"internal-error")}}_getReauthenticationResolver(e){return this._getIdTokenResponse(e)}}async function Xt(e,t){return nt(e,"POST","/v1/accounts:signInWithIdp",Xe(e,t))}class en extends zt{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(e){const t=new en(e.providerId,e.signInMethod);return e.idToken||e.accessToken?(e.idToken&&(t.idToken=e.idToken),e.accessToken&&(t.accessToken=e.accessToken),e.nonce&&!e.pendingToken&&(t.nonce=e.nonce),e.pendingToken&&(t.pendingToken=e.pendingToken)):e.oauthToken&&e.oauthTokenSecret?(t.accessToken=e.oauthToken,t.secret=e.oauthTokenSecret):Me("argument-error"),t}toJSON(){return{idToken:this.idToken,accessToken:this.accessToken,secret:this.secret,nonce:this.nonce,pendingToken:this.pendingToken,providerId:this.providerId,signInMethod:this.signInMethod}}static fromJSON(e){const t="string"==typeof e?JSON.parse(e):e,{providerId:n,signInMethod:r}=t,o=Ce(t,["providerId","signInMethod"]);if(!n||!r)return null;const i=new en(n,r);return i.idToken=o.idToken||void 0,i.accessToken=o.accessToken||void 0,i.secret=o.secret,i.nonce=o.nonce,i.pendingToken=o.pendingToken||null,i}_getIdTokenResponse(e){return Xt(e,this.buildRequest())}_linkToIdToken(e,t){const n=this.buildRequest();return n.idToken=t,Xt(e,n)}_getReauthenticationResolver(e){const t=this.buildRequest();return t.autoCreate=!1,Xt(e,t)}buildRequest(){const e={requestUri:"http://localhost",returnSecureToken:!0};if(this.pendingToken)e.pendingToken=this.pendingToken;else{const t={};this.idToken&&(t.id_token=this.idToken),this.accessToken&&(t.access_token=this.accessToken),this.secret&&(t.oauth_token_secret=this.secret),t.providerId=this.providerId,this.nonce&&!this.pendingToken&&(t.nonce=this.nonce),e.postBody=_(t)}return e}}const tn={USER_NOT_FOUND:"user-not-found"};class nn extends zt{constructor(e){super("phone","phone"),this.params=e}static _fromVerification(e,t){return new nn({verificationId:e,verificationCode:t})}static _fromTokenResponse(e,t){return new nn({phoneNumber:e,temporaryProof:t})}_getIdTokenResponse(e){return async function(e,t){return nt(e,"POST","/v1/accounts:signInWithPhoneNumber",Xe(e,t))}(e,this._makeVerificationRequest())}_linkToIdToken(e,t){return async function(e,t){const n=await nt(e,"POST","/v1/accounts:signInWithPhoneNumber",Xe(e,t));if(n.temporaryProof)throw it(e,"account-exists-with-different-credential",n);return n}(e,Object.assign({idToken:t},this._makeVerificationRequest()))}_getReauthenticationResolver(e){return async function(e,t){return nt(e,"POST","/v1/accounts:signInWithPhoneNumber",Xe(e,Object.assign(Object.assign({},t),{operation:"REAUTH"})),tn)}(e,this._makeVerificationRequest())}_makeVerificationRequest(){const{temporaryProof:e,phoneNumber:t,verificationId:n,verificationCode:r}=this.params;return e&&t?{temporaryProof:e,phoneNumber:t}:{sessionInfo:n,code:r}}toJSON(){const e={providerId:this.providerId};return this.params.phoneNumber&&(e.phoneNumber=this.params.phoneNumber),this.params.temporaryProof&&(e.temporaryProof=this.params.temporaryProof),this.params.verificationCode&&(e.verificationCode=this.params.verificationCode),this.params.verificationId&&(e.verificationId=this.params.verificationId),e}static fromJSON(e){"string"==typeof e&&(e=JSON.parse(e));const{verificationId:t,verificationCode:n,phoneNumber:r,temporaryProof:o}=e;return n||t||r||o?new nn({verificationId:t,verificationCode:n,phoneNumber:r,temporaryProof:o}):null}}class rn{constructor(e){var t,n,r,o,i,a;const s=E(I(e)),c=null!==(t=s.apiKey)&&void 0!==t?t:null,l=null!==(n=s.oobCode)&&void 0!==n?n:null,u=function(e){switch(e){case"recoverEmail":return"RECOVER_EMAIL";case"resetPassword":return"PASSWORD_RESET";case"signIn":return"EMAIL_SIGNIN";case"verifyEmail":return"VERIFY_EMAIL";case"verifyAndChangeEmail":return"VERIFY_AND_CHANGE_EMAIL";case"revertSecondFactorAddition":return"REVERT_SECOND_FACTOR_ADDITION";default:return null}}(null!==(r=s.mode)&&void 0!==r?r:null);$e(c&&l&&u,"argument-error"),this.apiKey=c,this.operation=u,this.code=l,this.continueUrl=null!==(o=s.continueUrl)&&void 0!==o?o:null,this.languageCode=null!==(i=s.languageCode)&&void 0!==i?i:null,this.tenantId=null!==(a=s.tenantId)&&void 0!==a?a:null}static parseLink(e){const t=function(e){const t=E(I(e)).link,n=t?E(I(t)).deep_link_id:null,r=E(I(e)).deep_link_id;return(r?E(I(r)).link:null)||r||n||t||e}(e);try{return new rn(t)}catch(e){return null}}}class on{constructor(){this.providerId=on.PROVIDER_ID}static credential(e,t){return Zt._fromEmailAndPassword(e,t)}static credentialWithLink(e,t){const n=rn.parseLink(t);return $e(n,"argument-error"),Zt._fromEmailAndCode(e,n.code,n.tenantId)}}on.PROVIDER_ID="password",on.EMAIL_PASSWORD_SIGN_IN_METHOD="password",on.EMAIL_LINK_SIGN_IN_METHOD="emailLink";class an{constructor(e){this.providerId=e,this.defaultLanguageCode=null,this.customParameters={}}setDefaultLanguage(e){this.defaultLanguageCode=e}setCustomParameters(e){return this.customParameters=e,this}getCustomParameters(){return this.customParameters}}class sn extends an{constructor(){super(...arguments),this.scopes=[]}addScope(e){return this.scopes.includes(e)||this.scopes.push(e),this}getScopes(){return[...this.scopes]}}class cn extends sn{constructor(){super("facebook.com")}static credential(e){return en._fromParams({providerId:cn.PROVIDER_ID,signInMethod:cn.FACEBOOK_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return cn.credentialFromTaggedObject(e)}static credentialFromError(e){return cn.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e))return null;if(!e.oauthAccessToken)return null;try{return cn.credential(e.oauthAccessToken)}catch(e){return null}}}cn.FACEBOOK_SIGN_IN_METHOD="facebook.com",cn.PROVIDER_ID="facebook.com";class ln extends sn{constructor(){super("google.com"),this.addScope("profile")}static credential(e,t){return en._fromParams({providerId:ln.PROVIDER_ID,signInMethod:ln.GOOGLE_SIGN_IN_METHOD,idToken:e,accessToken:t})}static credentialFromResult(e){return ln.credentialFromTaggedObject(e)}static credentialFromError(e){return ln.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthIdToken:t,oauthAccessToken:n}=e;if(!t&&!n)return null;try{return ln.credential(t,n)}catch(e){return null}}}ln.GOOGLE_SIGN_IN_METHOD="google.com",ln.PROVIDER_ID="google.com";class un extends sn{constructor(){super("github.com")}static credential(e){return en._fromParams({providerId:un.PROVIDER_ID,signInMethod:un.GITHUB_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return un.credentialFromTaggedObject(e)}static credentialFromError(e){return un.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e))return null;if(!e.oauthAccessToken)return null;try{return un.credential(e.oauthAccessToken)}catch(e){return null}}}un.GITHUB_SIGN_IN_METHOD="github.com",un.PROVIDER_ID="github.com";class dn extends sn{constructor(){super("twitter.com")}static credential(e,t){return en._fromParams({providerId:dn.PROVIDER_ID,signInMethod:dn.TWITTER_SIGN_IN_METHOD,oauthToken:e,oauthTokenSecret:t})}static credentialFromResult(e){return dn.credentialFromTaggedObject(e)}static credentialFromError(e){return dn.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthAccessToken:t,oauthTokenSecret:n}=e;if(!t||!n)return null;try{return dn.credential(t,n)}catch(e){return null}}}async function hn(e,t){return nt(e,"POST","/v1/accounts:signUp",Xe(e,t))}dn.TWITTER_SIGN_IN_METHOD="twitter.com",dn.PROVIDER_ID="twitter.com";class pn{constructor(e){this.user=e.user,this.providerId=e.providerId,this._tokenResponse=e._tokenResponse,this.operationType=e.operationType}static async _fromIdTokenResponse(e,t,n,r=!1){const o=await vt._fromIdTokenResponse(e,n,r),i=fn(n);return new pn({user:o,providerId:i,_tokenResponse:n,operationType:t})}static async _forOperation(e,t,n){await e._updateTokensIfNecessary(n,!0);const r=fn(n);return new pn({user:e,providerId:r,_tokenResponse:n,operationType:t})}}function fn(e){return e.providerId?e.providerId:"phoneNumber"in e?"phone":null}class mn extends g{constructor(e,t,n,r){var o;super(t.code,t.message),this.operationType=n,this.user=r,Object.setPrototypeOf(this,mn.prototype),this.customData={appName:e.name,tenantId:null!==(o=e.tenantId)&&void 0!==o?o:void 0,_serverResponse:t.customData._serverResponse,operationType:n}}static _fromErrorAndOperation(e,t,n,r){return new mn(e,t,n,r)}}function vn(e,t,n,r){return("reauthenticate"===t?n._getReauthenticationResolver(e):n._getIdTokenResponse(e)).catch((n=>{if("auth/multi-factor-auth-required"===n.code)throw mn._fromErrorAndOperation(e,n,t,r);throw n}))}async function gn(e,t,n=!1){const r=await ut(e,t._linkToIdToken(e.auth,await e.getIdToken()),n);return pn._forOperation(e,"link",r)}async function yn(e,t,n=!1){const{auth:r}=e,o="reauthenticate";try{const i=await ut(e,vn(r,o,t,e),n);$e(i.idToken,r,"internal-error");const a=lt(i.idToken);$e(a,r,"internal-error");const{sub:s}=a;return $e(e.uid===s,r,"user-mismatch"),pn._forOperation(e,o,i)}catch(e){throw"auth/user-not-found"===(null==e?void 0:e.code)&&Me(r,"user-mismatch"),e}}async function wn(e,t,n=!1){const r="signIn",o=await vn(e,r,t),i=await pn._fromIdTokenResponse(e,r,o);return n||await e._updateCurrentUser(i.user),i}async function bn(e,t){return wn(Ut(e),t)}function kn(e,t,n){var r;$e((null===(r=n.url)||void 0===r?void 0:r.length)>0,e,"invalid-continue-uri"),$e(void 0===n.dynamicLinkDomain||n.dynamicLinkDomain.length>0,e,"invalid-dynamic-link-domain"),t.continueUrl=n.url,t.dynamicLinkDomain=n.dynamicLinkDomain,t.canHandleCodeInApp=n.handleCodeInApp,n.iOS&&($e(n.iOS.bundleId.length>0,e,"missing-ios-bundle-id"),t.iOSBundleId=n.iOS.bundleId),n.android&&($e(n.android.packageName.length>0,e,"missing-android-pkg-name"),t.androidInstallApp=n.android.installApp,t.androidMinimumVersionCode=n.android.minimumVersion,t.androidPackageName=n.android.packageName)}async function _n(e){const t=Ut(e);t._getPasswordPolicyInternal()&&await t._updatePasswordPolicy()}async function En(e,t,n){var r;const o=Ut(e),i={requestType:"PASSWORD_RESET",email:t,clientType:"CLIENT_TYPE_WEB"};if(null===(r=o._getRecaptchaConfig())||void 0===r?void 0:r.emailPasswordEnabled){const e=await Vt(o,i,"getOobCode",!0);n&&kn(o,e,n),await Qt(o,e)}else n&&kn(o,i,n),await Qt(o,i).catch((async e=>{if("auth/missing-recaptcha-token"!==e.code)return Promise.reject(e);{console.log("Password resets are protected by reCAPTCHA for this project. Automatically triggering the reCAPTCHA flow and restarting the password reset flow.");const e=await Vt(o,i,"getOobCode",!0);n&&kn(o,e,n),await Qt(o,e)}}))}async function In(e,t,n){var r;const o=Ut(e),i={returnSecureToken:!0,email:t,password:n,clientType:"CLIENT_TYPE_WEB"};let a;if(null===(r=o._getRecaptchaConfig())||void 0===r?void 0:r.emailPasswordEnabled){const e=await Vt(o,i,"signUpPassword");a=hn(o,e)}else a=hn(o,i).catch((async e=>{if("auth/missing-recaptcha-token"===e.code){console.log("Sign-up is protected by reCAPTCHA for this project. Automatically triggering the reCAPTCHA flow and restarting the sign-up flow.");const e=await Vt(o,i,"signUpPassword");return hn(o,e)}throw e}));const s=await a.catch((t=>{throw"auth/password-does-not-meet-requirements"===t.code&&_n(e),t})),c=await pn._fromIdTokenResponse(o,"signIn",s);return await o._updateCurrentUser(c.user),c}function Pn(e,t,n){return bn(T(e),on.credential(t,n)).catch((async t=>{throw"auth/password-does-not-meet-requirements"===t.code&&_n(e),t}))}async function Sn(e,t){const n=T(e),r={requestType:"VERIFY_EMAIL",idToken:await e.getIdToken()};t&&kn(n.auth,r,t);const{email:o}=await async function(e,t){return Jt(e,t)}(n.auth,r);o!==e.email&&await e.reload()}function Tn(e){return T(e).signOut()}new WeakMap;const Cn="__sak";class xn{constructor(e,t){this.storageRetriever=e,this.type=t}_isAvailable(){try{return this.storage?(this.storage.setItem(Cn,"1"),this.storage.removeItem(Cn),Promise.resolve(!0)):Promise.resolve(!1)}catch(e){return Promise.resolve(!1)}}_set(e,t){return this.storage.setItem(e,JSON.stringify(t)),Promise.resolve()}_get(e){const t=this.storage.getItem(e);return Promise.resolve(t?JSON.parse(t):null)}_remove(e){return this.storage.removeItem(e),Promise.resolve()}get storage(){return this.storageRetriever()}}class Dn extends xn{constructor(){super((()=>window.localStorage),"LOCAL"),this.boundEventHandler=(e,t)=>this.onStorageEvent(e,t),this.listeners={},this.localCache={},this.pollTimer=null,this.safariLocalStorageNotSynced=function(){const e=v();return Pt(e)||Rt(e)}()&&function(){try{return!(!window||window===window.top)}catch(e){return!1}}(),this.fallbackToPolling=At(),this._shouldAllowMigration=!0}forAllChangedKeys(e){for(const t of Object.keys(this.listeners)){const n=this.storage.getItem(t),r=this.localCache[t];n!==r&&e(t,r,n)}}onStorageEvent(e,t=!1){if(!e.key)return void this.forAllChangedKeys(((e,t,n)=>{this.notifyListeners(e,n)}));const n=e.key;if(t?this.detachListener():this.stopPolling(),this.safariLocalStorageNotSynced){const r=this.storage.getItem(n);if(e.newValue!==r)null!==e.newValue?this.storage.setItem(n,e.newValue):this.storage.removeItem(n);else if(this.localCache[n]===e.newValue&&!t)return}const r=()=>{const e=this.storage.getItem(n);(t||this.localCache[n]!==e)&&this.notifyListeners(n,e)},o=this.storage.getItem(n);Ot()&&o!==e.newValue&&e.newValue!==e.oldValue?setTimeout(r,10):r()}notifyListeners(e,t){this.localCache[e]=t;const n=this.listeners[e];if(n)for(const e of Array.from(n))e(t?JSON.parse(t):t)}startPolling(){this.stopPolling(),this.pollTimer=setInterval((()=>{this.forAllChangedKeys(((e,t,n)=>{this.onStorageEvent(new StorageEvent("storage",{key:e,oldValue:t,newValue:n}),!0)}))}),1e3)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}attachListener(){window.addEventListener("storage",this.boundEventHandler)}detachListener(){window.removeEventListener("storage",this.boundEventHandler)}_addListener(e,t){0===Object.keys(this.listeners).length&&(this.fallbackToPolling?this.startPolling():this.attachListener()),this.listeners[e]||(this.listeners[e]=new Set,this.localCache[e]=this.storage.getItem(e)),this.listeners[e].add(t)}_removeListener(e,t){this.listeners[e]&&(this.listeners[e].delete(t),0===this.listeners[e].size&&delete this.listeners[e]),0===Object.keys(this.listeners).length&&(this.detachListener(),this.stopPolling())}async _set(e,t){await super._set(e,t),this.localCache[e]=JSON.stringify(t)}async _get(e){const t=await super._get(e);return this.localCache[e]=JSON.stringify(t),t}async _remove(e){await super._remove(e),delete this.localCache[e]}}Dn.type="LOCAL";const Rn=Dn;class On extends xn{constructor(){super((()=>window.sessionStorage),"SESSION")}_addListener(e,t){}_removeListener(e,t){}}On.type="SESSION";const An=On;class Ln{constructor(e){this.eventTarget=e,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(e){const t=this.receivers.find((t=>t.isListeningto(e)));if(t)return t;const n=new Ln(e);return this.receivers.push(n),n}isListeningto(e){return this.eventTarget===e}async handleEvent(e){const t=e,{eventId:n,eventType:r,data:o}=t.data,i=this.handlersMap[r];if(!(null==i?void 0:i.size))return;t.ports[0].postMessage({status:"ack",eventId:n,eventType:r});const a=Array.from(i).map((async e=>e(t.origin,o))),s=await function(e){return Promise.all(e.map((async e=>{try{return{fulfilled:!0,value:await e}}catch(e){return{fulfilled:!1,reason:e}}})))}(a);t.ports[0].postMessage({status:"done",eventId:n,eventType:r,response:s})}_subscribe(e,t){0===Object.keys(this.handlersMap).length&&this.eventTarget.addEventListener("message",this.boundEventHandler),this.handlersMap[e]||(this.handlersMap[e]=new Set),this.handlersMap[e].add(t)}_unsubscribe(e,t){this.handlersMap[e]&&t&&this.handlersMap[e].delete(t),t&&0!==this.handlersMap[e].size||delete this.handlersMap[e],0===Object.keys(this.handlersMap).length&&this.eventTarget.removeEventListener("message",this.boundEventHandler)}}function Nn(e="",t=10){let n="";for(let e=0;e<t;e++)n+=Math.floor(10*Math.random());return e+n}Ln.receivers=[];class Mn{constructor(e){this.target=e,this.handlers=new Set}removeMessageHandler(e){e.messageChannel&&(e.messageChannel.port1.removeEventListener("message",e.onMessage),e.messageChannel.port1.close()),this.handlers.delete(e)}async _send(e,t,n=50){const r="undefined"!=typeof MessageChannel?new MessageChannel:null;if(!r)throw new Error("connection_unavailable");let o,i;return new Promise(((a,s)=>{const c=Nn("",20);r.port1.start();const l=setTimeout((()=>{s(new Error("unsupported_event"))}),n);i={messageChannel:r,onMessage(e){const t=e;if(t.data.eventId===c)switch(t.data.status){case"ack":clearTimeout(l),o=setTimeout((()=>{s(new Error("timeout"))}),3e3);break;case"done":clearTimeout(o),a(t.data.response);break;default:clearTimeout(l),clearTimeout(o),s(new Error("invalid_response"))}}},this.handlers.add(i),r.port1.addEventListener("message",i.onMessage),this.target.postMessage({eventType:e,eventId:c,data:t},[r.port2])})).finally((()=>{i&&this.removeMessageHandler(i)}))}}function jn(){return window}function Un(){return void 0!==jn().WorkerGlobalScope&&"function"==typeof jn().importScripts}const Bn="firebaseLocalStorageDb",Fn="firebaseLocalStorage",$n="fbase_key";class Hn{constructor(e){this.request=e}toPromise(){return new Promise(((e,t)=>{this.request.addEventListener("success",(()=>{e(this.request.result)})),this.request.addEventListener("error",(()=>{t(this.request.error)}))}))}}function Vn(e,t){return e.transaction([Fn],t?"readwrite":"readonly").objectStore(Fn)}function Wn(){const e=indexedDB.open(Bn,1);return new Promise(((t,n)=>{e.addEventListener("error",(()=>{n(e.error)})),e.addEventListener("upgradeneeded",(()=>{const t=e.result;try{t.createObjectStore(Fn,{keyPath:$n})}catch(e){n(e)}})),e.addEventListener("success",(async()=>{const n=e.result;n.objectStoreNames.contains(Fn)?t(n):(n.close(),await function(){const e=indexedDB.deleteDatabase(Bn);return new Hn(e).toPromise()}(),t(await Wn()))}))}))}async function qn(e,t,n){const r=Vn(e,!0).put({[$n]:t,value:n});return new Hn(r).toPromise()}function Gn(e,t){const n=Vn(e,!0).delete(t);return new Hn(n).toPromise()}class zn{constructor(){this.type="LOCAL",this._shouldAllowMigration=!0,this.listeners={},this.localCache={},this.pollTimer=null,this.pendingWrites=0,this.receiver=null,this.sender=null,this.serviceWorkerReceiverAvailable=!1,this.activeServiceWorker=null,this._workerInitializationPromise=this.initializeServiceWorkerMessaging().then((()=>{}),(()=>{}))}async _openDb(){return this.db||(this.db=await Wn()),this.db}async _withRetries(e){let t=0;for(;;)try{const t=await this._openDb();return await e(t)}catch(e){if(t++>3)throw e;this.db&&(this.db.close(),this.db=void 0)}}async initializeServiceWorkerMessaging(){return Un()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=Ln._getInstance(Un()?self:null),this.receiver._subscribe("keyChanged",(async(e,t)=>({keyProcessed:(await this._poll()).includes(t.key)}))),this.receiver._subscribe("ping",(async(e,t)=>["keyChanged"]))}async initializeSender(){var e,t;if(this.activeServiceWorker=await async function(){if(!(null===navigator||void 0===navigator?void 0:navigator.serviceWorker))return null;try{return(await navigator.serviceWorker.ready).active}catch(e){return null}}(),!this.activeServiceWorker)return;this.sender=new Mn(this.activeServiceWorker);const n=await this.sender._send("ping",{},800);n&&(null===(e=n[0])||void 0===e?void 0:e.fulfilled)&&(null===(t=n[0])||void 0===t?void 0:t.value.includes("keyChanged"))&&(this.serviceWorkerReceiverAvailable=!0)}async notifyServiceWorker(e){var t;if(this.sender&&this.activeServiceWorker&&((null===(t=null===navigator||void 0===navigator?void 0:navigator.serviceWorker)||void 0===t?void 0:t.controller)||null)===this.activeServiceWorker)try{await this.sender._send("keyChanged",{key:e},this.serviceWorkerReceiverAvailable?800:50)}catch(t){}}async _isAvailable(){try{if(!indexedDB)return!1;const e=await Wn();return await qn(e,Cn,"1"),await Gn(e,Cn),!0}catch(e){}return!1}async _withPendingWrite(e){this.pendingWrites++;try{await e()}finally{this.pendingWrites--}}async _set(e,t){return this._withPendingWrite((async()=>(await this._withRetries((n=>qn(n,e,t))),this.localCache[e]=t,this.notifyServiceWorker(e))))}async _get(e){const t=await this._withRetries((t=>async function(e,t){const n=Vn(e,!1).get(t),r=await new Hn(n).toPromise();return void 0===r?null:r.value}(t,e)));return this.localCache[e]=t,t}async _remove(e){return this._withPendingWrite((async()=>(await this._withRetries((t=>Gn(t,e))),delete this.localCache[e],this.notifyServiceWorker(e))))}async _poll(){const e=await this._withRetries((e=>{const t=Vn(e,!1).getAll();return new Hn(t).toPromise()}));if(!e)return[];if(0!==this.pendingWrites)return[];const t=[],n=new Set;for(const{fbase_key:r,value:o}of e)n.add(r),JSON.stringify(this.localCache[r])!==JSON.stringify(o)&&(this.notifyListeners(r,o),t.push(r));for(const e of Object.keys(this.localCache))this.localCache[e]&&!n.has(e)&&(this.notifyListeners(e,null),t.push(e));return t}notifyListeners(e,t){this.localCache[e]=t;const n=this.listeners[e];if(n)for(const e of Array.from(n))e(t)}startPolling(){this.stopPolling(),this.pollTimer=setInterval((async()=>this._poll()),800)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}_addListener(e,t){0===Object.keys(this.listeners).length&&this.startPolling(),this.listeners[e]||(this.listeners[e]=new Set,this._get(e)),this.listeners[e].add(t)}_removeListener(e,t){this.listeners[e]&&(this.listeners[e].delete(t),0===this.listeners[e].size&&delete this.listeners[e]),0===Object.keys(this.listeners).length&&this.stopPolling()}}zn.type="LOCAL";const Kn=zn;$t("rcb"),new Ke(3e4,6e4);const Yn="recaptcha";async function Jn(e,t,n){var r;const o=await n.verify();try{let i;if($e("string"==typeof o,e,"argument-error"),$e(n.type===Yn,e,"argument-error"),i="string"==typeof t?{phoneNumber:t}:t,"session"in i){const t=i.session;if("phoneNumber"in i){$e("enroll"===t.type,e,"internal-error");const n=await function(e,t){return et(e,"POST","/v2/accounts/mfaEnrollment:start",Xe(e,t))}(e,{idToken:t.credential,phoneEnrollmentInfo:{phoneNumber:i.phoneNumber,recaptchaToken:o}});return n.phoneSessionInfo.sessionInfo}{$e("signin"===t.type,e,"internal-error");const n=(null===(r=i.multiFactorHint)||void 0===r?void 0:r.uid)||i.multiFactorUid;$e(n,e,"missing-multi-factor-info");const a=await function(e,t){return et(e,"POST","/v2/accounts/mfaSignIn:start",Xe(e,t))}(e,{mfaPendingCredential:t.credential,mfaEnrollmentId:n,phoneSignInInfo:{recaptchaToken:o}});return a.phoneResponseInfo.sessionInfo}}{const{sessionInfo:t}=await async function(e,t){return et(e,"POST","/v1/accounts:sendVerificationCode",Xe(e,t))}(e,{phoneNumber:i.phoneNumber,recaptchaToken:o});return t}}finally{n._reset()}}class Qn{constructor(e){this.providerId=Qn.PROVIDER_ID,this.auth=Ut(e)}verifyPhoneNumber(e,t){return Jn(this.auth,e,T(t))}static credential(e,t){return nn._fromVerification(e,t)}static credentialFromResult(e){const t=e;return Qn.credentialFromTaggedObject(t)}static credentialFromError(e){return Qn.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{phoneNumber:t,temporaryProof:n}=e;return t&&n?nn._fromTokenResponse(t,n):null}}function Zn(e,t){return t?yt(t):($e(e._popupRedirectResolver,e,"argument-error"),e._popupRedirectResolver)}Qn.PROVIDER_ID="phone",Qn.PHONE_SIGN_IN_METHOD="phone";class Xn extends zt{constructor(e){super("custom","custom"),this.params=e}_getIdTokenResponse(e){return Xt(e,this._buildIdpRequest())}_linkToIdToken(e,t){return Xt(e,this._buildIdpRequest(t))}_getReauthenticationResolver(e){return Xt(e,this._buildIdpRequest())}_buildIdpRequest(e){const t={requestUri:this.params.requestUri,sessionId:this.params.sessionId,postBody:this.params.postBody,tenantId:this.params.tenantId,pendingToken:this.params.pendingToken,returnSecureToken:!0,returnIdpCredential:!0};return e&&(t.idToken=e),t}}function er(e){return wn(e.auth,new Xn(e),e.bypassAuthState)}function tr(e){const{auth:t,user:n}=e;return $e(n,t,"internal-error"),yn(n,new Xn(e),e.bypassAuthState)}async function nr(e){const{auth:t,user:n}=e;return $e(n,t,"internal-error"),gn(n,new Xn(e),e.bypassAuthState)}class rr{constructor(e,t,n,r,o=!1){this.auth=e,this.resolver=n,this.user=r,this.bypassAuthState=o,this.pendingPromise=null,this.eventManager=null,this.filter=Array.isArray(t)?t:[t]}execute(){return new Promise((async(e,t)=>{this.pendingPromise={resolve:e,reject:t};try{this.eventManager=await this.resolver._initialize(this.auth),await this.onExecution(),this.eventManager.registerConsumer(this)}catch(e){this.reject(e)}}))}async onAuthEvent(e){const{urlResponse:t,sessionId:n,postBody:r,tenantId:o,error:i,type:a}=e;if(i)return void this.reject(i);const s={auth:this.auth,requestUri:t,sessionId:n,tenantId:o||void 0,postBody:r||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(a)(s))}catch(e){this.reject(e)}}onError(e){this.reject(e)}getIdpTask(e){switch(e){case"signInViaPopup":case"signInViaRedirect":return er;case"linkViaPopup":case"linkViaRedirect":return nr;case"reauthViaPopup":case"reauthViaRedirect":return tr;default:Me(this.auth,"internal-error")}}resolve(e){Ve(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(e),this.unregisterAndCleanUp()}reject(e){Ve(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.reject(e),this.unregisterAndCleanUp()}unregisterAndCleanUp(){this.eventManager&&this.eventManager.unregisterConsumer(this),this.pendingPromise=null,this.cleanUp()}}const or=new Ke(2e3,1e4);async function ir(e,t,n){const r=Ut(e);Be(e,t,an);const o=Zn(r,n);return new ar(r,"signInViaPopup",t,o).executeNotNull()}class ar extends rr{constructor(e,t,n,r,o){super(e,t,r,o),this.provider=n,this.authWindow=null,this.pollId=null,ar.currentPopupAction&&ar.currentPopupAction.cancel(),ar.currentPopupAction=this}async executeNotNull(){const e=await this.execute();return $e(e,this.auth,"internal-error"),e}async onExecution(){Ve(1===this.filter.length,"Popup operations only handle one event");const e=Nn();this.authWindow=await this.resolver._openPopup(this.auth,this.provider,this.filter[0],e),this.authWindow.associatedEvent=e,this.resolver._originValidation(this.auth).catch((e=>{this.reject(e)})),this.resolver._isIframeWebStorageSupported(this.auth,(e=>{e||this.reject(je(this.auth,"web-storage-unsupported"))})),this.pollUserCancellation()}get eventId(){var e;return(null===(e=this.authWindow)||void 0===e?void 0:e.associatedEvent)||null}cancel(){this.reject(je(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,ar.currentPopupAction=null}pollUserCancellation(){const e=()=>{var t,n;(null===(n=null===(t=this.authWindow)||void 0===t?void 0:t.window)||void 0===n?void 0:n.closed)?this.pollId=window.setTimeout((()=>{this.pollId=null,this.reject(je(this.auth,"popup-closed-by-user"))}),8e3):this.pollId=window.setTimeout(e,or.get())};e()}}ar.currentPopupAction=null;const sr=new Map;class cr extends rr{constructor(e,t,n=!1){super(e,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],t,void 0,n),this.eventId=null}async execute(){let e=sr.get(this.auth._key());if(!e){try{const t=await async function(e,t){const n=dr(t),r=ur(e);if(!await r._isAvailable())return!1;const o="true"===await r._get(n);return await r._remove(n),o}(this.resolver,this.auth)?await super.execute():null;e=()=>Promise.resolve(t)}catch(t){e=()=>Promise.reject(t)}sr.set(this.auth._key(),e)}return this.bypassAuthState||sr.set(this.auth._key(),(()=>Promise.resolve(null))),e()}async onAuthEvent(e){if("signInViaRedirect"===e.type)return super.onAuthEvent(e);if("unknown"!==e.type){if(e.eventId){const t=await this.auth._redirectUserForId(e.eventId);if(t)return this.user=t,super.onAuthEvent(e);this.resolve(null)}}else this.resolve(null)}async onExecution(){}cleanUp(){}}function lr(e,t){sr.set(e._key(),t)}function ur(e){return yt(e._redirectPersistence)}function dr(e){return kt("pendingRedirect",e.config.apiKey,e.name)}async function hr(e,t,n=!1){const r=Ut(e),o=Zn(r,t),i=new cr(r,o,n),a=await i.execute();return a&&!n&&(delete a.user._redirectEventId,await r._persistUserIfCurrent(a.user),await r._setRedirectUser(null,t)),a}class pr{constructor(e){this.auth=e,this.cachedEventUids=new Set,this.consumers=new Set,this.queuedRedirectEvent=null,this.hasHandledPotentialRedirect=!1,this.lastProcessedEventTime=Date.now()}registerConsumer(e){this.consumers.add(e),this.queuedRedirectEvent&&this.isEventForConsumer(this.queuedRedirectEvent,e)&&(this.sendToConsumer(this.queuedRedirectEvent,e),this.saveEventToCache(this.queuedRedirectEvent),this.queuedRedirectEvent=null)}unregisterConsumer(e){this.consumers.delete(e)}onEvent(e){if(this.hasEventBeenHandled(e))return!1;let t=!1;return this.consumers.forEach((n=>{this.isEventForConsumer(e,n)&&(t=!0,this.sendToConsumer(e,n),this.saveEventToCache(e))})),this.hasHandledPotentialRedirect||!function(e){switch(e.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return mr(e);default:return!1}}(e)||(this.hasHandledPotentialRedirect=!0,t||(this.queuedRedirectEvent=e,t=!0)),t}sendToConsumer(e,t){var n;if(e.error&&!mr(e)){const r=(null===(n=e.error.code)||void 0===n?void 0:n.split("auth/")[1])||"internal-error";t.onError(je(this.auth,r))}else t.onAuthEvent(e)}isEventForConsumer(e,t){const n=null===t.eventId||!!e.eventId&&e.eventId===t.eventId;return t.filter.includes(e.type)&&n}hasEventBeenHandled(e){return Date.now()-this.lastProcessedEventTime>=6e5&&this.cachedEventUids.clear(),this.cachedEventUids.has(fr(e))}saveEventToCache(e){this.cachedEventUids.add(fr(e)),this.lastProcessedEventTime=Date.now()}}function fr(e){return[e.type,e.eventId,e.sessionId,e.tenantId].filter((e=>e)).join("-")}function mr({type:e,error:t}){return"unknown"===e&&"auth/no-auth-event"===(null==t?void 0:t.code)}const vr=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,gr=/^https?/;async function yr(e){if(e.config.emulator)return;const{authorizedDomains:t}=await async function(e,t={}){return et(e,"GET","/v1/projects",t)}(e);for(const e of t)try{if(wr(e))return}catch(e){}Me(e,"unauthorized-domain")}function wr(e){const t=We(),{protocol:n,hostname:r}=new URL(t);if(e.startsWith("chrome-extension://")){const o=new URL(e);return""===o.hostname&&""===r?"chrome-extension:"===n&&e.replace("chrome-extension://","")===t.replace("chrome-extension://",""):"chrome-extension:"===n&&o.hostname===r}if(!gr.test(n))return!1;if(vr.test(e))return r===e;const o=e.replace(/\./g,"\\.");return new RegExp("^(.+\\."+o+"|"+o+")$","i").test(r)}const br=new Ke(3e4,6e4);function kr(){const e=jn().___jsl;if(null==e?void 0:e.H)for(const t of Object.keys(e.H))if(e.H[t].r=e.H[t].r||[],e.H[t].L=e.H[t].L||[],e.H[t].r=[...e.H[t].L],e.CP)for(let t=0;t<e.CP.length;t++)e.CP[t]=null}let _r=null;function Er(e){return _r=_r||function(e){return new Promise(((t,n)=>{var r,o,i;function a(){kr(),gapi.load("gapi.iframes",{callback:()=>{t(gapi.iframes.getContext())},ontimeout:()=>{kr(),n(je(e,"network-request-failed"))},timeout:br.get()})}if(null===(o=null===(r=jn().gapi)||void 0===r?void 0:r.iframes)||void 0===o?void 0:o.Iframe)t(gapi.iframes.getContext());else{if(!(null===(i=jn().gapi)||void 0===i?void 0:i.load)){const t=$t("iframefcb");return jn()[t]=()=>{gapi.load?a():n(je(e,"network-request-failed"))},Ft(`https://apis.google.com/js/api.js?onload=${t}`).catch((e=>n(e)))}a()}})).catch((e=>{throw _r=null,e}))}(e),_r}const Ir=new Ke(5e3,15e3),Pr={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},Sr=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function Tr(e){const t=e.config;$e(t.authDomain,e,"auth-domain-config-required");const n=t.emulator?Ye(t,"emulator/auth/iframe"):`https://${e.config.authDomain}/__/auth/iframe`,r={apiKey:t.apiKey,appName:e.name,v:me},o=Sr.get(e.config.apiHost);o&&(r.eid=o);const i=e._getFrameworks();return i.length&&(r.fw=i.join(",")),`${n}?${_(r).slice(1)}`}const Cr={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"};class xr{constructor(e){this.window=e,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch(e){}}}function Dr(e,t,n,r=500,o=600){const i=Math.max((window.screen.availHeight-o)/2,0).toString(),a=Math.max((window.screen.availWidth-r)/2,0).toString();let s="";const c=Object.assign(Object.assign({},Cr),{width:r.toString(),height:o.toString(),top:i,left:a}),l=v().toLowerCase();n&&(s=St(l)?"_blank":n),It(l)&&(t=t||"http://localhost",c.scrollbars="yes");const u=Object.entries(c).reduce(((e,[t,n])=>`${e}${t}=${n},`),"");if(function(e=v()){var t;return Rt(e)&&!!(null===(t=window.navigator)||void 0===t?void 0:t.standalone)}(l)&&"_self"!==s)return function(e,t){const n=document.createElement("a");n.href=e,n.target=t;const r=document.createEvent("MouseEvent");r.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),n.dispatchEvent(r)}(t||"",s),new xr(null);const d=window.open(t||"",s,u);$e(d,e,"popup-blocked");try{d.focus()}catch(e){}return new xr(d)}const Rr="__/auth/handler",Or="emulator/auth/handler",Ar=encodeURIComponent("fac");async function Lr(e,t,n,r,o,i){$e(e.config.authDomain,e,"auth-domain-config-required"),$e(e.config.apiKey,e,"invalid-api-key");const a={apiKey:e.config.apiKey,appName:e.name,authType:n,redirectUrl:r,v:me,eventId:o};if(t instanceof an){t.setDefaultLanguage(e.languageCode),a.providerId=t.providerId||"",function(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}(t.getCustomParameters())||(a.customParameters=JSON.stringify(t.getCustomParameters()));for(const[e,t]of Object.entries(i||{}))a[e]=t}if(t instanceof sn){const e=t.getScopes().filter((e=>""!==e));e.length>0&&(a.scopes=e.join(","))}e.tenantId&&(a.tid=e.tenantId);const s=a;for(const e of Object.keys(s))void 0===s[e]&&delete s[e];const c=await e._getAppCheckToken(),l=c?`#${Ar}=${encodeURIComponent(c)}`:"";return`${function({config:e}){if(!e.emulator)return`https://${e.authDomain}/${Rr}`;return Ye(e,Or)}(e)}?${_(s).slice(1)}${l}`}const Nr="webStorageSupport";const Mr=class{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=An,this._completeRedirectFn=hr,this._overrideRedirectResult=lr}async _openPopup(e,t,n,r){var o;Ve(null===(o=this.eventManagers[e._key()])||void 0===o?void 0:o.manager,"_initialize() not called before _openPopup()");return Dr(e,await Lr(e,t,n,We(),r),Nn())}async _openRedirect(e,t,n,r){await this._originValidation(e);return function(e){jn().location.href=e}(await Lr(e,t,n,We(),r)),new Promise((()=>{}))}_initialize(e){const t=e._key();if(this.eventManagers[t]){const{manager:e,promise:n}=this.eventManagers[t];return e?Promise.resolve(e):(Ve(n,"If manager is not set, promise should be"),n)}const n=this.initAndGetManager(e);return this.eventManagers[t]={promise:n},n.catch((()=>{delete this.eventManagers[t]})),n}async initAndGetManager(e){const t=await async function(e){const t=await Er(e),n=jn().gapi;return $e(n,e,"internal-error"),t.open({where:document.body,url:Tr(e),messageHandlersFilter:n.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:Pr,dontclear:!0},(t=>new Promise((async(n,r)=>{await t.restyle({setHideOnLeave:!1});const o=je(e,"network-request-failed"),i=jn().setTimeout((()=>{r(o)}),Ir.get());function a(){jn().clearTimeout(i),n(t)}t.ping(a).then(a,(()=>{r(o)}))}))))}(e),n=new pr(e);return t.register("authEvent",(t=>{$e(null==t?void 0:t.authEvent,e,"invalid-auth-event");return{status:n.onEvent(t.authEvent)?"ACK":"ERROR"}}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[e._key()]={manager:n},this.iframes[e._key()]=t,n}_isIframeWebStorageSupported(e,t){this.iframes[e._key()].send(Nr,{type:Nr},(n=>{var r;const o=null===(r=null==n?void 0:n[0])||void 0===r?void 0:r[Nr];void 0!==o&&t(!!o),Me(e,"internal-error")}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(e){const t=e._key();return this.originValidationPromises[t]||(this.originValidationPromises[t]=yr(e)),this.originValidationPromises[t]}get _shouldInitProactively(){return At()||Pt()||Rt()}};var jr="@firebase/auth",Ur="1.3.0";class Br{constructor(e){this.auth=e,this.internalListeners=new Map}getUid(){var e;return this.assertAuthConfigured(),(null===(e=this.auth.currentUser)||void 0===e?void 0:e.uid)||null}async getToken(e){if(this.assertAuthConfigured(),await this.auth._initializationPromise,!this.auth.currentUser)return null;return{accessToken:await this.auth.currentUser.getIdToken(e)}}addAuthTokenListener(e){if(this.assertAuthConfigured(),this.internalListeners.has(e))return;const t=this.auth.onIdTokenChanged((t=>{e((null==t?void 0:t.stsTokenManager.accessToken)||null)}));this.internalListeners.set(e,t),this.updateProactiveRefresh()}removeAuthTokenListener(e){this.assertAuthConfigured();const t=this.internalListeners.get(e);t&&(this.internalListeners.delete(e),t(),this.updateProactiveRefresh())}assertAuthConfigured(){$e(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}}const Fr=f("authIdTokenMaxAge")||300;let $r=null;function Hr(e=function(e=ae){const t=ce.get(e);if(!t&&e===ae&&p())return ve();if(!t)throw pe.create("no-app",{appName:e});return t}()){const t=he(e,"auth");if(t.isInitialized())return t.getImmediate();const n=function(e,t){const n=he(e,"auth");if(n.isInitialized()){const e=n.getImmediate();if(b(n.getOptions(),null!=t?t:{}))return e;Me(e,"already-initialized")}return n.initialize({options:t})}(e,{popupRedirectResolver:Mr,persistence:[Kn,Rn,An]}),r=f("authTokenSyncURL");if(r){const e=(o=r,async e=>{const t=e&&await e.getIdTokenResult(),n=t&&((new Date).getTime()-Date.parse(t.issuedAtTime))/1e3;if(n&&n>Fr)return;const r=null==t?void 0:t.token;$r!==r&&($r=r,await fetch(o,{method:r?"POST":"DELETE",headers:r?{Authorization:`Bearer ${r}`}:{}}))});!function(e,t,n){T(e).beforeAuthStateChanged(t,n)}(n,e,(()=>e(n.currentUser))),function(e,t,n,r){T(e).onIdTokenChanged(t,n,r)}(n,(t=>e(t)))}var o;const i=h("auth");return i&&Wt(n,`http://${i}`),n}var Vr;Vr="Browser",de(new C("auth",((e,{options:t})=>{const n=e.getProvider("app").getImmediate(),r=e.getProvider("heartbeat"),o=e.getProvider("app-check-internal"),{apiKey:i,authDomain:a}=n.options;$e(i&&!i.includes(":"),"invalid-api-key",{appName:n.name});const s={apiKey:i,authDomain:a,clientPlatform:Vr,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:Lt(Vr)},c=new jt(n,r,o,s);return function(e,t){const n=(null==t?void 0:t.persistence)||[],r=(Array.isArray(n)?n:[n]).map(yt);(null==t?void 0:t.errorMap)&&e._updateErrorMap(t.errorMap),e._initializeWithPersistence(r,null==t?void 0:t.popupRedirectResolver)}(c,t),c}),"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback(((e,t,n)=>{e.getProvider("auth-internal").initialize()}))),de(new C("auth-internal",(e=>(e=>new Br(e))(Ut(e.getProvider("auth").getImmediate()))),"PRIVATE").setInstantiationMode("EXPLICIT")),ge(jr,Ur,function(e){switch(e){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";default:return}}(Vr)),ge(jr,Ur,"esm2017");var Wr=n(2805),qr=n(694);function Gr(e){return Gr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Gr(e)}function zr(){zr=function(){return e};var e={},t=Object.prototype,n=t.hasOwnProperty,r=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",s=o.toStringTag||"@@toStringTag";function c(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(e){c=function(e,t,n){return e[t]=n}}function l(e,t,n,o){var i=t&&t.prototype instanceof h?t:h,a=Object.create(i.prototype),s=new P(o||[]);return r(a,"_invoke",{value:k(e,n,s)}),a}function u(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=l;var d={};function h(){}function p(){}function f(){}var m={};c(m,i,(function(){return this}));var v=Object.getPrototypeOf,g=v&&v(v(S([])));g&&g!==t&&n.call(g,i)&&(m=g);var y=f.prototype=h.prototype=Object.create(m);function w(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function b(e,t){function o(r,i,a,s){var c=u(e[r],e,i);if("throw"!==c.type){var l=c.arg,d=l.value;return d&&"object"==Gr(d)&&n.call(d,"__await")?t.resolve(d.__await).then((function(e){o("next",e,a,s)}),(function(e){o("throw",e,a,s)})):t.resolve(d).then((function(e){l.value=e,a(l)}),(function(e){return o("throw",e,a,s)}))}s(c.arg)}var i;r(this,"_invoke",{value:function(e,n){function r(){return new t((function(t,r){o(e,n,t,r)}))}return i=i?i.then(r,r):r()}})}function k(e,t,n){var r="suspendedStart";return function(o,i){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===o)throw i;return T()}for(n.method=o,n.arg=i;;){var a=n.delegate;if(a){var s=_(a,n);if(s){if(s===d)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var c=u(e,t,n);if("normal"===c.type){if(r=n.done?"completed":"suspendedYield",c.arg===d)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(r="completed",n.method="throw",n.arg=c.arg)}}}function _(e,t){var n=t.method,r=e.iterator[n];if(void 0===r)return t.delegate=null,"throw"===n&&e.iterator.return&&(t.method="return",t.arg=void 0,_(e,t),"throw"===t.method)||"return"!==n&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+n+"' method")),d;var o=u(r,e.iterator,t.arg);if("throw"===o.type)return t.method="throw",t.arg=o.arg,t.delegate=null,d;var i=o.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,d):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,d)}function E(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function I(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(E,this),this.reset(!0)}function S(e){if(e){var t=e[i];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,o=function t(){for(;++r<e.length;)if(n.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t};return o.next=o}}return{next:T}}function T(){return{value:void 0,done:!0}}return p.prototype=f,r(y,"constructor",{value:f,configurable:!0}),r(f,"constructor",{value:p,configurable:!0}),p.displayName=c(f,s,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===p||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,f):(e.__proto__=f,c(e,s,"GeneratorFunction")),e.prototype=Object.create(y),e},e.awrap=function(e){return{__await:e}},w(b.prototype),c(b.prototype,a,(function(){return this})),e.AsyncIterator=b,e.async=function(t,n,r,o,i){void 0===i&&(i=Promise);var a=new b(l(t,n,r,o),i);return e.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},w(y),c(y,s,"Generator"),c(y,i,(function(){return this})),c(y,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},e.values=S,P.prototype={constructor:P,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(I),!e)for(var t in this)"t"===t.charAt(0)&&n.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(n,r){return a.type="throw",a.arg=e,t.next=n,r&&(t.method="next",t.arg=void 0),!!r}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return r("end");if(i.tryLoc<=this.prev){var s=n.call(i,"catchLoc"),c=n.call(i,"finallyLoc");if(s&&c){if(this.prev<i.catchLoc)return r(i.catchLoc,!0);if(this.prev<i.finallyLoc)return r(i.finallyLoc)}else if(s){if(this.prev<i.catchLoc)return r(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return r(i.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=t,i?(this.method="next",this.next=i.finallyLoc,d):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),d},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),I(n),d}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;I(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:S(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),d}},e}function Kr(e,t,n,r,o,i,a){try{var s=e[i](a),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,o)}function Yr(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var i=e.apply(t,n);function a(e){Kr(i,r,o,a,s,"next",e)}function s(e){Kr(i,r,o,a,s,"throw",e)}a(void 0)}))}}function Jr(e,t,n,o,i){var a=window.__pt.settings.loginErrors,s=this,c=new r,l=window.__pt.fn,u=l.search(),d=window.__pt.settings.site,h=null,p=window.__pt.settings.site,f=ve(p.login.firebaseSettings);s.loginProviders=window.__pt.settings.site.login.providers,s.settings=window.__pt.settings.site.login.main||{},s.modalActive=!1,s.loadingSession=!1,s.loadingUserProfile=!1,s.dropdownListActive=!1,s.stepRegister=1,s.currenLink="",s.isResetpassword=!1,s.isProvider=!1,s.pageError={},s.userData={email:"",password:"",pwdconfirm:"",lastname:"",name:"",recatcha:""},s.emailInvalid=!1,s.sessionData={isLogin:!1},s.photoStyle={},s.currentErrorMsg=null,s.showBanner=!0,s.currentErrorMsgPerfil=null,s.avatarConf={color:"",avatar:""},s.eyeUser=!0,s.userDataWriten={name:"",phone:"",recaptchaToken:""},s.userProfile={name:null,contactEmail:null,phone:null,codePhone:null,birthdate:null,nationality:null,placeOfResidence:null,gender:null,createdAt:null,updatedAt:null,deletedAt:null,usersId:0,reservations:[],id:0,uid:""},s.dropdown_phones=!1,s.dropdown_lang=!1,s.dropdown_langMobile=!1,s.dropdown_nav=!1,s.dropdown_tablet=!1,s.iscodept=!1,s.codeData={},s.isResendCurrenUser=!1;var m=new Wr.Z(p.domainAPIUrl),v=l.search(),g=new qr.Z(v,p),y=(g.getUserKey(i),g.getUserKeyFavorites(i));function w(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;s.pageError.has=!0,s.pageError.type=t,s.loading=!1,s.loadingSession=!1}function b(){return(b=Yr(zr().mark((function e(t,n){return zr().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,fetch(p.endPoints.contactCallUrl,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(t)});case 2:e.sent,s.hideModalCall("modal-call",n),s.showModalHeader("modal-confirmation",null);case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function k(){document.body.style.overflow="hidden"}function _(){document.body.style.overflow="auto"}function E(e){var t=angular.element(".bottom__container"),n=angular.element(".bottom__tab").eq(0),r=n.position().left+n.outerWidth(),o=angular.element(".bottom__mask--left"),i=angular.element(".bottom__mask--right");"left"===e&&r<0||r>70?o.hide():o.show();var a,s=(a=angular.element(".bottom__tab").last()).position().left;"right"===e&&s+a.outerWidth()>t.width()?i.hide():i.show(),angular.element(".bottom__tab").eq(0).position().left,(a=angular.element(".bottom__tab").last()).position().left+a.outerWidth()>t.width()&&i.show()}function I(e,t,n){return P.apply(this,arguments)}function P(){return P=Yr(zr().mark((function e(n,r,o){var i,a;return zr().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:s.loadingSession=!0,i={headers:{"X-XSRF-TOKEN":S()}},a={uid:n,notSession:r,name:s.userData.name,lastname:s.userData.lastname,token:o||n,remember:!0},t.post(p.siteUrl+"/v1/api/login",a,i).then(function(){var e=Yr(zr().mark((function e(t){var n;return zr().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(s.loadingSession=!1,200!=t.data.status){e.next=12;break}if(!r){e.next=6;break}s.stepRegister=7,e.next=10;break;case 6:return n={UserId:y,FirebaseId:a.uid,country:p.country.toUpperCase()},e.next=9,m.copyByUser(n).then((function(e){})).catch((function(e){console.error("Error fetching copyByUser:",e)}));case 9:u.redirectTo&&""!==u.redirectTo?window.location.href=p.siteUrl+u.redirectTo:window.location.href=p.siteUrl+"/";case 10:e.next=14;break;case 12:s.currentErrorMsg=t.data.response,s.stepRegister=1;case 14:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),w);case 4:case"end":return e.stop()}}),e)}))),P.apply(this,arguments)}function S(){var e=document.querySelector("[name='_token']");return e?e.value:""}s.showModal=function(e){s.stepRegister=1,$("#".concat(e)).modal("show"),c.metricLoginAction("login",{action:"open modal"}),c.metricLoginAction("login",{action:"link header"}),c.metricHeaderSelectContent({title:"Mi cuenta"})},s.showModalHeader=function(e){$("#".concat(e)).modal("show"),s.cleaInputs()},s.hideModalCoupon=function(e){s.showBanner=!1},s.hideModalCall=function(e,t){$("#".concat(e)).modal("hide"),s.cleaInputs(t)},s.cleaInputs=function(e){s.userDataWriten={name:"",phone:"",recaptchaToken:""},e&&(e.$setPristine(),e.$setUntouched()),grecaptcha.enterprise.reset()},s.hideModal=function(e){$("#".concat(e)).modal("hide"),c.metricLoginAction("login",{action:"close modal"})},s.clickOutside=function(e,t){e.target.id===t&&s.hideModal(t)},s.clickOutsideCall=function(e,t,n){e.target.id===t&&s.hideModalCall(t,n)},s.submitForm=function(e){if(!e.$invalid)switch(s.stepRegister){case 1:e.$setPristine(),e.$setUntouched(),s.verifyEmail();break;case 2:s.loginWithEmailAndPassword(e);break;case 3:s.createUserWithEmailAndPassword(e);break;case 4:s.recoveryPassword()}},s.forgotPasswordForm=function(e){s.currentErrorMsg="",e.$setPristine(),e.$setUntouched(),s.recoveryPassword(),s.stepRegister=4},s.verifyEmail=Yr(zr().mark((function t(){var n;return zr().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return s.loadingSession=!0,n=Hr(f),t.prev=2,t.next=5,Pn(n,s.userData.email,"///0000");case 5:t.sent,e.$apply((function(){s.loadingSession=!1,s.stepRegister=2})),t.next=12;break;case 9:t.prev=9,t.t0=t.catch(2),e.$apply((function(){s.loadingSession=!1,c.metricsErrorsLogin(t.t0.code),"auth/user-not-found"===t.t0.code||"EMAIL_NOT_FOUND"===t.t0.code?s.stepRegister=3:s.stepRegister=2}));case 12:case"end":return t.stop()}}),t,null,[[2,9]])}))),s.createUserWithEmailAndPassword=Yr(zr().mark((function t(){var n,r;return zr().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return s.loadingSession=!0,n=Hr(f),t.prev=2,t.next=5,In(n,s.userData.email,s.userData.password);case 5:r=t.sent,e.$apply(Yr(zr().mark((function t(){var n,o;return zr().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=r.user,s.isResendCurrenUser=!1,t.prev=2,t.next=5,I(n.uid,!0,s.userData.recatcha);case 5:return o={url:p.siteUrl+"/login",handleCodeInApp:!0},t.prev=6,t.next=9,Sn(n,o);case 9:c.metricLoginAction("login",{action:"create account email"}),t.next=15;break;case 12:t.prev=12,t.t0=t.catch(6),e.$apply((function(){s.loadingSession=!1,s.currentErrorMsg=a[t.t0.code]||"An unexpected error occurred during email verification.",c.metricsErrorsLogin(t.t0.code||s.currentErrorMsg)}));case 15:t.next=20;break;case 17:t.prev=17,t.t1=t.catch(2),e.$apply((function(){s.loadingSession=!1,s.currentErrorMsg=a[t.t1.code]||"An unexpected error occurred during session setup.",c.metricsErrorsLogin(t.t1.code||s.currentErrorMsg)}));case 20:s.loadingSession=!1;case 21:case"end":return t.stop()}}),t,null,[[2,17],[6,12]])})))),t.next=12;break;case 9:t.prev=9,t.t0=t.catch(2),e.$apply((function(){s.loadingSession=!1,s.currentErrorMsg=a[t.t0.code]||"An unexpected error occurred.",c.metricsErrorsLogin(t.t0.code||s.currentErrorMsg),s.stepRegister=3}));case 12:case"end":return t.stop()}}),t,null,[[2,9]])}))),s.goToStepOne=function(){s.stepRegister=1,s.currentErrorMsg=""},e.$watch("vm.stepRegister",(function(t){window.grecaptcha&&3==t&&grecaptcha.ready((function(){grecaptcha.render("g-recaptcha-login",{sitekey:"6LdVzyYoAAAAAArBDZLZ-upafYoaZAxNT_iCpjGx",callback:function(t){e.$apply((function(){setTimeout((function(){e.$apply((function(){s.userData.recatcha=""}))}),6e4),s.userData.recatcha=t}))}})}))})),s.loginWithEmailAndPassword=Yr(zr().mark((function t(){var n,r;return zr().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return s.loadingSession=!0,n=Hr(f),t.prev=2,t.next=5,Pn(n,s.userData.email,s.userData.password);case 5:r=t.sent,e.$apply(Yr(zr().mark((function t(){var o,i;return zr().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!(o=r.user).emailVerified){t.next=7;break}I(o.uid,!1),c.metricLoginAction("login",{action:"login email"}),s.loadingSession=!1,t.next=21;break;case 7:return s.isResendCurrenUser=!0,c.metricsErrorsLogin("Not emailVerified"),i=n.currentUser,t.prev=10,t.next=13,Sn(i);case 13:t.next=18;break;case 15:t.prev=15,t.t0=t.catch(10),e.$apply((function(){s.loadingSession=!1,s.currentErrorMsg=a[t.t0.code]||"An unexpected error occurred during email verification.",c.metricsErrorsLogin(t.t0.code||s.currentErrorMsg),s.stepRegister=2}));case 18:s.logout(!0),s.stepRegister=7,s.loadingSession=!1;case 21:case"end":return t.stop()}}),t,null,[[10,15]])})))),t.next=12;break;case 9:t.prev=9,t.t0=t.catch(2),e.$apply((function(){s.loadingSession=!1,s.currentErrorMsg=a[t.t0.code]||"An unexpected error occurred.",c.metricsErrorsLogin(t.t0.code||s.currentErrorMsg),s.stepRegister=2}));case 12:case"end":return t.stop()}}),t,null,[[2,9]])}))),s.loginWithProvider=function(){var t=Yr(zr().mark((function t(n){var r,o,i;return zr().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:s.loadingSession=!0,r=Hr(f),t.t0=n,t.next="Google"===t.t0?5:"Facebook"===t.t0?7:9;break;case 5:return o=new ln,t.abrupt("break",12);case 7:return o=new cn,t.abrupt("break",12);case 9:return console.error("Proveedor no admitido"),s.loadingSession=!1,t.abrupt("return");case 12:return t.prev=12,t.next=15,ir(r,o);case 15:i=t.sent,e.$apply((function(){I(i.user.uid,!1),c.metricLoginAction("login",{action:"login ".concat(n)}),s.loadingSession=!1})),t.next=22;break;case 19:t.prev=19,t.t1=t.catch(12),e.$apply((function(){s.currentErrorMsg=a[t.t1.code]||"An unexpected error occurred.",c.metricsErrorsLogin(t.t1.code||"An unexpected error occurred."),s.stepRegister=1,s.loadingSession=!1}));case 22:case"end":return t.stop()}}),t,null,[[12,19]])})));return function(e){return t.apply(this,arguments)}}(),s.deleteAccount=function(){var t=Hr().currentUser;t?async function(e){return T(e).delete()}(t).then((function(){e.$apply((function(){c.metricLoginAction("login",{action:"delete account"}),s.logout()}))})).catch((function(t){e.$apply((function(){s.currentErrorMsg="Error deleting account: "+(t.code||"An unexpected error occurred."),c.metricsErrorsLogin(t.code||"Error deleting account")}))})):e.$apply((function(){s.currentErrorMsg="No user is currently logged in."}))},s.recoveryPassword=Yr(zr().mark((function t(){var n,r;return zr().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return s.loadingSession=!0,n=Hr(f),r={url:p.siteUrl+"/login",handleCodeInApp:!0},t.prev=3,t.next=6,En(n,s.userData.email,r);case 6:e.$apply((function(){s.loadingSession=!1,c.metricLoginAction("login",{action:"forgot password"})})),t.next=12;break;case 9:t.prev=9,t.t0=t.catch(3),e.$apply((function(){c.metricsErrorsLogin(t.t0.code||"Error sending password reset email"),s.currentErrorMsg=a[t.t0.code]||"An unexpected error occurred.",s.loadingSession=!1}));case 12:case"end":return t.stop()}}),t,null,[[3,9]])}))),s.logout=Yr(zr().mark((function t(){var n,r,o=arguments;return zr().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=o.length>0&&void 0!==o[0]&&o[0],r=Hr(f),t.prev=2,t.next=5,Tn(r);case 5:e.$apply((function(){s.sessionData={isLogin:!1},c.metricLoginAction("login",{action:"sign out"}),n||document.getElementById("logout-form").submit()})),t.next=11;break;case 8:t.prev=8,t.t0=t.catch(2),e.$apply((function(){s.currentErrorMsg="Error signing out: "+(t.t0.code||"An unexpected error occurred."),c.metricsErrorsLogin(t.t0.code||"Error signing out")}));case 11:case"end":return t.stop()}}),t,null,[[2,8]])}))),s.reseendVerification=Yr(zr().mark((function t(){var n,r;return zr().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return s.loadingSession=!0,n=Hr(f),r=n.currentUser,t.prev=3,t.next=6,Sn(r);case 6:e.$apply((function(){s.loadingSession=!1})),t.next=12;break;case 9:t.prev=9,t.t0=t.catch(3),e.$apply((function(){s.loadingSession=!1,s.currentErrorMsg="Error resending verification email: "+(t.t0.code||"An unexpected error occurred."),c.metricsErrorsLogin(t.t0.code||"Error resending verification email")}));case 12:case"end":return t.stop()}}),t,null,[[3,9]])}))),s.continueHome=function(){s.logout(),window.location.href="/"},s.isActive=function(e){return o.path()===e},s.setSessionDataObject=function(e){s.sessionData={token:e.token,displayName:e.userProfile.name||e.userProfile.contactEmail,uid:e.firebaseId,photoURL:e.image,isLogin:!0},s.userProfile.name=e.userProfile.name||null,s.userProfile.uid=e.firebaseId||null,s.userProfile.contactEmail=e.userProfile.contactEmail||null,s.userProfile.phone=e.userProfile.phone||null,s.userProfile.codePhone=e.userProfile.codePhone||null,s.userProfile.birthdate=e.userProfile.birthdate||null,s.userProfile.nationality=e.userProfile.nationality||null,s.userProfile.placeOfResidence=e.userProfile.placeOfResidence||null,s.userProfile.gender=e.userProfile.gender||null,s.userProfile.createdAt=e.userProfile.createdAt||null,s.userProfile.updatedAt=e.userProfile.updatedAt||null,s.userProfile.deletedAt=e.userProfile.deletedAt||null,s.userProfile.usersId=e.userProfile.usersId||0,s.userProfile.reservations=e.reservation||[],s.userProfile.id=e.id||0,s.avatarConf.avatar=s.userProfile.name?s.userProfile.name.substr(0,1):s.userProfile.contactEmail.substr(0,1),s.avatarConf.color=function(){var e=i.get("user_color");if(!e){var t=["#55c1ee","#5473b7","#5492cc","#fbac00","#fe6900","#ea0074","#573d95"];e=t[Math.floor(Math.random()*t.length)],i.set("user_color",e)}return e}(),s.setStyleAvatar(s.sessionData.photoURL,s.avatarConf),i.set("user",s.sessionData)},s.setStyleAvatar=function(e,t){s.photoStyle={"background-position":"center center","background-size":"cover","background-repeat":"no-repeat","background-color":"rgb("+t.color+")"},e&&(s.photoStyle["background-image"]="url("+e+")")},s.hasError=function(e,t){var n=e[t];return e.$submitted&&n.$invalid},s.isPasswordValid=function(e){return(null==e?void 0:e.length)>=8&&s.containsUppercase(e)&&s.containsNumber(e)},s.containsUppercase=function(e){return/[A-Z]/.test(e)},s.containsNumber=function(e){return/[0-9]/.test(e)},s.submitFormtWrite=function(e){s.userDataWriten.recaptchaToken=grecaptcha.enterprise.getResponse(h).length>0?grecaptcha.enterprise.getResponse(h):null,e.$invalid=!s.userDataWriten.recaptchaToken,!e.$invalid&&s.userDataWriten.phone&&s.userDataWriten.name&&function(e,t){b.apply(this,arguments)}(s.userDataWriten,e)},s.checkLoginParams=function(){var e=u.loginOpen,t=u.loginEmail,r=u.loginTimeout||s.settings.timeOpen;s.settings.autoOpen&&e&&n((function(){s.showModal("modal-login"),$("#navbarNav").addClass("show")}),1e3*r),t&&(s.userData.email=t)},s.sendContentHeader=function(e){c.metricHeaderSelectContent({title:e})},s.openDropdown=function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];s[e]=!s[e],s[e]&&"dropdown_nav"===e?k():_(),s.dropdown_langMobile,s.dropdown_user,"dropdown_nav"!=e&&"dropdown_langMobile"!=e&&window.innerWidth<=991&&(s.dropdown_nav=!1),"dropdown_lang"!=e&&(s.dropdown_lang=!1),d.mobile&&s[e]&&t||s.setDatePopupLogin()},s.openDropdownClose=function(e){s[e]=!1},s.setDatePopupLogin=function(){var e=i.get("popup_auto_open");if(!(new Date(e)>new Date)){var t=new Date;t.setDate(t.getDate()+1),i.set("popup_auto_open",t)}},n((function(){var e=angular.element(".bottom__container"),t=e.scrollLeft();angular.element(".bottom__mask--left").hide(),e.bind("scroll",(function(){n((function(){var n=e.scrollLeft();n>t?E("right"):n<t&&E("left"),t=n}))}))})),function(){var e,n=u.coupon,r=l.getCookie("codept"),o=n||r;if(l.setCookie("codept",o,"1"),s.iscodept=!!o,s.iscodept&&(e=o,t.get("/v1/api/GetCoupon?DiscountCode=".concat(e)).then((function(e){"null"!=e.data?s.codeData=e.data:s.codeData={}})).catch((function(e){console.error("Error al obtener los datos del cupón:",e),s.codeData={}}))),window.__pt.settings.site.login&&window.__pt.settings.site.login.main.active&&(function(){var e=l.getCookie("session_token");if(e&&e.length>0)return!0;return!1}()&&window.__pt.user?(s.setSessionDataObject(window.__pt.user),"/login"==window.location.pathname&&(window.location.href="/")):"/login/perfil"==window.location.pathname&&(window.location.href="/login")),"TB"==d.code&&window.grecaptcha&&"/login"!=window.location.pathname&&(h=grecaptcha.enterprise.ready((function(){grecaptcha.enterprise.render("g-recaptcha",{sitekey:"6Lfl5-8eAAAAAECHbOBAyrnsbQah1X5kthYKYyvq"})}))),"PTMX"==d.code&&!s.loadingSession){var a=i.get("popup_auto_open");if(new Date>new Date(a)){s.dropdown_user=!0;var c=setTimeout((function(){s.dropdown_user&&$("#btn_start_session").click(),clearTimeout(c)}),1e4)}}}()}window.app.controller("LoginController",Jr),Jr.$inject=["$scope","$http","$timeout","$location","localStorageService"]})()})();
//# sourceMappingURL=detail-controllers.min.js.map