/*! For license information please see controller.js.LICENSE.txt */
(()=>{var 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 i(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,(o=i.key,s=void 0,s=function(e,t){if("object"!==r(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,t||"default");if("object"!==r(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(o,"string"),"symbol"===r(s)?s:String(s)),i)}var o,s}function o(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}new(o((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)}})))},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 i(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,(o=i.key,s=void 0,s=function(e,t){if("object"!==r(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,t||"default");if("object"!==r(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(o,"string"),"symbol"===r(s)?s:String(s)),i)}var o,s}n.d(t,{Z:()=>o});var o=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,i=e.get("userKey");return!i||i||i.includes("anonimo")?r?(i&&i.includes("anonimo")||e.set("userKey",r),r):(setTimeout((function(){var r=t.getCookie("__ca__chat")||n;e.set("userKey",r)}),2e3),""):i}},{key:"getUserKeyFavorites",value:function(e){var t=window.__pt.fn,n=window.__pt.user||null,r="anonimo-".concat(t.generateUUID()),i=n&&n.firebaseId?n.firebaseId:t.getCookie("session_id")||r,o=e.get("userKey_fav");return o&&o===i?o:i?(e.set("userKey_fav",i),i):(setTimeout((function(){var i=n&&n.firebaseId?n.firebaseId:t.getCookie("session_id")||r;e.set("userKey_fav",i)}),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 i=e.pax[r],o="";n.adults+=i.adults,o+="".concat(i.adults,"/"),i.children&&i.children.length?(n.children+=i.children.length,o+="".concat(i.children.map((function(e){return e.year})).join(","))):o+="n",n.paxesFormat.push(o)}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 i=e[r],o="";n.adults+=i.adults,o+="".concat(i.adults,"/"),i.children&&i.children.length?(n.children+=i.children.length,o+="".concat(i.children.map((function(e){return e.year})).join(","))):o+="n",n.paxesFormat.push(o)}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 i=e.pax[r],o="";n.adults+=i.adults,o+="".concat(i.adults),i.children&&i.children.length&&(n.children+=i.children.length,o+="|".concat(i.children.map((function(e){return e.year})).join(","))),n.paxesFormat.push(o)}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 i=e?r.find((function(t){return t.key==e.promotionType})):"";i&&(t=i.active,n=i.blackFAndHotS)}return{activeKey:t,HotSBlackFri:n}}},{key:"windowScrollTop",value:function(){window.scrollTo(0,0)}}])&&i(t.prototype,n),r&&i(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 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 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 s(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){a(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}function a(e,t,n){return(t=d(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},o="function"==typeof Symbol?Symbol:{},s=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",u=o.toStringTag||"@@toStringTag";function l(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{l({},"")}catch(e){l=function(e,t,n){return e[t]=n}}function h(e,t,n,i){var o=t&&t.prototype instanceof f?t:f,s=Object.create(o.prototype),a=new P(i||[]);return r(s,"_invoke",{value:E(e,n,a)}),s}function d(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=h;var p={};function f(){}function g(){}function m(){}var v={};l(v,s,(function(){return this}));var y=Object.getPrototypeOf,w=y&&y(y(O([])));w&&w!==t&&n.call(w,s)&&(v=w);var _=m.prototype=f.prototype=Object.create(v);function b(e){["next","throw","return"].forEach((function(t){l(e,t,(function(e){return this._invoke(t,e)}))}))}function I(e,t){function o(r,s,a,c){var u=d(e[r],e,s);if("throw"!==u.type){var l=u.arg,h=l.value;return h&&"object"==i(h)&&n.call(h,"__await")?t.resolve(h.__await).then((function(e){o("next",e,a,c)}),(function(e){o("throw",e,a,c)})):t.resolve(h).then((function(e){l.value=e,a(l)}),(function(e){return o("throw",e,a,c)}))}c(u.arg)}var s;r(this,"_invoke",{value:function(e,n){function r(){return new t((function(t,r){o(e,n,t,r)}))}return s=s?s.then(r,r):r()}})}function E(e,t,n){var r="suspendedStart";return function(i,o){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw o;return C()}for(n.method=i,n.arg=o;;){var s=n.delegate;if(s){var a=k(s,n);if(a){if(a===p)continue;return a}}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=d(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 k(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,k(e,t),"throw"===t.method)||"return"!==n&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+n+"' method")),p;var i=d(r,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,p;var o=i.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,p):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,p)}function T(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 P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(T,this),this.reset(!0)}function O(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,i=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 i.next=i}}return{next:C}}function C(){return{value:void 0,done:!0}}return g.prototype=m,r(_,"constructor",{value:m,configurable:!0}),r(m,"constructor",{value:g,configurable:!0}),g.displayName=l(m,u,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,m):(e.__proto__=m,l(e,u,"GeneratorFunction")),e.prototype=Object.create(_),e},e.awrap=function(e){return{__await:e}},b(I.prototype),l(I.prototype,a,(function(){return this})),e.AsyncIterator=I,e.async=function(t,n,r,i,o){void 0===o&&(o=Promise);var s=new I(h(t,n,r,i),o);return e.isGeneratorFunction(n)?s:s.next().then((function(e){return e.done?e.value:s.next()}))},b(_),l(_,u,"Generator"),l(_,s,(function(){return this})),l(_,"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=O,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(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 s.type="throw",s.arg=e,t.next=n,r&&(t.method="next",t.arg=void 0),!!r}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],s=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var a=n.call(o,"catchLoc"),c=n.call(o,"finallyLoc");if(a&&c){if(this.prev<o.catchLoc)return r(o.catchLoc,!0);if(this.prev<o.finallyLoc)return r(o.finallyLoc)}else if(a){if(this.prev<o.catchLoc)return r(o.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return r(o.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var s=o?o.completion:{};return s.type=e,s.arg=t,o?(this.method="next",this.next=o.finallyLoc,p):this.complete(s)},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 i=r.arg;S(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:O(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),p}},e}function u(e,t,n,r,i,o,s){try{var a=e[o](s),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,i)}function l(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var o=e.apply(t,n);function s(e){u(o,r,i,s,a,"next",e)}function a(e){u(o,r,i,s,a,"throw",e)}s(void 0)}))}}function h(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,d(r.key),r)}}function d(e){var t=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)}(e,"string");return"symbol"===i(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,i,o,a,u,d,p;return t=e,n=[{key:"addHotel",value:(p=l(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:(d=l(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 d.apply(this,arguments)})},{key:"getHotelsByUser",value:(u=l(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 u.apply(this,arguments)})},{key:"getHotelsByUserFacade",value:(a=l(c().mark((function e(t){var n,i;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:s({"Content-Type":"application/json"},(0,r.w)())});case 4:return i=e.sent,e.abrupt("return",i.json());case 6:case"end":return e.stop()}}),e,this)}))),function(e){return a.apply(this,arguments)})},{key:"copyByUser",value:(o=l(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 o.apply(this,arguments)})}],n&&h(t.prototype,n),i&&h(t,i),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 i(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function s(e){if(t===setTimeout)return setTimeout(e,0);if((t===i||!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:i}catch(e){t=i}try{n="function"==typeof clearTimeout?clearTimeout:o}catch(e){n=o}}();var a,c=[],u=!1,l=-1;function h(){u&&a&&(u=!1,a.length?c=a.concat(c):l=-1,c.length&&d())}function d(){if(!u){var e=s(h);u=!0;for(var t=c.length;t;){for(a=c,c=[];++l<t;)a&&a[l].run();l=-1,t=c.length}a=null,u=!1,function(e){if(n===clearTimeout)return clearTimeout(e);if((n===o||!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||u||s(d)},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 i=t[r];if(void 0!==i)return i.exports;var o=t[r]={exports:{}};return e[r](o,o.exports,n),o.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),(()=>{"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 i=n[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,(o=i.key,s=void 0,s=function(t,n){if("object"!==e(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var i=r.call(t,n||"default");if("object"!==e(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===n?String:Number)(t)}(o,"string"),"symbol"===e(s)?s:String(s)),i)}var o,s}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,i;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),i&&t(n,i),Object.defineProperty(n,"prototype",{writable:!1}),e}(),i=n(4155);const o=function(e){const t=[];let n=0;for(let r=0;r<e.length;r++){let i=e.charCodeAt(r);i<128?t[n++]=i:i<2048?(t[n++]=i>>6|192,t[n++]=63&i|128):55296==(64512&i)&&r+1<e.length&&56320==(64512&e.charCodeAt(r+1))?(i=65536+((1023&i)<<10)+(1023&e.charCodeAt(++r)),t[n++]=i>>18|240,t[n++]=i>>12&63|128,t[n++]=i>>6&63|128,t[n++]=63&i|128):(t[n++]=i>>12|224,t[n++]=i>>6&63|128,t[n++]=63&i|128)}return t},s={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 i=e[t],o=t+1<e.length,s=o?e[t+1]:0,a=t+2<e.length,c=a?e[t+2]:0,u=i>>2,l=(3&i)<<4|s>>4;let h=(15&s)<<2|c>>6,d=63&c;a||(d=64,o||(h=64)),r.push(n[u],n[l],n[h],n[d])}return r.join("")},encodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?btoa(e):this.encodeByteArray(o(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 i=e[n++];if(i<128)t[r++]=String.fromCharCode(i);else if(i>191&&i<224){const o=e[n++];t[r++]=String.fromCharCode((31&i)<<6|63&o)}else if(i>239&&i<365){const o=((7&i)<<18|(63&e[n++])<<12|(63&e[n++])<<6|63&e[n++])-65536;t[r++]=String.fromCharCode(55296+(o>>10)),t[r++]=String.fromCharCode(56320+(1023&o))}else{const o=e[n++],s=e[n++];t[r++]=String.fromCharCode((15&i)<<12|(63&o)<<6|63&s)}}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 i=n[e.charAt(t++)],o=t<e.length?n[e.charAt(t)]:0;++t;const s=t<e.length?n[e.charAt(t)]:64;++t;const c=t<e.length?n[e.charAt(t)]:64;if(++t,null==i||null==o||null==s||null==c)throw new a;const u=i<<2|o>>4;if(r.push(u),64!==s){const e=o<<4&240|s>>2;if(r.push(e),64!==c){const e=s<<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 a extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const c=function(e){return function(e){const t=o(e);return s.encodeByteArray(t,!0)}(e).replace(/\./g,"")},u=function(e){try{return s.decodeString(e,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};const l=()=>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__,h=()=>{try{return l()||(()=>{if(void 0===i||void 0===i.env)return;const e=i.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&&u(e[1]);return t&&JSON.parse(t)})()}catch(e){return void console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${e}`)}},d=e=>{var t,n;return null===(n=null===(t=h())||void 0===t?void 0:t.emulatorHosts)||void 0===n?void 0:n[e]},p=()=>{var e;return null===(e=h())||void 0===e?void 0:e.config},f=e=>{var t;return null===(t=h())||void 0===t?void 0:t[`_${e}`]};class g{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 m(){return"undefined"!=typeof navigator&&"string"==typeof navigator.userAgent?navigator.userAgent:""}class v extends Error{constructor(e,t,n){super(t),this.code=e,this.customData=n,this.name="FirebaseError",Object.setPrototypeOf(this,v.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}`,i=this.errors[e],o=i?function(e,t){return e.replace(w,((e,n)=>{const r=t[n];return null!=r?String(r):`<${n}?>`}))}(i,n):"Error",s=`${this.serviceName}: ${o} (${r}).`;return new v(r,s,n)}}const w=/\{\$([^}]+)}/g;function _(e,t){if(e===t)return!0;const n=Object.keys(e),r=Object.keys(t);for(const i of n){if(!r.includes(i))return!1;const n=e[i],o=t[i];if(b(n)&&b(o)){if(!_(n,o))return!1}else if(n!==o)return!1}for(const e of r)if(!n.includes(e))return!1;return!0}function b(e){return null!==e&&"object"==typeof e}function I(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 k(e){const t=e.indexOf("?");if(!t)return"";const n=e.indexOf("#",t);return e.substring(t,n>0?n:void 0)}class T{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 i=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),i}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 P(e){return e&&e._delegate?e._delegate:e}class O{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 C="[DEFAULT]";class A{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 g;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:C})}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=C){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=C){return this.instances.has(e)}getOptions(e=C){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),i=null!==(n=this.onInitCallbacks.get(r))&&void 0!==n?n:new Set;i.add(e),this.onInitCallbacks.set(r,i);const o=this.instances.get(r);return o&&e(o,r),()=>{i.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===C?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=C){return this.component?this.component.multipleInstances?e:C: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 A(e,this);return this.providers.set(e,t),t}getProviders(){return Array.from(this.providers.values())}}const L=[];var N;!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"}(N||(N={}));const D={debug:N.DEBUG,verbose:N.VERBOSE,info:N.INFO,warn:N.WARN,error:N.ERROR,silent:N.SILENT},x=N.INFO,M={[N.DEBUG]:"log",[N.VERBOSE]:"log",[N.INFO]:"info",[N.WARN]:"warn",[N.ERROR]:"error"},U=(e,t,...n)=>{if(t<e.logLevel)return;const r=(new Date).toISOString(),i=M[t];if(!i)throw new Error(`Attempted to log a message with an invalid logType (value: ${t})`);console[i](`[${r}]  ${e.name}:`,...n)};class j{constructor(e){this.name=e,this._logLevel=x,this._logHandler=U,this._userLogHandler=null,L.push(this)}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in N))throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel="string"==typeof e?D[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,N.DEBUG,...e),this._logHandler(this,N.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,N.VERBOSE,...e),this._logHandler(this,N.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,N.INFO,...e),this._logHandler(this,N.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,N.WARN,...e),this._logHandler(this,N.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,N.ERROR,...e),this._logHandler(this,N.ERROR,...e)}}let F,V;const H=new WeakMap,B=new WeakMap,W=new WeakMap,z=new WeakMap,G=new WeakMap;let K={get(e,t,n){if(e instanceof IDBTransaction){if("done"===t)return B.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 Y(e[t])},set:(e,t,n)=>(e[t]=n,!0),has:(e,t)=>e instanceof IDBTransaction&&("done"===t||"store"===t)||t in e};function q(e){return e!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(V||(V=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(e)?function(...t){return e.apply(X(this),t),Y(H.get(this))}:function(...t){return Y(e.apply(X(this),t))}:function(t,...n){const r=e.call(X(this),t,...n);return W.set(r,t.sort?t.sort():[t]),Y(r)}}function J(e){return"function"==typeof e?q(e):(e instanceof IDBTransaction&&function(e){if(B.has(e))return;const t=new Promise(((t,n)=>{const r=()=>{e.removeEventListener("complete",i),e.removeEventListener("error",o),e.removeEventListener("abort",o)},i=()=>{t(),r()},o=()=>{n(e.error||new DOMException("AbortError","AbortError")),r()};e.addEventListener("complete",i),e.addEventListener("error",o),e.addEventListener("abort",o)}));B.set(e,t)}(e),t=e,(F||(F=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])).some((e=>t instanceof e))?new Proxy(e,K):e);var t}function Y(e){if(e instanceof IDBRequest)return function(e){const t=new Promise(((t,n)=>{const r=()=>{e.removeEventListener("success",i),e.removeEventListener("error",o)},i=()=>{t(Y(e.result)),r()},o=()=>{n(e.error),r()};e.addEventListener("success",i),e.addEventListener("error",o)}));return t.then((t=>{t instanceof IDBCursor&&H.set(t,e)})).catch((()=>{})),G.set(t,e),t}(e);if(z.has(e))return z.get(e);const t=J(e);return t!==e&&(z.set(e,t),G.set(t,e)),t}const X=e=>G.get(e);const Z=["get","getKey","getAll","getAllKeys","count"],Q=["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,i=Q.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!i&&!Z.includes(n))return;const o=async function(e,...t){const o=this.transaction(e,i?"readwrite":"readonly");let s=o.store;return r&&(s=s.index(t.shift())),(await Promise.all([s[n](...t),i&&o.done]))[0]};return ee.set(t,o),o}K=(e=>({...e,get:(t,n,r)=>te(t,n)||e.get(t,n,r),has:(t,n)=>!!te(t,n)||e.has(t,n)}))(K);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",ie="0.9.20",oe=new j("@firebase/app"),se="[DEFAULT]",ae={[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,ue=new Map;function le(e,t){try{e.container.addComponent(t)}catch(n){oe.debug(`Component ${t.name} failed to register with FirebaseApp ${e.name}`,n)}}function he(e){const t=e.name;if(ue.has(t))return oe.debug(`There were multiple attempts to register component ${t}.`),!1;ue.set(t,e);for(const t of ce.values())le(t,e);return!0}function de(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 O("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 ge="10.5.0";function me(e,t={}){let n=e;if("object"!=typeof t){t={name:t}}const r=Object.assign({name:se,automaticDataCollectionEnabled:!1},t),i=r.name;if("string"!=typeof i||!i)throw pe.create("bad-app-name",{appName:String(i)});if(n||(n=p()),!n)throw pe.create("no-options");const o=ce.get(i);if(o){if(_(n,o.options)&&_(r,o.config))return o;throw pe.create("duplicate-app",{appName:i})}const s=new R(i);for(const e of ue.values())s.addComponent(e);const a=new fe(n,r,s);return ce.set(i,a),a}function ve(e,t,n){var r;let i=null!==(r=ae[e])&&void 0!==r?r:e;n&&(i+=`-${n}`);const o=i.match(/\s|\//),s=t.match(/\s|\//);if(o||s){const e=[`Unable to register library "${i}" with version "${t}":`];return o&&e.push(`library name "${i}" contains illegal characters (whitespace or "/")`),o&&s&&e.push("and"),s&&e.push(`version name "${t}" contains illegal characters (whitespace or "/")`),void oe.warn(e.join(" "))}he(new O(`${i}-version`,(()=>({library:i,version:t})),"VERSION"))}const ye="firebase-heartbeat-store";let we=null;function _e(){return we||(we=function(e,t,{blocked:n,upgrade:r,blocking:i,terminated:o}={}){const s=indexedDB.open(e,t),a=Y(s);return r&&s.addEventListener("upgradeneeded",(e=>{r(Y(s.result),e.oldVersion,e.newVersion,Y(s.transaction),e)})),n&&s.addEventListener("blocked",(e=>n(e.oldVersion,e.newVersion,e))),a.then((e=>{o&&e.addEventListener("close",(()=>o())),i&&e.addEventListener("versionchange",(e=>i(e.oldVersion,e.newVersion,e)))})).catch((()=>{})),a}("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 be(e,t){try{const n=(await _e()).transaction(ye,"readwrite"),r=n.objectStore(ye);await r.put(t,Ie(e)),await n.done}catch(e){if(e instanceof v)oe.warn(e.message);else{const t=pe.create("idb-set",{originalErrorMessage:null==e?void 0:e.message});oe.warn(t.message)}}}function Ie(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 Te(t),this._heartbeatsCachePromise=this._storage.read().then((e=>(this._heartbeatsCache=e,e)))}async triggerHeartbeat(){const e=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),t=ke();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=ke(),{heartbeatsToSend:t,unsentEntries:n}=function(e,t=1024){const n=[];let r=e.slice();for(const i of e){const e=n.find((e=>e.agent===i.agent));if(e){if(e.dates.push(i.date),Se(n)>t){e.dates.pop();break}}else if(n.push({agent:i.agent,dates:[i.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 ke(){return(new Date).toISOString().substring(0,10)}class Te{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",i=self.indexedDB.open(r);i.onsuccess=()=>{i.result.close(),n||self.indexedDB.deleteDatabase(r),e(!0)},i.onupgradeneeded=()=>{n=!1},i.onerror=()=>{var e;t((null===(e=i.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 _e();return await t.transaction(ye).objectStore(ye).get(Ie(e))}catch(e){if(e instanceof v)oe.warn(e.message);else{const t=pe.create("idb-get",{originalErrorMessage:null==e?void 0:e.message});oe.warn(t.message)}}}(this.app)||{heartbeats:[]}}return{heartbeats:[]}}async overwrite(e){var t;if(await this._canUseIndexedDBPromise){const n=await this.read();return be(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 be(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 Pe;Pe="",he(new O("platform-logger",(e=>new ne(e)),"PRIVATE")),he(new O("heartbeat",(e=>new Ee(e)),"PRIVATE")),ve(re,ie,Pe),ve(re,ie,"esm2017"),ve("fire-js","");ve("firebase","10.5.0","app");function Oe(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 i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}Object.create;Object.create;function Ce(e){return void 0!==e&&void 0!==e.enterprise}class Ae{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 Le=Re,Ne=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."}),De=new j("@firebase/auth");function xe(e,...t){De.logLevel<=N.ERROR&&De.error(`Auth (${ge}): ${e}`,...t)}function Me(e,...t){throw Ve(e,...t)}function Ue(e,...t){return Ve(e,...t)}function je(e,t,n){const r=Object.assign(Object.assign({},Le()),{[t]:n});return new y("auth","Firebase",r).create(t,{appName:e.name})}function Fe(e,t,n){if(!(t instanceof n))throw n.name!==t.constructor.name&&Me(e,"argument-error"),je(e,"argument-error",`Type of ${t.constructor.name} does not match expected instance.Did you pass a reference from a different Auth SDK?`)}function Ve(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 Ne.create(e,...t)}function He(e,t,...n){if(!e)throw Ve(t,...n)}function $e(e){const t="INTERNAL ASSERTION FAILED: "+e;throw xe(t),new Error(t)}function Be(e,t){e||$e(t)}function We(){var e;return"undefined"!=typeof self&&(null===(e=self.location)||void 0===e?void 0:e.href)||""}function ze(){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 Ke(){return!("undefined"!=typeof navigator&&navigator&&"onLine"in navigator&&"boolean"==typeof navigator.onLine&&(ze()||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 qe{constructor(e,t){this.shortDelay=e,this.longDelay=t,Be(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(m())||"object"==typeof navigator&&"ReactNative"===navigator.product}get(){return Ke()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}}function Je(e,t){Be(e.emulator,"Emulator should always be set here");const{url:n}=e.emulator;return t?`${n}${t.startsWith("/")?t.slice(1):t}`:n}class Ye{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 $e("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 $e("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 $e("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}}const Xe={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 qe(3e4,6e4);function Qe(e,t){return e.tenantId&&!t.tenantId?Object.assign(Object.assign({},t),{tenantId:e.tenantId}):t}async function et(e,t,n,r,i={}){return tt(e,i,(async()=>{let i={},o={};r&&("GET"===t?o=r:i={body:JSON.stringify(r)});const s=I(Object.assign({key:e.config.apiKey},o)).slice(1),a=await e._getAdditionalHeaders();return a["Content-Type"]="application/json",e.languageCode&&(a["X-Firebase-Locale"]=e.languageCode),Ye.fetch()(rt(e,e.config.apiHost,n,s),Object.assign({method:t,headers:a,referrerPolicy:"no-referrer"},i))}))}async function tt(e,t,n){e._canInitEmulator=!1;const r=Object.assign(Object.assign({},Xe),t);try{const t=new it(e),i=await Promise.race([n(),t.promise]);t.clearNetworkTimeout();const o=await i.json();if("needConfirmation"in o)throw ot(e,"account-exists-with-different-credential",o);if(i.ok&&!("errorMessage"in o))return o;{const t=i.ok?o.errorMessage:o.error.message,[n,s]=t.split(" : ");if("FEDERATED_USER_ID_ALREADY_LINKED"===n)throw ot(e,"credential-already-in-use",o);if("EMAIL_EXISTS"===n)throw ot(e,"email-already-in-use",o);if("USER_DISABLED"===n)throw ot(e,"user-disabled",o);const a=r[n]||n.toLowerCase().replace(/[_\s]+/g,"-");if(s)throw je(e,a,s);Me(e,a)}}catch(t){if(t instanceof v)throw t;Me(e,"network-request-failed",{message:String(t)})}}async function nt(e,t,n,r,i={}){const o=await et(e,t,n,r,i);return"mfaPendingCredential"in o&&Me(e,"multi-factor-auth-required",{_serverResponse:o}),o}function rt(e,t,n,r){const i=`${t}${n}?${r}`;return e.config.emulator?Je(e.config,i):`${e.config.apiScheme}://${i}`}class it{constructor(e){this.auth=e,this.timer=null,this.promise=new Promise(((e,t)=>{this.timer=setTimeout((()=>t(Ue(this.auth,"network-request-failed"))),Ze.get())}))}clearNetworkTimeout(){clearTimeout(this.timer)}}function ot(e,t,n){const r={appName:e.name};n.email&&(r.email=n.email),n.phoneNumber&&(r.phoneNumber=n.phoneNumber);const i=Ue(e,t,r);return i.customData._tokenResponse=n,i}async function st(e,t){return et(e,"GET","/v2/recaptchaConfig",Qe(e,t))}function at(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 ut(e){const[t,n,r]=e.split(".");if(void 0===t||void 0===n||void 0===r)return xe("JWT malformed, contained fewer than 3 sections"),null;try{const e=u(n);return e?JSON.parse(e):(xe("Failed to decode base64 JWT payload"),null)}catch(e){return xe("Caught error parsing JWT payload as JSON",null==e?void 0:e.toString()),null}}async function lt(e,t,n=!1){if(n)return t;try{return await t}catch(t){throw t instanceof v&&function({code:e}){return"auth/user-disabled"===e||"auth/user-token-expired"===e}(t)&&e.auth.currentUser===e&&await e.auth.signOut(),t}}class ht{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 dt{constructor(e,t){this.createdAt=e,this.lastLoginAt=t,this._initializeTime()}_initializeTime(){this.lastSignInTime=at(this.lastLoginAt),this.creationTime=at(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(),i=await lt(e,async function(e,t){return et(e,"POST","/v1/accounts:lookup",t)}(n,{idToken:r}));He(null==i?void 0:i.users.length,n,"internal-error");const o=i.users[0];e._notifyReloadListener(o);const s=(null===(t=o.providerUserInfo)||void 0===t?void 0:t.length)?o.providerUserInfo.map((e=>{var{providerId:t}=e,n=Oe(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 a=(c=e.providerData,u=s,[...c.filter((e=>!u.some((t=>t.providerId===e.providerId)))),...u]);var c,u;const l=e.isAnonymous,h=!(e.email&&o.passwordHash||(null==a?void 0:a.length)),d=!!l&&h,p={uid:o.localId,displayName:o.displayName||null,photoURL:o.photoUrl||null,email:o.email||null,emailVerified:o.emailVerified||!1,phoneNumber:o.phoneNumber||null,tenantId:o.tenantId||null,providerData:a,metadata:new dt(o.createdAt,o.lastLoginAt),isAnonymous:d};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){He(e.idToken,"internal-error"),He(void 0!==e.idToken,"internal-error"),He(void 0!==e.refreshToken,"internal-error");const t="expiresIn"in e&&void 0!==e.expiresIn?Number(e.expiresIn):function(e){const t=ut(e);return He(t,"internal-error"),He(void 0!==t.exp,"internal-error"),He(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 He(!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:i}=await async function(e,t){const n=await tt(e,{},(async()=>{const n=I({grant_type:"refresh_token",refresh_token:t}).slice(1),{tokenApiHost:r,apiKey:i}=e.config,o=rt(e,r,"/v1/token",`key=${i}`),s=await e._getAdditionalHeaders();return s["Content-Type"]="application/x-www-form-urlencoded",Ye.fetch()(o,{method:"POST",headers:s,body:n})}));return{accessToken:n.access_token,expiresIn:n.expires_in,refreshToken:n.refresh_token}}(e,t);this.updateTokensAndExpiration(n,r,Number(i))}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:i}=t,o=new ft;return n&&(He("string"==typeof n,"internal-error",{appName:e}),o.refreshToken=n),r&&(He("string"==typeof r,"internal-error",{appName:e}),o.accessToken=r),i&&(He("number"==typeof i,"internal-error",{appName:e}),o.expirationTime=i),o}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 $e("not implemented")}}function gt(e,t){He("string"==typeof e||void 0===e,"internal-error",{appName:t})}class mt{constructor(e){var{uid:t,auth:n,stsTokenManager:r}=e,i=Oe(e,["uid","auth","stsTokenManager"]);this.providerId="firebase",this.proactiveRefresh=new ht(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=t,this.auth=n,this.stsTokenManager=r,this.accessToken=r.accessToken,this.displayName=i.displayName||null,this.email=i.email||null,this.emailVerified=i.emailVerified||!1,this.phoneNumber=i.phoneNumber||null,this.photoURL=i.photoURL||null,this.isAnonymous=i.isAnonymous||!1,this.tenantId=i.tenantId||null,this.providerData=i.providerData?[...i.providerData]:[],this.metadata=new dt(i.createdAt||void 0,i.lastLoginAt||void 0)}async getIdToken(e){const t=await lt(this,this.stsTokenManager.getToken(this.auth,e));return He(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=P(e),r=await n.getIdToken(t),i=ut(r);He(i&&i.exp&&i.auth_time&&i.iat,n.auth,"internal-error");const o="object"==typeof i.firebase?i.firebase:void 0,s=null==o?void 0:o.sign_in_provider;return{claims:i,token:r,authTime:at(ct(i.auth_time)),issuedAtTime:at(ct(i.iat)),expirationTime:at(ct(i.exp)),signInProvider:s||null,signInSecondFactor:(null==o?void 0:o.sign_in_second_factor)||null}}(this,e)}reload(){return async function(e){const t=P(e);await pt(t),await t.auth._persistUserIfCurrent(t),t.auth._notifyListenersIfCurrent(t)}(this)}_assign(e){this!==e&&(He(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 mt(Object.assign(Object.assign({},this),{auth:e,stsTokenManager:this.stsTokenManager._clone()}));return t.metadata._copy(this.metadata),t}_onReload(e){He(!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 lt(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,i,o,s,a,c,u;const l=null!==(n=t.displayName)&&void 0!==n?n:void 0,h=null!==(r=t.email)&&void 0!==r?r:void 0,d=null!==(i=t.phoneNumber)&&void 0!==i?i:void 0,p=null!==(o=t.photoURL)&&void 0!==o?o:void 0,f=null!==(s=t.tenantId)&&void 0!==s?s:void 0,g=null!==(a=t._redirectEventId)&&void 0!==a?a:void 0,m=null!==(c=t.createdAt)&&void 0!==c?c:void 0,v=null!==(u=t.lastLoginAt)&&void 0!==u?u:void 0,{uid:y,emailVerified:w,isAnonymous:_,providerData:b,stsTokenManager:I}=t;He(y&&I,e,"internal-error");const E=ft.fromJSON(this.name,I);He("string"==typeof y,e,"internal-error"),gt(l,e.name),gt(h,e.name),He("boolean"==typeof w,e,"internal-error"),He("boolean"==typeof _,e,"internal-error"),gt(d,e.name),gt(p,e.name),gt(f,e.name),gt(g,e.name),gt(m,e.name),gt(v,e.name);const k=new mt({uid:y,auth:e,email:h,emailVerified:w,displayName:l,isAnonymous:_,photoURL:p,phoneNumber:d,tenantId:f,stsTokenManager:E,createdAt:m,lastLoginAt:v});return b&&Array.isArray(b)&&(k.providerData=b.map((e=>Object.assign({},e)))),g&&(k._redirectEventId=g),k}static async _fromIdTokenResponse(e,t,n=!1){const r=new ft;r.updateFromServerResponse(t);const i=new mt({uid:t.localId,auth:e,stsTokenManager:r,isAnonymous:n});return await pt(i),i}}const vt=new Map;function yt(e){Be(e instanceof Function,"Expected a class definition");let t=vt.get(e);return t?(Be(t instanceof e,"Instance stored in cache mismatched with class"),t):(t=new e,vt.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 _t=wt;function bt(e,t,n){return`firebase:${e}:${t}:${n}`}class It{constructor(e,t,n){this.persistence=e,this.auth=t,this.userKey=n;const{config:r,name:i}=this.auth;this.fullUserKey=bt(this.userKey,r.apiKey,i),this.fullPersistenceKey=bt("persistence",r.apiKey,i),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?mt._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 It(yt(_t),e,n);const r=(await Promise.all(t.map((async e=>{if(await e._isAvailable())return e})))).filter((e=>e));let i=r[0]||yt(_t);const o=bt(n,e.config.apiKey,e.name);let s=null;for(const n of t)try{const t=await n._get(o);if(t){const r=mt._fromJSON(e,t);n!==i&&(s=r),i=n;break}}catch(e){}const a=r.filter((e=>e._shouldAllowMigration));return i._shouldAllowMigration&&a.length?(i=a[0],s&&await i._set(o,s.toJSON()),await Promise.all(t.map((async e=>{if(e!==i)try{await e._remove(o)}catch(e){}}))),new It(i,e,n)):new It(i,e,n)}}function Et(e){const t=e.toLowerCase();if(t.includes("opera/")||t.includes("opr/")||t.includes("opios/"))return"Opera";if(Pt(t))return"IEMobile";if(t.includes("msie")||t.includes("trident/"))return"IE";if(t.includes("edge/"))return"Edge";if(kt(t))return"Firefox";if(t.includes("silk/"))return"Silk";if(Ct(t))return"Blackberry";if(At(t))return"Webos";if(Tt(t))return"Safari";if((t.includes("chrome/")||St(t))&&!t.includes("edge/"))return"Chrome";if(Ot(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 kt(e=m()){return/firefox\//i.test(e)}function Tt(e=m()){const t=e.toLowerCase();return t.includes("safari/")&&!t.includes("chrome/")&&!t.includes("crios/")&&!t.includes("android")}function St(e=m()){return/crios\//i.test(e)}function Pt(e=m()){return/iemobile/i.test(e)}function Ot(e=m()){return/android/i.test(e)}function Ct(e=m()){return/blackberry/i.test(e)}function At(e=m()){return/webos/i.test(e)}function Rt(e=m()){return/iphone|ipad|ipod/i.test(e)||/macintosh/i.test(e)&&/mobile/i.test(e)}function Lt(){return function(){const e=m();return e.indexOf("MSIE ")>=0||e.indexOf("Trident/")>=0}()&&10===document.documentMode}function Nt(e=m()){return Rt(e)||Ot(e)||At(e)||Ct(e)||/windows phone/i.test(e)||Pt(e)}function Dt(e,t=[]){let n;switch(e){case"Browser":n=Et(m());break;case"Worker":n=`${Et(m())}-${e}`;break;default:n=e}const r=t.length?t.join(","):"FirebaseCore-web";return`${n}/JsCore/${ge}/${r}`}class xt{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,i;const o=e.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=null!==(t=o.minPasswordLength)&&void 0!==t?t:6,o.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=o.maxPasswordLength),void 0!==o.containsLowercaseCharacter&&(this.customStrengthOptions.containsLowercaseLetter=o.containsLowercaseCharacter),void 0!==o.containsUppercaseCharacter&&(this.customStrengthOptions.containsUppercaseLetter=o.containsUppercaseCharacter),void 0!==o.containsNumericCharacter&&(this.customStrengthOptions.containsNumericCharacter=o.containsNumericCharacter),void 0!==o.containsNonAlphanumericCharacter&&(this.customStrengthOptions.containsNonAlphanumericCharacter=o.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!==(i=e.forceUpgradeOnSignin)&&void 0!==i&&i,this.schemaVersion=e.schemaVersion}validatePassword(e){var t,n,r,i,o,s;const a={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(e,a),this.validatePasswordCharacterOptions(e,a),a.isValid&&(a.isValid=null===(t=a.meetsMinPasswordLength)||void 0===t||t),a.isValid&&(a.isValid=null===(n=a.meetsMaxPasswordLength)||void 0===n||n),a.isValid&&(a.isValid=null===(r=a.containsLowercaseLetter)||void 0===r||r),a.isValid&&(a.isValid=null===(i=a.containsUppercaseLetter)||void 0===i||i),a.isValid&&(a.isValid=null===(o=a.containsNumericCharacter)||void 0===o||o),a.isValid&&(a.isValid=null===(s=a.containsNonAlphanumericCharacter)||void 0===s||s),a}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,i){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=i))}}class Ut{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 Ft(this),this.idTokenSubscription=new Ft(this),this.beforeStateQueue=new xt(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=Ne,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 It.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,i=!1;if(e&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();const n=null===(t=this.redirectUser)||void 0===t?void 0:t._redirectEventId,o=null==r?void 0:r._redirectEventId,s=await this.tryRedirectSignIn(e);n&&n!==o||!(null==s?void 0:s.user)||(r=s.user,i=!0)}if(!r)return this.directlySetCurrentUser(null);if(!r._redirectEventId){if(i)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 He(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?P(e):null;return t&&He(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&&He(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",Qe(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;He(t,this,"argument-error"),this.redirectPersistenceManager=await It.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 i="function"==typeof t?t:t.next.bind(t);let o=!1;const s=this._isInitialized?Promise.resolve():this._initializationPromise;if(He(s,this,"internal-error"),s.then((()=>{o||i(this.currentUser)})),"function"==typeof t){const i=e.addObserver(t,n,r);return()=>{o=!0,i()}}{const n=e.addObserver(t);return()=>{o=!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 He(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(e){e&&!this.frameworks.includes(e)&&(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=Dt(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){De.logLevel<=N.WARN&&De.warn(`Auth (${ge}): ${e}`,...t)}(`Error while retrieving App Check token: ${t.error}`),null==t?void 0:t.token}}function jt(e){return P(e)}class Ft{constructor(e){this.auth=e,this.observer=null,this.addObserver=function(e,t){const n=new T(e,t);return n.subscribe.bind(n)}((e=>this.observer=e))}get next(){return He(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}function Vt(e){return new Promise(((t,n)=>{const r=document.createElement("script");var i,o;r.setAttribute("src",e),r.onload=t,r.onerror=e=>{const t=Ue("internal-error");t.customData=e,n(t)},r.type="text/javascript",r.charset="UTF-8",(null!==(o=null===(i=document.getElementsByTagName("head"))||void 0===i?void 0:i[0])&&void 0!==o?o:document).appendChild(r)}))}function Ht(e){return`__${e}${Math.floor(1e6*Math.random())}`}class $t{constructor(e){this.type="recaptcha-enterprise",this.auth=jt(e)}async verify(e="verify",t=!1){function n(t,n,r){const i=window.grecaptcha;Ce(i)?i.enterprise.ready((()=>{i.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)=>{st(e,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}).then((r=>{if(void 0!==r.recaptchaKey){const n=new Ae(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((i=>{if(!t&&Ce(window.grecaptcha))n(i,e,r);else{if("undefined"==typeof window)return void r(new Error("RecaptchaVerifier is only supported in browser"));Vt("https://www.google.com/recaptcha/enterprise.js?render="+i).then((()=>{n(i,e,r)})).catch((e=>{r(e)}))}})).catch((e=>{r(e)}))}))}}async function Bt(e,t,n,r=!1){const i=new $t(e);let o;try{o=await i.verify(n)}catch(e){o=await i.verify(n,!0)}const s=Object.assign({},t);return r?Object.assign(s,{captchaResp:o}):Object.assign(s,{captchaResponse:o}),Object.assign(s,{clientType:"CLIENT_TYPE_WEB"}),Object.assign(s,{recaptchaVersion:"RECAPTCHA_ENTERPRISE"}),s}function Wt(e,t,n){const r=jt(e);He(r._canInitEmulator,r,"emulator-config-failed"),He(/^https?:\/\//.test(t),r,"invalid-emulator-scheme");const i=!!(null==n?void 0:n.disableWarnings),o=zt(t),{host:s,port:a}=function(e){const t=zt(e),n=/(\/\/)?([^?#/]+)/.exec(e.substr(t.length));if(!n)return{host:"",port:null};const r=n[2].split("@").pop()||"",i=/^(\[[^\]]+\])(:|$)/.exec(r);if(i){const e=i[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===a?"":`:${a}`;r.config.emulator={url:`${o}//${s}${c}/`},r.settings.appVerificationDisabledForTesting=!0,r.emulatorConfig=Object.freeze({host:s,port:a,protocol:o.replace(":",""),options:Object.freeze({disableWarnings:i})}),i||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 zt(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 Kt{constructor(e,t){this.providerId=e,this.signInMethod=t}toJSON(){return $e("not implemented")}_getIdTokenResponse(e){return $e("not implemented")}_linkToIdToken(e,t){return $e("not implemented")}_getReauthenticationResolver(e){return $e("not implemented")}}async function qt(e,t){return et(e,"POST","/v1/accounts:update",t)}async function Jt(e,t){return nt(e,"POST","/v1/accounts:signInWithPassword",Qe(e,t))}async function Yt(e,t){return et(e,"POST","/v1/accounts:sendOobCode",Qe(e,t))}async function Xt(e,t){return Yt(e,t)}class Zt extends Kt{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 Bt(e,n,"signInWithPassword");return Jt(e,t)}return Jt(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 Bt(e,n,"signInWithPassword");return Jt(e,t)}return Promise.reject(t)}));case"emailLink":return async function(e,t){return nt(e,"POST","/v1/accounts:signInWithEmailLink",Qe(e,t))}(e,{email:this._email,oobCode:this._password});default:Me(e,"internal-error")}}async _linkToIdToken(e,t){switch(this.signInMethod){case"password":return qt(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",Qe(e,t))}(e,{idToken:t,email:this._email,oobCode:this._password});default:Me(e,"internal-error")}}_getReauthenticationResolver(e){return this._getIdTokenResponse(e)}}async function Qt(e,t){return nt(e,"POST","/v1/accounts:signInWithIdp",Qe(e,t))}class en extends Kt{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,i=Oe(t,["providerId","signInMethod"]);if(!n||!r)return null;const o=new en(n,r);return o.idToken=i.idToken||void 0,o.accessToken=i.accessToken||void 0,o.secret=i.secret,o.nonce=i.nonce,o.pendingToken=i.pendingToken||null,o}_getIdTokenResponse(e){return Qt(e,this.buildRequest())}_linkToIdToken(e,t){const n=this.buildRequest();return n.idToken=t,Qt(e,n)}_getReauthenticationResolver(e){const t=this.buildRequest();return t.autoCreate=!1,Qt(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=I(t)}return e}}const tn={USER_NOT_FOUND:"user-not-found"};class nn extends Kt{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",Qe(e,t))}(e,this._makeVerificationRequest())}_linkToIdToken(e,t){return async function(e,t){const n=await nt(e,"POST","/v1/accounts:signInWithPhoneNumber",Qe(e,t));if(n.temporaryProof)throw ot(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",Qe(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:i}=e;return n||t||r||i?new nn({verificationId:t,verificationCode:n,phoneNumber:r,temporaryProof:i}):null}}class rn{constructor(e){var t,n,r,i,o,s;const a=E(k(e)),c=null!==(t=a.apiKey)&&void 0!==t?t:null,u=null!==(n=a.oobCode)&&void 0!==n?n:null,l=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=a.mode)&&void 0!==r?r:null);He(c&&u&&l,"argument-error"),this.apiKey=c,this.operation=l,this.code=u,this.continueUrl=null!==(i=a.continueUrl)&&void 0!==i?i:null,this.languageCode=null!==(o=a.languageCode)&&void 0!==o?o:null,this.tenantId=null!==(s=a.tenantId)&&void 0!==s?s:null}static parseLink(e){const t=function(e){const t=E(k(e)).link,n=t?E(k(t)).deep_link_id:null,r=E(k(e)).deep_link_id;return(r?E(k(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 He(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 sn{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 an extends sn{constructor(){super(...arguments),this.scopes=[]}addScope(e){return this.scopes.includes(e)||this.scopes.push(e),this}getScopes(){return[...this.scopes]}}class cn extends an{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 un extends an{constructor(){super("google.com"),this.addScope("profile")}static credential(e,t){return en._fromParams({providerId:un.PROVIDER_ID,signInMethod:un.GOOGLE_SIGN_IN_METHOD,idToken:e,accessToken:t})}static credentialFromResult(e){return un.credentialFromTaggedObject(e)}static credentialFromError(e){return un.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthIdToken:t,oauthAccessToken:n}=e;if(!t&&!n)return null;try{return un.credential(t,n)}catch(e){return null}}}un.GOOGLE_SIGN_IN_METHOD="google.com",un.PROVIDER_ID="google.com";class ln extends an{constructor(){super("github.com")}static credential(e){return en._fromParams({providerId:ln.PROVIDER_ID,signInMethod:ln.GITHUB_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return ln.credentialFromTaggedObject(e)}static credentialFromError(e){return ln.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e))return null;if(!e.oauthAccessToken)return null;try{return ln.credential(e.oauthAccessToken)}catch(e){return null}}}ln.GITHUB_SIGN_IN_METHOD="github.com",ln.PROVIDER_ID="github.com";class hn extends an{constructor(){super("twitter.com")}static credential(e,t){return en._fromParams({providerId:hn.PROVIDER_ID,signInMethod:hn.TWITTER_SIGN_IN_METHOD,oauthToken:e,oauthTokenSecret:t})}static credentialFromResult(e){return hn.credentialFromTaggedObject(e)}static credentialFromError(e){return hn.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthAccessToken:t,oauthTokenSecret:n}=e;if(!t||!n)return null;try{return hn.credential(t,n)}catch(e){return null}}}async function dn(e,t){return nt(e,"POST","/v1/accounts:signUp",Qe(e,t))}hn.TWITTER_SIGN_IN_METHOD="twitter.com",hn.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 i=await mt._fromIdTokenResponse(e,n,r),o=fn(n);return new pn({user:i,providerId:o,_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 gn extends v{constructor(e,t,n,r){var i;super(t.code,t.message),this.operationType=n,this.user=r,Object.setPrototypeOf(this,gn.prototype),this.customData={appName:e.name,tenantId:null!==(i=e.tenantId)&&void 0!==i?i:void 0,_serverResponse:t.customData._serverResponse,operationType:n}}static _fromErrorAndOperation(e,t,n,r){return new gn(e,t,n,r)}}function mn(e,t,n,r){return("reauthenticate"===t?n._getReauthenticationResolver(e):n._getIdTokenResponse(e)).catch((n=>{if("auth/multi-factor-auth-required"===n.code)throw gn._fromErrorAndOperation(e,n,t,r);throw n}))}async function vn(e,t,n=!1){const r=await lt(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,i="reauthenticate";try{const o=await lt(e,mn(r,i,t,e),n);He(o.idToken,r,"internal-error");const s=ut(o.idToken);He(s,r,"internal-error");const{sub:a}=s;return He(e.uid===a,r,"user-mismatch"),pn._forOperation(e,i,o)}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",i=await mn(e,r,t),o=await pn._fromIdTokenResponse(e,r,i);return n||await e._updateCurrentUser(o.user),o}async function _n(e,t){return wn(jt(e),t)}function bn(e,t,n){var r;He((null===(r=n.url)||void 0===r?void 0:r.length)>0,e,"invalid-continue-uri"),He(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&&(He(n.iOS.bundleId.length>0,e,"missing-ios-bundle-id"),t.iOSBundleId=n.iOS.bundleId),n.android&&(He(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 In(e){const t=jt(e);t._getPasswordPolicyInternal()&&await t._updatePasswordPolicy()}async function En(e,t,n){var r;const i=jt(e),o={requestType:"PASSWORD_RESET",email:t,clientType:"CLIENT_TYPE_WEB"};if(null===(r=i._getRecaptchaConfig())||void 0===r?void 0:r.emailPasswordEnabled){const e=await Bt(i,o,"getOobCode",!0);n&&bn(i,e,n),await Xt(i,e)}else n&&bn(i,o,n),await Xt(i,o).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 Bt(i,o,"getOobCode",!0);n&&bn(i,e,n),await Xt(i,e)}}))}async function kn(e,t,n){var r;const i=jt(e),o={returnSecureToken:!0,email:t,password:n,clientType:"CLIENT_TYPE_WEB"};let s;if(null===(r=i._getRecaptchaConfig())||void 0===r?void 0:r.emailPasswordEnabled){const e=await Bt(i,o,"signUpPassword");s=dn(i,e)}else s=dn(i,o).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 Bt(i,o,"signUpPassword");return dn(i,e)}throw e}));const a=await s.catch((t=>{throw"auth/password-does-not-meet-requirements"===t.code&&In(e),t})),c=await pn._fromIdTokenResponse(i,"signIn",a);return await i._updateCurrentUser(c.user),c}function Tn(e,t,n){return _n(P(e),on.credential(t,n)).catch((async t=>{throw"auth/password-does-not-meet-requirements"===t.code&&In(e),t}))}async function Sn(e,t){const n=P(e),r={requestType:"VERIFY_EMAIL",idToken:await e.getIdToken()};t&&bn(n.auth,r,t);const{email:i}=await async function(e,t){return Yt(e,t)}(n.auth,r);i!==e.email&&await e.reload()}function Pn(e){return P(e).signOut()}new WeakMap;const On="__sak";class Cn{constructor(e,t){this.storageRetriever=e,this.type=t}_isAvailable(){try{return this.storage?(this.storage.setItem(On,"1"),this.storage.removeItem(On),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 An extends Cn{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=m();return Tt(e)||Rt(e)}()&&function(){try{return!(!window||window===window.top)}catch(e){return!1}}(),this.fallbackToPolling=Nt(),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)},i=this.storage.getItem(n);Lt()&&i!==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]}}An.type="LOCAL";const Rn=An;class Ln extends Cn{constructor(){super((()=>window.sessionStorage),"SESSION")}_addListener(e,t){}_removeListener(e,t){}}Ln.type="SESSION";const Nn=Ln;class Dn{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 Dn(e);return this.receivers.push(n),n}isListeningto(e){return this.eventTarget===e}async handleEvent(e){const t=e,{eventId:n,eventType:r,data:i}=t.data,o=this.handlersMap[r];if(!(null==o?void 0:o.size))return;t.ports[0].postMessage({status:"ack",eventId:n,eventType:r});const s=Array.from(o).map((async e=>e(t.origin,i))),a=await function(e){return Promise.all(e.map((async e=>{try{return{fulfilled:!0,value:await e}}catch(e){return{fulfilled:!1,reason:e}}})))}(s);t.ports[0].postMessage({status:"done",eventId:n,eventType:r,response:a})}_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 xn(e="",t=10){let n="";for(let e=0;e<t;e++)n+=Math.floor(10*Math.random());return e+n}Dn.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 i,o;return new Promise(((s,a)=>{const c=xn("",20);r.port1.start();const u=setTimeout((()=>{a(new Error("unsupported_event"))}),n);o={messageChannel:r,onMessage(e){const t=e;if(t.data.eventId===c)switch(t.data.status){case"ack":clearTimeout(u),i=setTimeout((()=>{a(new Error("timeout"))}),3e3);break;case"done":clearTimeout(i),s(t.data.response);break;default:clearTimeout(u),clearTimeout(i),a(new Error("invalid_response"))}}},this.handlers.add(o),r.port1.addEventListener("message",o.onMessage),this.target.postMessage({eventType:e,eventId:c,data:t},[r.port2])})).finally((()=>{o&&this.removeMessageHandler(o)}))}}function Un(){return window}function jn(){return void 0!==Un().WorkerGlobalScope&&"function"==typeof Un().importScripts}const Fn="firebaseLocalStorageDb",Vn="firebaseLocalStorage",Hn="fbase_key";class $n{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 Bn(e,t){return e.transaction([Vn],t?"readwrite":"readonly").objectStore(Vn)}function Wn(){const e=indexedDB.open(Fn,1);return new Promise(((t,n)=>{e.addEventListener("error",(()=>{n(e.error)})),e.addEventListener("upgradeneeded",(()=>{const t=e.result;try{t.createObjectStore(Vn,{keyPath:Hn})}catch(e){n(e)}})),e.addEventListener("success",(async()=>{const n=e.result;n.objectStoreNames.contains(Vn)?t(n):(n.close(),await function(){const e=indexedDB.deleteDatabase(Fn);return new $n(e).toPromise()}(),t(await Wn()))}))}))}async function zn(e,t,n){const r=Bn(e,!0).put({[Hn]:t,value:n});return new $n(r).toPromise()}function Gn(e,t){const n=Bn(e,!0).delete(t);return new $n(n).toPromise()}class Kn{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 jn()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=Dn._getInstance(jn()?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 zn(e,On,"1"),await Gn(e,On),!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=>zn(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=Bn(e,!1).get(t),r=await new $n(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=Bn(e,!1).getAll();return new $n(t).toPromise()}));if(!e)return[];if(0!==this.pendingWrites)return[];const t=[],n=new Set;for(const{fbase_key:r,value:i}of e)n.add(r),JSON.stringify(this.localCache[r])!==JSON.stringify(i)&&(this.notifyListeners(r,i),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()}}Kn.type="LOCAL";const qn=Kn;Ht("rcb"),new qe(3e4,6e4);const Jn="recaptcha";async function Yn(e,t,n){var r;const i=await n.verify();try{let o;if(He("string"==typeof i,e,"argument-error"),He(n.type===Jn,e,"argument-error"),o="string"==typeof t?{phoneNumber:t}:t,"session"in o){const t=o.session;if("phoneNumber"in o){He("enroll"===t.type,e,"internal-error");const n=await function(e,t){return et(e,"POST","/v2/accounts/mfaEnrollment:start",Qe(e,t))}(e,{idToken:t.credential,phoneEnrollmentInfo:{phoneNumber:o.phoneNumber,recaptchaToken:i}});return n.phoneSessionInfo.sessionInfo}{He("signin"===t.type,e,"internal-error");const n=(null===(r=o.multiFactorHint)||void 0===r?void 0:r.uid)||o.multiFactorUid;He(n,e,"missing-multi-factor-info");const s=await function(e,t){return et(e,"POST","/v2/accounts/mfaSignIn:start",Qe(e,t))}(e,{mfaPendingCredential:t.credential,mfaEnrollmentId:n,phoneSignInInfo:{recaptchaToken:i}});return s.phoneResponseInfo.sessionInfo}}{const{sessionInfo:t}=await async function(e,t){return et(e,"POST","/v1/accounts:sendVerificationCode",Qe(e,t))}(e,{phoneNumber:o.phoneNumber,recaptchaToken:i});return t}}finally{n._reset()}}class Xn{constructor(e){this.providerId=Xn.PROVIDER_ID,this.auth=jt(e)}verifyPhoneNumber(e,t){return Yn(this.auth,e,P(t))}static credential(e,t){return nn._fromVerification(e,t)}static credentialFromResult(e){const t=e;return Xn.credentialFromTaggedObject(t)}static credentialFromError(e){return Xn.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):(He(e._popupRedirectResolver,e,"argument-error"),e._popupRedirectResolver)}Xn.PROVIDER_ID="phone",Xn.PHONE_SIGN_IN_METHOD="phone";class Qn extends Kt{constructor(e){super("custom","custom"),this.params=e}_getIdTokenResponse(e){return Qt(e,this._buildIdpRequest())}_linkToIdToken(e,t){return Qt(e,this._buildIdpRequest(t))}_getReauthenticationResolver(e){return Qt(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 Qn(e),e.bypassAuthState)}function tr(e){const{auth:t,user:n}=e;return He(n,t,"internal-error"),yn(n,new Qn(e),e.bypassAuthState)}async function nr(e){const{auth:t,user:n}=e;return He(n,t,"internal-error"),vn(n,new Qn(e),e.bypassAuthState)}class rr{constructor(e,t,n,r,i=!1){this.auth=e,this.resolver=n,this.user=r,this.bypassAuthState=i,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:i,error:o,type:s}=e;if(o)return void this.reject(o);const a={auth:this.auth,requestUri:t,sessionId:n,tenantId:i||void 0,postBody:r||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(s)(a))}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){Be(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(e),this.unregisterAndCleanUp()}reject(e){Be(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 ir=new qe(2e3,1e4);async function or(e,t,n){const r=jt(e);Fe(e,t,sn);const i=Zn(r,n);return new sr(r,"signInViaPopup",t,i).executeNotNull()}class sr extends rr{constructor(e,t,n,r,i){super(e,t,r,i),this.provider=n,this.authWindow=null,this.pollId=null,sr.currentPopupAction&&sr.currentPopupAction.cancel(),sr.currentPopupAction=this}async executeNotNull(){const e=await this.execute();return He(e,this.auth,"internal-error"),e}async onExecution(){Be(1===this.filter.length,"Popup operations only handle one event");const e=xn();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(Ue(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(Ue(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,sr.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(Ue(this.auth,"popup-closed-by-user"))}),8e3):this.pollId=window.setTimeout(e,ir.get())};e()}}sr.currentPopupAction=null;const ar=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=ar.get(this.auth._key());if(!e){try{const t=await async function(e,t){const n=hr(t),r=lr(e);if(!await r._isAvailable())return!1;const i="true"===await r._get(n);return await r._remove(n),i}(this.resolver,this.auth)?await super.execute():null;e=()=>Promise.resolve(t)}catch(t){e=()=>Promise.reject(t)}ar.set(this.auth._key(),e)}return this.bypassAuthState||ar.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 ur(e,t){ar.set(e._key(),t)}function lr(e){return yt(e._redirectPersistence)}function hr(e){return bt("pendingRedirect",e.config.apiKey,e.name)}async function dr(e,t,n=!1){const r=jt(e),i=Zn(r,t),o=new cr(r,i,n),s=await o.execute();return s&&!n&&(delete s.user._redirectEventId,await r._persistUserIfCurrent(s.user),await r._setRedirectUser(null,t)),s}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 gr(e);default:return!1}}(e)||(this.hasHandledPotentialRedirect=!0,t||(this.queuedRedirectEvent=e,t=!0)),t}sendToConsumer(e,t){var n;if(e.error&&!gr(e)){const r=(null===(n=e.error.code)||void 0===n?void 0:n.split("auth/")[1])||"internal-error";t.onError(Ue(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 gr({type:e,error:t}){return"unknown"===e&&"auth/no-auth-event"===(null==t?void 0:t.code)}const mr=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,vr=/^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 i=new URL(e);return""===i.hostname&&""===r?"chrome-extension:"===n&&e.replace("chrome-extension://","")===t.replace("chrome-extension://",""):"chrome-extension:"===n&&i.hostname===r}if(!vr.test(n))return!1;if(mr.test(e))return r===e;const i=e.replace(/\./g,"\\.");return new RegExp("^(.+\\."+i+"|"+i+")$","i").test(r)}const _r=new qe(3e4,6e4);function br(){const e=Un().___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 Ir=null;function Er(e){return Ir=Ir||function(e){return new Promise(((t,n)=>{var r,i,o;function s(){br(),gapi.load("gapi.iframes",{callback:()=>{t(gapi.iframes.getContext())},ontimeout:()=>{br(),n(Ue(e,"network-request-failed"))},timeout:_r.get()})}if(null===(i=null===(r=Un().gapi)||void 0===r?void 0:r.iframes)||void 0===i?void 0:i.Iframe)t(gapi.iframes.getContext());else{if(!(null===(o=Un().gapi)||void 0===o?void 0:o.load)){const t=Ht("iframefcb");return Un()[t]=()=>{gapi.load?s():n(Ue(e,"network-request-failed"))},Vt(`https://apis.google.com/js/api.js?onload=${t}`).catch((e=>n(e)))}s()}})).catch((e=>{throw Ir=null,e}))}(e),Ir}const kr=new qe(5e3,15e3),Tr={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 Pr(e){const t=e.config;He(t.authDomain,e,"auth-domain-config-required");const n=t.emulator?Je(t,"emulator/auth/iframe"):`https://${e.config.authDomain}/__/auth/iframe`,r={apiKey:t.apiKey,appName:e.name,v:ge},i=Sr.get(e.config.apiHost);i&&(r.eid=i);const o=e._getFrameworks();return o.length&&(r.fw=o.join(",")),`${n}?${I(r).slice(1)}`}const Or={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"};class Cr{constructor(e){this.window=e,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch(e){}}}function Ar(e,t,n,r=500,i=600){const o=Math.max((window.screen.availHeight-i)/2,0).toString(),s=Math.max((window.screen.availWidth-r)/2,0).toString();let a="";const c=Object.assign(Object.assign({},Or),{width:r.toString(),height:i.toString(),top:o,left:s}),u=m().toLowerCase();n&&(a=St(u)?"_blank":n),kt(u)&&(t=t||"http://localhost",c.scrollbars="yes");const l=Object.entries(c).reduce(((e,[t,n])=>`${e}${t}=${n},`),"");if(function(e=m()){var t;return Rt(e)&&!!(null===(t=window.navigator)||void 0===t?void 0:t.standalone)}(u)&&"_self"!==a)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||"",a),new Cr(null);const h=window.open(t||"",a,l);He(h,e,"popup-blocked");try{h.focus()}catch(e){}return new Cr(h)}const Rr="__/auth/handler",Lr="emulator/auth/handler",Nr=encodeURIComponent("fac");async function Dr(e,t,n,r,i,o){He(e.config.authDomain,e,"auth-domain-config-required"),He(e.config.apiKey,e,"invalid-api-key");const s={apiKey:e.config.apiKey,appName:e.name,authType:n,redirectUrl:r,v:ge,eventId:i};if(t instanceof sn){t.setDefaultLanguage(e.languageCode),s.providerId=t.providerId||"",function(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}(t.getCustomParameters())||(s.customParameters=JSON.stringify(t.getCustomParameters()));for(const[e,t]of Object.entries(o||{}))s[e]=t}if(t instanceof an){const e=t.getScopes().filter((e=>""!==e));e.length>0&&(s.scopes=e.join(","))}e.tenantId&&(s.tid=e.tenantId);const a=s;for(const e of Object.keys(a))void 0===a[e]&&delete a[e];const c=await e._getAppCheckToken(),u=c?`#${Nr}=${encodeURIComponent(c)}`:"";return`${function({config:e}){if(!e.emulator)return`https://${e.authDomain}/${Rr}`;return Je(e,Lr)}(e)}?${I(a).slice(1)}${u}`}const xr="webStorageSupport";const Mr=class{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=Nn,this._completeRedirectFn=dr,this._overrideRedirectResult=ur}async _openPopup(e,t,n,r){var i;Be(null===(i=this.eventManagers[e._key()])||void 0===i?void 0:i.manager,"_initialize() not called before _openPopup()");return Ar(e,await Dr(e,t,n,We(),r),xn())}async _openRedirect(e,t,n,r){await this._originValidation(e);return function(e){Un().location.href=e}(await Dr(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):(Be(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=Un().gapi;return He(n,e,"internal-error"),t.open({where:document.body,url:Pr(e),messageHandlersFilter:n.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:Tr,dontclear:!0},(t=>new Promise((async(n,r)=>{await t.restyle({setHideOnLeave:!1});const i=Ue(e,"network-request-failed"),o=Un().setTimeout((()=>{r(i)}),kr.get());function s(){Un().clearTimeout(o),n(t)}t.ping(s).then(s,(()=>{r(i)}))}))))}(e),n=new pr(e);return t.register("authEvent",(t=>{He(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(xr,{type:xr},(n=>{var r;const i=null===(r=null==n?void 0:n[0])||void 0===r?void 0:r[xr];void 0!==i&&t(!!i),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 Nt()||Tt()||Rt()}};var Ur="@firebase/auth",jr="1.3.0";class Fr{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(){He(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}}const Vr=f("authIdTokenMaxAge")||300;let Hr=null;function $r(e=function(e=se){const t=ce.get(e);if(!t&&e===se&&p())return me();if(!t)throw pe.create("no-app",{appName:e});return t}()){const t=de(e,"auth");if(t.isInitialized())return t.getImmediate();const n=function(e,t){const n=de(e,"auth");if(n.isInitialized()){const e=n.getImmediate();if(_(n.getOptions(),null!=t?t:{}))return e;Me(e,"already-initialized")}return n.initialize({options:t})}(e,{popupRedirectResolver:Mr,persistence:[qn,Rn,Nn]}),r=f("authTokenSyncURL");if(r){const e=(i=r,async e=>{const t=e&&await e.getIdTokenResult(),n=t&&((new Date).getTime()-Date.parse(t.issuedAtTime))/1e3;if(n&&n>Vr)return;const r=null==t?void 0:t.token;Hr!==r&&(Hr=r,await fetch(i,{method:r?"POST":"DELETE",headers:r?{Authorization:`Bearer ${r}`}:{}}))});!function(e,t,n){P(e).beforeAuthStateChanged(t,n)}(n,e,(()=>e(n.currentUser))),function(e,t,n,r){P(e).onIdTokenChanged(t,n,r)}(n,(t=>e(t)))}var i;const o=d("auth");return o&&Wt(n,`http://${o}`),n}var Br;Br="Browser",he(new O("auth",((e,{options:t})=>{const n=e.getProvider("app").getImmediate(),r=e.getProvider("heartbeat"),i=e.getProvider("app-check-internal"),{apiKey:o,authDomain:s}=n.options;He(o&&!o.includes(":"),"invalid-api-key",{appName:n.name});const a={apiKey:o,authDomain:s,clientPlatform:Br,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:Dt(Br)},c=new Ut(n,r,i,a);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()}))),he(new O("auth-internal",(e=>(e=>new Fr(e))(jt(e.getProvider("auth").getImmediate()))),"PRIVATE").setInstantiationMode("EXPLICIT")),ve(Ur,jr,function(e){switch(e){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";default:return}}(Br)),ve(Ur,jr,"esm2017");var Wr=n(2805),zr=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 Kr(){Kr=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:{},o=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",a=i.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 u(e,t,n,i){var o=t&&t.prototype instanceof d?t:d,s=Object.create(o.prototype),a=new T(i||[]);return r(s,"_invoke",{value:b(e,n,a)}),s}function l(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=u;var h={};function d(){}function p(){}function f(){}var g={};c(g,o,(function(){return this}));var m=Object.getPrototypeOf,v=m&&m(m(S([])));v&&v!==t&&n.call(v,o)&&(g=v);var y=f.prototype=d.prototype=Object.create(g);function w(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function _(e,t){function i(r,o,s,a){var c=l(e[r],e,o);if("throw"!==c.type){var u=c.arg,h=u.value;return h&&"object"==Gr(h)&&n.call(h,"__await")?t.resolve(h.__await).then((function(e){i("next",e,s,a)}),(function(e){i("throw",e,s,a)})):t.resolve(h).then((function(e){u.value=e,s(u)}),(function(e){return i("throw",e,s,a)}))}a(c.arg)}var o;r(this,"_invoke",{value:function(e,n){function r(){return new t((function(t,r){i(e,n,t,r)}))}return o=o?o.then(r,r):r()}})}function b(e,t,n){var r="suspendedStart";return function(i,o){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw o;return P()}for(n.method=i,n.arg=o;;){var s=n.delegate;if(s){var a=I(s,n);if(a){if(a===h)continue;return a}}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=l(e,t,n);if("normal"===c.type){if(r=n.done?"completed":"suspendedYield",c.arg===h)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")),h;var i=l(r,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,h;var o=i.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,h):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,h)}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 k(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function T(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(E,this),this.reset(!0)}function S(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,i=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 i.next=i}}return{next:P}}function P(){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,a,"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,a,"GeneratorFunction")),e.prototype=Object.create(y),e},e.awrap=function(e){return{__await:e}},w(_.prototype),c(_.prototype,s,(function(){return this})),e.AsyncIterator=_,e.async=function(t,n,r,i,o){void 0===o&&(o=Promise);var s=new _(u(t,n,r,i),o);return e.isGeneratorFunction(n)?s:s.next().then((function(e){return e.done?e.value:s.next()}))},w(y),c(y,a,"Generator"),c(y,o,(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,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(k),!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 s.type="throw",s.arg=e,t.next=n,r&&(t.method="next",t.arg=void 0),!!r}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],s=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var a=n.call(o,"catchLoc"),c=n.call(o,"finallyLoc");if(a&&c){if(this.prev<o.catchLoc)return r(o.catchLoc,!0);if(this.prev<o.finallyLoc)return r(o.finallyLoc)}else if(a){if(this.prev<o.catchLoc)return r(o.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return r(o.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var s=o?o.completion:{};return s.type=e,s.arg=t,o?(this.method="next",this.next=o.finallyLoc,h):this.complete(s)},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),h},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),k(n),h}},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 i=r.arg;k(n)}return i}}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),h}},e}function qr(e,t,n,r,i,o,s){try{var a=e[o](s),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,i)}function Jr(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var o=e.apply(t,n);function s(e){qr(o,r,i,s,a,"next",e)}function a(e){qr(o,r,i,s,a,"throw",e)}s(void 0)}))}}function Yr(e,t,n,i,o){var s=window.__pt.settings.loginErrors,a=this,c=new r,u=window.__pt.fn,l=u.search(),h=window.__pt.settings.site,d=null,p=window.__pt.settings.site,f=me(p.login.firebaseSettings);a.loginProviders=window.__pt.settings.site.login.providers,a.settings=window.__pt.settings.site.login.main||{},a.modalActive=!1,a.loadingSession=!1,a.loadingUserProfile=!1,a.dropdownListActive=!1,a.stepRegister=1,a.currenLink="",a.isResetpassword=!1,a.isProvider=!1,a.pageError={},a.userData={email:"",password:"",pwdconfirm:"",lastname:"",name:"",recatcha:""},a.emailInvalid=!1,a.sessionData={isLogin:!1},a.photoStyle={},a.currentErrorMsg=null,a.showBanner=!0,a.currentErrorMsgPerfil=null,a.avatarConf={color:"",avatar:""},a.eyeUser=!0,a.userDataWriten={name:"",phone:"",recaptchaToken:""},a.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:""},a.dropdown_phones=!1,a.dropdown_lang=!1,a.dropdown_langMobile=!1,a.dropdown_nav=!1,a.dropdown_tablet=!1,a.iscodept=!1,a.codeData={},a.isResendCurrenUser=!1;var g=new Wr.Z(p.domainAPIUrl),m=u.search(),v=new zr.Z(m,p),y=(v.getUserKey(o),v.getUserKeyFavorites(o));function w(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;a.pageError.has=!0,a.pageError.type=t,a.loading=!1,a.loadingSession=!1}function _(){return(_=Jr(Kr().mark((function e(t,n){return Kr().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,a.hideModalCall("modal-call",n),a.showModalHeader("modal-confirmation",null);case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function b(){document.body.style.overflow="hidden"}function I(){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(),i=angular.element(".bottom__mask--left"),o=angular.element(".bottom__mask--right");"left"===e&&r<0||r>70?i.hide():i.show();var s,a=(s=angular.element(".bottom__tab").last()).position().left;"right"===e&&a+s.outerWidth()>t.width()?o.hide():o.show(),angular.element(".bottom__tab").eq(0).position().left,(s=angular.element(".bottom__tab").last()).position().left+s.outerWidth()>t.width()&&o.show()}function k(e,t,n){return T.apply(this,arguments)}function T(){return T=Jr(Kr().mark((function e(n,r,i){var o,s;return Kr().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:a.loadingSession=!0,o={headers:{"X-XSRF-TOKEN":S()}},s={uid:n,notSession:r,name:a.userData.name,lastname:a.userData.lastname,token:i||n,remember:!0},t.post(p.siteUrl+"/v1/api/login",s,o).then(function(){var e=Jr(Kr().mark((function e(t){var n;return Kr().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a.loadingSession=!1,200!=t.data.status){e.next=12;break}if(!r){e.next=6;break}a.stepRegister=7,e.next=10;break;case 6:return n={UserId:y,FirebaseId:s.uid,country:p.country.toUpperCase()},e.next=9,g.copyByUser(n).then((function(e){})).catch((function(e){console.error("Error fetching copyByUser:",e)}));case 9:l.redirectTo&&""!==l.redirectTo?window.location.href=p.siteUrl+l.redirectTo:window.location.href=p.siteUrl+"/";case 10:e.next=14;break;case 12:a.currentErrorMsg=t.data.response,a.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)}))),T.apply(this,arguments)}function S(){var e=document.querySelector("[name='_token']");return e?e.value:""}a.showModal=function(e){a.stepRegister=1,$("#".concat(e)).modal("show"),c.metricLoginAction("login",{action:"open modal"}),c.metricLoginAction("login",{action:"link header"}),c.metricHeaderSelectContent({title:"Mi cuenta"})},a.showModalHeader=function(e){$("#".concat(e)).modal("show"),a.cleaInputs()},a.hideModalCoupon=function(e){a.showBanner=!1},a.hideModalCall=function(e,t){$("#".concat(e)).modal("hide"),a.cleaInputs(t)},a.cleaInputs=function(e){a.userDataWriten={name:"",phone:"",recaptchaToken:""},e&&(e.$setPristine(),e.$setUntouched()),grecaptcha.enterprise.reset()},a.hideModal=function(e){$("#".concat(e)).modal("hide"),c.metricLoginAction("login",{action:"close modal"})},a.clickOutside=function(e,t){e.target.id===t&&a.hideModal(t)},a.clickOutsideCall=function(e,t,n){e.target.id===t&&a.hideModalCall(t,n)},a.submitForm=function(e){if(!e.$invalid)switch(a.stepRegister){case 1:e.$setPristine(),e.$setUntouched(),a.verifyEmail();break;case 2:a.loginWithEmailAndPassword(e);break;case 3:a.createUserWithEmailAndPassword(e);break;case 4:a.recoveryPassword()}},a.forgotPasswordForm=function(e){a.currentErrorMsg="",e.$setPristine(),e.$setUntouched(),a.recoveryPassword(),a.stepRegister=4},a.verifyEmail=Jr(Kr().mark((function t(){var n;return Kr().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return a.loadingSession=!0,n=$r(f),t.prev=2,t.next=5,Tn(n,a.userData.email,"///0000");case 5:t.sent,e.$apply((function(){a.loadingSession=!1,a.stepRegister=2})),t.next=12;break;case 9:t.prev=9,t.t0=t.catch(2),e.$apply((function(){a.loadingSession=!1,c.metricsErrorsLogin(t.t0.code),"auth/user-not-found"===t.t0.code||"EMAIL_NOT_FOUND"===t.t0.code?a.stepRegister=3:a.stepRegister=2}));case 12:case"end":return t.stop()}}),t,null,[[2,9]])}))),a.createUserWithEmailAndPassword=Jr(Kr().mark((function t(){var n,r;return Kr().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return a.loadingSession=!0,n=$r(f),t.prev=2,t.next=5,kn(n,a.userData.email,a.userData.password);case 5:r=t.sent,e.$apply(Jr(Kr().mark((function t(){var n,i;return Kr().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=r.user,a.isResendCurrenUser=!1,t.prev=2,t.next=5,k(n.uid,!0,a.userData.recatcha);case 5:return i={url:p.siteUrl+"/login",handleCodeInApp:!0},t.prev=6,t.next=9,Sn(n,i);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(){a.loadingSession=!1,a.currentErrorMsg=s[t.t0.code]||"An unexpected error occurred during email verification.",c.metricsErrorsLogin(t.t0.code||a.currentErrorMsg)}));case 15:t.next=20;break;case 17:t.prev=17,t.t1=t.catch(2),e.$apply((function(){a.loadingSession=!1,a.currentErrorMsg=s[t.t1.code]||"An unexpected error occurred during session setup.",c.metricsErrorsLogin(t.t1.code||a.currentErrorMsg)}));case 20:a.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(){a.loadingSession=!1,a.currentErrorMsg=s[t.t0.code]||"An unexpected error occurred.",c.metricsErrorsLogin(t.t0.code||a.currentErrorMsg),a.stepRegister=3}));case 12:case"end":return t.stop()}}),t,null,[[2,9]])}))),a.goToStepOne=function(){a.stepRegister=1,a.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(){a.userData.recatcha=""}))}),6e4),a.userData.recatcha=t}))}})}))})),a.loginWithEmailAndPassword=Jr(Kr().mark((function t(){var n,r;return Kr().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return a.loadingSession=!0,n=$r(f),t.prev=2,t.next=5,Tn(n,a.userData.email,a.userData.password);case 5:r=t.sent,e.$apply(Jr(Kr().mark((function t(){var i,o;return Kr().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!(i=r.user).emailVerified){t.next=7;break}k(i.uid,!1),c.metricLoginAction("login",{action:"login email"}),a.loadingSession=!1,t.next=21;break;case 7:return a.isResendCurrenUser=!0,c.metricsErrorsLogin("Not emailVerified"),o=n.currentUser,t.prev=10,t.next=13,Sn(o);case 13:t.next=18;break;case 15:t.prev=15,t.t0=t.catch(10),e.$apply((function(){a.loadingSession=!1,a.currentErrorMsg=s[t.t0.code]||"An unexpected error occurred during email verification.",c.metricsErrorsLogin(t.t0.code||a.currentErrorMsg),a.stepRegister=2}));case 18:a.logout(!0),a.stepRegister=7,a.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(){a.loadingSession=!1,a.currentErrorMsg=s[t.t0.code]||"An unexpected error occurred.",c.metricsErrorsLogin(t.t0.code||a.currentErrorMsg),a.stepRegister=2}));case 12:case"end":return t.stop()}}),t,null,[[2,9]])}))),a.loginWithProvider=function(){var t=Jr(Kr().mark((function t(n){var r,i,o;return Kr().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:a.loadingSession=!0,r=$r(f),t.t0=n,t.next="Google"===t.t0?5:"Facebook"===t.t0?7:9;break;case 5:return i=new un,t.abrupt("break",12);case 7:return i=new cn,t.abrupt("break",12);case 9:return console.error("Proveedor no admitido"),a.loadingSession=!1,t.abrupt("return");case 12:return t.prev=12,t.next=15,or(r,i);case 15:o=t.sent,e.$apply((function(){k(o.user.uid,!1),c.metricLoginAction("login",{action:"login ".concat(n)}),a.loadingSession=!1})),t.next=22;break;case 19:t.prev=19,t.t1=t.catch(12),e.$apply((function(){a.currentErrorMsg=s[t.t1.code]||"An unexpected error occurred.",c.metricsErrorsLogin(t.t1.code||"An unexpected error occurred."),a.stepRegister=1,a.loadingSession=!1}));case 22:case"end":return t.stop()}}),t,null,[[12,19]])})));return function(e){return t.apply(this,arguments)}}(),a.deleteAccount=function(){var t=$r().currentUser;t?async function(e){return P(e).delete()}(t).then((function(){e.$apply((function(){c.metricLoginAction("login",{action:"delete account"}),a.logout()}))})).catch((function(t){e.$apply((function(){a.currentErrorMsg="Error deleting account: "+(t.code||"An unexpected error occurred."),c.metricsErrorsLogin(t.code||"Error deleting account")}))})):e.$apply((function(){a.currentErrorMsg="No user is currently logged in."}))},a.recoveryPassword=Jr(Kr().mark((function t(){var n,r;return Kr().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return a.loadingSession=!0,n=$r(f),r={url:p.siteUrl+"/login",handleCodeInApp:!0},t.prev=3,t.next=6,En(n,a.userData.email,r);case 6:e.$apply((function(){a.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"),a.currentErrorMsg=s[t.t0.code]||"An unexpected error occurred.",a.loadingSession=!1}));case 12:case"end":return t.stop()}}),t,null,[[3,9]])}))),a.logout=Jr(Kr().mark((function t(){var n,r,i=arguments;return Kr().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=i.length>0&&void 0!==i[0]&&i[0],r=$r(f),t.prev=2,t.next=5,Pn(r);case 5:e.$apply((function(){a.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(){a.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]])}))),a.reseendVerification=Jr(Kr().mark((function t(){var n,r;return Kr().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return a.loadingSession=!0,n=$r(f),r=n.currentUser,t.prev=3,t.next=6,Sn(r);case 6:e.$apply((function(){a.loadingSession=!1})),t.next=12;break;case 9:t.prev=9,t.t0=t.catch(3),e.$apply((function(){a.loadingSession=!1,a.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]])}))),a.continueHome=function(){a.logout(),window.location.href="/"},a.isActive=function(e){return i.path()===e},a.setSessionDataObject=function(e){a.sessionData={token:e.token,displayName:e.userProfile.name||e.userProfile.contactEmail,uid:e.firebaseId,photoURL:e.image,isLogin:!0},a.userProfile.name=e.userProfile.name||null,a.userProfile.uid=e.firebaseId||null,a.userProfile.contactEmail=e.userProfile.contactEmail||null,a.userProfile.phone=e.userProfile.phone||null,a.userProfile.codePhone=e.userProfile.codePhone||null,a.userProfile.birthdate=e.userProfile.birthdate||null,a.userProfile.nationality=e.userProfile.nationality||null,a.userProfile.placeOfResidence=e.userProfile.placeOfResidence||null,a.userProfile.gender=e.userProfile.gender||null,a.userProfile.createdAt=e.userProfile.createdAt||null,a.userProfile.updatedAt=e.userProfile.updatedAt||null,a.userProfile.deletedAt=e.userProfile.deletedAt||null,a.userProfile.usersId=e.userProfile.usersId||0,a.userProfile.reservations=e.reservation||[],a.userProfile.id=e.id||0,a.avatarConf.avatar=a.userProfile.name?a.userProfile.name.substr(0,1):a.userProfile.contactEmail.substr(0,1),a.avatarConf.color=function(){var e=o.get("user_color");if(!e){var t=["#55c1ee","#5473b7","#5492cc","#fbac00","#fe6900","#ea0074","#573d95"];e=t[Math.floor(Math.random()*t.length)],o.set("user_color",e)}return e}(),a.setStyleAvatar(a.sessionData.photoURL,a.avatarConf),o.set("user",a.sessionData)},a.setStyleAvatar=function(e,t){a.photoStyle={"background-position":"center center","background-size":"cover","background-repeat":"no-repeat","background-color":"rgb("+t.color+")"},e&&(a.photoStyle["background-image"]="url("+e+")")},a.hasError=function(e,t){var n=e[t];return e.$submitted&&n.$invalid},a.isPasswordValid=function(e){return(null==e?void 0:e.length)>=8&&a.containsUppercase(e)&&a.containsNumber(e)},a.containsUppercase=function(e){return/[A-Z]/.test(e)},a.containsNumber=function(e){return/[0-9]/.test(e)},a.submitFormtWrite=function(e){a.userDataWriten.recaptchaToken=grecaptcha.enterprise.getResponse(d).length>0?grecaptcha.enterprise.getResponse(d):null,e.$invalid=!a.userDataWriten.recaptchaToken,!e.$invalid&&a.userDataWriten.phone&&a.userDataWriten.name&&function(e,t){_.apply(this,arguments)}(a.userDataWriten,e)},a.checkLoginParams=function(){var e=l.loginOpen,t=l.loginEmail,r=l.loginTimeout||a.settings.timeOpen;a.settings.autoOpen&&e&&n((function(){a.showModal("modal-login"),$("#navbarNav").addClass("show")}),1e3*r),t&&(a.userData.email=t)},a.sendContentHeader=function(e){c.metricHeaderSelectContent({title:e})},a.openDropdown=function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];a[e]=!a[e],a[e]&&"dropdown_nav"===e?b():I(),a.dropdown_langMobile,a.dropdown_user,"dropdown_nav"!=e&&"dropdown_langMobile"!=e&&window.innerWidth<=991&&(a.dropdown_nav=!1),"dropdown_lang"!=e&&(a.dropdown_lang=!1),h.mobile&&a[e]&&t||a.setDatePopupLogin()},a.openDropdownClose=function(e){a[e]=!1},a.setDatePopupLogin=function(){var e=o.get("popup_auto_open");if(!(new Date(e)>new Date)){var t=new Date;t.setDate(t.getDate()+1),o.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=l.coupon,r=u.getCookie("codept"),i=n||r;if(u.setCookie("codept",i,"1"),a.iscodept=!!i,a.iscodept&&(e=i,t.get("/v1/api/GetCoupon?DiscountCode=".concat(e)).then((function(e){"null"!=e.data?a.codeData=e.data:a.codeData={}})).catch((function(e){console.error("Error al obtener los datos del cupón:",e),a.codeData={}}))),window.__pt.settings.site.login&&window.__pt.settings.site.login.main.active&&(function(){var e=u.getCookie("session_token");if(e&&e.length>0)return!0;return!1}()&&window.__pt.user?(a.setSessionDataObject(window.__pt.user),"/login"==window.location.pathname&&(window.location.href="/")):"/login/perfil"==window.location.pathname&&(window.location.href="/login")),"TB"==h.code&&window.grecaptcha&&"/login"!=window.location.pathname&&(d=grecaptcha.enterprise.ready((function(){grecaptcha.enterprise.render("g-recaptcha",{sitekey:"6Lfl5-8eAAAAAECHbOBAyrnsbQah1X5kthYKYyvq"})}))),"PTMX"==h.code&&!a.loadingSession){var s=o.get("popup_auto_open");if(new Date>new Date(s)){a.dropdown_user=!0;var c=setTimeout((function(){a.dropdown_user&&$("#btn_start_session").click(),clearTimeout(c)}),1e4)}}}()}window.app.controller("LoginController",Yr),Yr.$inject=["$scope","$http","$timeout","$location","localStorageService"]})()})();
//# sourceMappingURL=controller.js.map