1/*! For license information please see d6a94a9f-019be7734cffb097a523.js.LICENSE.txt */ 2"use strict";(self.webpackChunkhusky_site=self.webpackChunkhusky_site||[]).push([[567],{74150:function(e,t,n){n.r(t),n.d(t,{DefaultLdsService:function(){return Pu},Events:function(){return Su},FieldCategory:function(){return bu},FirebaseUserAuthService:function(){return gm},InputType:function(){return Eu},LdsSystem:function(){return _u},OobMode:function(){return Iu},ShopifyService:function(){return Cu},ThirdPartyProvider:function(){return Tu},UserIdentifierType:function(){return xu},default:function(){return DE},isErrorResult:function(){return CE}});var r=n(88943),i=n(93441),a=n(71083),s=n(96384),o=n(36564),u=n(45281),c=n(47797);function l(e){return l="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},l(e)}function h(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}function f(e,t,n,r){return new(n||(n=Promise))(function(i,a){function s(e){try{u(r.next(e))}catch(t){a(t)}}function o(e){try{u(r.throw(e))}catch(t){a(t)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,o)}u((r=r.apply(e,t||[])).next())})}function d(e){return d=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},d(e)}function p(){return p="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=d(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},p.apply(this,arguments)}function v(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function g(e,t){return g=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},g(e,t)}function y(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&g(e,t)}function m(e,t){if(t&&("object"===l(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return v(e)}function k(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function w(e,t){if(e){if("string"==typeof e)return k(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?k(e,t):void 0}}function b(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,a=[],s=!0,o=!1;try{for(n=n.call(e);!(s=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);s=!0);}catch(u){o=!0,i=u}finally{try{s||null==n.return||n.return()}finally{if(o)throw i}}return a}}(e,t)||w(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _(e,t,n,r,i,a,s){try{var o=e[a](s),u=o.value}catch(c){return void n(c)}o.done?t(u):Promise.resolve(u).then(r,i)}function E(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var a=e.apply(t,n);function s(e){_(a,r,i,s,o,"next",e)}function o(e){_(a,r,i,s,o,"throw",e)}s(void 0)})}}function I(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function S(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,r.key,r)}}
vendor: 5,100 bytes, line 2
2function T(e,t,n){return t&&S(e.prototype,t),n&&S(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function x(e){return function(e){if(Array.isArray(e))return k(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||w(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function A(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var C="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==n.g?n.g:"undefined"!=typeof self?self:{},P={exports:{}};!function(e){var t=function(e){var t,n=Object.prototype,r=n.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",o=i.toStringTag||"@@toStringTag";function u(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(R){u=function(e,t,n){return e[t]=n}}function c(e,t,n,r){var i=t&&t.prototype instanceof y?t:y,a=Object.create(i.prototype),s=new C(r||[]);return a._invoke=function(e,t,n){var r=f;return function(i,a){if(r===p)throw new Error("Generator is already running");if(r===v){if("throw"===i)throw a;return O()}for(n.method=i,n.arg=a;;){var s=n.delegate;if(s){var o=T(s,n);if(o){if(o===g)continue;return o}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(r===f)throw r=v,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r=p;var u=h(e,t,n);if("normal"===u.type){if(r=n.done?v:d,u.arg===g)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r=v,n.method="throw",n.arg=u.arg)}}}(e,n,s),a}function h(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(R){return{type:"throw",arg:R}}}e.wrap=c;var f="suspendedStart",d="suspendedYield",p="executing",v="completed",g={};function y(){}function m(){}function k(){}var w={};u(w,a,function(){return this});var b=Object.getPrototypeOf,_=b&&b(b(P([])));_&&_!==n&&r.call(_,a)&&(w=_);var E=k.prototype=y.prototype=Object.create(w);function I(e){["next","throw","return"].forEach(function(t){u(e,t,function(e){return this._invoke(t,e)})})}function S(e,t){function n(i,a,s,o){var u=h(e[i],e,a);if("throw"!==u.type){var c=u.arg,f=c.value;return f&&"object"===l(f)&&r.call(f,"__await")?t.resolve(f.__await).then(function(e){n("next",e,s,o)},function(e){n("throw",e,s,o)}):t.resolve(f).then(function(e){c.value=e,s(c)},function(e){return n("throw",e,s,o)})}o(u.arg)}var i;this._invoke=function(e,r){function a(){return new t(function(t,i){n(e,r,t,i)})}return i=i?i.then(a,a):a()}}function T(e,n){var r=e.iterator[n.method];if(r===t){if(n.delegate=null,"throw"===n.method){if(e.iterator.return&&(n.method="return",n.arg=t,T(e,n),"throw"===n.method))return g;n.method="throw",n.arg=new TypeError("The iterator does not provide a 'throw' method")}return g}var i=h(r,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,g;var a=i.arg;return a?a.done?(n[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,g):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function x(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 A(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function C(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(x,this),this.reset(!0)}function P(e){if(e){var n=e[a];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,s=function n(){for(;++i<e.length;)if(r.call(e,i))return n.value=e[i],n.done=!1,n;return n.value=t,n.done=!0,n};return s.next=s}}return{next:O}}function O(){return{value:t,done:!0}}return m.prototype=k,u(E,"constructor",k),u(k,"constructor",m),m.displayName=u(k,o,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===m||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,k):(e.__proto__=k,u(e,o,"GeneratorFunction")),e.prototype=Object.create(E),e},e.awrap=function(e){return{__await:e}},I(S.prototype),u(S.prototype,s,function(){return this}),e.AsyncIterator=S,e.async=function(t,n,r,i,a){void 0===a&&(a=Promise);var s=new S(c(t,n,r,i),a);return e.isGeneratorFunction(n)?s:s.next().then(function(e){return e.done?e.value:s.next()})},I(E),u(E,o,"Generator"),u(E,a,function(){return this}),u(E,"toString",function(){return"[object Generator]"}),e.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var r=t.pop();if(r in e)return n.value=r,n.done=!1,n}return n.done=!0,n}},e.values=P,C.prototype={constructor:C,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEac
2h(A),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},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 n=this;function i(r,i){return o.type="throw",o.arg=e,n.next=r,i&&(n.method="next",n.arg=t),!!i}for(var a=this.tryEntries.length-1;a>=0;--a){var s=this.tryEntries[a],o=s.completion;if("root"===s.tryLoc)return i("end");if(s.tryLoc<=this.prev){var u=r.call(s,"catchLoc"),c=r.call(s,"finallyLoc");if(u&&c){if(this.prev<s.catchLoc)return i(s.catchLoc,!0);if(this.prev<s.finallyLoc)return i(s.finallyLoc)}else if(u){if(this.prev<s.catchLoc)return i(s.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<s.finallyLoc)return i(s.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var a=i;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var s=a?a.completion:{};return s.type=e,s.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):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),g},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),A(n),g}},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;A(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:P(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),g}},e}(e.exports);try{regeneratorRuntime=t}catch(n){"object"===("undefined"==typeof globalThis?"undefined":l(globalThis))?globalThis.regeneratorRuntime=t:Function("r","regeneratorRuntime = r")(t)}}(P);var O=P.exports;function R(e,t,n){return R=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var i=new(Function.bind.apply(e,r));return n&&g(i,n.prototype),i},R.apply(null,arguments)}function N(e){var t="function"==typeof Map?new Map:void 0;return N=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return R(e,arguments,d(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),g(r,e)},N(e)}function D(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return L(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return L(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,s=!0,o=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return s=e.done,e},e:function(e){o=!0,a=e},f:function(){try{s||null==n.return||n.return()}finally{if(o)throw a}}}}function L(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function M(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function(){var n,r=d(e);if(t){var i=d(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return m(this,n)}}var U=function(e){for(var t=[],n=0,r=0;r<e.length;r++){var 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},F={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:function(e,t){if(!Array.isArray(e))throw Error("encodeByteArray takes an array as a parameter");this.init_();for(var n=t?this.byteToCharMapWebSafe_:this.byteToCharMap_,r=[],i=0;i<e.length;i+=3){var a=e[i],s=i+1<e.length,o=s?e[i+1]:0,u=i+2<e.length,c=u?e[i+2]:0,l=a>>2,h=(3&a)<<4|o>>4,f=(15&o)<<2|c>>6,d=63&c;u||(d=64,s||(f=64)),r.push(n[l],n[h],n[f],n[d])}return r.join("")},encodeString:function(e,t){return this.HAS_NATIVE_SUPPORT&&!t?btoa(e):this.encodeByteArray(U(e),t)},decodeString:function(e,t){return this.HAS_NATIVE_SUPPORT&&!t?atob(e):function(e){for(var t=[],n=0,r=0;n<e.length;){var i=e[n++];if(i<128)t[r++]=String.fromCharCode(i);else if(i>191&&i<224){var a=e[n++];t[r++]=String.fromCharCode((31&i)<<6|63&a)}else if(i>239&&i<365){var s=((7&i)<<18|(63&e[n++])<<12|(63&e[n++])<<6|63&e[n++])-65536;t[r++]=String.fromCharCode(55296+(s>>10)),t[r++]=String.fromCharCode(56320+(1023&s))}else{var o=e[n++],u=e[n++];
2t[r++]=String.fromCharCode((15&i)<<12|(63&o)<<6|63&u)}}return t.join("")}(this.decodeStringToByteArray(e,t))},decodeStringToByteArray:function(e,t){this.init_();for(var n=t?this.charToByteMapWebSafe_:this.charToByteMap_,r=[],i=0;i<e.length;){var a=n[e.charAt(i++)],s=i<e.length?n[e.charAt(i)]:0,o=++i<e.length?n[e.charAt(i)]:64,u=++i<e.length?n[e.charAt(i)]:64;if(++i,null==a||null==s||null==o||null==u)throw new j;var c=a<<2|s>>4;if(r.push(c),64!==o){var l=s<<4&240|o>>2;if(r.push(l),64!==u){var h=o<<6&192|u;r.push(h)}}}return r},init_:function(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(var 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)}}},j=function(e){y(n,e);var t=M(n);function n(){var e;return I(this,n),(e=t.apply(this,arguments)).name="DecodeBase64StringError",e}return T(n)}(N(Error)),V=function(e){return function(e){var t=U(e);return F.encodeByteArray(t,!0)}(e).replace(/\./g,"")},B=function(e){try{return F.decodeString(e,!0)}catch(t){console.error("base64Decode failed: ",t)}return null};function q(){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.")}var z=function(){try{return q().__FIREBASE_DEFAULTS__||function(){if("undefined"!=typeof process){var e={}.__FIREBASE_DEFAULTS__;return e?JSON.parse(e):void 0}}()||function(){if("undefined"!=typeof document){var e;try{e=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch(n){return}var t=e&&B(e[1]);return t&&JSON.parse(t)}}()}catch(e){return void console.info("Unable to get __FIREBASE_DEFAULTS__ due to: ".concat(e))}},H=function(){var e;return null===(e=z())||void 0===e?void 0:e.config},K=function(e){var t;return null===(t=z())||void 0===t?void 0:t["_".concat(e)]},G=function(){function e(){var t=this;I(this,e),this.reject=function(){},this.resolve=function(){},this.promise=new Promise(function(e,n){t.resolve=e,t.reject=n})}return T(e,[{key:"wrapCallback",value:function(e){var t=this;return function(n,r){n?t.reject(n):t.resolve(r),"function"==typeof e&&(t.promise.catch(function(){}),1===e.length?e(n):e(n,r))}}}]),e}();function W(){return"undefined"!=typeof navigator&&"string"==typeof navigator.userAgent?navigator.userAgent:""}function Q(){return!function(){var e,t=null===(e=z())||void 0===e?void 0:e.forceEnvironment;if("node"===t)return!0;if("browser"===t)return!1;try{return"[object process]"===Object.prototype.toString.call(n.g.process)}catch(r){return!1}}()&&!!navigator.userAgent&&navigator.userAgent.includes("Safari")&&!navigator.userAgent.includes("Chrome")}function Y(){try{return"object"===("undefined"==typeof indexedDB?"undefined":l(indexedDB))}catch(e){return!1}}function X(){return new Promise(function(e,t){try{var n=!0,r="validate-browser-context-for-indexeddb-analytics-module",i=self.indexedDB.open(r);i.onsuccess=function(){i.result.close(),n||self.indexedDB.deleteDatabase(r),e(!0)},i.onupgradeneeded=function(){n=!1},i.onerror=function(){var e;t((null===(e=i.error)||void 0===e?void 0:e.message)||"")}}catch(a){t(a)}})}var J=function(e){y(n,e);var t=M(n);function n(e,r,i){var a;return I(this,n),(a=t.call(this,r)).code=e,a.customData=i,a.name="FirebaseError",Object.setPrototypeOf(v(a),n.prototype),Error.captureStackTrace&&Error.captureStackTrace(v(a),$.prototype.create),a}return T(n)}(N(Error)),$=function(){function e(t,n,r){I(this,e),this.service=t,this.serviceName=n,this.errors=r}return T(e,[{key:"create",value:function(e){var t=(arguments.length<=1?void 0:arguments[1])||{},n="".concat(this.service,"/").concat(e),r=this.errors[e],i=r?function(e,t){return e.replace(Z,function(e,n){var r=t[n];return null!=r?String(r):"<".concat(n,"?>")})}(r,t):"Error",a="".concat(this.serviceName,": ").concat(i," (").concat(n,").");
2return new J(n,a,t)}}]),e}();var Z=/\{\$([^}]+)}/g;function ee(e){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}function te(e,t){if(e===t)return!0;for(var n=Object.keys(e),r=Object.keys(t),i=0,a=n;i<a.length;i++){var s=a[i];if(!r.includes(s))return!1;var o=e[s],u=t[s];if(ne(o)&&ne(u)){if(!te(o,u))return!1}else if(o!==u)return!1}for(var c=0,l=r;c<l.length;c++){var h=l[c];if(!n.includes(h))return!1}return!0}function ne(e){return null!==e&&"object"===l(e)}function re(e){for(var t=[],n=function(){var e=b(i[r],2),n=e[0],a=e[1];Array.isArray(a)?a.forEach(function(e){t.push(encodeURIComponent(n)+"="+encodeURIComponent(e))}):t.push(encodeURIComponent(n)+"="+encodeURIComponent(a))},r=0,i=Object.entries(e);r<i.length;r++)n();return t.length?"&"+t.join("&"):""}function ie(e){var t={};return e.replace(/^\?/,"").split("&").forEach(function(e){if(e){var n=b(e.split("="),2),r=n[0],i=n[1];t[decodeURIComponent(r)]=decodeURIComponent(i)}}),t}function ae(e){var t=e.indexOf("?");if(!t)return"";var n=e.indexOf("#",t);return e.substring(t,n>0?n:void 0)}var se=function(){function e(t,n){var r=this;I(this,e),this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=n,this.task.then(function(){t(r)}).catch(function(e){r.error(e)})}return T(e,[{key:"next",value:function(e){this.forEachObserver(function(t){t.next(e)})}},{key:"error",value:function(e){this.forEachObserver(function(t){t.error(e)}),this.close(e)}},{key:"complete",value:function(){this.forEachObserver(function(e){e.complete()}),this.close()}},{key:"subscribe",value:function(e,t,n){var r,i=this;if(void 0===e&&void 0===t&&void 0===n)throw new Error("Missing Observer.");void 0===(r=function(e,t){if("object"!==l(e)||null===e)return!1;var n,r=D(t);try{for(r.s();!(n=r.n()).done;){var i=n.value;if(i in e&&"function"==typeof e[i])return!0}}catch(a){r.e(a)}finally{r.f()}return!1}(e,["next","error","complete"])?e:{next:e,error:t,complete:n}).next&&(r.next=oe),void 0===r.error&&(r.error=oe),void 0===r.complete&&(r.complete=oe);var a=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(function(){try{i.finalError?r.error(i.finalError):r.complete()}catch(e){}}),this.observers.push(r),a}},{key:"unsubscribeOne",value:function(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))}},{key:"forEachObserver",value:function(e){if(!this.finalized)for(var t=0;t<this.observers.length;t++)this.sendOne(t,e)}},{key:"sendOne",value:function(e,t){var n=this;this.task.then(function(){if(void 0!==n.observers&&void 0!==n.observers[e])try{t(n.observers[e])}catch(r){"undefined"!=typeof console&&console.error&&console.error(r)}})}},{key:"close",value:function(e){var t=this;this.finalized||(this.finalized=!0,void 0!==e&&(this.finalError=e),this.task.then(function(){t.observers=void 0,t.onNoObservers=void 0}))}}]),e}();function oe(){}var ue=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})};function ce(e){return e&&e._delegate?e._delegate:e}function le(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return he(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return he(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,s=!0,o=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return s=e.done,e},e:function(e){o=!0,a=e}
2,f:function(){try{s||null==n.return||n.return()}finally{if(o)throw a}}}}function he(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var fe=function(){function e(t,n,r){I(this,e),this.name=t,this.instanceFactory=n,this.type=r,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}return T(e,[{key:"setInstantiationMode",value:function(e){return this.instantiationMode=e,this}},{key:"setMultipleInstances",value:function(e){return this.multipleInstances=e,this}},{key:"setServiceProps",value:function(e){return this.serviceProps=e,this}},{key:"setInstanceCreatedCallback",value:function(e){return this.onInstanceCreated=e,this}}]),e}(),de="[DEFAULT]",pe=function(){function e(t,n){I(this,e),this.name=t,this.container=n,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}var t;return T(e,[{key:"get",value:function(e){var t=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(t)){var n=new G;if(this.instancesDeferred.set(t,n),this.isInitialized(t)||this.shouldAutoInitialize())try{var r=this.getOrInitializeService({instanceIdentifier:t});r&&n.resolve(r)}catch(i){}}return this.instancesDeferred.get(t).promise}},{key:"getImmediate",value:function(e){var t,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 ".concat(this.name," is not available"))}try{return this.getOrInitializeService({instanceIdentifier:n})}catch(i){if(r)return null;throw i}}},{key:"getComponent",value:function(){return this.component}},{key:"setComponent",value:function(e){if(e.name!==this.name)throw Error("Mismatching Component ".concat(e.name," for Provider ").concat(this.name,"."));if(this.component)throw Error("Component for ".concat(this.name," has already been provided"));if(this.component=e,this.shouldAutoInitialize()){if(function(e){return"EAGER"===e.instantiationMode}(e))try{this.getOrInitializeService({instanceIdentifier:de})}catch(u){}var t,n=le(this.instancesDeferred.entries());try{for(n.s();!(t=n.n()).done;){var r=b(t.value,2),i=r[0],a=r[1],s=this.normalizeInstanceIdentifier(i);try{var o=this.getOrInitializeService({instanceIdentifier:s});a.resolve(o)}catch(u){}}}catch(c){n.e(c)}finally{n.f()}}}},{key:"clearInstance",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:de;this.instancesDeferred.delete(e),this.instancesOptions.delete(e),this.instances.delete(e)}},{key:"delete",value:(t=E(O.mark(function e(){var t;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=Array.from(this.instances.values()),e.next=3,Promise.all([].concat(x(t.filter(function(e){return"INTERNAL"in e}).map(function(e){return e.INTERNAL.delete()})),x(t.filter(function(e){return"_delete"in e}).map(function(e){return e._delete()}))));case 3:case"end":return e.stop()}},e,this)})),function(){return t.apply(this,arguments)})},{key:"isComponentSet",value:function(){return null!=this.component}},{key:"isInitialized",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:de;return this.instances.has(e)}},{key:"getOptions",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:de;return this.instancesOptions.get(e)||{}}},{key:"initialize",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.options,n=void 0===t?{}:t,r=this.normalizeInstanceIdentifier(e.instanceIdentifier);if(this.isInitialized(r))throw Error("".concat(this.name,"(").concat(r,") has already been initialized"));if(!this.isComponentSet())throw Error("Component ".concat(this.name," has not been registered yet"));var i,a=this.getOrInitializeService({instanceIdentifier:r,options:n}),s=le(this.instancesDeferred.entries());try{for(s.s();!(i=s.n()).done;){var o=b(i.value,2),u=o[0],c=o[1];r===this.normalizeInstanceIdentifier(u)&&c.resolve(a)}}catch(l){s.e(l)}finally{s.f()}return a}},{key:"onInit",value:function(e,t){var n,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);var a=this.instances.get(r);return a&&e(a,r),function(){i.delete(e)}}},{key:"invokeOnInitCallbacks",value:function(e,t){var n=this.onInitCallbacks.get(t);if(n){var r,i=le(n);try{for(i.s();!(r=i.n()).done;){var a=r.value;try{a(e,t)}catch(s){}}}catch(o){i.e(o)}finally{i.f()}}}},{key:"getOrInitializeService",value:function(e){var t,n=e.instanceIdentifier,r=e.options,i=void 0===r?{}:r,a=this.instances.get(n);if(!a&&this.component&&(a=this.component.instanceFactory(this.container,{instanceIdentifier:(t=n,t===de?void 0:t),options:i}),this.instances.set(n,a),this.instancesOptions.set(n,i),this.invokeOnInitCallbacks(a,n),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,n,a)}catch(s){}return a||null}},{key:"normalizeInstanceIdentifier",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:de;return this.component?this.component.multipleInstances?e:de:e}},{key:"shouldAutoInitialize",value:function(){return!!this.component&&"EXPLICIT"!==this.component.instantiationMode}}]),e}();var ve,ge,ye=function(){function e(t){I(this,e),this.name=t,this.providers=new Map}return T(e,[{key:"addComponent",value:function(e){var t=this.getProvider(e.name);if(t.isComponentSet())throw new Error("Component ".concat(e.name," has already been registered with ").concat(this.name));t.setComponent(e)}},{key:"addOrOverwriteComponent",value:function(e){this.getProvider(e.name).isComponentSet()&&this.providers.delete(e.name),this.addComponent(e)}},{key:"getProvider",value:function(e){if(this.providers.has(e))return this.providers.get(e);var t=new pe(e,this);return this.providers.set(e,t),t}},{key:"getProviders",value:function(){return Array.from(this.providers.values())}}]),e}();!function(e){e[e.DEBUG=0]="DEBUG",e[e.VERBOSE=1]="VERBOSE",e[e.INFO=2]="INFO",e[e.WARN=3]="WARN",e[e.E
2RROR=4]="ERROR",e[e.SILENT=5]="SILENT"}(ge||(ge={}));var me,ke,we={debug:ge.DEBUG,verbose:ge.VERBOSE,info:ge.INFO,warn:ge.WARN,error:ge.ERROR,silent:ge.SILENT},be=ge.INFO,_e=(A(ve={},ge.DEBUG,"log"),A(ve,ge.VERBOSE,"log"),A(ve,ge.INFO,"info"),A(ve,ge.WARN,"warn"),A(ve,ge.ERROR,"error"),ve),Ee=function(e,t){if(!(t<e.logLevel)){var n=(new Date).toISOString(),r=_e[t];if(!r)throw new Error("Attempted to log a message with an invalid logType (value: ".concat(t,")"));for(var i,a=arguments.length,s=new Array(a>2?a-2:0),o=2;o<a;o++)s[o-2]=arguments[o];(i=console)[r].apply(i,["[".concat(n,"] ").concat(e.name,":")].concat(s))}},Ie=function(){function e(t){I(this,e),this.name=t,this._logLevel=be,this._logHandler=Ee,this._userLogHandler=null}return T(e,[{key:"logLevel",get:function(){return this._logLevel},set:function(e){if(!(e in ge))throw new TypeError('Invalid value "'.concat(e,'" assigned to `logLevel`'));this._logLevel=e}},{key:"setLogLevel",value:function(e){this._logLevel="string"==typeof e?we[e]:e}},{key:"logHandler",get:function(){return this._logHandler},set:function(e){if("function"!=typeof e)throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=e}},{key:"userLogHandler",get:function(){return this._userLogHandler},set:function(e){this._userLogHandler=e}},{key:"debug",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];this._userLogHandler&&this._userLogHandler.apply(this,[this,ge.DEBUG].concat(t)),this._logHandler.apply(this,[this,ge.DEBUG].concat(t))}},{key:"log",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];this._userLogHandler&&this._userLogHandler.apply(this,[this,ge.VERBOSE].concat(t)),this._logHandler.apply(this,[this,ge.VERBOSE].concat(t))}},{key:"info",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];this._userLogHandler&&this._userLogHandler.apply(this,[this,ge.INFO].concat(t)),this._logHandler.apply(this,[this,ge.INFO].concat(t))}},{key:"warn",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];this._userLogHandler&&this._userLogHandler.apply(this,[this,ge.WARN].concat(t)),this._logHandler.apply(this,[this,ge.WARN].concat(t))}},{key:"error",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];this._userLogHandler&&this._userLogHandler.apply(this,[this,ge.ERROR].concat(t)),this._logHandler.apply(this,[this,ge.ERROR].concat(t))}}]),e}();var Se=new WeakMap,Te=new WeakMap,xe=new WeakMap,Ae=new WeakMap,Ce=new WeakMap;var Pe={get:function(e,t,n){if(e instanceof IDBTransaction){if("done"===t)return Te.get(e);if("objectStoreNames"===t)return e.objectStoreNames||xe.get(e);if("store"===t)return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return Ne(e[t])},set:function(e,t,n){return e[t]=n,!0},has:function(e,t){return e instanceof IDBTransaction&&("done"===t||"store"===t)||t in e}};function Oe(e){return e!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(ke||(ke=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(e)?function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return e.apply(De(this),n),Ne(Se.get(this))}:function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return Ne(e.apply(De(this),n))}:function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];var a=e.call.apply(e,[De(this),t].concat(r));return xe.set(a,t.sort?t.sort():[t]),Ne(a)}}function Re(e){return"function"==typeof e?Oe(e):(e instanceof IDBTransaction&&function(e){if(!Te.has(e)){var t=new Promise(function(t,n){var r=function(){e.removeEventListener("complete",i),e.removeEventListener("error",a),e.removeEventListener("abort",a)},i=function(){t(),r()},a=function(){n(e.error||new DOMException("AbortError","AbortError")),r()};e.addEventListener("complete",i),e.addEventListener("error",a),e.addEventListener("abort",a)});Te.set(e,t)}}(e),t=e,(me||(me=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])).some(function(e){return t instanceof e})?new Proxy(e,Pe):e);var t}function Ne(e){if(e instanceof IDBRequest)return t=e,(n=new Promise(function(e,n){var r=function(){t.removeEventListener("success",i),t.removeEventListener("error",a)},i=function(){e(Ne(t.result)),r()},a=function(){n(t.error),r()};t.addEventListener("success",i),t.addEventListener("error",a)})).then(function(e){e instanceof IDBCursor&&Se.set(e,t)}).catch(function(){}),Ce.set(n,t),n;var t,n;if(Ae.has(e))return Ae.get(e);var r=Re(e);return r!==e&&(Ae.set(e,r),Ce.set(r,e)),r}var De=function(e){return Ce.get(e)};function Le(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 Me(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};
2t%2?Le(Object(n),!0).forEach(function(t){A(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Le(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var Ue,Fe,je=["get","getKey","getAll","getAllKeys","count"],Ve=["put","add","delete","clear"],Be=new Map;function qe(e,t){if(e instanceof IDBDatabase&&!(t in e)&&"string"==typeof t){if(Be.get(t))return Be.get(t);var n=t.replace(/FromIndex$/,""),r=t!==n,i=Ve.includes(n);if(n in(r?IDBIndex:IDBObjectStore).prototype&&(i||je.includes(n))){var a=function(){var e=E(O.mark(function e(t){var a,s,o,u,c,l,h=arguments;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:for(s=this.transaction(t,i?"readwrite":"readonly"),o=s.store,u=h.length,c=new Array(u>1?u-1:0),l=1;l<u;l++)c[l-1]=h[l];return r&&(o=o.index(c.shift())),e.next=6,Promise.all([(a=o)[n].apply(a,c),i&&s.done]);case 6:return e.abrupt("return",e.sent[0]);case 7:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}();return Be.set(t,a),a}}}function ze(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return He(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return He(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,s=!0,o=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return s=e.done,e},e:function(e){o=!0,a=e},f:function(){try{s||null==n.return||n.return()}finally{if(o)throw a}}}}function He(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}Pe=function(e){return Me(Me({},e),{},{get:function(t,n,r){return qe(t,n)||e.get(t,n,r)},has:function(t,n){return!!qe(t,n)||e.has(t,n)}})}(Pe);var Ke=function(){function e(t){I(this,e),this.container=t}return T(e,[{key:"getPlatformInfoString",value:function(){return this.container.getProviders().map(function(e){if(function(e){var t=e.getComponent();return"VERSION"===(null==t?void 0:t.type)}(e)){var t=e.getImmediate();return"".concat(t.library,"/").concat(t.version)}return null}).filter(function(e){return e}).join(" ")}}]),e}();var Ge="@firebase/app",We="0.10.5",Qe=new Ie("@firebase/app"),Ye="[DEFAULT]",Xe=(A(Ue={},Ge,"fire-core"),A(Ue,"@firebase/app-compat","fire-core-compat"),A(Ue,"@firebase/analytics","fire-analytics"),A(Ue,"@firebase/analytics-compat","fire-analytics-compat"),A(Ue,"@firebase/app-check","fire-app-check"),A(Ue,"@firebase/app-check-compat","fire-app-check-compat"),A(Ue,"@firebase/auth","fire-auth"),A(Ue,"@firebase/auth-compat","fire-auth-compat"),A(Ue,"@firebase/database","fire-rtdb"),A(Ue,"@firebase/database-compat","fire-rtdb-compat"),A(Ue,"@firebase/functions","fire-fn"),A(Ue,"@firebase/functions-compat","fire-fn-compat"),A(Ue,"@firebase/installations","fire-iid"),A(Ue,"@firebase/installations-compat","fire-iid-compat"),A(Ue,"@firebase/messaging","fire-fcm"),A(Ue,"@firebase/messaging-compat","fire-fcm-compat"),A(Ue,"@firebase/performance","fire-perf"),A(Ue,"@firebase/performance-compat","fire-perf-compat"),A(Ue,"@firebase/remote-config","fire-rc"),A(Ue,"@firebase/remote-config-compat","fire-rc-compat"),A(Ue,"@firebase/storage","fire-gcs"),A(Ue,"@firebase/storage-compat","fire-gcs-compat"),A(Ue,"@firebase/firestore","fire-fst"),A(Ue,"@firebase/firestore-compat","fire-fst-compat"),A(Ue,"@firebase/vertexai-preview","fire-vertex"),A(Ue,"fire-js","fire-js"),A(Ue,"firebase","fire-js-all"),Ue),Je=new Map,$e=new Map,Ze=new Map;function et(e,t){try{e.container.addComponent(t)}catch(n){Qe.debug("Component ".concat(t.name," failed to register with FirebaseApp ").concat(e.name),n)}}function tt(e){var t=e.name;if(Ze.has(t))return Qe.debug("There were multiple attempts to register component ".concat(t,".")),!1;Ze.set(t,e);var n,r=ze(Je.values());try{for(r.s();!(n=r.n()).done;){et(n.value,e)}}catch(s){r.e(s)}finally{r.f()}var i,a=ze($e.values());try{for(a.s();!(i=a.n()).done;){et(i.value,e)}}catch(s){a.e(s)}finally{a.f()}return!0}function nt(e,t){var n=e.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),e.container.getProvider(t)}function rt(e){return void 0!==e.settings}var it=(A(Fe={},"no-app","No Firebase App '{$appName}' has been created - call initializeApp() first"),A(Fe,"bad-app-name","Illegal App name: '{$appName}'"),A(Fe,"duplicate-app","Firebase App named '{$appName}' already exists with different options or config"),A(Fe,"app-deleted","Firebase App named '{$appName}' already deleted"),A(Fe,"server-app-deleted","Firebase Server App has been deleted"),A(Fe,"no-options","Need to provide options, when not being deployed to hosting via source."),A(Fe,"invali
2d-app-argument","firebase.{$appName}() takes either no argument or a Firebase App instance."),A(Fe,"invalid-log-argument","First argument to `onLog` must be null or a function."),A(Fe,"idb-open","Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}."),A(Fe,"idb-get","Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}."),A(Fe,"idb-set","Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}."),A(Fe,"idb-delete","Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}."),A(Fe,"finalization-registry-not-supported","FirebaseServerApp deleteOnDeref field defined but the JS runtime does not support FinalizationRegistry."),A(Fe,"invalid-server-app-environment","FirebaseServerApp is not for use in browser environments."),Fe),at=new $("app","Firebase",it),st=function(){function e(t,n,r){var i=this;I(this,e),this._isDeleted=!1,this._options=Object.assign({},t),this._config=Object.assign({},n),this._name=n.name,this._automaticDataCollectionEnabled=n.automaticDataCollectionEnabled,this._container=r,this.container.addComponent(new fe("app",function(){return i},"PUBLIC"))}return T(e,[{key:"automaticDataCollectionEnabled",get:function(){return this.checkDestroyed(),this._automaticDataCollectionEnabled},set:function(e){this.checkDestroyed(),this._automaticDataCollectionEnabled=e}},{key:"name",get:function(){return this.checkDestroyed(),this._name}},{key:"options",get:function(){return this.checkDestroyed(),this._options}},{key:"config",get:function(){return this.checkDestroyed(),this._config}},{key:"container",get:function(){return this._container}},{key:"isDeleted",get:function(){return this._isDeleted},set:function(e){this._isDeleted=e}},{key:"checkDestroyed",value:function(){if(this.isDeleted)throw at.create("app-deleted",{appName:this._name})}}]),e}(),ot="10.12.2";function ut(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e;"object"!==l(t)&&(t={name:t});var r=Object.assign({name:Ye,automaticDataCollectionEnabled:!1},t),i=r.name;if("string"!=typeof i||!i)throw at.create("bad-app-name",{appName:String(i)});if(n||(n=H()),!n)throw at.create("no-options");var a=Je.get(i);if(a){if(te(n,a.options)&&te(r,a.config))return a;throw at.create("duplicate-app",{appName:i})}var s,o=new ye(i),u=ze(Ze.values());try{for(u.s();!(s=u.n()).done;){var c=s.value;o.addComponent(c)}}catch(f){u.e(f)}finally{u.f()}var h=new st(n,r,o);return Je.set(i,h),h}function ct(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Ye,t=Je.get(e);if(!t&&e===Ye&&H())return ut();if(!t)throw at.create("no-app",{appName:e});return t}function lt(e,t,n){var r,i=null!==(r=Xe[e])&&void 0!==r?r:e;n&&(i+="-".concat(n));var a=i.match(/\s|\//),s=t.match(/\s|\//);if(a||s){var o=['Unable to register library "'.concat(i,'" with version "').concat(t,'":')];return a&&o.push('library name "'.concat(i,'" contains illegal characters (whitespace or "/")')),a&&s&&o.push("and"),s&&o.push('version name "'.concat(t,'" contains illegal characters (whitespace or "/")')),void Qe.warn(o.join(" "))}tt(new fe("".concat(i,"-version"),function(){return{library:i,version:t}},"VERSION"))}var ht="firebase-heartbeat-store",ft=null;function dt(){return ft||(ft=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.blocked,i=n.upgrade,a=n.blocking,s=n.terminated,o=indexedDB.open(e,t),u=Ne(o);return i&&o.addEventListener("upgradeneeded",function(e){i(Ne(o.result),e.oldVersion,e.newVersion,Ne(o.transaction),e)}),r&&o.addEventListener("blocked",function(e){return r(e.oldVersion,e.newVersion,e)}),u.then(function(e){s&&e.addEventListener("close",function(){return s()}),a&&e.addEventListener("versionchange",function(e){return a(e.oldVersion,e.newVersion,e)})}).catch(function(){}),u}("firebase-heartbeat-database",1,{upgrade:function(e,t){if(0===t)try{e.createObjectStore(ht)}catch(n){console.warn(n)}}}).catch(function(e){throw at.create("idb-open",{originalErrorMessage:e.message})})),ft}function pt(e){return vt.apply(this,arguments)}function vt(){return(vt=E(O.mark(function e(t){var n,r,i,a;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,dt();case 3:return n=e.sent,r=n.transaction(ht),e.next=7,r.objectStore(ht).get(mt(t));case 7:return i=e.sent,e.next=10,r.done;case 10:return e.abrupt("return",i);case 13:e.prev=13,e.t0=e.catch(0),e.t0 instanceof J?Qe.warn(e.t0.message):(a=at.create("idb-get",{originalErrorMessage:null===e.t0||void 0===e.t0?void 0:e.t0.message}),Qe.warn(a.message));case 16:case"end":return e.stop()}},e,null,[[0,13]])}))).apply(this,arguments)}function gt(e,t){return yt.apply(this,arguments)}function yt(){return(yt=E(O.mark(function e(t,n){var r,i,a,s;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,dt();case 3:return r=e.sent,i=r.transaction(ht,"readwrite"),a=i.objectStore(ht),e.next=8,a.put(n,mt(t));case 8:return e.next=10,i.done;case 10:e.next=15;break;case 12:e.prev=12,e.t0=e.catch(0),e.t0 instanceof J?Qe.warn(e.t0.message):(s=at.create("idb-set",{originalErrorMessage:null===e.t0||void 0===e.t0?void 0:e.t0.message}),Qe.warn(s.message));case 15:case"end":return e.stop()}},e,null,[[0,12]])}))).apply(this,arguments)}function mt(e){return"".concat(e.name,"!").concat(e.options.appId)}var kt=function(){function e(t){var n=this;I(this,e),this.container=t,this._heartbeatsCache=null;var r=this.container.getProvider("app").getImmediate();this._storage=new It(r),this._heartbeatsCachePromise=this._storage.read().then(function(e){return n._heartbeatsCache=e,e})}var t,n;return T(e,[{key:"triggerHeartbeat",value:(n=E(O.mark(function e(){var t,n,r,i,a;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=this.container.getProvider("platform-logger").getImmediate(),i=r.getPlatformInfoString(),a=wt(),null!=(null===(t=this._heartbeatsCache)||void 0===t?void 0:t.heartbeats)){e.next=9;break}return e.next=6,this._heartbeatsCachePromise;case 6:if(this._heartbeatsCache=e.sent,null!=(null===(n=this._heartbeatsCache)||void 0===n?void 0:n.heartbeats)){e.next=9;break}return e.abrupt("return");case 9:if(this._heartbeatsCache.lastSentHeartbeatDate!==a&&!this._heartbeatsCache.heartbeats.some(function(e){return e.date===a})){e.next=13;break}return e.abrupt("return");case 13:this._heartbeatsCache.heartbeats.push({date:a,agent:i});case 14:return this._heartbeatsCache.heartbeats=this._heartbeatsCache.heartbeats.filter(function(e){var t=new Date(e.date).valueOf();return Date.now()-t<=2592e6}),e.abrupt("return",this._storage.overwrite(this._heartbeatsCache));case 16:case"end":return e.stop()}},e,this)})),function(){return n.apply(this,arguments)})},{key:"getHeartbeatsHeader",value:(t=E(O.mark(function e(){var t,n,r,i,a,s;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(null!==this._heartbeatsCache){e.next=3;break}return e.next=3,this._heartbeatsCachePromise;case 3:if(null!=(null===(t=this._heartbeatsCache)||void 0===t?void 0:t.heartbeats)&&0!==this._heartbeatsCache.heartbeats.length){e.next=5;break}return e.abrupt("return","");case 5:if(n=wt(),r=bt(this._heartbeatsCache.heartbeats),i=r.heartbeatsToSend,a=r.unsentEntries,s=V(JSON.stringify({version:2,heartbeats:i})),this._heartbeatsCache.lastSentHeartbeatDate=n,!(a.length>0)){e.next=15;break}return this._heartbeatsCache.heartbeats=a,e.next=13,this._storage.overwrite(this._heartbeatsCache);case 13:e.next=17;break;case 15:this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache);case 17:return e.abrupt("return",s);case 18:case"end":return e.stop()}},e,this)})),function(){return t.apply(this,arguments)})}]),e}();function wt(){return(new Date).toISOString().substring(0,10)}function bt(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1024,r=[],i=e.slice(),a=ze(e);try{var s=function(){var e=t.value,a=r.find(function(t){return t.agent===e.agent});if(a){if(a.dates.push(e.date),St(r)>n)return a.dates.pop(),"break"}else if(r.push({agent:e.agent,dates:[e.date]}),St(r)>n)return r.pop(),"break";i=i.slice(1)};for(a.s();!(t=a.n()).done;){if("break"===s())break}}catch(o){a.e(o)}finally{a.f()}return{heartbeatsToSend:r,unsentEntries:i}}var _t,Et,It=function(){function e(t){I(this,e),this.app=t,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}var t,n,r;return T(e,[{key:"runIndexedDBEnvironmentCheck",value:(r=E(O.mark(function e(){return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(Y()){e.next=4;break}return e.abrupt("return",!1);case 4:return e.abrupt("return",X().then(function(){return!0}).catch(function(){return!1}));case 5:case"end":return e.stop()}},e)})),function(){return r.apply(this,arguments)})},{key:"read",value:function(){var e=E(O.mark(function e(){var t;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._canUseIndexedDBPromise;case 2:if(e.sent){e.next=7;break}return e.abrupt("return",{heartbeats:[]});case 7:return e.next=9,pt(this.app);case 9:if(!(null==(t=e.sent)?void 0:t.heartbeats)){e.next=14;break}return e.abrupt("return",t);case 14:return e.abrupt("return",{heartbeats:[]});case 15:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()}
2,{key:"overwrite",value:(n=E(O.mark(function e(t){var n,r;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._canUseIndexedDBPromise;case 2:if(e.sent){e.next=7;break}return e.abrupt("return");case 7:return e.next=9,this.read();case 9:return r=e.sent,e.abrupt("return",gt(this.app,{lastSentHeartbeatDate:null!==(n=t.lastSentHeartbeatDate)&&void 0!==n?n:r.lastSentHeartbeatDate,heartbeats:t.heartbeats}));case 11:case"end":return e.stop()}},e,this)})),function(e){return n.apply(this,arguments)})},{key:"add",value:(t=E(O.mark(function e(t){var n,r;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._canUseIndexedDBPromise;case 2:if(e.sent){e.next=7;break}return e.abrupt("return");case 7:return e.next=9,this.read();case 9:return r=e.sent,e.abrupt("return",gt(this.app,{lastSentHeartbeatDate:null!==(n=t.lastSentHeartbeatDate)&&void 0!==n?n:r.lastSentHeartbeatDate,heartbeats:[].concat(x(r.heartbeats),x(t.heartbeats))}));case 11:case"end":return e.stop()}},e,this)})),function(e){return t.apply(this,arguments)})}]),e}();function St(e){return V(JSON.stringify({version:2,heartbeats:e})).length}function Tt(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function(){var n,r=d(e);if(t){var i=d(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return m(this,n)}}function xt(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return At(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return At(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,s=!0,o=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return s=e.done,e},e:function(e){o=!0,a=e},f:function(){try{s||null==n.return||n.return()}finally{if(o)throw a}}}}function At(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}_t="",tt(new fe("platform-logger",function(e){return new Ke(e)},"PRIVATE")),tt(new fe("heartbeat",function(e){return new kt(e)},"PRIVATE")),lt(Ge,We,_t),lt(Ge,We,"esm2017"),lt("fire-js","");var Ct="facebook.com",Pt="google.com",Ot="password";function Rt(){return A({}
2,"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.")}var Nt=Rt,Dt=new $("auth","Firebase",Rt()),Lt={ADMIN_ONLY_OPERATION:"auth/admin-restricted-operation",ARGUMENT_ERROR:"auth/argument-error",APP_NOT_AUTHORIZED:"auth/app-not-authorized",APP_NOT_INSTALLED:"auth/app-not-installed",CAPTCHA_CHECK_FAILED:"auth/captcha-check-failed",CODE_EXPIRED:"auth/code-expired",CORDOVA_NOT_READY:"auth/cordova-not-ready",CORS_UNSUPPORTED:"auth/cors-unsupported",CREDENTIAL_ALREADY_IN_USE:"auth/credential-already-in-use",CREDENTIAL_MISMATCH:"auth/custom-token-mismatch",CREDENTIAL_TOO_OLD_LOGIN_AGAIN:"auth/requires-recent-login",DEPENDENT_SDK_INIT_BEFORE_AUTH:"auth/dependent-sdk-initialized-before-auth",DYNAMIC_LINK_NOT_ACTIVATED:"auth/dynamic-link-not-activated",EMAIL_CHANGE_NEEDS_VERIFICATION:"auth/email-change-needs-verification",EMAIL_EXISTS:"auth/email-already-in-use",EMULATOR_CONFIG_FAILED:"auth/emulator-config-failed",EXPIRED_OOB_CODE:"auth/expired-action-code",EXPIRED_POPUP_REQUEST:"auth/cancelled-popup-request",INTERNAL_ERROR:"auth/internal-error",INVALID_API_KEY:"auth/invalid-api-key",INVALID_APP_CREDENTIAL:"auth/invalid-app-credential",INVALID_APP_ID:"auth/invalid-app-id",INVALID_AUTH:"auth/invalid-user-token",INVALID_AUTH_EVENT:"auth/invalid-auth-event",INVALID_CERT_HASH:"auth/invalid-cert-hash",INVALID_CODE:"auth/invalid-verification-code",INVALID_CONTINUE_URI:"auth/invalid-continue-uri",INVALID_CORDOVA_CONFIGURATION:"auth/invalid-cordova-configuration",INVALID_CUSTOM_TOKEN:"auth/invalid-custom-token",INVALID_DYNAMIC_LINK_DOMAIN:"auth/invalid-dynamic-link-domain",INVALID_EMAIL:"auth/invalid-email",INVALID_EMULATOR_SCHEME:"auth/invalid-emulator-scheme",INVALID_IDP_RESPONSE:"auth/invalid-credential",INVALID_LOGIN_CREDENTIALS:"auth/invalid-credential",INVALID_MESSAGE_PAYLOAD:"auth/invalid-message-payload",INVALID_MFA_SESSION:"auth/invalid-multi-factor-session",INVALID_OAUTH_CLIENT_ID:"auth/invalid-oauth-client-id",INVALID_OAUTH_PROVIDER:"auth/invalid-oauth-provider",INVALID_OOB_CODE:"auth/invalid-action-code",INVALID_ORIGIN:"auth/unauthorized-domain",INVALID_PASSWORD:"auth/wrong-password",INVALID_PERSISTENCE:"auth/invalid-persistence-type",INVALID_PHONE_NUMBER:"auth/invalid-phone-number",INVALID_PROVIDER_ID:"auth/invalid-provider-id",INVALID_RECIPIENT_EMAIL:"auth/invalid-recipient-email",INVALID_SENDER:"auth/invalid-sender",INVALID_SESSION_INFO:"auth/invalid-verification-id",INVALID_TENANT_ID:"auth/invalid-tenant-id",MFA_INFO_NOT_FOUND:"auth/multi-factor-info-not-found",MFA_REQUIRED:"auth/multi-factor-auth-required",MISSING_ANDROID_PACKAGE_NAME:"auth/missing-android-pkg-name",MISSING_APP_CREDENTIAL:"auth/missing-app-credential",MISSING_AUTH_DOMAIN:"auth/auth-domain-config-required",MISSING_CODE:"auth/missing-verification-code",MISSING_CONTINUE_URI:"auth/missing-continue-uri",MISSING_IFRAME_START:"auth/missing-iframe-start",MISSING_IOS_BUNDLE_ID:"auth/missing-ios-bundle-id",MISSING_OR_INVALID_
2NONCE:"auth/missing-or-invalid-nonce",MISSING_MFA_INFO:"auth/missing-multi-factor-info",MISSING_MFA_SESSION:"auth/missing-multi-factor-session",MISSING_PHONE_NUMBER:"auth/missing-phone-number",MISSING_SESSION_INFO:"auth/missing-verification-id",MODULE_DESTROYED:"auth/app-deleted",NEED_CONFIRMATION:"auth/account-exists-with-different-credential",NETWORK_REQUEST_FAILED:"auth/network-request-failed",NULL_USER:"auth/null-user",NO_AUTH_EVENT:"auth/no-auth-event",NO_SUCH_PROVIDER:"auth/no-such-provider",OPERATION_NOT_ALLOWED:"auth/operation-not-allowed",OPERATION_NOT_SUPPORTED:"auth/operation-not-supported-in-this-environment",POPUP_BLOCKED:"auth/popup-blocked",POPUP_CLOSED_BY_USER:"auth/popup-closed-by-user",PROVIDER_ALREADY_LINKED:"auth/provider-already-linked",QUOTA_EXCEEDED:"auth/quota-exceeded",REDIRECT_CANCELLED_BY_USER:"auth/redirect-cancelled-by-user",REDIRECT_OPERATION_PENDING:"auth/redirect-operation-pending",REJECTED_CREDENTIAL:"auth/rejected-credential",SECOND_FACTOR_ALREADY_ENROLLED:"auth/second-factor-already-in-use",SECOND_FACTOR_LIMIT_EXCEEDED:"auth/maximum-second-factor-count-exceeded",TENANT_ID_MISMATCH:"auth/tenant-id-mismatch",TIMEOUT:"auth/timeout",TOKEN_EXPIRED:"auth/user-token-expired",TOO_MANY_ATTEMPTS_TRY_LATER:"auth/too-many-requests",UNAUTHORIZED_DOMAIN:"auth/unauthorized-continue-uri",UNSUPPORTED_FIRST_FACTOR:"auth/unsupported-first-factor",UNSUPPORTED_PERSISTENCE:"auth/unsupported-persistence-type",UNSUPPORTED_TENANT_OPERATION:"auth/unsupported-tenant-operation",UNVERIFIED_EMAIL:"auth/unverified-email",USER_CANCELLED:"auth/user-cancelled",USER_DELETED:"auth/user-not-found",USER_DISABLED:"auth/user-disabled",USER_MISMATCH:"auth/user-mismatch",USER_SIGNED_OUT:"auth/user-signed-out",WEAK_PASSWORD:"auth/weak-password",WEB_STORAGE_UNSUPPORTED:"auth/web-storage-unsupported",ALREADY_INITIALIZED:"auth/already-initialized",RECAPTCHA_NOT_ENABLED:"auth/recaptcha-not-enabled",MISSING_RECAPTCHA_TOKEN:"auth/missing-recaptcha-token",INVALID_RECAPTCHA_TOKEN:"auth/invalid-recaptcha-token",INVALID_RECAPTCHA_ACTION:"auth/invalid-recaptcha-action",MISSING_CLIENT_TYPE:"auth/missing-client-type",MISSING_RECAPTCHA_VERSION:"auth/missing-recaptcha-version",INVALID_RECAPTCHA_VERSION:"auth/invalid-recaptcha-version",INVALID_REQ_TYPE:"auth/invalid-req-type"},Mt=new Ie("@firebase/auth");function Ut(e){if(Mt.logLevel<=ge.WARN){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];Mt.warn.apply(Mt,["Auth (".concat(ot,"): ").concat(e)].concat(n))}}function Ft(e){if(Mt.logLevel<=ge.ERROR){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];Mt.error.apply(Mt,["Auth (".concat(ot,"): ").concat(e)].concat(n))}}function jt(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];throw Ht.apply(void 0,[e].concat(n))}function Vt(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return Ht.apply(void 0,[e].concat(n))}function Bt(e,t,n){var r=Object.assign(Object.assign({},Nt()),A({},t,n));return new $("auth","Firebase",r).create(t,{appName:e.name})}function qt(e){return Bt(e,"operation-not-supported-in-this-environment","Operations that alter the current user are not supported in conjunction with FirebaseServerApp")}function zt(e,t,n){if(!(t instanceof n))throw n.name!==t.constructor.name&&jt(e,"argument-error"),Bt(e,"argument-error","Type of ".concat(t.constructor.name," does not match expected instance.")+"Did you pass a reference from a different Auth SDK?")}function Ht(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];if("string"!=typeof e){var i,a=n[0],s=x(n.slice(1));return s[0]&&(s[0].appName=e.name),(i=e._errorFactory).create.apply(i,[a].concat(x(s)))}return Dt.create.apply(Dt,[e].concat(n))}function Kt(e,t){if(!e){for(var n=arguments.length,r=new Array(n>2?n-2:0),i=2;i<n;i++)r[i-2]=arguments[i];throw Ht.apply(void 0,[t].concat(r))}}function Gt(e){var t="INTERNAL ASSERTION FAILED: "+e;throw Ft(t),new Error(t)}function Wt(e,t){e||Gt(t)}function Qt(){var e;return"undefined"!=typeof self&&(null===(e=self.location)||void 0===e?void 0:e.href)||""}function Yt(){var e;return"undefined"!=typeof self&&(null===(e=self.location)||void 0===e?void 0:e.protocol)||null}function Xt(){return"undefined"==typeof navigator||!navigator||!("onLine"in navigator)||"boolean"!=typeof navigator.onLine||"http:"!==Yt()&&"https:"!==Yt()&&!function(){var e="object"===("undefined"==typeof chrome?"undefined":l(chrome))?chrome.runtime:"object"===("undefined"==typeof browser?"undefined":l(browser))?browser.runtime:void 0;return"object"===l(e)&&void 0!==e.id}()&&!("connection"in navigator)||navigator.onLine}var Jt=function(){function e(t,n){I(this,e),this.shortDelay=t,this.longDelay=n,Wt(n>
2t,"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(W())||"object"===("undefined"==typeof navigator?"undefined":l(navigator))&&"ReactNative"===navigator.product}return T(e,[{key:"get",value:function(){return Xt()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}}]),e}();function $t(e,t){Wt(e.emulator,"Emulator should always be set here");var n=e.emulator.url;return t?"".concat(n).concat(t.startsWith("/")?t.slice(1):t):n}var Zt=function(){function e(){I(this,e)}return T(e,null,[{key:"initialize",value:function(e,t,n){this.fetchImpl=e,t&&(this.headersImpl=t),n&&(this.responseImpl=n)}},{key:"fetch",value:function(e){function t(){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}(function(){return this.fetchImpl?this.fetchImpl:"undefined"!=typeof self&&"fetch"in self?self.fetch:"undefined"!=typeof globalThis&&globalThis.fetch?globalThis.fetch:"undefined"!=typeof fetch?fetch:void Gt("Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")})},{key:"headers",value:function(){return this.headersImpl?this.headersImpl:"undefined"!=typeof self&&"Headers"in self?self.Headers:"undefined"!=typeof globalThis&&globalThis.Headers?globalThis.Headers:"undefined"!=typeof Headers?Headers:void Gt("Could not find Headers implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}},{key:"response",value:function(){return this.responseImpl?this.responseImpl:"undefined"!=typeof self&&"Response"in self?self.Response:"undefined"!=typeof globalThis&&globalThis.Response?globalThis.Response:"undefined"!=typeof Response?Response:void Gt("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}}]),e}(),en=(A(Et={},"CREDENTIAL_MISMATCH","custom-token-mismatch"),A(Et,"MISSING_CUSTOM_TOKEN","internal-error"),A(Et,"INVALID_IDENTIFIER","invalid-email"),A(Et,"MISSING_CONTINUE_URI","internal-error"),A(Et,"INVALID_PASSWORD","wrong-password"),A(Et,"MISSING_PASSWORD","missing-password"),A(Et,"INVALID_LOGIN_CREDENTIALS","invalid-credential"),A(Et,"EMAIL_EXISTS","email-already-in-use"),A(Et,"PASSWORD_LOGIN_DISABLED","operation-not-allowed"),A(Et,"INVALID_IDP_RESPONSE","invalid-credential"),A(Et,"INVALID_PENDING_TOKEN","invalid-credential"),A(Et,"FEDERATED_USER_ID_ALREADY_LINKED","credential-already-in-use"),A(Et,"MISSING_REQ_TYPE","internal-error"),A(Et,"EMAIL_NOT_FOUND","user-not-found"),A(Et,"RESET_PASSWORD_EXCEED_LIMIT","too-many-requests"),A(Et,"EXPIRED_OOB_CODE","expired-action-code"),A(Et,"INVALID_OOB_CODE","invalid-action-code"),A(Et,"MISSING_OOB_CODE","internal-error"),A(Et,"CREDENTIAL_TOO_OLD_LOGIN_AGAIN","requires-recent-login"),A(Et,"INVALID_ID_TOKEN","invalid-user-token"),A(Et,"TOKEN_EXPIRED","user-token-expired"),A(Et,"USER_NOT_FOUND","user-token-expired"),A(Et,"TOO_MANY_ATTEMPTS_TRY_LATER","too-many-requests"),A(Et,"PASSWORD_DOES_NOT_MEET_REQUIREMENTS","password-does-not-meet-requirements"),A(Et,"INVALID_CODE","invalid-verification-code"),A(Et,"INVALID_SESSION_INFO","invalid-verification-id"),A(Et,"INVALID_TEMPORARY_PROOF","invalid-credential"),A(Et,"MISSING_SESSION_INFO","missing-verification-id"),A(Et,"SESSION_EXPIRED","code-expired"),A(Et,"MISSING_ANDROID_PACKAGE_NAME","missing-android-pkg-name"),A(Et,"UNAUTHORIZED_DOMAIN","unauthorized-continue-uri"),A(Et,"INVALID_OAUTH_CLIENT_ID","invalid-oauth-client-id"),A(Et,"ADMIN_ONLY_OPERATION","admin-restricted-operation"),A(Et,"INVALID_MFA_PENDING_CREDENTIAL","invalid-multi-factor-session"),A(Et,"MFA_ENROLLMENT_NOT_FOUND","multi-factor-info-not-found"),A(Et,"MISSING_MFA_ENROLLMENT_ID","missing-multi-factor-info"),A(Et,"MISSING_MFA_PENDING_CREDENTIAL","missing-multi-factor-session"),A(Et,"SECOND_FACTOR_EXISTS","second-factor-already-in-use"),A(Et,"SECOND_FACTOR_LIMIT_EXCEEDED","maximum-second-factor-count-exceeded"),A(Et,"BLOCKING_FUNCTION_ERROR_RESPONSE","internal-error"),A(Et,"RECAPTCHA_NOT_ENABLED","recaptcha-not-enabled"),A(Et,"MISSING_RECAPTCHA_TOKEN","missing-rec
2aptcha-token"),A(Et,"INVALID_RECAPTCHA_TOKEN","invalid-recaptcha-token"),A(Et,"INVALID_RECAPTCHA_ACTION","invalid-recaptcha-action"),A(Et,"MISSING_CLIENT_TYPE","missing-client-type"),A(Et,"MISSING_RECAPTCHA_VERSION","missing-recaptcha-version"),A(Et,"INVALID_RECAPTCHA_VERSION","invalid-recaptcha-version"),A(Et,"INVALID_REQ_TYPE","invalid-req-type"),Et),tn=new Jt(3e4,6e4);function nn(e,t){return e.tenantId&&!t.tenantId?Object.assign(Object.assign({},t),{tenantId:e.tenantId}):t}function rn(e,t,n,r){return an.apply(this,arguments)}function an(){return an=E(O.mark(function e(t,n,r,i){var a,s=arguments;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return a=s.length>4&&void 0!==s[4]?s[4]:{},e.abrupt("return",sn(t,a,E(O.mark(function e(){var a,s,o,u;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return a={},s={},i&&("GET"===n?s=i:a={body:JSON.stringify(i)}),o=re(Object.assign({key:t.config.apiKey},s)).slice(1),e.next=6,t._getAdditionalHeaders();case 6:return(u=e.sent)["Content-Type"]="application/json",t.languageCode&&(u["X-Firebase-Locale"]=t.languageCode),e.abrupt("return",Zt.fetch()(ln(t,t.config.apiHost,r,o),Object.assign({method:n,headers:u,referrerPolicy:"no-referrer"},a)));case 10:case"end":return e.stop()}},e)}))));case 2:case"end":return e.stop()}},e)})),an.apply(this,arguments)}function sn(e,t,n){return on.apply(this,arguments)}function on(){return(on=E(O.mark(function e(t,n,r){var i,a,s,o,u,c,l,h,f,d;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t._canInitEmulator=!1,i=Object.assign(Object.assign({},en),n),e.prev=2,a=new fn(t),e.next=6,Promise.race([r(),a.promise]);case 6:return s=e.sent,a.clearNetworkTimeout(),e.next=10,s.json();case 10:if(!("needConfirmation"in(o=e.sent))){e.next=13;break}throw dn(t,"account-exists-with-different-credential",o);case 13:if(!s.ok||"errorMessage"in o){e.next=17;break}return e.abrupt("return",o);case 17:if(u=s.ok?o.errorMessage:o.error.message,c=u.split(" : "),l=b(c,2),h=l[0],f=l[1],"FEDERATED_USER_ID_ALREADY_LINKED"!==h){e.next=23;break}throw dn(t,"credential-already-in-use",o);case 23:if("EMAIL_EXISTS"!==h){e.next=27;break}throw dn(t,"email-already-in-use",o);case 27:if("USER_DISABLED"!==h){e.next=29;break}throw dn(t,"user-disabled",o);case 29:if(d=i[h]||h.toLowerCase().replace(/[_\s]+/g,"-"),!f){e.next=34;break}throw Bt(t,d,f);case 34:jt(t,d);case 35:e.next=42;break;case 37:if(e.prev=37,e.t0=e.catch(2),!(e.t0 instanceof J)){e.next=41;break}throw e.t0;case 41:jt(t,"network-request-failed",{message:String(e.t0)});case 42:case"end":return e.stop()}},e,null,[[2,37]])}))).apply(this,arguments)}function un(e,t,n,r){return cn.apply(this,arguments)}function cn(){return cn=E(O.mark(function e(t,n,r,i){var a,s,o=arguments;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return a=o.length>4&&void 0!==o[4]?o[4]:{},e.next=3,rn(t,n,r,i,a);case 3:return"mfaPendingCredential"in(s=e.sent)&&jt(t,"multi-factor-auth-required",{_serverResponse:s}),e.abrupt("return",s);case 6:case"end":return e.stop()}},e)})),cn.apply(this,arguments)}function ln(e,t,n,r){var i="".concat(t).concat(n,"?").concat(r);return e.config.emulator?$t(e.config,i):"".concat(e.config.apiScheme,"://").concat(i)}function hn(e){switch(e){case"ENFORCE":return"ENFORCE";case"AUDIT":return"AUDIT";case"OFF":return"OFF";default:return"ENFORCEMENT_STATE_UNSPECIFIED"}}var fn=function(){function e(t){var n=this;I(this,e),this.auth=t,this.timer=null,this.promise=new Promise(function(e,t){n.timer=setTimeout(function(){return t(Vt(n.auth,"network-request-failed"))},tn.get())})}return T(e,[{key:"clearNetworkTimeout",value:function(){clearTimeout(this.timer)}}]),e}();function dn(e,t,n){var r={appName:e.name};n.email&&(r.email=n.email),n.phoneNumber&&(r.phoneNumber=n.phoneNumber);var i=Vt(e,t,r);return i.customData._tokenResponse=n,i}function pn(e){return void 0!==e&&void 0!==e.enterprise}var vn=function(){function e(t){if(I(this,e),this.siteKey="",this.recaptchaEnforcementState=[],void 0===t.recaptchaKey)throw new Error("recaptchaKey undefined");this.siteKey=t.recaptchaKey.split("/")[3],this.recaptchaEnforcementState=t.recaptchaEnforcementState}return T(e,[{key:"getProviderEnforcementState",value:function(e){if(!this.recaptchaEnforcementState||0===this.recaptchaEnforcementState.length)return null;var t,n=xt(this.recaptchaEnforcementState);try{for(n.s();!(t=n.n()).done;){var r=t.value;if(r.provider&&r.provider===e)return hn(r.enforcementState)}}catch(i){n.e(i)}finally{n.f()}return null}},{key:"isProviderEnabled",value:function(e){return"ENFORCE"===this.getProviderEnforcementState(e)||"AUDIT"===this.getProviderEnforcementState(e)}}]),e}();function gn(e,t){return yn.apply(this,arguments)}function yn(){return(yn=E(O.mark(function e(t,n){return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",rn(t,"GET","/v2/recaptchaConfig",nn(t,n)));case 1:case"end":return e.stop()}},e)}))).apply(this,arguments)}function mn(e,t){return kn.apply(this,arguments)}function kn(){return(kn=E(O.mark(function e(t,n){return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",rn(t,"POST","/v1/accounts:delete",n));case 1:case"end":return e.stop()}},e)}))).apply(this,arguments)}function wn(e,t){return bn.apply(this,arguments)}function bn(){return(bn=E(O.mark(function e(t,n){return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",rn(t,"POST","/v1/accounts:lookup",n));case 1:case"end":return e.stop()}},e)}))).apply(this,arguments)}function _n(e){if(e)try{var t=new Date(Number(e));if(!isNaN(t.getTime()))return t.toUTCString()}catch(n){}}function En(){return En=E(O.mark(function e(t){var n,r,i,a,s,o,u=arguments;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=u.length>1&&void 0!==u[1]&&u[1],r=ce(t),e.next=4,r.getIdToken(n);case 4:return i=e.sent,Kt((a=Sn(i))&&a.exp&&a.auth_time&&a.iat,r.auth,"internal-error"),s="object"===l(a.firebase)?a.firebase:void 0,o=null==s?void 0:s.sign_in_provider,e.abrupt("return",{claims:a,token:i,authTime:_n(In(a.auth_time)),issuedAtTime:_n(In(a.iat)),expirationTime:_n(In(a.exp)),signInProvider:o||null,signInSecondFactor:(null==s?void 0:s.sign_in_second_factor)||null});case 10:case"end":return e.stop()}},e)})),En.apply(this,arguments)}function In(e){return 1e3*Number(e)}function Sn(e){var t=b(e.split("."),3),n=t[0],r=t[1],i=t[2];if(void 0===n||void 0===r||void 0===i)return Ft("JWT malformed, contained fewer than 3 sections"),null;try{var a=B(r);return a?JSON.parse(a):(Ft("Failed to decode base64 JWT payload"),null)}catch(s){return Ft("Caught error parsing JWT payload as JSON",null==s?void 0:s.toString()),null}}function Tn(e){var t=Sn(e);return Kt(t,"internal-error"),Kt(void 0!==t.exp,"internal-error"),Kt(void 0!==t.iat,"internal-error"),Number(t.exp)-Number(t.iat)}function xn(e,t){return An.apply(this,arguments)}function An(){return An=E(O.mark(function e(t,n){var r=arguments;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!(r.length>
22&&void 0!==r[2]&&r[2])){e.next=3;break}return e.abrupt("return",n);case 3:return e.prev=3,e.next=6,n;case 6:return e.abrupt("return",e.sent);case 9:if(e.prev=9,e.t0=e.catch(3),!(e.t0 instanceof J&&Cn(e.t0))){e.next=15;break}if(t.auth.currentUser!==t){e.next=15;break}return e.next=15,t.auth.signOut();case 15:throw e.t0;case 16:case"end":return e.stop()}},e,null,[[3,9]])})),An.apply(this,arguments)}function Cn(e){var t=e.code;return t==="auth/".concat("user-disabled")||t==="auth/".concat("user-token-expired")}var Pn=function(){function e(t){I(this,e),this.user=t,this.isRunning=!1,this.timerId=null,this.errorBackoff=3e4}var t;return T(e,[{key:"_start",value:function(){this.isRunning||(this.isRunning=!0,this.schedule())}},{key:"_stop",value:function(){this.isRunning&&(this.isRunning=!1,null!==this.timerId&&clearTimeout(this.timerId))}},{key:"getInterval",value:function(e){var t;if(e){var n=this.errorBackoff;return this.errorBackoff=Math.min(2*this.errorBackoff,96e4),n}this.errorBackoff=3e4;var r=(null!==(t=this.user.stsTokenManager.expirationTime)&&void 0!==t?t:0)-Date.now()-3e5;return Math.max(0,r)}},{key:"schedule",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.isRunning){var n=this.getInterval(t);this.timerId=setTimeout(E(O.mark(function t(){return O.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e.iteration();case 2:case"end":return t.stop()}},t)})),n)}}},{key:"iteration",value:(t=E(O.mark(function e(){return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.user.getIdToken(!0);case 3:e.next=9;break;case 5:return e.prev=5,e.t0=e.catch(0),(null===e.t0||void 0===e.t0?void 0:e.t0.code)==="auth/".concat("network-request-failed")&&this.schedule(!0),e.abrupt("return");case 9:this.schedule();case 10:case"end":return e.stop()}},e,this,[[0,5]])})),function(){return t.apply(this,arguments)})}]),e}(),On=function(){function e(t,n){I(this,e),this.createdAt=t,this.lastLoginAt=n,this._initializeTime()}return T(e,[{key:"_initializeTime",value:function(){this.lastSignInTime=_n(this.lastLoginAt),this.creationTime=_n(this.createdAt)}},{key:"_copy",value:function(e){this.createdAt=e.createdAt,this.lastLoginAt=e.lastLoginAt,this._initializeTime()}},{key:"toJSON",value:function(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}}]),e}();function Rn(e){return Nn.apply(this,arguments)}function Nn(){return(Nn=E(O.mark(function e(t){var n,r,i,a,s,o,u,c,l,h,f;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.auth,e.next=3,t.getIdToken();case 3:return i=e.sent,e.next=6,xn(t,wn(r,{idToken:i}));case 6:Kt(null==(a=e.sent)?void 0:a.users.length,r,"internal-error"),s=a.users[0],t._notifyReloadListener(s),o=(null===(n=s.providerUserInfo)||void 0===n?void 0:n.length)?Mn(s.providerUserInfo):[],u=Ln(t.providerData,o),c=t.isAnonymous,l=!(t.email&&s.passwordHash||(null==u?void 0:u.length)),h=!!c&&l,f={uid:s.localId,displayName:s.displayName||null,photoURL:s.photoUrl||null,email:s.email||null,emailVerified:s.emailVerified||!1,phoneNumber:s.phoneNumber||null,tenantId:s.tenantId||null,providerData:u,metadata:new On(s.createdAt,s.lastLoginAt),isAnonymous:h},Object.assign(t,f);case 17:case"end":return e.stop()}},e)}))).apply(this,arguments)}function Dn(){return(Dn=E(O.mark(function e(t){var n;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=ce(t),e.next=3,Rn(n);case 3:return e.next=5,n.auth._persistUserIfCurrent(n);case 5:n.auth._notifyListenersIfCurrent(n);case 6:case"end":return e.stop()}},e)}))).apply(this,arguments)}function Ln(e,t){var n=e.filter(function(e){return!t.some(function(t){return t.providerId===e.providerId})});return[].concat(x(n),x(t))}function Mn(e){return e.map(function(e){var t=e.providerId,n=h(e,["providerId"]);return{providerId:t,uid:n.rawId||"",displayName:n.displayName||null,email:n.email||null,phoneNumber:n.phoneNumber||null,photoURL:n.photoUrl||null}})}function Un(e,t){return Fn.apply(this,arguments)}function Fn(){return(Fn=E(O.mark(function e(t,n){var r;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,sn(t,{},E(O.mark(function e(){var r,i,a,s,o,u;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=re({grant_type:"refresh_token",refresh_token:n}).slice(1),i=t.config,a=i.tokenApiHost,s=i.apiKey,o=ln(t,a,"/v1/token","key=".concat(s)),e.next=5,t._getAdditionalHeaders();case 5:return(u=e.sent)["Content-Type"]="application/x-www-form-urlencoded",e.abrupt("return",Zt.fetch()(o,{method:"POST",headers:u,body:r}));case 8:case"end":return e.stop()}},e)})));case 2:return r=e.sent,e.abrupt("return",{accessToken:r.access_token,expiresIn:r.expires_in,refreshToken:r.refresh_token});case 4:case"end":return e.stop()}},e)}))).apply(this,arguments)}function jn(e,t){return Vn.apply(this,arguments)}function Vn(){return(Vn=E(O.mark(function e(t,n){return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",rn(t,"POST","/v2/accounts:revokeToken",nn(t,n)));case 1:case"end":return e.stop()}},e)}))).apply(this,arguments)}var Bn=function(){function e(){I(this,e),this.refreshToken=null,this.accessToken=null,this.expirationTime=null}var t,n;return T(e,[{key:"isExpired",get:function(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}},{key:"updateFromServerResponse",value:function(e){Kt(e.idToken,"internal-error"),Kt(void 0!==e.idToken,"internal-error"),Kt(void 0!==e.refreshToken,"internal-error");
2var t="expiresIn"in e&&void 0!==e.expiresIn?Number(e.expiresIn):Tn(e.idToken);this.updateTokensAndExpiration(e.idToken,e.refreshToken,t)}},{key:"updateFromIdToken",value:function(e){Kt(0!==e.length,"internal-error");var t=Tn(e);this.updateTokensAndExpiration(e,null,t)}},{key:"getToken",value:(n=E(O.mark(function e(t){var n=arguments;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(n.length>1&&void 0!==n[1]&&n[1]||!this.accessToken||this.isExpired){e.next=3;break}return e.abrupt("return",this.accessToken);case 3:if(Kt(this.refreshToken,t,"user-token-expired"),!this.refreshToken){e.next=8;break}return e.next=7,this.refresh(t,this.refreshToken);case 7:return e.abrupt("return",this.accessToken);case 8:return e.abrupt("return",null);case 9:case"end":return e.stop()}},e,this)})),function(e){return n.apply(this,arguments)})},{key:"clearRefreshToken",value:function(){this.refreshToken=null}},{key:"refresh",value:(t=E(O.mark(function e(t,n){var r,i,a,s;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Un(t,n);case 2:r=e.sent,i=r.accessToken,a=r.refreshToken,s=r.expiresIn,this.updateTokensAndExpiration(i,a,Number(s));case 7:case"end":return e.stop()}},e,this)})),function(e,n){return t.apply(this,arguments)})},{key:"updateTokensAndExpiration",value:function(e,t,n){this.refreshToken=t||null,this.accessToken=e||null,this.expirationTime=Date.now()+1e3*n}},{key:"toJSON",value:function(){return{refreshToken:this.refreshToken,accessToken:this.accessToken,expirationTime:this.expirationTime}}},{key:"_assign",value:function(e){this.accessToken=e.accessToken,this.refreshToken=e.refreshToken,this.expirationTime=e.expirationTime}},{key:"_clone",value:function(){return Object.assign(new e,this.toJSON())}},{key:"_performRefresh",value:function(){return Gt("not implemented")}}],[{key:"fromJSON",value:function(t,n){var r=n.refreshToken,i=n.accessToken,a=n.expirationTime,s=new e;return r&&(Kt("string"==typeof r,"internal-error",{appName:t}),s.refreshToken=r),i&&(Kt("string"==typeof i,"internal-error",{appName:t}),s.accessToken=i),a&&(Kt("number"==typeof a,"internal-error",{appName:t}),s.expirationTime=a),s}}]),e}();function qn(e,t){Kt("string"==typeof e||void 0===e,"internal-error",{appName:t})}var zn=function(){function e(t){I(this,e);var n=t.uid,r=t.auth,i=t.stsTokenManager,a=h(t,["uid","auth","stsTokenManager"]);this.providerId="firebase",this.proactiveRefresh=new Pn(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=n,this.auth=r,this.stsTokenManager=i,this.accessToken=i.accessToken,this.displayName=a.displayName||null,this.email=a.email||null,this.emailVerified=a.emailVerified||!1,this.phoneNumber=a.phoneNumber||null,this.photoURL=a.photoURL||null,this.isAnonymous=a.isAnonymous||!1,this.tenantId=a.tenantId||null,this.providerData=a.providerData?x(a.providerData):[],this.metadata=new On(a.createdAt||void 0,a.lastLoginAt||void 0)}var t,n,r,i,a;return T(e,[{key:"getIdToken",value:(a=E(O.mark(function e(t){var n;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,xn(this,this.stsTokenManager.getToken(this.auth,t));case 2:if(Kt(n=e.sent,this.auth,"internal-error"),this.accessToken===n){e.next=9;break}return this.accessToken=n,e.next=8,this.auth._persistUserIfCurrent(this);case 8:this.auth._notifyListenersIfCurrent(this);case 9:return e.abrupt("return",n);case 10:case"end":return e.stop()}},e,this)})),function(e){return a.apply(this,arguments)})},{key:"getIdTokenResult",value:function(e){return function(e){return En.apply(this,arguments)}(this,e)}},{key:"reload",value:function(){return function(e){return Dn.apply(this,arguments)}(this)}},{key:"_assign",value:function(e){this!==e&&(Kt(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(function(e){return Object.assign({},e)}),this.metadata._copy(e.metadata),this.stsTokenManager._assign(e.stsTokenManager))}},{key:"_clone",value:function(t){var n=new e(Object.assign(Object.assign({},this),{auth:t,stsTokenManager:this.stsTokenManager._clone()}));return n.metadata._copy(this.metadata),n}},{key:"_onReload",value:function(e){Kt(!this.reloadListener,this.auth,"internal-error"),this.reloadListener=e,this.reloadUserInfo&&(this._notifyReloadListener(this.reloadUserInfo),this.reloadUserInfo=null)}},{key:"_notifyReloadListener",value:function(e){this.reloadListener?this.reloadListener(e):this.reloadUserInfo=e}},{key:"_startProactiveRefresh",value:function(){this.proactiveRefresh._start()}},{key:"_stopProactiveRefresh",value:function(){this.proactiveRefresh._stop()}},{key:"_updateTokensIfNecessary",value:(i=E(O.mark(function e(t){var n,r,i=arguments;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(n=i.length>1&&void 0!==i[1]&&i[1],r=!1,t.idToken&&t.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(t),r=!0),!n){e.next=6;break}return e.next=6,Rn(this);case 6:return e.next=8,this.auth._persistUserIfCurrent(this);case 8:r&&this.auth._notifyListenersIfCurrent(this);case 9:case"end":return e.stop()}},e,this)})),function(e){return i.apply(this,arguments)})},{key:"delete",value:(r=E(O.mark(function e(){var t;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!rt(this.auth.app)){e.next=2;break}return e.abrupt("return",Promise.reject(qt(this.auth)));case 2:return e.next=4,this.getIdToken();case 4:return t=e.sent,e.next=7,xn(this,mn(this.auth,{idToken:t}));case 7:return this.stsTokenManager.clearRefreshToken(),e.abrupt("return",this.auth.signOut());case 9:case"end":return e.stop()}},e,this)})),function(){return r.apply(this,arguments)})},{key:"toJSON",value:function(){return Object.assign(Object.assign({uid:this.uid,email:this.email||void 0,emailVerified:this.emailVerified,displayName:this.displayName||void 0,isA
2nonymous:this.isAnonymous,photoURL:this.photoURL||void 0,phoneNumber:this.phoneNumber||void 0,tenantId:this.tenantId||void 0,providerData:this.providerData.map(function(e){return Object.assign({},e)}),stsTokenManager:this.stsTokenManager.toJSON(),_redirectEventId:this._redirectEventId},this.metadata.toJSON()),{apiKey:this.auth.config.apiKey,appName:this.auth.name})}},{key:"refreshToken",get:function(){return this.stsTokenManager.refreshToken||""}}],[{key:"_fromJSON",value:function(t,n){var r,i,a,s,o,u,c,l,h=null!==(r=n.displayName)&&void 0!==r?r:void 0,f=null!==(i=n.email)&&void 0!==i?i:void 0,d=null!==(a=n.phoneNumber)&&void 0!==a?a:void 0,p=null!==(s=n.photoURL)&&void 0!==s?s:void 0,v=null!==(o=n.tenantId)&&void 0!==o?o:void 0,g=null!==(u=n._redirectEventId)&&void 0!==u?u:void 0,y=null!==(c=n.createdAt)&&void 0!==c?c:void 0,m=null!==(l=n.lastLoginAt)&&void 0!==l?l:void 0,k=n.uid,w=n.emailVerified,b=n.isAnonymous,_=n.providerData,E=n.stsTokenManager;Kt(k&&E,t,"internal-error");var I=Bn.fromJSON(this.name,E);Kt("string"==typeof k,t,"internal-error"),qn(h,t.name),qn(f,t.name),Kt("boolean"==typeof w,t,"internal-error"),Kt("boolean"==typeof b,t,"internal-error"),qn(d,t.name),qn(p,t.name),qn(v,t.name),qn(g,t.name),qn(y,t.name),qn(m,t.name);var S=new e({uid:k,auth:t,email:f,emailVerified:w,displayName:h,isAnonymous:b,photoURL:p,phoneNumber:d,tenantId:v,stsTokenManager:I,createdAt:y,lastLoginAt:m});return _&&Array.isArray(_)&&(S.providerData=_.map(function(e){return Object.assign({},e)})),g&&(S._redirectEventId=g),S}},{key:"_fromIdTokenResponse",value:(n=E(O.mark(function t(n,r){var i,a,s,o=arguments;return O.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return i=o.length>2&&void 0!==o[2]&&o[2],(a=new Bn).updateFromServerResponse(r),s=new e({uid:r.localId,auth:n,stsTokenManager:a,isAnonymous:i}),t.next=6,Rn(s);case 6:return t.abrupt("return",s);case 7:case"end":return t.stop()}},t)})),function(e,t){return n.apply(this,arguments)})},{key:"_fromGetAccountInfoResponse",value:(t=E(O.mark(function t(n,r,i){var a,s,o,u,c,l;return O.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return Kt(void 0!==(a=r.users[0]).localId,"internal-error"),s=void 0!==a.providerUserInfo?Mn(a.providerUserInfo):[],o=!(a.email&&a.passwordHash||(null==s?void 0:s.length)),(u=new Bn).updateFromIdToken(i),c=new e({uid:a.localId,auth:n,stsTokenManager:u,isAnonymous:o}),l={uid:a.localId,displayName:a.displayName||null,photoURL:a.photoUrl||null,email:a.email||null,emailVerified:a.emailVerified||!1,phoneNumber:a.phoneNumber||null,tenantId:a.tenantId||null,providerData:s,metadata:new On(a.createdAt,a.lastLoginAt),isAnonymous:!(a.email&&a.passwordHash||(null==s?void 0:s.length))},Object.assign(c,l),t.abrupt("return",c);case 10:case"end":return t.stop()}},t)})),function(e,n,r){return t.apply(this,arguments)})}]),e}(),Hn=new Map;function Kn(e){Wt(e instanceof Function,"Expected a class definition");var t=Hn.get(e);return t?(Wt(t instanceof e,"Instance stored in cache mismatched with class"),t):(t=new e,Hn.set(e,t),t)}var Gn=function(){function e(){I(this,e),this.type="NONE",this.storage={}}var t,n,r,i;return T(e,[{key:"_isAvailable",value:(i=E(O.mark(function e(){return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",!0);case 1:case"end":return e.stop()}},e)})),function(){return i.apply(this,arguments)})},{key:"_set",value:(r=E(O.mark(function e(t,n){return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:this.storage[t]=n;case 1:case"end":return e.stop()}},e,this)})),function(e,t){return r.apply(this,arguments)})},{key:"_get",value:(n=E(O.mark(function e(t){var n;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=this.storage[t],e.abrupt("return",void 0===n?null:n);case 2:case"end":return e.stop()}},e,this)})),function(e){return n.apply(this,arguments)})},{key:"_remove",value:(t=E(O.mark(function e(t){return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:delete this.storage[t];case 1:case"end":return e.stop()}},e,this)})),function(e){return t.apply(this,arguments)})},{key:"_addListener",value:function(e,t){}},{key:"_removeListener",value:function(e,t){}}]),e}();
2Gn.type="NONE";var Wn=Gn;function Qn(e,t,n){return"firebase".concat(":",e,":").concat(t,":").concat(n)}var Yn=function(){function e(t,n,r){I(this,e),this.persistence=t,this.auth=n,this.userKey=r;var i=this.auth,a=i.config,s=i.name;this.fullUserKey=Qn(this.userKey,a.apiKey,s),this.fullPersistenceKey=Qn("persistence",a.apiKey,s),this.boundEventHandler=n._onStorageEvent.bind(n),this.persistence._addListener(this.fullUserKey,this.boundEventHandler)}var t,n,r;return T(e,[{key:"setCurrentUser",value:function(e){return this.persistence._set(this.fullUserKey,e.toJSON())}},{key:"getCurrentUser",value:(r=E(O.mark(function e(){var t;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.persistence._get(this.fullUserKey);case 2:return t=e.sent,e.abrupt("return",t?zn._fromJSON(this.auth,t):null);case 4:case"end":return e.stop()}},e,this)})),function(){return r.apply(this,arguments)})},{key:"removeCurrentUser",value:function(){return this.persistence._remove(this.fullUserKey)}},{key:"savePersistenceForRedirect",value:function(){return this.persistence._set(this.fullPersistenceKey,this.persistence.type)}},{key:"setPersistence",value:(n=E(O.mark(function e(t){var n;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this.persistence!==t){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,this.getCurrentUser();case 4:return n=e.sent,e.next=7,this.removeCurrentUser();case 7:if(this.persistence=t,!n){e.next=10;break}return e.abrupt("return",this.setCurrentUser(n));case 10:case"end":return e.stop()}},e,this)})),function(e){return n.apply(this,arguments)})},{key:"delete",value:function(){this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}}],[{key:"create",value:(t=E(O.mark(function t(n,r){var i,a,s,o,u,c,l,h,f,d,p,v=arguments;return O.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(i=v.length>2&&void 0!==v[2]?v[2]:"authUser",r.length){t.next=3;break}return t.abrupt("return",new e(Kn(Wn),n,i));case 3:return t.next=5,Promise.all(r.map(function(){var e=E(O.mark(function e(t){return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t._isAvailable();case 2:if(!e.sent){e.next=4;break}return e.abrupt("return",t);case 4:return e.abrupt("return",void 0);case 5:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()));case 5:a=t.sent.filter(function(e){return e}),s=a[0]||Kn(Wn),o=Qn(i,n.config.apiKey,n.name),u=null,c=xt(r),t.prev=10,c.s();case 12:if((l=c.n()).done){t.next=29;break}return h=l.value,t.prev=14,t.next=17,h._get(o);case 17:if(!(f=t.sent)){t.next=23;break}return d=zn._fromJSON(n,f),h!==s&&(u=d),s=h,t.abrupt("break",29);case 23:t.next=27;break;case 25:t.prev=25,t.t0=t.catch(14);case 27:t.next=12;break;case 29:t.next=34;break;case 31:t.prev=31,t.t1=t.catch(10),c.e(t.t1);case 34:return t.prev=34,c.f(),t.finish(34);case 37:if(p=a.filter(function(e){return e._shouldAllowMigration}),s._shouldAllowMigration&&p.length){t.next=40;break}return t.abrupt("return",new e(s,n,i));case 40:if(s=p[0],!u){t.next=44;break}return t.next=44,s._set(o,u.toJSON());case 44:return t.next=46,Promise.all(r.map(function(){var e=E(O.mark(function e(t){return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t===s){e.next=8;break}return e.prev=1,e.next=4,t._remove(o);case 4:e.next=8;break;case 6:e.prev=6,e.t0=e.catch(1);case 8:case"end":return e.stop()}},e,null,[[1,6]])}));return function(t){return e.apply(this,arguments)}}()));case 46:return t.abrupt("return",new e(s,n,i));case 47:case"end":return t.stop()}},t,null,[[10,31,34,37],[14,25]])})),function(e,n){return t.apply(this,arguments)})}]),e}();function Xn(e){var t=e.toLowerCase();if(t.includes("opera/")||t.includes("opr/")||t.includes("opios/"))return"Opera";if(er(t))return"IEMobile";if(t.includes("msie")||t.includes("trident/"))return"IE";if(t.includes("edge/"))return"Edge";if(Jn(t))return"Firefox";if(t.includes("silk/"))return"Silk";if(nr(t))return"Blackberry";if(rr(t))return"Webos";if($n(t))return"Safari";if((t.includes("chrome/")||Zn(t))&&!t.includes("edge/"))return"Chrome";if(tr(t))return"Android";var n=e.match(/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/);return 2===(null==n?void 0:n.length)?n[1]:"Other"}function Jn(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:W();return/firefox\//i.test(e)}function $n(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:W()).toLowerCase();return e.includes("safari/")&&!e.includes("chrome/")&&!e.includes("crios/")&&!e.includes("android")}function Zn(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:W();return/crios\//i.test(e)}function er(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:W();return/iemobile/i.test(e)}function tr(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:W();return/android/i.test(e)}function nr(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:W();return/blackberry/i.test(e)}function rr(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:W();return/webos/i.test(e)}function ir(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:W();return/iphone|ipad|ipod/i.test(e)||/macintosh/i.test(e)&&/mobile/i.test(e)}function ar(){return((e=W()).indexOf("MSIE ")>=0||e.indexOf("Trident/")>=0)&&10===document.documentMode;var e}function sr(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:W();return ir(e)||tr(e)||rr(e)||nr(e)||/windows phone/i.test(e)||er(e)}function or(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];switch(e){case"Browser":t=Xn(W());break;case"Worker":t="".concat(Xn(W()),"-").concat(e);break;default:t=e}var r=n.length?n.join(","):"FirebaseCore-web";return"".concat(t,"/","JsCore","/").concat(ot,"/").concat(r)}var ur=function(){function e(t){I(this,e),this.auth=t,this.queue=[]}var t;return T(e,[{key:"pushCallback",value:function(e,t){var n=this,r=function(t){return new Promise(function(n,r){try{n(e(t))}catch(i){r(i)}})};r.onAbort=t,this.queue.push(r);var i=this.queue.length-1;return function(){n.queue[i]=function(){return Promise.resolve()}}}},{key:"runMiddleware",value:(t=E(O.mark(function e(t){var n,r,i,a,s,o,u;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this.auth.currentUser!==t){e.next=2;break}return e.abrupt("return");case 2:n=[],e.prev=3,r=xt(this.queue),e.prev=5,r.s();case 7:if((i=r.n()).done){e.next=14;break}return a=i.value,e.next=11,a(t);case 11:a.onAbort&&n.push(a.onAbort);case 12:e.next=7;break;case 14:e.next=19;break;case 16:e.prev=16,e.t0=e.catch(5),r.e(e.t0);case 19:return e.prev=19,r.f(),e.finish(19);case 22:e.next=30;break;case 24:e.prev=24,e.t1=e.catch(3),n.reverse(),s=xt(n);try{for(s.s();!(o=s.n()).done;){u=o.value;try{u()}catch(c){}}}catch(l){s.e(l)}finally{s.f()}throw this.auth._errorFactory.create("login-blocked",{originalMessage:null===e.t1||void 0===e.t1?void 0:e.t1.message});case 30:case"end":return e.stop()}},e,this,[[3,24],[5,16,19,22]])})),function(e){return t.apply(this,arguments)})}]),e}();function cr(e){return lr.apply(this,arguments)}function lr(){return lr=E(O.mark(function e(t){var n,r=arguments;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=r.length>1&&void 0!==r[1]?r[1]:{},e.abrupt("return",rn(t,"GET","/v2/passwordPolicy",nn(t,n)));case 2:case"end":return e.stop()}},e)})),lr.apply(this,arguments)}var hr=function(){function e(t){var n,r,i,a;I(this,e);var s=t.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=null!==(n=s.minPasswordLength)&&void 0!==n?n:6,s.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=s.maxPasswordLength),void 0!==s.containsLowercaseCharacter&&(this.customStrengthOptions.containsLowercaseLetter=s.containsLowercaseCharacter),void 0!==s.containsUppercaseCharacter&&(this.customStrengthOptions.containsUppercaseLetter=s.containsUppercaseCharacter),void 0!==s.containsNumericCharacter&&(this.customStrengthOptions.containsNumericCharacter=s.containsNumericCharacter),void 0!==s.containsNonAlphanumericCharacter&&(this.customStrengthOptions.containsNonAlphanumericCharacter=s.containsNonAlphanumericCharacter),this.enforcementState=t.enforcementState,"ENFORCEMENT_STATE_UNSPECIFIED"===this.enforcementState&&(this.enforcementState="OFF"),this.allowedNonAlphanumericCharacters=null!==(i=null===(r=t.allowedNonAlphanumericCharacters)||void 0===r?void 0:r.join(""))&&void 0!==i?i:"",this.forceUpgradeOnSignin=null!==(a=t.forceUpgradeOnSignin)&&void 0!==a&&a,this.schemaVersion=t.schemaVersion}return T(e,[{key:"validatePassword",value:function(e){var t,n,r,i,a,s,o={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(e,o),this.validatePasswordCharacterOptions(e,o),o.isValid&&
2(o.isValid=null===(t=o.meetsMinPasswordLength)||void 0===t||t),o.isValid&&(o.isValid=null===(n=o.meetsMaxPasswordLength)||void 0===n||n),o.isValid&&(o.isValid=null===(r=o.containsLowercaseLetter)||void 0===r||r),o.isValid&&(o.isValid=null===(i=o.containsUppercaseLetter)||void 0===i||i),o.isValid&&(o.isValid=null===(a=o.containsNumericCharacter)||void 0===a||a),o.isValid&&(o.isValid=null===(s=o.containsNonAlphanumericCharacter)||void 0===s||s),o}},{key:"validatePasswordLengthOptions",value:function(e,t){var n=this.customStrengthOptions.minPasswordLength,r=this.customStrengthOptions.maxPasswordLength;n&&(t.meetsMinPasswordLength=e.length>=n),r&&(t.meetsMaxPasswordLength=e.length<=r)}},{key:"validatePasswordCharacterOptions",value:function(e,t){var n;this.updatePasswordCharacterOptionsStatuses(t,!1,!1,!1,!1);for(var 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))}},{key:"updatePasswordCharacterOptionsStatuses",value:function(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))}}]),e}(),fr=function(){function e(t,n,r,i){I(this,e),this.app=t,this.heartbeatServiceProvider=n,this.appCheckServiceProvider=r,this.config=i,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new pr(this),this.idTokenSubscription=new pr(this),this.beforeStateQueue=new ur(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=Dt,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=t.name,this.clientVersion=i.sdkClientVersion}var t,n,r,i,a,s,o,u,c,l,h,f,d,p,v,g,y,m,k;return T(e,[{key:"_initializeWithPersistence",value:function(e,t){var n=this;return t&&(this._popupRedirectResolver=Kn(t)),this._initializationPromise=this.queue(E(O.mark(function r(){var i,a;return O.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:if(!n._deleted){r.next=2;break}return r.abrupt("return");case 2:return r.next=4,Yn.create(n,e);case 4:if(n.persistenceManager=r.sent,!n._deleted){r.next=7;break}return r.abrupt("return");case 7:if(!(null===(i=n._popupRedirectResolver)||void 0===i?void 0:i._shouldInitProactively)){r.next=15;break}return r.prev=8,r.next=11,n._popupRedirectResolver._initialize(n);case 11:r.next=15;break;case 13:r.prev=13,r.t0=r.catch(8);case 15:return r.next=17,n.initializeCurrentUser(t);case 17:if(n.lastNotifiedUid=(null===(a=n.currentUser)||void 0===a?void 0:a.uid)||null,!n._deleted){r.next=20;break}return r.abrupt("return");case 20:n._isInitialized=!0;case 21:case"end":return r.stop()}},r,null,[[8,13]])}))),this._initializationPromise}},{key:"_onStorageEvent",value:(k=E(O.mark(function e(){var t;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._deleted){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,this.assertedPersistence.getCurrentUser();case 4:if(t=e.sent,this.currentUser||t){e.next=7;break}return e.abrupt("return");case 7:if(!this.currentUser||!t||this.currentUser.uid!==t.uid){e.next=12;break}return this._currentUser._assign(t),e.next=11,this.currentUser.getIdToken();case 11:return e.abrupt("return");case 12:return e.next=14,this._updateCurrentUser(t,!0);case 14:case"end":return e.stop()}},e,this)})),function(){return k.apply(this,arguments)})},{key:"initializeCurrentUserFromIdToken",value:(m=E(O.mark(function e(t){var n,r;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,wn(this,{idToken:t});case 3:return n=e.sent,e.next=6,zn._fromGetAccountInfoResponse(this,n,t);case 6:return r=e.sent,e.next=9,this.directlySetCurrentUser(r);case 9:e.next=16;break;case 11:return e.prev=11,e.t0=e.catch(0),console.warn("FirebaseServerApp could not login user with provided authIdToken: ",e.t0),e.next=16,this.directlySetCurrentUser(null);case 16:case"end":return e.stop()}},e,this,[[0,11]])})),function(e){return m.apply(this,arguments)})},{key:"initializeCurrentUser",value:(y=E(O.mark(function e(t){var n,r,i,a,s,o,u,c,l=this;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!rt(this.app)){e.next=7;break}if(!(r=this.app.settings.authIdToken)){e.next=6;break}return e.abrupt("return",new Promise(function(e){setTimeout(function(){return l.initializeCurrentUserFromIdToken(r).then(e,e)})}));case 6:return e.abrupt("return",this.directlySetCurrentUser(null));case 7:return e.next=9,this.assertedPersistence.getCurrentUser();case 9:if(i=e.sent,a=i,s=!1,!t||!this.config.authDomain){e.next=21;break}return e.next=15,this.getOrInitRedirectPersistenceManager();case 15:return o=null===(n=this.redirectUser)||void 0===n?void 0:n._redirectEventId,u=null==a?void 0:a._redirectEventId,e.next=19,this.tryRedirectSignIn(t);case 19:c=e.sent,o&&o!==u||!(null==c?void 0:c.user)||(a=c.user,s=!0);case 21:if(a){e.next=23;break}return e.abrupt("return",this.directlySetCurrentUser(null));
2case 23:if(a._redirectEventId){e.next=39;break}if(!s){e.next=34;break}return e.prev=25,e.next=28,this.beforeStateQueue.runMiddleware(a);case 28:e.next=34;break;case 30:e.prev=30,e.t0=e.catch(25),a=i,this._popupRedirectResolver._overrideRedirectResult(this,function(){return Promise.reject(e.t0)});case 34:if(!a){e.next=38;break}return e.abrupt("return",this.reloadAndSetCurrentUserOrClear(a));case 38:return e.abrupt("return",this.directlySetCurrentUser(null));case 39:return Kt(this._popupRedirectResolver,this,"argument-error"),e.next=42,this.getOrInitRedirectPersistenceManager();case 42:if(!this.redirectUser||this.redirectUser._redirectEventId!==a._redirectEventId){e.next=44;break}return e.abrupt("return",this.directlySetCurrentUser(a));case 44:return e.abrupt("return",this.reloadAndSetCurrentUserOrClear(a));case 45:case"end":return e.stop()}},e,this,[[25,30]])})),function(e){return y.apply(this,arguments)})},{key:"tryRedirectSignIn",value:(g=E(O.mark(function e(t){var n;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=null,e.prev=1,e.next=4,this._popupRedirectResolver._completeRedirectFn(this,t,!0);case 4:n=e.sent,e.next=11;break;case 7:return e.prev=7,e.t0=e.catch(1),e.next=11,this._setRedirectUser(null);case 11:return e.abrupt("return",n);case 12:case"end":return e.stop()}},e,this,[[1,7]])})),function(e){return g.apply(this,arguments)})},{key:"reloadAndSetCurrentUserOrClear",value:(v=E(O.mark(function e(t){return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,Rn(t);case 3:e.next=9;break;case 5:if(e.prev=5,e.t0=e.catch(0),(null===e.t0||void 0===e.t0?void 0:e.t0.code)==="auth/".concat("network-request-failed")){e.next=9;break}return e.abrupt("return",this.directlySetCurrentUser(null));case 9:return e.abrupt("return",this.directlySetCurrentUser(t));case 10:case"end":return e.stop()}},e,this,[[0,5]])})),function(e){return v.apply(this,arguments)})},{key:"useDeviceLanguage",value:function(){this.languageCode=function(){if("undefined"==typeof navigator)return null;var e=navigator;return e.languages&&e.languages[0]||e.language||null}()}},{key:"_delete",value:(p=E(O.mark(function e(){return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:this._deleted=!0;case 1:case"end":return e.stop()}},e,this)})),function(){return p.apply(this,arguments)})},{key:"updateCurrentUser",value:(d=E(O.mark(function e(t){var n;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!rt(this.app)){e.next=2;break}return e.abrupt("return",Promise.reject(qt(this)));case 2:return(n=t?ce(t):null)&&Kt(n.auth.config.apiKey===this.config.apiKey,this,"invalid-user-token"),e.abrupt("return",this._updateCurrentUser(n&&n._clone(this)));case 5:case"end":return e.stop()}},e,this)})),function(e){return d.apply(this,arguments)})},{key:"_updateCurrentUser",value:(f=E(O.mark(function e(t){var n,r=this,i=arguments;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(n=i.length>1&&void 0!==i[1]&&i[1],!this._deleted){e.next=3;break}return e.abrupt("return");case 3:if(t&&Kt(this.tenantId===t.tenantId,this,"tenant-id-mismatch"),n){e.next=7;break}return e.next=7,this.beforeStateQueue.runMiddleware(t);case 7:return e.abrupt("return",this.queue(E(O.mark(function e(){return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,r.directlySetCurrentUser(t);case 2:r.notifyAuthListeners();case 3:case"end":return e.stop()}},e)}))));case 8:case"end":return e.stop()}},e,this)})),function(e){return f.apply(this,arguments)})},{key:"signOut",value:(h=E(O.mark(function e(){return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!rt(this.app)){e.next=2;break}return e.abrupt("return",Promise.reject(qt(this)));case 2:return e.next=4,this.beforeStateQueue.runMiddleware(null);case 4:if(!this.redirectPersistenceManager&&!this._popupRedirectResolver){e.next=7;break}return e.next=7,this._setRedirectUser(null);case 7:return e.abrupt("return",this._updateCurrentUser(null,!0));case 8:case"end":return e.stop()}},e,this)})),function(){return h.apply(this,arguments)})},{key:"setPersistence",value:function(e){var t=this;return rt(this.app)?Promise.reject(qt(this)):this.queue(E(O.mark(function n(){return O.wrap(function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,t.assertedPersistence.setPersistence(Kn(e));case 2:case"end":return n.stop()}},n)})))}},{key:"_getRecaptchaConfig",value:function(){return null==this.tenantId?this._agentRecaptchaConfig:this._tenantRecaptchaConfigs[this.tenantId]}},{key:"validatePassword",value:(l=E(O.mark(function e(t){var n;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this._getPasswordPolicyInternal()){e.next=3;break}return e.next=3,this._updatePasswordPolicy();case 3:if((n=this._getPasswordPolicyInternal()).schemaVersion===this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION){e.
2next=6;break}return e.abrupt("return",Promise.reject(this._errorFactory.create("unsupported-password-policy-schema-version",{})));case 6:return e.abrupt("return",n.validatePassword(t));case 7:case"end":return e.stop()}},e,this)})),function(e){return l.apply(this,arguments)})},{key:"_getPasswordPolicyInternal",value:function(){return null===this.tenantId?this._projectPasswordPolicy:this._tenantPasswordPolicies[this.tenantId]}},{key:"_updatePasswordPolicy",value:(c=E(O.mark(function e(){var t,n;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,cr(this);case 2:t=e.sent,n=new hr(t),null===this.tenantId?this._projectPasswordPolicy=n:this._tenantPasswordPolicies[this.tenantId]=n;case 5:case"end":return e.stop()}},e,this)})),function(){return c.apply(this,arguments)})},{key:"_getPersistence",value:function(){return this.assertedPersistence.persistence.type}},{key:"_updateErrorMap",value:function(e){this._errorFactory=new $("auth","Firebase",e())}},{key:"onAuthStateChanged",value:function(e,t,n){return this.registerStateListener(this.authStateSubscription,e,t,n)}},{key:"beforeAuthStateChanged",value:function(e,t){return this.beforeStateQueue.pushCallback(e,t)}},{key:"onIdTokenChanged",value:function(e,t,n){return this.registerStateListener(this.idTokenSubscription,e,t,n)}},{key:"authStateReady",value:function(){var e=this;return new Promise(function(t,n){if(e.currentUser)t();else var r=e.onAuthStateChanged(function(){r(),t()},n)})}},{key:"revokeAccessToken",value:(u=E(O.mark(function e(t){var n,r;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.currentUser){e.next=8;break}return e.next=3,this.currentUser.getIdToken();case 3:return n=e.sent,r={providerId:"apple.com",tokenType:"ACCESS_TOKEN",token:t,idToken:n},null!=this.tenantId&&(r.tenantId=this.tenantId),e.next=8,jn(this,r);case 8:case"end":return e.stop()}},e,this)})),function(e){return u.apply(this,arguments)})},{key:"toJSON",value:function(){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()}}},{key:"_setRedirectUser",value:(o=E(O.mark(function e(t,n){var r;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getOrInitRedirectPersistenceManager(n);case 2:return r=e.sent,e.abrupt("return",null===t?r.removeCurrentUser():r.setCurrentUser(t));case 4:case"end":return e.stop()}},e,this)})),function(e,t){return o.apply(this,arguments)})},{key:"getOrInitRedirectPersistenceManager",value:(s=E(O.mark(function e(t){var n;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this.redirectPersistenceManager){e.next=9;break}return Kt(n=t&&Kn(t)||this._popupRedirectResolver,this,"argument-error"),e.next=5,Yn.create(this,[Kn(n._redirectPersistence)],"redirectUser");case 5:return this.redirectPersistenceManager=e.sent,e.next=8,this.redirectPersistenceManager.getCurrentUser();case 8:this.redirectUser=e.sent;case 9:return e.abrupt("return",this.redirectPersistenceManager);case 10:case"end":return e.stop()}},e,this)})),function(e){return s.apply(this,arguments)})},{key:"_redirectUserForId",value:(a=E(O.mark(function e(t){var n,r;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._isInitialized){e.next=3;break}return e.next=3,this.queue(E(O.mark(function e(){return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:case"end":return e.stop()}},e)})));case 3:if((null===(n=this._currentUser)||void 0===n?void 0:n._redirectEventId)!==t){e.next=5;break}return e.abrupt("return",this._currentUser);case 5:if((null===(r=this.redirectUser)||void 0===r?void 0:r._redirectEventId)!==t){e.next=7;break}return e.abrupt("return",this.redirectUser);case 7:return e.abrupt("return",null);case 8:case"end":return e.stop()}},e,this)})),function(e){return a.apply(this,arguments)})},{key:"_persistUserIfCurrent",value:(i=E(O.mark(function e(t){var n=this;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t!==this.currentUser){e.next=2;break}return e.abrupt("return",this.queue(E(O.mark(function e(){return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",n.directlySetCurrentUser(t));case 1:case"end":return e.stop()}},e)}))));case 2:case"end":return e.stop()}},e,this)})),function(e){return i.apply(this,arguments)})},{key:"_notifyListenersIfCurrent",value:function(e){e===this.currentUser&&this.notifyAuthListeners()}},{key:"_key",value:function(){return"".concat(this.config.authDomain,":").concat(this.config.apiKey,":").concat(this.name)}},{key:"_startProactiveRefresh",value:function(){this.isProactiveRefreshEnabled=!0,this.currentUser&&this._currentUser._startProactiveRefresh()}},{key:"_stopProactiveRefresh",value:function(){this.isProactiveRefreshEnabled=!1,this.currentUser&&this._currentUser._stopProactiveRefresh()}},{key:"_currentUser",get:function(){return this.currentUser}},{key:"notifyAuthListeners",value:function(){var e,t;if(this._isInitialized){this.idTokenSubscription.next(this.currentUser);var 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))}}},{key:"registerStateListener",value:function(e,t,n,r){var i=this;if(this._deleted)return function(){};var a="function"==typeof t?t:t.next.bind(t),s=!1,o=this._isInitialized?Promise.resolve():this._initializationPromise;if(Kt(o,this,"internal-error"),o.then(function(){s||a(i.currentUser)}),"function"==typeof t){var u=e.addObserver(t,n,r);return function(){s=!0,u()}}var c=e.addObserver(t);return function(){s=!0,c()}}},{key:"directlySetCurrentUser",value:(r=E(O.mark(function e(t){return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this.currentUser&&this.currentUser!==t&&this._currentUser._stopProactiveRefresh(),t&&this.isProactiveRefreshEnabled&&t._startProactiveRefresh(),this.currentUser=t,!t){e.next=8;break}return e.next=6,this.assertedPersistence.setCurrentUser(t);case 6:e.next=10;break;case 8:return e.next=10,this.assertedPersistence.removeCurrentUser();case 10:case"end":return e.stop()}},e,this)})),function(e){return r.apply(this,arguments)})},{key:"queue",value:function(e){return this.operations=this.operations.then(e,e),this.operations}},{key:"assertedPersistence",get:function(){return Kt(this.persistenceManager,this,"internal-error"),this.persistenceManager}},{key:"_logFramework",value:function(e){e&&!this.frameworks.includes(e)&&(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=or(this.config.clientPlatform,this._getFrameworks()))}},{key:"_getFrameworks",value:function(){return this.frameworks}},{key:"_getAdditionalHeaders",value:(n=E(O.mark(function e(){var t,n,r,i;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=A({},"X-Client-Version",this.clientVersion),this.app.options.appId&&(n["X-Firebase-gmpid"]=this.app.options.appId),e.next=4,null===(t=this.heartbeatServiceProvider.getImmediate({optional:!0}))||void 0===t?void 0:t.getHeartbeatsHeader();case 4:return(r=e.sent)&&(n["X-Firebase-Client"]=r),e.next=8,this._getAppCheckToken();case 8:return(i=e.sent)&&(n["X-Firebase-AppCheck"]=i),e.abrupt("return",n);case 11:case"end":return e.stop()}},e,this)})),function(){return n.apply(this,arguments)})},{key:"_getAppCheckToken",value:(t=E(O.mark(function e(){var t,n;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,null===(t=this.appCheckServiceProvider.getImmediate({optional:!0}))||void 0===t?void 0:t.getToken();case 2:return(null==(n=e.sent)?void 0:n.error)&&Ut("Error while retrieving App Check token: ".concat(n.error)),e.abrupt("return",null==n?void 0:n.token);case 5:case"end":return e.stop()}},e,this)})),function(){return t.apply(this,arguments)})}]),e}();function dr(e){return ce(e)}var pr=function(){function e(t){var n,r,i=this;
2I(this,e),this.auth=t,this.observer=null,this.addObserver=(r=new se(function(e){return i.observer=e},n)).subscribe.bind(r)}return T(e,[{key:"next",get:function(){return Kt(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}]),e}(),vr={loadJS:function(){return E(O.mark(function e(){return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:throw new Error("Unable to load external scripts");case 1:case"end":return e.stop()}},e)}))()},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function gr(e){return vr.loadJS(e)}var yr=function(){function e(t){I(this,e),this.type="recaptcha-enterprise",this.auth=dr(t)}var t;return T(e,[{key:"verify",value:(t=E(O.mark(function e(){var t,n,r,i,a,s=this,o=arguments;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return a=function(e,n,r){var i=window.grecaptcha;pn(i)?i.enterprise.ready(function(){i.enterprise.execute(e,{action:t}).then(function(e){n(e)}).catch(function(){n("NO_RECAPTCHA")})}):r(Error("No reCAPTCHA enterprise script loaded."))},i=function(){return i=E(O.mark(function e(t){return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(n){e.next=5;break}if(null!=t.tenantId||null==t._agentRecaptchaConfig){e.next=3;break}return e.abrupt("return",t._agentRecaptchaConfig.siteKey);case 3:if(null==t.tenantId||void 0===t._tenantRecaptchaConfigs[t.tenantId]){e.next=5;break}return e.abrupt("return",t._tenantRecaptchaConfigs[t.tenantId].siteKey);case 5:return e.abrupt("return",new Promise(function(){var e=E(O.mark(function e(n,r){return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:gn(t,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}).then(function(e){if(void 0!==e.recaptchaKey){var i=new vn(e);return null==t.tenantId?t._agentRecaptchaConfig=i:t._tenantRecaptchaConfigs[t.tenantId]=i,n(i.siteKey)}r(new Error("recaptcha Enterprise site key undefined"))}).catch(function(e){r(e)});case 1:case"end":return e.stop()}},e)}));return function(t,n){return e.apply(this,arguments)}}()));case 6:case"end":return e.stop()}},e)})),i.apply(this,arguments)},r=function(e){return i.apply(this,arguments)},t=o.length>0&&void 0!==o[0]?o[0]:"verify",n=o.length>1&&void 0!==o[1]&&o[1],e.abrupt("return",new Promise(function(e,t){r(s.auth).then(function(r){if(!n&&pn(window.grecaptcha))a(r,e,t);else{if("undefined"==typeof window)return void t(new Error("RecaptchaVerifier is only supported in browser"));var i=vr.recaptchaEnterpriseScript;0!==i.length&&(i+=r),gr(i).then(function(){a(r,e,t)}).catch(function(e){t(e)})}}).catch(function(e){t(e)})}));case 6:case"end":return e.stop()}},e)})),function(){return t.apply(this,arguments)})}]),e}();function mr(e,t,n){return kr.apply(this,arguments)}function kr(){return kr=E(O.mark(function e(t,n,r){var i,a,s,o,u=arguments;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return i=u.length>3&&void 0!==u[3]&&u[3],a=new yr(t),e.prev=2,e.next=5,a.verify(r);case 5:s=e.sent,e.next=13;break;case 8:return e.prev=8,e.t0=e.catch(2),e.next=12,a.verify(r,!0);case 12:s=e.sent;case 13:return o=Object.assign({},n),i?Object.assign(o,{captchaResp:s}):Object.assign(o,{captchaResponse:s}),Object.assign(o,{clientType:"CLIENT_TYPE_WEB"}),Object.assign(o,{recaptchaVersion:"RECAPTCHA_ENTERPRISE"}),e.abrupt("return",o);case 18:case"end":return e.stop()}},e,null,[[2,8]])})),kr.apply(this,arguments)}function wr(e,t,n,r){return br.apply(this,arguments)}function br(){return br=E(O.mark(function e(t,n,r,i){var a,s;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!(null===(a=t._getRecaptchaConfig())||void 0===a?void 0:a.isProviderEnabled("EMAIL_PASSWORD_PROVIDER"))){e.
2next=7;break}return e.next=3,mr(t,n,r,"getOobCode"===r);case 3:return s=e.sent,e.abrupt("return",i(t,s));case 7:return e.abrupt("return",i(t,n).catch(function(){var e=E(O.mark(function e(a){var s;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(a.code!=="auth/".concat("missing-recaptcha-token")){e.next=8;break}return console.log("".concat(r," is protected by reCAPTCHA Enterprise for this project. Automatically triggering the reCAPTCHA flow and restarting the flow.")),e.next=4,mr(t,n,r,"getOobCode"===r);case 4:return s=e.sent,e.abrupt("return",i(t,s));case 8:return e.abrupt("return",Promise.reject(a));case 9:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()));case 8:case"end":return e.stop()}},e)})),br.apply(this,arguments)}function _r(e,t,n){var r=dr(e);Kt(r._canInitEmulator,r,"emulator-config-failed"),Kt(/^https?:\/\//.test(t),r,"invalid-emulator-scheme");var i=!!(null==n?void 0:n.disableWarnings),a=Er(t),s=function(e){var t=Er(e),n=/(\/\/)?([^?#/]+)/.exec(e.substr(t.length));if(!n)return{host:"",port:null};var r=n[2].split("@").pop()||"",i=/^(\[[^\]]+\])(:|$)/.exec(r);if(i){var a=i[1];return{host:a,port:Ir(r.substr(a.length+1))}}var s=b(r.split(":"),2);return{host:s[0],port:Ir(s[1])}}(t),o=s.host,u=s.port,c=null===u?"":":".concat(u);r.config.emulator={url:"".concat(a,"//").concat(o).concat(c,"/")},r.settings.appVerificationDisabledForTesting=!0,r.emulatorConfig=Object.freeze({host:o,port:u,protocol:a.replace(":",""),options:Object.freeze({disableWarnings:i})}),i||function(){function e(){var 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 Er(e){var t=e.indexOf(":");return t<0?"":e.substr(0,t+1)}function Ir(e){if(!e)return null;var t=Number(e);return isNaN(t)?null:t}var Sr=function(){function e(t,n){I(this,e),this.providerId=t,this.signInMethod=n}return T(e,[{key:"toJSON",value:function(){return Gt("not implemented")}},{key:"_getIdTokenResponse",value:function(e){return Gt("not implemented")}},{key:"_linkToIdToken",value:function(e,t){return Gt("not implemented")}},{key:"_getReauthenticationResolver",value:function(e){return Gt("not implemented")}}]),e}();function Tr(e,t){return xr.apply(this,arguments)}function xr(){return(xr=E(O.mark(function e(t,n){return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",rn(t,"POST","/v1/accounts:resetPassword",nn(t,n)));case 1:case"end":return e.stop()}},e)}))).apply(this,arguments)}function Ar(e,t){return Cr.apply(this,arguments)}function Cr(){return(Cr=E(O.mark(function e(t,n){return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",rn(t,"POST","/v1/accounts:update",n));case 1:case"end":return e.stop()}},e)}))).apply(this,arguments)}function Pr(e,t){return Or.apply(this,arguments)}function Or(){return(Or=E(O.mark(function e(t,n){return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",rn(t,"POST","/v1/accounts:signUp",n));case 1:case"end":return e.stop()}},e)}))).apply(this,arguments)}function Rr(e,t){return Nr.apply(this,arguments)}function Nr(){return(Nr=E(O.mark(function e(t,n){return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",rn(t,"POST","/v1/accounts:update",nn(t,n)));case 1:case"end":return e.stop()}},e)}))).apply(this,arguments)}function Dr(e,t){return Lr.apply(this,arguments)}function Lr(){return(Lr=E(O.mark(function e(t,n){return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",un(t,"POST","/v1/accounts:signInWithPassword",nn(t,n)));case 1:case"end":return e.stop()}},e)}))).apply(this,arguments)}function Mr(e,t){return Ur.apply(this,arguments)}function Ur(){return(Ur=E(O.mark(function e(t,n){return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",rn(t,"POST","/v1/accounts:sendOobCode",nn(t,n)));case 1:case"end":return e.stop()}},e)}))).apply(this,arguments)}function Fr(e,t){return jr.apply(this,arguments)}function jr(){return(jr=E(O.mark(function e(t,n){return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",Mr(t,n));case 1:case"end":return e.stop()}},e)}))).apply(this,arguments)}function Vr(e,t){return Br.apply(this,arguments)}function Br(){return(Br=E(O.mark(function e(t,n){return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",Mr(t,n));case 1:case"end":return e.stop()}},e)}))).apply(this,arguments)}function qr(e,t){return zr.apply(this,arguments)}function zr(){return(zr=E(O.mark(function e(t,n){return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",Mr(t,n));case 1:case"end":return e.stop()}},e)}))).apply(this,arguments)}
2function Hr(e,t){return Kr.apply(this,arguments)}function Kr(){return(Kr=E(O.mark(function e(t,n){return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",un(t,"POST","/v1/accounts:signInWithEmailLink",nn(t,n)));case 1:case"end":return e.stop()}},e)}))).apply(this,arguments)}function Gr(e,t){return Wr.apply(this,arguments)}function Wr(){return(Wr=E(O.mark(function e(t,n){return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",un(t,"POST","/v1/accounts:signInWithEmailLink",nn(t,n)));case 1:case"end":return e.stop()}},e)}))).apply(this,arguments)}var Qr=function(e){y(i,e);var t,n,r=Tt(i);function i(e,t,n){var a,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;return I(this,i),(a=r.call(this,"password",n))._email=e,a._password=t,a._tenantId=s,a}return T(i,[{key:"toJSON",value:function(){return{email:this._email,password:this._password,signInMethod:this.signInMethod,tenantId:this._tenantId}}},{key:"_getIdTokenResponse",value:(n=E(O.mark(function e(t){var n;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:e.t0=this.signInMethod,e.next="password"===e.t0?3:"emailLink"===e.t0?5:6;break;case 3:return n={returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"},e.abrupt("return",wr(t,n,"signInWithPassword",Dr));case 5:return e.abrupt("return",Hr(t,{email:this._email,oobCode:this._password}));case 6:jt(t,"internal-error");case 7:case"end":return e.stop()}},e,this)})),function(e){return n.apply(this,arguments)})},{key:"_linkToIdToken",value:(t=E(O.mark(function e(t,n){var r;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:e.t0=this.signInMethod,e.next="password"===e.t0?3:"emailLink"===e.t0?5:6;break;case 3:return r={idToken:n,returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"},e.abrupt("return",wr(t,r,"signUpPassword",Pr));case 5:return e.abrupt("return",Gr(t,{idToken:n,email:this._email,oobCode:this._password}));case 6:jt(t,"internal-error");case 7:case"end":return e.stop()}},e,this)})),function(e,n){return t.apply(this,arguments)})},{key:"_getReauthenticationResolver",value:function(e){return this._getIdTokenResponse(e)}}],[{key:"_fromEmailAndPassword",value:function(e,t){return new i(e,t,"password")}},{key:"_fromEmailAndCode",value:function(e,t){return new i(e,t,"emailLink",arguments.length>2&&void 0!==arguments[2]?arguments[2]:null)}},{key:"fromJSON",value:function(e){var 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}}]),i}(Sr);function Yr(e,t){return Xr.apply(this,arguments)}function Xr(){return(Xr=E(O.mark(function e(t,n){return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",un(t,"POST","/v1/accounts:signInWithIdp",nn(t,n)));case 1:case"end":return e.stop()}},e)}))).apply(this,arguments)}var Jr=function(e){y(n,e);var t=Tt(n);function n(){var e;return I(this,n),(e=t.apply(this,arguments)).pendingToken=null,e}return T(n,[{key:"toJSON",value:function(){return{idToken:this.idToken,accessToken:this.accessToken,secret:this.secret,n
2once:this.nonce,pendingToken:this.pendingToken,providerId:this.providerId,signInMethod:this.signInMethod}}},{key:"_getIdTokenResponse",value:function(e){return Yr(e,this.buildRequest())}},{key:"_linkToIdToken",value:function(e,t){var n=this.buildRequest();return n.idToken=t,Yr(e,n)}},{key:"_getReauthenticationResolver",value:function(e){var t=this.buildRequest();return t.autoCreate=!1,Yr(e,t)}},{key:"buildRequest",value:function(){var e={requestUri:"http://localhost",returnSecureToken:!0};if(this.pendingToken)e.pendingToken=this.pendingToken;else{var 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=re(t)}return e}}],[{key:"_fromParams",value:function(e){var t=new n(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):jt("argument-error"),t}},{key:"fromJSON",value:function(e){var t="string"==typeof e?JSON.parse(e):e,r=t.providerId,i=t.signInMethod,a=h(t,["providerId","signInMethod"]);if(!r||!i)return null;var s=new n(r,i);return s.idToken=a.idToken||void 0,s.accessToken=a.accessToken||void 0,s.secret=a.secret,s.nonce=a.nonce,s.pendingToken=a.pendingToken||null,s}}]),n}(Sr);A({},"USER_NOT_FOUND","user-not-found");var $r=function(){function e(t){var n,r,i,a,s,o;I(this,e);var u=ie(ae(t)),c=null!==(n=u.apiKey)&&void 0!==n?n:null,l=null!==(r=u.oobCode)&&void 0!==r?r:null,h=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!==(i=u.mode)&&void 0!==i?i:null);Kt(c&&l&&h,"argument-error"),this.apiKey=c,this.operation=h,this.code=l,this.continueUrl=null!==(a=u.continueUrl)&&void 0!==a?a:null,this.languageCode=null!==(s=u.languageCode)&&void 0!==s?s:null,this.tenantId=null!==(o=u.tenantId)&&void 0!==o?o:null}return T(e,null,[{key:"parseLink",value:function(t){var n=function(e){var t=ie(ae(e)).link,n=t?ie(ae(t)).deep_link_id:null,r=ie(ae(e)).deep_link_id;return(r?ie(ae(r)).link:null)||r||n||t||e}(t);try{return new e(n)}catch(r){return null}}}]),e}(),Zr=function(){function e(){I(this,e),this.providerId=e.PROVIDER_ID}return T(e,null,[{key:"credential",value:function(e,t){return Qr._fromEmailAndPassword(e,t)}},{key:"credentialWithLink",value:function(e,t){var n=$r.parseLink(t);return Kt(n,"argument-error"),Qr._fromEmailAndCode(e,n.code,n.tenantId)}}]),e}();Zr.PROVIDER_ID="password",Zr.EMAIL_PASSWORD_SIGN_IN_METHOD="password",Zr.EMAIL_LINK_SIGN_IN_METHOD="emailLink";var ei=function(){function e(t){I(this,e),this.providerId=t,this.defaultLanguageCode=null,this.customParameters={}}return T(e,[{key:"setDefaultLanguage",value:function(e){this.defaultLanguageCode=e}},{key:"setCustomParameters",value:function(e){return this.customParameters=e,this}},{key:"getCustomParameters",value:function(){return this.customParameters}}]),e}(),ti=function(e){y(n,e);var t=Tt(n);function n(){var e;return I(this,n),(e=t.apply(this,arguments)).scopes=[],e}return T(n,[{key:"addScope",value:function(e){return this.scopes.includes(e)||this.scopes.push(e),this}},{key:"getScopes",value:function(){return x(this.scopes)}}]),n}(ei),ni=function(e){y(n,e);var t=Tt(n);function n(){return I(this,n),t.call(this,"facebook.com")}return T(n,null,[{key:"credential",value:function(e){return Jr._fromParams({providerId:n.PROVIDER_ID,signInMethod:n.FACEBOOK_SIGN_IN_METHOD,accessToken:e})}},{key:"credentialFromResult",value:function(e){return n.credentialFromTaggedObject(e)}},{key:"credentialFromError",value:function(e){return n.credentialFromTaggedObject(e.customData||{})}},{key:"credentialFromTaggedObject",value:function(e){var t=e._tokenResponse;if(!t||!("oauthAccessToken"in t))return null;if(!t.oauthAccessToken)return null;try{return n.credential(t.oauthAccessToken)}catch(r){return null}}}]),n}(ti);ni.FACEBOOK_SIGN_IN_METHOD="facebook.com",ni.PROVIDER_ID="facebook.com";var ri=function(e){y(n,e);var t=Tt(n);function n(){var e;return I(this,n),(e=t.call(this,"google.com")).addScope("profile"),e}return T(n,null,[{key:"credential",value:function(e,t){return Jr._fromParams({providerId:n.PROVIDER_ID,signInMethod:n.GOOGLE_SIGN_IN_METHOD,idToken:e,accessToken:t})}},{key:"credentialFromResult",value:function(e){return n.credentialFromTaggedObject(e)}},{key:"credentialFromError",value:function(e){return n.credentialFromTaggedObject(e.customData||{})}},{key:"credentialFromTaggedObject",value:function(e){var t=e._tokenResponse;if(!t)return null;var r=t.oauthIdToken,i=t.oauthAccessToken;if(!r&&!i)return null;try{return n.credential(r,i)}catch(a){return null}}}]),n}(ti);function ii(e,t){return ai.apply(this,arguments)}function ai(){return(ai=E(O.mark(function e(t,n){return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",un(t,"POST","/v1/accounts:signUp",nn(t,n)));case 1:case"end":return e.stop()}},e)}))).apply(this,arguments)}ri.GOOGLE_SIGN_IN_METHOD="google.com",ri.PROVIDER_ID="google.com";var si=function(){function e(t){I(this,e),this.user=t.user,this.providerId=t.providerId,this._tokenResponse=t._token
2Response,this.operationType=t.operationType}var t,n;return T(e,null,[{key:"_fromIdTokenResponse",value:(n=E(O.mark(function t(n,r,i){var a,s,o,u,c=arguments;return O.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return a=c.length>3&&void 0!==c[3]&&c[3],t.next=3,zn._fromIdTokenResponse(n,i,a);case 3:return s=t.sent,o=oi(i),u=new e({user:s,providerId:o,_tokenResponse:i,operationType:r}),t.abrupt("return",u);case 7:case"end":return t.stop()}},t)})),function(e,t,r){return n.apply(this,arguments)})},{key:"_forOperation",value:(t=E(O.mark(function t(n,r,i){var a;return O.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,n._updateTokensIfNecessary(i,!0);case 2:return a=oi(i),t.abrupt("return",new e({user:n,providerId:a,_tokenResponse:i,operationType:r}));case 4:case"end":return t.stop()}},t)})),function(e,n,r){return t.apply(this,arguments)})}]),e}();function oi(e){return e.providerId?e.providerId:"phoneNumber"in e?"phone":null}var ui=function(e){y(n,e);var t=Tt(n);function n(e,r,i,a){var s,o;return I(this,n),(s=t.call(this,r.code,r.message)).operationType=i,s.user=a,Object.setPrototypeOf(v(s),n.prototype),s.customData={appName:e.name,tenantId:null!==(o=e.tenantId)&&void 0!==o?o:void 0,_serverResponse:r.customData._serverResponse,operationType:i},s}return T(n,null,[{key:"_fromErrorAndOperation",value:function(e,t,r,i){return new n(e,t,r,i)}}]),n}(J);function ci(e,t,n,r){return("reauthenticate"===t?n._getReauthenticationResolver(e):n._getIdTokenResponse(e)).catch(function(n){if(n.code==="auth/".concat("multi-factor-auth-required"))throw ui._fromErrorAndOperation(e,n,t,r);throw n})}function li(e,t){return hi.apply(this,arguments)}function hi(){return hi=E(O.mark(function e(t,n){var r,i,a=arguments;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=a.length>2&&void 0!==a[2]&&a[2],e.t0=xn,e.t1=t,e.t2=n,e.t3=t.auth,e.next=7,t.getIdToken();case 7:return e.t4=e.sent,e.t5=e.t2._linkToIdToken.call(e.t2,e.t3,e.t4),e.t6=r,e.next=12,(0,e.t0)(e.t1,e.t5,e.t6);case 12:return i=e.sent,e.abrupt("return",si._forOperation(t,"link",i));case 14:case"end":return e.stop()}},e)})),hi.apply(this,arguments)}function fi(e,t){return di.apply(this,arguments)}function di(){return di=E(O.mark(function e(t,n){var r,i,a,s,o,u,c=arguments;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=c.length>2&&void 0!==c[2]&&c[2],!rt((i=t.auth).app)){e.next=4;break}return e.abrupt("return",Promise.reject(qt(i)));case 4:return a="reauthenticate",e.prev=5,e.next=8,xn(t,ci(i,a,n,t),r);case 8:return Kt((s=e.sent).idToken,i,"internal-error"),Kt(o=Sn(s.idToken),i,"internal-error"),u=o.sub,Kt(t.uid===u,i,"user-mismatch"),e.abrupt("return",si._forOperation(t,a,s));case 17:throw e.prev=17,e.t0=e.catch(5),(null===e.t0||void 0===e.t0?void 0:e.t0.code)==="auth/".concat("user-not-found")&&jt(i,"user-mismatch"),e.t0;case 21:case"end":return e.stop()}},e,null,[[5,17]])})),di.apply(this,arguments)}function pi(e,t){return vi.apply(this,arguments)}function vi(){return vi=E(O.mark(function e(t,n){var r,i,a,s,o=arguments;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=o.length>2&&void 0!==o[2]&&o[2],!rt(t.app)){e.next=3;break}return e.abrupt("return",Promise.reject(qt(t)));case 3:return i="signIn",e.next=6,ci(t,i,n);case 6:return a=e.sent,e.next=9,si._fromIdTokenResponse(t,i,a);case 9:if(s=e.sent,r){e.next=13;break}return e.next=13,t._updateCurrentUser(s.user);case 13:return e.abrupt("return",s);case 14:case"end":return e.stop()}},e)})),vi.apply(this,arguments)}function gi(){return(gi=E(O.mark(function e(t,n){return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",pi(dr(t),n));case 1:case"end":return e.stop()}},e)}))).apply(this,arguments)}function yi(){return(yi=E(O.mark(function e(t,n){return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",fi(ce(t),n));case 1:case"end":return e.stop()}},e)}))).apply(this,arguments)}function mi(e,t,n){var r;Kt((null===(r=n.url)||void 0===r?void 0:r.length)>0,e,"invalid-continue-uri"),Kt(void 0===n.dynamicLinkDomain||n.dynamicLinkDomain.length>
20,e,"invalid-dynamic-link-domain"),t.continueUrl=n.url,t.dynamicLinkDomain=n.dynamicLinkDomain,t.canHandleCodeInApp=n.handleCodeInApp,n.iOS&&(Kt(n.iOS.bundleId.length>0,e,"missing-ios-bundle-id"),t.iOSBundleId=n.iOS.bundleId),n.android&&(Kt(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)}function ki(e){return wi.apply(this,arguments)}function wi(){return(wi=E(O.mark(function e(t){var n;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!(n=dr(t))._getPasswordPolicyInternal()){e.next=4;break}return e.next=4,n._updatePasswordPolicy();case 4:case"end":return e.stop()}},e)}))).apply(this,arguments)}function bi(){return(bi=E(O.mark(function e(t,n,r){var i,a;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return i=dr(t),a={requestType:"PASSWORD_RESET",email:n,clientType:"CLIENT_TYPE_WEB"},r&&mi(i,a,r),e.next=5,wr(i,a,"getOobCode",Vr);case 5:case"end":return e.stop()}},e)}))).apply(this,arguments)}function _i(){return _i=E(O.mark(function e(t,n,r){return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Tr(ce(t),{oobCode:n,newPassword:r}).catch(function(){var e=E(O.mark(function e(n){return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:throw n.code==="auth/".concat("password-does-not-meet-requirements")&&ki(t),n;case 2:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}());case 2:case"end":return e.stop()}},e)})),_i.apply(this,arguments)}function Ei(e,t){return Ii.apply(this,arguments)}function Ii(){return(Ii=E(O.mark(function e(t,n){return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Rr(ce(t),{oobCode:n});case 2:case"end":return e.stop()}},e)}))).apply(this,arguments)}function Si(){return(Si=E(O.mark(function e(t,n,r){var i,a,s,o;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!rt(t.app)){e.next=2;break}return e.abrupt("return",Promise.reject(qt(t)));case 2:return i=dr(t),a=wr(i,{returnSecureToken:!0,email:n,password:r,clientType:"CLIENT_TYPE_WEB"},"signUpPassword",ii),e.next=7,a.catch(function(e){throw e.code==="auth/".concat("password-does-not-meet-requirements")&&ki(t),e});case 7:return s=e.sent,e.next=10,si._fromIdTokenResponse(i,"signIn",s);case 10:return o=e.sent,e.next=13,i._updateCurrentUser(o.user);case 13:return e.abrupt("return",o);case 14:case"end":return e.stop()}},e)}))).apply(this,arguments)}function Ti(e,t,n){return rt(e.app)?Promise.reject(qt(e)):function(e,t){return gi.apply(this,arguments)}(ce(e),Zr.credential(t,n)).catch(function(){var t=E(O.mark(function t(n){return O.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:throw n.code==="auth/".concat("password-does-not-meet-requirements")&&ki(e),n;case 2:case"end":return t.stop()}},t)}));return function(e){return t.apply(this,arguments)}}())}function xi(e,t){return Ai.apply(this,arguments)}function Ai(){return(Ai=E(O.mark(function e(t,n){var r,i,a,s;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=ce(t),e.next=3,t.getIdToken();case 3:return i=e.sent,a={requestType:"VERIFY_EMAIL",idToken:i},n&&mi(r.auth,a,n),e.next=8,Fr(r.auth,a);case 8:if(s=e.sent,s.email===t.email){e.next=13;break}return e.next=13,t.reload();case 13:case"end":return e.stop()}},e)}))).apply(this,arguments)}function Ci(){return(Ci=E(O.mark(function e(t,n,r){var i,a,s,o;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return i=ce(t),e.next=3,t.getIdToken();case 3:return a=e.sent,s={requestType:"VERIFY_AND_CHANGE_EMAIL",idToken:a,newEmail:n},r&&mi(i.auth,s,r),e.next=8,qr(i.auth,s);case 8:if(o=e.sent,o.email===t.email){e.next=13;break}return e.next=13,t.reload();case 13:case"end":return e.stop()}},e)}))).apply(this,arguments)}function Pi(e,t){return Oi.apply(this,arguments)}function Oi(){return(Oi=E(O.mark(function e(t,n){return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",rn(t,"POST","/v1/accounts:update",n));case 1:case"end":return e.stop()}},e)}))).apply(this,arguments)}function Ri(){return(Ri=E(O.mark(function e(t,n){var r,i,a,s,o,u,c;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=n.displayName,i=n.photoURL,void 0!==r||void 0!==i){e.next=3;break}return e.abrupt("return");case 3:return a=ce(t),e.next=6,a.getIdToken();case 6:return s=e.sent,o={idToken:s,displayName:r,photoUrl:i,returnSecureToken:!0},e.next=10,xn(a,Pi(a.auth,o));
2case 10:return u=e.sent,a.displayName=u.displayName||null,a.photoURL=u.photoUrl||null,(c=a.providerData.find(function(e){return"password"===e.providerId}))&&(c.displayName=a.displayName,c.photoURL=a.photoURL),e.next=17,a._updateTokensIfNecessary(u);case 17:case"end":return e.stop()}},e)}))).apply(this,arguments)}function Ni(e,t){return function(e,t,n){return Di.apply(this,arguments)}(ce(e),null,t)}function Di(){return(Di=E(O.mark(function e(t,n,r){var i,a,s,o;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return i=t.auth,e.next=3,t.getIdToken();case 3:return a=e.sent,s={idToken:a,returnSecureToken:!0},n&&(s.email=n),r&&(s.password=r),e.next=9,xn(t,Ar(i,s));case 9:return o=e.sent,e.next=12,t._updateTokensIfNecessary(o,!0);case 12:case"end":return e.stop()}},e)}))).apply(this,arguments)}var Li=T(function e(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};I(this,e),this.isNewUser=t,this.providerId=n,this.profile=r}),Mi=function(e){y(n,e);var t=Tt(n);function n(e,r,i,a){var s;return I(this,n),(s=t.call(this,e,r,i)).username=a,s}return T(n)}(Li),Ui=function(e){y(n,e);var t=Tt(n);function n(e,r){return I(this,n),t.call(this,e,"facebook.com",r)}return T(n)}(Li),Fi=function(e){y(n,e);var t=Tt(n);function n(e,r){return I(this,n),t.call(this,e,"github.com",r,"string"==typeof(null==r?void 0:r.login)?null==r?void 0:r.login:null)}return T(n)}(Mi),ji=function(e){y(n,e);var t=Tt(n);function n(e,r){return I(this,n),t.call(this,e,"google.com",r)}return T(n)}(Li),Vi=function(e){y(n,e);var t=Tt(n);function n(e,r,i){return I(this,n),t.call(this,e,"twitter.com",r,i)}return T(n)}(Mi);function Bi(e){var t=e.user,n=e._tokenResponse;return t.isAnonymous&&!n?{providerId:null,isNewUser:!1,profile:null}:function(e){var t,n;if(!e)return null;var r=e.providerId,i=e.rawUserInfo?JSON.parse(e.rawUserInfo):{},a=e.isNewUser||"identitytoolkit#SignupNewUserResponse"===e.kind;if(!r&&(null==e?void 0:e.idToken)){var s=null===(n=null===(t=Sn(e.idToken))||void 0===t?void 0:t.firebase)||void 0===n?void 0:n.sign_in_provider;if(s)return new Li(a,"anonymous"!==s&&"custom"!==s?s:null)}if(!r)return null;switch(r){case"facebook.com":return new Ui(a,i);case"github.com":return new Fi(a,i);case"google.com":return new ji(a,i);case"twitter.com":return new Vi(a,i,e.screenName||null);case"custom":case"anonymous":return new Li(a,null);default:return new Li(a,r,i)}}(n)}var qi="__sak",zi=function(){function e(t,n){I(this,e),this.storageRetriever=t,this.type=n}return T(e,[{key:"_isAvailable",value:function(){try{return this.storage?(this.storage.setItem(qi,"1"),this.storage.removeItem(qi),Promise.resolve(!0)):Promise.resolve(!1)}catch(e){return Promise.resolve(!1)}}},{key:"_set",value:function(e,t){return this.storage.setItem(e,JSON.stringify(t)),Promise.resolve()}},{key:"_get",value:function(e){var t=this.storage.getItem(e);return Promise.resolve(t?JSON.parse(t):null)}},{key:"_remove",value:function(e){return this.storage.removeItem(e),Promise.resolve()}},{key:"storage",get:function(){return this.storageRetriever()}}]),e}();var Hi=function(e){y(a,e);var t,n,r,i=Tt(a);function a(){var e,t;return I(this,a),(e=i.call(this,function(){return window.localStorage},"LOCAL")).boundEventHandler=function(t,n){return e.onStorageEvent(t,n)},e.listeners={},e.localCache={},e.pollTimer=null,e.safariLocalStorageNotSynced=($n(t=W())||ir(t))&&function(){try{return!(!window||window===window.top)}catch(e){return!1}}(),e.fallbackToPolling=sr(),e._shouldAllowMigration=!0,e}return T(a,[{key:"forAllChangedKeys",value:function(e){for(var t=0,n=Object.keys(this.listeners);t<n.length;t++){var r=n[t],i=this.storage.getItem(r),a=this.localCache[r];i!==a&&e(r,a,i)}}},{key:"onStorageEvent",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(e.key){var r=e.key;if(n?this.detachListener():this.stopPolling(),this.safariLocalStorageNotSynced){var i=this.storage.getItem(r);if(e.newValue!==i)null!==e.newValue?this.storage.setItem(r,e.newValue):this.storage.removeItem(r);else if(this.localCache[r]===e.newValue&&!n)return}var a=function(){var e=t.storage.getItem(r);(n||t.localCache[r]!==e)&&t.notifyListeners(r,e)},s=this.storage.getItem(r);ar()&&s!==e.newValue&&e.newValue!==e.oldValue?setTimeout(a,10):a()}else this.forAllChangedKeys(function(e,n,r){t.notifyListeners(e,r)})}},{key:"notifyListeners",value:function(e,t){this.localCache[e]=t;var n=this.listeners[e];if(n)for(var r=0,i=Array.from(n);r<i.length;r++){(0,i[r])(t?JSON.parse(t):t)}}},{key:"startPolling",value:function(){var e=this;this.stopPolling(),this.pollTimer=setInterval(function(){e.forAllChangedKeys(function(t,n,r){e.onStorageEvent(new StorageEvent("storage",{key:t,oldValue:n,newValue:r}),!0)})},1e3)}},{key:"stopPolling",value:function(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}},{key:"attachListener",value:function(){window.addEventListener("storage",this.boundEventHandler)}},{key:"detachListener",value:function(){window.removeEventListener("storage",this.boundEventHandler)}},{key:"_addListener",value:function(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)}},{key:"_removeListener",value:function(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())}},{key:"_set",value:(r=E(O.mark(function e(t,n){return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,p(d(a.prototype),"_set",this).call(this,t,n);case 2:this.localCache[t]=JSON.stringify(n);case 3:case"end":return e.stop()}},e,this)})),function(e,t){return r.apply(this,arguments)})},{key:"_get",value:(n=E(O.mark(function e(t){var n;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,p(d(a.prototype),"_get",this).call(this,t);case 2:return n=e.sent,this.localCache[t]=JSON.stringify(n),e.abrupt("return",n);case 5:case"end":return e.stop()}},e,this)})),function(e){return n.apply(this,arguments)})},{key:"_remove",value:(t=E(O.mark(function e(t){return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,p(d(a.prototype),"_remove",this).call(this,t);case 2:delete this.localCache[t];case 3:case"end":return e.stop()}},e,this)})),function(e){return t.apply(this,arguments)})}]),a}(zi);Hi.type="LOCAL";var Ki=Hi,Gi=function(e){y(n,e);var t=Tt(n);function n(){return I(this,n),t.call(this,function(){return window.sessionStorage},"SESSION")}return T(n,[{key:"_addListener",value:function(e,t){}},{key:"_removeListener",value:function(e,t){}}]),n}(zi);Gi.type="SESSION";var Wi=Gi;function Qi(e){return Promise.all(e.map(function(){var e=E(O.mark(function e(t){var n;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,t;case 3:return n=e.sent,e.abrupt("return",{fulfilled:!0,value:n});case 7:return e.prev=7,e.t0=e.catch(0),e.abrupt("return",{fulfilled:!1,reason:e.t0});case 10:case"end":return e.stop()}},e,null,[[0,7]])}));return function(t){return e.apply(this,arguments)}}()))}var Yi=function(){function e(t){I(this,e),this.eventTarget=t,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}var t;return T(e,[{key:"isListeningto",value:function(e){return this.eventTarget===e}},{key:"handleEvent",value:(t=E(O.mark(function e(t){var n,r,i,a,s,o,u,c;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=(n=t).data,i=r.eventId,a=r.eventType,s=r.data,null==(o=this.handlersMap[a])?void 0:o.size){e.next=5;break}return e.abrupt("return");case 5:return n.ports[0].postMessage({status:"ack",eventId:i,eventType:a}),u=Array.from(o).map(function(){var e=E(O.mark(function e(t){return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",t(n.origin,s));case 1:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()),e.next=9,Qi(u);case 9:c=e.sent,n.ports[0].postMessage({status:"done",eventId:i,eventType:a,response:c});case 11:case"end":return e.stop()}},e,this)})),function(e){return t.apply(this,arguments)})},{key:"_subscribe",value:function(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)}},{key:"_unsubscribe",value:function(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)}}],[{key:"_getInstance",value:function(t){var n=this.receivers.find(function(e){return e.isListeningto(t)});if(n)return n;var r=new e(t);return this.receivers.push(r),r}}]),e}();function Xi(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10,n="",r=0;r<t;r++)n+=Math.floor(10*Math.random());return e+n}Yi.receivers=[];var Ji=function(){function e(t){I(this,e),this.target=t,this.handlers=new Set}var t;return T(e,[{key:"removeMessageHandler",value:function(e){e.messageChannel&&(e.messageChannel.port1.removeEventListener("message",e.onMessage),e.messageChannel.port1.close()),this.handlers.delete(e)}},{key:"_send",value:(t=E(O.mark(function e(t,n){var r,i,a,s,o=this,u=arguments;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=u.length>2&&void 0!==u[2]?u[2]:50,i="undefined"!=typeof MessageChannel?new MessageChannel:null){e.next=4;break}throw new Error("connection_unavailable");case 4:return e.abrupt("return",new Promise(function(e,u){var c=Xi("",20);i.port1.start();var l=setTimeout(function(){u(new Error("unsupported_event"))},r);s={messageChannel:i,onMessage:function(t){var n=t;if(n.data.eventId===c)switch(n.data.status){case"ack":clearTimeout(l),a=setTimeout(function(){u(new Error("timeout"))},3e3);break;case"done":clearTimeout(a),e(n.data.response);break;default:clearTimeout(l),clearTimeout(a),u(new Error("invalid_response"))}}},o.handlers.add(s),i.port1.addEventListener("message",s.onMessage),o.target.postMessage({eventType:t,eventId:c,data:n},[i.port2])}).finally(function(){s&&o.removeMessageHandler(s)}));case 5:case"end":return e.stop()}},e)})),function(e,n){return t.apply(this,arguments)})}]),e}();function $i(){return window}
2function Zi(e){$i().location.href=e}function ea(){return void 0!==$i().WorkerGlobalScope&&"function"==typeof $i().importScripts}function ta(){return na.apply(this,arguments)}function na(){return(na=E(O.mark(function e(){var t;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(null===navigator||void 0===navigator?void 0:navigator.serviceWorker){e.next=2;break}return e.abrupt("return",null);case 2:return e.prev=2,e.next=5,navigator.serviceWorker.ready;case 5:return t=e.sent,e.abrupt("return",t.active);case 9:return e.prev=9,e.t0=e.catch(2),e.abrupt("return",null);case 12:case"end":return e.stop()}},e,null,[[2,9]])}))).apply(this,arguments)}function ra(){var e;return(null===(e=null===navigator||void 0===navigator?void 0:navigator.serviceWorker)||void 0===e?void 0:e.controller)||null}function ia(){return ea()?self:null}var aa="firebaseLocalStorageDb",sa="firebaseLocalStorage",oa="fbase_key",ua=function(){function e(t){I(this,e),this.request=t}return T(e,[{key:"toPromise",value:function(){var e=this;return new Promise(function(t,n){e.request.addEventListener("success",function(){t(e.request.result)}),e.request.addEventListener("error",function(){n(e.request.error)})})}}]),e}();function ca(e,t){return e.transaction([sa],t?"readwrite":"readonly").objectStore(sa)}function la(){var e=indexedDB.deleteDatabase(aa);return new ua(e).toPromise()}function ha(){var e=indexedDB.open(aa,1);return new Promise(function(t,n){e.addEventListener("error",function(){n(e.error)}),e.addEventListener("upgradeneeded",function(){var t=e.result;try{t.createObjectStore(sa,{keyPath:oa})}catch(r){n(r)}}),e.addEventListener("success",E(O.mark(function n(){var r;return O.wrap(function(n){for(;;)switch(n.prev=n.next){case 0:if((r=e.result).objectStoreNames.contains(sa)){n.next=12;break}return r.close(),n.next=5,la();case 5:return n.t0=t,n.next=8,ha();case 8:n.t1=n.sent,(0,n.t0)(n.t1),n.next=13;break;case 12:t(r);case 13:case"end":return n.stop()}},n)})))})}function fa(e,t,n){return da.apply(this,arguments)}function da(){return(da=E(O.mark(function e(t,n,r){var i,a;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return a=ca(t,!0).put((A(i={},oa,n),A(i,"value",r),i)),e.abrupt("return",new ua(a).toPromise());case 2:case"end":return e.stop()}},e)}))).apply(this,arguments)}function pa(e,t){return va.apply(this,arguments)}function va(){return(va=E(O.mark(function e(t,n){var r,i;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=ca(t,!1).get(n),e.next=3,new ua(r).toPromise();case 3:return i=e.sent,e.abrupt("return",void 0===i?null:i.value);case 5:case"end":return e.stop()}},e)}))).apply(this,arguments)}function ga(e,t){var n=ca(e,!0).delete(t);return new ua(n).toPromise()}var ya=function(){function e(){I(this,e),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(function(){},function(){})}var t,n,r,i,a,s,o,u,c,l,h,f;return T(e,[{key:"_openDb",value:(f=E(O.mark(function e(){return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.db){e.next=2;break}return e.abrupt("return",this.db);case 2:return e.next=4,ha();case 4:return this.db=e.sent,e.abrupt("return",this.db);case 6:case"end":return e.stop()}},e,this)})),function(){return f.apply(this,arguments)})},{key:"_withRetries",value:(h=E(O.mark(function e(t){var n,r;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:n=0;case 1:return e.prev=2,e.next=5,this._openDb();case 5:return r=e.sent,e.next=8,t(r);case 8:return e.abrupt("return",e.sent);case 11:if(e.prev=11,e.t0=e.catch(2),!(n++>3)){e.next=15;break}throw e.t0;case 15:this.db&&(this.db.close(),this.db=void 0);case 16:e.next=1;break;case 18:case"end":return e.stop()}},e,this,[[2,11]])})),function(e){return h.apply(this,arguments)})},{key:"initializeServiceWorkerMessaging",value:(l=E(O.mark(function e(){return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",ea()?this.initializeReceiver():this.initializeSender());case 1:case"end":return e.stop()}},e,this)})),function(){return l.apply(this,arguments)})},{key:"initializeReceiver",value:(c=E(O.mark(function e(){var t=this;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:this.receiver=Yi._getInstance(ia()),this.receiver._subscribe("keyChanged",function(){var e=E(O.mark(function e(n,r){var i;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t._poll();case 2:return i=e.sent,e.abrupt("return",{keyProcessed:i.includes(r.key)});case 4:case"end":return e.stop()}},e)}));return function(t,n){return e.apply(this,arguments)}}()),this.receiver._subscribe("ping",function(){var e=E(O.mark(function e(t,n){return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",["keyChanged"]);case 1:case"end":return e.stop()}},e)}));return function(t,n){return e.apply(this,arguments)}}());case 3:case"end":return e.stop()}},e,this)})),function(){return c.apply(this,arguments)})},{key:"initializeSender",value:(u=E(O.mark(function e(){var t,n,r;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,ta();case 2:if(this.activeServiceWorker=e.sent,this.activeServiceWorker){e.next=5;break}return e.abrupt("return");case 5:return this.sender=new Ji(this.activeServiceWorker),e.next=8,this.sender._send("ping",{},800);case 8:if(r=e.sent){e.next=11;break}return e.abrupt("return");case 11:(null===(t=r[0])||void 0===t?void 0:t.fulfilled)&&(null===(n=r[0])||void 0===n?void 0:n.value.includes("keyChanged"))&&(this.serviceWorkerReceiverAvailable=!0);case 12:case"end":return e.stop()}},e,this)})),function(){return u.apply(this,arguments)})},{key:"notifyServiceWorker",value:(o=E(O.mark(function e(t){return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this.sender&&this.activeServiceWorker&&ra()===this.activeServiceWorker){e.next=2;break}return e.abrupt("return");case 2:return e.prev=2,e.next=5,this.sender._send("keyChanged",{key:t},this.serviceWorkerReceiverAvailable?800:50);case 5:e.next=9;break;case 7:e.prev=7,e.t0=e.catch(2);case 9:case"end":return e.stop()}},e,this,[[2,7]])})),function(e){return o.apply(this,arguments)})},{key:"_isAvailable",value:(s=E(O.mark(function e(){var t;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,indexedDB){e.next=3;break}return e.abrupt("return",!1);case 3:return e.next=5,ha();case 5:return t=e.sent,e.next=8,fa(t,qi,"1");case 8:return e.next=10,ga(t,qi);case 10:return e.abrupt("return",!0);case 13:e.prev=13,e.t0=e.catch(0);case 15:return e.abrupt("return",!1);case 16:case"end":return e.stop()}},e,null,[[0,13]])})),function(){return s.apply(this,arguments)})},{key:"_withPendingWrite",value:(a=E(O.mark(function e(t){return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return this.pendingWrites++,e.prev=1,e.next=4,t();case 4:return e.prev=4,this.pendingWrites--,e.finish(4);case 7:case"end":return e.stop()}},e,this,[[1,,4,7]])})),function(e){return a.apply(this,arguments)})},{key:"_set",value:(i=E(O.mark(function e(t,n){var r=this;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._withPendingWrite(E(O.mark(function e(){return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,r._withRetries(function(e){return fa(e,t,n)});case 2:return r.localCache[t]=n,e.abrupt("return",r.notifyServiceWorker(t));case 4:case"end":return e.stop()}},e)}))));case 1:case"end":return e.stop()}},e,this)})),function(e,t){return i.apply(this,arguments)})},{key:"_get",value:(r=E(O.mark(function e(t){var n;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._withRetries(function(e){return pa(e,t)});case 2:return n=e.sent,this.localCache[t]=n,e.abrupt("return",n);case 5:case"end":return e.stop()}},e,this)})),function(e){return r.apply(this,arguments)})},{key:"_remove",value:(n=E(O.mark(function e(t){var n=this;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._withPendingWrite(E(O.mark(function e(){return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,n._withRetries(function(e){return ga(e,t)});case 2:return delete n.localCache[t],e.abrupt("return",n.notifyServiceWorker(t));case 4:case"end":return e.stop()}},e)}))));case 1:case"end":return e.stop()}},e,this)})),function(e){return n.apply(this,arguments)})},{key:"_poll",value:(t=E(O.mark(function e(){var t,n,r,i,a,s,o,u,c,l,h;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._withRetries(function(e){var t=ca(e,!1).getAll();
2return new ua(t).toPromise()});case 2:if(t=e.sent){e.next=5;break}return e.abrupt("return",[]);case 5:if(0===this.pendingWrites){e.next=7;break}return e.abrupt("return",[]);case 7:if(n=[],r=new Set,0!==t.length){i=xt(t);try{for(i.s();!(a=i.n()).done;)s=a.value,o=s.fbase_key,u=s.value,r.add(o),JSON.stringify(this.localCache[o])!==JSON.stringify(u)&&(this.notifyListeners(o,u),n.push(o))}catch(f){i.e(f)}finally{i.f()}}for(c=0,l=Object.keys(this.localCache);c<l.length;c++)h=l[c],this.localCache[h]&&!r.has(h)&&(this.notifyListeners(h,null),n.push(h));return e.abrupt("return",n);case 12:case"end":return e.stop()}},e,this)})),function(){return t.apply(this,arguments)})},{key:"notifyListeners",value:function(e,t){this.localCache[e]=t;var n=this.listeners[e];if(n)for(var r=0,i=Array.from(n);r<i.length;r++){(0,i[r])(t)}}},{key:"startPolling",value:function(){var e=this;this.stopPolling(),this.pollTimer=setInterval(E(O.mark(function t(){return O.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",e._poll());case 1:case"end":return t.stop()}},t)})),800)}},{key:"stopPolling",value:function(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}},{key:"_addListener",value:function(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)}},{key:"_removeListener",value:function(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()}}]),e}();ya.type="LOCAL";var ma=ya;function ka(e,t){return t?Kn(t):(Kt(e._popupRedirectResolver,e,"argument-error"),e._popupRedirectResolver)}new Jt(3e4,6e4);var wa=function(e){y(n,e);var t=Tt(n);function n(e){var r;return I(this,n),(r=t.call(this,"custom","custom")).params=e,r}return T(n,[{key:"_getIdTokenResponse",value:function(e){return Yr(e,this._buildIdpRequest())}},{key:"_linkToIdToken",value:function(e,t){return Yr(e,this._buildIdpRequest(t))}},{key:"_getReauthenticationResolver",value:function(e){return Yr(e,this._buildIdpRequest())}},{key:"_buildIdpRequest",value:function(e){var 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}}]),n}(Sr);function ba(e){return pi(e.auth,new wa(e),e.bypassAuthState)}function _a(e){var t=e.auth,n=e.user;return Kt(n,t,"internal-error"),fi(n,new wa(e),e.bypassAuthState)}function Ea(e){return Ia.apply(this,arguments)}function Ia(){return(Ia=E(O.mark(function e(t){var n,r;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.auth,Kt(r=t.user,n,"internal-error"),e.abrupt("return",li(r,new wa(t),t.bypassAuthState));case 3:case"end":return e.stop()}},e)}))).apply(this,arguments)}var Sa=function(){function e(t,n,r,i){var a=arguments.length>4&&void 0!==arguments[4]&&arguments[4];I(this,e),this.auth=t,this.resolver=r,this.user=i,this.bypassAuthState=a,this.pendingPromise=null,this.eventManager=null,this.filter=Array.isArray(n)?n:[n]}var t;return T(e,[{key:"execute",value:function(){var e=this;return new Promise(function(){var t=E(O.mark(function t(n,r){return O.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return e.pendingPromise={resolve:n,reject:r},t.prev=1,t.next=4,e.resolver._initialize(e.auth);case 4:return e.eventManager=t.sent,t.next=7,e.onExecution();case 7:e.eventManager.registerConsumer(e),t.next=13;break;case 10:t.prev=10,t.t0=t.catch(1),e.reject(t.t0);case 13:case"end":return t.stop()}},t,null,[[1,10]])}));return function(e,n){return t.apply(this,arguments)}}())}},{key:"onAuthEvent",value:(t=E(O.mark(function e(t){var n,r,i,a,s,o,u;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.urlResponse,r=t.sessionId,i=t.postBody,a=t.tenantId,s=t.error,o=t.type,!s){e.next=4;break}return this.reject(s),e.abrupt("return");case 4:return u={auth:this.auth,requestUri:n,sessionId:r,tenantId:a||void 0,postBody:i||void 0,user:this.user,bypassAuthState:this.bypassAuthState},e.prev=5,e.t0=this,e.next=9,this.getIdpTask(o)(u);case 9:e.t1=e.sent,e.t0.resolve.call(e.t0,e.t1),e.next=16;break;case 13:e.prev=13,e.t2=e.catch(5),this.reject(e.t2);case 16:case"end":return e.stop()}},e,this,[[5,13]])})),function(e){return t.apply(this,arguments)})},{key:"onError",value:function(e){this.reject(e)}},{key:"getIdpTask",value:function(e){switch(e){case"signInViaPopup":case"signInViaRedirect":return ba;case"linkViaPopup":case"linkViaRedirect":return Ea;case"reauthViaPopup":case"reauthViaRedirect":return _a;default:jt(this.auth,"internal-error")}}},{key:"resolve",value:function(e){Wt(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(e),this.unregisterAndCleanUp()}},{key:"reject",value:function(e){Wt(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.reject(e),this.unregisterAndCleanUp()}},{key:"unregisterAndCleanUp",value:function(){this.eventManager&&this.eventManager.unregisterConsumer(this),this.pendingPromise=null,this.cleanUp()}}]),e}(),Ta=new Jt(2e3,1e4);function xa(){return(xa=E(O.mark(function e(t,n,r){var i,a,s;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!rt(t.app)){e.next=2;break}return e.abrupt("return",Promise.reject(Vt(t,"operation-not-supported-in-this-environment")));case 2:return i=dr(t),zt(t,n,ei),a=ka(i,r),s=new Ca(i,"signInViaPopup",n,a),e.abrupt("return",s.executeNotNull());case 7:case"end":return e.stop()}},e)}))).apply(this,arguments)}function Aa(){return(Aa=E(O.mark(function e(t,n,r){var i,a,s;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!rt((i=ce(t)).auth.app)){e.next=3;break}return e.abrupt("return",Promise.reject(Vt(i.auth,"operation-not-supported-in-this-environment")));case 3:return zt(i.auth,n,ei),a=ka(i.auth,r),s=new Ca(i.auth,"reauthViaPopup",n,a,i),e.abrupt("return",s.executeNotNull());case 7:case"end":return e.stop()}},e)}))).apply(this,arguments)}var Ca=function(e){y(i,e);var t,n,r=Tt(i);function i(e,t,n,a,s){var o;return I(this,i),(o=r.call(this,e,t,a,s)).provider=n,o.authWindow=null,o.pollId=null,i.currentPopupAction&&i.currentPopupAction.cancel(),i.currentPopupAction=v(o),o}return T(i,[{key:"executeNotNull",value:(n=E(O.mark(function e(){var t;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.execute();case 2:return Kt(t=e.sent,this.auth,"internal-error"),e.abrupt("return",t);case 5:case"end":return e.stop()}},e,this)})),function(){return n.apply(this,arguments)})},{key:"onExecution",value:(t=E(O.mark(function e(){var t,n=this;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return Wt(1===this.filter.length,"Popup operations only handle one event"),t=Xi(),e.next=4,this.resolver._openPopup(this.auth,this.provider,this.filter[0],t);case 4:this.authWindow=e.sent,this.authWindow.associatedEvent=t,this.resolver._originValidation(this.auth).catch(function(e){n.reject(e)}),this.resolver._isIframeWebStorageSupported(this.auth,function(e){e||n.reject(Vt(n.auth,"web-storage-unsupported"))}),this.pollUserCancellation();case 9:case"end":return e.stop()}},e,this)})),function(){return t.apply(this,arguments)})},{key:"eventId",get:function(){var e;return(null===(e=this.authWindow)||void 0===e?void 0:e.associatedEvent)||null}},{key:"cancel",value:function(){this.reject(Vt(this.auth,"cancelled-popup-request"))}},{key:"cleanUp",value:function(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,i.currentPopupAction=null}},{key:"pollUserCancellation",value:function(){var e=this;!function t(){var n,r;(null===(r=null===(n=e.authWindow)||void 0===n?void 0:n.window)||void 0===r?void 0:r.closed)?e.pollId=window.setTimeout(function(){e.pollId=null,e.reject(Vt(e.auth,"popup-closed-by-user"))},8e3):e.pollId=window.setTimeout(t,Ta.get())}()}}]),i}(Sa);Ca.currentPopupAction=null;var Pa=new Map,Oa=function(e){y(a,e);var t,n,r,i=Tt(a);function a(e,t){var n,r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return I(this,a),(n=i.call(this,e,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],t,void 0,r)).eventId=null,n}return T(a,[{key:"execute",value:(r=E(O.mark(function e(){var t,n;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t=Pa.get(this.auth._key())){e.next=21;break}return e.prev=2,e.next=5,Ra(this.resolver,this.auth);case 5:if(!e.sent){e.next=12;break}return e.next=9,p(d(a.prototype),"execute",this).call(this);case 9:e.t0=e.sent,e.next=13;break;case 12:e.t0=null;case 13:n=e.t0,t=function(){return Promise.resolve(n)},e.next=20;break;case 17:e.prev=17,e.t1=e.catch(2),t=function(){return Promise.reject(e.t1)};case 20:Pa.set(this.auth._key(),t);case 21:return this.bypassAuthState||Pa.set(this.auth._key(),function(){return Promise.resolve(null)}),e.abrupt("return",t());case 23:case"end":return e.stop()}},e,this,[[2,17]])})),function(){return r.apply(this,arguments)})},{key:"onAuthEvent",value:(n=E(O.mark(function e(t){var n;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if("signInViaRedirect"!==t.type){e.next=4;break}return e.abrupt("return",p(d(a.prototype),"onAuthEvent",this).call(this,t));case 4:if("unknown"!==t.type){e.next=7;break}return this.resolve(null),e.abrupt("return");
2case 7:if(!t.eventId){e.next=17;break}return e.next=10,this.auth._redirectUserForId(t.eventId);case 10:if(!(n=e.sent)){e.next=16;break}return this.user=n,e.abrupt("return",p(d(a.prototype),"onAuthEvent",this).call(this,t));case 16:this.resolve(null);case 17:case"end":return e.stop()}},e,this)})),function(e){return n.apply(this,arguments)})},{key:"onExecution",value:(t=E(O.mark(function e(){return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:case"end":return e.stop()}},e)})),function(){return t.apply(this,arguments)})},{key:"cleanUp",value:function(){}}]),a}(Sa);function Ra(e,t){return Na.apply(this,arguments)}function Na(){return(Na=E(O.mark(function e(t,n){var r,i,a;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=Ma(n),i=La(t),e.next=4,i._isAvailable();case 4:if(e.sent){e.next=6;break}return e.abrupt("return",!1);case 6:return e.next=8,i._get(r);case 8:return e.t0=e.sent,a="true"===e.t0,e.next=12,i._remove(r);case 12:return e.abrupt("return",a);case 13:case"end":return e.stop()}},e)}))).apply(this,arguments)}function Da(e,t){Pa.set(e._key(),t)}function La(e){return Kn(e._redirectPersistence)}function Ma(e){return Qn("pendingRedirect",e.config.apiKey,e.name)}function Ua(e,t){return Fa.apply(this,arguments)}function Fa(){return Fa=E(O.mark(function e(t,n){var r,i,a,s,o,u=arguments;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=u.length>2&&void 0!==u[2]&&u[2],!rt(t.app)){e.next=3;break}return e.abrupt("return",Promise.reject(qt(t)));case 3:return i=dr(t),a=ka(i,n),s=new Oa(i,a,r),e.next=8,s.execute();case 8:if(!(o=e.sent)||r){e.next=15;break}return delete o.user._redirectEventId,e.next=13,i._persistUserIfCurrent(o.user);case 13:return e.next=15,i._setRedirectUser(null,n);case 15:return e.abrupt("return",o);case 16:case"end":return e.stop()}},e)})),Fa.apply(this,arguments)}var ja=function(){function e(t){I(this,e),this.auth=t,this.cachedEventUids=new Set,this.consumers=new Set,this.queuedRedirectEvent=null,this.hasHandledPotentialRedirect=!1,this.lastProcessedEventTime=Date.now()}return T(e,[{key:"registerConsumer",value:function(e){this.consumers.add(e),this.queuedRedirectEvent&&this.isEventForConsumer(this.queuedRedirectEvent,e)&&(this.sendToConsumer(this.queuedRedirectEvent,e),this.saveEventToCache(this.queuedRedirectEvent),this.queuedRedirectEvent=null)}},{key:"unregisterConsumer",value:function(e){this.consumers.delete(e)}},{key:"onEvent",value:function(e){var t=this;if(this.hasEventBeenHandled(e))return!1;var n=!1;return this.consumers.forEach(function(r){t.isEventForConsumer(e,r)&&(n=!0,t.sendToConsumer(e,r),t.saveEventToCache(e))}),this.hasHandledPotentialRedirect||!function(e){switch(e.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return Ba(e);default:return!1}}(e)||(this.hasHandledPotentialRedirect=!0,n||(this.queuedRedirectEvent=e,n=!0)),n}},{key:"sendToConsumer",value:function(e,t){var n;if(e.error&&!Ba(e)){var r=(null===(n=e.error.code)||void 0===n?void 0:n.split("auth/")[1])||"internal-error";t.onError(Vt(this.auth,r))}else t.onAuthEvent(e)}},{key:"isEventForConsumer",value:function(e,t){var n=null===t.eventId||!!e.eventId&&e.eventId===t.eventId;return t.filter.includes(e.type)&&n}},{key:"hasEventBeenHandled",value:function(e){return Date.now()-this.lastProcessedEventTime>=6e5&&this.cachedEventUids.clear(),this.cachedEventUids.has(Va(e))}},{key:"saveEventToCache",value:function(e){this.cachedEventUids.add(Va(e)),this.lastProcessedEventTime=Date.now()}}]),e}();function Va(e){return[e.type,e.eventId,e.sessionId,e.tenantId].filter(function(e){return e}).join("-")}function Ba(e){var t=e.type,n=e.error;return"unknown"===t&&(null==n?void 0:n.code)==="auth/".concat("no-auth-event")}function qa(e){return za.apply(this,arguments)}function za(){return za=E(O.mark(function e(t){var n,r=arguments;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=r.length>1&&void 0!==r[1]?r[1]:{},e.abrupt("return",rn(t,"GET","/v1/projects",n));case 2:case"end":return e.stop()}},e)})),za.apply(this,arguments)}var Ha=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,Ka=/^https?/;function Ga(){return(Ga=E(O.mark(function e(t){var n,r,i,a,s;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!t.config.emulator){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,qa(t);case 4:n=e.sent,r=n.authorizedDomains,i=xt(r),e.prev=7,i.s();case 9:if((a=i.n()).done){e.next=20;break}if(s=a.value,e.prev=11,!Wa(s)){e.next=14;break}return e.abrupt("return");case 14:e.next=18;break;case 16:e.prev=16,e.t0=e.catch(11);case 18:e.next=9;break;case 20:e.next=25;break;case 22:e.prev=22,e.t1=e.catch(7),i.e(e.t1);case 25:return e.prev=25,i.f(),e.finish(25);case 28:jt(t,"unauthorized-domain");case 29:case"end":return e.stop()}},e,null,[[7,22,25,28],[11,16]])}))).apply(this,arguments)}function Wa(e){var t=Qt(),n=new URL(t),r=n.protocol,i=n.hostname;if(e.startsWith("chrome-extension://")){var a=new URL(e);return""===a.hostname&&""===i?"chrome-extension:"===r&&e.replace("chrome-extension://","")===t.replace("chrome-extension://",""):"chrome-extension:"===r&&a.hostname===i}if(!Ka.test(r))return!1;if(Ha.test(e))return i===e;var s=e.replace(/\./g,"\\.");return new RegExp("^(.+\\."+s+"|"+s+")$","i").test(i)}var Qa=new Jt(3e4,6e4);function Ya(){var e=$i().___jsl;if(null==e?void 0:e.H)for(var t=0,n=Object.keys(e.H);t<n.length;t++){var r=n[t];if(e.H[r].r=e.H[r].r||[],e.H[r].L=e.H[r].L||[],e.H[r].r=x(e.H[r].L),e.CP)for(var i=0;i<e.CP.length;i++)e.CP[i]=null}}function Xa(e){return new Promise(function(t,n){var r,i,a;function s(){Ya(),gapi.load("gapi.iframes",{callback:function(){t(gapi.iframes.getContext())},ontimeout:function(){Ya(),n(Vt(e,"network-request-failed"))},timeout:Qa.get()})}if(null===(i=null===(r=$i().gapi)||void 0===r?void 0:r.iframes)||void 0===i?void 0:i.Iframe)t(gapi.iframes.getContext());else{if(!(null===(a=$i().gapi)||void 0===a?void 0:a.load)){var o="__".concat("iframefcb").concat(Math.floor(1e6*Math.random()));return $i()[o]=function(){gapi.load?s():n(Vt(e,"network-request-failed"))},gr("".concat(vr.gapiScript,"?onload=").concat(o)).catch(function(e){return n(e)})}s()}}).catch(function(e){throw Ja=null,e})}var Ja=null;function $a(e){return Ja=Ja||Xa(e)}var Za=new Jt(5e3,15e3),es={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},ts=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function ns(e){var t=e.config;Kt(t.authDomain,e,"auth-domain-config-required");var n=t.emulator?$t(t,"emulator/auth/iframe"):"https://".concat(e.config.authDomain,"/").concat("__/auth/iframe"),r={apiKey:t.apiKey,appName:e.n
2ame,v:ot},i=ts.get(e.config.apiHost);i&&(r.eid=i);var a=e._getFrameworks();return a.length&&(r.fw=a.join(",")),"".concat(n,"?").concat(re(r).slice(1))}function rs(e){return is.apply(this,arguments)}function is(){return is=E(O.mark(function e(t){var n,r;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,$a(t);case 2:return n=e.sent,Kt(r=$i().gapi,t,"internal-error"),e.abrupt("return",n.open({where:document.body,url:ns(t),messageHandlersFilter:r.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:es,dontclear:!0},function(e){return new Promise(function(){var n=E(O.mark(function n(r,i){var a,s,o;return O.wrap(function(n){for(;;)switch(n.prev=n.next){case 0:return o=function(){$i().clearTimeout(s),r(e)},n.next=3,e.restyle({setHideOnLeave:!1});case 3:a=Vt(t,"network-request-failed"),s=$i().setTimeout(function(){i(a)},Za.get()),e.ping(o).then(o,function(){i(a)});case 6:case"end":return n.stop()}},n)}));return function(e,t){return n.apply(this,arguments)}}())}));case 6:case"end":return e.stop()}},e)})),is.apply(this,arguments)}var as={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"},ss=function(){function e(t){I(this,e),this.window=t,this.associatedEvent=null}return T(e,[{key:"close",value:function(){if(this.window)try{this.window.close()}catch(e){}}}]),e}();function os(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:500,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:600,a=Math.max((window.screen.availHeight-i)/2,0).toString(),s=Math.max((window.screen.availWidth-r)/2,0).toString(),o="",u=Object.assign(Object.assign({},as),{width:r.toString(),height:i.toString(),top:a,left:s}),c=W().toLowerCase();n&&(o=Zn(c)?"_blank":n),Jn(c)&&(t=t||"http://localhost",u.scrollbars="yes");var l=Object.entries(u).reduce(function(e,t){var n=b(t,2),r=n[0],i=n[1];return"".concat(e).concat(r,"=").concat(i,",")},"");if(function(){var e;return ir(arguments.length>0&&void 0!==arguments[0]?arguments[0]:W())&&!!(null===(e=window.navigator)||void 0===e?void 0:e.standalone)}(c)&&"_self"!==o)return function(e,t){var n=document.createElement("a");n.href=e,n.target=t;var 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||"",o),new ss(null);var h=window.open(t||"",o,l);Kt(h,e,"popup-blocked");try{h.focus()}catch(f){}return new ss(h)}var us=encodeURIComponent("fac");function cs(e,t,n,r,i,a){return ls.apply(this,arguments)}function ls(){return(ls=E(O.mark(function e(t,n,r,i,a,s){var o,u,c,l,h,f,d,p,v,g,y,m,k;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(Kt(t.config.authDomain,t,"auth-domain-config-required"),Kt(t.config.apiKey,t,"invalid-api-key"),o={apiKey:t.config.apiKey,appName:t.name,authType:r,redirectUrl:i,v:ot,eventId:a},n instanceof ei)for(n.setDefaultLanguage(t.languageCode),o.providerId=n.providerId||"",ee(n.getCustomParameters())||(o.customParameters=JSON.stringify(n.getCustomParameters())),u=0,c=Object.entries(s||{});u<c.length;u++)l=b(c[u],2),h=l[0],f=l[1],o[h]=f;for(n instanceof ti&&(d=n.getScopes().filter(function(e){return""!==e})).length>0&&(o.scopes=d.join(",")),t.tenantId&&(o.tid=t.tenantId),p=o,v=0,g=Object.keys(p);v<g.length;v++)y=g[v],void 0===p[y]&&delete p[y];return e.next=10,t._getAppCheckToken();case 10:return m=e.sent,k=m?"#".concat(us,"=").concat(encodeURIComponent(m)):"",e.abrupt("return","".concat(hs(t),"?").concat(re(p).slice(1)).concat(k));case 13:case"end":return e.stop()}},e)}))).apply(this,arguments)}function hs(e){var t=e.config;return t.emulator?$t(t,"emulator/auth/handler"):"https://".concat(t.authDomain,"/").concat("__/auth/handler")}var fs="webStorageSupport",ds=function(){function e(){I(this,e),this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=Wi,this._completeRedirectFn=Ua,this._overrideRedirectResult=Da}var t,n,r;return T(e,[{key:"_openPopup",value:(r=E(O.mark(function e(t,n,r,i){var a,s;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return Wt(null===(a=this.eventManagers[t._key()])||void 0===a?void 0:a.manager,"_initialize() not called before _openPopup()"),e.next=3,cs(t,n,r,Qt(),i);case 3:return s=e.sent,e.abrupt("return",os(t,s,Xi()));case 5:case"end":return e.stop()}},e,this)})),function(e,t,n,i){return r.apply(this,arguments)})},{key:"_openRedirect",value:(n=E(O.mark(function e(t,n,r,i){return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._originValidation(t);case 2:return e.next=4,cs(t,n,r,Qt(),i);case 4:return Zi(e.sent),e.abrupt("return",new Promise(function(){}));case 7:case"end":return e.stop()}},e,this)})),function(e,t,r,i){return n.apply(this,arguments)})},{key:"_initialize",value:function(e){var t=this,n=e._key();if(this.eventManagers[n]){var r=this.eventManagers[n],i=r.manager,a=r.promise;return i?Promise.resolve(i):(Wt(a,"If manager is not set, promise should be"),a)}var s=this.initAndGetManager(e);return this.eventManagers[n]={promise:s},s.catch(function(){delete t.eventManagers[n]}),s}},{key:"initAndGetManager",value:(t=E(O.mark(function e(t){var n,r;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,rs(t);case 2:return n=e.sent,r=new ja(t),n.register("authEvent",function(e){return Kt(null==e?void 0:e.authEvent,t,"invali
2d-auth-event"),{status:r.onEvent(e.authEvent)?"ACK":"ERROR"}},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[t._key()]={manager:r},this.iframes[t._key()]=n,e.abrupt("return",r);case 8:case"end":return e.stop()}},e,this)})),function(e){return t.apply(this,arguments)})},{key:"_isIframeWebStorageSupported",value:function(e,t){this.iframes[e._key()].send(fs,{type:fs},function(n){var r,i=null===(r=null==n?void 0:n[0])||void 0===r?void 0:r[fs];void 0!==i&&t(!!i),jt(e,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}},{key:"_originValidation",value:function(e){var t=e._key();return this.originValidationPromises[t]||(this.originValidationPromises[t]=function(e){return Ga.apply(this,arguments)}(e)),this.originValidationPromises[t]}},{key:"_shouldInitProactively",get:function(){return sr()||$n()||ir()}}]),e}(),ps=ds,vs="@firebase/auth",gs="1.7.4",ys=function(){function e(t){I(this,e),this.auth=t,this.internalListeners=new Map}var t;return T(e,[{key:"getUid",value:function(){var e;return this.assertAuthConfigured(),(null===(e=this.auth.currentUser)||void 0===e?void 0:e.uid)||null}},{key:"getToken",value:(t=E(O.mark(function e(t){var n;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return this.assertAuthConfigured(),e.next=3,this.auth._initializationPromise;case 3:if(this.auth.currentUser){e.next=5;break}return e.abrupt("return",null);case 5:return e.next=7,this.auth.currentUser.getIdToken(t);case 7:return n=e.sent,e.abrupt("return",{accessToken:n});case 9:case"end":return e.stop()}},e,this)})),function(e){return t.apply(this,arguments)})},{key:"addAuthTokenListener",value:function(e){if(this.assertAuthConfigured(),!this.internalListeners.has(e)){var t=this.auth.onIdTokenChanged(function(t){e((null==t?void 0:t.stsTokenManager.accessToken)||null)});this.internalListeners.set(e,t),this.updateProactiveRefresh()}}},{key:"removeAuthTokenListener",value:function(e){this.assertAuthConfigured();var t=this.internalListeners.get(e);t&&(this.internalListeners.delete(e),t(),this.updateProactiveRefresh())}},{key:"assertAuthConfigured",value:function(){Kt(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}},{key:"updateProactiveRefresh",value:function(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}}]),e}();var ms,ks=K("authIdTokenMaxAge")||300,ws=null;function bs(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ct(),t=nt(e,"auth");if(t.isInitialized())return t.getImmediate();var n,r=function(e,t){var n=nt(e,"auth");if(n.isInitialized()){var r=n.getImmediate();if(te(n.getOptions(),null!=t?t:{}))return r;jt(r,"already-initialized")}return n.initialize({options:t})}(e,{popupRedirectResolver:ps,persistence:[ma,Ki,Wi]}),i=K("authTokenSyncURL");if(i&&"boolean"==typeof isSecureContext&&isSecureContext){var a=new URL(i,location.origin);if(location.origin===a.origin){var s=(n=a.toString(),function(){var e=E(O.mark(function e(t){var r,i,a;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(e.t0=t,!e.t0){e.next=5;break}return e.next=4,t.getIdTokenResult();case 4:e.t0=e.sent;case 5:if(r=e.t0,!((i=r&&((new Date).getTime()-Date.parse(r.issuedAtTime))/1e3)&&i>ks)){e.next=9;break}return e.abrupt("return");case 9:if(a=null==r?void 0:r.token,ws!==a){e.next=12;break}return e.abrupt("return");case 12:return ws=a,e.next=15,fetch(n,{method:a?"POST":"DELETE",headers:a?{Authorization:"Bearer ".concat(a)}:{}});case 15:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}());!function(e,t,n){ce(e).beforeAuthStateChanged(t,n)}(r,s,function(){return s(r.currentUser)}),function(e,t,n,r){ce(e).onIdTokenChanged(t,n,r)}(r,function(e){return s(e)})}}var o,u,c,l=(o="auth",null===(c=null===(u=z())||void 0===u?void 0:u.emulatorHosts)||void 0===c?void 0:c[o]);return l&&_r(r,"http://".concat(l)),r}vr={loadJS:function(e){return new Promise(function(t,n){var r,i,a=document.createElement("script");a.setAttribute("src",e),a.onload=t,a.onerror=function(e){var t=Vt("internal-error");t.customData=e,n(t)},a.type="text/javascript",a.charset="UTF-8",(null!==(i=null===(r=document.getElementsByTagName("head"))||void 0===r?void 0:r[0])&&void 0!==i?i:document).appendChild(a)})},gapiScript:"https://apis.google.com/js/api.js",recaptchaV2Script:"https://www.google.com/recaptcha/api.js",recaptchaEnterpriseScript:"https://www.google.com/recaptcha/enterprise.js?render="},ms="Browser",tt(new fe("auth",function(e,t){var n=t.options,r=e.getProvider("app").getImmediate(),i=e.getProvider("heartbeat"),a=e.getProvider("app-check-internal"),s=r.options,o=s.apiKey,u=s.authDomain;Kt(o&&!o.includes(":"),"invalid-api-key",{appName:r.name});var c={apiKey:o,authDomain:u,clientPlatform:ms,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:or(ms)},l=new fr(r,i,a,c);return function(e,t){var n=(null==t?void 0:t.persistence)||[],r=(Array.isArray(n)?n:[n]).map(Kn);(null==t?void 0:t.errorMap)&&e._updateErrorMap(t.errorMap),e._initializeWithPersistence(r,null==t?void 0:t.popupRedirectResolver)}(l,n),l},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback(function(e,t,n){e.getProvider("auth-internal").initialize()})),tt(new fe("auth-internal",function(e){return function(e){return new ys(e)}(dr(e.getProvider("auth").getImmediate()))},"PRIVATE").setInstantiationMode("EXPLICIT")),lt(vs,gs,function(e){switch(e){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";case"WebExtension":return"web-extension";default:return}}(ms)),lt(vs,gs,"esm2017");var _s=Object.prototype;var Es=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||_s)};var Is=function(e,t){return function(n){return e(t(n))}},Ss=Is(Object.keys,Object),Ts=Es,xs=Ss,As=Object.prototype.hasOwnProperty;var Cs=function(e){if(!Ts(e))return xs(e);var t=[];for(var n in Object(e))As.call(e,n)&&"constructor"!=n&&t.push(n);return t}
2,Ps="object"==l(C)&&C&&C.Object===Object&&C,Os=Ps,Rs="object"==("undefined"==typeof self?"undefined":l(self))&&self&&self.Object===Object&&self,Ns=Os||Rs||Function("return this")(),Ds=Ns.Symbol,Ls=Ds,Ms=Object.prototype,Us=Ms.hasOwnProperty,Fs=Ms.toString,js=Ls?Ls.toStringTag:void 0;var Vs=function(e){var t=Us.call(e,js),n=e[js];try{e[js]=void 0;var r=!0}catch(a){}var i=Fs.call(e);return r&&(t?e[js]=n:delete e[js]),i},Bs=Object.prototype.toString;var qs=Vs,zs=function(e){return Bs.call(e)},Hs=Ds?Ds.toStringTag:void 0;var Ks=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":Hs&&Hs in Object(e)?qs(e):zs(e)};var Gs=function(e){var t=l(e);return null!=e&&("object"==t||"function"==t)},Ws=Ks,Qs=Gs;var Ys,Xs=function(e){if(!Qs(e))return!1;var t=Ws(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},Js=Ns["__core-js_shared__"],$s=(Ys=/[^.]+$/.exec(Js&&Js.keys&&Js.keys.IE_PROTO||""))?"Symbol(src)_1."+Ys:"";var Zs=function(e){return!!$s&&$s in e},eo=Function.prototype.toString;var to=function(e){if(null!=e){try{return eo.call(e)}catch(t){}try{return e+""}catch(t){}}return""},no=Xs,ro=Zs,io=Gs,ao=to,so=/^\[object .+?Constructor\]$/,oo=Function.prototype,uo=Object.prototype,co=oo.toString,lo=uo.hasOwnProperty,ho=RegExp("^"+co.call(lo).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var fo=function(e){return!(!io(e)||ro(e))&&(no(e)?ho:so).test(ao(e))},po=function(e,t){return null==e?void 0:e[t]};var vo=function(e,t){var n=po(e,t);return fo(n)?n:void 0},go=vo(Ns,"DataView"),yo=vo(Ns,"Map"),mo=go,ko=yo,wo=vo(Ns,"Promise"),bo=vo(Ns,"Set"),_o=vo(Ns,"WeakMap"),Eo=Ks,Io=to,So="[object Map]",To="[object Promise]",xo="[object Set]",Ao="[object WeakMap]",Co="[object DataView]",Po=Io(mo),Oo=Io(ko),Ro=Io(wo),No=Io(bo),Do=Io(_o),Lo=Eo;(mo&&Lo(new mo(new ArrayBuffer(1)))!=Co||ko&&Lo(new ko)!=So||wo&&Lo(wo.resolve())!=To||bo&&Lo(new bo)!=xo||_o&&Lo(new _o)!=Ao)&&(Lo=function(e){var t=Eo(e),n="[object Object]"==t?e.constructor:void 0,r=n?Io(n):"";if(r)switch(r){case Po:return Co;case Oo:return So;case Ro:return To;case No:return xo;case Do:return Ao}return t});var Mo=Lo;var Uo=function(e){return null!=e&&"object"==l(e)},Fo=Ks,jo=Uo;var Vo=function(e){return jo(e)&&"[object Arguments]"==Fo(e)},Bo=Uo,qo=Object.prototype,zo=qo.hasOwnProperty,Ho=qo.propertyIsEnumerable,Ko=Vo(function(){return arguments}())?Vo:function(e){return Bo(e)&&zo.call(e,"callee")&&!Ho.call(e,"callee")},Go=Ko,Wo=Array.isArray;var Qo=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991},Yo=Xs,Xo=Qo;var Jo=function(e){return null!=e&&Xo(e.length)&&!Yo(e)},$o={exports:{}};var Zo=function(){return!1};!function(e,t){var n=Ns,r=Zo,i=t&&!t.nodeType&&t,a=i&&e&&!e.nodeType&&e,s=a&&a.exports===i?n.Buffer:void 0,o=(s?s.isBuffer:void 0)||r;e.exports=o}($o,$o.exports);var eu=Ks,tu=Qo,nu=Uo,ru={};ru["[object Float32Array]"]=ru["[object Float64Array]"]=ru["[object Int8Array]"]=ru["[object Int16Array]"]=ru["[object Int32Array]"]=ru["[object Uint8Array]"]=ru["[object Uint8ClampedArray]"]=ru["[object Uint16Array]"]=ru["[object Uint32Array]"]=!0,ru["[object Arguments]"]=ru["[object Array]"]=ru["[object ArrayBuffer]"]=ru["[object Boolean]"]=ru["[object DataView]"]=ru["[object Date]"]=ru["[object Error]"]=ru["[object Function]"]=ru["[object Map]"]=ru["[object Number]"]=ru["[object Object]"]=ru["[object RegExp]"]=ru["[object Set]"]=ru["[object String]"]=ru["[object WeakMap]"]=!1;var iu=function(e){return nu(e)&&tu(e.length)&&!!ru[eu(e)]};var au=function(e){return function(t){return e(t)}},su={exports:{}};!function(e,t){var n=Ps,r=t&&!t.nodeType&&t,i=r&&e&&!e.nodeType&&e,a=i&&i.exports===r&&n.process,s=function(){try{var e=i&&i.require&&i.require("util").types;return e||a&&a.binding&&a.binding("util")}catch(t){}}();e.exports=s}(su,su.exports);var ou=iu,uu=au,cu=su.exports,lu=cu&&cu.isTypedArray,hu=lu?uu(lu):ou,fu=Cs,du=Mo,pu=Go,vu=Wo,gu=Jo,yu=$o.exports,mu=Es,ku=hu,wu=Object.prototype.hasOwnProperty;var bu,_u,Eu,Iu,Su,Tu,xu,Au=function(e){if(null==e)return!0;
2if(gu(e)&&(vu(e)||"string"==typeof e||"function"==typeof e.splice||yu(e)||ku(e)||pu(e)))return!e.length;var t=du(e);if("[object Map]"==t||"[object Set]"==t)return!e.size;if(mu(e))return!fu(e).length;for(var n in e)if(wu.call(e,n))return!1;return!0};class Cu{constructor(e){this.isMultipassEnabled=()=>this.config.hasMultipass,this.generateMultipassLink=e=>f(this,void 0,void 0,function*(){try{if(!this.isMultipassEnabled())return{success:!1,message:"Multipass disabled",code:"405"};if(!this.config.multipassAuthReturnTo)return{success:!1,message:"multipassAuthReturnTo parameter is missing",code:"multipassAuthReturnToMissing"};if(!window)return{success:!1,message:"Problem with client session occured - no window detected",code:"500"};const t={email:e,return_to:this.config.multipassAuthReturnTo},n=yield(0,a.A)("/api/shopify/multipass",{method:"POST",data:t});return n.data.success?{success:!0,url:n.data.url}:n.data}catch(t){return{success:!1,message:t.message,code:t.code}}}),this.signIn=e=>{window.location.href=e},this.getUserIdByEmail=({clientEmail:e})=>f(this,void 0,void 0,function*(){try{const t=`email:${e}`,n={data:{apiPath:`/customers/search.json?query=${t}`,method:"GET"}};return(yield a.A.post("/api/shopify/admin-api",n)).data}catch(t){return{success:!1,message:t.message,code:t.code}}}),this.getUserData=({clientId:e,scope:t})=>f(this,void 0,void 0,function*(){var n;try{const r=`/customers/${e}`,i={data:{apiPath:t?`${r}/${t}.json`:r,method:"GET"}},s=yield a.A.post("/api/shopify/admin-api",i);return{orders:s.data.data.orders,success:s.data.success,code:null===(n=s.data.code)||void 0===n?void 0:n.toString()}}catch(r){return{success:!1,message:r.message,code:r.code}}}),this.config=e}}!function(e){e.Technical="technical",e.DeliveryAddresses="deliveryAddresses",e.UserDetails="userDetails",e.Security="security",e.OrderHistory="orderHistory",e.AdditionalDeliveryAddresses="additionalDeliveryAddresses"}(bu||(bu={})),function(e){e.Health="Health",e.Hyho="Hyho"}(_u||(_u={})),function(e){e.textbox="textbox",e.password="password",e.date="date",e.datePicker="datePicker",e.checkbox="checkbox",e.radio="radio",e.textarea="textarea",e.phone="phone",e.select="select",e.infoBlock="infoBlock",e.custom="custom"}(Eu||(Eu={})),function(e){e.verifyEmail="verifyEmail",e.recoverEmail="recoverEmail",e.resetPassword="resetPassword",e.verifyAndChangeEmail="verifyAndChangeEmail"}(Iu||(Iu={})),function(e){e.onConfirmSignUp="onConfirmSignUp ",e.onAuthStateChange="onAuthStateChange",e.onTermsChanged="onTermsChanged",e.onLdsConfirmation="onLdsConfirmation",e.onDeleteAccount="onDeleteAccount",e.onDeniedSignIn="onDeniedSignIn"}(Su||(Su={})),function(e){e.Google="Google",e.Facebook="Facebook"}(Tu||(Tu={})),function(e){e[e.Email=0]="Email"}(xu||(xu={}));class Pu{constructor(e){this.ldsConfig=e,this.getSocialLds=()=>f(this,void 0,void 0,function*(){const e=(yield this.getLds()).filter(({socialTerm:e})=>e).map(({businessId:e})=>e);return this.createLdsFields(e)}),this.createLdsFields=e=>f(this,void 0,void 0,function*(){var t;if(!Array.isArray(e))return[];return null!==(t=(yield this.getLds()).filter(({businessId:t})=>e.includes(t)).map(({businessId:e,isRequired:t,description:n,validFrom:r,validTo:i,versionId:a,consentType:s})=>({system:this.ldsConfig.system.toString(),acceptanceDate:(new Date).toISOString(),businessId:e,versionId:a,validFrom:null==r?void 0:r.toISOString(),validTo:null==i?void 0:i.toISOString(),description:n,isRequired:t,accepted:!0,consentType:s})))&&void 0!==t?t:[]}),this.getLds=()=>this.getLdsPromise,this.getLdsByBusinessId=e=>f(this,void 0,void 0,function*(){return(yield this.getLdsPromise).find(({businessId:t})=>t===e)}),this.dispatchEventIfLegalsUpdated=(e,t)=>f(this,void 0,void 0,function*(){const n=yield this.getUpdatedLds(e,t);(null==n?void 0:n.length)&&window.dispatchEvent(new CustomEvent(Su.onTermsChanged,{detail:{updatedLds:n,visible:!0}}))}),this.getMissingLegalsForProfileEdit=e=>f(this,void 0,void 0,function*(){const t=yield this.getLds(),n=e?this.getAcceptedLegals(e):{};return t.filter(e=>!e.socialTerm&&e.isRequired&&(!(e.businessId in n)||n[e.businessId]!==e.versionId))}
2),this.getAcceptedLegals=e=>{var t;return(null!==(t=null==e?void 0:e.lds)&&void 0!==t?t:[]).filter(({accepted:e})=>e).reduce((e,{businessId:t,versionId:n})=>{const r=Object.assign(e,{});return r[t]=n,r},{})},this.getUpdatedLds=(e,t)=>f(this,void 0,void 0,function*(){return(yield this.getLdsPromise).filter(n=>{const{businessId:r,versionId:i,isRequired:a,socialTerm:s}=n,o=e.find(e=>e.businessId===r),u=!o&&a&&(t?s:!s);return o&&o.versionId!==i||u})}),this.getLdsData=()=>Promise.resolve(this.ldsConfig.legals.map(e=>Object.assign(Object.assign({},e),{system:this.ldsConfig.system}))),this.getLdsPromise=this.getLdsData()}}var Ou;function Ru(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return Nu(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Nu(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,s=!0,o=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return s=e.done,e},e:function(e){o=!0,a=e},f:function(){try{s||null==n.return||n.return()}finally{if(o)throw a}}}}function Nu(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}lt("firebase","10.12.2","app");var Du=new Map,Lu={activated:!1,tokenObservers:[]},Mu={initialized:!1,enabled:!1};function Uu(e){return Du.get(e)||Object.assign({},Lu)}function Fu(){return Mu}var ju="https://content-firebaseappcheck.googleapis.com/v1",Vu=3e4,Bu=96e4,qu=function(){function e(t,n,r,i,a){if(I(this,e),this.operation=t,this.retryPolicy=n,this.getWaitDuration=r,this.lowerBound=i,this.upperBound=a,this.pending=null,this.nextErrorWaitInterval=i,i>a)throw new Error("Proactive refresh lower bound greater than upper bound!")}var t;return T(e,[{key:"start",value:function(){this.nextErrorWaitInterval=this.lowerBound,this.process(!0).catch(function(){})}},{key:"stop",value:function(){this.pending&&(this.pending.reject("cancelled"),this.pending=null)}},{key:"isRunning",value:function(){return!!this.pending}},{key:"process",value:(t=E(O.mark(function e(t){return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return this.stop(),e.prev=1,this.pending=new G,this.pending.promise.catch(function(e){}),e.next=6,zu(this.getNextRun(t));case 6:return this.pending.resolve(),e.next=9,this.pending.promise;case 9:return this.pending=new G,this.pending.promise.catch(function(e){}),e.next=13,this.operation();case 13:return this.pending.resolve(),e.next=16,this.pending.promise;case 16:this.process(!0).catch(function(){}),e.next=22;break;case 19:e.prev=19,e.t0=e.catch(1),this.retryPolicy(e.t0)?this.process(!1).catch(function(){}):this.stop();case 22:case"end":return e.stop()}},e,this,[[1,19]])})),function(e){return t.apply(this,arguments)})},{key:"getNextRun",value:function(e){if(e)return this.nextErrorWaitInterval=this.lowerBound,this.getWaitDuration();var t=this.nextErrorWaitInterval;return this.nextErrorWaitInterval*=2,this.nextErrorWaitInterval>this.upperBound&&(this.nextErrorWaitInterval=this.upperBound),t}}]),e}();function zu(e){return new Promise(function(t){setTimeout(t,e)})}var Hu=(A(Ou={},"already-initialized","You have already called initializeAppCheck() for FirebaseApp {$appName} with different options. To avoid this error, call initializeAppCheck() with the same options as when it was originally called. This will return the already initialized instance."),A(Ou,"use-before-activation","App Check is being used before initializeAppCheck() is called for FirebaseApp {$appName}. Call initializeAppCheck() before instantiating other Firebase services."),A(Ou,"fetch-network-error","Fetch failed to connect to a network. Check Internet connection. Original error: {$originalErrorMessage}."),A(Ou,"fetch-parse-error","Fetch client could not parse response. Original error: {$originalErrorMessage}."),A(Ou,"fetch-status-error","Fetch server returned an HTTP error status. HTTP status: {$httpStatus}."),A(Ou,"storage-open","Error thrown when opening storage. Original error: {$originalErrorMessage}."),A(Ou,"storage-get","Error thrown when reading from storage. Original error: {$originalErrorMessage}."),A(Ou,"storage-set","Error thrown when writing to storage. Original error: {$originalErrorMessage}."),A(Ou,"recaptcha-error","ReCAPTCHA error."),A(Ou,"throttled","Requests throttled due to {$httpStatus} error. Attempts allowed again after {$time}"),Ou),Ku=new $("appCheck","AppCheck",Hu);function Gu(){var e;return arguments.length>0&&void 0!==arguments[0]&&arguments[0]?null===(e=self.grecaptcha)||void 0===e?void 0:e.enterprise:self.grecaptcha}function Wu(e){if(!Uu(e).activated)throw Ku.create("use-before-activation",{appName:e.n
2ame})}function Qu(e){var t=Math.round(e/1e3),n=Math.floor(t/86400),r=Math.floor((t-3600*n*24)/3600),i=Math.floor((t-3600*n*24-3600*r)/60),a=t-3600*n*24-3600*r-60*i,s="";return n&&(s+=Yu(n)+"d:"),r&&(s+=Yu(r)+"h:"),s+=Yu(i)+"m:"+Yu(a)+"s"}function Yu(e){return 0===e?"00":e>=10?e.toString():"0"+e}function Xu(e,t){return Ju.apply(this,arguments)}function Ju(){return(Ju=E(O.mark(function e(t,n){var r,i,a,s,o,u,c,l,h,f,d;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.url,i=t.body,a={"Content-Type":"application/json"},!(s=n.getImmediate({optional:!0}))){e.next=8;break}return e.next=6,s.getHeartbeatsHeader();case 6:(o=e.sent)&&(a["X-Firebase-Client"]=o);case 8:return u={method:"POST",body:JSON.stringify(i),headers:a},e.prev=9,e.next=12,fetch(r,u);case 12:c=e.sent,e.next=18;break;case 15:throw e.prev=15,e.t0=e.catch(9),Ku.create("fetch-network-error",{originalErrorMessage:null===e.t0||void 0===e.t0?void 0:e.t0.message});case 18:if(200===c.status){e.next=20;break}throw Ku.create("fetch-status-error",{httpStatus:c.status});case 20:return e.prev=20,e.next=23,c.json();case 23:l=e.sent,e.next=29;break;case 26:throw e.prev=26,e.t1=e.catch(20),Ku.create("fetch-parse-error",{originalErrorMessage:null===e.t1||void 0===e.t1?void 0:e.t1.message});case 29:if((h=l.ttl.match(/^([\d.]+)(s)$/))&&h[2]&&!isNaN(Number(h[1]))){e.next=32;break}throw Ku.create("fetch-parse-error",{originalErrorMessage:"ttl field (timeToLive) is not in standard Protobuf Duration "+"format: ".concat(l.ttl)});case 32:return f=1e3*Number(h[1]),d=Date.now(),e.abrupt("return",{token:l.token,expireTimeMillis:d+f,issuedAtTimeMillis:d});case 35:case"end":return e.stop()}},e,null,[[9,15],[20,26]])}))).apply(this,arguments)}function $u(e,t){var n=e.options,r=n.projectId,i=n.appId,a=n.apiKey;return{url:"".concat(ju,"/projects/").concat(r,"/apps/").concat(i,":").concat("exchangeRecaptchaV3Token","?key=").concat(a),body:{recaptcha_v3_token:t}}}function Zu(e,t){var n=e.options,r=n.projectId,i=n.appId,a=n.apiKey;return{url:"".concat(ju,"/projects/").concat(r,"/apps/").concat(i,":").concat("exchangeDebugToken","?key=").concat(a),body:{debug_token:t}}}var ec="firebase-app-check-store",tc="debug-token",nc=null;function rc(){return nc||(nc=new Promise(function(e,t){try{var n=indexedDB.open("firebase-app-check-database",1);n.onsuccess=function(t){e(t.target.result)},n.onerror=function(e){var n;t(Ku.create("storage-open",{originalErrorMessage:null===(n=e.target.error)||void 0===n?void 0:n.message}))},n.onupgradeneeded=function(e){var t=e.target.result;if(0===e.oldVersion)t.createObjectStore(ec,{keyPath:"compositeKey"})}}catch(r){t(Ku.create("storage-open",{originalErrorMessage:null==r?void 0:r.message}))}}))}function ic(e){return cc(hc(e))}function ac(e){return oc(tc,e)}function sc(){return cc(tc)}function oc(e,t){return uc.apply(this,arguments)}function uc(){return(uc=E(O.mark(function e(t,n){var r,i,a,s;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,rc();case 2:return r=e.sent,i=r.transaction(ec,"readwrite"),a=i.objectStore(ec),s=a.put({compositeKey:t,value:n}),e.abrupt("return",new Promise(function(e,t){s.onsuccess=function(t){e()},i.onerror=function(e){var n;t(Ku.create("storage-set",{originalErrorMessage:null===(n=e.target.error)||void 0===n?void 0:n.message}))}}));case 7:case"end":return e.stop()}},e)}))).apply(this,arguments)}function cc(e){return lc.apply(this,arguments)}function lc(){return(lc=E(O.mark(function e(t){var n,r,i,a;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,rc();case 2:return n=e.sent,r=n.transaction(ec,"readonly"),i=r.objectStore(ec),a=i.get(t),e.abrupt("return",new Promise(function(e,t){a.onsuccess=function(t){var n=t.target.result;e(n?n.value:void 0)},r.onerror=function(e){var n;t(Ku.create("storage-get",{originalErrorMessage:null===(n=e.target.error)||void 0===n?void 0:n.message}))}}));case 7:case"end":return e.stop()}},e)}))).apply(this,arguments)}function hc(e){return"".concat(e.options.appId,"-").concat(e.name)}var fc=new Ie("@firebase/app-check");function dc(){return(dc=E(O.mark(function e(t){var n;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!Y()){e.next=12;break}return n=void 0,e.prev=2,e.next=5,ic(t);case 5:n=e.sent,e.next=11;break;case 8:e.prev=8,e.t0=e.catch(2),fc.warn("Failed to read token from IndexedDB. Error: ".concat(e.t0));case 11:return e.abrupt("return",n);case 12:return e.abrupt("return",void 0);case 13:case"end":return e.stop()}},e,null,[[2,8]])}))).apply(this,arguments)}function pc(e,t){return Y()?function(e,t){return oc(hc(e),t)}(e,t).catch(function(e){fc.warn("Failed to write token to IndexedDB. Error: ".concat(e))}):Promise.resolve()}function vc(){return(vc=E(O.mark(function e(){var t,n;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=void 0,e.prev=1,e.next=4,
2sc();case 4:t=e.sent,e.next=9;break;case 7:e.prev=7,e.t0=e.catch(1);case 9:if(t){e.next=15;break}return ac(n=ue()).catch(function(e){return fc.warn("Failed to persist debug token to IndexedDB. Error: ".concat(e))}),e.abrupt("return",n);case 15:return e.abrupt("return",t);case 16:case"end":return e.stop()}},e,null,[[1,7]])}))).apply(this,arguments)}function gc(){return Fu().enabled}function yc(){return mc.apply(this,arguments)}function mc(){return(mc=E(O.mark(function e(){var t;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!(t=Fu()).enabled||!t.token){e.next=5;break}return e.abrupt("return",t.token.promise);case 5:throw Error("\n Can't get debug token in production mode.\n ");case 6:case"end":return e.stop()}},e)}))).apply(this,arguments)}function kc(){var e=q(),t=Fu();if(t.initialized=!0,"string"==typeof e.FIREBASE_APPCHECK_DEBUG_TOKEN||!0===e.FIREBASE_APPCHECK_DEBUG_TOKEN){t.enabled=!0;var n=new G;t.token=n,"string"==typeof e.FIREBASE_APPCHECK_DEBUG_TOKEN?n.resolve(e.FIREBASE_APPCHECK_DEBUG_TOKEN):n.resolve(function(){return vc.apply(this,arguments)}())}}var wc={error:"UNKNOWN_ERROR"};function bc(e){return _c.apply(this,arguments)}function _c(){return _c=E(O.mark(function e(t){var n,r,i,a,s,o,u,c,l,h=arguments;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(n=h.length>1&&void 0!==h[1]&&h[1],Wu(r=t.app),i=Uu(r),a=i.token,s=void 0,a&&!Ac(a)&&(i.token=void 0,a=void 0),a){e.next=18;break}return e.next=10,i.cachedTokenPromise;case 10:if(!(o=e.sent)){e.next=18;break}if(!Ac(o)){e.next=16;break}a=o,e.next=18;break;case 16:return e.next=18,pc(r,void 0);case 18:if(n||!a||!Ac(a)){e.next=20;break}return e.abrupt("return",{token:a.token});case 20:if(u=!1,!gc()){e.next=40;break}if(i.exchangeTokenPromise){e.next=33;break}return e.t0=Xu,e.t1=Zu,e.t2=r,e.next=28,yc();case 28:e.t3=e.sent,e.t4=(0,e.t1)(e.t2,e.t3),e.t5=t.heartbeatServiceProvider,i.exchangeTokenPromise=(0,e.t0)(e.t4,e.t5).finally(function(){i.exchangeTokenPromise=void 0}),u=!0;case 33:return e.next=35,i.exchangeTokenPromise;case 35:return c=e.sent,e.next=38,pc(r,c);case 38:return i.token=c,e.abrupt("return",{token:c.token});case 40:return e.prev=40,i.exchangeTokenPromise||(i.exchangeTokenPromise=i.provider.getToken().finally(function(){i.exchangeTokenPromise=void 0}),u=!0),e.next=44,Uu(r).exchangeTokenPromise;case 44:a=e.sent,e.next=51;break;case 47:e.prev=47,e.t6=e.catch(40),e.t6.code==="appCheck/".concat("throttled")?fc.warn(e.t6.message):fc.error(e.t6),s=e.t6;case 51:if(a){e.next=55;break}l=Cc(s),e.next=63;break;case 55:if(!s){e.next=59;break}l=Ac(a)?{token:a.token,internalError:s}:Cc(s),e.next=63;break;case 59:return l={token:a.token},i.token=a,e.next=63,pc(r,a);case 63:return u&&xc(r,l),e.abrupt("return",l);case 65:case"end":return e.stop()}},e,null,[[40,47]])})),_c.apply(this,arguments)}function Ec(){return(Ec=E(O.mark(function e(t){var n,r,i,a,s,o,u,c;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(Wu(n=t.app),r=Uu(n),i=r.provider,!gc()){e.next=14;break}return e.next=6,yc();case 6:return a=e.sent,e.next=9,Xu(Zu(n,a),t.heartbeatServiceProvider);case 9:return s=e.sent,o=s.token,e.abrupt("return",{token:o});case 14:return e.next=16,i.getToken();case 16:return u=e.sent,c=u.token,e.abrupt("return",{token:c});case 19:case"end":return e.stop()}},e)}))).apply(this,arguments)}function Ic(e,t,n,r){var i=Uu(e.app),a={next:n,error:r,type:t};if(i.tokenObservers=[].concat(x(i.tokenObservers),[a]),i.token&&Ac(i.token)){var s=i.token;Promise.resolve().then(function(){n({token:s.token}),Tc(e)}).catch(function(){})}i.cachedTokenPromise.then(function(){return Tc(e)})}function Sc(e,t){var n=Uu(e),r=n.tokenObservers.filter(function(e){return e.next!==t});0===r.length&&n.tokenRefresher&&n.tokenRefresher.isRunning()&&n.tokenRefresher.stop(),n.tokenObservers=r}function Tc(e){var t=Uu(e.app),n=t.tokenRefresher;n||(n=function(e){var t=e.app;return new qu(E(O.mark(function n(){var r;return O.wrap(function(n){for(;;)switch(n.prev=n.next){case 0:if(Uu(t).token){n.next=7;break}return n.next=4,bc(e);case 4:r=n.sent,n.next=10;break;case 7:return n.next=9,bc(e,!0);case 9:r=n.sent;case 10:if(!r.error){n.next=12;break}throw r.error;case 12:if(!r.internalError){n.next=14;break}throw r.internalError;case 14:case"end":return n.stop()}},n)})),function(){return!0},function(){var e=Uu(t);if(e.token){var n=e.token.issuedAtTimeMillis+.5*(e.token.expireTimeMillis-e.token.issuedAtTimeMillis)+3e5,r=e.token.expireTimeMillis-3e5;return n=Math.min(n,r),Math.max(0,n-Date.now())}return 0},Vu,Bu)}(e),t.tokenRefresher=n),!n.isRunning()&&t.isTokenAutoRefreshEnabled&&n.start()}function xc(e,t){var n,r=Ru(Uu(e).tokenObservers);try{for(r.s();!(n=r.n()).done;){var i=n.value;try{"EXTERNAL"===i.type&&null!=t.error?i.error(t.error):i.next(t)}catch(a){}}}catch(s){r.e(s)}finally{r.f()}}function Ac(e){return e.expireTimeMillis-Date.now()>0}function Cc(e){return{token:(t=wc,F.encodeString(JSON.stringify(t),!1)),error:e};var t}var Pc=function(){function e(t,n){I(this,e),this.app=t,this.heartbeatServiceProvider=n}return T(e,[{key:"_delete",value:function(){var e,t=Ru(Uu(this.app).tokenObservers);try{for(t.s();!(e=t.n()).done;){var n=e.value;Sc(this.app,n.next)}}catch(r){t.e(r)}finally{t.f()}return Promise.resolve()}}]),e}();function Oc(e){return{getToken:function(t){return bc(e,t)},getLimitedUseToken:function(){return function(e){return Ec.apply(this,arguments)}(e)},addTokenListener:function(t){return Ic(e,"INTERNAL",t)},removeTokenListener:function(t){return Sc(e.app,t)}}}var Rc="https://www.google.com/recaptcha/api.js";function Nc(e,t){var n=new G;Uu(e).reCAPTCHAState={initialized:n};var r,i,a=function(e){var t="fire_app_check_".concat(e.name),n=document.createElement("div");return n.id=t,n.style.display="none",document.body.appendChild(n),t}(e),s=Gu(!1);return s?Dc(e,t,s,a,n):(r=function(){var r=Gu(!1);if(!r)throw new Error("no recaptcha");Dc(e,t,r,a,n)},(i=document.createElement("script")).src=Rc,i.onload=r,document.head.appendChild(i)),n.promise}function Dc(e,t,n,r,i){n.ready(function(){!function(e,t,n,r){var i=n.render(r,{sitekey:t,size:"invisible",callback:function(){Uu(e).reCAPTCHAState.succeeded=!0},"error-callback":function(){Uu(e).reCAPTCHAState.succeeded=!1}}),a=Uu(e);a.reCAPTCHAState=Object.assign(Object.assign({},a.reCAPTCHAState),{widgetId:i})}(e,t,n,r),i.resolve(n)})}function Lc(e){return Mc.apply(this,arguments)}function Mc(){return(Mc=E(O.mark(function e(t){var n,r;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return Wu(t),n=Uu(t).reCAPTCHAState,e.next=4,n.initialized.promise;case 4:return r=e.sent,e.abrupt("return",new Promise(function(e,n){var i=Uu(t).reCAPTCHAState;r.ready(function(){e(r.execute(i.widgetId,{action:"fire_app_check"}))})}));case 6:case"end":return e.stop()}},e)}))).apply(this,arguments)}var Uc=function(){function e(t){I(this,e),this._siteKey=t,this._throttleData=null}var t;return T(e,[{key:"getToken",value:(t=E(O.mark(function e(){var t,n,r,i,a;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return jc(this._throttleData),e.next=3,Lc(this._app).catch(function(e){throw Ku.create("recaptcha-error")});case 3:if(i=e.sent,null===(t=Uu(this._app).reCAPTCHAState)||void 0===t?void 0:t.succeeded){e.next=6;break}throw Ku.create("recaptcha-error");case 6:return e.prev=6,e.next=9,Xu($u(this._app,i),this._heartbeatServiceProvider);case 9:a=e.sent,e.next=20;break;case 12:if(e.prev=12,e.t0=e.catch(6),!(null===(n=e.t0.code)||void 0===n?void 0:n.includes("fetch-status-error"))){e.next=19;break}throw this._throttleData=Fc(Number(null===(r=e.t0.customData)||void 0===r?void 0:r.httpStatus),this._throttleData),Ku.create("throttled",{time:Qu(this._throttleData.allowRequestsAfter-Date.now()),httpStatus:this._throttleData.httpStatus});case 19:throw e.t0;case 20:return this._throttleData=null,e.abrupt("return",a);case 22:case"end":return e.stop()}},e,this,[[6,12]])})),function(){return t.apply(this,arguments)})},{key:"initialize",value:function(e){this._app=e,this._heartbeatServiceProvider=nt(e,"heartbeat"),Nc(e,this._siteKey).catch(function(){})}},{key:"isEqual",value:function(t){return t instanceof e&&this._siteKey===t._siteKey}}]),e}();function Fc(e,t){if(404===e||403===e)return{backoffCount:1,allowRequestsAfter:Date.now()+864e5,httpStatus:e};var n=t?t.backoffCount:0,r=function(e){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:2,n=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3)*Math.pow(t,e),r=Math.round(.5*n*(Math.random()-.5)*2);return Math.min(144e5,n+r)}(n,1e3,2);return{backoffCount:n+1,allowRequestsAfter:Date.now()+r,httpStatus:e}}function jc(e){if(e&&Date.now()-e.allowRequestsAfter<=0)throw Ku.create("throttled",{time:Qu(e.allowRequestsAfter-Date.now()),httpStatus:e.httpStatus})}function Vc(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ct(),t=arguments.length>1?arguments[1]:void 0,n=nt(e=ce(e),"app-check");if(Fu().initialized||kc(),gc()&&yc().then(function(e){return console.log("App Check debug token: ".concat(e,". You will need to add it to your app's App Check
2settings in the Firebase console for it to work."))}),n.isInitialized()){var r=n.getImmediate(),i=n.getOptions();if(i.isTokenAutoRefreshEnabled===t.isTokenAutoRefreshEnabled&&i.provider.isEqual(t.provider))return r;throw Ku.create("already-initialized",{appName:e.name})}var a=n.initialize({options:t});return function(e,t,n){var r=function(e,t){return Du.set(e,t),Du.get(e)}(e,Object.assign({},Lu));r.activated=!0,r.provider=t,r.cachedTokenPromise=function(e){return dc.apply(this,arguments)}(e).then(function(t){return t&&Ac(t)&&(r.token=t,xc(e,{token:t.token})),t}),r.isTokenAutoRefreshEnabled=void 0===n?e.automaticDataCollectionEnabled:n,r.provider.initialize(e)}(e,t.provider,t.isTokenAutoRefreshEnabled),Uu(e).isTokenAutoRefreshEnabled&&Ic(a,"INTERNAL",function(){}),a}var Bc="app-check-internal";tt(new fe("app-check",function(e){return function(e,t){return new Pc(e,t)}(e.getProvider("app").getImmediate(),e.getProvider("heartbeat"))},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback(function(e,t,n){e.getProvider(Bc).initialize()})),tt(new fe(Bc,function(e){return Oc(e.getProvider("app-check").getImmediate())},"PUBLIC").setInstantiationMode("EXPLICIT")),lt("@firebase/app-check","0.8.4");var qc,zc,Hc="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==n.g?n.g:"undefined"!=typeof self?self:{};function Kc(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return Gc(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Gc(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,s=!0,o=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return s=e.done,e},e:function(e){o=!0,a=e},f:function(){try{s||null==n.return||n.return()}finally{if(o)throw a}}}}function Gc(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Wc(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function(){var n,r=d(e);if(t){var i=d(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return m(this,n)}}(function(){var e;function t(){this.blockSize=-1,this.blockSize=64,this.g=Array(4),this.B=Array(this.blockSize),this.o=this.h=0,this.s()}function n(e,t,n){n||(n=0);var r=Array(16);if("string"==typeof t)for(var i=0;16>i;++i)r[i]=t.charCodeAt(n++)|t.charCodeAt(n++)<<8|t.charCodeAt(n++)<<16|t.charCodeAt(n++)<<24;else for(i=0;16>i;++i)r[i]=t[n++]|t[n++]<<8|t[n++]<<16|t[n++]<<24;t=e.g[0],n=e.g[1],i=e.g[2];var a=e.g[3],s=t+(a^n&(i^a))+r[0]+3614090360&4294967295;s=(n=(i=(a=(t=(n=(i=(a=(t=(n=(i=(a=(t=(n=(i=(a=(t=(n=(i=(a=(t=(n=(i=(a=(t=(n=(i=(a=(t=(n=(i=(a=(t=(n=(i=(a=(t=(n=(i=(a=(t=(n=(i=(a=(t=(n=(i=(a=(t=(n=(i=(a=(t=(n=(i=(a=(t=(n=(i=(a=(t=n+(s<<7&4294967295|s>>>25))+((s=a+(i^t&(n^i))+r[1]+3905402710&4294967295)<<12&4294967295|s>>>20))+((s=i+(n^a&(t^n))+r[2]+606105819&4294967295)<<17&4294967295|s>>>15))+((s=n+(t^i&(a^t))+r[3]+3250441966&4294967295)<<22&4294967295|s>>>10))+((s=t+(a^n&(i^a))+r[4]+4118548399&4294967295)<<7&4294967295|s>>>25))+((s=a+(i^t&(n^i))+r[5]+1200080426&4294967295)<<12&4294967295|s>>>20))+((s=i+(n^a&(t^n))+r[6]+2821735955&4294967295)<<17&4294967295|s>>>15))+((s=n+(t^i&(a^t))+r[7]+4249261313&4294967295)<<22&4294967295|s>>>10))+((s=t+(a^n&(i^a))+r[8]+1770035416&4294967295)<<7&4294967295|s>>>25))+((s=a+(i^t&(n^i))+r[9]+2336552879&4294967295)<<12&4294967295|s>>>20))+((s=i+(n^a&(t^n))+r[10]+4294925233&4294967295)<<17&4294967295|s>>>15))+((s=n+(t^i&(a^t))+r[11]+2304563134&4294967295)<<22&4294967295|s>>>10))+((s=t+(a^n&(i^a))+r[12]+1804603682&4294967295)<<7&4294967295|s>>>25))+((s=a+(i^t&(n^i))+r[13]+4254626195&4294967295)<<12&4294967295|s>>>20))+((s=i+(n^a&(t^n))+r[14]+2792965006&4294967295)<<17&4294967295|s>>>15))+((s=n+(t^i&(a^t))+r[15]+1236535329&4294967295)<<22&4294967295|s>>>10))+((s=t+(i^a&(n^i))+r[1]+4129170786&4294967295)<<5&4294967295|s>>>27))+((s=a+(n^i&(t^n))+r[6]+3225465664&4294967295)<<9&4294967295|s>>>23))+((s=i+(t^n&(a^t))+r[11]+643717713&4294967295)<<14&4294967295|s>>>18))+((s=n+(a^t&(i^a))+r[0]+3921069994&4294967295)<<20&4294967295|s>>>12))+((s=t+(i^a&(n^i))+r[5]+3593408605&4294967295)<<5&4294967295|s>>>27))+((s=a+(n^i&(t^n))+r[10]+38016083&4294967295)<<9&4294967295|s>>>23))+((s=i+(t^n&(a^t))+r[15]+3634488961&4294967295)<<14&4294967295|s>>>18))+((s=n+(a^t&(i^a))+r[4]+3889429448&4294967295)<<20&4294967295|s>>>12))+((s=t+(i^a&(n^i))+r[9]+568446438&4294967295)<<5&4294967295|s>>>27))+((s=a+(n^i&(t^n))+r[14]+3275163606&4294967295)<<9&4294967295|s>>>23))+((s=i+(t^n&(a^t))+r[3]+4107603335&4294967295)<<14&4294967295|s>>>18))+((s=n+(a^t&(i^a))+r[8]+1163531501&4294967295)<<20&4294967295|s>>>12))+((s=t+(i^a&(n^i))+r[13]+2850285829&4294967295)<<5&4294967295|s>>>27))+((s=a+(n^i&(t^n))+r[2]+4243563512&4294967295)<<9&4294967295|s>>>23))+((s=i+(t^n&(a^t))+r[7]+1735328473&4294967295)<<14&4294967295|s>>>18))+((s=n+(a^t&(i^a))+r[12]+2368359562&4294967295)<<20&4294967295|s>>>12))+((s=t+(n^i^a)+r[5]+4294588738&4294967295)<<4&4294967295|s>>>28))+((s=a+(t^n^i)+r[8]+2272392833&4294967295)<<11&4294967295|s>>>21))+((s=i+(a^t^n)+r[11]+1839030562&4294967295)<<16&4294967295|s>>>16))+((s=n+(i^a^t)+r[14]+4259657740&4294967295)<<23&4294967295|s>>>9))+((s=t+(n^i^a)+r[1]+2763975236&4294967295)<<4&4294967295|s>>>28))+((s=a+(t^n^i)+r[4]+1272893353&4294967295)<<11&4294967295|s>>>21))+((s=i+(a^t^n)+r[7]+4139469664&4294967295)<<16&4294967295|s>>>16))+((s=n+(i^a^t)+r[10]+3200236656&4294967295)<<23&4294967295|s>>>9))+((s=t+(n^i^a)+r[13]+681279174&4294967295)<<4&4294967295|s>>>28))+((s=a+(t^n^i)+r[0]+3936430074&4294967295)<<11&4294967295|s>>>21))+((s=i+(a^t^n)+r[3]+3572445317&4294967295)<<16&4294967295|s>>>16))+((s=n+(i^a^t)+r[6]+76029189&4294967295)<<23&4294967295|s>>>9))+((s=t+(n^i^a)+r[9]+3654602809&4294967295)<<4&4294967295|s>>>28))+((s=a+(t^n^i)+r[12]+3873151461&4294967295)<<11&4294967295|s>>>21))+((s=i+(a^t^n)+r[15]+530742520&4294967295)<<16&4294967295|s>>>16))+((s=n+(i^a^t)+r[2]+3299628645&4294967295)<<23&4294967295|s>>>9))+((s=t+(i^(n|~a))+r[0]+4096336452&4294967295)<<6&4294967295|s>>>26))+((s=a+(n^(t|~i))+r[7]+1126891415&4294967295)<<10&4294967295|s>>>22))+((s=i+(t^(a|~n))+r[14]+2878612391&4294967295)<<15&4294967295|s>>>17))+((s=n+(a^(i|~t))+r[5]+4237533241&4294967295)<<21&4294967295|s>>>11))+((s=t+(i^(n|~a))+r[12]+1700485571&4294967295)<<6&4294967295|s>>>26))+((s=a+(n^(t|~i))+r[3]+2399980690&4294967295)<<10&4294967295|s>>>22))+((s=i+(t^(a|~n))+r[10]+4293915773&4294967295)<<15&4294967295|s>>>17))+((s=n+(a^(i|~t))+r[1]+2240044497&4294967295)<<21&4294967295|s>>>11))+((s=t+(i^(n|~a))+r[8]+1873313359&4294967295)<<6&4294967295|s>>>26))+((s=a+(n^(t|~i))+r[15]+4264355552&4294967295)<<10&4294967295|s>>>22))+((s=i+(t^(a|~n))+r[6]+2734768916&4294967295)<<15&4294967295|s>>>17))+((s=n+(a^(i|~t))+r[13]+1309151649&4294967295)<<21&4294967295|s>>>11))+((a=(t=n+((s=t+(i^(n|~a))+r[4]+4149444226&4294967295)<<6&4294967295|s>>>
226))+((s=a+(n^(t|~i))+r[11]+3174756917&4294967295)<<10&4294967295|s>>>22))^((i=a+((s=i+(t^(a|~n))+r[2]+718787259&4294967295)<<15&4294967295|s>>>17))|~t))+r[9]+3951481745&4294967295,e.g[0]=e.g[0]+t&4294967295,e.g[1]=e.g[1]+(i+(s<<21&4294967295|s>>>11))&4294967295,e.g[2]=e.g[2]+i&4294967295,e.g[3]=e.g[3]+a&4294967295}function r(e,t){this.h=t;for(var n=[],r=!0,i=e.length-1;0<=i;i--){var a=0|e[i];r&&a==t||(n[i]=a,r=!1)}this.g=n}!function(e,t){function n(){}n.prototype=t.prototype,e.D=t.prototype,e.prototype=new n,e.prototype.constructor=e,e.C=function(e,n,r){for(var i=Array(arguments.length-2),a=2;a<arguments.length;a++)i[a-2]=arguments[a];return t.prototype[n].apply(e,i)}}(t,function(){this.blockSize=-1}),t.prototype.s=function(){this.g[0]=1732584193,this.g[1]=4023233417,this.g[2]=2562383102,this.g[3]=271733878,this.o=this.h=0},t.prototype.u=function(e,t){void 0===t&&(t=e.length);for(var r=t-this.blockSize,i=this.B,a=this.h,s=0;s<t;){if(0==a)for(;s<=r;)n(this,e,s),s+=this.blockSize;if("string"==typeof e){for(;s<t;)if(i[a++]=e.charCodeAt(s++),a==this.blockSize){n(this,i),a=0;break}}else for(;s<t;)if(i[a++]=e[s++],a==this.blockSize){n(this,i),a=0;break}}this.h=a,this.o+=t},t.prototype.v=function(){var e=Array((56>this.h?this.blockSize:2*this.blockSize)-this.h);e[0]=128;for(var t=1;t<e.length-8;++t)e[t]=0;var n=8*this.o;for(t=e.length-8;t<e.length;++t)e[t]=255&n,n/=256;for(this.u(e),e=Array(16),t=n=0;4>t;++t)for(var r=0;32>r;r+=8)e[n++]=this.g[t]>>>r&255;return e};var i={};function a(e){return-128<=e&&128>e?function(e,t){var n=i;return Object.prototype.hasOwnProperty.call(n,e)?n[e]:n[e]=t(e)}(e,function(e){return new r([0|e],0>e?-1:0)}):new r([0|e],0>e?-1:0)}function s(e){if(isNaN(e)||!isFinite(e))return o;if(0>e)return f(s(-e));for(var t=[],n=1,i=0;e>=n;i++)t[i]=e/n|0,n*=4294967296;return new r(t,0)}var o=a(0),u=a(1),c=a(16777216);function l(e){if(0!=e.h)return!1;for(var t=0;t<e.g.length;t++)if(0!=e.g[t])return!1;return!0}function h(e){return-1==e.h}function f(e){for(var t=e.g.length,n=[],i=0;i<t;i++)n[i]=~e.g[i];return new r(n,~e.h).add(u)}function d(e,t){return e.add(f(t))}function p(e,t){for(;(65535&e[t])!=e[t];)e[t+1]+=e[t]>>>16,e[t]&=65535,t++}function v(e,t){this.g=e,this.h=t}function g(e,t){if(l(t))throw Error("division by zero");if(l(e))return new v(o,o);if(h(e))return t=g(f(e),t),new v(f(t.g),f(t.h));if(h(t))return t=g(e,f(t)),new v(f(t.g),t.h);if(30<e.g.length){if(h(e)||h(t))throw Error("slowDivide_ only works with positive integers.");for(var n=u,r=t;0>=r.l(e);)n=y(n),r=y(r);var i=m(n,1),a=m(r,1);for(r=m(r,2),n=m(n,2);!l(r);){var c=a.add(r);0>=c.l(e)&&(i=i.add(n),a=c),r=m(r,1),n=m(n,1)}return t=d(e,i.j(t)),new v(i,t)}for(i=o;0<=e.l(t);){for(n=Math.max(1,Math.floor(e.m()/t.m())),r=48>=(r=Math.ceil(Math.log(n)/Math.LN2))?1:Math.pow(2,r-48),c=(a=s(n)).j(t);h(c)||0<c.l(e);)c=(a=s(n-=r)).j(t);l(a)&&(a=u),i=i.add(a),e=d(e,c)}return new v(i,e)}function y(e){for(var t=e.g.length+1,n=[],i=0;i<t;i++)n[i]=e.i(i)<<1|e.i(i-1)>>>31;return new r(n,e.h)}function m(e,t){var n=t>>5;t%=32;for(var i=e.g.length-n,a=[],s=0;s<i;s++)a[s]=0<t?e.i(s+n)>>>t|e.i(s+n+1)<<32-t:e.i(s+n);return new r(a,e.h)}(e=r.prototype).m=function(){if(h(this))return-f(this).m();for(var e=0,t=1,n=0;n<this.g.length;n++){var r=this.i(n);e+=(0<=r?r:4294967296+r)*t,t*=4294967296}return e},e.toString=function(e){if(2>(e=e||10)||36<e)throw Error("radix out of range: "+e);if(l(this))return"0";if(h(this))return"-"+f(this).toString(e);for(var t=s(Math.pow(e,6)),n=this,r="";;){var i=g(n,t).g,a=((0<(n=d(n,i.j(t))).g.length?n.g[0]:n.h)>>>0).toString(e);if(l(n=i))return a+r;for(;6>a.length;)a="0"+a;r=a+r}},e.i=function(e){return 0>e?0:e<this.g.length?this.g[e]:this.h},e.l=function(e){return h(e=d(this,e))?-1:l(e)?0:1},e.abs=function(){return h(this)?f(this):this},e.add=function(e){for(var t=Math.max(this.g.length,e.g.length),n=[],i=0,a=0;a<=t;a++){var s=i+(65535&this.i(a))+(65535&e.i(a)),o=(s>>>16)+(this.i(a)>>>16)+(e.i(a)>>>16);i=o>>>16,s&=65535,o&=65535,n[a]=o<<16|s}return new r(n,-2147483648&n[n.length-1]?-1:0)},e.j=function(e){if(l(this)||l(e))return o;if(h(this))return h(e)?f(this).j(f(e)):f(f(this).j(e));if(h(e))return f(this.j(f(e)));if(0>this.l(c)&&0>e.l(c))return s(this.m()*e.m());for(var t=this.g.length+e.g.length,n=[],i=0;i<2*t;i++)n[i]=0;for(i=0;i<this.g.length;i++)for(var a=0;a<e.g.length;a++){var u=this.i(i)>>>16,d=65535&this.i(i),v=e.i(a)>>>16,g=65535&e.i(a);n[2*i+2*a]+=d*g,p(n,2*i+2*a),n[2*i+2*a+1]+=u*g,p(n,2*i+2*a+1),n[2*i+2*a+1]+=d*v,p(n,2*i+2*a+1),n[2*i+2*a+2]+=u*v,p(n,2*i+2*a+2)}for(i=0;i<t;i++)n[i]=n[2*i+1]<<16|n[2*i];for(i=t;i<2*t;i++)n[i]=0;return new r(n,0)},e.A=function(e){return g(this,e).h},e.and=function(e){for(var t=Math.max(this.g.length,e.g.length),n=[],i=0;i<t;i++)n[i]=this.i(i)&e.i(i);return new r(n,this.h&e.h)},e.or=function(e){for(var t=Math.max(this.g.length,e.g.length),n=[],i=0;i<t;i++)n[i]=this.i(i)|e.i(i);return new r(n,this.h|e.h)},e.xor=function(e){for(var t=Math.max(this.g.length,e.g.length),n=[],i=0;i<t;i++)n[i]=this.i(i)^e.i(i);return new r(n,this.h^e.h)},t.prototype.digest=t.prototype.v,t.prototype.reset=t.prototype.s,t.prototype.update=t.prototype.u,zc=t,r.prototype.add=r.prototype.add,r.prototype.multiply=r.prototype.j,r.prototype.modulo=r.prototype.A,r.prototype.compare=r.prototype.l,r.prototype.toNumber=r.prototype.m,r.prototype.toString=r.prototype.toString,r.prototype.getBits=r.prototype.i,r.fromNumber=s,r.fromString=function e(t,n){if(0==t.length)throw Error("number format error: empty string");if(2>(n=n||10)||36<n)throw Error("radix out of range: "+n);
2if("-"==t.charAt(0))return f(e(t.substring(1),n));if(0<=t.indexOf("-"))throw Error('number format error: interior "-" character');for(var r=s(Math.pow(n,8)),i=o,a=0;a<t.length;a+=8){var u=Math.min(8,t.length-a),c=parseInt(t.substring(a,a+u),n);8>u?(u=s(Math.pow(n,u)),i=i.j(u).add(s(c))):i=(i=i.j(r)).add(s(c))}return i},qc=r}).apply(void 0!==Hc?Hc:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{});var Qc,Yc,Xc,Jc,$c,Zc,el,tl,nl,rl="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==n.g?n.g:"undefined"!=typeof self?self:{};function il(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return al(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return al(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,s=!0,o=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return s=e.done,e},e:function(e){o=!0,a=e},f:function(){try{s||null==n.return||n.return()}finally{if(o)throw a}}}}function al(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function sl(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function(){var n,r=d(e);if(t){var i=d(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return m(this,n)}}(function(){var e,t="function"==typeof Object.defineProperties?Object.defineProperty:function(e,t,n){return e==Array.prototype||e==Object.prototype||(e[t]=n.value),e};var n=function(e){e=["object"==("undefined"==typeof globalThis?"undefined":l(globalThis))&&globalThis,e,"object"==("undefined"==typeof window?"undefined":l(window))&&window,"object"==("undefined"==typeof self?"undefined":l(self))&&self,"object"==l(rl)&&rl];for(var t=0;t<e.length;++t){var n=e[t];if(n&&n.Math==Math)return n}throw Error("Cannot find global object")}(this);!function(e,r){if(r)e:{var i=n;e=e.split(".");for(var a=0;a<e.length-1;a++){var s=e[a];if(!(s in i))break e;i=i[s]}(r=r(a=i[e=e[e.length-1]]))!=a&&null!=r&&t(i,e,{configurable:!0,writable:!0,value:r})}}("Array.prototype.values",function(e){return e||function(){return function(e,t){e instanceof String&&(e+="");var n=0,r=!1,i={next:function(){if(!r&&n<e.length){var i=n++;return{value:t(i,e[i]),done:!1}}return r=!0,{done:!0,value:void 0}}};return i[Symbol.iterator]=function(){return i},i}(this,function(e,t){return t})}});var r=r||{},i=this||self;function a(e){var t=l(e);return"array"==(t="object"!=t?t:e?Array.isArray(e)?"array":t:"null")||"object"==t&&"number"==typeof e.length}function s(e){var t=l(e);return"object"==t&&null!=e||"function"==t}function o(e,t,n){return e.call.apply(e.bind,arguments)}function u(e,t,n){if(!e)throw Error();if(2<arguments.length){var r=Array.prototype.slice.call(arguments,2);return function(){var n=Array.prototype.slice.call(arguments);return Array.prototype.unshift.apply(n,r),e.apply(t,n)}}return function(){return e.apply(t,arguments)}}function c(e,t,n){return(c=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?o:u).apply(null,arguments)}function h(e,t){var n=Array.prototype.slice.call(arguments,1);return function(){var t=n.slice();return t.push.apply(t,arguments),e.apply(this,t)}}function f(e,t){function n(){}n.prototype=t.prototype,e.aa=t.prototype,e.prototype=new n,e.prototype.constructor=e,e.Qb=function(e,n,r){for(var i=Array(arguments.length-2),a=2;a<arguments.length;a++)i[a-2]=arguments[a];return t.prototype[n].apply(e,i)}}function v(e){var t=e.length;if(0<t){for(var n=Array(t),r=0;r<t;r++)n[r]=e[r];return n}return[]}function g(e,t){for(var n=1;n<arguments.length;n++){var r=arguments[n];if(a(r)){var i=e.length||0,s=r.length||0;e.length=i+s;for(var o=0;o<s;o++)e[i+o]=r[o]}else e.push(r)}}var m=function(){function e(t,n){I(this,e),this.i=t,this.j=n,this.h=0,this.g=null}return T(e,[{key:"get",value:function(){var e;return 0<this.h?(this.h--,e=this.g,this.g=e.next,e.next=null):e=this.i(),e}}]),e}();function k(e){return/^[\s\xa0]*$/.test(e)}function w(){var e=i.navigator;return e&&(e=e.userAgent)?e:""}function _(e){return _[" "](e),e}_[" "]=function(){};var E=!(-1==w().indexOf("Gecko")||-1!=w().toLowerCase().indexOf("webkit")&&-1==w().indexOf("Edge")||-1!=w().indexOf("Trident")||-1!=w().indexOf("MSIE")||-1!=w().indexOf("Edge"));function S(e,t,n){for(var r in e)t.call(n,e[r],r,e)}function x(e){var t={};for(var n in e)t[n]=e[n];return t}var A="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleStr
2ing toString valueOf".split(" ");function C(e,t){for(var n,r,i=1;i<arguments.length;i++){for(n in r=arguments[i])e[n]=r[n];for(var a=0;a<A.length;a++)n=A[a],Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}}function P(e){var t=1;e=e.split(":");for(var n=[];0<t&&e.length;)n.push(e.shift()),t--;return e.length&&n.push(e.join(":")),n}function O(e){i.setTimeout(function(){throw e},0)}function R(){var e=F,t=null;return e.g&&(t=e.g,e.g=e.g.next,e.g||(e.h=null),t.next=null),t}var N,D=function(){function e(){I(this,e),this.h=this.g=null}return T(e,[{key:"add",value:function(e,t){var n=L.get();n.set(e,t),this.h?this.h.next=n:this.g=n,this.h=n}}]),e}(),L=new m(function(){return new M},function(e){return e.reset()}),M=function(){function e(){I(this,e),this.next=this.g=this.h=null}return T(e,[{key:"set",value:function(e,t){this.h=e,this.g=t,this.next=null}},{key:"reset",value:function(){this.next=this.g=this.h=null}}]),e}(),U=!1,F=new D,j=function(){var e=i.Promise.resolve(void 0);N=function(){e.then(V)}},V=function(){for(var e;e=R();){try{e.h.call(e.g)}catch(n){O(n)}var t=L;t.j(e),100>t.h&&(t.h++,e.next=t.g,t.g=e)}U=!1};function B(){this.s=this.s,this.C=this.C}function q(e,t){this.type=e,this.g=this.target=t,this.defaultPrevented=!1}B.prototype.s=!1,B.prototype.ma=function(){this.s||(this.s=!0,this.N())},B.prototype.N=function(){if(this.C)for(;this.C.length;)this.C.shift()()},q.prototype.h=function(){this.defaultPrevented=!0};var z=function(){if(!i.addEventListener||!Object.defineProperty)return!1;var e=!1,t=Object.defineProperty({},"passive",{get:function(){e=!0}});try{var n=function(){};i.addEventListener("test",n,t),i.removeEventListener("test",n,t)}catch(n){}return e}();function H(e,t){if(q.call(this,e?e.type:""),this.relatedTarget=this.g=this.target=null,this.button=this.screenY=this.screenX=this.clientY=this.clientX=0,this.key="",this.metaKey=this.shiftKey=this.altKey=this.ctrlKey=!1,this.state=null,this.pointerId=0,this.pointerType="",this.i=null,e){var n=this.type=e.type,r=e.changedTouches&&e.changedTouches.length?e.changedTouches[0]:null;if(this.target=e.target||e.srcElement,this.g=t,t=e.relatedTarget){if(E){e:{try{_(t.nodeName);var i=!0;break e}catch(a){}i=!1}i||(t=null)}}else"mouseover"==n?t=e.fromElement:"mouseout"==n&&(t=e.toElement);this.relatedTarget=t,r?(this.clientX=void 0!==r.clientX?r.clientX:r.pageX,this.clientY=void 0!==r.clientY?r.clientY:r.pageY,this.screenX=r.screenX||0,this.screenY=r.screenY||0):(this.clientX=void 0!==e.clientX?e.clientX:e.pageX,this.clientY=void 0!==e.clientY?e.clientY:e.pageY,this.screenX=e.screenX||0,this.screenY=e.screenY||0),this.button=e.button,this.key=e.key||"",this.ctrlKey=e.ctrlKey,this.altKey=e.altKey,this.shiftKey=e.shiftKey,this.metaKey=e.metaKey,this.pointerId=e.pointerId||0,this.pointerType="string"==typeof e.pointerType?e.pointerType:K[e.pointerType]||"",this.state=e.state,this.i=e,e.defaultPrevented&&H.aa.h.call(this)}}f(H,q);var K={2:"touch",3:"pen",4:"mouse"};H.prototype.h=function(){H.aa.h.call(this);var e=this.i;e.preventDefault?e.preventDefault():e.returnValue=!1};var G="closure_listenable_"+(1e6*Math.random()|0),W=0;function Q(e,t,n,r,i){this.listener=e,this.proxy=null,this.src=t,this.type=n,this.capture=!!r,this.ha=i,this.key=++W,this.da=this.fa=!1}function Y(e){e.da=!0,e.listener=null,e.proxy=null,e.src=null,e.ha=null}function X(e){this.src=e,this.g={},this.h=0}function J(e,t){var n=t.type;if(n in e.g){var r,i=e.g[n],a=Array.prototype.indexOf.call(i,t,void 0);(r=0<=a)&&Array.prototype.splice.call(i,a,1),r&&(Y(t),0==e.g[n].length&&(delete e.g[n],e.h--))}}function $(e,t,n,r){for(var i=0;i<e.length;++i){var a=e[i];if(!a.da&&a.listener==t&&a.capture==!!n&&a.ha==r)return i}return-1}X.prototype.add=function(e,t,n,r,i){var a=e.toString();(e=this.g[a])||(e=this.g[a]=[],this.h++);var s=$(e,t,r,i);return-1<s?(t=e[s],n||(t.fa=!1)):((t=new Q(t,this.src,a,!!r,i)).fa=n,e.push(t)),t};var Z="closure_lm_"+(1e6*Math.random()|0),ee={};function te(e,t,n,r,i){if(r&&r.once)return re(e,t,n,r,i);if(Array.isArray(t)){for(var a=0;a<t.length;a++)te(e,t[a],n,r,i);return null}return n=le(n),e&&e[G]?e.K(t,n,s(r)?!!r.capture:!!r,i):ne(e,t,n,!1,r,i)}function ne(e,t,n,r,i,a){if(!t)throw Error("Invalid event type");var o=s(i)?!!i.capture:!!i,u=ue(e);
2if(u||(e[Z]=u=new X(e)),(n=u.add(t,n,r,o,a)).proxy)return n;if(r=function(){function e(n){return t.call(e.src,e.listener,n)}var t=oe;return e}(),n.proxy=r,r.src=e,r.listener=n,e.addEventListener)z||(i=o),void 0===i&&(i=!1),e.addEventListener(t.toString(),r,i);else if(e.attachEvent)e.attachEvent(se(t.toString()),r);else{if(!e.addListener||!e.removeListener)throw Error("addEventListener and attachEvent are unavailable.");e.addListener(r)}return n}function re(e,t,n,r,i){if(Array.isArray(t)){for(var a=0;a<t.length;a++)re(e,t[a],n,r,i);return null}return n=le(n),e&&e[G]?e.L(t,n,s(r)?!!r.capture:!!r,i):ne(e,t,n,!0,r,i)}function ie(e,t,n,r,i){if(Array.isArray(t))for(var a=0;a<t.length;a++)ie(e,t[a],n,r,i);else r=s(r)?!!r.capture:!!r,n=le(n),e&&e[G]?(e=e.i,(t=String(t).toString())in e.g&&(-1<(n=$(a=e.g[t],n,r,i))&&(Y(a[n]),Array.prototype.splice.call(a,n,1),0==a.length&&(delete e.g[t],e.h--)))):e&&(e=ue(e))&&(t=e.g[t.toString()],e=-1,t&&(e=$(t,n,r,i)),(n=-1<e?t[e]:null)&&ae(n))}function ae(e){if("number"!=typeof e&&e&&!e.da){var t=e.src;if(t&&t[G])J(t.i,e);else{var n=e.type,r=e.proxy;t.removeEventListener?t.removeEventListener(n,r,e.capture):t.detachEvent?t.detachEvent(se(n),r):t.addListener&&t.removeListener&&t.removeListener(r),(n=ue(t))?(J(n,e),0==n.h&&(n.src=null,t[Z]=null)):Y(e)}}}function se(e){return e in ee?ee[e]:ee[e]="on"+e}function oe(e,t){if(e.da)e=!0;else{t=new H(t,this);var n=e.listener,r=e.ha||e.src;e.fa&&ae(e),e=n.call(r,t)}return e}function ue(e){return(e=e[Z])instanceof X?e:null}var ce="__closure_events_fn_"+(1e9*Math.random()>>>0);function le(e){return"function"==typeof e?e:(e[ce]||(e[ce]=function(t){return e.handleEvent(t)}),e[ce])}function he(){B.call(this),this.i=new X(this),this.M=this,this.F=null}function fe(e,t){var n,r=e.F;if(r)for(n=[];r;r=r.F)n.push(r);if(e=e.M,r=t.type||t,"string"==typeof t)t=new q(t,e);else if(t instanceof q)t.target=t.target||e;else{var i=t;C(t=new q(r,e),i)}if(i=!0,n)for(var a=n.length-1;0<=a;a--){var s=t.g=n[a];i=de(s,r,!0,t)&&i}if(i=de(s=t.g=e,r,!0,t)&&i,i=de(s,r,!1,t)&&i,n)for(a=0;a<n.length;a++)i=de(s=t.g=n[a],r,!1,t)&&i}function de(e,t,n,r){if(!(t=e.i.g[String(t)]))return!0;t=t.concat();for(var i=!0,a=0;a<t.length;++a){var s=t[a];if(s&&!s.da&&s.capture==n){var o=s.listener,u=s.ha||s.src;s.fa&&J(e.i,s),i=!1!==o.call(u,r)&&i}}return i&&!r.defaultPrevented}function pe(e,t,n){if("function"==typeof e)n&&(e=c(e,n));else{if(!e||"function"!=typeof e.handleEvent)throw Error("Invalid listener argument");e=c(e.handleEvent,e)}return 2147483647<Number(t)?-1:i.setTimeout(e,t||0)}function ve(e){e.g=pe(function(){e.g=null,e.i&&(e.i=!1,ve(e))},e.l);var t=e.h;e.h=null,e.m.apply(null,t)}f(he,B),he.prototype[G]=!0,he.prototype.removeEventListener=function(e,t,n,r){ie(this,e,t,n,r)},he.prototype.N=function(){if(he.aa.N.call(this),this.i){var e,t=this.i;for(e in t.g){for(var n=t.g[e],r=0;r<n.length;r++)Y(n[r]);delete t.g[e],t.h--}}this.F=null},he.prototype.K=function(e,t,n,r){return this.i.add(String(e),t,!1,n,r)},he.prototype.L=function(e,t,n,r){return this.i.add(String(e),t,!0,n,r)};var ge=function(e){y(n,e);var t=Wc(n);function n(e,r){var i;return I(this,n),(i=t.call(this)).m=e,i.l=r,i.h=null,i.i=!1,i.g=null,i}return T(n,[{key:"j",value:function(e){this.h=arguments,this.g?this.i=!0:ve(this)}},{key:"N",value:function(){p(d(n.prototype),"N",this).call(this),this.g&&(i.clearTimeout(this.g),this.g=null,this.i=!1,this.h=null)}}]),n}(B);function ye(e){B.call(this),this.h=e,this.g={}}f(ye,B);var me=[];function ke(e){S(e.g,function(e,t){this.g.hasOwnProperty(t)&&ae(e)},e),e.g={}}ye.prototype.N=function(){ye.aa.N.call(this),ke(this)},ye.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")};var we=i.JSON.stringify,be=i.JSON.parse,_e=function(){function e(){I(this,e)}return T(e,[{key:"stringify",value:function(e){return i.JSON.stringify(e,void 0)}},{key:"parse",value:function(e){return i.JSON.parse(e,void 0)}}]),e}();function Ee(){}function Ie(e){return e.h||(e.h=e.i())}function Se(){}Ee.prototype.h=null;var Te={OPEN:"a",kb:"b",Ja:"c",wb:"d"};function xe(){q.call(this,"d")}function Ae(){q.call(this,"c")}f(xe,q),f(Ae,q);var Ce={},Pe=null;function Oe(){return Pe=Pe||new he}function Re(e){q.call(this,Ce.La,e)}function Ne(e){var t=Oe();fe(t,new Re(t))}function De(e,t){q.call(this,Ce.STAT_EVENT,e),this.stat=t}function Le(e){var t=Oe();fe(t,new De(t,e))}function Me(e,t){q.call(this,Ce.Ma,e),this.size=t}function Ue(e,t){if("function"!=typeof e)throw Error("Fn must not be null and must be a function");return i.setTimeout(function(){e()},t)}function Fe(){this.g=!0}function je(e,t,n,r){e.info(function(){return"XMLHTTP TEXT ("+t+"): "+function(e,t){if(!e.g)return t;if(!t)return null;try{var n=JSON.parse(t);if(n)for(e=0;e<n.length;e++)if(Array.isArray(n[e])){var r=n[e];if(!(2>r.length)){var i=r[1];if(Array.isArray(i)&&!(1>i.length)){var a=i[0];if("noop"!=a&&"stop"!=a&&"close"!=a)for(var s=1;s<i.length;s++)i[s]=""}}}return we(n)}catch(o){return t}}(e,n)+(r?" "+r:"")})}Ce.La="serverreachability",f(Re,q),Ce.STAT_EVENT="statevent",f(De,q),Ce.Ma="timingevent",f(Me,q),Fe.prototype.xa=function(){this.g=!1},Fe.prototype.info=function(){};var Ve,Be={NO_ERROR:0,gb:1,tb:2,sb:3,nb:4,rb:5,ub:6,Ia:7,TIMEOUT:8,xb:9},qe={lb:"complete",Hb:"success",Ja:"error",Ia:"abort",zb:"ready",Ab:"readystatechange",TIMEOUT:"timeout",vb:"incrementaldata",yb:"progress",ob:"downloadprogress",Pb:"uploadprogress"};function ze(){}function He(e,t,n,r){this.j=e,this.i=t,this.l=n,this.R=r||1,this.U=new ye(this),this.I=45e3,this.H=null,this.o=!1,this.m=this.A=this.v=this.L=this.F=this.S=this.B=null,this.D=[],this.g=null,this.C=0,this.s=this.u=null,this.X=-1,this.J=!1,this.O=0,this.M=null,this.W=this.K=this.T=this.P=!1,this.h=new Ke}function Ke(){this.i=null,this.g="",this.h=!1}f(ze,Ee),ze.prototype.g=function(){return new XMLHttpRequest},ze.prototype.i=function(){return{}},Ve=new ze;var Ge={},We={};function Qe(e,t,n){e.L=1,e.v=wt(vt(t)),e.m=n,e.P=!0,Ye(e,null)}function Ye(e,t){e.F=Date.now(),$e(e),e.A=vt(e.v);var n=e.A,r=e.R;Array.isArray(r)||(r=[String(r)]),Dt(n.i,"t",r),e.C=0,n=e.j.J,e.h=new Ke,e.g=_n(e.j,n?t:null,!e.m),
20<e.O&&(e.M=new ge(c(e.Y,e,e.g),e.O)),t=e.U,n=e.g,r=e.ca;var i="readystatechange";Array.isArray(i)||(i&&(me[0]=i.toString()),i=me);for(var a=0;a<i.length;a++){var s=te(n,i[a],r||t.handleEvent,!1,t.h||t);if(!s)break;t.g[s.key]=s}t=e.H?x(e.H):{},e.m?(e.u||(e.u="POST"),t["Content-Type"]="application/x-www-form-urlencoded",e.g.ea(e.A,e.u,e.m,t)):(e.u="GET",e.g.ea(e.A,e.u,null,t)),Ne(),function(e,t,n,r,i,a){e.info(function(){if(e.g)if(a)for(var s="",o=a.split("&"),u=0;u<o.length;u++){var c=o[u].split("=");if(1<c.length){var l=c[0];c=c[1];var h=l.split("_");s=2<=h.length&&"type"==h[1]?s+(l+"=")+c+"&":s+(l+"=redacted&")}}else s=null;else s=a;return"XMLHTTP REQ ("+r+") [attempt "+i+"]: "+t+"\n"+n+"\n"+s})}(e.i,e.u,e.A,e.l,e.R,e.m)}function Xe(e){return!!e.g&&("GET"==e.u&&2!=e.L&&e.j.Ca)}function Je(e,t){var n=e.C,r=t.indexOf("\n",n);return-1==r?We:(n=Number(t.substring(n,r)),isNaN(n)?Ge:(r+=1)+n>t.length?We:(t=t.slice(r,r+n),e.C=r+n,t))}function $e(e){e.S=Date.now()+e.I,Ze(e,e.I)}function Ze(e,t){if(null!=e.B)throw Error("WatchDog timer not null");e.B=Ue(c(e.ba,e),t)}function et(e){e.B&&(i.clearTimeout(e.B),e.B=null)}function tt(e){0==e.j.G||e.J||yn(e.j,e)}function nt(e){et(e);var t=e.M;t&&"function"==typeof t.ma&&t.ma(),e.M=null,ke(e.U),e.g&&(t=e.g,e.g=null,t.abort(),t.ma())}function rt(e,t){try{var n=e.j;if(0!=n.G&&(n.g==e||ut(n.h,e)))if(!e.K&&ut(n.h,e)&&3==n.G){try{var r=n.Da.g.parse(t)}catch(a){r=null}if(Array.isArray(r)&&3==r.length){var i=r;if(0==i[0]){e:if(!n.u){if(n.g){if(!(n.g.F+3e3<e.F))break e;gn(n),sn(n)}dn(n),Le(18)}}else n.za=i[1],0<n.za-n.T&&37500>i[2]&&n.F&&0==n.v&&!n.C&&(n.C=Ue(c(n.Za,n),6e3));if(1>=ot(n.h)&&n.ca){try{n.ca()}catch(a){}n.ca=void 0}}else kn(n,11)}else if((e.K||n.g==e)&&gn(n),!k(t))for(i=n.Da.g.parse(t),t=0;t<i.length;t++){var a=i[t];if(n.T=a[0],a=a[1],2==n.G)if("c"==a[0]){n.K=a[1],n.ia=a[2];var s=a[3];null!=s&&(n.la=s,n.j.info("VER="+n.la));var o=a[4];null!=o&&(n.Aa=o,n.j.info("SVER="+n.Aa));var u=a[5];null!=u&&"number"==typeof u&&0<u&&(r=1.5*u,n.L=r,n.j.info("backChannelRequestTimeoutMs_="+r)),r=n;var l=e.g;if(l){var h=l.g?l.g.getResponseHeader("X-Client-Wire-Protocol"):null;if(h){var f=r.h;f.g||-1==h.indexOf("spdy")&&-1==h.indexOf("quic")&&-1==h.indexOf("h2")||(f.j=f.l,f.g=new Set,f.h&&(ct(f,f.h),f.h=null))}if(r.D){var d=l.g?l.g.getResponseHeader("X-HTTP-Session-Id"):null;d&&(r.ya=d,kt(r.I,r.D,d))}}n.G=3,n.l&&n.l.ua(),n.ba&&(n.R=Date.now()-e.F,n.j.info("Handshake RTT: "+n.R+"ms"));var p=e;if((r=n).qa=bn(r,r.J?r.ia:null,r.W),p.K){lt(r.h,p);var v=p,g=r.L;g&&(v.I=g),v.B&&(et(v),$e(v)),r.g=p}else fn(r);0<n.i.length&&un(n)}else"stop"!=a[0]&&"close"!=a[0]||kn(n,7);else 3==n.G&&("stop"==a[0]||"close"==a[0]?"stop"==a[0]?kn(n,7):an(n):"noop"!=a[0]&&n.l&&n.l.ta(a),n.v=0)}Ne()}catch(a){}}He.prototype.ca=function(e){e=e.target;var t=this.M;t&&3==en(e)?t.j():this.Y(e)},He.prototype.Y=function(e){try{if(e==this.g)e:{var t=en(this.g),n=this.g.Ba();this.g.Z();if(!(3>t)&&(3!=t||this.g&&(this.h.h||this.g.oa()||tn(this.g)))){this.J||4!=t||7==n||Ne(),et(this);var r=this.g.Z();this.X=r;t:if(Xe(this)){var a=tn(this.g);e="";var s=a.length,o=4==en(this.g);if(!this.h.i){if("undefined"==typeof TextDecoder){nt(this),tt(this);var u="";break t}this.h.i=new i.TextDecoder}for(n=0;n<s;n++)this.h.h=!0,e+=this.h.i.decode(a[n],{stream:!(o&&n==s-1)});a.length=0,this.h.g+=e,this.C=0,u=this.h.g}else u=this.g.oa();if(this.o=200==r,function(e,t,n,r,i,a,s){e.info(function(){return"XMLHTTP RESP ("+r+") [ attempt "+i+"]: "+t+"\n"+n+"\n"+a+" "+s})}(this.i,this.u,this.A,this.l,this.R,t,r),this.o){if(this.T&&!this.K){t:{if(this.g){var c,l=this.g;if((c=l.g?l.g.getResponseHeader("X-HTTP-Initial-Response"):null)&&!k(c)){var h=c;break t}}h=null}if(!(r=h)){this.o=!1,this.s=3,Le(12),nt(this),tt(this);break e}je(this.i,this.l,r,"Initial handshake response via X-HTTP-Initial-Response"),this.K=!0,rt(this,r)}if(this.P){var f;for(r=!0;!this.J&&this.C<u.length;){if((f=Je(this,u))==We){4==t&&(this.s=4,Le(14),r=!1),je(this.i,this.l,null,"[Incomplete Response]");break}if(f==Ge){this.s=4,Le(15),je(this.i,this.l,u,"[Invalid Chunk]"),r=!1;break}je(this.i,this.l,f,null),rt(this,f)}if(Xe(this)&&0!=this.C&&(this.h.g=this.h.g.slice(this.C),this.C=0),4!=t||0!=u.length||this.h.h||(this.s=1,Le(16),r=!1),this.o=this.o&&r,r){if(0<u.length&&!this.W){this.W=!0;var d=this.j;d.g==this&&d.ba&&!d.M&&(d.j.info("Great, no buffering proxy detected. Bytes received: "+u.length),pn(d),d.M=!0,Le(11))}}else je(this.i,this.l,u,"[Invalid Chunked Response]"),nt(this),tt(this)}else je(this.i,this.l,u,null),rt(this,u);4==t&&nt(this),this.o&&!this.J&&(4==t?yn(this.j,this):(this.o=!1,$e(this)))}else(function(e){var t={};e=(e.g&&2<=en(e)&&e.g.getAllResponseHeaders()||"").split("\r\n");for(var n=0;n<e.length;n++)if(!k(e[n])){var r=P(e[n]),i=r[0];if("string"==typeof(r=r[1])){r=r.trim();var a=t[i]||[];t[i]=a,a.push(r)}}!function(e,t){for(var n in e)t.call(void 0,e[n],n,e)}(t,function(e){return e.join(", ")})})(this.g),400==r&&0<u.indexOf("Unknown SID")?(this.s=3,Le(12)):(this.s=0,Le(13)),nt(this),tt(this)}}}catch(t){}},He.prototype.cancel=function(){this.J=!0,nt(this)},He.prototype.ba=function(){this.B=null;var e=Date.now();0<=e-this.S?(function(e,t){e.info(function(){return"TIMEOUT: "+t})}(this.i,this.A),2!=this.L&&(Ne(),Le(17)),nt(this),this.s=2,tt(this)):Ze(this,this.S-e)};var it=T(function e(t,n){I(this,e),this.g=t,this.map=n});function at(e){this.l=e||10,i.PerformanceNavigationTiming?e=0<(e=i.performance.getEntriesByType("navigation")).length&&("hq"==e[0].nextHopProtocol||"h2"==e[0].nextHopProtocol):e=!!(i.chrome&&i.chrome.loadTimes&&i.chrome.loadTimes()&&i.chrome.loadTimes().wasFetchedViaSpdy),this.j=e?this.l:1,this.g=null,1<this.j&&(this.g=new Set),this.h=null,this.i=[]}function st(e){return!!e.h||!!e.g&&e.g.size>=e.j}function ot(e){return e.h?1:e.g?e.g.size:0}function ut(e,t){return e.h?e.h==t:!!e.g&&e.g.has(t)}function ct(e,t){e.g?e.g.add(t):e.h=t}function lt(e,t){e.h&&e.h==t?e.h=null:e.g&&e.g.has(t)&&e.g.delete(t)}function ht(e){if(null!=e.h)return e.i.concat(e.h.D);if(null!=e.g&&0!==e.g.size){var t,n=e.i,r=Kc(e.g.values());try{for(r.s();!(t=r.n()).done;){var i=t.value;n=n.concat(i.D)}}catch(a){r.e(a)}finally{r.f()}return n}return v(e.i)}function ft(e,t){if(e.forEach&&"function"==typeof e.forEach)e.forEach(t,void 0);else if(a(e)||"string"==typeof e)Array.prototype.forEach.call(e,t,void 0);else for(var n=function(e){if(e.na&&"function"==typeof e.na)return e.na();if(!e.V||"function"!=typeof e.V){if("undefined"!=typeof Map&&e instanceof Map)return Array.from(e.keys());if(!("undefined"!=typeof Set&&e instanceof Set)){if(a(e)||"string"==typeof e){var t=[];e=e.length;for(var n=0;n<e;n++)t.push(n);return t}for(var r in t=[],n=0,e)t[n++]=r;return t}}}(e),r=function(e){if(e.V&&"function"==typeof e.V)return e.V();if("undefined"!=typeof Map&&e instanceof Map||"undefined"!=typeof Set&&e instanceof Set)return Array.from(e.values());if("string"==typeof e)return e.split("");
2if(a(e)){for(var t=[],n=e.length,r=0;r<n;r++)t.push(e[r]);return t}for(r in t=[],n=0,e)t[n++]=e[r];return t}(e),i=r.length,s=0;s<i;s++)t.call(void 0,r[s],n&&n[s],e)}at.prototype.cancel=function(){if(this.i=ht(this),this.h)this.h.cancel(),this.h=null;else if(this.g&&0!==this.g.size){var e,t=Kc(this.g.values());try{for(t.s();!(e=t.n()).done;){e.value.cancel()}}catch(n){t.e(n)}finally{t.f()}this.g.clear()}};var dt=RegExp("^(?:([^:/?#.]+):)?(?://(?:([^\\\\/?#]*)@)?([^\\\\/?#]*?)(?::([0-9]+))?(?=[\\\\/?#]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#([\\s\\S]*))?$");function pt(e){if(this.g=this.o=this.j="",this.s=null,this.m=this.l="",this.h=!1,e instanceof pt){this.h=e.h,gt(this,e.j),this.o=e.o,this.g=e.g,yt(this,e.s),this.l=e.l;var t=e.i,n=new Pt;n.i=t.i,t.g&&(n.g=new Map(t.g),n.h=t.h),mt(this,n),this.m=e.m}else e&&(t=String(e).match(dt))?(this.h=!1,gt(this,t[1]||"",!0),this.o=bt(t[2]||""),this.g=bt(t[3]||"",!0),yt(this,t[4]),this.l=bt(t[5]||"",!0),mt(this,t[6]||"",!0),this.m=bt(t[7]||"")):(this.h=!1,this.i=new Pt(null,this.h))}function vt(e){return new pt(e)}function gt(e,t,n){e.j=n?bt(t,!0):t,e.j&&(e.j=e.j.replace(/:$/,""))}function yt(e,t){if(t){if(t=Number(t),isNaN(t)||0>t)throw Error("Bad port number "+t);e.s=t}else e.s=null}function mt(e,t,n){t instanceof Pt?(e.i=t,function(e,t){t&&!e.j&&(Ot(e),e.i=null,e.g.forEach(function(e,t){var n=t.toLowerCase();t!=n&&(Rt(this,t),Dt(this,n,e))},e)),e.j=t}(e.i,e.h)):(n||(t=_t(t,At)),e.i=new Pt(t,e.h))}function kt(e,t,n){e.i.set(t,n)}function wt(e){return kt(e,"zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^Date.now()).toString(36)),e}function bt(e,t){return e?t?decodeURI(e.replace(/%25/g,"%2525")):decodeURIComponent(e):""}function _t(e,t,n){return"string"==typeof e?(e=encodeURI(e).replace(t,Et),n&&(e=e.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),e):null}function Et(e){return"%"+((e=e.charCodeAt(0))>>4&15).toString(16)+(15&e).toString(16)}pt.prototype.toString=function(){var e=[],t=this.j;t&&e.push(_t(t,St,!0),":");var n=this.g;return(n||"file"==t)&&(e.push("//"),(t=this.o)&&e.push(_t(t,St,!0),"@"),e.push(encodeURIComponent(String(n)).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),null!=(n=this.s)&&e.push(":",String(n))),(n=this.l)&&(this.g&&"/"!=n.charAt(0)&&e.push("/"),e.push(_t(n,"/"==n.charAt(0)?xt:Tt,!0))
2),(n=this.i.toString())&&e.push("?",n),(n=this.m)&&e.push("#",_t(n,Ct)),e.join("")};var It,St=/[#\/\?@]/g,Tt=/[#\?:]/g,xt=/[#\?]/g,At=/[#\?@]/g,Ct=/#/g;function Pt(e,t){this.h=this.g=null,this.i=e||null,this.j=!!t}function Ot(e){e.g||(e.g=new Map,e.h=0,e.i&&function(e,t){if(e){e=e.split("&");for(var n=0;n<e.length;n++){var r=e[n].indexOf("="),i=null;if(0<=r){var a=e[n].substring(0,r);i=e[n].substring(r+1)}else a=e[n];t(a,i?decodeURIComponent(i.replace(/\+/g," ")):"")}}}(e.i,function(t,n){e.add(decodeURIComponent(t.replace(/\+/g," ")),n)}))}function Rt(e,t){Ot(e),t=Lt(e,t),e.g.has(t)&&(e.i=null,e.h-=e.g.get(t).length,e.g.delete(t))}function Nt(e,t){return Ot(e),t=Lt(e,t),e.g.has(t)}function Dt(e,t,n){Rt(e,t),0<n.length&&(e.i=null,e.g.set(Lt(e,t),v(n)),e.h+=n.length)}function Lt(e,t){return t=String(t),e.j&&(t=t.toLowerCase()),t}function Mt(e,t,n,r,i){try{i&&(i.onload=null,i.onerror=null,i.onabort=null,i.ontimeout=null),r(n)}catch(a){}}function Ut(){this.g=new _e}function Ft(e,t,n){var r=n||"";try{ft(e,function(e,n){var i=e;s(e)&&(i=we(e)),t.push(r+n+"="+encodeURIComponent(i))})}catch(i){throw t.push(r+"type="+encodeURIComponent("_badmap")),i}}function jt(e){this.l=e.Ub||null,this.j=e.eb||!1}function Vt(e,t){he.call(this),this.D=e,this.o=t,this.m=void 0,this.status=this.readyState=0,this.responseType=this.responseText=this.response=this.statusText="",this.onreadystatechange=null,this.u=new Headers,this.h=null,this.B="GET",this.A="",this.g=!1,this.v=this.j=this.l=null}function Bt(e){e.j.read().then(e.Pa.bind(e)).catch(e.ga.bind(e))}function qt(e){e.readyState=4,e.l=null,e.j=null,e.v=null,zt(e)}function zt(e){e.onreadystatechange&&e.onreadystatechange.call(e)}function Ht(e){var t="";return S(e,function(e,n){t+=n,t+=":",t+=e,t+="\r\n"}),t}function Kt(e,t,n){e:{for(r in n){var r=!1;break e}r=!0}r||(n=Ht(n),"string"==typeof e?null!=n&&encodeURIComponent(String(n)):kt(e,t,n))}function Gt(e){he.call(this),this.headers=new Map,this.o=e||null,this.h=!1,this.v=this.g=null,this.D="",this.m=0,this.l="",this.j=this.B=this.u=this.A=!1,this.I=null,this.H="",this.J=!1}(e=Pt.prototype).add=function(e,t){Ot(this),this.i=null,e=Lt(this,e);var n=this.g.get(e);return n||this.g.set(e,n=[]),n.push(t),this.h+=1,this},e.forEach=function(e,t){Ot(this),this.g.forEach(function(n,r){n.forEach(function(n){e.call(t,n,r,this)},this)},this)},e.na=function(){Ot(this);for(var e=Array.from(this.g.values()),t=Array.from(this.g.keys()),n=[],r=0;r<t.length;r++)for(var i=e[r],a=0;a<i.length;a++)n.push(t[r]);return n},e.V=function(e){Ot(this);var t=[];if("string"==typeof e)Nt(this,e)&&(t=t.concat(this.g.get(Lt(this,e))));else{e=Array.from(this.g.values());for(var n=0;n<e.length;n++)t=t.concat(e[n])}return t},e.set=function(e,t){return Ot(this),this.i=null,Nt(this,e=Lt(this,e))&&(this.h-=this.g.get(e).length),this.g.set(e,[t]),this.h+=1,this},e.get=function(e,t){return e&&0<(e=this.V(e)).length?String(e[0]):t},e.toString=function(){if(this.i)return this.i;if(!this.g)return"";for(var e=[],t=Array.from(this.g.keys()),n=0;n<t.length;n++){var r=t[n],i=encodeURIComponent(String(r)),a=this.V(r);for(r=0;r<a.length;r++){var s=i;""!==a[r]&&(s+="="+encodeURIComponent(String(a[r]))),e.push(s)}}return this.i=e.join("&")},f(jt,Ee),jt.prototype.g=function(){return new Vt(this.l,this.j)},jt.prototype.i=(It={},function(){return It}),f(Vt,he),(e=Vt.prototype).open=function(e,t){if(0!=this.readyState)throw this.abort(),Error("Error reopening a connection");this.B=e,this.A=t,this.readyState=1,zt(this)},e.send=function(e){if(1!=this.readyState)throw this.abort(),Error("need to call open() first. ");this.g=!0;var t={headers:this.u,method:this.B,credentials:this.m,cache:void 0};e&&(t.body=e),(this.D||i).fetch(new Request(this.A,t)).then(this.Sa.bind(this),this.ga.bind(this))},e.abort=function(){this.response=this.responseText="",this.u=new Headers,this.status=0,this.j&&this.j.cancel("Request was aborted.").catch(function(){}),1<=this.readyState&&this.g&&4!=this.readyState&&(this.g=!1,qt(this)),this.readyState=0},e.Sa=function(e){if(this.g&&(this.l=e,this.h||(this.status=this.l.status,this.statusText=this.l.statusText,this.h=e.headers,this.readyState=2,zt(this)),this.g&&(this.readyState=3,zt(this),this.g)))if("arraybuffer"===this.responseType)e.arrayBuffer().then(this.Qa.bind(this),this.ga.bind(this));else if(void 0!==i.ReadableStream&&"body"in e){if(this.j=e.body.getReader(),this.o){if(this.responseType)throw Error('responseType must be empty for "streamBinaryChunks" mode responses.');this.response=[]}else this.response=this.responseText="",this.v=new TextDecoder;Bt(this)}else e.text().then(this.Ra.bind(this),this.ga.bind(this))},e.Pa=function(e){if(this.g){if(this.o&&e.value)this.response.push(e.value);else if(!this.o){var t=e.value?e.value:new Uint8Array(0);(t=this.v.decode(t,{stream:!e.done}))&&(this.response=this.responseText+=t)}e.done?qt(this):zt(this),3==this.readyState&&Bt(this)}},e.Ra=function(e){this.g&&(this.response=this.responseText=e,qt(this))},e.Qa=function(e){this.g&&(this.response=e,qt(this))},e.ga=function(){this.g&&qt(this)},e.setRequestHeader=function(e,t){this.u.append(e,t)},e.getResponseHeader=function(e){return this.h&&this.h.get(e.toLowerCase())||""},e.getAllResponseHeaders=function(){if(!this.h)return"";for(var e=[],t=this.h.entries(),n=t.next();!n.done;)n=n.value,e.push(n[0]+": "+n[1]),n=t.next();return e.join("\r\n")},Object.defineProperty(Vt.prototype,"withCredentials",{get:function(){return"include"===this.m},set:function(e){this.m=e?"include":"same-origin"}}),f(Gt,he);var Wt=/^https?$/i,Qt=["POST","PUT"];function Yt(e,t){e.h=!1,e.g&&(e.j=!0,e.g.abort(),e.j=!1),e.l=t,e.m=5,Xt(e),$t(e)}function Xt(e){e.A||(e.A=!0,fe(e,"complete"),fe(e,"error"))}function Jt(e){if(e.h&&void 0!==r&&(!e.v[1]||4!=en(e)||2!=e.Z()))if(e.u&&4==en(e))pe(e.Ea,0,e);else if(fe(e,"readystatechange"),4==en(e)){e.h=!1;try{var t,n=e.Z();e:switch(n){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var a=!0;break e;default:a=!1}if(!(t=a)){var s;if(s=0===n){var o=String(e.D).match(dt)[1]||null;!o&&i.self&&i.self.location&&(o=i.self.location.protocol.slice(0,-1)),s=!Wt.test(o?o.toLowerCase():"")}t=s}if(t)fe(e,"complete"),fe(e,"success");else{e.m=6;try{var u=2<en(e)?e.g.statusText:""}catch(c){u=""}e.l=u+" ["+e.Z()+"]",Xt(e)}}finally{$t(e)}}}function $t(e,t){if(e.g){Zt(e);var n=e.g,r=e.v[0]?function(){}:null;e.g=null,e.v=null,t||fe(e,"ready");try{n.onreadystatechange=r}catch(i){}}}function Zt(e){e.I&&(i.clearTimeout(e.I),e.I=null)}function en(e){return e.g?e.g.readyState:0}function tn(e){try{if(!e.g)return null;if("response"in e.g)return e.g.response;switch(e.H){case"":case"text":return e.g.responseText;case"arraybuffer":if("mozResponseArrayBuffer"in e.g)return e.g.mozResponseArrayBuffer}return null}catch(cl){return null}}
2function nn(e,t,n){return n&&n.internalChannelParams&&n.internalChannelParams[e]||t}function rn(e){this.Aa=0,this.i=[],this.j=new Fe,this.ia=this.qa=this.I=this.W=this.g=this.ya=this.D=this.H=this.m=this.S=this.o=null,this.Ya=this.U=0,this.Va=nn("failFast",!1,e),this.F=this.C=this.u=this.s=this.l=null,this.X=!0,this.za=this.T=-1,this.Y=this.v=this.B=0,this.Ta=nn("baseRetryDelayMs",5e3,e),this.cb=nn("retryDelaySeedMs",1e4,e),this.Wa=nn("forwardChannelMaxRetries",2,e),this.wa=nn("forwardChannelRequestTimeoutMs",2e4,e),this.pa=e&&e.xmlHttpFactory||void 0,this.Xa=e&&e.Tb||void 0,this.Ca=e&&e.useFetchStreams||!1,this.L=void 0,this.J=e&&e.supportsCrossDomainXhr||!1,this.K="",this.h=new at(e&&e.concurrentRequestLimit),this.Da=new Ut,this.P=e&&e.fastHandshake||!1,this.O=e&&e.encodeInitMessageHeaders||!1,this.P&&this.O&&(this.O=!1),this.Ua=e&&e.Rb||!1,e&&e.xa&&this.j.xa(),e&&e.forceLongPolling&&(this.X=!1),this.ba=!this.P&&this.X&&e&&e.detectBufferingProxy||!1,this.ja=void 0,e&&e.longPollingTimeout&&0<e.longPollingTimeout&&(this.ja=e.longPollingTimeout),this.ca=void 0,this.R=0,this.M=!1,this.ka=this.A=null}function an(e){if(on(e),3==e.G){var t=e.U++,n=vt(e.I);if(kt(n,"SID",e.K),kt(n,"RID",t),kt(n,"TYPE","terminate"),ln(e,n),(t=new He(e,e.j,t)).L=2,t.v=wt(vt(n)),n=!1,i.navigator&&i.navigator.sendBeacon)try{n=i.navigator.sendBeacon(t.v.toString(),"")}catch(r){}!n&&i.Image&&((new Image).src=t.v,n=!0),n||(t.g=_n(t.j,null),t.g.ea(t.v)),t.F=Date.now(),$e(t)}wn(e)}function sn(e){e.g&&(pn(e),e.g.cancel(),e.g=null)}function on(e){sn(e),e.u&&(i.clearTimeout(e.u),e.u=null),gn(e),e.h.cancel(),e.s&&("number"==typeof e.s&&i.clearTimeout(e.s),e.s=null)}function un(e){if(!st(e.h)&&!e.s){e.s=!0;var t=e.Ga;N||j(),U||(N(),U=!0),F.add(t,e),e.B=0}}function cn(e,t){var n;n=t?t.l:e.U++;var r=vt(e.I);kt(r,"SID",e.K),kt(r,"RID",n),kt(r,"AID",e.T),ln(e,r),e.m&&e.o&&Kt(r,e.m,e.o),n=new He(e,e.j,n,e.B+1),null===e.m&&(n.H=e.o),t&&(e.i=t.D.concat(e.i)),t=hn(e,n,1e3),n.I=Math.round(.5*e.wa)+Math.round(.5*e.wa*Math.random()),ct(e.h,n),Qe(n,r,t)}function ln(e,t){e.H&&S(e.H,function(e,n){kt(t,n,e)}),e.l&&ft({},function(e,n){kt(t,n,e)})}function hn(e,t,n){n=Math.min(e.i.length,n);var r=e.l?c(e.l.Na,e.l,e):null;e:for(var i=e.i,a=-1;;){var s=["count="+n];-1==a?0<n?(a=i[0].g,s.push("ofs="+a)):a=0:s.push("ofs="+a);for(var o=!0,u=0;u<n;u++){var l=i[u].g,h=i[u].map;if(0>(l-=a))a=Math.max(0,i[u].g-100),o=!1;else try{Ft(h,s,"req"+l+"_")}catch(f){r&&r(h)}}if(o){r=s.join("&");break e}}return e=e.i.splice(0,n),t.D=e,r}function fn(e){if(!e.g&&!e.u){e.Y=1;var t=e.Fa;N||j(),U||(N(),U=!0),F.add(t,e),e.v=0}}function dn(e){return!(e.g||e.u||3<=e.v)&&(e.Y++,e.u=Ue(c(e.Fa,e),mn(e,e.v)),e.v++,!0)}function pn(e){null!=e.A&&(i.clearTimeout(e.A),e.A=null)}function vn(e){e.g=new He(e,e.j,"rpc",e.Y),null===e.m&&(e.g.H=e.o),e.g.O=0;var t=vt(e.qa);kt(t,"RID","rpc"),kt(t,"SID",e.K),kt(t,"AID",e.T),kt(t,"CI",e.F?"0":"1"),!e.F&&e.ja&&kt(t,"TO",e.ja),kt(t,"TYPE","xmlhttp"),ln(e,t),e.m&&e.o&&Kt(t,e.m,e.o),e.L&&(e.g.I=e.L);var n=e.g;e=e.ia,n.L=1,n.v=wt(vt(t)),n.m=null,n.P=!0,Ye(n,e)}function gn(e){null!=e.C&&(i.clearTimeout(e.C),e.C=null)}function yn(e,t){var n=null;if(e.g==t){gn(e),pn(e),e.g=null;var r=2}else{if(!ut(e.h,t))return;n=t.D,lt(e.h,t),r=1}if(0!=e.G)if(t.o)if(1==r){n=t.m?t.m.length:0,t=Date.now()-t.F;var i=e.B;fe(r=Oe(),new Me(r,n)),un(e)}else fn(e);else if(3==(i=t.s)||0==i&&0<t.X||!(1==r&&function(e,t){return!(ot(e.h)>=e.h.j-(e.s?1:0)||(e.s?(e.i=t.D.concat(e.i),0):1==e.G||2==e.G||e.B>=(e.Va?0:e.Wa)||(e.s=Ue(c(e.Ga,e,t),mn(e,e.B)),e.B++,0)))}(e,t)||2==r&&dn(e)))switch(n&&0<n.length&&(t=e.h,t.i=t.i.concat(n)),i){case 1:kn(e,5);break;case 4:kn(e,10);break;case 3:kn(e,6);break;default:kn(e,2)}}function mn(e,t){var n=e.Ta+Math.floor(Math.random()*e.cb);return e.isActive()||(n*=2),n*t}function kn(e,t){if(e.j.info("Error code "+t),2==t){var n=c(e.fb,e),r=e.Xa,a=!r;r=new pt(r||"//www.google.com/images/cleardot.gif"),i.location&&"http"==i.location.protocol||gt(r,"https"),wt(r),a?function(e,t){var n=new Fe;if(i.Image){var r=new Image;r.onload=h(Mt,n,"TestLoadImage: loaded",!0,t,r),r.onerror=h(Mt,n,"TestLoadImage: error",!1,t,r),r.onabort=h(Mt,n,"TestLoadImage: abort",!1,t,r),r.ontimeout=h(Mt,n,"TestLoadImage: timeout",!1,t,r),i.setTimeout(function(){r.ontimeout&&r.ontimeout()},1e4),r.src=e}else t(!1)}(r.toString(),n):function(e,t){new Fe;var n=new AbortController,r=setTimeout(function(){n.abort(),Mt(0,0,!1,t)},1e4);fetch(e,{signal:n.signal}).then(function(e){clearTimeout(r),e.ok?Mt(0,0,!0,t):Mt(0,0,!1,t)}).catch(function(){clearTimeout(r),Mt(0,0,!1,t)})}(r.toString(),n)}else Le(2);e.G=0,e.l&&e.l.sa(t),wn(e),on(e)}function wn(e){if(e.G=0,e.ka=[],e.l){var t=ht(e.h);0==t.length&&0==e.i.length||(g(e.ka,t),g(e.ka,e.i),e.h.i.length=0,v(e.i),e.i.length=0),e.l.ra()}}function bn(e,t,n){var r=n instanceof pt?vt(n):new pt(n);if(""!=r.g)t&&(r.g=t+"."+r.g),yt(r,r.s);else{var a=i.location;r=a.protocol,t=t?t+"."+a.hostname:a.hostname,a=+a.port;var s=new pt(null);
2r&>(s,r),t&&(s.g=t),a&&yt(s,a),n&&(s.l=n),r=s}return n=e.D,t=e.ya,n&&t&&kt(r,n,t),kt(r,"VER",e.la),ln(e,r),r}function _n(e,t,n){if(t&&!e.J)throw Error("Can't create secondary domain capable XhrIo object.");return(t=e.Ca&&!e.pa?new Gt(new jt({eb:n})):new Gt(e.pa)).Ha(e.J),t}function En(){}function In(){}function Sn(e,t){he.call(this),this.g=new rn(t),this.l=e,this.h=t&&t.messageUrlParams||null,e=t&&t.messageHeaders||null,t&&t.clientProtocolHeaderRequired&&(e?e["X-Client-Protocol"]="webchannel":e={"X-Client-Protocol":"webchannel"}),this.g.o=e,e=t&&t.initMessageHeaders||null,t&&t.messageContentType&&(e?e["X-WebChannel-Content-Type"]=t.messageContentType:e={"X-WebChannel-Content-Type":t.messageContentType}),t&&t.va&&(e?e["X-WebChannel-Client-Profile"]=t.va:e={"X-WebChannel-Client-Profile":t.va}),this.g.S=e,(e=t&&t.Sb)&&!k(e)&&(this.g.m=e),this.v=t&&t.supportsCrossDomainXhr||!1,this.u=t&&t.sendRawJson||!1,(t=t&&t.httpSessionIdParam)&&!k(t)&&(this.g.D=t,null!==(e=this.h)&&t in e&&(t in(e=this.h)&&delete e[t])),this.j=new An(this)}function Tn(e){xe.call(this),e.__headers__&&(this.headers=e.__headers__,this.statusCode=e.__status__,delete e.__headers__,delete e.__status__);var t=e.__sm__;if(t){e:{for(var n in t){e=n;break e}e=void 0}(this.i=e)&&(e=this.i,t=null!==t&&e in t?t[e]:void 0),this.data=t}else this.data=e}function xn(){Ae.call(this),this.status=1}function An(e){this.g=e}(e=Gt.prototype).Ha=function(e){this.J=e},e.ea=function(e,t,n,r){if(this.g)throw Error("[goog.net.XhrIo] Object is active with another request="+this.D+"; newUri="+e);t=t?t.toUpperCase():"GET",this.D=e,this.l="",this.m=0,this.A=!1,this.h=!0,this.g=this.o?this.o.g():Ve.g(),this.v=this.o?Ie(this.o):Ie(Ve),this.g.onreadystatechange=c(this.Ea,this);try{this.B=!0,this.g.open(t,String(e),!0),this.B=!1}catch(u){return void Yt(this,u)}if(e=n||"",n=new Map(this.headers),r)if(Object.getPrototypeOf(r)===Object.prototype)for(var a in r)n.set(a,r[a]);else{if("function"!=typeof r.keys||"function"!=typeof r.get)throw Error("Unknown input type for opt_headers: "+String(r));var s,o=Kc(r.keys());try{for(o.s();!(s=o.n()).done;){var u=s.value;n.set(u,r.get(u))}}catch(v){o.e(v)}finally{o.f()}}r=Array.from(n.keys()).find(function(e){return"content-type"==e.toLowerCase()}),a=i.FormData&&e instanceof i.FormData,!(0<=Array.prototype.indexOf.call(Qt,t,void 0))||r||a||n.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8");var l,h=Kc(n);try{for(h.s();!(l=h.n()).done;){var f=b(l.value,2),d=f[0],p=f[1];this.g.setRequestHeader(d,p)}}catch(v){h.e(v)}finally{h.f()}this.H&&(this.g.responseType=this.H),"withCredentials"in this.g&&this.g.withCredentials!==this.J&&(this.g.withCredentials=this.J);try{Zt(this),this.u=!0,this.g.send(e),this.u=!1}catch(u){Yt(this,u)}},e.abort=function(e){this.g&&this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1,this.m=e||7,fe(this,"complete"),fe(this,"abort"),$t(this))},e.N=function(){this.g&&(this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1),$t(this,!0)),Gt.aa.N.call(this)},e.Ea=function(){this.s||(this.B||this.u||this.j?Jt(this):this.bb())},e.bb=function(){Jt(this)},e.isActive=function(){return!!this.g},e.Z=function(){try{return 2<en(this)?this.g.status:-1}catch(It){return-1}},e.oa=function(){try{return this.g?this.g.responseText:""}catch(It){return""}},e.Oa=function(e){if(this.g){var t=this.g.responseText;return e&&0==t.indexOf(e)&&(t=t.substring(e.length)),be(t)}},e.Ba=function(){return this.m},e.Ka=function(){return"string"==typeof this.l?this.l:String(this.l)},(e=rn.prototype).la=8,e.G=1,e.connect=function(e,t,n,r){Le(0),this.W=e,this.H=t||{},n&&void 0!==r&&(this.H.OSID=n,this.H.OAID=r),this.F=this.X,this.I=bn(this,null,this.W),un(this)},e.Ga=function(e){if(this.s)if(this.s=null,1==this.G){if(!e){this.U=Math.floor(1e5*Math.random()),e=this.U++;var t=new He(this,this.j,e),n=this.o;if(this.S&&(n?C(n=x(n),this.S):n=this.S),null!==this.m||this.O||(t.H=n,n=null),this.P)e:{for(var r=0,i=0;i<this.i.length;i++){var a=this.i[i];if(void 0===(a="__data__"in a.map&&"string"==typeof(a=a.map.__data__)?a.length:void 0))break;if(4096<(r+=a)){r=i;break e}if(4096===r||i===this.i.length-1){r=i+1;break e}}r=1e3}else r=1e3;
2r=hn(this,t,r),kt(i=vt(this.I),"RID",e),kt(i,"CVER",22),this.D&&kt(i,"X-HTTP-Session-Id",this.D),ln(this,i),n&&(this.O?r="headers="+encodeURIComponent(String(Ht(n)))+"&"+r:this.m&&Kt(i,this.m,n)),ct(this.h,t),this.Ua&&kt(i,"TYPE","init"),this.P?(kt(i,"$req",r),kt(i,"SID","null"),t.T=!0,Qe(t,i,null)):Qe(t,i,r),this.G=2}}else 3==this.G&&(e?cn(this,e):0==this.i.length||st(this.h)||cn(this))},e.Fa=function(){if(this.u=null,vn(this),this.ba&&!(this.M||null==this.g||0>=this.R)){var e=2*this.R;this.j.info("BP detection timer enabled: "+e),this.A=Ue(c(this.ab,this),e)}},e.ab=function(){this.A&&(this.A=null,this.j.info("BP detection timeout reached."),this.j.info("Buffering proxy detected and switch to long-polling!"),this.F=!1,this.M=!0,Le(10),sn(this),vn(this))},e.Za=function(){null!=this.C&&(this.C=null,sn(this),dn(this),Le(19))},e.fb=function(e){e?(this.j.info("Successfully pinged google.com"),Le(2)):(this.j.info("Failed to ping google.com"),Le(1))},e.isActive=function(){return!!this.l&&this.l.isActive(this)},(e=En.prototype).ua=function(){},e.ta=function(){},e.sa=function(){},e.ra=function(){},e.isActive=function(){return!0},e.Na=function(){},In.prototype.g=function(e,t){return new Sn(e,t)},f(Sn,he),Sn.prototype.m=function(){this.g.l=this.j,this.v&&(this.g.J=!0),this.g.connect(this.l,this.h||void 0)},Sn.prototype.close=function(){an(this.g)},Sn.prototype.o=function(e){var t=this.g;if("string"==typeof e){var n={};n.__data__=e,e=n}else this.u&&((n={}).__data__=we(e),e=n);t.i.push(new it(t.Ya++,e)),3==t.G&&un(t)},Sn.prototype.N=function(){this.g.l=null,delete this.j,an(this.g),delete this.g,Sn.aa.N.call(this)},f(Tn,xe),f(xn,Ae),f(An,En),An.prototype.ua=function(){fe(this.g,"a")},An.prototype.ta=function(e){fe(this.g,new Tn(e))},An.prototype.sa=function(e){fe(this.g,new xn)},An.prototype.ra=function(){fe(this.g,"b")},In.prototype.createWebChannel=In.prototype.g,Sn.prototype.send=Sn.prototype.o,Sn.prototype.open=Sn.prototype.m,Sn.prototype.close=Sn.prototype.close,nl=function(){return new In},tl=function(){return Oe()},el=Ce,Zc={mb:0,pb:1,qb:2,Jb:3,Ob:4,Lb:5,Mb:6,Kb:7,Ib:8,Nb:9,PROXY:10,NOPROXY:11,Gb:12,Cb:13,Db:14,Bb:15,Eb:16,Fb:17,ib:18,hb:19,jb:20},Be.NO_ERROR=0,Be.TIMEOUT=8,Be.HTTP_ERROR=6,$c=Be,qe.COMPLETE="complete",Jc=qe,Se.EventType=Te,Te.OPEN="a",Te.CLOSE="b",Te.ERROR="c",Te.MESSAGE="d",he.prototype.listen=he.prototype.K,Xc=Se,Yc=jt,Gt.prototype.listenOnce=Gt.prototype.L,Gt.prototype.getLastError=Gt.prototype.Ka,Gt.prototype.getLastErrorCode=Gt.prototype.Ba,Gt.prototype.getStatus=Gt.prototype.Z,Gt.prototype.getResponseJson=Gt.prototype.Oa,Gt.prototype.getResponseText=Gt.prototype.oa,Gt.prototype.send=Gt.prototype.ea,Gt.prototype.setWithCredentials=Gt.prototype.Ha,Qc=Gt}).apply(void 0!==rl?rl:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{});var ol="@firebase/firestore",ul=function(){function e(t){I(this,e),this.uid=t}return T(e,[{key:"isAuthenticated",value:function(){return null!=this.uid}},{key:"toKey",value:function(){return this.isAuthenticated()?"uid:"+this.uid:"anonymous-user"}},{key:"isEqual",value:function(e){return e.uid===this.uid}}]),e}();ul.UNAUTHENTICATED=new ul(null),ul.GOOGLE_CREDENTIALS=new ul("google-credentials-uid"),ul.FIRST_PARTY=new ul("first-party-uid"),ul.MOCK_USER=new ul("mock-user");var cl="10.12.1",ll=new Ie("@firebase/firestore");function hl(){return ll.logLevel}function fl(e){if(ll.logLevel<=ge.DEBUG){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];var i=n.map(vl);ll.debug.apply(ll,["Firestore (".concat(cl,"): ").concat(e)].concat(x(i)))}}function dl(e){if(ll.logLevel<=ge.ERROR){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];var i=n.map(vl);ll.error.apply(ll,["Firestore (".concat(cl,"): ").concat(e)].concat(x(i)))}}function pl(e){if(ll.logLevel<=ge.WARN){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];var i=n.map(vl);ll.warn.apply(ll,["Firestore (".concat(cl,"): ").concat(e)].concat(x(i)))}}function vl(e){if("string"==typeof e)return e;try{return function(e){return JSON.stringify(e)}(e)}catch(t){return e}}function gl(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"Unexpected state",t="FIRESTORE (".concat(cl,") INTERNAL ASSERTION FAILED: ")+e;throw dl(t),new Error(t)}function yl(e,t){e||gl()}function ml(e,t){return e}var kl={OK:"ok",CANCELLED:"cancelled",UNKNOWN:"unknown",INVALID_ARGUMENT:"invalid-argument",DEADLINE_EXCEEDED:"deadline-exceeded",NOT_FOUND:"not-found",ALREADY_EXISTS:"already-exists",PERMISSION_DENIED:"permission-denied",UNAUTHENTICATED:"unauthenticated",RESOURCE_EXHAUSTED:"resource-exhausted",FAILED_PRECONDITION:"failed-precondition",ABORTED:"aborted",OUT_OF_RANGE:"out-of-range",UNIMPLEMENT
2ED:"unimplemented",INTERNAL:"internal",UNAVAILABLE:"unavailable",DATA_LOSS:"data-loss"},wl=function(e){y(n,e);var t=sl(n);function n(e,r){var i;return I(this,n),(i=t.call(this,e,r)).code=e,i.message=r,i.toString=function(){return"".concat(i.name,": [code=").concat(i.code,"]: ").concat(i.message)},i}return T(n)}(J),bl=T(function e(){var t=this;I(this,e),this.promise=new Promise(function(e,n){t.resolve=e,t.reject=n})}),_l=T(function e(t,n){I(this,e),this.user=n,this.type="OAuth",this.headers=new Map,this.headers.set("Authorization","Bearer ".concat(t))}),El=function(){function e(){I(this,e)}return T(e,[{key:"getToken",value:function(){return Promise.resolve(null)}},{key:"invalidateToken",value:function(){}},{key:"start",value:function(e,t){e.enqueueRetryable(function(){return t(ul.UNAUTHENTICATED)})}},{key:"shutdown",value:function(){}}]),e}(),Il=function(){function e(t){I(this,e),this.t=t,this.currentUser=ul.UNAUTHENTICATED,this.i=0,this.forceRefresh=!1,this.auth=null}return T(e,[{key:"start",value:function(e,t){var n=this,r=this.i,i=function(e){return n.i!==r?(r=n.i,t(e)):Promise.resolve()},a=new bl;this.o=function(){n.i++,n.currentUser=n.u(),a.resolve(),a=new bl,e.enqueueRetryable(function(){return i(n.currentUser)})};var s=function(){var t=a;e.enqueueRetryable(E(O.mark(function e(){return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.promise;case 2:return e.next=4,i(n.currentUser);case 4:case"end":return e.stop()}},e)})))},o=function(e){fl("FirebaseAuthCredentialsProvider","Auth detected"),n.auth=e,n.auth.addAuthTokenListener(n.o),s()};this.t.onInit(function(e){return o(e)}),setTimeout(function(){if(!n.auth){var e=n.t.getImmediate({optional:!0});e?o(e):(fl("FirebaseAuthCredentialsProvider","Auth not yet detected"),a.resolve(),a=new bl)}},0),s()}},{key:"getToken",value:function(){var e=this,t=this.i,n=this.forceRefresh;return this.forceRefresh=!1,this.auth?this.auth.getToken(n).then(function(n){return e.i!==t?(fl("FirebaseAuthCredentialsProvider","getToken aborted due to token change."),e.getToken()):n?(yl("string"==typeof n.accessToken),new _l(n.accessToken,e.currentUser)):null}):Promise.resolve(null)}},{key:"invalidateToken",value:function(){this.forceRefresh=!0}},{key:"shutdown",value:function(){this.auth&&this.auth.removeAuthTokenListener(this.o)}},{key:"u",value:function(){var e=this.auth&&this.auth.getUid();return yl(null===e||"string"==typeof e),new ul(e)}}]),e}(),Sl=function(){function e(t,n,r){I(this,e),this.l=t,this.h=n,this.P=r,this.type="FirstParty",this.user=ul.FIRST_PARTY,this.I=new Map}return T(e,[{key:"T",value:function(){return this.P?this.P():null}},{key:"headers",get:function(){this.I.set("X-Goog-AuthUser",this.l);var e=this.T();return e&&this.I.set("Authorization",e),this.h&&this.I.set("X-Goog-Iam-Authorization-Token",this.h),this.I}}]),e}(),Tl=function(){function e(t,n,r){I(this,e),this.l=t,this.h=n,this.P=r}return T(e,[{key:"getToken",value:function(){return Promise.resolve(new Sl(this.l,this.h,this.P))}},{key:"start",value:function(e,t){e.enqueueRetryable(function(){return t(ul.FIRST_PARTY)})}},{key:"shutdown",value:function(){}},{key:"invalidateToken",value:function(){}}]),e}(),xl=T(function e(t){I(this,e),this.value=t,this.type="AppCheck",this.headers=new Map,t&&t.length>0&&this.headers.set("x-firebase-appcheck",this.value)}),Al=function(){function e(t){I(this,e),this.A=t,this.forceRefresh=!1,this.appCheck=null,this.R=null}return T(e,[{key:"start",value:function(e,t){var n=this,r=function(e){null!=e.error&&fl("FirebaseAppCheckTokenProvider","Error getting App Check token; using placeholder token instead. Error: ".concat(e.error.message));var r=e.token!==n.R;return n.R=e.token,fl("FirebaseAppCheckTokenProvider","Received ".concat(r?"new":"existing"," token.")),r?t(e.token):Promise.resolve()};this.o=function(t){e.enqueueRetryable(function(){return r(t)})};var i=function(e){fl("FirebaseAppCheckTokenProvider","AppCheck detected"),n.appCheck=e,n.appCheck.addTokenListener(n.o)};this.A.onInit(function(e){return i(e)}),setTimeout(function(){if(!n.appCheck){var e=n.A.getImmediate({optional:!0});e?i(e):fl("FirebaseAppCheckTokenProvider","AppCheck not yet detected")}},0)}},{key:"getToken",value:function(){var e=this,t=this.forceRefresh;return this.forceRefresh=!1,this.appCheck?this.appCheck.getToken(t).then(function(t){return t?(yl("string"==typeof t.token),e.R=t.token,new xl(t.token)):null}):Promise.resolve(null)}},{key:"invalidateToken",value:function(){this.forceRefresh=!0}},{key:"shutdown",value:function(){this.appCheck&&this.appCheck.removeTokenListener(this.o)}}]),e}();function Cl(e){var t="undefined"!=typeof self&&(self.crypto||self.msCrypto),n=new Uint8Array(e);if(t&&"function"==typeof t.getRandomValues)t.getRandomValues(n);else for(var r=0;r<e;
2r++)n[r]=Math.floor(256*Math.random());return n}var Pl=function(){function e(){I(this,e)}return T(e,null,[{key:"newId",value:function(){for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",t=62*Math.floor(256/62),n="";n.length<20;)for(var r=Cl(40),i=0;i<r.length;++i)n.length<20&&r[i]<t&&(n+=e.charAt(r[i]%62));return n}}]),e}();function Ol(e,t){return e<t?-1:e>t?1:0}function Rl(e,t,n){return e.length===t.length&&e.every(function(e,r){return n(e,t[r])})}var Nl=function(){function e(t,n){if(I(this,e),this.seconds=t,this.nanoseconds=n,n<0)throw new wl(kl.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+n);if(n>=1e9)throw new wl(kl.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+n);if(t<-62135596800)throw new wl(kl.INVALID_ARGUMENT,"Timestamp seconds out of range: "+t);if(t>=253402300800)throw new wl(kl.INVALID_ARGUMENT,"Timestamp seconds out of range: "+t)}return T(e,[{key:"toDate",value:function(){return new Date(this.toMillis())}},{key:"toMillis",value:function(){return 1e3*this.seconds+this.nanoseconds/1e6}},{key:"_compareTo",value:function(e){return this.seconds===e.seconds?Ol(this.nanoseconds,e.nanoseconds):Ol(this.seconds,e.seconds)}},{key:"isEqual",value:function(e){return e.seconds===this.seconds&&e.nanoseconds===this.nanoseconds}},{key:"toString",value:function(){return"Timestamp(seconds="+this.seconds+", nanoseconds="+this.nanoseconds+")"}},{key:"toJSON",value:function(){return{seconds:this.seconds,nanoseconds:this.nanoseconds}}},{key:"valueOf",value:function(){var e=this.seconds- -62135596800;return String(e).padStart(12,"0")+"."+String(this.nanoseconds).padStart(9,"0")}}],[{key:"now",value:function(){return e.fromMillis(Date.now())}},{key:"fromDate",value:function(t){return e.fromMillis(t.getTime())}},{key:"fromMillis",value:function(t){var n=Math.floor(t/1e3);return new e(n,Math.floor(1e6*(t-1e3*n)))}}]),e}(),Dl=function(){function e(t){I(this,e),this.timestamp=t}return T(e,[{key:"compareTo",value:function(e){return this.timestamp._compareTo(e.timestamp)}},{key:"isEqual",value:function(e){return this.timestamp.isEqual(e.timestamp)}},{key:"toMicroseconds",value:function(){return 1e6*this.timestamp.seconds+this.timestamp.nanoseconds/1e3}},{key:"toString",value:function(){return"SnapshotVersion("+this.timestamp.toString()+")"}},{key:"toTimestamp",value:function(){return this.timestamp}}],[{key:"fromTimestamp",value:function(t){return new e(t)}},{key:"min",value:function(){return new e(new Nl(0,0))}},{key:"max",value:function(){return new e(new Nl(253402300799,999999999))}}]),e}(),Ll=function(){function e(t,n,r){I(this,e),void 0===n?n=0:n>t.length&&gl(),void 0===r?r=t.length-n:r>t.length-n&&gl(),this.segments=t,this.offset=n,this.len=r}return T(e,[{key:"length",get:function(){return this.len}},{key:"isEqual",value:function(t){return 0===e.comparator(this,t)}},{key:"child",value:function(t){var n=this.segments.slice(this.offset,this.limit());return t instanceof e?t.forEach(function(e){n.push(e)}):n.push(t),this.construct(n)}},{key:"limit",value:function(){return this.offset+this.length}},{key:"popFirst",value:function(e){return e=void 0===e?1:e,this.construct(this.segments,this.offset+e,this.length-e)}},{key:"popLast",value:function(){return this.construct(this.segments,this.offset,this.length-1)}},{key:"firstSegment",value:function(){return this.segments[this.offset]}},{key:"lastSegment",value:function(){return this.get(this.length-1)}},{key:"get",value:function(e){return this.segments[this.offset+e]}},{key:"isEmpty",value:function(){return 0===this.length}},{key:"isPrefixOf",value:function(e){if(e.length<this.length)return!1;for(var t=0;t<this.length;t++)if(this.get(t)!==e.get(t))return!1;return!0}},{key:"isImmediateParentOf",value:function(e){if(this.length+1!==e.length)return!1;for(var t=0;t<this.length;t++)if(this.get(t)!==e.get(t))return!1;return!0}},{key:"forEach",value:function(e){for(var t=this.offset,n=this.limit();t<n;t++)e(this.segments[t])}},{key:"toArray",value:function(){return this.segments.slice(this.offset,this.limit())}}],[{key:"comparator",value:function(e,t){for(var n=Math.min(e.length,t.length),r=0;r<n;r++){var i=e.get(r),a=t.get(r);if(i<a)return-1;if(i>a)return 1}return e.length<t.length?-1:e.length>t.length?1:0}}]),e}(),Ml=function(e){y(n,e);var t=sl(n);function n(){return I(this,n),t.apply(this,arguments)}
2return T(n,[{key:"construct",value:function(e,t,r){return new n(e,t,r)}},{key:"canonicalString",value:function(){return this.toArray().join("/")}},{key:"toString",value:function(){return this.canonicalString()}},{key:"toUriEncodedString",value:function(){return this.toArray().map(encodeURIComponent).join("/")}}],[{key:"fromString",value:function(){for(var e=[],t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];for(var a=0,s=r;a<s.length;a++){var o=s[a];if(o.indexOf("//")>=0)throw new wl(kl.INVALID_ARGUMENT,"Invalid segment (".concat(o,"). Paths must not contain // in them."));e.push.apply(e,x(o.split("/").filter(function(e){return e.length>0})))}return new n(e)}},{key:"emptyPath",value:function(){return new n([])}}]),n}(Ll),Ul=/^[_a-zA-Z][_a-zA-Z0-9]*$/,Fl=function(e){y(n,e);var t=sl(n);function n(){return I(this,n),t.apply(this,arguments)}return T(n,[{key:"construct",value:function(e,t,r){return new n(e,t,r)}},{key:"canonicalString",value:function(){return this.toArray().map(function(e){return e=e.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),n.isValidIdentifier(e)||(e="`"+e+"`"),e}).join(".")}},{key:"toString",value:function(){return this.canonicalString()}},{key:"isKeyField",value:function(){return 1===this.length&&"__name__"===this.get(0)}}],[{key:"isValidIdentifier",value:function(e){return Ul.test(e)}},{key:"keyField",value:function(){return new n(["__name__"])}},{key:"fromServerFormat",value:function(e){for(var t=[],r="",i=0,a=function(){if(0===r.length)throw new wl(kl.INVALID_ARGUMENT,"Invalid field path (".concat(e,"). Paths must not be empty, begin with '.', end with '.', or contain '..'"));t.push(r),r=""},s=!1;i<e.length;){var o=e[i];if("\\"===o){if(i+1===e.length)throw new wl(kl.INVALID_ARGUMENT,"Path has trailing escape character: "+e);var u=e[i+1];if("\\"!==u&&"."!==u&&"`"!==u)throw new wl(kl.INVALID_ARGUMENT,"Path has invalid escape sequence: "+e);r+=u,i+=2}else"`"===o?(s=!s,i++):"."!==o||s?(r+=o,i++):(a(),i++)}if(a(),s)throw new wl(kl.INVALID_ARGUMENT,"Unterminated ` in path: "+e);return new n(t)}},{key:"emptyPath",value:function(){return new n([])}}]),n}(Ll),jl=function(){function e(t){I(this,e),this.path=t}return T(e,[{key:"collectionGroup",get:function(){return this.path.popLast().lastSegment()}},{key:"hasCollectionId",value:function(e){return this.path.length>=2&&this.path.get(this.path.length-2)===e}},{key:"getCollectionGroup",value:function(){return this.path.get(this.path.length-2)}},{key:"getCollectionPath",value:function(){return this.path.popLast()}},{key:"isEqual",value:function(e){return null!==e&&0===Ml.comparator(this.path,e.path)}},{key:"toString",value:function(){return this.path.toString()}}],[{key:"fromPath",value:function(t){return new e(Ml.fromString(t))}},{key:"fromName",value:function(t){return new e(Ml.fromString(t).popFirst(5))}},{key:"empty",value:function(){return new e(Ml.emptyPath())}},{key:"comparator",value:function(e,t){return Ml.comparator(e.path,t.path)}},{key:"isDocumentKey",value:function(e){return e.length%2==0}},{key:"fromSegments",value:function(t){return new e(new Ml(t.slice()))}}]),e}();function Vl(e){return new Bl(e.readTime,e.key,-1)}T(function e(t,n,r,i){I(this,e),this.indexId=t,this.collectionGroup=n,this.fields=r,this.indexState=i}).UNKNOWN_ID=-1;var Bl=function(){function e(t,n,r){I(this,e),this.readTime=t,this.documentKey=n,this.largestBatchId=r}return T(e,null,[{key:"min",value:function(){return new e(Dl.min(),jl.empty(),-1)}},{key:"max",value:function(){return new e(Dl.max(),jl.empty(),-1)}}]),e}();function ql(e,t){var n=e.readTime.compareTo(t.readTime);return 0!==n?n:0!==(n=jl.comparator(e.documentKey,t.documentKey))?n:Ol(e.largestBatchId,t.largestBatchId)}var zl=function(){function e(){I(this,e),this.onCommittedListeners=[]}return T(e,[{key:"addOnCommittedListener",value:function(e){this.onCommittedListeners.push(e)}},{key:"raiseOnCommittedEvent",value:function(){this.onCommittedListeners.forEach(function(e){return e()})}}]),e}();function Hl(e){return Kl.apply(this,arguments)}function Kl(){return(Kl=E(O.mark(function e(t){return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t.code===kl.FAILED_PRECONDITION&&"The current tab is not in the required state to perform this operation. It might be necessary to refresh the browser tab."===t.message){e.next=2;break}throw t;case 2:fl("LocalStore","Unexpectedly lost primary lease");case 3:case"end":return e.stop()}},e)}))).apply(this,arguments)}var Gl=function(){function e(t){var n=this;I(this,e),this.nextCallback=null,this.catchCallback=null,this.result=void 0,this.error=void 0,this.isDone=!1,this.callbackAttached=!1,t(function(e){n.isDone=!0,n.result=e,n.nextCallback&&n.nextCallback(e)},function(e){n.isDone=!0,n.error=e,n.catchCallback&&n.catchCallback(e)})}return T(e,[{key:"catch",value:function(e){return this.next(void 0,e)}},{key:"next",value:function(t,n){var r=this;return this.callbackAttached&&gl(),this.callbackAttached=!0,this.isDone?this.error?this.wrapFailure(n,this.error):this.wrapSuccess(t,this.result):new e(function(e,i){r.nextCallback=function(n){r.wrapSuccess(t,n).next(e,i)},r.catchCallback=function(t){r.wrapFailure(n,t).next(e,i)}})}},{key:"toPromise",value:function(){var e=this;return new Promise(function(t,n){e.next(t,n)})}},{key:"wrapUserFunction",value:function(t){try{var n=t();return n instanceof e?n:e.resolve(n)}catch(t){return e.reject(t)}}},{key:"wrapSuccess",value:function(t,n){return t?this.wrapUserFunction(function(){return t(n)}):e.resolve(n)}},{key:"wrapFailure",value:function(t,n){return t?this.wrapUserFunction(function(){return t(n)}):e.reject(n)}}],[{key:"resolve",value:function(t){return new e(function(e,n){e(t)})}}
2,{key:"reject",value:function(t){return new e(function(e,n){n(t)})}},{key:"waitFor",value:function(t){return new e(function(e,n){var r=0,i=0,a=!1;t.forEach(function(t){++r,t.next(function(){++i,a&&i===r&&e()},function(e){return n(e)})}),a=!0,i===r&&e()})}},{key:"or",value:function(t){var n,r=e.resolve(!1),i=il(t);try{var a=function(){var t=n.value;r=r.next(function(n){return n?e.resolve(n):t()})};for(i.s();!(n=i.n()).done;)a()}catch(s){i.e(s)}finally{i.f()}return r}},{key:"forEach",value:function(e,t){var n=this,r=[];return e.forEach(function(e,i){r.push(t.call(n,e,i))}),this.waitFor(r)}},{key:"mapArray",value:function(t,n){return new e(function(e,r){for(var i=t.length,a=new Array(i),s=0,o=function(o){var u=o;n(t[u]).next(function(t){a[u]=t,++s===i&&e(a)},function(e){return r(e)})},u=0;u<i;u++)o(u)})}},{key:"doWhile",value:function(t,n){return new e(function(e,r){!function i(){!0===t()?n().next(function(){i()},r):e()}()})}}]),e}();function Wl(e){return"IndexedDbTransactionError"===e.name}var Ql=function(){function e(t,n){var r=this;I(this,e),this.previousValue=t,n&&(n.sequenceNumberHandler=function(e){return r.ie(e)},this.se=function(e){return n.writeSequenceNumber(e)})}return T(e,[{key:"ie",value:function(e){return this.previousValue=Math.max(e,this.previousValue),this.previousValue}},{key:"next",value:function(){var e=++this.previousValue;return this.se&&this.se(e),e}}]),e}();function Yl(e){return null==e}function Xl(e){return 0===e&&1/e==-1/0}Ql.oe=-1;var Jl=["mutationQueues","mutations","documentMutations","remoteDocuments","targets","owner","targetGlobal","targetDocuments"].concat(["clientMetadata"]).concat(["remoteDocumentGlobal"]).concat(["collectionParents"]).concat(["bundles","namedQueries"]);function $l(e){var t=0;for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t++;return t}function Zl(e,t){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t(n,e[n])}function eh(e){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}[].concat(x(Jl),["documentOverlays"]);var th=function(){function e(t,n){I(this,e),this.comparator=t,this.root=n||rh.EMPTY}return T(e,[{key:"insert",value:function(t,n){return new e(this.comparator,this.root.insert(t,n,this.comparator).copy(null,null,rh.BLACK,null,null))}},{key:"remove",value:function(t){return new e(this.comparator,this.root.remove(t,this.comparator).copy(null,null,rh.BLACK,null,null))}},{key:"get",value:function(e){for(var t=this.root;!t.isEmpty();){var n=this.comparator(e,t.key);if(0===n)return t.value;n<0?t=t.left:n>0&&(t=t.right)}return null}},{key:"indexOf",value:function(e){for(var t=0,n=this.root;!n.isEmpty();){var r=this.comparator(e,n.key);if(0===r)return t+n.left.size;r<0?n=n.left:(t+=n.left.size+1,n=n.right)}return-1}},{key:"isEmpty",value:function(){return this.root.isEmpty()}},{key:"size",get:function(){return this.root.size}},{key:"minKey",value:function(){return this.root.minKey()}},{key:"maxKey",value:function(){return this.root.maxKey()}},{key:"inorderTraversal",value:function(e){return this.root.inorderTraversal(e)}},{key:"forEach",value:function(e){this.inorderTraversal(function(t,n){return e(t,n),!1})}},{key:"toString",value:function(){var e=[];return this.inorderTraversal(function(t,n){return e.push("".concat(t,":").concat(n)),!1}),"{".concat(e.join(", "),"}")}},{key:"reverseTraversal",value:function(e){return this.root.reverseTraversal(e)}},{key:"getIterator",value:function(){return new nh(this.root,null,this.comparator,!1)}},{key:"getIteratorFrom",value:function(e){return new nh(this.root,e,this.comparator,!1)}},{key:"getReverseIterator",value:function(){return new nh(this.root,null,this.comparator,!0)}},{key:"getReverseIteratorFrom",value:function(e){return new nh(this.root,e,this.comparator,!0)}}]),e}(),nh=function(){function e(t,n,r,i){I(this,e),this.isReverse=i,this.nodeStack=[];for(var a=1;!t.isEmpty();)if(a=n?r(t.key,n):1,n&&i&&(a*=-1),a<0)t=this.isReverse?t.left:t.right;else{if(0===a){this.nodeStack.push(t);break}this.nodeStack.push(t),t=this.isReverse?t.right:t.left}}return T(e,[{key:"getNext",value:function(){var e=this.nodeStack.pop(),t={key:e.key,value:e.value};if(this.isReverse)for(e=e.left;!e.isEmpty();)this.nodeStack.push(e),e=e.right;else for(e=e.right;!e.isEmpty();)this.nodeStack.push(e),e=e.left;return t}},{key:"hasNext",value:function(){return this.nodeStack.length>0}},{key:"peek",value:function(){if(0===this.nodeStack.length)return null;var e=this.nodeStack[this.nodeStack.length-1];return{key:e.key,value:e.value}}}]),e}(),rh=function(){function e(t,n,r,i,a){I(this,e),this.key=t,this.value=n,this.color=null!=r?r:e.RED,this.left=null!=i?i:e.EMPTY,this.right=null!=a?a:e.EMPTY,this.size=this.left.size+1+this.right.size}
2return T(e,[{key:"copy",value:function(t,n,r,i,a){return new e(null!=t?t:this.key,null!=n?n:this.value,null!=r?r:this.color,null!=i?i:this.left,null!=a?a:this.right)}},{key:"isEmpty",value:function(){return!1}},{key:"inorderTraversal",value:function(e){return this.left.inorderTraversal(e)||e(this.key,this.value)||this.right.inorderTraversal(e)}},{key:"reverseTraversal",value:function(e){return this.right.reverseTraversal(e)||e(this.key,this.value)||this.left.reverseTraversal(e)}},{key:"min",value:function(){return this.left.isEmpty()?this:this.left.min()}},{key:"minKey",value:function(){return this.min().key}},{key:"maxKey",value:function(){return this.right.isEmpty()?this.key:this.right.maxKey()}},{key:"insert",value:function(e,t,n){var r=this,i=n(e,r.key);return(r=i<0?r.copy(null,null,null,r.left.insert(e,t,n),null):0===i?r.copy(null,t,null,null,null):r.copy(null,null,null,null,r.right.insert(e,t,n))).fixUp()}},{key:"removeMin",value:function(){if(this.left.isEmpty())return e.EMPTY;var t=this;return t.left.isRed()||t.left.left.isRed()||(t=t.moveRedLeft()),(t=t.copy(null,null,null,t.left.removeMin(),null)).fixUp()}},{key:"remove",value:function(t,n){var r,i=this;if(n(t,i.key)<0)i.left.isEmpty()||i.left.isRed()||i.left.left.isRed()||(i=i.moveRedLeft()),i=i.copy(null,null,null,i.left.remove(t,n),null);else{if(i.left.isRed()&&(i=i.rotateRight()),i.right.isEmpty()||i.right.isRed()||i.right.left.isRed()||(i=i.moveRedRight()),0===n(t,i.key)){if(i.right.isEmpty())return e.EMPTY;r=i.right.min(),i=i.copy(r.key,r.value,null,null,i.right.removeMin())}i=i.copy(null,null,null,null,i.right.remove(t,n))}return i.fixUp()}},{key:"isRed",value:function(){return this.color}},{key:"fixUp",value:function(){var e=this;return e.right.isRed()&&!e.left.isRed()&&(e=e.rotateLeft()),e.left.isRed()&&e.left.left.isRed()&&(e=e.rotateRight()),e.left.isRed()&&e.right.isRed()&&(e=e.colorFlip()),e}},{key:"moveRedLeft",value:function(){var e=this.colorFlip();return e.right.left.isRed()&&(e=(e=(e=e.copy(null,null,null,null,e.right.rotateRight())).rotateLeft()).colorFlip()),e}},{key:"moveRedRight",value:function(){var e=this.colorFlip();return e.left.left.isRed()&&(e=(e=e.rotateRight()).colorFlip()),e}},{key:"rotateLeft",value:function(){var t=this.copy(null,null,e.RED,null,this.right.left);return this.right.copy(null,null,this.color,t,null)}},{key:"rotateRight",value:function(){var t=this.copy(null,null,e.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,t)}},{key:"colorFlip",value:function(){var e=this.left.copy(null,null,!this.left.color,null,null),t=this.right.copy(null,null,!this.right.color,null,null);return this.copy(null,null,!this.color,e,t)}},{key:"checkMaxDepth",value:function(){var e=this.check();return Math.pow(2,e)<=this.size+1}},{key:"check",value:function(){if(this.isRed()&&this.left.isRed())throw gl();if(this.right.isRed())throw gl();var e=this.left.check();if(e!==this.right.check())throw gl();return e+(this.isRed()?0:1)}}]),e}();rh.EMPTY=null,rh.RED=!0,rh.BLACK=!1,rh.EMPTY=new(function(){function e(){I(this,e),this.size=0}return T(e,[{key:"key",get:function(){throw gl()}},{key:"value",get:function(){throw gl()}},{key:"color",get:function(){throw gl()}},{key:"left",get:function(){throw gl()}},{key:"right",get:function(){throw gl()}},{key:"copy",value:function(e,t,n,r,i){return this}},{key:"insert",value:function(e,t,n){return new rh(e,t)}},{key:"remove",value:function(e,t){return this}},{key:"isEmpty",value:function(){return!0}},{key:"inorderTraversal",value:function(e){return!1}},{key:"reverseTraversal",value:function(e){return!1}},{key:"minKey",value:function(){return null}},{key:"maxKey",value:function(){return null}},{key:"isRed",value:function(){return!1}},{key:"checkMaxDepth",value:function(){return!0}},{key:"check",value:function(){return 0}}]),e}());var ih=function(){function e(t){I(this,e),this.comparator=t,this.data=new th(this.comparator)}return T(e,[{key:"has",value:function(e){return null!==this.data.get(e)}},{key:"first",value:function(){return this.data.minKey()}},{key:"last",value:function(){return this.data.maxKey()}},{key:"size",get:function(){return this.data.size}},{key:"indexOf",value:function(e){return this.data.indexOf(e)}}
2,{key:"forEach",value:function(e){this.data.inorderTraversal(function(t,n){return e(t),!1})}},{key:"forEachInRange",value:function(e,t){for(var n=this.data.getIteratorFrom(e[0]);n.hasNext();){var r=n.getNext();if(this.comparator(r.key,e[1])>=0)return;t(r.key)}}},{key:"forEachWhile",value:function(e,t){var n;for(n=void 0!==t?this.data.getIteratorFrom(t):this.data.getIterator();n.hasNext();)if(!e(n.getNext().key))return}},{key:"firstAfterOrEqual",value:function(e){var t=this.data.getIteratorFrom(e);return t.hasNext()?t.getNext().key:null}},{key:"getIterator",value:function(){return new ah(this.data.getIterator())}},{key:"getIteratorFrom",value:function(e){return new ah(this.data.getIteratorFrom(e))}},{key:"add",value:function(e){return this.copy(this.data.remove(e).insert(e,!0))}},{key:"delete",value:function(e){return this.has(e)?this.copy(this.data.remove(e)):this}},{key:"isEmpty",value:function(){return this.data.isEmpty()}},{key:"unionWith",value:function(e){var t=this;return t.size<e.size&&(t=e,e=this),e.forEach(function(e){t=t.add(e)}),t}},{key:"isEqual",value:function(t){if(!(t instanceof e))return!1;if(this.size!==t.size)return!1;for(var n=this.data.getIterator(),r=t.data.getIterator();n.hasNext();){var i=n.getNext().key,a=r.getNext().key;if(0!==this.comparator(i,a))return!1}return!0}},{key:"toArray",value:function(){var e=[];return this.forEach(function(t){e.push(t)}),e}},{key:"toString",value:function(){var e=[];return this.forEach(function(t){return e.push(t)}),"SortedSet("+e.toString()+")"}},{key:"copy",value:function(t){var n=new e(this.comparator);return n.data=t,n}}]),e}(),ah=function(){function e(t){I(this,e),this.iter=t}return T(e,[{key:"getNext",value:function(){return this.iter.getNext().key}},{key:"hasNext",value:function(){return this.iter.hasNext()}}]),e}(),sh=function(){function e(t){I(this,e),this.fields=t,t.sort(Fl.comparator)}return T(e,[{key:"unionWith",value:function(t){var n,r=new ih(Fl.comparator),i=il(this.fields);try{for(i.s();!(n=i.n()).done;){var a=n.value;r=r.add(a)}}catch(c){i.e(c)}finally{i.f()}var s,o=il(t);try{for(o.s();!(s=o.n()).done;){var u=s.value;r=r.add(u)}}catch(c){o.e(c)}finally{o.f()}return new e(r.toArray())}},{key:"covers",value:function(e){var t,n=il(this.fields);try{for(n.s();!(t=n.n()).done;){if(t.value.isPrefixOf(e))return!0}}catch(r){n.e(r)}finally{n.f()}return!1}},{key:"isEqual",value:function(e){return Rl(this.fields,e.fields,function(e,t){return e.isEqual(t)})}}],[{key:"empty",value:function(){return new e([])}}]),e}(),oh=function(e){y(n,e);var t=sl(n);function n(){var e;return I(this,n),(e=t.apply(this,arguments)).name="Base64DecodeError",e}return T(n)}(N(Error)),uh=function(){function e(t){I(this,e),this.binaryString=t}return T(e,[{key:Symbol.iterator,value:function(){var e=this,t=0;return{next:function(){return t<e.binaryString.length?{value:e.binaryString.charCodeAt(t++),done:!1}:{value:void 0,done:!0}}}}},{key:"toBase64",value:function(){return e=this.binaryString,btoa(e);var e}},{key:"toUint8Array",value:function(){return function(e){for(var t=new Uint8Array(e.length),n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return t}(this.binaryString)}},{key:"approximateByteSize",value:function(){return 2*this.binaryString.length}},{key:"compareTo",value:function(e){return Ol(this.binaryString,e.binaryString)}},{key:"isEqual",value:function(e){return this.binaryString===e.binaryString}}],[{key:"fromBase64String",value:function(t){var n=function(e){try{return atob(e)}catch(e){throw"undefined"!=typeof DOMException&&e instanceof DOMException?new oh("Invalid base64 string: "+e):e}}(t);return new e(n)}},{key:"fromUint8Array",value:function(t){var n=function(e){for(var t="",n=0;n<e.length;++n)t+=String.fromCharCode(e[n]);return t}(t);return new e(n)}}]),e}();uh.EMPTY_BYTE_STRING=new uh("");var ch=new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);function lh(e){if(yl(!!e),"string"==typeof e){var t=0,n=ch.exec(e);if(yl(!!n),n[1]){var r=n[1];r=(r+"000000000").substr(0,9),t=Number(r)}var i=new Date(e);return{seconds:Math.floor(i.getTime()/1e3),nanos:t}}return{seconds:hh(e.seconds),nanos:hh(e.nanos)}}function hh(e){return"number"==typeof e?e:"string"==typeof e?Number(e):0}function fh(e){return"string"==typeof e?uh.fromBase64String(e):uh.fromUint8Array(e)}function dh(e){var t,n;return"server_timestamp"===(null===(n=((null===(t=null==e?void 0:e.mapValue)||void 0===t?void 0:t.fields)||{}).__type__)||void 0===n?void 0:n.stringValue)}function ph(e){var t=e.mapValue.fields.__previous_value__;return dh(t)?ph(t):t}function vh(e){var t=lh(e.mapValue.fields.__local_write_time__.timestampValue);return new Nl(t.seconds,t.nanos)}var gh=T(function e(t,n,r,i,a,s,o,u,c){I(this,e),this.databaseId=t,this.appId=n,this.persistenceKey=r,this.host=i,this.ssl=a,this.forceLongPolling=s,this.autoDetectLongPolling=o,this.longPollingOptions=u,this.useFetchStreams=c}),yh=function(){function e(t,n){I(this,e),this.projectId=t,this.database=n||"(default)"}return T(e,[{key:"isDefaultDatabase",get:function(){return"(default)"===this.database}},{key:"isEqual",value:function(t){return t instanceof e&&t.projectId===this.projectId&&t.database===this.database}}],[{key:"empty",value:function(){return new e("","")}}]),e}(),mh={fields:{__type__:{stringValue:"__max__"}}};function kh(e){return"nullValue"in e?0:"booleanValue"in e?1:"integerValue"in e||"doubleValue"in e?2:"timestampValue"in e?3:"stringValue"in e?5:"bytesValue"in e?6:"referenceValue"in e?7:"geoPointValue"in e?8:"arrayValue"in e?9:"mapValue"in e?dh(e)?4:Rh(e)?9007199254740991:10:gl()}function wh(e,t){if(e===t)return!0;var n=kh(e);if(n!==kh(t))return!1;switch(n){case 0:case 9007199254740991:return!0;case 1:return e.booleanValue===t.booleanValue;case 4:return vh(e).isEqual(vh(t));case 3:return function(e,t){if("string"==typeof e.timestampValue&&"string"==typeof t.timestampValue&&e.timestampValue.length===t.timestampValue.length)return e.timestampValue===t.timestampValue;var n=lh(e.timestampValue),r=lh(t.timestampValue);return n.seconds===r.seconds&&n.nanos===r.nanos}(e,t);case 5:return e.stringValue===t.stringValue;case 6:return function(e,t){return fh(e.bytesValue).isEqual(fh(t.bytesValue))}(e,t);case 7:return e.referenceValue===t.referenceValue;case 8:return function(e,t){return hh(e.geoPointValue.latitude)===hh(t.geoPointValue.latitude)&&hh(e.geoPointValue.longitude)===hh(t.geoPointValue.longitude)}(e,t);case 2:return function(e,t){if("integerValue"in e&&"integerValue"in t)return hh(e.integerValue)===
2hh(t.integerValue);if("doubleValue"in e&&"doubleValue"in t){var n=hh(e.doubleValue),r=hh(t.doubleValue);return n===r?Xl(n)===Xl(r):isNaN(n)&&isNaN(r)}return!1}(e,t);case 9:return Rl(e.arrayValue.values||[],t.arrayValue.values||[],wh);case 10:return function(e,t){var n=e.mapValue.fields||{},r=t.mapValue.fields||{};if($l(n)!==$l(r))return!1;for(var i in n)if(n.hasOwnProperty(i)&&(void 0===r[i]||!wh(n[i],r[i])))return!1;return!0}(e,t);default:return gl()}}function bh(e,t){return void 0!==(e.values||[]).find(function(e){return wh(e,t)})}function _h(e,t){if(e===t)return 0;var n=kh(e),r=kh(t);if(n!==r)return Ol(n,r);switch(n){case 0:case 9007199254740991:return 0;case 1:return Ol(e.booleanValue,t.booleanValue);case 2:return function(e,t){var n=hh(e.integerValue||e.doubleValue),r=hh(t.integerValue||t.doubleValue);return n<r?-1:n>r?1:n===r?0:isNaN(n)?isNaN(r)?0:-1:1}(e,t);case 3:return Eh(e.timestampValue,t.timestampValue);case 4:return Eh(vh(e),vh(t));case 5:return Ol(e.stringValue,t.stringValue);case 6:return function(e,t){var n=fh(e),r=fh(t);return n.compareTo(r)}(e.bytesValue,t.bytesValue);case 7:return function(e,t){for(var n=e.split("/"),r=t.split("/"),i=0;i<n.length&&i<r.length;i++){var a=Ol(n[i],r[i]);if(0!==a)return a}return Ol(n.length,r.length)}(e.referenceValue,t.referenceValue);case 8:return function(e,t){var n=Ol(hh(e.latitude),hh(t.latitude));return 0!==n?n:Ol(hh(e.longitude),hh(t.longitude))}(e.geoPointValue,t.geoPointValue);case 9:return function(e,t){for(var n=e.values||[],r=t.values||[],i=0;i<n.length&&i<r.length;++i){var a=_h(n[i],r[i]);if(a)return a}return Ol(n.length,r.length)}(e.arrayValue,t.arrayValue);case 10:return function(e,t){if(e===mh&&t===mh)return 0;if(e===mh)return 1;if(t===mh)return-1;var n=e.fields||{},r=Object.keys(n),i=t.fields||{},a=Object.keys(i);r.sort(),a.sort();for(var s=0;s<r.length&&s<a.length;++s){var o=Ol(r[s],a[s]);if(0!==o)return o;var u=_h(n[r[s]],i[a[s]]);if(0!==u)return u}return Ol(r.length,a.length)}(e.mapValue,t.mapValue);default:throw gl()}}function Eh(e,t){if("string"==typeof e&&"string"==typeof t&&e.length===t.length)return Ol(e,t);var n=lh(e),r=lh(t),i=Ol(n.seconds,r.seconds);return 0!==i?i:Ol(n.nanos,r.nanos)}function Ih(e){return Sh(e)}function Sh(e){return"nullValue"in e?"null":"booleanValue"in e?""+e.booleanValue:"integerValue"in e?""+e.integerValue:"doubleValue"in e?""+e.doubleValue:"timestampValue"in e?function(e){var t=lh(e);return"time(".concat(t.seconds,",").concat(t.nanos,")")}(e.timestampValue):"stringValue"in e?e.stringValue:"bytesValue"in e?function(e){return fh(e).toBase64()}(e.bytesValue):"referenceValue"in e?function(e){return jl.fromName(e).toString()}(e.referenceValue):"geoPointValue"in e?function(e){return"geo(".concat(e.latitude,",").concat(e.longitude,")")}(e.geoPointValue):"arrayValue"in e?function(e){var t,n="[",r=!0,i=il(e.values||[]);try{for(i.s();!(t=i.n()).done;){var a=t.value;r?r=!1:n+=",",n+=Sh(a)}}catch(s){i.e(s)}finally{i.f()}return n+"]"}(e.arrayValue):"mapValue"in e?function(e){var t,n="{",r=!0,i=il(Object.keys(e.fields||{}).sort());try{for(i.s();!(t=i.n()).done;){var a=t.value;r?r=!1:n+=",",n+="".concat(a,":").concat(Sh(e.fields[a]))}}catch(s){i.e(s)}finally{i.f()}return n+"}"}(e.mapValue):gl()}function Th(e){return!!e&&"integerValue"in e}function xh(e){return!!e&&"arrayValue"in e}function Ah(e){return!!e&&"nullValue"in e}function Ch(e){return!!e&&"doubleValue"in e&&isNaN(Number(e.doubleValue))}function Ph(e){return!!e&&"mapValue"in e}function Oh(e){if(e.geoPointValue)return{geoPointValue:Object.assign({},e.geoPointValue)};if(e.timestampValue&&"object"==l(e.timestampValue))return{timestampValue:Object.assign({},e.timestampValue)};if(e.mapValue){var t={mapValue:{fields:{}}};return Zl(e.mapValue.fields,function(e,n){return t.mapValue.fields[e]=Oh(n)}),t}if(e.arrayValue){for(var n={arrayValue:{values:[]}},r=0;r<(e.arrayValue.values||[]).length;++r)n.arrayValue.values[r]=Oh(e.arrayValue.values[r]);return n}return Object.assign({},e)}function Rh(e){return"__max__"===(((e.mapValue||{}).fields||{}).__type__||{}).stringValue}var Nh=function(){function e(t){I(this,e),this.value=t}return T(e,[{key:"field",value:function(e){if(e.isEmpty())return this.value;
2for(var t=this.value,n=0;n<e.length-1;++n)if(!Ph(t=(t.mapValue.fields||{})[e.get(n)]))return null;return(t=(t.mapValue.fields||{})[e.lastSegment()])||null}},{key:"set",value:function(e,t){this.getFieldsMap(e.popLast())[e.lastSegment()]=Oh(t)}},{key:"setAll",value:function(e){var t=this,n=Fl.emptyPath(),r={},i=[];e.forEach(function(e,a){if(!n.isImmediateParentOf(a)){var s=t.getFieldsMap(n);t.applyChanges(s,r,i),r={},i=[],n=a.popLast()}e?r[a.lastSegment()]=Oh(e):i.push(a.lastSegment())});var a=this.getFieldsMap(n);this.applyChanges(a,r,i)}},{key:"delete",value:function(e){var t=this.field(e.popLast());Ph(t)&&t.mapValue.fields&&delete t.mapValue.fields[e.lastSegment()]}},{key:"isEqual",value:function(e){return wh(this.value,e.value)}},{key:"getFieldsMap",value:function(e){var t=this.value;t.mapValue.fields||(t.mapValue={fields:{}});for(var n=0;n<e.length;++n){var r=t.mapValue.fields[e.get(n)];Ph(r)&&r.mapValue.fields||(r={mapValue:{fields:{}}},t.mapValue.fields[e.get(n)]=r),t=r}return t.mapValue.fields}},{key:"applyChanges",value:function(e,t,n){Zl(t,function(t,n){return e[t]=n});var r,i=il(n);try{for(i.s();!(r=i.n()).done;){var a=r.value;delete e[a]}}catch(s){i.e(s)}finally{i.f()}}},{key:"clone",value:function(){return new e(Oh(this.value))}}],[{key:"empty",value:function(){return new e({mapValue:{}})}}]),e}();function Dh(e){var t=[];return Zl(e.fields,function(e,n){var r=new Fl([e]);if(Ph(n)){var i=Dh(n.mapValue).fields;if(0===i.length)t.push(r);else{var a,s=il(i);try{for(s.s();!(a=s.n()).done;){var o=a.value;t.push(r.child(o))}}catch(u){s.e(u)}finally{s.f()}}}else t.push(r)}),new sh(t)}var Lh=function(){function e(t,n,r,i,a,s,o){I(this,e),this.key=t,this.documentType=n,this.version=r,this.readTime=i,this.createTime=a,this.data=s,this.documentState=o}return T(e,[{key:"convertToFoundDocument",value:function(e,t){return!this.createTime.isEqual(Dl.min())||2!==this.documentType&&0!==this.documentType||(this.createTime=e),this.version=e,this.documentType=1,this.data=t,this.documentState=0,this}},{key:"convertToNoDocument",value:function(e){return this.version=e,this.documentType=2,this.data=Nh.empty(),this.documentState=0,this}},{key:"convertToUnknownDocument",value:function(e){return this.version=e,this.documentType=3,this.data=Nh.empty(),this.documentState=2,this}},{key:"setHasCommittedMutations",value:function(){return this.documentState=2,this}},{key:"setHasLocalMutations",value:function(){return this.documentState=1,this.version=Dl.min(),this}},{key:"setReadTime",value:function(e){return this.readTime=e,this}},{key:"hasLocalMutations",get:function(){return 1===this.documentState}},{key:"hasCommittedMutations",get:function(){return 2===this.documentState}},{key:"hasPendingWrites",get:function(){return this.hasLocalMutations||this.hasCommittedMutations}},{key:"isValidDocument",value:function(){return 0!==this.documentType}},{key:"isFoundDocument",value:function(){return 1===this.documentType}},{key:"isNoDocument",value:function(){return 2===this.documentType}},{key:"isUnknownDocument",value:function(){return 3===this.documentType}},{key:"isEqual",value:function(t){return t instanceof e&&this.key.isEqual(t.key)&&this.version.isEqual(t.version)&&this.documentType===t.documentType&&this.documentState===t.documentState&&this.data.isEqual(t.data)}},{key:"mutableCopy",value:function(){return new e(this.key,this.documentType,this.version,this.readTime,this.createTime,this.data.clone(),this.documentState)}},{key:"toString",value:function(){return"Document(".concat(this.key,", ").concat(this.version,", ").concat(JSON.stringify(this.data.value),", {createTime: ").concat(this.createTime,"}), {documentType: ").concat(this.documentType,"}), {documentState: ").concat(this.documentState,"})")}}],[{key:"newInvalidDocument",value:function(t){return new e(t,0,Dl.min(),Dl.min(),Dl.min(),Nh.empty(),0)}},{key:"newFoundDocument",value:function(t,n,r,i){return new e(t,1,n,Dl.min(),r,i,0)}},{key:"newNoDocument",value:function(t,n){return new e(t,2,n,Dl.min(),Dl.min(),Nh.empty(),0)}},{key:"newUnknownDocument",value:function(t,n){return new e(t,3,n,Dl.min(),Dl.min(),Nh.empty(),2)}}]),e}(),Mh=T(function e(t,n){I(this,e),this.position=t,this.inclusive=n});
2function Uh(e,t,n){for(var r=0,i=0;i<e.position.length;i++){var a=t[i],s=e.position[i];if(r=a.field.isKeyField()?jl.comparator(jl.fromName(s.referenceValue),n.key):_h(s,n.data.field(a.field)),"desc"===a.dir&&(r*=-1),0!==r)break}return r}function Fh(e,t){if(null===e)return null===t;if(null===t)return!1;if(e.inclusive!==t.inclusive||e.position.length!==t.position.length)return!1;for(var n=0;n<e.position.length;n++)if(!wh(e.position[n],t.position[n]))return!1;return!0}var jh=T(function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"asc";I(this,e),this.field=t,this.dir=n});function Vh(e,t){return e.dir===t.dir&&e.field.isEqual(t.field)}var Bh=T(function e(){I(this,e)}),qh=function(e){y(n,e);var t=sl(n);function n(e,r,i){var a;return I(this,n),(a=t.call(this)).field=e,a.op=r,a.value=i,a}return T(n,[{key:"matches",value:function(e){var t=e.data.field(this.field);return"!="===this.op?null!==t&&this.matchesComparison(_h(t,this.value)):null!==t&&kh(this.value)===kh(t)&&this.matchesComparison(_h(t,this.value))}},{key:"matchesComparison",value:function(e){switch(this.op){case"<":return e<0;case"<=":return e<=0;case"==":return 0===e;case"!=":return 0!==e;case">":return e>0;case">=":return e>=0;default:return gl()}}},{key:"isInequality",value:function(){return["<","<=",">",">=","!=","not-in"].indexOf(this.op)>=0}},{key:"getFlattenedFilters",value:function(){return[this]}},{key:"getFilters",value:function(){return[this]}}],[{key:"create",value:function(e,t,r){return e.isKeyField()?"in"===t||"not-in"===t?this.createKeyFieldInFilter(e,t,r):new Yh(e,t,r):"array-contains"===t?new Zh(e,r):"in"===t?new ef(e,r):"not-in"===t?new tf(e,r):"array-contains-any"===t?new nf(e,r):new n(e,t,r)}},{key:"createKeyFieldInFilter",value:function(e,t,n){return"in"===t?new Xh(e,n):new Jh(e,n)}}]),n}(Bh),zh=function(e){y(n,e);var t=sl(n);function n(e,r){var i;return I(this,n),(i=t.call(this)).filters=e,i.op=r,i.ae=null,i}return T(n,[{key:"matches",value:function(e){return Hh(this)?void 0===this.filters.find(function(t){return!t.matches(e)}):void 0!==this.filters.find(function(t){return t.matches(e)})}},{key:"getFlattenedFilters",value:function(){return null!==this.ae||(this.ae=this.filters.reduce(function(e,t){return e.concat(t.getFlattenedFilters())},[])),this.ae}},{key:"getFilters",value:function(){return Object.assign([],this.filters)}}],[{key:"create",value:function(e,t){return new n(e,t)}}]),n}(Bh);function Hh(e){return"and"===e.op}function Kh(e){return function(e){var t,n=il(e.filters);try{for(n.s();!(t=n.n()).done;){if(t.value instanceof zh)return!1}}catch(r){n.e(r)}finally{n.f()}return!0}(e)&&Hh(e)}function Gh(e){if(e instanceof qh)return e.field.canonicalString()+e.op.toString()+Ih(e.value);if(Kh(e))return e.filters.map(function(e){return Gh(e)}).join(",");var t=e.filters.map(function(e){return Gh(e)}).join(",");return"".concat(e.op,"(").concat(t,")")}function Wh(e,t){return e instanceof qh?function(e,t){return t instanceof qh&&e.op===t.op&&e.field.isEqual(t.field)&&wh(e.value,t.value)}(e,t):e instanceof zh?function(e,t){return t instanceof zh&&e.op===t.op&&e.filters.length===t.filters.length&&e.filters.reduce(function(e,n,r){return e&&Wh(n,t.filters[r])},!0)}(e,t):void gl()}function Qh(e){return e instanceof qh?function(e){return"".concat(e.field.canonicalString()," ").concat(e.op," ").concat(Ih(e.value))}(e):e instanceof zh?function(e){return e.op.toString()+" {"+e.getFilters().map(Qh).join(" ,")+"}"}(e):"Filter"}var Yh=function(e){y(n,e);var t=sl(n);function n(e,r,i){var a;return I(this,n),(a=t.call(this,e,r,i)).key=jl.fromName(i.referenceValue),a}return T(n,[{key:"matches",value:function(e){var t=jl.comparator(e.key,this.key);return this.matchesComparison(t)}}]),n}(qh),Xh=function(e){y(n,e);var t=sl(n);function n(e,r){var i;return I(this,n),(i=t.call(this,e,"in",r)).keys=$h("in",r),i}return T(n,[{key:"matches",value:function(e){return this.keys.some(function(t){return t.isEqual(e.key)})}}]),n}(qh),Jh=function(e){y(n,e);var t=sl(n);function n(e,r){var i;return I(this,n),(i=t.call(this,e,"not-in",r)).keys=$h("not-in",r),i}return T(n,[{key:"matches",value:function(e){return!this.keys.some(function(t){return t.isEqual(e.key)})}}]),n}(qh);function $h(e,t){var n;return((null===(n=t.arrayValue)||void 0===n?void 0:n.values)||[]).map(function(e){return jl.fromName(e.referenceValue)})}var Zh=function(e){y(n,e);var t=sl(n);function n(e,r){return I(this,n),t.call(this,e,"array-contains",r)}return T(n,[{key:"matches",value:function(e){var t=e.data.field(this.field);return xh(t)&&bh(t.arrayValue,this.value)}}]),n}(qh),ef=function(e){y(n,e);var t=sl(n);function n(e,r){return I(this,n),t.call(this,e,"in",r)}return T(n,[{key:"matches",value:function(e){var t=e.data.field(this.field);return null!==t&&bh(this.value.arrayValue,t)}}]),n}(qh),tf=function(e){y(n,e);var t=sl(n);function n(e,r){return I(this,n),t.call(this,e,"not-in",r)}return T(n,[{key:"matches",value:function(e){if(bh(this.value.arrayValue,{nullValue:"NULL_VALUE"}))return!1;var t=e.data.field(this.field);return null!==t&&!bh(this.value.arrayValue,t)}}]),n}(qh),nf=function(e){y(n,e);var t=sl(n);function n(e,r){return I(this,n),t.call(this,e,"array-contains-any",r)}return T(n,[{key:"matches",value:function(e){var t=this,n=e.data.field(this.field);return!(!xh(n)||!n.arrayValue.values)&&n.arrayValue.values.some(function(e){return bh(t.value.arrayValue,e)})}}]),n}(qh),rf=T(function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,o=arguments.length>6&&void 0!==arguments[6]?arguments[6]:null;I(this,e),this.path=t,this.collectionGroup=n,this.orderBy=r,this.filters=i,this.limit=a,this.startAt=s,this.endAt=o,this.ue=null});function af(e){return new rf(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,arguments.length>6&&void 0!==arguments[6]?arguments[6]:null)}function sf(e){var t=ml(e);
2if(null===t.ue){var n=t.path.canonicalString();null!==t.collectionGroup&&(n+="|cg:"+t.collectionGroup),n+="|f:",n+=t.filters.map(function(e){return Gh(e)}).join(","),n+="|ob:",n+=t.orderBy.map(function(e){return function(e){return e.field.canonicalString()+e.dir}(e)}).join(","),Yl(t.limit)||(n+="|l:",n+=t.limit),t.startAt&&(n+="|lb:",n+=t.startAt.inclusive?"b:":"a:",n+=t.startAt.position.map(function(e){return Ih(e)}).join(",")),t.endAt&&(n+="|ub:",n+=t.endAt.inclusive?"a:":"b:",n+=t.endAt.position.map(function(e){return Ih(e)}).join(",")),t.ue=n}return t.ue}function of(e,t){if(e.limit!==t.limit)return!1;if(e.orderBy.length!==t.orderBy.length)return!1;for(var n=0;n<e.orderBy.length;n++)if(!Vh(e.orderBy[n],t.orderBy[n]))return!1;if(e.filters.length!==t.filters.length)return!1;for(var r=0;r<e.filters.length;r++)if(!Wh(e.filters[r],t.filters[r]))return!1;return e.collectionGroup===t.collectionGroup&&!!e.path.isEqual(t.path)&&!!Fh(e.startAt,t.startAt)&&Fh(e.endAt,t.endAt)}function uf(e){return jl.isDocumentKey(e.path)&&null===e.collectionGroup&&0===e.filters.length}var cf=T(function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:"F",o=arguments.length>6&&void 0!==arguments[6]?arguments[6]:null,u=arguments.length>7&&void 0!==arguments[7]?arguments[7]:null;I(this,e),this.path=t,this.collectionGroup=n,this.explicitOrderBy=r,this.filters=i,this.limit=a,this.limitType=s,this.startAt=o,this.endAt=u,this.ce=null,this.le=null,this.he=null,this.startAt,this.endAt});function lf(e){return new cf(e)}function hf(e){return 0===e.filters.length&&null===e.limit&&null==e.startAt&&null==e.endAt&&(0===e.explicitOrderBy.length||1===e.explicitOrderBy.length&&e.explicitOrderBy[0].field.isKeyField())}function ff(e){var t=ml(e);if(null===t.ce){t.ce=[];var n,r=new Set,i=il(t.explicitOrderBy);try{for(i.s();!(n=i.n()).done;){var a=n.value;t.ce.push(a),r.add(a.field.canonicalString())}}catch(u){i.e(u)}finally{i.f()}var s=t.explicitOrderBy.length>0?t.explicitOrderBy[t.explicitOrderBy.length-1].dir:"asc",o=function(e){var t=new ih(Fl.comparator);return e.filters.forEach(function(e){e.getFlattenedFilters().forEach(function(e){e.isInequality()&&(t=t.add(e.field))})}),t}(t);o.forEach(function(e){r.has(e.canonicalString())||e.isKeyField()||t.ce.push(new jh(e,s))}),r.has(Fl.keyField().canonicalString())||t.ce.push(new jh(Fl.keyField(),s))}return t.ce}function df(e){var t=ml(e);return t.le||(t.le=function(e,t){if("F"===e.limitType)return af(e.path,e.collectionGroup,t,e.filters,e.limit,e.startAt,e.endAt);t=t.map(function(e){var t="desc"===e.dir?"asc":"desc";return new jh(e.field,t)});var n=e.endAt?new Mh(e.endAt.position,e.endAt.inclusive):null,r=e.startAt?new Mh(e.startAt.position,e.startAt.inclusive):null;return af(e.path,e.collectionGroup,t,e.filters,e.limit,n,r)}(t,ff(e))),t.le}function pf(e,t,n){return new cf(e.path,e.collectionGroup,e.explicitOrderBy.slice(),e.filters.slice(),t,n,e.startAt,e.endAt)}function vf(e,t){return of(df(e),df(t))&&e.limitType===t.limitType}function gf(e){return"".concat(sf(df(e)),"|lt:").concat(e.limitType)}function yf(e){return"Query(target=".concat(function(e){var t=e.path.canonicalString();return null!==e.collectionGroup&&(t+=" collectionGroup="+e.collectionGroup),e.filters.length>0&&(t+=", filters: [".concat(e.filters.map(function(e){return Qh(e)}).join(", "),"]")),Yl(e.limit)||(t+=", limit: "+e.limit),e.orderBy.length>0&&(t+=", orderBy: [".concat(e.orderBy.map(function(e){return function(e){return"".concat(e.field.canonicalString()," (").concat(e.dir,")")}(e)}).join(", "),"]")),e.startAt&&(t+=", startAt: ",t+=e.startAt.inclusive?"b:":"a:",t+=e.startAt.position.map(function(e){return Ih(e)}).join(",")),e.endAt&&(t+=", endAt: ",t+=e.endAt.inclusive?"a:":"b:",t+=e.endAt.position.map(function(e){return Ih(e)}).join(",")),"Target(".concat(t,")")}(df(e)),"; limitType=").concat(e.limitType,")")}function mf(e,t){return t.isFoundDocument()&&function(e,t){var n=t.key.path;return null!==e.collectionGroup?t.key.hasCollectionId(e.collectionGroup)&&e.path.isPrefixOf(n):jl.isDocumentKey(e.path)?e.path.isEqual(n):e.path.isImmediateParentOf(n)}(e,t)&&function(e,t){var n,r=il(ff(e));try{for(r.s();!(n=r.n()).done;){var i=n.value;if(!i.field.isKeyField()&&null===t.data.field(i.field))return!1}}catch(a){r.e(a)}finally{r.f()}return!0}(e,t)&&function(e,t){var n,r=il(e.filters);try{for(r.s();!(n=r.n()).done;){if(!n.value.matches(t))return!1}}catch(i){r.e(i)}finally{r.f()}return!0}(e,t)&&function(e,t){return!(e.startAt&&!function(e,t,n){var r=Uh(e,t,n);return e.inclusive?r<=0:r<0}(e.startAt,ff(e),t))&&!(e.endAt&&!function(e,t,n){var r=Uh(e,t,n);return e.inclusive?r>=0:r>0}(e.endAt,ff(e),t))}(e,t)}function kf(e){return function(t,n){var r,i=!1,a=il(ff(e));try{for(a.s();!(r=a.n()).done;){var s=r.value,o=wf(s,t,n);if(0!==o)return o;i=i||s.field.isKeyField()}}catch(u){a.e(u)}finally{a.f()}return 0}}function wf(e,t,n){var r=e.field.isKeyField()?jl.comparator(t.key,n.key):function(e,t,n){var r=t.data.field(e),i=n.data.field(e);return null!==r&&null!==i?_h(r,i):gl()}(e.field,t,n);switch(e.dir){case"asc":return r;case"desc":return-1*r;default:return gl()}}var bf=function(){function e(t,n){I(this,e),this.mapKeyFn=t,this.equalsFn=n,this.inner={},this.innerSize=0}return T(e,[{key:"get",value:function(e){var t=this.mapKeyFn(e),n=this.inner[t];if(void 0!==n){var r,i=il(n);try{for(i.s();!(r=i.n()).done;){var a=b(r.value,2),s=a[0],o=a[1];if(this.equalsFn(s,e))return o}}catch(u){i.e(u)}finally{i.f()}}}},{key:"has",value:function(e){return void 0!==this.get(e)}},{key:"set",value:function(e,t){var n=this.mapKeyFn(e),r=this.inner[n];if(void 0===r)return this.inner[n]=[[e,t]],void this.innerSize++;for(var i=0;i<r.length;i++)if(this.equalsFn(r[i][0],e))return void(r[i]=[e,t]);
2r.push([e,t]),this.innerSize++}},{key:"delete",value:function(e){var t=this.mapKeyFn(e),n=this.inner[t];if(void 0===n)return!1;for(var r=0;r<n.length;r++)if(this.equalsFn(n[r][0],e))return 1===n.length?delete this.inner[t]:n.splice(r,1),this.innerSize--,!0;return!1}},{key:"forEach",value:function(e){Zl(this.inner,function(t,n){var r,i=il(n);try{for(i.s();!(r=i.n()).done;){var a=b(r.value,2),s=a[0],o=a[1];e(s,o)}}catch(u){i.e(u)}finally{i.f()}})}},{key:"isEmpty",value:function(){return eh(this.inner)}},{key:"size",value:function(){return this.innerSize}}]),e}(),_f=new th(jl.comparator);function Ef(){return _f}var If=new th(jl.comparator);function Sf(){for(var e=If,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];for(var i=0,a=n;i<a.length;i++){var s=a[i];e=e.insert(s.key,s)}return e}function Tf(e){var t=If;return e.forEach(function(e,n){return t=t.insert(e,n.overlayedDocument)}),t}function xf(){return Cf()}function Af(){return Cf()}function Cf(){return new bf(function(e){return e.toString()},function(e,t){return e.isEqual(t)})}var Pf=new th(jl.comparator),Of=new ih(jl.comparator);function Rf(){for(var e=Of,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];for(var i=0,a=n;i<a.length;i++){var s=a[i];e=e.add(s)}return e}var Nf=new ih(Ol);function Df(e,t){if(e.useProto3Json){if(isNaN(t))return{doubleValue:"NaN"};if(t===1/0)return{doubleValue:"Infinity"};if(t===-1/0)return{doubleValue:"-Infinity"}}return{doubleValue:Xl(t)?"-0":t}}function Lf(e){return{integerValue:""+e}}function Mf(e,t){return function(e){return"number"==typeof e&&Number.isInteger(e)&&!Xl(e)&&e<=Number.MAX_SAFE_INTEGER&&e>=Number.MIN_SAFE_INTEGER}(t)?Lf(t):Df(e,t)}var Uf=T(function e(){I(this,e),this._=void 0});function Ff(e,t,n){return e instanceof Bf?function(e,t){var n={fields:{__type__:{stringValue:"server_timestamp"},__local_write_time__:{timestampValue:{seconds:e.seconds,nanos:e.nanoseconds}}}};return t&&dh(t)&&(t=ph(t)),t&&(n.fields.__previous_value__=t),{mapValue:n}}(n,t):e instanceof qf?zf(e,t):e instanceof Hf?Kf(e,t):function(e,t){var n=Vf(e,t),r=Wf(n)+Wf(e.Pe);return Th(n)&&Th(e.Pe)?Lf(r):Df(e.serializer,r)}(e,t)}function jf(e,t,n){return e instanceof qf?zf(e,t):e instanceof Hf?Kf(e,t):n}function Vf(e,t){return e instanceof Gf?function(e){return Th(e)||function(e){return!!e&&"doubleValue"in e}(e)}(t)?t:{integerValue:0}:null}var Bf=function(e){y(n,e);var t=sl(n);function n(){return I(this,n),t.apply(this,arguments)}return T(n)}(Uf),qf=function(e){y(n,e);var t=sl(n);function n(e){var r;return I(this,n),(r=t.call(this)).elements=e,r}return T(n)}(Uf);function zf(e,t){var n,r=Qf(t),i=il(e.elements);try{var a=function(){var e=n.value;r.some(function(t){return wh(t,e)})||r.push(e)};for(i.s();!(n=i.n()).done;)a()}catch(s){i.e(s)}finally{i.f()}return{arrayValue:{values:r}}}var Hf=function(e){y(n,e);var t=sl(n);function n(e){var r;return I(this,n),(r=t.call(this)).elements=e,r}return T(n)}(Uf);function Kf(e,t){var n,r=Qf(t),i=il(e.elements);try{var a=function(){var e=n.value;r=r.filter(function(t){return!wh(t,e)})};for(i.s();!(n=i.n()).done;)a()}catch(s){i.e(s)}finally{i.f()}return{arrayValue:{values:r}}}var Gf=function(e){y(n,e);var t=sl(n);function n(e,r){var i;return I(this,n),(i=t.call(this)).serializer=e,i.Pe=r,i}return T(n)}(Uf);function Wf(e){return hh(e.integerValue||e.doubleValue)}function Qf(e){return xh(e)&&e.arrayValue.values?e.arrayValue.values.slice():[]}var Yf=T(function e(t,n){I(this,e),this.version=t,this.transformResults=n}),Xf=function(){function e(t,n){I(this,e),this.updateTime=t,this.exists=n}return T(e,[{key:"isNone",get:function(){return void 0===this.updateTime&&void 0===this.exists}},{key:"isEqual",value:function(e){return this.exists===e.exists&&(this.updateTime?!!e.updateTime&&this.updateTime.isEqual(e.updateTime):!e.updateTime)}}],[{key:"none",value:function(){return new e}},{key:"exists",value:function(t){return new e(void 0,t)}},{key:"updateTime",value:function(t){return new e(t)}}]),e}();function Jf(e,t){return void 0!==e.updateTime?t.isFoundDocument()&&t.version.isEqual(e.updateTime):void 0===e.exists||e.exists===t.isFoundDocument()}var $f=T(function e(){I(this,e)});function Zf(e,t){if(!e.hasLocalMutations||t&&0===t.fields.length)return null;if(null===t)return e.isNoDocument()?new hd(e.key,Xf.none()):new id(e.ke
2y,e.data,Xf.none());var n,r=e.data,i=Nh.empty(),a=new ih(Fl.comparator),s=il(t.fields);try{for(s.s();!(n=s.n()).done;){var o=n.value;if(!a.has(o)){var u=r.field(o);null===u&&o.length>1&&(o=o.popLast(),u=r.field(o)),null===u?i.delete(o):i.set(o,u),a=a.add(o)}}}catch(c){s.e(c)}finally{s.f()}return new ad(e.key,i,new sh(a.toArray()),Xf.none())}function ed(e,t,n){e instanceof id?function(e,t,n){var r=e.value.clone(),i=od(e.fieldTransforms,t,n.transformResults);r.setAll(i),t.convertToFoundDocument(n.version,r).setHasCommittedMutations()}(e,t,n):e instanceof ad?function(e,t,n){if(Jf(e.precondition,t)){var r=od(e.fieldTransforms,t,n.transformResults),i=t.data;i.setAll(sd(e)),i.setAll(r),t.convertToFoundDocument(n.version,i).setHasCommittedMutations()}else t.convertToUnknownDocument(n.version)}(e,t,n):function(e,t,n){t.convertToNoDocument(n.version).setHasCommittedMutations()}(0,t,n)}function td(e,t,n,r){return e instanceof id?function(e,t,n,r){if(!Jf(e.precondition,t))return n;var i=e.value.clone(),a=ud(e.fieldTransforms,r,t);return i.setAll(a),t.convertToFoundDocument(t.version,i).setHasLocalMutations(),null}(e,t,n,r):e instanceof ad?function(e,t,n,r){if(!Jf(e.precondition,t))return n;var i=ud(e.fieldTransforms,r,t),a=t.data;return a.setAll(sd(e)),a.setAll(i),t.convertToFoundDocument(t.version,a).setHasLocalMutations(),null===n?null:n.unionWith(e.fieldMask.fields).unionWith(e.fieldTransforms.map(function(e){return e.field}))}(e,t,n,r):function(e,t,n){return Jf(e.precondition,t)?(t.convertToNoDocument(t.version).setHasLocalMutations(),null):n}(e,t,n)}function nd(e,t){var n,r=null,i=il(e.fieldTransforms);try{for(i.s();!(n=i.n()).done;){var a=n.value,s=t.data.field(a.field),o=Vf(a.transform,s||null);null!=o&&(null===r&&(r=Nh.empty()),r.set(a.field,o))}}catch(u){i.e(u)}finally{i.f()}return r||null}function rd(e,t){return e.type===t.type&&!!e.key.isEqual(t.key)&&!!e.precondition.isEqual(t.precondition)&&!!function(e,t){return void 0===e&&void 0===t||!(!e||!t)&&Rl(e,t,function(e,t){return function(e,t){return e.field.isEqual(t.field)&&function(e,t){return e instanceof qf&&t instanceof qf||e instanceof Hf&&t instanceof Hf?Rl(e.elements,t.elements,wh):e instanceof Gf&&t instanceof Gf?wh(e.Pe,t.Pe):e instanceof Bf&&t instanceof Bf}(e.transform,t.transform)}(e,t)})}(e.fieldTransforms,t.fieldTransforms)&&(0===e.type?e.value.isEqual(t.value):1!==e.type||e.data.isEqual(t.data)&&e.fieldMask.isEqual(t.fieldMask))}var id=function(e){y(n,e);var t=sl(n);function n(e,r,i){var a,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[];
2return I(this,n),(a=t.call(this)).key=e,a.value=r,a.precondition=i,a.fieldTransforms=s,a.type=0,a}return T(n,[{key:"getFieldMask",value:function(){return null}}]),n}($f),ad=function(e){y(n,e);var t=sl(n);function n(e,r,i,a){var s,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[];return I(this,n),(s=t.call(this)).key=e,s.data=r,s.fieldMask=i,s.precondition=a,s.fieldTransforms=o,s.type=1,s}return T(n,[{key:"getFieldMask",value:function(){return this.fieldMask}}]),n}($f);function sd(e){var t=new Map;return e.fieldMask.fields.forEach(function(n){if(!n.isEmpty()){var r=e.data.field(n);t.set(n,r)}}),t}function od(e,t,n){var r=new Map;yl(e.length===n.length);for(var i=0;i<n.length;i++){var a=e[i],s=a.transform,o=t.data.field(a.field);r.set(a.field,jf(s,o,n[i]))}return r}function ud(e,t,n){var r,i=new Map,a=il(e);try{for(a.s();!(r=a.n()).done;){var s=r.value,o=s.transform,u=n.data.field(s.field);i.set(s.field,Ff(o,u,t))}}catch(c){a.e(c)}finally{a.f()}return i}var cd,ld,hd=function(e){y(n,e);var t=sl(n);function n(e,r){var i;return I(this,n),(i=t.call(this)).key=e,i.precondition=r,i.type=2,i.fieldTransforms=[],i}return T(n,[{key:"getFieldMask",value:function(){return null}}]),n}($f),fd=function(e){y(n,e);var t=sl(n);function n(e,r){var i;return I(this,n),(i=t.call(this)).key=e,i.precondition=r,i.type=3,i.fieldTransforms=[],i}return T(n,[{key:"getFieldMask",value:function(){return null}}]),n}($f),dd=function(){function e(t,n,r,i){I(this,e),this.batchId=t,this.localWriteTime=n,this.baseMutations=r,this.mutations=i}return T(e,[{key:"applyToRemoteDocument",value:function(e,t){for(var n=t.mutationResults,r=0;r<this.mutations.length;r++){var i=this.mutations[r];i.key.isEqual(e.key)&&ed(i,e,n[r])}}},{key:"applyToLocalView",value:function(e,t){var n,r=il(this.baseMutations);try{for(r.s();!(n=r.n()).done;){var i=n.value;i.key.isEqual(e.key)&&(t=td(i,e,t,this.localWriteTime))}}catch(u){r.e(u)}finally{r.f()}var a,s=il(this.mutations);try{for(s.s();!(a=s.n()).done;){var o=a.value;o.key.isEqual(e.key)&&(t=td(o,e,t,this.localWriteTime))}}catch(u){s.e(u)}finally{s.f()}return t}},{key:"applyToLocalDocumentSet",value:function(e,t){var n=this,r=Af();return this.mutations.forEach(function(i){var a=e.get(i.key),s=a.overlayedDocument,o=n.applyToLocalView(s,a.mutatedFields),u=Zf(s,o=t.has(i.key)?null:o);null!==u&&r.set(i.key,u),s.isValidDocument()||s.convertToNoDocument(Dl.min())}),r}},{key:"keys",value:function(){return this.mutations.reduce(function(e,t){return e.add(t.key)},Rf())}},{key:"isEqual",value:function(e){return this.batchId===e.batchId&&Rl(this.mutations,e.mutations,function(e,t){return rd(e,t)})&&Rl(this.baseMutations,e.baseMutations,function(e,t){return rd(e,t)})}}]),e}(),pd=function(){function e(t,n,r,i){I(this,e),this.batch=t,this.commitVersion=n,this.mutationResults=r,this.docVersions=i}return T(e,null,[{key:"from",value:function(t,n,r){yl(t.mutations.length===r.length);for(var i=Pf,a=t.mutations,s=0;s<a.length;s++)i=i.insert(a[s].key,r[s].version);return new e(t,n,r,i)}}]),e}(),vd=function(){function e(t,n){I(this,e),this.largestBatchId=t,this.mutation=n}return T(e,[{key:"getKey",value:function(){return this.mutation.key}},{key:"isEqual",value:function(e){return null!==e&&this.mutation===e.mutation}},{key:"toString",value:function(){return"Overlay{\n largestBatchId: ".concat(this.largestBatchId,",\n mutation: ").concat(this.mutation.toString(),"\n }")}}]),e}(),gd=T(function e(t,n){I(this,e),this.count=t,this.unchangedNames=n});function yd(e){switch(e){default:return gl();case kl.CANCELLED:case kl.UNKNOWN:case kl.DEADLINE_EXCEEDED:case kl.RESOURCE_EXHAUSTED:case kl.INTERNAL:case kl.UNAVAILABLE:case kl.UNAUTHENTICATED:return!1;case kl.INVALID_ARGUMENT:case kl.NOT_FOUND:case kl.ALREADY_EXISTS:case kl.PERMISSION_DENIED:case kl.FAILED_PRECONDITION:case kl.ABORTED:case kl.OUT_OF_RANGE:case kl.UNIMPLEMENTED:case kl.DATA_LOSS:return!0}}function md(e){if(void 0===e)return dl("GRPC error has no .code"),kl.UNKNOWN;switch(e){case cd.OK:return kl.OK;case cd.CANCELLED:return kl.CANCELLED;case cd.UNKNOWN:return kl.UNKNOWN;case cd.DEADLINE_EXCEEDED:return kl.DEADLINE_EXCEEDED;case cd.RESOURCE_EXHAUSTED:return kl.RESOURCE_EXHAUSTED;case cd.INTERNAL:return kl.INTERNAL;case cd.UNAVAILABLE:return kl.UNAVAILABLE;case cd.UNAUTHENTICATED:return kl.UNAUTHENTICATED;case cd.INVALID_ARGUMENT:return kl.INVALID_ARGUMENT;case cd.NOT_FOUND:return kl.NOT_FOUND;case cd.ALREADY_EXISTS:return kl.ALREADY_EXISTS;case cd.PERMISSION_DENIED:return kl.PERMISSION_DENIED;case cd.FAILED_PRECONDITION:return kl.FAILED_PRECONDITION;case cd.ABORTED:return kl.ABORTED;case cd.OUT_OF_RANGE:return kl.OUT_OF_RANGE;
2case cd.UNIMPLEMENTED:return kl.UNIMPLEMENTED;case cd.DATA_LOSS:return kl.DATA_LOSS;default:return gl()}}(ld=cd||(cd={}))[ld.OK=0]="OK",ld[ld.CANCELLED=1]="CANCELLED",ld[ld.UNKNOWN=2]="UNKNOWN",ld[ld.INVALID_ARGUMENT=3]="INVALID_ARGUMENT",ld[ld.DEADLINE_EXCEEDED=4]="DEADLINE_EXCEEDED",ld[ld.NOT_FOUND=5]="NOT_FOUND",ld[ld.ALREADY_EXISTS=6]="ALREADY_EXISTS",ld[ld.PERMISSION_DENIED=7]="PERMISSION_DENIED",ld[ld.UNAUTHENTICATED=16]="UNAUTHENTICATED",ld[ld.RESOURCE_EXHAUSTED=8]="RESOURCE_EXHAUSTED",ld[ld.FAILED_PRECONDITION=9]="FAILED_PRECONDITION",ld[ld.ABORTED=10]="ABORTED",ld[ld.OUT_OF_RANGE=11]="OUT_OF_RANGE",ld[ld.UNIMPLEMENTED=12]="UNIMPLEMENTED",ld[ld.INTERNAL=13]="INTERNAL",ld[ld.UNAVAILABLE=14]="UNAVAILABLE",ld[ld.DATA_LOSS=15]="DATA_LOSS";var kd=new qc([4294967295,4294967295],0);function wd(e){var t=(new TextEncoder).encode(e),n=new zc;return n.update(t),new Uint8Array(n.digest())}function bd(e){var t=new DataView(e.buffer),n=t.getUint32(0,!0),r=t.getUint32(4,!0),i=t.getUint32(8,!0),a=t.getUint32(12,!0);return[new qc([n,r],0),new qc([i,a],0)]}var _d=function(){function e(t,n,r){if(I(this,e),this.bitmap=t,this.padding=n,this.hashCount=r,n<0||n>=8)throw new Ed("Invalid padding: ".concat(n));if(r<0)throw new Ed("Invalid hash count: ".concat(r));if(t.length>0&&0===this.hashCount)throw new Ed("Invalid hash count: ".concat(r));if(0===t.length&&0!==n)throw new Ed("Invalid padding when bitmap length is 0: ".concat(n));this.Ie=8*t.length-n,this.Te=qc.fromNumber(this.Ie)}return T(e,[{key:"Ee",value:function(e,t,n){var r=e.add(t.multiply(qc.fromNumber(n)));return 1===r.compare(kd)&&(r=new qc([r.getBits(0),r.getBits(1)],0)),r.modulo(this.Te).toNumber()}},{key:"de",value:function(e){return!!(this.bitmap[Math.floor(e/8)]&1<<e%8)}},{key:"mightContain",value:function(e){if(0===this.Ie)return!1;for(var t=b(bd(wd(e)),2),n=t[0],r=t[1],i=0;i<this.hashCount;i++){var a=this.Ee(n,r,i);if(!this.de(a))return!1}return!0}},{key:"insert",value:function(e){if(0!==this.Ie)for(var t=b(bd(wd(e)),2),n=t[0],r=t[1],i=0;i<this.hashCount;i++){var a=this.Ee(n,r,i);this.Ae(a)}}},{key:"Ae",value:function(e){var t=Math.floor(e/8),n=e%8;this.bitmap[t]|=1<<n}}],[{key:"create",value:function(t,n,r){var i=t%8==0?0:8-t%8,a=new e(new Uint8Array(Math.ceil(t/8)),i,n);return r.forEach(function(e){return a.insert(e)}),a}}]),e}(),Ed=function(e){y(n,e);var t=sl(n);function n(){var e;return I(this,n),(e=t.apply(this,arguments)).name="BloomFilterError",e}return T(n)}(N(Error)),Id=function(){function e(t,n,r,i,a){I(this,e),this.snapshotVersion=t,this.targetChanges=n,this.targetMismatches=r,this.documentUpdates=i,this.resolvedLimboDocuments=a}return T(e,null,[{key:"createSynthesizedRemoteEventForCurrentChange",value:function(t,n,r){var i=new Map;return i.set(t,Sd.createSynthesizedTargetChangeForCurrentChange(t,n,r)),new e(Dl.min(),i,new th(Ol),Ef(),Rf())}}]),e}(),Sd=function(){function e(t,n,r,i,a){I(this,e),this.resumeToken=t,this.current=n,this.addedDocuments=r,this.modifiedDocuments=i,this.removedDocuments=a}return T(e,null,[{key:"createSynthesizedTargetChangeForCurrentChange",value:function(t,n,r){return new e(r,n,Rf(),Rf(),Rf())}}]),e}(),Td=T(function e(t,n,r,i){I(this,e),this.Re=t,this.removedTargetIds=n,this.key=r,this.Ve=i}),xd=T(function e(t,n){I(this,e),this.targetId=t,this.me=n}),Ad=T(function e(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:uh.EMPTY_BYTE_STRING,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;I(this,e),this.state=t,this.targetIds=n,this.resumeToken=r,this.cause=i}),Cd=function(){function e(){I(this,e),this.fe=0,this.ge=Rd(),this.pe=uh.EMPTY_BYTE_STRING,this.ye=!1,this.we=!0}return T(e,[{key:"current",get:function(){return this.ye}},{key:"resumeToken",get:function(){return this.pe}},{key:"Se",get:function(){return 0!==this.fe}},{key:"be",get:function(){return this.we}},{key:"De",value:function(e){e.approximateByteSize()>0&&(this.we=!0,this.pe=e)}},{key:"Ce",value:function(){var e=Rf(),t=Rf(),n=Rf();return this.ge.forEach(function(r,i){switch(i){case 0:e=e.add(r);break;case 2:t=t.add(r);break;case 1:n=n.add(r);break;default:gl()}}),new Sd(this.pe,this.ye,e,t,n)}},{key:"ve",value:function(){this.we=!1,this.ge=Rd()}},{key:"Fe",value:function(e,t){this.we=!0,this.ge=this.ge.insert(e,t)}},{key:"Me",value:function(e){this.we=!0,this.ge=this.ge.remove(e)}},{key:"xe",value:function(){this.fe+=1}},{key:"Oe",value:function(){this.fe-=1,yl(this.fe>=0)}},{key:"Ne",value:function(){this.we=!0,this.ye=!0}}]),e}(),Pd=function(){function e(t){I(this,e),this.Le=t,this.Be=new Map,this.ke=Ef(),this.qe=Od(),this.Qe=new th(Ol)}return T(e,[{key:"Ke",value:function(e){var t,n=il(e.Re);try{for(n.s();!(t=n.n()).done;){var r=t.value;e.Ve&&e.Ve.isFoundDocument()?this.$e(r,e.Ve):this.Ue(r,e.key,e.Ve)}}catch(o){n.e(o)}finally{n.f()}var i,a=il(e.removedTargetIds);try{for(a.s();!(i=a.n()).done;){var s=i.value;this.Ue(s,e.key,e.Ve)}}catch(o){a.e(o)}finally{a.f()}}},{key:"We",value:function(e){var t=this;this.forEachTarget(e,function(n){var r=t.Ge(n);switch(e.state){case 0:t.ze(n)&&r.De(e.resumeToken);break;
2case 1:r.Oe(),r.Se||r.ve(),r.De(e.resumeToken);break;case 2:r.Oe(),r.Se||t.removeTarget(n);break;case 3:t.ze(n)&&(r.Ne(),r.De(e.resumeToken));break;case 4:t.ze(n)&&(t.je(n),r.De(e.resumeToken));break;default:gl()}})}},{key:"forEachTarget",value:function(e,t){var n=this;e.targetIds.length>0?e.targetIds.forEach(t):this.Be.forEach(function(e,r){n.ze(r)&&t(r)})}},{key:"He",value:function(e){var t=e.targetId,n=e.me.count,r=this.Je(t);if(r){var i=r.target;if(uf(i))if(0===n){var a=new jl(i.path);this.Ue(t,a,Lh.newNoDocument(a,Dl.min()))}else yl(1===n);else{var s=this.Ye(t);if(s!==n){var o=this.Ze(e),u=o?this.Xe(o,e,s):1;if(0!==u){this.je(t);var c=2===u?"TargetPurposeExistenceFilterMismatchBloom":"TargetPurposeExistenceFilterMismatch";this.Qe=this.Qe.insert(t,c)}}}}}},{key:"Ze",value:function(e){var t=e.me.unchangedNames;if(!t||!t.bits)return null;var n,r,i=t.bits,a=i.bitmap,s=void 0===a?"":a,o=i.padding,u=void 0===o?0:o,c=t.hashCount,l=void 0===c?0:c;try{n=fh(s).toUint8Array()}catch(e){if(e instanceof oh)return pl("Decoding the base64 bloom filter in existence filter failed ("+e.message+"); ignoring the bloom filter and falling back to full re-query."),null;throw e}try{r=new _d(n,u,l)}catch(e){return pl(e instanceof Ed?"BloomFilter error: ":"Applying bloom filter failed: ",e),null}return 0===r.Ie?null:r}},{key:"Xe",value:function(e,t,n){return t.me.count===n-this.nt(e,t.targetId)?0:2}},{key:"nt",value:function(e,t){var n=this,r=this.Le.getRemoteKeysForTarget(t),i=0;return r.forEach(function(r){var a=n.Le.tt(),s="projects/".concat(a.projectId,"/databases/").concat(a.database,"/documents/").concat(r.path.canonicalString());e.mightContain(s)||(n.Ue(t,r,null),i++)}),i}},{key:"rt",value:function(e){var t=this,n=new Map;this.Be.forEach(function(r,i){var a=t.Je(i);if(a){if(r.current&&uf(a.target)){var s=new jl(a.target.path);null!==t.ke.get(s)||t.it(i,s)||t.Ue(i,s,Lh.newNoDocument(s,e))}r.be&&(n.set(i,r.Ce()),r.ve())}});var r=Rf();this.qe.forEach(function(e,n){var i=!0;n.forEachWhile(function(e){var n=t.Je(e);return!n||"TargetPurposeLimboResolution"===n.purpose||(i=!1,!1)}),i&&(r=r.add(e))}),this.ke.forEach(function(t,n){return n.setReadTime(e)});var i=new Id(e,n,this.Qe,this.ke,r);return this.ke=Ef(),this.qe=Od(),this.Qe=new th(Ol),i}},{key:"$e",value:function(e,t){if(this.ze(e)){var n=this.it(e,t.key)?2:0;this.Ge(e).Fe(t.key,n),this.ke=this.ke.insert(t.key,t),this.qe=this.qe.insert(t.key,this.st(t.key).add(e))}}},{key:"Ue",value:function(e,t,n){if(this.ze(e)){var r=this.Ge(e);this.it(e,t)?r.Fe(t,1):r.Me(t),this.qe=this.qe.insert(t,this.st(t).delete(e)),n&&(this.ke=this.ke.insert(t,n))}}},{key:"removeTarget",value:function(e){this.Be.delete(e)}},{key:"Ye",value:function(e){var t=this.Ge(e).Ce();return this.Le.getRemoteKeysForTarget(e).size+t.addedDocuments.size-t.removedDocuments.size}},{key:"xe",value:function(e){this.Ge(e).xe()}},{key:"Ge",value:function(e){var t=this.Be.get(e);return t||(t=new Cd,this.Be.set(e,t)),t}},{key:"st",value:function(e){var t=this.qe.get(e);return t||(t=new ih(Ol),this.qe=this.qe.insert(e,t)),t}},{key:"ze",value:function(e){var t=null!==this.Je(e);return t||fl("WatchChangeAggregator","Detected inactive target",e),t}},{key:"Je",value:function(e){var t=this.Be.get(e);return t&&t.Se?null:this.Le.ot(e)}},{key:"je",value:function(e){var t=this;this.Be.set(e,new Cd),this.Le.getRemoteKeysForTarget(e).forEach(function(n){t.Ue(e,n,null)})}},{key:"it",value:function(e,t){return this.Le.getRemoteKeysForTarget(e).has(t)}}]),e}();function Od(){return new th(jl.comparator)}function Rd(){return new th(jl.comparator)}var Nd={asc:"ASCENDING",desc:"DESCENDING"},Dd={"<":"LESS_THAN","<=":"LESS_THAN_OR_EQUAL",">":"GREATER_THAN",">=":"GREATER_THAN_OR_EQUAL","==":"EQUAL","!=":"NOT_EQUAL","array-contains":"ARRAY_CONTAINS",in:"IN","not-in":"NOT_IN","array-contains-any":"ARRAY_CONTAINS_ANY"},Ld={and:"AND",or:"OR"},Md=T(function e(t,n){I(this,e),this.databaseId=t,this.useProto3Json=n});function Ud(e,t){return e.useProto3Json||Yl(t)?t:{value:t}}function Fd(e,t){return e.useProto3Json?"".concat(new Date(1e3*t.seconds).toISOString().replace(/\.\d*/,"").replace("Z",""),".").concat(("000000000"+t.nanoseconds).slice(-9),"Z"):{seconds:""+t.seconds,nanos:t.nanoseconds}}
2function jd(e,t){return e.useProto3Json?t.toBase64():t.toUint8Array()}function Vd(e,t){return Fd(e,t.toTimestamp())}function Bd(e){return yl(!!e),Dl.fromTimestamp(function(e){var t=lh(e);return new Nl(t.seconds,t.nanos)}(e))}function qd(e,t){return zd(e,t).canonicalString()}function zd(e,t){var n=function(e){return new Ml(["projects",e.projectId,"databases",e.database])}(e).child("documents");return void 0===t?n:n.child(t)}function Hd(e){var t=Ml.fromString(e);return yl(up(t)),t}function Kd(e,t){return qd(e.databaseId,t.path)}function Gd(e,t){var n=Hd(t);if(n.get(1)!==e.databaseId.projectId)throw new wl(kl.INVALID_ARGUMENT,"Tried to deserialize key from different project: "+n.get(1)+" vs "+e.databaseId.projectId);if(n.get(3)!==e.databaseId.database)throw new wl(kl.INVALID_ARGUMENT,"Tried to deserialize key from different database: "+n.get(3)+" vs "+e.databaseId.database);return new jl(Yd(n))}function Wd(e,t){return qd(e.databaseId,t)}function Qd(e){return new Ml(["projects",e.databaseId.projectId,"databases",e.databaseId.database]).canonicalString()}function Yd(e){return yl(e.length>4&&"documents"===e.get(4)),e.popFirst(5)}function Xd(e,t,n){return{name:Kd(e,t),fields:n.value.mapValue.fields}}function Jd(e,t){return{documents:[Wd(e,t.path)]}}function $d(e,t){var n,r={structuredQuery:{}},i=t.path;null!==t.collectionGroup?(n=i,r.structuredQuery.from=[{collectionId:t.collectionGroup,allDescendants:!0}]):(n=i.popLast(),r.structuredQuery.from=[{collectionId:i.lastSegment()}]),r.parent=Wd(e,n);var a=function(e){if(0!==e.length)return sp(zh.create(e,"and"))}(t.filters);a&&(r.structuredQuery.where=a);var s=function(e){if(0!==e.length)return e.map(function(e){return function(e){return{field:ip(e.field),direction:tp(e.dir)}}(e)})}(t.orderBy);s&&(r.structuredQuery.orderBy=s);var o=Ud(e,t.limit);return null!==o&&(r.structuredQuery.limit=o),t.startAt&&(r.structuredQuery.startAt=function(e){return{before:e.inclusive,values:e.position}}(t.startAt)),t.endAt&&(r.structuredQuery.endAt=function(e){return{before:!e.inclusive,values:e.position}}(t.endAt)),{_t:r,parent:n}}function Zd(e){var t=function(e){var t=Hd(e);return 4===t.length?Ml.emptyPath():Yd(t)}(e.parent),n=e.structuredQuery,r=n.from?n.from.length:0,i=null;if(r>0){yl(1===r);var a=n.from[0];a.allDescendants?i=a.collectionId:t=t.child(a.collectionId)}var s=[];n.where&&(s=function(e){var t=ep(e);return t instanceof zh&&Kh(t)?t.getFilters():[t]}(n.where));var o=[];n.orderBy&&(o=function(e){return e.map(function(e){return function(e){return new jh(ap(e.field),function(e){switch(e){case"ASCENDING":return"asc";case"DESCENDING":return"desc";default:return}}(e.direction))}(e)})}(n.orderBy));var u=null;n.limit&&(u=function(e){var t;return Yl(t="object"==l(e)?e.value:e)?null:t}(n.limit));var c=null;n.startAt&&(c=function(e){var t=!!e.before,n=e.values||[];return new Mh(n,t)}(n.startAt));var h=null;return n.endAt&&(h=function(e){var t=!e.before,n=e.values||[];return new Mh(n,t)}(n.endAt)),function(e,t,n,r,i,a,s,o){return new cf(e,t,n,r,i,a,s,o)}(t,i,o,s,u,"F",c,h)}function ep(e){return void 0!==e.unaryFilter?function(e){switch(e.unaryFilter.op){case"IS_NAN":var t=ap(e.unaryFilter.field);return qh.create(t,"==",{doubleValue:NaN});case"IS_NULL":var n=ap(e.unaryFilter.field);return qh.create(n,"==",{nullValue:"NULL_VALUE"});case"IS_NOT_NAN":var r=ap(e.unaryFilter.field);return qh.create(r,"!=",{doubleValue:NaN});case"IS_NOT_NULL":var i=ap(e.unaryFilter.field);return qh.create(i,"!=",{nullValue:"NULL_VALUE"});default:return gl()}}(e):void 0!==e.fieldFilter?function(e){return qh.create(ap(e.fieldFilter.field),function(e){switch(e){case"EQUAL":return"==";case"NOT_EQUAL":return"!=";case"GREATER_THAN":return">";case"GREATER_THAN_OR_EQUAL":return">=";case"LESS_THAN":return"<";case"LESS_THAN_OR_EQUAL":return"<=";case"ARRAY_CONTAINS":return"array-contains";case"IN":return"in";case"NOT_IN":return"not-in";case"ARRAY_CONTAINS_ANY":return"array-contains-any";default:return gl()}}(e.fieldFilter.op),e.fieldFilter.value)}(e):void 0!==e.compositeFilter?function(e){return zh.create(e.compositeFilter.filters.map(function(e){return ep(e)}),function(e){switch(e){case"AND":return"and";case"OR":return"or";default:return gl()}}(e.compositeFilter.op))}(e):gl()}function tp(e){return Nd[e]}function np(e){return Dd[e]}function rp(e){return Ld[e]}function ip(e){return{fieldPath:e.canonicalString()}}function ap(e){return Fl.fromServerFormat(e.fieldPath)}function sp(e){return e instanceof qh?function(e){if("=="===e.op){if(Ch(e.value))return{unaryFilter:{field:ip(e.field),op:"IS_NAN"}};if(Ah(e.value))return{unaryFilter:{field:ip(e.field),op:"IS_NULL"}}}else if("!="===e.op){if(Ch(e.value))return{unaryFilter:{field:ip(e.field),op:"IS_NOT_NA
2N"}};if(Ah(e.value))return{unaryFilter:{field:ip(e.field),op:"IS_NOT_NULL"}}}return{fieldFilter:{field:ip(e.field),op:np(e.op),value:e.value}}}(e):e instanceof zh?function(e){var t=e.getFilters().map(function(e){return sp(e)});return 1===t.length?t[0]:{compositeFilter:{op:rp(e.op),filters:t}}}(e):gl()}function op(e){var t=[];return e.fields.forEach(function(e){return t.push(e.canonicalString())}),{fieldPaths:t}}function up(e){return e.length>=4&&"projects"===e.get(0)&&"databases"===e.get(2)}var cp=function(){function e(t,n,r,i){var a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:Dl.min(),s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:Dl.min(),o=arguments.length>6&&void 0!==arguments[6]?arguments[6]:uh.EMPTY_BYTE_STRING,u=arguments.length>7&&void 0!==arguments[7]?arguments[7]:null;I(this,e),this.target=t,this.targetId=n,this.purpose=r,this.sequenceNumber=i,this.snapshotVersion=a,this.lastLimboFreeSnapshotVersion=s,this.resumeToken=o,this.expectedCount=u}return T(e,[{key:"withSequenceNumber",value:function(t){return new e(this.target,this.targetId,this.purpose,t,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,this.expectedCount)}},{key:"withResumeToken",value:function(t,n){return new e(this.target,this.targetId,this.purpose,this.sequenceNumber,n,this.lastLimboFreeSnapshotVersion,t,null)}},{key:"withExpectedCount",value:function(t){return new e(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,t)}},{key:"withLastLimboFreeSnapshotVersion",value:function(t){return new e(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,t,this.resumeToken,this.expectedCount)}}]),e}(),lp=T(function e(t){I(this,e),this.ct=t});function hp(e){var t=Zd({parent:e.parent,structuredQuery:e.structuredQuery});return"LAST"===e.limitType?pf(t,t.limit,"L"):t}var fp=function(){function e(){I(this,e)}return T(e,[{key:"Pt",value:function(e,t){this.It(e,t),t.Tt()}},{key:"It",value:function(e,t){if("nullValue"in e)this.Et(t,5);else if("booleanValue"in e)this.Et(t,10),t.dt(e.booleanValue?1:0);else if("integerValue"in e)this.Et(t,15),t.dt(hh(e.integerValue));else if("doubleValue"in e){var n=hh(e.doubleValue);isNaN(n)?this.Et(t,13):(this.Et(t,15),Xl(n)?t.dt(0):t.dt(n))}else if("timestampValue"in e){var r=e.timestampValue;this.Et(t,20),"string"==typeof r&&(r=lh(r)),t.At("".concat(r.seconds||"")),t.dt(r.nanos||0)}else if("stringValue"in e)this.Rt(e.stringValue,t),this.Vt(t);else if("bytesValue"in e)this.Et(t,30),t.ft(fh(e.bytesValue)),this.Vt(t);else if("referenceValue"in e)this.gt(e.referenceValue,t);else if("geoPointValue"in e){var i=e.geoPointValue;this.Et(t,45),t.dt(i.latitude||0),t.dt(i.longitude||0)}else"mapValue"in e?Rh(e)?this.Et(t,Number.MAX_SAFE_INTEGER):(this.yt(e.mapValue,t),this.Vt(t)):"arrayValue"in e?(this.wt(e.arrayValue,t),this.Vt(t)):gl()}},{key:"Rt",value:function(e,t){this.Et(t,25),this.St(e,t)}},{key:"St",value:function(e,t){t.At(e)}},{key:"yt",value:function(e,t){var n=e.fields||{};this.Et(t,55);for(var r=0,i=Object.keys(n);r<i.length;r++){var a=i[r];this.Rt(a,t),this.It(n[a],t)}}},{key:"wt",value:function(e,t){var n=e.values||[];this.Et(t,50);var r,i=il(n);try{for(i.s();!(r=i.n()).done;){var a=r.value;this.It(a,t)}}catch(s){i.e(s)}finally{i.f()}}},{key:"gt",value:function(e,t){var n=this;this.Et(t,37),jl.fromName(e).path.forEach(function(e){n.Et(t,60),n.St(e,t)})}},{key:"Et",value:function(e,t){e.dt(t)}},{key:"Vt",value:function(e){e.dt(2)}}]),e}();fp.bt=new fp;var dp=function(){function e(){I(this,e),this._n=new pp}return T(e,[{key:"addToCollectionParentIndex",value:function(e,t){return this._n.add(t),Gl.resolve()}},{key:"getCollectionParents",value:function(e,t){return Gl.resolve(this._n.getEntries(t))}},{key:"addFieldIndex",value:function(e,t){return Gl.resolve()}},{key:"deleteFieldIndex",value:function(e,t){return Gl.resolve()}},{key:"deleteAllFieldIndexes",value:function(e){return Gl.resolve()}},{key:"createTargetIndexes",value:function(e,t){return Gl.resolve()}},{key:"getDocumentsMatchingTarget",value:function(e,t){return Gl.resolve(null)}},{key:"getIndexType",value:function(e,t){return Gl.resolve(0)}},{key:"getFieldIndexes",value:function(e,t){return Gl.resolve([])}},{key:"getNextCollectionGroupToUpdate",value:function(e){return Gl.resolve(null)}},{key:"getMinOffset",value:function(e,t){return Gl.resolve(Bl.min())}},{key:"getMinOffsetFromCollectionGroup",value:function(e,t){return Gl.resolve(Bl.min())}},{key:"updateCollectionGroup",value:function(e,t,n){return Gl.resolve()}},{key:"updateIndexEntries",value:function(e,t){return Gl.resolve()}}]),e}(),pp=function(){function e(){I(this,e),this.index={}}return T(e,[{key:"add",value:function(e){var t=e.lastSegment(),n=e.popLast(),r=this.index[t]||new ih(Ml.comparator),i=!r.has(n);return this.index[t]=r.add(n),i}},{key:"has",value:function(e){var t=e.lastSegment(),n=e.popLast(),r=this.index[t];return r&&r.has(n)}},{key:"getEntries",value:function(e){return(this.index[e]||new ih(Ml.comparator)).toArray()}}]),e}(),vp=function(){function e(t,n,r){I(this,e),this.cacheSizeCollectionThreshold=t,this.percentileToCollect=n,this.maximumSequenceNumbersToCollect=r}return T(e,null,[{key:"withCacheSize",value:function(t){return new e(t,e.DEFAULT_COLLECTION_PE
2RCENTILE,e.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT)}}]),e}();vp.DEFAULT_COLLECTION_PERCENTILE=10,vp.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT=1e3,vp.DEFAULT=new vp(41943040,vp.DEFAULT_COLLECTION_PERCENTILE,vp.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT),vp.DISABLED=new vp(-1,0,0);var gp=function(){function e(t){I(this,e),this.On=t}return T(e,[{key:"next",value:function(){return this.On+=2,this.On}}],[{key:"Nn",value:function(){return new e(0)}},{key:"Ln",value:function(){return new e(-1)}}]),e}(),yp=function(){function e(){I(this,e),this.changes=new bf(function(e){return e.toString()},function(e,t){return e.isEqual(t)}),this.changesApplied=!1}return T(e,[{key:"addEntry",value:function(e){this.assertNotApplied(),this.changes.set(e.key,e)}},{key:"removeEntry",value:function(e,t){this.assertNotApplied(),this.changes.set(e,Lh.newInvalidDocument(e).setReadTime(t))}},{key:"getEntry",value:function(e,t){this.assertNotApplied();var n=this.changes.get(t);return void 0!==n?Gl.resolve(n):this.getFromCache(e,t)}},{key:"getEntries",value:function(e,t){return this.getAllFromCache(e,t)}},{key:"apply",value:function(e){return this.assertNotApplied(),this.changesApplied=!0,this.applyChanges(e)}},{key:"assertNotApplied",value:function(){}}]),e}(),mp=T(function e(t,n){I(this,e),this.overlayedDocument=t,this.mutatedFields=n}),kp=function(){function e(t,n,r,i){I(this,e),this.remoteDocumentCache=t,this.mutationQueue=n,this.documentOverlayCache=r,this.indexManager=i}return T(e,[{key:"getDocument",value:function(e,t){var n=this,r=null;return this.documentOverlayCache.getOverlay(e,t).next(function(i){return r=i,n.remoteDocumentCache.getEntry(e,t)}).next(function(e){return null!==r&&td(r.mutation,e,sh.empty(),Nl.now()),e})}},{key:"getDocuments",value:function(e,t){var n=this;return this.remoteDocumentCache.getEntries(e,t).next(function(t){return n.getLocalViewOfDocuments(e,t,Rf()).next(function(){return t})})}},{key:"getLocalViewOfDocuments",value:function(e,t){var n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Rf(),i=xf();return this.populateOverlays(e,i,t).next(function(){return n.computeViews(e,t,i,r).next(function(e){var t=Sf();return e.forEach(function(e,n){t=t.insert(e,n.overlayedDocument)}),t})})}},{key:"getOverlayedDocuments",value:function(e,t){var n=this,r=xf();return this.populateOverlays(e,r,t).next(function(){return n.computeViews(e,t,r,Rf())})}},{key:"populateOverlays",value:function(e,t,n){var r=[];return n.forEach(function(e){t.has(e)||r.push(e)}),this.documentOverlayCache.getOverlays(e,r).next(function(e){e.forEach(function(e,n){t.set(e,n)})})}},{key:"computeViews",value:function(e,t,n,r){var i=Ef(),a=Cf(),s=Cf();return t.forEach(function(e,t){var s=n.get(t.key);r.has(t.key)&&(void 0===s||s.mutation instanceof ad)?i=i.insert(t.key,t):void 0!==s?(a.set(t.key,s.mutation.getFieldMask()),td(s.mutation,t,s.mutation.getFieldMask(),Nl.now())):a.set(t.key,sh.empty())}),this.recalculateAndSaveOverlays(e,i).next(function(e){return e.forEach(function(e,t){return a.set(e,t)}),t.forEach(function(e,t){var n;return s.set(e,new mp(t,null!==(n=a.get(e))&&void 0!==n?n:null))}),s})}},{key:"recalculateAndSaveOverlays",value:function(e,t){var n=this,r=Cf(),i=new th(function(e,t){return e-t}),a=Rf();return this.mutationQueue.getAllMutationBatchesAffectingDocumentKeys(e,t).next(function(e){var n,a=il(e);try{var s=function(){var e=n.value;e.keys().forEach(function(n){var a=t.get(n);if(null!==a){var s=r.get(n)||sh.empty();s=e.applyToLocalView(a,s),r.set(n,s);var o=(i.get(e.batchId)||Rf()).add(n);i=i.insert(e.batchId,o)}})};for(a.s();!(n=a.n()).done;)s()}catch(o){a.e(o)}finally{a.f()}}).next(function(){for(var s=[],o=i.getReverseIterator(),u=function(){var i=o.getNext(),u=i.key,c=i.value,l=Af();c.forEach(function(e){if(!a.has(e)){var n=Zf(t.get(e),r.get(e));null!==n&&l.set(e,n),a=a.add(e)}}),s.push(n.documentOverlayCache.saveOverlays(e,u,l))};o.hasNext();)u();return Gl.waitFor(s)}).next(function(){return r})}},{key:"recalculateAndSaveOverlaysForDocumentKeys",value:function(e,t){var n=this;return this.remoteDocumentCache.getEntries(e,t).next(function(t){return n.recalculateAndSaveOverlays(e,t)})}},{key:"getDocumentsMatchingQuery",value:function(e,t,n,r){return function(e){return jl.isDocumentKey(e.path)&&null===e.collectionGroup&&0===e.filters.length}(t)?this.getDocumentsMatchingDocumentQuery(e,t.path):function(e){return null!==e.collectionGroup}(t)?this.getDocumentsMatchingCollectionGroupQuery(e,t,n,r):this.getDocumentsMatchingCollectionQuery(e,t,n,r)}},{key:"getNextDocuments",value:function(e,t,n,r){var i=this;return this.remoteDocumentCache.getAllFromCollectionGroup(e,t,n,r).next(function(a){var s=r-a.size>0?i.documentOverlayCache.getOverlaysForCollectionGroup(e,t,n.largestBatchId,r-a.size):Gl.resolve(xf()),o=-1,u=a;return s.next(function(t){return Gl.forEach(t,function(t,n){return o<n.largestBatchId&&(o=n.largestBatchId),a.get(t)?Gl.resolve():i.remoteDocumentCache.getEntry(e,t).next(function(e){u=u.insert(t,e)})}).next(function(){return i.populateOverlays(e,t,a)}).next(function(){return i.computeViews(e,u,t,Rf())}).next(function(e){return{batchId:o,changes:Tf(e)}})})})}},{key:"getDocumentsMatchingDocumentQuery",value:function(e,t){return this.getDocument(e,new jl(t)).next(function(e){var t=Sf();
2return e.isFoundDocument()&&(t=t.insert(e.key,e)),t})}},{key:"getDocumentsMatchingCollectionGroupQuery",value:function(e,t,n,r){var i=this,a=t.collectionGroup,s=Sf();return this.indexManager.getCollectionParents(e,a).next(function(o){return Gl.forEach(o,function(o){var u=function(e,t){return new cf(t,null,e.explicitOrderBy.slice(),e.filters.slice(),e.limit,e.limitType,e.startAt,e.endAt)}(t,o.child(a));return i.getDocumentsMatchingCollectionQuery(e,u,n,r).next(function(e){e.forEach(function(e,t){s=s.insert(e,t)})})}).next(function(){return s})})}},{key:"getDocumentsMatchingCollectionQuery",value:function(e,t,n,r){var i,a=this;return this.documentOverlayCache.getOverlaysForCollection(e,t.path,n.largestBatchId).next(function(s){return i=s,a.remoteDocumentCache.getDocumentsMatchingQuery(e,t,n,i,r)}).next(function(e){i.forEach(function(t,n){var r=n.getKey();null===e.get(r)&&(e=e.insert(r,Lh.newInvalidDocument(r)))});var n=Sf();return e.forEach(function(e,r){var a=i.get(e);void 0!==a&&td(a.mutation,r,sh.empty(),Nl.now()),mf(t,r)&&(n=n.insert(e,r))}),n})}}]),e}(),wp=function(){function e(t){I(this,e),this.serializer=t,this.cr=new Map,this.lr=new Map}return T(e,[{key:"getBundleMetadata",value:function(e,t){return Gl.resolve(this.cr.get(t))}},{key:"saveBundleMetadata",value:function(e,t){return this.cr.set(t.id,function(e){return{id:e.id,version:e.version,createTime:Bd(e.createTime)}}(t)),Gl.resolve()}},{key:"getNamedQuery",value:function(e,t){return Gl.resolve(this.lr.get(t))}},{key:"saveNamedQuery",value:function(e,t){return this.lr.set(t.name,function(e){return{name:e.name,query:hp(e.bundledQuery),readTime:Bd(e.readTime)}}(t)),Gl.resolve()}}]),e}(),bp=function(){function e(){I(this,e),this.overlays=new th(jl.comparator),this.hr=new Map}return T(e,[{key:"getOverlay",value:function(e,t){return Gl.resolve(this.overlays.get(t))}},{key:"getOverlays",value:function(e,t){var n=this,r=xf();return Gl.forEach(t,function(t){return n.getOverlay(e,t).next(function(e){null!==e&&r.set(t,e)})}).next(function(){return r})}},{key:"saveOverlays",value:function(e,t,n){var r=this;return n.forEach(function(n,i){r.ht(e,t,i)}),Gl.resolve()}},{key:"removeOverlaysForBatchId",value:function(e,t,n){var r=this,i=this.hr.get(n);return void 0!==i&&(i.forEach(function(e){return r.overlays=r.overlays.remove(e)}),this.hr.delete(n)),Gl.resolve()}},{key:"getOverlaysForCollection",value:function(e,t,n){for(var r=xf(),i=t.length+1,a=new jl(t.child("")),s=this.overlays.getIteratorFrom(a);s.hasNext();){var o=s.getNext().value,u=o.getKey();if(!t.isPrefixOf(u.path))break;u.path.length===i&&o.largestBatchId>n&&r.set(o.getKey(),o)}return Gl.resolve(r)}},{key:"getOverlaysForCollectionGroup",value:function(e,t,n,r){for(var i=new th(function(e,t){return e-t}),a=this.overlays.getIterator();a.hasNext();){var s=a.getNext().value;if(s.getKey().getCollectionGroup()===t&&s.largestBatchId>n){var o=i.get(s.largestBatchId);null===o&&(o=xf(),i=i.insert(s.largestBatchId,o)),o.set(s.getKey(),s)}}for(var u=xf(),c=i.getIterator();c.hasNext()&&(c.getNext().value.forEach(function(e,t){return u.set(e,t)}),!(u.size()>=r)););return Gl.resolve(u)}},{key:"ht",value:function(e,t,n){var r=this.overlays.get(n.key);if(null!==r){var i=this.hr.get(r.largestBatchId).delete(n.key);this.hr.set(r.largestBatchId,i)}this.overlays=this.overlays.insert(n.key,new vd(t,n));var a=this.hr.get(t);void 0===a&&(a=Rf(),this.hr.set(t,a)),this.hr.set(t,a.add(n.key))}}]),e}(),_p=function(){function e(){I(this,e),this.Pr=new ih(Ep.Ir),this.Tr=new ih(E
2p.Er)}return T(e,[{key:"isEmpty",value:function(){return this.Pr.isEmpty()}},{key:"addReference",value:function(e,t){var n=new Ep(e,t);this.Pr=this.Pr.add(n),this.Tr=this.Tr.add(n)}},{key:"dr",value:function(e,t){var n=this;e.forEach(function(e){return n.addReference(e,t)})}},{key:"removeReference",value:function(e,t){this.Ar(new Ep(e,t))}},{key:"Rr",value:function(e,t){var n=this;e.forEach(function(e){return n.removeReference(e,t)})}},{key:"Vr",value:function(e){var t=this,n=new jl(new Ml([])),r=new Ep(n,e),i=new Ep(n,e+1),a=[];return this.Tr.forEachInRange([r,i],function(e){t.Ar(e),a.push(e.key)}),a}},{key:"mr",value:function(){var e=this;this.Pr.forEach(function(t){return e.Ar(t)})}},{key:"Ar",value:function(e){this.Pr=this.Pr.delete(e),this.Tr=this.Tr.delete(e)}},{key:"gr",value:function(e){var t=new jl(new Ml([])),n=new Ep(t,e),r=new Ep(t,e+1),i=Rf();return this.Tr.forEachInRange([n,r],function(e){i=i.add(e.key)}),i}},{key:"containsKey",value:function(e){var t=new Ep(e,0),n=this.Pr.firstAfterOrEqual(t);return null!==n&&e.isEqual(n.key)}}]),e}(),Ep=function(){function e(t,n){I(this,e),this.key=t,this.pr=n}return T(e,null,[{key:"Ir",value:function(e,t){return jl.comparator(e.key,t.key)||Ol(e.pr,t.pr)}},{key:"Er",value:function(e,t){return Ol(e.pr,t.pr)||jl.comparator(e.key,t.key)}}]),e}(),Ip=function(){function e(t,n){I(this,e),this.indexManager=t,this.referenceDelegate=n,this.mutationQueue=[],this.yr=1,this.wr=new ih(Ep.Ir)}return T(e,[{key:"checkEmpty",value:function(e){return Gl.resolve(0===this.mutationQueue.length)}},{key:"addMutationBatch",value:function(e,t,n,r){var i=this.yr;this.yr++,this.mutationQueue.length>0&&this.mutationQueue[this.mutationQueue.length-1];var a=new dd(i,t,n,r);this.mutationQueue.push(a);var s,o=il(r);try{for(o.s();!(s=o.n()).done;){var u=s.value;this.wr=this.wr.add(new Ep(u.key,i)),this.indexManager.addToCollectionParentIndex(e,u.key.path.popLast())}}catch(c){o.e(c)}finally{o.f()}return Gl.resolve(a)}},{key:"lookupMutationBatch",value:function(e,t){return Gl.resolve(this.Sr(t))}},{key:"getNextMutationBatchAfterBatchId",value:function(e,t){var n=t+1,r=this.br(n),i=r<0?0:r;return Gl.resolve(this.mutationQueue.length>i?this.mutationQueue[i]:null)}},{key:"getHighestUnacknowledgedBatchId",value:function(){return Gl.resolve(0===this.mutationQueue.length?-1:this.yr-1)}},{key:"getAllMutationBatches",value:function(e){return Gl.resolve(this.mutationQueue.slice())}},{key:"getAllMutationBatchesAffectingDocumentKey",value:function(e,t){var n=this,r=new Ep(t,0),i=new Ep(t,Number.POSITIVE_INFINITY),a=[];return this.wr.forEachInRange([r,i],function(e){var t=n.Sr(e.pr);a.push(t)}),Gl.resolve(a)}},{key:"getAllMutationBatchesAffectingDocumentKeys",value:function(e,t){var n=this,r=new ih(Ol);return t.forEach(function(e){var t=new Ep(e,0),i=new Ep(e,Number.POSITIVE_INFINITY);n.wr.forEachInRange([t,i],function(e){r=r.add(e.pr)})}),Gl.resolve(this.Dr(r))}},{key:"getAllMutationBatchesAffectingQuery",value:function(e,t){var n=t.path,r=n.length+1,i=n;jl.isDocumentKey(i)||(i=i.child(""));var a=new Ep(new jl(i),0),s=new ih(Ol);return this.wr.forEachWhile(function(e){var t=e.key.path;return!!n.isPrefixOf(t)&&(t.length===r&&(s=s.add(e.pr)),!0)},a),Gl.resolve(this.Dr(s))}},{key:"Dr",value:function(e){var t=this,n=[];return e.forEach(function(e){var r=t.Sr(e);null!==r&&n.push(r)}),n}},{key:"removeMutationBatch",value:function(e,t){var n=this;yl(0===this.Cr(t.batchId,"removed")),this.mutationQueue.shift();var r=this.wr;return Gl.forEach(t.mutations,function(i){var a=new Ep(i.key,t.batchId);return r=r.delete(a),n.referenceDelegate.markPotentiallyOrphaned(e,i.key)}).next(function(){n.wr=r})}},{key:"Mn",value:function(e){}},{key:"containsKey",value:function(e,t){var n=new Ep(t,0),r=this.wr.firstAfterOrEqual(n);return Gl.resolve(t.isEqual(r&&r.key))}},{key:"performConsistencyCheck",value:function(e){return this.mutationQueue.length,Gl.resolve()}},{key:"Cr",value:function(e,t){return this.br(e)}},{key:"br",value:function(e){return 0===this.mutationQueue.length?0:e-this.mutationQueue[0].batchId}},{key:"Sr",value:function(e){var t=this.br(e);return t<0||t>
2=this.mutationQueue.length?null:this.mutationQueue[t]}}]),e}(),Sp=function(){function e(t){I(this,e),this.vr=t,this.docs=new th(jl.comparator),this.size=0}return T(e,[{key:"setIndexManager",value:function(e){this.indexManager=e}},{key:"addEntry",value:function(e,t){var n=t.key,r=this.docs.get(n),i=r?r.size:0,a=this.vr(t);return this.docs=this.docs.insert(n,{document:t.mutableCopy(),size:a}),this.size+=a-i,this.indexManager.addToCollectionParentIndex(e,n.path.popLast())}},{key:"removeEntry",value:function(e){var t=this.docs.get(e);t&&(this.docs=this.docs.remove(e),this.size-=t.size)}},{key:"getEntry",value:function(e,t){var n=this.docs.get(t);return Gl.resolve(n?n.document.mutableCopy():Lh.newInvalidDocument(t))}},{key:"getEntries",value:function(e,t){var n=this,r=Ef();return t.forEach(function(e){var t=n.docs.get(e);r=r.insert(e,t?t.document.mutableCopy():Lh.newInvalidDocument(e))}),Gl.resolve(r)}},{key:"getDocumentsMatchingQuery",value:function(e,t,n,r){for(var i=Ef(),a=t.path,s=new jl(a.child("")),o=this.docs.getIteratorFrom(s);o.hasNext();){var u=o.getNext(),c=u.key,l=u.value.document;if(!a.isPrefixOf(c.path))break;c.path.length>a.length+1||ql(Vl(l),n)<=0||(r.has(l.key)||mf(t,l))&&(i=i.insert(l.key,l.mutableCopy()))}return Gl.resolve(i)}},{key:"getAllFromCollectionGroup",value:function(e,t,n,r){gl()}},{key:"Fr",value:function(e,t){return Gl.forEach(this.docs,function(e){return t(e)})}},{key:"newChangeBuffer",value:function(e){return new Tp(this)}},{key:"getSize",value:function(e){return Gl.resolve(this.size)}}]),e}(),Tp=function(e){y(n,e);var t=sl(n);function n(e){var r;return I(this,n),(r=t.call(this)).ar=e,r}return T(n,[{key:"applyChanges",value:function(e){var t=this,n=[];
2return this.changes.forEach(function(r,i){i.isValidDocument()?n.push(t.ar.addEntry(e,i)):t.ar.removeEntry(r)}),Gl.waitFor(n)}},{key:"getFromCache",value:function(e,t){return this.ar.getEntry(e,t)}},{key:"getAllFromCache",value:function(e,t){return this.ar.getEntries(e,t)}}]),n}(yp),xp=function(){function e(t){I(this,e),this.persistence=t,this.Mr=new bf(function(e){return sf(e)},of),this.lastRemoteSnapshotVersion=Dl.min(),this.highestTargetId=0,this.Or=0,this.Nr=new _p,this.targetCount=0,this.Lr=gp.Nn()}return T(e,[{key:"forEachTarget",value:function(e,t){return this.Mr.forEach(function(e,n){return t(n)}),Gl.resolve()}},{key:"getLastRemoteSnapshotVersion",value:function(e){return Gl.resolve(this.lastRemoteSnapshotVersion)}},{key:"getHighestSequenceNumber",value:function(e){return Gl.resolve(this.Or)}},{key:"allocateTargetId",value:function(e){return this.highestTargetId=this.Lr.next(),Gl.resolve(this.highestTargetId)}},{key:"setTargetsMetadata",value:function(e,t,n){return n&&(this.lastRemoteSnapshotVersion=n),t>this.Or&&(this.Or=t),Gl.resolve()}},{key:"qn",value:function(e){this.Mr.set(e.target,e);var t=e.targetId;t>this.highestTargetId&&(this.Lr=new gp(t),this.highestTargetId=t),e.sequenceNumber>this.Or&&(this.Or=e.sequenceNumber)}},{key:"addTargetData",value:function(e,t){return this.qn(t),this.targetCount+=1,Gl.resolve()}},{key:"updateTargetData",value:function(e,t){return this.qn(t),Gl.resolve()}},{key:"removeTargetData",value:function(e,t){return this.Mr.delete(t.target),this.Nr.Vr(t.targetId),this.targetCount-=1,Gl.resolve()}},{key:"removeTargets",value:function(e,t,n){var r=this,i=0,a=[];return this.Mr.forEach(function(s,o){o.sequenceNumber<=t&&null===n.get(o.targetId)&&(r.Mr.delete(s),a.push(r.removeMatchingKeysForTargetId(e,o.targetId)),i++)}),Gl.waitFor(a).next(function(){return i})}},{key:"getTargetCount",value:function(e){return Gl.resolve(this.targetCount)}},{key:"getTargetData",value:function(e,t){var n=this.Mr.get(t)||null;return Gl.resolve(n)}},{key:"addMatchingKeys",value:function(e,t,n){return this.Nr.dr(t,n),Gl.resolve()}},{key:"removeMatchingKeys",value:function(e,t,n){this.Nr.Rr(t,n);var r=this.persistence.referenceDelegate,i=[];return r&&t.forEach(function(t){i.push(r.markPotentiallyOrphaned(e,t))}),Gl.waitFor(i)}},{key:"removeMatchingKeysForTargetId",value:function(e,t){return this.Nr.Vr(t),Gl.resolve()}},{key:"getMatchingKeysForTargetId",value:function(e,t){var n=this.Nr.gr(t);return Gl.resolve(n)}},{key:"containsKey",value:function(e,t){return Gl.resolve(this.Nr.containsKey(t))}}]),e}(),Ap=function(){function e(t,n){var r=this;I(this,e),this.Br={},this.overlays={},this.kr=new Ql(0),this.qr=!1,this.qr=!0,this.referenceDelegate=t(this),this.Qr=new xp(this),this.indexManager=new dp,this.remoteDocumentCache=function(e){return new Sp(e)}(function(e){return r.referenceDelegate.Kr(e)}),this.serializer=new lp(n),this.$r=new wp(this.serializer)}return T(e,[{key:"start",value:function(){return Promise.resolve()}},{key:"shutdown",value:function(){return this.qr=!1,Promise.resolve()}},{key:"started",get:function(){return this.qr}},{key:"setDatabaseDeletedListener",value:function(){}},{key:"setNetworkEnabled",value:function(){}},{key:"getIndexManager",value:function(e){return this.indexManager}},{key:"getDocumentOverlayCache",value:function(e){var t=this.overlays[e.toKey()];return t||(t=new bp,this.overlays[e.toKey()]=t),t}},{key:"getMutationQueue",value:function(e,t){var n=this.Br[e.toKey()];return n||(n=new Ip(t,this.referenceDelegate),this.Br[e.toKey()]=n),n}},{key:"getTargetCache",value:function(){return this.Qr}},{key:"getRemoteDocumentCache",value:function(){return this.remoteDocumentCache}},{key:"getBundleCache",value:function(){return this.$r}},{key:"runTransaction",value:function(e,t,n){var r=this;fl("MemoryPersistence","Starting transaction:",e);var i=new Cp(this.kr.next());return this.referenceDelegate.Ur(),n(i).next(function(e){return r.referenceDelegate.Wr(i).next(function(){return e})}).toPromise().then(function(e){return i.raiseOnCommittedEvent(),e})}},{key:"Gr",value:function(e,t){return Gl.or(Object.values(this.Br).map(function(n){return function(){return n.containsKey(e,t)}}))}}]),e}(),Cp=function(e){y(n,e);var t=sl(n);function n(e){var r;return I(this,n),(r=t.call(this)).currentSequenceNumber=e,r}return T(n)}(zl),Pp=function(){function e(t){I(this,e),this.persistence=t,this.zr=new _p,this.jr=null}return T(e,[{key:"Jr",get:function(){if(this.jr)return this.jr;throw gl()}},{key:"addReference",value:function(e,t,n){return this.zr.addReference(n,t),this.Jr.delete(n.toString()),Gl.resolve()}},{key:"removeReference",value:function(e,t,n){return this.zr.removeReference(n,t),this.Jr.add(n.toString()),Gl.resolve()}},{key:"markPotentiallyOrphaned",value:function(e,t){return this.Jr.add(t.toString()),Gl.resolve()}},{key:"removeTarget",value:function(e,t){var n=this;
2this.zr.Vr(t.targetId).forEach(function(e){return n.Jr.add(e.toString())});var r=this.persistence.getTargetCache();return r.getMatchingKeysForTargetId(e,t.targetId).next(function(e){e.forEach(function(e){return n.Jr.add(e.toString())})}).next(function(){return r.removeTargetData(e,t)})}},{key:"Ur",value:function(){this.jr=new Set}},{key:"Wr",value:function(e){var t=this,n=this.persistence.getRemoteDocumentCache().newChangeBuffer();return Gl.forEach(this.Jr,function(r){var i=jl.fromPath(r);return t.Yr(e,i).next(function(e){e||n.removeEntry(i,Dl.min())})}).next(function(){return t.jr=null,n.apply(e)})}},{key:"updateLimboDocument",value:function(e,t){var n=this;return this.Yr(e,t).next(function(e){e?n.Jr.delete(t.toString()):n.Jr.add(t.toString())})}},{key:"Kr",value:function(e){return 0}},{key:"Yr",value:function(e,t){var n=this;return Gl.or([function(){return Gl.resolve(n.zr.containsKey(t))},function(){return n.persistence.getTargetCache().containsKey(e,t)},function(){return n.persistence.Gr(e,t)}])}}],[{key:"Hr",value:function(t){return new e(t)}}]),e}(),Op=function(){function e(t,n,r,i){I(this,e),this.targetId=t,this.fromCache=n,this.qi=r,this.Qi=i}return T(e,null,[{key:"Ki",value:function(t,n){var r,i=Rf(),a=Rf(),s=il(n.docChanges);try{for(s.s();!(r=s.n()).done;){var o=r.value;switch(o.type){case 0:i=i.add(o.doc.key);break;case 1:a=a.add(o.doc.key)}}}catch(u){s.e(u)}finally{s.f()}return new e(t,n.fromCache,i,a)}}]),e}(),Rp=function(){function e(){I(this,e),this._documentReadCount=0}return T(e,[{key:"documentReadCount",get:function(){return this._documentReadCount}},{key:"incrementDocumentReadCount",value:function(e){this._documentReadCount+=e}}]),e}(),Np=function(){function e(){var t,n,r;I(this,e),this.$i=!1,this.Ui=!1,this.Wi=100,this.Gi=Q()?8:(t=W(),n=t.match(/Android ([\d.]+)/i),r=n?n[1].split(".").slice(0,2).join("."):"-1",Number(r)>0?6:4)}return T(e,[{key:"initialize",value:function(e,t){this.zi=e,this.indexManager=t,this.$i=!0}},{key:"getDocumentsMatchingQuery",value:function(e,t,n,r){var i=this,a={result:null};return this.ji(e,t).next(function(e){a.result=e}).next(function(){if(!a.result)return i.Hi(e,t,r,n).next(function(e){a.result=e})}).next(function(){if(!a.result){var n=new Rp;return i.Ji(e,t,n).next(function(r){if(a.result=r,i.Ui)return i.Yi(e,t,n,r.size)})}}).next(function(){return a.result})}},{key:"Yi",value:function(e,t,n,r){return n.documentReadCount<this.Wi?(hl()<=ge.DEBUG&&fl("QueryEngine","SDK will not create cache indexes for query:",yf(t),"since it only creates cache indexes for collection contains","more than or equal to",this.Wi,"documents"),Gl.resolve()):(hl()<=ge.DEBUG&&fl("QueryEngine","Query:",yf(t),"scans",n.documentReadCount,"local documents and returns",r,"documents as results."),n.documentReadCount>this.Gi*r?(hl()<=ge.DEBUG&&fl("QueryEngine","The SDK decides to create cache indexes for query:",yf(t),"as using cache indexes may help improve performance."),this.indexManager.createTargetIndexes(e,df(t))):Gl.resolve())}},{key:"ji",value:function(e,t){var n=this;if(hf(t))return Gl.resolve(null);var r=df(t);return this.indexManager.getIndexType(e,r).next(function(i){return 0===i?null:(null!==t.limit&&1===i&&(t=pf(t,null,"F"),r=df(t)),n.indexManager.getDocumentsMatchingTarget(e,r).next(function(i){var a=Rf.apply(void 0,x(i));return n.zi.getDocuments(e,a).next(function(i){return n.indexManager.getMinOffset(e,r).next(function(r){var s=n.Zi(t,i);return n.Xi(t,s,a,r.readTime)?n.ji(e,pf(t,null,"F")):n.es(e,s,t,r)})})}))})}},{key:"Hi",value:function(e,t,n,r){var i=this;return hf(t)||r.isEqual(Dl.min())?Gl.resolve(null):this.zi.getDocuments(e,n).next(function(a){var s=i.Zi(t,a);return i.Xi(t,s,n,r)?Gl.resolve(null):(hl()<=ge.DEBUG&&fl("QueryEngine","Re-using previous result from %s to execute query: %s",r.toString(),yf(t)),i.es(e,s,t,function(e,t){var n=e.toTimestamp().seconds,r=e.toTimestamp().nanoseconds+1,i=Dl.fromTimestamp(1e9===r?new Nl(n+1,0):new Nl(n,r));return new Bl(i,jl.empty(),t)}(r,-1)).next(function(e){return e}))})}},{key:"Zi",value:function(e,t){var n=new ih(kf(e));return t.forEach(function(t,r){mf(e,r)&&(n=n.add(r))}),n}},{key:"Xi",value:function(e,t,n,r){if(null===e.limit)return!1;if(n.size!==t.size)return!0;var i="F"===e.limitType?t.last():t.first();return!!i&&(i.hasPendingWrites||i.version.compareTo(r)>0)}},{key:"Ji",value:function(e,t,n){return hl()<=ge.DEBUG&&fl("QueryEngine","Using full collection scan to execute query:",yf(t)),this.zi.getDocumentsMatchingQuery(e,t,Bl.min(),n)}},{key:"es",value:function(e,t,n,r){return this.zi.getDocumentsMatchingQuery(e,n,r).next(function(e){return t.forEach(function(t){e=e.insert(t.key,t)}),e})}}]),e}(),Dp=function(){function e(t,n,r,i){I(this,e),this.persistence=t,this.ts=n,this.serializer
2=i,this.ns=new th(Ol),this.rs=new bf(function(e){return sf(e)},of),this.ss=new Map,this.os=t.getRemoteDocumentCache(),this.Qr=t.getTargetCache(),this.$r=t.getBundleCache(),this._s(r)}return T(e,[{key:"_s",value:function(e){this.documentOverlayCache=this.persistence.getDocumentOverlayCache(e),this.indexManager=this.persistence.getIndexManager(e),this.mutationQueue=this.persistence.getMutationQueue(e,this.indexManager),this.localDocuments=new kp(this.os,this.mutationQueue,this.documentOverlayCache,this.indexManager),this.os.setIndexManager(this.indexManager),this.ts.initialize(this.localDocuments,this.indexManager)}},{key:"collectGarbage",value:function(e){var t=this;return this.persistence.runTransaction("Collect garbage","readwrite-primary",function(n){return e.collect(n,t.ns)})}}]),e}();function Lp(e,t){return Mp.apply(this,arguments)}function Mp(){return(Mp=E(O.mark(function e(t,n){var r;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=ml(t),e.next=3,r.persistence.runTransaction("Handle user change","readonly",function(e){var t;return r.mutationQueue.getAllMutationBatches(e).next(function(i){return t=i,r._s(n),r.mutationQueue.getAllMutationBatches(e)}).next(function(n){var i,a=[],s=[],o=Rf(),u=il(t);try{for(u.s();!(i=u.n()).done;){var c=i.value;a.push(c.batchId);var l,h=il(c.mutations);try{for(h.s();!(l=h.n()).done;){var f=l.value;o=o.add(f.key)}}catch(k){h.e(k)}finally{h.f()}}}catch(k){u.e(k)}finally{u.f()}var d,p=il(n);try{for(p.s();!(d=p.n()).done;){var v=d.value;s.push(v.batchId);var g,y=il(v.mutations);try{for(y.s();!(g=y.n()).done;){var m=g.value;o=o.add(m.key)}}catch(k){y.e(k)}finally{y.f()}}}catch(k){p.e(k)}finally{p.f()}return r.localDocuments.getDocuments(e,o).next(function(e){return{us:e,removedBatchIds:a,addedBatchIds:s}})})});case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}},e)}))).apply(this,arguments)}function Up(e,t){var n=ml(e);return n.persistence.runTransaction("Acknowledge batch","readwrite-primary",function(e){var r=t.batch.keys(),i=n.os.newChangeBuffer({trackRemovals:!0});return function(e,t,n,r){var i=n.batch,a=i.keys(),s=Gl.resolve();return a.forEach(function(e){s=s.next(function(){return r.getEntry(t,e)}).next(function(t){var a=n.docVersions.get(e);yl(null!==a),t.version.compareTo(a)<0&&(i.applyToRemoteDocument(t,n),t.isValidDocument()&&(t.setReadTime(n.commitVersion),r.addEntry(t)))})}),s.next(function(){return e.mutationQueue.removeMutationBatch(t,i)})}(n,e,t,i).next(function(){return i.apply(e)}
2).next(function(){return n.mutationQueue.performConsistencyCheck(e)}).next(function(){return n.documentOverlayCache.removeOverlaysForBatchId(e,r,t.batch.batchId)}).next(function(){return n.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(e,function(e){for(var t=Rf(),n=0;n<e.mutationResults.length;++n)e.mutationResults[n].transformResults.length>0&&(t=t.add(e.batch.mutations[n].key));return t}(t))}).next(function(){return n.localDocuments.getDocuments(e,r)})})}function Fp(e){var t=ml(e);return t.persistence.runTransaction("Get last remote snapshot version","readonly",function(e){return t.Qr.getLastRemoteSnapshotVersion(e)})}function jp(e,t){var n=ml(e),r=t.snapshotVersion,i=n.ns;return n.persistence.runTransaction("Apply remote event","readwrite-primary",function(e){var a=n.os.newChangeBuffer({trackRemovals:!0});i=n.ns;var s=[];t.targetChanges.forEach(function(a,o){var u=i.get(o);if(u){s.push(n.Qr.removeMatchingKeys(e,a.removedDocuments,o).next(function(){return n.Qr.addMatchingKeys(e,a.addedDocuments,o)}));var c=u.withSequenceNumber(e.currentSequenceNumber);null!==t.targetMismatches.get(o)?c=c.withResumeToken(uh.EMPTY_BYTE_STRING,Dl.min()).withLastLimboFreeSnapshotVersion(Dl.min()):a.resumeToken.approximateByteSize()>0&&(c=c.withResumeToken(a.resumeToken,r)),i=i.insert(o,c),function(e,t,n){return 0===e.resumeToken.approximateByteSize()||(t.snapshotVersion.toMicroseconds()-e.snapshotVersion.toMicroseconds()>=3e8||n.addedDocuments.size+n.modifiedDocuments.size+n.removedDocuments.size>0)}(u,c,a)&&s.push(n.Qr.updateTargetData(e,c))}});var o=Ef(),u=Rf();if(t.documentUpdates.forEach(function(r){t.resolvedLimboDocuments.has(r)&&s.push(n.persistence.referenceDelegate.updateLimboDocument(e,r))}),s.push(function(e,t,n){var r=Rf(),i=Rf();return n.forEach(function(e){return r=r.add(e)}),t.getEntries(e,r).next(function(e){var r=Ef();return n.forEach(function(n,a){var s=e.get(n);a.isFoundDocument()!==s.isFoundDocument()&&(i=i.add(n)),a.isNoDocument()&&a.version.isEqual(Dl.min())?(t.removeEntry(n,a.readTime),r=r.insert(n,a)):!s.isValidDocument()||a.version.compareTo(s.version)>0||0===a.version.compareTo(s.version)&&s.hasPendingWrites?(t.addEntry(a),r=r.insert(n,a)):fl("LocalStore","Ignoring outdated watch update for ",n,". Current version:",s.version," Watch version:",a.version)}),{cs:r,ls:i}})}(e,a,t.documentUpdates).next(function(e){o=e.cs,u=e.ls})),!r.isEqual(Dl.min())){var c=n.Qr.getLastRemoteSnapshotVersion(e).next(function(t){return n.Qr.setTargetsMetadata(e,e.currentSequenceNumber,r)});s.push(c)}return Gl.waitFor(s).next(function(){return a.apply(e)}).next(function(){return n.localDocuments.getLocalViewOfDocuments(e,o,u)}).next(function(){return o})}).then(function(e){return n.ns=i,e})}function Vp(e,t){var n=ml(e);return n.persistence.runTransaction("Get next mutation batch","readonly",function(e){return void 0===t&&(t=-1),n.mutationQueue.getNextMutationBatchAfterBatchId(e,t)})}function Bp(e,t){var n=ml(e);return n.persistence.runTransaction("Allocate target","readwrite",function(e){var r;return n.Qr.getTargetData(e,t).next(function(i){return i?(r=i,Gl.resolve(r)):n.Qr.allocateTargetId(e).next(function(i){return r=new cp(t,i,"TargetPurposeListen",e.currentSequenceNumber),n.Qr.addTargetData(e,r).next(function(){return r})})})}).then(function(e){var r=n.ns.get(e.targetId);return(null===r||e.snapshotVersion.compareTo(r.snapshotVersion)>0)&&(n.ns=n.ns.insert(e.targetId,e),n.rs.set(t,e.targetId)),e})}function qp(e,t,n){return zp.apply(this,arguments)}function zp(){return(zp=E(O.mark(function e(t,n,r){var i,a,s;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(i=ml(t),a=i.ns.get(n),s=r?"readwrite":"readwrite-primary",e.prev=1,e.t0=r,e.t0){e.next=6;break}return e.next=6,i.persistence.runTransaction("Release target",s,function(e){return i.persistence.referenceDelegate.removeTarget(e,a)});case 6:e.next=13;break;case 8:if(e.prev=8,e.t1=e.catch(1),Wl(e.t1)){e.next=12;break}throw e.t1;case 12:fl("LocalStore","Failed to update sequence numbers for target ".concat(n,": ").concat(e.t1));case 13:i.ns=i.ns.remove(n),i.rs.delete(a.target);case 14:case"end":return e.stop()}},e,null,[[1,8]])}))).apply(this,arguments)}function Hp(e,t,n){var r=ml(e),i=Dl.min(),a=Rf();
2return r.persistence.runTransaction("Execute query","readwrite",function(e){return function(e,t,n){var r=ml(e),i=r.rs.get(n);return void 0!==i?Gl.resolve(r.ns.get(i)):r.Qr.getTargetData(t,n)}(r,e,df(t)).next(function(t){if(t)return i=t.lastLimboFreeSnapshotVersion,r.Qr.getMatchingKeysForTargetId(e,t.targetId).next(function(e){a=e})}).next(function(){return r.ts.getDocumentsMatchingQuery(e,t,n?i:Dl.min(),n?a:Rf())}).next(function(e){return function(e,t,n){var r=e.ss.get(t)||Dl.min();n.forEach(function(e,t){t.readTime.compareTo(r)>0&&(r=t.readTime)}),e.ss.set(t,r)}(r,function(e){return e.collectionGroup||(e.path.length%2==1?e.path.lastSegment():e.path.get(e.path.length-2))}(t),e),{documents:e,hs:a}})})}var Kp=function(){function e(){I(this,e),this.activeTargetIds=Nf}return T(e,[{key:"As",value:function(e){this.activeTargetIds=this.activeTargetIds.add(e)}},{key:"Rs",value:function(e){this.activeTargetIds=this.activeTargetIds.delete(e)}},{key:"ds",value:function(){var e={activeTargetIds:this.activeTargetIds.toArray(),updateTimeMs:Date.now()};return JSON.stringify(e)}}]),e}(),Gp=function(){function e(){I(this,e),this.no=new Kp,this.ro={},this.onlineStateHandler=null,this.sequenceNumberHandler=null}return T(e,[{key:"addPendingMutation",value:function(e){}},{key:"updateMutationState",value:function(e,t,n){}},{key:"addLocalQueryTarget",value:function(e){return this.no.As(e),this.ro[e]||"not-current"}},{key:"updateQueryState",value:function(e,t,n){this.ro[e]=t}},{key:"removeLocalQueryTarget",value:function(e){this.no.Rs(e)}},{key:"isLocalQueryTarget",value:function(e){return this.no.activeTargetIds.has(e)}},{key:"clearQueryState",value:function(e){delete this.ro[e]}},{key:"getAllActiveQueryTargets",value:function(){return this.no.activeTargetIds}},{key:"isActiveQueryTarget",value:function(e){return this.no.activeTargetIds.has(e)}},{key:"start",value:function(){return this.no=new Kp,Promise.resolve()}},{key:"handleUserChange",value:function(e,t,n){}},{key:"setOnlineState",value:function(e){}},{key:"shutdown",value:function(){}},{key:"writeSequenceNumber",value:function(e){}},{key:"notifyBundleLoaded",value:function(e){}}]),e}(),Wp=function(){function e(){I(this,e)}return T(e,[{key:"io",value:function(e){}},{key:"shutdown",value:function(){}}]),e}(),Qp=function(){function e(){var t=this;I(this,e),this.so=function(){return t.oo()},this._o=function(){return t.ao()},this.uo=[],this.co()}return T(e,[{key:"io",value:function(e){this.uo.push(e)}},{key:"shutdown",value:function(){window.removeEventListener("online",this.so),window.removeEventListener("offline",this._o)}},{key:"co",value:function(){window.addEventListener("online",this.so),window.addEventListener("offline",this._o)}},{key:"oo",value:function(){fl("ConnectivityMonitor","Network connectivity changed: AVAILABLE");var e,t=il(this.uo);try{for(t.s();!(e=t.n()).done;){(0,e.value)(0)}}catch(n){t.e(n)}finally{t.f()}}},{key:"ao",value:function(){fl("ConnectivityMonitor","Network connectivity changed: UNAVAILABLE");var e,t=il(this.uo);try{for(t.s();!(e=t.n()).done;){(0,e.value)(1)}}catch(n){t.e(n)}finally{t.f()}}}],[{key:"D",value:function(){return"undefined"!=typeof window&&void 0!==window.addEventListener&&void 0!==window.removeEventListener}}]),e}(),Yp=null;function Xp(){return null===Yp?Yp=268435456+Math.round(2147483648*Math.random()):Yp++,"0x"+Yp.toString(16)}var Jp={BatchGetDocuments:"batchGet",Commit:"commit",RunQuery:"runQuery",RunAggregationQuery:"runAggregationQuery"},$p=function(){function e(t){I(this,e),this.lo=t.lo,this.ho=t.ho}return T(e,[{key:"Po",value:function(e){this.Io=e}},{key:"To",value:function(e){this.Eo=e}},{key:"Ao",value:function(e){this.Ro=e}},{key:"onMessage",value:function(e){this.Vo=e}},{key:"close",value:function(){this.ho()}},{key:"send",value:function(e){this.lo(e)}},{key:"mo",value:function(){this.Io()}},{key:"fo",value:function(){this.Eo()}},{key:"po",value:function(e){this.Ro(e)}},{key:"yo",value:function(e){this.Vo(e)}}]),e}(),Zp="WebChannelConnection",ev=function(e){y(n,e);var t=sl(n);function n(e){var r;return I(this,n),(r=t.call(this,e)).forceLongPolling=e.forceLongPolling,r.autoDetectLongPolling=e.autoDetectLongPolling,r.useFetchStreams=e.useFetchStreams,r.longPollingOptions=e.longPollingOptions,r}return T(n,[{key:"Mo",value:function(e,t,n,r){var i=Xp();return new Promise(function(a,s){var o=new Qc;o.setWithCredentials(!0),o.listenOnce(Jc.COMPLETE,function(){try{
2switch(o.getLastErrorCode()){case $c.NO_ERROR:var t=o.getResponseJson();fl(Zp,"XHR for RPC '".concat(e,"' ").concat(i," received:"),JSON.stringify(t)),a(t);break;case $c.TIMEOUT:fl(Zp,"RPC '".concat(e,"' ").concat(i," timed out")),s(new wl(kl.DEADLINE_EXCEEDED,"Request time out"));break;case $c.HTTP_ERROR:var n=o.getStatus();if(fl(Zp,"RPC '".concat(e,"' ").concat(i," failed with status:"),n,"response text:",o.getResponseText()),n>0){var r=o.getResponseJson();Array.isArray(r)&&(r=r[0]);var u=null==r?void 0:r.error;if(u&&u.status&&u.message){var c=function(e){var t=e.toLowerCase().replace(/_/g,"-");return Object.values(kl).indexOf(t)>=0?t:kl.UNKNOWN}(u.status);s(new wl(c,u.message))}else s(new wl(kl.UNKNOWN,"Server responded with status "+o.getStatus()))}else s(new wl(kl.UNAVAILABLE,"Connection failed."));break;default:gl()}}finally{fl(Zp,"RPC '".concat(e,"' ").concat(i," completed."))}});var u=JSON.stringify(r);fl(Zp,"RPC '".concat(e,"' ").concat(i," sending request:"),r),o.send(t,"POST",u,n,15)})}},{key:"Oo",value:function(e,t,n){var r=Xp(),i=[this.wo,"/","google.firestore.v1.Firestore","/",e,"/channel"],a=nl(),s=tl(),o={httpSessionIdParam:"gsessionid",initMessageHeaders:{},messageUrlParams:{database:"projects/".concat(this.databaseId.projectId,"/databases/").concat(this.databaseId.database)},sendRawJson:!0,supportsCrossDomainXhr:!0,internalChannelParams:{forwardChannelRequestTimeoutMs:6e5},forceLongPolling:this.forceLongPolling,detectBufferingProxy:this.autoDetectLongPolling},u=this.longPollingOptions.timeoutSeconds;void 0!==u&&(o.longPollingTimeout=Math.round(1e3*u)),this.useFetchStreams&&(o.xmlHttpFactory=new Yc({})),this.Fo(o.initMessageHeaders,t,n),o.encodeInitMessageHeaders=!0;var c=i.join("");fl(Zp,"Creating RPC '".concat(e,"' stream ").concat(r,": ").concat(c),o);var l=a.createWebChannel(c,o),h=!1,f=!1,d=new $p({lo:function(t){f?fl(Zp,"Not sending because RPC '".concat(e,"' stream ").concat(r," is closed:"),t):(h||(fl(Zp,"Opening RPC '".concat(e,"' stream ").concat(r," transport.")),l.open(),h=!0),fl(Zp,"RPC '".concat(e,"' stream ").concat(r," sending:"),t),l.send(t))},ho:function(){return l.close()}}),p=function(e,t,n){e.listen(t,function(e){try{n(e)}catch(e){setTimeout(function(){throw e},0)}})};return p(l,Xc.EventType.OPEN,function(){f||(fl(Zp,"RPC '".concat(e,"' stream ").concat(r," transport opened.")),d.mo())}),p(l,Xc.EventType.CLOSE,function(){f||(f=!0,fl(Zp,"RPC '".concat(e,"' stream ").concat(r," transport closed")),d.po())}),p(l,Xc.EventType.ERROR,function(t){f||(f=!0,pl(Zp,"RPC '".concat(e,"' stream ").concat(r," transport errored:"),t),d.po(new wl(kl.UNAVAILABLE,"The operation could not be completed")))}),p(l,Xc.EventType.MESSAGE,function(t){var n;if(!f){var i=t.data[0];yl(!!i);var a=i,s=a.error||(null===(n=a[0])||void 0===n?void 0:n.error);if(s){fl(Zp,"RPC '".concat(e,"' stream ").concat(r," received error:"),s);var o=s.status,u=function(e){var t=cd[e];if(void 0!==t)return md(t)}(o),c=s.message;void 0===u&&(u=kl.INTERNAL,c="Unknown error status: "+o+" with message "+s.message),f=!0,d.po(new wl(u,c)),l.close()}else fl(Zp,"RPC '".concat(e,"' stream ").concat(r," received:"),i),d.yo(i)}}),p(s,el.STAT_EVENT,function(t){t.stat===Zc.PROXY?fl(Zp,"RPC '".concat(e,"' stream ").concat(r," detected buffering proxy")):t.stat===Zc.NOPROXY&&fl(Zp,"RPC '".concat(e,"' stream ").concat(r," detected no buffering proxy"))}),setTimeout(function(){d.fo()},0),d}}]),n}(function(){function e(t){I(this,e),this.databaseInfo=t,this.databaseId=t.databaseId;var n=t.ssl?"https":"http",r=encodeURIComponent(this.databaseId.projectId),i=encodeURIComponent(this.databaseId.database);this.wo=n+"://"+t.host,this.So="projects/".concat(r,"/databases/").concat(i),this.bo="(default)"===this.databaseId.database?"project_id=".concat(r):"project_id=".concat(r,"&database_id=").concat(i)}return T(e,[{key:"Do",get:function(){return!1}},{key:"Co",value:function(e,t,n,r,i){var a=Xp(),s=this.vo(e,t.toUriEncodedString());fl("RestConnection","Sending RPC '".concat(e,"' ").concat(a,":"),s,n);var o={"google-cloud-resource-prefix":this.So,"x-goog-request-params":this.bo};return this.Fo(o,r,i),this.Mo(e,s,o,n).then(function(t){return fl("RestConnection","Received RPC '".concat(e,"' ").concat(a,": "),t),t},function(t){throw pl("RestConnection","RPC '".concat(e,"' ").concat(a," failed with error: "),t,"url: ",s,"request:",n),t})}},{key:"xo",value:function(e,t,n,r,i,a){return this.Co(e,t,n,r,i)}},{key:"Fo",value:function(e,t,n){e["X-Goog-Api-Client"]="gl-js/ fire/"+cl,e["Content-Type"]="text/plain",this.databaseInfo.appId&&(e["X-Firebase-GMPID"]=this.databaseInfo.appId),t&&t.headers.forEac
2h(function(t,n){return e[n]=t}),n&&n.headers.forEach(function(t,n){return e[n]=t})}},{key:"vo",value:function(e,t){var n=Jp[e];return"".concat(this.wo,"/v1/").concat(t,":").concat(n)}},{key:"terminate",value:function(){}}]),e}());function tv(){return"undefined"!=typeof document?document:null}function nv(e){return new Md(e,!0)}var rv=function(){function e(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e3,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1.5,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:6e4;I(this,e),this.oi=t,this.timerId=n,this.No=r,this.Lo=i,this.Bo=a,this.ko=0,this.qo=null,this.Qo=Date.now(),this.reset()}return T(e,[{key:"reset",value:function(){this.ko=0}},{key:"Ko",value:function(){this.ko=this.Bo}},{key:"$o",value:function(e){var t=this;this.cancel();var n=Math.floor(this.ko+this.Uo()),r=Math.max(0,Date.now()-this.Qo),i=Math.max(0,n-r);i>0&&fl("ExponentialBackoff","Backing off for ".concat(i," ms (base delay: ").concat(this.ko," ms, delay with jitter: ").concat(n," ms, last attempt: ").concat(r," ms ago)")),this.qo=this.oi.enqueueAfterDelay(this.timerId,i,function(){return t.Qo=Date.now(),e()}),this.ko*=this.Lo,this.ko<this.No&&(this.ko=this.No),this.ko>this.Bo&&(this.ko=this.Bo)}},{key:"Wo",value:function(){null!==this.qo&&(this.qo.skipDelay(),this.qo=null)}},{key:"cancel",value:function(){null!==this.qo&&(this.qo.cancel(),this.qo=null)}},{key:"Uo",value:function(){return(Math.random()-.5)*this.ko}}]),e}(),iv=function(){function e(t,n,r,i,a,s,o,u){I(this,e),this.oi=t,this.Go=r,this.zo=i,this.connection=a,this.authCredentialsProvider=s,this.appCheckCredentialsProvider=o,this.listener=u,this.state=0,this.jo=0,this.Ho=null,this.Jo=null,this.stream=null,this.Yo=new rv(t,n)}var t,n,r;return T(e,[{key:"Zo",value:function(){return 1===this.state||5===this.state||this.Xo()}},{key:"Xo",value:function(){return 2===this.state||3===this.state}},{key:"start",value:function(){4!==this.state?this.auth():this.e_()}},{key:"stop",value:(r=E(O.mark(function e(){return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(e.t0=this.Zo(),!e.t0){e.next=4;break}return e.next=4,this.close(0);case 4:case"end":return e.stop()}},e,this)})),function(){return r.apply(this,arguments)})},{key:"t_",value:function(){this.state=0,this.Yo.reset()}},{key:"n_",value:function(){var e=this;this.Xo()&&null===this.Ho&&(this.Ho=this.oi.enqueueAfterDelay(this.Go,6e4,function(){return e.r_()}))}},{key:"i_",value:function(e){this.s_(),this.stream.send(e)}},{key:"r_",value:(n=E(O.mark(function e(){return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.Xo()){e.next=2;break}return e.abrupt("return",this.close(0));case 2:case"end":return e.stop()}},e,this)})),function(){return n.apply(this,arguments)})},{key:"s_",value:function(){this.Ho&&(this.Ho.cancel(),this.Ho=null)}},{key:"o_",value:function(){this.Jo&&(this.Jo.cancel(),this.Jo=null)}},{key:"close",value:(t=E(O.mark(function e(t,n){return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return this.s_(),this.o_(),this.Yo.cancel(),this.jo++,4!==t?this.Yo.reset():n&&n.code===kl.RESOURCE_EXHAUSTED?(dl(n.toString()),dl("Using maximum backoff delay to prevent overloading the backend."),this.Yo.Ko()):n&&n.code===kl.UNAUTHENTICATED&&3!==this.state&&(this.authCredentialsProvider.invalidateToken(),this.appCheckCredentialsProvider.invalidateToken()),null!==this.stream&&(this.__(),this.stream.close(),this.stream=null),this.state=t,e.next=9,this.listener.Ao(n);case 9:case"end":return e.stop()}},e,this)})),function(e,n){return t.apply(this,arguments)})},{key:"__",value:function(){}},{key:"auth",value:function(){var e=this;this.state=1;var t=this.a_(this.jo),n=this.jo;Promise.all([this.authCredentialsProvider.getToken(),this.appCheckCredentialsProvider.getToken()]).then(function(t){var r=b(t,2),i=r[0],a=r[1];e.jo===n&&e.u_(i,a)},function(n){t(function(){var t=new wl(kl.UNKNOWN,"Fetching auth token failed: "+n.message);return e.c_(t)})})}},{key:"u_",value:function(e,t){var n=this,r=this.a_(this.jo);this.stream=this.l_(e,t),this.stream.Po(function(){r(function(){return n.listener.Po()})}),this.stream.To(function(){r(function(){return n.state=2,n.Jo=n.oi.enqueueAfterDelay(n.zo,1e4,function(){return n.Xo()&&(n.state=3),Promise.resolve()}),n.listener.To()})}),this.stream.Ao(function(e){r(function(){return n.c_(e)})}),this.stream.onMessage(function(e){r(function(){return n.onMessage(e)})})}},{key:"e_",value:function(){var e=this;this.state=5,this.Yo.$o(E(O.mark(function t(){return O.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:e.state=0,e.start();case 1:case"end":return t.stop()}},t)})))}},{key:"c_",value:function(e){return fl("PersistentStream","close with error: ".concat(e)),this.stream=null,this.close(4,e)}},{key:"a_",value:function(e){var t=this;return function(n){t.oi.enqueueAndForget(function(){return t.jo===e?n():(fl("PersistentStream","stream callback skipped by getCloseGuardedDispatcher."),Promise.resolve())})}}}]),e}(),av=function(e){y(n,e);var t=sl(n);function n(e,r,i,a,s,o){var u;return I(this,n),(u=t.call(this,e,"listen_stream_connection_backoff","listen_stream_idle","health_check_timeout",r,i,a,o)).serializer
2=s,u}return T(n,[{key:"l_",value:function(e,t){return this.connection.Oo("Listen",e,t)}},{key:"onMessage",value:function(e){this.Yo.reset();var t=function(e,t){var n;if("targetChange"in t){t.targetChange;var r=function(e){return"NO_CHANGE"===e?0:"ADD"===e?1:"REMOVE"===e?2:"CURRENT"===e?3:"RESET"===e?4:gl()}(t.targetChange.targetChangeType||"NO_CHANGE"),i=t.targetChange.targetIds||[],a=function(e,t){return e.useProto3Json?(yl(void 0===t||"string"==typeof t),uh.fromBase64String(t||"")):(yl(void 0===t||t instanceof Buffer||t instanceof Uint8Array),uh.fromUint8Array(t||new Uint8Array))}(e,t.targetChange.resumeToken),s=t.targetChange.cause,o=s&&function(e){var t=void 0===e.code?kl.UNKNOWN:md(e.code);return new wl(t,e.message||"")}(s);n=new Ad(r,i,a,o||null)}else if("documentChange"in t){t.documentChange;var u=t.documentChange;u.document,u.document.name,u.document.updateTime;var c=Gd(e,u.document.name),l=Bd(u.document.updateTime),h=u.document.createTime?Bd(u.document.createTime):Dl.min(),f=new Nh({mapValue:{fields:u.document.fields}}),d=Lh.newFoundDocument(c,l,h,f),p=u.targetIds||[],v=u.removedTargetIds||[];n=new Td(p,v,d.key,d)}else if("documentDelete"in t){t.documentDelete;var g=t.documentDelete;g.document;var y=Gd(e,g.document),m=g.readTime?Bd(g.readTime):Dl.min(),k=Lh.newNoDocument(y,m),w=g.removedTargetIds||[];n=new Td([],w,k.key,k)}else if("documentRemove"in t){t.documentRemove;var b=t.documentRemove;b.document;var _=Gd(e,b.document),E=b.removedTargetIds||[];n=new Td([],E,_,null)}else{if(!("filter"in t))return gl();t.filter;var I=t.filter;I.targetId;var S=I.count,T=void 0===S?0:S,x=I.unchangedNames,A=new gd(T,x),C=I.targetId;n=new xd(C,A)}return n}(this.serializer,e),n=function(e){if(!("targetChange"in e))return Dl.min();var t=e.targetChange;return t.targetIds&&t.targetIds.length?Dl.min():t.readTime?Bd(t.readTime):Dl.min()}(e);return this.listener.h_(t,n)}},{key:"P_",value:function(e){var t={};t.database=Qd(this.serializer),t.addTarget=function(e,t){var n,r=t.target;if((n=uf(r)?{documents:Jd(e,r)}:{query:$d(e,r)._t}).targetId=t.targetId,t.resumeToken.approximateByteSize()>0){n.resumeToken=jd(e,t.resumeToken);var i=Ud(e,t.expectedCount);null!==i&&(n.expectedCount=i)}else if(t.snapshotVersion.compareTo(Dl.min())>0){n.readTime=Fd(e,t.snapshotVersion.toTimestamp());var a=Ud(e,t.expectedCount);null!==a&&(n.expectedCount=a)}return n}(this.serializer,e);var n=function(e,t){var n=function(e){switch(e){case"TargetPurposeListen":return null;case"TargetPurposeExistenceFilterMismatch":return"existence-filter-mismatch";case"TargetPurposeExistenceFilterMismatchBloom":return"existence-filter-mismatch-bloom";case"TargetPurposeLimboResolution":return"limbo-document";default:return gl()}}(t.purpose);return null==n?null:{"goog-listen-tags":n}}(this.serializer,e);n&&(t.labels=n),this.i_(t)}},{key:"I_",value:function(e){var t={};t.database=Qd(this.serializer),t.removeTarget=e,this.i_(t)}}]),n}(iv),sv=function(e){y(n,e);var t=sl(n);function n(e,r,i,a,s,o){var u;return I(this,n),(u=t.call(this,e,"write_stream_connection_backoff","write_stream_idle","health_check_timeout",r,i,a,o)).serializer=s,u.T_=!1,u}return T(n,[{key:"E_",get:function(){return this.T_}},{key:"start",value:function(){this.T_=!1,this.lastStreamToken=void 0,p(d(n.prototype),"start",this).call(this)}},{key:"__",value:function(){this.T_&&this.d_([])}},{key:"l_",value:function(e,t){return this.connection.Oo("Write",e,t)}},{key:"onMessage",value:function(e){if(yl(!!e.streamToken),this.lastStreamToken=e.streamToken,this.T_){this.Yo.reset();var t=function(e,t){return e&&e.length>0?(yl(void 0!==t),e.map(function(e){return function(e,t){var n=e.updateTime?Bd(e.updateTime):Bd(t);return n.isEqual(Dl.min())&&(n=Bd(t)),new Yf(n,e.transformResults||[])}(e,t)})):[]}(e.writeResults,e.commitTime),n=Bd(e.commitTime);return this.listener.A_(n,t)}return yl(!e.writeResults||0===e.writeResults.length),this.T_=!0,this.listener.R_()}},{key:"V_",value:function(){var e={};e.database=Qd(this.serializer),this.i_(e)}},{key:"d_",value:function(e){var t=this,n={streamToken:this.lastStreamToken,writes:e.map(function(e){return function(e,t){var n;if(t instanceof id)n={update:Xd(e,t.key,t.value)};else if(t instanceof hd)n={delete:Kd(e,t.key)};else if(t instanceof ad)n={update:Xd(e,t.key,t.data),updateMask:op(t.fieldMask)};else{if(!(t instanceof fd))return gl();n={verify:Kd(e,t.key)}}return t.fieldTransforms.length>0&&(n.updateTransforms=t.fieldTransforms.map(function(e){return function(e,t){var n=t.transform;if(n instanceof Bf)return{fieldPath:t.field.canonicalString(),setToServerValue:"REQUEST_TIME"};if(n instanceof qf)return{fieldPath:t.field.canonicalString(),appendMissingElements:{values:n.elements}};if(n instanceof Hf)return{fieldPath:t.field.canonicalString(),removeAllFromArray:{values:n.elements}};if(n instanceof Gf)return{fieldPath:t.field.canonicalString(),increment:n.Pe};throw gl()}(0,e)})),t.precondition.isNone||(n.currentDocument=function(e,t){return void 0!==t.updateTime?{updateTime:Vd(e,t.updateTime)}:void 0!==t.exists?{exists:t.exists}:gl()}(e,t.precondition)),n}(t.serializer,e)})};this.i_(n)}}]),n}(iv),ov=function(e){y(n,e);var t=sl(n);function n(e,r,i,a){var s;return I(this,n),(s=t.call(this)).authCredentials=e,s.appCheckCredentials=r,s.connection=i,s.serializer
2=a,s.m_=!1,s}return T(n,[{key:"f_",value:function(){if(this.m_)throw new wl(kl.FAILED_PRECONDITION,"The client has already been terminated.")}},{key:"Co",value:function(e,t,n,r){var i=this;return this.f_(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then(function(a){var s=b(a,2),o=s[0],u=s[1];return i.connection.Co(e,zd(t,n),r,o,u)}).catch(function(e){throw"FirebaseError"===e.name?(e.code===kl.UNAUTHENTICATED&&(i.authCredentials.invalidateToken(),i.appCheckCredentials.invalidateToken()),e):new wl(kl.UNKNOWN,e.toString())})}},{key:"xo",value:function(e,t,n,r,i){var a=this;return this.f_(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then(function(s){var o=b(s,2),u=o[0],c=o[1];return a.connection.xo(e,zd(t,n),r,u,c,i)}).catch(function(e){throw"FirebaseError"===e.name?(e.code===kl.UNAUTHENTICATED&&(a.authCredentials.invalidateToken(),a.appCheckCredentials.invalidateToken()),e):new wl(kl.UNKNOWN,e.toString())})}},{key:"terminate",value:function(){this.m_=!0,this.connection.terminate()}}]),n}(T(function e(){I(this,e)})),uv=function(){function e(t,n){I(this,e),this.asyncQueue=t,this.onlineStateHandler=n,this.state="Unknown",this.g_=0,this.p_=null,this.y_=!0}return T(e,[{key:"w_",value:function(){var e=this;0===this.g_&&(this.S_("Unknown"),this.p_=this.asyncQueue.enqueueAfterDelay("online_state_timeout",1e4,function(){return e.p_=null,e.b_("Backend didn't respond within 10 seconds."),e.S_("Offline"),Promise.resolve()}))}},{key:"D_",value:function(e){"Online"===this.state?this.S_("Unknown"):(this.g_++,this.g_>=1&&(this.C_(),this.b_("Connection failed 1 times. Most recent error: ".concat(e.toString())),this.S_("Offline")))}},{key:"set",value:function(e){this.C_(),this.g_=0,"Online"===e&&(this.y_=!1),this.S_(e)}},{key:"S_",value:function(e){e!==this.state&&(this.state=e,this.onlineStateHandler(e))}},{key:"b_",value:function(e){var t="Could not reach Cloud Firestore backend. ".concat(e,"\nThis typically indicates that your device does not have a healthy Internet connection at the moment. The client will operate in offline mode until it is able to successfully connect to the backend.");this.y_?(dl(t),this.y_=!1):fl("OnlineStateTracker",t)}},{key:"C_",value:function(){null!==this.p_&&(this.p_.cancel(),this.p_=null)}}]),e}(),cv=T(function e(t,n,r,i,a){var s=this;I(this,e),this.localStore=t,this.datastore=n,this.asyncQueue=r,this.remoteSyncer={},this.v_=[],this.F_=new Map,this.M_=new Set,this.x_=[],this.O_=a,this.O_.io(function(e){r.enqueueAndForget(E(O.mark(function e(){return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(e.t0=wv(s),!e.t0){e.next=5;break}return fl("RemoteStore","Restarting streams for network reachability change."),e.next=5,function(){var e=E(O.mark(function e(t){var n;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return(n=ml(t)).M_.add(4),e.next=4,fv(n);case 4:return n.N_.set("Unknown"),n.M_.delete(4),e.next=8,lv(n);case 8:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()(s);case 5:case"end":return e.stop()}},e)})))}),this.N_=new uv(r,i)});function lv(e){return hv.apply(this,arguments)}function hv(){return(hv=E(O.mark(function e(t){var n,r,i;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!wv(t)){e.next=18;break}n=il(t.x_),e.prev=2,n.s();case 4:if((r=n.n()).done){e.next=10;break}return i=r.value,e.next=8,i(!0);case 8:e.next=4;break;case 10:e.next=15;break;case 12:e.prev=12,e.t0=e.catch(2),n.e(e.t0);case 15:return e.prev=15,n.f(),e.finish(15);case 18:case"end":return e.stop()}},e,null,[[2,12,15,18]])}))).apply(this,arguments)}function fv(e){return dv.apply(this,arguments)}function dv(){return(dv=E(O.mark(function e(t){var n,r,i;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:n=il(t.x_),e.prev=1,n.s();case 3:if((r=n.n()).done){e.next=9;break}return i=r.value,e.next=7,i(!1);case 7:e.next=3;break;case 9:e.next=14;break;case 11:e.prev=11,e.t0=e.catch(1),n.e(e.t0);case 14:return e.prev=14,n.f(),e.finish(14);case 17:case"end":return e.stop()}},e,null,[[1,11,14,17]])}))).apply(this,arguments)}function pv(e,t){var n=ml(e);n.F_.has(t.targetId)||(n.F_.set(t.targetId,t),kv(n)?mv(n):Jv(n).Xo()&&gv(n,t))}function vv(e,t){var n=ml(e),r=Jv(n);n.F_.delete(t),r.Xo()&&yv(n,t),0===n.F_.size&&(r.Xo()?r.n_():wv(n)&&n.N_.set("Unknown"))}
2function gv(e,t){if(e.L_.xe(t.targetId),t.resumeToken.approximateByteSize()>0||t.snapshotVersion.compareTo(Dl.min())>0){var n=e.remoteSyncer.getRemoteKeysForTarget(t.targetId).size;t=t.withExpectedCount(n)}Jv(e).P_(t)}function yv(e,t){e.L_.xe(t),Jv(e).I_(t)}function mv(e){e.L_=new Pd({getRemoteKeysForTarget:function(t){return e.remoteSyncer.getRemoteKeysForTarget(t)},ot:function(t){return e.F_.get(t)||null},tt:function(){return e.datastore.serializer.databaseId}}),Jv(e).start(),e.N_.w_()}function kv(e){return wv(e)&&!Jv(e).Zo()&&e.F_.size>0}function wv(e){return 0===ml(e).M_.size}function bv(e){e.L_=void 0}function _v(e){return Ev.apply(this,arguments)}function Ev(){return(Ev=E(O.mark(function e(t){return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:t.N_.set("Online");case 1:case"end":return e.stop()}},e)}))).apply(this,arguments)}function Iv(e){return Sv.apply(this,arguments)}function Sv(){return(Sv=E(O.mark(function e(t){return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:t.F_.forEach(function(e,n){gv(t,e)});case 1:case"end":return e.stop()}},e)}))).apply(this,arguments)}function Tv(e,t){return xv.apply(this,arguments)}function xv(){return(xv=E(O.mark(function e(t,n){return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:bv(t),kv(t)?(t.N_.D_(n),mv(t)):t.N_.set("Unknown");case 1:case"end":return e.stop()}},e)}))).apply(this,arguments)}function Av(e,t,n){return Cv.apply(this,arguments)}function Cv(){return Cv=E(O.mark(function e(t,n,r){var i;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t.N_.set("Online"),!(n instanceof Ad&&2===n.state&&n.cause)){e.next=13;break}return e.prev=1,e.next=4,function(){var e=E(O.mark(function e(t,n){var r,i,a,s;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:r=n.cause,i=il(n.targetIds),e.prev=2,i.s();case 4:if((a=i.n()).done){e.next=14;break}if(s=a.value,e.t0=t.F_.has(s),!e.t0){e.next=12;break}return e.next=10,t.remoteSyncer.rejectListen(s,r);case 10:t.F_.delete(s),t.L_.removeTarget(s);case 12:e.next=4;break;case 14:e.next=19;break;case 16:e.prev=16,e.t1=e.catch(2),i.e(e.t1);case 19:return e.prev=19,i.f(),e.finish(19);case 22:case"end":return e.stop()}},e,null,[[2,16,19,22]])}));return function(t,n){return e.apply(this,arguments)}}()(t,n);case 4:e.next=11;break;case 6:return e.prev=6,e.t0=e.catch(1),fl("RemoteStore","Failed to remove targets %s: %s ",n.targetIds.join(","),e.t0),e.next=11,Pv(t,e.t0);case 11:case 22:e.next=29;break;case 13:if(n instanceof Td?t.L_.Ke(n):n instanceof xd?t.L_.He(n):t.L_.We(n),r.isEqual(Dl.min())){e.next=29;break}return e.prev=14,e.next=17,Fp(t.localStore);case 17:if(i=e.sent,e.t1=r.compareTo(i)>=0,!e.t1){e.next=22;break}return e.next=22,function(e,t){var n=e.L_.rt(t);
2return n.targetChanges.forEach(function(n,r){if(n.resumeToken.approximateByteSize()>0){var i=e.F_.get(r);i&&e.F_.set(r,i.withResumeToken(n.resumeToken,t))}}),n.targetMismatches.forEach(function(t,n){var r=e.F_.get(t);if(r){e.F_.set(t,r.withResumeToken(uh.EMPTY_BYTE_STRING,r.snapshotVersion)),yv(e,t);var i=new cp(r.target,t,n,r.sequenceNumber);gv(e,i)}}),e.remoteSyncer.applyRemoteEvent(n)}(t,r);case 24:return e.prev=24,e.t2=e.catch(14),fl("RemoteStore","Failed to raise snapshot:",e.t2),e.next=29,Pv(t,e.t2);case 29:case"end":return e.stop()}},e,null,[[1,6],[14,24]])})),Cv.apply(this,arguments)}function Pv(e,t,n){return Ov.apply(this,arguments)}function Ov(){return(Ov=E(O.mark(function e(t,n,r){return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(Wl(n)){e.next=2;break}throw n;case 2:return t.M_.add(1),e.next=5,fv(t);case 5:t.N_.set("Offline"),r||(r=function(){return Fp(t.localStore)}),t.asyncQueue.enqueueRetryable(E(O.mark(function e(){return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return fl("RemoteStore","Retrying IndexedDB access"),e.next=3,r();case 3:return t.M_.delete(1),e.next=6,lv(t);case 6:case"end":return e.stop()}},e)})));case 8:case"end":return e.stop()}},e)}))).apply(this,arguments)}function Rv(e,t){return t().catch(function(n){return Pv(e,n,t)})}function Nv(e){return Dv.apply(this,arguments)}function Dv(){return(Dv=E(O.mark(function e(t){var n,r,i,a;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:n=ml(t),r=$v(n),i=n.v_.length>0?n.v_[n.v_.length-1].batchId:-1;case 2:if(!Lv(n)){e.next=19;break}return e.prev=3,e.next=6,Vp(n.localStore,i);case 6:if(null!==(a=e.sent)){e.next=10;break}return 0===n.v_.length&&r.n_(),e.abrupt("break",19);case 10:i=a.batchId,Mv(n,a),e.next=17;break;case 13:return e.prev=13,e.t0=e.catch(3),e.next=17,Pv(n,e.t0);case 17:e.next=2;break;case 19:Uv(n)&&Fv(n);case 20:case"end":return e.stop()}},e,null,[[3,13]])}))).apply(this,arguments)}function Lv(e){return wv(e)&&e.v_.length<10}function Mv(e,t){e.v_.push(t);var n=$v(e);n.Xo()&&n.E_&&n.d_(t.mutations)}function Uv(e){return wv(e)&&!$v(e).Zo()&&e.v_.length>0}function Fv(e){$v(e).start()}function jv(e){return Vv.apply(this,arguments)}function Vv(){return(Vv=E(O.mark(function e(t){return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:$v(t).V_();case 1:case"end":return e.stop()}},e)}))).apply(this,arguments)}function Bv(e){return qv.apply(this,arguments)}function qv(){return(qv=E(O.mark(function e(t){var n,r,i,a;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:n=$v(t),r=il(t.v_);try{for(r.s();!(i=r.n()).done;)a=i.value,n.d_(a.mutations)}catch(s){r.e(s)}finally{r.f()}case 3:case"end":return e.stop()}},e)}))).apply(this,arguments)}function zv(e,t,n){return Hv.apply(this,arguments)}function Hv(){return(Hv=E(O.mark(function e(t,n,r){var i,a;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return i=t.v_.shift(),a=pd.from(i,n,r),e.next=3,Rv(t,function(){return t.remoteSyncer.applySuccessfulWrite(a)});case 3:return e.next=5,Nv(t);case 5:case"end":return e.stop()}},e)}))).apply(this,arguments)}function Kv(e,t){return Gv.apply(this,arguments)}function Gv(){return Gv=E(O.mark(function e(t,n){return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(e.t0=n&&$v(t).E_,!e.t0){e.next=4;break}return e.next=4,function(){var e=E(O.mark(function e(t,n){var r;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!function(e){return yd(e)&&e!==kl.ABORTED}(n.code)){e.next=7;break}return r=t.v_.shift(),$v(t).t_(),e.next=5,Rv(t,function(){return t.remoteSyncer.rejectFailedWrite(r.batchId,n)});case 5:return e.next=7,Nv(t);case 7:case"end":return e.stop()}},e)}));return function(t,n){return e.apply(this,arguments)}}()(t,n);case 4:Uv(t)&&Fv(t);case 5:case"end":return e.stop()}},e)})),Gv.apply(this,arguments)}function Wv(e,t){return Qv.apply(this,arguments)}function Qv(){return(Qv=E(O.mark(function e(t,n){var r,i;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return(r=ml(t)).asyncQueue.verifyOperationInProgress(),fl("RemoteStore","RemoteStore received new credentials"),i=wv(r),r.M_.add(3),e.next=6,fv(r);case 6:return i&&r.N_.set("Unknown"),e.next=9,r.remoteSyncer.handleCredentialChange(n);case 9:return r.M_.delete(3),e.next=12,lv(r);case 12:case"end":return e.stop()}},e)}))).apply(this,arguments)}function Yv(e,t){return Xv.apply(this,arguments)}function Xv(){return(Xv=E(O.mark(function e(t,n){var r;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=ml(t),!n){e.next=7;break}return r.M_.delete(2),e.next=5,lv(r);case 5:e.next=13;break;case 7:if(e.t0=n,e.t0){e.next=13;break}return r.M_.add(2),e.next=12,fv(r);case 12:r.N_.set("Unknown");case 13:case"end":return e.stop()}},e)}))).apply(this,arguments)}function Jv(e){return e.B_||(e.B_=function(e,t,n){var r=ml(e);return r.f_(),new av(t,r.connection,r.authCredentials,r.appCheckCredentials,r.serializer,n)}(e.datastore,e.asyncQueue,{Po:_v.bind(null,e),To:Iv.bind(null,e),Ao:Tv.bind(null,e),h_:Av.bind(null,e)}),e.x_.push(function(){var t=E(O.mark(function t(n){return O.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(!n){t.next=4;break}e.B_.t_(),kv(e)?mv(e):e.N_.set("Unknown"),t.next=7;break;case 4:return t.next=6,e.B_.stop();case 6:bv(e);case 7:case"end":return t.stop()}},t)}));return function(e){return t.apply(this,arguments)}}())),e.B_}function $v(e){return e.k_||(e.k_=function(e,t,n){var r=ml(e);return r.f_(),new sv(t,r.connection,r.authCredentials,r.appCheckCredentials,r.serializer,n)}(e.datastore,e.asyncQueue,{Po:function(){return Promise.resolve()},To:jv.bind(null,e),Ao:Kv.bind(null,e),R_:Bv.bind(null,e),A_:zv.bind(null,e)}),e.x_.push(function(){var t=E(O.mark(function t(n){return O.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(!n){t.next=6;break}return e.k_.t_(),t.next=4,Nv(e);case 4:t.next=9;break;case 6:return t.next=8,e.k_.stop();case 8:e.v_.length>0&&(fl("RemoteStore","Stopping write stream with ".concat(e.v_.length," pending writes")),e.v_=[]);case 9:case"end":return t.stop()}},t)}));return function(e){return t.apply(this,arguments)}}())),e.k_}var Zv=function(){function e(t,n,r,i,a){I(this,e),this.asyncQueue=t,this.timerId=n,this.targetTimeMs=r,this.op=i,this.removalCallback=a,this.deferred=new bl,this.then=this.deferred.promise.then.bind(this.deferred.promise),this.deferred.promise.catch(function(e){})}return T(e,[{key:"promise",get:function(){return this.deferred.promise}},{key:"start",value:function(e){var t=this;this.timerHandle=setTimeout(function(){return t.handleDelayElapsed()},e)}},{key:"skipDelay",value:function(){return this.handleDelayElapsed()}},{key:"cancel",value:function(e){null!==this.timerHandle&&(this.clearTimeout(),this.deferred.reject(new wl(kl.CANCELLED,"Operation cancelled"+(e?": "+e:""))))}},{key:"handleDelayElapsed",value:function(){var e=this;this.asyncQueue.enqueueAndForget(function(){return null!==e.timerHandle?(e.clearTimeout(),e.op().then(function(t){return e.deferred.resolve(t)})):Promise.resolve()})}},{key:"clearTimeout",value:function(e){function t(){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}(function(){null!==this.timerHandle&&(this.removalCallback(this),clearTimeout(this.timerHandle),this.timerHandle=null)})}],[{key:"createAndSchedule",value:function(t,n,r,i,a){var s=new e(t,n,Date.now()+r,i,a);return s.start(r),s}}]),e}();function eg(e,t){if(dl("AsyncQueue","".concat(t,": ").concat(e)),Wl(e))return new wl(kl.UNAVAILABLE,"".concat(t,": ").concat(e));throw e}var tg,ng,rg=function(){function e(t){I(this,e),this.comparator=t?function(e,n){return t(e,n)||jl.comparator(e.key,n.key)}:function(e,t){return jl.comparator(e.key,t.key)},this.keyedMap=Sf(),this.sortedSet=new th(this.comparator)}return T(e,[{key:"has",value:function(e){return null!=this.keyedMap.get(e)}},{key:"get",value:function(e){return this.keyedMap.get(e)}},{key:"first",value:function(){return this.sortedSet.minKey()}},{key:"last",value:function(){return this.sortedSet.maxKey()}},{key:"isEmpty",value:function(){return this.sortedSet.isEmpty()}},{key:"indexOf",value:function(e){var t=this.keyedMap.get(e);return t?this.sortedSet.indexOf(t):-1}},{key:"size",get:function(){return this.sortedSet.size}}
2,{key:"forEach",value:function(e){this.sortedSet.inorderTraversal(function(t,n){return e(t),!1})}},{key:"add",value:function(e){var t=this.delete(e.key);return t.copy(t.keyedMap.insert(e.key,e),t.sortedSet.insert(e,null))}},{key:"delete",value:function(e){var t=this.get(e);return t?this.copy(this.keyedMap.remove(e),this.sortedSet.remove(t)):this}},{key:"isEqual",value:function(t){if(!(t instanceof e))return!1;if(this.size!==t.size)return!1;for(var n=this.sortedSet.getIterator(),r=t.sortedSet.getIterator();n.hasNext();){var i=n.getNext().key,a=r.getNext().key;if(!i.isEqual(a))return!1}return!0}},{key:"toString",value:function(){var e=[];return this.forEach(function(t){e.push(t.toString())}),0===e.length?"DocumentSet ()":"DocumentSet (\n "+e.join(" \n")+"\n)"}},{key:"copy",value:function(t,n){var r=new e;return r.comparator=this.comparator,r.keyedMap=t,r.sortedSet=n,r}}],[{key:"emptySet",value:function(t){return new e(t.comparator)}}]),e}(),ig=function(){function e(){I(this,e),this.q_=new th(jl.comparator)}return T(e,[{key:"track",value:function(e){var t=e.doc.key,n=this.q_.get(t);n?0!==e.type&&3===n.type?this.q_=this.q_.insert(t,e):3===e.type&&1!==n.type?this.q_=this.q_.insert(t,{type:n.type,doc:e.doc}):2===e.type&&2===n.type?this.q_=this.q_.insert(t,{type:2,doc:e.doc}):2===e.type&&0===n.type?this.q_=this.q_.insert(t,{type:0,doc:e.doc}):1===e.type&&0===n.type?this.q_=this.q_.remove(t):1===e.type&&2===n.type?this.q_=this.q_.insert(t,{type:1,doc:n.doc}):0===e.type&&1===n.type?this.q_=this.q_.insert(t,{type:2,doc:e.doc}):gl():this.q_=this.q_.insert(t,e)}},{key:"Q_",value:function(){var e=[];return this.q_.inorderTraversal(function(t,n){e.push(n)}),e}}]),e}(),ag=function(){function e(t,n,r,i,a,s,o,u,c){I(this,e),this.query=t,this.docs=n,this.oldDocs=r,this.docChanges=i,this.mutatedKeys=a,this.fromCache=s,this.syncStateChanged=o,this.excludesMetadataChanges=u,this.hasCachedResults=c}return T(e,[{key:"hasPendingWrites",get:function(){return!this.mutatedKeys.isEmpty()}},{key:"isEqual",value:function(e){if(!(this.fromCache===e.fromCache&&this.hasCachedResults===e.hasCachedResults&&this.syncStateChanged===e.syncStateChanged&&this.mutatedKeys.isEqual(e.mutatedKeys)&&vf(this.query,e.query)&&this.docs.isEqual(e.docs)&&this.oldDocs.isEqual(e.oldDocs)))return!1;var t=this.docChanges,n=e.docChanges;if(t.length!==n.length)return!1;for(var r=0;r<t.length;r++)if(t[r].type!==n[r].type||!t[r].doc.isEqual(n[r].doc))return!1;return!0}}],[{key:"fromInitialDocuments",value:function(t,n,r,i,a){var s=[];return n.forEach(function(e){s.push({type:0,doc:e})}),new e(t,n,rg.emptySet(n),s,r,i,!0,!1,a)}}]),e}(),sg=function(){function e(){I(this,e),this.K_=void 0,this.U_=[]}return T(e,[{key:"W_",value:function(){return this.U_.some(function(e){return e.G_()})}}]),e}(),og=T(function e(){I(this,e),this.queries=new bf(function(e){return gf(e)},vf),this.onlineState="Unknown",this.z_=new Set});function ug(e,t){return cg.apply(this,arguments)}function cg(){return(cg=E(O.mark(function e(t,n){var r,i,a,s,o;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:r=ml(t),i=3,a=n.query,(s=r.queries.get(a))?!s.W_()&&n.G_()&&(i=2):(s=new sg,i=n.G_()?0:1),e.prev=5,e.t0=i,e.next=0===e.t0?9:1===e.t0?13:2===e.t0?17:19;break;case 9:return e.next=11,r.onListen(a,!0);case 11:return s.K_=e.sent,e.abrupt("break",19);case 13:return e.next=15,r.onListen(a,!1);case 15:return s.K_=e.sent,e.abrupt("break",19);case 17:return e.next=19,r.onFirstRemoteStoreListen(a);case 19:e.next=25;break;case 21:return e.prev=21,e.t1=e.catch(5),o=eg(e.t1,"Initialization of query '".concat(yf(n.query),"' failed")),e.abrupt("return",void n.onError(o));case 25:r.queries.set(a,s),s.U_.push(n),n.j_(r.onlineState),s.K_&&n.H_(s.K_)&&pg(r);case 26:case"end":return e.stop()}},e,null,[[5,21]])}))).apply(this,arguments)}function lg(e,t){return hg.apply(this,arguments)}function hg(){return(hg=E(O.mark(function e(t,n){var r,i,a,s,o;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:r=ml(t),i=n.query,a=3,(s=r.queries.get(i))&&(o=s.U_.indexOf(n))>=0&&(s.U_.splice(o,1),0===s.U_.length?a=n.G_()?0:1:!s.W_()&&n.G_()&&(a=2)),e.t0=a,e.next=0===e.t0?7:1===e.t0?8:2===e.t0?9:10;break;case 7:return e.abrupt("return",(r.queries.delete(i),r.onUnlisten(i,!0)));case 8:return e.abrupt("return",(r.queries.delete(i),r.onUnlisten(i,!1)));case 9:return e.abrupt("return",r.onLastRemoteStoreUnlisten(i));case 10:return e.abrupt("return");case 11:case"end":return e.stop()}},e)}))).apply(this,arguments)}function fg(e,t){var n,r=ml(e),i=!1,a=il(t);try{for(a.s();!(n=a.n()).done;){var s=n.value,o=s.query,u=r.queries.get(o);if(u){var c,l=il(u.U_);try{for(l.s();!(c=l.n()).done;){c.value.H_(s)&&(i=!0)}}catch(h){l.e(h)}finally{l.f()}u.K_=s}}}catch(h){a.e(h)}finally{a.f()}i&&pg(r)}function dg(e,t,n){var r=ml(e),i=r.queries.get(t);if(i){var a,s=il(i.U_);try{for(s.s();!(a=s.n()).done;){a.value.onError(n)}}catch(o){s.e(o)}finally{s.f()}}r.queries.delete(t)}function pg(e){e.z_.forEach(function(e){e.next()})}(ng=tg||(tg={})).J_="default",ng.Cache="cache";var vg=function(){function e(t,n,r){I(this,e),this.query=t,this.Y_=n,this.Z_=!1,this.X_=null,this.onlineState="Unknown",this.options=r||{}}return T(e,[{key:"H_",value:function(e){if(!this.options.includeMetadataChanges){var t,n=[],r=il(e.docChanges);try{for(r.s();!(t=r.n()).done;){var i=t.value;3!==i.type&&n.push(i)}}catch(s){r.e(s)}finally{r.f()}e=new ag(e.query,e.docs,e.oldDocs,n,e.mutatedKeys,e.fromCache,e.syncStateChanged,!0,e.hasCachedResults)}var a=!1;return this.Z_?this.ea(e)&&(this.Y_.next(e),a=!0):this.ta(e,this.onlineState)&&(this.na(e),a=!0),this.X_=e,a}},{key:"onError",value:function(e){this.Y_.error(e)}},{key:"j_",value:function(e){this.onlineState=e;var t=!1;return this.X_&&!this.Z_&&this.ta(this.X_,e)&&(this.na(this.X_),t=!0),t}},{key:"ta",value:function(e,t){if(!e.fromCache)return!0;
2if(!this.G_())return!0;var n="Offline"!==t;return(!this.options.ra||!n)&&(!e.docs.isEmpty()||e.hasCachedResults||"Offline"===t)}},{key:"ea",value:function(e){if(e.docChanges.length>0)return!0;var t=this.X_&&this.X_.hasPendingWrites!==e.hasPendingWrites;return!(!e.syncStateChanged&&!t)&&!0===this.options.includeMetadataChanges}},{key:"na",value:function(e){e=ag.fromInitialDocuments(e.query,e.docs,e.mutatedKeys,e.fromCache,e.hasCachedResults),this.Z_=!0,this.Y_.next(e)}},{key:"G_",value:function(){return this.options.source!==tg.Cache}}]),e}(),gg=T(function e(t){I(this,e),this.key=t}),yg=T(function e(t){I(this,e),this.key=t}),mg=function(){function e(t,n){I(this,e),this.query=t,this.la=n,this.ha=null,this.hasCachedResults=!1,this.current=!1,this.Pa=Rf(),this.mutatedKeys=Rf(),this.Ia=kf(t),this.Ta=new rg(this.Ia)}return T(e,[{key:"Ea",get:function(){return this.la}},{key:"da",value:function(e,t){var n=this,r=t?t.Aa:new ig,i=t?t.Ta:this.Ta,a=t?t.mutatedKeys:this.mutatedKeys,s=i,o=!1,u="F"===this.query.limitType&&i.size===this.query.limit?i.last():null,c="L"===this.query.limitType&&i.size===this.query.limit?i.first():null;if(e.inorderTraversal(function(e,t){var l=i.get(e),h=mf(n.query,t)?t:null,f=!!l&&n.mutatedKeys.has(l.key),d=!!h&&(h.hasLocalMutations||n.mutatedKeys.has(h.key)&&h.hasCommittedMutations),p=!1;l&&h?l.data.isEqual(h.data)?f!==d&&(r.track({type:3,doc:h}),p=!0):n.Ra(l,h)||(r.track({type:2,doc:h}),p=!0,(u&&n.Ia(h,u)>0||c&&n.Ia(h,c)<0)&&(o=!0)):!l&&h?(r.track({type:0,doc:h}),p=!0):l&&!h&&(r.track({type:1,doc:l}),p=!0,(u||c)&&(o=!0)),p&&(h?(s=s.add(h),a=d?a.add(e):a.delete(e)):(s=s.delete(e),a=a.delete(e)))}),null!==this.query.limit)for(;s.size>this.query.limit;){var l="F"===this.query.limitType?s.last():s.first();s=s.delete(l.key),a=a.delete(l.key),r.track({type:1,doc:l})}return{Ta:s,Aa:r,Xi:o,mutatedKeys:a}}},{key:"Ra",value:function(e,t){return e.hasLocalMutations&&t.hasCommittedMutations&&!t.hasLocalMutations}},{key:"applyChanges",value:function(e,t,n,r){var i=this,a=this.Ta;this.Ta=e.Ta,this.mutatedKeys=e.mutatedKeys;var s=e.Aa.Q_();s.sort(function(e,t){return function(e,t){var n=function(e){switch(e){case 0:return 1;case 2:case 3:return 2;case 1:return 0;default:return gl()}};return n(e)-n(t)}(e.type,t.type)||i.Ia(e.doc,t.doc)}),this.Va(n),r=null!=r&&r;var o=t&&!r?this.ma():[],u=0===this.Pa.size&&this.current&&!r?1:0,c=u!==this.ha;return this.ha=u,0!==s.length||c?{snapshot:new ag(this.query,e.Ta,a,s,e.mutatedKeys,0===u,c,!1,!!n&&n.resumeToken.approximateByteSize()>0),fa:o}:{fa:o}}},{key:"j_",value:function(e){return this.current&&"Offline"===e?(this.current=!1,this.applyChanges({Ta:this.Ta,Aa:new ig,mutatedKeys:this.mutatedKeys,Xi:!1},!1)):{fa:[]}}},{key:"ga",value:function(e){return!this.la.has(e)&&!!this.Ta.has(e)&&!this.Ta.get(e).hasLocalMutations}},{key:"Va",value:function(e){var t=this;e&&(e.addedDocuments.forEach(function(e){return t.la=t.la.add(e)}),e.modifiedDocuments.forEach(function(e){}),e.removedDocuments.forEach(function(e){return t.la=t.la.delete(e)}),this.current=e.current)}},{key:"ma",value:function(){var e=this;if(!this.current)return[];var t=this.Pa;this.Pa=Rf(),this.Ta.forEach(function(t){e.ga(t.key)&&(e.Pa=e.Pa.add(t.key))});var n=[];return t.forEach(function(t){e.Pa.has(t)||n.push(new yg(t))}),this.Pa.forEach(function(e){t.has(e)||n.push(new gg(e))}),n}},{key:"pa",value:function(e){this.la=e.hs,this.Pa=Rf();var t=this.da(e.documents);return this.applyChanges(t,!0)}},{key:"ya",value:function(){return ag.fromInitialDocuments(this.query,this.Ta,this.mutatedKeys,0===this.ha,this.hasCachedResults)}}]),e}(),kg=T(function e(t,n,r){I(this,e),this.query=t,this.targetId=n,this.view=r}),wg=T(function e(t){I(this,e),this.key=t,this.wa=!1}),bg=function(){function e(t,n,r,i,a,s){I(this,e),this.localStore=t,this.remoteStore=n,this.eventManager=r,this.sharedClientState=i,this.currentUser=a,this.maxConcurrentLimboResolutions=s,this.Sa={},this.ba=new bf(function(e){return gf(e)},vf),this.Da=new Map,this.Ca=new Set,this.va=new th(jl.comparator),this.Fa=new Map,this.Ma=new _p,this.xa={},this.Oa=new Map,this.Na=gp.Ln(),this.onlineState="Unknown",this.La=void 0}return T(e,[{key:"isPrimaryClient",get:function(){return!0===this.La}}]),e}();function _g(e,t){return Eg.apply(this,arguments)}function Eg(){return Eg=E(O.mark(function e(t,n){var r,i,a,s,o=arguments;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=!(o.length>2&&void 0!==o[2])||o[2],i=ry(t),!(s=i.ba.get(n))){e.next=7;break}
2i.sharedClientState.addLocalQueryTarget(s.targetId),a=s.view.ya(),e.next=10;break;case 7:return e.next=9,Tg(i,n,r,!0);case 9:a=e.sent;case 10:return e.abrupt("return",a);case 11:case"end":return e.stop()}},e)})),Eg.apply(this,arguments)}function Ig(e,t){return Sg.apply(this,arguments)}function Sg(){return(Sg=E(O.mark(function e(t,n){var r;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=ry(t),e.next=3,Tg(r,n,!0,!1);case 3:case"end":return e.stop()}},e)}))).apply(this,arguments)}function Tg(e,t,n,r){return xg.apply(this,arguments)}function xg(){return(xg=E(O.mark(function e(t,n,r,i){var a,s,o,u;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Bp(t.localStore,df(n));case 2:if(a=e.sent,s=a.targetId,o=r?t.sharedClientState.addLocalQueryTarget(s):"not-current",e.t0=i,!e.t0){e.next=10;break}return e.next=9,Ag(t,n,s,"current"===o,a.resumeToken);case 9:u=e.sent;case 10:return t.isPrimaryClient&&r&&pv(t.remoteStore,a),e.abrupt("return",u);case 12:case"end":return e.stop()}},e)}))).apply(this,arguments)}function Ag(e,t,n,r,i){return Cg.apply(this,arguments)}function Cg(){return Cg=E(O.mark(function e(t,n,r,i,a){var s,o,u,c,l,h;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t.Ba=function(e,n,r){return(i=E(O.mark(function e(t,n,r,i){var a,s,o,u;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(a=n.view.da(r),e.t0=a.Xi,!e.t0){e.next=6;break}return e.next=5,Hp(t.localStore,n.query,!1).then(function(e){var t=e.documents;return n.view.da(t,a)});case 5:a=e.sent;case 6:return s=i&&i.targetChanges.get(n.targetId),o=i&&null!=i.targetMismatches.get(n.targetId),u=n.view.applyChanges(a,t.isPrimaryClient,s,o),e.abrupt("return",(Yg(t,n.targetId,u.fa),u.snapshot));case 8:case"end":return e.stop()}},e)})),function(e,t,n,r){return i.apply(this,arguments)})(t,e,n,r);var i},e.next=3,Hp(t.localStore,n,!0);case 3:return s=e.sent,o=new mg(n,s.hs),u=o.da(s.documents),c=Sd.createSynthesizedTargetChangeForCurrentChange(r,i&&"Offline"!==t.onlineState,a),l=o.applyChanges(u,t.isPrimaryClient,c),Yg(t,r,l.fa),h=new kg(n,r,o),e.abrupt("return",(t.ba.set(n,h),t.Da.has(r)?t.Da.get(r).push(n):t.Da.set(r,[n]),l.snapshot));case 11:case"end":return e.stop()}},e)})),Cg.apply(this,arguments)}function Pg(e,t,n){return Og.apply(this,arguments)}function Og(){return(Og=E(O.mark(function e(t,n,r){var i,a,s;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(i=ml(t),a=i.ba.get(n),!((s=i.Da.get(a.targetId)).length>1)){e.next=3;break}return e.abrupt("return",(i.Da.set(a.targetId,s.filter(function(e){return!vf(e,n)})),void i.ba.delete(n)));case 3:if(!i.isPrimaryClient){e.next=11;break}if(i.sharedClientState.removeLocalQueryTarget(a.targetId),e.t0=i.sharedClientState.isActiveQueryTarget(a.targetId),e.t0){e.next=9;break}return e.next=9,qp(i.localStore,a.targetId,!1).then(function(){i.sharedClientState.clearQueryState(a.targetId),r&&vv(i.remoteStore,a.targetId),Wg(i,a.targetId)}).catch(Hl);case 9:e.next=14;break;case 11:return Wg(i,a.targetId),e.next=14,qp(i.localStore,a.targetId,!0);case 14:case"end":return e.stop()}},e)}))).apply(this,arguments)}function Rg(e,t){return Ng.apply(this,arguments)}function Ng(){return(Ng=E(O.mark(function e(t,n){var r,i,a;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:r=ml(t),i=r.ba.get(n),a=r.Da.get(i.targetId),r.isPrimaryClient&&1===a.length&&(r.sharedClientState.removeLocalQueryTarget(i.targetId),vv(r.remoteStore,i.targetId));case 2:case"end":return e.stop()}},e)}))).apply(this,arguments)}function Dg(e,t,n){return Lg.apply(this,arguments)}function Lg(){return(Lg=E(O.mark(function e(t,n,r){var i,a,s;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return i=iy(t),e.prev=1,e.next=4,function(e,t){var n,r,i=ml(e),a=Nl.now(),s=t.reduce(function(e,t){return e.add(t.key)},Rf());return i.persistence.runTransaction("Locally write mutations","readwrite",function(e){var o=Ef(),u=Rf();return i.os.getEntries(e,s).next(function(e){(o=e).forEach(function(e,t){t.isValidDocument()||(u=u.add(e))})}).next(function(){return i.localDocuments.getOverlayedDocuments(e,o)}).next(function(r){n=r;var s,o=[],u=il(t);try{for(u.s();!(s=u.n()).done;){var c=s.value,l=nd(c,n.get(c.key).overlayedDocument);null!=l&&o.push(new ad(c.key,l,Dh(l.value.mapValue),Xf.exists(!0)))}}catch(h){u.e(h)}finally{u.f()}
2return i.mutationQueue.addMutationBatch(e,a,o,t)}).next(function(t){r=t;var a=t.applyToLocalDocumentSet(n,u);return i.documentOverlayCache.saveOverlays(e,t.batchId,a)})}).then(function(){return{batchId:r.batchId,changes:Tf(n)}})}(i.localStore,n);case 4:return a=e.sent,i.sharedClientState.addPendingMutation(a.batchId),function(e,t,n){var r=e.xa[e.currentUser.toKey()];r||(r=new th(Ol)),r=r.insert(t,n),e.xa[e.currentUser.toKey()]=r}(i,a.batchId,r),e.next=9,$g(i,a.changes);case 9:return e.next=11,Nv(i.remoteStore);case 11:e.next=17;break;case 13:e.prev=13,e.t0=e.catch(1),s=eg(e.t0,"Failed to persist write"),r.reject(s);case 17:case"end":return e.stop()}},e,null,[[1,13]])}))).apply(this,arguments)}function Mg(e,t){return Ug.apply(this,arguments)}function Ug(){return(Ug=E(O.mark(function e(t,n){var r,i;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=ml(t),e.prev=1,e.next=4,jp(r.localStore,n);case 4:return i=e.sent,n.targetChanges.forEach(function(e,t){var n=r.Fa.get(t);n&&(yl(e.addedDocuments.size+e.modifiedDocuments.size+e.removedDocuments.size<=1),e.addedDocuments.size>0?n.wa=!0:e.modifiedDocuments.size>0?yl(n.wa):e.removedDocuments.size>0&&(yl(n.wa),n.wa=!1))}),e.next=8,$g(r,i,n);case 8:e.next=14;break;case 10:return e.prev=10,e.t0=e.catch(1),e.next=14,Hl(e.t0);case 14:case"end":return e.stop()}},e,null,[[1,10]])}))).apply(this,arguments)}function Fg(e,t,n){var r=ml(e);if(r.isPrimaryClient&&0===n||!r.isPrimaryClient&&1===n){var i=[];r.ba.forEach(function(e,n){var r=n.view.j_(t);r.snapshot&&i.push(r.snapshot)}),function(e,t){var n=ml(e);n.onlineState=t;var r=!1;n.queries.forEach(function(e,n){var i,a=il(n.U_);try{for(a.s();!(i=a.n()).done;){i.value.j_(t)&&(r=!0)}}catch(s){a.e(s)}finally{a.f()}}),r&&pg(n)}(r.eventManager,t),i.length&&r.Sa.h_(i),r.onlineState=t,r.isPrimaryClient&&r.sharedCl
2ientState.setOnlineState(t)}}function jg(e,t,n){return Vg.apply(this,arguments)}function Vg(){return(Vg=E(O.mark(function e(t,n,r){var i,a,s,o,u,c;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if((i=ml(t)).sharedClientState.updateQueryState(n,"rejected",r),a=i.Fa.get(n),!(s=a&&a.key)){e.next=14;break}return o=(o=new th(jl.comparator)).insert(s,Lh.newNoDocument(s,Dl.min())),u=Rf().add(s),c=new Id(Dl.min(),new Map,new th(Ol),o,u),e.next=9,Mg(i,c);case 9:i.va=i.va.remove(s),i.Fa.delete(n),Jg(i),e.next=16;break;case 14:return e.next=16,qp(i.localStore,n,!1).then(function(){return Wg(i,n,r)}).catch(Hl);case 16:case"end":return e.stop()}},e)}))).apply(this,arguments)}function Bg(e,t){return qg.apply(this,arguments)}function qg(){return(qg=E(O.mark(function e(t,n){var r,i,a;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=ml(t),i=n.batch.batchId,e.prev=1,e.next=4,Up(r.localStore,n);case 4:return a=e.sent,Gg(r,i,null),Kg(r,i),r.sharedClientState.updateMutationState(i,"acknowledged"),e.next=10,$g(r,a);case 10:e.next=16;break;case 12:return e.prev=12,e.t0=e.catch(1),e.next=16,Hl(e.t0);case 16:case"end":return e.stop()}},e,null,[[1,12]])}))).apply(this,arguments)}function zg(e,t,n){return Hg.apply(this,arguments)}function Hg(){return(Hg=E(O.mark(function e(t,n,r){var i,a;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return i=ml(t),e.prev=1,e.next=4,function(e,t){var n=ml(e);return n.persistence.runTransaction("Reject batch","readwrite-primary",function(e){var r;
2return n.mutationQueue.lookupMutationBatch(e,t).next(function(t){return yl(null!==t),r=t.keys(),n.mutationQueue.removeMutationBatch(e,t)}).next(function(){return n.mutationQueue.performConsistencyCheck(e)}).next(function(){return n.documentOverlayCache.removeOverlaysForBatchId(e,r,t)}).next(function(){return n.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(e,r)}).next(function(){return n.localDocuments.getDocuments(e,r)})})}(i.localStore,n);case 4:return a=e.sent,Gg(i,n,r),Kg(i,n),i.sharedClientState.updateMutationState(n,"rejected",r),e.next=10,$g(i,a);case 10:e.next=16;break;case 12:return e.prev=12,e.t0=e.catch(1),e.next=16,Hl(e.t0);case 16:case"end":return e.stop()}},e,null,[[1,12]])}))).apply(this,arguments)}function Kg(e,t){(e.Oa.get(t)||[]).forEach(function(e){e.resolve()}),e.Oa.delete(t)}function Gg(e,t,n){var r=ml(e),i=r.xa[r.currentUser.toKey()];if(i){var a=i.get(t);a&&(n?a.reject(n):a.resolve(),i=i.remove(t)),r.xa[r.currentUser.toKey()]=i}}function Wg(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;e.sharedClientState.removeLocalQueryTarget(t);var r,i=il(e.Da.get(t));try{for(i.s();!(r=i.n()).done;){var a=r.value;e.ba.delete(a),n&&e.Sa.ka(a,n)}}catch(s){i.e(s)}finally{i.f()}e.Da.delete(t),e.isPrimaryClient&&e.Ma.Vr(t).forEach(function(t){e.Ma.containsKey(t)||Qg(e,t)})}function Qg(e,t){e.Ca.delete(t.path.canonicalString());var n=e.va.get(t);null!==n&&(vv(e.remoteStore,n),e.va=e.va.remove(t),e.Fa.delete(n),Jg(e))}function Yg(e,t,n){var r,i=il(n);try{for(i.s();!(r=i.n()).done;){var a=r.value;a instanceof gg?(e.Ma.addReference(a.key,t),Xg(e,a)):a instanceof yg?(fl("SyncEngine","Document no longer in limbo: "+a.key),e.Ma.removeReference(a.key,t),e.Ma.containsKey(a.key)||Qg(e,a.key)):gl()}}catch(s){i.e(s)}finally{i.f()}}function Xg(e,t){var n=t.key,r=n.path.canonicalString();e.va.get(n)||e.Ca.has(r)||(fl("SyncEngine","New document in limbo: "+n),e.Ca.add(r),Jg(e))}function Jg(e){for(;e.Ca.size>0&&e.va.size<e.maxConcurrentLimboResolutions;){var t=e.Ca.values().next().value;e.Ca.delete(t);var n=new jl(Ml.fromString(t)),r=e.Na.next();e.Fa.set(r,new wg(n)),e.va=e.va.insert(n,r),pv(e.remoteStore,new cp(df(lf(n.path)),r,"TargetPurposeLimboResolution",Ql.oe))}}function $g(e,t,n){return Zg.apply(this,arguments)}function Zg(){return Zg=E(O.mark(function e(t,n,r){var i,a,s,o;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(i=ml(t),a=[],s=[],o=[],e.t0=i.ba.isEmpty(),e.t0){e.next=9;break}return i.ba.forEach(function(e,t){o.push(i.Ba(t,n,r).then(function(e){if((e||r)&&i.isPrimaryClient){var n=e&&!e.fromCache;i.sharedClientState.updateQueryState(t.targetId,n?"current":"not-current")}if(e){a.push(e);var o=Op.Ki(t.targetId,e);s.push(o)}}))}),e.next=6,Promise.all(o);case 6:return i.Sa.h_(a),e.next=9,function(){var e=E(O.mark(function e(t,n){var r,i,a,s,o,u,c,l;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=ml(t),e.prev=1,e.next=4,r.persistence.runTransaction("notifyLocalViewChanges","readwrite",function(e){return Gl.forEach(n,function(t){return Gl.forEach(t.qi,function(n){return r.persistence.referenceDelegate.addReference(e,t.targetId,n)}).next(function(){return Gl.forEach(t.Qi,function(n){return r.persistence.referenceDelegate.removeReference(e,t.targetId,n)})})})});case 4:e.next=11;break;case 6:if(e.prev=6,e.t0=e.catch(1),Wl(e.t0)){e.next=10;break}throw e.t0;case 10:fl("LocalStore","Failed to update sequence numbers: "+e.t0);case 11:i=il(n);try{for(i.s();!(a=i.n()).done;)s=a.value,o=s.targetId,s.fromCache||(u=r.ns.get(o),c=u.snapshotVersion,l=u.withLastLimboFreeSnapshotVersion(c),r.ns=r.ns.insert(o,l))}catch(h){i.e(h)}finally{i.f()}case 13:case"end":return e.stop()}},e,null,[[1,6]])}));return function(t,n){return e.apply(this,arguments)}}()(i.localStore,s);case 9:case"end":return e.stop()}},e)})),Zg.apply(this,arguments)}function ey(e,t){return ty.apply(this,arguments)}function ty(){return(ty=E(O.mark(function e(t,n){var r,i;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if((r=ml(t)).currentUser.isEqual(n)){e.next=11;break}
2return fl("SyncEngine","User change. New user:",n.toKey()),e.next=5,Lp(r.localStore,n);case 5:return i=e.sent,r.currentUser=n,function(e,t){e.Oa.forEach(function(e){e.forEach(function(e){e.reject(new wl(kl.CANCELLED,t))})}),e.Oa.clear()}(r,"'waitForPendingWrites' promise is rejected due to a user change."),r.sharedClientState.handleUserChange(n,i.removedBatchIds,i.addedBatchIds),e.next=11,$g(r,i.us);case 11:case"end":return e.stop()}},e)}))).apply(this,arguments)}function ny(e,t){var n=ml(e),r=n.Fa.get(t);if(r&&r.wa)return Rf().add(r.key);var i=Rf(),a=n.Da.get(t);if(!a)return i;var s,o=il(a);try{for(o.s();!(s=o.n()).done;){var u=s.value,c=n.ba.get(u);i=i.unionWith(c.view.Ea)}}catch(l){o.e(l)}finally{o.f()}return i}function ry(e){var t=ml(e);return t.remoteStore.remoteSyncer.applyRemoteEvent=Mg.bind(null,t),t.remoteStore.remoteSyncer.getRemoteKeysForTarget=ny.bind(null,t),t.remoteStore.remoteSyncer.rejectListen=jg.bind(null,t),t.Sa.h_=fg.bind(null,t.eventManager),t.Sa.ka=dg.bind(null,t.eventManager),t}function iy(e){var t=ml(e);return t.remoteStore.remoteSyncer.applySuccessfulWrite=Bg.bind(null,t),t.remoteStore.remoteSyncer.rejectFailedWrite=zg.bind(null,t),t}var ay=function(){function e(){I(this,e),this.synchronizeTabs=!1}var t,n;return T(e,[{key:"initialize",value:(n=E(O.mark(function e(t){return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return this.serializer=nv(t.databaseInfo.databaseId),this.sharedClientState=this.createSharedClientState(t),this.persistence=this.createPersistence(t),e.next=5,this.persistence.start();case 5:this.localStore=this.createLocalStore(t),this.gcScheduler=this.createGarbageCollectionScheduler(t,this.localStore),this.indexBackfillerScheduler=this.createIndexBackfillerScheduler(t,this.localStore);case 8:case"end":return e.stop()}},e,this)})),function(e){return n.apply(this,arguments)})},{key:"createGarbageCollectionScheduler",value:function(e,t){return null}},{key:"createIndexBackfillerScheduler",value:function(e,t){return null}},{key:"createLocalStore",value:function(e){return function(e,t,n,r){return new Dp(e,t,n,r)}(this.persistence,new Np,e.initialUser,this.serializer)}},{key:"createPersistence",value:function(e){return new Ap(Pp.Hr,this.serializer)}},{key:"createSharedClientState",value:function(e){return new Gp}},{key:"terminate",value:(t=E(O.mark(function e(){var t,n;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return null===(t=this.gcScheduler)||void 0===t||t.stop(),null===(n=this.indexBackfillerScheduler)||void 0===n||n.stop(),this.sharedClientState.shutdown(),e.next=5,this.persistence.shutdown();case 5:case"end":return e.stop()}},e,this)})),function(){return t.apply(this,arguments)})}]),e}(),sy=function(){function e(){I(this,e)}var t,n;return T(e,[{key:"initialize",value:(n=E(O.mark(function e(t,n){var r=this;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(e.t0=this.localStore,e.t0){e.next=12;break}return this.localStore=t.localStore,this.sharedClientState=t.sharedClientState,this.datastore=this.createDatastore(n),this.remoteStore=this.createRemoteStore(n),this.eventManager=this.createEventManager(n),this.syncEngine=this.createSyncEngine(n,!t.synchronizeTabs),this.sharedClientState.onlineStateHandler=function(e){return Fg(r.syncEngine,e,1)},this.remoteStore.remoteSyncer.handleCredentialChange=ey.bind(null,this.syncEngine),e.next=12,Yv(this.remoteStore,this.syncEngine.isPrimaryClient);case 12:case"end":return e.stop()}},e,this)})),function(e,t){return n.apply(this,arguments)})},{key:"createEventManager",value:function(e){return new og}},{key:"createDatastore",value:function(e){var t=nv(e.databaseInfo.databaseId),n=function(e){return new ev(e)}(e.databaseInfo);return function(e,t,n,r){return new ov(e,t,n,r)}(e.authCredentials,e.appCheckCredentials,n,t)}},{key:"createRemoteStore",value:function(e){var t=this;return function(e,t,n,r,i){return new cv(e,t,n,r,i)}(this.localStore,this.datastore,e.asyncQueue,function(e){return Fg(t.syncEngine,e,0)},Qp.D()?new Qp:new Wp)}},{key:"createSyncEngine",value:function(e,t){return function(e,t,n,r,i,a,s){var o=new bg(e,t,n,r,i,a);return s&&(o.La=!0),o}(this.localStore,this.remoteStore,this.eventManager,this.sharedCl
2ientState,e.initialUser,e.maxConcurrentLimboResolutions,t)}},{key:"terminate",value:(t=E(O.mark(function e(){var t;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,function(){var e=E(O.mark(function e(t){var n;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=ml(t),fl("RemoteStore","RemoteStore shutting down."),n.M_.add(5),e.next=5,fv(n);case 5:n.O_.shutdown(),n.N_.set("Unknown");case 7:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()(this.remoteStore);case 2:null===(t=this.datastore)||void 0===t||t.terminate();case 3:case"end":return e.stop()}},e,this)})),function(){return t.apply(this,arguments)})}]),e}(),oy=function(){function e(t){I(this,e),this.observer=t,this.muted=!1}return T(e,[{key:"next",value:function(e){this.observer.next&&this.Ka(this.observer.next,e)}},{key:"error",value:function(e){this.observer.error?this.Ka(this.observer.error,e):dl("Uncaught Error in snapshot listener:",e.toString())}},{key:"$a",value:function(){this.muted=!0}},{key:"Ka",value:function(e,t){var n=this;this.muted||setTimeout(function(){n.muted||e(t)},0)}}]),e}(),uy=function(){function e(t,n,r,i){var a=this;I(this,e),this.authCredentials=t,this.appCheckCredentials=n,this.asyncQueue=r,this.databaseInfo=i,this.user=ul.UNAUTHENTICATED,this.clientId=Pl.newId(),this.authCredentialListener=function(){return Promise.resolve()},this.appCheckCredentialListener=function(){return Promise.resolve()},this.authCredentials.start(r,function(){var e=E(O.mark(function e(t){return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return fl("FirestoreClient","Received user=",t.uid),e.next=3,a.authCredentialListener(t);case 3:a.user=t;case 4:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()),this.appCheckCredentials.start(r,function(e){return fl("FirestoreClient","Received new app check token=",e),a.appCheckCredentialListener(e,a.user)})}return T(e,[{key:"configuration",get:function(){return{asyncQueue:this.asyncQueue,databaseInfo:this.databaseInfo,clientId:this.clientId,authCredentials:this.authCredentials,appCheckCredentials:this.appCheckCredentials,initialUser:this.user,maxConcurrentLimboResolutions:100}}},{key:"setCredentialChangeListener",value:function(e){this.authCredentialListener=e}},{key:"setAppCheckTokenChangeListener",value:function(e){this.appCheckCredentialListener=e}},{key:"verifyNotTerminated",value:function(){if(this.asyncQueue.isShuttingDown)throw new wl(kl.FAILED_PRECONDITION,"The client has already been terminated.")}},{key:"terminate",value:function(){var e=this;this.asyncQueue.enterRestrictedMode();var t=new bl;return this.asyncQueue.enqueueAndForgetEvenWhileRestricted(E(O.mark(function n(){var r;return O.wrap(function(n){for(;;)switch(n.prev=n.next){case 0:if(n.prev=0,n.t0=e._onlineComponents,!n.t0){n.next=5;break}return n.next=5,e._onlineComponents.terminate();case 5:if(n.t1=e._offlineComponents,!n.t1){n.next=9;break}return n.next=9,e._offlineComponents.terminate();case 9:e.authCredentials.shutdown(),e.appCheckCredentials.shutdown(),t.resolve(),n.next=18;break;case 14:n.prev=14,n.t2=n.catch(0),r=eg(n.t2,"Failed to shutdown persistence"),t.reject(r);case 18:case"end":return n.stop()}},n,null,[[0,14]])}))),t.promise}}]),e}();function cy(e,t){return ly.apply(this,arguments)}function ly(){return ly=E(O.mark(function e(t,n){var r,i;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t.asyncQueue.verifyOperationInProgress(),fl("FirestoreClient","Initializing OfflineComponentProvider"),r=t.configuration,e.next=4,n.initialize(r);case 4:i=r.initialUser,t.setCredentialChangeListener(function(){var e=E(O.mark(function e(t){return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(e.t0=i.isEqual(t),e.t0){e.next=5;break}return e.next=4,Lp(n.localStore,t);case 4:i=t;case 5:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()),n.persistence.setDatabaseDeletedListener(function(){return t.terminate()}),t._offlineComponents=n;case 6:case"end":return e.stop()}},e)})),ly.apply(this,arguments)}function hy(e,t){return fy.apply(this,arguments)}function fy(){return(fy=E(O.mark(function e(t,n){var r;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t.asyncQueue.verifyOperationInProgress(),e.next=3,py(t);case 3:return r=e.sent,fl("FirestoreClient","Initializing OnlineComponentProvider"),e.next=7,n.initialize(r,t.configuration);case 7:t.setCredentialChangeListener(function(e){return Wv(n.remoteStore,e)}),t.setAppCheckTokenChangeListener(function(e,t){return Wv(n.remoteStore,t)}),t._onlineComponents=n;case 10:case"end":return e.stop()}},e)}))).apply(this,arguments)}function dy(e){return"FirebaseError"===e.name?e.code===kl.FAILED_PRECONDITION||e.code===kl.UNIMPLEMENT
2ED:!("undefined"!=typeof DOMException&&e instanceof DOMException)||22===e.code||20===e.code||11===e.code}function py(e){return vy.apply(this,arguments)}function vy(){return(vy=E(O.mark(function e(t){var n;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t._offlineComponents){e.next=21;break}if(!t._uninitializedComponentsProvider){e.next=18;break}return fl("FirestoreClient","Using user provided OfflineComponentProvider"),e.prev=3,e.next=6,cy(t,t._uninitializedComponentsProvider._offline);case 6:e.next=16;break;case 8:if(e.prev=8,e.t0=e.catch(3),dy(n=e.t0)){e.next=13;break}throw n;case 13:return pl("Error using user provided cache. Falling back to memory cache: "+n),e.next=16,cy(t,new ay);case 16:e.next=21;break;case 18:return fl("FirestoreClient","Using default OfflineComponentProvider"),e.next=21,cy(t,new ay);case 21:return e.abrupt("return",t._offlineComponents);case 22:case"end":return e.stop()}},e,null,[[3,8]])}))).apply(this,arguments)}function gy(e){return yy.apply(this,arguments)}function yy(){return(yy=E(O.mark(function e(t){return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(e.t0=t._onlineComponents,e.t0){e.next=11;break}if(!t._uninitializedComponentsProvider){e.next=8;break}return fl("FirestoreClient","Using user provided OnlineComponentProvider"),e.next=6,hy(t,t._uninitializedComponentsProvider._online);case 6:e.next=11;break;case 8:return fl("FirestoreClient","Using default OnlineComponentProvider"),e.next=11,hy(t,new sy);case 11:return e.abrupt("return",t._onlineComponents);case 12:case"end":return e.stop()}},e)}))).apply(this,arguments)}function my(e){return gy(e).then(function(e){return e.syncEngine})}function ky(e){return wy.apply(this,arguments)}function wy(){return(wy=E(O.mark(function e(t){var n,r;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,gy(t);case 2:return n=e.sent,r=n.eventManager,e.abrupt("return",(r.onListen=_g.bind(null,n.syncEngine),r.onUnlisten=Pg.bind(null,n.syncEngine),r.onFirstRemoteStoreListen=Ig.bind(null,n.syncEngine),r.onLastRemoteStoreUnlisten=Rg.bind(null,n.syncEngine),r));case 5:case"end":return e.stop()}},e)}))).apply(this,arguments)}function by(e){var t={};return void 0!==e.timeoutSeconds&&(t.timeoutSeconds=e.timeoutSeconds),t}var _y=new Map;function Ey(e){if(!jl.isDocumentKey(e))throw new wl(kl.INVALID_ARGUMENT,"Invalid document reference. Document references must have an even number of segments, but ".concat(e," has ").concat(e.length,"."))}function Iy(e){if(void 0===e)return"undefined";if(null===e)return"null";if("string"==typeof e)return e.length>20&&(e="".concat(e.substring(0,20),"...")),JSON.stringify(e);if("number"==typeof e||"boolean"==typeof e)return""+e;if("object"==l(e)){if(e instanceof Array)return"an array";var t=function(e){return e.constructor?e.constructor.name:null}(e);return t?"a custom ".concat(t," object"):"an object"}return"function"==typeof e?"a function":gl()}function Sy(e,t){if("_delegate"in e&&(e=e._delegate),!(e instanceof t)){if(t.name===e.constructor.name)throw new wl(kl.INVALID_ARGUMENT,"Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");var n=Iy(e);throw new wl(kl.INVALID_ARGUMENT,"Expected type '".concat(t.name,"', but it was: ").concat(n))}return e}var Ty=function(){function e(t){var n,r;if(I(this,e),void 0===t.host){if(void 0!==t.ssl)throw new wl(kl.INVALID_ARGUMENT,"Can't provide ssl option if host option is not set");this.host="firestore.googleapis.com",this.ssl=!0}else this.host=t.host,this.ssl=null===(n=t.ssl)||void 0===n||n;if(this.credentials=t.credentials,this.ignoreUndefinedProperties=!!t.ignoreUndefinedProperties,this.localCache=t.localCache,void 0===t.cacheSizeBytes)this.cacheSizeBytes=41943040;else{if(-1!==t.cacheSizeBytes&&t.cacheSizeBytes<1048576)throw new wl(kl.INVALID_ARGUMENT,"cacheSizeBytes must be at least 1048576");this.cacheSizeBytes=t.cacheSizeBytes}(function(e,t,n,r){if(!0===t&&!0===r)throw new wl(kl.INVALID_ARGUMENT,"".concat(e," and ").concat(n," cannot be used together."))})("experimentalForceLongPolling",t.experimentalForceLongPolling,"experimentalAutoDetectLongPolling",t.experimentalAutoDetectLongPolling),this.experimentalForceLongPolling=!!t.experimentalForceLongPolling,this.experimentalForceLongPolling?this.experimentalAutoDetectLongPolling=!1:void 0===t.experimentalAutoDetectLongPolling?this.experimentalAutoDetectLongPolling=!0:this.experimentalAutoDetectLongPolling=!!t.experimentalAutoDetectLongPolling,this.experimentalLongPollingOptions=by(null!==(r=t.experimentalLongPollingOptions)&&void 0!==r?r:{}),function(e){if(void 0!==e.timeoutSeconds){if(isNaN(e.timeoutSeconds))throw new wl(kl.INVA
2LID_ARGUMENT,"invalid long polling timeout: ".concat(e.timeoutSeconds," (must not be NaN)"));if(e.timeoutSeconds<5)throw new wl(kl.INVALID_ARGUMENT,"invalid long polling timeout: ".concat(e.timeoutSeconds," (minimum allowed value is 5)"));if(e.timeoutSeconds>30)throw new wl(kl.INVALID_ARGUMENT,"invalid long polling timeout: ".concat(e.timeoutSeconds," (maximum allowed value is 30)"))}}(this.experimentalLongPollingOptions),this.useFetchStreams=!!t.useFetchStreams}return T(e,[{key:"isEqual",value:function(e){return this.host===e.host&&this.ssl===e.ssl&&this.credentials===e.credentials&&this.cacheSizeBytes===e.cacheSizeBytes&&this.experimentalForceLongPolling===e.experimentalForceLongPolling&&this.experimentalAutoDetectLongPolling===e.experimentalAutoDetectLongPolling&&function(e,t){return e.timeoutSeconds===t.timeoutSeconds}(this.experimentalLongPollingOptions,e.experimentalLongPollingOptions)&&this.ignoreUndefinedProperties===e.ignoreUndefinedProperties&&this.useFetchStreams===e.useFetchStreams}}]),e}(),xy=function(){function e(t,n,r,i){I(this,e),this._authCredentials=t,this._appCheckCredentials=n,this._databaseId=r,this._app=i,this.type="firestore-lite",this._persistenceKey="(lite)",this._settings=new Ty({}),this._settingsFrozen=!1}return T(e,[{key:"app",get:function(){if(!this._app)throw new wl(kl.FAILED_PRECONDITION,"Firestore was not initialized using the Firebase SDK. 'app' is not available");return this._app}},{key:"_initialized",get:function(){return this._settingsFrozen}},{key:"_terminated",get:function(){return void 0!==this._terminateTask}},{key:"_setSettings",value:function(e){if(this._settingsFrozen)throw new wl(kl.FAILED_PRECONDITION,"Firestore has already been started and its settings can no longer be changed. You can only modify settings before calling any other methods on a Firestore object.");this._settings=new Ty(e),void 0!==e.credentials&&(this._authCredentials=function(e){if(!e)return new El;switch(e.type){case"firstParty":return new Tl(e.sessionIndex||"0",e.iamToken||null,e.authTokenFactory||null);case"provider":return e.client;default:throw new wl(kl.INVALID_ARGUMENT,"makeAuthCredentialsProvider failed due to invalid credential type")}}(e.credentials))}},{key:"_getSettings",value:function(){return this._settings}},{key:"_freezeSettings",value:function(){return this._settingsFrozen=!0,this._settings}},{key:"_delete",value:function(){return this._terminateTask||(this._terminateTask=this._terminate()),this._terminateTask}},{key:"toJSON",value:function(){return{app:this._app,databaseId:this._databaseId,settings:this._settings}}},{key:"_terminate",value:function(){return e=this,(t=_y.get(e))&&(fl("ComponentProvider","Removing Datastore"),_y.delete(e),t.terminate()),Promise.resolve();var e,t}}]),e}(),Ay=function(){function e(t,n,r){I(this,e),this.converter=n,this._query=r,this.type="query",this.firestore=t}return T(e,[{key:"withConverter",value:function(t){return new e(this.firestore,t,this._query)}}]),e}(),Cy=function(){function e(t,n,r){I(this,e),this.converter=n,this._key=r,this.type="document",this.firestore=t}return T(e,[{key:"_path",get:function(){return this._key.path}},{key:"id",get:function(){return this._key.path.lastSegment()}},{key:"path",get:function(){return this._key.path.canonicalString()}},{key:"parent",get:function(){return new Py(this.firestore,this.converter,this._key.path.popLast())}},{key:"withConverter",value:function(t){return new e(this.firestore,t,this._key)}}]),e}(),Py=function(e){y(n,e);var t=sl(n);function n(e,r,i){var a;return I(this,n),(a=t.call(this,e,r,lf(i)))._path=i,a.type="collection",a}return T(n,[{key:"id",get:function(){return this._query.path.lastSegment()}},{key:"path",get:function(){return this._query.path.canonicalString()}},{key:"parent",get:function(){var e=this._path.popLast();return e.isEmpty()?null:new Cy(this.firestore,null,new jl(e))}},{key:"withConverter",value:function(e){return new n(this.firestore,e,this._path)}}]),n}(Ay);function Oy(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),i=2;i<n;i++)r[i-2]=arguments[i];if(e=ce(e),1===arguments.length&&(t=Pl.newId()),function(e,t,n){if(!n)throw new wl(kl.INVA
2LID_ARGUMENT,"Function ".concat(e,"() cannot be called with an empty ").concat(t,"."))}("doc","path",t),e instanceof xy){var a=Ml.fromString.apply(Ml,[t].concat(r));return Ey(a),new Cy(e,null,new jl(a))}if(!(e instanceof Cy||e instanceof Py))throw new wl(kl.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");var s=e._path.child(Ml.fromString.apply(Ml,[t].concat(r)));return Ey(s),new Cy(e.firestore,e instanceof Py?e.converter:null,new jl(s))}var Ry=function(){function e(){var t=this;I(this,e),this.iu=Promise.resolve(),this.su=[],this.ou=!1,this._u=[],this.au=null,this.uu=!1,this.cu=!1,this.lu=[],this.Yo=new rv(this,"async_queue_retry"),this.hu=function(){var e=tv();e&&fl("AsyncQueue","Visibility state changed to "+e.visibilityState),t.Yo.Wo()};var n=tv();n&&"function"==typeof n.addEventListener&&n.addEventListener("visibilitychange",this.hu)}var t,n;return T(e,[{key:"isShuttingDown",get:function(){return this.ou}},{key:"enqueueAndForget",value:function(e){this.enqueue(e)}},{key:"enqueueAndForgetEvenWhileRestricted",value:function(e){this.Pu(),this.Iu(e)}},{key:"enterRestrictedMode",value:function(e){if(!this.ou){this.ou=!0,this.cu=e||!1;var t=tv();t&&"function"==typeof t.removeEventListener&&t.removeEventListener("visibilitychange",this.hu)}}},{key:"enqueue",value:function(e){var t=this;if(this.Pu(),this.ou)return new Promise(function(){});var n=new bl;return this.Iu(function(){return t.ou&&t.cu?Promise.resolve():(e().then(n.resolve,n.reject),n.promise)}).then(function(){return n.promise})}},{key:"enqueueRetryable",value:function(e){var t=this;this.enqueueAndForget(function(){return t.su.push(e),t.Tu()})}},{key:"Tu",value:(n=E(O.mark(function e(){var t=this;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(0===this.su.length){e.next=14;break}return e.prev=1,e.next=4,this.su[0]();case 4:this.su.shift(),this.Yo.reset(),e.next=13;break;case 8:if(e.prev=8,e.t0=e.catch(1),Wl(e.t0)){e.next=12;break}throw e.t0;case 12:fl("AsyncQueue","Operation failed with retryable error: "+e.t0);case 13:this.su.length>0&&this.Yo.$o(function(){return t.Tu()});case 14:case"end":return e.stop()}},e,this,[[1,8]])})),function(){return n.apply(this,arguments)})},{key:"Iu",value:function(e){var t=this,n=this.iu.then(function(){return t.uu=!0,e().catch(function(e){t.au=e,t.uu=!1;var n=function(e){var t=e.message||"";return e.stack&&(t=e.stack.includes(e.message)?e.stack:e.message+"\n"+e.stack),t}(e);throw dl("INTERNAL UNHANDLED ERROR: ",n),e}).then(function(e){return t.uu=!1,e})});return this.iu=n,n}},{key:"enqueueAfterDelay",value:function(e,t,n){var r=this;this.Pu(),this.lu.indexOf(e)>-1&&(t=0);var i=Zv.createAndSchedule(this,e,t,n,function(e){return r.Eu(e)});return this._u.push(i),i}},{key:"Pu",value:function(){this.au&&gl()}},{key:"verifyOperationInProgress",value:function(){}},{key:"du",value:(t=E(O.mark(function e(){var t;return O.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=this.iu,e.next=3,t;case 3:if(t!==this.iu){e.next=0;break}case 4:case"end":return e.stop()}},e,this)})),function(){return t.apply(this,arguments)})},{key:"Au",value:function(e){var t,n=il(this._u);try{for(n.s();!(t=n.n()).done;){if(t.value.timerId===e)return!0}}catch(r){n.e(r)}finally{n.f()}return!1}},{key:"Ru",value:function(e){var t=this;return this.du().then(function(){t._u.sort(function(e,t){return e.targetTimeMs-t.targetTimeMs});var n,r=il(t._u);try{for(r.s();!(n=r.n()).done;){var i=n.value;if(i.skipDelay(),"all"!==e&&i.timerId===e)break}}catch(a){r.e(a)}finally{r.f()}return t.du()})}},{key:"Vu",value:function(e){this.lu.push(e)}},{key:"Eu",value:function(e){var t=this._u.indexOf(e);this._u.splice(t,1)}}]),e}(),Ny=function(e){y(n,e);var t=sl(n);function n(e,r,i,a){var s;return I(this,n),(s=t.call(this,e,r,i,a)).type="firestore",s._queue=new Ry,s._persistenceKey=(null==a?void 0:a.name)||"[DEFAULT]",s}return T(n,[{key:"_terminate",value:function(){return this._firestoreClient||Ly(this),this._firestoreClient.terminate()}}]),n}(xy);function Dy(e){return e._firestoreClient||Ly(e),e._firestoreClient.verifyNotTerminated(),e._firestoreClient}function Ly(e){var t,n,r,i=e._freezeSettings(),a=function(e,t,n,r){return new gh(e,t,n,r.host,r.ssl,r.experimentalForceLongPolling,r.experimentalAutoDetectLongPolling,by(r.experimentalLongPollingOptions),r.useFetchStreams)}(e._databaseId,(null===(t=e._app)||void 0===t?void 0:t.options.appId)||"",e._persistenceKey,i);e._firestoreClient=new uy(e._authCredentials,e._appCheckCredentials,e._queue,a),(null===(n=i.localCache)||void 0===n?void 0:n._offlineComponentProvider)&&(null===(r=i.localCache)||void 0===r?void 0:r._onlineComponentProvider)&&(e._firestoreClient._uninitializedComponentsProvider={_offlineKind:i.localCache.kind,_offline:i.localCache._offlineComponentProvider,_online:i.localCache._onlineComponentProvider})}var My=function(){function e(t){I(this,e),this._byteString=t}return T(e,[{key:"toBase64",value:function(){return this._byteString.toBase64()}},{key:"toUint8Array",value:function(){return this._byteString.toUint8Array()}},{key:"toString",value:function(){return"Bytes(base64: "+this.toBase64()+")"}},{key:"isEqual",value:function(e){return this._byteString.isEqual(e._byteString)}}],[{key:"fromBase64String",value:function(t){try{return new e(uh.fromBase64String(t))}
2catch(t){throw new wl(kl.INVALID_ARGUMENT,"Failed to construct data from Base64 string: "+t)}}},{key:"fromUint8Array",value:function(t){return new e(uh.fromUint8Array(t))}}]),e}(),Uy=function(){function e(){I(this,e);for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];for(var i=0;i<n.length;++i)if(0===n[i].length)throw new wl(kl.INVALID_ARGUMENT,"Invalid field name at argument $(i + 1). Field names must not be empty.");this._internalPath=new Fl(n)}return T(e,[{key:"isEqual",value:function(e){return this._internalPath.isEqual(e._internalPath)}}]),e}(),Fy=T(function e(t){I(this,e),this._methodName=t}),jy=function(){function e(t,n){if(I(this,e),!isFinite(t)||t<-90||t>90)throw new wl(kl.INVALID_ARGUMENT,"Latitude must be a number between -90 and 90, but was: "+t);if(!isFinite(n)||n<-180||n>180)throw new wl(kl.INVALID_ARGUMENT,"Longitude must be a number between -180 and 180, but was: "+n);this._lat=t,this._long=n}return T(e,[{key:"latitude",get:function(){return this._lat}},{key:"longitude",get:function(){return this._long}},{key:"isEqual",value:function(e){return this._lat===e._lat&&this._long===e._long}},{key:"toJSON",value:function(){return{latitude:this._lat,longitude:this._long}}},{key:"_compareTo",value:function(e){return Ol(this._lat,e._lat)||Ol(this._long,e._long)}}]),e}(),Vy=/^__.*__$/,By=function(){function e(t,n,r){I(this,e),this.data=t,this.fieldMask=n,this.fieldTransforms=r}return T(e,[{key:"toMutation",value:function(e,t){return null!==this.fieldMask?new ad(e,this.data,this.fieldMask,t,this.fieldTransforms):new id(e,this.data,t,this.fieldTransforms)}}]),e}(),qy=function(){function e(t,n,r){I(this,e),this.data=t,this.fieldMask=n,this.fieldTransforms=r}return T(e,[{key:"toMutation",value:function(e,t){return new ad(e,this.data,this.fieldMask,t,this.fieldTransforms)}}]),e}();function zy(e){switch(e){case 0:case 2:case 1:return!0;case 3:case 4:return!1;default:throw gl()}}var Hy=function(){function e(t,n,r,i,a,s){I(this,e),this.settings=t,this.databaseId=n,this.serializer=r,this.ignoreUndefinedProperties=i,void 0===a&&this.mu(),this.fieldTransforms=a||[],this.fieldMask=s||[]}return T(e,[{key:"path",get:function(){return this.settings.path}},{key:"fu",get:function(){return this.settings.fu}},{key:"gu",value:function(t){return new e(Object.assign(Object.assign({},this.settings),t),this.databaseId,this.serializer,this.ignoreUndefinedProperties,this.fieldTransforms,this.fieldMask)}},{key:"pu",value:function(e){var t,n=null===(t=this.path)||void 0===t?void 0:t.child(e),r=this.gu({path:n,yu:!1});return r.wu(e),r}},{key:"Su",value:function(e){var t,n=null===(t=this.path)||void 0===t?void 0:t.child(e),r=this.gu({path:n,yu:!1});return r.mu(),r}},{key:"bu",value:function(e){return this.gu({path:void 0,yu:!0})}},{key:"Du",value:function(e){return nm(e,this.settings.methodName,this.settings.Cu||!1,this.path,this.settings.vu)}},{key:"contains",value:function(e){return void 0!==this.fieldMask.find(function(t){return e.isPrefixOf(t)})||void 0!==this.fieldTransforms.find(function(t){return e.isPrefixOf(t.field)})}},{key:"mu",value:function(){if(this.path)for(var e=0;e<this.path.length;e++)this.wu(this.path.get(e))}},{key:"wu",value:function(e){if(0===e.length)throw this.Du("Document fields must not be empty");if(zy(this.fu)&&Vy.test(e))throw this.Du('Document fields cannot begin and end with "__"')}}]),e}(),Ky=function(){function e(t,n,r){I(this,e),this.databaseId=t,this.ignoreUndefinedProperties=n,this.serializer=r||nv(t)}return T(e,[{key:"Fu",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return new Hy({fu:e,methodName:t,vu:n,path:Fl.emptyPath(),yu:!1,Cu:r},this.databaseId,this.serializer,this.ignoreUndefinedProperties)}}]),e}();function Gy(e){var t=e._freezeSettings(),n=nv(e._databaseId);return new Ky(e._databaseId,!!t.ignoreUndefinedProperties,n)}function Wy(e,t,n,r,i){var a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{},s=e.Fu(a.merge||a.mergeFields?2:0,t,n,i);$y("Data must be an object, but it was:",s,r);var o,u,c=Xy(r,s);if(a.merge)o=new sh(s.fieldMask),u=s.fieldTransforms;else if(a.mergeFields){var l,h=[],f=il(a.mergeFields);try{for(f.s();!(l=f.n()).done;){var d=Zy(t,l.value,n);
2if(!s.contains(d))throw new wl(kl.INVALID_ARGUMENT,"Field '".concat(d,"' is specified in your field mask but missing from your input data."));rm(h,d)||h.push(d)}}catch(p){f.e(p)}finally{f.f()}o=new sh(h),u=s.fieldTransforms.filter(function(e){return o.covers(e.field)})}else o=null,u=s.fieldTransforms;return new By(new Nh(c),o,u)}var Qy=function(e){y(n,e);var t=sl(n);function n(){return I(this,n),t.apply(this,arguments)}return T(n,[{key:"_toFieldTransform",value:function(e){if(2!==e.fu)throw 1===e.fu?e.Du("".concat(this._methodName,"() can only appear at the top level of your update data")):e.Du("".concat(this._methodName,"() cannot be used with set() unless you pass {merge:true}"));return e.fieldMask.push(e.path),null}},{key:"isEqual",value:function(e){return e instanceof n}}]),n}(Fy);function Yy(e,t){if(Jy(e=ce(e)))return $y("Unsupported field value:",t,e),Xy(e,t);if(e instanceof Fy)return function(e,t){if(!zy(t.fu))throw t.Du("".concat(e._methodName,"() can only be used with update() and set()"));if(!t.path)throw t.Du("".concat(e._methodName,"() is not currently supported inside arrays"));var n=e._toFieldTransform(t);n&&t.fieldTransforms.push(n)}(e,t),null;if(void 0===e&&t.ignoreUndefinedProperties)return null;if(t.path&&t.fieldMask.push(t.path),e instanceof Array){if(t.settings.yu&&4!==t.fu)throw t.Du("Nested arrays are not supported");return function(e,t){var n,r=[],i=0,a=il(e);try{for(a.s();!(n=a.n()).done;){var s=Yy(n.value,t.bu(i));null==s&&(s={nullValue:"NULL_VALUE"}),r.push(s),i++}}catch(o){a.e(o)}finally{a.f()}return{arrayValue:{values:r}}}(e,t)}return function(e,t){if(null===(e=ce(e)))return{nullValue:"NULL_VALUE"};if("number"==typeof e)return Mf(t.serializer,e);if("boolean"==typeof e)return{booleanValue:e};if("string"==typeof e)return{stringValue:e};if(e instanceof Date){var n=Nl.fromDate(e);return{timestampValue:Fd(t.serializer,n)}}if(e instanceof Nl){var r=new Nl(e.seconds,1e3*Math.floor(e.nanoseconds/1e3));return{timestampValue:Fd(t.serializer,r)}}if(e instanceof jy)return{geoPointValue:{latitude:e.latitude,longitude:e.longitude}};if(e instanceof My)return{bytesValue:jd(t.serializer,e._byteString)};if(e instanceof Cy){var i=t.databaseId,a=e.firestore._databaseId;if(!a.isEqual(i))throw t.Du("Document reference is for database ".concat(a.projectId,"/").concat(a.database," but should be for database ").concat(i.projectId,"/").concat(i.database));return{referenceValue:qd(e.firestore._databaseId||t.databaseId,e._key.path)}}throw t.Du("Unsupported field value: ".concat(Iy(e)))}(e,t)}function Xy(e,t){var n={};return eh(e)?t.path&&t.path.length>0&&t.fieldMask.push(t.path):Zl(e,function(e,r){var i=Yy(r,t.pu(e));null!=i&&(n[e]=i)}),{mapValue:{fields:n}}}function Jy(e){return!("object"!=l(e)||null===e||e instanceof Array||e instanceof Date||e instanceof Nl||e instanceof jy||e instanceof My||e instanceof Cy||e instanceof Fy)}function $y(e,t,n){if(!Jy(n)||!function(e){return"object"==l(e)&&null!==e&&(Object.getPrototypeOf(e)===Object.prototype||null===Object.getPrototypeOf(e))}(n)){var r=Iy(n);throw"an object"===r?t.Du(e+" a custom object"):t.Du(e+" "+r)}}function Zy(e,t,n){if((t=ce(t))instanceof Uy)return t._internalPath;if("string"==typeof t)return tm(e,t);throw nm("Field path arguments must be of type string or ",e,!1,void 0,n)}var em=new RegExp("[~\\*/\\[\\]]");function tm(e,t,n){if(t.search(em)>=0)throw nm("Invalid field path (".concat(t,"). Paths must not contain '~', '*', '/', '[', or ']'"),e,!1,void 0,n);try{return R(Uy,x(t.split(".")))._internalPath}catch(r){throw nm("Invalid field path (".concat(t,"). Paths must not be empty, begin with '.', end with '.', or contain '..'"),e,!1,void 0,n)}}function nm(e,t,n,r,i){var a=r&&!r.isEmpty(),s=void 0!==i,o="Function ".concat(t,"() called with invalid data");n&&(o+=" (via `toFirestore()`)"),o+=". ";var u="";return(a||s)&&(u+=" (found",a&&(u+=" in field ".concat(r)),s&&(u+=" in document ".concat(i)),u+=")"),new wl(kl.INVALID_ARGUMENT,o+e+u)}function rm(e,t){return e.some(function(e){return e.isEqual(t)})}var im=function(){function e(t,n,r,i,a){I(this,e),this._firestore=t,this._userDataWriter=n,this._key=r,this._document=i,this._converter=a}return T(e,[{key:"id",get:function(){return this._key.path.lastSegment()}},{key:"ref",get:function(){return new Cy(this._firestore,this._converter,this._key)}},{key:"exists",value:function(){return null!==this._document}},{key:"data",value:function(){if(this._document){if(this._converter){var e=new am(this._firestore,this._userDataWriter,this._key,this._document,null);return this._converter.fromFirestore(e)}return this._userDataWriter.convertValue(this._document.data.value)}}},{key:"get",value:function(e){if(this._document){var t=this._document.data.field(sm("DocumentSnapshot.get",e));if(null!==t)return this._userDataWriter.convertValue(t)}}}]),e}(),am=function(e){y(n,e);var t=sl(n);function n(){return I(this,n),t.apply(this,arguments)}return T(n,[{key:"data",value:function(){return p(d(n.prototype),"data",this).call(this)}}]),n}(im);function sm(e,t){return"string"==typeof t?tm(e,t):t instanceof Uy?t._internalPath:t._delegate._internalPath}var om=function(){function e(){I(this,e)}
2return T(e,[{key:"convertValue",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"none";switch(kh(e)){case 0:return null;case 1:return e.booleanValue;case 2:return hh(e.integerValue||e.doubleValue);case 3:return this.convertTimestamp(e.timestampValue);case 4:return this.convertServerTimestamp(e,t);case 5:return e.stringValue;case 6:return this.convertBytes(fh(e.bytesValue));case 7:return this.convertReference(e.referenceValue);case 8:return this.convertGeoPoint(e.geoPointValue);case 9:return this.convertArray(e.arrayValue,t);case 10:return this.convertObject(e.mapValue,t);default:throw gl()}}},{key:"convertObject",value:function(e,t){return this.convertObjectMap(e.fields,t)}},{key:"convertObjectMap",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"none",r={};return Zl(e,function(e,i){r[e]=t.convertValue(i,n)}),r}},{key:"convertGeoPoint",value:function(e){return new jy(hh(e.latitude),hh(e.longitude))}},{key:"convertArray",value:function(e,t){var n=this;return(e.values||[]).map(function(e){return n.convertValue(e,t)})}},{key:"convertServerTimestamp",value:function(e,t){switch(t){case"previous":var n=ph(e);return null==n?null:this.convertValue(n,t);case"estimate":return this.convertTimestamp(vh(e));default:return null}}},{key:"convertTimestamp",value:function(e){var t=lh(e);return new Nl(t.seconds,t.nanos)}},{key:"convertDocumentKey",value:function(e,t){var n=Ml.fromString(e);yl(up(n));var r=new yh(n.get(1),n.get(3)),i=new jl(n.popFirst(5));return r.isEqual(t)||dl("Document ".concat(i," contains a document reference within a different database (").concat(r.projectId,"/").concat(r.database,") which is not supported. It will be treated as a reference in the current database (").concat(t.projectId,"/").concat(t.database,") instead.")),i}}]),e}();var um=function(){function e(t,n){I(this,e),this.hasPendingWrites=t,this.fromCache=n}return T(e,[{key:"isEqual",value:function(e){return this.hasPendingWrites===e.hasPendingWrites&&this.fromCache===e.fromCache}}]),e}(),cm=function(e){y(n,e);var t=sl(n);function n(e,r,i,a,s,o){var u;return I(this,n),(u=t.call(this,e,r,i,a,o))._firestore=e,u._firestoreImpl=e,u.metadata=s,u}return T(n,[{key:"exists",value:function(){return p(d(n.prototype),"exists",this).call(this)}},{key:"data",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this._document){if(this._converter){var t=new lm(this._firestore,this._userDataWriter,this._key,this._document,this.metadata,null);return this._converter.fromFirestore(t,e)}return this._userDataWriter.convertValue(this._document.data.value,e.serverTimestamps)}}},{key:"get",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this._document){var n=this._document.data.field(sm("DocumentSnapshot.get",e));if(null!==n)return this._userDataWriter.convertValue(n,t.serverTimestamps)}}}]),n}(im),lm=function(e){y(n,e);var t=sl(n);function n(){return I(this,n),t.apply(this,arguments)}return T(n,[{key:"data",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return p(d(n.prototype),"data",this).call(this,e)}}]),n}(cm);function hm(e){e=Sy(e,Cy);var t=Sy(e.firestore,Ny);return function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=new bl;return e.asyncQueue.enqueueAndForget(E(O.mark(function i(){return O.wrap(function(i){for(;;)switch(i.prev=i.next){case 0:return i.t0=function(e,t,n,r,i){var a=new oy({next:function(a){t.enqueueAndForget(function(){return lg(e,s)});var o=a.docs.has(n);!o&&a.fromCache?i.reject(new wl(kl.UNAVAILABLE,"Failed to get document because the client is offline.")):o&&a.fromCache&&r&&"server"===r.source?i.reject(new wl(kl.UNAVAILABLE,'Failed to get document from server. (However, this document does exist in the local cache. Run again without setting source to "server" to retrieve the cached document.)')):i.resolve(a)},error:function(e){return i.reject(e)}}),s=new vg(lf(n.path),a,{includeMetadataChanges:!0,ra:!0});return ug(e,s)},i.next=3,ky(e);case 3:return i.t1=i.sent,i.t2=e.asyncQueue,i.t3=t,i.t4=n,i.t5=r,i.abrupt("return",(0,i.t0)(i.t1,i.t2,i.t3,i.t4,i.t5));case 9:case"end":return i.stop()}},i)}))),r.promise}(Dy(t),e._key).then(function(n){return function(e,t,n){var r=n.docs.get(t._key),i=new fm(e);return new cm(e,i,t._key,r,new um(n.hasPendingWrites,n.fromCache),t.converter)}(t,e,n)})}var fm=function(e){y(n,e);var t=sl(n);function n(e){var r;return I(this,n),(r=t.call(this)).firestore=e,r}
2return T(n,[{key:"convertBytes",value:function(e){return new My(e)}},{key:"convertReference",value:function(e){var t=this.convertDocumentKey(e,this.firestore._databaseId);return new Cy(this.firestore,null,t)}}]),n}(om);function dm(e,t,n){e=Sy(e,Cy);var r=Sy(e.firestore,Ny),i=function(e,t,n){return e?n&&(n.merge||n.mergeFields)?e.toFirestore(t,n):e.toFirestore(t):t}(e.converter,t,n);return vm(r,[Wy(Gy(r),"setDoc",e._key,i,null!==e.converter,n).toMutation(e._key,Xf.none())])}function pm(e,t,n){e=Sy(e,Cy);for(var r,i=Sy(e.firestore,Ny),a=Gy(i),s=arguments.length,o=new Array(s>3?s-3:0),u=3;u<s;u++)o[u-3]=arguments[u];return r="string"==typeof(t=ce(t))||t instanceof Uy?function(e,t,n,r,i,a){var s=e.Fu(1,t,n),o=[Zy(t,r,n)],u=[i];if(a.length%2!=0)throw new wl(kl.INVALID_ARGUMENT,"Function ".concat(t,"() needs to be called with an even number of arguments that alternate between field names and values."));for(var c=0;c<a.length;c+=2)o.push(Zy(t,a[c])),u.push(a[c+1]);for(var l=[],h=Nh.empty(),f=o.length-1;f>=0;--f)if(!rm(l,o[f])){var d=o[f],p=u[f];p=ce(p);var v=s.Su(d);if(p instanceof Qy)l.push(d);else{var g=Yy(p,v);null!=g&&(l.push(d),h.set(d,g))}}var y=new sh(l);return new qy(h,y,s.fieldTransforms)}(a,"updateDoc",e._key,t,n,o):function(e,t,n,r){var i=e.Fu(1,t,n);$y("Data must be an object, but it was:",i,r);var a=[],s=Nh.empty();Zl(r,function(e,r){var o=tm(t,e,n);r=ce(r);var u=i.Su(o);if(r instanceof Qy)a.push(o);else{var c=Yy(r,u);null!=c&&(a.push(o),s.set(o,c))}});var o=new sh(a);return new qy(s,o,i.fieldTransforms)}(a,"updateDoc",e._key,t),vm(i,[r.toMutation(e._key,Xf.exists(!0))])}function vm(e,t){return function(e,t){var n=new bl;return e.asyncQueue.enqueueAndForget(E(O.mark(function r(){return O.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return r.t0=Dg,r.next=3,my(e);case 3:return r.t1=r.sent,r.t2=t,r.t3=n,r.abrupt("return",(0,r.t0)(r.t1,r.t2,r.t3));case 7:case"end":return r.stop()}},r)}))),n.promise}(Dy(e),t)}!function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];!function(e){cl=e}(ot),tt(new fe("firestore",function(e,n){var r=n.instanceIdentifier,i=n.options,a=e.getProvider("app").getImmediate(),s=new Ny(new Il(e.getProvider("auth-internal")),new Al(e.getProvider("app-check-internal")),function(e,t){if(!Object.prototype.hasOwnProperty.apply(e.options,["projectId"]))throw new wl(kl.INVALID_ARGUMENT,'"projectId" not provided in firebase.initializeApp.');return new yh(e.options.projectId,t)}(a,r),a);return i=Object.assign({useFetchStreams:t},i),s._setSettings(i),s},"PUBLIC").setMultipleInstances(!0)),lt(ol,"4.6.3",e),lt(ol,"4.6.3","esm2017")}();class gm{constructor(e){if(this.config=e,this.authObjectInitialized=!1,this.isUserDeletionInProgress=!1,this.isVerificationSignOutInProgress=!1,this.updateUserDisplayName=(e,t)=>f(this,void 0,void 0,function*(){return this.handleResponse(()=>f(this,void 0,void 0,function*(){return e.displayName!==t?function(e,t){return Ri.apply(this,arguments)}(e,{displayName:t}):{}}))}),this.signUp=({email:e="",password:t,attributes:n})=>f(this,void 0,void 0,function*(){let r=null;try{return r=yield function(e,t,n){return Si.apply(this,arguments)}(this.auth,e,t),yield dm(Oy(this.userDataStore,this.config.userAttrCollectionName,r.user.uid),Object.assign({},n)),yield xi(r.user),yield this.updateUserDisplayName(r.user,(null==n?void 0:n.given_name)||""),Object.assign({success:!0},r)}catch(i){return r&&(yield this.deleteUser(r.user)),{success:!1,message:i.message,code:i.code}}}),this.signIn=e=>f(this,void 0,void 0,function*(){return this.handleResponse(()=>f(this,void 0,void 0,function*(){return this.getCurrentUser()&&(yield this.signOut(),"undefined"!=typeof window&&window.dispatchEvent(new CustomEvent(Su.onAuthStateChange))),Ti(this.auth,e.email,e.password)}))}),this.federatedSignIn=({provider:e,userAttributes:t})=>f(this,void 0,void 0,function*(){return this.handleResponse(()=>f(this,void 0,void 0,function*(){const n=this.getAuthProvider(e),r=yield function(e,t,n){return xa.apply(this,arguments)}(this.auth,n),i=Bi(r);return(null==i?void 0:i.isNewUser)&&(yield dm(Oy(this.userDataStore,this.config.userAttrCollectionName,r.user.uid),null!=t?t:{})),r}))}),this.signOut=()=>f(this,void 0,void 0,function*(){return this.handleResponse(()=>f(this,void 0,void 0,function*(){return ce(this.auth).signOut()}))}),this.getUserProvidersId=e=>e.providerData.map(e=>e.providerId),this.reauthenticateCurrentUser=e=>f(this,void 0,void 0,function*(){const t=this.getCurrentUser();return t?this.handleResponse(()=>f(this,void 0,void 0,function*(){const n=this.getUserProvider(t);if(n===Ot){if(e.password)return this.reauthenticateWithPassword(t,e.password||"");throw new Error("Missing password parameter")}
2return this.reauthenticateExternalProvider(t,n)})):{success:!1,code:"auth-custom/reauthentication-impossible"}}),this.getCurrentUser=()=>this.authObjectInitialized?this.auth.currentUser:void 0,this.deleteUser=e=>f(this,void 0,void 0,function*(){const t=()=>{this.isUserDeletionInProgress=!1};return this.handleResponse(()=>f(this,void 0,void 0,function*(){var t;this.isUserDeletionInProgress=!0,yield(t=Oy(this.userDataStore,this.config.userAttrCollectionName,e.uid),vm(Sy(t.firestore,Ny),[new hd(t._key,Xf.none())])),yield e.delete()}),t,t)}),this.reloadUser=()=>f(this,void 0,void 0,function*(){const e=this.getCurrentUser();yield null==e?void 0:e.reload()}),this.confirmSignUp=({verificationCode:e})=>f(this,void 0,void 0,function*(){const t=()=>{this.isVerificationSignOutInProgress=!1};return this.handleResponse(()=>f(this,void 0,void 0,function*(){yield Ei(this.auth,e);const t=this.getCurrentUser();if((null==t?void 0:t.uid)&&(yield pm(Oy(this.userDataStore,this.config.userAttrCollectionName,t.uid),{updatedAt:(new Date).toISOString()})),"true"==={}.GATSBY_FIREBASE_AUTH_USER_STATUS_CHECK)return this.isVerificationSignOutInProgress=!0,void(yield this.signOut());yield this.reloadUser(),"undefined"!=typeof window&&window.dispatchEvent(new CustomEvent(Su.onAuthStateChange,{detail:{user:this.getCurrentUser()}}))}),t,t)}),this.authStateChangedObserver=e=>{const{customSignInEvent:t}=e||{};var n,r,i,a;n=this.auth,r=e=>{this.authObjectInitialized=!0,"undefined"!=typeof window&&window.dispatchEvent(new CustomEvent(Su.onAuthStateChange,{detail:{user:e,suppressUserAccessValidation:this.isUserDeletionInProgress||this.isVerificationSignOutInProgress}})),(null==e?void 0:e.emailVerified)&&"function"==typeof t&&t()},ce(n).onAuthStateChanged(r,i,a)},this.forgotPassword=e=>f(this,void 0,void 0,function*(){return this.handleResponse(()=>f(this,void 0,void 0,function*(){if(e.userIdentifier.type===xu.Email)return function(e,t,n){return bi.apply(this,arguments)}(this.auth,e.userIdentifier.value);throw new Error("Invalid user identifier type")}))}),this.resetPassword=e=>f(this,void 0,void 0,function*(){return this.handleResponse(()=>f(this,void 0,void 0,function*(){return function(e,t,n){return _i.apply(this,arguments)}(this.auth,e.oobCode,e.newPassword)}))}),this.getUserAttributes=()=>f(this,void 0,void 0,function*(){return this.handleResponse(()=>f(this,void 0,void 0,function*(){const e=this.getCurrentUser();return{attributes:(yield hm(Oy(this.userDataStore,this.config.userAttrCollectionName,(null==e?void 0:e.uid)||""))).data()}}))}),this.getCurrentUserStatus=()=>f(this,void 0,void 0,function*(){return this.handleResponse(()=>f(this,void 0,void 0,function*(){var e;const t=this.getCurrentUser();if(!t)throw new Error("No user is currently signed in");return{status:null===(e=(yield hm(Oy(this.userDataStore,this.config.userAttrCollectionName,t.uid))).data())||void 0===e?void 0:e.status}}))}),this.setUserAttributes=e=>f(this,void 0,void 0,function*(){return this.handleResponse(()=>f(this,void 0,void 0,function*(){const t=this.getCurrentUser();yield pm(Oy(this.userDataStore,this.config.userAttrCollectionName,(null==t?void 0:t.uid)||""),e)}))}),this.changePassword=e=>f(this,void 0,void 0,function*(){return this.handleResponse(()=>f(this,void 0,void 0,function*(){const{user:t,password:n,currentPassword:r}=e;yield this.reauthenticateWithPassword(t,r),yield Ni(t,n)}))}),this.resendSignUp=()=>f(this,void 0,void 0,function*(){return this.handleResponse(()=>f(this,void 0,void 0,function*(){const e=this.getCurrentUser();if(!e)throw new Error("Missing user data");return xi(e)}))}),this.getAvailableSocialSignIn=()=>({[Tu.Facebook]:Boolean(this.config.hasFacebookSignIn),[Tu.Google]:Boolean(this.config.hasGoogleSignIn)}),this.getRememberMeConfig=()=>this.config.rememberMeConfig||{show:!1,defaultValue:!1},this.setAuthStatePersistence=e=>f(this,void 0,void 0,function*(){return this.handleResponse(()=>f(this,void 0,void 0,function*(){const t=e?ma:Wi;var n,r;yield(n=this.auth,r=t,ce(n).setPersistence(r))}))}),this.changeEmail=(e,t)=>this.handleResponse(()=>f(this,void 0,void 0,function*(){return function(e,t,n){return Ci.apply(this,arguments)}(e,t)})),this.verifyCodeForEmailChange=({verificationCode:e})=>f(this,void 0,void 0,function*(){return this.handleResponse(()=>f(this,void 0,void 0,function*(){yield Ei(this.auth,e),yield this.signOut()}))}),this.getUserProvider=e=>{const t=new Set(this.getUserProvidersId(e));if(t.has(Ot))return Ot;if(t.has(Ct))return Tu.Facebook;if(t.has(Pt))return Tu.Google;throw Error(`Unknown user provider: ${JSON.stringify(t)}`)},this.reauthenticateWithPassword=(e,t)=>function(e,t){return yi.apply(this,arguments)}
2(e,Zr.credential(e.email||"",t)),this.reauthenticateExternalProvider=(e,t)=>function(e,t,n){return Aa.apply(this,arguments)}(e,this.getAuthProvider(t)),this.handleResponse=(e,t,n)=>f(this,void 0,void 0,function*(){try{const t=yield e();return null==n||n(),Object.assign(Object.assign({},t),{success:!0})}catch(r){return null==t||t(),Object.assign(Object.assign({},r),{success:!1})}}),this.getAuthProvider=e=>{switch(e){case Tu.Google:return new ri;case Tu.Facebook:return new ni;default:throw Error(`No provider with name: ${e}`)}},this.app=ut(this.config.firebaseOptions),this.auth=bs(this.app),this.userDataStore=function(e,t,n){n||(n="(default)");var r=nt(e,"firestore");if(r.isInitialized(n)){var i=r.getImmediate({identifier:n});if(te(r.getOptions(n),t))return i;throw new wl(kl.FAILED_PRECONDITION,"initializeFirestore() has already been called with different options. To avoid this error, call initializeFirestore() with the same options as when it was originally called, or call getFirestore() to return the already initialized instance.")}if(void 0!==t.cacheSizeBytes&&void 0!==t.localCache)throw new wl(kl.INVALID_ARGUMENT,"cache and cacheSizeBytes cannot be specified at the same time as cacheSizeBytes willbe deprecated. Instead, specify the cache size in the cache object");if(void 0!==t.cacheSizeBytes&&-1!==t.cacheSizeBytes&&t.cacheSizeBytes<1048576)throw new wl(kl.INVALID_ARGUMENT,"cacheSizeBytes must be at least 1048576");return r.initialize({options:t,instanceIdentifier:n})}(this.app,{ignoreUndefinedProperties:!0}),"undefined"!=typeof window){const e={}.GATSBY_FIREBASE_RECAPTCHA_PUBLIC_KEY,t="true"==={}.FIREBASE_RECAPTCHA_USE_DEBUG_TOKEN,n={}.APP_CHECK_DEBUG_TOKEN_FROM_CI;e&&(n?window.FIREBASE_APPCHECK_DEBUG_TOKEN=n:t&&(window.FIREBASE_APPCHECK_DEBUG_TOKEN=!0),Vc(this.app,{provider:new Uc(e),isTokenAutoRefreshEnabled:!0}))}}}var ym=function(){this.__data__=[],this.size=0};var mm=function(e,t){return e===t||e!=e&&t!=t},km=mm;var wm=function(e,t){for(var n=e.length;n--;)if(km(e[n][0],t))return n;return-1},bm=wm,_m=Array.prototype.splice;var Em=wm;var Im=wm;var Sm=wm;var Tm=ym,xm=function(e){var t=this.__data__,n=bm(t,e);return!(n<0)&&(n==t.length-1?t.pop():_m.call(t,n,1),--this.size,!0)},Am=function(e){var t=this.__data__,n=Em(t,e);return n<0?void 0:t[n][1]},Cm=function(e){return Im(this.__data__,e)>-1},Pm=function(e,t){var n=this.__data__,r=Sm(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this};function Om(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}Om.prototype.clear=Tm,Om.prototype.delete=xm,Om.prototype.get=Am,Om.prototype.has=Cm,Om.prototype.set=Pm;var Rm=Om,Nm=Rm;var Dm=function(){this.__data__=new Nm,this.size=0};var Lm=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n};var Mm=function(e){return this.__data__.get(e)};var Um=function(e){return this.__data__.has(e)},Fm=vo(Object,"create"),jm=Fm;var Vm=function(){this.__data__=jm?jm(null):{},this.size=0};var Bm=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},qm=Fm,zm=Object.prototype.hasOwnProperty;var Hm=function(e){var t=this.__data__;if(qm){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return zm.call(t,e)?t[e]:void 0},Km=Fm,Gm=Object.prototype.hasOwnProperty;var Wm=Fm;var Qm=Vm,Ym=Bm,Xm=Hm,Jm=function(e){var t=this.__data__;return Km?void 0!==t[e]:Gm.call(t,e)},$m=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=Wm&&void 0===t?"__lodash_hash_undefined__":t,this};function Zm(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}Zm.prototype.clear=Qm,Zm.prototype.delete=Ym,Zm.prototype.get=Xm,Zm.prototype.has=Jm,Zm.prototype.set=$m;var ek=Zm,tk=Rm,nk=yo;var rk=function(e){var t=l(e);return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e};var ik=function(e,t){var n=e.__data__;return rk(t)?n["string"==typeof t?"string":"hash"]:n.map},ak=ik;var sk=ik;var ok=ik;var uk=ik;var ck=function(){this.size=0,this.__data__={hash:new ek,map:new(nk||tk),string:new ek}},lk=function(e){var t=ak(this,e).delete(e);return this.size-=t?1:0,t},hk=function(e){return sk(this,e).get(e)},fk=function(e){return ok(this,e).has(e)},dk=function(e,t){var n=uk(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this};function pk(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}pk.prototype.clear=ck,pk.prototype.delete=lk,pk.prototype.get=hk,pk.prototype.has=fk,pk.prototype.set=dk;var vk=pk,gk=Rm,yk=yo,mk=vk;var kk=Rm,wk=Dm,bk=Lm,_k=Mm,Ek=Um,Ik=function(e,t){var n=this.__data__;if(n instanceof gk){var r=n.__data__;if(!yk||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new mk(r)}return n.set(e,t),this.size=n.size,this};function Sk(e){var t=this.__data__=new kk(e);this.size=t.size}Sk.prototype.clear=wk,Sk.prototype.delete=bk,Sk.prototype.get=_k,Sk.prototype.has=Ek,Sk.prototype.set=Ik;var Tk=Sk;var xk=function(e,t){for(var n=-1,r=null==e?0:e.length;
vendor: 5,133 bytes, line 2
2++n<r&&!1!==t(e[n],n,e););return e},Ak=vo,Ck=function(){try{var e=Ak(Object,"defineProperty");return e({},"",{}),e}catch(t){}}();var Pk=function(e,t,n){"__proto__"==t&&Ck?Ck(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n},Ok=Pk,Rk=mm,Nk=Object.prototype.hasOwnProperty;var Dk=function(e,t,n){var r=e[t];Nk.call(e,t)&&Rk(r,n)&&(void 0!==n||t in e)||Ok(e,t,n)},Lk=Dk,Mk=Pk;var Uk=function(e,t,n,r){var i=!n;n||(n={});for(var a=-1,s=t.length;++a<s;){var o=t[a],u=r?r(n[o],e[o],o,n,e):void 0;void 0===u&&(u=e[o]),i?Mk(n,o,u):Lk(n,o,u)}return n};var Fk=/^(?:0|[1-9]\d*)$/;var jk=function(e,t){var n=l(e);return!!(t=null==t?9007199254740991:t)&&("number"==n||"symbol"!=n&&Fk.test(e))&&e>-1&&e%1==0&&e<t},Vk=function(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r},Bk=Go,qk=Wo,zk=$o.exports,Hk=jk,Kk=hu,Gk=Object.prototype.hasOwnProperty;var Wk=function(e,t){var n=qk(e),r=!n&&Bk(e),i=!n&&!r&&zk(e),a=!n&&!r&&!i&&Kk(e),s=n||r||i||a,o=s?Vk(e.length,String):[],u=o.length;for(var c in e)!t&&!Gk.call(e,c)||s&&("length"==c||i&&("offset"==c||"parent"==c)||a&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||Hk(c,u))||o.push(c);return o},Qk=Wk,Yk=Cs,Xk=Jo;var Jk=function(e){return Xk(e)?Qk(e):Yk(e)},$k=Uk,Zk=Jk;var ew=function(e,t){return e&&$k(t,Zk(t),e)};var tw=Gs,nw=Es,rw=function(e){var t=[];if(null!=e)for(var n in Object(e))t.push(n);return t},iw=Object.prototype.hasOwnProperty;var aw=Wk,sw=function(e){if(!tw(e))return rw(e);var t=nw(e),n=[];for(var r in e)("constructor"!=r||!t&&iw.call(e,r))&&n.push(r);return n},ow=Jo;var uw=function(e){return ow(e)?aw(e,!0):sw(e)},cw=Uk,lw=uw;var hw=function(e,t){return e&&cw(t,lw(t),e)},fw={exports:{}};!function(e,t){var n=Ns,r=t&&!t.nodeType&&t,i=r&&e&&!e.nodeType&&e,a=i&&i.exports===r?n.Buffer:void 0,s=a?a.allocUnsafe:void 0;e.exports=function(e,t){if(t)return e.slice();var n=e.length,r=s?s(n):new e.constructor(n);return e.copy(r),r}}(fw,fw.exports);var dw=function(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n<r;)t[n]=e[n];return t};var pw=function(){return[]},vw=function(e,t){for(var n=-1,r=null==e?0:e.length,i=0,a=[];++n<r;){var s=e[n];t(s,n,e)&&(a[i++]=s)}return a},gw=pw,yw=Object.prototype.propertyIsEnumerable,mw=Object.getOwnPropertySymbols,kw=mw?function(e){return null==e?[]:(e=Object(e),vw(mw(e),function(t){return yw.call(e,t)}))}:gw,ww=Uk,bw=kw;var _w=function(e,t){return ww(e,bw(e),t)};var Ew=function(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e},Iw=Is(Object.getPrototypeOf,Object),Sw=Ew,Tw=Iw,xw=kw,Aw=pw,Cw=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)Sw(t,xw(e)),e=Tw(e);return t}:Aw,Pw=Uk,Ow=Cw;var Rw=function(e,t){return Pw(e,Ow(e),t)},Nw=Ew,Dw=Wo;var Lw=function(e,t,n){var r=t(e);return Dw(e)?r:Nw(r,n(e))},Mw=Lw,Uw=kw,Fw=Jk;var jw=function(e){return Mw(e,Fw,Uw)},Vw=Lw,Bw=Cw,qw=uw;var zw=function(e){return Vw(e,qw,Bw)},Hw=Object.prototype.hasOwnProperty;var Kw=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Hw.call(e,"index")&&(n.index=e.index,n.input=e.input),n},Gw=Ns.Uint8Array,Ww=Gw;var Qw=function(e){var t=new e.constructor(e.byteLength);return new Ww(t).set(new Ww(e)),t},Yw=Qw;var Xw=function(e,t){var n=t?Yw(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)},Jw=/\w*$/;var $w=function(e){var t=new e.constructor(e.source,Jw.exec(e));return t.lastIndex=e.lastIndex,t},Zw=Ds?Ds.prototype:void 0,eb=Zw?Zw.valueOf:void 0;var tb=Qw;var nb=Qw,rb=Xw,ib=$w,ab=function(e){return eb?Object(eb.call(e)):{}},sb=function(e,t){var n=t?tb(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)};var ob=function(e,t,n){var r=e.constructor;switch(t){case"[object ArrayBuffer]":return nb(e);case"[object Boolean]":case"[object Date]":return new r(+e);case"[object DataView]":return rb(e,n);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return sb(e,n);case"[object Map]":case"[object Set]":return new r;case"[object Number]":case"[object String]":return new r(e);case"[object RegExp]":return ib(e);case"[object Symbol]":return ab(e)}},ub=Gs,cb=Object.create,lb=function(){function e(){}return function(t){if(!ub(t))return{};if(cb)return cb(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}(),hb=Iw,fb=Es;var db=function(e){return"function"!=typeof e.constructor||fb(e)?{}:lb(hb(e))},pb=Mo,vb=Uo;var gb=function(e){return vb(e)&&"[object Map]"==pb(e)},yb=au,mb=su.exports,kb=mb&&mb.isMap,wb=kb?yb(kb):gb,bb=Mo,_b=Uo;var Eb=function(e){return _b(e)&&"[object Set]"==bb(e)},Ib=au,Sb=su.exports,Tb=Sb&&Sb.isSet,xb=Tb?Ib(Tb):Eb,Ab=Tk,Cb=xk,Pb=Dk,Ob=ew,Rb=hw,Nb=fw.exports,Db=dw,Lb=_w,Mb=Rw,Ub=jw,Fb=zw,jb=Mo,Vb=Kw,Bb=ob,qb=db,zb=Wo,Hb=$o.exports,Kb=wb,Gb=Gs,Wb=xb,Qb=Jk,Yb=uw,Xb="[object Arguments]",Jb="[object Function]",$b="[object Object]",Zb={};Zb[Xb]=Zb["[object Array]"]=Zb["[object ArrayBuffer]"]=Zb["[object DataView]"]=Zb["[object Boolean]"]=Zb["[object Date]"]=Zb["[object Float32Array]"]=Zb["[object Float64Array
2]"]=Zb["[object Int8Array]"]=Zb["[object Int16Array]"]=Zb["[object Int32Array]"]=Zb["[object Map]"]=Zb["[object Number]"]=Zb[$b]=Zb["[object RegExp]"]=Zb["[object Set]"]=Zb["[object String]"]=Zb["[object Symbol]"]=Zb["[object Uint8Array]"]=Zb["[object Uint8ClampedArray]"]=Zb["[object Uint16Array]"]=Zb["[object Uint32Array]"]=!0,Zb["[object Error]"]=Zb[Jb]=Zb["[object WeakMap]"]=!1;var e_=function e(t,n,r,i,a,s){var o,u=1&n,c=2&n,l=4&n;if(r&&(o=a?r(t,i,a,s):r(t)),void 0!==o)return o;if(!Gb(t))return t;var h=zb(t);if(h){if(o=Vb(t),!u)return Db(t,o)}else{var f=jb(t),d=f==Jb||"[object GeneratorFunction]"==f;if(Hb(t))return Nb(t,u);if(f==$b||f==Xb||d&&!a){if(o=c||d?{}:qb(t),!u)return c?Mb(t,Rb(o,t)):Lb(t,Ob(o,t))}else{if(!Zb[f])return a?t:{};o=Bb(t,f,u)}}s||(s=new Ab);var p=s.get(t);if(p)return p;s.set(t,o),Wb(t)?t.forEach(function(i){o.add(e(i,n,r,i,t,s))}):Kb(t)&&t.forEach(function(i,a){o.set(a,e(i,n,r,a,t,s))});var v=h?void 0:(l?c?Fb:Ub:c?Yb:Qb)(t);return Cb(v||t,function(i,a){v&&(i=t[a=i]),Pb(o,a,e(i,n,r,a,t,s))}),o},t_=e_;var n_=function(e){return t_(e,5)},r_=Ks,i_=Uo;var a_=function(e){return"symbol"==l(e)||i_(e)&&"[object Symbol]"==r_(e)},s_=Wo,o_=a_,u_=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,c_=/^\w*$/;var l_=function(e,t){if(s_(e))return!1;var n=l(e);return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!o_(e))||(c_.test(e)||!u_.test(e)||null!=t&&e in Object(t))},h_=vk;function f_(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var n=function n(){var r=arguments,i=t?t.apply(this,r):r[0],a=n.cache;if(a.has(i))return a.get(i);var s=e.apply(this,r);return n.cache=a.set(i,s)||a,s};return n.cache=new(f_.Cache||h_),n}f_.Cache=h_;var d_=f_;var p_=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,v_=/\\(\\)?/g,g_=function(e){var t=d_(e,function(e){return 500===n.size&&n.clear(),e}),n=t.cache;return t}(function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(p_,function(e,n,r,i){t.push(r?i.replace(v_,"$1"):n||e)}),t});var y_=function(e,t){for(var n=-1,r=null==e?0:e.length,i=Array(r);++n<r;)i[n]=t(e[n],n,e);return i},m_=Wo,k_=a_,w_=Ds?Ds.prototype:void 0,b_=w_?w_.toString:void 0;var __=function e(t){if("string"==typeof t)return t;if(m_(t))return y_(t,e)+"";if(k_(t))return b_?b_.call(t):"";var n=t+"";return"0"==n&&1/t==-1/0?"-0":n},E_=__;var I_=Wo,S_=l_,T_=g_,x_=function(e){return null==e?"":E_(e)};var A_=function(e,t){return I_(e)?e:S_(e,t)?[e]:T_(x_(e))},C_=a_;var P_=function(e){if("string"==typeof e||C_(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t},O_=A_,R_=P_;var N_=function(e,t){for(var n=0,r=(t=O_(t,e)).length;null!=e&&n<r;)e=e[R_(t[n++])];return n&&n==r?e:void 0};var D_=function(e,t,n){var r=null==e?void 0:N_(e,t);return void 0===r?n:r},L_=Object.prototype.hasOwnProperty;var M_=A_,U_=Go,F_=Wo,j_=jk,V_=Qo,B_=P_;var q_=function(e,t){return null!=e&&L_.call(e,t)},z_=function(e,t,n){for(var r=-1,i=(t=M_(t,e)).length,a=!1;++r<i;){var s=B_(t[r]);if(!(a=null!=e&&n(e,s)))break;e=e[s]}return a||++r!=i?a:!!(i=null==e?0:e.length)&&V_(i)&&j_(s,i)&&(F_(e)||U_(e))};var H_=function(e,t){return null!=e&&z_(e,t,q_)};var K_=vk,G_=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this},W_=function(e){return this.__data__.has(e)};function Q_(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new K_;++t<n;)this.add(e[t])}Q_.prototype.add=Q_.prototype.push=G_,Q_.prototype.has=W_;var Y_=Q_,X_=function(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1},J_=function(e,t){return e.has(t)};var $_=function(e,t,n,r,i,a){var s=1&n,o=e.length,u=t.length;if(o!=u&&!(s&&u>o))return!1;var c=a.get(e),l=a.get(t);if(c&&l)return c==t&&l==e;var h=-1,f=!0,d=2&n?new Y_:void 0;for(a.set(e,t),a.set(t,e);++h<o;){var p=e[h],v=t[h];if(r)var g=s?r(v,p,h,t,e,a):r(p,v,h,e,t,a);if(void 0!==g){if(g)continue;f=!1;break}if(d){if(!X_(t,function(e,t){if(!J_(d,t)&&(p===e||i(p,e,n,r,a)))return d.push(t)})){f=!1;break}}else if(p!==v&&!i(p,v,n,r,a)){f=!1;break}}return a.delete(e),a.delete(t),f};var Z_=Gw,eE=mm,tE=$_,nE=function(e){var t=-1,n=Array(e.size);return e.forEach(function(e,r){n[++t]=[r,e]}),n},rE=function(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n}
vendor: 1,880 bytes, line 2
2,iE=Ds?Ds.prototype:void 0,aE=iE?iE.valueOf:void 0;var sE=function(e,t,n,r,i,a,s){switch(n){case"[object DataView]":if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case"[object ArrayBuffer]":return!(e.byteLength!=t.byteLength||!a(new Z_(e),new Z_(t)));case"[object Boolean]":case"[object Date]":case"[object Number]":return eE(+e,+t);case"[object Error]":return e.name==t.name&&e.message==t.message;case"[object RegExp]":case"[object String]":return e==t+"";case"[object Map]":var o=nE;case"[object Set]":var u=1&r;if(o||(o=rE),e.size!=t.size&&!u)return!1;var c=s.get(e);if(c)return c==t;r|=2,s.set(e,t);var l=tE(o(e),o(t),r,i,a,s);return s.delete(e),l;case"[object Symbol]":if(aE)return aE.call(e)==aE.call(t)}return!1},oE=jw,uE=Object.prototype.hasOwnProperty;var cE=Tk,lE=$_,hE=sE,fE=function(e,t,n,r,i,a){var s=1&n,o=oE(e),u=o.length;if(u!=oE(t).length&&!s)return!1;for(var c=u;c--;){var l=o[c];if(!(s?l in t:uE.call(t,l)))return!1}var h=a.get(e),f=a.get(t);if(h&&f)return h==t&&f==e;var d=!0;a.set(e,t),a.set(t,e);for(var p=s;++c<u;){var v=e[l=o[c]],g=t[l];if(r)var y=s?r(g,v,l,t,e,a):r(v,g,l,e,t,a);if(!(void 0===y?v===g||i(v,g,n,r,a):y)){d=!1;break}p||(p="constructor"==l)}if(d&&!p){var m=e.constructor,k=t.constructor;m==k||!("constructor"in e)||!("constructor"in t)||"function"==typeof m&&m instanceof m&&"function"==typeof k&&k instanceof k||(d=!1)}return a.delete(e),a.delete(t),d},dE=Mo,pE=Wo,vE=$o.exports,gE=hu,yE="[object Arguments]",mE="[object Array]",kE="[object Object]",wE=Object.prototype.hasOwnProperty;var bE=function(e,t,n,r,i,a){var s=pE(e),o=pE(t),u=s?mE:dE(e),c=o?mE:dE(t),l=(u=u==yE?kE:u)==kE,h=(c=c==yE?kE:c)==kE,f=u==c;if(f&&vE(e)){if(!vE(t))return!1;s=!0,l=!1}if(f&&!l)return a||(a=new cE),s||gE(e)?lE(e,t,n,r,i,a):hE(e,t,u,n,r,i,a);if(!(1&n)){var d=l&&wE.call(e,"__wrapped__"),p=h&&wE.call(t,"__wrapped__");
2if(d||p){var v=d?e.value():e,g=p?t.value():t;return a||(a=new cE),i(v,g,n,r,a)}}return!!f&&(a||(a=new cE),fE(e,t,n,r,i,a))},_E=Uo;var EE=function e(t,n,r,i,a){return t===n||(null==t||null==n||!_E(t)&&!_E(n)?t!=t&&n!=n:bE(t,n,r,i,e,a))},IE=EE;var SE=function(e,t){return IE(e,t)};const TE={email:{id:"email",type:Eu.textbox,showInSignUp:!0,showInProfile:!0,showInSignIn:!0,isRequired:!0,regex:/^[a-z0-9.!#$%&â*+\/=?^_`{|}~-]+@[a-z0-9-]+(?:\.[a-z0-9-]+)+$/i,category:bu.UserDetails,showInEdit:!0,showInPreview:!0,isRequiredInEdit:!0,order:{signUp:1,signIn:1,profile:3}},currentPassword:{id:"currentPassword",type:Eu.password,showInSignUp:!1,showInProfile:!0,showInSignIn:!1,isRequired:!1,category:bu.Security,showInEdit:!0,showInPreview:!1,isRequiredInEdit:!0,requiredIf:["password"]},loginPassword:{id:"loginPassword",type:Eu.password,showInSignUp:!1,showInProfile:!0,showInSignIn:!0,isRequired:!0,category:bu.Security,showInEdit:!0,showInPreview:!1,isRequiredInEdit:!0,order:{signIn:2}},password:{id:"password",type:Eu.password,showInSignUp:!0,showInProfile:!0,isRequired:!0,showInSignIn:!1,regex:/^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[+=^$*.[\]{}()?\-â!@#%&/,><':;|_~`])\S{8,99}$/,category:bu.Security,showInEdit:!0,showInPreview:!0,isRequiredInEdit:!0,requiredIf:["currentPassword"],order:{signUp:2}},confirmPassword:{id:"confirmPassword",type:Eu.password,showInSignUp:!0,showInProfile:!1,isRequired:!0,showInSignIn:!1,category:bu.Security,sameAs:"password",showInEdit:!0,showInPreview:!1,isRequiredInEdit:!0,requiredIf:["password","currentPassword"],order:{signUp:3}},legals:{id:"legals",type:Eu.checkbox,options:[],requiredOptions:[],defaultValue:[],category:bu.Security,showInSignUp:!0,showInSignIn:!1,showInProfile:!0,showInEdit:!0,showInPreview:!1,isLegal:!0,order:{signUp:10}},"address.street_address":{id:"streetAddress",type:Eu.textbox,showInSignUp:!1,showInSignIn:!1,showInProfile:!0,isRequired:!1,category:bu.DeliveryAddresses,showInEdit:!0,showInPreview:!0,regex:/^.{1,85}$/,requiredIf:["address.locality","address.region","address.postal_code","address.country"]},"address.locality":{id:"locality",type:Eu.textbox,showInSignUp:!1,showInProfile:!1,showInSignIn:!1,isRequired:!1,category:bu.DeliveryAddresses,showInEdit:!1,showInPreview:!1,requiredIf:["address.street_address","address.region","address.postal_code","address.country"]},"address.region":{id:"region",type:Eu.textbox,showInSignUp:!1,showInProfile:!0,showInSignIn:!1,isRequired:!1,category:bu.DeliveryAddresses,showInEdit:!0,showInPreview:!0,regex:/^.{1,65}$/,requiredIf:["address.street_address","address.locality","address.postal_code","address.country"]},"address.postal_code":{id:"postalCode",type:Eu.textbox,showInSignUp:!1,showInProfile:!0,showInSignIn:!1,isRequired:!1,regex:/^.{1,12}$/,category:bu.DeliveryAddresses,showInEdit:!0,showInPreview:!0,requiredIf:["address.street_address","address.locality","address.region","address.country"]},"address.country":{id:"country",type:Eu.textbox,showInSignUp:!1,showInSignIn:!1,showInProfile:!0,isRequired:!1,category:bu.DeliveryAddresses,showInEdit:!0,showInPreview:!0,regex:/^.{1,65}$/,requiredIf:["address.street_address","address.locality","address.region","address.postal_code"]},name:{id:"name",type:Eu.textbox,showInSignUp:!1,showInProfile:!1,showInSignIn:!1,isRequired:!1,category:bu.UserDetails,showInEdit:!1,showInPreview:!1},given_name:{id:"givenName",type:Eu.textbox,showInSignUp:!1,showInProfile:!0,showInSignIn:!1,isRequired:!1,category:bu.UserDetails,showInEdit:!0,showInPreview:!0,regex:/^.{1,60}$/,order:{profile:1}},family_name:{id:"familyName",type:Eu.textbox,showInSignUp:!1,showInProfile:!0,showInSignIn:!1,isRequired:!1,category:bu.UserDetails,showInEdit:!0,showInPreview:!0,regex:/^.{1,60}$/,order:{profile:2}},birthdate:{id:"birthdate",type:Eu.date,showInSignUp:!1,showInSignIn:!1,showInProfile:!1,isRequired:!1,regex:/^([12]\d{3}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01]))$/,category:bu.UserDetails,showInEdit:!1,showInPreview:!0,maxValue:new Date},gender:{id:"gender",type:Eu.radio,options:[{key:"male",translationKey:"male"},{key:"female",translationKey:"female"},{key:"other",translationKey:"other"}],showInSignUp:!1,showInProfile:!1,showInSignIn:!1,isRequired:!1,category:bu.UserDetails,showInEdit:!0,showInPreview:!0},middle_name:{id:"middleName",type:Eu.textbox,category:bu.UserDetails,showInSignUp:!1,showInProfile:!1,isRequired:!1,showInSignIn:!1},nickname:{id:"nickname",type:Eu.textbox,category:bu.UserDetails,showInSignUp:!1,showInProfile:!1,isRequired:!1,showInSignIn:!1},phone_number:{id:"phoneNumber",type:Eu.textbox,showInSignUp:!1,showInProfile:!0,isRequired:!1,category:bu.UserDetails,showInEdit:!0,showInSignIn:!1,showInPreview:!0,customValidator:(e,t,n
2)=>{var r,i;const a=!((null===(r=e.value)||void 0===r?void 0:r.length)>0)||(0,s.g)((null===(i=e.value)||void 0===i?void 0:i.toString())||"");return{valid:a,message:a?null:n.translate("phone_numberRegexErrorMessage")}},order:{profile:4}},preferred_username:{id:"preferredUsername",type:Eu.textbox,category:bu.UserDetails,showInSignUp:!1,showInProfile:!1,showInSignIn:!1,isRequired:!1},website:{id:"website",type:Eu.textbox,showInSignUp:!1,showInProfile:!1,isRequired:!1,showInSignIn:!1,category:bu.UserDetails,showInEdit:!1,showInPreview:!1},deleteAccountStatement:{id:"deleteAccountStatement",type:Eu.checkbox,showInSignUp:!1,showInProfile:!0,showInSignIn:!1,isRequired:!0,category:bu.Security,showInEdit:!0,showInPreview:!1,isRequiredInEdit:!0,defaultValue:[],requiredOptions:["agreement"],options:[{key:"agreement",translationKey:"confirmAccountDelete",hideCheckbox:!1}]}},xE={validationNotConfigured:"No validation method configured for {1} field ",sameAsNeedsReferrer:"When using sameAs parameter you must pass also referenced field for validation",defaultErrorMessage:"An error occurred. Please try again.",requiredErrorMessage:"{1} is required.",notSameErrorMessage:"{2} and {1} do not match.",regexErrorMessage:"Please enter a valid {1}.",emailRequiredErrorMessage:"Email is required.",emailRegexErrorMessage:"Please enter a valid email address.",passwordRequiredErrorMessage:"Password is required.",passwordRegexErrorMessage:"Password must have at least 8 characters and contain uppercase letters, lowercase letters, numbers and special characters.",deleteAccountStatementRequiredErrorMessage:"Please fill out all required fields.",currentPasswordRequiredErrorMessage:"Password is required.",confirmPasswordRequiredErrorMessage:"Confirm password is required.",confirmPasswordNotSameErrorMessage:"Password and Confirm password do not match.",phone_numberRegexErrorMessage:"Phone number must start with a plus sign, followed by a number. Do not use spaces or any other characters.",legalsRequiredErrorMessage:"All required legal fields must be accepted.",maxDateErrorMessage:"The selected date is after the allowed date.",birthdateMaxDateErrorMessage:"Please be sure to use your real birthday.",minDateErrorMessage:"The selected date is before the allowed date.",birthdateMinDateErrorMessage:"Please be sure to use your real birthday.",email:"Email",emailProfile:"Email",password:"Password",passwordProfile:"New password",currentPasswordProfile:"Old password",loginPasswordProfile:"Password",confirmPassword:"Confirm password",gender:"Gender",genderProfile:"Gender",male:"Male",maleProfile:"Male",female:"Female",femaleProfile:"Female",other:"Other",otherProfile:"Other",family_name:"Last name",family_nameProfile:"Last name",given_name:"First name",given_nameProfile:"First name",website:"Website",websiteProfile:"Website",name:"Full name",nameProfile:"Full name",birthdate:"Birthday",birthdateProfile:"Birthday",phone_number:"Phone",nicknameProfile:"Nickname",preferred_usernameProfile:"Preferred username",phone_numberProfile:"Phone","address.region":"City","address.regionProfile":"City","address.postal_code":"Postal code","address.postal_codeProfile":"Postal code","address.country":"Country","address.countryProfile":"Country","address.birthdate":"Birthdate","address.birthdateProfile":"Birthdate","address.phone_number":"Phone number","address.phone_numberProfile":"Phone number","address.locality":"Locality","address.localityProfile":"Locality","address.street_address":"Street and Number","address.street_addressProfile":"Street and Number",legals:"Legal",termsTextDefault:"By creating an account you agree to {1}.",termsTextDefault_1:"Terms & Conditions",termsTextDefaultSocialSignIn:"You must agree with the {1} to continue. Please read them carefully.",termsTextDefaultSocialSignIn_1:"Terms & Conditions",termsTextDefaultHasChanged:"We're updating our {1}. Please read them carefully.",termsTextDefaultHasChanged_1:"Terms & Conditions",privacyPolicyLegal:"You also need to accept {1}.",privacyPolicyLegal_1:"Privacy Policy",privacyPolicyLegalSocialSignIn:"You must agree with the {1} to continue. Please read them carefully.",privacyPolicyLegalSocialSignIn_1:"Privacy Policy",privacyPolicyLegalHasChanged:"We're updating our {1}. Please read them carefully.",privacyPolicyLegalHasChanged_1:"Privacy Policy",confirmLdsTitle:"Privacy & Data",confirmLdsDescription:"To add or modify data please accept our:",confirmLdsCloseButton:"Not now",confirmLdsCloseSubmit:"Accept",continueUsing:"Or continue using",missingLdsError:"Before changing user data you need to agree with Terms & Conditions",linkResendPossibleIn:"Resend confirmation link possible in {1} seconds.",loginTitle:"Log in to {brandname} shop",loginDescription:"To log-in in to our {brandname} shop please enter email and password.",loginPassword:"Password",loginRememberMe:"Remember me",loginSignUpInformationSubtitle:"Don't have account yet?",loginSignUpInformationButton:"ð Sign up",loginForgotPasswordButton:"Forgot your password?",loginSubmitButton:"Log in",registerTitle:"Please register",registerSignInInformationButton:"ð Log in",registerSignInInformationSubtitle:"Already have account?",registerDescription:"To register to our {brandname} shop please enter all obligatory data.",registerSubmitButton:"Continue",registerConfirmTitle:"Confirm registration",registerConfirmButton:"Confirm registration",registerConfirmationCheckInfoEmail:"Please click on confirmation link in a message that was sent to you by email on:",registerConfirmationCheckInfoSMS:"Please provide a confirmation code that was sent to you by SMS on:",resendButton:"Resend link",registerCongratulationTitle:"Congratulations",registerCongratulationText:"The account has been successfully created and verified ð. Please log in ð.",registerCongratulationButton:"Log in",forgotPasswordTitle:"Forgot the password?",forgotPasswordFormSuccessInfoTitle:"Check your email inbox",forgotPasswordFormSuccessInfoMessage:"If an account associated with the provided email address exists, you will receive an email with further instructions on resetting your password. If you do not receive an email, please ensure you've entered the correct email address or register for a new account if you haven't already.",forgotPasswordProvideEmail:"No worries, please enter the associated email address and we will send you a confirmation code for the password change.",forgotPasswordProvidePassword:"Please provide a new password:",forgotPassword:"Password",forgotPasswordConfirmPassword:"Confirm password",forgotPasswordSignInInformationSubtitle:"
2ð Go back to",forgotPasswordSignInInformationButton:"Log in",forgotPasswordSendResetLinkButton:"Send reset password link",forgotPasswordConfirmButton:"Submit changes",forgotPasswordCongratulationText:"Your password has been successfully changed ð. Please log in ð.",forgotPasswordCongratulationTitle:"Congratulations",forgotPasswordCongratulationButton:"Log in",changeAttributeTitleEMAIL:"Confirm email",changeAttributeTitleSMS:"Confirm phone number",changeAttributeCheckInfoEMAIL:"Email has been changed. Please provide a confirmation code that was sent to you by email on: ",changeAttributeCheckInfoSMS:"Phone number has been changed. Please provide a confirmation code that was sent to you by SMS on: ",userAttributesSubmitTitle:"Account confirmation",userAttributesSubmitConfirmButton:"Confirm account",accountConfirmationTitle:"Account confirmation",accountConfirmationCheckInfoEmail:"Account was not confirmed. Please provide a confirmation code that was sent to you by email on:",accountConfirmationCheckInfoSMS:"Account was not confirmed. Please provide a confirmation code that was sent to you by SMS on:",accountConfirmationConfirmButton:"Confirm account",accountConfirmationCongratulationText:"The account has been successfully confirmed and verified ð. Please log in ð.",accountConfirmationCongratulationTitle:"Congratulations",accountConfirmationCongratulationCloseButton:"Log in",updatedLdsTitle:"Legals have been changed",updatedLdsDescription:"To add or modify data please accept our:",updatedLdsSubmitButton:"Accept",security:"Security",securityDeleteAccountSubmitButton:"Delete account",securityDeleteAccountCancelButton:"Cancel",confirmAccountDeleteProfile:"Yes, I'm sure. Please delete my account.",securityDeleteDescription:"Permanently delete your account and all of your content",securityDeleteTitle:"Delete your account",securityDeleteSuccessModalMessage:"Your account was successfully deleted",securityDeleteSuccessModalTitle:"Success",securityDeleteSuccessModalButton:"Close",securityPasswordSectionTitle:"Password",securityLegalsSectionTitle:"Consents",securityPasswordEditSuccessModalTitle:"Success",securityPasswordEditSuccessModalButton:"Accept",securityPasswordChangeSuccessModalMessage:"You password has been successfuly changed.",securityPasswordEditTitle:"Edit password",securityPasswordEditCancelButton:"Cancel",securityPasswordEditSubmitButton:"Change password",securityLegalsEditSubmitButton:"Save changes",securityPasswordCurrentPasswordTooltipLabel:"Label describing old password field",securityPasswordPasswordTooltipLabel:"Label describing new password field",securityPasswordCurrentPasswordTooltipText:'{"blocks":[{"text":"Your current password","type":"unstyled","depth":0,"inlineStyleRanges":[],"entityRanges":[],"data":{}}],"entityMap":{}}',securityPasswordPasswordTooltipText:'{"blocks":[{"text":"Your new password","type":"unstyled","depth":0,"inlineStyleRanges":[],"entityRanges":[],"data":{}}],"entityMap":{}}',userDetails:"User details",userDetailsChangeEmailSubmitButton:"Change email",userDetailsChangeEmailCancelButton:"Cancel",userDetailsChangeEmailDescription:"Change your email address",userDetailsChangeEmailTitle:"Change email address",userDetailsChangeEmailSuccessModalTitle:"Success",userDetailsChangeEmailSuccessModalMessage:"Verification mail has been sent to your new e-mail. Please check your inbox.",userDetailsChangeEmailSuccessModalButton:"Accept",userDetailsEditTitle:"Edit personal information",userDetailsEditSubmitButton:"Save changes",userDetailsEditButton:"Edit details",userDetailsEditCancelButton:"Cancel",userDetailsGiven_nameTooltipLabel:"Label describing first name field",userDetailsGiven_nameTooltipText:'{"blocks":[{"text":"Your first name","type":"unstyled","depth":0,"inlineStyleRanges":[],"entityRanges":[],"data":{}}],"entityMap":{}}',userDetailsFamily_nameTooltipLabel:"Label describing last name field",userDetailsFamily_nameTooltipText:'{"blocks":[{"text":"Your last name","type":"unstyled","depth":0,"inlineStyleRanges":[],"entityRanges":[],"data":{}}],"entityMap":{}}',userDetailsPhone_numberTooltipLabel:"Label describing phone number field",userDetailsPhone_numberTooltipText:'{"blocks":[{"text":"Your phone number","type":"unstyled","depth":0,"inlineStyleRanges":[],"entityRanges":[],"data":{}}],"entityMap":{}}',contactInformation:"Contact information",contactInformationEditTitle:"Edit contact information",contactInformationEditSubmitButton:"Save changes",deliveryAddresses:"Delivery addresses",deliveryAddressesEditTitle:"Edit contact information",deliveryAddressesEditSubmitButton:"Save",deliveryAddressesEditCancelButton:"Cancel",profileSecurityButton:"Change password",phoneNumberChangeSubmitCongratulationText:"Phone number has been changed successfully",federatedSignInFailure:"Social media login failed",editPasswordEqualErrorMessage:"Your new password cannot be the same as the current one.",multipassAPIConfigurationError:"Env is missing: ",multipassAuthReturnToMissing:"MultipassAuthReturnTo parameter in config is missing ",orderHistory:"Order history",additionalDeliveryAddresses:"Shipping addresses",addAdditionalDeliveryAddresses:"Add new address",addNewAddressEditTitle:"New address",addNewAddressEditSubmitButton:"Save New Address",addNewAddressEditCancelButton:"Cancel",additionalDeliveryAddressesEditTitle:"Address editing",additionalDeliveryAddressesEditCancelButton:"Cancel",additionalDeliveryAddressesEditSubmitButton:"Save",editAddress:"Edit",deleteAddress:"Delete",setDefaultAddress:"Set as Default",profileHeadingPrefix:"Hello",profileHeadingSuffix:"!",profileHeadingDescription:"Here you may review and edit all your details, addresses, security settings and orders.",verificationTimeout:"
2Verification timeout!",missingUserDataWhileEmailVerification:"Missing user data for verification, try to login to your account to resolve this issue",errorInformationBoxTitle:"Something went wrong!",userAlreadyVerified:"User already verified",canNotChangePasswordOfExternalProviderError:"Can't change password when user signed in with external provider",validationError:"Invalid params",deleteAddressTitle:"Delete address",deleteAddressText:"Are you sure you want to delete address? It will be deleted permanently.",deleteAddressConfirm:"Confirm",deleteAddressCancel:"Cancel",confirmLdsInfo:'Please accept to allow editing of your personal data; click "Not Now" to decline.',changeEmailEqualErrorMessage:"Your new email cannot be the same as the current one.",changeEmailMissingErrorMessage:"Can't change email",verifyAndChangeEmailCongratulationTitle:"Congratulations",verifyAndChangeEmailCongratulationText:"The new e-mail address has been verified ð. Please log in with your new mail ð.",verifyAndChangeEmailCongratulationButton:"Log in",recoverEmailCongratulationTitle:"Congratulations",recoverEmailCongratulationText:"Your e-mail address has been recovered ð. Please log in ð.",recoverEmailCongratulationButton:"Log in",deniedAccessUserRejected:"Your account has been rejected by the administrator. Please contact support for more information.",deniedAccessUserPending:"Your account is awaiting approval by the administrator. If you experience any issues, please contact support for more information.",postMigrationPasswordResetHeadline:"It looks like your account is locked.",postMigrationPasswordResetDescription:"Please reset your password for security reasons. After clicking the link, you'll be directed to a simple form to complete the process. If you have any trouble, donât hesitate to ask for help.",postMigrationPasswordResetButton:"Reset"},AE={"auth/email-already-in-use":"An account with the given email already exists","auth/expired-action-code":"This confirmation link is already expired","auth/invalid-action-code":"This confirmation link is invalid or already used","auth/invalid-credential":"Invalid credentials","invalid-argument":"Internal error, please try again later","auth/firebase-app-check-token-is-invalid":"There was an error processing the form, please try again","auth-custom/reauthentication-impossible":"Reauthentication impossible due to missing data","auth/requires-recent-login":"User reuthentication required","auth/too-many-requests":"Attempt limit exceeded, please try again later","auth/weak-password":"Password must have at least 6 characters","auth/wrong-password":"Your current password is incorrect","auth/user-mismatch":"Invalid credentials","auth/user-token-expired":"You session has expired, please sign in and try again","auth/api-key-not-valid-please-pass-a-valid-api-key":"The login and register are currently unavailable, please try again later"};function CE(e){return!e.success}class PE{constructor(e,t,n){this.translationService=e,this.ldsService=t,this.fieldsSetup=n,this.fields={},this.resetupLegalFields=e=>f(this,void 0,void 0,function*(){yield this.setupFields(e,this.fieldsSetup)}),this.setupFields=(e,t)=>f(this,void 0,void 0,function*(){const n=n_(TE),r=this.setupAdditionalSignUpFields(n,null==t?void 0:t.slice());this.fieldsReady=new Promise(t=>{(()=>{f(this,void 0,void 0,function*(){this.fields=yield this.setupLegalFields(r,e),t()})})()}),yield this.fieldsReady}),this.filterChangedAttributes=(e,t)=>Object.entries(e).reduce((e,[n,r])=>((!t||!SE(t[n],r)&&!(Au(t[n])&&Au(r)))&&(e[n]=r),e),{}),this.serializeFields=e=>Object.fromEntries(Object.entries(e).map(([e,t])=>t instanceof Date?[e,t.toISOString()]:[e,t])),this.createFormattedAddressAttributes=e=>{const{"address.street_address":t,"address.locality":n,"address.region":r,"address.postal_code":i,"address.country":a}=e,s=h(e,["address.street_address","address.locality","address.region","address.postal_code","address.country"]),o={street_address:t,locality:n,region:r,postal_code:i,country:a},u=this.areAnyFieldsExisting(...Object.values(o));return Object.assign(Object.assign({},s),u&&{address:o})},this.groupByCategory=e=>Object.entries(e).reduce((e,[t,n])=>{const{category:r}=n;return Object.assign(Object.assign({},e),r?{[r]:Object.assign(Object.assign({},e[r]||{}),{[t]:n})}:{})},{}),this.fillLegalsField=(e,t)=>{var n;const r=(null===(n=null==t?void 0:t.options)||void 0===n?void 0:n.filter(e=>e.isRequired).map(e=>e.key))||[];
2null==e||e.forEach(e=>{r.includes(e.businessId)||r.push(e.businessId)});const i=t.options?t.options.map(e=>Object.assign(Object.assign({},e),{isDisabled:e.isRequired})):[];return{legals:Object.assign(Object.assign({},t),{defaultValue:r,options:i})}},this.fillFieldsWithUserData=({profileFields:e,userFields:t,filterExistingFields:n})=>Object.entries(e).reduce((e,[r,i])=>n&&t&&!H_(t,r)?Object.assign({},e):Object.assign(Object.assign({},e),{[r]:Object.assign(Object.assign({},i),{defaultValue:D_(t,r)})}),{}),this.fillAdditionalDeliveryAddressesFields=(e,t=[])=>t.map(t=>this.fillFieldsWithUserData({profileFields:e,userFields:t,filterExistingFields:!0})).map(e=>Object.assign(Object.assign({},e),{id:Math.random().toString(36).substring(2,8)})),this.setFieldValidation=(e,t)=>f(this,void 0,void 0,function*(){yield this.fieldsReady,this.fields[e]=Object.assign(Object.assign({},this.fields[e]),t)}),this.getFields=()=>f(this,void 0,void 0,function*(){return yield this.fieldsReady,this.fields}),this.sortFieldsAscending=(e,t)=>(void 0===e?Number.MAX_SAFE_INTEGER:e)-(void 0===t?Number.MAX_SAFE_INTEGER:t),this.getSignUpFields=()=>f(this,void 0,void 0,function*(){return yield this.fieldsReady,Object.entries(this.fields).filter(([,{showInSignUp:e}])=>e).sort(([,{order:e}],[,{order:t}])=>this.sortFieldsAscending(null==e?void 0:e.signUp,null==t?void 0:t.signUp)).reduce(this.mapFieldsToShow(!1),Promise.resolve({}))}),this.getSignInFields=()=>f(this,void 0,void 0,function*(){return yield this.fieldsReady,Object.entries(this.fields).filter(([,{showInSignIn:e}])=>e).sort(([,{order:e}],[,{order:t}])=>this.sortFieldsAscending(null==e?void 0:e.signIn,null==t?void 0:t.signIn)).reduce(this.mapFieldsToShow(!1),Promise.resolve({}))}),this.getLegalsFields=(e,t,n)=>f(this,void 0,void 0,function*(){return yield this.fieldsReady,Object.entries(this.fields).filter(([,{isLegal:e}])=>e).reduce(this.mapFieldsToShow(e,t,n),Promise.resolve({}))}),this.getProfileFields=()=>f(this,void 0,void 0,function*(){yield this.fieldsReady;return Object.entries(this.fields).filter(([,{showInProfile:e}])=>e).sort(([,{order:e}],[,{order:t}])=>this.sortFieldsAscending(null==e?void 0:e.profile,null==t?void 0:t.profile)).reduce(this.mapFieldsToShow(!1,"Profile"),Promise.resolve({}))}),this.areAllFieldsFilled=(...e)=>e.every(e=>(null==e?void 0:e.length)>0),this.areAllFieldsExisting=(...e)=>e.every(e=>void 0!==e),this.areAnyFieldsFilled=(...e)=>e.some(e=>(null==e?void 0:e.length)>0),this.areAnyFieldsExisting=(...e)=>e.some(e=>void 0!==e),this.mapFieldsToShow=(e,t,n)=>(r,[i,a])=>f(this,void 0,void 0,function*(){const{translate:s,hasTranslationKey:o}=this.translationService,u=yield r,c=yield this.handleOptions(Object.assign(Object.assign({},a),{translationPostfix:t,isExternalProviderUser:e}));return u[i]=Object.assign(Object.assign({},a),{label:s(`${i}${t||""}`),description:o(`${i}Description${t||""}`)?s(`${i}Description${t||""}`):void 0,options:null==c?void 0:c.filter(e=>!n||e.isRequired)}),u}),this.setupAdditionalSignUpFields=(e,t)=>{const n=null==t?void 0:t.filter(e=>e.customField).reduce((e,t)=>(e[t.id]=t,e),{});return Object.entries(e).reduce((e,[r,i])=>{const a=null==t?void 0:t.find(e=>e.name===r);return Object.assign(Object.assign(Object.assign({},e),{[r]:Object.assign(Object.assign({},i),a||{})}),n)},{})},this.setupLegalFields=(e,t)=>f(this,void 0,void 0,function*(){var n,r;const i=yield this.ldsService.getLds(),a=(null===(n=e.legals.options)||void 0===n?void 0:n.slice())||[],s=(null===(r=e.legals.requiredOptions)||void 0===r?void 0:r.slice())||[];return i.forEach(({businessId:n,isRequired:r,hideCheckbox:i,translationKey:o,customLabel:u,socialTerm:c})=>{var l;const h=a.find(({key:e})=>e===n);h?(h.hideCheckbox=i,h.socialTerm=c):a.push({key:n,customLabel:u,translationKey:o||"termsTextDefault",hideCheckbox:i,socialTerm:c}),i&&!(null===(l=e.legals.defaultValue)||void 0===l?void 0:l.includes(n))&&e.legals.defaultValue.push(n);!((r||i)&&!s.includes(n))||!t&&c||s.push(n)}),Object.assign(Object.assign({},e),{legals:Object.assign(Object.assign({},e.legals),{options:a,requiredOptions:s})})}),this.handleOptions=({options:e,requiredOptions:t,type:n,translationPostfix:r,isExternalProviderUser:i}
2)=>f(this,void 0,void 0,function*(){if(!(null==e?void 0:e.length))return Promise.resolve(null);const a=e.filter(({socialTerm:e})=>i||!e),s={checkbox:this.handleCheckbox(a,t,r),radio:this.handleRadio(a,r),select:this.handleSelect(a,r)};return Promise.all(s[n]())}),this.handleRadio=(e,t)=>()=>{const{translate:n}=this.translationService;return e.map(({key:e,translationKey:r})=>f(this,void 0,void 0,function*(){return{key:e,label:n(`${r}${t||""}`)}}))},this.handleSelect=(e,t)=>()=>{const{translate:n}=this.translationService;return e.map(({key:e,translationKey:r})=>f(this,void 0,void 0,function*(){return{value:e,label:n(`${r}${t||""}`)}}))},this.handleCheckbox=(e,t,n)=>()=>{const{translate:r}=this.translationService;return e.map(({key:e,translationKey:i,hideCheckbox:a,customLabel:s})=>f(this,void 0,void 0,function*(){const o=`${i}${n||""}`,u=yield this.prepareActionArray({translationKey:o,businessId:e,customLabel:s});return{key:e,labels:u,label:r(o),hideCheckbox:a,isRequired:void 0!==t&&t.includes(e)}}))},this.splitLabelForLinks=e=>e.split(/(\[.*?\]|\.)\s*/g).filter(Boolean),this.prepareActionArray=({businessId:e,translationKey:t,customLabel:n})=>f(this,void 0,void 0,function*(){const{translate:r,getTranslationArray:i}=this.translationService,a=n?"custom":"default",s={custom:{splitter:this.splitLabelForLinks,regex:/\[.*?\]/},default:{splitter:i,regex:/\{([0-9]+)\}/}},{splitter:o,regex:u}=s[a],c=o(n||t),l=yield this.ldsService.getLdsByBusinessId(e),h=l?()=>{l.onLegalLinkClickAction&&l.onLegalLinkClickAction()}:null;return c.map(e=>{const i=e.match(u);return(null==i?void 0:i.length)?{value:n?i[0].slice(1,i[0].length-1):r(`${t}_${i[1]}`),onClick:h}:{value:e,onClick:null}})}),this.setupFields(!1,this.fieldsSetup)}}class OE{log(e,...t){console.log(e,t)}warn(e,...t){console.warn(e,t)}error(e,...t){console.error(e,t)}}class RE{constructor(e,t){this.loggerService=e,this.hasTranslationKey=e=>!!this.translations[e],this.translate=(e,t,...n)=>{let r=this.translations[e];return r?(null==n||n.forEach((e,t)=>{r=r.replace(`{${t+1}}`,e||"")}),r):t||e},this.getTranslationArray=e=>{const t=this.translations[e];return t?t.split(/(\{[0-9]+\})([a-zA-Z0-9 .,-_&()]+)/g).filter(e=>e.length):(this.loggerService.warn("Translation key not provided",e),[])},this.translations=Object.assign(Object.assign(Object.assign({},xE),AE),t||{})}}class NE{constructor(e,t,n,r){this.translationService=e,this.fieldsService=t,this.loggerService=n,this.fieldsSetup=r,this.defaultValidators={},this.resetupValidation=()=>this.setup(),this.setup=()=>f(this,void 0,void 0,function*(){this.validatorsReady=new Promise(e=>{(()=>{f(this,void 0,void 0,function*(){var t;this.defaultValidators=yield this.createDefaultValidation(),yield this.createValidation(null===(t=this.fieldsSetup)||void 0===t?void 0:t.slice()),e()})})()}),yield this.validatorsReady}),this.validate=(e,t)=>f(this,void 0,void 0,function*(){yield this.validatorsReady;const{translate:n}=this.translationService,r={};return Object.entries(e).forEach(([i,a])=>{const s=this.defaultValidators[i];s?r[i]=s({name:i,value:a,fields:e},t,this.translationService):this.loggerService.warn(n("validationNotConfigured",i))}),{valid:Object.values(r).every(({valid:e})=>e),validation:r}}),this.requiredValidator=({isRequired:e,isRequiredInEdit:t,requiredIf:n,type:r,requiredOptions:i},{name:a,value:s,fields:o},u)=>{const{translate:c}=this.translationService,l={textbox:this.stringRequiredValidator,date:this.stringRequiredValidator,datePicker:this.datePickerRequiredValidator,textarea:this.stringRequiredValidator,password:this.stringRequiredValidator,checkbox:this.checkboxRequiredValidator,radio:this.radioRequiredValidator,phone:this.stringRequiredValidator,select:this.selectRequiredValidator,infoBlock:this.infoBlockRequiredValidator},h=e&&!u||t&&u||(null==n?void 0:n.some(e=>{var t;return(null===(t=o[e])||void 0===t?void 0:t.length)>0}));return r!==Eu.checkbox||l[r.toString()](s,i)?h&&!l[r.toString()](s)?{valid:!1,message:c(`${a}RequiredErrorMessage`,c("requiredErrorMessage",void 0,c(a)))}:{valid:!0,message:null}:{valid:!1,message:c(`${a}RequiredErrorMessage`,c("requiredErrorMessage",void 0,c(a)))}},this.validator=(e,{name:t,value:n,fields:r},i)=>{var a,s;const{regex:o,sameAs:u,type:c,maxValue:l,minValue:h}=e,{translate:f}=this.translationService,d=this.requiredValidator(e,{name:t,value:n,fields:r},i);if(!d.valid)return d;const p={date:this.rangeValidator,datePicker:this.ageValidator},v=null===(a=p[c.toString()])||void 0===a?void 0:a.call(p,{min:h,max:l,name:t,val:n});if(null==v?void 0:v.error)return{valid:!1,message:v.message};if("string"==typeof n&&o&&(null==n?void 0:n.length)&&!(null===(s=n.match(o)
2)||void 0===s?void 0:s.length))return{valid:!1,message:f(`${t}RegexErrorMessage`,f("regexErrorMessage",void 0,f(t)))};if(u){const e=r[u];if(void 0===e)return this.loggerService.error(f("sameAsNeedsReferrer")),{valid:!0,message:null};const i=e===n;return{valid:i,message:i?null:f(`${t}${u}NotSameErrorMessage`,f("notSameErrorMessage",void 0,f(t),f(u)))}}return{valid:!0,message:null}},this.customValidator=(e,t,{name:n,value:r,fields:i},a)=>{const s=this.requiredValidator(t,{name:n,value:r,fields:i},a);return s.valid?e.bind(t,{name:n,value:r,fields:i},a,this.translationService)():s},this.createDefaultValidation=()=>f(this,void 0,void 0,function*(){const e=yield this.fieldsService.getFields();return Object.keys(e).reduce((t,n)=>{const{customValidator:r}=e[n];return Object.assign(Object.assign({},t),{[n]:"function"==typeof r?this.customValidator.bind(this,r,e[n]):this.validator.bind(this,e[n])})},{})}),this.stringRequiredValidator=e=>(null==e?void 0:e.length)>0,this.datePickerRequiredValidator=e=>"string"==typeof e?(null==e?void 0:e.length)>0:e&&e instanceof Date,this.radioRequiredValidator=e=>(null==e?void 0:e.length)>0,this.selectRequiredValidator=e=>"string"==typeof e?e.length>0:e.value.length>0,this.infoBlockRequiredValidator=()=>!0,this.rangeValidator=({val:e,max:t,min:n,name:r})=>{const{translate:i}=this.translationService;return t&&(0,o.A)(new Date(e),t)?{error:!0,message:i(`${r}MaxDateErrorMessage`,i("maxDateErrorMessage",void 0,i(r)))}:n&&(0,u.A)(new Date(e),n)?{error:!0,message:i(`${r}MinDateErrorMessage`,i("minDateErrorMessage",void 0,i(r)))}:{error:!1,message:null}},this.ageValidator=({val:e,name:t})=>{const{translate:n}=this.translationService,r=Number(n(`${t}MinimumAge`));if(Number.isNaN(r))return this.loggerService.warn(`Invalid minimum age translation for ${t}`),{error:!1,message:null};const i=new Date(e),a=(0,c.A)(new Date,r);return(0,o.A)(i,a)?{error:!0,message:n(`${t}MinimumAgeErrorMessage`,n("minDateErrorMessage",void 0,n(t)))}:{error:!1,message:null}},this.checkboxRequiredValidator=(e,t)=>(null==t?void 0:t.length)?null==t?void 0:t.every(t=>null==e?void 0:e.includes(t)):(null==e?void 0:e.length)>0,this.createValidation=e=>f(this,void 0,void 0,function*(){(null==e?void 0:e.length)&&(yield Promise.all(null==e?void 0:e.map(e=>f(this,void 0,void 0,function*(){if(e){const{name:t}=e,{customValidator:n}=e,r=h(e,["customValidator"]);this.fieldsService.setFieldValidation(t,r);const i=yield this.fieldsService.getFields();"function"==typeof n?this.defaultValidators[t]=n.bind(i[t]):this.defaultValidators[t].bind(i[t])}return!0}))))}),this.setup()}}class DE{constructor({userAuthService:e,ldsService:t,ecommerceService:n},a){this.signUp=e=>f(this,void 0,void 0,function*(){const{email:t,password:n}=e,r=h(e,["email","password"]),i=yield this.validate(Object.assign(Object.assign({},r),{email:t,password:n}));if(!i.valid)return this.loggerService.error(i),{success:!1,message:this.translationService.translate("validationError"),lastModified:(new Date).toISOString()};const a=Array.isArray(r.legals)?yield this.ldsService.createLdsFields(r.legals):[],s=this.fieldsService.serializeFields(r),o=this.cleanAttributes(s,!0,["confirmPassword","legals"]),u=this.fieldsService.createFormattedAddressAttributes(o),c=yield this.userAuthService.signUp({email:t,password:n,attributes:Object.assign(Object.assign({},u),{lds:a})});return window.localStorage.setItem(Su.onConfirmSignUp,"false"),this.formatServiceResult(c)}),this.signIn=e=>f(this,void 0,void 0,function*(){var{email:t}=e,n=h(e,["email"]);let r;if(this.ecommerceService&&this.ecommerceService.isMultipassEnabled()&&(r=yield this.ecommerceService.generateMultipassLink(t),CE(r))){const e=r.code?this.translate(`${r.code}`)+r.message:this.translate("defaultErrorMessage");return Object.assign(Object.assign({},r),{message:e})}const i=yield this.userAuthService.signIn(Object.assign(Object.assign({},n),{email:t}));return i.success?(this.ecommerceService&&r&&r.url&&this.ecommerceService.signIn(r.url),i):this.formatServiceResult(i)}),this.federatedSignIn=e=>f(this,void 0,void 0,function*(){const t=yield this.ldsService.getSocialLds();return this.userAuthService.federatedSignIn(Object.assign(Object.assign({},e),{userAttributes:{lds:t}}))}),this.dispatchEventIfLegalsUpdated=()=>f(this,void 0,void 0,function*(){var e,t;const n=yield this.userAuthService.getUserAttributes();CE(n)||(yield this.ldsService.dispatchEventIfLegalsUpdated(null!==(t=null===(e=n.attributes)||void 0===e?void 0:e.lds)&&void 0!==t?t:[],this.isExternalProviderUser()))}
2),this.getAcceptedLegals=()=>f(this,void 0,void 0,function*(){const e=yield this.userAuthService.getUserAttributes();return e.success&&e.attributes?this.ldsService.getAcceptedLegals(e.attributes):{}}),this.translate=(e,t,...n)=>this.translationService.translate(e,t,...n),this.signOut=()=>this.userAuthService.signOut(),this.getAvailableSocialSignIn=()=>this.userAuthService.getAvailableSocialSignIn(),this.getCurrentUser=()=>this.userAuthService.getCurrentUser(),this.getCurrentUserStatus=()=>this.userAuthService.getCurrentUserStatus(),this.deleteCurrentUser=e=>f(this,void 0,void 0,function*(){const t=yield this.userAuthService.reauthenticateCurrentUser(e);if(t.success&&t.user){const e=yield this.userAuthService.deleteUser(t.user);return e.success?e:this.formatServiceResult(e)}return this.formatServiceResult(t)}),this.getRememberMeConfig=()=>this.userAuthService.getRememberMeConfig(),this.confirmSignUp=e=>f(this,void 0,void 0,function*(){const t=yield this.userAuthService.confirmSignUp(e),n=CE(t),r=n&&(0,i.Gv)(t.message)&&[Lt.EXPIRED_OOB_CODE,Lt.INVALID_OOB_CODE].includes(t.message);return n||window.localStorage.setItem(Su.onConfirmSignUp,"true"),this.formatServiceResult(Object.assign(Object.assign({},t),{allowForAnotherResend:r}))}),this.verifyCodeForEmailChange=e=>f(this,void 0,void 0,function*(){const t=yield this.userAuthService.verifyCodeForEmailChange(e);return this.formatServiceResult(t)}),this.validate=(e,t=!1)=>this.validationService.validate(e,t),this.getSignUpFields=()=>
2this.fieldsService.getSignUpFields(),this.getSignInFields=()=>this.fieldsService.getSignInFields(),this.getProfileFields=()=>f(this,void 0,void 0,function*(){var e,t;const[n,r]=yield Promise.all([this.fieldsService.getProfileFields(),this.userAuthService.getUserAttributes()]);if(!r.success)return this.fieldsService.groupByCategory(n);const i=this.fieldsService.fillAdditionalDeliveryAddressesFields(n,null===(e=r.attributes)||void 0===e?void 0:e.deliveryAddresses),a=this.getCurrentUser(),s=this.fieldsService.fillFieldsWithUserData({profileFields:n,userFields:Object.assign(Object.assign({},r.attributes),{email:(null==a?void 0:a.email)||""})}),o=this.fieldsService.fillLegalsField((null===(t=r.attributes)||void 0===t?void 0:t.lds)||[],n.legals);return Object.assign(Object.assign({},this.fieldsService.groupByCategory(Object.assign(Object.assign({},s),o))),i&&{[bu.AdditionalDeliveryAddresses]:i})}),this.changePassword=e=>f(this,void 0,void 0,function*(){const t=this.getCurrentUser();if(t&&this.isPasswordProviderUser()){const{password:n,currentPassword:r}=e;if(n===r)return{success:!1,message:this.translationService.translate("editPasswordEqualErrorMessage")};const i=yield this.userAuthService.changePassword({user:t,password:n,currentPassword:r});return CE(i)?this.formatServiceResult(i):i}return{success:!1,message:this.translationService.translate("canNotChangePasswordOfExternalProviderError")}}),this.updateUserLegals=({legals:e},t)=>f(this,void 0,void 0,function*(){var n,r,i;if(!Array.isArray(e))return{success:!1,message:this.translationService.translate("validationError")};const a=yield this.ldsService.createLdsFields(e);if(t){const t=yield this.userAuthService.getUserAttributes();if(CE(t))return this.formatServiceResult(t);const s=null!==(i=null===(r=null===(n=t.attributes)||void 0===n?void 0:n.lds)||void 0===r?void 0:r.filter(t=>!e.includes(t.businessId)))&&void 0!==i?i:[];a.push(...s)}const s=yield this.userAuthService.setUserAttributes({lds:a,lastModified:(new Date).toISOString()});return this.formatServiceResult(s)}),this.setUserAttributes=e=>f(this,void 0,void 0,function*(){var t;const n=yield this.getUserProfileEditRights();if(!n.success)return n;if(n.success&&!n.canEditProfile)return{success:!1,message:this.translationService.translate("missingLdsError")};const i=yield this.validationService.validate(e,!0);if(!i.valid)return this.loggerService.error(i),{success:!1,message:this.translationService.translate("validationError")};const a=this.fieldsService.serializeFields(e),s=this.cleanAttributes(a,!1,["confirmPassword","password","currentPassword","email","legals"]),o=this.fieldsService.createFormattedAddressAttributes(s),u=yield this.userAuthService.getUserAttributes(),c=this.fieldsService.filterChangedAttributes(o,u.attributes);if((0,r.R)(c))return{success:!0};const l=yield this.userAuthService.setUserAttributes(Object.assign(Object.assign({},c),{deliveryAddresses:null===(t=null==c?void 0:c.deliveryAddresses)||void 0===t?void 0:t.filter(e=>[...e.address?Object.values(e.address):[]].some(e=>!Au(e))),lastModified:(new Date).toISOString()}));return l.success?this.shouldUpdateUserDisplayName(c)?this.updateUserDisplayName({preferredUsername:o.preferred_username,nickname:o.nickname,givenName:o.given_name}):{success:!0}:this.formatServiceResult(l)}),this.getUserProfileEditRights=()=>f(this,void 0,void 0,function*(){const e=yield this.userAuthService.getUserAttributes();if(e.success){const t=yield this.ldsService.getMissingLegalsForProfileEdit(e.attributes);return(null==t?void 0:t.length)?{success:!0,canEditProfile:!1}:{success:!0,canEditProfile:!0}}return this.formatServiceResult(e)}),this.getLegalsFields=(e,t)=>f(this,void 0,void 0,function*(){return this.fieldsService.getLegalsFields(this.isExternalProviderUser(),e,t)}),this.resendSignUp=()=>this.userAuthService.resendSignUp(),this.forgotPassword=e=>f(this,void 0,void 0,function*(){const t=yield this.userAuthService.forgotPassword(e);return this.formatServiceResult(t)}),this.resetPassword=e=>f(this,void 0,void 0,function*(){const t=yield this.userAuthService.resetPassword(e);return this.formatServiceResult(t)}),this.getLds=()=>this.ldsService.getLds(),this.getUserName=()=>{const e=this.userAuthService.getCurrentUser(),t=e?(null==e?void 0:e.displayName)||"":void 0;return{success:Boolean(e),userName:t}},this.isPasswordProviderUser=()=>{try{return this.isPasswordProviderLoggedUser()}catch(e){return!1}},this.isExternalProviderUser=()=>{try{return!this.isPasswordProviderLoggedUser()}catch(e){return!1}},this.getUserOrders=()=>f(this,void 0,void 0,function*(){if(!this.ecommerceService)return;const e=yield this.getProfileFields(),t=yield this.ecommerceService.getUserIdByEmail({clientEmail:e.security.email.defaultValue});return t.success&&t.id?this.ecommerceService.getUserData({clientId:t.id,scope:"orders"}):t}),this.setRememberMe=e=>f(this,void 0,void 0,function*(){return this.userAuthService.setAuthStatePersistence(e)}),this.createFormattedAddressAttributes=e=>this.fieldsService.createFormattedAddressAttributes(e),this.changeEmail=e=>f(this,void 0,void 0,function*(){var{newEmail:t}=e,n=h(e,["newEmail"]);const{email:r}=this.getCurrentUser()||{};if((0,i.z3)(r)||t===r)return{success:!1,message:this.translationService.translate((0,i.z3)(r)?"changeEmailMissingErrorMessage":"changeEmailEqualErrorMessage")};const a=yield this.userAuthService.reauthenticateCurrentUser(n);if(a.success&&a.user){const e=yield this.userAuthService.changeEmail(a.user,t);return e.success?e:this.formatServiceResult(e)}return this.formatServiceResult(a)}),this.customSignInEvent=()=>f(this,void 0,void 0,function*(){this.checkUserStatus()}),this.checkUserStatus=()=>{this.fieldsService.resetupLegalFields(this.isExternalProviderUser()),this.validationService.resetupValidation()},this.cleanAttributes=(e,t,n)=>Object.entries(e).reduce((e,[r,i])=>{const a=null!=i&&(!t||(null==i?void 0:i.length))&&!(null==n?void 0:n.includes(r));return Object.assign(Object.assign({},e),a?{[r]:i}:{})},{}),this.shouldUpdateUserDisplayName=e=>{const t=["preferred_username","nickname","given_name"];return Object.keys(e).some(e=>t.includes(e))},this.updateUserDisplayName=e=>f(this,void 0,void 0,function*(){let t;const n=this.getCurrentUser();if(n){const{preferredUsername:r,nickname:i,givenName:a}=e,s=r||i||a||"";if(t=yield this.userAuthService.updateUserDisplayName(n,s),t.success)return t}return{success:!1,message:this.getErrorMessage(t)}}),this.isPasswordProviderLoggedUser=()=>{const e=this.userAuthService.getCurrentUser();if(e){return this.userAuthService.getUserProvidersId(e).includes(Ot)}throw new Error("not logged")},this.getErrorMessage=e=>{const{code:t,message:n}=e;return t?this.translationService.translate(t,n):n};const{translations:s,fieldsSetup:o}=a||{};this.loggerService=new OE,this.translationService=new RE(this.loggerService,s),this.ldsService=new t.Class(t.params),n&&(this.ecommerceService=new n.Class(n.params)),this.fieldsService=new PE(this.translationService,this.ldsService,o),this.userAuthService=new e.Class(e.params),this.validationService=new NE(this.translationService,this.fieldsService,this.loggerService,o),this.checkUserStatus(),this.userAuthService.authStateChangedObserver({customSignInEvent:this.customSignInEvent})}formatServiceResult(e){return Object.assign(Object.assign({},e),{message:this.getErrorMessage(e)})}}DE.getInstance=(e,t)=>(DE.instance||(DE.instance=new DE(e,t)),DE.instance)}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.