@thefittingroom/sdk 1.2.1 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * thefittingroom v1.2.1 (2024-06-27T17:22:36.881Z)
2
+ * thefittingroom v1.3.0 (2024-07-10T23:25:53.913Z)
3
3
  * Copyright 2022-present, TheFittingRoom, Inc. All rights reserved.
4
4
  */
5
5
  var t=Object.freeze({__proto__:null}),e=Object.freeze({__proto__:null});
@@ -35,10 +35,10 @@ var t=Object.freeze({__proto__:null}),e=Object.freeze({__proto__:null});
35
35
  * See the License for the specific language governing permissions and
36
36
  * limitations under the License.
37
37
  */
38
- const n=function(t){const e=[];let n=0;for(let s=0;s<t.length;s++){let r=t.charCodeAt(s);r<128?e[n++]=r:r<2048?(e[n++]=r>>6|192,e[n++]=63&r|128):55296==(64512&r)&&s+1<t.length&&56320==(64512&t.charCodeAt(s+1))?(r=65536+((1023&r)<<10)+(1023&t.charCodeAt(++s)),e[n++]=r>>18|240,e[n++]=r>>12&63|128,e[n++]=r>>6&63|128,e[n++]=63&r|128):(e[n++]=r>>12|224,e[n++]=r>>6&63|128,e[n++]=63&r|128)}return e},s={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:"function"==typeof atob,encodeByteArray(t,e){if(!Array.isArray(t))throw Error("encodeByteArray takes an array as a parameter");this.init_();const n=e?this.byteToCharMapWebSafe_:this.byteToCharMap_,s=[];for(let e=0;e<t.length;e+=3){const r=t[e],i=e+1<t.length,o=i?t[e+1]:0,a=e+2<t.length,c=a?t[e+2]:0,u=r>>2,h=(3&r)<<4|o>>4;let l=(15&o)<<2|c>>6,d=63&c;a||(d=64,i||(l=64)),s.push(n[u],n[h],n[l],n[d])}return s.join("")},encodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(t):this.encodeByteArray(n(t),e)},decodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(t):function(t){const e=[];let n=0,s=0;for(;n<t.length;){const r=t[n++];if(r<128)e[s++]=String.fromCharCode(r);else if(r>191&&r<224){const i=t[n++];e[s++]=String.fromCharCode((31&r)<<6|63&i)}else if(r>239&&r<365){const i=((7&r)<<18|(63&t[n++])<<12|(63&t[n++])<<6|63&t[n++])-65536;e[s++]=String.fromCharCode(55296+(i>>10)),e[s++]=String.fromCharCode(56320+(1023&i))}else{const i=t[n++],o=t[n++];e[s++]=String.fromCharCode((15&r)<<12|(63&i)<<6|63&o)}}return e.join("")}(this.decodeStringToByteArray(t,e))},decodeStringToByteArray(t,e){this.init_();const n=e?this.charToByteMapWebSafe_:this.charToByteMap_,s=[];for(let e=0;e<t.length;){const r=n[t.charAt(e++)],i=e<t.length?n[t.charAt(e)]:0;++e;const o=e<t.length?n[t.charAt(e)]:64;++e;const a=e<t.length?n[t.charAt(e)]:64;if(++e,null==r||null==i||null==o||null==a)throw Error();const c=r<<2|i>>4;if(s.push(c),64!==o){const t=i<<4&240|o>>2;if(s.push(t),64!==a){const t=o<<6&192|a;s.push(t)}}}return s},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let t=0;t<this.ENCODED_VALS.length;t++)this.byteToCharMap_[t]=this.ENCODED_VALS.charAt(t),this.charToByteMap_[this.byteToCharMap_[t]]=t,this.byteToCharMapWebSafe_[t]=this.ENCODED_VALS_WEBSAFE.charAt(t),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[t]]=t,t>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(t)]=t,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(t)]=t)}}},r=function(t){return function(t){const e=n(t);return s.encodeByteArray(e,!0)}(t).replace(/\./g,"")},i=function(t){try{return s.decodeString(t,!0)}catch(t){console.error("base64Decode failed: ",t)}return null};
38
+ const n=function(t){const e=[];let n=0;for(let r=0;r<t.length;r++){let s=t.charCodeAt(r);s<128?e[n++]=s:s<2048?(e[n++]=s>>6|192,e[n++]=63&s|128):55296==(64512&s)&&r+1<t.length&&56320==(64512&t.charCodeAt(r+1))?(s=65536+((1023&s)<<10)+(1023&t.charCodeAt(++r)),e[n++]=s>>18|240,e[n++]=s>>12&63|128,e[n++]=s>>6&63|128,e[n++]=63&s|128):(e[n++]=s>>12|224,e[n++]=s>>6&63|128,e[n++]=63&s|128)}return e},r={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(t,e){if(!Array.isArray(t))throw Error("encodeByteArray takes an array as a parameter");this.init_();const n=e?this.byteToCharMapWebSafe_:this.byteToCharMap_,r=[];for(let e=0;e<t.length;e+=3){const s=t[e],i=e+1<t.length,o=i?t[e+1]:0,a=e+2<t.length,c=a?t[e+2]:0,u=s>>2,h=(3&s)<<4|o>>4;let l=(15&o)<<2|c>>6,d=63&c;a||(d=64,i||(l=64)),r.push(n[u],n[h],n[l],n[d])}return r.join("")},encodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(t):this.encodeByteArray(n(t),e)},decodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(t):function(t){const e=[];let n=0,r=0;for(;n<t.length;){const s=t[n++];if(s<128)e[r++]=String.fromCharCode(s);else if(s>191&&s<224){const i=t[n++];e[r++]=String.fromCharCode((31&s)<<6|63&i)}else if(s>239&&s<365){const i=((7&s)<<18|(63&t[n++])<<12|(63&t[n++])<<6|63&t[n++])-65536;e[r++]=String.fromCharCode(55296+(i>>10)),e[r++]=String.fromCharCode(56320+(1023&i))}else{const i=t[n++],o=t[n++];e[r++]=String.fromCharCode((15&s)<<12|(63&i)<<6|63&o)}}return e.join("")}(this.decodeStringToByteArray(t,e))},decodeStringToByteArray(t,e){this.init_();const n=e?this.charToByteMapWebSafe_:this.charToByteMap_,r=[];for(let e=0;e<t.length;){const i=n[t.charAt(e++)],o=e<t.length?n[t.charAt(e)]:0;++e;const a=e<t.length?n[t.charAt(e)]:64;++e;const c=e<t.length?n[t.charAt(e)]:64;if(++e,null==i||null==o||null==a||null==c)throw new s;const u=i<<2|o>>4;if(r.push(u),64!==a){const t=o<<4&240|a>>2;if(r.push(t),64!==c){const t=a<<6&192|c;r.push(t)}}}return r},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let t=0;t<this.ENCODED_VALS.length;t++)this.byteToCharMap_[t]=this.ENCODED_VALS.charAt(t),this.charToByteMap_[this.byteToCharMap_[t]]=t,this.byteToCharMapWebSafe_[t]=this.ENCODED_VALS_WEBSAFE.charAt(t),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[t]]=t,t>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(t)]=t,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(t)]=t)}}};class s extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const i=function(t){return function(t){const e=n(t);return r.encodeByteArray(e,!0)}(t).replace(/\./g,"")},o=function(t){try{return r.decodeString(t,!0)}catch(t){console.error("base64Decode failed: ",t)}return null};
39
39
  /**
40
40
  * @license
41
- * Copyright 2017 Google LLC
41
+ * Copyright 2022 Google LLC
42
42
  *
43
43
  * Licensed under the Apache License, Version 2.0 (the "License");
44
44
  * you may not use this file except in compliance with the License.
@@ -52,7 +52,7 @@ const n=function(t){const e=[];let n=0;for(let s=0;s<t.length;s++){let r=t.charC
52
52
  * See the License for the specific language governing permissions and
53
53
  * limitations under the License.
54
54
  */
55
- function o(){return"undefined"!=typeof navigator&&"string"==typeof navigator.userAgent?navigator.userAgent:""}
55
+ const a=()=>
56
56
  /**
57
57
  * @license
58
58
  * Copyright 2022 Google LLC
@@ -69,7 +69,7 @@ function o(){return"undefined"!=typeof navigator&&"string"==typeof navigator.use
69
69
  * See the License for the specific language governing permissions and
70
70
  * limitations under the License.
71
71
  */
72
- const a=()=>function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if("undefined"!=typeof global)return global;throw new Error("Unable to locate global object.")}().__FIREBASE_DEFAULTS__,c=()=>{try{return a()||(()=>{if("undefined"==typeof process||void 0===process.env)return;const t=process.env.__FIREBASE_DEFAULTS__;return t?JSON.parse(t):void 0})()||(()=>{if("undefined"==typeof document)return;let t;try{t=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch(t){return}const e=t&&i(t[1]);return e&&JSON.parse(e)})()}catch(t){return void console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${t}`)}},u=t=>{var e,n;return null===(n=null===(e=c())||void 0===e?void 0:e.emulatorHosts)||void 0===n?void 0:n[t]},h=t=>{var e;return null===(e=c())||void 0===e?void 0:e[`_${t}`]};
72
+ function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if("undefined"!=typeof global)return global;throw new Error("Unable to locate global object.")}().__FIREBASE_DEFAULTS__,c=()=>{try{return a()||(()=>{if("undefined"==typeof process||void 0===process.env)return;const t=process.env.__FIREBASE_DEFAULTS__;return t?JSON.parse(t):void 0})()||(()=>{if("undefined"==typeof document)return;let t;try{t=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch(t){return}const e=t&&o(t[1]);return e&&JSON.parse(e)})()}catch(t){return void console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${t}`)}},u=()=>{var t;return null===(t=c())||void 0===t?void 0:t.config},h=t=>{var e;return null===(e=c())||void 0===e?void 0:e[`_${t}`]};
73
73
  /**
74
74
  * @license
75
75
  * Copyright 2017 Google LLC
@@ -89,7 +89,7 @@ const a=()=>function(){if("undefined"!=typeof self)return self;if("undefined"!=t
89
89
  class l{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise(((t,e)=>{this.resolve=t,this.reject=e}))}wrapCallback(t){return(e,n)=>{e?this.reject(e):this.resolve(n),"function"==typeof t&&(this.promise.catch((()=>{})),1===t.length?t(e):t(e,n))}}}
90
90
  /**
91
91
  * @license
92
- * Copyright 2021 Google LLC
92
+ * Copyright 2017 Google LLC
93
93
  *
94
94
  * Licensed under the Apache License, Version 2.0 (the "License");
95
95
  * you may not use this file except in compliance with the License.
@@ -102,7 +102,7 @@ class l{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Pr
102
102
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
103
103
  * See the License for the specific language governing permissions and
104
104
  * limitations under the License.
105
- */class d extends Error{constructor(t,e,n){super(e),this.code=t,this.customData=n,this.name="FirebaseError",Object.setPrototypeOf(this,d.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,f.prototype.create)}}class f{constructor(t,e,n){this.service=t,this.serviceName=e,this.errors=n}create(t,...e){const n=e[0]||{},s=`${this.service}/${t}`,r=this.errors[t],i=r?function(t,e){return t.replace(p,((t,n)=>{const s=e[n];return null!=s?String(s):`<${n}?>`}))}(r,n):"Error",o=`${this.serviceName}: ${i} (${s}).`;return new d(s,o,n)}}const p=/\{\$([^}]+)}/g;function g(t,e){if(t===e)return!0;const n=Object.keys(t),s=Object.keys(e);for(const r of n){if(!s.includes(r))return!1;const n=t[r],i=e[r];if(m(n)&&m(i)){if(!g(n,i))return!1}else if(n!==i)return!1}for(const t of s)if(!n.includes(t))return!1;return!0}function m(t){return null!==t&&"object"==typeof t}
105
+ */function d(){return"undefined"!=typeof navigator&&"string"==typeof navigator.userAgent?navigator.userAgent:""}class f extends Error{constructor(t,e,n){super(e),this.code=t,this.customData=n,this.name="FirebaseError",Object.setPrototypeOf(this,f.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,p.prototype.create)}}class p{constructor(t,e,n){this.service=t,this.serviceName=e,this.errors=n}create(t,...e){const n=e[0]||{},r=`${this.service}/${t}`,s=this.errors[t],i=s?function(t,e){return t.replace(g,((t,n)=>{const r=e[n];return null!=r?String(r):`<${n}?>`}))}(s,n):"Error",o=`${this.serviceName}: ${i} (${r}).`;return new f(r,o,n)}}const g=/\{\$([^}]+)}/g;function m(t,e){if(t===e)return!0;const n=Object.keys(t),r=Object.keys(e);for(const s of n){if(!r.includes(s))return!1;const n=t[s],i=e[s];if(y(n)&&y(i)){if(!m(n,i))return!1}else if(n!==i)return!1}for(const t of r)if(!n.includes(t))return!1;return!0}function y(t){return null!==t&&"object"==typeof t}
106
106
  /**
107
107
  * @license
108
108
  * Copyright 2017 Google LLC
@@ -118,7 +118,7 @@ class l{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Pr
118
118
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
119
119
  * See the License for the specific language governing permissions and
120
120
  * limitations under the License.
121
- */function y(t){const e=[];for(const[n,s]of Object.entries(t))Array.isArray(s)?s.forEach((t=>{e.push(encodeURIComponent(n)+"="+encodeURIComponent(t))})):e.push(encodeURIComponent(n)+"="+encodeURIComponent(s));return e.length?"&"+e.join("&"):""}function v(t){const e={};return t.replace(/^\?/,"").split("&").forEach((t=>{if(t){const[n,s]=t.split("=");e[decodeURIComponent(n)]=decodeURIComponent(s)}})),e}function w(t){const e=t.indexOf("?");if(!e)return"";const n=t.indexOf("#",e);return t.substring(e,n>0?n:void 0)}class _{constructor(t,e){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=e,this.task.then((()=>{t(this)})).catch((t=>{this.error(t)}))}next(t){this.forEachObserver((e=>{e.next(t)}))}error(t){this.forEachObserver((e=>{e.error(t)})),this.close(t)}complete(){this.forEachObserver((t=>{t.complete()})),this.close()}subscribe(t,e,n){let s;if(void 0===t&&void 0===e&&void 0===n)throw new Error("Missing Observer.");s=function(t,e){if("object"!=typeof t||null===t)return!1;for(const n of e)if(n in t&&"function"==typeof t[n])return!0;return!1}(t,["next","error","complete"])?t:{next:t,error:e,complete:n},void 0===s.next&&(s.next=T),void 0===s.error&&(s.error=T),void 0===s.complete&&(s.complete=T);const r=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then((()=>{try{this.finalError?s.error(this.finalError):s.complete()}catch(t){}})),this.observers.push(s),r}unsubscribeOne(t){void 0!==this.observers&&void 0!==this.observers[t]&&(delete this.observers[t],this.observerCount-=1,0===this.observerCount&&void 0!==this.onNoObservers&&this.onNoObservers(this))}forEachObserver(t){if(!this.finalized)for(let e=0;e<this.observers.length;e++)this.sendOne(e,t)}sendOne(t,e){this.task.then((()=>{if(void 0!==this.observers&&void 0!==this.observers[t])try{e(this.observers[t])}catch(t){"undefined"!=typeof console&&console.error&&console.error(t)}}))}close(t){this.finalized||(this.finalized=!0,void 0!==t&&(this.finalError=t),this.task.then((()=>{this.observers=void 0,this.onNoObservers=void 0})))}}function T(){}
121
+ */function v(t){const e=[];for(const[n,r]of Object.entries(t))Array.isArray(r)?r.forEach((t=>{e.push(encodeURIComponent(n)+"="+encodeURIComponent(t))})):e.push(encodeURIComponent(n)+"="+encodeURIComponent(r));return e.length?"&"+e.join("&"):""}function w(t){const e={};return t.replace(/^\?/,"").split("&").forEach((t=>{if(t){const[n,r]=t.split("=");e[decodeURIComponent(n)]=decodeURIComponent(r)}})),e}function _(t){const e=t.indexOf("?");if(!e)return"";const n=t.indexOf("#",e);return t.substring(e,n>0?n:void 0)}class T{constructor(t,e){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=e,this.task.then((()=>{t(this)})).catch((t=>{this.error(t)}))}next(t){this.forEachObserver((e=>{e.next(t)}))}error(t){this.forEachObserver((e=>{e.error(t)})),this.close(t)}complete(){this.forEachObserver((t=>{t.complete()})),this.close()}subscribe(t,e,n){let r;if(void 0===t&&void 0===e&&void 0===n)throw new Error("Missing Observer.");r=function(t,e){if("object"!=typeof t||null===t)return!1;for(const n of e)if(n in t&&"function"==typeof t[n])return!0;return!1}(t,["next","error","complete"])?t:{next:t,error:e,complete:n},void 0===r.next&&(r.next=E),void 0===r.error&&(r.error=E),void 0===r.complete&&(r.complete=E);const s=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then((()=>{try{this.finalError?r.error(this.finalError):r.complete()}catch(t){}})),this.observers.push(r),s}unsubscribeOne(t){void 0!==this.observers&&void 0!==this.observers[t]&&(delete this.observers[t],this.observerCount-=1,0===this.observerCount&&void 0!==this.onNoObservers&&this.onNoObservers(this))}forEachObserver(t){if(!this.finalized)for(let e=0;e<this.observers.length;e++)this.sendOne(e,t)}sendOne(t,e){this.task.then((()=>{if(void 0!==this.observers&&void 0!==this.observers[t])try{e(this.observers[t])}catch(t){"undefined"!=typeof console&&console.error&&console.error(t)}}))}close(t){this.finalized||(this.finalized=!0,void 0!==t&&(this.finalError=t),this.task.then((()=>{this.observers=void 0,this.onNoObservers=void 0})))}}function E(){}
122
122
  /**
123
123
  * @license
124
124
  * Copyright 2021 Google LLC
@@ -134,7 +134,7 @@ class l{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Pr
134
134
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
135
135
  * See the License for the specific language governing permissions and
136
136
  * limitations under the License.
137
- */function I(t){return t&&t._delegate?t._delegate:t}class E{constructor(t,e,n){this.name=t,this.instanceFactory=e,this.type=n,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(t){return this.instantiationMode=t,this}setMultipleInstances(t){return this.multipleInstances=t,this}setServiceProps(t){return this.serviceProps=t,this}setInstanceCreatedCallback(t){return this.onInstanceCreated=t,this}}
137
+ */function S(t){return t&&t._delegate?t._delegate:t}class I{constructor(t,e,n){this.name=t,this.instanceFactory=e,this.type=n,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(t){return this.instantiationMode=t,this}setMultipleInstances(t){return this.multipleInstances=t,this}setServiceProps(t){return this.serviceProps=t,this}setInstanceCreatedCallback(t){return this.onInstanceCreated=t,this}}
138
138
  /**
139
139
  * @license
140
140
  * Copyright 2019 Google LLC
@@ -150,7 +150,7 @@ class l{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Pr
150
150
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
151
151
  * See the License for the specific language governing permissions and
152
152
  * limitations under the License.
153
- */const S="[DEFAULT]";
153
+ */const b="[DEFAULT]";
154
154
  /**
155
155
  * @license
156
156
  * Copyright 2019 Google LLC
@@ -166,7 +166,7 @@ class l{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Pr
166
166
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
167
167
  * See the License for the specific language governing permissions and
168
168
  * limitations under the License.
169
- */class b{constructor(t,e){this.name=t,this.container=e,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(t){const e=this.normalizeInstanceIdentifier(t);if(!this.instancesDeferred.has(e)){const t=new l;if(this.instancesDeferred.set(e,t),this.isInitialized(e)||this.shouldAutoInitialize())try{const n=this.getOrInitializeService({instanceIdentifier:e});n&&t.resolve(n)}catch(t){}}return this.instancesDeferred.get(e).promise}getImmediate(t){var e;const n=this.normalizeInstanceIdentifier(null==t?void 0:t.identifier),s=null!==(e=null==t?void 0:t.optional)&&void 0!==e&&e;if(!this.isInitialized(n)&&!this.shouldAutoInitialize()){if(s)return null;throw Error(`Service ${this.name} is not available`)}try{return this.getOrInitializeService({instanceIdentifier:n})}catch(t){if(s)return null;throw t}}getComponent(){return this.component}setComponent(t){if(t.name!==this.name)throw Error(`Mismatching Component ${t.name} for Provider ${this.name}.`);if(this.component)throw Error(`Component for ${this.name} has already been provided`);if(this.component=t,this.shouldAutoInitialize()){if(function(t){return"EAGER"===t.instantiationMode}
169
+ */class A{constructor(t,e){this.name=t,this.container=e,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(t){const e=this.normalizeInstanceIdentifier(t);if(!this.instancesDeferred.has(e)){const t=new l;if(this.instancesDeferred.set(e,t),this.isInitialized(e)||this.shouldAutoInitialize())try{const n=this.getOrInitializeService({instanceIdentifier:e});n&&t.resolve(n)}catch(t){}}return this.instancesDeferred.get(e).promise}getImmediate(t){var e;const n=this.normalizeInstanceIdentifier(null==t?void 0:t.identifier),r=null!==(e=null==t?void 0:t.optional)&&void 0!==e&&e;if(!this.isInitialized(n)&&!this.shouldAutoInitialize()){if(r)return null;throw Error(`Service ${this.name} is not available`)}try{return this.getOrInitializeService({instanceIdentifier:n})}catch(t){if(r)return null;throw t}}getComponent(){return this.component}setComponent(t){if(t.name!==this.name)throw Error(`Mismatching Component ${t.name} for Provider ${this.name}.`);if(this.component)throw Error(`Component for ${this.name} has already been provided`);if(this.component=t,this.shouldAutoInitialize()){if(function(t){return"EAGER"===t.instantiationMode}
170
170
  /**
171
171
  * @license
172
172
  * Copyright 2019 Google LLC
@@ -182,7 +182,7 @@ class l{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Pr
182
182
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
183
183
  * See the License for the specific language governing permissions and
184
184
  * limitations under the License.
185
- */(t))try{this.getOrInitializeService({instanceIdentifier:S})}catch(t){}for(const[t,e]of this.instancesDeferred.entries()){const n=this.normalizeInstanceIdentifier(t);try{const t=this.getOrInitializeService({instanceIdentifier:n});e.resolve(t)}catch(t){}}}}clearInstance(t=S){this.instancesDeferred.delete(t),this.instancesOptions.delete(t),this.instances.delete(t)}async delete(){const t=Array.from(this.instances.values());await Promise.all([...t.filter((t=>"INTERNAL"in t)).map((t=>t.INTERNAL.delete())),...t.filter((t=>"_delete"in t)).map((t=>t._delete()))])}isComponentSet(){return null!=this.component}isInitialized(t=S){return this.instances.has(t)}getOptions(t=S){return this.instancesOptions.get(t)||{}}initialize(t={}){const{options:e={}}=t,n=this.normalizeInstanceIdentifier(t.instanceIdentifier);if(this.isInitialized(n))throw Error(`${this.name}(${n}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);const s=this.getOrInitializeService({instanceIdentifier:n,options:e});for(const[t,e]of this.instancesDeferred.entries()){n===this.normalizeInstanceIdentifier(t)&&e.resolve(s)}return s}onInit(t,e){var n;const s=this.normalizeInstanceIdentifier(e),r=null!==(n=this.onInitCallbacks.get(s))&&void 0!==n?n:new Set;r.add(t),this.onInitCallbacks.set(s,r);const i=this.instances.get(s);return i&&t(i,s),()=>{r.delete(t)}}invokeOnInitCallbacks(t,e){const n=this.onInitCallbacks.get(e);if(n)for(const s of n)try{s(t,e)}catch(t){}}getOrInitializeService({instanceIdentifier:t,options:e={}}){let n=this.instances.get(t);if(!n&&this.component&&(n=this.component.instanceFactory(this.container,{instanceIdentifier:(s=t,s===S?void 0:s),options:e}),this.instances.set(t,n),this.instancesOptions.set(t,e),this.invokeOnInitCallbacks(n,t),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,t,n)}catch(t){}var s;return n||null}normalizeInstanceIdentifier(t=S){return this.component?this.component.multipleInstances?t:S:t}shouldAutoInitialize(){return!!this.component&&"EXPLICIT"!==this.component.instantiationMode}}class A{constructor(t){this.name=t,this.providers=new Map}addComponent(t){const e=this.getProvider(t.name);if(e.isComponentSet())throw new Error(`Component ${t.name} has already been registered with ${this.name}`);e.setComponent(t)}addOrOverwriteComponent(t){this.getProvider(t.name).isComponentSet()&&this.providers.delete(t.name),this.addComponent(t)}getProvider(t){if(this.providers.has(t))return this.providers.get(t);const e=new b(t,this);return this.providers.set(t,e),e}getProviders(){return Array.from(this.providers.values())}}
185
+ */(t))try{this.getOrInitializeService({instanceIdentifier:b})}catch(t){}for(const[t,e]of this.instancesDeferred.entries()){const n=this.normalizeInstanceIdentifier(t);try{const t=this.getOrInitializeService({instanceIdentifier:n});e.resolve(t)}catch(t){}}}}clearInstance(t=b){this.instancesDeferred.delete(t),this.instancesOptions.delete(t),this.instances.delete(t)}async delete(){const t=Array.from(this.instances.values());await Promise.all([...t.filter((t=>"INTERNAL"in t)).map((t=>t.INTERNAL.delete())),...t.filter((t=>"_delete"in t)).map((t=>t._delete()))])}isComponentSet(){return null!=this.component}isInitialized(t=b){return this.instances.has(t)}getOptions(t=b){return this.instancesOptions.get(t)||{}}initialize(t={}){const{options:e={}}=t,n=this.normalizeInstanceIdentifier(t.instanceIdentifier);if(this.isInitialized(n))throw Error(`${this.name}(${n}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);const r=this.getOrInitializeService({instanceIdentifier:n,options:e});for(const[t,e]of this.instancesDeferred.entries()){n===this.normalizeInstanceIdentifier(t)&&e.resolve(r)}return r}onInit(t,e){var n;const r=this.normalizeInstanceIdentifier(e),s=null!==(n=this.onInitCallbacks.get(r))&&void 0!==n?n:new Set;s.add(t),this.onInitCallbacks.set(r,s);const i=this.instances.get(r);return i&&t(i,r),()=>{s.delete(t)}}invokeOnInitCallbacks(t,e){const n=this.onInitCallbacks.get(e);if(n)for(const r of n)try{r(t,e)}catch(t){}}getOrInitializeService({instanceIdentifier:t,options:e={}}){let n=this.instances.get(t);if(!n&&this.component&&(n=this.component.instanceFactory(this.container,{instanceIdentifier:(r=t,r===b?void 0:r),options:e}),this.instances.set(t,n),this.instancesOptions.set(t,e),this.invokeOnInitCallbacks(n,t),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,t,n)}catch(t){}var r;return n||null}normalizeInstanceIdentifier(t=b){return this.component?this.component.multipleInstances?t:b:t}shouldAutoInitialize(){return!!this.component&&"EXPLICIT"!==this.component.instantiationMode}}class C{constructor(t){this.name=t,this.providers=new Map}addComponent(t){const e=this.getProvider(t.name);if(e.isComponentSet())throw new Error(`Component ${t.name} has already been registered with ${this.name}`);e.setComponent(t)}addOrOverwriteComponent(t){this.getProvider(t.name).isComponentSet()&&this.providers.delete(t.name),this.addComponent(t)}getProvider(t){if(this.providers.has(t))return this.providers.get(t);const e=new A(t,this);return this.providers.set(t,e),e}getProviders(){return Array.from(this.providers.values())}}
186
186
  /**
187
187
  * @license
188
188
  * Copyright 2017 Google LLC
@@ -198,7 +198,7 @@ class l{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Pr
198
198
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
199
199
  * See the License for the specific language governing permissions and
200
200
  * limitations under the License.
201
- */var C;!function(t){t[t.DEBUG=0]="DEBUG",t[t.VERBOSE=1]="VERBOSE",t[t.INFO=2]="INFO",t[t.WARN=3]="WARN",t[t.ERROR=4]="ERROR",t[t.SILENT=5]="SILENT"}(C||(C={}));const k={debug:C.DEBUG,verbose:C.VERBOSE,info:C.INFO,warn:C.WARN,error:C.ERROR,silent:C.SILENT},N=C.INFO,R={[C.DEBUG]:"log",[C.VERBOSE]:"log",[C.INFO]:"info",[C.WARN]:"warn",[C.ERROR]:"error"},O=(t,e,...n)=>{if(e<t.logLevel)return;const s=(new Date).toISOString(),r=R[e];if(!r)throw new Error(`Attempted to log a message with an invalid logType (value: ${e})`);console[r](`[${s}] ${t.name}:`,...n)};class D{constructor(t){this.name=t,this._logLevel=N,this._logHandler=O,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(t){if(!(t in C))throw new TypeError(`Invalid value "${t}" assigned to \`logLevel\``);this._logLevel=t}setLogLevel(t){this._logLevel="string"==typeof t?k[t]:t}get logHandler(){return this._logHandler}set logHandler(t){if("function"!=typeof t)throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=t}get userLogHandler(){return this._userLogHandler}set userLogHandler(t){this._userLogHandler=t}debug(...t){this._userLogHandler&&this._userLogHandler(this,C.DEBUG,...t),this._logHandler(this,C.DEBUG,...t)}log(...t){this._userLogHandler&&this._userLogHandler(this,C.VERBOSE,...t),this._logHandler(this,C.VERBOSE,...t)}info(...t){this._userLogHandler&&this._userLogHandler(this,C.INFO,...t),this._logHandler(this,C.INFO,...t)}warn(...t){this._userLogHandler&&this._userLogHandler(this,C.WARN,...t),this._logHandler(this,C.WARN,...t)}error(...t){this._userLogHandler&&this._userLogHandler(this,C.ERROR,...t),this._logHandler(this,C.ERROR,...t)}}let L,P;const M=new WeakMap,x=new WeakMap,U=new WeakMap,F=new WeakMap,V=new WeakMap;let B={get(t,e,n){if(t instanceof IDBTransaction){if("done"===e)return x.get(t);if("objectStoreNames"===e)return t.objectStoreNames||U.get(t);if("store"===e)return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return q(t[e])},set:(t,e,n)=>(t[e]=n,!0),has:(t,e)=>t instanceof IDBTransaction&&("done"===e||"store"===e)||e in t};function H(t){return t!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(P||(P=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(t)?function(...e){return t.apply(K(this),e),q(M.get(this))}:function(...e){return q(t.apply(K(this),e))}:function(e,...n){const s=t.call(K(this),e,...n);return U.set(s,e.sort?e.sort():[e]),q(s)}}function j(t){return"function"==typeof t?H(t):(t instanceof IDBTransaction&&function(t){if(x.has(t))return;const e=new Promise(((e,n)=>{const s=()=>{t.removeEventListener("complete",r),t.removeEventListener("error",i),t.removeEventListener("abort",i)},r=()=>{e(),s()},i=()=>{n(t.error||new DOMException("AbortError","AbortError")),s()};t.addEventListener("complete",r),t.addEventListener("error",i),t.addEventListener("abort",i)}));x.set(t,e)}(t),e=t,(L||(L=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])).some((t=>e instanceof t))?new Proxy(t,B):t);var e}function q(t){if(t instanceof IDBRequest)return function(t){const e=new Promise(((e,n)=>{const s=()=>{t.removeEventListener("success",r),t.removeEventListener("error",i)},r=()=>{e(q(t.result)),s()},i=()=>{n(t.error),s()};t.addEventListener("success",r),t.addEventListener("error",i)}));return e.then((e=>{e instanceof IDBCursor&&M.set(e,t)})).catch((()=>{})),V.set(e,t),e}(t);if(F.has(t))return F.get(t);const e=j(t);return e!==t&&(F.set(t,e),V.set(e,t)),e}const K=t=>V.get(t);const G=["get","getKey","getAll","getAllKeys","count"],W=["put","add","delete","clear"],z=new Map;function $(t,e){if(!(t instanceof IDBDatabase)||e in t||"string"!=typeof e)return;if(z.get(e))return z.get(e);const n=e.replace(/FromIndex$/,""),s=e!==n,r=W.includes(n);if(!(n in(s?IDBIndex:IDBObjectStore).prototype)||!r&&!G.includes(n))return;const i=async function(t,...e){const i=this.transaction(t,r?"readwrite":"readonly");let o=i.store;return s&&(o=o.index(e.shift())),(await Promise.all([o[n](...e),r&&i.done]))[0]};return z.set(e,i),i}B=(t=>({...t,get:(e,n,s)=>$(e,n)||t.get(e,n,s),has:(e,n)=>!!$(e,n)||t.has(e,n)}))(B);
201
+ */var k;!function(t){t[t.DEBUG=0]="DEBUG",t[t.VERBOSE=1]="VERBOSE",t[t.INFO=2]="INFO",t[t.WARN=3]="WARN",t[t.ERROR=4]="ERROR",t[t.SILENT=5]="SILENT"}(k||(k={}));const R={debug:k.DEBUG,verbose:k.VERBOSE,info:k.INFO,warn:k.WARN,error:k.ERROR,silent:k.SILENT},N=k.INFO,D={[k.DEBUG]:"log",[k.VERBOSE]:"log",[k.INFO]:"info",[k.WARN]:"warn",[k.ERROR]:"error"},O=(t,e,...n)=>{if(e<t.logLevel)return;const r=(new Date).toISOString(),s=D[e];if(!s)throw new Error(`Attempted to log a message with an invalid logType (value: ${e})`);console[s](`[${r}] ${t.name}:`,...n)};class L{constructor(t){this.name=t,this._logLevel=N,this._logHandler=O,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(t){if(!(t in k))throw new TypeError(`Invalid value "${t}" assigned to \`logLevel\``);this._logLevel=t}setLogLevel(t){this._logLevel="string"==typeof t?R[t]:t}get logHandler(){return this._logHandler}set logHandler(t){if("function"!=typeof t)throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=t}get userLogHandler(){return this._userLogHandler}set userLogHandler(t){this._userLogHandler=t}debug(...t){this._userLogHandler&&this._userLogHandler(this,k.DEBUG,...t),this._logHandler(this,k.DEBUG,...t)}log(...t){this._userLogHandler&&this._userLogHandler(this,k.VERBOSE,...t),this._logHandler(this,k.VERBOSE,...t)}info(...t){this._userLogHandler&&this._userLogHandler(this,k.INFO,...t),this._logHandler(this,k.INFO,...t)}warn(...t){this._userLogHandler&&this._userLogHandler(this,k.WARN,...t),this._logHandler(this,k.WARN,...t)}error(...t){this._userLogHandler&&this._userLogHandler(this,k.ERROR,...t),this._logHandler(this,k.ERROR,...t)}}const P=(t,e)=>e.some((e=>t instanceof e));let M,x;const U=new WeakMap,F=new WeakMap,V=new WeakMap,B=new WeakMap,H=new WeakMap;let j={get(t,e,n){if(t instanceof IDBTransaction){if("done"===e)return F.get(t);if("objectStoreNames"===e)return t.objectStoreNames||V.get(t);if("store"===e)return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return K(t[e])},set:(t,e,n)=>(t[e]=n,!0),has:(t,e)=>t instanceof IDBTransaction&&("done"===e||"store"===e)||e in t};function $(t){return t!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(x||(x=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(t)?function(...e){return t.apply(W(this),e),K(U.get(this))}:function(...e){return K(t.apply(W(this),e))}:function(e,...n){const r=t.call(W(this),e,...n);return V.set(r,e.sort?e.sort():[e]),K(r)}}function q(t){return"function"==typeof t?$(t):(t instanceof IDBTransaction&&function(t){if(F.has(t))return;const e=new Promise(((e,n)=>{const r=()=>{t.removeEventListener("complete",s),t.removeEventListener("error",i),t.removeEventListener("abort",i)},s=()=>{e(),r()},i=()=>{n(t.error||new DOMException("AbortError","AbortError")),r()};t.addEventListener("complete",s),t.addEventListener("error",i),t.addEventListener("abort",i)}));F.set(t,e)}(t),P(t,M||(M=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction]))?new Proxy(t,j):t)}function K(t){if(t instanceof IDBRequest)return function(t){const e=new Promise(((e,n)=>{const r=()=>{t.removeEventListener("success",s),t.removeEventListener("error",i)},s=()=>{e(K(t.result)),r()},i=()=>{n(t.error),r()};t.addEventListener("success",s),t.addEventListener("error",i)}));return e.then((e=>{e instanceof IDBCursor&&U.set(e,t)})).catch((()=>{})),H.set(e,t),e}(t);if(B.has(t))return B.get(t);const e=q(t);return e!==t&&(B.set(t,e),H.set(e,t)),e}const W=t=>H.get(t);const G=["get","getKey","getAll","getAllKeys","count"],z=["put","add","delete","clear"],Q=new Map;function Y(t,e){if(!(t instanceof IDBDatabase)||e in t||"string"!=typeof e)return;if(Q.get(e))return Q.get(e);const n=e.replace(/FromIndex$/,""),r=e!==n,s=z.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!s&&!G.includes(n))return;const i=async function(t,...e){const i=this.transaction(t,s?"readwrite":"readonly");let o=i.store;return r&&(o=o.index(e.shift())),(await Promise.all([o[n](...e),s&&i.done]))[0]};return Q.set(e,i),i}j=(t=>({...t,get:(e,n,r)=>Y(e,n)||t.get(e,n,r),has:(e,n)=>!!Y(e,n)||t.has(e,n)}))(j);
202
202
  /**
203
203
  * @license
204
204
  * Copyright 2019 Google LLC
@@ -215,7 +215,7 @@ class l{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Pr
215
215
  * See the License for the specific language governing permissions and
216
216
  * limitations under the License.
217
217
  */
218
- class Q{constructor(t){this.container=t}getPlatformInfoString(){return this.container.getProviders().map((t=>{if(function(t){const e=t.getComponent();return"VERSION"===(null==e?void 0:e.type)}(t)){const e=t.getImmediate();return`${e.library}/${e.version}`}return null})).filter((t=>t)).join(" ")}}const J="@firebase/app",Y="0.9.0",X=new D("@firebase/app"),Z="[DEFAULT]",tt={[J]:"fire-core","@firebase/app-compat":"fire-core-compat","@firebase/analytics":"fire-analytics","@firebase/analytics-compat":"fire-analytics-compat","@firebase/app-check":"fire-app-check","@firebase/app-check-compat":"fire-app-check-compat","@firebase/auth":"fire-auth","@firebase/auth-compat":"fire-auth-compat","@firebase/database":"fire-rtdb","@firebase/database-compat":"fire-rtdb-compat","@firebase/functions":"fire-fn","@firebase/functions-compat":"fire-fn-compat","@firebase/installations":"fire-iid","@firebase/installations-compat":"fire-iid-compat","@firebase/messaging":"fire-fcm","@firebase/messaging-compat":"fire-fcm-compat","@firebase/performance":"fire-perf","@firebase/performance-compat":"fire-perf-compat","@firebase/remote-config":"fire-rc","@firebase/remote-config-compat":"fire-rc-compat","@firebase/storage":"fire-gcs","@firebase/storage-compat":"fire-gcs-compat","@firebase/firestore":"fire-fst","@firebase/firestore-compat":"fire-fst-compat","fire-js":"fire-js",firebase:"fire-js-all"},et=new Map,nt=new Map;function st(t,e){try{t.container.addComponent(e)}catch(n){X.debug(`Component ${e.name} failed to register with FirebaseApp ${t.name}`,n)}}function rt(t){const e=t.name;if(nt.has(e))return X.debug(`There were multiple attempts to register component ${e}.`),!1;nt.set(e,t);for(const e of et.values())st(e,t);return!0}function it(t,e){const n=t.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),t.container.getProvider(e)}
218
+ class J{constructor(t){this.container=t}getPlatformInfoString(){return this.container.getProviders().map((t=>{if(function(t){const e=t.getComponent();return"VERSION"===(null==e?void 0:e.type)}(t)){const e=t.getImmediate();return`${e.library}/${e.version}`}return null})).filter((t=>t)).join(" ")}}const X="@firebase/app",Z="0.9.13",tt=new L("@firebase/app"),et="@firebase/app-compat",nt="@firebase/analytics-compat",rt="@firebase/analytics",st="@firebase/app-check-compat",it="@firebase/app-check",ot="@firebase/auth",at="@firebase/auth-compat",ct="@firebase/database",ut="@firebase/database-compat",ht="@firebase/functions",lt="@firebase/functions-compat",dt="@firebase/installations",ft="@firebase/installations-compat",pt="@firebase/messaging",gt="@firebase/messaging-compat",mt="@firebase/performance",yt="@firebase/performance-compat",vt="@firebase/remote-config",wt="@firebase/remote-config-compat",_t="@firebase/storage",Tt="@firebase/storage-compat",Et="@firebase/firestore",St="@firebase/firestore-compat",It="firebase",bt="[DEFAULT]",At={[X]:"fire-core",[et]:"fire-core-compat",[rt]:"fire-analytics",[nt]:"fire-analytics-compat",[it]:"fire-app-check",[st]:"fire-app-check-compat",[ot]:"fire-auth",[at]:"fire-auth-compat",[ct]:"fire-rtdb",[ut]:"fire-rtdb-compat",[ht]:"fire-fn",[lt]:"fire-fn-compat",[dt]:"fire-iid",[ft]:"fire-iid-compat",[pt]:"fire-fcm",[gt]:"fire-fcm-compat",[mt]:"fire-perf",[yt]:"fire-perf-compat",[vt]:"fire-rc",[wt]:"fire-rc-compat",[_t]:"fire-gcs",[Tt]:"fire-gcs-compat",[Et]:"fire-fst",[St]:"fire-fst-compat","fire-js":"fire-js",[It]:"fire-js-all"},Ct=new Map,kt=new Map;function Rt(t,e){try{t.container.addComponent(e)}catch(n){tt.debug(`Component ${e.name} failed to register with FirebaseApp ${t.name}`,n)}}function Nt(t){const e=t.name;if(kt.has(e))return tt.debug(`There were multiple attempts to register component ${e}.`),!1;kt.set(e,t);for(const e of Ct.values())Rt(e,t);return!0}function Dt(t,e){const n=t.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),t.container.getProvider(e)}
219
219
  /**
220
220
  * @license
221
221
  * Copyright 2019 Google LLC
@@ -231,7 +231,7 @@ class Q{constructor(t){this.container=t}getPlatformInfoString(){return this.cont
231
231
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
232
232
  * See the License for the specific language governing permissions and
233
233
  * limitations under the License.
234
- */const ot=new f("app","Firebase",{"no-app":"No Firebase App '{$appName}' has been created - call Firebase App.initializeApp()","bad-app-name":"Illegal App name: '{$appName}","duplicate-app":"Firebase App named '{$appName}' already exists with different options or config","app-deleted":"Firebase App named '{$appName}' already deleted","no-options":"Need to provide options, when not being deployed to hosting via source.","invalid-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance.","invalid-log-argument":"First argument to `onLog` must be null or a function.","idb-open":"Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.","idb-get":"Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.","idb-set":"Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.","idb-delete":"Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}."});
234
+ */const Ot=new p("app","Firebase",{"no-app":"No Firebase App '{$appName}' has been created - call initializeApp() first","bad-app-name":"Illegal App name: '{$appName}","duplicate-app":"Firebase App named '{$appName}' already exists with different options or config","app-deleted":"Firebase App named '{$appName}' already deleted","no-options":"Need to provide options, when not being deployed to hosting via source.","invalid-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance.","invalid-log-argument":"First argument to `onLog` must be null or a function.","idb-open":"Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.","idb-get":"Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.","idb-set":"Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.","idb-delete":"Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}."});
235
235
  /**
236
236
  * @license
237
237
  * Copyright 2019 Google LLC
@@ -248,7 +248,7 @@ class Q{constructor(t){this.container=t}getPlatformInfoString(){return this.cont
248
248
  * See the License for the specific language governing permissions and
249
249
  * limitations under the License.
250
250
  */
251
- class at{constructor(t,e,n){this._isDeleted=!1,this._options=Object.assign({},t),this._config=Object.assign({},e),this._name=e.name,this._automaticDataCollectionEnabled=e.automaticDataCollectionEnabled,this._container=n,this.container.addComponent(new E("app",(()=>this),"PUBLIC"))}get automaticDataCollectionEnabled(){return this.checkDestroyed(),this._automaticDataCollectionEnabled}set automaticDataCollectionEnabled(t){this.checkDestroyed(),this._automaticDataCollectionEnabled=t}get name(){return this.checkDestroyed(),this._name}get options(){return this.checkDestroyed(),this._options}get config(){return this.checkDestroyed(),this._config}get container(){return this._container}get isDeleted(){return this._isDeleted}set isDeleted(t){this._isDeleted=t}checkDestroyed(){if(this.isDeleted)throw ot.create("app-deleted",{appName:this._name})}}
251
+ class Lt{constructor(t,e,n){this._isDeleted=!1,this._options=Object.assign({},t),this._config=Object.assign({},e),this._name=e.name,this._automaticDataCollectionEnabled=e.automaticDataCollectionEnabled,this._container=n,this.container.addComponent(new I("app",(()=>this),"PUBLIC"))}get automaticDataCollectionEnabled(){return this.checkDestroyed(),this._automaticDataCollectionEnabled}set automaticDataCollectionEnabled(t){this.checkDestroyed(),this._automaticDataCollectionEnabled=t}get name(){return this.checkDestroyed(),this._name}get options(){return this.checkDestroyed(),this._options}get config(){return this.checkDestroyed(),this._config}get container(){return this._container}get isDeleted(){return this._isDeleted}set isDeleted(t){this._isDeleted=t}checkDestroyed(){if(this.isDeleted)throw Ot.create("app-deleted",{appName:this._name})}}
252
252
  /**
253
253
  * @license
254
254
  * Copyright 2019 Google LLC
@@ -264,7 +264,7 @@ class at{constructor(t,e,n){this._isDeleted=!1,this._options=Object.assign({},t)
264
264
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
265
265
  * See the License for the specific language governing permissions and
266
266
  * limitations under the License.
267
- */const ct="9.15.0";function ut(t,e={}){let n=t;if("object"!=typeof e){e={name:e}}const s=Object.assign({name:Z,automaticDataCollectionEnabled:!1},e),r=s.name;if("string"!=typeof r||!r)throw ot.create("bad-app-name",{appName:String(r)});if(n||(n=(()=>{var t;return null===(t=c())||void 0===t?void 0:t.config})()),!n)throw ot.create("no-options");const i=et.get(r);if(i){if(g(n,i.options)&&g(s,i.config))return i;throw ot.create("duplicate-app",{appName:r})}const o=new A(r);for(const t of nt.values())o.addComponent(t);const a=new at(n,s,o);return et.set(r,a),a}function ht(t=Z){const e=et.get(t);if(!e&&t===Z)return ut();if(!e)throw ot.create("no-app",{appName:t});return e}function lt(t,e,n){var s;let r=null!==(s=tt[t])&&void 0!==s?s:t;n&&(r+=`-${n}`);const i=r.match(/\s|\//),o=e.match(/\s|\//);if(i||o){const t=[`Unable to register library "${r}" with version "${e}":`];return i&&t.push(`library name "${r}" contains illegal characters (whitespace or "/")`),i&&o&&t.push("and"),o&&t.push(`version name "${e}" contains illegal characters (whitespace or "/")`),void X.warn(t.join(" "))}rt(new E(`${r}-version`,(()=>({library:r,version:e})),"VERSION"))}
267
+ */const Pt="9.23.0";function Mt(t,e={}){let n=t;if("object"!=typeof e){e={name:e}}const r=Object.assign({name:bt,automaticDataCollectionEnabled:!1},e),s=r.name;if("string"!=typeof s||!s)throw Ot.create("bad-app-name",{appName:String(s)});if(n||(n=u()),!n)throw Ot.create("no-options");const i=Ct.get(s);if(i){if(m(n,i.options)&&m(r,i.config))return i;throw Ot.create("duplicate-app",{appName:s})}const o=new C(s);for(const t of kt.values())o.addComponent(t);const a=new Lt(n,r,o);return Ct.set(s,a),a}function xt(t=bt){const e=Ct.get(t);if(!e&&t===bt&&u())return Mt();if(!e)throw Ot.create("no-app",{appName:t});return e}function Ut(t,e,n){var r;let s=null!==(r=At[t])&&void 0!==r?r:t;n&&(s+=`-${n}`);const i=s.match(/\s|\//),o=e.match(/\s|\//);if(i||o){const t=[`Unable to register library "${s}" with version "${e}":`];return i&&t.push(`library name "${s}" contains illegal characters (whitespace or "/")`),i&&o&&t.push("and"),o&&t.push(`version name "${e}" contains illegal characters (whitespace or "/")`),void tt.warn(t.join(" "))}Nt(new I(`${s}-version`,(()=>({library:s,version:e})),"VERSION"))}
268
268
  /**
269
269
  * @license
270
270
  * Copyright 2021 Google LLC
@@ -280,7 +280,7 @@ class at{constructor(t,e,n){this._isDeleted=!1,this._options=Object.assign({},t)
280
280
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
281
281
  * See the License for the specific language governing permissions and
282
282
  * limitations under the License.
283
- */const dt="firebase-heartbeat-store";let ft=null;function pt(){return ft||(ft=function(t,e,{blocked:n,upgrade:s,blocking:r,terminated:i}={}){const o=indexedDB.open(t,e),a=q(o);return s&&o.addEventListener("upgradeneeded",(t=>{s(q(o.result),t.oldVersion,t.newVersion,q(o.transaction))})),n&&o.addEventListener("blocked",(()=>n())),a.then((t=>{i&&t.addEventListener("close",(()=>i())),r&&t.addEventListener("versionchange",(()=>r()))})).catch((()=>{})),a}("firebase-heartbeat-database",1,{upgrade:(t,e)=>{if(0===e)t.createObjectStore(dt)}}).catch((t=>{throw ot.create("idb-open",{originalErrorMessage:t.message})}))),ft}async function gt(t,e){try{const n=(await pt()).transaction(dt,"readwrite"),s=n.objectStore(dt);return await s.put(e,mt(t)),n.done}catch(t){if(t instanceof d)X.warn(t.message);else{const e=ot.create("idb-set",{originalErrorMessage:null==t?void 0:t.message});X.warn(e.message)}}}function mt(t){return`${t.name}!${t.options.appId}`}
283
+ */const Ft="firebase-heartbeat-database",Vt=1,Bt="firebase-heartbeat-store";let Ht=null;function jt(){return Ht||(Ht=function(t,e,{blocked:n,upgrade:r,blocking:s,terminated:i}={}){const o=indexedDB.open(t,e),a=K(o);return r&&o.addEventListener("upgradeneeded",(t=>{r(K(o.result),t.oldVersion,t.newVersion,K(o.transaction),t)})),n&&o.addEventListener("blocked",(t=>n(t.oldVersion,t.newVersion,t))),a.then((t=>{i&&t.addEventListener("close",(()=>i())),s&&t.addEventListener("versionchange",(t=>s(t.oldVersion,t.newVersion,t)))})).catch((()=>{})),a}(Ft,Vt,{upgrade:(t,e)=>{if(0===e)t.createObjectStore(Bt)}}).catch((t=>{throw Ot.create("idb-open",{originalErrorMessage:t.message})}))),Ht}async function $t(t,e){try{const n=(await jt()).transaction(Bt,"readwrite"),r=n.objectStore(Bt);await r.put(e,qt(t)),await n.done}catch(t){if(t instanceof f)tt.warn(t.message);else{const e=Ot.create("idb-set",{originalErrorMessage:null==t?void 0:t.message});tt.warn(e.message)}}}function qt(t){return`${t.name}!${t.options.appId}`}
284
284
  /**
285
285
  * @license
286
286
  * Copyright 2021 Google LLC
@@ -296,7 +296,7 @@ class at{constructor(t,e,n){this._isDeleted=!1,this._options=Object.assign({},t)
296
296
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
297
297
  * See the License for the specific language governing permissions and
298
298
  * limitations under the License.
299
- */class yt{constructor(t){this.container=t,this._heartbeatsCache=null;const e=this.container.getProvider("app").getImmediate();this._storage=new wt(e),this._heartbeatsCachePromise=this._storage.read().then((t=>(this._heartbeatsCache=t,t)))}async triggerHeartbeat(){const t=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),e=vt();if(null===this._heartbeatsCache&&(this._heartbeatsCache=await this._heartbeatsCachePromise),this._heartbeatsCache.lastSentHeartbeatDate!==e&&!this._heartbeatsCache.heartbeats.some((t=>t.date===e)))return this._heartbeatsCache.heartbeats.push({date:e,agent:t}),this._heartbeatsCache.heartbeats=this._heartbeatsCache.heartbeats.filter((t=>{const e=new Date(t.date).valueOf();return Date.now()-e<=2592e6})),this._storage.overwrite(this._heartbeatsCache)}async getHeartbeatsHeader(){if(null===this._heartbeatsCache&&await this._heartbeatsCachePromise,null===this._heartbeatsCache||0===this._heartbeatsCache.heartbeats.length)return"";const t=vt(),{heartbeatsToSend:e,unsentEntries:n}=function(t,e=1024){const n=[];let s=t.slice();for(const r of t){const t=n.find((t=>t.agent===r.agent));if(t){if(t.dates.push(r.date),_t(n)>e){t.dates.pop();break}}else if(n.push({agent:r.agent,dates:[r.date]}),_t(n)>e){n.pop();break}s=s.slice(1)}return{heartbeatsToSend:n,unsentEntries:s}}(this._heartbeatsCache.heartbeats),s=r(JSON.stringify({version:2,heartbeats:e}));return this._heartbeatsCache.lastSentHeartbeatDate=t,n.length>0?(this._heartbeatsCache.heartbeats=n,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),s}}function vt(){return(new Date).toISOString().substring(0,10)}class wt{constructor(t){this.app=t,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return!!function(){try{return"object"==typeof indexedDB}catch(t){return!1}}()&&new Promise(((t,e)=>{try{let n=!0;const s="validate-browser-context-for-indexeddb-analytics-module",r=self.indexedDB.open(s);r.onsuccess=()=>{r.result.close(),n||self.indexedDB.deleteDatabase(s),t(!0)},r.onupgradeneeded=()=>{n=!1},r.onerror=()=>{var t;e((null===(t=r.error)||void 0===t?void 0:t.message)||"")}}catch(t){e(t)}})).then((()=>!0)).catch((()=>!1))}async read(){if(await this._canUseIndexedDBPromise){return await async function(t){try{return(await pt()).transaction(dt).objectStore(dt).get(mt(t))}catch(t){if(t instanceof d)X.warn(t.message);else{const e=ot.create("idb-get",{originalErrorMessage:null==t?void 0:t.message});X.warn(e.message)}}}(this.app)||{heartbeats:[]}}return{heartbeats:[]}}async overwrite(t){var e;if(await this._canUseIndexedDBPromise){const n=await this.read();return gt(this.app,{lastSentHeartbeatDate:null!==(e=t.lastSentHeartbeatDate)&&void 0!==e?e:n.lastSentHeartbeatDate,heartbeats:t.heartbeats})}}async add(t){var e;if(await this._canUseIndexedDBPromise){const n=await this.read();return gt(this.app,{lastSentHeartbeatDate:null!==(e=t.lastSentHeartbeatDate)&&void 0!==e?e:n.lastSentHeartbeatDate,heartbeats:[...n.heartbeats,...t.heartbeats]})}}}function _t(t){return r(JSON.stringify({version:2,heartbeats:t})).length}
299
+ */class Kt{constructor(t){this.container=t,this._heartbeatsCache=null;const e=this.container.getProvider("app").getImmediate();this._storage=new Gt(e),this._heartbeatsCachePromise=this._storage.read().then((t=>(this._heartbeatsCache=t,t)))}async triggerHeartbeat(){const t=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),e=Wt();if(null===this._heartbeatsCache&&(this._heartbeatsCache=await this._heartbeatsCachePromise),this._heartbeatsCache.lastSentHeartbeatDate!==e&&!this._heartbeatsCache.heartbeats.some((t=>t.date===e)))return this._heartbeatsCache.heartbeats.push({date:e,agent:t}),this._heartbeatsCache.heartbeats=this._heartbeatsCache.heartbeats.filter((t=>{const e=new Date(t.date).valueOf();return Date.now()-e<=2592e6})),this._storage.overwrite(this._heartbeatsCache)}async getHeartbeatsHeader(){if(null===this._heartbeatsCache&&await this._heartbeatsCachePromise,null===this._heartbeatsCache||0===this._heartbeatsCache.heartbeats.length)return"";const t=Wt(),{heartbeatsToSend:e,unsentEntries:n}=function(t,e=1024){const n=[];let r=t.slice();for(const s of t){const t=n.find((t=>t.agent===s.agent));if(t){if(t.dates.push(s.date),zt(n)>e){t.dates.pop();break}}else if(n.push({agent:s.agent,dates:[s.date]}),zt(n)>e){n.pop();break}r=r.slice(1)}return{heartbeatsToSend:n,unsentEntries:r}}(this._heartbeatsCache.heartbeats),r=i(JSON.stringify({version:2,heartbeats:e}));return this._heartbeatsCache.lastSentHeartbeatDate=t,n.length>0?(this._heartbeatsCache.heartbeats=n,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),r}}function Wt(){return(new Date).toISOString().substring(0,10)}class Gt{constructor(t){this.app=t,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return!!function(){try{return"object"==typeof indexedDB}catch(t){return!1}}()&&new Promise(((t,e)=>{try{let n=!0;const r="validate-browser-context-for-indexeddb-analytics-module",s=self.indexedDB.open(r);s.onsuccess=()=>{s.result.close(),n||self.indexedDB.deleteDatabase(r),t(!0)},s.onupgradeneeded=()=>{n=!1},s.onerror=()=>{var t;e((null===(t=s.error)||void 0===t?void 0:t.message)||"")}}catch(t){e(t)}})).then((()=>!0)).catch((()=>!1))}async read(){if(await this._canUseIndexedDBPromise){const t=await async function(t){try{const e=await jt();return await e.transaction(Bt).objectStore(Bt).get(qt(t))}catch(t){if(t instanceof f)tt.warn(t.message);else{const e=Ot.create("idb-get",{originalErrorMessage:null==t?void 0:t.message});tt.warn(e.message)}}}(this.app);return t||{heartbeats:[]}}return{heartbeats:[]}}async overwrite(t){var e;if(await this._canUseIndexedDBPromise){const n=await this.read();return $t(this.app,{lastSentHeartbeatDate:null!==(e=t.lastSentHeartbeatDate)&&void 0!==e?e:n.lastSentHeartbeatDate,heartbeats:t.heartbeats})}}async add(t){var e;if(await this._canUseIndexedDBPromise){const n=await this.read();return $t(this.app,{lastSentHeartbeatDate:null!==(e=t.lastSentHeartbeatDate)&&void 0!==e?e:n.lastSentHeartbeatDate,heartbeats:[...n.heartbeats,...t.heartbeats]})}}}function zt(t){return i(JSON.stringify({version:2,heartbeats:t})).length}
300
300
  /**
301
301
  * @license
302
302
  * Copyright 2019 Google LLC
@@ -312,7 +312,89 @@ class at{constructor(t,e,n){this._isDeleted=!1,this._options=Object.assign({},t)
312
312
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
313
313
  * See the License for the specific language governing permissions and
314
314
  * limitations under the License.
315
- */var Tt;Tt="",rt(new E("platform-logger",(t=>new Q(t)),"PRIVATE")),rt(new E("heartbeat",(t=>new yt(t)),"PRIVATE")),lt(J,Y,Tt),lt(J,Y,"esm2017"),lt("fire-js","");var It=function(t,e){return It=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},It(t,e)};function Et(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],s=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&s>=t.length&&(t=void 0),{value:t&&t[s++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function St(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var s,r,i=n.call(t),o=[];try{for(;(void 0===e||e-- >0)&&!(s=i.next()).done;)o.push(s.value)}catch(t){r={error:t}}finally{try{s&&!s.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return o}var bt,At="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},Ct=Ct||{},kt=At||self;function Nt(){}function Rt(t){var e=typeof t;return"array"==(e="object"!=e?e:t?Array.isArray(t)?"array":e:"null")||"object"==e&&"number"==typeof t.length}function Ot(t){var e=typeof t;return"object"==e&&null!=t||"function"==e}var Dt="closure_uid_"+(1e9*Math.random()>>>0),Lt=0;function Pt(t,e,n){return t.call.apply(t.bind,arguments)}function Mt(t,e,n){if(!t)throw Error();if(2<arguments.length){var s=Array.prototype.slice.call(arguments,2);return function(){var n=Array.prototype.slice.call(arguments);return Array.prototype.unshift.apply(n,s),t.apply(e,n)}}return function(){return t.apply(e,arguments)}}function xt(t,e,n){return(xt=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?Pt:Mt).apply(null,arguments)}function Ut(t,e){var n=Array.prototype.slice.call(arguments,1);return function(){var e=n.slice();return e.push.apply(e,arguments),t.apply(this,e)}}function Ft(t,e){function n(){}n.prototype=e.prototype,t.X=e.prototype,t.prototype=new n,t.prototype.constructor=t,t.Wb=function(t,n,s){for(var r=Array(arguments.length-2),i=2;i<arguments.length;i++)r[i-2]=arguments[i];return e.prototype[n].apply(t,r)}}function Vt(){this.s=this.s,this.o=this.o}Vt.prototype.s=!1,Vt.prototype.na=function(){var t;!this.s&&(this.s=!0,this.M(),0)&&(t=this,Object.prototype.hasOwnProperty.call(t,Dt)&&t[Dt]||(t[Dt]=++Lt))},Vt.prototype.M=function(){if(this.o)for(;this.o.length;)this.o.shift()()};var Bt=Array.prototype.indexOf?function(t,e){return Array.prototype.indexOf.call(t,e,void 0)}:function(t,e){if("string"==typeof t)return"string"!=typeof e||1!=e.length?-1:t.indexOf(e,0);for(var n=0;n<t.length;n++)if(n in t&&t[n]===e)return n;return-1};function Ht(t){var e=t.length;if(0<e){for(var n=Array(e),s=0;s<e;s++)n[s]=t[s];return n}return[]}function jt(t,e){for(var n=1;n<arguments.length;n++){var s=arguments[n];if(Rt(s)){var r=t.length||0,i=s.length||0;t.length=r+i;for(var o=0;o<i;o++)t[r+o]=s[o]}else t.push(s)}}function qt(t,e){this.type=t,this.g=this.target=e,this.defaultPrevented=!1}qt.prototype.h=function(){this.defaultPrevented=!0};var Kt=function(){if(!kt.addEventListener||!Object.defineProperty)return!1;var t=!1,e=Object.defineProperty({},"passive",{get:function(){t=!0}});try{kt.addEventListener("test",Nt,e),kt.removeEventListener("test",Nt,e)}catch(t){}return t}();function Gt(t){return/^[\s\xa0]*$/.test(t)}var Wt=String.prototype.trim?function(t){return t.trim()}:function(t){return/^[\s\xa0]*([\s\S]*?)[\s\xa0]*$/.exec(t)[1]};function zt(t,e){return t<e?-1:t>e?1:0}function $t(){var t=kt.navigator;return t&&(t=t.userAgent)?t:""}function Qt(t){return-1!=$t().indexOf(t)}function Jt(t){return Jt[" "](t),t}Jt[" "]=Nt;var Yt,Xt,Zt=Qt("Opera"),te=Qt("Trident")||Qt("MSIE"),ee=Qt("Edge"),ne=ee||te,se=Qt("Gecko")&&!(-1!=$t().toLowerCase().indexOf("webkit")&&!Qt("Edge"))&&!(Qt("Trident")||Qt("MSIE"))&&!Qt("Edge"),re=-1!=$t().toLowerCase().indexOf("webkit")&&!Qt("Edge");function ie(){var t=kt.document;return t?t.documentMode:void 0}t:{var oe="",ae=(Xt=$t(),se?/rv:([^\);]+)(\)|;)/.exec(Xt):ee?/Edge\/([\d\.]+)/.exec(Xt):te?/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(Xt):re?/WebKit\/(\S+)/.exec(Xt):Zt?/(?:Version)[ \/]?(\S+)/.exec(Xt):void 0);if(ae&&(oe=ae?ae[1]:""),te){var ce=ie();if(null!=ce&&ce>parseFloat(oe)){Yt=String(ce);break t}}Yt=oe}var ue,he={};function le(){return function(t){var e=he;return Object.prototype.hasOwnProperty.call(e,9)?e[9]:e[9]=t(9)}((function(){for(var t=0,e=Wt(String(Yt)).split("."),n=Wt("9").split("."),s=Math.max(e.length,n.length),r=0;0==t&&r<s;r++){var i=e[r]||"",o=n[r]||"";do{if(i=/(\d*)(\D*)(.*)/.exec(i)||["","","",""],o=/(\d*)(\D*)(.*)/.exec(o)||["","","",""],0==i[0].length&&0==o[0].length)break;t=zt(0==i[1].length?0:parseInt(i[1],10),0==o[1].length?0:parseInt(o[1],10))||zt(0==i[2].length,0==o[2].length)||zt(i[2],o[2]),i=i[3],o=o[3]}while(0==t)}return 0<=t}))}if(kt.document&&te){var de=ie();ue=de||(parseInt(Yt,10)||void 0)}else ue=void 0;var fe=ue;function pe(t,e){if(qt.call(this,t?t.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,t){var n=this.type=t.type,s=t.changedTouches&&t.changedTouches.length?t.changedTouches[0]:null;if(this.target=t.target||t.srcElement,this.g=e,e=t.relatedTarget){if(se){t:{try{Jt(e.nodeName);var r=!0;break t}catch(t){}r=!1}r||(e=null)}}else"mouseover"==n?e=t.fromElement:"mouseout"==n&&(e=t.toElement);this.relatedTarget=e,s?(this.clientX=void 0!==s.clientX?s.clientX:s.pageX,this.clientY=void 0!==s.clientY?s.clientY:s.pageY,this.screenX=s.screenX||0,this.screenY=s.screenY||0):(this.clientX=void 0!==t.clientX?t.clientX:t.pageX,this.clientY=void 0!==t.clientY?t.clientY:t.pageY,this.screenX=t.screenX||0,this.screenY=t.screenY||0),this.button=t.button,this.key=t.key||"",this.ctrlKey=t.ctrlKey,this.altKey=t.altKey,this.shiftKey=t.shiftKey,this.metaKey=t.metaKey,this.pointerId=t.pointerId||0,this.pointerType="string"==typeof t.pointerType?t.pointerType:ge[t.pointerType]||"",this.state=t.state,this.i=t,t.defaultPrevented&&pe.X.h.call(this)}}Ft(pe,qt);var ge={2:"touch",3:"pen",4:"mouse"};pe.prototype.h=function(){pe.X.h.call(this);var t=this.i;t.preventDefault?t.preventDefault():t.returnValue=!1};var me="closure_listenable_"+(1e6*Math.random()|0),ye=0;function ve(t,e,n,s,r){this.listener=t,this.proxy=null,this.src=e,this.type=n,this.capture=!!s,this.ha=r,this.key=++ye,this.ba=this.ea=!1}function we(t){t.ba=!0,t.listener=null,t.proxy=null,t.src=null,t.ha=null}function _e(t,e,n){for(var s in t)e.call(n,t[s],s,t)}function Te(t){var e={};for(var n in t)e[n]=t[n];return e}var Ie="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function Ee(t,e){for(var n,s,r=1;r<arguments.length;r++){for(n in s=arguments[r])t[n]=s[n];for(var i=0;i<Ie.length;i++)n=Ie[i],Object.prototype.hasOwnProperty.call(s,n)&&(t[n]=s[n])}}function Se(t){this.src=t,this.g={},this.h=0}function be(t,e){var n=e.type;if(n in t.g){var s,r=t.g[n],i=Bt(r,e);(s=0<=i)&&Array.prototype.splice.call(r,i,1),s&&(we(e),0==t.g[n].length&&(delete t.g[n],t.h--))}}function Ae(t,e,n,s){for(var r=0;r<t.length;++r){var i=t[r];if(!i.ba&&i.listener==e&&i.capture==!!n&&i.ha==s)return r}return-1}Se.prototype.add=function(t,e,n,s,r){var i=t.toString();(t=this.g[i])||(t=this.g[i]=[],this.h++);var o=Ae(t,e,s,r);return-1<o?(e=t[o],n||(e.ea=!1)):((e=new ve(e,this.src,i,!!s,r)).ea=n,t.push(e)),e};var Ce="closure_lm_"+(1e6*Math.random()|0),ke={};function Ne(t,e,n,s,r){if(s&&s.once)return Oe(t,e,n,s,r);if(Array.isArray(e)){for(var i=0;i<e.length;i++)Ne(t,e[i],n,s,r);return null}return n=Fe(n),t&&t[me]?t.N(e,n,Ot(s)?!!s.capture:!!s,r):Re(t,e,n,!1,s,r)}function Re(t,e,n,s,r,i){if(!e)throw Error("Invalid event type");var o=Ot(r)?!!r.capture:!!r,a=xe(t);if(a||(t[Ce]=a=new Se(t)),(n=a.add(e,n,s,o,i)).proxy)return n;if(s=function(){function t(n){return e.call(t.src,t.listener,n)}var e=Me;return t}(),n.proxy=s,s.src=t,s.listener=n,t.addEventListener)Kt||(r=o),void 0===r&&(r=!1),t.addEventListener(e.toString(),s,r);else if(t.attachEvent)t.attachEvent(Pe(e.toString()),s);else{if(!t.addListener||!t.removeListener)throw Error("addEventListener and attachEvent are unavailable.");t.addListener(s)}return n}function Oe(t,e,n,s,r){if(Array.isArray(e)){for(var i=0;i<e.length;i++)Oe(t,e[i],n,s,r);return null}return n=Fe(n),t&&t[me]?t.O(e,n,Ot(s)?!!s.capture:!!s,r):Re(t,e,n,!0,s,r)}function De(t,e,n,s,r){if(Array.isArray(e))for(var i=0;i<e.length;i++)De(t,e[i],n,s,r);else s=Ot(s)?!!s.capture:!!s,n=Fe(n),t&&t[me]?(t=t.i,(e=String(e).toString())in t.g&&(-1<(n=Ae(i=t.g[e],n,s,r))&&(we(i[n]),Array.prototype.splice.call(i,n,1),0==i.length&&(delete t.g[e],t.h--)))):t&&(t=xe(t))&&(e=t.g[e.toString()],t=-1,e&&(t=Ae(e,n,s,r)),(n=-1<t?e[t]:null)&&Le(n))}function Le(t){if("number"!=typeof t&&t&&!t.ba){var e=t.src;if(e&&e[me])be(e.i,t);else{var n=t.type,s=t.proxy;e.removeEventListener?e.removeEventListener(n,s,t.capture):e.detachEvent?e.detachEvent(Pe(n),s):e.addListener&&e.removeListener&&e.removeListener(s),(n=xe(e))?(be(n,t),0==n.h&&(n.src=null,e[Ce]=null)):we(t)}}}function Pe(t){return t in ke?ke[t]:ke[t]="on"+t}function Me(t,e){if(t.ba)t=!0;else{e=new pe(e,this);var n=t.listener,s=t.ha||t.src;t.ea&&Le(t),t=n.call(s,e)}return t}function xe(t){return(t=t[Ce])instanceof Se?t:null}var Ue="__closure_events_fn_"+(1e9*Math.random()>>>0);function Fe(t){return"function"==typeof t?t:(t[Ue]||(t[Ue]=function(e){return t.handleEvent(e)}),t[Ue])}function Ve(){Vt.call(this),this.i=new Se(this),this.P=this,this.I=null}function Be(t,e){var n,s=t.I;if(s)for(n=[];s;s=s.I)n.push(s);if(t=t.P,s=e.type||e,"string"==typeof e)e=new qt(e,t);else if(e instanceof qt)e.target=e.target||t;else{var r=e;Ee(e=new qt(s,t),r)}if(r=!0,n)for(var i=n.length-1;0<=i;i--){var o=e.g=n[i];r=He(o,s,!0,e)&&r}if(r=He(o=e.g=t,s,!0,e)&&r,r=He(o,s,!1,e)&&r,n)for(i=0;i<n.length;i++)r=He(o=e.g=n[i],s,!1,e)&&r}function He(t,e,n,s){if(!(e=t.i.g[String(e)]))return!0;e=e.concat();for(var r=!0,i=0;i<e.length;++i){var o=e[i];if(o&&!o.ba&&o.capture==n){var a=o.listener,c=o.ha||o.src;o.ea&&be(t.i,o),r=!1!==a.call(c,s)&&r}}return r&&!s.defaultPrevented}Ft(Ve,Vt),Ve.prototype[me]=!0,Ve.prototype.removeEventListener=function(t,e,n,s){De(this,t,e,n,s)},Ve.prototype.M=function(){if(Ve.X.M.call(this),this.i){var t,e=this.i;for(t in e.g){for(var n=e.g[t],s=0;s<n.length;s++)we(n[s]);delete e.g[t],e.h--}}this.I=null},Ve.prototype.N=function(t,e,n,s){return this.i.add(String(t),e,!1,n,s)},Ve.prototype.O=function(t,e,n,s){return this.i.add(String(t),e,!0,n,s)};var je=kt.JSON.stringify;function qe(){var t=Ye,e=null;return t.g&&(e=t.g,t.g=t.g.next,t.g||(t.h=null),e.next=null),e}var Ke,Ge=function(){function t(){this.h=this.g=null}return t.prototype.add=function(t,e){var n=We.get();n.set(t,e),this.h?this.h.next=n:this.g=n,this.h=n},t}(),We=new(function(){function t(t,e){this.i=t,this.j=e,this.h=0,this.g=null}return t.prototype.get=function(){var t;return 0<this.h?(this.h--,t=this.g,this.g=t.next,t.next=null):t=this.i(),t},t}())((function(){return new ze}),(function(t){return t.reset()})),ze=function(){function t(){this.next=this.g=this.h=null}return t.prototype.set=function(t,e){this.h=t,this.g=e,this.next=null},t.prototype.reset=function(){this.next=this.g=this.h=null},t}();function $e(t){kt.setTimeout((function(){throw t}),0)}function Qe(t,e){Ke||function(){var t=kt.Promise.resolve(void 0);Ke=function(){t.then(Xe)}}(),Je||(Ke(),Je=!0),Ye.add(t,e)}var Je=!1,Ye=new Ge;function Xe(){for(var t;t=qe();){try{t.h.call(t.g)}catch(t){$e(t)}var e=We;e.j(t),100>e.h&&(e.h++,t.next=e.g,e.g=t)}Je=!1}function Ze(t,e){Ve.call(this),this.h=t||1,this.g=e||kt,this.j=xt(this.lb,this),this.l=Date.now()}function tn(t){t.ca=!1,t.R&&(t.g.clearTimeout(t.R),t.R=null)}function en(t,e,n){if("function"==typeof t)n&&(t=xt(t,n));else{if(!t||"function"!=typeof t.handleEvent)throw Error("Invalid listener argument");t=xt(t.handleEvent,t)}return 2147483647<Number(e)?-1:kt.setTimeout(t,e||0)}function nn(t){t.g=en((function(){t.g=null,t.i&&(t.i=!1,nn(t))}),t.j);var e=t.h;t.h=null,t.m.apply(null,e)}Ft(Ze,Ve),(bt=Ze.prototype).ca=!1,bt.R=null,bt.lb=function(){if(this.ca){var t=Date.now()-this.l;0<t&&t<.8*this.h?this.R=this.g.setTimeout(this.j,this.h-t):(this.R&&(this.g.clearTimeout(this.R),this.R=null),Be(this,"tick"),this.ca&&(tn(this),this.start()))}},bt.start=function(){this.ca=!0,this.R||(this.R=this.g.setTimeout(this.j,this.h),this.l=Date.now())},bt.M=function(){Ze.X.M.call(this),tn(this),delete this.g};var sn=function(t){function e(e,n){var s=t.call(this)||this;return s.m=e,s.j=n,s.h=null,s.i=!1,s.g=null,s}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}It(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}(e,t),e.prototype.l=function(t){this.h=arguments,this.g?this.i=!0:nn(this)},e.prototype.M=function(){t.prototype.M.call(this),this.g&&(kt.clearTimeout(this.g),this.g=null,this.i=!1,this.h=null)},e}(Vt);function rn(t){Vt.call(this),this.h=t,this.g={}}Ft(rn,Vt);var on=[];function an(t,e,n,s){Array.isArray(n)||(n&&(on[0]=n.toString()),n=on);for(var r=0;r<n.length;r++){var i=Ne(e,n[r],s||t.handleEvent,!1,t.h||t);if(!i)break;t.g[i.key]=i}}function cn(t){_e(t.g,(function(t,e){this.g.hasOwnProperty(e)&&Le(t)}),t),t.g={}}function un(){this.g=!0}function hn(t,e,n,s){t.info((function(){return"XMLHTTP TEXT ("+e+"): "+function(t,e){if(!t.g)return e;if(!e)return null;try{var n=JSON.parse(e);if(n)for(t=0;t<n.length;t++)if(Array.isArray(n[t])){var s=n[t];if(!(2>s.length)){var r=s[1];if(Array.isArray(r)&&!(1>r.length)){var i=r[0];if("noop"!=i&&"stop"!=i&&"close"!=i)for(var o=1;o<r.length;o++)r[o]=""}}}return je(n)}catch(t){return e}}(t,n)+(s?" "+s:"")}))}rn.prototype.M=function(){rn.X.M.call(this),cn(this)},rn.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")},un.prototype.Aa=function(){this.g=!1},un.prototype.info=function(){};var ln={},dn=null;function fn(){return dn=dn||new Ve}function pn(t){qt.call(this,ln.Pa,t)}function gn(t){var e=fn();Be(e,new pn(e))}function mn(t,e){qt.call(this,ln.STAT_EVENT,t),this.stat=e}function yn(t){var e=fn();Be(e,new mn(e,t))}function vn(t,e){qt.call(this,ln.Qa,t),this.size=e}function wn(t,e){if("function"!=typeof t)throw Error("Fn must not be null and must be a function");return kt.setTimeout((function(){t()}),e)}ln.Pa="serverreachability",Ft(pn,qt),ln.STAT_EVENT="statevent",Ft(mn,qt),ln.Qa="timingevent",Ft(vn,qt);var _n={NO_ERROR:0,mb:1,zb:2,yb:3,tb:4,xb:5,Ab:6,Ma:7,TIMEOUT:8,Db:9},Tn={rb:"complete",Nb:"success",Na:"error",Ma:"abort",Fb:"ready",Gb:"readystatechange",TIMEOUT:"timeout",Bb:"incrementaldata",Eb:"progress",ub:"downloadprogress",Vb:"uploadprogress"};function In(){}function En(t){return t.h||(t.h=t.i())}function Sn(){}In.prototype.h=null;var bn,An={OPEN:"a",qb:"b",Na:"c",Cb:"d"};function Cn(){qt.call(this,"d")}function kn(){qt.call(this,"c")}function Nn(){}function Rn(t,e,n,s){this.l=t,this.j=e,this.m=n,this.U=s||1,this.S=new rn(this),this.O=Dn,t=ne?125:void 0,this.T=new Ze(t),this.H=null,this.i=!1,this.s=this.A=this.v=this.K=this.F=this.V=this.B=null,this.D=[],this.g=null,this.C=0,this.o=this.u=null,this.Y=-1,this.I=!1,this.N=0,this.L=null,this.$=this.J=this.Z=this.P=!1,this.h=new On}function On(){this.i=null,this.g="",this.h=!1}Ft(Cn,qt),Ft(kn,qt),Ft(Nn,In),Nn.prototype.g=function(){return new XMLHttpRequest},Nn.prototype.i=function(){return{}},bn=new Nn;var Dn=45e3,Ln={},Pn={};function Mn(t,e,n){t.K=1,t.v=ts(Qn(e)),t.s=n,t.P=!0,xn(t,null)}function xn(t,e){t.F=Date.now(),Bn(t),t.A=Qn(t.v);var n=t.A,s=t.U;Array.isArray(s)||(s=[String(s)]),fs(n.i,"t",s),t.C=0,n=t.l.H,t.h=new On,t.g=fr(t.l,n?e:null,!t.s),0<t.N&&(t.L=new sn(xt(t.La,t,t.g),t.N)),an(t.S,t.g,"readystatechange",t.ib),e=t.H?Te(t.H):{},t.s?(t.u||(t.u="POST"),e["Content-Type"]="application/x-www-form-urlencoded",t.g.da(t.A,t.u,t.s,e)):(t.u="GET",t.g.da(t.A,t.u,null,e)),gn(),function(t,e,n,s,r,i){t.info((function(){if(t.g)if(i)for(var o="",a=i.split("&"),c=0;c<a.length;c++){var u=a[c].split("=");if(1<u.length){var h=u[0];u=u[1];var l=h.split("_");o=2<=l.length&&"type"==l[1]?o+(h+"=")+u+"&":o+(h+"=redacted&")}}else o=null;else o=i;return"XMLHTTP REQ ("+s+") [attempt "+r+"]: "+e+"\n"+n+"\n"+o}))}(t.j,t.u,t.A,t.m,t.U,t.s)}function Un(t){return!!t.g&&("GET"==t.u&&2!=t.K&&t.l.Da)}function Fn(t,e,n){for(var s,r=!0;!t.I&&t.C<n.length;){if((s=Vn(t,n))==Pn){4==e&&(t.o=4,yn(14),r=!1),hn(t.j,t.m,null,"[Incomplete Response]");break}if(s==Ln){t.o=4,yn(15),hn(t.j,t.m,n,"[Invalid Chunk]"),r=!1;break}hn(t.j,t.m,s,null),Gn(t,s)}Un(t)&&s!=Pn&&s!=Ln&&(t.h.g="",t.C=0),4!=e||0!=n.length||t.h.h||(t.o=1,yn(16),r=!1),t.i=t.i&&r,r?0<n.length&&!t.$&&(t.$=!0,(e=t.l).g==t&&e.$&&!e.K&&(e.j.info("Great, no buffering proxy detected. Bytes received: "+n.length),ir(e),e.K=!0,yn(11))):(hn(t.j,t.m,n,"[Invalid Chunked Response]"),Kn(t),qn(t))}function Vn(t,e){var n=t.C,s=e.indexOf("\n",n);return-1==s?Pn:(n=Number(e.substring(n,s)),isNaN(n)?Ln:(s+=1)+n>e.length?Pn:(e=e.substr(s,n),t.C=s+n,e))}function Bn(t){t.V=Date.now()+t.O,Hn(t,t.O)}function Hn(t,e){if(null!=t.B)throw Error("WatchDog timer not null");t.B=wn(xt(t.gb,t),e)}function jn(t){t.B&&(kt.clearTimeout(t.B),t.B=null)}function qn(t){0==t.l.G||t.I||cr(t.l,t)}function Kn(t){jn(t);var e=t.L;e&&"function"==typeof e.na&&e.na(),t.L=null,tn(t.T),cn(t.S),t.g&&(e=t.g,t.g=null,e.abort(),e.na())}function Gn(t,e){try{var n=t.l;if(0!=n.G&&(n.g==t||_s(n.h,t)))if(!t.J&&_s(n.h,t)&&3==n.G){try{var s=n.Fa.g.parse(e)}catch(i){s=null}if(Array.isArray(s)&&3==s.length){var r=s;if(0==r[0]){t:if(!n.u){if(n.g){if(!(n.g.F+3e3<t.F))break t;ar(n),Ys(n)}rr(n),yn(18)}}else n.Ba=r[1],0<n.Ba-n.T&&37500>r[2]&&n.L&&0==n.A&&!n.v&&(n.v=wn(xt(n.cb,n),6e3));if(1>=ws(n.h)&&n.ja){try{n.ja()}catch(i){}n.ja=void 0}}else hr(n,11)}else if((t.J||n.g==t)&&ar(n),!Gt(e))for(r=n.Fa.g.parse(e),e=0;e<r.length;e++){var i=r[e];if(n.T=i[0],i=i[1],2==n.G)if("c"==i[0]){n.I=i[1],n.ka=i[2];var o=i[3];null!=o&&(n.ma=o,n.j.info("VER="+n.ma));var a=i[4];null!=a&&(n.Ca=a,n.j.info("SVER="+n.Ca));var c=i[5];null!=c&&"number"==typeof c&&0<c&&(s=1.5*c,n.J=s,n.j.info("backChannelRequestTimeoutMs_="+s)),s=n;var u=t.g;if(u){var h=u.g?u.g.getResponseHeader("X-Client-Wire-Protocol"):null;if(h){var l=s.h;l.g||-1==h.indexOf("spdy")&&-1==h.indexOf("quic")&&-1==h.indexOf("h2")||(l.j=l.l,l.g=new Set,l.h&&(Ts(l,l.h),l.h=null))}if(s.D){var d=u.g?u.g.getResponseHeader("X-HTTP-Session-Id"):null;d&&(s.za=d,Zn(s.F,s.D,d))}}n.G=3,n.l&&n.l.xa(),n.$&&(n.P=Date.now()-t.F,n.j.info("Handshake RTT: "+n.P+"ms"));var f=t;if((s=n).sa=dr(s,s.H?s.ka:null,s.V),f.J){Is(s.h,f);var p=f,g=s.J;g&&p.setTimeout(g),p.B&&(jn(p),Bn(p)),s.g=f}else sr(s);0<n.i.length&&Zs(n)}else"stop"!=i[0]&&"close"!=i[0]||hr(n,7);else 3==n.G&&("stop"==i[0]||"close"==i[0]?"stop"==i[0]?hr(n,7):Js(n):"noop"!=i[0]&&n.l&&n.l.wa(i),n.A=0)}gn()}catch(i){}}function Wn(t,e){if(t.forEach&&"function"==typeof t.forEach)t.forEach(e,void 0);else if(Rt(t)||"string"==typeof t)Array.prototype.forEach.call(t,e,void 0);else for(var n=function(t){if(t.oa&&"function"==typeof t.oa)return t.oa();if(!t.W||"function"!=typeof t.W){if("undefined"!=typeof Map&&t instanceof Map)return Array.from(t.keys());if(!("undefined"!=typeof Set&&t instanceof Set)){if(Rt(t)||"string"==typeof t){var e=[];t=t.length;for(var n=0;n<t;n++)e.push(n);return e}for(var s in e=[],n=0,t)e[n++]=s;return e}}}(t),s=function(t){if(t.W&&"function"==typeof t.W)return t.W();if("undefined"!=typeof Map&&t instanceof Map||"undefined"!=typeof Set&&t instanceof Set)return Array.from(t.values());if("string"==typeof t)return t.split("");if(Rt(t)){for(var e=[],n=t.length,s=0;s<n;s++)e.push(t[s]);return e}for(s in e=[],n=0,t)e[n++]=t[s];return e}(t),r=s.length,i=0;i<r;i++)e.call(void 0,s[i],n&&n[i],t)}(bt=Rn.prototype).setTimeout=function(t){this.O=t},bt.ib=function(t){t=t.target;var e=this.L;e&&3==Ks(t)?e.l():this.La(t)},bt.La=function(t){try{if(t==this.g)t:{var e=Ks(this.g),n=this.g.Ea();this.g.aa();if(!(3>e)&&(3!=e||ne||this.g&&(this.h.h||this.g.fa()||Gs(this.g)))){this.I||4!=e||7==n||gn(),jn(this);var s=this.g.aa();this.Y=s;e:if(Un(this)){var r=Gs(this.g);t="";var i=r.length,o=4==Ks(this.g);if(!this.h.i){if("undefined"==typeof TextDecoder){Kn(this),qn(this);var a="";break e}this.h.i=new kt.TextDecoder}for(n=0;n<i;n++)this.h.h=!0,t+=this.h.i.decode(r[n],{stream:o&&n==i-1});r.splice(0,i),this.h.g+=t,this.C=0,a=this.h.g}else a=this.g.fa();if(this.i=200==s,function(t,e,n,s,r,i,o){t.info((function(){return"XMLHTTP RESP ("+s+") [ attempt "+r+"]: "+e+"\n"+n+"\n"+i+" "+o}))}(this.j,this.u,this.A,this.m,this.U,e,s),this.i){if(this.Z&&!this.J){e:{if(this.g){var c,u=this.g;if((c=u.g?u.g.getResponseHeader("X-HTTP-Initial-Response"):null)&&!Gt(c)){var h=c;break e}}h=null}if(!(s=h)){this.i=!1,this.o=3,yn(12),Kn(this),qn(this);break t}hn(this.j,this.m,s,"Initial handshake response via X-HTTP-Initial-Response"),this.J=!0,Gn(this,s)}this.P?(Fn(this,e,a),ne&&this.i&&3==e&&(an(this.S,this.T,"tick",this.hb),this.T.start())):(hn(this.j,this.m,a,null),Gn(this,a)),4==e&&Kn(this),this.i&&!this.I&&(4==e?cr(this.l,this):(this.i=!1,Bn(this)))}else 400==s&&0<a.indexOf("Unknown SID")?(this.o=3,yn(12)):(this.o=0,yn(13)),Kn(this),qn(this)}}}catch(e){}},bt.hb=function(){if(this.g){var t=Ks(this.g),e=this.g.fa();this.C<e.length&&(jn(this),Fn(this,t,e),this.i&&4!=t&&Bn(this))}},bt.cancel=function(){this.I=!0,Kn(this)},bt.gb=function(){this.B=null;var t=Date.now();0<=t-this.V?(function(t,e){t.info((function(){return"TIMEOUT: "+e}))}(this.j,this.A),2!=this.K&&(gn(),yn(17)),Kn(this),this.o=2,qn(this)):Hn(this,this.V-t)};var zn=RegExp("^(?:([^:/?#.]+):)?(?://(?:([^\\\\/?#]*)@)?([^\\\\/?#]*?)(?::([0-9]+))?(?=[\\\\/?#]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#([\\s\\S]*))?$");function $n(t,e){if(this.g=this.s=this.j="",this.m=null,this.o=this.l="",this.h=!1,t instanceof $n){this.h=void 0!==e?e:t.h,Jn(this,t.j),this.s=t.s,this.g=t.g,Yn(this,t.m),this.l=t.l,e=t.i;var n=new us;n.i=e.i,e.g&&(n.g=new Map(e.g),n.h=e.h),Xn(this,n),this.o=t.o}else t&&(n=String(t).match(zn))?(this.h=!!e,Jn(this,n[1]||"",!0),this.s=es(n[2]||""),this.g=es(n[3]||"",!0),Yn(this,n[4]),this.l=es(n[5]||"",!0),Xn(this,n[6]||"",!0),this.o=es(n[7]||"")):(this.h=!!e,this.i=new us(null,this.h))}function Qn(t){return new $n(t)}function Jn(t,e,n){t.j=n?es(e,!0):e,t.j&&(t.j=t.j.replace(/:$/,""))}function Yn(t,e){if(e){if(e=Number(e),isNaN(e)||0>e)throw Error("Bad port number "+e);t.m=e}else t.m=null}function Xn(t,e,n){e instanceof us?(t.i=e,function(t,e){e&&!t.j&&(hs(t),t.i=null,t.g.forEach((function(t,e){var n=e.toLowerCase();e!=n&&(ls(this,e),fs(this,n,t))}),t)),t.j=e}(t.i,t.h)):(n||(e=ns(e,as)),t.i=new us(e,t.h))}function Zn(t,e,n){t.i.set(e,n)}function ts(t){return Zn(t,"zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^Date.now()).toString(36)),t}function es(t,e){return t?e?decodeURI(t.replace(/%25/g,"%2525")):decodeURIComponent(t):""}function ns(t,e,n){return"string"==typeof t?(t=encodeURI(t).replace(e,ss),n&&(t=t.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),t):null}function ss(t){return"%"+((t=t.charCodeAt(0))>>4&15).toString(16)+(15&t).toString(16)}$n.prototype.toString=function(){var t=[],e=this.j;e&&t.push(ns(e,rs,!0),":");var n=this.g;return(n||"file"==e)&&(t.push("//"),(e=this.s)&&t.push(ns(e,rs,!0),"@"),t.push(encodeURIComponent(String(n)).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),null!=(n=this.m)&&t.push(":",String(n))),(n=this.l)&&(this.g&&"/"!=n.charAt(0)&&t.push("/"),t.push(ns(n,"/"==n.charAt(0)?os:is,!0))),(n=this.i.toString())&&t.push("?",n),(n=this.o)&&t.push("#",ns(n,cs)),t.join("")};var rs=/[#\/\?@]/g,is=/[#\?:]/g,os=/[#\?]/g,as=/[#\?@]/g,cs=/#/g;function us(t,e){this.h=this.g=null,this.i=t||null,this.j=!!e}function hs(t){t.g||(t.g=new Map,t.h=0,t.i&&function(t,e){if(t){t=t.split("&");for(var n=0;n<t.length;n++){var s=t[n].indexOf("="),r=null;if(0<=s){var i=t[n].substring(0,s);r=t[n].substring(s+1)}else i=t[n];e(i,r?decodeURIComponent(r.replace(/\+/g," ")):"")}}}(t.i,(function(e,n){t.add(decodeURIComponent(e.replace(/\+/g," ")),n)})))}function ls(t,e){hs(t),e=ps(t,e),t.g.has(e)&&(t.i=null,t.h-=t.g.get(e).length,t.g.delete(e))}function ds(t,e){return hs(t),e=ps(t,e),t.g.has(e)}function fs(t,e,n){ls(t,e),0<n.length&&(t.i=null,t.g.set(ps(t,e),Ht(n)),t.h+=n.length)}function ps(t,e){return e=String(e),t.j&&(e=e.toLowerCase()),e}(bt=us.prototype).add=function(t,e){hs(this),this.i=null,t=ps(this,t);var n=this.g.get(t);return n||this.g.set(t,n=[]),n.push(e),this.h+=1,this},bt.forEach=function(t,e){hs(this),this.g.forEach((function(n,s){n.forEach((function(n){t.call(e,n,s,this)}),this)}),this)},bt.oa=function(){hs(this);for(var t=Array.from(this.g.values()),e=Array.from(this.g.keys()),n=[],s=0;s<e.length;s++)for(var r=t[s],i=0;i<r.length;i++)n.push(e[s]);return n},bt.W=function(t){hs(this);var e=[];if("string"==typeof t)ds(this,t)&&(e=e.concat(this.g.get(ps(this,t))));else{t=Array.from(this.g.values());for(var n=0;n<t.length;n++)e=e.concat(t[n])}return e},bt.set=function(t,e){return hs(this),this.i=null,ds(this,t=ps(this,t))&&(this.h-=this.g.get(t).length),this.g.set(t,[e]),this.h+=1,this},bt.get=function(t,e){return t&&0<(t=this.W(t)).length?String(t[0]):e},bt.toString=function(){if(this.i)return this.i;if(!this.g)return"";for(var t=[],e=Array.from(this.g.keys()),n=0;n<e.length;n++){var s=e[n],r=encodeURIComponent(String(s)),i=this.W(s);for(s=0;s<i.length;s++){var o=r;""!==i[s]&&(o+="="+encodeURIComponent(String(i[s]))),t.push(o)}}return this.i=t.join("&")};var gs=function(t,e){this.h=t,this.g=e};function ms(t){this.l=t||ys,kt.PerformanceNavigationTiming?t=0<(t=kt.performance.getEntriesByType("navigation")).length&&("hq"==t[0].nextHopProtocol||"h2"==t[0].nextHopProtocol):t=!!(kt.g&&kt.g.Ga&&kt.g.Ga()&&kt.g.Ga().$b),this.j=t?this.l:1,this.g=null,1<this.j&&(this.g=new Set),this.h=null,this.i=[]}var ys=10;function vs(t){return!!t.h||!!t.g&&t.g.size>=t.j}function ws(t){return t.h?1:t.g?t.g.size:0}function _s(t,e){return t.h?t.h==e:!!t.g&&t.g.has(e)}function Ts(t,e){t.g?t.g.add(e):t.h=e}function Is(t,e){t.h&&t.h==e?t.h=null:t.g&&t.g.has(e)&&t.g.delete(e)}function Es(t){var e,n;if(null!=t.h)return t.i.concat(t.h.D);if(null!=t.g&&0!==t.g.size){var s=t.i;try{for(var r=Et(t.g.values()),i=r.next();!i.done;i=r.next()){var o=i.value;s=s.concat(o.D)}}catch(t){e={error:t}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(e)throw e.error}}return s}return Ht(t.i)}function Ss(){}function bs(){this.g=new Ss}function As(t,e,n){var s=n||"";try{Wn(t,(function(t,n){var r=t;Ot(t)&&(r=je(t)),e.push(s+n+"="+encodeURIComponent(r))}))}catch(t){throw e.push(s+"type="+encodeURIComponent("_badmap")),t}}function Cs(t,e,n,s,r){try{e.onload=null,e.onerror=null,e.onabort=null,e.ontimeout=null,r(s)}catch(t){}}function ks(t){this.l=t.ac||null,this.j=t.jb||!1}function Ns(t,e){Ve.call(this),this.D=t,this.u=e,this.m=void 0,this.readyState=Rs,this.status=0,this.responseType=this.responseText=this.response=this.statusText="",this.onreadystatechange=null,this.v=new Headers,this.h=null,this.C="GET",this.B="",this.g=!1,this.A=this.j=this.l=null}ms.prototype.cancel=function(){var t,e;if(this.i=Es(this),this.h)this.h.cancel(),this.h=null;else if(this.g&&0!==this.g.size){try{for(var n=Et(this.g.values()),s=n.next();!s.done;s=n.next()){s.value.cancel()}}catch(e){t={error:e}}finally{try{s&&!s.done&&(e=n.return)&&e.call(n)}finally{if(t)throw t.error}}this.g.clear()}},Ss.prototype.stringify=function(t){return kt.JSON.stringify(t,void 0)},Ss.prototype.parse=function(t){return kt.JSON.parse(t,void 0)},Ft(ks,In),ks.prototype.g=function(){return new Ns(this.l,this.j)},ks.prototype.i=function(t){return function(){return t}}({}),Ft(Ns,Ve);var Rs=0;function Os(t){t.j.read().then(t.Ta.bind(t)).catch(t.ga.bind(t))}function Ds(t){t.readyState=4,t.l=null,t.j=null,t.A=null,Ls(t)}function Ls(t){t.onreadystatechange&&t.onreadystatechange.call(t)}(bt=Ns.prototype).open=function(t,e){if(this.readyState!=Rs)throw this.abort(),Error("Error reopening a connection");this.C=t,this.B=e,this.readyState=1,Ls(this)},bt.send=function(t){if(1!=this.readyState)throw this.abort(),Error("need to call open() first. ");this.g=!0;var e={headers:this.v,method:this.C,credentials:this.m,cache:void 0};t&&(e.body=t),(this.D||kt).fetch(new Request(this.B,e)).then(this.Wa.bind(this),this.ga.bind(this))},bt.abort=function(){this.response=this.responseText="",this.v=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,Ds(this)),this.readyState=Rs},bt.Wa=function(t){if(this.g&&(this.l=t,this.h||(this.status=this.l.status,this.statusText=this.l.statusText,this.h=t.headers,this.readyState=2,Ls(this)),this.g&&(this.readyState=3,Ls(this),this.g)))if("arraybuffer"===this.responseType)t.arrayBuffer().then(this.Ua.bind(this),this.ga.bind(this));else if(void 0!==kt.ReadableStream&&"body"in t){if(this.j=t.body.getReader(),this.u){if(this.responseType)throw Error('responseType must be empty for "streamBinaryChunks" mode responses.');this.response=[]}else this.response=this.responseText="",this.A=new TextDecoder;Os(this)}else t.text().then(this.Va.bind(this),this.ga.bind(this))},bt.Ta=function(t){if(this.g){if(this.u&&t.value)this.response.push(t.value);else if(!this.u){var e=t.value?t.value:new Uint8Array(0);(e=this.A.decode(e,{stream:!t.done}))&&(this.response=this.responseText+=e)}t.done?Ds(this):Ls(this),3==this.readyState&&Os(this)}},bt.Va=function(t){this.g&&(this.response=this.responseText=t,Ds(this))},bt.Ua=function(t){this.g&&(this.response=t,Ds(this))},bt.ga=function(){this.g&&Ds(this)},bt.setRequestHeader=function(t,e){this.v.append(t,e)},bt.getResponseHeader=function(t){return this.h&&this.h.get(t.toLowerCase())||""},bt.getAllResponseHeaders=function(){if(!this.h)return"";for(var t=[],e=this.h.entries(),n=e.next();!n.done;)n=n.value,t.push(n[0]+": "+n[1]),n=e.next();return t.join("\r\n")},Object.defineProperty(Ns.prototype,"withCredentials",{get:function(){return"include"===this.m},set:function(t){this.m=t?"include":"same-origin"}});var Ps=kt.JSON.parse;function Ms(t){Ve.call(this),this.headers=new Map,this.u=t||null,this.h=!1,this.C=this.g=null,this.H="",this.m=0,this.j="",this.l=this.F=this.v=this.D=!1,this.B=0,this.A=null,this.J=xs,this.K=this.L=!1}Ft(Ms,Ve);var xs="",Us=/^https?$/i,Fs=["POST","PUT"];function Vs(t,e){t.h=!1,t.g&&(t.l=!0,t.g.abort(),t.l=!1),t.j=e,t.m=5,Bs(t),js(t)}function Bs(t){t.D||(t.D=!0,Be(t,"complete"),Be(t,"error"))}function Hs(t){if(t.h&&void 0!==Ct&&(!t.C[1]||4!=Ks(t)||2!=t.aa()))if(t.v&&4==Ks(t))en(t.Ha,0,t);else if(Be(t,"readystatechange"),4==Ks(t)){t.h=!1;try{var e,n=t.aa();t:switch(n){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var s=!0;break t;default:s=!1}if(!(e=s)){var r;if(r=0===n){var i=String(t.H).match(zn)[1]||null;if(!i&&kt.self&&kt.self.location){var o=kt.self.location.protocol;i=o.substr(0,o.length-1)}r=!Us.test(i?i.toLowerCase():"")}e=r}if(e)Be(t,"complete"),Be(t,"success");else{t.m=6;try{var a=2<Ks(t)?t.g.statusText:""}catch(t){a=""}t.j=a+" ["+t.aa()+"]",Bs(t)}}finally{js(t)}}}function js(t,e){if(t.g){qs(t);var n=t.g,s=t.C[0]?Nt:null;t.g=null,t.C=null,e||Be(t,"ready");try{n.onreadystatechange=s}catch(t){}}}function qs(t){t.g&&t.K&&(t.g.ontimeout=null),t.A&&(kt.clearTimeout(t.A),t.A=null)}function Ks(t){return t.g?t.g.readyState:0}function Gs(t){try{if(!t.g)return null;if("response"in t.g)return t.g.response;switch(t.J){case xs:case"text":return t.g.responseText;case"arraybuffer":if("mozResponseArrayBuffer"in t.g)return t.g.mozResponseArrayBuffer}return null}catch(t){return null}}function Ws(t){var e="";return _e(t,(function(t,n){e+=n,e+=":",e+=t,e+="\r\n"})),e}function zs(t,e,n){t:{for(s in n){var s=!1;break t}s=!0}s||(n=Ws(n),"string"==typeof t?null!=n&&encodeURIComponent(String(n)):Zn(t,e,n))}function $s(t,e,n){return n&&n.internalChannelParams&&n.internalChannelParams[t]||e}function Qs(t){this.Ca=0,this.i=[],this.j=new un,this.ka=this.sa=this.F=this.V=this.g=this.za=this.D=this.ia=this.o=this.S=this.s=null,this.ab=this.U=0,this.Za=$s("failFast",!1,t),this.L=this.v=this.u=this.m=this.l=null,this.Y=!0,this.pa=this.Ba=this.T=-1,this.Z=this.A=this.C=0,this.Xa=$s("baseRetryDelayMs",5e3,t),this.bb=$s("retryDelaySeedMs",1e4,t),this.$a=$s("forwardChannelMaxRetries",2,t),this.ta=$s("forwardChannelRequestTimeoutMs",2e4,t),this.ra=t&&t.xmlHttpFactory||void 0,this.Da=t&&t.Zb||!1,this.J=void 0,this.H=t&&t.supportsCrossDomainXhr||!1,this.I="",this.h=new ms(t&&t.concurrentRequestLimit),this.Fa=new bs,this.O=t&&t.fastHandshake||!1,this.N=t&&t.encodeInitMessageHeaders||!1,this.O&&this.N&&(this.N=!1),this.Ya=t&&t.Xb||!1,t&&t.Aa&&this.j.Aa(),t&&t.forceLongPolling&&(this.Y=!1),this.$=!this.O&&this.Y&&t&&t.detectBufferingProxy||!1,this.ja=void 0,this.P=0,this.K=!1,this.la=this.B=null}function Js(t){if(Xs(t),3==t.G){var e=t.U++,n=Qn(t.F);Zn(n,"SID",t.I),Zn(n,"RID",e),Zn(n,"TYPE","terminate"),er(t,n),(e=new Rn(t,t.j,e,void 0)).K=2,e.v=ts(Qn(n)),n=!1,kt.navigator&&kt.navigator.sendBeacon&&(n=kt.navigator.sendBeacon(e.v.toString(),"")),!n&&kt.Image&&((new Image).src=e.v,n=!0),n||(e.g=fr(e.l,null),e.g.da(e.v)),e.F=Date.now(),Bn(e)}lr(t)}function Ys(t){t.g&&(ir(t),t.g.cancel(),t.g=null)}function Xs(t){Ys(t),t.u&&(kt.clearTimeout(t.u),t.u=null),ar(t),t.h.cancel(),t.m&&("number"==typeof t.m&&kt.clearTimeout(t.m),t.m=null)}function Zs(t){vs(t.h)||t.m||(t.m=!0,Qe(t.Ja,t),t.C=0)}function tr(t,e){var n;n=e?e.m:t.U++;var s=Qn(t.F);Zn(s,"SID",t.I),Zn(s,"RID",n),Zn(s,"AID",t.T),er(t,s),t.o&&t.s&&zs(s,t.o,t.s),n=new Rn(t,t.j,n,t.C+1),null===t.o&&(n.H=t.s),e&&(t.i=e.D.concat(t.i)),e=nr(t,n,1e3),n.setTimeout(Math.round(.5*t.ta)+Math.round(.5*t.ta*Math.random())),Ts(t.h,n),Mn(n,s,e)}function er(t,e){t.ia&&_e(t.ia,(function(t,n){Zn(e,n,t)})),t.l&&Wn({},(function(t,n){Zn(e,n,t)}))}function nr(t,e,n){n=Math.min(t.i.length,n);var s=t.l?xt(t.l.Ra,t.l,t):null;t:for(var r=t.i,i=-1;;){var o=["count="+n];-1==i?0<n?(i=r[0].h,o.push("ofs="+i)):i=0:o.push("ofs="+i);for(var a=!0,c=0;c<n;c++){var u=r[c].h,h=r[c].g;if(0>(u-=i))i=Math.max(0,r[c].h-100),a=!1;else try{As(h,o,"req"+u+"_")}catch(t){s&&s(h)}}if(a){s=o.join("&");break t}}return t=t.i.splice(0,n),e.D=t,s}function sr(t){t.g||t.u||(t.Z=1,Qe(t.Ia,t),t.A=0)}function rr(t){return!(t.g||t.u||3<=t.A)&&(t.Z++,t.u=wn(xt(t.Ia,t),ur(t,t.A)),t.A++,!0)}function ir(t){null!=t.B&&(kt.clearTimeout(t.B),t.B=null)}function or(t){t.g=new Rn(t,t.j,"rpc",t.Z),null===t.o&&(t.g.H=t.s),t.g.N=0;var e=Qn(t.sa);Zn(e,"RID","rpc"),Zn(e,"SID",t.I),Zn(e,"CI",t.L?"0":"1"),Zn(e,"AID",t.T),Zn(e,"TYPE","xmlhttp"),er(t,e),t.o&&t.s&&zs(e,t.o,t.s),t.J&&t.g.setTimeout(t.J);var n=t.g;t=t.ka,n.K=1,n.v=ts(Qn(e)),n.s=null,n.P=!0,xn(n,t)}function ar(t){null!=t.v&&(kt.clearTimeout(t.v),t.v=null)}function cr(t,e){var n=null;if(t.g==e){ar(t),ir(t),t.g=null;var s=2}else{if(!_s(t.h,e))return;n=e.D,Is(t.h,e),s=1}if(0!=t.G)if(t.pa=e.Y,e.i)if(1==s){n=e.s?e.s.length:0,e=Date.now()-e.F;var r=t.C;Be(s=fn(),new vn(s,n)),Zs(t)}else sr(t);else if(3==(r=e.o)||0==r&&0<t.pa||!(1==s&&function(t,e){return!(ws(t.h)>=t.h.j-(t.m?1:0)||(t.m?(t.i=e.D.concat(t.i),0):1==t.G||2==t.G||t.C>=(t.Za?0:t.$a)||(t.m=wn(xt(t.Ja,t,e),ur(t,t.C)),t.C++,0)))}(t,e)||2==s&&rr(t)))switch(n&&0<n.length&&(e=t.h,e.i=e.i.concat(n)),r){case 1:hr(t,5);break;case 4:hr(t,10);break;case 3:hr(t,6);break;default:hr(t,2)}}function ur(t,e){var n=t.Xa+Math.floor(Math.random()*t.bb);return t.l||(n*=2),n*e}function hr(t,e){if(t.j.info("Error code "+e),2==e){var n=null;t.l&&(n=null);var s=xt(t.kb,t);n||(n=new $n("//www.google.com/images/cleardot.gif"),kt.location&&"http"==kt.location.protocol||Jn(n,"https"),ts(n)),function(t,e){var n=new un;if(kt.Image){var s=new Image;s.onload=Ut(Cs,n,s,"TestLoadImage: loaded",!0,e),s.onerror=Ut(Cs,n,s,"TestLoadImage: error",!1,e),s.onabort=Ut(Cs,n,s,"TestLoadImage: abort",!1,e),s.ontimeout=Ut(Cs,n,s,"TestLoadImage: timeout",!1,e),kt.setTimeout((function(){s.ontimeout&&s.ontimeout()}),1e4),s.src=t}else e(!1)}(n.toString(),s)}else yn(2);t.G=0,t.l&&t.l.va(e),lr(t),Xs(t)}function lr(t){if(t.G=0,t.la=[],t.l){var e=Es(t.h);0==e.length&&0==t.i.length||(jt(t.la,e),jt(t.la,t.i),t.h.i.length=0,Ht(t.i),t.i.length=0),t.l.ua()}}function dr(t,e,n){var s=n instanceof $n?Qn(n):new $n(n,void 0);if(""!=s.g)e&&(s.g=e+"."+s.g),Yn(s,s.m);else{var r=kt.location;s=r.protocol,e=e?e+"."+r.hostname:r.hostname,r=+r.port;var i=new $n(null,void 0);s&&Jn(i,s),e&&(i.g=e),r&&Yn(i,r),n&&(i.l=n),s=i}return n=t.D,e=t.za,n&&e&&Zn(s,n,e),Zn(s,"VER",t.ma),er(t,s),s}function fr(t,e,n){if(e&&!t.H)throw Error("Can't create secondary domain capable XhrIo object.");return(e=n&&t.Da&&!t.ra?new Ms(new ks({jb:!0})):new Ms(t.ra)).Ka(t.H),e}function pr(){}function gr(){if(te&&!(10<=Number(fe)))throw Error("Environmental error: no available transport.")}function mr(t,e){Ve.call(this),this.g=new Qs(e),this.l=t,this.h=e&&e.messageUrlParams||null,t=e&&e.messageHeaders||null,e&&e.clientProtocolHeaderRequired&&(t?t["X-Client-Protocol"]="webchannel":t={"X-Client-Protocol":"webchannel"}),this.g.s=t,t=e&&e.initMessageHeaders||null,e&&e.messageContentType&&(t?t["X-WebChannel-Content-Type"]=e.messageContentType:t={"X-WebChannel-Content-Type":e.messageContentType}),e&&e.ya&&(t?t["X-WebChannel-Client-Profile"]=e.ya:t={"X-WebChannel-Client-Profile":e.ya}),this.g.S=t,(t=e&&e.Yb)&&!Gt(t)&&(this.g.o=t),this.A=e&&e.supportsCrossDomainXhr||!1,this.v=e&&e.sendRawJson||!1,(e=e&&e.httpSessionIdParam)&&!Gt(e)&&(this.g.D=e,null!==(t=this.h)&&e in t&&(e in(t=this.h)&&delete t[e])),this.j=new wr(this)}function yr(t){Cn.call(this);var e=t.__sm__;if(e){t:{for(var n in e){t=n;break t}t=void 0}(this.i=t)&&(t=this.i,e=null!==e&&t in e?e[t]:void 0),this.data=e}else this.data=t}function vr(){kn.call(this),this.status=1}function wr(t){this.g=t}(bt=Ms.prototype).Ka=function(t){this.L=t},bt.da=function(t,e,n,s){var r,i,o,a;if(this.g)throw Error("[goog.net.XhrIo] Object is active with another request="+this.H+"; newUri="+t);e=e?e.toUpperCase():"GET",this.H=t,this.j="",this.m=0,this.D=!1,this.h=!0,this.g=this.u?this.u.g():bn.g(),this.C=this.u?En(this.u):En(bn),this.g.onreadystatechange=xt(this.Ha,this);try{this.F=!0,this.g.open(e,String(t),!0),this.F=!1}catch(l){return void Vs(this,l)}if(t=n||"",n=new Map(this.headers),s)if(Object.getPrototypeOf(s)===Object.prototype)for(var c in s)n.set(c,s[c]);else{if("function"!=typeof s.keys||"function"!=typeof s.get)throw Error("Unknown input type for opt_headers: "+String(s));try{for(var u=Et(s.keys()),h=u.next();!h.done;h=u.next()){var l=h.value;n.set(l,s.get(l))}}catch(t){r={error:t}}finally{try{h&&!h.done&&(i=u.return)&&i.call(u)}finally{if(r)throw r.error}}}s=Array.from(n.keys()).find((function(t){return"content-type"==t.toLowerCase()})),c=kt.FormData&&t instanceof kt.FormData,!(0<=Bt(Fs,e))||s||c||n.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8");try{for(var d=Et(n),f=d.next();!f.done;f=d.next()){var p=St(f.value,2),g=(l=p[0],p[1]);this.g.setRequestHeader(l,g)}}catch(t){o={error:t}}finally{try{f&&!f.done&&(a=d.return)&&a.call(d)}finally{if(o)throw o.error}}this.J&&(this.g.responseType=this.J),"withCredentials"in this.g&&this.g.withCredentials!==this.L&&(this.g.withCredentials=this.L);try{qs(this),0<this.B&&((this.K=function(t){return te&&le()&&"number"==typeof t.timeout&&void 0!==t.ontimeout}(this.g))?(this.g.timeout=this.B,this.g.ontimeout=xt(this.qa,this)):this.A=en(this.qa,this.B,this)),this.v=!0,this.g.send(t),this.v=!1}catch(l){Vs(this,l)}},bt.qa=function(){void 0!==Ct&&this.g&&(this.j="Timed out after "+this.B+"ms, aborting",this.m=8,Be(this,"timeout"),this.abort(8))},bt.abort=function(t){this.g&&this.h&&(this.h=!1,this.l=!0,this.g.abort(),this.l=!1,this.m=t||7,Be(this,"complete"),Be(this,"abort"),js(this))},bt.M=function(){this.g&&(this.h&&(this.h=!1,this.l=!0,this.g.abort(),this.l=!1),js(this,!0)),Ms.X.M.call(this)},bt.Ha=function(){this.s||(this.F||this.v||this.l?Hs(this):this.fb())},bt.fb=function(){Hs(this)},bt.aa=function(){try{return 2<Ks(this)?this.g.status:-1}catch(t){return-1}},bt.fa=function(){try{return this.g?this.g.responseText:""}catch(t){return""}},bt.Sa=function(t){if(this.g){var e=this.g.responseText;return t&&0==e.indexOf(t)&&(e=e.substring(t.length)),Ps(e)}},bt.Ea=function(){return this.m},bt.Oa=function(){return"string"==typeof this.j?this.j:String(this.j)},(bt=Qs.prototype).ma=8,bt.G=1,bt.Ja=function(t){if(this.m)if(this.m=null,1==this.G){if(!t){this.U=Math.floor(1e5*Math.random()),t=this.U++;var e=new Rn(this,this.j,t,void 0),n=this.s;if(this.S&&(n?Ee(n=Te(n),this.S):n=this.S),null!==this.o||this.N||(e.H=n,n=null),this.O)t:{for(var s=0,r=0;r<this.i.length;r++){var i=this.i[r];if(void 0===(i="__data__"in i.g&&"string"==typeof(i=i.g.__data__)?i.length:void 0))break;if(4096<(s+=i)){s=r;break t}if(4096===s||r===this.i.length-1){s=r+1;break t}}s=1e3}else s=1e3;s=nr(this,e,s),Zn(r=Qn(this.F),"RID",t),Zn(r,"CVER",22),this.D&&Zn(r,"X-HTTP-Session-Id",this.D),er(this,r),n&&(this.N?s="headers="+encodeURIComponent(String(Ws(n)))+"&"+s:this.o&&zs(r,this.o,n)),Ts(this.h,e),this.Ya&&Zn(r,"TYPE","init"),this.O?(Zn(r,"$req",s),Zn(r,"SID","null"),e.Z=!0,Mn(e,r,null)):Mn(e,r,s),this.G=2}}else 3==this.G&&(t?tr(this,t):0==this.i.length||vs(this.h)||tr(this))},bt.Ia=function(){if(this.u=null,or(this),this.$&&!(this.K||null==this.g||0>=this.P)){var t=2*this.P;this.j.info("BP detection timer enabled: "+t),this.B=wn(xt(this.eb,this),t)}},bt.eb=function(){this.B&&(this.B=null,this.j.info("BP detection timeout reached."),this.j.info("Buffering proxy detected and switch to long-polling!"),this.L=!1,this.K=!0,yn(10),Ys(this),or(this))},bt.cb=function(){null!=this.v&&(this.v=null,Ys(this),rr(this),yn(19))},bt.kb=function(t){t?(this.j.info("Successfully pinged google.com"),yn(2)):(this.j.info("Failed to ping google.com"),yn(1))},(bt=pr.prototype).xa=function(){},bt.wa=function(){},bt.va=function(){},bt.ua=function(){},bt.Ra=function(){},gr.prototype.g=function(t,e){return new mr(t,e)},Ft(mr,Ve),mr.prototype.m=function(){this.g.l=this.j,this.A&&(this.g.H=!0);var t=this.g,e=this.l,n=this.h||void 0;yn(0),t.V=e,t.ia=n||{},t.L=t.Y,t.F=dr(t,null,t.V),Zs(t)},mr.prototype.close=function(){Js(this.g)},mr.prototype.u=function(t){var e=this.g;if("string"==typeof t){var n={};n.__data__=t,t=n}else this.v&&((n={}).__data__=je(t),t=n);e.i.push(new gs(e.ab++,t)),3==e.G&&Zs(e)},mr.prototype.M=function(){this.g.l=null,delete this.j,Js(this.g),delete this.g,mr.X.M.call(this)},Ft(yr,Cn),Ft(vr,kn),Ft(wr,pr),wr.prototype.xa=function(){Be(this.g,"a")},wr.prototype.wa=function(t){Be(this.g,new yr(t))},wr.prototype.va=function(t){Be(this.g,new vr)},wr.prototype.ua=function(){Be(this.g,"b")},gr.prototype.createWebChannel=gr.prototype.g,mr.prototype.send=mr.prototype.u,mr.prototype.open=mr.prototype.m,mr.prototype.close=mr.prototype.close,_n.NO_ERROR=0,_n.TIMEOUT=8,_n.HTTP_ERROR=6,Tn.COMPLETE="complete",Sn.EventType=An,An.OPEN="a",An.CLOSE="b",An.ERROR="c",An.MESSAGE="d",Ve.prototype.listen=Ve.prototype.N,Ms.prototype.listenOnce=Ms.prototype.O,Ms.prototype.getLastError=Ms.prototype.Oa,Ms.prototype.getLastErrorCode=Ms.prototype.Ea,Ms.prototype.getStatus=Ms.prototype.aa,Ms.prototype.getResponseJson=Ms.prototype.Sa,Ms.prototype.getResponseText=Ms.prototype.fa,Ms.prototype.send=Ms.prototype.da,Ms.prototype.setWithCredentials=Ms.prototype.Ka;var _r=_n,Tr=Tn,Ir=ln,Er=10,Sr=11,br=ks,Ar=Sn,Cr=Ms;const kr="@firebase/firestore";
315
+ */var Qt;Qt="",Nt(new I("platform-logger",(t=>new J(t)),"PRIVATE")),Nt(new I("heartbeat",(t=>new Kt(t)),"PRIVATE")),Ut(X,Z,Qt),Ut(X,Z,"esm2017"),Ut("fire-js","");
316
+ /**
317
+ * @license
318
+ * Copyright 2017 Google LLC
319
+ *
320
+ * Licensed under the Apache License, Version 2.0 (the "License");
321
+ * you may not use this file except in compliance with the License.
322
+ * You may obtain a copy of the License at
323
+ *
324
+ * http://www.apache.org/licenses/LICENSE-2.0
325
+ *
326
+ * Unless required by applicable law or agreed to in writing, software
327
+ * distributed under the License is distributed on an "AS IS" BASIS,
328
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
329
+ * See the License for the specific language governing permissions and
330
+ * limitations under the License.
331
+ */
332
+ /**
333
+ * @license
334
+ * Copyright 2017 Google LLC
335
+ *
336
+ * Licensed under the Apache License, Version 2.0 (the "License");
337
+ * you may not use this file except in compliance with the License.
338
+ * You may obtain a copy of the License at
339
+ *
340
+ * http://www.apache.org/licenses/LICENSE-2.0
341
+ *
342
+ * Unless required by applicable law or agreed to in writing, software
343
+ * distributed under the License is distributed on an "AS IS" BASIS,
344
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
345
+ * See the License for the specific language governing permissions and
346
+ * limitations under the License.
347
+ */
348
+ const Yt=function(t){const e=[];let n=0;for(let r=0;r<t.length;r++){let s=t.charCodeAt(r);s<128?e[n++]=s:s<2048?(e[n++]=s>>6|192,e[n++]=63&s|128):55296==(64512&s)&&r+1<t.length&&56320==(64512&t.charCodeAt(r+1))?(s=65536+((1023&s)<<10)+(1023&t.charCodeAt(++r)),e[n++]=s>>18|240,e[n++]=s>>12&63|128,e[n++]=s>>6&63|128,e[n++]=63&s|128):(e[n++]=s>>12|224,e[n++]=s>>6&63|128,e[n++]=63&s|128)}return e},Jt={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(t,e){if(!Array.isArray(t))throw Error("encodeByteArray takes an array as a parameter");this.init_();const n=e?this.byteToCharMapWebSafe_:this.byteToCharMap_,r=[];for(let e=0;e<t.length;e+=3){const s=t[e],i=e+1<t.length,o=i?t[e+1]:0,a=e+2<t.length,c=a?t[e+2]:0,u=s>>2,h=(3&s)<<4|o>>4;let l=(15&o)<<2|c>>6,d=63&c;a||(d=64,i||(l=64)),r.push(n[u],n[h],n[l],n[d])}return r.join("")},encodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(t):this.encodeByteArray(Yt(t),e)},decodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(t):function(t){const e=[];let n=0,r=0;for(;n<t.length;){const s=t[n++];if(s<128)e[r++]=String.fromCharCode(s);else if(s>191&&s<224){const i=t[n++];e[r++]=String.fromCharCode((31&s)<<6|63&i)}else if(s>239&&s<365){const i=((7&s)<<18|(63&t[n++])<<12|(63&t[n++])<<6|63&t[n++])-65536;e[r++]=String.fromCharCode(55296+(i>>10)),e[r++]=String.fromCharCode(56320+(1023&i))}else{const i=t[n++],o=t[n++];e[r++]=String.fromCharCode((15&s)<<12|(63&i)<<6|63&o)}}return e.join("")}(this.decodeStringToByteArray(t,e))},decodeStringToByteArray(t,e){this.init_();const n=e?this.charToByteMapWebSafe_:this.charToByteMap_,r=[];for(let e=0;e<t.length;){const s=n[t.charAt(e++)],i=e<t.length?n[t.charAt(e)]:0;++e;const o=e<t.length?n[t.charAt(e)]:64;++e;const a=e<t.length?n[t.charAt(e)]:64;if(++e,null==s||null==i||null==o||null==a)throw Error();const c=s<<2|i>>4;if(r.push(c),64!==o){const t=i<<4&240|o>>2;if(r.push(t),64!==a){const t=o<<6&192|a;r.push(t)}}}return r},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let t=0;t<this.ENCODED_VALS.length;t++)this.byteToCharMap_[t]=this.ENCODED_VALS.charAt(t),this.charToByteMap_[this.byteToCharMap_[t]]=t,this.byteToCharMapWebSafe_[t]=this.ENCODED_VALS_WEBSAFE.charAt(t),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[t]]=t,t>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(t)]=t,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(t)]=t)}}},Xt=function(t){return function(t){const e=Yt(t);return Jt.encodeByteArray(e,!0)}(t).replace(/\./g,"")};
349
+ /**
350
+ * @license
351
+ * Copyright 2022 Google LLC
352
+ *
353
+ * Licensed under the Apache License, Version 2.0 (the "License");
354
+ * you may not use this file except in compliance with the License.
355
+ * You may obtain a copy of the License at
356
+ *
357
+ * http://www.apache.org/licenses/LICENSE-2.0
358
+ *
359
+ * Unless required by applicable law or agreed to in writing, software
360
+ * distributed under the License is distributed on an "AS IS" BASIS,
361
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
362
+ * See the License for the specific language governing permissions and
363
+ * limitations under the License.
364
+ */
365
+ const Zt=()=>function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if("undefined"!=typeof global)return global;throw new Error("Unable to locate global object.")}().__FIREBASE_DEFAULTS__,te=()=>{if("undefined"==typeof document)return;let t;try{t=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch(t){return}const e=t&&function(t){try{return Jt.decodeString(t,!0)}catch(t){console.error("base64Decode failed: ",t)}return null}(t[1]);return e&&JSON.parse(e)},ee=()=>{try{return Zt()||(()=>{if("undefined"==typeof process||void 0===process.env)return;const t=process.env.__FIREBASE_DEFAULTS__;return t?JSON.parse(t):void 0})()||te()}catch(t){return void console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${t}`)}},ne=t=>{const e=(t=>{var e,n;return null===(n=null===(e=ee())||void 0===e?void 0:e.emulatorHosts)||void 0===n?void 0:n[t]})(t);if(!e)return;const n=e.lastIndexOf(":");if(n<=0||n+1===e.length)throw new Error(`Invalid host ${e} with no separate hostname and port!`);const r=parseInt(e.substring(n+1),10);return"["===e[0]?[e.substring(1,n-1),r]:[e.substring(0,n),r]};class re extends Error{constructor(t,e,n){super(e),this.code=t,this.customData=n,this.name="FirebaseError",Object.setPrototypeOf(this,re.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,se.prototype.create)}}class se{constructor(t,e,n){this.service=t,this.serviceName=e,this.errors=n}create(t,...e){const n=e[0]||{},r=`${this.service}/${t}`,s=this.errors[t],i=s?function(t,e){return t.replace(ie,((t,n)=>{const r=e[n];return null!=r?String(r):`<${n}?>`}))}(s,n):"Error",o=`${this.serviceName}: ${i} (${r}).`;return new re(r,o,n)}}const ie=/\{\$([^}]+)}/g;
366
+ /**
367
+ * @license
368
+ * Copyright 2021 Google LLC
369
+ *
370
+ * Licensed under the Apache License, Version 2.0 (the "License");
371
+ * you may not use this file except in compliance with the License.
372
+ * You may obtain a copy of the License at
373
+ *
374
+ * http://www.apache.org/licenses/LICENSE-2.0
375
+ *
376
+ * Unless required by applicable law or agreed to in writing, software
377
+ * distributed under the License is distributed on an "AS IS" BASIS,
378
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
379
+ * See the License for the specific language governing permissions and
380
+ * limitations under the License.
381
+ */function oe(t){return t&&t._delegate?t._delegate:t}class ae{constructor(t,e,n){this.name=t,this.instanceFactory=e,this.type=n,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(t){return this.instantiationMode=t,this}setMultipleInstances(t){return this.multipleInstances=t,this}setServiceProps(t){return this.serviceProps=t,this}setInstanceCreatedCallback(t){return this.onInstanceCreated=t,this}}
382
+ /**
383
+ * @license
384
+ * Copyright 2017 Google LLC
385
+ *
386
+ * Licensed under the Apache License, Version 2.0 (the "License");
387
+ * you may not use this file except in compliance with the License.
388
+ * You may obtain a copy of the License at
389
+ *
390
+ * http://www.apache.org/licenses/LICENSE-2.0
391
+ *
392
+ * Unless required by applicable law or agreed to in writing, software
393
+ * distributed under the License is distributed on an "AS IS" BASIS,
394
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
395
+ * See the License for the specific language governing permissions and
396
+ * limitations under the License.
397
+ */var ce;!function(t){t[t.DEBUG=0]="DEBUG",t[t.VERBOSE=1]="VERBOSE",t[t.INFO=2]="INFO",t[t.WARN=3]="WARN",t[t.ERROR=4]="ERROR",t[t.SILENT=5]="SILENT"}(ce||(ce={}));const ue={debug:ce.DEBUG,verbose:ce.VERBOSE,info:ce.INFO,warn:ce.WARN,error:ce.ERROR,silent:ce.SILENT},he=ce.INFO,le={[ce.DEBUG]:"log",[ce.VERBOSE]:"log",[ce.INFO]:"info",[ce.WARN]:"warn",[ce.ERROR]:"error"},de=(t,e,...n)=>{if(e<t.logLevel)return;const r=(new Date).toISOString(),s=le[e];if(!s)throw new Error(`Attempted to log a message with an invalid logType (value: ${e})`);console[s](`[${r}] ${t.name}:`,...n)};var fe=function(t,e){return fe=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},fe(t,e)};function pe(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function ge(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,s,i=n.call(t),o=[];try{for(;(void 0===e||e-- >0)&&!(r=i.next()).done;)o.push(r.value)}catch(t){s={error:t}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(s)throw s.error}}return o}var me,ye="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},ve=ve||{},we=ye||self;function _e(){}function Te(t){var e=typeof t;return"array"==(e="object"!=e?e:t?Array.isArray(t)?"array":e:"null")||"object"==e&&"number"==typeof t.length}function Ee(t){var e=typeof t;return"object"==e&&null!=t||"function"==e}var Se="closure_uid_"+(1e9*Math.random()>>>0),Ie=0;function be(t,e,n){return t.call.apply(t.bind,arguments)}function Ae(t,e,n){if(!t)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),t.apply(e,n)}}return function(){return t.apply(e,arguments)}}function Ce(t,e,n){return(Ce=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?be:Ae).apply(null,arguments)}function ke(t,e){var n=Array.prototype.slice.call(arguments,1);return function(){var e=n.slice();return e.push.apply(e,arguments),t.apply(this,e)}}function Re(t,e){function n(){}n.prototype=e.prototype,t.X=e.prototype,t.prototype=new n,t.prototype.constructor=t,t.Wb=function(t,n,r){for(var s=Array(arguments.length-2),i=2;i<arguments.length;i++)s[i-2]=arguments[i];return e.prototype[n].apply(t,s)}}function Ne(){this.s=this.s,this.o=this.o}Ne.prototype.s=!1,Ne.prototype.na=function(){var t;!this.s&&(this.s=!0,this.M(),0)&&(t=this,Object.prototype.hasOwnProperty.call(t,Se)&&t[Se]||(t[Se]=++Ie))},Ne.prototype.M=function(){if(this.o)for(;this.o.length;)this.o.shift()()};var De=Array.prototype.indexOf?function(t,e){return Array.prototype.indexOf.call(t,e,void 0)}:function(t,e){if("string"==typeof t)return"string"!=typeof e||1!=e.length?-1:t.indexOf(e,0);for(var n=0;n<t.length;n++)if(n in t&&t[n]===e)return n;return-1};function Oe(t){var e=t.length;if(0<e){for(var n=Array(e),r=0;r<e;r++)n[r]=t[r];return n}return[]}function Le(t,e){for(var n=1;n<arguments.length;n++){var r=arguments[n];if(Te(r)){var s=t.length||0,i=r.length||0;t.length=s+i;for(var o=0;o<i;o++)t[s+o]=r[o]}else t.push(r)}}function Pe(t,e){this.type=t,this.g=this.target=e,this.defaultPrevented=!1}Pe.prototype.h=function(){this.defaultPrevented=!0};var Me=function(){if(!we.addEventListener||!Object.defineProperty)return!1;var t=!1,e=Object.defineProperty({},"passive",{get:function(){t=!0}});try{we.addEventListener("test",_e,e),we.removeEventListener("test",_e,e)}catch(t){}return t}();function xe(t){return/^[\s\xa0]*$/.test(t)}var Ue=String.prototype.trim?function(t){return t.trim()}:function(t){return/^[\s\xa0]*([\s\S]*?)[\s\xa0]*$/.exec(t)[1]};function Fe(t,e){return t<e?-1:t>e?1:0}function Ve(){var t=we.navigator;return t&&(t=t.userAgent)?t:""}function Be(t){return-1!=Ve().indexOf(t)}function He(t){return He[" "](t),t}He[" "]=_e;var je,$e,qe=Be("Opera"),Ke=Be("Trident")||Be("MSIE"),We=Be("Edge"),Ge=We||Ke,ze=Be("Gecko")&&!(-1!=Ve().toLowerCase().indexOf("webkit")&&!Be("Edge"))&&!(Be("Trident")||Be("MSIE"))&&!Be("Edge"),Qe=-1!=Ve().toLowerCase().indexOf("webkit")&&!Be("Edge");function Ye(){var t=we.document;return t?t.documentMode:void 0}t:{var Je="",Xe=($e=Ve(),ze?/rv:([^\);]+)(\)|;)/.exec($e):We?/Edge\/([\d\.]+)/.exec($e):Ke?/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec($e):Qe?/WebKit\/(\S+)/.exec($e):qe?/(?:Version)[ \/]?(\S+)/.exec($e):void 0);if(Xe&&(Je=Xe?Xe[1]:""),Ke){var Ze=Ye();if(null!=Ze&&Ze>parseFloat(Je)){je=String(Ze);break t}}je=Je}var tn,en={};function nn(){return function(t){var e=en;return Object.prototype.hasOwnProperty.call(e,9)?e[9]:e[9]=t(9)}((function(){for(var t=0,e=Ue(String(je)).split("."),n=Ue("9").split("."),r=Math.max(e.length,n.length),s=0;0==t&&s<r;s++){var i=e[s]||"",o=n[s]||"";do{if(i=/(\d*)(\D*)(.*)/.exec(i)||["","","",""],o=/(\d*)(\D*)(.*)/.exec(o)||["","","",""],0==i[0].length&&0==o[0].length)break;t=Fe(0==i[1].length?0:parseInt(i[1],10),0==o[1].length?0:parseInt(o[1],10))||Fe(0==i[2].length,0==o[2].length)||Fe(i[2],o[2]),i=i[3],o=o[3]}while(0==t)}return 0<=t}))}if(we.document&&Ke){var rn=Ye();tn=rn||(parseInt(je,10)||void 0)}else tn=void 0;var sn=tn;function on(t,e){if(Pe.call(this,t?t.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,t){var n=this.type=t.type,r=t.changedTouches&&t.changedTouches.length?t.changedTouches[0]:null;if(this.target=t.target||t.srcElement,this.g=e,e=t.relatedTarget){if(ze){t:{try{He(e.nodeName);var s=!0;break t}catch(t){}s=!1}s||(e=null)}}else"mouseover"==n?e=t.fromElement:"mouseout"==n&&(e=t.toElement);this.relatedTarget=e,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!==t.clientX?t.clientX:t.pageX,this.clientY=void 0!==t.clientY?t.clientY:t.pageY,this.screenX=t.screenX||0,this.screenY=t.screenY||0),this.button=t.button,this.key=t.key||"",this.ctrlKey=t.ctrlKey,this.altKey=t.altKey,this.shiftKey=t.shiftKey,this.metaKey=t.metaKey,this.pointerId=t.pointerId||0,this.pointerType="string"==typeof t.pointerType?t.pointerType:an[t.pointerType]||"",this.state=t.state,this.i=t,t.defaultPrevented&&on.X.h.call(this)}}Re(on,Pe);var an={2:"touch",3:"pen",4:"mouse"};on.prototype.h=function(){on.X.h.call(this);var t=this.i;t.preventDefault?t.preventDefault():t.returnValue=!1};var cn="closure_listenable_"+(1e6*Math.random()|0),un=0;function hn(t,e,n,r,s){this.listener=t,this.proxy=null,this.src=e,this.type=n,this.capture=!!r,this.ha=s,this.key=++un,this.ba=this.ea=!1}function ln(t){t.ba=!0,t.listener=null,t.proxy=null,t.src=null,t.ha=null}function dn(t,e,n){for(var r in t)e.call(n,t[r],r,t)}function fn(t){var e={};for(var n in t)e[n]=t[n];return e}var pn="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function gn(t,e){for(var n,r,s=1;s<arguments.length;s++){for(n in r=arguments[s])t[n]=r[n];for(var i=0;i<pn.length;i++)n=pn[i],Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}}function mn(t){this.src=t,this.g={},this.h=0}function yn(t,e){var n=e.type;if(n in t.g){var r,s=t.g[n],i=De(s,e);(r=0<=i)&&Array.prototype.splice.call(s,i,1),r&&(ln(e),0==t.g[n].length&&(delete t.g[n],t.h--))}}function vn(t,e,n,r){for(var s=0;s<t.length;++s){var i=t[s];if(!i.ba&&i.listener==e&&i.capture==!!n&&i.ha==r)return s}return-1}mn.prototype.add=function(t,e,n,r,s){var i=t.toString();(t=this.g[i])||(t=this.g[i]=[],this.h++);var o=vn(t,e,r,s);return-1<o?(e=t[o],n||(e.ea=!1)):((e=new hn(e,this.src,i,!!r,s)).ea=n,t.push(e)),e};var wn="closure_lm_"+(1e6*Math.random()|0),_n={};function Tn(t,e,n,r,s){if(r&&r.once)return Sn(t,e,n,r,s);if(Array.isArray(e)){for(var i=0;i<e.length;i++)Tn(t,e[i],n,r,s);return null}return n=Nn(n),t&&t[cn]?t.N(e,n,Ee(r)?!!r.capture:!!r,s):En(t,e,n,!1,r,s)}function En(t,e,n,r,s,i){if(!e)throw Error("Invalid event type");var o=Ee(s)?!!s.capture:!!s,a=kn(t);if(a||(t[wn]=a=new mn(t)),(n=a.add(e,n,r,o,i)).proxy)return n;if(r=function(){function t(n){return e.call(t.src,t.listener,n)}var e=Cn;return t}(),n.proxy=r,r.src=t,r.listener=n,t.addEventListener)Me||(s=o),void 0===s&&(s=!1),t.addEventListener(e.toString(),r,s);else if(t.attachEvent)t.attachEvent(An(e.toString()),r);else{if(!t.addListener||!t.removeListener)throw Error("addEventListener and attachEvent are unavailable.");t.addListener(r)}return n}function Sn(t,e,n,r,s){if(Array.isArray(e)){for(var i=0;i<e.length;i++)Sn(t,e[i],n,r,s);return null}return n=Nn(n),t&&t[cn]?t.O(e,n,Ee(r)?!!r.capture:!!r,s):En(t,e,n,!0,r,s)}function In(t,e,n,r,s){if(Array.isArray(e))for(var i=0;i<e.length;i++)In(t,e[i],n,r,s);else r=Ee(r)?!!r.capture:!!r,n=Nn(n),t&&t[cn]?(t=t.i,(e=String(e).toString())in t.g&&(-1<(n=vn(i=t.g[e],n,r,s))&&(ln(i[n]),Array.prototype.splice.call(i,n,1),0==i.length&&(delete t.g[e],t.h--)))):t&&(t=kn(t))&&(e=t.g[e.toString()],t=-1,e&&(t=vn(e,n,r,s)),(n=-1<t?e[t]:null)&&bn(n))}function bn(t){if("number"!=typeof t&&t&&!t.ba){var e=t.src;if(e&&e[cn])yn(e.i,t);else{var n=t.type,r=t.proxy;e.removeEventListener?e.removeEventListener(n,r,t.capture):e.detachEvent?e.detachEvent(An(n),r):e.addListener&&e.removeListener&&e.removeListener(r),(n=kn(e))?(yn(n,t),0==n.h&&(n.src=null,e[wn]=null)):ln(t)}}}function An(t){return t in _n?_n[t]:_n[t]="on"+t}function Cn(t,e){if(t.ba)t=!0;else{e=new on(e,this);var n=t.listener,r=t.ha||t.src;t.ea&&bn(t),t=n.call(r,e)}return t}function kn(t){return(t=t[wn])instanceof mn?t:null}var Rn="__closure_events_fn_"+(1e9*Math.random()>>>0);function Nn(t){return"function"==typeof t?t:(t[Rn]||(t[Rn]=function(e){return t.handleEvent(e)}),t[Rn])}function Dn(){Ne.call(this),this.i=new mn(this),this.P=this,this.I=null}function On(t,e){var n,r=t.I;if(r)for(n=[];r;r=r.I)n.push(r);if(t=t.P,r=e.type||e,"string"==typeof e)e=new Pe(e,t);else if(e instanceof Pe)e.target=e.target||t;else{var s=e;gn(e=new Pe(r,t),s)}if(s=!0,n)for(var i=n.length-1;0<=i;i--){var o=e.g=n[i];s=Ln(o,r,!0,e)&&s}if(s=Ln(o=e.g=t,r,!0,e)&&s,s=Ln(o,r,!1,e)&&s,n)for(i=0;i<n.length;i++)s=Ln(o=e.g=n[i],r,!1,e)&&s}function Ln(t,e,n,r){if(!(e=t.i.g[String(e)]))return!0;e=e.concat();for(var s=!0,i=0;i<e.length;++i){var o=e[i];if(o&&!o.ba&&o.capture==n){var a=o.listener,c=o.ha||o.src;o.ea&&yn(t.i,o),s=!1!==a.call(c,r)&&s}}return s&&!r.defaultPrevented}Re(Dn,Ne),Dn.prototype[cn]=!0,Dn.prototype.removeEventListener=function(t,e,n,r){In(this,t,e,n,r)},Dn.prototype.M=function(){if(Dn.X.M.call(this),this.i){var t,e=this.i;for(t in e.g){for(var n=e.g[t],r=0;r<n.length;r++)ln(n[r]);delete e.g[t],e.h--}}this.I=null},Dn.prototype.N=function(t,e,n,r){return this.i.add(String(t),e,!1,n,r)},Dn.prototype.O=function(t,e,n,r){return this.i.add(String(t),e,!0,n,r)};var Pn=we.JSON.stringify;function Mn(){var t=$n,e=null;return t.g&&(e=t.g,t.g=t.g.next,t.g||(t.h=null),e.next=null),e}var xn,Un=function(){function t(){this.h=this.g=null}return t.prototype.add=function(t,e){var n=Fn.get();n.set(t,e),this.h?this.h.next=n:this.g=n,this.h=n},t}(),Fn=new(function(){function t(t,e){this.i=t,this.j=e,this.h=0,this.g=null}return t.prototype.get=function(){var t;return 0<this.h?(this.h--,t=this.g,this.g=t.next,t.next=null):t=this.i(),t},t}())((function(){return new Vn}),(function(t){return t.reset()})),Vn=function(){function t(){this.next=this.g=this.h=null}return t.prototype.set=function(t,e){this.h=t,this.g=e,this.next=null},t.prototype.reset=function(){this.next=this.g=this.h=null},t}();function Bn(t){we.setTimeout((function(){throw t}),0)}function Hn(t,e){xn||function(){var t=we.Promise.resolve(void 0);xn=function(){t.then(qn)}}(),jn||(xn(),jn=!0),$n.add(t,e)}var jn=!1,$n=new Un;function qn(){for(var t;t=Mn();){try{t.h.call(t.g)}catch(t){Bn(t)}var e=Fn;e.j(t),100>e.h&&(e.h++,t.next=e.g,e.g=t)}jn=!1}function Kn(t,e){Dn.call(this),this.h=t||1,this.g=e||we,this.j=Ce(this.lb,this),this.l=Date.now()}function Wn(t){t.ca=!1,t.R&&(t.g.clearTimeout(t.R),t.R=null)}function Gn(t,e,n){if("function"==typeof t)n&&(t=Ce(t,n));else{if(!t||"function"!=typeof t.handleEvent)throw Error("Invalid listener argument");t=Ce(t.handleEvent,t)}return 2147483647<Number(e)?-1:we.setTimeout(t,e||0)}function zn(t){t.g=Gn((function(){t.g=null,t.i&&(t.i=!1,zn(t))}),t.j);var e=t.h;t.h=null,t.m.apply(null,e)}Re(Kn,Dn),(me=Kn.prototype).ca=!1,me.R=null,me.lb=function(){if(this.ca){var t=Date.now()-this.l;0<t&&t<.8*this.h?this.R=this.g.setTimeout(this.j,this.h-t):(this.R&&(this.g.clearTimeout(this.R),this.R=null),On(this,"tick"),this.ca&&(Wn(this),this.start()))}},me.start=function(){this.ca=!0,this.R||(this.R=this.g.setTimeout(this.j,this.h),this.l=Date.now())},me.M=function(){Kn.X.M.call(this),Wn(this),delete this.g};var Qn=function(t){function e(e,n){var r=t.call(this)||this;return r.m=e,r.j=n,r.h=null,r.i=!1,r.g=null,r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}fe(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}(e,t),e.prototype.l=function(t){this.h=arguments,this.g?this.i=!0:zn(this)},e.prototype.M=function(){t.prototype.M.call(this),this.g&&(we.clearTimeout(this.g),this.g=null,this.i=!1,this.h=null)},e}(Ne);function Yn(t){Ne.call(this),this.h=t,this.g={}}Re(Yn,Ne);var Jn=[];function Xn(t,e,n,r){Array.isArray(n)||(n&&(Jn[0]=n.toString()),n=Jn);for(var s=0;s<n.length;s++){var i=Tn(e,n[s],r||t.handleEvent,!1,t.h||t);if(!i)break;t.g[i.key]=i}}function Zn(t){dn(t.g,(function(t,e){this.g.hasOwnProperty(e)&&bn(t)}),t),t.g={}}function tr(){this.g=!0}function er(t,e,n,r){t.info((function(){return"XMLHTTP TEXT ("+e+"): "+function(t,e){if(!t.g)return e;if(!e)return null;try{var n=JSON.parse(e);if(n)for(t=0;t<n.length;t++)if(Array.isArray(n[t])){var r=n[t];if(!(2>r.length)){var s=r[1];if(Array.isArray(s)&&!(1>s.length)){var i=s[0];if("noop"!=i&&"stop"!=i&&"close"!=i)for(var o=1;o<s.length;o++)s[o]=""}}}return Pn(n)}catch(t){return e}}(t,n)+(r?" "+r:"")}))}Yn.prototype.M=function(){Yn.X.M.call(this),Zn(this)},Yn.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")},tr.prototype.Aa=function(){this.g=!1},tr.prototype.info=function(){};var nr={},rr=null;function sr(){return rr=rr||new Dn}function ir(t){Pe.call(this,nr.Pa,t)}function or(t){var e=sr();On(e,new ir(e))}function ar(t,e){Pe.call(this,nr.STAT_EVENT,t),this.stat=e}function cr(t){var e=sr();On(e,new ar(e,t))}function ur(t,e){Pe.call(this,nr.Qa,t),this.size=e}function hr(t,e){if("function"!=typeof t)throw Error("Fn must not be null and must be a function");return we.setTimeout((function(){t()}),e)}nr.Pa="serverreachability",Re(ir,Pe),nr.STAT_EVENT="statevent",Re(ar,Pe),nr.Qa="timingevent",Re(ur,Pe);var lr={NO_ERROR:0,mb:1,zb:2,yb:3,tb:4,xb:5,Ab:6,Ma:7,TIMEOUT:8,Db:9},dr={rb:"complete",Nb:"success",Na:"error",Ma:"abort",Fb:"ready",Gb:"readystatechange",TIMEOUT:"timeout",Bb:"incrementaldata",Eb:"progress",ub:"downloadprogress",Vb:"uploadprogress"};function fr(){}function pr(t){return t.h||(t.h=t.i())}function gr(){}fr.prototype.h=null;var mr,yr={OPEN:"a",qb:"b",Na:"c",Cb:"d"};function vr(){Pe.call(this,"d")}function wr(){Pe.call(this,"c")}function _r(){}function Tr(t,e,n,r){this.l=t,this.j=e,this.m=n,this.U=r||1,this.S=new Yn(this),this.O=Sr,t=Ge?125:void 0,this.T=new Kn(t),this.H=null,this.i=!1,this.s=this.A=this.v=this.K=this.F=this.V=this.B=null,this.D=[],this.g=null,this.C=0,this.o=this.u=null,this.Y=-1,this.I=!1,this.N=0,this.L=null,this.$=this.J=this.Z=this.P=!1,this.h=new Er}function Er(){this.i=null,this.g="",this.h=!1}Re(vr,Pe),Re(wr,Pe),Re(_r,fr),_r.prototype.g=function(){return new XMLHttpRequest},_r.prototype.i=function(){return{}},mr=new _r;var Sr=45e3,Ir={},br={};function Ar(t,e,n){t.K=1,t.v=Kr(Br(e)),t.s=n,t.P=!0,Cr(t,null)}function Cr(t,e){t.F=Date.now(),Dr(t),t.A=Br(t.v);var n=t.A,r=t.U;Array.isArray(r)||(r=[String(r)]),ss(n.i,"t",r),t.C=0,n=t.l.H,t.h=new Er,t.g=si(t.l,n?e:null,!t.s),0<t.N&&(t.L=new Qn(Ce(t.La,t,t.g),t.N)),Xn(t.S,t.g,"readystatechange",t.ib),e=t.H?fn(t.H):{},t.s?(t.u||(t.u="POST"),e["Content-Type"]="application/x-www-form-urlencoded",t.g.da(t.A,t.u,t.s,e)):(t.u="GET",t.g.da(t.A,t.u,null,e)),or(),function(t,e,n,r,s,i){t.info((function(){if(t.g)if(i)for(var o="",a=i.split("&"),c=0;c<a.length;c++){var u=a[c].split("=");if(1<u.length){var h=u[0];u=u[1];var l=h.split("_");o=2<=l.length&&"type"==l[1]?o+(h+"=")+u+"&":o+(h+"=redacted&")}}else o=null;else o=i;return"XMLHTTP REQ ("+r+") [attempt "+s+"]: "+e+"\n"+n+"\n"+o}))}(t.j,t.u,t.A,t.m,t.U,t.s)}function kr(t){return!!t.g&&("GET"==t.u&&2!=t.K&&t.l.Da)}function Rr(t,e,n){for(var r,s=!0;!t.I&&t.C<n.length;){if((r=Nr(t,n))==br){4==e&&(t.o=4,cr(14),s=!1),er(t.j,t.m,null,"[Incomplete Response]");break}if(r==Ir){t.o=4,cr(15),er(t.j,t.m,n,"[Invalid Chunk]"),s=!1;break}er(t.j,t.m,r,null),xr(t,r)}kr(t)&&r!=br&&r!=Ir&&(t.h.g="",t.C=0),4!=e||0!=n.length||t.h.h||(t.o=1,cr(16),s=!1),t.i=t.i&&s,s?0<n.length&&!t.$&&(t.$=!0,(e=t.l).g==t&&e.$&&!e.K&&(e.j.info("Great, no buffering proxy detected. Bytes received: "+n.length),Ys(e),e.K=!0,cr(11))):(er(t.j,t.m,n,"[Invalid Chunked Response]"),Mr(t),Pr(t))}function Nr(t,e){var n=t.C,r=e.indexOf("\n",n);return-1==r?br:(n=Number(e.substring(n,r)),isNaN(n)?Ir:(r+=1)+n>e.length?br:(e=e.substr(r,n),t.C=r+n,e))}function Dr(t){t.V=Date.now()+t.O,Or(t,t.O)}function Or(t,e){if(null!=t.B)throw Error("WatchDog timer not null");t.B=hr(Ce(t.gb,t),e)}function Lr(t){t.B&&(we.clearTimeout(t.B),t.B=null)}function Pr(t){0==t.l.G||t.I||Zs(t.l,t)}function Mr(t){Lr(t);var e=t.L;e&&"function"==typeof e.na&&e.na(),t.L=null,Wn(t.T),Zn(t.S),t.g&&(e=t.g,t.g=null,e.abort(),e.na())}function xr(t,e){try{var n=t.l;if(0!=n.G&&(n.g==t||ls(n.h,t)))if(!t.J&&ls(n.h,t)&&3==n.G){try{var r=n.Fa.g.parse(e)}catch(i){r=null}if(Array.isArray(r)&&3==r.length){var s=r;if(0==s[0]){t:if(!n.u){if(n.g){if(!(n.g.F+3e3<t.F))break t;Xs(n),js(n)}Qs(n),cr(18)}}else n.Ba=s[1],0<n.Ba-n.T&&37500>s[2]&&n.L&&0==n.A&&!n.v&&(n.v=hr(Ce(n.cb,n),6e3));if(1>=hs(n.h)&&n.ja){try{n.ja()}catch(i){}n.ja=void 0}}else ei(n,11)}else if((t.J||n.g==t)&&Xs(n),!xe(e))for(s=n.Fa.g.parse(e),e=0;e<s.length;e++){var i=s[e];if(n.T=i[0],i=i[1],2==n.G)if("c"==i[0]){n.I=i[1],n.ka=i[2];var o=i[3];null!=o&&(n.ma=o,n.j.info("VER="+n.ma));var a=i[4];null!=a&&(n.Ca=a,n.j.info("SVER="+n.Ca));var c=i[5];null!=c&&"number"==typeof c&&0<c&&(r=1.5*c,n.J=r,n.j.info("backChannelRequestTimeoutMs_="+r)),r=n;var u=t.g;if(u){var h=u.g?u.g.getResponseHeader("X-Client-Wire-Protocol"):null;if(h){var l=r.h;l.g||-1==h.indexOf("spdy")&&-1==h.indexOf("quic")&&-1==h.indexOf("h2")||(l.j=l.l,l.g=new Set,l.h&&(ds(l,l.h),l.h=null))}if(r.D){var d=u.g?u.g.getResponseHeader("X-HTTP-Session-Id"):null;d&&(r.za=d,qr(r.F,r.D,d))}}n.G=3,n.l&&n.l.xa(),n.$&&(n.P=Date.now()-t.F,n.j.info("Handshake RTT: "+n.P+"ms"));var f=t;if((r=n).sa=ri(r,r.H?r.ka:null,r.V),f.J){fs(r.h,f);var p=f,g=r.J;g&&p.setTimeout(g),p.B&&(Lr(p),Dr(p)),r.g=f}else zs(r);0<n.i.length&&qs(n)}else"stop"!=i[0]&&"close"!=i[0]||ei(n,7);else 3==n.G&&("stop"==i[0]||"close"==i[0]?"stop"==i[0]?ei(n,7):Hs(n):"noop"!=i[0]&&n.l&&n.l.wa(i),n.A=0)}or()}catch(i){}}function Ur(t,e){if(t.forEach&&"function"==typeof t.forEach)t.forEach(e,void 0);else if(Te(t)||"string"==typeof t)Array.prototype.forEach.call(t,e,void 0);else for(var n=function(t){if(t.oa&&"function"==typeof t.oa)return t.oa();if(!t.W||"function"!=typeof t.W){if("undefined"!=typeof Map&&t instanceof Map)return Array.from(t.keys());if(!("undefined"!=typeof Set&&t instanceof Set)){if(Te(t)||"string"==typeof t){var e=[];t=t.length;for(var n=0;n<t;n++)e.push(n);return e}for(var r in e=[],n=0,t)e[n++]=r;return e}}}(t),r=function(t){if(t.W&&"function"==typeof t.W)return t.W();if("undefined"!=typeof Map&&t instanceof Map||"undefined"!=typeof Set&&t instanceof Set)return Array.from(t.values());if("string"==typeof t)return t.split("");if(Te(t)){for(var e=[],n=t.length,r=0;r<n;r++)e.push(t[r]);return e}for(r in e=[],n=0,t)e[n++]=t[r];return e}(t),s=r.length,i=0;i<s;i++)e.call(void 0,r[i],n&&n[i],t)}(me=Tr.prototype).setTimeout=function(t){this.O=t},me.ib=function(t){t=t.target;var e=this.L;e&&3==Ms(t)?e.l():this.La(t)},me.La=function(t){try{if(t==this.g)t:{var e=Ms(this.g),n=this.g.Ea();this.g.aa();if(!(3>e)&&(3!=e||Ge||this.g&&(this.h.h||this.g.fa()||xs(this.g)))){this.I||4!=e||7==n||or(),Lr(this);var r=this.g.aa();this.Y=r;e:if(kr(this)){var s=xs(this.g);t="";var i=s.length,o=4==Ms(this.g);if(!this.h.i){if("undefined"==typeof TextDecoder){Mr(this),Pr(this);var a="";break e}this.h.i=new we.TextDecoder}for(n=0;n<i;n++)this.h.h=!0,t+=this.h.i.decode(s[n],{stream:o&&n==i-1});s.splice(0,i),this.h.g+=t,this.C=0,a=this.h.g}else a=this.g.fa();if(this.i=200==r,function(t,e,n,r,s,i,o){t.info((function(){return"XMLHTTP RESP ("+r+") [ attempt "+s+"]: "+e+"\n"+n+"\n"+i+" "+o}))}(this.j,this.u,this.A,this.m,this.U,e,r),this.i){if(this.Z&&!this.J){e:{if(this.g){var c,u=this.g;if((c=u.g?u.g.getResponseHeader("X-HTTP-Initial-Response"):null)&&!xe(c)){var h=c;break e}}h=null}if(!(r=h)){this.i=!1,this.o=3,cr(12),Mr(this),Pr(this);break t}er(this.j,this.m,r,"Initial handshake response via X-HTTP-Initial-Response"),this.J=!0,xr(this,r)}this.P?(Rr(this,e,a),Ge&&this.i&&3==e&&(Xn(this.S,this.T,"tick",this.hb),this.T.start())):(er(this.j,this.m,a,null),xr(this,a)),4==e&&Mr(this),this.i&&!this.I&&(4==e?Zs(this.l,this):(this.i=!1,Dr(this)))}else 400==r&&0<a.indexOf("Unknown SID")?(this.o=3,cr(12)):(this.o=0,cr(13)),Mr(this),Pr(this)}}}catch(e){}},me.hb=function(){if(this.g){var t=Ms(this.g),e=this.g.fa();this.C<e.length&&(Lr(this),Rr(this,t,e),this.i&&4!=t&&Dr(this))}},me.cancel=function(){this.I=!0,Mr(this)},me.gb=function(){this.B=null;var t=Date.now();0<=t-this.V?(function(t,e){t.info((function(){return"TIMEOUT: "+e}))}(this.j,this.A),2!=this.K&&(or(),cr(17)),Mr(this),this.o=2,Pr(this)):Or(this,this.V-t)};var Fr=RegExp("^(?:([^:/?#.]+):)?(?://(?:([^\\\\/?#]*)@)?([^\\\\/?#]*?)(?::([0-9]+))?(?=[\\\\/?#]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#([\\s\\S]*))?$");function Vr(t,e){if(this.g=this.s=this.j="",this.m=null,this.o=this.l="",this.h=!1,t instanceof Vr){this.h=void 0!==e?e:t.h,Hr(this,t.j),this.s=t.s,this.g=t.g,jr(this,t.m),this.l=t.l,e=t.i;var n=new ts;n.i=e.i,e.g&&(n.g=new Map(e.g),n.h=e.h),$r(this,n),this.o=t.o}else t&&(n=String(t).match(Fr))?(this.h=!!e,Hr(this,n[1]||"",!0),this.s=Wr(n[2]||""),this.g=Wr(n[3]||"",!0),jr(this,n[4]),this.l=Wr(n[5]||"",!0),$r(this,n[6]||"",!0),this.o=Wr(n[7]||"")):(this.h=!!e,this.i=new ts(null,this.h))}function Br(t){return new Vr(t)}function Hr(t,e,n){t.j=n?Wr(e,!0):e,t.j&&(t.j=t.j.replace(/:$/,""))}function jr(t,e){if(e){if(e=Number(e),isNaN(e)||0>e)throw Error("Bad port number "+e);t.m=e}else t.m=null}function $r(t,e,n){e instanceof ts?(t.i=e,function(t,e){e&&!t.j&&(es(t),t.i=null,t.g.forEach((function(t,e){var n=e.toLowerCase();e!=n&&(ns(this,e),ss(this,n,t))}),t)),t.j=e}(t.i,t.h)):(n||(e=Gr(e,Xr)),t.i=new ts(e,t.h))}function qr(t,e,n){t.i.set(e,n)}function Kr(t){return qr(t,"zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^Date.now()).toString(36)),t}function Wr(t,e){return t?e?decodeURI(t.replace(/%25/g,"%2525")):decodeURIComponent(t):""}function Gr(t,e,n){return"string"==typeof t?(t=encodeURI(t).replace(e,zr),n&&(t=t.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),t):null}function zr(t){return"%"+((t=t.charCodeAt(0))>>4&15).toString(16)+(15&t).toString(16)}Vr.prototype.toString=function(){var t=[],e=this.j;e&&t.push(Gr(e,Qr,!0),":");var n=this.g;return(n||"file"==e)&&(t.push("//"),(e=this.s)&&t.push(Gr(e,Qr,!0),"@"),t.push(encodeURIComponent(String(n)).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),null!=(n=this.m)&&t.push(":",String(n))),(n=this.l)&&(this.g&&"/"!=n.charAt(0)&&t.push("/"),t.push(Gr(n,"/"==n.charAt(0)?Jr:Yr,!0))),(n=this.i.toString())&&t.push("?",n),(n=this.o)&&t.push("#",Gr(n,Zr)),t.join("")};var Qr=/[#\/\?@]/g,Yr=/[#\?:]/g,Jr=/[#\?]/g,Xr=/[#\?@]/g,Zr=/#/g;function ts(t,e){this.h=this.g=null,this.i=t||null,this.j=!!e}function es(t){t.g||(t.g=new Map,t.h=0,t.i&&function(t,e){if(t){t=t.split("&");for(var n=0;n<t.length;n++){var r=t[n].indexOf("="),s=null;if(0<=r){var i=t[n].substring(0,r);s=t[n].substring(r+1)}else i=t[n];e(i,s?decodeURIComponent(s.replace(/\+/g," ")):"")}}}(t.i,(function(e,n){t.add(decodeURIComponent(e.replace(/\+/g," ")),n)})))}function ns(t,e){es(t),e=is(t,e),t.g.has(e)&&(t.i=null,t.h-=t.g.get(e).length,t.g.delete(e))}function rs(t,e){return es(t),e=is(t,e),t.g.has(e)}function ss(t,e,n){ns(t,e),0<n.length&&(t.i=null,t.g.set(is(t,e),Oe(n)),t.h+=n.length)}function is(t,e){return e=String(e),t.j&&(e=e.toLowerCase()),e}(me=ts.prototype).add=function(t,e){es(this),this.i=null,t=is(this,t);var n=this.g.get(t);return n||this.g.set(t,n=[]),n.push(e),this.h+=1,this},me.forEach=function(t,e){es(this),this.g.forEach((function(n,r){n.forEach((function(n){t.call(e,n,r,this)}),this)}),this)},me.oa=function(){es(this);for(var t=Array.from(this.g.values()),e=Array.from(this.g.keys()),n=[],r=0;r<e.length;r++)for(var s=t[r],i=0;i<s.length;i++)n.push(e[r]);return n},me.W=function(t){es(this);var e=[];if("string"==typeof t)rs(this,t)&&(e=e.concat(this.g.get(is(this,t))));else{t=Array.from(this.g.values());for(var n=0;n<t.length;n++)e=e.concat(t[n])}return e},me.set=function(t,e){return es(this),this.i=null,rs(this,t=is(this,t))&&(this.h-=this.g.get(t).length),this.g.set(t,[e]),this.h+=1,this},me.get=function(t,e){return t&&0<(t=this.W(t)).length?String(t[0]):e},me.toString=function(){if(this.i)return this.i;if(!this.g)return"";for(var t=[],e=Array.from(this.g.keys()),n=0;n<e.length;n++){var r=e[n],s=encodeURIComponent(String(r)),i=this.W(r);for(r=0;r<i.length;r++){var o=s;""!==i[r]&&(o+="="+encodeURIComponent(String(i[r]))),t.push(o)}}return this.i=t.join("&")};var os=function(t,e){this.h=t,this.g=e};function as(t){this.l=t||cs,we.PerformanceNavigationTiming?t=0<(t=we.performance.getEntriesByType("navigation")).length&&("hq"==t[0].nextHopProtocol||"h2"==t[0].nextHopProtocol):t=!!(we.g&&we.g.Ga&&we.g.Ga()&&we.g.Ga().$b),this.j=t?this.l:1,this.g=null,1<this.j&&(this.g=new Set),this.h=null,this.i=[]}var cs=10;function us(t){return!!t.h||!!t.g&&t.g.size>=t.j}function hs(t){return t.h?1:t.g?t.g.size:0}function ls(t,e){return t.h?t.h==e:!!t.g&&t.g.has(e)}function ds(t,e){t.g?t.g.add(e):t.h=e}function fs(t,e){t.h&&t.h==e?t.h=null:t.g&&t.g.has(e)&&t.g.delete(e)}function ps(t){var e,n;if(null!=t.h)return t.i.concat(t.h.D);if(null!=t.g&&0!==t.g.size){var r=t.i;try{for(var s=pe(t.g.values()),i=s.next();!i.done;i=s.next()){var o=i.value;r=r.concat(o.D)}}catch(t){e={error:t}}finally{try{i&&!i.done&&(n=s.return)&&n.call(s)}finally{if(e)throw e.error}}return r}return Oe(t.i)}function gs(){}function ms(){this.g=new gs}function ys(t,e,n){var r=n||"";try{Ur(t,(function(t,n){var s=t;Ee(t)&&(s=Pn(t)),e.push(r+n+"="+encodeURIComponent(s))}))}catch(t){throw e.push(r+"type="+encodeURIComponent("_badmap")),t}}function vs(t,e,n,r,s){try{e.onload=null,e.onerror=null,e.onabort=null,e.ontimeout=null,s(r)}catch(t){}}function ws(t){this.l=t.ac||null,this.j=t.jb||!1}function _s(t,e){Dn.call(this),this.D=t,this.u=e,this.m=void 0,this.readyState=Ts,this.status=0,this.responseType=this.responseText=this.response=this.statusText="",this.onreadystatechange=null,this.v=new Headers,this.h=null,this.C="GET",this.B="",this.g=!1,this.A=this.j=this.l=null}as.prototype.cancel=function(){var t,e;if(this.i=ps(this),this.h)this.h.cancel(),this.h=null;else if(this.g&&0!==this.g.size){try{for(var n=pe(this.g.values()),r=n.next();!r.done;r=n.next()){r.value.cancel()}}catch(e){t={error:e}}finally{try{r&&!r.done&&(e=n.return)&&e.call(n)}finally{if(t)throw t.error}}this.g.clear()}},gs.prototype.stringify=function(t){return we.JSON.stringify(t,void 0)},gs.prototype.parse=function(t){return we.JSON.parse(t,void 0)},Re(ws,fr),ws.prototype.g=function(){return new _s(this.l,this.j)},ws.prototype.i=function(t){return function(){return t}}({}),Re(_s,Dn);var Ts=0;function Es(t){t.j.read().then(t.Ta.bind(t)).catch(t.ga.bind(t))}function Ss(t){t.readyState=4,t.l=null,t.j=null,t.A=null,Is(t)}function Is(t){t.onreadystatechange&&t.onreadystatechange.call(t)}(me=_s.prototype).open=function(t,e){if(this.readyState!=Ts)throw this.abort(),Error("Error reopening a connection");this.C=t,this.B=e,this.readyState=1,Is(this)},me.send=function(t){if(1!=this.readyState)throw this.abort(),Error("need to call open() first. ");this.g=!0;var e={headers:this.v,method:this.C,credentials:this.m,cache:void 0};t&&(e.body=t),(this.D||we).fetch(new Request(this.B,e)).then(this.Wa.bind(this),this.ga.bind(this))},me.abort=function(){this.response=this.responseText="",this.v=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,Ss(this)),this.readyState=Ts},me.Wa=function(t){if(this.g&&(this.l=t,this.h||(this.status=this.l.status,this.statusText=this.l.statusText,this.h=t.headers,this.readyState=2,Is(this)),this.g&&(this.readyState=3,Is(this),this.g)))if("arraybuffer"===this.responseType)t.arrayBuffer().then(this.Ua.bind(this),this.ga.bind(this));else if(void 0!==we.ReadableStream&&"body"in t){if(this.j=t.body.getReader(),this.u){if(this.responseType)throw Error('responseType must be empty for "streamBinaryChunks" mode responses.');this.response=[]}else this.response=this.responseText="",this.A=new TextDecoder;Es(this)}else t.text().then(this.Va.bind(this),this.ga.bind(this))},me.Ta=function(t){if(this.g){if(this.u&&t.value)this.response.push(t.value);else if(!this.u){var e=t.value?t.value:new Uint8Array(0);(e=this.A.decode(e,{stream:!t.done}))&&(this.response=this.responseText+=e)}t.done?Ss(this):Is(this),3==this.readyState&&Es(this)}},me.Va=function(t){this.g&&(this.response=this.responseText=t,Ss(this))},me.Ua=function(t){this.g&&(this.response=t,Ss(this))},me.ga=function(){this.g&&Ss(this)},me.setRequestHeader=function(t,e){this.v.append(t,e)},me.getResponseHeader=function(t){return this.h&&this.h.get(t.toLowerCase())||""},me.getAllResponseHeaders=function(){if(!this.h)return"";for(var t=[],e=this.h.entries(),n=e.next();!n.done;)n=n.value,t.push(n[0]+": "+n[1]),n=e.next();return t.join("\r\n")},Object.defineProperty(_s.prototype,"withCredentials",{get:function(){return"include"===this.m},set:function(t){this.m=t?"include":"same-origin"}});var bs=we.JSON.parse;function As(t){Dn.call(this),this.headers=new Map,this.u=t||null,this.h=!1,this.C=this.g=null,this.H="",this.m=0,this.j="",this.l=this.F=this.v=this.D=!1,this.B=0,this.A=null,this.J=Cs,this.K=this.L=!1}Re(As,Dn);var Cs="",ks=/^https?$/i,Rs=["POST","PUT"];function Ns(t,e){t.h=!1,t.g&&(t.l=!0,t.g.abort(),t.l=!1),t.j=e,t.m=5,Ds(t),Ls(t)}function Ds(t){t.D||(t.D=!0,On(t,"complete"),On(t,"error"))}function Os(t){if(t.h&&void 0!==ve&&(!t.C[1]||4!=Ms(t)||2!=t.aa()))if(t.v&&4==Ms(t))Gn(t.Ha,0,t);else if(On(t,"readystatechange"),4==Ms(t)){t.h=!1;try{var e,n=t.aa();t:switch(n){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var r=!0;break t;default:r=!1}if(!(e=r)){var s;if(s=0===n){var i=String(t.H).match(Fr)[1]||null;if(!i&&we.self&&we.self.location){var o=we.self.location.protocol;i=o.substr(0,o.length-1)}s=!ks.test(i?i.toLowerCase():"")}e=s}if(e)On(t,"complete"),On(t,"success");else{t.m=6;try{var a=2<Ms(t)?t.g.statusText:""}catch(t){a=""}t.j=a+" ["+t.aa()+"]",Ds(t)}}finally{Ls(t)}}}function Ls(t,e){if(t.g){Ps(t);var n=t.g,r=t.C[0]?_e:null;t.g=null,t.C=null,e||On(t,"ready");try{n.onreadystatechange=r}catch(t){}}}function Ps(t){t.g&&t.K&&(t.g.ontimeout=null),t.A&&(we.clearTimeout(t.A),t.A=null)}function Ms(t){return t.g?t.g.readyState:0}function xs(t){try{if(!t.g)return null;if("response"in t.g)return t.g.response;switch(t.J){case Cs:case"text":return t.g.responseText;case"arraybuffer":if("mozResponseArrayBuffer"in t.g)return t.g.mozResponseArrayBuffer}return null}catch(t){return null}}function Us(t){var e="";return dn(t,(function(t,n){e+=n,e+=":",e+=t,e+="\r\n"})),e}function Fs(t,e,n){t:{for(r in n){var r=!1;break t}r=!0}r||(n=Us(n),"string"==typeof t?null!=n&&encodeURIComponent(String(n)):qr(t,e,n))}function Vs(t,e,n){return n&&n.internalChannelParams&&n.internalChannelParams[t]||e}function Bs(t){this.Ca=0,this.i=[],this.j=new tr,this.ka=this.sa=this.F=this.V=this.g=this.za=this.D=this.ia=this.o=this.S=this.s=null,this.ab=this.U=0,this.Za=Vs("failFast",!1,t),this.L=this.v=this.u=this.m=this.l=null,this.Y=!0,this.pa=this.Ba=this.T=-1,this.Z=this.A=this.C=0,this.Xa=Vs("baseRetryDelayMs",5e3,t),this.bb=Vs("retryDelaySeedMs",1e4,t),this.$a=Vs("forwardChannelMaxRetries",2,t),this.ta=Vs("forwardChannelRequestTimeoutMs",2e4,t),this.ra=t&&t.xmlHttpFactory||void 0,this.Da=t&&t.Zb||!1,this.J=void 0,this.H=t&&t.supportsCrossDomainXhr||!1,this.I="",this.h=new as(t&&t.concurrentRequestLimit),this.Fa=new ms,this.O=t&&t.fastHandshake||!1,this.N=t&&t.encodeInitMessageHeaders||!1,this.O&&this.N&&(this.N=!1),this.Ya=t&&t.Xb||!1,t&&t.Aa&&this.j.Aa(),t&&t.forceLongPolling&&(this.Y=!1),this.$=!this.O&&this.Y&&t&&t.detectBufferingProxy||!1,this.ja=void 0,this.P=0,this.K=!1,this.la=this.B=null}function Hs(t){if($s(t),3==t.G){var e=t.U++,n=Br(t.F);qr(n,"SID",t.I),qr(n,"RID",e),qr(n,"TYPE","terminate"),Ws(t,n),(e=new Tr(t,t.j,e,void 0)).K=2,e.v=Kr(Br(n)),n=!1,we.navigator&&we.navigator.sendBeacon&&(n=we.navigator.sendBeacon(e.v.toString(),"")),!n&&we.Image&&((new Image).src=e.v,n=!0),n||(e.g=si(e.l,null),e.g.da(e.v)),e.F=Date.now(),Dr(e)}ni(t)}function js(t){t.g&&(Ys(t),t.g.cancel(),t.g=null)}function $s(t){js(t),t.u&&(we.clearTimeout(t.u),t.u=null),Xs(t),t.h.cancel(),t.m&&("number"==typeof t.m&&we.clearTimeout(t.m),t.m=null)}function qs(t){us(t.h)||t.m||(t.m=!0,Hn(t.Ja,t),t.C=0)}function Ks(t,e){var n;n=e?e.m:t.U++;var r=Br(t.F);qr(r,"SID",t.I),qr(r,"RID",n),qr(r,"AID",t.T),Ws(t,r),t.o&&t.s&&Fs(r,t.o,t.s),n=new Tr(t,t.j,n,t.C+1),null===t.o&&(n.H=t.s),e&&(t.i=e.D.concat(t.i)),e=Gs(t,n,1e3),n.setTimeout(Math.round(.5*t.ta)+Math.round(.5*t.ta*Math.random())),ds(t.h,n),Ar(n,r,e)}function Ws(t,e){t.ia&&dn(t.ia,(function(t,n){qr(e,n,t)})),t.l&&Ur({},(function(t,n){qr(e,n,t)}))}function Gs(t,e,n){n=Math.min(t.i.length,n);var r=t.l?Ce(t.l.Ra,t.l,t):null;t:for(var s=t.i,i=-1;;){var o=["count="+n];-1==i?0<n?(i=s[0].h,o.push("ofs="+i)):i=0:o.push("ofs="+i);for(var a=!0,c=0;c<n;c++){var u=s[c].h,h=s[c].g;if(0>(u-=i))i=Math.max(0,s[c].h-100),a=!1;else try{ys(h,o,"req"+u+"_")}catch(t){r&&r(h)}}if(a){r=o.join("&");break t}}return t=t.i.splice(0,n),e.D=t,r}function zs(t){t.g||t.u||(t.Z=1,Hn(t.Ia,t),t.A=0)}function Qs(t){return!(t.g||t.u||3<=t.A)&&(t.Z++,t.u=hr(Ce(t.Ia,t),ti(t,t.A)),t.A++,!0)}function Ys(t){null!=t.B&&(we.clearTimeout(t.B),t.B=null)}function Js(t){t.g=new Tr(t,t.j,"rpc",t.Z),null===t.o&&(t.g.H=t.s),t.g.N=0;var e=Br(t.sa);qr(e,"RID","rpc"),qr(e,"SID",t.I),qr(e,"CI",t.L?"0":"1"),qr(e,"AID",t.T),qr(e,"TYPE","xmlhttp"),Ws(t,e),t.o&&t.s&&Fs(e,t.o,t.s),t.J&&t.g.setTimeout(t.J);var n=t.g;t=t.ka,n.K=1,n.v=Kr(Br(e)),n.s=null,n.P=!0,Cr(n,t)}function Xs(t){null!=t.v&&(we.clearTimeout(t.v),t.v=null)}function Zs(t,e){var n=null;if(t.g==e){Xs(t),Ys(t),t.g=null;var r=2}else{if(!ls(t.h,e))return;n=e.D,fs(t.h,e),r=1}if(0!=t.G)if(t.pa=e.Y,e.i)if(1==r){n=e.s?e.s.length:0,e=Date.now()-e.F;var s=t.C;On(r=sr(),new ur(r,n)),qs(t)}else zs(t);else if(3==(s=e.o)||0==s&&0<t.pa||!(1==r&&function(t,e){return!(hs(t.h)>=t.h.j-(t.m?1:0)||(t.m?(t.i=e.D.concat(t.i),0):1==t.G||2==t.G||t.C>=(t.Za?0:t.$a)||(t.m=hr(Ce(t.Ja,t,e),ti(t,t.C)),t.C++,0)))}(t,e)||2==r&&Qs(t)))switch(n&&0<n.length&&(e=t.h,e.i=e.i.concat(n)),s){case 1:ei(t,5);break;case 4:ei(t,10);break;case 3:ei(t,6);break;default:ei(t,2)}}function ti(t,e){var n=t.Xa+Math.floor(Math.random()*t.bb);return t.l||(n*=2),n*e}function ei(t,e){if(t.j.info("Error code "+e),2==e){var n=null;t.l&&(n=null);var r=Ce(t.kb,t);n||(n=new Vr("//www.google.com/images/cleardot.gif"),we.location&&"http"==we.location.protocol||Hr(n,"https"),Kr(n)),function(t,e){var n=new tr;if(we.Image){var r=new Image;r.onload=ke(vs,n,r,"TestLoadImage: loaded",!0,e),r.onerror=ke(vs,n,r,"TestLoadImage: error",!1,e),r.onabort=ke(vs,n,r,"TestLoadImage: abort",!1,e),r.ontimeout=ke(vs,n,r,"TestLoadImage: timeout",!1,e),we.setTimeout((function(){r.ontimeout&&r.ontimeout()}),1e4),r.src=t}else e(!1)}(n.toString(),r)}else cr(2);t.G=0,t.l&&t.l.va(e),ni(t),$s(t)}function ni(t){if(t.G=0,t.la=[],t.l){var e=ps(t.h);0==e.length&&0==t.i.length||(Le(t.la,e),Le(t.la,t.i),t.h.i.length=0,Oe(t.i),t.i.length=0),t.l.ua()}}function ri(t,e,n){var r=n instanceof Vr?Br(n):new Vr(n,void 0);if(""!=r.g)e&&(r.g=e+"."+r.g),jr(r,r.m);else{var s=we.location;r=s.protocol,e=e?e+"."+s.hostname:s.hostname,s=+s.port;var i=new Vr(null,void 0);r&&Hr(i,r),e&&(i.g=e),s&&jr(i,s),n&&(i.l=n),r=i}return n=t.D,e=t.za,n&&e&&qr(r,n,e),qr(r,"VER",t.ma),Ws(t,r),r}function si(t,e,n){if(e&&!t.H)throw Error("Can't create secondary domain capable XhrIo object.");return(e=n&&t.Da&&!t.ra?new As(new ws({jb:!0})):new As(t.ra)).Ka(t.H),e}function ii(){}function oi(){if(Ke&&!(10<=Number(sn)))throw Error("Environmental error: no available transport.")}function ai(t,e){Dn.call(this),this.g=new Bs(e),this.l=t,this.h=e&&e.messageUrlParams||null,t=e&&e.messageHeaders||null,e&&e.clientProtocolHeaderRequired&&(t?t["X-Client-Protocol"]="webchannel":t={"X-Client-Protocol":"webchannel"}),this.g.s=t,t=e&&e.initMessageHeaders||null,e&&e.messageContentType&&(t?t["X-WebChannel-Content-Type"]=e.messageContentType:t={"X-WebChannel-Content-Type":e.messageContentType}),e&&e.ya&&(t?t["X-WebChannel-Client-Profile"]=e.ya:t={"X-WebChannel-Client-Profile":e.ya}),this.g.S=t,(t=e&&e.Yb)&&!xe(t)&&(this.g.o=t),this.A=e&&e.supportsCrossDomainXhr||!1,this.v=e&&e.sendRawJson||!1,(e=e&&e.httpSessionIdParam)&&!xe(e)&&(this.g.D=e,null!==(t=this.h)&&e in t&&(e in(t=this.h)&&delete t[e])),this.j=new hi(this)}function ci(t){vr.call(this);var e=t.__sm__;if(e){t:{for(var n in e){t=n;break t}t=void 0}(this.i=t)&&(t=this.i,e=null!==e&&t in e?e[t]:void 0),this.data=e}else this.data=t}function ui(){wr.call(this),this.status=1}function hi(t){this.g=t}(me=As.prototype).Ka=function(t){this.L=t},me.da=function(t,e,n,r){var s,i,o,a;if(this.g)throw Error("[goog.net.XhrIo] Object is active with another request="+this.H+"; newUri="+t);e=e?e.toUpperCase():"GET",this.H=t,this.j="",this.m=0,this.D=!1,this.h=!0,this.g=this.u?this.u.g():mr.g(),this.C=this.u?pr(this.u):pr(mr),this.g.onreadystatechange=Ce(this.Ha,this);try{this.F=!0,this.g.open(e,String(t),!0),this.F=!1}catch(l){return void Ns(this,l)}if(t=n||"",n=new Map(this.headers),r)if(Object.getPrototypeOf(r)===Object.prototype)for(var c in r)n.set(c,r[c]);else{if("function"!=typeof r.keys||"function"!=typeof r.get)throw Error("Unknown input type for opt_headers: "+String(r));try{for(var u=pe(r.keys()),h=u.next();!h.done;h=u.next()){var l=h.value;n.set(l,r.get(l))}}catch(t){s={error:t}}finally{try{h&&!h.done&&(i=u.return)&&i.call(u)}finally{if(s)throw s.error}}}r=Array.from(n.keys()).find((function(t){return"content-type"==t.toLowerCase()})),c=we.FormData&&t instanceof we.FormData,!(0<=De(Rs,e))||r||c||n.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8");try{for(var d=pe(n),f=d.next();!f.done;f=d.next()){var p=ge(f.value,2),g=(l=p[0],p[1]);this.g.setRequestHeader(l,g)}}catch(t){o={error:t}}finally{try{f&&!f.done&&(a=d.return)&&a.call(d)}finally{if(o)throw o.error}}this.J&&(this.g.responseType=this.J),"withCredentials"in this.g&&this.g.withCredentials!==this.L&&(this.g.withCredentials=this.L);try{Ps(this),0<this.B&&((this.K=function(t){return Ke&&nn()&&"number"==typeof t.timeout&&void 0!==t.ontimeout}(this.g))?(this.g.timeout=this.B,this.g.ontimeout=Ce(this.qa,this)):this.A=Gn(this.qa,this.B,this)),this.v=!0,this.g.send(t),this.v=!1}catch(l){Ns(this,l)}},me.qa=function(){void 0!==ve&&this.g&&(this.j="Timed out after "+this.B+"ms, aborting",this.m=8,On(this,"timeout"),this.abort(8))},me.abort=function(t){this.g&&this.h&&(this.h=!1,this.l=!0,this.g.abort(),this.l=!1,this.m=t||7,On(this,"complete"),On(this,"abort"),Ls(this))},me.M=function(){this.g&&(this.h&&(this.h=!1,this.l=!0,this.g.abort(),this.l=!1),Ls(this,!0)),As.X.M.call(this)},me.Ha=function(){this.s||(this.F||this.v||this.l?Os(this):this.fb())},me.fb=function(){Os(this)},me.aa=function(){try{return 2<Ms(this)?this.g.status:-1}catch(t){return-1}},me.fa=function(){try{return this.g?this.g.responseText:""}catch(t){return""}},me.Sa=function(t){if(this.g){var e=this.g.responseText;return t&&0==e.indexOf(t)&&(e=e.substring(t.length)),bs(e)}},me.Ea=function(){return this.m},me.Oa=function(){return"string"==typeof this.j?this.j:String(this.j)},(me=Bs.prototype).ma=8,me.G=1,me.Ja=function(t){if(this.m)if(this.m=null,1==this.G){if(!t){this.U=Math.floor(1e5*Math.random()),t=this.U++;var e=new Tr(this,this.j,t,void 0),n=this.s;if(this.S&&(n?gn(n=fn(n),this.S):n=this.S),null!==this.o||this.N||(e.H=n,n=null),this.O)t:{for(var r=0,s=0;s<this.i.length;s++){var i=this.i[s];if(void 0===(i="__data__"in i.g&&"string"==typeof(i=i.g.__data__)?i.length:void 0))break;if(4096<(r+=i)){r=s;break t}if(4096===r||s===this.i.length-1){r=s+1;break t}}r=1e3}else r=1e3;r=Gs(this,e,r),qr(s=Br(this.F),"RID",t),qr(s,"CVER",22),this.D&&qr(s,"X-HTTP-Session-Id",this.D),Ws(this,s),n&&(this.N?r="headers="+encodeURIComponent(String(Us(n)))+"&"+r:this.o&&Fs(s,this.o,n)),ds(this.h,e),this.Ya&&qr(s,"TYPE","init"),this.O?(qr(s,"$req",r),qr(s,"SID","null"),e.Z=!0,Ar(e,s,null)):Ar(e,s,r),this.G=2}}else 3==this.G&&(t?Ks(this,t):0==this.i.length||us(this.h)||Ks(this))},me.Ia=function(){if(this.u=null,Js(this),this.$&&!(this.K||null==this.g||0>=this.P)){var t=2*this.P;this.j.info("BP detection timer enabled: "+t),this.B=hr(Ce(this.eb,this),t)}},me.eb=function(){this.B&&(this.B=null,this.j.info("BP detection timeout reached."),this.j.info("Buffering proxy detected and switch to long-polling!"),this.L=!1,this.K=!0,cr(10),js(this),Js(this))},me.cb=function(){null!=this.v&&(this.v=null,js(this),Qs(this),cr(19))},me.kb=function(t){t?(this.j.info("Successfully pinged google.com"),cr(2)):(this.j.info("Failed to ping google.com"),cr(1))},(me=ii.prototype).xa=function(){},me.wa=function(){},me.va=function(){},me.ua=function(){},me.Ra=function(){},oi.prototype.g=function(t,e){return new ai(t,e)},Re(ai,Dn),ai.prototype.m=function(){this.g.l=this.j,this.A&&(this.g.H=!0);var t=this.g,e=this.l,n=this.h||void 0;cr(0),t.V=e,t.ia=n||{},t.L=t.Y,t.F=ri(t,null,t.V),qs(t)},ai.prototype.close=function(){Hs(this.g)},ai.prototype.u=function(t){var e=this.g;if("string"==typeof t){var n={};n.__data__=t,t=n}else this.v&&((n={}).__data__=Pn(t),t=n);e.i.push(new os(e.ab++,t)),3==e.G&&qs(e)},ai.prototype.M=function(){this.g.l=null,delete this.j,Hs(this.g),delete this.g,ai.X.M.call(this)},Re(ci,vr),Re(ui,wr),Re(hi,ii),hi.prototype.xa=function(){On(this.g,"a")},hi.prototype.wa=function(t){On(this.g,new ci(t))},hi.prototype.va=function(t){On(this.g,new ui)},hi.prototype.ua=function(){On(this.g,"b")},oi.prototype.createWebChannel=oi.prototype.g,ai.prototype.send=ai.prototype.u,ai.prototype.open=ai.prototype.m,ai.prototype.close=ai.prototype.close,lr.NO_ERROR=0,lr.TIMEOUT=8,lr.HTTP_ERROR=6,dr.COMPLETE="complete",gr.EventType=yr,yr.OPEN="a",yr.CLOSE="b",yr.ERROR="c",yr.MESSAGE="d",Dn.prototype.listen=Dn.prototype.N,As.prototype.listenOnce=As.prototype.O,As.prototype.getLastError=As.prototype.Oa,As.prototype.getLastErrorCode=As.prototype.Ea,As.prototype.getStatus=As.prototype.aa,As.prototype.getResponseJson=As.prototype.Sa,As.prototype.getResponseText=As.prototype.fa,As.prototype.send=As.prototype.da,As.prototype.setWithCredentials=As.prototype.Ka;var li=lr,di=dr,fi=nr,pi=10,gi=11,mi=ws,yi=gr,vi=As;const wi="@firebase/firestore";
316
398
  /**
317
399
  * @license
318
400
  * Copyright 2017 Google LLC
@@ -328,7 +410,7 @@ class at{constructor(t,e,n){this._isDeleted=!1,this._options=Object.assign({},t)
328
410
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
329
411
  * See the License for the specific language governing permissions and
330
412
  * limitations under the License.
331
- */class Nr{constructor(t){this.uid=t}isAuthenticated(){return null!=this.uid}toKey(){return this.isAuthenticated()?"uid:"+this.uid:"anonymous-user"}isEqual(t){return t.uid===this.uid}}Nr.UNAUTHENTICATED=new Nr(null),Nr.GOOGLE_CREDENTIALS=new Nr("google-credentials-uid"),Nr.FIRST_PARTY=new Nr("first-party-uid"),Nr.MOCK_USER=new Nr("mock-user");
413
+ */class _i{constructor(t){this.uid=t}isAuthenticated(){return null!=this.uid}toKey(){return this.isAuthenticated()?"uid:"+this.uid:"anonymous-user"}isEqual(t){return t.uid===this.uid}}_i.UNAUTHENTICATED=new _i(null),_i.GOOGLE_CREDENTIALS=new _i("google-credentials-uid"),_i.FIRST_PARTY=new _i("first-party-uid"),_i.MOCK_USER=new _i("mock-user");
332
414
  /**
333
415
  * @license
334
416
  * Copyright 2017 Google LLC
@@ -345,7 +427,7 @@ class at{constructor(t,e,n){this._isDeleted=!1,this._options=Object.assign({},t)
345
427
  * See the License for the specific language governing permissions and
346
428
  * limitations under the License.
347
429
  */
348
- let Rr="9.15.0";
430
+ let Ti="9.15.0";
349
431
  /**
350
432
  * @license
351
433
  * Copyright 2017 Google LLC
@@ -361,7 +443,7 @@ let Rr="9.15.0";
361
443
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
362
444
  * See the License for the specific language governing permissions and
363
445
  * limitations under the License.
364
- */const Or=new D("@firebase/firestore");function Dr(){return Or.logLevel}function Lr(t,...e){if(Or.logLevel<=C.DEBUG){const n=e.map(xr);Or.debug(`Firestore (${Rr}): ${t}`,...n)}}function Pr(t,...e){if(Or.logLevel<=C.ERROR){const n=e.map(xr);Or.error(`Firestore (${Rr}): ${t}`,...n)}}function Mr(t,...e){if(Or.logLevel<=C.WARN){const n=e.map(xr);Or.warn(`Firestore (${Rr}): ${t}`,...n)}}function xr(t){if("string"==typeof t)return t;try{return e=t,JSON.stringify(e)}catch(e){return t}
446
+ */const Ei=new class{constructor(t){this.name=t,this._logLevel=he,this._logHandler=de,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(t){if(!(t in ce))throw new TypeError(`Invalid value "${t}" assigned to \`logLevel\``);this._logLevel=t}setLogLevel(t){this._logLevel="string"==typeof t?ue[t]:t}get logHandler(){return this._logHandler}set logHandler(t){if("function"!=typeof t)throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=t}get userLogHandler(){return this._userLogHandler}set userLogHandler(t){this._userLogHandler=t}debug(...t){this._userLogHandler&&this._userLogHandler(this,ce.DEBUG,...t),this._logHandler(this,ce.DEBUG,...t)}log(...t){this._userLogHandler&&this._userLogHandler(this,ce.VERBOSE,...t),this._logHandler(this,ce.VERBOSE,...t)}info(...t){this._userLogHandler&&this._userLogHandler(this,ce.INFO,...t),this._logHandler(this,ce.INFO,...t)}warn(...t){this._userLogHandler&&this._userLogHandler(this,ce.WARN,...t),this._logHandler(this,ce.WARN,...t)}error(...t){this._userLogHandler&&this._userLogHandler(this,ce.ERROR,...t),this._logHandler(this,ce.ERROR,...t)}}("@firebase/firestore");function Si(){return Ei.logLevel}function Ii(t,...e){if(Ei.logLevel<=ce.DEBUG){const n=e.map(Ci);Ei.debug(`Firestore (${Ti}): ${t}`,...n)}}function bi(t,...e){if(Ei.logLevel<=ce.ERROR){const n=e.map(Ci);Ei.error(`Firestore (${Ti}): ${t}`,...n)}}function Ai(t,...e){if(Ei.logLevel<=ce.WARN){const n=e.map(Ci);Ei.warn(`Firestore (${Ti}): ${t}`,...n)}}function Ci(t){if("string"==typeof t)return t;try{return e=t,JSON.stringify(e)}catch(e){return t}
365
447
  /**
366
448
  * @license
367
449
  * Copyright 2020 Google LLC
@@ -393,7 +475,7 @@ let Rr="9.15.0";
393
475
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
394
476
  * See the License for the specific language governing permissions and
395
477
  * limitations under the License.
396
- */function Ur(t="Unexpected state"){const e=`FIRESTORE (${Rr}) INTERNAL ASSERTION FAILED: `+t;throw Pr(e),new Error(e)}function Fr(t,e){t||Ur()}function Vr(t,e){return t}
478
+ */function ki(t="Unexpected state"){const e=`FIRESTORE (${Ti}) INTERNAL ASSERTION FAILED: `+t;throw bi(e),new Error(e)}function Ri(t,e){t||ki()}function Ni(t,e){return t}
397
479
  /**
398
480
  * @license
399
481
  * Copyright 2017 Google LLC
@@ -409,7 +491,7 @@ let Rr="9.15.0";
409
491
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
410
492
  * See the License for the specific language governing permissions and
411
493
  * limitations under the License.
412
- */const Br={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",UNIMPLEMENTED:"unimplemented",INTERNAL:"internal",UNAVAILABLE:"unavailable",DATA_LOSS:"data-loss"};class Hr extends d{constructor(t,e){super(t,e),this.code=t,this.message=e,this.toString=()=>`${this.name}: [code=${this.code}]: ${this.message}`}}
494
+ */const Di={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",UNIMPLEMENTED:"unimplemented",INTERNAL:"internal",UNAVAILABLE:"unavailable",DATA_LOSS:"data-loss"};class Oi extends re{constructor(t,e){super(t,e),this.code=t,this.message=e,this.toString=()=>`${this.name}: [code=${this.code}]: ${this.message}`}}
413
495
  /**
414
496
  * @license
415
497
  * Copyright 2017 Google LLC
@@ -425,7 +507,7 @@ let Rr="9.15.0";
425
507
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
426
508
  * See the License for the specific language governing permissions and
427
509
  * limitations under the License.
428
- */class jr{constructor(){this.promise=new Promise(((t,e)=>{this.resolve=t,this.reject=e}))}}
510
+ */class Li{constructor(){this.promise=new Promise(((t,e)=>{this.resolve=t,this.reject=e}))}}
429
511
  /**
430
512
  * @license
431
513
  * Copyright 2017 Google LLC
@@ -441,7 +523,7 @@ let Rr="9.15.0";
441
523
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
442
524
  * See the License for the specific language governing permissions and
443
525
  * limitations under the License.
444
- */class qr{constructor(t,e){this.user=e,this.type="OAuth",this.headers=new Map,this.headers.set("Authorization",`Bearer ${t}`)}}class Kr{getToken(){return Promise.resolve(null)}invalidateToken(){}start(t,e){t.enqueueRetryable((()=>e(Nr.UNAUTHENTICATED)))}shutdown(){}}class Gr{constructor(t){this.token=t,this.changeListener=null}getToken(){return Promise.resolve(this.token)}invalidateToken(){}start(t,e){this.changeListener=e,t.enqueueRetryable((()=>e(this.token.user)))}shutdown(){this.changeListener=null}}class Wr{constructor(t){this.t=t,this.currentUser=Nr.UNAUTHENTICATED,this.i=0,this.forceRefresh=!1,this.auth=null}start(t,e){let n=this.i;const s=t=>this.i!==n?(n=this.i,e(t)):Promise.resolve();let r=new jr;this.o=()=>{this.i++,this.currentUser=this.u(),r.resolve(),r=new jr,t.enqueueRetryable((()=>s(this.currentUser)))};const i=()=>{const e=r;t.enqueueRetryable((async()=>{await e.promise,await s(this.currentUser)}))},o=t=>{Lr("FirebaseAuthCredentialsProvider","Auth detected"),this.auth=t,this.auth.addAuthTokenListener(this.o),i()};this.t.onInit((t=>o(t))),setTimeout((()=>{if(!this.auth){const t=this.t.getImmediate({optional:!0});t?o(t):(Lr("FirebaseAuthCredentialsProvider","Auth not yet detected"),r.resolve(),r=new jr)}}),0),i()}getToken(){const t=this.i,e=this.forceRefresh;return this.forceRefresh=!1,this.auth?this.auth.getToken(e).then((e=>this.i!==t?(Lr("FirebaseAuthCredentialsProvider","getToken aborted due to token change."),this.getToken()):e?(Fr("string"==typeof e.accessToken),new qr(e.accessToken,this.currentUser)):null)):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.auth&&this.auth.removeAuthTokenListener(this.o)}u(){const t=this.auth&&this.auth.getUid();return Fr(null===t||"string"==typeof t),new Nr(t)}}class zr{constructor(t,e,n,s){this.h=t,this.l=e,this.m=n,this.g=s,this.type="FirstParty",this.user=Nr.FIRST_PARTY,this.p=new Map}I(){return this.g?this.g():(Fr(!("object"!=typeof this.h||null===this.h||!this.h.auth||!this.h.auth.getAuthHeaderValueForFirstParty)),this.h.auth.getAuthHeaderValueForFirstParty([]))}get headers(){this.p.set("X-Goog-AuthUser",this.l);const t=this.I();return t&&this.p.set("Authorization",t),this.m&&this.p.set("X-Goog-Iam-Authorization-Token",this.m),this.p}}class $r{constructor(t,e,n,s){this.h=t,this.l=e,this.m=n,this.g=s}getToken(){return Promise.resolve(new zr(this.h,this.l,this.m,this.g))}start(t,e){t.enqueueRetryable((()=>e(Nr.FIRST_PARTY)))}shutdown(){}invalidateToken(){}}class Qr{constructor(t){this.value=t,this.type="AppCheck",this.headers=new Map,t&&t.length>0&&this.headers.set("x-firebase-appcheck",this.value)}}class Jr{constructor(t){this.T=t,this.forceRefresh=!1,this.appCheck=null,this.A=null}start(t,e){const n=t=>{null!=t.error&&Lr("FirebaseAppCheckTokenProvider",`Error getting App Check token; using placeholder token instead. Error: ${t.error.message}`);const n=t.token!==this.A;return this.A=t.token,Lr("FirebaseAppCheckTokenProvider",`Received ${n?"new":"existing"} token.`),n?e(t.token):Promise.resolve()};this.o=e=>{t.enqueueRetryable((()=>n(e)))};const s=t=>{Lr("FirebaseAppCheckTokenProvider","AppCheck detected"),this.appCheck=t,this.appCheck.addTokenListener(this.o)};this.T.onInit((t=>s(t))),setTimeout((()=>{if(!this.appCheck){const t=this.T.getImmediate({optional:!0});t?s(t):Lr("FirebaseAppCheckTokenProvider","AppCheck not yet detected")}}),0)}getToken(){const t=this.forceRefresh;return this.forceRefresh=!1,this.appCheck?this.appCheck.getToken(t).then((t=>t?(Fr("string"==typeof t.token),this.A=t.token,new Qr(t.token)):null)):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.appCheck&&this.appCheck.removeTokenListener(this.o)}}
526
+ */class Pi{constructor(t,e){this.user=e,this.type="OAuth",this.headers=new Map,this.headers.set("Authorization",`Bearer ${t}`)}}class Mi{getToken(){return Promise.resolve(null)}invalidateToken(){}start(t,e){t.enqueueRetryable((()=>e(_i.UNAUTHENTICATED)))}shutdown(){}}class xi{constructor(t){this.token=t,this.changeListener=null}getToken(){return Promise.resolve(this.token)}invalidateToken(){}start(t,e){this.changeListener=e,t.enqueueRetryable((()=>e(this.token.user)))}shutdown(){this.changeListener=null}}class Ui{constructor(t){this.t=t,this.currentUser=_i.UNAUTHENTICATED,this.i=0,this.forceRefresh=!1,this.auth=null}start(t,e){let n=this.i;const r=t=>this.i!==n?(n=this.i,e(t)):Promise.resolve();let s=new Li;this.o=()=>{this.i++,this.currentUser=this.u(),s.resolve(),s=new Li,t.enqueueRetryable((()=>r(this.currentUser)))};const i=()=>{const e=s;t.enqueueRetryable((async()=>{await e.promise,await r(this.currentUser)}))},o=t=>{Ii("FirebaseAuthCredentialsProvider","Auth detected"),this.auth=t,this.auth.addAuthTokenListener(this.o),i()};this.t.onInit((t=>o(t))),setTimeout((()=>{if(!this.auth){const t=this.t.getImmediate({optional:!0});t?o(t):(Ii("FirebaseAuthCredentialsProvider","Auth not yet detected"),s.resolve(),s=new Li)}}),0),i()}getToken(){const t=this.i,e=this.forceRefresh;return this.forceRefresh=!1,this.auth?this.auth.getToken(e).then((e=>this.i!==t?(Ii("FirebaseAuthCredentialsProvider","getToken aborted due to token change."),this.getToken()):e?(Ri("string"==typeof e.accessToken),new Pi(e.accessToken,this.currentUser)):null)):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.auth&&this.auth.removeAuthTokenListener(this.o)}u(){const t=this.auth&&this.auth.getUid();return Ri(null===t||"string"==typeof t),new _i(t)}}class Fi{constructor(t,e,n,r){this.h=t,this.l=e,this.m=n,this.g=r,this.type="FirstParty",this.user=_i.FIRST_PARTY,this.p=new Map}I(){return this.g?this.g():(Ri(!("object"!=typeof this.h||null===this.h||!this.h.auth||!this.h.auth.getAuthHeaderValueForFirstParty)),this.h.auth.getAuthHeaderValueForFirstParty([]))}get headers(){this.p.set("X-Goog-AuthUser",this.l);const t=this.I();return t&&this.p.set("Authorization",t),this.m&&this.p.set("X-Goog-Iam-Authorization-Token",this.m),this.p}}class Vi{constructor(t,e,n,r){this.h=t,this.l=e,this.m=n,this.g=r}getToken(){return Promise.resolve(new Fi(this.h,this.l,this.m,this.g))}start(t,e){t.enqueueRetryable((()=>e(_i.FIRST_PARTY)))}shutdown(){}invalidateToken(){}}class Bi{constructor(t){this.value=t,this.type="AppCheck",this.headers=new Map,t&&t.length>0&&this.headers.set("x-firebase-appcheck",this.value)}}class Hi{constructor(t){this.T=t,this.forceRefresh=!1,this.appCheck=null,this.A=null}start(t,e){const n=t=>{null!=t.error&&Ii("FirebaseAppCheckTokenProvider",`Error getting App Check token; using placeholder token instead. Error: ${t.error.message}`);const n=t.token!==this.A;return this.A=t.token,Ii("FirebaseAppCheckTokenProvider",`Received ${n?"new":"existing"} token.`),n?e(t.token):Promise.resolve()};this.o=e=>{t.enqueueRetryable((()=>n(e)))};const r=t=>{Ii("FirebaseAppCheckTokenProvider","AppCheck detected"),this.appCheck=t,this.appCheck.addTokenListener(this.o)};this.T.onInit((t=>r(t))),setTimeout((()=>{if(!this.appCheck){const t=this.T.getImmediate({optional:!0});t?r(t):Ii("FirebaseAppCheckTokenProvider","AppCheck not yet detected")}}),0)}getToken(){const t=this.forceRefresh;return this.forceRefresh=!1,this.appCheck?this.appCheck.getToken(t).then((t=>t?(Ri("string"==typeof t.token),this.A=t.token,new Bi(t.token)):null)):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.appCheck&&this.appCheck.removeTokenListener(this.o)}}
445
527
  /**
446
528
  * @license
447
529
  * Copyright 2020 Google LLC
@@ -457,7 +539,7 @@ let Rr="9.15.0";
457
539
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
458
540
  * See the License for the specific language governing permissions and
459
541
  * limitations under the License.
460
- */function Yr(t){const e="undefined"!=typeof self&&(self.crypto||self.msCrypto),n=new Uint8Array(t);if(e&&"function"==typeof e.getRandomValues)e.getRandomValues(n);else for(let e=0;e<t;e++)n[e]=Math.floor(256*Math.random());return n}
542
+ */function ji(t){const e="undefined"!=typeof self&&(self.crypto||self.msCrypto),n=new Uint8Array(t);if(e&&"function"==typeof e.getRandomValues)e.getRandomValues(n);else for(let e=0;e<t;e++)n[e]=Math.floor(256*Math.random());return n}
461
543
  /**
462
544
  * @license
463
545
  * Copyright 2017 Google LLC
@@ -473,7 +555,7 @@ let Rr="9.15.0";
473
555
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
474
556
  * See the License for the specific language governing permissions and
475
557
  * limitations under the License.
476
- */class Xr{static R(){const t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",e=Math.floor(256/t.length)*t.length;let n="";for(;n.length<20;){const s=Yr(40);for(let r=0;r<s.length;++r)n.length<20&&s[r]<e&&(n+=t.charAt(s[r]%t.length))}return n}}function Zr(t,e){return t<e?-1:t>e?1:0}function ti(t,e,n){return t.length===e.length&&t.every(((t,s)=>n(t,e[s])))}
558
+ */class $i{static R(){const t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",e=62*Math.floor(256/62);let n="";for(;n.length<20;){const r=ji(40);for(let s=0;s<r.length;++s)n.length<20&&r[s]<e&&(n+=t.charAt(r[s]%62))}return n}}function qi(t,e){return t<e?-1:t>e?1:0}function Ki(t,e,n){return t.length===e.length&&t.every(((t,r)=>n(t,e[r])))}
477
559
  /**
478
560
  * @license
479
561
  * Copyright 2017 Google LLC
@@ -489,7 +571,7 @@ let Rr="9.15.0";
489
571
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
490
572
  * See the License for the specific language governing permissions and
491
573
  * limitations under the License.
492
- */class ei{constructor(t,e){if(this.seconds=t,this.nanoseconds=e,e<0)throw new Hr(Br.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+e);if(e>=1e9)throw new Hr(Br.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+e);if(t<-62135596800)throw new Hr(Br.INVALID_ARGUMENT,"Timestamp seconds out of range: "+t);if(t>=253402300800)throw new Hr(Br.INVALID_ARGUMENT,"Timestamp seconds out of range: "+t)}static now(){return ei.fromMillis(Date.now())}static fromDate(t){return ei.fromMillis(t.getTime())}static fromMillis(t){const e=Math.floor(t/1e3),n=Math.floor(1e6*(t-1e3*e));return new ei(e,n)}toDate(){return new Date(this.toMillis())}toMillis(){return 1e3*this.seconds+this.nanoseconds/1e6}_compareTo(t){return this.seconds===t.seconds?Zr(this.nanoseconds,t.nanoseconds):Zr(this.seconds,t.seconds)}isEqual(t){return t.seconds===this.seconds&&t.nanoseconds===this.nanoseconds}toString(){return"Timestamp(seconds="+this.seconds+", nanoseconds="+this.nanoseconds+")"}toJSON(){return{seconds:this.seconds,nanoseconds:this.nanoseconds}}valueOf(){const t=this.seconds- -62135596800;return String(t).padStart(12,"0")+"."+String(this.nanoseconds).padStart(9,"0")}}
574
+ */class Wi{constructor(t,e){if(this.seconds=t,this.nanoseconds=e,e<0)throw new Oi(Di.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+e);if(e>=1e9)throw new Oi(Di.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+e);if(t<-62135596800)throw new Oi(Di.INVALID_ARGUMENT,"Timestamp seconds out of range: "+t);if(t>=253402300800)throw new Oi(Di.INVALID_ARGUMENT,"Timestamp seconds out of range: "+t)}static now(){return Wi.fromMillis(Date.now())}static fromDate(t){return Wi.fromMillis(t.getTime())}static fromMillis(t){const e=Math.floor(t/1e3),n=Math.floor(1e6*(t-1e3*e));return new Wi(e,n)}toDate(){return new Date(this.toMillis())}toMillis(){return 1e3*this.seconds+this.nanoseconds/1e6}_compareTo(t){return this.seconds===t.seconds?qi(this.nanoseconds,t.nanoseconds):qi(this.seconds,t.seconds)}isEqual(t){return t.seconds===this.seconds&&t.nanoseconds===this.nanoseconds}toString(){return"Timestamp(seconds="+this.seconds+", nanoseconds="+this.nanoseconds+")"}toJSON(){return{seconds:this.seconds,nanoseconds:this.nanoseconds}}valueOf(){const t=this.seconds- -62135596800;return String(t).padStart(12,"0")+"."+String(this.nanoseconds).padStart(9,"0")}}
493
575
  /**
494
576
  * @license
495
577
  * Copyright 2017 Google LLC
@@ -505,7 +587,7 @@ let Rr="9.15.0";
505
587
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
506
588
  * See the License for the specific language governing permissions and
507
589
  * limitations under the License.
508
- */class ni{constructor(t){this.timestamp=t}static fromTimestamp(t){return new ni(t)}static min(){return new ni(new ei(0,0))}static max(){return new ni(new ei(253402300799,999999999))}compareTo(t){return this.timestamp._compareTo(t.timestamp)}isEqual(t){return this.timestamp.isEqual(t.timestamp)}toMicroseconds(){return 1e6*this.timestamp.seconds+this.timestamp.nanoseconds/1e3}toString(){return"SnapshotVersion("+this.timestamp.toString()+")"}toTimestamp(){return this.timestamp}}
590
+ */class Gi{constructor(t){this.timestamp=t}static fromTimestamp(t){return new Gi(t)}static min(){return new Gi(new Wi(0,0))}static max(){return new Gi(new Wi(253402300799,999999999))}compareTo(t){return this.timestamp._compareTo(t.timestamp)}isEqual(t){return this.timestamp.isEqual(t.timestamp)}toMicroseconds(){return 1e6*this.timestamp.seconds+this.timestamp.nanoseconds/1e3}toString(){return"SnapshotVersion("+this.timestamp.toString()+")"}toTimestamp(){return this.timestamp}}
509
591
  /**
510
592
  * @license
511
593
  * Copyright 2017 Google LLC
@@ -521,7 +603,7 @@ let Rr="9.15.0";
521
603
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
522
604
  * See the License for the specific language governing permissions and
523
605
  * limitations under the License.
524
- */class si{constructor(t,e,n){void 0===e?e=0:e>t.length&&Ur(),void 0===n?n=t.length-e:n>t.length-e&&Ur(),this.segments=t,this.offset=e,this.len=n}get length(){return this.len}isEqual(t){return 0===si.comparator(this,t)}child(t){const e=this.segments.slice(this.offset,this.limit());return t instanceof si?t.forEach((t=>{e.push(t)})):e.push(t),this.construct(e)}limit(){return this.offset+this.length}popFirst(t){return t=void 0===t?1:t,this.construct(this.segments,this.offset+t,this.length-t)}popLast(){return this.construct(this.segments,this.offset,this.length-1)}firstSegment(){return this.segments[this.offset]}lastSegment(){return this.get(this.length-1)}get(t){return this.segments[this.offset+t]}isEmpty(){return 0===this.length}isPrefixOf(t){if(t.length<this.length)return!1;for(let e=0;e<this.length;e++)if(this.get(e)!==t.get(e))return!1;return!0}isImmediateParentOf(t){if(this.length+1!==t.length)return!1;for(let e=0;e<this.length;e++)if(this.get(e)!==t.get(e))return!1;return!0}forEach(t){for(let e=this.offset,n=this.limit();e<n;e++)t(this.segments[e])}toArray(){return this.segments.slice(this.offset,this.limit())}static comparator(t,e){const n=Math.min(t.length,e.length);for(let s=0;s<n;s++){const n=t.get(s),r=e.get(s);if(n<r)return-1;if(n>r)return 1}return t.length<e.length?-1:t.length>e.length?1:0}}class ri extends si{construct(t,e,n){return new ri(t,e,n)}canonicalString(){return this.toArray().join("/")}toString(){return this.canonicalString()}static fromString(...t){const e=[];for(const n of t){if(n.indexOf("//")>=0)throw new Hr(Br.INVALID_ARGUMENT,`Invalid segment (${n}). Paths must not contain // in them.`);e.push(...n.split("/").filter((t=>t.length>0)))}return new ri(e)}static emptyPath(){return new ri([])}}const ii=/^[_a-zA-Z][_a-zA-Z0-9]*$/;class oi extends si{construct(t,e,n){return new oi(t,e,n)}static isValidIdentifier(t){return ii.test(t)}canonicalString(){return this.toArray().map((t=>(t=t.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),oi.isValidIdentifier(t)||(t="`"+t+"`"),t))).join(".")}toString(){return this.canonicalString()}isKeyField(){return 1===this.length&&"__name__"===this.get(0)}static keyField(){return new oi(["__name__"])}static fromServerFormat(t){const e=[];let n="",s=0;const r=()=>{if(0===n.length)throw new Hr(Br.INVALID_ARGUMENT,`Invalid field path (${t}). Paths must not be empty, begin with '.', end with '.', or contain '..'`);e.push(n),n=""};let i=!1;for(;s<t.length;){const e=t[s];if("\\"===e){if(s+1===t.length)throw new Hr(Br.INVALID_ARGUMENT,"Path has trailing escape character: "+t);const e=t[s+1];if("\\"!==e&&"."!==e&&"`"!==e)throw new Hr(Br.INVALID_ARGUMENT,"Path has invalid escape sequence: "+t);n+=e,s+=2}else"`"===e?(i=!i,s++):"."!==e||i?(n+=e,s++):(r(),s++)}if(r(),i)throw new Hr(Br.INVALID_ARGUMENT,"Unterminated ` in path: "+t);return new oi(e)}static emptyPath(){return new oi([])}}
606
+ */class zi{constructor(t,e,n){void 0===e?e=0:e>t.length&&ki(),void 0===n?n=t.length-e:n>t.length-e&&ki(),this.segments=t,this.offset=e,this.len=n}get length(){return this.len}isEqual(t){return 0===zi.comparator(this,t)}child(t){const e=this.segments.slice(this.offset,this.limit());return t instanceof zi?t.forEach((t=>{e.push(t)})):e.push(t),this.construct(e)}limit(){return this.offset+this.length}popFirst(t){return t=void 0===t?1:t,this.construct(this.segments,this.offset+t,this.length-t)}popLast(){return this.construct(this.segments,this.offset,this.length-1)}firstSegment(){return this.segments[this.offset]}lastSegment(){return this.get(this.length-1)}get(t){return this.segments[this.offset+t]}isEmpty(){return 0===this.length}isPrefixOf(t){if(t.length<this.length)return!1;for(let e=0;e<this.length;e++)if(this.get(e)!==t.get(e))return!1;return!0}isImmediateParentOf(t){if(this.length+1!==t.length)return!1;for(let e=0;e<this.length;e++)if(this.get(e)!==t.get(e))return!1;return!0}forEach(t){for(let e=this.offset,n=this.limit();e<n;e++)t(this.segments[e])}toArray(){return this.segments.slice(this.offset,this.limit())}static comparator(t,e){const n=Math.min(t.length,e.length);for(let r=0;r<n;r++){const n=t.get(r),s=e.get(r);if(n<s)return-1;if(n>s)return 1}return t.length<e.length?-1:t.length>e.length?1:0}}class Qi extends zi{construct(t,e,n){return new Qi(t,e,n)}canonicalString(){return this.toArray().join("/")}toString(){return this.canonicalString()}static fromString(...t){const e=[];for(const n of t){if(n.indexOf("//")>=0)throw new Oi(Di.INVALID_ARGUMENT,`Invalid segment (${n}). Paths must not contain // in them.`);e.push(...n.split("/").filter((t=>t.length>0)))}return new Qi(e)}static emptyPath(){return new Qi([])}}const Yi=/^[_a-zA-Z][_a-zA-Z0-9]*$/;class Ji extends zi{construct(t,e,n){return new Ji(t,e,n)}static isValidIdentifier(t){return Yi.test(t)}canonicalString(){return this.toArray().map((t=>(t=t.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),Ji.isValidIdentifier(t)||(t="`"+t+"`"),t))).join(".")}toString(){return this.canonicalString()}isKeyField(){return 1===this.length&&"__name__"===this.get(0)}static keyField(){return new Ji(["__name__"])}static fromServerFormat(t){const e=[];let n="",r=0;const s=()=>{if(0===n.length)throw new Oi(Di.INVALID_ARGUMENT,`Invalid field path (${t}). Paths must not be empty, begin with '.', end with '.', or contain '..'`);e.push(n),n=""};let i=!1;for(;r<t.length;){const e=t[r];if("\\"===e){if(r+1===t.length)throw new Oi(Di.INVALID_ARGUMENT,"Path has trailing escape character: "+t);const e=t[r+1];if("\\"!==e&&"."!==e&&"`"!==e)throw new Oi(Di.INVALID_ARGUMENT,"Path has invalid escape sequence: "+t);n+=e,r+=2}else"`"===e?(i=!i,r++):"."!==e||i?(n+=e,r++):(s(),r++)}if(s(),i)throw new Oi(Di.INVALID_ARGUMENT,"Unterminated ` in path: "+t);return new Ji(e)}static emptyPath(){return new Ji([])}}
525
607
  /**
526
608
  * @license
527
609
  * Copyright 2017 Google LLC
@@ -537,7 +619,7 @@ let Rr="9.15.0";
537
619
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
538
620
  * See the License for the specific language governing permissions and
539
621
  * limitations under the License.
540
- */class ai{constructor(t){this.path=t}static fromPath(t){return new ai(ri.fromString(t))}static fromName(t){return new ai(ri.fromString(t).popFirst(5))}static empty(){return new ai(ri.emptyPath())}get collectionGroup(){return this.path.popLast().lastSegment()}hasCollectionId(t){return this.path.length>=2&&this.path.get(this.path.length-2)===t}getCollectionGroup(){return this.path.get(this.path.length-2)}getCollectionPath(){return this.path.popLast()}isEqual(t){return null!==t&&0===ri.comparator(this.path,t.path)}toString(){return this.path.toString()}static comparator(t,e){return ri.comparator(t.path,e.path)}static isDocumentKey(t){return t.length%2==0}static fromSegments(t){return new ai(new ri(t.slice()))}}function ci(t){return new ui(t.readTime,t.key,-1)}class ui{constructor(t,e,n){this.readTime=t,this.documentKey=e,this.largestBatchId=n}static min(){return new ui(ni.min(),ai.empty(),-1)}static max(){return new ui(ni.max(),ai.empty(),-1)}}function hi(t,e){let n=t.readTime.compareTo(e.readTime);return 0!==n?n:(n=ai.comparator(t.documentKey,e.documentKey),0!==n?n:Zr(t.largestBatchId,e.largestBatchId))}
622
+ */class Xi{constructor(t){this.path=t}static fromPath(t){return new Xi(Qi.fromString(t))}static fromName(t){return new Xi(Qi.fromString(t).popFirst(5))}static empty(){return new Xi(Qi.emptyPath())}get collectionGroup(){return this.path.popLast().lastSegment()}hasCollectionId(t){return this.path.length>=2&&this.path.get(this.path.length-2)===t}getCollectionGroup(){return this.path.get(this.path.length-2)}getCollectionPath(){return this.path.popLast()}isEqual(t){return null!==t&&0===Qi.comparator(this.path,t.path)}toString(){return this.path.toString()}static comparator(t,e){return Qi.comparator(t.path,e.path)}static isDocumentKey(t){return t.length%2==0}static fromSegments(t){return new Xi(new Qi(t.slice()))}}function Zi(t){return new to(t.readTime,t.key,-1)}class to{constructor(t,e,n){this.readTime=t,this.documentKey=e,this.largestBatchId=n}static min(){return new to(Gi.min(),Xi.empty(),-1)}static max(){return new to(Gi.max(),Xi.empty(),-1)}}function eo(t,e){let n=t.readTime.compareTo(e.readTime);return 0!==n?n:(n=Xi.comparator(t.documentKey,e.documentKey),0!==n?n:qi(t.largestBatchId,e.largestBatchId)
541
623
  /**
542
624
  * @license
543
625
  * Copyright 2020 Google LLC
@@ -553,7 +635,7 @@ let Rr="9.15.0";
553
635
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
554
636
  * See the License for the specific language governing permissions and
555
637
  * limitations under the License.
556
- */class li{constructor(){this.onCommittedListeners=[]}addOnCommittedListener(t){this.onCommittedListeners.push(t)}raiseOnCommittedEvent(){this.onCommittedListeners.forEach((t=>t()))}}
638
+ */)}const no="The current tab is not in the required state to perform this operation. It might be necessary to refresh the browser tab.";class ro{constructor(){this.onCommittedListeners=[]}addOnCommittedListener(t){this.onCommittedListeners.push(t)}raiseOnCommittedEvent(){this.onCommittedListeners.forEach((t=>t()))}}
557
639
  /**
558
640
  * @license
559
641
  * Copyright 2017 Google LLC
@@ -569,7 +651,7 @@ let Rr="9.15.0";
569
651
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
570
652
  * See the License for the specific language governing permissions and
571
653
  * limitations under the License.
572
- */async function di(t){if(t.code!==Br.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)throw t;Lr("LocalStore","Unexpectedly lost primary lease")}
654
+ */async function so(t){if(t.code!==Di.FAILED_PRECONDITION||t.message!==no)throw t;Ii("LocalStore","Unexpectedly lost primary lease")}
573
655
  /**
574
656
  * @license
575
657
  * Copyright 2017 Google LLC
@@ -585,7 +667,7 @@ let Rr="9.15.0";
585
667
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
586
668
  * See the License for the specific language governing permissions and
587
669
  * limitations under the License.
588
- */class fi{constructor(t){this.nextCallback=null,this.catchCallback=null,this.result=void 0,this.error=void 0,this.isDone=!1,this.callbackAttached=!1,t((t=>{this.isDone=!0,this.result=t,this.nextCallback&&this.nextCallback(t)}),(t=>{this.isDone=!0,this.error=t,this.catchCallback&&this.catchCallback(t)}))}catch(t){return this.next(void 0,t)}next(t,e){return this.callbackAttached&&Ur(),this.callbackAttached=!0,this.isDone?this.error?this.wrapFailure(e,this.error):this.wrapSuccess(t,this.result):new fi(((n,s)=>{this.nextCallback=e=>{this.wrapSuccess(t,e).next(n,s)},this.catchCallback=t=>{this.wrapFailure(e,t).next(n,s)}}))}toPromise(){return new Promise(((t,e)=>{this.next(t,e)}))}wrapUserFunction(t){try{const e=t();return e instanceof fi?e:fi.resolve(e)}catch(t){return fi.reject(t)}}wrapSuccess(t,e){return t?this.wrapUserFunction((()=>t(e))):fi.resolve(e)}wrapFailure(t,e){return t?this.wrapUserFunction((()=>t(e))):fi.reject(e)}static resolve(t){return new fi(((e,n)=>{e(t)}))}static reject(t){return new fi(((e,n)=>{n(t)}))}static waitFor(t){return new fi(((e,n)=>{let s=0,r=0,i=!1;t.forEach((t=>{++s,t.next((()=>{++r,i&&r===s&&e()}),(t=>n(t)))})),i=!0,r===s&&e()}))}static or(t){let e=fi.resolve(!1);for(const n of t)e=e.next((t=>t?fi.resolve(t):n()));return e}static forEach(t,e){const n=[];return t.forEach(((t,s)=>{n.push(e.call(this,t,s))})),this.waitFor(n)}static mapArray(t,e){return new fi(((n,s)=>{const r=t.length,i=new Array(r);let o=0;for(let a=0;a<r;a++){const c=a;e(t[c]).next((t=>{i[c]=t,++o,o===r&&n(i)}),(t=>s(t)))}}))}static doWhile(t,e){return new fi(((n,s)=>{const r=()=>{!0===t()?e().next((()=>{r()}),s):n()};r()}))}}function pi(t){return"IndexedDbTransactionError"===t.name}
670
+ */class io{constructor(t){this.nextCallback=null,this.catchCallback=null,this.result=void 0,this.error=void 0,this.isDone=!1,this.callbackAttached=!1,t((t=>{this.isDone=!0,this.result=t,this.nextCallback&&this.nextCallback(t)}),(t=>{this.isDone=!0,this.error=t,this.catchCallback&&this.catchCallback(t)}))}catch(t){return this.next(void 0,t)}next(t,e){return this.callbackAttached&&ki(),this.callbackAttached=!0,this.isDone?this.error?this.wrapFailure(e,this.error):this.wrapSuccess(t,this.result):new io(((n,r)=>{this.nextCallback=e=>{this.wrapSuccess(t,e).next(n,r)},this.catchCallback=t=>{this.wrapFailure(e,t).next(n,r)}}))}toPromise(){return new Promise(((t,e)=>{this.next(t,e)}))}wrapUserFunction(t){try{const e=t();return e instanceof io?e:io.resolve(e)}catch(t){return io.reject(t)}}wrapSuccess(t,e){return t?this.wrapUserFunction((()=>t(e))):io.resolve(e)}wrapFailure(t,e){return t?this.wrapUserFunction((()=>t(e))):io.reject(e)}static resolve(t){return new io(((e,n)=>{e(t)}))}static reject(t){return new io(((e,n)=>{n(t)}))}static waitFor(t){return new io(((e,n)=>{let r=0,s=0,i=!1;t.forEach((t=>{++r,t.next((()=>{++s,i&&s===r&&e()}),(t=>n(t)))})),i=!0,s===r&&e()}))}static or(t){let e=io.resolve(!1);for(const n of t)e=e.next((t=>t?io.resolve(t):n()));return e}static forEach(t,e){const n=[];return t.forEach(((t,r)=>{n.push(e.call(this,t,r))})),this.waitFor(n)}static mapArray(t,e){return new io(((n,r)=>{const s=t.length,i=new Array(s);let o=0;for(let a=0;a<s;a++){const c=a;e(t[c]).next((t=>{i[c]=t,++o,o===s&&n(i)}),(t=>r(t)))}}))}static doWhile(t,e){return new io(((n,r)=>{const s=()=>{!0===t()?e().next((()=>{s()}),r):n()};s()}))}}function oo(t){return"IndexedDbTransactionError"===t.name}
589
671
  /**
590
672
  * @license
591
673
  * Copyright 2018 Google LLC
@@ -601,7 +683,7 @@ let Rr="9.15.0";
601
683
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
602
684
  * See the License for the specific language governing permissions and
603
685
  * limitations under the License.
604
- */class gi{constructor(t,e){this.previousValue=t,e&&(e.sequenceNumberHandler=t=>this.ut(t),this.ct=t=>e.writeSequenceNumber(t))}ut(t){return this.previousValue=Math.max(t,this.previousValue),this.previousValue}next(){const t=++this.previousValue;return this.ct&&this.ct(t),t}}gi.at=-1;
686
+ */class ao{constructor(t,e){this.previousValue=t,e&&(e.sequenceNumberHandler=t=>this.ut(t),this.ct=t=>e.writeSequenceNumber(t))}ut(t){return this.previousValue=Math.max(t,this.previousValue),this.previousValue}next(){const t=++this.previousValue;return this.ct&&this.ct(t),t}}ao.at=-1;
605
687
  /**
606
688
  * @license
607
689
  * Copyright 2017 Google LLC
@@ -618,7 +700,7 @@ let Rr="9.15.0";
618
700
  * See the License for the specific language governing permissions and
619
701
  * limitations under the License.
620
702
  */
621
- class mi{constructor(t,e,n,s,r,i,o,a){this.databaseId=t,this.appId=e,this.persistenceKey=n,this.host=s,this.ssl=r,this.forceLongPolling=i,this.autoDetectLongPolling=o,this.useFetchStreams=a}}class yi{constructor(t,e){this.projectId=t,this.database=e||"(default)"}static empty(){return new yi("","")}get isDefaultDatabase(){return"(default)"===this.database}isEqual(t){return t instanceof yi&&t.projectId===this.projectId&&t.database===this.database}}
703
+ class co{constructor(t,e,n,r,s,i,o,a){this.databaseId=t,this.appId=e,this.persistenceKey=n,this.host=r,this.ssl=s,this.forceLongPolling=i,this.autoDetectLongPolling=o,this.useFetchStreams=a}}class uo{constructor(t,e){this.projectId=t,this.database=e||"(default)"}static empty(){return new uo("","")}get isDefaultDatabase(){return"(default)"===this.database}isEqual(t){return t instanceof uo&&t.projectId===this.projectId&&t.database===this.database}}
622
704
  /**
623
705
  * @license
624
706
  * Copyright 2017 Google LLC
@@ -634,7 +716,7 @@ class mi{constructor(t,e,n,s,r,i,o,a){this.databaseId=t,this.appId=e,this.persis
634
716
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
635
717
  * See the License for the specific language governing permissions and
636
718
  * limitations under the License.
637
- */function vi(t){let e=0;for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&e++;return e}function wi(t,e){for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&e(n,t[n])}function _i(t){for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0}
719
+ */function ho(t){let e=0;for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&e++;return e}function lo(t,e){for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&e(n,t[n])}function fo(t){for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0}
638
720
  /**
639
721
  * @license
640
722
  * Copyright 2017 Google LLC
@@ -650,7 +732,7 @@ class mi{constructor(t,e,n,s,r,i,o,a){this.databaseId=t,this.appId=e,this.persis
650
732
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
651
733
  * See the License for the specific language governing permissions and
652
734
  * limitations under the License.
653
- */function Ti(t){return null==t}function Ii(t){return 0===t&&1/t==-1/0}
735
+ */function po(t){return null==t}function go(t){return 0===t&&1/t==-1/0}
654
736
  /**
655
737
  * @license
656
738
  * Copyright 2020 Google LLC
@@ -667,7 +749,7 @@ class mi{constructor(t,e,n,s,r,i,o,a){this.databaseId=t,this.appId=e,this.persis
667
749
  * See the License for the specific language governing permissions and
668
750
  * limitations under the License.
669
751
  */
670
- class Ei{constructor(t){this.binaryString=t}static fromBase64String(t){const e=atob(t);return new Ei(e)}static fromUint8Array(t){const e=function(t){let e="";for(let n=0;n<t.length;++n)e+=String.fromCharCode(t[n]);return e}(t);return new Ei(e)}[Symbol.iterator](){let t=0;return{next:()=>t<this.binaryString.length?{value:this.binaryString.charCodeAt(t++),done:!1}:{value:void 0,done:!0}}}toBase64(){return t=this.binaryString,btoa(t);var t}toUint8Array(){return function(t){const e=new Uint8Array(t.length);for(let n=0;n<t.length;n++)e[n]=t.charCodeAt(n);return e}
752
+ class mo{constructor(t){this.binaryString=t}static fromBase64String(t){const e=atob(t);return new mo(e)}static fromUint8Array(t){const e=function(t){let e="";for(let n=0;n<t.length;++n)e+=String.fromCharCode(t[n]);return e}(t);return new mo(e)}[Symbol.iterator](){let t=0;return{next:()=>t<this.binaryString.length?{value:this.binaryString.charCodeAt(t++),done:!1}:{value:void 0,done:!0}}}toBase64(){return t=this.binaryString,btoa(t);var t}toUint8Array(){return function(t){const e=new Uint8Array(t.length);for(let n=0;n<t.length;n++)e[n]=t.charCodeAt(n);return e}
671
753
  /**
672
754
  * @license
673
755
  * Copyright 2020 Google LLC
@@ -683,7 +765,7 @@ class Ei{constructor(t){this.binaryString=t}static fromBase64String(t){const e=a
683
765
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
684
766
  * See the License for the specific language governing permissions and
685
767
  * limitations under the License.
686
- */(this.binaryString)}approximateByteSize(){return 2*this.binaryString.length}compareTo(t){return Zr(this.binaryString,t.binaryString)}isEqual(t){return this.binaryString===t.binaryString}}Ei.EMPTY_BYTE_STRING=new Ei("");const Si=new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);function bi(t){if(Fr(!!t),"string"==typeof t){let e=0;const n=Si.exec(t);if(Fr(!!n),n[1]){let t=n[1];t=(t+"000000000").substr(0,9),e=Number(t)}const s=new Date(t);return{seconds:Math.floor(s.getTime()/1e3),nanos:e}}return{seconds:Ai(t.seconds),nanos:Ai(t.nanos)}}function Ai(t){return"number"==typeof t?t:"string"==typeof t?Number(t):0}function Ci(t){return"string"==typeof t?Ei.fromBase64String(t):Ei.fromUint8Array(t)}
768
+ */(this.binaryString)}approximateByteSize(){return 2*this.binaryString.length}compareTo(t){return qi(this.binaryString,t.binaryString)}isEqual(t){return this.binaryString===t.binaryString}}mo.EMPTY_BYTE_STRING=new mo("");const yo=new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);function vo(t){if(Ri(!!t),"string"==typeof t){let e=0;const n=yo.exec(t);if(Ri(!!n),n[1]){let t=n[1];t=(t+"000000000").substr(0,9),e=Number(t)}const r=new Date(t);return{seconds:Math.floor(r.getTime()/1e3),nanos:e}}return{seconds:wo(t.seconds),nanos:wo(t.nanos)}}function wo(t){return"number"==typeof t?t:"string"==typeof t?Number(t):0}function _o(t){return"string"==typeof t?mo.fromBase64String(t):mo.fromUint8Array(t)}
687
769
  /**
688
770
  * @license
689
771
  * Copyright 2020 Google LLC
@@ -699,7 +781,7 @@ class Ei{constructor(t){this.binaryString=t}static fromBase64String(t){const e=a
699
781
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
700
782
  * See the License for the specific language governing permissions and
701
783
  * limitations under the License.
702
- */function ki(t){var e,n;return"server_timestamp"===(null===(n=((null===(e=null==t?void 0:t.mapValue)||void 0===e?void 0:e.fields)||{}).__type__)||void 0===n?void 0:n.stringValue)}function Ni(t){const e=t.mapValue.fields.__previous_value__;return ki(e)?Ni(e):e}function Ri(t){const e=bi(t.mapValue.fields.__local_write_time__.timestampValue);return new ei(e.seconds,e.nanos)}
784
+ */function To(t){var e,n;return"server_timestamp"===(null===(n=((null===(e=null==t?void 0:t.mapValue)||void 0===e?void 0:e.fields)||{}).__type__)||void 0===n?void 0:n.stringValue)}function Eo(t){const e=t.mapValue.fields.__previous_value__;return To(e)?Eo(e):e}function So(t){const e=vo(t.mapValue.fields.__local_write_time__.timestampValue);return new Wi(e.seconds,e.nanos)}
703
785
  /**
704
786
  * @license
705
787
  * Copyright 2020 Google LLC
@@ -715,7 +797,7 @@ class Ei{constructor(t){this.binaryString=t}static fromBase64String(t){const e=a
715
797
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
716
798
  * See the License for the specific language governing permissions and
717
799
  * limitations under the License.
718
- */const Oi={fields:{__type__:{stringValue:"__max__"}}};function Di(t){return"nullValue"in t?0:"booleanValue"in t?1:"integerValue"in t||"doubleValue"in t?2:"timestampValue"in t?3:"stringValue"in t?5:"bytesValue"in t?6:"referenceValue"in t?7:"geoPointValue"in t?8:"arrayValue"in t?9:"mapValue"in t?ki(t)?4:function(t){return"__max__"===(((t.mapValue||{}).fields||{}).__type__||{}).stringValue}
800
+ */const Io={mapValue:{fields:{__type__:{stringValue:"__max__"}}}};function bo(t){return"nullValue"in t?0:"booleanValue"in t?1:"integerValue"in t||"doubleValue"in t?2:"timestampValue"in t?3:"stringValue"in t?5:"bytesValue"in t?6:"referenceValue"in t?7:"geoPointValue"in t?8:"arrayValue"in t?9:"mapValue"in t?To(t)?4:function(t){return"__max__"===(((t.mapValue||{}).fields||{}).__type__||{}).stringValue}
719
801
  /**
720
802
  * @license
721
803
  * Copyright 2022 Google LLC
@@ -731,7 +813,7 @@ class Ei{constructor(t){this.binaryString=t}static fromBase64String(t){const e=a
731
813
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
732
814
  * See the License for the specific language governing permissions and
733
815
  * limitations under the License.
734
- */(t)?9007199254740991:10:Ur()}function Li(t,e){if(t===e)return!0;const n=Di(t);if(n!==Di(e))return!1;switch(n){case 0:case 9007199254740991:return!0;case 1:return t.booleanValue===e.booleanValue;case 4:return Ri(t).isEqual(Ri(e));case 3:return function(t,e){if("string"==typeof t.timestampValue&&"string"==typeof e.timestampValue&&t.timestampValue.length===e.timestampValue.length)return t.timestampValue===e.timestampValue;const n=bi(t.timestampValue),s=bi(e.timestampValue);return n.seconds===s.seconds&&n.nanos===s.nanos}(t,e);case 5:return t.stringValue===e.stringValue;case 6:return function(t,e){return Ci(t.bytesValue).isEqual(Ci(e.bytesValue))}(t,e);case 7:return t.referenceValue===e.referenceValue;case 8:return function(t,e){return Ai(t.geoPointValue.latitude)===Ai(e.geoPointValue.latitude)&&Ai(t.geoPointValue.longitude)===Ai(e.geoPointValue.longitude)}(t,e);case 2:return function(t,e){if("integerValue"in t&&"integerValue"in e)return Ai(t.integerValue)===Ai(e.integerValue);if("doubleValue"in t&&"doubleValue"in e){const n=Ai(t.doubleValue),s=Ai(e.doubleValue);return n===s?Ii(n)===Ii(s):isNaN(n)&&isNaN(s)}return!1}(t,e);case 9:return ti(t.arrayValue.values||[],e.arrayValue.values||[],Li);case 10:return function(t,e){const n=t.mapValue.fields||{},s=e.mapValue.fields||{};if(vi(n)!==vi(s))return!1;for(const t in n)if(n.hasOwnProperty(t)&&(void 0===s[t]||!Li(n[t],s[t])))return!1;return!0}(t,e);default:return Ur()}}function Pi(t,e){return void 0!==(t.values||[]).find((t=>Li(t,e)))}function Mi(t,e){if(t===e)return 0;const n=Di(t),s=Di(e);if(n!==s)return Zr(n,s);switch(n){case 0:case 9007199254740991:return 0;case 1:return Zr(t.booleanValue,e.booleanValue);case 2:return function(t,e){const n=Ai(t.integerValue||t.doubleValue),s=Ai(e.integerValue||e.doubleValue);return n<s?-1:n>s?1:n===s?0:isNaN(n)?isNaN(s)?0:-1:1}(t,e);case 3:return xi(t.timestampValue,e.timestampValue);case 4:return xi(Ri(t),Ri(e));case 5:return Zr(t.stringValue,e.stringValue);case 6:return function(t,e){const n=Ci(t),s=Ci(e);return n.compareTo(s)}(t.bytesValue,e.bytesValue);case 7:return function(t,e){const n=t.split("/"),s=e.split("/");for(let t=0;t<n.length&&t<s.length;t++){const e=Zr(n[t],s[t]);if(0!==e)return e}return Zr(n.length,s.length)}(t.referenceValue,e.referenceValue);case 8:return function(t,e){const n=Zr(Ai(t.latitude),Ai(e.latitude));return 0!==n?n:Zr(Ai(t.longitude),Ai(e.longitude))}(t.geoPointValue,e.geoPointValue);case 9:return function(t,e){const n=t.values||[],s=e.values||[];for(let t=0;t<n.length&&t<s.length;++t){const e=Mi(n[t],s[t]);if(e)return e}return Zr(n.length,s.length)}(t.arrayValue,e.arrayValue);case 10:return function(t,e){if(t===Oi&&e===Oi)return 0;if(t===Oi)return 1;if(e===Oi)return-1;const n=t.fields||{},s=Object.keys(n),r=e.fields||{},i=Object.keys(r);s.sort(),i.sort();for(let t=0;t<s.length&&t<i.length;++t){const e=Zr(s[t],i[t]);if(0!==e)return e;const o=Mi(n[s[t]],r[i[t]]);if(0!==o)return o}return Zr(s.length,i.length)}(t.mapValue,e.mapValue);default:throw Ur()}}function xi(t,e){if("string"==typeof t&&"string"==typeof e&&t.length===e.length)return Zr(t,e);const n=bi(t),s=bi(e),r=Zr(n.seconds,s.seconds);return 0!==r?r:Zr(n.nanos,s.nanos)}function Ui(t){return Fi(t)}function Fi(t){return"nullValue"in t?"null":"booleanValue"in t?""+t.booleanValue:"integerValue"in t?""+t.integerValue:"doubleValue"in t?""+t.doubleValue:"timestampValue"in t?function(t){const e=bi(t);return`time(${e.seconds},${e.nanos})`}(t.timestampValue):"stringValue"in t?t.stringValue:"bytesValue"in t?Ci(t.bytesValue).toBase64():"referenceValue"in t?(n=t.referenceValue,ai.fromName(n).toString()):"geoPointValue"in t?`geo(${(e=t.geoPointValue).latitude},${e.longitude})`:"arrayValue"in t?function(t){let e="[",n=!0;for(const s of t.values||[])n?n=!1:e+=",",e+=Fi(s);return e+"]"}(t.arrayValue):"mapValue"in t?function(t){const e=Object.keys(t.fields||{}).sort();let n="{",s=!0;for(const r of e)s?s=!1:n+=",",n+=`${r}:${Fi(t.fields[r])}`;return n+"}"}(t.mapValue):Ur();var e,n}function Vi(t,e){return{referenceValue:`projects/${t.projectId}/databases/${t.database}/documents/${e.path.canonicalString()}`}}function Bi(t){return!!t&&"integerValue"in t}function Hi(t){return!!t&&"arrayValue"in t}function ji(t){return!!t&&"nullValue"in t}function qi(t){return!!t&&"doubleValue"in t&&isNaN(Number(t.doubleValue))}function Ki(t){return!!t&&"mapValue"in t}function Gi(t){if(t.geoPointValue)return{geoPointValue:Object.assign({},t.geoPointValue)};if(t.timestampValue&&"object"==typeof t.timestampValue)return{timestampValue:Object.assign({},t.timestampValue)};if(t.mapValue){const e={mapValue:{fields:{}}};return wi(t.mapValue.fields,((t,n)=>e.mapValue.fields[t]=Gi(n))),e}if(t.arrayValue){const e={arrayValue:{values:[]}};for(let n=0;n<(t.arrayValue.values||[]).length;++n)e.arrayValue.values[n]=Gi(t.arrayValue.values[n]);return e}return Object.assign({},t)}class Wi{constructor(t,e){this.position=t,this.inclusive=e}}function zi(t,e,n){let s=0;for(let r=0;r<t.position.length;r++){const i=e[r],o=t.position[r];if(s=i.field.isKeyField()?ai.comparator(ai.fromName(o.referenceValue),n.key):Mi(o,n.data.field(i.field)),"desc"===i.dir&&(s*=-1),0!==s)break}return s}function $i(t,e){if(null===t)return null===e;if(null===e)return!1;if(t.inclusive!==e.inclusive||t.position.length!==e.position.length)return!1;for(let n=0;n<t.position.length;n++)if(!Li(t.position[n],e.position[n]))return!1;return!0}
816
+ */(t)?9007199254740991:10:ki()}function Ao(t,e){if(t===e)return!0;const n=bo(t);if(n!==bo(e))return!1;switch(n){case 0:case 9007199254740991:return!0;case 1:return t.booleanValue===e.booleanValue;case 4:return So(t).isEqual(So(e));case 3:return function(t,e){if("string"==typeof t.timestampValue&&"string"==typeof e.timestampValue&&t.timestampValue.length===e.timestampValue.length)return t.timestampValue===e.timestampValue;const n=vo(t.timestampValue),r=vo(e.timestampValue);return n.seconds===r.seconds&&n.nanos===r.nanos}(t,e);case 5:return t.stringValue===e.stringValue;case 6:return function(t,e){return _o(t.bytesValue).isEqual(_o(e.bytesValue))}(t,e);case 7:return t.referenceValue===e.referenceValue;case 8:return function(t,e){return wo(t.geoPointValue.latitude)===wo(e.geoPointValue.latitude)&&wo(t.geoPointValue.longitude)===wo(e.geoPointValue.longitude)}(t,e);case 2:return function(t,e){if("integerValue"in t&&"integerValue"in e)return wo(t.integerValue)===wo(e.integerValue);if("doubleValue"in t&&"doubleValue"in e){const n=wo(t.doubleValue),r=wo(e.doubleValue);return n===r?go(n)===go(r):isNaN(n)&&isNaN(r)}return!1}(t,e);case 9:return Ki(t.arrayValue.values||[],e.arrayValue.values||[],Ao);case 10:return function(t,e){const n=t.mapValue.fields||{},r=e.mapValue.fields||{};if(ho(n)!==ho(r))return!1;for(const t in n)if(n.hasOwnProperty(t)&&(void 0===r[t]||!Ao(n[t],r[t])))return!1;return!0}(t,e);default:return ki()}}function Co(t,e){return void 0!==(t.values||[]).find((t=>Ao(t,e)))}function ko(t,e){if(t===e)return 0;const n=bo(t),r=bo(e);if(n!==r)return qi(n,r);switch(n){case 0:case 9007199254740991:return 0;case 1:return qi(t.booleanValue,e.booleanValue);case 2:return function(t,e){const n=wo(t.integerValue||t.doubleValue),r=wo(e.integerValue||e.doubleValue);return n<r?-1:n>r?1:n===r?0:isNaN(n)?isNaN(r)?0:-1:1}(t,e);case 3:return Ro(t.timestampValue,e.timestampValue);case 4:return Ro(So(t),So(e));case 5:return qi(t.stringValue,e.stringValue);case 6:return function(t,e){const n=_o(t),r=_o(e);return n.compareTo(r)}(t.bytesValue,e.bytesValue);case 7:return function(t,e){const n=t.split("/"),r=e.split("/");for(let t=0;t<n.length&&t<r.length;t++){const e=qi(n[t],r[t]);if(0!==e)return e}return qi(n.length,r.length)}(t.referenceValue,e.referenceValue);case 8:return function(t,e){const n=qi(wo(t.latitude),wo(e.latitude));return 0!==n?n:qi(wo(t.longitude),wo(e.longitude))}(t.geoPointValue,e.geoPointValue);case 9:return function(t,e){const n=t.values||[],r=e.values||[];for(let t=0;t<n.length&&t<r.length;++t){const e=ko(n[t],r[t]);if(e)return e}return qi(n.length,r.length)}(t.arrayValue,e.arrayValue);case 10:return function(t,e){if(t===Io.mapValue&&e===Io.mapValue)return 0;if(t===Io.mapValue)return 1;if(e===Io.mapValue)return-1;const n=t.fields||{},r=Object.keys(n),s=e.fields||{},i=Object.keys(s);r.sort(),i.sort();for(let t=0;t<r.length&&t<i.length;++t){const e=qi(r[t],i[t]);if(0!==e)return e;const o=ko(n[r[t]],s[i[t]]);if(0!==o)return o}return qi(r.length,i.length)}(t.mapValue,e.mapValue);default:throw ki()}}function Ro(t,e){if("string"==typeof t&&"string"==typeof e&&t.length===e.length)return qi(t,e);const n=vo(t),r=vo(e),s=qi(n.seconds,r.seconds);return 0!==s?s:qi(n.nanos,r.nanos)}function No(t){return Do(t)}function Do(t){return"nullValue"in t?"null":"booleanValue"in t?""+t.booleanValue:"integerValue"in t?""+t.integerValue:"doubleValue"in t?""+t.doubleValue:"timestampValue"in t?function(t){const e=vo(t);return`time(${e.seconds},${e.nanos})`}(t.timestampValue):"stringValue"in t?t.stringValue:"bytesValue"in t?_o(t.bytesValue).toBase64():"referenceValue"in t?(n=t.referenceValue,Xi.fromName(n).toString()):"geoPointValue"in t?`geo(${(e=t.geoPointValue).latitude},${e.longitude})`:"arrayValue"in t?function(t){let e="[",n=!0;for(const r of t.values||[])n?n=!1:e+=",",e+=Do(r);return e+"]"}(t.arrayValue):"mapValue"in t?function(t){const e=Object.keys(t.fields||{}).sort();let n="{",r=!0;for(const s of e)r?r=!1:n+=",",n+=`${s}:${Do(t.fields[s])}`;return n+"}"}(t.mapValue):ki();var e,n}function Oo(t,e){return{referenceValue:`projects/${t.projectId}/databases/${t.database}/documents/${e.path.canonicalString()}`}}function Lo(t){return!!t&&"integerValue"in t}function Po(t){return!!t&&"arrayValue"in t}function Mo(t){return!!t&&"nullValue"in t}function xo(t){return!!t&&"doubleValue"in t&&isNaN(Number(t.doubleValue))}function Uo(t){return!!t&&"mapValue"in t}function Fo(t){if(t.geoPointValue)return{geoPointValue:Object.assign({},t.geoPointValue)};if(t.timestampValue&&"object"==typeof t.timestampValue)return{timestampValue:Object.assign({},t.timestampValue)};if(t.mapValue){const e={mapValue:{fields:{}}};return lo(t.mapValue.fields,((t,n)=>e.mapValue.fields[t]=Fo(n))),e}if(t.arrayValue){const e={arrayValue:{values:[]}};for(let n=0;n<(t.arrayValue.values||[]).length;++n)e.arrayValue.values[n]=Fo(t.arrayValue.values[n]);return e}return Object.assign({},t)}class Vo{constructor(t,e){this.position=t,this.inclusive=e}}function Bo(t,e,n){let r=0;for(let s=0;s<t.position.length;s++){const i=e[s],o=t.position[s];if(r=i.field.isKeyField()?Xi.comparator(Xi.fromName(o.referenceValue),n.key):ko(o,n.data.field(i.field)),"desc"===i.dir&&(r*=-1),0!==r)break}return r}function Ho(t,e){if(null===t)return null===e;if(null===e)return!1;if(t.inclusive!==e.inclusive||t.position.length!==e.position.length)return!1;for(let n=0;n<t.position.length;n++)if(!Ao(t.position[n],e.position[n]))return!1;return!0}
735
817
  /**
736
818
  * @license
737
819
  * Copyright 2022 Google LLC
@@ -747,7 +829,7 @@ class Ei{constructor(t){this.binaryString=t}static fromBase64String(t){const e=a
747
829
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
748
830
  * See the License for the specific language governing permissions and
749
831
  * limitations under the License.
750
- */class Qi{}class Ji extends Qi{constructor(t,e,n){super(),this.field=t,this.op=e,this.value=n}static create(t,e,n){return t.isKeyField()?"in"===e||"not-in"===e?this.createKeyFieldInFilter(t,e,n):new so(t,e,n):"array-contains"===e?new ao(t,n):"in"===e?new co(t,n):"not-in"===e?new uo(t,n):"array-contains-any"===e?new ho(t,n):new Ji(t,e,n)}static createKeyFieldInFilter(t,e,n){return"in"===e?new ro(t,n):new io(t,n)}matches(t){const e=t.data.field(this.field);return"!="===this.op?null!==e&&this.matchesComparison(Mi(e,this.value)):null!==e&&Di(this.value)===Di(e)&&this.matchesComparison(Mi(e,this.value))}matchesComparison(t){switch(this.op){case"<":return t<0;case"<=":return t<=0;case"==":return 0===t;case"!=":return 0!==t;case">":return t>0;case">=":return t>=0;default:return Ur()}}isInequality(){return["<","<=",">",">=","!=","not-in"].indexOf(this.op)>=0}getFlattenedFilters(){return[this]}getFilters(){return[this]}getFirstInequalityField(){return this.isInequality()?this.field:null}}class Yi extends Qi{constructor(t,e){super(),this.filters=t,this.op=e,this.ht=null}static create(t,e){return new Yi(t,e)}matches(t){return Xi(this)?void 0===this.filters.find((e=>!e.matches(t))):void 0!==this.filters.find((e=>e.matches(t)))}getFlattenedFilters(){return null!==this.ht||(this.ht=this.filters.reduce(((t,e)=>t.concat(e.getFlattenedFilters())),[])),this.ht}getFilters(){return Object.assign([],this.filters)}getFirstInequalityField(){const t=this.lt((t=>t.isInequality()));return null!==t?t.field:null}lt(t){for(const e of this.getFlattenedFilters())if(t(e))return e;return null}}function Xi(t){return"and"===t.op}function Zi(t){return function(t){for(const e of t.filters)if(e instanceof Yi)return!1;return!0}(t)&&Xi(t)}function to(t){if(t instanceof Ji)return t.field.canonicalString()+t.op.toString()+Ui(t.value);{const e=t.filters.map((t=>to(t))).join(",");return`${t.op}(${e})`}}function eo(t,e){return t instanceof Ji?function(t,e){return e instanceof Ji&&t.op===e.op&&t.field.isEqual(e.field)&&Li(t.value,e.value)}(t,e):t instanceof Yi?function(t,e){return e instanceof Yi&&t.op===e.op&&t.filters.length===e.filters.length&&t.filters.reduce(((t,n,s)=>t&&eo(n,e.filters[s])),!0)}(t,e):void Ur()}function no(t){return t instanceof Ji?function(t){return`${t.field.canonicalString()} ${t.op} ${Ui(t.value)}`}(t):t instanceof Yi?function(t){return t.op.toString()+" {"+t.getFilters().map(no).join(" ,")+"}"}(t):"Filter"}class so extends Ji{constructor(t,e,n){super(t,e,n),this.key=ai.fromName(n.referenceValue)}matches(t){const e=ai.comparator(t.key,this.key);return this.matchesComparison(e)}}class ro extends Ji{constructor(t,e){super(t,"in",e),this.keys=oo("in",e)}matches(t){return this.keys.some((e=>e.isEqual(t.key)))}}class io extends Ji{constructor(t,e){super(t,"not-in",e),this.keys=oo("not-in",e)}matches(t){return!this.keys.some((e=>e.isEqual(t.key)))}}function oo(t,e){var n;return((null===(n=e.arrayValue)||void 0===n?void 0:n.values)||[]).map((t=>ai.fromName(t.referenceValue)))}class ao extends Ji{constructor(t,e){super(t,"array-contains",e)}matches(t){const e=t.data.field(this.field);return Hi(e)&&Pi(e.arrayValue,this.value)}}class co extends Ji{constructor(t,e){super(t,"in",e)}matches(t){const e=t.data.field(this.field);return null!==e&&Pi(this.value.arrayValue,e)}}class uo extends Ji{constructor(t,e){super(t,"not-in",e)}matches(t){if(Pi(this.value.arrayValue,{nullValue:"NULL_VALUE"}))return!1;const e=t.data.field(this.field);return null!==e&&!Pi(this.value.arrayValue,e)}}class ho extends Ji{constructor(t,e){super(t,"array-contains-any",e)}matches(t){const e=t.data.field(this.field);return!(!Hi(e)||!e.arrayValue.values)&&e.arrayValue.values.some((t=>Pi(this.value.arrayValue,t)))}}
832
+ */class jo{}class $o extends jo{constructor(t,e,n){super(),this.field=t,this.op=e,this.value=n}static create(t,e,n){return t.isKeyField()?"in"===e||"not-in"===e?this.createKeyFieldInFilter(t,e,n):new Yo(t,e,n):"array-contains"===e?new ta(t,n):"in"===e?new ea(t,n):"not-in"===e?new na(t,n):"array-contains-any"===e?new ra(t,n):new $o(t,e,n)}static createKeyFieldInFilter(t,e,n){return"in"===e?new Jo(t,n):new Xo(t,n)}matches(t){const e=t.data.field(this.field);return"!="===this.op?null!==e&&this.matchesComparison(ko(e,this.value)):null!==e&&bo(this.value)===bo(e)&&this.matchesComparison(ko(e,this.value))}matchesComparison(t){switch(this.op){case"<":return t<0;case"<=":return t<=0;case"==":return 0===t;case"!=":return 0!==t;case">":return t>0;case">=":return t>=0;default:return ki()}}isInequality(){return["<","<=",">",">=","!=","not-in"].indexOf(this.op)>=0}getFlattenedFilters(){return[this]}getFilters(){return[this]}getFirstInequalityField(){return this.isInequality()?this.field:null}}class qo extends jo{constructor(t,e){super(),this.filters=t,this.op=e,this.ht=null}static create(t,e){return new qo(t,e)}matches(t){return Ko(this)?void 0===this.filters.find((e=>!e.matches(t))):void 0!==this.filters.find((e=>e.matches(t)))}getFlattenedFilters(){return null!==this.ht||(this.ht=this.filters.reduce(((t,e)=>t.concat(e.getFlattenedFilters())),[])),this.ht}getFilters(){return Object.assign([],this.filters)}getFirstInequalityField(){const t=this.lt((t=>t.isInequality()));return null!==t?t.field:null}lt(t){for(const e of this.getFlattenedFilters())if(t(e))return e;return null}}function Ko(t){return"and"===t.op}function Wo(t){return function(t){for(const e of t.filters)if(e instanceof qo)return!1;return!0}(t)&&Ko(t)}function Go(t){if(t instanceof $o)return t.field.canonicalString()+t.op.toString()+No(t.value);{const e=t.filters.map((t=>Go(t))).join(",");return`${t.op}(${e})`}}function zo(t,e){return t instanceof $o?function(t,e){return e instanceof $o&&t.op===e.op&&t.field.isEqual(e.field)&&Ao(t.value,e.value)}(t,e):t instanceof qo?function(t,e){return e instanceof qo&&t.op===e.op&&t.filters.length===e.filters.length&&t.filters.reduce(((t,n,r)=>t&&zo(n,e.filters[r])),!0)}(t,e):void ki()}function Qo(t){return t instanceof $o?function(t){return`${t.field.canonicalString()} ${t.op} ${No(t.value)}`}(t):t instanceof qo?function(t){return t.op.toString()+" {"+t.getFilters().map(Qo).join(" ,")+"}"}(t):"Filter"}class Yo extends $o{constructor(t,e,n){super(t,e,n),this.key=Xi.fromName(n.referenceValue)}matches(t){const e=Xi.comparator(t.key,this.key);return this.matchesComparison(e)}}class Jo extends $o{constructor(t,e){super(t,"in",e),this.keys=Zo("in",e)}matches(t){return this.keys.some((e=>e.isEqual(t.key)))}}class Xo extends $o{constructor(t,e){super(t,"not-in",e),this.keys=Zo("not-in",e)}matches(t){return!this.keys.some((e=>e.isEqual(t.key)))}}function Zo(t,e){var n;return((null===(n=e.arrayValue)||void 0===n?void 0:n.values)||[]).map((t=>Xi.fromName(t.referenceValue)))}class ta extends $o{constructor(t,e){super(t,"array-contains",e)}matches(t){const e=t.data.field(this.field);return Po(e)&&Co(e.arrayValue,this.value)}}class ea extends $o{constructor(t,e){super(t,"in",e)}matches(t){const e=t.data.field(this.field);return null!==e&&Co(this.value.arrayValue,e)}}class na extends $o{constructor(t,e){super(t,"not-in",e)}matches(t){if(Co(this.value.arrayValue,{nullValue:"NULL_VALUE"}))return!1;const e=t.data.field(this.field);return null!==e&&!Co(this.value.arrayValue,e)}}class ra extends $o{constructor(t,e){super(t,"array-contains-any",e)}matches(t){const e=t.data.field(this.field);return!(!Po(e)||!e.arrayValue.values)&&e.arrayValue.values.some((t=>Co(this.value.arrayValue,t)))}}
751
833
  /**
752
834
  * @license
753
835
  * Copyright 2022 Google LLC
@@ -763,7 +845,7 @@ class Ei{constructor(t){this.binaryString=t}static fromBase64String(t){const e=a
763
845
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
764
846
  * See the License for the specific language governing permissions and
765
847
  * limitations under the License.
766
- */class lo{constructor(t,e="asc"){this.field=t,this.dir=e}}function fo(t,e){return t.dir===e.dir&&t.field.isEqual(e.field)}
848
+ */class sa{constructor(t,e="asc"){this.field=t,this.dir=e}}function ia(t,e){return t.dir===e.dir&&t.field.isEqual(e.field)}
767
849
  /**
768
850
  * @license
769
851
  * Copyright 2017 Google LLC
@@ -779,7 +861,7 @@ class Ei{constructor(t){this.binaryString=t}static fromBase64String(t){const e=a
779
861
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
780
862
  * See the License for the specific language governing permissions and
781
863
  * limitations under the License.
782
- */class po{constructor(t,e){this.comparator=t,this.root=e||mo.EMPTY}insert(t,e){return new po(this.comparator,this.root.insert(t,e,this.comparator).copy(null,null,mo.BLACK,null,null))}remove(t){return new po(this.comparator,this.root.remove(t,this.comparator).copy(null,null,mo.BLACK,null,null))}get(t){let e=this.root;for(;!e.isEmpty();){const n=this.comparator(t,e.key);if(0===n)return e.value;n<0?e=e.left:n>0&&(e=e.right)}return null}indexOf(t){let e=0,n=this.root;for(;!n.isEmpty();){const s=this.comparator(t,n.key);if(0===s)return e+n.left.size;s<0?n=n.left:(e+=n.left.size+1,n=n.right)}return-1}isEmpty(){return this.root.isEmpty()}get size(){return this.root.size}minKey(){return this.root.minKey()}maxKey(){return this.root.maxKey()}inorderTraversal(t){return this.root.inorderTraversal(t)}forEach(t){this.inorderTraversal(((e,n)=>(t(e,n),!1)))}toString(){const t=[];return this.inorderTraversal(((e,n)=>(t.push(`${e}:${n}`),!1))),`{${t.join(", ")}}`}reverseTraversal(t){return this.root.reverseTraversal(t)}getIterator(){return new go(this.root,null,this.comparator,!1)}getIteratorFrom(t){return new go(this.root,t,this.comparator,!1)}getReverseIterator(){return new go(this.root,null,this.comparator,!0)}getReverseIteratorFrom(t){return new go(this.root,t,this.comparator,!0)}}class go{constructor(t,e,n,s){this.isReverse=s,this.nodeStack=[];let r=1;for(;!t.isEmpty();)if(r=e?n(t.key,e):1,e&&s&&(r*=-1),r<0)t=this.isReverse?t.left:t.right;else{if(0===r){this.nodeStack.push(t);break}this.nodeStack.push(t),t=this.isReverse?t.right:t.left}}getNext(){let t=this.nodeStack.pop();const e={key:t.key,value:t.value};if(this.isReverse)for(t=t.left;!t.isEmpty();)this.nodeStack.push(t),t=t.right;else for(t=t.right;!t.isEmpty();)this.nodeStack.push(t),t=t.left;return e}hasNext(){return this.nodeStack.length>0}peek(){if(0===this.nodeStack.length)return null;const t=this.nodeStack[this.nodeStack.length-1];return{key:t.key,value:t.value}}}class mo{constructor(t,e,n,s,r){this.key=t,this.value=e,this.color=null!=n?n:mo.RED,this.left=null!=s?s:mo.EMPTY,this.right=null!=r?r:mo.EMPTY,this.size=this.left.size+1+this.right.size}copy(t,e,n,s,r){return new mo(null!=t?t:this.key,null!=e?e:this.value,null!=n?n:this.color,null!=s?s:this.left,null!=r?r:this.right)}isEmpty(){return!1}inorderTraversal(t){return this.left.inorderTraversal(t)||t(this.key,this.value)||this.right.inorderTraversal(t)}reverseTraversal(t){return this.right.reverseTraversal(t)||t(this.key,this.value)||this.left.reverseTraversal(t)}min(){return this.left.isEmpty()?this:this.left.min()}minKey(){return this.min().key}maxKey(){return this.right.isEmpty()?this.key:this.right.maxKey()}insert(t,e,n){let s=this;const r=n(t,s.key);return s=r<0?s.copy(null,null,null,s.left.insert(t,e,n),null):0===r?s.copy(null,e,null,null,null):s.copy(null,null,null,null,s.right.insert(t,e,n)),s.fixUp()}removeMin(){if(this.left.isEmpty())return mo.EMPTY;let t=this;return t.left.isRed()||t.left.left.isRed()||(t=t.moveRedLeft()),t=t.copy(null,null,null,t.left.removeMin(),null),t.fixUp()}remove(t,e){let n,s=this;if(e(t,s.key)<0)s.left.isEmpty()||s.left.isRed()||s.left.left.isRed()||(s=s.moveRedLeft()),s=s.copy(null,null,null,s.left.remove(t,e),null);else{if(s.left.isRed()&&(s=s.rotateRight()),s.right.isEmpty()||s.right.isRed()||s.right.left.isRed()||(s=s.moveRedRight()),0===e(t,s.key)){if(s.right.isEmpty())return mo.EMPTY;n=s.right.min(),s=s.copy(n.key,n.value,null,null,s.right.removeMin())}s=s.copy(null,null,null,null,s.right.remove(t,e))}return s.fixUp()}isRed(){return this.color}fixUp(){let t=this;return t.right.isRed()&&!t.left.isRed()&&(t=t.rotateLeft()),t.left.isRed()&&t.left.left.isRed()&&(t=t.rotateRight()),t.left.isRed()&&t.right.isRed()&&(t=t.colorFlip()),t}moveRedLeft(){let t=this.colorFlip();return t.right.left.isRed()&&(t=t.copy(null,null,null,null,t.right.rotateRight()),t=t.rotateLeft(),t=t.colorFlip()),t}moveRedRight(){let t=this.colorFlip();return t.left.left.isRed()&&(t=t.rotateRight(),t=t.colorFlip()),t}rotateLeft(){const t=this.copy(null,null,mo.RED,null,this.right.left);return this.right.copy(null,null,this.color,t,null)}rotateRight(){const t=this.copy(null,null,mo.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,t)}colorFlip(){const t=this.left.copy(null,null,!this.left.color,null,null),e=this.right.copy(null,null,!this.right.color,null,null);return this.copy(null,null,!this.color,t,e)}checkMaxDepth(){const t=this.check();return Math.pow(2,t)<=this.size+1}check(){if(this.isRed()&&this.left.isRed())throw Ur();if(this.right.isRed())throw Ur();const t=this.left.check();if(t!==this.right.check())throw Ur();return t+(this.isRed()?0:1)}}mo.EMPTY=null,mo.RED=!0,mo.BLACK=!1,mo.EMPTY=new class{constructor(){this.size=0}get key(){throw Ur()}get value(){throw Ur()}get color(){throw Ur()}get left(){throw Ur()}get right(){throw Ur()}copy(t,e,n,s,r){return this}insert(t,e,n){return new mo(t,e)}remove(t,e){return this}isEmpty(){return!0}inorderTraversal(t){return!1}reverseTraversal(t){return!1}minKey(){return null}maxKey(){return null}isRed(){return!1}checkMaxDepth(){return!0}check(){return 0}};
864
+ */class oa{constructor(t,e){this.comparator=t,this.root=e||ca.EMPTY}insert(t,e){return new oa(this.comparator,this.root.insert(t,e,this.comparator).copy(null,null,ca.BLACK,null,null))}remove(t){return new oa(this.comparator,this.root.remove(t,this.comparator).copy(null,null,ca.BLACK,null,null))}get(t){let e=this.root;for(;!e.isEmpty();){const n=this.comparator(t,e.key);if(0===n)return e.value;n<0?e=e.left:n>0&&(e=e.right)}return null}indexOf(t){let e=0,n=this.root;for(;!n.isEmpty();){const r=this.comparator(t,n.key);if(0===r)return e+n.left.size;r<0?n=n.left:(e+=n.left.size+1,n=n.right)}return-1}isEmpty(){return this.root.isEmpty()}get size(){return this.root.size}minKey(){return this.root.minKey()}maxKey(){return this.root.maxKey()}inorderTraversal(t){return this.root.inorderTraversal(t)}forEach(t){this.inorderTraversal(((e,n)=>(t(e,n),!1)))}toString(){const t=[];return this.inorderTraversal(((e,n)=>(t.push(`${e}:${n}`),!1))),`{${t.join(", ")}}`}reverseTraversal(t){return this.root.reverseTraversal(t)}getIterator(){return new aa(this.root,null,this.comparator,!1)}getIteratorFrom(t){return new aa(this.root,t,this.comparator,!1)}getReverseIterator(){return new aa(this.root,null,this.comparator,!0)}getReverseIteratorFrom(t){return new aa(this.root,t,this.comparator,!0)}}class aa{constructor(t,e,n,r){this.isReverse=r,this.nodeStack=[];let s=1;for(;!t.isEmpty();)if(s=e?n(t.key,e):1,e&&r&&(s*=-1),s<0)t=this.isReverse?t.left:t.right;else{if(0===s){this.nodeStack.push(t);break}this.nodeStack.push(t),t=this.isReverse?t.right:t.left}}getNext(){let t=this.nodeStack.pop();const e={key:t.key,value:t.value};if(this.isReverse)for(t=t.left;!t.isEmpty();)this.nodeStack.push(t),t=t.right;else for(t=t.right;!t.isEmpty();)this.nodeStack.push(t),t=t.left;return e}hasNext(){return this.nodeStack.length>0}peek(){if(0===this.nodeStack.length)return null;const t=this.nodeStack[this.nodeStack.length-1];return{key:t.key,value:t.value}}}class ca{constructor(t,e,n,r,s){this.key=t,this.value=e,this.color=null!=n?n:ca.RED,this.left=null!=r?r:ca.EMPTY,this.right=null!=s?s:ca.EMPTY,this.size=this.left.size+1+this.right.size}copy(t,e,n,r,s){return new ca(null!=t?t:this.key,null!=e?e:this.value,null!=n?n:this.color,null!=r?r:this.left,null!=s?s:this.right)}isEmpty(){return!1}inorderTraversal(t){return this.left.inorderTraversal(t)||t(this.key,this.value)||this.right.inorderTraversal(t)}reverseTraversal(t){return this.right.reverseTraversal(t)||t(this.key,this.value)||this.left.reverseTraversal(t)}min(){return this.left.isEmpty()?this:this.left.min()}minKey(){return this.min().key}maxKey(){return this.right.isEmpty()?this.key:this.right.maxKey()}insert(t,e,n){let r=this;const s=n(t,r.key);return r=s<0?r.copy(null,null,null,r.left.insert(t,e,n),null):0===s?r.copy(null,e,null,null,null):r.copy(null,null,null,null,r.right.insert(t,e,n)),r.fixUp()}removeMin(){if(this.left.isEmpty())return ca.EMPTY;let t=this;return t.left.isRed()||t.left.left.isRed()||(t=t.moveRedLeft()),t=t.copy(null,null,null,t.left.removeMin(),null),t.fixUp()}remove(t,e){let n,r=this;if(e(t,r.key)<0)r.left.isEmpty()||r.left.isRed()||r.left.left.isRed()||(r=r.moveRedLeft()),r=r.copy(null,null,null,r.left.remove(t,e),null);else{if(r.left.isRed()&&(r=r.rotateRight()),r.right.isEmpty()||r.right.isRed()||r.right.left.isRed()||(r=r.moveRedRight()),0===e(t,r.key)){if(r.right.isEmpty())return ca.EMPTY;n=r.right.min(),r=r.copy(n.key,n.value,null,null,r.right.removeMin())}r=r.copy(null,null,null,null,r.right.remove(t,e))}return r.fixUp()}isRed(){return this.color}fixUp(){let t=this;return t.right.isRed()&&!t.left.isRed()&&(t=t.rotateLeft()),t.left.isRed()&&t.left.left.isRed()&&(t=t.rotateRight()),t.left.isRed()&&t.right.isRed()&&(t=t.colorFlip()),t}moveRedLeft(){let t=this.colorFlip();return t.right.left.isRed()&&(t=t.copy(null,null,null,null,t.right.rotateRight()),t=t.rotateLeft(),t=t.colorFlip()),t}moveRedRight(){let t=this.colorFlip();return t.left.left.isRed()&&(t=t.rotateRight(),t=t.colorFlip()),t}rotateLeft(){const t=this.copy(null,null,ca.RED,null,this.right.left);return this.right.copy(null,null,this.color,t,null)}rotateRight(){const t=this.copy(null,null,ca.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,t)}colorFlip(){const t=this.left.copy(null,null,!this.left.color,null,null),e=this.right.copy(null,null,!this.right.color,null,null);return this.copy(null,null,!this.color,t,e)}checkMaxDepth(){const t=this.check();return Math.pow(2,t)<=this.size+1}check(){if(this.isRed()&&this.left.isRed())throw ki();if(this.right.isRed())throw ki();const t=this.left.check();if(t!==this.right.check())throw ki();return t+(this.isRed()?0:1)}}ca.EMPTY=null,ca.RED=!0,ca.BLACK=!1,ca.EMPTY=new class{constructor(){this.size=0}get key(){throw ki()}get value(){throw ki()}get color(){throw ki()}get left(){throw ki()}get right(){throw ki()}copy(t,e,n,r,s){return this}insert(t,e,n){return new ca(t,e)}remove(t,e){return this}isEmpty(){return!0}inorderTraversal(t){return!1}reverseTraversal(t){return!1}minKey(){return null}maxKey(){return null}isRed(){return!1}checkMaxDepth(){return!0}check(){return 0}};
783
865
  /**
784
866
  * @license
785
867
  * Copyright 2017 Google LLC
@@ -796,7 +878,7 @@ class Ei{constructor(t){this.binaryString=t}static fromBase64String(t){const e=a
796
878
  * See the License for the specific language governing permissions and
797
879
  * limitations under the License.
798
880
  */
799
- class yo{constructor(t){this.comparator=t,this.data=new po(this.comparator)}has(t){return null!==this.data.get(t)}first(){return this.data.minKey()}last(){return this.data.maxKey()}get size(){return this.data.size}indexOf(t){return this.data.indexOf(t)}forEach(t){this.data.inorderTraversal(((e,n)=>(t(e),!1)))}forEachInRange(t,e){const n=this.data.getIteratorFrom(t[0]);for(;n.hasNext();){const s=n.getNext();if(this.comparator(s.key,t[1])>=0)return;e(s.key)}}forEachWhile(t,e){let n;for(n=void 0!==e?this.data.getIteratorFrom(e):this.data.getIterator();n.hasNext();)if(!t(n.getNext().key))return}firstAfterOrEqual(t){const e=this.data.getIteratorFrom(t);return e.hasNext()?e.getNext().key:null}getIterator(){return new vo(this.data.getIterator())}getIteratorFrom(t){return new vo(this.data.getIteratorFrom(t))}add(t){return this.copy(this.data.remove(t).insert(t,!0))}delete(t){return this.has(t)?this.copy(this.data.remove(t)):this}isEmpty(){return this.data.isEmpty()}unionWith(t){let e=this;return e.size<t.size&&(e=t,t=this),t.forEach((t=>{e=e.add(t)})),e}isEqual(t){if(!(t instanceof yo))return!1;if(this.size!==t.size)return!1;const e=this.data.getIterator(),n=t.data.getIterator();for(;e.hasNext();){const t=e.getNext().key,s=n.getNext().key;if(0!==this.comparator(t,s))return!1}return!0}toArray(){const t=[];return this.forEach((e=>{t.push(e)})),t}toString(){const t=[];return this.forEach((e=>t.push(e))),"SortedSet("+t.toString()+")"}copy(t){const e=new yo(this.comparator);return e.data=t,e}}class vo{constructor(t){this.iter=t}getNext(){return this.iter.getNext().key}hasNext(){return this.iter.hasNext()}}
881
+ class ua{constructor(t){this.comparator=t,this.data=new oa(this.comparator)}has(t){return null!==this.data.get(t)}first(){return this.data.minKey()}last(){return this.data.maxKey()}get size(){return this.data.size}indexOf(t){return this.data.indexOf(t)}forEach(t){this.data.inorderTraversal(((e,n)=>(t(e),!1)))}forEachInRange(t,e){const n=this.data.getIteratorFrom(t[0]);for(;n.hasNext();){const r=n.getNext();if(this.comparator(r.key,t[1])>=0)return;e(r.key)}}forEachWhile(t,e){let n;for(n=void 0!==e?this.data.getIteratorFrom(e):this.data.getIterator();n.hasNext();)if(!t(n.getNext().key))return}firstAfterOrEqual(t){const e=this.data.getIteratorFrom(t);return e.hasNext()?e.getNext().key:null}getIterator(){return new ha(this.data.getIterator())}getIteratorFrom(t){return new ha(this.data.getIteratorFrom(t))}add(t){return this.copy(this.data.remove(t).insert(t,!0))}delete(t){return this.has(t)?this.copy(this.data.remove(t)):this}isEmpty(){return this.data.isEmpty()}unionWith(t){let e=this;return e.size<t.size&&(e=t,t=this),t.forEach((t=>{e=e.add(t)})),e}isEqual(t){if(!(t instanceof ua))return!1;if(this.size!==t.size)return!1;const e=this.data.getIterator(),n=t.data.getIterator();for(;e.hasNext();){const t=e.getNext().key,r=n.getNext().key;if(0!==this.comparator(t,r))return!1}return!0}toArray(){const t=[];return this.forEach((e=>{t.push(e)})),t}toString(){const t=[];return this.forEach((e=>t.push(e))),"SortedSet("+t.toString()+")"}copy(t){const e=new ua(this.comparator);return e.data=t,e}}class ha{constructor(t){this.iter=t}getNext(){return this.iter.getNext().key}hasNext(){return this.iter.hasNext()}}
800
882
  /**
801
883
  * @license
802
884
  * Copyright 2020 Google LLC
@@ -812,7 +894,7 @@ class yo{constructor(t){this.comparator=t,this.data=new po(this.comparator)}has(
812
894
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
813
895
  * See the License for the specific language governing permissions and
814
896
  * limitations under the License.
815
- */class wo{constructor(t){this.fields=t,t.sort(oi.comparator)}static empty(){return new wo([])}unionWith(t){let e=new yo(oi.comparator);for(const t of this.fields)e=e.add(t);for(const n of t)e=e.add(n);return new wo(e.toArray())}covers(t){for(const e of this.fields)if(e.isPrefixOf(t))return!0;return!1}isEqual(t){return ti(this.fields,t.fields,((t,e)=>t.isEqual(e)))}}
897
+ */class la{constructor(t){this.fields=t,t.sort(Ji.comparator)}static empty(){return new la([])}unionWith(t){let e=new ua(Ji.comparator);for(const t of this.fields)e=e.add(t);for(const n of t)e=e.add(n);return new la(e.toArray())}covers(t){for(const e of this.fields)if(e.isPrefixOf(t))return!0;return!1}isEqual(t){return Ki(this.fields,t.fields,((t,e)=>t.isEqual(e)))}}
816
898
  /**
817
899
  * @license
818
900
  * Copyright 2017 Google LLC
@@ -828,7 +910,7 @@ class yo{constructor(t){this.comparator=t,this.data=new po(this.comparator)}has(
828
910
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
829
911
  * See the License for the specific language governing permissions and
830
912
  * limitations under the License.
831
- */class _o{constructor(t){this.value=t}static empty(){return new _o({mapValue:{}})}field(t){if(t.isEmpty())return this.value;{let e=this.value;for(let n=0;n<t.length-1;++n)if(e=(e.mapValue.fields||{})[t.get(n)],!Ki(e))return null;return e=(e.mapValue.fields||{})[t.lastSegment()],e||null}}set(t,e){this.getFieldsMap(t.popLast())[t.lastSegment()]=Gi(e)}setAll(t){let e=oi.emptyPath(),n={},s=[];t.forEach(((t,r)=>{if(!e.isImmediateParentOf(r)){const t=this.getFieldsMap(e);this.applyChanges(t,n,s),n={},s=[],e=r.popLast()}t?n[r.lastSegment()]=Gi(t):s.push(r.lastSegment())}));const r=this.getFieldsMap(e);this.applyChanges(r,n,s)}delete(t){const e=this.field(t.popLast());Ki(e)&&e.mapValue.fields&&delete e.mapValue.fields[t.lastSegment()]}isEqual(t){return Li(this.value,t.value)}getFieldsMap(t){let e=this.value;e.mapValue.fields||(e.mapValue={fields:{}});for(let n=0;n<t.length;++n){let s=e.mapValue.fields[t.get(n)];Ki(s)&&s.mapValue.fields||(s={mapValue:{fields:{}}},e.mapValue.fields[t.get(n)]=s),e=s}return e.mapValue.fields}applyChanges(t,e,n){wi(e,((e,n)=>t[e]=n));for(const e of n)delete t[e]}clone(){return new _o(Gi(this.value))}}
913
+ */class da{constructor(t){this.value=t}static empty(){return new da({mapValue:{}})}field(t){if(t.isEmpty())return this.value;{let e=this.value;for(let n=0;n<t.length-1;++n)if(e=(e.mapValue.fields||{})[t.get(n)],!Uo(e))return null;return e=(e.mapValue.fields||{})[t.lastSegment()],e||null}}set(t,e){this.getFieldsMap(t.popLast())[t.lastSegment()]=Fo(e)}setAll(t){let e=Ji.emptyPath(),n={},r=[];t.forEach(((t,s)=>{if(!e.isImmediateParentOf(s)){const t=this.getFieldsMap(e);this.applyChanges(t,n,r),n={},r=[],e=s.popLast()}t?n[s.lastSegment()]=Fo(t):r.push(s.lastSegment())}));const s=this.getFieldsMap(e);this.applyChanges(s,n,r)}delete(t){const e=this.field(t.popLast());Uo(e)&&e.mapValue.fields&&delete e.mapValue.fields[t.lastSegment()]}isEqual(t){return Ao(this.value,t.value)}getFieldsMap(t){let e=this.value;e.mapValue.fields||(e.mapValue={fields:{}});for(let n=0;n<t.length;++n){let r=e.mapValue.fields[t.get(n)];Uo(r)&&r.mapValue.fields||(r={mapValue:{fields:{}}},e.mapValue.fields[t.get(n)]=r),e=r}return e.mapValue.fields}applyChanges(t,e,n){lo(e,((e,n)=>t[e]=n));for(const e of n)delete t[e]}clone(){return new da(Fo(this.value))}}function fa(t){const e=[];return lo(t.fields,((t,n)=>{const r=new Ji([t]);if(Uo(n)){const t=fa(n.mapValue).fields;if(0===t.length)e.push(r);else for(const n of t)e.push(r.child(n))}else e.push(r)})),new la(e)
832
914
  /**
833
915
  * @license
834
916
  * Copyright 2017 Google LLC
@@ -844,7 +926,7 @@ class yo{constructor(t){this.comparator=t,this.data=new po(this.comparator)}has(
844
926
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
845
927
  * See the License for the specific language governing permissions and
846
928
  * limitations under the License.
847
- */class To{constructor(t,e,n,s,r,i,o){this.key=t,this.documentType=e,this.version=n,this.readTime=s,this.createTime=r,this.data=i,this.documentState=o}static newInvalidDocument(t){return new To(t,0,ni.min(),ni.min(),ni.min(),_o.empty(),0)}static newFoundDocument(t,e,n,s){return new To(t,1,e,ni.min(),n,s,0)}static newNoDocument(t,e){return new To(t,2,e,ni.min(),ni.min(),_o.empty(),0)}static newUnknownDocument(t,e){return new To(t,3,e,ni.min(),ni.min(),_o.empty(),2)}convertToFoundDocument(t,e){return!this.createTime.isEqual(ni.min())||2!==this.documentType&&0!==this.documentType||(this.createTime=t),this.version=t,this.documentType=1,this.data=e,this.documentState=0,this}convertToNoDocument(t){return this.version=t,this.documentType=2,this.data=_o.empty(),this.documentState=0,this}convertToUnknownDocument(t){return this.version=t,this.documentType=3,this.data=_o.empty(),this.documentState=2,this}setHasCommittedMutations(){return this.documentState=2,this}setHasLocalMutations(){return this.documentState=1,this.version=ni.min(),this}setReadTime(t){return this.readTime=t,this}get hasLocalMutations(){return 1===this.documentState}get hasCommittedMutations(){return 2===this.documentState}get hasPendingWrites(){return this.hasLocalMutations||this.hasCommittedMutations}isValidDocument(){return 0!==this.documentType}isFoundDocument(){return 1===this.documentType}isNoDocument(){return 2===this.documentType}isUnknownDocument(){return 3===this.documentType}isEqual(t){return t instanceof To&&this.key.isEqual(t.key)&&this.version.isEqual(t.version)&&this.documentType===t.documentType&&this.documentState===t.documentState&&this.data.isEqual(t.data)}mutableCopy(){return new To(this.key,this.documentType,this.version,this.readTime,this.createTime,this.data.clone(),this.documentState)}toString(){return`Document(${this.key}, ${this.version}, ${JSON.stringify(this.data.value)}, {createTime: ${this.createTime}}), {documentType: ${this.documentType}}), {documentState: ${this.documentState}})`}}
929
+ */}class pa{constructor(t,e,n,r,s,i,o){this.key=t,this.documentType=e,this.version=n,this.readTime=r,this.createTime=s,this.data=i,this.documentState=o}static newInvalidDocument(t){return new pa(t,0,Gi.min(),Gi.min(),Gi.min(),da.empty(),0)}static newFoundDocument(t,e,n,r){return new pa(t,1,e,Gi.min(),n,r,0)}static newNoDocument(t,e){return new pa(t,2,e,Gi.min(),Gi.min(),da.empty(),0)}static newUnknownDocument(t,e){return new pa(t,3,e,Gi.min(),Gi.min(),da.empty(),2)}convertToFoundDocument(t,e){return!this.createTime.isEqual(Gi.min())||2!==this.documentType&&0!==this.documentType||(this.createTime=t),this.version=t,this.documentType=1,this.data=e,this.documentState=0,this}convertToNoDocument(t){return this.version=t,this.documentType=2,this.data=da.empty(),this.documentState=0,this}convertToUnknownDocument(t){return this.version=t,this.documentType=3,this.data=da.empty(),this.documentState=2,this}setHasCommittedMutations(){return this.documentState=2,this}setHasLocalMutations(){return this.documentState=1,this.version=Gi.min(),this}setReadTime(t){return this.readTime=t,this}get hasLocalMutations(){return 1===this.documentState}get hasCommittedMutations(){return 2===this.documentState}get hasPendingWrites(){return this.hasLocalMutations||this.hasCommittedMutations}isValidDocument(){return 0!==this.documentType}isFoundDocument(){return 1===this.documentType}isNoDocument(){return 2===this.documentType}isUnknownDocument(){return 3===this.documentType}isEqual(t){return t instanceof pa&&this.key.isEqual(t.key)&&this.version.isEqual(t.version)&&this.documentType===t.documentType&&this.documentState===t.documentState&&this.data.isEqual(t.data)}mutableCopy(){return new pa(this.key,this.documentType,this.version,this.readTime,this.createTime,this.data.clone(),this.documentState)}toString(){return`Document(${this.key}, ${this.version}, ${JSON.stringify(this.data.value)}, {createTime: ${this.createTime}}), {documentType: ${this.documentType}}), {documentState: ${this.documentState}})`}}
848
930
  /**
849
931
  * @license
850
932
  * Copyright 2019 Google LLC
@@ -860,7 +942,7 @@ class yo{constructor(t){this.comparator=t,this.data=new po(this.comparator)}has(
860
942
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
861
943
  * See the License for the specific language governing permissions and
862
944
  * limitations under the License.
863
- */class Io{constructor(t,e=null,n=[],s=[],r=null,i=null,o=null){this.path=t,this.collectionGroup=e,this.orderBy=n,this.filters=s,this.limit=r,this.startAt=i,this.endAt=o,this.ft=null}}function Eo(t,e=null,n=[],s=[],r=null,i=null,o=null){return new Io(t,e,n,s,r,i,o)}function So(t){const e=Vr(t);if(null===e.ft){let t=e.path.canonicalString();null!==e.collectionGroup&&(t+="|cg:"+e.collectionGroup),t+="|f:",t+=e.filters.map((t=>to(t))).join(","),t+="|ob:",t+=e.orderBy.map((t=>function(t){return t.field.canonicalString()+t.dir}(t))).join(","),Ti(e.limit)||(t+="|l:",t+=e.limit),e.startAt&&(t+="|lb:",t+=e.startAt.inclusive?"b:":"a:",t+=e.startAt.position.map((t=>Ui(t))).join(",")),e.endAt&&(t+="|ub:",t+=e.endAt.inclusive?"a:":"b:",t+=e.endAt.position.map((t=>Ui(t))).join(",")),e.ft=t}return e.ft}function bo(t,e){if(t.limit!==e.limit)return!1;if(t.orderBy.length!==e.orderBy.length)return!1;for(let n=0;n<t.orderBy.length;n++)if(!fo(t.orderBy[n],e.orderBy[n]))return!1;if(t.filters.length!==e.filters.length)return!1;for(let n=0;n<t.filters.length;n++)if(!eo(t.filters[n],e.filters[n]))return!1;return t.collectionGroup===e.collectionGroup&&!!t.path.isEqual(e.path)&&!!$i(t.startAt,e.startAt)&&$i(t.endAt,e.endAt)}function Ao(t){return ai.isDocumentKey(t.path)&&null===t.collectionGroup&&0===t.filters.length}
945
+ */class ga{constructor(t,e=null,n=[],r=[],s=null,i=null,o=null){this.path=t,this.collectionGroup=e,this.orderBy=n,this.filters=r,this.limit=s,this.startAt=i,this.endAt=o,this.ft=null}}function ma(t,e=null,n=[],r=[],s=null,i=null,o=null){return new ga(t,e,n,r,s,i,o)}function ya(t){const e=Ni(t);if(null===e.ft){let t=e.path.canonicalString();null!==e.collectionGroup&&(t+="|cg:"+e.collectionGroup),t+="|f:",t+=e.filters.map((t=>Go(t))).join(","),t+="|ob:",t+=e.orderBy.map((t=>function(t){return t.field.canonicalString()+t.dir}(t))).join(","),po(e.limit)||(t+="|l:",t+=e.limit),e.startAt&&(t+="|lb:",t+=e.startAt.inclusive?"b:":"a:",t+=e.startAt.position.map((t=>No(t))).join(",")),e.endAt&&(t+="|ub:",t+=e.endAt.inclusive?"a:":"b:",t+=e.endAt.position.map((t=>No(t))).join(",")),e.ft=t}return e.ft}function va(t,e){if(t.limit!==e.limit)return!1;if(t.orderBy.length!==e.orderBy.length)return!1;for(let n=0;n<t.orderBy.length;n++)if(!ia(t.orderBy[n],e.orderBy[n]))return!1;if(t.filters.length!==e.filters.length)return!1;for(let n=0;n<t.filters.length;n++)if(!zo(t.filters[n],e.filters[n]))return!1;return t.collectionGroup===e.collectionGroup&&!!t.path.isEqual(e.path)&&!!Ho(t.startAt,e.startAt)&&Ho(t.endAt,e.endAt)}function wa(t){return Xi.isDocumentKey(t.path)&&null===t.collectionGroup&&0===t.filters.length}
864
946
  /**
865
947
  * @license
866
948
  * Copyright 2017 Google LLC
@@ -876,7 +958,7 @@ class yo{constructor(t){this.comparator=t,this.data=new po(this.comparator)}has(
876
958
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
877
959
  * See the License for the specific language governing permissions and
878
960
  * limitations under the License.
879
- */class Co{constructor(t,e=null,n=[],s=[],r=null,i="F",o=null,a=null){this.path=t,this.collectionGroup=e,this.explicitOrderBy=n,this.filters=s,this.limit=r,this.limitType=i,this.startAt=o,this.endAt=a,this.dt=null,this._t=null,this.startAt,this.endAt}}function ko(t){return new Co(t)}function No(t){return 0===t.filters.length&&null===t.limit&&null==t.startAt&&null==t.endAt&&(0===t.explicitOrderBy.length||1===t.explicitOrderBy.length&&t.explicitOrderBy[0].field.isKeyField())}function Ro(t){return t.explicitOrderBy.length>0?t.explicitOrderBy[0].field:null}function Oo(t){for(const e of t.filters){const t=e.getFirstInequalityField();if(null!==t)return t}return null}function Do(t){return null!==t.collectionGroup}function Lo(t){const e=Vr(t);if(null===e.dt){e.dt=[];const t=Oo(e),n=Ro(e);if(null!==t&&null===n)t.isKeyField()||e.dt.push(new lo(t)),e.dt.push(new lo(oi.keyField(),"asc"));else{let t=!1;for(const n of e.explicitOrderBy)e.dt.push(n),n.field.isKeyField()&&(t=!0);if(!t){const t=e.explicitOrderBy.length>0?e.explicitOrderBy[e.explicitOrderBy.length-1].dir:"asc";e.dt.push(new lo(oi.keyField(),t))}}}return e.dt}function Po(t){const e=Vr(t);if(!e._t)if("F"===e.limitType)e._t=Eo(e.path,e.collectionGroup,Lo(e),e.filters,e.limit,e.startAt,e.endAt);else{const t=[];for(const n of Lo(e)){const e="desc"===n.dir?"asc":"desc";t.push(new lo(n.field,e))}const n=e.endAt?new Wi(e.endAt.position,e.endAt.inclusive):null,s=e.startAt?new Wi(e.startAt.position,e.startAt.inclusive):null;e._t=Eo(e.path,e.collectionGroup,t,e.filters,e.limit,n,s)}return e._t}function Mo(t,e){e.getFirstInequalityField(),Oo(t);const n=t.filters.concat([e]);return new Co(t.path,t.collectionGroup,t.explicitOrderBy.slice(),n,t.limit,t.limitType,t.startAt,t.endAt)}function xo(t,e,n){return new Co(t.path,t.collectionGroup,t.explicitOrderBy.slice(),t.filters.slice(),e,n,t.startAt,t.endAt)}function Uo(t,e){return bo(Po(t),Po(e))&&t.limitType===e.limitType}function Fo(t){return`${So(Po(t))}|lt:${t.limitType}`}function Vo(t){return`Query(target=${function(t){let e=t.path.canonicalString();return null!==t.collectionGroup&&(e+=" collectionGroup="+t.collectionGroup),t.filters.length>0&&(e+=`, filters: [${t.filters.map((t=>no(t))).join(", ")}]`),Ti(t.limit)||(e+=", limit: "+t.limit),t.orderBy.length>0&&(e+=`, orderBy: [${t.orderBy.map((t=>function(t){return`${t.field.canonicalString()} (${t.dir})`}(t))).join(", ")}]`),t.startAt&&(e+=", startAt: ",e+=t.startAt.inclusive?"b:":"a:",e+=t.startAt.position.map((t=>Ui(t))).join(",")),t.endAt&&(e+=", endAt: ",e+=t.endAt.inclusive?"a:":"b:",e+=t.endAt.position.map((t=>Ui(t))).join(",")),`Target(${e})`}(Po(t))}; limitType=${t.limitType})`}function Bo(t,e){return e.isFoundDocument()&&function(t,e){const n=e.key.path;return null!==t.collectionGroup?e.key.hasCollectionId(t.collectionGroup)&&t.path.isPrefixOf(n):ai.isDocumentKey(t.path)?t.path.isEqual(n):t.path.isImmediateParentOf(n)}(t,e)&&function(t,e){for(const n of Lo(t))if(!n.field.isKeyField()&&null===e.data.field(n.field))return!1;return!0}(t,e)&&function(t,e){for(const n of t.filters)if(!n.matches(e))return!1;return!0}(t,e)&&function(t,e){return!(t.startAt&&!function(t,e,n){const s=zi(t,e,n);return t.inclusive?s<=0:s<0}(t.startAt,Lo(t),e))&&!(t.endAt&&!function(t,e,n){const s=zi(t,e,n);return t.inclusive?s>=0:s>0}(t.endAt,Lo(t),e))}(t,e)}function Ho(t){return(e,n)=>{let s=!1;for(const r of Lo(t)){const t=jo(r,e,n);if(0!==t)return t;s=s||r.field.isKeyField()}return 0}}function jo(t,e,n){const s=t.field.isKeyField()?ai.comparator(e.key,n.key):function(t,e,n){const s=e.data.field(t),r=n.data.field(t);return null!==s&&null!==r?Mi(s,r):Ur()}(t.field,e,n);switch(t.dir){case"asc":return s;case"desc":return-1*s;default:return Ur()}}
961
+ */class _a{constructor(t,e=null,n=[],r=[],s=null,i="F",o=null,a=null){this.path=t,this.collectionGroup=e,this.explicitOrderBy=n,this.filters=r,this.limit=s,this.limitType=i,this.startAt=o,this.endAt=a,this.dt=null,this._t=null,this.startAt,this.endAt}}function Ta(t){return new _a(t)}function Ea(t){return 0===t.filters.length&&null===t.limit&&null==t.startAt&&null==t.endAt&&(0===t.explicitOrderBy.length||1===t.explicitOrderBy.length&&t.explicitOrderBy[0].field.isKeyField())}function Sa(t){return t.explicitOrderBy.length>0?t.explicitOrderBy[0].field:null}function Ia(t){for(const e of t.filters){const t=e.getFirstInequalityField();if(null!==t)return t}return null}function ba(t){return null!==t.collectionGroup}function Aa(t){const e=Ni(t);if(null===e.dt){e.dt=[];const t=Ia(e),n=Sa(e);if(null!==t&&null===n)t.isKeyField()||e.dt.push(new sa(t)),e.dt.push(new sa(Ji.keyField(),"asc"));else{let t=!1;for(const n of e.explicitOrderBy)e.dt.push(n),n.field.isKeyField()&&(t=!0);if(!t){const t=e.explicitOrderBy.length>0?e.explicitOrderBy[e.explicitOrderBy.length-1].dir:"asc";e.dt.push(new sa(Ji.keyField(),t))}}}return e.dt}function Ca(t){const e=Ni(t);if(!e._t)if("F"===e.limitType)e._t=ma(e.path,e.collectionGroup,Aa(e),e.filters,e.limit,e.startAt,e.endAt);else{const t=[];for(const n of Aa(e)){const e="desc"===n.dir?"asc":"desc";t.push(new sa(n.field,e))}const n=e.endAt?new Vo(e.endAt.position,e.endAt.inclusive):null,r=e.startAt?new Vo(e.startAt.position,e.startAt.inclusive):null;e._t=ma(e.path,e.collectionGroup,t,e.filters,e.limit,n,r)}return e._t}function ka(t,e){e.getFirstInequalityField(),Ia(t);const n=t.filters.concat([e]);return new _a(t.path,t.collectionGroup,t.explicitOrderBy.slice(),n,t.limit,t.limitType,t.startAt,t.endAt)}function Ra(t,e,n){return new _a(t.path,t.collectionGroup,t.explicitOrderBy.slice(),t.filters.slice(),e,n,t.startAt,t.endAt)}function Na(t,e){return va(Ca(t),Ca(e))&&t.limitType===e.limitType}function Da(t){return`${ya(Ca(t))}|lt:${t.limitType}`}function Oa(t){return`Query(target=${function(t){let e=t.path.canonicalString();return null!==t.collectionGroup&&(e+=" collectionGroup="+t.collectionGroup),t.filters.length>0&&(e+=`, filters: [${t.filters.map((t=>Qo(t))).join(", ")}]`),po(t.limit)||(e+=", limit: "+t.limit),t.orderBy.length>0&&(e+=`, orderBy: [${t.orderBy.map((t=>function(t){return`${t.field.canonicalString()} (${t.dir})`}(t))).join(", ")}]`),t.startAt&&(e+=", startAt: ",e+=t.startAt.inclusive?"b:":"a:",e+=t.startAt.position.map((t=>No(t))).join(",")),t.endAt&&(e+=", endAt: ",e+=t.endAt.inclusive?"a:":"b:",e+=t.endAt.position.map((t=>No(t))).join(",")),`Target(${e})`}(Ca(t))}; limitType=${t.limitType})`}function La(t,e){return e.isFoundDocument()&&function(t,e){const n=e.key.path;return null!==t.collectionGroup?e.key.hasCollectionId(t.collectionGroup)&&t.path.isPrefixOf(n):Xi.isDocumentKey(t.path)?t.path.isEqual(n):t.path.isImmediateParentOf(n)}(t,e)&&function(t,e){for(const n of Aa(t))if(!n.field.isKeyField()&&null===e.data.field(n.field))return!1;return!0}(t,e)&&function(t,e){for(const n of t.filters)if(!n.matches(e))return!1;return!0}(t,e)&&function(t,e){return!(t.startAt&&!function(t,e,n){const r=Bo(t,e,n);return t.inclusive?r<=0:r<0}(t.startAt,Aa(t),e))&&!(t.endAt&&!function(t,e,n){const r=Bo(t,e,n);return t.inclusive?r>=0:r>0}(t.endAt,Aa(t),e))}(t,e)}function Pa(t){return(e,n)=>{let r=!1;for(const s of Aa(t)){const t=Ma(s,e,n);if(0!==t)return t;r=r||s.field.isKeyField()}return 0}}function Ma(t,e,n){const r=t.field.isKeyField()?Xi.comparator(e.key,n.key):function(t,e,n){const r=e.data.field(t),s=n.data.field(t);return null!==r&&null!==s?ko(r,s):ki()}(t.field,e,n);switch(t.dir){case"asc":return r;case"desc":return-1*r;default:return ki()}}
880
962
  /**
881
963
  * @license
882
964
  * Copyright 2020 Google LLC
@@ -892,7 +974,7 @@ class yo{constructor(t){this.comparator=t,this.data=new po(this.comparator)}has(
892
974
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
893
975
  * See the License for the specific language governing permissions and
894
976
  * limitations under the License.
895
- */function qo(t,e){if(t.wt){if(isNaN(e))return{doubleValue:"NaN"};if(e===1/0)return{doubleValue:"Infinity"};if(e===-1/0)return{doubleValue:"-Infinity"}}return{doubleValue:Ii(e)?"-0":e}}function Ko(t){return{integerValue:""+t}}function Go(t,e){return function(t){return"number"==typeof t&&Number.isInteger(t)&&!Ii(t)&&t<=Number.MAX_SAFE_INTEGER&&t>=Number.MIN_SAFE_INTEGER}(e)?Ko(e):qo(t,e)}
977
+ */function xa(t,e){if(t.wt){if(isNaN(e))return{doubleValue:"NaN"};if(e===1/0)return{doubleValue:"Infinity"};if(e===-1/0)return{doubleValue:"-Infinity"}}return{doubleValue:go(e)?"-0":e}}function Ua(t){return{integerValue:""+t}}function Fa(t,e){return function(t){return"number"==typeof t&&Number.isInteger(t)&&!go(t)&&t<=Number.MAX_SAFE_INTEGER&&t>=Number.MIN_SAFE_INTEGER}(e)?Ua(e):xa(t,e)}
896
978
  /**
897
979
  * @license
898
980
  * Copyright 2018 Google LLC
@@ -908,7 +990,7 @@ class yo{constructor(t){this.comparator=t,this.data=new po(this.comparator)}has(
908
990
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
909
991
  * See the License for the specific language governing permissions and
910
992
  * limitations under the License.
911
- */class Wo{constructor(){this._=void 0}}function zo(t,e,n){return t instanceof Qo?function(t,e){const n={fields:{__type__:{stringValue:"server_timestamp"},__local_write_time__:{timestampValue:{seconds:t.seconds,nanos:t.nanoseconds}}}};return e&&(n.fields.__previous_value__=e),{mapValue:n}}(n,e):t instanceof Jo?Yo(t,e):t instanceof Xo?Zo(t,e):function(t,e){const n=function(t,e){return t instanceof ta?Bi(n=e)||function(t){return!!t&&"doubleValue"in t}(n)?e:{integerValue:0}:null;var n}(t,e),s=ea(n)+ea(t.gt);return Bi(n)&&Bi(t.gt)?Ko(s):qo(t.yt,s)}(t,e)}function $o(t,e,n){return t instanceof Jo?Yo(t,e):t instanceof Xo?Zo(t,e):n}class Qo extends Wo{}class Jo extends Wo{constructor(t){super(),this.elements=t}}function Yo(t,e){const n=na(e);for(const e of t.elements)n.some((t=>Li(t,e)))||n.push(e);return{arrayValue:{values:n}}}class Xo extends Wo{constructor(t){super(),this.elements=t}}function Zo(t,e){let n=na(e);for(const e of t.elements)n=n.filter((t=>!Li(t,e)));return{arrayValue:{values:n}}}class ta extends Wo{constructor(t,e){super(),this.yt=t,this.gt=e}}function ea(t){return Ai(t.integerValue||t.doubleValue)}function na(t){return Hi(t)&&t.arrayValue.values?t.arrayValue.values.slice():[]}class sa{constructor(t,e){this.updateTime=t,this.exists=e}static none(){return new sa}static exists(t){return new sa(void 0,t)}static updateTime(t){return new sa(t)}get isNone(){return void 0===this.updateTime&&void 0===this.exists}isEqual(t){return this.exists===t.exists&&(this.updateTime?!!t.updateTime&&this.updateTime.isEqual(t.updateTime):!t.updateTime)}}function ra(t,e){return void 0!==t.updateTime?e.isFoundDocument()&&e.version.isEqual(t.updateTime):void 0===t.exists||t.exists===e.isFoundDocument()}class ia{}function oa(t,e){if(!t.hasLocalMutations||e&&0===e.fields.length)return null;if(null===e)return t.isNoDocument()?new ga(t.key,sa.none()):new ha(t.key,t.data,sa.none());{const n=t.data,s=_o.empty();let r=new yo(oi.comparator);for(let t of e.fields)if(!r.has(t)){let e=n.field(t);null===e&&t.length>1&&(t=t.popLast(),e=n.field(t)),null===e?s.delete(t):s.set(t,e),r=r.add(t)}return new la(t.key,s,new wo(r.toArray()),sa.none())}}function aa(t,e,n){t instanceof ha?function(t,e,n){const s=t.value.clone(),r=fa(t.fieldTransforms,e,n.transformResults);s.setAll(r),e.convertToFoundDocument(n.version,s).setHasCommittedMutations()}(t,e,n):t instanceof la?function(t,e,n){if(!ra(t.precondition,e))return void e.convertToUnknownDocument(n.version);const s=fa(t.fieldTransforms,e,n.transformResults),r=e.data;r.setAll(da(t)),r.setAll(s),e.convertToFoundDocument(n.version,r).setHasCommittedMutations()}(t,e,n):function(t,e,n){e.convertToNoDocument(n.version).setHasCommittedMutations()}(0,e,n)}function ca(t,e,n,s){return t instanceof ha?function(t,e,n,s){if(!ra(t.precondition,e))return n;const r=t.value.clone(),i=pa(t.fieldTransforms,s,e);return r.setAll(i),e.convertToFoundDocument(e.version,r).setHasLocalMutations(),null}(t,e,n,s):t instanceof la?function(t,e,n,s){if(!ra(t.precondition,e))return n;const r=pa(t.fieldTransforms,s,e),i=e.data;return i.setAll(da(t)),i.setAll(r),e.convertToFoundDocument(e.version,i).setHasLocalMutations(),null===n?null:n.unionWith(t.fieldMask.fields).unionWith(t.fieldTransforms.map((t=>t.field)))}(t,e,n,s):function(t,e,n){return ra(t.precondition,e)?(e.convertToNoDocument(e.version).setHasLocalMutations(),null):n}(t,e,n)}function ua(t,e){return t.type===e.type&&!!t.key.isEqual(e.key)&&!!t.precondition.isEqual(e.precondition)&&!!function(t,e){return void 0===t&&void 0===e||!(!t||!e)&&ti(t,e,((t,e)=>function(t,e){return t.field.isEqual(e.field)&&function(t,e){return t instanceof Jo&&e instanceof Jo||t instanceof Xo&&e instanceof Xo?ti(t.elements,e.elements,Li):t instanceof ta&&e instanceof ta?Li(t.gt,e.gt):t instanceof Qo&&e instanceof Qo}(t.transform,e.transform)}(t,e)))}(t.fieldTransforms,e.fieldTransforms)&&(0===t.type?t.value.isEqual(e.value):1!==t.type||t.data.isEqual(e.data)&&t.fieldMask.isEqual(e.fieldMask))}class ha extends ia{constructor(t,e,n,s=[]){super(),this.key=t,this.value=e,this.precondition=n,this.fieldTransforms=s,this.type=0}getFieldMask(){return null}}class la extends ia{constructor(t,e,n,s,r=[]){super(),this.key=t,this.data=e,this.fieldMask=n,this.precondition=s,this.fieldTransforms=r,this.type=1}getFieldMask(){return this.fieldMask}}function da(t){const e=new Map;return t.fieldMask.fields.forEach((n=>{if(!n.isEmpty()){const s=t.data.field(n);e.set(n,s)}})),e}function fa(t,e,n){const s=new Map;Fr(t.length===n.length);for(let r=0;r<n.length;r++){const i=t[r],o=i.transform,a=e.data.field(i.field);s.set(i.field,$o(o,a,n[r]))}return s}function pa(t,e,n){const s=new Map;for(const r of t){const t=r.transform,i=n.data.field(r.field);s.set(r.field,zo(t,i,e))}return s}class ga extends ia{constructor(t,e){super(),this.key=t,this.precondition=e,this.type=2,this.fieldTransforms=[]}getFieldMask(){return null}}
993
+ */class Va{constructor(){this._=void 0}}function Ba(t,e,n){return t instanceof $a?function(t,e){const n={fields:{__type__:{stringValue:"server_timestamp"},__local_write_time__:{timestampValue:{seconds:t.seconds,nanos:t.nanoseconds}}}};return e&&(n.fields.__previous_value__=e),{mapValue:n}}(n,e):t instanceof qa?Ka(t,e):t instanceof Wa?Ga(t,e):function(t,e){const n=ja(t,e),r=Qa(n)+Qa(t.gt);return Lo(n)&&Lo(t.gt)?Ua(r):xa(t.yt,r)}(t,e)}function Ha(t,e,n){return t instanceof qa?Ka(t,e):t instanceof Wa?Ga(t,e):n}function ja(t,e){return t instanceof za?Lo(n=e)||function(t){return!!t&&"doubleValue"in t}(n)?e:{integerValue:0}:null;var n}class $a extends Va{}class qa extends Va{constructor(t){super(),this.elements=t}}function Ka(t,e){const n=Ya(e);for(const e of t.elements)n.some((t=>Ao(t,e)))||n.push(e);return{arrayValue:{values:n}}}class Wa extends Va{constructor(t){super(),this.elements=t}}function Ga(t,e){let n=Ya(e);for(const e of t.elements)n=n.filter((t=>!Ao(t,e)));return{arrayValue:{values:n}}}class za extends Va{constructor(t,e){super(),this.yt=t,this.gt=e}}function Qa(t){return wo(t.integerValue||t.doubleValue)}function Ya(t){return Po(t)&&t.arrayValue.values?t.arrayValue.values.slice():[]}class Ja{constructor(t,e){this.version=t,this.transformResults=e}}class Xa{constructor(t,e){this.updateTime=t,this.exists=e}static none(){return new Xa}static exists(t){return new Xa(void 0,t)}static updateTime(t){return new Xa(t)}get isNone(){return void 0===this.updateTime&&void 0===this.exists}isEqual(t){return this.exists===t.exists&&(this.updateTime?!!t.updateTime&&this.updateTime.isEqual(t.updateTime):!t.updateTime)}}function Za(t,e){return void 0!==t.updateTime?e.isFoundDocument()&&e.version.isEqual(t.updateTime):void 0===t.exists||t.exists===e.isFoundDocument()}class tc{}function ec(t,e){if(!t.hasLocalMutations||e&&0===e.fields.length)return null;if(null===e)return t.isNoDocument()?new lc(t.key,Xa.none()):new oc(t.key,t.data,Xa.none());{const n=t.data,r=da.empty();let s=new ua(Ji.comparator);for(let t of e.fields)if(!s.has(t)){let e=n.field(t);null===e&&t.length>1&&(t=t.popLast(),e=n.field(t)),null===e?r.delete(t):r.set(t,e),s=s.add(t)}return new ac(t.key,r,new la(s.toArray()),Xa.none())}}function nc(t,e,n){t instanceof oc?function(t,e,n){const r=t.value.clone(),s=uc(t.fieldTransforms,e,n.transformResults);r.setAll(s),e.convertToFoundDocument(n.version,r).setHasCommittedMutations()}(t,e,n):t instanceof ac?function(t,e,n){if(!Za(t.precondition,e))return void e.convertToUnknownDocument(n.version);const r=uc(t.fieldTransforms,e,n.transformResults),s=e.data;s.setAll(cc(t)),s.setAll(r),e.convertToFoundDocument(n.version,s).setHasCommittedMutations()}(t,e,n):function(t,e,n){e.convertToNoDocument(n.version).setHasCommittedMutations()}(0,e,n)}function rc(t,e,n,r){return t instanceof oc?function(t,e,n,r){if(!Za(t.precondition,e))return n;const s=t.value.clone(),i=hc(t.fieldTransforms,r,e);return s.setAll(i),e.convertToFoundDocument(e.version,s).setHasLocalMutations(),null}(t,e,n,r):t instanceof ac?function(t,e,n,r){if(!Za(t.precondition,e))return n;const s=hc(t.fieldTransforms,r,e),i=e.data;return i.setAll(cc(t)),i.setAll(s),e.convertToFoundDocument(e.version,i).setHasLocalMutations(),null===n?null:n.unionWith(t.fieldMask.fields).unionWith(t.fieldTransforms.map((t=>t.field)))}(t,e,n,r):function(t,e,n){return Za(t.precondition,e)?(e.convertToNoDocument(e.version).setHasLocalMutations(),null):n}(t,e,n)}function sc(t,e){let n=null;for(const r of t.fieldTransforms){const t=e.data.field(r.field),s=ja(r.transform,t||null);null!=s&&(null===n&&(n=da.empty()),n.set(r.field,s))}return n||null}function ic(t,e){return t.type===e.type&&!!t.key.isEqual(e.key)&&!!t.precondition.isEqual(e.precondition)&&!!function(t,e){return void 0===t&&void 0===e||!(!t||!e)&&Ki(t,e,((t,e)=>function(t,e){return t.field.isEqual(e.field)&&function(t,e){return t instanceof qa&&e instanceof qa||t instanceof Wa&&e instanceof Wa?Ki(t.elements,e.elements,Ao):t instanceof za&&e instanceof za?Ao(t.gt,e.gt):t instanceof $a&&e instanceof $a}(t.transform,e.transform)}(t,e)))}(t.fieldTransforms,e.fieldTransforms)&&(0===t.type?t.value.isEqual(e.value):1!==t.type||t.data.isEqual(e.data)&&t.fieldMask.isEqual(e.fieldMask))}class oc extends tc{constructor(t,e,n,r=[]){super(),this.key=t,this.value=e,this.precondition=n,this.fieldTransforms=r,this.type=0}getFieldMask(){return null}}class ac extends tc{constructor(t,e,n,r,s=[]){super(),this.key=t,this.data=e,this.fieldMask=n,this.precondition=r,this.fieldTransforms=s,this.type=1}getFieldMask(){return this.fieldMask}}function cc(t){const e=new Map;return t.fieldMask.fields.forEach((n=>{if(!n.isEmpty()){const r=t.data.field(n);e.set(n,r)}})),e}function uc(t,e,n){const r=new Map;Ri(t.length===n.length);for(let s=0;s<n.length;s++){const i=t[s],o=i.transform,a=e.data.field(i.field);r.set(i.field,Ha(o,a,n[s]))}return r}function hc(t,e,n){const r=new Map;for(const s of t){const t=s.transform,i=n.data.field(s.field);r.set(s.field,Ba(t,i,e))}return r}class lc extends tc{constructor(t,e){super(),this.key=t,this.precondition=e,this.type=2,this.fieldTransforms=[]}getFieldMask(){return null}}class dc extends tc{constructor(t,e){super(),this.key=t,this.precondition=e,this.type=3,this.fieldTransforms=[]}getFieldMask(){return null}}
912
994
  /**
913
995
  * @license
914
996
  * Copyright 2017 Google LLC
@@ -924,7 +1006,7 @@ class yo{constructor(t){this.comparator=t,this.data=new po(this.comparator)}has(
924
1006
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
925
1007
  * See the License for the specific language governing permissions and
926
1008
  * limitations under the License.
927
- */class ma{constructor(t){this.count=t}}
1009
+ */class fc{constructor(t){this.count=t}}
928
1010
  /**
929
1011
  * @license
930
1012
  * Copyright 2017 Google LLC
@@ -940,7 +1022,7 @@ class yo{constructor(t){this.comparator=t,this.data=new po(this.comparator)}has(
940
1022
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
941
1023
  * See the License for the specific language governing permissions and
942
1024
  * limitations under the License.
943
- */var ya,va;function wa(t){if(void 0===t)return Pr("GRPC error has no .code"),Br.UNKNOWN;switch(t){case ya.OK:return Br.OK;case ya.CANCELLED:return Br.CANCELLED;case ya.UNKNOWN:return Br.UNKNOWN;case ya.DEADLINE_EXCEEDED:return Br.DEADLINE_EXCEEDED;case ya.RESOURCE_EXHAUSTED:return Br.RESOURCE_EXHAUSTED;case ya.INTERNAL:return Br.INTERNAL;case ya.UNAVAILABLE:return Br.UNAVAILABLE;case ya.UNAUTHENTICATED:return Br.UNAUTHENTICATED;case ya.INVALID_ARGUMENT:return Br.INVALID_ARGUMENT;case ya.NOT_FOUND:return Br.NOT_FOUND;case ya.ALREADY_EXISTS:return Br.ALREADY_EXISTS;case ya.PERMISSION_DENIED:return Br.PERMISSION_DENIED;case ya.FAILED_PRECONDITION:return Br.FAILED_PRECONDITION;case ya.ABORTED:return Br.ABORTED;case ya.OUT_OF_RANGE:return Br.OUT_OF_RANGE;case ya.UNIMPLEMENTED:return Br.UNIMPLEMENTED;case ya.DATA_LOSS:return Br.DATA_LOSS;default:return Ur()}}(va=ya||(ya={}))[va.OK=0]="OK",va[va.CANCELLED=1]="CANCELLED",va[va.UNKNOWN=2]="UNKNOWN",va[va.INVALID_ARGUMENT=3]="INVALID_ARGUMENT",va[va.DEADLINE_EXCEEDED=4]="DEADLINE_EXCEEDED",va[va.NOT_FOUND=5]="NOT_FOUND",va[va.ALREADY_EXISTS=6]="ALREADY_EXISTS",va[va.PERMISSION_DENIED=7]="PERMISSION_DENIED",va[va.UNAUTHENTICATED=16]="UNAUTHENTICATED",va[va.RESOURCE_EXHAUSTED=8]="RESOURCE_EXHAUSTED",va[va.FAILED_PRECONDITION=9]="FAILED_PRECONDITION",va[va.ABORTED=10]="ABORTED",va[va.OUT_OF_RANGE=11]="OUT_OF_RANGE",va[va.UNIMPLEMENTED=12]="UNIMPLEMENTED",va[va.INTERNAL=13]="INTERNAL",va[va.UNAVAILABLE=14]="UNAVAILABLE",va[va.DATA_LOSS=15]="DATA_LOSS";
1025
+ */var pc,gc;function mc(t){if(void 0===t)return bi("GRPC error has no .code"),Di.UNKNOWN;switch(t){case pc.OK:return Di.OK;case pc.CANCELLED:return Di.CANCELLED;case pc.UNKNOWN:return Di.UNKNOWN;case pc.DEADLINE_EXCEEDED:return Di.DEADLINE_EXCEEDED;case pc.RESOURCE_EXHAUSTED:return Di.RESOURCE_EXHAUSTED;case pc.INTERNAL:return Di.INTERNAL;case pc.UNAVAILABLE:return Di.UNAVAILABLE;case pc.UNAUTHENTICATED:return Di.UNAUTHENTICATED;case pc.INVALID_ARGUMENT:return Di.INVALID_ARGUMENT;case pc.NOT_FOUND:return Di.NOT_FOUND;case pc.ALREADY_EXISTS:return Di.ALREADY_EXISTS;case pc.PERMISSION_DENIED:return Di.PERMISSION_DENIED;case pc.FAILED_PRECONDITION:return Di.FAILED_PRECONDITION;case pc.ABORTED:return Di.ABORTED;case pc.OUT_OF_RANGE:return Di.OUT_OF_RANGE;case pc.UNIMPLEMENTED:return Di.UNIMPLEMENTED;case pc.DATA_LOSS:return Di.DATA_LOSS;default:return ki()}}(gc=pc||(pc={}))[gc.OK=0]="OK",gc[gc.CANCELLED=1]="CANCELLED",gc[gc.UNKNOWN=2]="UNKNOWN",gc[gc.INVALID_ARGUMENT=3]="INVALID_ARGUMENT",gc[gc.DEADLINE_EXCEEDED=4]="DEADLINE_EXCEEDED",gc[gc.NOT_FOUND=5]="NOT_FOUND",gc[gc.ALREADY_EXISTS=6]="ALREADY_EXISTS",gc[gc.PERMISSION_DENIED=7]="PERMISSION_DENIED",gc[gc.UNAUTHENTICATED=16]="UNAUTHENTICATED",gc[gc.RESOURCE_EXHAUSTED=8]="RESOURCE_EXHAUSTED",gc[gc.FAILED_PRECONDITION=9]="FAILED_PRECONDITION",gc[gc.ABORTED=10]="ABORTED",gc[gc.OUT_OF_RANGE=11]="OUT_OF_RANGE",gc[gc.UNIMPLEMENTED=12]="UNIMPLEMENTED",gc[gc.INTERNAL=13]="INTERNAL",gc[gc.UNAVAILABLE=14]="UNAVAILABLE",gc[gc.DATA_LOSS=15]="DATA_LOSS";
944
1026
  /**
945
1027
  * @license
946
1028
  * Copyright 2017 Google LLC
@@ -957,7 +1039,7 @@ class yo{constructor(t){this.comparator=t,this.data=new po(this.comparator)}has(
957
1039
  * See the License for the specific language governing permissions and
958
1040
  * limitations under the License.
959
1041
  */
960
- class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.innerSize=0}get(t){const e=this.mapKeyFn(t),n=this.inner[e];if(void 0!==n)for(const[e,s]of n)if(this.equalsFn(e,t))return s}has(t){return void 0!==this.get(t)}set(t,e){const n=this.mapKeyFn(t),s=this.inner[n];if(void 0===s)return this.inner[n]=[[t,e]],void this.innerSize++;for(let n=0;n<s.length;n++)if(this.equalsFn(s[n][0],t))return void(s[n]=[t,e]);s.push([t,e]),this.innerSize++}delete(t){const e=this.mapKeyFn(t),n=this.inner[e];if(void 0===n)return!1;for(let s=0;s<n.length;s++)if(this.equalsFn(n[s][0],t))return 1===n.length?delete this.inner[e]:n.splice(s,1),this.innerSize--,!0;return!1}forEach(t){wi(this.inner,((e,n)=>{for(const[e,s]of n)t(e,s)}))}isEmpty(){return _i(this.inner)}size(){return this.innerSize}}
1042
+ class yc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.innerSize=0}get(t){const e=this.mapKeyFn(t),n=this.inner[e];if(void 0!==n)for(const[e,r]of n)if(this.equalsFn(e,t))return r}has(t){return void 0!==this.get(t)}set(t,e){const n=this.mapKeyFn(t),r=this.inner[n];if(void 0===r)return this.inner[n]=[[t,e]],void this.innerSize++;for(let n=0;n<r.length;n++)if(this.equalsFn(r[n][0],t))return void(r[n]=[t,e]);r.push([t,e]),this.innerSize++}delete(t){const e=this.mapKeyFn(t),n=this.inner[e];if(void 0===n)return!1;for(let r=0;r<n.length;r++)if(this.equalsFn(n[r][0],t))return 1===n.length?delete this.inner[e]:n.splice(r,1),this.innerSize--,!0;return!1}forEach(t){lo(this.inner,((e,n)=>{for(const[e,r]of n)t(e,r)}))}isEmpty(){return fo(this.inner)}size(){return this.innerSize}}
961
1043
  /**
962
1044
  * @license
963
1045
  * Copyright 2017 Google LLC
@@ -973,7 +1055,7 @@ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
973
1055
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
974
1056
  * See the License for the specific language governing permissions and
975
1057
  * limitations under the License.
976
- */const Ta=new po(ai.comparator);function Ia(){return Ta}const Ea=new po(ai.comparator);function Sa(...t){let e=Ea;for(const n of t)e=e.insert(n.key,n);return e}function ba(t){let e=Ea;return t.forEach(((t,n)=>e=e.insert(t,n.overlayedDocument))),e}function Aa(){return ka()}function Ca(){return ka()}function ka(){return new _a((t=>t.toString()),((t,e)=>t.isEqual(e)))}new po(ai.comparator);const Na=new yo(ai.comparator);function Ra(...t){let e=Na;for(const n of t)e=e.add(n);return e}const Oa=new yo(Zr);function Da(){return Oa}
1058
+ */const vc=new oa(Xi.comparator);function wc(){return vc}const _c=new oa(Xi.comparator);function Tc(...t){let e=_c;for(const n of t)e=e.insert(n.key,n);return e}function Ec(t){let e=_c;return t.forEach(((t,n)=>e=e.insert(t,n.overlayedDocument))),e}function Sc(){return bc()}function Ic(){return bc()}function bc(){return new yc((t=>t.toString()),((t,e)=>t.isEqual(e)))}const Ac=new oa(Xi.comparator),Cc=new ua(Xi.comparator);function kc(...t){let e=Cc;for(const n of t)e=e.add(n);return e}const Rc=new ua(qi);function Nc(){return Rc}
977
1059
  /**
978
1060
  * @license
979
1061
  * Copyright 2017 Google LLC
@@ -989,7 +1071,7 @@ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
989
1071
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
990
1072
  * See the License for the specific language governing permissions and
991
1073
  * limitations under the License.
992
- */class La{constructor(t,e,n,s,r){this.snapshotVersion=t,this.targetChanges=e,this.targetMismatches=n,this.documentUpdates=s,this.resolvedLimboDocuments=r}static createSynthesizedRemoteEventForCurrentChange(t,e,n){const s=new Map;return s.set(t,Pa.createSynthesizedTargetChangeForCurrentChange(t,e,n)),new La(ni.min(),s,Da(),Ia(),Ra())}}class Pa{constructor(t,e,n,s,r){this.resumeToken=t,this.current=e,this.addedDocuments=n,this.modifiedDocuments=s,this.removedDocuments=r}static createSynthesizedTargetChangeForCurrentChange(t,e,n){return new Pa(n,e,Ra(),Ra(),Ra())}}
1074
+ */class Dc{constructor(t,e,n,r,s){this.snapshotVersion=t,this.targetChanges=e,this.targetMismatches=n,this.documentUpdates=r,this.resolvedLimboDocuments=s}static createSynthesizedRemoteEventForCurrentChange(t,e,n){const r=new Map;return r.set(t,Oc.createSynthesizedTargetChangeForCurrentChange(t,e,n)),new Dc(Gi.min(),r,Nc(),wc(),kc())}}class Oc{constructor(t,e,n,r,s){this.resumeToken=t,this.current=e,this.addedDocuments=n,this.modifiedDocuments=r,this.removedDocuments=s}static createSynthesizedTargetChangeForCurrentChange(t,e,n){return new Oc(n,e,kc(),kc(),kc())}}
993
1075
  /**
994
1076
  * @license
995
1077
  * Copyright 2017 Google LLC
@@ -1005,7 +1087,7 @@ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1005
1087
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1006
1088
  * See the License for the specific language governing permissions and
1007
1089
  * limitations under the License.
1008
- */class Ma{constructor(t,e,n,s){this.It=t,this.removedTargetIds=e,this.key=n,this.Tt=s}}class xa{constructor(t,e){this.targetId=t,this.Et=e}}class Ua{constructor(t,e,n=Ei.EMPTY_BYTE_STRING,s=null){this.state=t,this.targetIds=e,this.resumeToken=n,this.cause=s}}class Fa{constructor(){this.At=0,this.Rt=Ha(),this.bt=Ei.EMPTY_BYTE_STRING,this.Pt=!1,this.vt=!0}get current(){return this.Pt}get resumeToken(){return this.bt}get Vt(){return 0!==this.At}get St(){return this.vt}Dt(t){t.approximateByteSize()>0&&(this.vt=!0,this.bt=t)}Ct(){let t=Ra(),e=Ra(),n=Ra();return this.Rt.forEach(((s,r)=>{switch(r){case 0:t=t.add(s);break;case 2:e=e.add(s);break;case 1:n=n.add(s);break;default:Ur()}})),new Pa(this.bt,this.Pt,t,e,n)}xt(){this.vt=!1,this.Rt=Ha()}Nt(t,e){this.vt=!0,this.Rt=this.Rt.insert(t,e)}kt(t){this.vt=!0,this.Rt=this.Rt.remove(t)}Ot(){this.At+=1}Mt(){this.At-=1}Ft(){this.vt=!0,this.Pt=!0}}class Va{constructor(t){this.$t=t,this.Bt=new Map,this.Lt=Ia(),this.qt=Ba(),this.Ut=new yo(Zr)}Kt(t){for(const e of t.It)t.Tt&&t.Tt.isFoundDocument()?this.Gt(e,t.Tt):this.Qt(e,t.key,t.Tt);for(const e of t.removedTargetIds)this.Qt(e,t.key,t.Tt)}jt(t){this.forEachTarget(t,(e=>{const n=this.Wt(e);switch(t.state){case 0:this.zt(e)&&n.Dt(t.resumeToken);break;case 1:n.Mt(),n.Vt||n.xt(),n.Dt(t.resumeToken);break;case 2:n.Mt(),n.Vt||this.removeTarget(e);break;case 3:this.zt(e)&&(n.Ft(),n.Dt(t.resumeToken));break;case 4:this.zt(e)&&(this.Ht(e),n.Dt(t.resumeToken));break;default:Ur()}}))}forEachTarget(t,e){t.targetIds.length>0?t.targetIds.forEach(e):this.Bt.forEach(((t,n)=>{this.zt(n)&&e(n)}))}Jt(t){const e=t.targetId,n=t.Et.count,s=this.Yt(e);if(s){const t=s.target;if(Ao(t))if(0===n){const n=new ai(t.path);this.Qt(e,n,To.newNoDocument(n,ni.min()))}else Fr(1===n);else this.Xt(e)!==n&&(this.Ht(e),this.Ut=this.Ut.add(e))}}Zt(t){const e=new Map;this.Bt.forEach(((n,s)=>{const r=this.Yt(s);if(r){if(n.current&&Ao(r.target)){const e=new ai(r.target.path);null!==this.Lt.get(e)||this.te(s,e)||this.Qt(s,e,To.newNoDocument(e,t))}n.St&&(e.set(s,n.Ct()),n.xt())}}));let n=Ra();this.qt.forEach(((t,e)=>{let s=!0;e.forEachWhile((t=>{const e=this.Yt(t);return!e||2===e.purpose||(s=!1,!1)})),s&&(n=n.add(t))})),this.Lt.forEach(((e,n)=>n.setReadTime(t)));const s=new La(t,e,this.Ut,this.Lt,n);return this.Lt=Ia(),this.qt=Ba(),this.Ut=new yo(Zr),s}Gt(t,e){if(!this.zt(t))return;const n=this.te(t,e.key)?2:0;this.Wt(t).Nt(e.key,n),this.Lt=this.Lt.insert(e.key,e),this.qt=this.qt.insert(e.key,this.ee(e.key).add(t))}Qt(t,e,n){if(!this.zt(t))return;const s=this.Wt(t);this.te(t,e)?s.Nt(e,1):s.kt(e),this.qt=this.qt.insert(e,this.ee(e).delete(t)),n&&(this.Lt=this.Lt.insert(e,n))}removeTarget(t){this.Bt.delete(t)}Xt(t){const e=this.Wt(t).Ct();return this.$t.getRemoteKeysForTarget(t).size+e.addedDocuments.size-e.removedDocuments.size}Ot(t){this.Wt(t).Ot()}Wt(t){let e=this.Bt.get(t);return e||(e=new Fa,this.Bt.set(t,e)),e}ee(t){let e=this.qt.get(t);return e||(e=new yo(Zr),this.qt=this.qt.insert(t,e)),e}zt(t){const e=null!==this.Yt(t);return e||Lr("WatchChangeAggregator","Detected inactive target",t),e}Yt(t){const e=this.Bt.get(t);return e&&e.Vt?null:this.$t.ne(t)}Ht(t){this.Bt.set(t,new Fa),this.$t.getRemoteKeysForTarget(t).forEach((e=>{this.Qt(t,e,null)}))}te(t,e){return this.$t.getRemoteKeysForTarget(t).has(e)}}function Ba(){return new po(ai.comparator)}function Ha(){return new po(ai.comparator)}
1090
+ */class Lc{constructor(t,e,n,r){this.It=t,this.removedTargetIds=e,this.key=n,this.Tt=r}}class Pc{constructor(t,e){this.targetId=t,this.Et=e}}class Mc{constructor(t,e,n=mo.EMPTY_BYTE_STRING,r=null){this.state=t,this.targetIds=e,this.resumeToken=n,this.cause=r}}class xc{constructor(){this.At=0,this.Rt=Vc(),this.bt=mo.EMPTY_BYTE_STRING,this.Pt=!1,this.vt=!0}get current(){return this.Pt}get resumeToken(){return this.bt}get Vt(){return 0!==this.At}get St(){return this.vt}Dt(t){t.approximateByteSize()>0&&(this.vt=!0,this.bt=t)}Ct(){let t=kc(),e=kc(),n=kc();return this.Rt.forEach(((r,s)=>{switch(s){case 0:t=t.add(r);break;case 2:e=e.add(r);break;case 1:n=n.add(r);break;default:ki()}})),new Oc(this.bt,this.Pt,t,e,n)}xt(){this.vt=!1,this.Rt=Vc()}Nt(t,e){this.vt=!0,this.Rt=this.Rt.insert(t,e)}kt(t){this.vt=!0,this.Rt=this.Rt.remove(t)}Ot(){this.At+=1}Mt(){this.At-=1}Ft(){this.vt=!0,this.Pt=!0}}class Uc{constructor(t){this.$t=t,this.Bt=new Map,this.Lt=wc(),this.qt=Fc(),this.Ut=new ua(qi)}Kt(t){for(const e of t.It)t.Tt&&t.Tt.isFoundDocument()?this.Gt(e,t.Tt):this.Qt(e,t.key,t.Tt);for(const e of t.removedTargetIds)this.Qt(e,t.key,t.Tt)}jt(t){this.forEachTarget(t,(e=>{const n=this.Wt(e);switch(t.state){case 0:this.zt(e)&&n.Dt(t.resumeToken);break;case 1:n.Mt(),n.Vt||n.xt(),n.Dt(t.resumeToken);break;case 2:n.Mt(),n.Vt||this.removeTarget(e);break;case 3:this.zt(e)&&(n.Ft(),n.Dt(t.resumeToken));break;case 4:this.zt(e)&&(this.Ht(e),n.Dt(t.resumeToken));break;default:ki()}}))}forEachTarget(t,e){t.targetIds.length>0?t.targetIds.forEach(e):this.Bt.forEach(((t,n)=>{this.zt(n)&&e(n)}))}Jt(t){const e=t.targetId,n=t.Et.count,r=this.Yt(e);if(r){const t=r.target;if(wa(t))if(0===n){const n=new Xi(t.path);this.Qt(e,n,pa.newNoDocument(n,Gi.min()))}else Ri(1===n);else this.Xt(e)!==n&&(this.Ht(e),this.Ut=this.Ut.add(e))}}Zt(t){const e=new Map;this.Bt.forEach(((n,r)=>{const s=this.Yt(r);if(s){if(n.current&&wa(s.target)){const e=new Xi(s.target.path);null!==this.Lt.get(e)||this.te(r,e)||this.Qt(r,e,pa.newNoDocument(e,t))}n.St&&(e.set(r,n.Ct()),n.xt())}}));let n=kc();this.qt.forEach(((t,e)=>{let r=!0;e.forEachWhile((t=>{const e=this.Yt(t);return!e||2===e.purpose||(r=!1,!1)})),r&&(n=n.add(t))})),this.Lt.forEach(((e,n)=>n.setReadTime(t)));const r=new Dc(t,e,this.Ut,this.Lt,n);return this.Lt=wc(),this.qt=Fc(),this.Ut=new ua(qi),r}Gt(t,e){if(!this.zt(t))return;const n=this.te(t,e.key)?2:0;this.Wt(t).Nt(e.key,n),this.Lt=this.Lt.insert(e.key,e),this.qt=this.qt.insert(e.key,this.ee(e.key).add(t))}Qt(t,e,n){if(!this.zt(t))return;const r=this.Wt(t);this.te(t,e)?r.Nt(e,1):r.kt(e),this.qt=this.qt.insert(e,this.ee(e).delete(t)),n&&(this.Lt=this.Lt.insert(e,n))}removeTarget(t){this.Bt.delete(t)}Xt(t){const e=this.Wt(t).Ct();return this.$t.getRemoteKeysForTarget(t).size+e.addedDocuments.size-e.removedDocuments.size}Ot(t){this.Wt(t).Ot()}Wt(t){let e=this.Bt.get(t);return e||(e=new xc,this.Bt.set(t,e)),e}ee(t){let e=this.qt.get(t);return e||(e=new ua(qi),this.qt=this.qt.insert(t,e)),e}zt(t){const e=null!==this.Yt(t);return e||Ii("WatchChangeAggregator","Detected inactive target",t),e}Yt(t){const e=this.Bt.get(t);return e&&e.Vt?null:this.$t.ne(t)}Ht(t){this.Bt.set(t,new xc),this.$t.getRemoteKeysForTarget(t).forEach((e=>{this.Qt(t,e,null)}))}te(t,e){return this.$t.getRemoteKeysForTarget(t).has(e)}}function Fc(){return new oa(Xi.comparator)}function Vc(){return new oa(Xi.comparator)}
1009
1091
  /**
1010
1092
  * @license
1011
1093
  * Copyright 2017 Google LLC
@@ -1021,7 +1103,7 @@ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1021
1103
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1022
1104
  * See the License for the specific language governing permissions and
1023
1105
  * limitations under the License.
1024
- */const ja={asc:"ASCENDING",desc:"DESCENDING"},qa={"<":"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"},Ka={and:"AND",or:"OR"};class Ga{constructor(t,e){this.databaseId=t,this.wt=e}}function Wa(t,e){return t.wt?`${new Date(1e3*e.seconds).toISOString().replace(/\.\d*/,"").replace("Z","")}.${("000000000"+e.nanoseconds).slice(-9)}Z`:{seconds:""+e.seconds,nanos:e.nanoseconds}}function za(t,e){return t.wt?e.toBase64():e.toUint8Array()}function $a(t){return Fr(!!t),ni.fromTimestamp(function(t){const e=bi(t);return new ei(e.seconds,e.nanos)}(t))}function Qa(t,e){return function(t){return new ri(["projects",t.projectId,"databases",t.database])}(t).child("documents").child(e).canonicalString()}function Ja(t){const e=ri.fromString(t);return Fr(lc(e)),e}function Ya(t,e){const n=Ja(e);if(n.get(1)!==t.databaseId.projectId)throw new Hr(Br.INVALID_ARGUMENT,"Tried to deserialize key from different project: "+n.get(1)+" vs "+t.databaseId.projectId);if(n.get(3)!==t.databaseId.database)throw new Hr(Br.INVALID_ARGUMENT,"Tried to deserialize key from different database: "+n.get(3)+" vs "+t.databaseId.database);return new ai(tc(n))}function Xa(t,e){return Qa(t.databaseId,e)}function Za(t){return new ri(["projects",t.databaseId.projectId,"databases",t.databaseId.database]).canonicalString()}function tc(t){return Fr(t.length>4&&"documents"===t.get(4)),t.popFirst(5)}function ec(t,e){return{documents:[Xa(t,e.path)]}}function nc(t,e){const n={structuredQuery:{}},s=e.path;null!==e.collectionGroup?(n.parent=Xa(t,s),n.structuredQuery.from=[{collectionId:e.collectionGroup,allDescendants:!0}]):(n.parent=Xa(t,s.popLast()),n.structuredQuery.from=[{collectionId:s.lastSegment()}]);const r=function(t){if(0!==t.length)return hc(Yi.create(t,"and"))}(e.filters);r&&(n.structuredQuery.where=r);const i=function(t){if(0!==t.length)return t.map((t=>function(t){return{field:cc(t.field),direction:ic(t.dir)}}(t)))}(e.orderBy);i&&(n.structuredQuery.orderBy=i);const o=function(t,e){return t.wt||Ti(e)?e:{value:e}}(t,e.limit);var a;return null!==o&&(n.structuredQuery.limit=o),e.startAt&&(n.structuredQuery.startAt={before:(a=e.startAt).inclusive,values:a.position}),e.endAt&&(n.structuredQuery.endAt=function(t){return{before:!t.inclusive,values:t.position}}(e.endAt)),n}function sc(t){let e=function(t){const e=Ja(t);return 4===e.length?ri.emptyPath():tc(e)}(t.parent);const n=t.structuredQuery,s=n.from?n.from.length:0;let r=null;if(s>0){Fr(1===s);const t=n.from[0];t.allDescendants?r=t.collectionId:e=e.child(t.collectionId)}let i=[];n.where&&(i=function(t){const e=rc(t);return e instanceof Yi&&Zi(e)?e.getFilters():[e]}(n.where));let o=[];n.orderBy&&(o=n.orderBy.map((t=>function(t){return new lo(uc(t.field),function(t){switch(t){case"ASCENDING":return"asc";case"DESCENDING":return"desc";default:return}}(t.direction))}(t))));let a=null;n.limit&&(a=function(t){let e;return e="object"==typeof t?t.value:t,Ti(e)?null:e}(n.limit));let c=null;n.startAt&&(c=function(t){const e=!!t.before,n=t.values||[];return new Wi(n,e)}(n.startAt));let u=null;return n.endAt&&(u=function(t){const e=!t.before,n=t.values||[];return new Wi(n,e)}(n.endAt)),function(t,e,n,s,r,i,o,a){return new Co(t,e,n,s,r,i,o,a)}(e,r,o,i,a,"F",c,u)}function rc(t){return void 0!==t.unaryFilter?function(t){switch(t.unaryFilter.op){case"IS_NAN":const e=uc(t.unaryFilter.field);return Ji.create(e,"==",{doubleValue:NaN});case"IS_NULL":const n=uc(t.unaryFilter.field);return Ji.create(n,"==",{nullValue:"NULL_VALUE"});case"IS_NOT_NAN":const s=uc(t.unaryFilter.field);return Ji.create(s,"!=",{doubleValue:NaN});case"IS_NOT_NULL":const r=uc(t.unaryFilter.field);return Ji.create(r,"!=",{nullValue:"NULL_VALUE"});default:return Ur()}}(t):void 0!==t.fieldFilter?function(t){return Ji.create(uc(t.fieldFilter.field),function(t){switch(t){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 Ur()}}(t.fieldFilter.op),t.fieldFilter.value)}(t):void 0!==t.compositeFilter?function(t){return Yi.create(t.compositeFilter.filters.map((t=>rc(t))),function(t){switch(t){case"AND":return"and";case"OR":return"or";default:return Ur()}}(t.compositeFilter.op))}(t):Ur()}function ic(t){return ja[t]}function oc(t){return qa[t]}function ac(t){return Ka[t]}function cc(t){return{fieldPath:t.canonicalString()}}function uc(t){return oi.fromServerFormat(t.fieldPath)}function hc(t){return t instanceof Ji?function(t){if("=="===t.op){if(qi(t.value))return{unaryFilter:{field:cc(t.field),op:"IS_NAN"}};if(ji(t.value))return{unaryFilter:{field:cc(t.field),op:"IS_NULL"}}}else if("!="===t.op){if(qi(t.value))return{unaryFilter:{field:cc(t.field),op:"IS_NOT_NAN"}};if(ji(t.value))return{unaryFilter:{field:cc(t.field),op:"IS_NOT_NULL"}}}return{fieldFilter:{field:cc(t.field),op:oc(t.op),value:t.value}}}(t):t instanceof Yi?function(t){const e=t.getFilters().map((t=>hc(t)));return 1===e.length?e[0]:{compositeFilter:{op:ac(t.op),filters:e}}}(t):Ur()}function lc(t){return t.length>=4&&"projects"===t.get(0)&&"databases"===t.get(2)}
1106
+ */const Bc={asc:"ASCENDING",desc:"DESCENDING"},Hc={"<":"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"},jc={and:"AND",or:"OR"};class $c{constructor(t,e){this.databaseId=t,this.wt=e}}function qc(t,e){return t.wt?`${new Date(1e3*e.seconds).toISOString().replace(/\.\d*/,"").replace("Z","")}.${("000000000"+e.nanoseconds).slice(-9)}Z`:{seconds:""+e.seconds,nanos:e.nanoseconds}}function Kc(t,e){return t.wt?e.toBase64():e.toUint8Array()}function Wc(t,e){return qc(t,e.toTimestamp())}function Gc(t){return Ri(!!t),Gi.fromTimestamp(function(t){const e=vo(t);return new Wi(e.seconds,e.nanos)}(t))}function zc(t,e){return function(t){return new Qi(["projects",t.projectId,"databases",t.database])}(t).child("documents").child(e).canonicalString()}function Qc(t){const e=Qi.fromString(t);return Ri(fu(e)),e}function Yc(t,e){return zc(t.databaseId,e.path)}function Jc(t,e){const n=Qc(e);if(n.get(1)!==t.databaseId.projectId)throw new Oi(Di.INVALID_ARGUMENT,"Tried to deserialize key from different project: "+n.get(1)+" vs "+t.databaseId.projectId);if(n.get(3)!==t.databaseId.database)throw new Oi(Di.INVALID_ARGUMENT,"Tried to deserialize key from different database: "+n.get(3)+" vs "+t.databaseId.database);return new Xi(tu(n))}function Xc(t,e){return zc(t.databaseId,e)}function Zc(t){return new Qi(["projects",t.databaseId.projectId,"databases",t.databaseId.database]).canonicalString()}function tu(t){return Ri(t.length>4&&"documents"===t.get(4)),t.popFirst(5)}function eu(t,e,n){return{name:Yc(t,e),fields:n.value.mapValue.fields}}function nu(t,e){return{documents:[Xc(t,e.path)]}}function ru(t,e){const n={structuredQuery:{}},r=e.path;null!==e.collectionGroup?(n.parent=Xc(t,r),n.structuredQuery.from=[{collectionId:e.collectionGroup,allDescendants:!0}]):(n.parent=Xc(t,r.popLast()),n.structuredQuery.from=[{collectionId:r.lastSegment()}]);const s=function(t){if(0!==t.length)return lu(qo.create(t,"and"))}(e.filters);s&&(n.structuredQuery.where=s);const i=function(t){if(0!==t.length)return t.map((t=>function(t){return{field:uu(t.field),direction:ou(t.dir)}}(t)))}(e.orderBy);i&&(n.structuredQuery.orderBy=i);const o=function(t,e){return t.wt||po(e)?e:{value:e}}(t,e.limit);var a;return null!==o&&(n.structuredQuery.limit=o),e.startAt&&(n.structuredQuery.startAt={before:(a=e.startAt).inclusive,values:a.position}),e.endAt&&(n.structuredQuery.endAt=function(t){return{before:!t.inclusive,values:t.position}}(e.endAt)),n}function su(t){let e=function(t){const e=Qc(t);return 4===e.length?Qi.emptyPath():tu(e)}(t.parent);const n=t.structuredQuery,r=n.from?n.from.length:0;let s=null;if(r>0){Ri(1===r);const t=n.from[0];t.allDescendants?s=t.collectionId:e=e.child(t.collectionId)}let i=[];n.where&&(i=function(t){const e=iu(t);return e instanceof qo&&Wo(e)?e.getFilters():[e]}(n.where));let o=[];n.orderBy&&(o=n.orderBy.map((t=>function(t){return new sa(hu(t.field),function(t){switch(t){case"ASCENDING":return"asc";case"DESCENDING":return"desc";default:return}}(t.direction))}(t))));let a=null;n.limit&&(a=function(t){let e;return e="object"==typeof t?t.value:t,po(e)?null:e}(n.limit));let c=null;n.startAt&&(c=function(t){const e=!!t.before,n=t.values||[];return new Vo(n,e)}(n.startAt));let u=null;return n.endAt&&(u=function(t){const e=!t.before,n=t.values||[];return new Vo(n,e)}(n.endAt)),function(t,e,n,r,s,i,o,a){return new _a(t,e,n,r,s,i,o,a)}(e,s,o,i,a,"F",c,u)}function iu(t){return void 0!==t.unaryFilter?function(t){switch(t.unaryFilter.op){case"IS_NAN":const e=hu(t.unaryFilter.field);return $o.create(e,"==",{doubleValue:NaN});case"IS_NULL":const n=hu(t.unaryFilter.field);return $o.create(n,"==",{nullValue:"NULL_VALUE"});case"IS_NOT_NAN":const r=hu(t.unaryFilter.field);return $o.create(r,"!=",{doubleValue:NaN});case"IS_NOT_NULL":const s=hu(t.unaryFilter.field);return $o.create(s,"!=",{nullValue:"NULL_VALUE"});default:return ki()}}(t):void 0!==t.fieldFilter?function(t){return $o.create(hu(t.fieldFilter.field),function(t){switch(t){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 ki()}}(t.fieldFilter.op),t.fieldFilter.value)}(t):void 0!==t.compositeFilter?function(t){return qo.create(t.compositeFilter.filters.map((t=>iu(t))),function(t){switch(t){case"AND":return"and";case"OR":return"or";default:return ki()}}(t.compositeFilter.op))}(t):ki()}function ou(t){return Bc[t]}function au(t){return Hc[t]}function cu(t){return jc[t]}function uu(t){return{fieldPath:t.canonicalString()}}function hu(t){return Ji.fromServerFormat(t.fieldPath)}function lu(t){return t instanceof $o?function(t){if("=="===t.op){if(xo(t.value))return{unaryFilter:{field:uu(t.field),op:"IS_NAN"}};if(Mo(t.value))return{unaryFilter:{field:uu(t.field),op:"IS_NULL"}}}else if("!="===t.op){if(xo(t.value))return{unaryFilter:{field:uu(t.field),op:"IS_NOT_NAN"}};if(Mo(t.value))return{unaryFilter:{field:uu(t.field),op:"IS_NOT_NULL"}}}return{fieldFilter:{field:uu(t.field),op:au(t.op),value:t.value}}}(t):t instanceof qo?function(t){const e=t.getFilters().map((t=>lu(t)));return 1===e.length?e[0]:{compositeFilter:{op:cu(t.op),filters:e}}}(t):ki()}function du(t){const e=[];return t.fields.forEach((t=>e.push(t.canonicalString()))),{fieldPaths:e}}function fu(t){return t.length>=4&&"projects"===t.get(0)&&"databases"===t.get(2)}
1025
1107
  /**
1026
1108
  * @license
1027
1109
  * Copyright 2017 Google LLC
@@ -1037,7 +1119,7 @@ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1037
1119
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1038
1120
  * See the License for the specific language governing permissions and
1039
1121
  * limitations under the License.
1040
- */class dc{constructor(t,e,n,s){this.batchId=t,this.localWriteTime=e,this.baseMutations=n,this.mutations=s}applyToRemoteDocument(t,e){const n=e.mutationResults;for(let e=0;e<this.mutations.length;e++){const s=this.mutations[e];s.key.isEqual(t.key)&&aa(s,t,n[e])}}applyToLocalView(t,e){for(const n of this.baseMutations)n.key.isEqual(t.key)&&(e=ca(n,t,e,this.localWriteTime));for(const n of this.mutations)n.key.isEqual(t.key)&&(e=ca(n,t,e,this.localWriteTime));return e}applyToLocalDocumentSet(t,e){const n=Ca();return this.mutations.forEach((s=>{const r=t.get(s.key),i=r.overlayedDocument;let o=this.applyToLocalView(i,r.mutatedFields);o=e.has(s.key)?null:o;const a=oa(i,o);null!==a&&n.set(s.key,a),i.isValidDocument()||i.convertToNoDocument(ni.min())})),n}keys(){return this.mutations.reduce(((t,e)=>t.add(e.key)),Ra())}isEqual(t){return this.batchId===t.batchId&&ti(this.mutations,t.mutations,((t,e)=>ua(t,e)))&&ti(this.baseMutations,t.baseMutations,((t,e)=>ua(t,e)))}}
1122
+ */class pu{constructor(t,e,n,r){this.batchId=t,this.localWriteTime=e,this.baseMutations=n,this.mutations=r}applyToRemoteDocument(t,e){const n=e.mutationResults;for(let e=0;e<this.mutations.length;e++){const r=this.mutations[e];r.key.isEqual(t.key)&&nc(r,t,n[e])}}applyToLocalView(t,e){for(const n of this.baseMutations)n.key.isEqual(t.key)&&(e=rc(n,t,e,this.localWriteTime));for(const n of this.mutations)n.key.isEqual(t.key)&&(e=rc(n,t,e,this.localWriteTime));return e}applyToLocalDocumentSet(t,e){const n=Ic();return this.mutations.forEach((r=>{const s=t.get(r.key),i=s.overlayedDocument;let o=this.applyToLocalView(i,s.mutatedFields);o=e.has(r.key)?null:o;const a=ec(i,o);null!==a&&n.set(r.key,a),i.isValidDocument()||i.convertToNoDocument(Gi.min())})),n}keys(){return this.mutations.reduce(((t,e)=>t.add(e.key)),kc())}isEqual(t){return this.batchId===t.batchId&&Ki(this.mutations,t.mutations,((t,e)=>ic(t,e)))&&Ki(this.baseMutations,t.baseMutations,((t,e)=>ic(t,e)))}}class gu{constructor(t,e,n,r){this.batch=t,this.commitVersion=e,this.mutationResults=n,this.docVersions=r}static from(t,e,n){Ri(t.mutations.length===n.length);let r=Ac;const s=t.mutations;for(let t=0;t<s.length;t++)r=r.insert(s[t].key,n[t].version);return new gu(t,e,n,r)}}
1041
1123
  /**
1042
1124
  * @license
1043
1125
  * Copyright 2022 Google LLC
@@ -1053,7 +1135,7 @@ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1053
1135
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1054
1136
  * See the License for the specific language governing permissions and
1055
1137
  * limitations under the License.
1056
- */class fc{constructor(t,e){this.largestBatchId=t,this.mutation=e}getKey(){return this.mutation.key}isEqual(t){return null!==t&&this.mutation===t.mutation}toString(){return`Overlay{\n largestBatchId: ${this.largestBatchId},\n mutation: ${this.mutation.toString()}\n }`}}
1138
+ */class mu{constructor(t,e){this.largestBatchId=t,this.mutation=e}getKey(){return this.mutation.key}isEqual(t){return null!==t&&this.mutation===t.mutation}toString(){return`Overlay{\n largestBatchId: ${this.largestBatchId},\n mutation: ${this.mutation.toString()}\n }`}}
1057
1139
  /**
1058
1140
  * @license
1059
1141
  * Copyright 2017 Google LLC
@@ -1069,7 +1151,7 @@ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1069
1151
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1070
1152
  * See the License for the specific language governing permissions and
1071
1153
  * limitations under the License.
1072
- */class pc{constructor(t,e,n,s,r=ni.min(),i=ni.min(),o=Ei.EMPTY_BYTE_STRING){this.target=t,this.targetId=e,this.purpose=n,this.sequenceNumber=s,this.snapshotVersion=r,this.lastLimboFreeSnapshotVersion=i,this.resumeToken=o}withSequenceNumber(t){return new pc(this.target,this.targetId,this.purpose,t,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken)}withResumeToken(t,e){return new pc(this.target,this.targetId,this.purpose,this.sequenceNumber,e,this.lastLimboFreeSnapshotVersion,t)}withLastLimboFreeSnapshotVersion(t){return new pc(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,t,this.resumeToken)}}
1154
+ */class yu{constructor(t,e,n,r,s=Gi.min(),i=Gi.min(),o=mo.EMPTY_BYTE_STRING){this.target=t,this.targetId=e,this.purpose=n,this.sequenceNumber=r,this.snapshotVersion=s,this.lastLimboFreeSnapshotVersion=i,this.resumeToken=o}withSequenceNumber(t){return new yu(this.target,this.targetId,this.purpose,t,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken)}withResumeToken(t,e){return new yu(this.target,this.targetId,this.purpose,this.sequenceNumber,e,this.lastLimboFreeSnapshotVersion,t)}withLastLimboFreeSnapshotVersion(t){return new yu(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,t,this.resumeToken)}}
1073
1155
  /**
1074
1156
  * @license
1075
1157
  * Copyright 2017 Google LLC
@@ -1085,7 +1167,7 @@ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1085
1167
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1086
1168
  * See the License for the specific language governing permissions and
1087
1169
  * limitations under the License.
1088
- */class gc{constructor(t){this.ie=t}}function mc(t){const e=sc({parent:t.parent,structuredQuery:t.structuredQuery});return"LAST"===t.limitType?xo(e,e.limit,"L"):e}
1170
+ */class vu{constructor(t){this.ie=t}}function wu(t){const e=su({parent:t.parent,structuredQuery:t.structuredQuery});return"LAST"===t.limitType?Ra(e,e.limit,"L"):e}
1089
1171
  /**
1090
1172
  * @license
1091
1173
  * Copyright 2019 Google LLC
@@ -1101,7 +1183,7 @@ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1101
1183
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1102
1184
  * See the License for the specific language governing permissions and
1103
1185
  * limitations under the License.
1104
- */class yc{constructor(){this.Je=new vc}addToCollectionParentIndex(t,e){return this.Je.add(e),fi.resolve()}getCollectionParents(t,e){return fi.resolve(this.Je.getEntries(e))}addFieldIndex(t,e){return fi.resolve()}deleteFieldIndex(t,e){return fi.resolve()}getDocumentsMatchingTarget(t,e){return fi.resolve(null)}getIndexType(t,e){return fi.resolve(0)}getFieldIndexes(t,e){return fi.resolve([])}getNextCollectionGroupToUpdate(t){return fi.resolve(null)}getMinOffset(t,e){return fi.resolve(ui.min())}getMinOffsetFromCollectionGroup(t,e){return fi.resolve(ui.min())}updateCollectionGroup(t,e,n){return fi.resolve()}updateIndexEntries(t,e){return fi.resolve()}}class vc{constructor(){this.index={}}add(t){const e=t.lastSegment(),n=t.popLast(),s=this.index[e]||new yo(ri.comparator),r=!s.has(n);return this.index[e]=s.add(n),r}has(t){const e=t.lastSegment(),n=t.popLast(),s=this.index[e];return s&&s.has(n)}getEntries(t){return(this.index[t]||new yo(ri.comparator)).toArray()}}
1186
+ */class _u{constructor(){this.Je=new Tu}addToCollectionParentIndex(t,e){return this.Je.add(e),io.resolve()}getCollectionParents(t,e){return io.resolve(this.Je.getEntries(e))}addFieldIndex(t,e){return io.resolve()}deleteFieldIndex(t,e){return io.resolve()}getDocumentsMatchingTarget(t,e){return io.resolve(null)}getIndexType(t,e){return io.resolve(0)}getFieldIndexes(t,e){return io.resolve([])}getNextCollectionGroupToUpdate(t){return io.resolve(null)}getMinOffset(t,e){return io.resolve(to.min())}getMinOffsetFromCollectionGroup(t,e){return io.resolve(to.min())}updateCollectionGroup(t,e,n){return io.resolve()}updateIndexEntries(t,e){return io.resolve()}}class Tu{constructor(){this.index={}}add(t){const e=t.lastSegment(),n=t.popLast(),r=this.index[e]||new ua(Qi.comparator),s=!r.has(n);return this.index[e]=r.add(n),s}has(t){const e=t.lastSegment(),n=t.popLast(),r=this.index[e];return r&&r.has(n)}getEntries(t){return(this.index[t]||new ua(Qi.comparator)).toArray()}}
1105
1187
  /**
1106
1188
  * @license
1107
1189
  * Copyright 2017 Google LLC
@@ -1117,7 +1199,7 @@ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1117
1199
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1118
1200
  * See the License for the specific language governing permissions and
1119
1201
  * limitations under the License.
1120
- */class wc{constructor(t){this.bn=t}next(){return this.bn+=2,this.bn}static Pn(){return new wc(0)}static vn(){return new wc(-1)}}
1202
+ */class Eu{constructor(t){this.bn=t}next(){return this.bn+=2,this.bn}static Pn(){return new Eu(0)}static vn(){return new Eu(-1)}}
1121
1203
  /**
1122
1204
  * @license
1123
1205
  * Copyright 2017 Google LLC
@@ -1133,7 +1215,7 @@ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1133
1215
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1134
1216
  * See the License for the specific language governing permissions and
1135
1217
  * limitations under the License.
1136
- */class _c{constructor(){this.changes=new _a((t=>t.toString()),((t,e)=>t.isEqual(e))),this.changesApplied=!1}addEntry(t){this.assertNotApplied(),this.changes.set(t.key,t)}removeEntry(t,e){this.assertNotApplied(),this.changes.set(t,To.newInvalidDocument(t).setReadTime(e))}getEntry(t,e){this.assertNotApplied();const n=this.changes.get(e);return void 0!==n?fi.resolve(n):this.getFromCache(t,e)}getEntries(t,e){return this.getAllFromCache(t,e)}apply(t){return this.assertNotApplied(),this.changesApplied=!0,this.applyChanges(t)}assertNotApplied(){}}
1218
+ */class Su{constructor(){this.changes=new yc((t=>t.toString()),((t,e)=>t.isEqual(e))),this.changesApplied=!1}addEntry(t){this.assertNotApplied(),this.changes.set(t.key,t)}removeEntry(t,e){this.assertNotApplied(),this.changes.set(t,pa.newInvalidDocument(t).setReadTime(e))}getEntry(t,e){this.assertNotApplied();const n=this.changes.get(e);return void 0!==n?io.resolve(n):this.getFromCache(t,e)}getEntries(t,e){return this.getAllFromCache(t,e)}apply(t){return this.assertNotApplied(),this.changesApplied=!0,this.applyChanges(t)}assertNotApplied(){}}
1137
1219
  /**
1138
1220
  * @license
1139
1221
  * Copyright 2017 Google LLC
@@ -1165,7 +1247,7 @@ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1165
1247
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1166
1248
  * See the License for the specific language governing permissions and
1167
1249
  * limitations under the License.
1168
- */class Tc{constructor(t,e){this.overlayedDocument=t,this.mutatedFields=e}}
1250
+ */class Iu{constructor(t,e){this.overlayedDocument=t,this.mutatedFields=e}}
1169
1251
  /**
1170
1252
  * @license
1171
1253
  * Copyright 2017 Google LLC
@@ -1181,7 +1263,7 @@ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1181
1263
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1182
1264
  * See the License for the specific language governing permissions and
1183
1265
  * limitations under the License.
1184
- */class Ic{constructor(t,e,n,s){this.remoteDocumentCache=t,this.mutationQueue=e,this.documentOverlayCache=n,this.indexManager=s}getDocument(t,e){let n=null;return this.documentOverlayCache.getOverlay(t,e).next((s=>(n=s,this.remoteDocumentCache.getEntry(t,e)))).next((t=>(null!==n&&ca(n.mutation,t,wo.empty(),ei.now()),t)))}getDocuments(t,e){return this.remoteDocumentCache.getEntries(t,e).next((e=>this.getLocalViewOfDocuments(t,e,Ra()).next((()=>e))))}getLocalViewOfDocuments(t,e,n=Ra()){const s=Aa();return this.populateOverlays(t,s,e).next((()=>this.computeViews(t,e,s,n).next((t=>{let e=Sa();return t.forEach(((t,n)=>{e=e.insert(t,n.overlayedDocument)})),e}))))}getOverlayedDocuments(t,e){const n=Aa();return this.populateOverlays(t,n,e).next((()=>this.computeViews(t,e,n,Ra())))}populateOverlays(t,e,n){const s=[];return n.forEach((t=>{e.has(t)||s.push(t)})),this.documentOverlayCache.getOverlays(t,s).next((t=>{t.forEach(((t,n)=>{e.set(t,n)}))}))}computeViews(t,e,n,s){let r=Ia();const i=ka(),o=ka();return e.forEach(((t,e)=>{const o=n.get(e.key);s.has(e.key)&&(void 0===o||o.mutation instanceof la)?r=r.insert(e.key,e):void 0!==o&&(i.set(e.key,o.mutation.getFieldMask()),ca(o.mutation,e,o.mutation.getFieldMask(),ei.now()))})),this.recalculateAndSaveOverlays(t,r).next((t=>(t.forEach(((t,e)=>i.set(t,e))),e.forEach(((t,e)=>{var n;return o.set(t,new Tc(e,null!==(n=i.get(t))&&void 0!==n?n:null))})),o)))}recalculateAndSaveOverlays(t,e){const n=ka();let s=new po(((t,e)=>t-e)),r=Ra();return this.mutationQueue.getAllMutationBatchesAffectingDocumentKeys(t,e).next((t=>{for(const r of t)r.keys().forEach((t=>{const i=e.get(t);if(null===i)return;let o=n.get(t)||wo.empty();o=r.applyToLocalView(i,o),n.set(t,o);const a=(s.get(r.batchId)||Ra()).add(t);s=s.insert(r.batchId,a)}))})).next((()=>{const i=[],o=s.getReverseIterator();for(;o.hasNext();){const s=o.getNext(),a=s.key,c=s.value,u=Ca();c.forEach((t=>{if(!r.has(t)){const s=oa(e.get(t),n.get(t));null!==s&&u.set(t,s),r=r.add(t)}})),i.push(this.documentOverlayCache.saveOverlays(t,a,u))}return fi.waitFor(i)})).next((()=>n))}recalculateAndSaveOverlaysForDocumentKeys(t,e){return this.remoteDocumentCache.getEntries(t,e).next((e=>this.recalculateAndSaveOverlays(t,e)))}getDocumentsMatchingQuery(t,e,n){return function(t){return ai.isDocumentKey(t.path)&&null===t.collectionGroup&&0===t.filters.length}(e)?this.getDocumentsMatchingDocumentQuery(t,e.path):Do(e)?this.getDocumentsMatchingCollectionGroupQuery(t,e,n):this.getDocumentsMatchingCollectionQuery(t,e,n)}getNextDocuments(t,e,n,s){return this.remoteDocumentCache.getAllFromCollectionGroup(t,e,n,s).next((r=>{const i=s-r.size>0?this.documentOverlayCache.getOverlaysForCollectionGroup(t,e,n.largestBatchId,s-r.size):fi.resolve(Aa());let o=-1,a=r;return i.next((e=>fi.forEach(e,((e,n)=>(o<n.largestBatchId&&(o=n.largestBatchId),r.get(e)?fi.resolve():this.remoteDocumentCache.getEntry(t,e).next((t=>{a=a.insert(e,t)}))))).next((()=>this.populateOverlays(t,e,r))).next((()=>this.computeViews(t,a,e,Ra()))).next((t=>({batchId:o,changes:ba(t)})))))}))}getDocumentsMatchingDocumentQuery(t,e){return this.getDocument(t,new ai(e)).next((t=>{let e=Sa();return t.isFoundDocument()&&(e=e.insert(t.key,t)),e}))}getDocumentsMatchingCollectionGroupQuery(t,e,n){const s=e.collectionGroup;let r=Sa();return this.indexManager.getCollectionParents(t,s).next((i=>fi.forEach(i,(i=>{const o=function(t,e){return new Co(e,null,t.explicitOrderBy.slice(),t.filters.slice(),t.limit,t.limitType,t.startAt,t.endAt)}(e,i.child(s));return this.getDocumentsMatchingCollectionQuery(t,o,n).next((t=>{t.forEach(((t,e)=>{r=r.insert(t,e)}))}))})).next((()=>r))))}getDocumentsMatchingCollectionQuery(t,e,n){let s;return this.remoteDocumentCache.getAllFromCollection(t,e.path,n).next((r=>(s=r,this.documentOverlayCache.getOverlaysForCollection(t,e.path,n.largestBatchId)))).next((t=>{t.forEach(((t,e)=>{const n=e.getKey();null===s.get(n)&&(s=s.insert(n,To.newInvalidDocument(n)))}));let n=Sa();return s.forEach(((s,r)=>{const i=t.get(s);void 0!==i&&ca(i.mutation,r,wo.empty(),ei.now()),Bo(e,r)&&(n=n.insert(s,r))})),n}))}}
1266
+ */class bu{constructor(t,e,n,r){this.remoteDocumentCache=t,this.mutationQueue=e,this.documentOverlayCache=n,this.indexManager=r}getDocument(t,e){let n=null;return this.documentOverlayCache.getOverlay(t,e).next((r=>(n=r,this.remoteDocumentCache.getEntry(t,e)))).next((t=>(null!==n&&rc(n.mutation,t,la.empty(),Wi.now()),t)))}getDocuments(t,e){return this.remoteDocumentCache.getEntries(t,e).next((e=>this.getLocalViewOfDocuments(t,e,kc()).next((()=>e))))}getLocalViewOfDocuments(t,e,n=kc()){const r=Sc();return this.populateOverlays(t,r,e).next((()=>this.computeViews(t,e,r,n).next((t=>{let e=Tc();return t.forEach(((t,n)=>{e=e.insert(t,n.overlayedDocument)})),e}))))}getOverlayedDocuments(t,e){const n=Sc();return this.populateOverlays(t,n,e).next((()=>this.computeViews(t,e,n,kc())))}populateOverlays(t,e,n){const r=[];return n.forEach((t=>{e.has(t)||r.push(t)})),this.documentOverlayCache.getOverlays(t,r).next((t=>{t.forEach(((t,n)=>{e.set(t,n)}))}))}computeViews(t,e,n,r){let s=wc();const i=bc(),o=bc();return e.forEach(((t,e)=>{const o=n.get(e.key);r.has(e.key)&&(void 0===o||o.mutation instanceof ac)?s=s.insert(e.key,e):void 0!==o&&(i.set(e.key,o.mutation.getFieldMask()),rc(o.mutation,e,o.mutation.getFieldMask(),Wi.now()))})),this.recalculateAndSaveOverlays(t,s).next((t=>(t.forEach(((t,e)=>i.set(t,e))),e.forEach(((t,e)=>{var n;return o.set(t,new Iu(e,null!==(n=i.get(t))&&void 0!==n?n:null))})),o)))}recalculateAndSaveOverlays(t,e){const n=bc();let r=new oa(((t,e)=>t-e)),s=kc();return this.mutationQueue.getAllMutationBatchesAffectingDocumentKeys(t,e).next((t=>{for(const s of t)s.keys().forEach((t=>{const i=e.get(t);if(null===i)return;let o=n.get(t)||la.empty();o=s.applyToLocalView(i,o),n.set(t,o);const a=(r.get(s.batchId)||kc()).add(t);r=r.insert(s.batchId,a)}))})).next((()=>{const i=[],o=r.getReverseIterator();for(;o.hasNext();){const r=o.getNext(),a=r.key,c=r.value,u=Ic();c.forEach((t=>{if(!s.has(t)){const r=ec(e.get(t),n.get(t));null!==r&&u.set(t,r),s=s.add(t)}})),i.push(this.documentOverlayCache.saveOverlays(t,a,u))}return io.waitFor(i)})).next((()=>n))}recalculateAndSaveOverlaysForDocumentKeys(t,e){return this.remoteDocumentCache.getEntries(t,e).next((e=>this.recalculateAndSaveOverlays(t,e)))}getDocumentsMatchingQuery(t,e,n){return function(t){return Xi.isDocumentKey(t.path)&&null===t.collectionGroup&&0===t.filters.length}(e)?this.getDocumentsMatchingDocumentQuery(t,e.path):ba(e)?this.getDocumentsMatchingCollectionGroupQuery(t,e,n):this.getDocumentsMatchingCollectionQuery(t,e,n)}getNextDocuments(t,e,n,r){return this.remoteDocumentCache.getAllFromCollectionGroup(t,e,n,r).next((s=>{const i=r-s.size>0?this.documentOverlayCache.getOverlaysForCollectionGroup(t,e,n.largestBatchId,r-s.size):io.resolve(Sc());let o=-1,a=s;return i.next((e=>io.forEach(e,((e,n)=>(o<n.largestBatchId&&(o=n.largestBatchId),s.get(e)?io.resolve():this.remoteDocumentCache.getEntry(t,e).next((t=>{a=a.insert(e,t)}))))).next((()=>this.populateOverlays(t,e,s))).next((()=>this.computeViews(t,a,e,kc()))).next((t=>({batchId:o,changes:Ec(t)})))))}))}getDocumentsMatchingDocumentQuery(t,e){return this.getDocument(t,new Xi(e)).next((t=>{let e=Tc();return t.isFoundDocument()&&(e=e.insert(t.key,t)),e}))}getDocumentsMatchingCollectionGroupQuery(t,e,n){const r=e.collectionGroup;let s=Tc();return this.indexManager.getCollectionParents(t,r).next((i=>io.forEach(i,(i=>{const o=function(t,e){return new _a(e,null,t.explicitOrderBy.slice(),t.filters.slice(),t.limit,t.limitType,t.startAt,t.endAt)}(e,i.child(r));return this.getDocumentsMatchingCollectionQuery(t,o,n).next((t=>{t.forEach(((t,e)=>{s=s.insert(t,e)}))}))})).next((()=>s))))}getDocumentsMatchingCollectionQuery(t,e,n){let r;return this.remoteDocumentCache.getAllFromCollection(t,e.path,n).next((s=>(r=s,this.documentOverlayCache.getOverlaysForCollection(t,e.path,n.largestBatchId)))).next((t=>{t.forEach(((t,e)=>{const n=e.getKey();null===r.get(n)&&(r=r.insert(n,pa.newInvalidDocument(n)))}));let n=Tc();return r.forEach(((r,s)=>{const i=t.get(r);void 0!==i&&rc(i.mutation,s,la.empty(),Wi.now()),La(e,s)&&(n=n.insert(r,s))})),n}))}}
1185
1267
  /**
1186
1268
  * @license
1187
1269
  * Copyright 2020 Google LLC
@@ -1197,7 +1279,7 @@ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1197
1279
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1198
1280
  * See the License for the specific language governing permissions and
1199
1281
  * limitations under the License.
1200
- */class Ec{constructor(t){this.yt=t,this.Zn=new Map,this.ts=new Map}getBundleMetadata(t,e){return fi.resolve(this.Zn.get(e))}saveBundleMetadata(t,e){var n;return this.Zn.set(e.id,{id:(n=e).id,version:n.version,createTime:$a(n.createTime)}),fi.resolve()}getNamedQuery(t,e){return fi.resolve(this.ts.get(e))}saveNamedQuery(t,e){return this.ts.set(e.name,function(t){return{name:t.name,query:mc(t.bundledQuery),readTime:$a(t.readTime)}}(e)),fi.resolve()}}
1282
+ */class Au{constructor(t){this.yt=t,this.Zn=new Map,this.ts=new Map}getBundleMetadata(t,e){return io.resolve(this.Zn.get(e))}saveBundleMetadata(t,e){var n;return this.Zn.set(e.id,{id:(n=e).id,version:n.version,createTime:Gc(n.createTime)}),io.resolve()}getNamedQuery(t,e){return io.resolve(this.ts.get(e))}saveNamedQuery(t,e){return this.ts.set(e.name,function(t){return{name:t.name,query:wu(t.bundledQuery),readTime:Gc(t.readTime)}}(e)),io.resolve()}}
1201
1283
  /**
1202
1284
  * @license
1203
1285
  * Copyright 2022 Google LLC
@@ -1213,7 +1295,7 @@ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1213
1295
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1214
1296
  * See the License for the specific language governing permissions and
1215
1297
  * limitations under the License.
1216
- */class Sc{constructor(){this.overlays=new po(ai.comparator),this.es=new Map}getOverlay(t,e){return fi.resolve(this.overlays.get(e))}getOverlays(t,e){const n=Aa();return fi.forEach(e,(e=>this.getOverlay(t,e).next((t=>{null!==t&&n.set(e,t)})))).next((()=>n))}saveOverlays(t,e,n){return n.forEach(((n,s)=>{this.oe(t,e,s)})),fi.resolve()}removeOverlaysForBatchId(t,e,n){const s=this.es.get(n);return void 0!==s&&(s.forEach((t=>this.overlays=this.overlays.remove(t))),this.es.delete(n)),fi.resolve()}getOverlaysForCollection(t,e,n){const s=Aa(),r=e.length+1,i=new ai(e.child("")),o=this.overlays.getIteratorFrom(i);for(;o.hasNext();){const t=o.getNext().value,i=t.getKey();if(!e.isPrefixOf(i.path))break;i.path.length===r&&t.largestBatchId>n&&s.set(t.getKey(),t)}return fi.resolve(s)}getOverlaysForCollectionGroup(t,e,n,s){let r=new po(((t,e)=>t-e));const i=this.overlays.getIterator();for(;i.hasNext();){const t=i.getNext().value;if(t.getKey().getCollectionGroup()===e&&t.largestBatchId>n){let e=r.get(t.largestBatchId);null===e&&(e=Aa(),r=r.insert(t.largestBatchId,e)),e.set(t.getKey(),t)}}const o=Aa(),a=r.getIterator();for(;a.hasNext()&&(a.getNext().value.forEach(((t,e)=>o.set(t,e))),!(o.size()>=s)););return fi.resolve(o)}oe(t,e,n){const s=this.overlays.get(n.key);if(null!==s){const t=this.es.get(s.largestBatchId).delete(n.key);this.es.set(s.largestBatchId,t)}this.overlays=this.overlays.insert(n.key,new fc(e,n));let r=this.es.get(e);void 0===r&&(r=Ra(),this.es.set(e,r)),this.es.set(e,r.add(n.key))}}
1298
+ */class Cu{constructor(){this.overlays=new oa(Xi.comparator),this.es=new Map}getOverlay(t,e){return io.resolve(this.overlays.get(e))}getOverlays(t,e){const n=Sc();return io.forEach(e,(e=>this.getOverlay(t,e).next((t=>{null!==t&&n.set(e,t)})))).next((()=>n))}saveOverlays(t,e,n){return n.forEach(((n,r)=>{this.oe(t,e,r)})),io.resolve()}removeOverlaysForBatchId(t,e,n){const r=this.es.get(n);return void 0!==r&&(r.forEach((t=>this.overlays=this.overlays.remove(t))),this.es.delete(n)),io.resolve()}getOverlaysForCollection(t,e,n){const r=Sc(),s=e.length+1,i=new Xi(e.child("")),o=this.overlays.getIteratorFrom(i);for(;o.hasNext();){const t=o.getNext().value,i=t.getKey();if(!e.isPrefixOf(i.path))break;i.path.length===s&&t.largestBatchId>n&&r.set(t.getKey(),t)}return io.resolve(r)}getOverlaysForCollectionGroup(t,e,n,r){let s=new oa(((t,e)=>t-e));const i=this.overlays.getIterator();for(;i.hasNext();){const t=i.getNext().value;if(t.getKey().getCollectionGroup()===e&&t.largestBatchId>n){let e=s.get(t.largestBatchId);null===e&&(e=Sc(),s=s.insert(t.largestBatchId,e)),e.set(t.getKey(),t)}}const o=Sc(),a=s.getIterator();for(;a.hasNext()&&(a.getNext().value.forEach(((t,e)=>o.set(t,e))),!(o.size()>=r)););return io.resolve(o)}oe(t,e,n){const r=this.overlays.get(n.key);if(null!==r){const t=this.es.get(r.largestBatchId).delete(n.key);this.es.set(r.largestBatchId,t)}this.overlays=this.overlays.insert(n.key,new mu(e,n));let s=this.es.get(e);void 0===s&&(s=kc(),this.es.set(e,s)),this.es.set(e,s.add(n.key))}}
1217
1299
  /**
1218
1300
  * @license
1219
1301
  * Copyright 2017 Google LLC
@@ -1229,7 +1311,7 @@ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1229
1311
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1230
1312
  * See the License for the specific language governing permissions and
1231
1313
  * limitations under the License.
1232
- */class bc{constructor(){this.ns=new yo(Ac.ss),this.rs=new yo(Ac.os)}isEmpty(){return this.ns.isEmpty()}addReference(t,e){const n=new Ac(t,e);this.ns=this.ns.add(n),this.rs=this.rs.add(n)}us(t,e){t.forEach((t=>this.addReference(t,e)))}removeReference(t,e){this.cs(new Ac(t,e))}hs(t,e){t.forEach((t=>this.removeReference(t,e)))}ls(t){const e=new ai(new ri([])),n=new Ac(e,t),s=new Ac(e,t+1),r=[];return this.rs.forEachInRange([n,s],(t=>{this.cs(t),r.push(t.key)})),r}fs(){this.ns.forEach((t=>this.cs(t)))}cs(t){this.ns=this.ns.delete(t),this.rs=this.rs.delete(t)}ds(t){const e=new ai(new ri([])),n=new Ac(e,t),s=new Ac(e,t+1);let r=Ra();return this.rs.forEachInRange([n,s],(t=>{r=r.add(t.key)})),r}containsKey(t){const e=new Ac(t,0),n=this.ns.firstAfterOrEqual(e);return null!==n&&t.isEqual(n.key)}}class Ac{constructor(t,e){this.key=t,this._s=e}static ss(t,e){return ai.comparator(t.key,e.key)||Zr(t._s,e._s)}static os(t,e){return Zr(t._s,e._s)||ai.comparator(t.key,e.key)}}
1314
+ */class ku{constructor(){this.ns=new ua(Ru.ss),this.rs=new ua(Ru.os)}isEmpty(){return this.ns.isEmpty()}addReference(t,e){const n=new Ru(t,e);this.ns=this.ns.add(n),this.rs=this.rs.add(n)}us(t,e){t.forEach((t=>this.addReference(t,e)))}removeReference(t,e){this.cs(new Ru(t,e))}hs(t,e){t.forEach((t=>this.removeReference(t,e)))}ls(t){const e=new Xi(new Qi([])),n=new Ru(e,t),r=new Ru(e,t+1),s=[];return this.rs.forEachInRange([n,r],(t=>{this.cs(t),s.push(t.key)})),s}fs(){this.ns.forEach((t=>this.cs(t)))}cs(t){this.ns=this.ns.delete(t),this.rs=this.rs.delete(t)}ds(t){const e=new Xi(new Qi([])),n=new Ru(e,t),r=new Ru(e,t+1);let s=kc();return this.rs.forEachInRange([n,r],(t=>{s=s.add(t.key)})),s}containsKey(t){const e=new Ru(t,0),n=this.ns.firstAfterOrEqual(e);return null!==n&&t.isEqual(n.key)}}class Ru{constructor(t,e){this.key=t,this._s=e}static ss(t,e){return Xi.comparator(t.key,e.key)||qi(t._s,e._s)}static os(t,e){return qi(t._s,e._s)||Xi.comparator(t.key,e.key)}}
1233
1315
  /**
1234
1316
  * @license
1235
1317
  * Copyright 2017 Google LLC
@@ -1245,7 +1327,7 @@ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1245
1327
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1246
1328
  * See the License for the specific language governing permissions and
1247
1329
  * limitations under the License.
1248
- */class Cc{constructor(t,e){this.indexManager=t,this.referenceDelegate=e,this.mutationQueue=[],this.ws=1,this.gs=new yo(Ac.ss)}checkEmpty(t){return fi.resolve(0===this.mutationQueue.length)}addMutationBatch(t,e,n,s){const r=this.ws;this.ws++,this.mutationQueue.length>0&&this.mutationQueue[this.mutationQueue.length-1];const i=new dc(r,e,n,s);this.mutationQueue.push(i);for(const e of s)this.gs=this.gs.add(new Ac(e.key,r)),this.indexManager.addToCollectionParentIndex(t,e.key.path.popLast());return fi.resolve(i)}lookupMutationBatch(t,e){return fi.resolve(this.ys(e))}getNextMutationBatchAfterBatchId(t,e){const n=e+1,s=this.ps(n),r=s<0?0:s;return fi.resolve(this.mutationQueue.length>r?this.mutationQueue[r]:null)}getHighestUnacknowledgedBatchId(){return fi.resolve(0===this.mutationQueue.length?-1:this.ws-1)}getAllMutationBatches(t){return fi.resolve(this.mutationQueue.slice())}getAllMutationBatchesAffectingDocumentKey(t,e){const n=new Ac(e,0),s=new Ac(e,Number.POSITIVE_INFINITY),r=[];return this.gs.forEachInRange([n,s],(t=>{const e=this.ys(t._s);r.push(e)})),fi.resolve(r)}getAllMutationBatchesAffectingDocumentKeys(t,e){let n=new yo(Zr);return e.forEach((t=>{const e=new Ac(t,0),s=new Ac(t,Number.POSITIVE_INFINITY);this.gs.forEachInRange([e,s],(t=>{n=n.add(t._s)}))})),fi.resolve(this.Is(n))}getAllMutationBatchesAffectingQuery(t,e){const n=e.path,s=n.length+1;let r=n;ai.isDocumentKey(r)||(r=r.child(""));const i=new Ac(new ai(r),0);let o=new yo(Zr);return this.gs.forEachWhile((t=>{const e=t.key.path;return!!n.isPrefixOf(e)&&(e.length===s&&(o=o.add(t._s)),!0)}),i),fi.resolve(this.Is(o))}Is(t){const e=[];return t.forEach((t=>{const n=this.ys(t);null!==n&&e.push(n)})),e}removeMutationBatch(t,e){Fr(0===this.Ts(e.batchId,"removed")),this.mutationQueue.shift();let n=this.gs;return fi.forEach(e.mutations,(s=>{const r=new Ac(s.key,e.batchId);return n=n.delete(r),this.referenceDelegate.markPotentiallyOrphaned(t,s.key)})).next((()=>{this.gs=n}))}An(t){}containsKey(t,e){const n=new Ac(e,0),s=this.gs.firstAfterOrEqual(n);return fi.resolve(e.isEqual(s&&s.key))}performConsistencyCheck(t){return this.mutationQueue.length,fi.resolve()}Ts(t,e){return this.ps(t)}ps(t){return 0===this.mutationQueue.length?0:t-this.mutationQueue[0].batchId}ys(t){const e=this.ps(t);return e<0||e>=this.mutationQueue.length?null:this.mutationQueue[e]}}
1330
+ */class Nu{constructor(t,e){this.indexManager=t,this.referenceDelegate=e,this.mutationQueue=[],this.ws=1,this.gs=new ua(Ru.ss)}checkEmpty(t){return io.resolve(0===this.mutationQueue.length)}addMutationBatch(t,e,n,r){const s=this.ws;this.ws++,this.mutationQueue.length>0&&this.mutationQueue[this.mutationQueue.length-1];const i=new pu(s,e,n,r);this.mutationQueue.push(i);for(const e of r)this.gs=this.gs.add(new Ru(e.key,s)),this.indexManager.addToCollectionParentIndex(t,e.key.path.popLast());return io.resolve(i)}lookupMutationBatch(t,e){return io.resolve(this.ys(e))}getNextMutationBatchAfterBatchId(t,e){const n=e+1,r=this.ps(n),s=r<0?0:r;return io.resolve(this.mutationQueue.length>s?this.mutationQueue[s]:null)}getHighestUnacknowledgedBatchId(){return io.resolve(0===this.mutationQueue.length?-1:this.ws-1)}getAllMutationBatches(t){return io.resolve(this.mutationQueue.slice())}getAllMutationBatchesAffectingDocumentKey(t,e){const n=new Ru(e,0),r=new Ru(e,Number.POSITIVE_INFINITY),s=[];return this.gs.forEachInRange([n,r],(t=>{const e=this.ys(t._s);s.push(e)})),io.resolve(s)}getAllMutationBatchesAffectingDocumentKeys(t,e){let n=new ua(qi);return e.forEach((t=>{const e=new Ru(t,0),r=new Ru(t,Number.POSITIVE_INFINITY);this.gs.forEachInRange([e,r],(t=>{n=n.add(t._s)}))})),io.resolve(this.Is(n))}getAllMutationBatchesAffectingQuery(t,e){const n=e.path,r=n.length+1;let s=n;Xi.isDocumentKey(s)||(s=s.child(""));const i=new Ru(new Xi(s),0);let o=new ua(qi);return this.gs.forEachWhile((t=>{const e=t.key.path;return!!n.isPrefixOf(e)&&(e.length===r&&(o=o.add(t._s)),!0)}),i),io.resolve(this.Is(o))}Is(t){const e=[];return t.forEach((t=>{const n=this.ys(t);null!==n&&e.push(n)})),e}removeMutationBatch(t,e){Ri(0===this.Ts(e.batchId,"removed")),this.mutationQueue.shift();let n=this.gs;return io.forEach(e.mutations,(r=>{const s=new Ru(r.key,e.batchId);return n=n.delete(s),this.referenceDelegate.markPotentiallyOrphaned(t,r.key)})).next((()=>{this.gs=n}))}An(t){}containsKey(t,e){const n=new Ru(e,0),r=this.gs.firstAfterOrEqual(n);return io.resolve(e.isEqual(r&&r.key))}performConsistencyCheck(t){return this.mutationQueue.length,io.resolve()}Ts(t,e){return this.ps(t)}ps(t){return 0===this.mutationQueue.length?0:t-this.mutationQueue[0].batchId}ys(t){const e=this.ps(t);return e<0||e>=this.mutationQueue.length?null:this.mutationQueue[e]}}
1249
1331
  /**
1250
1332
  * @license
1251
1333
  * Copyright 2017 Google LLC
@@ -1261,7 +1343,7 @@ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1261
1343
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1262
1344
  * See the License for the specific language governing permissions and
1263
1345
  * limitations under the License.
1264
- */class kc{constructor(t){this.Es=t,this.docs=new po(ai.comparator),this.size=0}setIndexManager(t){this.indexManager=t}addEntry(t,e){const n=e.key,s=this.docs.get(n),r=s?s.size:0,i=this.Es(e);return this.docs=this.docs.insert(n,{document:e.mutableCopy(),size:i}),this.size+=i-r,this.indexManager.addToCollectionParentIndex(t,n.path.popLast())}removeEntry(t){const e=this.docs.get(t);e&&(this.docs=this.docs.remove(t),this.size-=e.size)}getEntry(t,e){const n=this.docs.get(e);return fi.resolve(n?n.document.mutableCopy():To.newInvalidDocument(e))}getEntries(t,e){let n=Ia();return e.forEach((t=>{const e=this.docs.get(t);n=n.insert(t,e?e.document.mutableCopy():To.newInvalidDocument(t))})),fi.resolve(n)}getAllFromCollection(t,e,n){let s=Ia();const r=new ai(e.child("")),i=this.docs.getIteratorFrom(r);for(;i.hasNext();){const{key:t,value:{document:r}}=i.getNext();if(!e.isPrefixOf(t.path))break;t.path.length>e.length+1||hi(ci(r),n)<=0||(s=s.insert(r.key,r.mutableCopy()))}return fi.resolve(s)}getAllFromCollectionGroup(t,e,n,s){Ur()}As(t,e){return fi.forEach(this.docs,(t=>e(t)))}newChangeBuffer(t){return new Nc(this)}getSize(t){return fi.resolve(this.size)}}class Nc extends _c{constructor(t){super(),this.Yn=t}applyChanges(t){const e=[];return this.changes.forEach(((n,s)=>{s.isValidDocument()?e.push(this.Yn.addEntry(t,s)):this.Yn.removeEntry(n)})),fi.waitFor(e)}getFromCache(t,e){return this.Yn.getEntry(t,e)}getAllFromCache(t,e){return this.Yn.getEntries(t,e)}}
1346
+ */class Du{constructor(t){this.Es=t,this.docs=new oa(Xi.comparator),this.size=0}setIndexManager(t){this.indexManager=t}addEntry(t,e){const n=e.key,r=this.docs.get(n),s=r?r.size:0,i=this.Es(e);return this.docs=this.docs.insert(n,{document:e.mutableCopy(),size:i}),this.size+=i-s,this.indexManager.addToCollectionParentIndex(t,n.path.popLast())}removeEntry(t){const e=this.docs.get(t);e&&(this.docs=this.docs.remove(t),this.size-=e.size)}getEntry(t,e){const n=this.docs.get(e);return io.resolve(n?n.document.mutableCopy():pa.newInvalidDocument(e))}getEntries(t,e){let n=wc();return e.forEach((t=>{const e=this.docs.get(t);n=n.insert(t,e?e.document.mutableCopy():pa.newInvalidDocument(t))})),io.resolve(n)}getAllFromCollection(t,e,n){let r=wc();const s=new Xi(e.child("")),i=this.docs.getIteratorFrom(s);for(;i.hasNext();){const{key:t,value:{document:s}}=i.getNext();if(!e.isPrefixOf(t.path))break;t.path.length>e.length+1||eo(Zi(s),n)<=0||(r=r.insert(s.key,s.mutableCopy()))}return io.resolve(r)}getAllFromCollectionGroup(t,e,n,r){ki()}As(t,e){return io.forEach(this.docs,(t=>e(t)))}newChangeBuffer(t){return new Ou(this)}getSize(t){return io.resolve(this.size)}}class Ou extends Su{constructor(t){super(),this.Yn=t}applyChanges(t){const e=[];return this.changes.forEach(((n,r)=>{r.isValidDocument()?e.push(this.Yn.addEntry(t,r)):this.Yn.removeEntry(n)})),io.waitFor(e)}getFromCache(t,e){return this.Yn.getEntry(t,e)}getAllFromCache(t,e){return this.Yn.getEntries(t,e)}}
1265
1347
  /**
1266
1348
  * @license
1267
1349
  * Copyright 2017 Google LLC
@@ -1277,7 +1359,7 @@ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1277
1359
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1278
1360
  * See the License for the specific language governing permissions and
1279
1361
  * limitations under the License.
1280
- */class Rc{constructor(t){this.persistence=t,this.Rs=new _a((t=>So(t)),bo),this.lastRemoteSnapshotVersion=ni.min(),this.highestTargetId=0,this.bs=0,this.Ps=new bc,this.targetCount=0,this.vs=wc.Pn()}forEachTarget(t,e){return this.Rs.forEach(((t,n)=>e(n))),fi.resolve()}getLastRemoteSnapshotVersion(t){return fi.resolve(this.lastRemoteSnapshotVersion)}getHighestSequenceNumber(t){return fi.resolve(this.bs)}allocateTargetId(t){return this.highestTargetId=this.vs.next(),fi.resolve(this.highestTargetId)}setTargetsMetadata(t,e,n){return n&&(this.lastRemoteSnapshotVersion=n),e>this.bs&&(this.bs=e),fi.resolve()}Dn(t){this.Rs.set(t.target,t);const e=t.targetId;e>this.highestTargetId&&(this.vs=new wc(e),this.highestTargetId=e),t.sequenceNumber>this.bs&&(this.bs=t.sequenceNumber)}addTargetData(t,e){return this.Dn(e),this.targetCount+=1,fi.resolve()}updateTargetData(t,e){return this.Dn(e),fi.resolve()}removeTargetData(t,e){return this.Rs.delete(e.target),this.Ps.ls(e.targetId),this.targetCount-=1,fi.resolve()}removeTargets(t,e,n){let s=0;const r=[];return this.Rs.forEach(((i,o)=>{o.sequenceNumber<=e&&null===n.get(o.targetId)&&(this.Rs.delete(i),r.push(this.removeMatchingKeysForTargetId(t,o.targetId)),s++)})),fi.waitFor(r).next((()=>s))}getTargetCount(t){return fi.resolve(this.targetCount)}getTargetData(t,e){const n=this.Rs.get(e)||null;return fi.resolve(n)}addMatchingKeys(t,e,n){return this.Ps.us(e,n),fi.resolve()}removeMatchingKeys(t,e,n){this.Ps.hs(e,n);const s=this.persistence.referenceDelegate,r=[];return s&&e.forEach((e=>{r.push(s.markPotentiallyOrphaned(t,e))})),fi.waitFor(r)}removeMatchingKeysForTargetId(t,e){return this.Ps.ls(e),fi.resolve()}getMatchingKeysForTargetId(t,e){const n=this.Ps.ds(e);return fi.resolve(n)}containsKey(t,e){return fi.resolve(this.Ps.containsKey(e))}}
1362
+ */class Lu{constructor(t){this.persistence=t,this.Rs=new yc((t=>ya(t)),va),this.lastRemoteSnapshotVersion=Gi.min(),this.highestTargetId=0,this.bs=0,this.Ps=new ku,this.targetCount=0,this.vs=Eu.Pn()}forEachTarget(t,e){return this.Rs.forEach(((t,n)=>e(n))),io.resolve()}getLastRemoteSnapshotVersion(t){return io.resolve(this.lastRemoteSnapshotVersion)}getHighestSequenceNumber(t){return io.resolve(this.bs)}allocateTargetId(t){return this.highestTargetId=this.vs.next(),io.resolve(this.highestTargetId)}setTargetsMetadata(t,e,n){return n&&(this.lastRemoteSnapshotVersion=n),e>this.bs&&(this.bs=e),io.resolve()}Dn(t){this.Rs.set(t.target,t);const e=t.targetId;e>this.highestTargetId&&(this.vs=new Eu(e),this.highestTargetId=e),t.sequenceNumber>this.bs&&(this.bs=t.sequenceNumber)}addTargetData(t,e){return this.Dn(e),this.targetCount+=1,io.resolve()}updateTargetData(t,e){return this.Dn(e),io.resolve()}removeTargetData(t,e){return this.Rs.delete(e.target),this.Ps.ls(e.targetId),this.targetCount-=1,io.resolve()}removeTargets(t,e,n){let r=0;const s=[];return this.Rs.forEach(((i,o)=>{o.sequenceNumber<=e&&null===n.get(o.targetId)&&(this.Rs.delete(i),s.push(this.removeMatchingKeysForTargetId(t,o.targetId)),r++)})),io.waitFor(s).next((()=>r))}getTargetCount(t){return io.resolve(this.targetCount)}getTargetData(t,e){const n=this.Rs.get(e)||null;return io.resolve(n)}addMatchingKeys(t,e,n){return this.Ps.us(e,n),io.resolve()}removeMatchingKeys(t,e,n){this.Ps.hs(e,n);const r=this.persistence.referenceDelegate,s=[];return r&&e.forEach((e=>{s.push(r.markPotentiallyOrphaned(t,e))})),io.waitFor(s)}removeMatchingKeysForTargetId(t,e){return this.Ps.ls(e),io.resolve()}getMatchingKeysForTargetId(t,e){const n=this.Ps.ds(e);return io.resolve(n)}containsKey(t,e){return io.resolve(this.Ps.containsKey(e))}}
1281
1363
  /**
1282
1364
  * @license
1283
1365
  * Copyright 2017 Google LLC
@@ -1293,7 +1375,7 @@ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1293
1375
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1294
1376
  * See the License for the specific language governing permissions and
1295
1377
  * limitations under the License.
1296
- */class Oc{constructor(t,e){this.Vs={},this.overlays={},this.Ss=new gi(0),this.Ds=!1,this.Ds=!0,this.referenceDelegate=t(this),this.Cs=new Rc(this),this.indexManager=new yc,this.remoteDocumentCache=function(t){return new kc(t)}((t=>this.referenceDelegate.xs(t))),this.yt=new gc(e),this.Ns=new Ec(this.yt)}start(){return Promise.resolve()}shutdown(){return this.Ds=!1,Promise.resolve()}get started(){return this.Ds}setDatabaseDeletedListener(){}setNetworkEnabled(){}getIndexManager(t){return this.indexManager}getDocumentOverlayCache(t){let e=this.overlays[t.toKey()];return e||(e=new Sc,this.overlays[t.toKey()]=e),e}getMutationQueue(t,e){let n=this.Vs[t.toKey()];return n||(n=new Cc(e,this.referenceDelegate),this.Vs[t.toKey()]=n),n}getTargetCache(){return this.Cs}getRemoteDocumentCache(){return this.remoteDocumentCache}getBundleCache(){return this.Ns}runTransaction(t,e,n){Lr("MemoryPersistence","Starting transaction:",t);const s=new Dc(this.Ss.next());return this.referenceDelegate.ks(),n(s).next((t=>this.referenceDelegate.Os(s).next((()=>t)))).toPromise().then((t=>(s.raiseOnCommittedEvent(),t)))}Ms(t,e){return fi.or(Object.values(this.Vs).map((n=>()=>n.containsKey(t,e))))}}class Dc extends li{constructor(t){super(),this.currentSequenceNumber=t}}class Lc{constructor(t){this.persistence=t,this.Fs=new bc,this.$s=null}static Bs(t){return new Lc(t)}get Ls(){if(this.$s)return this.$s;throw Ur()}addReference(t,e,n){return this.Fs.addReference(n,e),this.Ls.delete(n.toString()),fi.resolve()}removeReference(t,e,n){return this.Fs.removeReference(n,e),this.Ls.add(n.toString()),fi.resolve()}markPotentiallyOrphaned(t,e){return this.Ls.add(e.toString()),fi.resolve()}removeTarget(t,e){this.Fs.ls(e.targetId).forEach((t=>this.Ls.add(t.toString())));const n=this.persistence.getTargetCache();return n.getMatchingKeysForTargetId(t,e.targetId).next((t=>{t.forEach((t=>this.Ls.add(t.toString())))})).next((()=>n.removeTargetData(t,e)))}ks(){this.$s=new Set}Os(t){const e=this.persistence.getRemoteDocumentCache().newChangeBuffer();return fi.forEach(this.Ls,(n=>{const s=ai.fromPath(n);return this.qs(t,s).next((t=>{t||e.removeEntry(s,ni.min())}))})).next((()=>(this.$s=null,e.apply(t))))}updateLimboDocument(t,e){return this.qs(t,e).next((t=>{t?this.Ls.delete(e.toString()):this.Ls.add(e.toString())}))}xs(t){return 0}qs(t,e){return fi.or([()=>fi.resolve(this.Fs.containsKey(e)),()=>this.persistence.getTargetCache().containsKey(t,e),()=>this.persistence.Ms(t,e)])}}
1378
+ */class Pu{constructor(t,e){this.Vs={},this.overlays={},this.Ss=new ao(0),this.Ds=!1,this.Ds=!0,this.referenceDelegate=t(this),this.Cs=new Lu(this),this.indexManager=new _u,this.remoteDocumentCache=function(t){return new Du(t)}((t=>this.referenceDelegate.xs(t))),this.yt=new vu(e),this.Ns=new Au(this.yt)}start(){return Promise.resolve()}shutdown(){return this.Ds=!1,Promise.resolve()}get started(){return this.Ds}setDatabaseDeletedListener(){}setNetworkEnabled(){}getIndexManager(t){return this.indexManager}getDocumentOverlayCache(t){let e=this.overlays[t.toKey()];return e||(e=new Cu,this.overlays[t.toKey()]=e),e}getMutationQueue(t,e){let n=this.Vs[t.toKey()];return n||(n=new Nu(e,this.referenceDelegate),this.Vs[t.toKey()]=n),n}getTargetCache(){return this.Cs}getRemoteDocumentCache(){return this.remoteDocumentCache}getBundleCache(){return this.Ns}runTransaction(t,e,n){Ii("MemoryPersistence","Starting transaction:",t);const r=new Mu(this.Ss.next());return this.referenceDelegate.ks(),n(r).next((t=>this.referenceDelegate.Os(r).next((()=>t)))).toPromise().then((t=>(r.raiseOnCommittedEvent(),t)))}Ms(t,e){return io.or(Object.values(this.Vs).map((n=>()=>n.containsKey(t,e))))}}class Mu extends ro{constructor(t){super(),this.currentSequenceNumber=t}}class xu{constructor(t){this.persistence=t,this.Fs=new ku,this.$s=null}static Bs(t){return new xu(t)}get Ls(){if(this.$s)return this.$s;throw ki()}addReference(t,e,n){return this.Fs.addReference(n,e),this.Ls.delete(n.toString()),io.resolve()}removeReference(t,e,n){return this.Fs.removeReference(n,e),this.Ls.add(n.toString()),io.resolve()}markPotentiallyOrphaned(t,e){return this.Ls.add(e.toString()),io.resolve()}removeTarget(t,e){this.Fs.ls(e.targetId).forEach((t=>this.Ls.add(t.toString())));const n=this.persistence.getTargetCache();return n.getMatchingKeysForTargetId(t,e.targetId).next((t=>{t.forEach((t=>this.Ls.add(t.toString())))})).next((()=>n.removeTargetData(t,e)))}ks(){this.$s=new Set}Os(t){const e=this.persistence.getRemoteDocumentCache().newChangeBuffer();return io.forEach(this.Ls,(n=>{const r=Xi.fromPath(n);return this.qs(t,r).next((t=>{t||e.removeEntry(r,Gi.min())}))})).next((()=>(this.$s=null,e.apply(t))))}updateLimboDocument(t,e){return this.qs(t,e).next((t=>{t?this.Ls.delete(e.toString()):this.Ls.add(e.toString())}))}xs(t){return 0}qs(t,e){return io.or([()=>io.resolve(this.Fs.containsKey(e)),()=>this.persistence.getTargetCache().containsKey(t,e),()=>this.persistence.Ms(t,e)])}}
1297
1379
  /**
1298
1380
  * @license
1299
1381
  * Copyright 2017 Google LLC
@@ -1309,7 +1391,7 @@ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1309
1391
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1310
1392
  * See the License for the specific language governing permissions and
1311
1393
  * limitations under the License.
1312
- */class Pc{constructor(t,e,n,s){this.targetId=t,this.fromCache=e,this.Si=n,this.Di=s}static Ci(t,e){let n=Ra(),s=Ra();for(const t of e.docChanges)switch(t.type){case 0:n=n.add(t.doc.key);break;case 1:s=s.add(t.doc.key)}return new Pc(t,e.fromCache,n,s)}}
1394
+ */class Uu{constructor(t,e,n,r){this.targetId=t,this.fromCache=e,this.Si=n,this.Di=r}static Ci(t,e){let n=kc(),r=kc();for(const t of e.docChanges)switch(t.type){case 0:n=n.add(t.doc.key);break;case 1:r=r.add(t.doc.key)}return new Uu(t,e.fromCache,n,r)}}
1313
1395
  /**
1314
1396
  * @license
1315
1397
  * Copyright 2019 Google LLC
@@ -1325,7 +1407,7 @@ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1325
1407
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1326
1408
  * See the License for the specific language governing permissions and
1327
1409
  * limitations under the License.
1328
- */class Mc{constructor(){this.xi=!1}initialize(t,e){this.Ni=t,this.indexManager=e,this.xi=!0}getDocumentsMatchingQuery(t,e,n,s){return this.ki(t,e).next((r=>r||this.Oi(t,e,s,n))).next((n=>n||this.Mi(t,e)))}ki(t,e){if(No(e))return fi.resolve(null);let n=Po(e);return this.indexManager.getIndexType(t,n).next((s=>0===s?null:(null!==e.limit&&1===s&&(e=xo(e,null,"F"),n=Po(e)),this.indexManager.getDocumentsMatchingTarget(t,n).next((s=>{const r=Ra(...s);return this.Ni.getDocuments(t,r).next((s=>this.indexManager.getMinOffset(t,n).next((n=>{const i=this.Fi(e,s);return this.$i(e,i,r,n.readTime)?this.ki(t,xo(e,null,"F")):this.Bi(t,i,e,n)}))))})))))}Oi(t,e,n,s){return No(e)||s.isEqual(ni.min())?this.Mi(t,e):this.Ni.getDocuments(t,n).next((r=>{const i=this.Fi(e,r);return this.$i(e,i,n,s)?this.Mi(t,e):(Dr()<=C.DEBUG&&Lr("QueryEngine","Re-using previous result from %s to execute query: %s",s.toString(),Vo(e)),this.Bi(t,i,e,function(t,e){const n=t.toTimestamp().seconds,s=t.toTimestamp().nanoseconds+1,r=ni.fromTimestamp(1e9===s?new ei(n+1,0):new ei(n,s));return new ui(r,ai.empty(),e)}(s,-1)))}))}Fi(t,e){let n=new yo(Ho(t));return e.forEach(((e,s)=>{Bo(t,s)&&(n=n.add(s))})),n}$i(t,e,n,s){if(null===t.limit)return!1;if(n.size!==e.size)return!0;const r="F"===t.limitType?e.last():e.first();return!!r&&(r.hasPendingWrites||r.version.compareTo(s)>0)}Mi(t,e){return Dr()<=C.DEBUG&&Lr("QueryEngine","Using full collection scan to execute query:",Vo(e)),this.Ni.getDocumentsMatchingQuery(t,e,ui.min())}Bi(t,e,n,s){return this.Ni.getDocumentsMatchingQuery(t,n,s).next((t=>(e.forEach((e=>{t=t.insert(e.key,e)})),t)))}}
1410
+ */class Fu{constructor(){this.xi=!1}initialize(t,e){this.Ni=t,this.indexManager=e,this.xi=!0}getDocumentsMatchingQuery(t,e,n,r){return this.ki(t,e).next((s=>s||this.Oi(t,e,r,n))).next((n=>n||this.Mi(t,e)))}ki(t,e){if(Ea(e))return io.resolve(null);let n=Ca(e);return this.indexManager.getIndexType(t,n).next((r=>0===r?null:(null!==e.limit&&1===r&&(e=Ra(e,null,"F"),n=Ca(e)),this.indexManager.getDocumentsMatchingTarget(t,n).next((r=>{const s=kc(...r);return this.Ni.getDocuments(t,s).next((r=>this.indexManager.getMinOffset(t,n).next((n=>{const i=this.Fi(e,r);return this.$i(e,i,s,n.readTime)?this.ki(t,Ra(e,null,"F")):this.Bi(t,i,e,n)}))))})))))}Oi(t,e,n,r){return Ea(e)||r.isEqual(Gi.min())?this.Mi(t,e):this.Ni.getDocuments(t,n).next((s=>{const i=this.Fi(e,s);return this.$i(e,i,n,r)?this.Mi(t,e):(Si()<=ce.DEBUG&&Ii("QueryEngine","Re-using previous result from %s to execute query: %s",r.toString(),Oa(e)),this.Bi(t,i,e,function(t,e){const n=t.toTimestamp().seconds,r=t.toTimestamp().nanoseconds+1,s=Gi.fromTimestamp(1e9===r?new Wi(n+1,0):new Wi(n,r));return new to(s,Xi.empty(),e)}(r,-1)))}))}Fi(t,e){let n=new ua(Pa(t));return e.forEach(((e,r)=>{La(t,r)&&(n=n.add(r))})),n}$i(t,e,n,r){if(null===t.limit)return!1;if(n.size!==e.size)return!0;const s="F"===t.limitType?e.last():e.first();return!!s&&(s.hasPendingWrites||s.version.compareTo(r)>0)}Mi(t,e){return Si()<=ce.DEBUG&&Ii("QueryEngine","Using full collection scan to execute query:",Oa(e)),this.Ni.getDocumentsMatchingQuery(t,e,to.min())}Bi(t,e,n,r){return this.Ni.getDocumentsMatchingQuery(t,n,r).next((t=>(e.forEach((e=>{t=t.insert(e.key,e)})),t)))}}
1329
1411
  /**
1330
1412
  * @license
1331
1413
  * Copyright 2020 Google LLC
@@ -1341,7 +1423,7 @@ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1341
1423
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1342
1424
  * See the License for the specific language governing permissions and
1343
1425
  * limitations under the License.
1344
- */class xc{constructor(t,e,n,s){this.persistence=t,this.Li=e,this.yt=s,this.qi=new po(Zr),this.Ui=new _a((t=>So(t)),bo),this.Ki=new Map,this.Gi=t.getRemoteDocumentCache(),this.Cs=t.getTargetCache(),this.Ns=t.getBundleCache(),this.Qi(n)}Qi(t){this.documentOverlayCache=this.persistence.getDocumentOverlayCache(t),this.indexManager=this.persistence.getIndexManager(t),this.mutationQueue=this.persistence.getMutationQueue(t,this.indexManager),this.localDocuments=new Ic(this.Gi,this.mutationQueue,this.documentOverlayCache,this.indexManager),this.Gi.setIndexManager(this.indexManager),this.Li.initialize(this.localDocuments,this.indexManager)}collectGarbage(t){return this.persistence.runTransaction("Collect garbage","readwrite-primary",(e=>t.collect(e,this.qi)))}}async function Uc(t,e){const n=Vr(t);return await n.persistence.runTransaction("Handle user change","readonly",(t=>{let s;return n.mutationQueue.getAllMutationBatches(t).next((r=>(s=r,n.Qi(e),n.mutationQueue.getAllMutationBatches(t)))).next((e=>{const r=[],i=[];let o=Ra();for(const t of s){r.push(t.batchId);for(const e of t.mutations)o=o.add(e.key)}for(const t of e){i.push(t.batchId);for(const e of t.mutations)o=o.add(e.key)}return n.localDocuments.getDocuments(t,o).next((t=>({ji:t,removedBatchIds:r,addedBatchIds:i})))}))}))}function Fc(t){const e=Vr(t);return e.persistence.runTransaction("Get last remote snapshot version","readonly",(t=>e.Cs.getLastRemoteSnapshotVersion(t)))}function Vc(t,e){const n=Vr(t),s=e.snapshotVersion;let r=n.qi;return n.persistence.runTransaction("Apply remote event","readwrite-primary",(t=>{const i=n.Gi.newChangeBuffer({trackRemovals:!0});r=n.qi;const o=[];e.targetChanges.forEach(((i,a)=>{const c=r.get(a);if(!c)return;o.push(n.Cs.removeMatchingKeys(t,i.removedDocuments,a).next((()=>n.Cs.addMatchingKeys(t,i.addedDocuments,a))));let u=c.withSequenceNumber(t.currentSequenceNumber);e.targetMismatches.has(a)?u=u.withResumeToken(Ei.EMPTY_BYTE_STRING,ni.min()).withLastLimboFreeSnapshotVersion(ni.min()):i.resumeToken.approximateByteSize()>0&&(u=u.withResumeToken(i.resumeToken,s)),r=r.insert(a,u),function(t,e,n){return 0===t.resumeToken.approximateByteSize()||(e.snapshotVersion.toMicroseconds()-t.snapshotVersion.toMicroseconds()>=3e8||n.addedDocuments.size+n.modifiedDocuments.size+n.removedDocuments.size>0)}(c,u,i)&&o.push(n.Cs.updateTargetData(t,u))}));let a=Ia(),c=Ra();if(e.documentUpdates.forEach((s=>{e.resolvedLimboDocuments.has(s)&&o.push(n.persistence.referenceDelegate.updateLimboDocument(t,s))})),o.push(function(t,e,n){let s=Ra(),r=Ra();return n.forEach((t=>s=s.add(t))),e.getEntries(t,s).next((t=>{let s=Ia();return n.forEach(((n,i)=>{const o=t.get(n);i.isFoundDocument()!==o.isFoundDocument()&&(r=r.add(n)),i.isNoDocument()&&i.version.isEqual(ni.min())?(e.removeEntry(n,i.readTime),s=s.insert(n,i)):!o.isValidDocument()||i.version.compareTo(o.version)>0||0===i.version.compareTo(o.version)&&o.hasPendingWrites?(e.addEntry(i),s=s.insert(n,i)):Lr("LocalStore","Ignoring outdated watch update for ",n,". Current version:",o.version," Watch version:",i.version)})),{Wi:s,zi:r}}))}(t,i,e.documentUpdates).next((t=>{a=t.Wi,c=t.zi}))),!s.isEqual(ni.min())){const e=n.Cs.getLastRemoteSnapshotVersion(t).next((e=>n.Cs.setTargetsMetadata(t,t.currentSequenceNumber,s)));o.push(e)}return fi.waitFor(o).next((()=>i.apply(t))).next((()=>n.localDocuments.getLocalViewOfDocuments(t,a,c))).next((()=>a))})).then((t=>(n.qi=r,t)))}async function Bc(t,e,n){const s=Vr(t),r=s.qi.get(e),i=n?"readwrite":"readwrite-primary";try{n||await s.persistence.runTransaction("Release target",i,(t=>s.persistence.referenceDelegate.removeTarget(t,r)))}catch(t){if(!pi(t))throw t;Lr("LocalStore",`Failed to update sequence numbers for target ${e}: ${t}`)}s.qi=s.qi.remove(e),s.Ui.delete(r.target)}function Hc(t,e,n){const s=Vr(t);let r=ni.min(),i=Ra();return s.persistence.runTransaction("Execute query","readonly",(t=>function(t,e,n){const s=Vr(t),r=s.Ui.get(n);return void 0!==r?fi.resolve(s.qi.get(r)):s.Cs.getTargetData(e,n)}(s,t,Po(e)).next((e=>{if(e)return r=e.lastLimboFreeSnapshotVersion,s.Cs.getMatchingKeysForTargetId(t,e.targetId).next((t=>{i=t}))})).next((()=>s.Li.getDocumentsMatchingQuery(t,e,n?r:ni.min(),n?i:Ra()))).next((t=>(function(t,e,n){let s=t.Ki.get(e)||ni.min();n.forEach(((t,e)=>{e.readTime.compareTo(s)>0&&(s=e.readTime)})),t.Ki.set(e,s)}(s,function(t){return t.collectionGroup||(t.path.length%2==1?t.path.lastSegment():t.path.get(t.path.length-2))}(e),t),{documents:t,Hi:i})))))}class jc{constructor(){this.activeTargetIds=Da()}er(t){this.activeTargetIds=this.activeTargetIds.add(t)}nr(t){this.activeTargetIds=this.activeTargetIds.delete(t)}tr(){const t={activeTargetIds:this.activeTargetIds.toArray(),updateTimeMs:Date.now()};return JSON.stringify(t)}}class qc{constructor(){this.Lr=new jc,this.qr={},this.onlineStateHandler=null,this.sequenceNumberHandler=null}addPendingMutation(t){}updateMutationState(t,e,n){}addLocalQueryTarget(t){return this.Lr.er(t),this.qr[t]||"not-current"}updateQueryState(t,e,n){this.qr[t]=e}removeLocalQueryTarget(t){this.Lr.nr(t)}isLocalQueryTarget(t){return this.Lr.activeTargetIds.has(t)}clearQueryState(t){delete this.qr[t]}getAllActiveQueryTargets(){return this.Lr.activeTargetIds}isActiveQueryTarget(t){return this.Lr.activeTargetIds.has(t)}start(){return this.Lr=new jc,Promise.resolve()}handleUserChange(t,e,n){}setOnlineState(t){}shutdown(){}writeSequenceNumber(t){}notifyBundleLoaded(t){}}
1426
+ */class Vu{constructor(t,e,n,r){this.persistence=t,this.Li=e,this.yt=r,this.qi=new oa(qi),this.Ui=new yc((t=>ya(t)),va),this.Ki=new Map,this.Gi=t.getRemoteDocumentCache(),this.Cs=t.getTargetCache(),this.Ns=t.getBundleCache(),this.Qi(n)}Qi(t){this.documentOverlayCache=this.persistence.getDocumentOverlayCache(t),this.indexManager=this.persistence.getIndexManager(t),this.mutationQueue=this.persistence.getMutationQueue(t,this.indexManager),this.localDocuments=new bu(this.Gi,this.mutationQueue,this.documentOverlayCache,this.indexManager),this.Gi.setIndexManager(this.indexManager),this.Li.initialize(this.localDocuments,this.indexManager)}collectGarbage(t){return this.persistence.runTransaction("Collect garbage","readwrite-primary",(e=>t.collect(e,this.qi)))}}async function Bu(t,e){const n=Ni(t);return await n.persistence.runTransaction("Handle user change","readonly",(t=>{let r;return n.mutationQueue.getAllMutationBatches(t).next((s=>(r=s,n.Qi(e),n.mutationQueue.getAllMutationBatches(t)))).next((e=>{const s=[],i=[];let o=kc();for(const t of r){s.push(t.batchId);for(const e of t.mutations)o=o.add(e.key)}for(const t of e){i.push(t.batchId);for(const e of t.mutations)o=o.add(e.key)}return n.localDocuments.getDocuments(t,o).next((t=>({ji:t,removedBatchIds:s,addedBatchIds:i})))}))}))}function Hu(t){const e=Ni(t);return e.persistence.runTransaction("Get last remote snapshot version","readonly",(t=>e.Cs.getLastRemoteSnapshotVersion(t)))}function ju(t,e){const n=Ni(t),r=e.snapshotVersion;let s=n.qi;return n.persistence.runTransaction("Apply remote event","readwrite-primary",(t=>{const i=n.Gi.newChangeBuffer({trackRemovals:!0});s=n.qi;const o=[];e.targetChanges.forEach(((i,a)=>{const c=s.get(a);if(!c)return;o.push(n.Cs.removeMatchingKeys(t,i.removedDocuments,a).next((()=>n.Cs.addMatchingKeys(t,i.addedDocuments,a))));let u=c.withSequenceNumber(t.currentSequenceNumber);e.targetMismatches.has(a)?u=u.withResumeToken(mo.EMPTY_BYTE_STRING,Gi.min()).withLastLimboFreeSnapshotVersion(Gi.min()):i.resumeToken.approximateByteSize()>0&&(u=u.withResumeToken(i.resumeToken,r)),s=s.insert(a,u),function(t,e,n){return 0===t.resumeToken.approximateByteSize()||(e.snapshotVersion.toMicroseconds()-t.snapshotVersion.toMicroseconds()>=3e8||n.addedDocuments.size+n.modifiedDocuments.size+n.removedDocuments.size>0)}(c,u,i)&&o.push(n.Cs.updateTargetData(t,u))}));let a=wc(),c=kc();if(e.documentUpdates.forEach((r=>{e.resolvedLimboDocuments.has(r)&&o.push(n.persistence.referenceDelegate.updateLimboDocument(t,r))})),o.push(function(t,e,n){let r=kc(),s=kc();return n.forEach((t=>r=r.add(t))),e.getEntries(t,r).next((t=>{let r=wc();return n.forEach(((n,i)=>{const o=t.get(n);i.isFoundDocument()!==o.isFoundDocument()&&(s=s.add(n)),i.isNoDocument()&&i.version.isEqual(Gi.min())?(e.removeEntry(n,i.readTime),r=r.insert(n,i)):!o.isValidDocument()||i.version.compareTo(o.version)>0||0===i.version.compareTo(o.version)&&o.hasPendingWrites?(e.addEntry(i),r=r.insert(n,i)):Ii("LocalStore","Ignoring outdated watch update for ",n,". Current version:",o.version," Watch version:",i.version)})),{Wi:r,zi:s}}))}(t,i,e.documentUpdates).next((t=>{a=t.Wi,c=t.zi}))),!r.isEqual(Gi.min())){const e=n.Cs.getLastRemoteSnapshotVersion(t).next((e=>n.Cs.setTargetsMetadata(t,t.currentSequenceNumber,r)));o.push(e)}return io.waitFor(o).next((()=>i.apply(t))).next((()=>n.localDocuments.getLocalViewOfDocuments(t,a,c))).next((()=>a))})).then((t=>(n.qi=s,t)))}function $u(t,e){const n=Ni(t);return n.persistence.runTransaction("Get next mutation batch","readonly",(t=>(void 0===e&&(e=-1),n.mutationQueue.getNextMutationBatchAfterBatchId(t,e))))}async function qu(t,e,n){const r=Ni(t),s=r.qi.get(e),i=n?"readwrite":"readwrite-primary";try{n||await r.persistence.runTransaction("Release target",i,(t=>r.persistence.referenceDelegate.removeTarget(t,s)))}catch(t){if(!oo(t))throw t;Ii("LocalStore",`Failed to update sequence numbers for target ${e}: ${t}`)}r.qi=r.qi.remove(e),r.Ui.delete(s.target)}function Ku(t,e,n){const r=Ni(t);let s=Gi.min(),i=kc();return r.persistence.runTransaction("Execute query","readonly",(t=>function(t,e,n){const r=Ni(t),s=r.Ui.get(n);return void 0!==s?io.resolve(r.qi.get(s)):r.Cs.getTargetData(e,n)}(r,t,Ca(e)).next((e=>{if(e)return s=e.lastLimboFreeSnapshotVersion,r.Cs.getMatchingKeysForTargetId(t,e.targetId).next((t=>{i=t}))})).next((()=>r.Li.getDocumentsMatchingQuery(t,e,n?s:Gi.min(),n?i:kc()))).next((t=>(function(t,e,n){let r=t.Ki.get(e)||Gi.min();n.forEach(((t,e)=>{e.readTime.compareTo(r)>0&&(r=e.readTime)})),t.Ki.set(e,r)}(r,function(t){return t.collectionGroup||(t.path.length%2==1?t.path.lastSegment():t.path.get(t.path.length-2))}(e),t),{documents:t,Hi:i})))))}class Wu{constructor(){this.activeTargetIds=Nc()}er(t){this.activeTargetIds=this.activeTargetIds.add(t)}nr(t){this.activeTargetIds=this.activeTargetIds.delete(t)}tr(){const t={activeTargetIds:this.activeTargetIds.toArray(),updateTimeMs:Date.now()};return JSON.stringify(t)}}class Gu{constructor(){this.Lr=new Wu,this.qr={},this.onlineStateHandler=null,this.sequenceNumberHandler=null}addPendingMutation(t){}updateMutationState(t,e,n){}addLocalQueryTarget(t){return this.Lr.er(t),this.qr[t]||"not-current"}updateQueryState(t,e,n){this.qr[t]=e}removeLocalQueryTarget(t){this.Lr.nr(t)}isLocalQueryTarget(t){return this.Lr.activeTargetIds.has(t)}clearQueryState(t){delete this.qr[t]}getAllActiveQueryTargets(){return this.Lr.activeTargetIds}isActiveQueryTarget(t){return this.Lr.activeTargetIds.has(t)}start(){return this.Lr=new Wu,Promise.resolve()}handleUserChange(t,e,n){}setOnlineState(t){}shutdown(){}writeSequenceNumber(t){}notifyBundleLoaded(t){}}
1345
1427
  /**
1346
1428
  * @license
1347
1429
  * Copyright 2019 Google LLC
@@ -1357,7 +1439,7 @@ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1357
1439
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1358
1440
  * See the License for the specific language governing permissions and
1359
1441
  * limitations under the License.
1360
- */class Kc{Ur(t){}shutdown(){}}
1442
+ */class zu{Ur(t){}shutdown(){}}
1361
1443
  /**
1362
1444
  * @license
1363
1445
  * Copyright 2019 Google LLC
@@ -1373,7 +1455,7 @@ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1373
1455
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1374
1456
  * See the License for the specific language governing permissions and
1375
1457
  * limitations under the License.
1376
- */class Gc{constructor(){this.Kr=()=>this.Gr(),this.Qr=()=>this.jr(),this.Wr=[],this.zr()}Ur(t){this.Wr.push(t)}shutdown(){window.removeEventListener("online",this.Kr),window.removeEventListener("offline",this.Qr)}zr(){window.addEventListener("online",this.Kr),window.addEventListener("offline",this.Qr)}Gr(){Lr("ConnectivityMonitor","Network connectivity changed: AVAILABLE");for(const t of this.Wr)t(0)}jr(){Lr("ConnectivityMonitor","Network connectivity changed: UNAVAILABLE");for(const t of this.Wr)t(1)}static C(){return"undefined"!=typeof window&&void 0!==window.addEventListener&&void 0!==window.removeEventListener}}
1458
+ */class Qu{constructor(){this.Kr=()=>this.Gr(),this.Qr=()=>this.jr(),this.Wr=[],this.zr()}Ur(t){this.Wr.push(t)}shutdown(){window.removeEventListener("online",this.Kr),window.removeEventListener("offline",this.Qr)}zr(){window.addEventListener("online",this.Kr),window.addEventListener("offline",this.Qr)}Gr(){Ii("ConnectivityMonitor","Network connectivity changed: AVAILABLE");for(const t of this.Wr)t(0)}jr(){Ii("ConnectivityMonitor","Network connectivity changed: UNAVAILABLE");for(const t of this.Wr)t(1)}static C(){return"undefined"!=typeof window&&void 0!==window.addEventListener&&void 0!==window.removeEventListener}}
1377
1459
  /**
1378
1460
  * @license
1379
1461
  * Copyright 2020 Google LLC
@@ -1389,7 +1471,7 @@ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1389
1471
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1390
1472
  * See the License for the specific language governing permissions and
1391
1473
  * limitations under the License.
1392
- */const Wc={BatchGetDocuments:"batchGet",Commit:"commit",RunQuery:"runQuery",RunAggregationQuery:"runAggregationQuery"};
1474
+ */const Yu={BatchGetDocuments:"batchGet",Commit:"commit",RunQuery:"runQuery",RunAggregationQuery:"runAggregationQuery"};
1393
1475
  /**
1394
1476
  * @license
1395
1477
  * Copyright 2017 Google LLC
@@ -1405,7 +1487,7 @@ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1405
1487
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1406
1488
  * See the License for the specific language governing permissions and
1407
1489
  * limitations under the License.
1408
- */class zc{constructor(t){this.Hr=t.Hr,this.Jr=t.Jr}Yr(t){this.Xr=t}Zr(t){this.eo=t}onMessage(t){this.no=t}close(){this.Jr()}send(t){this.Hr(t)}so(){this.Xr()}io(t){this.eo(t)}ro(t){this.no(t)}}
1490
+ */class Ju{constructor(t){this.Hr=t.Hr,this.Jr=t.Jr}Yr(t){this.Xr=t}Zr(t){this.eo=t}onMessage(t){this.no=t}close(){this.Jr()}send(t){this.Hr(t)}so(){this.Xr()}io(t){this.eo(t)}ro(t){this.no(t)}}
1409
1491
  /**
1410
1492
  * @license
1411
1493
  * Copyright 2017 Google LLC
@@ -1421,7 +1503,7 @@ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1421
1503
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1422
1504
  * See the License for the specific language governing permissions and
1423
1505
  * limitations under the License.
1424
- */class $c extends class{constructor(t){this.databaseInfo=t,this.databaseId=t.databaseId;const e=t.ssl?"https":"http";this.oo=e+"://"+t.host,this.uo="projects/"+this.databaseId.projectId+"/databases/"+this.databaseId.database+"/documents"}get co(){return!1}ao(t,e,n,s,r){const i=this.ho(t,e);Lr("RestConnection","Sending: ",i,n);const o={};return this.lo(o,s,r),this.fo(t,i,o,n).then((t=>(Lr("RestConnection","Received: ",t),t)),(e=>{throw Mr("RestConnection",`${t} failed with error: `,e,"url: ",i,"request:",n),e}))}_o(t,e,n,s,r,i){return this.ao(t,e,n,s,r)}lo(t,e,n){t["X-Goog-Api-Client"]="gl-js/ fire/"+Rr,t["Content-Type"]="text/plain",this.databaseInfo.appId&&(t["X-Firebase-GMPID"]=this.databaseInfo.appId),e&&e.headers.forEach(((e,n)=>t[n]=e)),n&&n.headers.forEach(((e,n)=>t[n]=e))}ho(t,e){const n=Wc[t];return`${this.oo}/v1/${e}:${n}`}}{constructor(t){super(t),this.forceLongPolling=t.forceLongPolling,this.autoDetectLongPolling=t.autoDetectLongPolling,this.useFetchStreams=t.useFetchStreams}fo(t,e,n,s){return new Promise(((r,i)=>{const o=new Cr;o.setWithCredentials(!0),o.listenOnce(Tr.COMPLETE,(()=>{try{switch(o.getLastErrorCode()){case _r.NO_ERROR:const e=o.getResponseJson();Lr("Connection","XHR received:",JSON.stringify(e)),r(e);break;case _r.TIMEOUT:Lr("Connection",'RPC "'+t+'" timed out'),i(new Hr(Br.DEADLINE_EXCEEDED,"Request time out"));break;case _r.HTTP_ERROR:const n=o.getStatus();if(Lr("Connection",'RPC "'+t+'" failed with status:',n,"response text:",o.getResponseText()),n>0){let t=o.getResponseJson();Array.isArray(t)&&(t=t[0]);const e=null==t?void 0:t.error;if(e&&e.status&&e.message){const t=function(t){const e=t.toLowerCase().replace(/_/g,"-");return Object.values(Br).indexOf(e)>=0?e:Br.UNKNOWN}(e.status);i(new Hr(t,e.message))}else i(new Hr(Br.UNKNOWN,"Server responded with status "+o.getStatus()))}else i(new Hr(Br.UNAVAILABLE,"Connection failed."));break;default:Ur()}}finally{Lr("Connection",'RPC "'+t+'" completed.')}}));const a=JSON.stringify(s);o.send(e,"POST",a,n,15)}))}wo(t,e,n){const s=[this.oo,"/","google.firestore.v1.Firestore","/",t,"/channel"],r=new gr,i=fn(),o={httpSessionIdParam:"gsessionid",initMessageHeaders:{},messageUrlParams:{database:`projects/${this.databaseId.projectId}/databases/${this.databaseId.database}`},sendRawJson:!0,supportsCrossDomainXhr:!0,internalChannelParams:{forwardChannelRequestTimeoutMs:6e5},forceLongPolling:this.forceLongPolling,detectBufferingProxy:this.autoDetectLongPolling};this.useFetchStreams&&(o.xmlHttpFactory=new br({})),this.lo(o.initMessageHeaders,e,n),o.encodeInitMessageHeaders=!0;const a=s.join("");Lr("Connection","Creating WebChannel: "+a,o);const c=r.createWebChannel(a,o);let u=!1,h=!1;const l=new zc({Hr:t=>{h?Lr("Connection","Not sending because WebChannel is closed:",t):(u||(Lr("Connection","Opening WebChannel transport."),c.open(),u=!0),Lr("Connection","WebChannel sending:",t),c.send(t))},Jr:()=>c.close()}),d=(t,e,n)=>{t.listen(e,(t=>{try{n(t)}catch(t){setTimeout((()=>{throw t}),0)}}))};return d(c,Ar.EventType.OPEN,(()=>{h||Lr("Connection","WebChannel transport opened.")})),d(c,Ar.EventType.CLOSE,(()=>{h||(h=!0,Lr("Connection","WebChannel transport closed"),l.io())})),d(c,Ar.EventType.ERROR,(t=>{h||(h=!0,Mr("Connection","WebChannel transport errored:",t),l.io(new Hr(Br.UNAVAILABLE,"The operation could not be completed")))})),d(c,Ar.EventType.MESSAGE,(t=>{var e;if(!h){const n=t.data[0];Fr(!!n);const s=n,r=s.error||(null===(e=s[0])||void 0===e?void 0:e.error);if(r){Lr("Connection","WebChannel received error:",r);const t=r.status;let e=function(t){const e=ya[t];if(void 0!==e)return wa(e)}(t),n=r.message;void 0===e&&(e=Br.INTERNAL,n="Unknown error status: "+t+" with message "+r.message),h=!0,l.io(new Hr(e,n)),c.close()}else Lr("Connection","WebChannel received:",n),l.ro(n)}})),d(i,Ir.STAT_EVENT,(t=>{t.stat===Er?Lr("Connection","Detected buffering proxy"):t.stat===Sr&&Lr("Connection","Detected no buffering proxy")})),setTimeout((()=>{l.so()}),0),l}}function Qc(){return"undefined"!=typeof document?document:null}
1506
+ */class Xu extends class{constructor(t){this.databaseInfo=t,this.databaseId=t.databaseId;const e=t.ssl?"https":"http";this.oo=e+"://"+t.host,this.uo="projects/"+this.databaseId.projectId+"/databases/"+this.databaseId.database+"/documents"}get co(){return!1}ao(t,e,n,r,s){const i=this.ho(t,e);Ii("RestConnection","Sending: ",i,n);const o={};return this.lo(o,r,s),this.fo(t,i,o,n).then((t=>(Ii("RestConnection","Received: ",t),t)),(e=>{throw Ai("RestConnection",`${t} failed with error: `,e,"url: ",i,"request:",n),e}))}_o(t,e,n,r,s,i){return this.ao(t,e,n,r,s)}lo(t,e,n){t["X-Goog-Api-Client"]="gl-js/ fire/"+Ti,t["Content-Type"]="text/plain",this.databaseInfo.appId&&(t["X-Firebase-GMPID"]=this.databaseInfo.appId),e&&e.headers.forEach(((e,n)=>t[n]=e)),n&&n.headers.forEach(((e,n)=>t[n]=e))}ho(t,e){const n=Yu[t];return`${this.oo}/v1/${e}:${n}`}}{constructor(t){super(t),this.forceLongPolling=t.forceLongPolling,this.autoDetectLongPolling=t.autoDetectLongPolling,this.useFetchStreams=t.useFetchStreams}fo(t,e,n,r){return new Promise(((s,i)=>{const o=new vi;o.setWithCredentials(!0),o.listenOnce(di.COMPLETE,(()=>{try{switch(o.getLastErrorCode()){case li.NO_ERROR:const e=o.getResponseJson();Ii("Connection","XHR received:",JSON.stringify(e)),s(e);break;case li.TIMEOUT:Ii("Connection",'RPC "'+t+'" timed out'),i(new Oi(Di.DEADLINE_EXCEEDED,"Request time out"));break;case li.HTTP_ERROR:const n=o.getStatus();if(Ii("Connection",'RPC "'+t+'" failed with status:',n,"response text:",o.getResponseText()),n>0){let t=o.getResponseJson();Array.isArray(t)&&(t=t[0]);const e=null==t?void 0:t.error;if(e&&e.status&&e.message){const t=function(t){const e=t.toLowerCase().replace(/_/g,"-");return Object.values(Di).indexOf(e)>=0?e:Di.UNKNOWN}(e.status);i(new Oi(t,e.message))}else i(new Oi(Di.UNKNOWN,"Server responded with status "+o.getStatus()))}else i(new Oi(Di.UNAVAILABLE,"Connection failed."));break;default:ki()}}finally{Ii("Connection",'RPC "'+t+'" completed.')}}));const a=JSON.stringify(r);o.send(e,"POST",a,n,15)}))}wo(t,e,n){const r=[this.oo,"/","google.firestore.v1.Firestore","/",t,"/channel"],s=new oi,i=sr(),o={httpSessionIdParam:"gsessionid",initMessageHeaders:{},messageUrlParams:{database:`projects/${this.databaseId.projectId}/databases/${this.databaseId.database}`},sendRawJson:!0,supportsCrossDomainXhr:!0,internalChannelParams:{forwardChannelRequestTimeoutMs:6e5},forceLongPolling:this.forceLongPolling,detectBufferingProxy:this.autoDetectLongPolling};this.useFetchStreams&&(o.xmlHttpFactory=new mi({})),this.lo(o.initMessageHeaders,e,n),o.encodeInitMessageHeaders=!0;const a=r.join("");Ii("Connection","Creating WebChannel: "+a,o);const c=s.createWebChannel(a,o);let u=!1,h=!1;const l=new Ju({Hr:t=>{h?Ii("Connection","Not sending because WebChannel is closed:",t):(u||(Ii("Connection","Opening WebChannel transport."),c.open(),u=!0),Ii("Connection","WebChannel sending:",t),c.send(t))},Jr:()=>c.close()}),d=(t,e,n)=>{t.listen(e,(t=>{try{n(t)}catch(t){setTimeout((()=>{throw t}),0)}}))};return d(c,yi.EventType.OPEN,(()=>{h||Ii("Connection","WebChannel transport opened.")})),d(c,yi.EventType.CLOSE,(()=>{h||(h=!0,Ii("Connection","WebChannel transport closed"),l.io())})),d(c,yi.EventType.ERROR,(t=>{h||(h=!0,Ai("Connection","WebChannel transport errored:",t),l.io(new Oi(Di.UNAVAILABLE,"The operation could not be completed")))})),d(c,yi.EventType.MESSAGE,(t=>{var e;if(!h){const n=t.data[0];Ri(!!n);const r=n,s=r.error||(null===(e=r[0])||void 0===e?void 0:e.error);if(s){Ii("Connection","WebChannel received error:",s);const t=s.status;let e=function(t){const e=pc[t];if(void 0!==e)return mc(e)}(t),n=s.message;void 0===e&&(e=Di.INTERNAL,n="Unknown error status: "+t+" with message "+s.message),h=!0,l.io(new Oi(e,n)),c.close()}else Ii("Connection","WebChannel received:",n),l.ro(n)}})),d(i,fi.STAT_EVENT,(t=>{t.stat===pi?Ii("Connection","Detected buffering proxy"):t.stat===gi&&Ii("Connection","Detected no buffering proxy")})),setTimeout((()=>{l.so()}),0),l}}function Zu(){return"undefined"!=typeof document?document:null}
1425
1507
  /**
1426
1508
  * @license
1427
1509
  * Copyright 2020 Google LLC
@@ -1437,7 +1519,7 @@ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1437
1519
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1438
1520
  * See the License for the specific language governing permissions and
1439
1521
  * limitations under the License.
1440
- */function Jc(t){return new Ga(t,!0)}class Yc{constructor(t,e,n=1e3,s=1.5,r=6e4){this.Hs=t,this.timerId=e,this.mo=n,this.yo=s,this.po=r,this.Io=0,this.To=null,this.Eo=Date.now(),this.reset()}reset(){this.Io=0}Ao(){this.Io=this.po}Ro(t){this.cancel();const e=Math.floor(this.Io+this.bo()),n=Math.max(0,Date.now()-this.Eo),s=Math.max(0,e-n);s>0&&Lr("ExponentialBackoff",`Backing off for ${s} ms (base delay: ${this.Io} ms, delay with jitter: ${e} ms, last attempt: ${n} ms ago)`),this.To=this.Hs.enqueueAfterDelay(this.timerId,s,(()=>(this.Eo=Date.now(),t()))),this.Io*=this.yo,this.Io<this.mo&&(this.Io=this.mo),this.Io>this.po&&(this.Io=this.po)}Po(){null!==this.To&&(this.To.skipDelay(),this.To=null)}cancel(){null!==this.To&&(this.To.cancel(),this.To=null)}bo(){return(Math.random()-.5)*this.Io}}
1522
+ */function th(t){return new $c(t,!0)}class eh{constructor(t,e,n=1e3,r=1.5,s=6e4){this.Hs=t,this.timerId=e,this.mo=n,this.yo=r,this.po=s,this.Io=0,this.To=null,this.Eo=Date.now(),this.reset()}reset(){this.Io=0}Ao(){this.Io=this.po}Ro(t){this.cancel();const e=Math.floor(this.Io+this.bo()),n=Math.max(0,Date.now()-this.Eo),r=Math.max(0,e-n);r>0&&Ii("ExponentialBackoff",`Backing off for ${r} ms (base delay: ${this.Io} ms, delay with jitter: ${e} ms, last attempt: ${n} ms ago)`),this.To=this.Hs.enqueueAfterDelay(this.timerId,r,(()=>(this.Eo=Date.now(),t()))),this.Io*=this.yo,this.Io<this.mo&&(this.Io=this.mo),this.Io>this.po&&(this.Io=this.po)}Po(){null!==this.To&&(this.To.skipDelay(),this.To=null)}cancel(){null!==this.To&&(this.To.cancel(),this.To=null)}bo(){return(Math.random()-.5)*this.Io}}
1441
1523
  /**
1442
1524
  * @license
1443
1525
  * Copyright 2017 Google LLC
@@ -1453,7 +1535,7 @@ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1453
1535
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1454
1536
  * See the License for the specific language governing permissions and
1455
1537
  * limitations under the License.
1456
- */class Xc{constructor(t,e,n,s,r,i,o,a){this.Hs=t,this.vo=n,this.Vo=s,this.connection=r,this.authCredentialsProvider=i,this.appCheckCredentialsProvider=o,this.listener=a,this.state=0,this.So=0,this.Do=null,this.Co=null,this.stream=null,this.xo=new Yc(t,e)}No(){return 1===this.state||5===this.state||this.ko()}ko(){return 2===this.state||3===this.state}start(){4!==this.state?this.auth():this.Oo()}async stop(){this.No()&&await this.close(0)}Mo(){this.state=0,this.xo.reset()}Fo(){this.ko()&&null===this.Do&&(this.Do=this.Hs.enqueueAfterDelay(this.vo,6e4,(()=>this.$o())))}Bo(t){this.Lo(),this.stream.send(t)}async $o(){if(this.ko())return this.close(0)}Lo(){this.Do&&(this.Do.cancel(),this.Do=null)}qo(){this.Co&&(this.Co.cancel(),this.Co=null)}async close(t,e){this.Lo(),this.qo(),this.xo.cancel(),this.So++,4!==t?this.xo.reset():e&&e.code===Br.RESOURCE_EXHAUSTED?(Pr(e.toString()),Pr("Using maximum backoff delay to prevent overloading the backend."),this.xo.Ao()):e&&e.code===Br.UNAUTHENTICATED&&3!==this.state&&(this.authCredentialsProvider.invalidateToken(),this.appCheckCredentialsProvider.invalidateToken()),null!==this.stream&&(this.Uo(),this.stream.close(),this.stream=null),this.state=t,await this.listener.Zr(e)}Uo(){}auth(){this.state=1;const t=this.Ko(this.So),e=this.So;Promise.all([this.authCredentialsProvider.getToken(),this.appCheckCredentialsProvider.getToken()]).then((([t,n])=>{this.So===e&&this.Go(t,n)}),(e=>{t((()=>{const t=new Hr(Br.UNKNOWN,"Fetching auth token failed: "+e.message);return this.Qo(t)}))}))}Go(t,e){const n=this.Ko(this.So);this.stream=this.jo(t,e),this.stream.Yr((()=>{n((()=>(this.state=2,this.Co=this.Hs.enqueueAfterDelay(this.Vo,1e4,(()=>(this.ko()&&(this.state=3),Promise.resolve()))),this.listener.Yr())))})),this.stream.Zr((t=>{n((()=>this.Qo(t)))})),this.stream.onMessage((t=>{n((()=>this.onMessage(t)))}))}Oo(){this.state=5,this.xo.Ro((async()=>{this.state=0,this.start()}))}Qo(t){return Lr("PersistentStream",`close with error: ${t}`),this.stream=null,this.close(4,t)}Ko(t){return e=>{this.Hs.enqueueAndForget((()=>this.So===t?e():(Lr("PersistentStream","stream callback skipped by getCloseGuardedDispatcher."),Promise.resolve())))}}}class Zc extends Xc{constructor(t,e,n,s,r,i){super(t,"listen_stream_connection_backoff","listen_stream_idle","health_check_timeout",e,n,s,i),this.yt=r}jo(t,e){return this.connection.wo("Listen",t,e)}onMessage(t){this.xo.reset();const e=function(t,e){let n;if("targetChange"in e){e.targetChange;const s=function(t){return"NO_CHANGE"===t?0:"ADD"===t?1:"REMOVE"===t?2:"CURRENT"===t?3:"RESET"===t?4:Ur()}(e.targetChange.targetChangeType||"NO_CHANGE"),r=e.targetChange.targetIds||[],i=function(t,e){return t.wt?(Fr(void 0===e||"string"==typeof e),Ei.fromBase64String(e||"")):(Fr(void 0===e||e instanceof Uint8Array),Ei.fromUint8Array(e||new Uint8Array))}(t,e.targetChange.resumeToken),o=e.targetChange.cause,a=o&&function(t){const e=void 0===t.code?Br.UNKNOWN:wa(t.code);return new Hr(e,t.message||"")}(o);n=new Ua(s,r,i,a||null)}else if("documentChange"in e){e.documentChange;const s=e.documentChange;s.document,s.document.name,s.document.updateTime;const r=Ya(t,s.document.name),i=$a(s.document.updateTime),o=s.document.createTime?$a(s.document.createTime):ni.min(),a=new _o({mapValue:{fields:s.document.fields}}),c=To.newFoundDocument(r,i,o,a),u=s.targetIds||[],h=s.removedTargetIds||[];n=new Ma(u,h,c.key,c)}else if("documentDelete"in e){e.documentDelete;const s=e.documentDelete;s.document;const r=Ya(t,s.document),i=s.readTime?$a(s.readTime):ni.min(),o=To.newNoDocument(r,i),a=s.removedTargetIds||[];n=new Ma([],a,o.key,o)}else if("documentRemove"in e){e.documentRemove;const s=e.documentRemove;s.document;const r=Ya(t,s.document),i=s.removedTargetIds||[];n=new Ma([],i,r,null)}else{if(!("filter"in e))return Ur();{e.filter;const t=e.filter;t.targetId;const s=t.count||0,r=new ma(s),i=t.targetId;n=new xa(i,r)}}return n}(this.yt,t),n=function(t){if(!("targetChange"in t))return ni.min();const e=t.targetChange;return e.targetIds&&e.targetIds.length?ni.min():e.readTime?$a(e.readTime):ni.min()}(t);return this.listener.Wo(e,n)}zo(t){const e={};e.database=Za(this.yt),e.addTarget=function(t,e){let n;const s=e.target;return n=Ao(s)?{documents:ec(t,s)}:{query:nc(t,s)},n.targetId=e.targetId,e.resumeToken.approximateByteSize()>0?n.resumeToken=za(t,e.resumeToken):e.snapshotVersion.compareTo(ni.min())>0&&(n.readTime=Wa(t,e.snapshotVersion.toTimestamp())),n}(this.yt,t);const n=function(t,e){const n=function(t,e){switch(e){case 0:return null;case 1:return"existence-filter-mismatch";case 2:return"limbo-document";default:return Ur()}}(0,e.purpose);return null==n?null:{"goog-listen-tags":n}}(this.yt,t);n&&(e.labels=n),this.Bo(e)}Ho(t){const e={};e.database=Za(this.yt),e.removeTarget=t,this.Bo(e)}}
1538
+ */class nh{constructor(t,e,n,r,s,i,o,a){this.Hs=t,this.vo=n,this.Vo=r,this.connection=s,this.authCredentialsProvider=i,this.appCheckCredentialsProvider=o,this.listener=a,this.state=0,this.So=0,this.Do=null,this.Co=null,this.stream=null,this.xo=new eh(t,e)}No(){return 1===this.state||5===this.state||this.ko()}ko(){return 2===this.state||3===this.state}start(){4!==this.state?this.auth():this.Oo()}async stop(){this.No()&&await this.close(0)}Mo(){this.state=0,this.xo.reset()}Fo(){this.ko()&&null===this.Do&&(this.Do=this.Hs.enqueueAfterDelay(this.vo,6e4,(()=>this.$o())))}Bo(t){this.Lo(),this.stream.send(t)}async $o(){if(this.ko())return this.close(0)}Lo(){this.Do&&(this.Do.cancel(),this.Do=null)}qo(){this.Co&&(this.Co.cancel(),this.Co=null)}async close(t,e){this.Lo(),this.qo(),this.xo.cancel(),this.So++,4!==t?this.xo.reset():e&&e.code===Di.RESOURCE_EXHAUSTED?(bi(e.toString()),bi("Using maximum backoff delay to prevent overloading the backend."),this.xo.Ao()):e&&e.code===Di.UNAUTHENTICATED&&3!==this.state&&(this.authCredentialsProvider.invalidateToken(),this.appCheckCredentialsProvider.invalidateToken()),null!==this.stream&&(this.Uo(),this.stream.close(),this.stream=null),this.state=t,await this.listener.Zr(e)}Uo(){}auth(){this.state=1;const t=this.Ko(this.So),e=this.So;Promise.all([this.authCredentialsProvider.getToken(),this.appCheckCredentialsProvider.getToken()]).then((([t,n])=>{this.So===e&&this.Go(t,n)}),(e=>{t((()=>{const t=new Oi(Di.UNKNOWN,"Fetching auth token failed: "+e.message);return this.Qo(t)}))}))}Go(t,e){const n=this.Ko(this.So);this.stream=this.jo(t,e),this.stream.Yr((()=>{n((()=>(this.state=2,this.Co=this.Hs.enqueueAfterDelay(this.Vo,1e4,(()=>(this.ko()&&(this.state=3),Promise.resolve()))),this.listener.Yr())))})),this.stream.Zr((t=>{n((()=>this.Qo(t)))})),this.stream.onMessage((t=>{n((()=>this.onMessage(t)))}))}Oo(){this.state=5,this.xo.Ro((async()=>{this.state=0,this.start()}))}Qo(t){return Ii("PersistentStream",`close with error: ${t}`),this.stream=null,this.close(4,t)}Ko(t){return e=>{this.Hs.enqueueAndForget((()=>this.So===t?e():(Ii("PersistentStream","stream callback skipped by getCloseGuardedDispatcher."),Promise.resolve())))}}}class rh extends nh{constructor(t,e,n,r,s,i){super(t,"listen_stream_connection_backoff","listen_stream_idle","health_check_timeout",e,n,r,i),this.yt=s}jo(t,e){return this.connection.wo("Listen",t,e)}onMessage(t){this.xo.reset();const e=function(t,e){let n;if("targetChange"in e){e.targetChange;const r=function(t){return"NO_CHANGE"===t?0:"ADD"===t?1:"REMOVE"===t?2:"CURRENT"===t?3:"RESET"===t?4:ki()}(e.targetChange.targetChangeType||"NO_CHANGE"),s=e.targetChange.targetIds||[],i=function(t,e){return t.wt?(Ri(void 0===e||"string"==typeof e),mo.fromBase64String(e||"")):(Ri(void 0===e||e instanceof Uint8Array),mo.fromUint8Array(e||new Uint8Array))}(t,e.targetChange.resumeToken),o=e.targetChange.cause,a=o&&function(t){const e=void 0===t.code?Di.UNKNOWN:mc(t.code);return new Oi(e,t.message||"")}(o);n=new Mc(r,s,i,a||null)}else if("documentChange"in e){e.documentChange;const r=e.documentChange;r.document,r.document.name,r.document.updateTime;const s=Jc(t,r.document.name),i=Gc(r.document.updateTime),o=r.document.createTime?Gc(r.document.createTime):Gi.min(),a=new da({mapValue:{fields:r.document.fields}}),c=pa.newFoundDocument(s,i,o,a),u=r.targetIds||[],h=r.removedTargetIds||[];n=new Lc(u,h,c.key,c)}else if("documentDelete"in e){e.documentDelete;const r=e.documentDelete;r.document;const s=Jc(t,r.document),i=r.readTime?Gc(r.readTime):Gi.min(),o=pa.newNoDocument(s,i),a=r.removedTargetIds||[];n=new Lc([],a,o.key,o)}else if("documentRemove"in e){e.documentRemove;const r=e.documentRemove;r.document;const s=Jc(t,r.document),i=r.removedTargetIds||[];n=new Lc([],i,s,null)}else{if(!("filter"in e))return ki();{e.filter;const t=e.filter;t.targetId;const r=t.count||0,s=new fc(r),i=t.targetId;n=new Pc(i,s)}}return n}(this.yt,t),n=function(t){if(!("targetChange"in t))return Gi.min();const e=t.targetChange;return e.targetIds&&e.targetIds.length?Gi.min():e.readTime?Gc(e.readTime):Gi.min()}(t);return this.listener.Wo(e,n)}zo(t){const e={};e.database=Zc(this.yt),e.addTarget=function(t,e){let n;const r=e.target;return n=wa(r)?{documents:nu(t,r)}:{query:ru(t,r)},n.targetId=e.targetId,e.resumeToken.approximateByteSize()>0?n.resumeToken=Kc(t,e.resumeToken):e.snapshotVersion.compareTo(Gi.min())>0&&(n.readTime=qc(t,e.snapshotVersion.toTimestamp())),n}(this.yt,t);const n=function(t,e){const n=function(t,e){switch(e){case 0:return null;case 1:return"existence-filter-mismatch";case 2:return"limbo-document";default:return ki()}}(0,e.purpose);return null==n?null:{"goog-listen-tags":n}}(this.yt,t);n&&(e.labels=n),this.Bo(e)}Ho(t){const e={};e.database=Zc(this.yt),e.removeTarget=t,this.Bo(e)}}class sh extends nh{constructor(t,e,n,r,s,i){super(t,"write_stream_connection_backoff","write_stream_idle","health_check_timeout",e,n,r,i),this.yt=s,this.Jo=!1}get Yo(){return this.Jo}start(){this.Jo=!1,this.lastStreamToken=void 0,super.start()}Uo(){this.Jo&&this.Xo([])}jo(t,e){return this.connection.wo("Write",t,e)}onMessage(t){if(Ri(!!t.streamToken),this.lastStreamToken=t.streamToken,this.Jo){this.xo.reset();const e=function(t,e){return t&&t.length>0?(Ri(void 0!==e),t.map((t=>function(t,e){let n=t.updateTime?Gc(t.updateTime):Gc(e);return n.isEqual(Gi.min())&&(n=Gc(e)),new Ja(n,t.transformResults||[])}(t,e)))):[]}(t.writeResults,t.commitTime),n=Gc(t.commitTime);return this.listener.Zo(n,e)}return Ri(!t.writeResults||0===t.writeResults.length),this.Jo=!0,this.listener.tu()}eu(){const t={};t.database=Zc(this.yt),this.Bo(t)}Xo(t){const e={streamToken:this.lastStreamToken,writes:t.map((t=>function(t,e){let n;if(e instanceof oc)n={update:eu(t,e.key,e.value)};else if(e instanceof lc)n={delete:Yc(t,e.key)};else if(e instanceof ac)n={update:eu(t,e.key,e.data),updateMask:du(e.fieldMask)};else{if(!(e instanceof dc))return ki();n={verify:Yc(t,e.key)}}return e.fieldTransforms.length>0&&(n.updateTransforms=e.fieldTransforms.map((t=>function(t,e){const n=e.transform;if(n instanceof $a)return{fieldPath:e.field.canonicalString(),setToServerValue:"REQUEST_TIME"};if(n instanceof qa)return{fieldPath:e.field.canonicalString(),appendMissingElements:{values:n.elements}};if(n instanceof Wa)return{fieldPath:e.field.canonicalString(),removeAllFromArray:{values:n.elements}};if(n instanceof za)return{fieldPath:e.field.canonicalString(),increment:n.gt};throw ki()}(0,t)))),e.precondition.isNone||(n.currentDocument=function(t,e){return void 0!==e.updateTime?{updateTime:Wc(t,e.updateTime)}:void 0!==e.exists?{exists:e.exists}:ki()}(t,e.precondition)),n}(this.yt,t)))};this.Bo(e)}}
1457
1539
  /**
1458
1540
  * @license
1459
1541
  * Copyright 2017 Google LLC
@@ -1469,7 +1551,7 @@ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1469
1551
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1470
1552
  * See the License for the specific language governing permissions and
1471
1553
  * limitations under the License.
1472
- */class tu extends class{}{constructor(t,e,n,s){super(),this.authCredentials=t,this.appCheckCredentials=e,this.connection=n,this.yt=s,this.nu=!1}su(){if(this.nu)throw new Hr(Br.FAILED_PRECONDITION,"The client has already been terminated.")}ao(t,e,n){return this.su(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then((([s,r])=>this.connection.ao(t,e,n,s,r))).catch((t=>{throw"FirebaseError"===t.name?(t.code===Br.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),t):new Hr(Br.UNKNOWN,t.toString())}))}_o(t,e,n,s){return this.su(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then((([r,i])=>this.connection._o(t,e,n,r,i,s))).catch((t=>{throw"FirebaseError"===t.name?(t.code===Br.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),t):new Hr(Br.UNKNOWN,t.toString())}))}terminate(){this.nu=!0}}class eu{constructor(t,e){this.asyncQueue=t,this.onlineStateHandler=e,this.state="Unknown",this.iu=0,this.ru=null,this.ou=!0}uu(){0===this.iu&&(this.cu("Unknown"),this.ru=this.asyncQueue.enqueueAfterDelay("online_state_timeout",1e4,(()=>(this.ru=null,this.au("Backend didn't respond within 10 seconds."),this.cu("Offline"),Promise.resolve()))))}hu(t){"Online"===this.state?this.cu("Unknown"):(this.iu++,this.iu>=1&&(this.lu(),this.au(`Connection failed 1 times. Most recent error: ${t.toString()}`),this.cu("Offline")))}set(t){this.lu(),this.iu=0,"Online"===t&&(this.ou=!1),this.cu(t)}cu(t){t!==this.state&&(this.state=t,this.onlineStateHandler(t))}au(t){const e=`Could not reach Cloud Firestore backend. ${t}\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.ou?(Pr(e),this.ou=!1):Lr("OnlineStateTracker",e)}lu(){null!==this.ru&&(this.ru.cancel(),this.ru=null)}}
1554
+ */class ih extends class{}{constructor(t,e,n,r){super(),this.authCredentials=t,this.appCheckCredentials=e,this.connection=n,this.yt=r,this.nu=!1}su(){if(this.nu)throw new Oi(Di.FAILED_PRECONDITION,"The client has already been terminated.")}ao(t,e,n){return this.su(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then((([r,s])=>this.connection.ao(t,e,n,r,s))).catch((t=>{throw"FirebaseError"===t.name?(t.code===Di.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),t):new Oi(Di.UNKNOWN,t.toString())}))}_o(t,e,n,r){return this.su(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then((([s,i])=>this.connection._o(t,e,n,s,i,r))).catch((t=>{throw"FirebaseError"===t.name?(t.code===Di.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),t):new Oi(Di.UNKNOWN,t.toString())}))}terminate(){this.nu=!0}}class oh{constructor(t,e){this.asyncQueue=t,this.onlineStateHandler=e,this.state="Unknown",this.iu=0,this.ru=null,this.ou=!0}uu(){0===this.iu&&(this.cu("Unknown"),this.ru=this.asyncQueue.enqueueAfterDelay("online_state_timeout",1e4,(()=>(this.ru=null,this.au("Backend didn't respond within 10 seconds."),this.cu("Offline"),Promise.resolve()))))}hu(t){"Online"===this.state?this.cu("Unknown"):(this.iu++,this.iu>=1&&(this.lu(),this.au(`Connection failed 1 times. Most recent error: ${t.toString()}`),this.cu("Offline")))}set(t){this.lu(),this.iu=0,"Online"===t&&(this.ou=!1),this.cu(t)}cu(t){t!==this.state&&(this.state=t,this.onlineStateHandler(t))}au(t){const e=`Could not reach Cloud Firestore backend. ${t}\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.ou?(bi(e),this.ou=!1):Ii("OnlineStateTracker",e)}lu(){null!==this.ru&&(this.ru.cancel(),this.ru=null)}}
1473
1555
  /**
1474
1556
  * @license
1475
1557
  * Copyright 2017 Google LLC
@@ -1485,7 +1567,7 @@ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1485
1567
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1486
1568
  * See the License for the specific language governing permissions and
1487
1569
  * limitations under the License.
1488
- */class nu{constructor(t,e,n,s,r){this.localStore=t,this.datastore=e,this.asyncQueue=n,this.remoteSyncer={},this.fu=[],this.du=new Map,this._u=new Set,this.wu=[],this.mu=r,this.mu.Ur((t=>{n.enqueueAndForget((async()=>{lu(this)&&(Lr("RemoteStore","Restarting streams for network reachability change."),await async function(t){const e=Vr(t);e._u.add(4),await ru(e),e.gu.set("Unknown"),e._u.delete(4),await su(e)}(this))}))})),this.gu=new eu(n,s)}}async function su(t){if(lu(t))for(const e of t.wu)await e(!0)}async function ru(t){for(const e of t.wu)await e(!1)}function iu(t,e){const n=Vr(t);n.du.has(e.targetId)||(n.du.set(e.targetId,e),hu(n)?uu(n):vu(n).ko()&&au(n,e))}function ou(t,e){const n=Vr(t),s=vu(n);n.du.delete(e),s.ko()&&cu(n,e),0===n.du.size&&(s.ko()?s.Fo():lu(n)&&n.gu.set("Unknown"))}function au(t,e){t.yu.Ot(e.targetId),vu(t).zo(e)}function cu(t,e){t.yu.Ot(e),vu(t).Ho(e)}function uu(t){t.yu=new Va({getRemoteKeysForTarget:e=>t.remoteSyncer.getRemoteKeysForTarget(e),ne:e=>t.du.get(e)||null}),vu(t).start(),t.gu.uu()}function hu(t){return lu(t)&&!vu(t).No()&&t.du.size>0}function lu(t){return 0===Vr(t)._u.size}function du(t){t.yu=void 0}async function fu(t){t.du.forEach(((e,n)=>{au(t,e)}))}async function pu(t,e){du(t),hu(t)?(t.gu.hu(e),uu(t)):t.gu.set("Unknown")}async function gu(t,e,n){if(t.gu.set("Online"),e instanceof Ua&&2===e.state&&e.cause)try{await async function(t,e){const n=e.cause;for(const s of e.targetIds)t.du.has(s)&&(await t.remoteSyncer.rejectListen(s,n),t.du.delete(s),t.yu.removeTarget(s))}(t,e)}catch(n){Lr("RemoteStore","Failed to remove targets %s: %s ",e.targetIds.join(","),n),await mu(t,n)}else if(e instanceof Ma?t.yu.Kt(e):e instanceof xa?t.yu.Jt(e):t.yu.jt(e),!n.isEqual(ni.min()))try{const e=await Fc(t.localStore);n.compareTo(e)>=0&&await function(t,e){const n=t.yu.Zt(e);return n.targetChanges.forEach(((n,s)=>{if(n.resumeToken.approximateByteSize()>0){const r=t.du.get(s);r&&t.du.set(s,r.withResumeToken(n.resumeToken,e))}})),n.targetMismatches.forEach((e=>{const n=t.du.get(e);if(!n)return;t.du.set(e,n.withResumeToken(Ei.EMPTY_BYTE_STRING,n.snapshotVersion)),cu(t,e);const s=new pc(n.target,e,1,n.sequenceNumber);au(t,s)})),t.remoteSyncer.applyRemoteEvent(n)}(t,n)}catch(e){Lr("RemoteStore","Failed to raise snapshot:",e),await mu(t,e)}}async function mu(t,e,n){if(!pi(e))throw e;t._u.add(1),await ru(t),t.gu.set("Offline"),n||(n=()=>Fc(t.localStore)),t.asyncQueue.enqueueRetryable((async()=>{Lr("RemoteStore","Retrying IndexedDB access"),await n(),t._u.delete(1),await su(t)}))}async function yu(t,e){const n=Vr(t);n.asyncQueue.verifyOperationInProgress(),Lr("RemoteStore","RemoteStore received new credentials");const s=lu(n);n._u.add(3),await ru(n),s&&n.gu.set("Unknown"),await n.remoteSyncer.handleCredentialChange(e),n._u.delete(3),await su(n)}function vu(t){return t.pu||(t.pu=function(t,e,n){const s=Vr(t);return s.su(),new Zc(e,s.connection,s.authCredentials,s.appCheckCredentials,s.yt,n)
1570
+ */class ah{constructor(t,e,n,r,s){this.localStore=t,this.datastore=e,this.asyncQueue=n,this.remoteSyncer={},this.fu=[],this.du=new Map,this._u=new Set,this.wu=[],this.mu=s,this.mu.Ur((t=>{n.enqueueAndForget((async()=>{mh(this)&&(Ii("RemoteStore","Restarting streams for network reachability change."),await async function(t){const e=Ni(t);e._u.add(4),await uh(e),e.gu.set("Unknown"),e._u.delete(4),await ch(e)}(this))}))})),this.gu=new oh(n,r)}}async function ch(t){if(mh(t))for(const e of t.wu)await e(!0)}async function uh(t){for(const e of t.wu)await e(!1)}function hh(t,e){const n=Ni(t);n.du.has(e.targetId)||(n.du.set(e.targetId,e),gh(n)?ph(n):Lh(n).ko()&&dh(n,e))}function lh(t,e){const n=Ni(t),r=Lh(n);n.du.delete(e),r.ko()&&fh(n,e),0===n.du.size&&(r.ko()?r.Fo():mh(n)&&n.gu.set("Unknown"))}function dh(t,e){t.yu.Ot(e.targetId),Lh(t).zo(e)}function fh(t,e){t.yu.Ot(e),Lh(t).Ho(e)}function ph(t){t.yu=new Uc({getRemoteKeysForTarget:e=>t.remoteSyncer.getRemoteKeysForTarget(e),ne:e=>t.du.get(e)||null}),Lh(t).start(),t.gu.uu()}function gh(t){return mh(t)&&!Lh(t).No()&&t.du.size>0}function mh(t){return 0===Ni(t)._u.size}function yh(t){t.yu=void 0}async function vh(t){t.du.forEach(((e,n)=>{dh(t,e)}))}async function wh(t,e){yh(t),gh(t)?(t.gu.hu(e),ph(t)):t.gu.set("Unknown")}async function _h(t,e,n){if(t.gu.set("Online"),e instanceof Mc&&2===e.state&&e.cause)try{await async function(t,e){const n=e.cause;for(const r of e.targetIds)t.du.has(r)&&(await t.remoteSyncer.rejectListen(r,n),t.du.delete(r),t.yu.removeTarget(r))}(t,e)}catch(n){Ii("RemoteStore","Failed to remove targets %s: %s ",e.targetIds.join(","),n),await Th(t,n)}else if(e instanceof Lc?t.yu.Kt(e):e instanceof Pc?t.yu.Jt(e):t.yu.jt(e),!n.isEqual(Gi.min()))try{const e=await Hu(t.localStore);n.compareTo(e)>=0&&await function(t,e){const n=t.yu.Zt(e);return n.targetChanges.forEach(((n,r)=>{if(n.resumeToken.approximateByteSize()>0){const s=t.du.get(r);s&&t.du.set(r,s.withResumeToken(n.resumeToken,e))}})),n.targetMismatches.forEach((e=>{const n=t.du.get(e);if(!n)return;t.du.set(e,n.withResumeToken(mo.EMPTY_BYTE_STRING,n.snapshotVersion)),fh(t,e);const r=new yu(n.target,e,1,n.sequenceNumber);dh(t,r)})),t.remoteSyncer.applyRemoteEvent(n)}(t,n)}catch(e){Ii("RemoteStore","Failed to raise snapshot:",e),await Th(t,e)}}async function Th(t,e,n){if(!oo(e))throw e;t._u.add(1),await uh(t),t.gu.set("Offline"),n||(n=()=>Hu(t.localStore)),t.asyncQueue.enqueueRetryable((async()=>{Ii("RemoteStore","Retrying IndexedDB access"),await n(),t._u.delete(1),await ch(t)}))}function Eh(t,e){return e().catch((n=>Th(t,n,e)))}async function Sh(t){const e=Ni(t),n=Ph(e);let r=e.fu.length>0?e.fu[e.fu.length-1].batchId:-1;for(;Ih(e);)try{const t=await $u(e.localStore,r);if(null===t){0===e.fu.length&&n.Fo();break}r=t.batchId,bh(e,t)}catch(t){await Th(e,t)}Ah(e)&&Ch(e)}function Ih(t){return mh(t)&&t.fu.length<10}function bh(t,e){t.fu.push(e);const n=Ph(t);n.ko()&&n.Yo&&n.Xo(e.mutations)}function Ah(t){return mh(t)&&!Ph(t).No()&&t.fu.length>0}function Ch(t){Ph(t).start()}async function kh(t){Ph(t).eu()}async function Rh(t){const e=Ph(t);for(const n of t.fu)e.Xo(n.mutations)}async function Nh(t,e,n){const r=t.fu.shift(),s=gu.from(r,e,n);await Eh(t,(()=>t.remoteSyncer.applySuccessfulWrite(s))),await Sh(t)}async function Dh(t,e){e&&Ph(t).Yo&&await async function(t,e){if(function(t){switch(t){default:return ki();case Di.CANCELLED:case Di.UNKNOWN:case Di.DEADLINE_EXCEEDED:case Di.RESOURCE_EXHAUSTED:case Di.INTERNAL:case Di.UNAVAILABLE:case Di.UNAUTHENTICATED:return!1;case Di.INVALID_ARGUMENT:case Di.NOT_FOUND:case Di.ALREADY_EXISTS:case Di.PERMISSION_DENIED:case Di.FAILED_PRECONDITION:case Di.ABORTED:case Di.OUT_OF_RANGE:case Di.UNIMPLEMENTED:case Di.DATA_LOSS:return!0}}(n=e.code)&&n!==Di.ABORTED){const n=t.fu.shift();Ph(t).Mo(),await Eh(t,(()=>t.remoteSyncer.rejectFailedWrite(n.batchId,e))),await Sh(t)}var n}(t,e),Ah(t)&&Ch(t)}async function Oh(t,e){const n=Ni(t);n.asyncQueue.verifyOperationInProgress(),Ii("RemoteStore","RemoteStore received new credentials");const r=mh(n);n._u.add(3),await uh(n),r&&n.gu.set("Unknown"),await n.remoteSyncer.handleCredentialChange(e),n._u.delete(3),await ch(n)}function Lh(t){return t.pu||(t.pu=function(t,e,n){const r=Ni(t);return r.su(),new rh(e,r.connection,r.authCredentials,r.appCheckCredentials,r.yt,n)
1489
1571
  /**
1490
1572
  * @license
1491
1573
  * Copyright 2018 Google LLC
@@ -1501,7 +1583,7 @@ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1501
1583
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1502
1584
  * See the License for the specific language governing permissions and
1503
1585
  * limitations under the License.
1504
- */}(t.datastore,t.asyncQueue,{Yr:fu.bind(null,t),Zr:pu.bind(null,t),Wo:gu.bind(null,t)}),t.wu.push((async e=>{e?(t.pu.Mo(),hu(t)?uu(t):t.gu.set("Unknown")):(await t.pu.stop(),du(t))}))),t.pu
1586
+ */}(t.datastore,t.asyncQueue,{Yr:vh.bind(null,t),Zr:wh.bind(null,t),Wo:_h.bind(null,t)}),t.wu.push((async e=>{e?(t.pu.Mo(),gh(t)?ph(t):t.gu.set("Unknown")):(await t.pu.stop(),yh(t))}))),t.pu}function Ph(t){return t.Iu||(t.Iu=function(t,e,n){const r=Ni(t);return r.su(),new sh(e,r.connection,r.authCredentials,r.appCheckCredentials,r.yt,n)}(t.datastore,t.asyncQueue,{Yr:kh.bind(null,t),Zr:Dh.bind(null,t),tu:Rh.bind(null,t),Zo:Nh.bind(null,t)}),t.wu.push((async e=>{e?(t.Iu.Mo(),await Sh(t)):(await t.Iu.stop(),t.fu.length>0&&(Ii("RemoteStore",`Stopping write stream with ${t.fu.length} pending writes`),t.fu=[]))}))),t.Iu
1505
1587
  /**
1506
1588
  * @license
1507
1589
  * Copyright 2017 Google LLC
@@ -1517,7 +1599,7 @@ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1517
1599
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1518
1600
  * See the License for the specific language governing permissions and
1519
1601
  * limitations under the License.
1520
- */}class wu{constructor(t,e,n,s,r){this.asyncQueue=t,this.timerId=e,this.targetTimeMs=n,this.op=s,this.removalCallback=r,this.deferred=new jr,this.then=this.deferred.promise.then.bind(this.deferred.promise),this.deferred.promise.catch((t=>{}))}static createAndSchedule(t,e,n,s,r){const i=Date.now()+n,o=new wu(t,e,i,s,r);return o.start(n),o}start(t){this.timerHandle=setTimeout((()=>this.handleDelayElapsed()),t)}skipDelay(){return this.handleDelayElapsed()}cancel(t){null!==this.timerHandle&&(this.clearTimeout(),this.deferred.reject(new Hr(Br.CANCELLED,"Operation cancelled"+(t?": "+t:""))))}handleDelayElapsed(){this.asyncQueue.enqueueAndForget((()=>null!==this.timerHandle?(this.clearTimeout(),this.op().then((t=>this.deferred.resolve(t)))):Promise.resolve()))}clearTimeout(){null!==this.timerHandle&&(this.removalCallback(this),clearTimeout(this.timerHandle),this.timerHandle=null)}}function _u(t,e){if(Pr("AsyncQueue",`${e}: ${t}`),pi(t))return new Hr(Br.UNAVAILABLE,`${e}: ${t}`);throw t}
1602
+ */}class Mh{constructor(t,e,n,r,s){this.asyncQueue=t,this.timerId=e,this.targetTimeMs=n,this.op=r,this.removalCallback=s,this.deferred=new Li,this.then=this.deferred.promise.then.bind(this.deferred.promise),this.deferred.promise.catch((t=>{}))}static createAndSchedule(t,e,n,r,s){const i=Date.now()+n,o=new Mh(t,e,i,r,s);return o.start(n),o}start(t){this.timerHandle=setTimeout((()=>this.handleDelayElapsed()),t)}skipDelay(){return this.handleDelayElapsed()}cancel(t){null!==this.timerHandle&&(this.clearTimeout(),this.deferred.reject(new Oi(Di.CANCELLED,"Operation cancelled"+(t?": "+t:""))))}handleDelayElapsed(){this.asyncQueue.enqueueAndForget((()=>null!==this.timerHandle?(this.clearTimeout(),this.op().then((t=>this.deferred.resolve(t)))):Promise.resolve()))}clearTimeout(){null!==this.timerHandle&&(this.removalCallback(this),clearTimeout(this.timerHandle),this.timerHandle=null)}}function xh(t,e){if(bi("AsyncQueue",`${e}: ${t}`),oo(t))return new Oi(Di.UNAVAILABLE,`${e}: ${t}`);throw t}
1521
1603
  /**
1522
1604
  * @license
1523
1605
  * Copyright 2017 Google LLC
@@ -1533,7 +1615,7 @@ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1533
1615
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1534
1616
  * See the License for the specific language governing permissions and
1535
1617
  * limitations under the License.
1536
- */class Tu{constructor(t){this.comparator=t?(e,n)=>t(e,n)||ai.comparator(e.key,n.key):(t,e)=>ai.comparator(t.key,e.key),this.keyedMap=Sa(),this.sortedSet=new po(this.comparator)}static emptySet(t){return new Tu(t.comparator)}has(t){return null!=this.keyedMap.get(t)}get(t){return this.keyedMap.get(t)}first(){return this.sortedSet.minKey()}last(){return this.sortedSet.maxKey()}isEmpty(){return this.sortedSet.isEmpty()}indexOf(t){const e=this.keyedMap.get(t);return e?this.sortedSet.indexOf(e):-1}get size(){return this.sortedSet.size}forEach(t){this.sortedSet.inorderTraversal(((e,n)=>(t(e),!1)))}add(t){const e=this.delete(t.key);return e.copy(e.keyedMap.insert(t.key,t),e.sortedSet.insert(t,null))}delete(t){const e=this.get(t);return e?this.copy(this.keyedMap.remove(t),this.sortedSet.remove(e)):this}isEqual(t){if(!(t instanceof Tu))return!1;if(this.size!==t.size)return!1;const e=this.sortedSet.getIterator(),n=t.sortedSet.getIterator();for(;e.hasNext();){const t=e.getNext().key,s=n.getNext().key;if(!t.isEqual(s))return!1}return!0}toString(){const t=[];return this.forEach((e=>{t.push(e.toString())})),0===t.length?"DocumentSet ()":"DocumentSet (\n "+t.join(" \n")+"\n)"}copy(t,e){const n=new Tu;return n.comparator=this.comparator,n.keyedMap=t,n.sortedSet=e,n}}
1618
+ */class Uh{constructor(t){this.comparator=t?(e,n)=>t(e,n)||Xi.comparator(e.key,n.key):(t,e)=>Xi.comparator(t.key,e.key),this.keyedMap=Tc(),this.sortedSet=new oa(this.comparator)}static emptySet(t){return new Uh(t.comparator)}has(t){return null!=this.keyedMap.get(t)}get(t){return this.keyedMap.get(t)}first(){return this.sortedSet.minKey()}last(){return this.sortedSet.maxKey()}isEmpty(){return this.sortedSet.isEmpty()}indexOf(t){const e=this.keyedMap.get(t);return e?this.sortedSet.indexOf(e):-1}get size(){return this.sortedSet.size}forEach(t){this.sortedSet.inorderTraversal(((e,n)=>(t(e),!1)))}add(t){const e=this.delete(t.key);return e.copy(e.keyedMap.insert(t.key,t),e.sortedSet.insert(t,null))}delete(t){const e=this.get(t);return e?this.copy(this.keyedMap.remove(t),this.sortedSet.remove(e)):this}isEqual(t){if(!(t instanceof Uh))return!1;if(this.size!==t.size)return!1;const e=this.sortedSet.getIterator(),n=t.sortedSet.getIterator();for(;e.hasNext();){const t=e.getNext().key,r=n.getNext().key;if(!t.isEqual(r))return!1}return!0}toString(){const t=[];return this.forEach((e=>{t.push(e.toString())})),0===t.length?"DocumentSet ()":"DocumentSet (\n "+t.join(" \n")+"\n)"}copy(t,e){const n=new Uh;return n.comparator=this.comparator,n.keyedMap=t,n.sortedSet=e,n}}
1537
1619
  /**
1538
1620
  * @license
1539
1621
  * Copyright 2017 Google LLC
@@ -1549,7 +1631,7 @@ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1549
1631
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1550
1632
  * See the License for the specific language governing permissions and
1551
1633
  * limitations under the License.
1552
- */class Iu{constructor(){this.Tu=new po(ai.comparator)}track(t){const e=t.doc.key,n=this.Tu.get(e);n?0!==t.type&&3===n.type?this.Tu=this.Tu.insert(e,t):3===t.type&&1!==n.type?this.Tu=this.Tu.insert(e,{type:n.type,doc:t.doc}):2===t.type&&2===n.type?this.Tu=this.Tu.insert(e,{type:2,doc:t.doc}):2===t.type&&0===n.type?this.Tu=this.Tu.insert(e,{type:0,doc:t.doc}):1===t.type&&0===n.type?this.Tu=this.Tu.remove(e):1===t.type&&2===n.type?this.Tu=this.Tu.insert(e,{type:1,doc:n.doc}):0===t.type&&1===n.type?this.Tu=this.Tu.insert(e,{type:2,doc:t.doc}):Ur():this.Tu=this.Tu.insert(e,t)}Eu(){const t=[];return this.Tu.inorderTraversal(((e,n)=>{t.push(n)})),t}}class Eu{constructor(t,e,n,s,r,i,o,a,c){this.query=t,this.docs=e,this.oldDocs=n,this.docChanges=s,this.mutatedKeys=r,this.fromCache=i,this.syncStateChanged=o,this.excludesMetadataChanges=a,this.hasCachedResults=c}static fromInitialDocuments(t,e,n,s,r){const i=[];return e.forEach((t=>{i.push({type:0,doc:t})})),new Eu(t,e,Tu.emptySet(e),i,n,s,!0,!1,r)}get hasPendingWrites(){return!this.mutatedKeys.isEmpty()}isEqual(t){if(!(this.fromCache===t.fromCache&&this.hasCachedResults===t.hasCachedResults&&this.syncStateChanged===t.syncStateChanged&&this.mutatedKeys.isEqual(t.mutatedKeys)&&Uo(this.query,t.query)&&this.docs.isEqual(t.docs)&&this.oldDocs.isEqual(t.oldDocs)))return!1;const e=this.docChanges,n=t.docChanges;if(e.length!==n.length)return!1;for(let t=0;t<e.length;t++)if(e[t].type!==n[t].type||!e[t].doc.isEqual(n[t].doc))return!1;return!0}}
1634
+ */class Fh{constructor(){this.Tu=new oa(Xi.comparator)}track(t){const e=t.doc.key,n=this.Tu.get(e);n?0!==t.type&&3===n.type?this.Tu=this.Tu.insert(e,t):3===t.type&&1!==n.type?this.Tu=this.Tu.insert(e,{type:n.type,doc:t.doc}):2===t.type&&2===n.type?this.Tu=this.Tu.insert(e,{type:2,doc:t.doc}):2===t.type&&0===n.type?this.Tu=this.Tu.insert(e,{type:0,doc:t.doc}):1===t.type&&0===n.type?this.Tu=this.Tu.remove(e):1===t.type&&2===n.type?this.Tu=this.Tu.insert(e,{type:1,doc:n.doc}):0===t.type&&1===n.type?this.Tu=this.Tu.insert(e,{type:2,doc:t.doc}):ki():this.Tu=this.Tu.insert(e,t)}Eu(){const t=[];return this.Tu.inorderTraversal(((e,n)=>{t.push(n)})),t}}class Vh{constructor(t,e,n,r,s,i,o,a,c){this.query=t,this.docs=e,this.oldDocs=n,this.docChanges=r,this.mutatedKeys=s,this.fromCache=i,this.syncStateChanged=o,this.excludesMetadataChanges=a,this.hasCachedResults=c}static fromInitialDocuments(t,e,n,r,s){const i=[];return e.forEach((t=>{i.push({type:0,doc:t})})),new Vh(t,e,Uh.emptySet(e),i,n,r,!0,!1,s)}get hasPendingWrites(){return!this.mutatedKeys.isEmpty()}isEqual(t){if(!(this.fromCache===t.fromCache&&this.hasCachedResults===t.hasCachedResults&&this.syncStateChanged===t.syncStateChanged&&this.mutatedKeys.isEqual(t.mutatedKeys)&&Na(this.query,t.query)&&this.docs.isEqual(t.docs)&&this.oldDocs.isEqual(t.oldDocs)))return!1;const e=this.docChanges,n=t.docChanges;if(e.length!==n.length)return!1;for(let t=0;t<e.length;t++)if(e[t].type!==n[t].type||!e[t].doc.isEqual(n[t].doc))return!1;return!0}}
1553
1635
  /**
1554
1636
  * @license
1555
1637
  * Copyright 2017 Google LLC
@@ -1565,7 +1647,7 @@ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1565
1647
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1566
1648
  * See the License for the specific language governing permissions and
1567
1649
  * limitations under the License.
1568
- */class Su{constructor(){this.Au=void 0,this.listeners=[]}}class bu{constructor(){this.queries=new _a((t=>Fo(t)),Uo),this.onlineState="Unknown",this.Ru=new Set}}async function Au(t,e){const n=Vr(t),s=e.query;let r=!1,i=n.queries.get(s);if(i||(r=!0,i=new Su),r)try{i.Au=await n.onListen(s)}catch(t){const n=_u(t,`Initialization of query '${Vo(e.query)}' failed`);return void e.onError(n)}n.queries.set(s,i),i.listeners.push(e),e.bu(n.onlineState),i.Au&&e.Pu(i.Au)&&Ru(n)}async function Cu(t,e){const n=Vr(t),s=e.query;let r=!1;const i=n.queries.get(s);if(i){const t=i.listeners.indexOf(e);t>=0&&(i.listeners.splice(t,1),r=0===i.listeners.length)}if(r)return n.queries.delete(s),n.onUnlisten(s)}function ku(t,e){const n=Vr(t);let s=!1;for(const t of e){const e=t.query,r=n.queries.get(e);if(r){for(const e of r.listeners)e.Pu(t)&&(s=!0);r.Au=t}}s&&Ru(n)}function Nu(t,e,n){const s=Vr(t),r=s.queries.get(e);if(r)for(const t of r.listeners)t.onError(n);s.queries.delete(e)}function Ru(t){t.Ru.forEach((t=>{t.next()}))}class Ou{constructor(t,e,n){this.query=t,this.vu=e,this.Vu=!1,this.Su=null,this.onlineState="Unknown",this.options=n||{}}Pu(t){if(!this.options.includeMetadataChanges){const e=[];for(const n of t.docChanges)3!==n.type&&e.push(n);t=new Eu(t.query,t.docs,t.oldDocs,e,t.mutatedKeys,t.fromCache,t.syncStateChanged,!0,t.hasCachedResults)}let e=!1;return this.Vu?this.Du(t)&&(this.vu.next(t),e=!0):this.Cu(t,this.onlineState)&&(this.xu(t),e=!0),this.Su=t,e}onError(t){this.vu.error(t)}bu(t){this.onlineState=t;let e=!1;return this.Su&&!this.Vu&&this.Cu(this.Su,t)&&(this.xu(this.Su),e=!0),e}Cu(t,e){if(!t.fromCache)return!0;const n="Offline"!==e;return(!this.options.Nu||!n)&&(!t.docs.isEmpty()||t.hasCachedResults||"Offline"===e)}Du(t){if(t.docChanges.length>0)return!0;const e=this.Su&&this.Su.hasPendingWrites!==t.hasPendingWrites;return!(!t.syncStateChanged&&!e)&&!0===this.options.includeMetadataChanges}xu(t){t=Eu.fromInitialDocuments(t.query,t.docs,t.mutatedKeys,t.fromCache,t.hasCachedResults),this.Vu=!0,this.vu.next(t)}}
1650
+ */class Bh{constructor(){this.Au=void 0,this.listeners=[]}}class Hh{constructor(){this.queries=new yc((t=>Da(t)),Na),this.onlineState="Unknown",this.Ru=new Set}}async function jh(t,e){const n=Ni(t),r=e.query;let s=!1,i=n.queries.get(r);if(i||(s=!0,i=new Bh),s)try{i.Au=await n.onListen(r)}catch(t){const n=xh(t,`Initialization of query '${Oa(e.query)}' failed`);return void e.onError(n)}n.queries.set(r,i),i.listeners.push(e),e.bu(n.onlineState),i.Au&&e.Pu(i.Au)&&Wh(n)}async function $h(t,e){const n=Ni(t),r=e.query;let s=!1;const i=n.queries.get(r);if(i){const t=i.listeners.indexOf(e);t>=0&&(i.listeners.splice(t,1),s=0===i.listeners.length)}if(s)return n.queries.delete(r),n.onUnlisten(r)}function qh(t,e){const n=Ni(t);let r=!1;for(const t of e){const e=t.query,s=n.queries.get(e);if(s){for(const e of s.listeners)e.Pu(t)&&(r=!0);s.Au=t}}r&&Wh(n)}function Kh(t,e,n){const r=Ni(t),s=r.queries.get(e);if(s)for(const t of s.listeners)t.onError(n);r.queries.delete(e)}function Wh(t){t.Ru.forEach((t=>{t.next()}))}class Gh{constructor(t,e,n){this.query=t,this.vu=e,this.Vu=!1,this.Su=null,this.onlineState="Unknown",this.options=n||{}}Pu(t){if(!this.options.includeMetadataChanges){const e=[];for(const n of t.docChanges)3!==n.type&&e.push(n);t=new Vh(t.query,t.docs,t.oldDocs,e,t.mutatedKeys,t.fromCache,t.syncStateChanged,!0,t.hasCachedResults)}let e=!1;return this.Vu?this.Du(t)&&(this.vu.next(t),e=!0):this.Cu(t,this.onlineState)&&(this.xu(t),e=!0),this.Su=t,e}onError(t){this.vu.error(t)}bu(t){this.onlineState=t;let e=!1;return this.Su&&!this.Vu&&this.Cu(this.Su,t)&&(this.xu(this.Su),e=!0),e}Cu(t,e){if(!t.fromCache)return!0;const n="Offline"!==e;return(!this.options.Nu||!n)&&(!t.docs.isEmpty()||t.hasCachedResults||"Offline"===e)}Du(t){if(t.docChanges.length>0)return!0;const e=this.Su&&this.Su.hasPendingWrites!==t.hasPendingWrites;return!(!t.syncStateChanged&&!e)&&!0===this.options.includeMetadataChanges}xu(t){t=Vh.fromInitialDocuments(t.query,t.docs,t.mutatedKeys,t.fromCache,t.hasCachedResults),this.Vu=!0,this.vu.next(t)}}
1569
1651
  /**
1570
1652
  * @license
1571
1653
  * Copyright 2017 Google LLC
@@ -1581,7 +1663,7 @@ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1581
1663
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1582
1664
  * See the License for the specific language governing permissions and
1583
1665
  * limitations under the License.
1584
- */class Du{constructor(t){this.key=t}}class Lu{constructor(t){this.key=t}}class Pu{constructor(t,e){this.query=t,this.qu=e,this.Uu=null,this.hasCachedResults=!1,this.current=!1,this.Ku=Ra(),this.mutatedKeys=Ra(),this.Gu=Ho(t),this.Qu=new Tu(this.Gu)}get ju(){return this.qu}Wu(t,e){const n=e?e.zu:new Iu,s=e?e.Qu:this.Qu;let r=e?e.mutatedKeys:this.mutatedKeys,i=s,o=!1;const a="F"===this.query.limitType&&s.size===this.query.limit?s.last():null,c="L"===this.query.limitType&&s.size===this.query.limit?s.first():null;if(t.inorderTraversal(((t,e)=>{const u=s.get(t),h=Bo(this.query,e)?e:null,l=!!u&&this.mutatedKeys.has(u.key),d=!!h&&(h.hasLocalMutations||this.mutatedKeys.has(h.key)&&h.hasCommittedMutations);let f=!1;u&&h?u.data.isEqual(h.data)?l!==d&&(n.track({type:3,doc:h}),f=!0):this.Hu(u,h)||(n.track({type:2,doc:h}),f=!0,(a&&this.Gu(h,a)>0||c&&this.Gu(h,c)<0)&&(o=!0)):!u&&h?(n.track({type:0,doc:h}),f=!0):u&&!h&&(n.track({type:1,doc:u}),f=!0,(a||c)&&(o=!0)),f&&(h?(i=i.add(h),r=d?r.add(t):r.delete(t)):(i=i.delete(t),r=r.delete(t)))})),null!==this.query.limit)for(;i.size>this.query.limit;){const t="F"===this.query.limitType?i.last():i.first();i=i.delete(t.key),r=r.delete(t.key),n.track({type:1,doc:t})}return{Qu:i,zu:n,$i:o,mutatedKeys:r}}Hu(t,e){return t.hasLocalMutations&&e.hasCommittedMutations&&!e.hasLocalMutations}applyChanges(t,e,n){const s=this.Qu;this.Qu=t.Qu,this.mutatedKeys=t.mutatedKeys;const r=t.zu.Eu();r.sort(((t,e)=>function(t,e){const n=t=>{switch(t){case 0:return 1;case 2:case 3:return 2;case 1:return 0;default:return Ur()}};return n(t)-n(e)}
1666
+ */class zh{constructor(t){this.key=t}}class Qh{constructor(t){this.key=t}}class Yh{constructor(t,e){this.query=t,this.qu=e,this.Uu=null,this.hasCachedResults=!1,this.current=!1,this.Ku=kc(),this.mutatedKeys=kc(),this.Gu=Pa(t),this.Qu=new Uh(this.Gu)}get ju(){return this.qu}Wu(t,e){const n=e?e.zu:new Fh,r=e?e.Qu:this.Qu;let s=e?e.mutatedKeys:this.mutatedKeys,i=r,o=!1;const a="F"===this.query.limitType&&r.size===this.query.limit?r.last():null,c="L"===this.query.limitType&&r.size===this.query.limit?r.first():null;if(t.inorderTraversal(((t,e)=>{const u=r.get(t),h=La(this.query,e)?e:null,l=!!u&&this.mutatedKeys.has(u.key),d=!!h&&(h.hasLocalMutations||this.mutatedKeys.has(h.key)&&h.hasCommittedMutations);let f=!1;u&&h?u.data.isEqual(h.data)?l!==d&&(n.track({type:3,doc:h}),f=!0):this.Hu(u,h)||(n.track({type:2,doc:h}),f=!0,(a&&this.Gu(h,a)>0||c&&this.Gu(h,c)<0)&&(o=!0)):!u&&h?(n.track({type:0,doc:h}),f=!0):u&&!h&&(n.track({type:1,doc:u}),f=!0,(a||c)&&(o=!0)),f&&(h?(i=i.add(h),s=d?s.add(t):s.delete(t)):(i=i.delete(t),s=s.delete(t)))})),null!==this.query.limit)for(;i.size>this.query.limit;){const t="F"===this.query.limitType?i.last():i.first();i=i.delete(t.key),s=s.delete(t.key),n.track({type:1,doc:t})}return{Qu:i,zu:n,$i:o,mutatedKeys:s}}Hu(t,e){return t.hasLocalMutations&&e.hasCommittedMutations&&!e.hasLocalMutations}applyChanges(t,e,n){const r=this.Qu;this.Qu=t.Qu,this.mutatedKeys=t.mutatedKeys;const s=t.zu.Eu();s.sort(((t,e)=>function(t,e){const n=t=>{switch(t){case 0:return 1;case 2:case 3:return 2;case 1:return 0;default:return ki()}};return n(t)-n(e)}
1585
1667
  /**
1586
1668
  * @license
1587
1669
  * Copyright 2020 Google LLC
@@ -1597,7 +1679,7 @@ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1597
1679
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1598
1680
  * See the License for the specific language governing permissions and
1599
1681
  * limitations under the License.
1600
- */(t.type,e.type)||this.Gu(t.doc,e.doc))),this.Ju(n);const i=e?this.Yu():[],o=0===this.Ku.size&&this.current?1:0,a=o!==this.Uu;return this.Uu=o,0!==r.length||a?{snapshot:new Eu(this.query,t.Qu,s,r,t.mutatedKeys,0===o,a,!1,!!n&&n.resumeToken.approximateByteSize()>0),Xu:i}:{Xu:i}}bu(t){return this.current&&"Offline"===t?(this.current=!1,this.applyChanges({Qu:this.Qu,zu:new Iu,mutatedKeys:this.mutatedKeys,$i:!1},!1)):{Xu:[]}}Zu(t){return!this.qu.has(t)&&!!this.Qu.has(t)&&!this.Qu.get(t).hasLocalMutations}Ju(t){t&&(t.addedDocuments.forEach((t=>this.qu=this.qu.add(t))),t.modifiedDocuments.forEach((t=>{})),t.removedDocuments.forEach((t=>this.qu=this.qu.delete(t))),this.current=t.current)}Yu(){if(!this.current)return[];const t=this.Ku;this.Ku=Ra(),this.Qu.forEach((t=>{this.Zu(t.key)&&(this.Ku=this.Ku.add(t.key))}));const e=[];return t.forEach((t=>{this.Ku.has(t)||e.push(new Lu(t))})),this.Ku.forEach((n=>{t.has(n)||e.push(new Du(n))})),e}tc(t){this.qu=t.Hi,this.Ku=Ra();const e=this.Wu(t.documents);return this.applyChanges(e,!0)}ec(){return Eu.fromInitialDocuments(this.query,this.Qu,this.mutatedKeys,0===this.Uu,this.hasCachedResults)}}class Mu{constructor(t,e,n){this.query=t,this.targetId=e,this.view=n}}class xu{constructor(t){this.key=t,this.nc=!1}}class Uu{constructor(t,e,n,s,r,i){this.localStore=t,this.remoteStore=e,this.eventManager=n,this.sharedClientState=s,this.currentUser=r,this.maxConcurrentLimboResolutions=i,this.sc={},this.ic=new _a((t=>Fo(t)),Uo),this.rc=new Map,this.oc=new Set,this.uc=new po(ai.comparator),this.cc=new Map,this.ac=new bc,this.hc={},this.lc=new Map,this.fc=wc.vn(),this.onlineState="Unknown",this.dc=void 0}get isPrimaryClient(){return!0===this.dc}}async function Fu(t,e){const n=function(t){const e=Vr(t);return e.remoteStore.remoteSyncer.applyRemoteEvent=Bu.bind(null,e),e.remoteStore.remoteSyncer.getRemoteKeysForTarget=Ju.bind(null,e),e.remoteStore.remoteSyncer.rejectListen=ju.bind(null,e),e.sc.Wo=ku.bind(null,e.eventManager),e.sc.wc=Nu.bind(null,e.eventManager),e}(t);let s,r;const i=n.ic.get(e);if(i)s=i.targetId,n.sharedClientState.addLocalQueryTarget(s),r=i.view.ec();else{const t=await function(t,e){const n=Vr(t);return n.persistence.runTransaction("Allocate target","readwrite",(t=>{let s;return n.Cs.getTargetData(t,e).next((r=>r?(s=r,fi.resolve(s)):n.Cs.allocateTargetId(t).next((r=>(s=new pc(e,r,0,t.currentSequenceNumber),n.Cs.addTargetData(t,s).next((()=>s)))))))})).then((t=>{const s=n.qi.get(t.targetId);return(null===s||t.snapshotVersion.compareTo(s.snapshotVersion)>0)&&(n.qi=n.qi.insert(t.targetId,t),n.Ui.set(e,t.targetId)),t}))}(n.localStore,Po(e));n.isPrimaryClient&&iu(n.remoteStore,t);const i=n.sharedClientState.addLocalQueryTarget(t.targetId);s=t.targetId,r=await async function(t,e,n,s,r){t._c=(e,n,s)=>async function(t,e,n,s){let r=e.view.Wu(n);r.$i&&(r=await Hc(t.localStore,e.query,!1).then((({documents:t})=>e.view.Wu(t,r))));const i=s&&s.targetChanges.get(e.targetId),o=e.view.applyChanges(r,t.isPrimaryClient,i);return Gu(t,e.targetId,o.Xu),o.snapshot}(t,e,n,s);const i=await Hc(t.localStore,e,!0),o=new Pu(e,i.Hi),a=o.Wu(i.documents),c=Pa.createSynthesizedTargetChangeForCurrentChange(n,s&&"Offline"!==t.onlineState,r),u=o.applyChanges(a,t.isPrimaryClient,c);Gu(t,n,u.Xu);const h=new Mu(e,n,o);return t.ic.set(e,h),t.rc.has(n)?t.rc.get(n).push(e):t.rc.set(n,[e]),u.snapshot}(n,e,s,"current"===i,t.resumeToken)}return r}async function Vu(t,e){const n=Vr(t),s=n.ic.get(e),r=n.rc.get(s.targetId);if(r.length>1)return n.rc.set(s.targetId,r.filter((t=>!Uo(t,e)))),void n.ic.delete(e);n.isPrimaryClient?(n.sharedClientState.removeLocalQueryTarget(s.targetId),n.sharedClientState.isActiveQueryTarget(s.targetId)||await Bc(n.localStore,s.targetId,!1).then((()=>{n.sharedClientState.clearQueryState(s.targetId),ou(n.remoteStore,s.targetId),qu(n,s.targetId)})).catch(di)):(qu(n,s.targetId),await Bc(n.localStore,s.targetId,!0))}async function Bu(t,e){const n=Vr(t);try{const t=await Vc(n.localStore,e);e.targetChanges.forEach(((t,e)=>{const s=n.cc.get(e);s&&(Fr(t.addedDocuments.size+t.modifiedDocuments.size+t.removedDocuments.size<=1),t.addedDocuments.size>0?s.nc=!0:t.modifiedDocuments.size>0?Fr(s.nc):t.removedDocuments.size>0&&(Fr(s.nc),s.nc=!1))})),await $u(n,t,e)}catch(t){await di(t)}}function Hu(t,e,n){const s=Vr(t);if(s.isPrimaryClient&&0===n||!s.isPrimaryClient&&1===n){const t=[];s.ic.forEach(((n,s)=>{const r=s.view.bu(e);r.snapshot&&t.push(r.snapshot)})),function(t,e){const n=Vr(t);n.onlineState=e;let s=!1;n.queries.forEach(((t,n)=>{for(const t of n.listeners)t.bu(e)&&(s=!0)})),s&&Ru(n)}(s.eventManager,e),t.length&&s.sc.Wo(t),s.onlineState=e,s.isPrimaryClient&&s.sharedClientState.setOnlineState(e)}}async function ju(t,e,n){const s=Vr(t);s.sharedClientState.updateQueryState(e,"rejected",n);const r=s.cc.get(e),i=r&&r.key;if(i){let t=new po(ai.comparator);t=t.insert(i,To.newNoDocument(i,ni.min()));const n=Ra().add(i),r=new La(ni.min(),new Map,new yo(Zr),t,n);await Bu(s,r),s.uc=s.uc.remove(i),s.cc.delete(e),zu(s)}else await Bc(s.localStore,e,!1).then((()=>qu(s,e,n))).catch(di)}function qu(t,e,n=null){t.sharedClientState.removeLocalQueryTarget(e);for(const s of t.rc.get(e))t.ic.delete(s),n&&t.sc.wc(s,n);t.rc.delete(e),t.isPrimaryClient&&t.ac.ls(e).forEach((e=>{t.ac.containsKey(e)||Ku(t,e)}))}function Ku(t,e){t.oc.delete(e.path.canonicalString());const n=t.uc.get(e);null!==n&&(ou(t.remoteStore,n),t.uc=t.uc.remove(e),t.cc.delete(n),zu(t))}function Gu(t,e,n){for(const s of n)s instanceof Du?(t.ac.addReference(s.key,e),Wu(t,s)):s instanceof Lu?(Lr("SyncEngine","Document no longer in limbo: "+s.key),t.ac.removeReference(s.key,e),t.ac.containsKey(s.key)||Ku(t,s.key)):Ur()}function Wu(t,e){const n=e.key,s=n.path.canonicalString();t.uc.get(n)||t.oc.has(s)||(Lr("SyncEngine","New document in limbo: "+n),t.oc.add(s),zu(t))}function zu(t){for(;t.oc.size>0&&t.uc.size<t.maxConcurrentLimboResolutions;){const e=t.oc.values().next().value;t.oc.delete(e);const n=new ai(ri.fromString(e)),s=t.fc.next();t.cc.set(s,new xu(n)),t.uc=t.uc.insert(n,s),iu(t.remoteStore,new pc(Po(ko(n.path)),s,2,gi.at))}}async function $u(t,e,n){const s=Vr(t),r=[],i=[],o=[];s.ic.isEmpty()||(s.ic.forEach(((t,a)=>{o.push(s._c(a,e,n).then((t=>{if((t||n)&&s.isPrimaryClient&&s.sharedClientState.updateQueryState(a.targetId,(null==t?void 0:t.fromCache)?"not-current":"current"),t){r.push(t);const e=Pc.Ci(a.targetId,t);i.push(e)}})))})),await Promise.all(o),s.sc.Wo(r),await async function(t,e){const n=Vr(t);try{await n.persistence.runTransaction("notifyLocalViewChanges","readwrite",(t=>fi.forEach(e,(e=>fi.forEach(e.Si,(s=>n.persistence.referenceDelegate.addReference(t,e.targetId,s))).next((()=>fi.forEach(e.Di,(s=>n.persistence.referenceDelegate.removeReference(t,e.targetId,s)))))))))}catch(t){if(!pi(t))throw t;Lr("LocalStore","Failed to update sequence numbers: "+t)}for(const t of e){const e=t.targetId;if(!t.fromCache){const t=n.qi.get(e),s=t.snapshotVersion,r=t.withLastLimboFreeSnapshotVersion(s);n.qi=n.qi.insert(e,r)}}}(s.localStore,i))}async function Qu(t,e){const n=Vr(t);if(!n.currentUser.isEqual(e)){Lr("SyncEngine","User change. New user:",e.toKey());const t=await Uc(n.localStore,e);n.currentUser=e,function(t,e){t.lc.forEach((t=>{t.forEach((t=>{t.reject(new Hr(Br.CANCELLED,"'waitForPendingWrites' promise is rejected due to a user change."))}))})),t.lc.clear()}(n),n.sharedClientState.handleUserChange(e,t.removedBatchIds,t.addedBatchIds),await $u(n,t.ji)}}function Ju(t,e){const n=Vr(t),s=n.cc.get(e);if(s&&s.nc)return Ra().add(s.key);{let t=Ra();const s=n.rc.get(e);if(!s)return t;for(const e of s){const s=n.ic.get(e);t=t.unionWith(s.view.ju)}return t}}class Yu{constructor(){this.synchronizeTabs=!1}async initialize(t){this.yt=Jc(t.databaseInfo.databaseId),this.sharedClientState=this.gc(t),this.persistence=this.yc(t),await this.persistence.start(),this.localStore=this.Ic(t),this.gcScheduler=this.Tc(t,this.localStore),this.indexBackfillerScheduler=this.Ec(t,this.localStore)}Tc(t,e){return null}Ec(t,e){return null}Ic(t){return function(t,e,n,s){return new xc(t,e,n,s)}(this.persistence,new Mc,t.initialUser,this.yt)}yc(t){return new Oc(Lc.Bs,this.yt)}gc(t){return new qc}async terminate(){this.gcScheduler&&this.gcScheduler.stop(),await this.sharedClientState.shutdown(),await this.persistence.shutdown()}}class Xu{async initialize(t,e){this.localStore||(this.localStore=t.localStore,this.sharedClientState=t.sharedClientState,this.datastore=this.createDatastore(e),this.remoteStore=this.createRemoteStore(e),this.eventManager=this.createEventManager(e),this.syncEngine=this.createSyncEngine(e,!t.synchronizeTabs),this.sharedClientState.onlineStateHandler=t=>Hu(this.syncEngine,t,1),this.remoteStore.remoteSyncer.handleCredentialChange=Qu.bind(null,this.syncEngine),await async function(t,e){const n=Vr(t);e?(n._u.delete(2),await su(n)):e||(n._u.add(2),await ru(n),n.gu.set("Unknown"))}(this.remoteStore,this.syncEngine.isPrimaryClient))}createEventManager(t){return new bu}createDatastore(t){const e=Jc(t.databaseInfo.databaseId),n=(s=t.databaseInfo,new $c(s));var s;return function(t,e,n,s){return new tu(t,e,n,s)}(t.authCredentials,t.appCheckCredentials,n,e)}createRemoteStore(t){return e=this.localStore,n=this.datastore,s=t.asyncQueue,r=t=>Hu(this.syncEngine,t,0),i=Gc.C()?new Gc:new Kc,new nu(e,n,s,r,i);var e,n,s,r,i}createSyncEngine(t,e){return function(t,e,n,s,r,i,o){const a=new Uu(t,e,n,s,r,i);return o&&(a.dc=!0),a}(this.localStore,this.remoteStore,this.eventManager,this.sharedClientState,t.initialUser,t.maxConcurrentLimboResolutions,e)}terminate(){return async function(t){const e=Vr(t);Lr("RemoteStore","RemoteStore shutting down."),e._u.add(5),await ru(e),e.mu.shutdown(),e.gu.set("Unknown")}(this.remoteStore)}}
1682
+ */(t.type,e.type)||this.Gu(t.doc,e.doc))),this.Ju(n);const i=e?this.Yu():[],o=0===this.Ku.size&&this.current?1:0,a=o!==this.Uu;return this.Uu=o,0!==s.length||a?{snapshot:new Vh(this.query,t.Qu,r,s,t.mutatedKeys,0===o,a,!1,!!n&&n.resumeToken.approximateByteSize()>0),Xu:i}:{Xu:i}}bu(t){return this.current&&"Offline"===t?(this.current=!1,this.applyChanges({Qu:this.Qu,zu:new Fh,mutatedKeys:this.mutatedKeys,$i:!1},!1)):{Xu:[]}}Zu(t){return!this.qu.has(t)&&!!this.Qu.has(t)&&!this.Qu.get(t).hasLocalMutations}Ju(t){t&&(t.addedDocuments.forEach((t=>this.qu=this.qu.add(t))),t.modifiedDocuments.forEach((t=>{})),t.removedDocuments.forEach((t=>this.qu=this.qu.delete(t))),this.current=t.current)}Yu(){if(!this.current)return[];const t=this.Ku;this.Ku=kc(),this.Qu.forEach((t=>{this.Zu(t.key)&&(this.Ku=this.Ku.add(t.key))}));const e=[];return t.forEach((t=>{this.Ku.has(t)||e.push(new Qh(t))})),this.Ku.forEach((n=>{t.has(n)||e.push(new zh(n))})),e}tc(t){this.qu=t.Hi,this.Ku=kc();const e=this.Wu(t.documents);return this.applyChanges(e,!0)}ec(){return Vh.fromInitialDocuments(this.query,this.Qu,this.mutatedKeys,0===this.Uu,this.hasCachedResults)}}class Jh{constructor(t,e,n){this.query=t,this.targetId=e,this.view=n}}class Xh{constructor(t){this.key=t,this.nc=!1}}class Zh{constructor(t,e,n,r,s,i){this.localStore=t,this.remoteStore=e,this.eventManager=n,this.sharedClientState=r,this.currentUser=s,this.maxConcurrentLimboResolutions=i,this.sc={},this.ic=new yc((t=>Da(t)),Na),this.rc=new Map,this.oc=new Set,this.uc=new oa(Xi.comparator),this.cc=new Map,this.ac=new ku,this.hc={},this.lc=new Map,this.fc=Eu.vn(),this.onlineState="Unknown",this.dc=void 0}get isPrimaryClient(){return!0===this.dc}}async function tl(t,e){const n=function(t){const e=Ni(t);return e.remoteStore.remoteSyncer.applyRemoteEvent=rl.bind(null,e),e.remoteStore.remoteSyncer.getRemoteKeysForTarget=yl.bind(null,e),e.remoteStore.remoteSyncer.rejectListen=il.bind(null,e),e.sc.Wo=qh.bind(null,e.eventManager),e.sc.wc=Kh.bind(null,e.eventManager),e}(t);let r,s;const i=n.ic.get(e);if(i)r=i.targetId,n.sharedClientState.addLocalQueryTarget(r),s=i.view.ec();else{const t=await function(t,e){const n=Ni(t);return n.persistence.runTransaction("Allocate target","readwrite",(t=>{let r;return n.Cs.getTargetData(t,e).next((s=>s?(r=s,io.resolve(r)):n.Cs.allocateTargetId(t).next((s=>(r=new yu(e,s,0,t.currentSequenceNumber),n.Cs.addTargetData(t,r).next((()=>r)))))))})).then((t=>{const r=n.qi.get(t.targetId);return(null===r||t.snapshotVersion.compareTo(r.snapshotVersion)>0)&&(n.qi=n.qi.insert(t.targetId,t),n.Ui.set(e,t.targetId)),t}))}(n.localStore,Ca(e));n.isPrimaryClient&&hh(n.remoteStore,t);const i=n.sharedClientState.addLocalQueryTarget(t.targetId);r=t.targetId,s=await async function(t,e,n,r,s){t._c=(e,n,r)=>async function(t,e,n,r){let s=e.view.Wu(n);s.$i&&(s=await Ku(t.localStore,e.query,!1).then((({documents:t})=>e.view.Wu(t,s))));const i=r&&r.targetChanges.get(e.targetId),o=e.view.applyChanges(s,t.isPrimaryClient,i);return dl(t,e.targetId,o.Xu),o.snapshot}(t,e,n,r);const i=await Ku(t.localStore,e,!0),o=new Yh(e,i.Hi),a=o.Wu(i.documents),c=Oc.createSynthesizedTargetChangeForCurrentChange(n,r&&"Offline"!==t.onlineState,s),u=o.applyChanges(a,t.isPrimaryClient,c);dl(t,n,u.Xu);const h=new Jh(e,n,o);return t.ic.set(e,h),t.rc.has(n)?t.rc.get(n).push(e):t.rc.set(n,[e]),u.snapshot}(n,e,r,"current"===i,t.resumeToken)}return s}async function el(t,e){const n=Ni(t),r=n.ic.get(e),s=n.rc.get(r.targetId);if(s.length>1)return n.rc.set(r.targetId,s.filter((t=>!Na(t,e)))),void n.ic.delete(e);n.isPrimaryClient?(n.sharedClientState.removeLocalQueryTarget(r.targetId),n.sharedClientState.isActiveQueryTarget(r.targetId)||await qu(n.localStore,r.targetId,!1).then((()=>{n.sharedClientState.clearQueryState(r.targetId),lh(n.remoteStore,r.targetId),hl(n,r.targetId)})).catch(so)):(hl(n,r.targetId),await qu(n.localStore,r.targetId,!0))}async function nl(t,e,n){const r=function(t){const e=Ni(t);return e.remoteStore.remoteSyncer.applySuccessfulWrite=ol.bind(null,e),e.remoteStore.remoteSyncer.rejectFailedWrite=al.bind(null,e),e}(t);try{const t=await function(t,e){const n=Ni(t),r=Wi.now(),s=e.reduce(((t,e)=>t.add(e.key)),kc());let i,o;return n.persistence.runTransaction("Locally write mutations","readwrite",(t=>{let a=wc(),c=kc();return n.Gi.getEntries(t,s).next((t=>{a=t,a.forEach(((t,e)=>{e.isValidDocument()||(c=c.add(t))}))})).next((()=>n.localDocuments.getOverlayedDocuments(t,a))).next((s=>{i=s;const o=[];for(const t of e){const e=sc(t,i.get(t.key).overlayedDocument);null!=e&&o.push(new ac(t.key,e,fa(e.value.mapValue),Xa.exists(!0)))}return n.mutationQueue.addMutationBatch(t,r,o,e)})).next((e=>{o=e;const r=e.applyToLocalDocumentSet(i,c);return n.documentOverlayCache.saveOverlays(t,e.batchId,r)}))})).then((()=>({batchId:o.batchId,changes:Ec(i)})))}(r.localStore,e);r.sharedClientState.addPendingMutation(t.batchId),function(t,e,n){let r=t.hc[t.currentUser.toKey()];r||(r=new oa(qi)),r=r.insert(e,n),t.hc[t.currentUser.toKey()]=r}(r,t.batchId,n),await gl(r,t.changes),await Sh(r.remoteStore)}catch(t){const e=xh(t,"Failed to persist write");n.reject(e)}}async function rl(t,e){const n=Ni(t);try{const t=await ju(n.localStore,e);e.targetChanges.forEach(((t,e)=>{const r=n.cc.get(e);r&&(Ri(t.addedDocuments.size+t.modifiedDocuments.size+t.removedDocuments.size<=1),t.addedDocuments.size>0?r.nc=!0:t.modifiedDocuments.size>0?Ri(r.nc):t.removedDocuments.size>0&&(Ri(r.nc),r.nc=!1))})),await gl(n,t,e)}catch(t){await so(t)}}function sl(t,e,n){const r=Ni(t);if(r.isPrimaryClient&&0===n||!r.isPrimaryClient&&1===n){const t=[];r.ic.forEach(((n,r)=>{const s=r.view.bu(e);s.snapshot&&t.push(s.snapshot)})),function(t,e){const n=Ni(t);n.onlineState=e;let r=!1;n.queries.forEach(((t,n)=>{for(const t of n.listeners)t.bu(e)&&(r=!0)})),r&&Wh(n)}(r.eventManager,e),t.length&&r.sc.Wo(t),r.onlineState=e,r.isPrimaryClient&&r.sharedClientState.setOnlineState(e)}}async function il(t,e,n){const r=Ni(t);r.sharedClientState.updateQueryState(e,"rejected",n);const s=r.cc.get(e),i=s&&s.key;if(i){let t=new oa(Xi.comparator);t=t.insert(i,pa.newNoDocument(i,Gi.min()));const n=kc().add(i),s=new Dc(Gi.min(),new Map,new ua(qi),t,n);await rl(r,s),r.uc=r.uc.remove(i),r.cc.delete(e),pl(r)}else await qu(r.localStore,e,!1).then((()=>hl(r,e,n))).catch(so)}async function ol(t,e){const n=Ni(t),r=e.batch.batchId;try{const t=await function(t,e){const n=Ni(t);return n.persistence.runTransaction("Acknowledge batch","readwrite-primary",(t=>{const r=e.batch.keys(),s=n.Gi.newChangeBuffer({trackRemovals:!0});return function(t,e,n,r){const s=n.batch,i=s.keys();let o=io.resolve();return i.forEach((t=>{o=o.next((()=>r.getEntry(e,t))).next((e=>{const i=n.docVersions.get(t);Ri(null!==i),e.version.compareTo(i)<0&&(s.applyToRemoteDocument(e,n),e.isValidDocument()&&(e.setReadTime(n.commitVersion),r.addEntry(e)))}))})),o.next((()=>t.mutationQueue.removeMutationBatch(e,s)))}(n,t,e,s).next((()=>s.apply(t))).next((()=>n.mutationQueue.performConsistencyCheck(t))).next((()=>n.documentOverlayCache.removeOverlaysForBatchId(t,r,e.batch.batchId))).next((()=>n.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(t,function(t){let e=kc();for(let n=0;n<t.mutationResults.length;++n)t.mutationResults[n].transformResults.length>0&&(e=e.add(t.batch.mutations[n].key));return e}(e)))).next((()=>n.localDocuments.getDocuments(t,r)))}))}(n.localStore,e);ul(n,r,null),cl(n,r),n.sharedClientState.updateMutationState(r,"acknowledged"),await gl(n,t)}catch(t){await so(t)}}async function al(t,e,n){const r=Ni(t);try{const t=await function(t,e){const n=Ni(t);return n.persistence.runTransaction("Reject batch","readwrite-primary",(t=>{let r;return n.mutationQueue.lookupMutationBatch(t,e).next((e=>(Ri(null!==e),r=e.keys(),n.mutationQueue.removeMutationBatch(t,e)))).next((()=>n.mutationQueue.performConsistencyCheck(t))).next((()=>n.documentOverlayCache.removeOverlaysForBatchId(t,r,e))).next((()=>n.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(t,r))).next((()=>n.localDocuments.getDocuments(t,r)))}))}(r.localStore,e);ul(r,e,n),cl(r,e),r.sharedClientState.updateMutationState(e,"rejected",n),await gl(r,t)}catch(n){await so(n)}}function cl(t,e){(t.lc.get(e)||[]).forEach((t=>{t.resolve()})),t.lc.delete(e)}function ul(t,e,n){const r=Ni(t);let s=r.hc[r.currentUser.toKey()];if(s){const t=s.get(e);t&&(n?t.reject(n):t.resolve(),s=s.remove(e)),r.hc[r.currentUser.toKey()]=s}}function hl(t,e,n=null){t.sharedClientState.removeLocalQueryTarget(e);for(const r of t.rc.get(e))t.ic.delete(r),n&&t.sc.wc(r,n);t.rc.delete(e),t.isPrimaryClient&&t.ac.ls(e).forEach((e=>{t.ac.containsKey(e)||ll(t,e)}))}function ll(t,e){t.oc.delete(e.path.canonicalString());const n=t.uc.get(e);null!==n&&(lh(t.remoteStore,n),t.uc=t.uc.remove(e),t.cc.delete(n),pl(t))}function dl(t,e,n){for(const r of n)r instanceof zh?(t.ac.addReference(r.key,e),fl(t,r)):r instanceof Qh?(Ii("SyncEngine","Document no longer in limbo: "+r.key),t.ac.removeReference(r.key,e),t.ac.containsKey(r.key)||ll(t,r.key)):ki()}function fl(t,e){const n=e.key,r=n.path.canonicalString();t.uc.get(n)||t.oc.has(r)||(Ii("SyncEngine","New document in limbo: "+n),t.oc.add(r),pl(t))}function pl(t){for(;t.oc.size>0&&t.uc.size<t.maxConcurrentLimboResolutions;){const e=t.oc.values().next().value;t.oc.delete(e);const n=new Xi(Qi.fromString(e)),r=t.fc.next();t.cc.set(r,new Xh(n)),t.uc=t.uc.insert(n,r),hh(t.remoteStore,new yu(Ca(Ta(n.path)),r,2,ao.at))}}async function gl(t,e,n){const r=Ni(t),s=[],i=[],o=[];r.ic.isEmpty()||(r.ic.forEach(((t,a)=>{o.push(r._c(a,e,n).then((t=>{if((t||n)&&r.isPrimaryClient&&r.sharedClientState.updateQueryState(a.targetId,(null==t?void 0:t.fromCache)?"not-current":"current"),t){s.push(t);const e=Uu.Ci(a.targetId,t);i.push(e)}})))})),await Promise.all(o),r.sc.Wo(s),await async function(t,e){const n=Ni(t);try{await n.persistence.runTransaction("notifyLocalViewChanges","readwrite",(t=>io.forEach(e,(e=>io.forEach(e.Si,(r=>n.persistence.referenceDelegate.addReference(t,e.targetId,r))).next((()=>io.forEach(e.Di,(r=>n.persistence.referenceDelegate.removeReference(t,e.targetId,r)))))))))}catch(t){if(!oo(t))throw t;Ii("LocalStore","Failed to update sequence numbers: "+t)}for(const t of e){const e=t.targetId;if(!t.fromCache){const t=n.qi.get(e),r=t.snapshotVersion,s=t.withLastLimboFreeSnapshotVersion(r);n.qi=n.qi.insert(e,s)}}}(r.localStore,i))}async function ml(t,e){const n=Ni(t);if(!n.currentUser.isEqual(e)){Ii("SyncEngine","User change. New user:",e.toKey());const t=await Bu(n.localStore,e);n.currentUser=e,function(t,e){t.lc.forEach((t=>{t.forEach((t=>{t.reject(new Oi(Di.CANCELLED,"'waitForPendingWrites' promise is rejected due to a user change."))}))})),t.lc.clear()}(n),n.sharedClientState.handleUserChange(e,t.removedBatchIds,t.addedBatchIds),await gl(n,t.ji)}}function yl(t,e){const n=Ni(t),r=n.cc.get(e);if(r&&r.nc)return kc().add(r.key);{let t=kc();const r=n.rc.get(e);if(!r)return t;for(const e of r){const r=n.ic.get(e);t=t.unionWith(r.view.ju)}return t}}class vl{constructor(){this.synchronizeTabs=!1}async initialize(t){this.yt=th(t.databaseInfo.databaseId),this.sharedClientState=this.gc(t),this.persistence=this.yc(t),await this.persistence.start(),this.localStore=this.Ic(t),this.gcScheduler=this.Tc(t,this.localStore),this.indexBackfillerScheduler=this.Ec(t,this.localStore)}Tc(t,e){return null}Ec(t,e){return null}Ic(t){return function(t,e,n,r){return new Vu(t,e,n,r)}(this.persistence,new Fu,t.initialUser,this.yt)}yc(t){return new Pu(xu.Bs,this.yt)}gc(t){return new Gu}async terminate(){this.gcScheduler&&this.gcScheduler.stop(),await this.sharedClientState.shutdown(),await this.persistence.shutdown()}}class wl{async initialize(t,e){this.localStore||(this.localStore=t.localStore,this.sharedClientState=t.sharedClientState,this.datastore=this.createDatastore(e),this.remoteStore=this.createRemoteStore(e),this.eventManager=this.createEventManager(e),this.syncEngine=this.createSyncEngine(e,!t.synchronizeTabs),this.sharedClientState.onlineStateHandler=t=>sl(this.syncEngine,t,1),this.remoteStore.remoteSyncer.handleCredentialChange=ml.bind(null,this.syncEngine),await async function(t,e){const n=Ni(t);e?(n._u.delete(2),await ch(n)):e||(n._u.add(2),await uh(n),n.gu.set("Unknown"))}(this.remoteStore,this.syncEngine.isPrimaryClient))}createEventManager(t){return new Hh}createDatastore(t){const e=th(t.databaseInfo.databaseId),n=(r=t.databaseInfo,new Xu(r));var r;return function(t,e,n,r){return new ih(t,e,n,r)}(t.authCredentials,t.appCheckCredentials,n,e)}createRemoteStore(t){return e=this.localStore,n=this.datastore,r=t.asyncQueue,s=t=>sl(this.syncEngine,t,0),i=Qu.C()?new Qu:new zu,new ah(e,n,r,s,i);var e,n,r,s,i}createSyncEngine(t,e){return function(t,e,n,r,s,i,o){const a=new Zh(t,e,n,r,s,i);return o&&(a.dc=!0),a}(this.localStore,this.remoteStore,this.eventManager,this.sharedClientState,t.initialUser,t.maxConcurrentLimboResolutions,e)}terminate(){return async function(t){const e=Ni(t);Ii("RemoteStore","RemoteStore shutting down."),e._u.add(5),await uh(e),e.mu.shutdown(),e.gu.set("Unknown")}(this.remoteStore)}}
1601
1683
  /**
1602
1684
  * @license
1603
1685
  * Copyright 2017 Google LLC
@@ -1613,7 +1695,7 @@ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1613
1695
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1614
1696
  * See the License for the specific language governing permissions and
1615
1697
  * limitations under the License.
1616
- */function Zu(t,e,n){if(!n)throw new Hr(Br.INVALID_ARGUMENT,`Function ${t}() cannot be called with an empty ${e}.`)}function th(t){if(!ai.isDocumentKey(t))throw new Hr(Br.INVALID_ARGUMENT,`Invalid document reference. Document references must have an even number of segments, but ${t} has ${t.length}.`)}function eh(t){if(ai.isDocumentKey(t))throw new Hr(Br.INVALID_ARGUMENT,`Invalid collection reference. Collection references must have an odd number of segments, but ${t} has ${t.length}.`)}function nh(t){if(void 0===t)return"undefined";if(null===t)return"null";if("string"==typeof t)return t.length>20&&(t=`${t.substring(0,20)}...`),JSON.stringify(t);if("number"==typeof t||"boolean"==typeof t)return""+t;if("object"==typeof t){if(t instanceof Array)return"an array";{const e=function(t){return t.constructor?t.constructor.name:null}(t);return e?`a custom ${e} object`:"an object"}}return"function"==typeof t?"a function":Ur()}function sh(t,e){if("_delegate"in t&&(t=t._delegate),!(t instanceof e)){if(e.name===t.constructor.name)throw new Hr(Br.INVALID_ARGUMENT,"Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");{const n=nh(t);throw new Hr(Br.INVALID_ARGUMENT,`Expected type '${e.name}', but it was: ${n}`)}}return t}
1698
+ */function _l(t,e,n){if(!n)throw new Oi(Di.INVALID_ARGUMENT,`Function ${t}() cannot be called with an empty ${e}.`)}function Tl(t){if(!Xi.isDocumentKey(t))throw new Oi(Di.INVALID_ARGUMENT,`Invalid document reference. Document references must have an even number of segments, but ${t} has ${t.length}.`)}function El(t){if(Xi.isDocumentKey(t))throw new Oi(Di.INVALID_ARGUMENT,`Invalid collection reference. Collection references must have an odd number of segments, but ${t} has ${t.length}.`)}function Sl(t){if(void 0===t)return"undefined";if(null===t)return"null";if("string"==typeof t)return t.length>20&&(t=`${t.substring(0,20)}...`),JSON.stringify(t);if("number"==typeof t||"boolean"==typeof t)return""+t;if("object"==typeof t){if(t instanceof Array)return"an array";{const e=function(t){return t.constructor?t.constructor.name:null}(t);return e?`a custom ${e} object`:"an object"}}return"function"==typeof t?"a function":ki()}function Il(t,e){if("_delegate"in t&&(t=t._delegate),!(t instanceof e)){if(e.name===t.constructor.name)throw new Oi(Di.INVALID_ARGUMENT,"Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");{const n=Sl(t);throw new Oi(Di.INVALID_ARGUMENT,`Expected type '${e.name}', but it was: ${n}`)}}return t}
1617
1699
  /**
1618
1700
  * @license
1619
1701
  * Copyright 2020 Google LLC
@@ -1629,7 +1711,7 @@ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1629
1711
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1630
1712
  * See the License for the specific language governing permissions and
1631
1713
  * limitations under the License.
1632
- */const rh=new Map;class ih{constructor(t){var e;if(void 0===t.host){if(void 0!==t.ssl)throw new Hr(Br.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===(e=t.ssl)||void 0===e||e;if(this.credentials=t.credentials,this.ignoreUndefinedProperties=!!t.ignoreUndefinedProperties,void 0===t.cacheSizeBytes)this.cacheSizeBytes=41943040;else{if(-1!==t.cacheSizeBytes&&t.cacheSizeBytes<1048576)throw new Hr(Br.INVALID_ARGUMENT,"cacheSizeBytes must be at least 1048576");this.cacheSizeBytes=t.cacheSizeBytes}this.experimentalForceLongPolling=!!t.experimentalForceLongPolling,this.experimentalAutoDetectLongPolling=!!t.experimentalAutoDetectLongPolling,this.useFetchStreams=!!t.useFetchStreams,function(t,e,n,s){if(!0===e&&!0===s)throw new Hr(Br.INVALID_ARGUMENT,`${t} and ${n} cannot be used together.`)}("experimentalForceLongPolling",t.experimentalForceLongPolling,"experimentalAutoDetectLongPolling",t.experimentalAutoDetectLongPolling)}isEqual(t){return this.host===t.host&&this.ssl===t.ssl&&this.credentials===t.credentials&&this.cacheSizeBytes===t.cacheSizeBytes&&this.experimentalForceLongPolling===t.experimentalForceLongPolling&&this.experimentalAutoDetectLongPolling===t.experimentalAutoDetectLongPolling&&this.ignoreUndefinedProperties===t.ignoreUndefinedProperties&&this.useFetchStreams===t.useFetchStreams}}
1714
+ */const bl=new Map;class Al{constructor(t){var e;if(void 0===t.host){if(void 0!==t.ssl)throw new Oi(Di.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===(e=t.ssl)||void 0===e||e;if(this.credentials=t.credentials,this.ignoreUndefinedProperties=!!t.ignoreUndefinedProperties,void 0===t.cacheSizeBytes)this.cacheSizeBytes=41943040;else{if(-1!==t.cacheSizeBytes&&t.cacheSizeBytes<1048576)throw new Oi(Di.INVALID_ARGUMENT,"cacheSizeBytes must be at least 1048576");this.cacheSizeBytes=t.cacheSizeBytes}this.experimentalForceLongPolling=!!t.experimentalForceLongPolling,this.experimentalAutoDetectLongPolling=!!t.experimentalAutoDetectLongPolling,this.useFetchStreams=!!t.useFetchStreams,function(t,e,n,r){if(!0===e&&!0===r)throw new Oi(Di.INVALID_ARGUMENT,`${t} and ${n} cannot be used together.`)}("experimentalForceLongPolling",t.experimentalForceLongPolling,"experimentalAutoDetectLongPolling",t.experimentalAutoDetectLongPolling)}isEqual(t){return this.host===t.host&&this.ssl===t.ssl&&this.credentials===t.credentials&&this.cacheSizeBytes===t.cacheSizeBytes&&this.experimentalForceLongPolling===t.experimentalForceLongPolling&&this.experimentalAutoDetectLongPolling===t.experimentalAutoDetectLongPolling&&this.ignoreUndefinedProperties===t.ignoreUndefinedProperties&&this.useFetchStreams===t.useFetchStreams}}
1633
1715
  /**
1634
1716
  * @license
1635
1717
  * Copyright 2020 Google LLC
@@ -1645,7 +1727,24 @@ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1645
1727
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1646
1728
  * See the License for the specific language governing permissions and
1647
1729
  * limitations under the License.
1648
- */class oh{constructor(t,e,n,s){this._authCredentials=t,this._appCheckCredentials=e,this._databaseId=n,this._app=s,this.type="firestore-lite",this._persistenceKey="(lite)",this._settings=new ih({}),this._settingsFrozen=!1}get app(){if(!this._app)throw new Hr(Br.FAILED_PRECONDITION,"Firestore was not initialized using the Firebase SDK. 'app' is not available");return this._app}get _initialized(){return this._settingsFrozen}get _terminated(){return void 0!==this._terminateTask}_setSettings(t){if(this._settingsFrozen)throw new Hr(Br.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 ih(t),void 0!==t.credentials&&(this._authCredentials=function(t){if(!t)return new Kr;switch(t.type){case"gapi":const e=t.client;return new $r(e,t.sessionIndex||"0",t.iamToken||null,t.authTokenFactory||null);case"provider":return t.client;default:throw new Hr(Br.INVALID_ARGUMENT,"makeAuthCredentialsProvider failed due to invalid credential type")}}(t.credentials))}_getSettings(){return this._settings}_freezeSettings(){return this._settingsFrozen=!0,this._settings}_delete(){return this._terminateTask||(this._terminateTask=this._terminate()),this._terminateTask}toJSON(){return{app:this._app,databaseId:this._databaseId,settings:this._settings}}_terminate(){return function(t){const e=rh.get(t);e&&(Lr("ComponentProvider","Removing Datastore"),rh.delete(t),e.terminate())}(this),Promise.resolve()}}function ah(t,e,n,s={}){var i;const o=(t=sh(t,oh))._getSettings();if("firestore.googleapis.com"!==o.host&&o.host!==e&&Mr("Host has been set in both settings() and useEmulator(), emulator host will be used"),t._setSettings(Object.assign(Object.assign({},o),{host:`${e}:${n}`,ssl:!1})),s.mockUserToken){let e,n;if("string"==typeof s.mockUserToken)e=s.mockUserToken,n=Nr.MOCK_USER;else{e=function(t,e){if(t.uid)throw new Error('The "uid" field is no longer supported by mockUserToken. Please use "sub" instead for Firebase Auth User ID.');const n=e||"demo-project",s=t.iat||0,i=t.sub||t.user_id;if(!i)throw new Error("mockUserToken must contain 'sub' or 'user_id' field!");const o=Object.assign({iss:`https://securetoken.google.com/${n}`,aud:n,iat:s,exp:s+3600,auth_time:s,sub:i,user_id:i,firebase:{sign_in_provider:"custom",identities:{}}},t);return[r(JSON.stringify({alg:"none",type:"JWT"})),r(JSON.stringify(o)),""].join(".")}
1730
+ */class Cl{constructor(t,e,n,r){this._authCredentials=t,this._appCheckCredentials=e,this._databaseId=n,this._app=r,this.type="firestore-lite",this._persistenceKey="(lite)",this._settings=new Al({}),this._settingsFrozen=!1}get app(){if(!this._app)throw new Oi(Di.FAILED_PRECONDITION,"Firestore was not initialized using the Firebase SDK. 'app' is not available");return this._app}get _initialized(){return this._settingsFrozen}get _terminated(){return void 0!==this._terminateTask}_setSettings(t){if(this._settingsFrozen)throw new Oi(Di.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 Al(t),void 0!==t.credentials&&(this._authCredentials=function(t){if(!t)return new Mi;switch(t.type){case"gapi":const e=t.client;return new Vi(e,t.sessionIndex||"0",t.iamToken||null,t.authTokenFactory||null);case"provider":return t.client;default:throw new Oi(Di.INVALID_ARGUMENT,"makeAuthCredentialsProvider failed due to invalid credential type")}}(t.credentials))}_getSettings(){return this._settings}_freezeSettings(){return this._settingsFrozen=!0,this._settings}_delete(){return this._terminateTask||(this._terminateTask=this._terminate()),this._terminateTask}toJSON(){return{app:this._app,databaseId:this._databaseId,settings:this._settings}}_terminate(){return function(t){const e=bl.get(t);e&&(Ii("ComponentProvider","Removing Datastore"),bl.delete(t),e.terminate())}(this),Promise.resolve()}}function kl(t,e,n,r={}){var s;const i=(t=Il(t,Cl))._getSettings();if("firestore.googleapis.com"!==i.host&&i.host!==e&&Ai("Host has been set in both settings() and useEmulator(), emulator host will be used"),t._setSettings(Object.assign(Object.assign({},i),{host:`${e}:${n}`,ssl:!1})),r.mockUserToken){let e,n;if("string"==typeof r.mockUserToken)e=r.mockUserToken,n=_i.MOCK_USER;else{e=
1731
+ /**
1732
+ * @license
1733
+ * Copyright 2021 Google LLC
1734
+ *
1735
+ * Licensed under the Apache License, Version 2.0 (the "License");
1736
+ * you may not use this file except in compliance with the License.
1737
+ * You may obtain a copy of the License at
1738
+ *
1739
+ * http://www.apache.org/licenses/LICENSE-2.0
1740
+ *
1741
+ * Unless required by applicable law or agreed to in writing, software
1742
+ * distributed under the License is distributed on an "AS IS" BASIS,
1743
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1744
+ * See the License for the specific language governing permissions and
1745
+ * limitations under the License.
1746
+ */
1747
+ function(t,e){if(t.uid)throw new Error('The "uid" field is no longer supported by mockUserToken. Please use "sub" instead for Firebase Auth User ID.');const n=e||"demo-project",r=t.iat||0,s=t.sub||t.user_id;if(!s)throw new Error("mockUserToken must contain 'sub' or 'user_id' field!");const i=Object.assign({iss:`https://securetoken.google.com/${n}`,aud:n,iat:r,exp:r+3600,auth_time:r,sub:s,user_id:s,firebase:{sign_in_provider:"custom",identities:{}}},t);return[Xt(JSON.stringify({alg:"none",type:"JWT"})),Xt(JSON.stringify(i)),""].join(".")}
1649
1748
  /**
1650
1749
  * @license
1651
1750
  * Copyright 2017 Google LLC
@@ -1661,7 +1760,7 @@ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1661
1760
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1662
1761
  * See the License for the specific language governing permissions and
1663
1762
  * limitations under the License.
1664
- */(s.mockUserToken,null===(i=t._app)||void 0===i?void 0:i.options.projectId);const o=s.mockUserToken.sub||s.mockUserToken.user_id;if(!o)throw new Hr(Br.INVALID_ARGUMENT,"mockUserToken must contain 'sub' or 'user_id' field!");n=new Nr(o)}t._authCredentials=new Gr(new qr(e,n))}}
1763
+ */(r.mockUserToken,null===(s=t._app)||void 0===s?void 0:s.options.projectId);const i=r.mockUserToken.sub||r.mockUserToken.user_id;if(!i)throw new Oi(Di.INVALID_ARGUMENT,"mockUserToken must contain 'sub' or 'user_id' field!");n=new _i(i)}t._authCredentials=new xi(new Pi(e,n))}}
1665
1764
  /**
1666
1765
  * @license
1667
1766
  * Copyright 2020 Google LLC
@@ -1677,7 +1776,7 @@ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1677
1776
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1678
1777
  * See the License for the specific language governing permissions and
1679
1778
  * limitations under the License.
1680
- */class ch{constructor(t,e,n){this.converter=e,this._key=n,this.type="document",this.firestore=t}get _path(){return this._key.path}get id(){return this._key.path.lastSegment()}get path(){return this._key.path.canonicalString()}get parent(){return new hh(this.firestore,this.converter,this._key.path.popLast())}withConverter(t){return new ch(this.firestore,t,this._key)}}class uh{constructor(t,e,n){this.converter=e,this._query=n,this.type="query",this.firestore=t}withConverter(t){return new uh(this.firestore,t,this._query)}}class hh extends uh{constructor(t,e,n){super(t,e,ko(n)),this._path=n,this.type="collection"}get id(){return this._query.path.lastSegment()}get path(){return this._query.path.canonicalString()}get parent(){const t=this._path.popLast();return t.isEmpty()?null:new ch(this.firestore,null,new ai(t))}withConverter(t){return new hh(this.firestore,t,this._path)}}function lh(t,e,...n){if(t=I(t),Zu("collection","path",e),t instanceof oh){const s=ri.fromString(e,...n);return eh(s),new hh(t,null,s)}{if(!(t instanceof ch||t instanceof hh))throw new Hr(Br.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const s=t._path.child(ri.fromString(e,...n));return eh(s),new hh(t.firestore,null,s)}}function dh(t,e,...n){if(t=I(t),1===arguments.length&&(e=Xr.R()),Zu("doc","path",e),t instanceof oh){const s=ri.fromString(e,...n);return th(s),new ch(t,null,new ai(s))}{if(!(t instanceof ch||t instanceof hh))throw new Hr(Br.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const s=t._path.child(ri.fromString(e,...n));return th(s),new ch(t.firestore,t instanceof hh?t.converter:null,new ai(s))}}
1779
+ */class Rl{constructor(t,e,n){this.converter=e,this._key=n,this.type="document",this.firestore=t}get _path(){return this._key.path}get id(){return this._key.path.lastSegment()}get path(){return this._key.path.canonicalString()}get parent(){return new Dl(this.firestore,this.converter,this._key.path.popLast())}withConverter(t){return new Rl(this.firestore,t,this._key)}}class Nl{constructor(t,e,n){this.converter=e,this._query=n,this.type="query",this.firestore=t}withConverter(t){return new Nl(this.firestore,t,this._query)}}class Dl extends Nl{constructor(t,e,n){super(t,e,Ta(n)),this._path=n,this.type="collection"}get id(){return this._query.path.lastSegment()}get path(){return this._query.path.canonicalString()}get parent(){const t=this._path.popLast();return t.isEmpty()?null:new Rl(this.firestore,null,new Xi(t))}withConverter(t){return new Dl(this.firestore,t,this._path)}}function Ol(t,e,...n){if(t=oe(t),_l("collection","path",e),t instanceof Cl){const r=Qi.fromString(e,...n);return El(r),new Dl(t,null,r)}{if(!(t instanceof Rl||t instanceof Dl))throw new Oi(Di.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const r=t._path.child(Qi.fromString(e,...n));return El(r),new Dl(t.firestore,null,r)}}function Ll(t,e,...n){if(t=oe(t),1===arguments.length&&(e=$i.R()),_l("doc","path",e),t instanceof Cl){const r=Qi.fromString(e,...n);return Tl(r),new Rl(t,null,new Xi(r))}{if(!(t instanceof Rl||t instanceof Dl))throw new Oi(Di.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const r=t._path.child(Qi.fromString(e,...n));return Tl(r),new Rl(t.firestore,t instanceof Dl?t.converter:null,new Xi(r))}}
1681
1780
  /**
1682
1781
  * @license
1683
1782
  * Copyright 2020 Google LLC
@@ -1709,7 +1808,7 @@ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1709
1808
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1710
1809
  * See the License for the specific language governing permissions and
1711
1810
  * limitations under the License.
1712
- */class fh{constructor(t){this.observer=t,this.muted=!1}next(t){this.observer.next&&this.Rc(this.observer.next,t)}error(t){this.observer.error?this.Rc(this.observer.error,t):Pr("Uncaught Error in snapshot listener:",t.toString())}bc(){this.muted=!0}Rc(t,e){this.muted||setTimeout((()=>{this.muted||t(e)}),0)}}
1811
+ */class Pl{constructor(t){this.observer=t,this.muted=!1}next(t){this.observer.next&&this.Rc(this.observer.next,t)}error(t){this.observer.error?this.Rc(this.observer.error,t):bi("Uncaught Error in snapshot listener:",t.toString())}bc(){this.muted=!0}Rc(t,e){this.muted||setTimeout((()=>{this.muted||t(e)}),0)}}
1713
1812
  /**
1714
1813
  * @license
1715
1814
  * Copyright 2017 Google LLC
@@ -1725,7 +1824,7 @@ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1725
1824
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1726
1825
  * See the License for the specific language governing permissions and
1727
1826
  * limitations under the License.
1728
- */class ph{constructor(t,e,n,s){this.authCredentials=t,this.appCheckCredentials=e,this.asyncQueue=n,this.databaseInfo=s,this.user=Nr.UNAUTHENTICATED,this.clientId=Xr.R(),this.authCredentialListener=()=>Promise.resolve(),this.appCheckCredentialListener=()=>Promise.resolve(),this.authCredentials.start(n,(async t=>{Lr("FirestoreClient","Received user=",t.uid),await this.authCredentialListener(t),this.user=t})),this.appCheckCredentials.start(n,(t=>(Lr("FirestoreClient","Received new app check token=",t),this.appCheckCredentialListener(t,this.user))))}async getConfiguration(){return{asyncQueue:this.asyncQueue,databaseInfo:this.databaseInfo,clientId:this.clientId,authCredentials:this.authCredentials,appCheckCredentials:this.appCheckCredentials,initialUser:this.user,maxConcurrentLimboResolutions:100}}setCredentialChangeListener(t){this.authCredentialListener=t}setAppCheckTokenChangeListener(t){this.appCheckCredentialListener=t}verifyNotTerminated(){if(this.asyncQueue.isShuttingDown)throw new Hr(Br.FAILED_PRECONDITION,"The client has already been terminated.")}terminate(){this.asyncQueue.enterRestrictedMode();const t=new jr;return this.asyncQueue.enqueueAndForgetEvenWhileRestricted((async()=>{try{this.onlineComponents&&await this.onlineComponents.terminate(),this.offlineComponents&&await this.offlineComponents.terminate(),this.authCredentials.shutdown(),this.appCheckCredentials.shutdown(),t.resolve()}catch(e){const n=_u(e,"Failed to shutdown persistence");t.reject(n)}})),t.promise}}async function gh(t,e){t.asyncQueue.verifyOperationInProgress();const n=await async function(t){return t.offlineComponents||(Lr("FirestoreClient","Using default OfflineComponentProvider"),await async function(t,e){t.asyncQueue.verifyOperationInProgress(),Lr("FirestoreClient","Initializing OfflineComponentProvider");const n=await t.getConfiguration();await e.initialize(n);let s=n.initialUser;t.setCredentialChangeListener((async t=>{s.isEqual(t)||(await Uc(e.localStore,t),s=t)})),e.persistence.setDatabaseDeletedListener((()=>t.terminate())),t.offlineComponents=e}(t,new Yu)),t.offlineComponents}(t);Lr("FirestoreClient","Initializing OnlineComponentProvider");const s=await t.getConfiguration();await e.initialize(n,s),t.setCredentialChangeListener((t=>yu(e.remoteStore,t))),t.setAppCheckTokenChangeListener(((t,n)=>yu(e.remoteStore,n))),t.onlineComponents=e}async function mh(t){const e=await async function(t){return t.onlineComponents||(Lr("FirestoreClient","Using default OnlineComponentProvider"),await gh(t,new Xu)),t.onlineComponents}(t),n=e.eventManager;return n.onListen=Fu.bind(null,e.syncEngine),n.onUnlisten=Vu.bind(null,e.syncEngine),n}class yh{constructor(){this.Bc=Promise.resolve(),this.Lc=[],this.qc=!1,this.Uc=[],this.Kc=null,this.Gc=!1,this.Qc=!1,this.jc=[],this.xo=new Yc(this,"async_queue_retry"),this.Wc=()=>{const t=Qc();t&&Lr("AsyncQueue","Visibility state changed to "+t.visibilityState),this.xo.Po()};const t=Qc();t&&"function"==typeof t.addEventListener&&t.addEventListener("visibilitychange",this.Wc)}get isShuttingDown(){return this.qc}enqueueAndForget(t){this.enqueue(t)}enqueueAndForgetEvenWhileRestricted(t){this.zc(),this.Hc(t)}enterRestrictedMode(t){if(!this.qc){this.qc=!0,this.Qc=t||!1;const e=Qc();e&&"function"==typeof e.removeEventListener&&e.removeEventListener("visibilitychange",this.Wc)}}enqueue(t){if(this.zc(),this.qc)return new Promise((()=>{}));const e=new jr;return this.Hc((()=>this.qc&&this.Qc?Promise.resolve():(t().then(e.resolve,e.reject),e.promise))).then((()=>e.promise))}enqueueRetryable(t){this.enqueueAndForget((()=>(this.Lc.push(t),this.Jc())))}async Jc(){if(0!==this.Lc.length){try{await this.Lc[0](),this.Lc.shift(),this.xo.reset()}catch(t){if(!pi(t))throw t;Lr("AsyncQueue","Operation failed with retryable error: "+t)}this.Lc.length>0&&this.xo.Ro((()=>this.Jc()))}}Hc(t){const e=this.Bc.then((()=>(this.Gc=!0,t().catch((t=>{this.Kc=t,this.Gc=!1;const e=function(t){let e=t.message||"";return t.stack&&(e=t.stack.includes(t.message)?t.stack:t.message+"\n"+t.stack),e}
1827
+ */class Ml{constructor(t,e,n,r){this.authCredentials=t,this.appCheckCredentials=e,this.asyncQueue=n,this.databaseInfo=r,this.user=_i.UNAUTHENTICATED,this.clientId=$i.R(),this.authCredentialListener=()=>Promise.resolve(),this.appCheckCredentialListener=()=>Promise.resolve(),this.authCredentials.start(n,(async t=>{Ii("FirestoreClient","Received user=",t.uid),await this.authCredentialListener(t),this.user=t})),this.appCheckCredentials.start(n,(t=>(Ii("FirestoreClient","Received new app check token=",t),this.appCheckCredentialListener(t,this.user))))}async getConfiguration(){return{asyncQueue:this.asyncQueue,databaseInfo:this.databaseInfo,clientId:this.clientId,authCredentials:this.authCredentials,appCheckCredentials:this.appCheckCredentials,initialUser:this.user,maxConcurrentLimboResolutions:100}}setCredentialChangeListener(t){this.authCredentialListener=t}setAppCheckTokenChangeListener(t){this.appCheckCredentialListener=t}verifyNotTerminated(){if(this.asyncQueue.isShuttingDown)throw new Oi(Di.FAILED_PRECONDITION,"The client has already been terminated.")}terminate(){this.asyncQueue.enterRestrictedMode();const t=new Li;return this.asyncQueue.enqueueAndForgetEvenWhileRestricted((async()=>{try{this.onlineComponents&&await this.onlineComponents.terminate(),this.offlineComponents&&await this.offlineComponents.terminate(),this.authCredentials.shutdown(),this.appCheckCredentials.shutdown(),t.resolve()}catch(e){const n=xh(e,"Failed to shutdown persistence");t.reject(n)}})),t.promise}}async function xl(t,e){t.asyncQueue.verifyOperationInProgress();const n=await async function(t){return t.offlineComponents||(Ii("FirestoreClient","Using default OfflineComponentProvider"),await async function(t,e){t.asyncQueue.verifyOperationInProgress(),Ii("FirestoreClient","Initializing OfflineComponentProvider");const n=await t.getConfiguration();await e.initialize(n);let r=n.initialUser;t.setCredentialChangeListener((async t=>{r.isEqual(t)||(await Bu(e.localStore,t),r=t)})),e.persistence.setDatabaseDeletedListener((()=>t.terminate())),t.offlineComponents=e}(t,new vl)),t.offlineComponents}(t);Ii("FirestoreClient","Initializing OnlineComponentProvider");const r=await t.getConfiguration();await e.initialize(n,r),t.setCredentialChangeListener((t=>Oh(e.remoteStore,t))),t.setAppCheckTokenChangeListener(((t,n)=>Oh(e.remoteStore,n))),t.onlineComponents=e}async function Ul(t){return t.onlineComponents||(Ii("FirestoreClient","Using default OnlineComponentProvider"),await xl(t,new wl)),t.onlineComponents}async function Fl(t){const e=await Ul(t),n=e.eventManager;return n.onListen=tl.bind(null,e.syncEngine),n.onUnlisten=el.bind(null,e.syncEngine),n}class Vl{constructor(){this.Bc=Promise.resolve(),this.Lc=[],this.qc=!1,this.Uc=[],this.Kc=null,this.Gc=!1,this.Qc=!1,this.jc=[],this.xo=new eh(this,"async_queue_retry"),this.Wc=()=>{const t=Zu();t&&Ii("AsyncQueue","Visibility state changed to "+t.visibilityState),this.xo.Po()};const t=Zu();t&&"function"==typeof t.addEventListener&&t.addEventListener("visibilitychange",this.Wc)}get isShuttingDown(){return this.qc}enqueueAndForget(t){this.enqueue(t)}enqueueAndForgetEvenWhileRestricted(t){this.zc(),this.Hc(t)}enterRestrictedMode(t){if(!this.qc){this.qc=!0,this.Qc=t||!1;const e=Zu();e&&"function"==typeof e.removeEventListener&&e.removeEventListener("visibilitychange",this.Wc)}}enqueue(t){if(this.zc(),this.qc)return new Promise((()=>{}));const e=new Li;return this.Hc((()=>this.qc&&this.Qc?Promise.resolve():(t().then(e.resolve,e.reject),e.promise))).then((()=>e.promise))}enqueueRetryable(t){this.enqueueAndForget((()=>(this.Lc.push(t),this.Jc())))}async Jc(){if(0!==this.Lc.length){try{await this.Lc[0](),this.Lc.shift(),this.xo.reset()}catch(t){if(!oo(t))throw t;Ii("AsyncQueue","Operation failed with retryable error: "+t)}this.Lc.length>0&&this.xo.Ro((()=>this.Jc()))}}Hc(t){const e=this.Bc.then((()=>(this.Gc=!0,t().catch((t=>{this.Kc=t,this.Gc=!1;const e=function(t){let e=t.message||"";return t.stack&&(e=t.stack.includes(t.message)?t.stack:t.message+"\n"+t.stack),e}
1729
1828
  /**
1730
1829
  * @license
1731
1830
  * Copyright 2017 Google LLC
@@ -1741,7 +1840,7 @@ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1741
1840
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1742
1841
  * See the License for the specific language governing permissions and
1743
1842
  * limitations under the License.
1744
- */(t);throw Pr("INTERNAL UNHANDLED ERROR: ",e),t})).then((t=>(this.Gc=!1,t))))));return this.Bc=e,e}enqueueAfterDelay(t,e,n){this.zc(),this.jc.indexOf(t)>-1&&(e=0);const s=wu.createAndSchedule(this,t,e,n,(t=>this.Yc(t)));return this.Uc.push(s),s}zc(){this.Kc&&Ur()}verifyOperationInProgress(){}async Xc(){let t;do{t=this.Bc,await t}while(t!==this.Bc)}Zc(t){for(const e of this.Uc)if(e.timerId===t)return!0;return!1}ta(t){return this.Xc().then((()=>{this.Uc.sort(((t,e)=>t.targetTimeMs-e.targetTimeMs));for(const e of this.Uc)if(e.skipDelay(),"all"!==t&&e.timerId===t)break;return this.Xc()}))}ea(t){this.jc.push(t)}Yc(t){const e=this.Uc.indexOf(t);this.Uc.splice(e,1)}}function vh(t){return function(t,e){if("object"!=typeof t||null===t)return!1;const n=t;for(const t of["next","error","complete"])if(t in n&&"function"==typeof n[t])return!0;return!1}
1843
+ */(t);throw bi("INTERNAL UNHANDLED ERROR: ",e),t})).then((t=>(this.Gc=!1,t))))));return this.Bc=e,e}enqueueAfterDelay(t,e,n){this.zc(),this.jc.indexOf(t)>-1&&(e=0);const r=Mh.createAndSchedule(this,t,e,n,(t=>this.Yc(t)));return this.Uc.push(r),r}zc(){this.Kc&&ki()}verifyOperationInProgress(){}async Xc(){let t;do{t=this.Bc,await t}while(t!==this.Bc)}Zc(t){for(const e of this.Uc)if(e.timerId===t)return!0;return!1}ta(t){return this.Xc().then((()=>{this.Uc.sort(((t,e)=>t.targetTimeMs-e.targetTimeMs));for(const e of this.Uc)if(e.skipDelay(),"all"!==t&&e.timerId===t)break;return this.Xc()}))}ea(t){this.jc.push(t)}Yc(t){const e=this.Uc.indexOf(t);this.Uc.splice(e,1)}}function Bl(t){return function(t,e){if("object"!=typeof t||null===t)return!1;const n=t;for(const t of["next","error","complete"])if(t in n&&"function"==typeof n[t])return!0;return!1}
1745
1844
  /**
1746
1845
  * @license
1747
1846
  * Copyright 2020 Google LLC
@@ -1757,7 +1856,7 @@ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1757
1856
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1758
1857
  * See the License for the specific language governing permissions and
1759
1858
  * limitations under the License.
1760
- */(t)}class wh extends oh{constructor(t,e,n,s){super(t,e,n,s),this.type="firestore",this._queue=new yh,this._persistenceKey=(null==s?void 0:s.name)||"[DEFAULT]"}_terminate(){return this._firestoreClient||Ih(this),this._firestoreClient.terminate()}}function _h(t,e){const n="string"==typeof t?t:e||"(default)",s=it("object"==typeof t?t:ht(),"firestore").getImmediate({identifier:n});if(!s._initialized){const t=(t=>{const e=u(t);if(!e)return;const n=e.lastIndexOf(":");if(n<=0||n+1===e.length)throw new Error(`Invalid host ${e} with no separate hostname and port!`);const s=parseInt(e.substring(n+1),10);return"["===e[0]?[e.substring(1,n-1),s]:[e.substring(0,n),s]})("firestore");t&&ah(s,...t)}return s}function Th(t){return t._firestoreClient||Ih(t),t._firestoreClient.verifyNotTerminated(),t._firestoreClient}function Ih(t){var e;const n=t._freezeSettings(),s=function(t,e,n,s){return new mi(t,e,n,s.host,s.ssl,s.experimentalForceLongPolling,s.experimentalAutoDetectLongPolling,s.useFetchStreams)}
1859
+ */(t)}class Hl extends Cl{constructor(t,e,n,r){super(t,e,n,r),this.type="firestore",this._queue=new Vl,this._persistenceKey=(null==r?void 0:r.name)||"[DEFAULT]"}_terminate(){return this._firestoreClient||$l(this),this._firestoreClient.terminate()}}function jl(t){return t._firestoreClient||$l(t),t._firestoreClient.verifyNotTerminated(),t._firestoreClient}function $l(t){var e;const n=t._freezeSettings(),r=function(t,e,n,r){return new co(t,e,n,r.host,r.ssl,r.experimentalForceLongPolling,r.experimentalAutoDetectLongPolling,r.useFetchStreams)}
1761
1860
  /**
1762
1861
  * @license
1763
1862
  * Copyright 2020 Google LLC
@@ -1773,7 +1872,7 @@ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1773
1872
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1774
1873
  * See the License for the specific language governing permissions and
1775
1874
  * limitations under the License.
1776
- */(t._databaseId,(null===(e=t._app)||void 0===e?void 0:e.options.appId)||"",t._persistenceKey,n);t._firestoreClient=new ph(t._authCredentials,t._appCheckCredentials,t._queue,s)}
1875
+ */(t._databaseId,(null===(e=t._app)||void 0===e?void 0:e.options.appId)||"",t._persistenceKey,n);t._firestoreClient=new Ml(t._authCredentials,t._appCheckCredentials,t._queue,r)}
1777
1876
  /**
1778
1877
  * @license
1779
1878
  * Copyright 2020 Google LLC
@@ -1805,7 +1904,7 @@ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1805
1904
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1806
1905
  * See the License for the specific language governing permissions and
1807
1906
  * limitations under the License.
1808
- */class Eh{constructor(t){this._byteString=t}static fromBase64String(t){try{return new Eh(Ei.fromBase64String(t))}catch(t){throw new Hr(Br.INVALID_ARGUMENT,"Failed to construct data from Base64 string: "+t)}}static fromUint8Array(t){return new Eh(Ei.fromUint8Array(t))}toBase64(){return this._byteString.toBase64()}toUint8Array(){return this._byteString.toUint8Array()}toString(){return"Bytes(base64: "+this.toBase64()+")"}isEqual(t){return this._byteString.isEqual(t._byteString)}}
1907
+ */class ql{constructor(t){this._byteString=t}static fromBase64String(t){try{return new ql(mo.fromBase64String(t))}catch(t){throw new Oi(Di.INVALID_ARGUMENT,"Failed to construct data from Base64 string: "+t)}}static fromUint8Array(t){return new ql(mo.fromUint8Array(t))}toBase64(){return this._byteString.toBase64()}toUint8Array(){return this._byteString.toUint8Array()}toString(){return"Bytes(base64: "+this.toBase64()+")"}isEqual(t){return this._byteString.isEqual(t._byteString)}}
1809
1908
  /**
1810
1909
  * @license
1811
1910
  * Copyright 2020 Google LLC
@@ -1821,7 +1920,7 @@ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1821
1920
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1822
1921
  * See the License for the specific language governing permissions and
1823
1922
  * limitations under the License.
1824
- */class Sh{constructor(...t){for(let e=0;e<t.length;++e)if(0===t[e].length)throw new Hr(Br.INVALID_ARGUMENT,"Invalid field name at argument $(i + 1). Field names must not be empty.");this._internalPath=new oi(t)}isEqual(t){return this._internalPath.isEqual(t._internalPath)}}
1923
+ */class Kl{constructor(...t){for(let e=0;e<t.length;++e)if(0===t[e].length)throw new Oi(Di.INVALID_ARGUMENT,"Invalid field name at argument $(i + 1). Field names must not be empty.");this._internalPath=new Ji(t)}isEqual(t){return this._internalPath.isEqual(t._internalPath)}}
1825
1924
  /**
1826
1925
  * @license
1827
1926
  * Copyright 2020 Google LLC
@@ -1838,7 +1937,7 @@ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1838
1937
  * See the License for the specific language governing permissions and
1839
1938
  * limitations under the License.
1840
1939
  */
1841
- class bh{constructor(t){this._methodName=t}}
1940
+ class Wl{constructor(t){this._methodName=t}}
1842
1941
  /**
1843
1942
  * @license
1844
1943
  * Copyright 2017 Google LLC
@@ -1854,7 +1953,7 @@ class bh{constructor(t){this._methodName=t}}
1854
1953
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1855
1954
  * See the License for the specific language governing permissions and
1856
1955
  * limitations under the License.
1857
- */class Ah{constructor(t,e){if(!isFinite(t)||t<-90||t>90)throw new Hr(Br.INVALID_ARGUMENT,"Latitude must be a number between -90 and 90, but was: "+t);if(!isFinite(e)||e<-180||e>180)throw new Hr(Br.INVALID_ARGUMENT,"Longitude must be a number between -180 and 180, but was: "+e);this._lat=t,this._long=e}get latitude(){return this._lat}get longitude(){return this._long}isEqual(t){return this._lat===t._lat&&this._long===t._long}toJSON(){return{latitude:this._lat,longitude:this._long}}_compareTo(t){return Zr(this._lat,t._lat)||Zr(this._long,t._long)}}
1956
+ */class Gl{constructor(t,e){if(!isFinite(t)||t<-90||t>90)throw new Oi(Di.INVALID_ARGUMENT,"Latitude must be a number between -90 and 90, but was: "+t);if(!isFinite(e)||e<-180||e>180)throw new Oi(Di.INVALID_ARGUMENT,"Longitude must be a number between -180 and 180, but was: "+e);this._lat=t,this._long=e}get latitude(){return this._lat}get longitude(){return this._long}isEqual(t){return this._lat===t._lat&&this._long===t._long}toJSON(){return{latitude:this._lat,longitude:this._long}}_compareTo(t){return qi(this._lat,t._lat)||qi(this._long,t._long)}}
1858
1957
  /**
1859
1958
  * @license
1860
1959
  * Copyright 2017 Google LLC
@@ -1870,7 +1969,7 @@ class bh{constructor(t){this._methodName=t}}
1870
1969
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1871
1970
  * See the License for the specific language governing permissions and
1872
1971
  * limitations under the License.
1873
- */const Ch=/^__.*__$/;function kh(t){switch(t){case 0:case 2:case 1:return!0;case 3:case 4:return!1;default:throw Ur()}}class Nh{constructor(t,e,n,s,r,i){this.settings=t,this.databaseId=e,this.yt=n,this.ignoreUndefinedProperties=s,void 0===r&&this.na(),this.fieldTransforms=r||[],this.fieldMask=i||[]}get path(){return this.settings.path}get sa(){return this.settings.sa}ia(t){return new Nh(Object.assign(Object.assign({},this.settings),t),this.databaseId,this.yt,this.ignoreUndefinedProperties,this.fieldTransforms,this.fieldMask)}ra(t){var e;const n=null===(e=this.path)||void 0===e?void 0:e.child(t),s=this.ia({path:n,oa:!1});return s.ua(t),s}ca(t){var e;const n=null===(e=this.path)||void 0===e?void 0:e.child(t),s=this.ia({path:n,oa:!1});return s.na(),s}aa(t){return this.ia({path:void 0,oa:!0})}ha(t){return Ph(t,this.settings.methodName,this.settings.la||!1,this.path,this.settings.fa)}contains(t){return void 0!==this.fieldMask.find((e=>t.isPrefixOf(e)))||void 0!==this.fieldTransforms.find((e=>t.isPrefixOf(e.field)))}na(){if(this.path)for(let t=0;t<this.path.length;t++)this.ua(this.path.get(t))}ua(t){if(0===t.length)throw this.ha("Document fields must not be empty");if(kh(this.sa)&&Ch.test(t))throw this.ha('Document fields cannot begin and end with "__"')}}class Rh{constructor(t,e,n){this.databaseId=t,this.ignoreUndefinedProperties=e,this.yt=n||Jc(t)}da(t,e,n,s=!1){return new Nh({sa:t,methodName:e,fa:n,path:oi.emptyPath(),oa:!1,la:s},this.databaseId,this.yt,this.ignoreUndefinedProperties)}}function Oh(t,e){if(Dh(t=I(t)))return function(t,e,n){if(!Dh(n)||!function(t){return"object"==typeof t&&null!==t&&(Object.getPrototypeOf(t)===Object.prototype||null===Object.getPrototypeOf(t))}(n)){const s=nh(n);throw"an object"===s?e.ha(t+" a custom object"):e.ha(t+" "+s)}}("Unsupported field value:",e,t),function(t,e){const n={};return _i(t)?e.path&&e.path.length>0&&e.fieldMask.push(e.path):wi(t,((t,s)=>{const r=Oh(s,e.ra(t));null!=r&&(n[t]=r)})),{mapValue:{fields:n}}}(t,e);if(t instanceof bh)return function(t,e){if(!kh(e.sa))throw e.ha(`${t._methodName}() can only be used with update() and set()`);if(!e.path)throw e.ha(`${t._methodName}() is not currently supported inside arrays`);const n=t._toFieldTransform(e);n&&e.fieldTransforms.push(n)}(t,e),null;if(void 0===t&&e.ignoreUndefinedProperties)return null;if(e.path&&e.fieldMask.push(e.path),t instanceof Array){if(e.settings.oa&&4!==e.sa)throw e.ha("Nested arrays are not supported");return function(t,e){const n=[];let s=0;for(const r of t){let t=Oh(r,e.aa(s));null==t&&(t={nullValue:"NULL_VALUE"}),n.push(t),s++}return{arrayValue:{values:n}}}(t,e)}return function(t,e){if(null===(t=I(t)))return{nullValue:"NULL_VALUE"};if("number"==typeof t)return Go(e.yt,t);if("boolean"==typeof t)return{booleanValue:t};if("string"==typeof t)return{stringValue:t};if(t instanceof Date){const n=ei.fromDate(t);return{timestampValue:Wa(e.yt,n)}}if(t instanceof ei){const n=new ei(t.seconds,1e3*Math.floor(t.nanoseconds/1e3));return{timestampValue:Wa(e.yt,n)}}if(t instanceof Ah)return{geoPointValue:{latitude:t.latitude,longitude:t.longitude}};if(t instanceof Eh)return{bytesValue:za(e.yt,t._byteString)};if(t instanceof ch){const n=e.databaseId,s=t.firestore._databaseId;if(!s.isEqual(n))throw e.ha(`Document reference is for database ${s.projectId}/${s.database} but should be for database ${n.projectId}/${n.database}`);return{referenceValue:Qa(t.firestore._databaseId||e.databaseId,t._key.path)}}throw e.ha(`Unsupported field value: ${nh(t)}`)}(t,e)}function Dh(t){return!("object"!=typeof t||null===t||t instanceof Array||t instanceof Date||t instanceof ei||t instanceof Ah||t instanceof Eh||t instanceof ch||t instanceof bh)}const Lh=new RegExp("[~\\*/\\[\\]]");function Ph(t,e,n,s,r){const i=s&&!s.isEmpty(),o=void 0!==r;let a=`Function ${e}() called with invalid data`;n&&(a+=" (via `toFirestore()`)"),a+=". ";let c="";return(i||o)&&(c+=" (found",i&&(c+=` in field ${s}`),o&&(c+=` in document ${r}`),c+=")"),new Hr(Br.INVALID_ARGUMENT,a+t+c)
1972
+ */const zl=/^__.*__$/;class Ql{constructor(t,e,n){this.data=t,this.fieldMask=e,this.fieldTransforms=n}toMutation(t,e){return null!==this.fieldMask?new ac(t,this.data,this.fieldMask,e,this.fieldTransforms):new oc(t,this.data,e,this.fieldTransforms)}}function Yl(t){switch(t){case 0:case 2:case 1:return!0;case 3:case 4:return!1;default:throw ki()}}class Jl{constructor(t,e,n,r,s,i){this.settings=t,this.databaseId=e,this.yt=n,this.ignoreUndefinedProperties=r,void 0===s&&this.na(),this.fieldTransforms=s||[],this.fieldMask=i||[]}get path(){return this.settings.path}get sa(){return this.settings.sa}ia(t){return new Jl(Object.assign(Object.assign({},this.settings),t),this.databaseId,this.yt,this.ignoreUndefinedProperties,this.fieldTransforms,this.fieldMask)}ra(t){var e;const n=null===(e=this.path)||void 0===e?void 0:e.child(t),r=this.ia({path:n,oa:!1});return r.ua(t),r}ca(t){var e;const n=null===(e=this.path)||void 0===e?void 0:e.child(t),r=this.ia({path:n,oa:!1});return r.na(),r}aa(t){return this.ia({path:void 0,oa:!0})}ha(t){return cd(t,this.settings.methodName,this.settings.la||!1,this.path,this.settings.fa)}contains(t){return void 0!==this.fieldMask.find((e=>t.isPrefixOf(e)))||void 0!==this.fieldTransforms.find((e=>t.isPrefixOf(e.field)))}na(){if(this.path)for(let t=0;t<this.path.length;t++)this.ua(this.path.get(t))}ua(t){if(0===t.length)throw this.ha("Document fields must not be empty");if(Yl(this.sa)&&zl.test(t))throw this.ha('Document fields cannot begin and end with "__"')}}class Xl{constructor(t,e,n){this.databaseId=t,this.ignoreUndefinedProperties=e,this.yt=n||th(t)}da(t,e,n,r=!1){return new Jl({sa:t,methodName:e,fa:n,path:Ji.emptyPath(),oa:!1,la:r},this.databaseId,this.yt,this.ignoreUndefinedProperties)}}function Zl(t){const e=t._freezeSettings(),n=th(t._databaseId);return new Xl(t._databaseId,!!e.ignoreUndefinedProperties,n)}function td(t,e,n,r,s,i={}){const o=t.da(i.merge||i.mergeFields?2:0,e,n,s);sd("Data must be an object, but it was:",o,r);const a=nd(r,o);let c,u;if(i.merge)c=new la(o.fieldMask),u=o.fieldTransforms;else if(i.mergeFields){const t=[];for(const r of i.mergeFields){const s=id(e,r,n);if(!o.contains(s))throw new Oi(Di.INVALID_ARGUMENT,`Field '${s}' is specified in your field mask but missing from your input data.`);ud(t,s)||t.push(s)}c=new la(t),u=o.fieldTransforms.filter((t=>c.covers(t.field)))}else c=null,u=o.fieldTransforms;return new Ql(new da(a),c,u)}function ed(t,e){if(rd(t=oe(t)))return sd("Unsupported field value:",e,t),nd(t,e);if(t instanceof Wl)return function(t,e){if(!Yl(e.sa))throw e.ha(`${t._methodName}() can only be used with update() and set()`);if(!e.path)throw e.ha(`${t._methodName}() is not currently supported inside arrays`);const n=t._toFieldTransform(e);n&&e.fieldTransforms.push(n)}(t,e),null;if(void 0===t&&e.ignoreUndefinedProperties)return null;if(e.path&&e.fieldMask.push(e.path),t instanceof Array){if(e.settings.oa&&4!==e.sa)throw e.ha("Nested arrays are not supported");return function(t,e){const n=[];let r=0;for(const s of t){let t=ed(s,e.aa(r));null==t&&(t={nullValue:"NULL_VALUE"}),n.push(t),r++}return{arrayValue:{values:n}}}(t,e)}return function(t,e){if(null===(t=oe(t)))return{nullValue:"NULL_VALUE"};if("number"==typeof t)return Fa(e.yt,t);if("boolean"==typeof t)return{booleanValue:t};if("string"==typeof t)return{stringValue:t};if(t instanceof Date){const n=Wi.fromDate(t);return{timestampValue:qc(e.yt,n)}}if(t instanceof Wi){const n=new Wi(t.seconds,1e3*Math.floor(t.nanoseconds/1e3));return{timestampValue:qc(e.yt,n)}}if(t instanceof Gl)return{geoPointValue:{latitude:t.latitude,longitude:t.longitude}};if(t instanceof ql)return{bytesValue:Kc(e.yt,t._byteString)};if(t instanceof Rl){const n=e.databaseId,r=t.firestore._databaseId;if(!r.isEqual(n))throw e.ha(`Document reference is for database ${r.projectId}/${r.database} but should be for database ${n.projectId}/${n.database}`);return{referenceValue:zc(t.firestore._databaseId||e.databaseId,t._key.path)}}throw e.ha(`Unsupported field value: ${Sl(t)}`)}(t,e)}function nd(t,e){const n={};return fo(t)?e.path&&e.path.length>0&&e.fieldMask.push(e.path):lo(t,((t,r)=>{const s=ed(r,e.ra(t));null!=s&&(n[t]=s)})),{mapValue:{fields:n}}}function rd(t){return!("object"!=typeof t||null===t||t instanceof Array||t instanceof Date||t instanceof Wi||t instanceof Gl||t instanceof ql||t instanceof Rl||t instanceof Wl)}function sd(t,e,n){if(!rd(n)||!function(t){return"object"==typeof t&&null!==t&&(Object.getPrototypeOf(t)===Object.prototype||null===Object.getPrototypeOf(t))}(n)){const r=Sl(n);throw"an object"===r?e.ha(t+" a custom object"):e.ha(t+" "+r)}}function id(t,e,n){if((e=oe(e))instanceof Kl)return e._internalPath;if("string"==typeof e)return ad(t,e);throw cd("Field path arguments must be of type string or ",t,!1,void 0,n)}const od=new RegExp("[~\\*/\\[\\]]");function ad(t,e,n){if(e.search(od)>=0)throw cd(`Invalid field path (${e}). Paths must not contain '~', '*', '/', '[', or ']'`,t,!1,void 0,n);try{return new Kl(...e.split("."))._internalPath}catch(r){throw cd(`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`,t,!1,void 0,n)}}function cd(t,e,n,r,s){const i=r&&!r.isEmpty(),o=void 0!==s;let a=`Function ${e}() called with invalid data`;n&&(a+=" (via `toFirestore()`)"),a+=". ";let c="";return(i||o)&&(c+=" (found",i&&(c+=` in field ${r}`),o&&(c+=` in document ${s}`),c+=")"),new Oi(Di.INVALID_ARGUMENT,a+t+c)}function ud(t,e){return t.some((t=>t.isEqual(e)))}
1874
1973
  /**
1875
1974
  * @license
1876
1975
  * Copyright 2020 Google LLC
@@ -1886,7 +1985,7 @@ class bh{constructor(t){this._methodName=t}}
1886
1985
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1887
1986
  * See the License for the specific language governing permissions and
1888
1987
  * limitations under the License.
1889
- */}class Mh{constructor(t,e,n,s,r){this._firestore=t,this._userDataWriter=e,this._key=n,this._document=s,this._converter=r}get id(){return this._key.path.lastSegment()}get ref(){return new ch(this._firestore,this._converter,this._key)}exists(){return null!==this._document}data(){if(this._document){if(this._converter){const t=new xh(this._firestore,this._userDataWriter,this._key,this._document,null);return this._converter.fromFirestore(t)}return this._userDataWriter.convertValue(this._document.data.value)}}get(t){if(this._document){const e=this._document.data.field(Uh("DocumentSnapshot.get",t));if(null!==e)return this._userDataWriter.convertValue(e)}}}class xh extends Mh{data(){return super.data()}}function Uh(t,e){return"string"==typeof e?function(t,e,n){if(e.search(Lh)>=0)throw Ph(`Invalid field path (${e}). Paths must not contain '~', '*', '/', '[', or ']'`,t,!1,void 0,n);try{return new Sh(...e.split("."))._internalPath}catch(s){throw Ph(`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`,t,!1,void 0,n)}}(t,e):e instanceof Sh?e._internalPath:e._delegate._internalPath}
1988
+ */class hd{constructor(t,e,n,r,s){this._firestore=t,this._userDataWriter=e,this._key=n,this._document=r,this._converter=s}get id(){return this._key.path.lastSegment()}get ref(){return new Rl(this._firestore,this._converter,this._key)}exists(){return null!==this._document}data(){if(this._document){if(this._converter){const t=new ld(this._firestore,this._userDataWriter,this._key,this._document,null);return this._converter.fromFirestore(t)}return this._userDataWriter.convertValue(this._document.data.value)}}get(t){if(this._document){const e=this._document.data.field(dd("DocumentSnapshot.get",t));if(null!==e)return this._userDataWriter.convertValue(e)}}}class ld extends hd{data(){return super.data()}}function dd(t,e){return"string"==typeof e?ad(t,e):e instanceof Kl?e._internalPath:e._delegate._internalPath}
1890
1989
  /**
1891
1990
  * @license
1892
1991
  * Copyright 2020 Google LLC
@@ -1902,7 +2001,7 @@ class bh{constructor(t){this._methodName=t}}
1902
2001
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1903
2002
  * See the License for the specific language governing permissions and
1904
2003
  * limitations under the License.
1905
- */function Fh(t){if("L"===t.limitType&&0===t.explicitOrderBy.length)throw new Hr(Br.UNIMPLEMENTED,"limitToLast() queries require specifying at least one orderBy() clause")}class Vh{}class Bh extends Vh{}function Hh(t,e,...n){let s=[];e instanceof Vh&&s.push(e),s=s.concat(n),function(t){const e=t.filter((t=>t instanceof Kh)).length,n=t.filter((t=>t instanceof jh)).length;if(e>1||e>0&&n>0)throw new Hr(Br.INVALID_ARGUMENT,"InvalidQuery. When using composite filters, you cannot use more than one filter at the top level. Consider nesting the multiple filters within an `and(...)` statement. For example: change `query(query, where(...), or(...))` to `query(query, and(where(...), or(...)))`.")}
2004
+ */function fd(t){if("L"===t.limitType&&0===t.explicitOrderBy.length)throw new Oi(Di.UNIMPLEMENTED,"limitToLast() queries require specifying at least one orderBy() clause")}class pd{}class gd extends pd{}function md(t,e,...n){let r=[];e instanceof pd&&r.push(e),r=r.concat(n),function(t){const e=t.filter((t=>t instanceof wd)).length,n=t.filter((t=>t instanceof yd)).length;if(e>1||e>0&&n>0)throw new Oi(Di.INVALID_ARGUMENT,"InvalidQuery. When using composite filters, you cannot use more than one filter at the top level. Consider nesting the multiple filters within an `and(...)` statement. For example: change `query(query, where(...), or(...))` to `query(query, and(where(...), or(...)))`.")}
1906
2005
  /**
1907
2006
  * @license
1908
2007
  * Copyright 2020 Google LLC
@@ -1918,7 +2017,7 @@ class bh{constructor(t){this._methodName=t}}
1918
2017
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1919
2018
  * See the License for the specific language governing permissions and
1920
2019
  * limitations under the License.
1921
- */(s);for(const e of s)t=e._apply(t);return t}class jh extends Bh{constructor(t,e,n){super(),this._field=t,this._op=e,this._value=n,this.type="where"}static _create(t,e,n){return new jh(t,e,n)}_apply(t){const e=this._parse(t);return zh(t._query,e),new uh(t.firestore,t.converter,Mo(t._query,e))}_parse(t){const e=function(t){const e=t._freezeSettings(),n=Jc(t._databaseId);return new Rh(t._databaseId,!!e.ignoreUndefinedProperties,n)}(t.firestore),n=function(t,e,n,s,r,i,o){let a;if(r.isKeyField()){if("array-contains"===i||"array-contains-any"===i)throw new Hr(Br.INVALID_ARGUMENT,`Invalid Query. You can't perform '${i}' queries on documentId().`);if("in"===i||"not-in"===i){Wh(o,i);const e=[];for(const n of o)e.push(Gh(s,t,n));a={arrayValue:{values:e}}}else a=Gh(s,t,o)}else"in"!==i&&"not-in"!==i&&"array-contains-any"!==i||Wh(o,i),a=function(t,e,n,s=!1){return Oh(n,t.da(s?4:3,e))}(n,"where",o,"in"===i||"not-in"===i);return Ji.create(r,i,a)}(t._query,0,e,t.firestore._databaseId,this._field,this._op,this._value);return n}}function qh(t,e,n){const s=e,r=Uh("where",t);return jh._create(r,s,n)}class Kh extends Vh{constructor(t,e){super(),this.type=t,this._queryConstraints=e}static _create(t,e){return new Kh(t,e)}_parse(t){const e=this._queryConstraints.map((e=>e._parse(t))).filter((t=>t.getFilters().length>0));return 1===e.length?e[0]:Yi.create(e,this._getOperator())}_apply(t){const e=this._parse(t);return 0===e.getFilters().length?t:(function(t,e){let n=t;const s=e.getFlattenedFilters();for(const t of s)zh(n,t),n=Mo(n,t)}(t._query,e),new uh(t.firestore,t.converter,Mo(t._query,e)))}_getQueryConstraints(){return this._queryConstraints}_getOperator(){return"and"===this.type?"and":"or"}}function Gh(t,e,n){if("string"==typeof(n=I(n))){if(""===n)throw new Hr(Br.INVALID_ARGUMENT,"Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");if(!Do(e)&&-1!==n.indexOf("/"))throw new Hr(Br.INVALID_ARGUMENT,`Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '${n}' contains a '/' character.`);const s=e.path.child(ri.fromString(n));if(!ai.isDocumentKey(s))throw new Hr(Br.INVALID_ARGUMENT,`Invalid query. When querying a collection group by documentId(), the value provided must result in a valid document path, but '${s}' is not because it has an odd number of segments (${s.length}).`);return Vi(t,new ai(s))}if(n instanceof ch)return Vi(t,n._key);throw new Hr(Br.INVALID_ARGUMENT,`Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${nh(n)}.`)}function Wh(t,e){if(!Array.isArray(t)||0===t.length)throw new Hr(Br.INVALID_ARGUMENT,`Invalid Query. A non-empty array is required for '${e.toString()}' filters.`);if(t.length>10)throw new Hr(Br.INVALID_ARGUMENT,`Invalid Query. '${e.toString()}' filters support a maximum of 10 elements in the value array.`)}function zh(t,e){if(e.isInequality()){const n=Oo(t),s=e.field;if(null!==n&&!n.isEqual(s))throw new Hr(Br.INVALID_ARGUMENT,`Invalid query. All where filters with an inequality (<, <=, !=, not-in, >, or >=) must be on the same field. But you have inequality filters on '${n.toString()}' and '${s.toString()}'`);const r=Ro(t);null!==r&&function(t,e,n){if(!n.isEqual(e))throw new Hr(Br.INVALID_ARGUMENT,`Invalid query. You have a where filter with an inequality (<, <=, !=, not-in, >, or >=) on field '${e.toString()}' and so you must also use '${e.toString()}' as your first argument to orderBy(), but your first orderBy() is on field '${n.toString()}' instead.`)}(0,s,r)}const n=function(t,e){for(const n of t)for(const t of n.getFlattenedFilters())if(e.indexOf(t.op)>=0)return t.op;return null}(t.filters,function(t){switch(t){case"!=":return["!=","not-in"];case"array-contains":return["array-contains","array-contains-any","not-in"];case"in":return["array-contains-any","in","not-in"];case"array-contains-any":return["array-contains","array-contains-any","in","not-in"];case"not-in":return["array-contains","array-contains-any","in","not-in","!="];default:return[]}}(e.op));if(null!==n)throw n===e.op?new Hr(Br.INVALID_ARGUMENT,`Invalid query. You cannot use more than one '${e.op.toString()}' filter.`):new Hr(Br.INVALID_ARGUMENT,`Invalid query. You cannot use '${e.op.toString()}' filters with '${n.toString()}' filters.`)}class $h{convertValue(t,e="none"){switch(Di(t)){case 0:return null;case 1:return t.booleanValue;case 2:return Ai(t.integerValue||t.doubleValue);case 3:return this.convertTimestamp(t.timestampValue);case 4:return this.convertServerTimestamp(t,e);case 5:return t.stringValue;case 6:return this.convertBytes(Ci(t.bytesValue));case 7:return this.convertReference(t.referenceValue);case 8:return this.convertGeoPoint(t.geoPointValue);case 9:return this.convertArray(t.arrayValue,e);case 10:return this.convertObject(t.mapValue,e);default:throw Ur()}}convertObject(t,e){const n={};return wi(t.fields,((t,s)=>{n[t]=this.convertValue(s,e)})),n}convertGeoPoint(t){return new Ah(Ai(t.latitude),Ai(t.longitude))}convertArray(t,e){return(t.values||[]).map((t=>this.convertValue(t,e)))}convertServerTimestamp(t,e){switch(e){case"previous":const n=Ni(t);return null==n?null:this.convertValue(n,e);case"estimate":return this.convertTimestamp(Ri(t));default:return null}}convertTimestamp(t){const e=bi(t);return new ei(e.seconds,e.nanos)}convertDocumentKey(t,e){const n=ri.fromString(t);Fr(lc(n));const s=new yi(n.get(1),n.get(3)),r=new ai(n.popFirst(5));return s.isEqual(e)||Pr(`Document ${r} contains a document reference within a different database (${s.projectId}/${s.database}) which is not supported. It will be treated as a reference in the current database (${e.projectId}/${e.database}) instead.`),r}}
2020
+ */(r);for(const e of r)t=e._apply(t);return t}class yd extends gd{constructor(t,e,n){super(),this._field=t,this._op=e,this._value=n,this.type="where"}static _create(t,e,n){return new yd(t,e,n)}_apply(t){const e=this._parse(t);return Ed(t._query,e),new Nl(t.firestore,t.converter,ka(t._query,e))}_parse(t){const e=Zl(t.firestore),n=function(t,e,n,r,s,i,o){let a;if(s.isKeyField()){if("array-contains"===i||"array-contains-any"===i)throw new Oi(Di.INVALID_ARGUMENT,`Invalid Query. You can't perform '${i}' queries on documentId().`);if("in"===i||"not-in"===i){Td(o,i);const e=[];for(const n of o)e.push(_d(r,t,n));a={arrayValue:{values:e}}}else a=_d(r,t,o)}else"in"!==i&&"not-in"!==i&&"array-contains-any"!==i||Td(o,i),a=function(t,e,n,r=!1){return ed(n,t.da(r?4:3,e))}(n,"where",o,"in"===i||"not-in"===i);return $o.create(s,i,a)}(t._query,0,e,t.firestore._databaseId,this._field,this._op,this._value);return n}}function vd(t,e,n){const r=e,s=dd("where",t);return yd._create(s,r,n)}class wd extends pd{constructor(t,e){super(),this.type=t,this._queryConstraints=e}static _create(t,e){return new wd(t,e)}_parse(t){const e=this._queryConstraints.map((e=>e._parse(t))).filter((t=>t.getFilters().length>0));return 1===e.length?e[0]:qo.create(e,this._getOperator())}_apply(t){const e=this._parse(t);return 0===e.getFilters().length?t:(function(t,e){let n=t;const r=e.getFlattenedFilters();for(const t of r)Ed(n,t),n=ka(n,t)}(t._query,e),new Nl(t.firestore,t.converter,ka(t._query,e)))}_getQueryConstraints(){return this._queryConstraints}_getOperator(){return"and"===this.type?"and":"or"}}function _d(t,e,n){if("string"==typeof(n=oe(n))){if(""===n)throw new Oi(Di.INVALID_ARGUMENT,"Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");if(!ba(e)&&-1!==n.indexOf("/"))throw new Oi(Di.INVALID_ARGUMENT,`Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '${n}' contains a '/' character.`);const r=e.path.child(Qi.fromString(n));if(!Xi.isDocumentKey(r))throw new Oi(Di.INVALID_ARGUMENT,`Invalid query. When querying a collection group by documentId(), the value provided must result in a valid document path, but '${r}' is not because it has an odd number of segments (${r.length}).`);return Oo(t,new Xi(r))}if(n instanceof Rl)return Oo(t,n._key);throw new Oi(Di.INVALID_ARGUMENT,`Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${Sl(n)}.`)}function Td(t,e){if(!Array.isArray(t)||0===t.length)throw new Oi(Di.INVALID_ARGUMENT,`Invalid Query. A non-empty array is required for '${e.toString()}' filters.`);if(t.length>10)throw new Oi(Di.INVALID_ARGUMENT,`Invalid Query. '${e.toString()}' filters support a maximum of 10 elements in the value array.`)}function Ed(t,e){if(e.isInequality()){const n=Ia(t),r=e.field;if(null!==n&&!n.isEqual(r))throw new Oi(Di.INVALID_ARGUMENT,`Invalid query. All where filters with an inequality (<, <=, !=, not-in, >, or >=) must be on the same field. But you have inequality filters on '${n.toString()}' and '${r.toString()}'`);const s=Sa(t);null!==s&&function(t,e,n){if(!n.isEqual(e))throw new Oi(Di.INVALID_ARGUMENT,`Invalid query. You have a where filter with an inequality (<, <=, !=, not-in, >, or >=) on field '${e.toString()}' and so you must also use '${e.toString()}' as your first argument to orderBy(), but your first orderBy() is on field '${n.toString()}' instead.`)}(0,r,s)}const n=function(t,e){for(const n of t)for(const t of n.getFlattenedFilters())if(e.indexOf(t.op)>=0)return t.op;return null}(t.filters,function(t){switch(t){case"!=":return["!=","not-in"];case"array-contains":return["array-contains","array-contains-any","not-in"];case"in":return["array-contains-any","in","not-in"];case"array-contains-any":return["array-contains","array-contains-any","in","not-in"];case"not-in":return["array-contains","array-contains-any","in","not-in","!="];default:return[]}}(e.op));if(null!==n)throw n===e.op?new Oi(Di.INVALID_ARGUMENT,`Invalid query. You cannot use more than one '${e.op.toString()}' filter.`):new Oi(Di.INVALID_ARGUMENT,`Invalid query. You cannot use '${e.op.toString()}' filters with '${n.toString()}' filters.`)}class Sd{convertValue(t,e="none"){switch(bo(t)){case 0:return null;case 1:return t.booleanValue;case 2:return wo(t.integerValue||t.doubleValue);case 3:return this.convertTimestamp(t.timestampValue);case 4:return this.convertServerTimestamp(t,e);case 5:return t.stringValue;case 6:return this.convertBytes(_o(t.bytesValue));case 7:return this.convertReference(t.referenceValue);case 8:return this.convertGeoPoint(t.geoPointValue);case 9:return this.convertArray(t.arrayValue,e);case 10:return this.convertObject(t.mapValue,e);default:throw ki()}}convertObject(t,e){const n={};return lo(t.fields,((t,r)=>{n[t]=this.convertValue(r,e)})),n}convertGeoPoint(t){return new Gl(wo(t.latitude),wo(t.longitude))}convertArray(t,e){return(t.values||[]).map((t=>this.convertValue(t,e)))}convertServerTimestamp(t,e){switch(e){case"previous":const n=Eo(t);return null==n?null:this.convertValue(n,e);case"estimate":return this.convertTimestamp(So(t));default:return null}}convertTimestamp(t){const e=vo(t);return new Wi(e.seconds,e.nanos)}convertDocumentKey(t,e){const n=Qi.fromString(t);Ri(fu(n));const r=new uo(n.get(1),n.get(3)),s=new Xi(n.popFirst(5));return r.isEqual(e)||bi(`Document ${s} contains a document reference within a different database (${r.projectId}/${r.database}) which is not supported. It will be treated as a reference in the current database (${e.projectId}/${e.database}) instead.`),s}}
1922
2021
  /**
1923
2022
  * @license
1924
2023
  * Copyright 2020 Google LLC
@@ -1934,7 +2033,7 @@ class bh{constructor(t){this._methodName=t}}
1934
2033
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1935
2034
  * See the License for the specific language governing permissions and
1936
2035
  * limitations under the License.
1937
- */class Qh{constructor(t,e){this.hasPendingWrites=t,this.fromCache=e}isEqual(t){return this.hasPendingWrites===t.hasPendingWrites&&this.fromCache===t.fromCache}}class Jh extends Mh{constructor(t,e,n,s,r,i){super(t,e,n,s,i),this._firestore=t,this._firestoreImpl=t,this.metadata=r}exists(){return super.exists()}data(t={}){if(this._document){if(this._converter){const e=new Yh(this._firestore,this._userDataWriter,this._key,this._document,this.metadata,null);return this._converter.fromFirestore(e,t)}return this._userDataWriter.convertValue(this._document.data.value,t.serverTimestamps)}}get(t,e={}){if(this._document){const n=this._document.data.field(Uh("DocumentSnapshot.get",t));if(null!==n)return this._userDataWriter.convertValue(n,e.serverTimestamps)}}}class Yh extends Jh{data(t={}){return super.data(t)}}class Xh{constructor(t,e,n,s){this._firestore=t,this._userDataWriter=e,this._snapshot=s,this.metadata=new Qh(s.hasPendingWrites,s.fromCache),this.query=n}get docs(){const t=[];return this.forEach((e=>t.push(e))),t}get size(){return this._snapshot.docs.size}get empty(){return 0===this.size}forEach(t,e){this._snapshot.docs.forEach((n=>{t.call(e,new Yh(this._firestore,this._userDataWriter,n.key,n,new Qh(this._snapshot.mutatedKeys.has(n.key),this._snapshot.fromCache),this.query.converter))}))}docChanges(t={}){const e=!!t.includeMetadataChanges;if(e&&this._snapshot.excludesMetadataChanges)throw new Hr(Br.INVALID_ARGUMENT,"To include metadata changes with your document changes, you must also pass { includeMetadataChanges:true } to onSnapshot().");return this._cachedChanges&&this._cachedChangesIncludeMetadataChanges===e||(this._cachedChanges=function(t,e){if(t._snapshot.oldDocs.isEmpty()){let e=0;return t._snapshot.docChanges.map((n=>{const s=new Yh(t._firestore,t._userDataWriter,n.doc.key,n.doc,new Qh(t._snapshot.mutatedKeys.has(n.doc.key),t._snapshot.fromCache),t.query.converter);return n.doc,{type:"added",doc:s,oldIndex:-1,newIndex:e++}}))}{let n=t._snapshot.oldDocs;return t._snapshot.docChanges.filter((t=>e||3!==t.type)).map((e=>{const s=new Yh(t._firestore,t._userDataWriter,e.doc.key,e.doc,new Qh(t._snapshot.mutatedKeys.has(e.doc.key),t._snapshot.fromCache),t.query.converter);let r=-1,i=-1;return 0!==e.type&&(r=n.indexOf(e.doc.key),n=n.delete(e.doc.key)),1!==e.type&&(n=n.add(e.doc),i=n.indexOf(e.doc.key)),{type:Zh(e.type),doc:s,oldIndex:r,newIndex:i}}))}}(this,e),this._cachedChangesIncludeMetadataChanges=e),this._cachedChanges}}function Zh(t){switch(t){case 0:return"added";case 2:case 3:return"modified";case 1:return"removed";default:return Ur()}}
2036
+ */
1938
2037
  /**
1939
2038
  * @license
1940
2039
  * Copyright 2020 Google LLC
@@ -1950,7 +2049,8 @@ class bh{constructor(t){this._methodName=t}}
1950
2049
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1951
2050
  * See the License for the specific language governing permissions and
1952
2051
  * limitations under the License.
1953
- */function tl(t){t=sh(t,ch);const e=sh(t.firestore,wh);return function(t,e,n={}){const s=new jr;return t.asyncQueue.enqueueAndForget((async()=>function(t,e,n,s,r){const i=new fh({next:i=>{e.enqueueAndForget((()=>Cu(t,o)));const a=i.docs.has(n);!a&&i.fromCache?r.reject(new Hr(Br.UNAVAILABLE,"Failed to get document because the client is offline.")):a&&i.fromCache&&s&&"server"===s.source?r.reject(new Hr(Br.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.)')):r.resolve(i)},error:t=>r.reject(t)}),o=new Ou(ko(n.path),i,{includeMetadataChanges:!0,Nu:!0});return Au(t,o)}(await mh(t),t.asyncQueue,e,n,s))),s.promise}(Th(e),t._key).then((n=>rl(e,t,n)))}class el extends $h{constructor(t){super(),this.firestore=t}convertBytes(t){return new Eh(t)}convertReference(t){const e=this.convertDocumentKey(t,this.firestore._databaseId);return new ch(this.firestore,null,e)}}function nl(t){t=sh(t,uh);const e=sh(t.firestore,wh),n=Th(e),s=new el(e);return Fh(t._query),function(t,e,n={}){const s=new jr;return t.asyncQueue.enqueueAndForget((async()=>function(t,e,n,s,r){const i=new fh({next:n=>{e.enqueueAndForget((()=>Cu(t,o))),n.fromCache&&"server"===s.source?r.reject(new Hr(Br.UNAVAILABLE,'Failed to get documents from server. (However, these documents may exist in the local cache. Run again without setting source to "server" to retrieve the cached documents.)')):r.resolve(n)},error:t=>r.reject(t)}),o=new Ou(n,i,{includeMetadataChanges:!0,Nu:!0});return Au(t,o)}(await mh(t),t.asyncQueue,e,n,s))),s.promise}(n,t._query).then((n=>new Xh(e,s,t,n)))}function sl(t,...e){var n,s,r;t=I(t);let i={includeMetadataChanges:!1},o=0;"object"!=typeof e[o]||vh(e[o])||(i=e[o],o++);const a={includeMetadataChanges:i.includeMetadataChanges};if(vh(e[o])){const t=e[o];e[o]=null===(n=t.next)||void 0===n?void 0:n.bind(t),e[o+1]=null===(s=t.error)||void 0===s?void 0:s.bind(t),e[o+2]=null===(r=t.complete)||void 0===r?void 0:r.bind(t)}let c,u,h;if(t instanceof ch)u=sh(t.firestore,wh),h=ko(t._key.path),c={next:n=>{e[o]&&e[o](rl(u,t,n))},error:e[o+1],complete:e[o+2]};else{const n=sh(t,uh);u=sh(n.firestore,wh),h=n._query;const s=new el(u);c={next:t=>{e[o]&&e[o](new Xh(u,s,n,t))},error:e[o+1],complete:e[o+2]},Fh(t._query)}return function(t,e,n,s){const r=new fh(s),i=new Ou(e,r,n);return t.asyncQueue.enqueueAndForget((async()=>Au(await mh(t),i))),()=>{r.bc(),t.asyncQueue.enqueueAndForget((async()=>Cu(await mh(t),i)))}}(Th(u),h,a,c)}function rl(t,e,n){const s=n.docs.get(e._key),r=new el(t);return new Jh(t,r,e._key,s,new Qh(n.hasPendingWrites,n.fromCache),e.converter)}!function(t,e=!0){Rr=ct,rt(new E("firestore",((t,{instanceIdentifier:n,options:s})=>{const r=t.getProvider("app").getImmediate(),i=new wh(new Wr(t.getProvider("auth-internal")),new Jr(t.getProvider("app-check-internal")),function(t,e){if(!Object.prototype.hasOwnProperty.apply(t.options,["projectId"]))throw new Hr(Br.INVALID_ARGUMENT,'"projectId" not provided in firebase.initializeApp.');return new yi(t.options.projectId,e)}(r,n),r);return s=Object.assign({useFetchStreams:e},s),i._setSettings(s),i}),"PUBLIC").setMultipleInstances(!0)),lt(kr,"3.8.0",t),lt(kr,"3.8.0","esm2017")}();
2052
+ */
2053
+ class Id{constructor(t,e){this.hasPendingWrites=t,this.fromCache=e}isEqual(t){return this.hasPendingWrites===t.hasPendingWrites&&this.fromCache===t.fromCache}}class bd extends hd{constructor(t,e,n,r,s,i){super(t,e,n,r,i),this._firestore=t,this._firestoreImpl=t,this.metadata=s}exists(){return super.exists()}data(t={}){if(this._document){if(this._converter){const e=new Ad(this._firestore,this._userDataWriter,this._key,this._document,this.metadata,null);return this._converter.fromFirestore(e,t)}return this._userDataWriter.convertValue(this._document.data.value,t.serverTimestamps)}}get(t,e={}){if(this._document){const n=this._document.data.field(dd("DocumentSnapshot.get",t));if(null!==n)return this._userDataWriter.convertValue(n,e.serverTimestamps)}}}class Ad extends bd{data(t={}){return super.data(t)}}class Cd{constructor(t,e,n,r){this._firestore=t,this._userDataWriter=e,this._snapshot=r,this.metadata=new Id(r.hasPendingWrites,r.fromCache),this.query=n}get docs(){const t=[];return this.forEach((e=>t.push(e))),t}get size(){return this._snapshot.docs.size}get empty(){return 0===this.size}forEach(t,e){this._snapshot.docs.forEach((n=>{t.call(e,new Ad(this._firestore,this._userDataWriter,n.key,n,new Id(this._snapshot.mutatedKeys.has(n.key),this._snapshot.fromCache),this.query.converter))}))}docChanges(t={}){const e=!!t.includeMetadataChanges;if(e&&this._snapshot.excludesMetadataChanges)throw new Oi(Di.INVALID_ARGUMENT,"To include metadata changes with your document changes, you must also pass { includeMetadataChanges:true } to onSnapshot().");return this._cachedChanges&&this._cachedChangesIncludeMetadataChanges===e||(this._cachedChanges=function(t,e){if(t._snapshot.oldDocs.isEmpty()){let e=0;return t._snapshot.docChanges.map((n=>{const r=new Ad(t._firestore,t._userDataWriter,n.doc.key,n.doc,new Id(t._snapshot.mutatedKeys.has(n.doc.key),t._snapshot.fromCache),t.query.converter);return n.doc,{type:"added",doc:r,oldIndex:-1,newIndex:e++}}))}{let n=t._snapshot.oldDocs;return t._snapshot.docChanges.filter((t=>e||3!==t.type)).map((e=>{const r=new Ad(t._firestore,t._userDataWriter,e.doc.key,e.doc,new Id(t._snapshot.mutatedKeys.has(e.doc.key),t._snapshot.fromCache),t.query.converter);let s=-1,i=-1;return 0!==e.type&&(s=n.indexOf(e.doc.key),n=n.delete(e.doc.key)),1!==e.type&&(n=n.add(e.doc),i=n.indexOf(e.doc.key)),{type:kd(e.type),doc:r,oldIndex:s,newIndex:i}}))}}(this,e),this._cachedChangesIncludeMetadataChanges=e),this._cachedChanges}}function kd(t){switch(t){case 0:return"added";case 2:case 3:return"modified";case 1:return"removed";default:return ki()}}
1954
2054
  /**
1955
2055
  * @license
1956
2056
  * Copyright 2020 Google LLC
@@ -1966,8 +2066,7 @@ class bh{constructor(t){this._methodName=t}}
1966
2066
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1967
2067
  * See the License for the specific language governing permissions and
1968
2068
  * limitations under the License.
1969
- */
1970
- lt("firebase","9.15.0","app");class il{constructor(){}static getInstance(){return il.instance||(il.instance=new il),il.instance}setEnv(t){switch(t){case"production":case"prod":this.env="prod";break;default:this.env="dev"}}get firebase(){return"prod"===this.env?al.firebase:ol.firebase}get api(){return"prod"===this.env?al.api:ol.api}get config(){return"prod"===this.env?al.config:ol.config}}const ol={firebase:{apiKey:"AIzaSyDfjBWzpmzb-mhGN8VSURxzLg6nkzmKUD8",authDomain:"fittingroom-dev-5d248.firebaseapp.com",projectId:"fittingroom-dev-5d248",storageBucket:"fittingroom-dev-5d248.appspot.com",messagingSenderId:"2298664147",appId:"1:2298664147:web:340bda75cd5d25f3997026"},api:{url:"https://tfr.dev.thefittingroom.xyz"},config:{avatarTimeout:Number("120000"),vtoTimeout:Number("120000")}},al={firebase:{apiKey:"AIzaSyA3kQ6w1vkA9l9lgY0nNACVPXe-QmP5T1Y",authDomain:"fittingroom-prod.firebaseapp.com",projectId:"fittingroom-prod",storageBucket:"fittingroom-prod.appspot.com",messagingSenderId:"965656825574",appId:"1:965656825574:web:933493cddc73213bd43527"},api:{url:"https://tfr.p.thefittingroom.xyz"},config:{avatarTimeout:Number("120000"),vtoTimeout:Number("120000")}};function cl(t,e){var n={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(n[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(s=Object.getOwnPropertySymbols(t);r<s.length;r++)e.indexOf(s[r])<0&&Object.prototype.propertyIsEnumerable.call(t,s[r])&&(n[s[r]]=t[s[r]])}return n}function ul(){return{"dependent-sdk-initialized-before-auth":"Another Firebase SDK was initialized and is trying to use Auth before Auth is initialized. Please be sure to call `initializeAuth` or `getAuth` before starting any other Firebase SDK."}}const hl=ul,ll=new f("auth","Firebase",{"dependent-sdk-initialized-before-auth":"Another Firebase SDK was initialized and is trying to use Auth before Auth is initialized. Please be sure to call `initializeAuth` or `getAuth` before starting any other Firebase SDK."}),dl="auth/user-disabled",fl=new D("@firebase/auth");function pl(t,...e){fl.logLevel<=C.ERROR&&fl.error(`Auth (${ct}): ${t}`,...e)}
2069
+ */function Rd(t){t=Il(t,Rl);const e=Il(t.firestore,Hl);return function(t,e,n={}){const r=new Li;return t.asyncQueue.enqueueAndForget((async()=>function(t,e,n,r,s){const i=new Pl({next:i=>{e.enqueueAndForget((()=>$h(t,o)));const a=i.docs.has(n);!a&&i.fromCache?s.reject(new Oi(Di.UNAVAILABLE,"Failed to get document because the client is offline.")):a&&i.fromCache&&r&&"server"===r.source?s.reject(new Oi(Di.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.)')):s.resolve(i)},error:t=>s.reject(t)}),o=new Gh(Ta(n.path),i,{includeMetadataChanges:!0,Nu:!0});return jh(t,o)}(await Fl(t),t.asyncQueue,e,n,r))),r.promise}(jl(e),t._key).then((n=>Pd(e,t,n)))}class Nd extends Sd{constructor(t){super(),this.firestore=t}convertBytes(t){return new ql(t)}convertReference(t){const e=this.convertDocumentKey(t,this.firestore._databaseId);return new Rl(this.firestore,null,e)}}function Dd(t){t=Il(t,Nl);const e=Il(t.firestore,Hl),n=jl(e),r=new Nd(e);return fd(t._query),function(t,e,n={}){const r=new Li;return t.asyncQueue.enqueueAndForget((async()=>function(t,e,n,r,s){const i=new Pl({next:n=>{e.enqueueAndForget((()=>$h(t,o))),n.fromCache&&"server"===r.source?s.reject(new Oi(Di.UNAVAILABLE,'Failed to get documents from server. (However, these documents may exist in the local cache. Run again without setting source to "server" to retrieve the cached documents.)')):s.resolve(n)},error:t=>s.reject(t)}),o=new Gh(n,i,{includeMetadataChanges:!0,Nu:!0});return jh(t,o)}(await Fl(t),t.asyncQueue,e,n,r))),r.promise}(n,t._query).then((n=>new Cd(e,r,t,n)))}function Od(t,e,n){t=Il(t,Rl);const r=Il(t.firestore,Hl),s=function(t,e,n){let r;return r=t?n&&(n.merge||n.mergeFields)?t.toFirestore(e,n):t.toFirestore(e):e,r}(t.converter,e,n);return function(t,e){return function(t,e){const n=new Li;return t.asyncQueue.enqueueAndForget((async()=>nl(await function(t){return Ul(t).then((t=>t.syncEngine))}(t),e,n))),n.promise}(jl(t),e)}(r,[td(Zl(r),"setDoc",t._key,s,null!==t.converter,n).toMutation(t._key,Xa.none())])}function Ld(t,...e){var n,r,s;t=oe(t);let i={includeMetadataChanges:!1},o=0;"object"!=typeof e[o]||Bl(e[o])||(i=e[o],o++);const a={includeMetadataChanges:i.includeMetadataChanges};if(Bl(e[o])){const t=e[o];e[o]=null===(n=t.next)||void 0===n?void 0:n.bind(t),e[o+1]=null===(r=t.error)||void 0===r?void 0:r.bind(t),e[o+2]=null===(s=t.complete)||void 0===s?void 0:s.bind(t)}let c,u,h;if(t instanceof Rl)u=Il(t.firestore,Hl),h=Ta(t._key.path),c={next:n=>{e[o]&&e[o](Pd(u,t,n))},error:e[o+1],complete:e[o+2]};else{const n=Il(t,Nl);u=Il(n.firestore,Hl),h=n._query;const r=new Nd(u);c={next:t=>{e[o]&&e[o](new Cd(u,r,n,t))},error:e[o+1],complete:e[o+2]},fd(t._query)}return function(t,e,n,r){const s=new Pl(r),i=new Gh(e,s,n);return t.asyncQueue.enqueueAndForget((async()=>jh(await Fl(t),i))),()=>{s.bc(),t.asyncQueue.enqueueAndForget((async()=>$h(await Fl(t),i)))}}(jl(u),h,a,c)}function Pd(t,e,n){const r=n.docs.get(e._key),s=new Nd(t);return new bd(t,s,e._key,r,new Id(n.hasPendingWrites,n.fromCache),e.converter)}!function(t,e=!0){Ti=Pt,Nt(new ae("firestore",((t,{instanceIdentifier:n,options:r})=>{const s=t.getProvider("app").getImmediate(),i=new Hl(new Ui(t.getProvider("auth-internal")),new Hi(t.getProvider("app-check-internal")),function(t,e){if(!Object.prototype.hasOwnProperty.apply(t.options,["projectId"]))throw new Oi(Di.INVALID_ARGUMENT,'"projectId" not provided in firebase.initializeApp.');return new uo(t.options.projectId,e)}(s,n),s);return r=Object.assign({useFetchStreams:e},r),i._setSettings(r),i}),"PUBLIC").setMultipleInstances(!0)),Ut(wi,"3.8.0",t),Ut(wi,"3.8.0","esm2017")}();
1971
2070
  /**
1972
2071
  * @license
1973
2072
  * Copyright 2020 Google LLC
@@ -1983,7 +2082,8 @@ lt("firebase","9.15.0","app");class il{constructor(){}static getInstance(){retur
1983
2082
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1984
2083
  * See the License for the specific language governing permissions and
1985
2084
  * limitations under the License.
1986
- */function gl(t,...e){throw yl(t,...e)}function ml(t,...e){return yl(t,...e)}function yl(t,...e){if("string"!=typeof t){const n=e[0],s=[...e.slice(1)];return s[0]&&(s[0].appName=t.name),t._errorFactory.create(n,...s)}return ll.create(t,...e)}function vl(t,e,...n){if(!t)throw yl(e,...n)}function wl(t){const e="INTERNAL ASSERTION FAILED: "+t;throw pl(e),new Error(e)}function _l(t,e){t||wl(e)}
2085
+ */
2086
+ Ut("firebase","9.23.0","app");class Md{constructor(){}static getInstance(){return Md.instance||(Md.instance=new Md),Md.instance}setEnv(t){switch(t){case"production":case"prod":this.env="prod";break;default:this.env="dev"}}get firebase(){return"prod"===this.env?Ud.firebase:xd.firebase}get api(){return"prod"===this.env?Ud.api:xd.api}get config(){return"prod"===this.env?Ud.config:xd.config}}const xd={firebase:{apiKey:"AIzaSyDfjBWzpmzb-mhGN8VSURxzLg6nkzmKUD8",authDomain:"fittingroom-dev-5d248.firebaseapp.com",projectId:"fittingroom-dev-5d248",storageBucket:"fittingroom-dev-5d248.appspot.com",messagingSenderId:"2298664147",appId:"1:2298664147:web:340bda75cd5d25f3997026"},api:{url:"https://tfr.dev.thefittingroom.xyz"},config:{avatarTimeout:Number("120000"),vtoTimeout:Number("120000")}},Ud={firebase:{apiKey:"AIzaSyA3kQ6w1vkA9l9lgY0nNACVPXe-QmP5T1Y",authDomain:"fittingroom-prod.firebaseapp.com",projectId:"fittingroom-prod",storageBucket:"fittingroom-prod.appspot.com",messagingSenderId:"965656825574",appId:"1:965656825574:web:933493cddc73213bd43527"},api:{url:"https://tfr.p.thefittingroom.xyz"},config:{avatarTimeout:Number("120000"),vtoTimeout:Number("120000")}};var Fd=1e3,Vd=6e4,Bd=36e5,Hd="millisecond",jd="second",$d="minute",qd="hour",Kd="day",Wd="week",Gd="month",zd="quarter",Qd="year",Yd="date",Jd="Invalid Date",Xd=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,Zd=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,tf={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(t){var e=["th","st","nd","rd"],n=t%100;return"["+t+(e[(n-20)%10]||e[n]||e[0])+"]"}},ef=function(t,e,n){var r=String(t);return!r||r.length>=e?t:""+Array(e+1-r.length).join(n)+t},nf={s:ef,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),r=Math.floor(n/60),s=n%60;return(e<=0?"+":"-")+ef(r,2,"0")+":"+ef(s,2,"0")},m:function t(e,n){if(e.date()<n.date())return-t(n,e);var r=12*(n.year()-e.year())+(n.month()-e.month()),s=e.clone().add(r,Gd),i=n-s<0,o=e.clone().add(r+(i?-1:1),Gd);return+(-(r+(n-s)/(i?s-o:o-s))||0)},a:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},p:function(t){return{M:Gd,y:Qd,w:Wd,d:Kd,D:Yd,h:qd,m:$d,s:jd,ms:Hd,Q:zd}[t]||String(t||"").toLowerCase().replace(/s$/,"")},u:function(t){return void 0===t}},rf="en",sf={};sf[rf]=tf;var of="$isDayjsObject",af=function(t){return t instanceof lf||!(!t||!t[of])},cf=function t(e,n,r){var s;if(!e)return rf;if("string"==typeof e){var i=e.toLowerCase();sf[i]&&(s=i),n&&(sf[i]=n,s=i);var o=e.split("-");if(!s&&o.length>1)return t(o[0])}else{var a=e.name;sf[a]=e,s=a}return!r&&s&&(rf=s),s||!r&&rf},uf=function(t,e){if(af(t))return t.clone();var n="object"==typeof e?e:{};return n.date=t,n.args=arguments,new lf(n)},hf=nf;hf.l=cf,hf.i=af,hf.w=function(t,e){return uf(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var lf=function(){function t(t){this.$L=cf(t.locale,null,!0),this.parse(t),this.$x=this.$x||t.x||{},this[of]=!0}var e=t.prototype;return e.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(hf.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var r=e.match(Xd);if(r){var s=r[2]-1||0,i=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],s,r[3]||1,r[4]||0,r[5]||0,r[6]||0,i)):new Date(r[1],s,r[3]||1,r[4]||0,r[5]||0,r[6]||0,i)}}return new Date(e)}(t),this.init()},e.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds()},e.$utils=function(){return hf},e.isValid=function(){return!(this.$d.toString()===Jd)},e.isSame=function(t,e){var n=uf(t);return this.startOf(e)<=n&&n<=this.endOf(e)},e.isAfter=function(t,e){return uf(t)<this.startOf(e)},e.isBefore=function(t,e){return this.endOf(e)<uf(t)},e.$g=function(t,e,n){return hf.u(t)?this[e]:this.set(n,t)},e.unix=function(){return Math.floor(this.valueOf()/1e3)},e.valueOf=function(){return this.$d.getTime()},e.startOf=function(t,e){var n=this,r=!!hf.u(e)||e,s=hf.p(t),i=function(t,e){var s=hf.w(n.$u?Date.UTC(n.$y,e,t):new Date(n.$y,e,t),n);return r?s:s.endOf(Kd)},o=function(t,e){return hf.w(n.toDate()[t].apply(n.toDate("s"),(r?[0,0,0,0]:[23,59,59,999]).slice(e)),n)},a=this.$W,c=this.$M,u=this.$D,h="set"+(this.$u?"UTC":"");switch(s){case Qd:return r?i(1,0):i(31,11);case Gd:return r?i(1,c):i(0,c+1);case Wd:var l=this.$locale().weekStart||0,d=(a<l?a+7:a)-l;return i(r?u-d:u+(6-d),c);case Kd:case Yd:return o(h+"Hours",0);case qd:return o(h+"Minutes",1);case $d:return o(h+"Seconds",2);case jd:return o(h+"Milliseconds",3);default:return this.clone()}},e.endOf=function(t){return this.startOf(t,!1)},e.$set=function(t,e){var n,r=hf.p(t),s="set"+(this.$u?"UTC":""),i=(n={},n[Kd]=s+"Date",n[Yd]=s+"Date",n[Gd]=s+"Month",n[Qd]=s+"FullYear",n[qd]=s+"Hours",n[$d]=s+"Minutes",n[jd]=s+"Seconds",n[Hd]=s+"Milliseconds",n)[r],o=r===Kd?this.$D+(e-this.$W):e;if(r===Gd||r===Qd){var a=this.clone().set(Yd,1);a.$d[i](o),a.init(),this.$d=a.set(Yd,Math.min(this.$D,a.daysInMonth())).$d}else i&&this.$d[i](o);return this.init(),this},e.set=function(t,e){return this.clone().$set(t,e)},e.get=function(t){return this[hf.p(t)]()},e.add=function(t,e){var n,r=this;t=Number(t);var s=hf.p(e),i=function(e){var n=uf(r);return hf.w(n.date(n.date()+Math.round(e*t)),r)};if(s===Gd)return this.set(Gd,this.$M+t);if(s===Qd)return this.set(Qd,this.$y+t);if(s===Kd)return i(1);if(s===Wd)return i(7);var o=(n={},n[$d]=Vd,n[qd]=Bd,n[jd]=Fd,n)[s]||1,a=this.$d.getTime()+t*o;return hf.w(a,this)},e.subtract=function(t,e){return this.add(-1*t,e)},e.format=function(t){var e=this,n=this.$locale();if(!this.isValid())return n.invalidDate||Jd;var r=t||"YYYY-MM-DDTHH:mm:ssZ",s=hf.z(this),i=this.$H,o=this.$m,a=this.$M,c=n.weekdays,u=n.months,h=n.meridiem,l=function(t,n,s,i){return t&&(t[n]||t(e,r))||s[n].slice(0,i)},d=function(t){return hf.s(i%12||12,t,"0")},f=h||function(t,e,n){var r=t<12?"AM":"PM";return n?r.toLowerCase():r};return r.replace(Zd,(function(t,r){return r||function(t){switch(t){case"YY":return String(e.$y).slice(-2);case"YYYY":return hf.s(e.$y,4,"0");case"M":return a+1;case"MM":return hf.s(a+1,2,"0");case"MMM":return l(n.monthsShort,a,u,3);case"MMMM":return l(u,a);case"D":return e.$D;case"DD":return hf.s(e.$D,2,"0");case"d":return String(e.$W);case"dd":return l(n.weekdaysMin,e.$W,c,2);case"ddd":return l(n.weekdaysShort,e.$W,c,3);case"dddd":return c[e.$W];case"H":return String(i);case"HH":return hf.s(i,2,"0");case"h":return d(1);case"hh":return d(2);case"a":return f(i,o,!0);case"A":return f(i,o,!1);case"m":return String(o);case"mm":return hf.s(o,2,"0");case"s":return String(e.$s);case"ss":return hf.s(e.$s,2,"0");case"SSS":return hf.s(e.$ms,3,"0");case"Z":return s}return null}(t)||s.replace(":","")}))},e.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},e.diff=function(t,e,n){var r,s=this,i=hf.p(e),o=uf(t),a=(o.utcOffset()-this.utcOffset())*Vd,c=this-o,u=function(){return hf.m(s,o)};switch(i){case Qd:r=u()/12;break;case Gd:r=u();break;case zd:r=u()/3;break;case Wd:r=(c-a)/6048e5;break;case Kd:r=(c-a)/864e5;break;case qd:r=c/Bd;break;case $d:r=c/Vd;break;case jd:r=c/Fd;break;default:r=c}return n?r:hf.a(r)},e.daysInMonth=function(){return this.endOf(Gd).$D},e.$locale=function(){return sf[this.$L]},e.locale=function(t,e){if(!t)return this.$L;var n=this.clone(),r=cf(t,e,!0);return r&&(n.$L=r),n},e.clone=function(){return hf.w(this.$d,this)},e.toDate=function(){return new Date(this.valueOf())},e.toJSON=function(){return this.isValid()?this.toISOString():null},e.toISOString=function(){return this.$d.toISOString()},e.toString=function(){return this.$d.toUTCString()},t}(),df=lf.prototype;function ff(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(r=Object.getOwnPropertySymbols(t);s<r.length;s++)e.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(t,r[s])&&(n[r[s]]=t[r[s]])}return n}function pf(){return{"dependent-sdk-initialized-before-auth":"Another Firebase SDK was initialized and is trying to use Auth before Auth is initialized. Please be sure to call `initializeAuth` or `getAuth` before starting any other Firebase SDK."}}uf.prototype=df,[["$ms",Hd],["$s",jd],["$m",$d],["$H",qd],["$W",Kd],["$M",Gd],["$y",Qd],["$D",Yd]].forEach((function(t){df[t[1]]=function(e){return this.$g(e,t[0],t[1])}})),uf.extend=function(t,e){return t.$i||(t(e,lf,uf),t.$i=!0),uf},uf.locale=cf,uf.isDayjs=af,uf.unix=function(t){return uf(1e3*t)},uf.en=sf[rf],uf.Ls=sf,uf.p={},"function"==typeof SuppressedError&&SuppressedError;const gf=pf,mf=new p("auth","Firebase",{"dependent-sdk-initialized-before-auth":"Another Firebase SDK was initialized and is trying to use Auth before Auth is initialized. Please be sure to call `initializeAuth` or `getAuth` before starting any other Firebase SDK."}),yf="auth/user-disabled",vf=new L("@firebase/auth");function wf(t,...e){vf.logLevel<=k.ERROR&&vf.error(`Auth (${Pt}): ${t}`,...e)}
1987
2087
  /**
1988
2088
  * @license
1989
2089
  * Copyright 2020 Google LLC
@@ -1999,7 +2099,7 @@ lt("firebase","9.15.0","app");class il{constructor(){}static getInstance(){retur
1999
2099
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2000
2100
  * See the License for the specific language governing permissions and
2001
2101
  * limitations under the License.
2002
- */const Tl=new Map;function Il(t){_l(t instanceof Function,"Expected a class definition");let e=Tl.get(t);return e?(_l(e instanceof t,"Instance stored in cache mismatched with class"),e):(e=new t,Tl.set(t,e),e)}
2102
+ */function _f(t,...e){throw Ef(t,...e)}function Tf(t,...e){return Ef(t,...e)}function Ef(t,...e){if("string"!=typeof t){const n=e[0],r=[...e.slice(1)];return r[0]&&(r[0].appName=t.name),t._errorFactory.create(n,...r)}return mf.create(t,...e)}function Sf(t,e,...n){if(!t)throw Ef(e,...n)}function If(t){const e="INTERNAL ASSERTION FAILED: "+t;throw wf(e),new Error(e)}function bf(t,e){t||If(e)}
2003
2103
  /**
2004
2104
  * @license
2005
2105
  * Copyright 2020 Google LLC
@@ -2015,7 +2115,7 @@ lt("firebase","9.15.0","app");class il{constructor(){}static getInstance(){retur
2015
2115
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2016
2116
  * See the License for the specific language governing permissions and
2017
2117
  * limitations under the License.
2018
- */
2118
+ */function Af(){var t;return"undefined"!=typeof self&&(null===(t=self.location)||void 0===t?void 0:t.href)||""}function Cf(){var t;return"undefined"!=typeof self&&(null===(t=self.location)||void 0===t?void 0:t.protocol)||null}
2019
2119
  /**
2020
2120
  * @license
2021
2121
  * Copyright 2020 Google LLC
@@ -2031,8 +2131,7 @@ lt("firebase","9.15.0","app");class il{constructor(){}static getInstance(){retur
2031
2131
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2032
2132
  * See the License for the specific language governing permissions and
2033
2133
  * limitations under the License.
2034
- */
2035
- function El(){var t;return"undefined"!=typeof self&&(null===(t=self.location)||void 0===t?void 0:t.href)||""}function Sl(){var t;return"undefined"!=typeof self&&(null===(t=self.location)||void 0===t?void 0:t.protocol)||null}
2134
+ */function kf(){return"undefined"==typeof navigator||!navigator||!("onLine"in navigator)||"boolean"!=typeof navigator.onLine||"http:"!==Cf()&&"https:"!==Cf()&&!function(){const t="object"==typeof chrome?chrome.runtime:"object"==typeof browser?browser.runtime:void 0;return"object"==typeof t&&void 0!==t.id}()&&!("connection"in navigator)||navigator.onLine}
2036
2135
  /**
2037
2136
  * @license
2038
2137
  * Copyright 2020 Google LLC
@@ -2048,7 +2147,8 @@ function El(){var t;return"undefined"!=typeof self&&(null===(t=self.location)||v
2048
2147
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2049
2148
  * See the License for the specific language governing permissions and
2050
2149
  * limitations under the License.
2051
- */function bl(){return"undefined"==typeof navigator||!navigator||!("onLine"in navigator)||"boolean"!=typeof navigator.onLine||"http:"!==Sl()&&"https:"!==Sl()&&!function(){const t="object"==typeof chrome?chrome.runtime:"object"==typeof browser?browser.runtime:void 0;return"object"==typeof t&&void 0!==t.id}()&&!("connection"in navigator)||navigator.onLine}
2150
+ */
2151
+ class Rf{constructor(t,e){this.shortDelay=t,this.longDelay=e,bf(e>t,"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(d())||"object"==typeof navigator&&"ReactNative"===navigator.product}get(){return kf()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}}
2052
2152
  /**
2053
2153
  * @license
2054
2154
  * Copyright 2020 Google LLC
@@ -2064,8 +2164,7 @@ function El(){var t;return"undefined"!=typeof self&&(null===(t=self.location)||v
2064
2164
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2065
2165
  * See the License for the specific language governing permissions and
2066
2166
  * limitations under the License.
2067
- */
2068
- class Al{constructor(t,e){this.shortDelay=t,this.longDelay=e,_l(e>t,"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(o())||"object"==typeof navigator&&"ReactNative"===navigator.product}get(){return bl()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}}
2167
+ */function Nf(t,e){bf(t.emulator,"Emulator should always be set here");const{url:n}=t.emulator;return e?`${n}${e.startsWith("/")?e.slice(1):e}`:n}
2069
2168
  /**
2070
2169
  * @license
2071
2170
  * Copyright 2020 Google LLC
@@ -2081,7 +2180,7 @@ class Al{constructor(t,e){this.shortDelay=t,this.longDelay=e,_l(e>t,"Short delay
2081
2180
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2082
2181
  * See the License for the specific language governing permissions and
2083
2182
  * limitations under the License.
2084
- */function Cl(t,e){_l(t.emulator,"Emulator should always be set here");const{url:n}=t.emulator;return e?`${n}${e.startsWith("/")?e.slice(1):e}`:n}
2183
+ */class Df{static initialize(t,e,n){this.fetchImpl=t,e&&(this.headersImpl=e),n&&(this.responseImpl=n)}static fetch(){return this.fetchImpl?this.fetchImpl:"undefined"!=typeof self&&"fetch"in self?self.fetch:void If("Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static headers(){return this.headersImpl?this.headersImpl:"undefined"!=typeof self&&"Headers"in self?self.Headers:void If("Could not find Headers implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static response(){return this.responseImpl?this.responseImpl:"undefined"!=typeof self&&"Response"in self?self.Response:void If("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}}
2085
2184
  /**
2086
2185
  * @license
2087
2186
  * Copyright 2020 Google LLC
@@ -2097,7 +2196,7 @@ class Al{constructor(t,e){this.shortDelay=t,this.longDelay=e,_l(e>t,"Short delay
2097
2196
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2098
2197
  * See the License for the specific language governing permissions and
2099
2198
  * limitations under the License.
2100
- */class kl{static initialize(t,e,n){this.fetchImpl=t,e&&(this.headersImpl=e),n&&(this.responseImpl=n)}static fetch(){return this.fetchImpl?this.fetchImpl:"undefined"!=typeof self&&"fetch"in self?self.fetch:void wl("Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static headers(){return this.headersImpl?this.headersImpl:"undefined"!=typeof self&&"Headers"in self?self.Headers:void wl("Could not find Headers implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static response(){return this.responseImpl?this.responseImpl:"undefined"!=typeof self&&"Response"in self?self.Response:void wl("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}}
2199
+ */const Of={CREDENTIAL_MISMATCH:"custom-token-mismatch",MISSING_CUSTOM_TOKEN:"internal-error",INVALID_IDENTIFIER:"invalid-email",MISSING_CONTINUE_URI:"internal-error",INVALID_PASSWORD:"wrong-password",MISSING_PASSWORD:"missing-password",EMAIL_EXISTS:"email-already-in-use",PASSWORD_LOGIN_DISABLED:"operation-not-allowed",INVALID_IDP_RESPONSE:"invalid-credential",INVALID_PENDING_TOKEN:"invalid-credential",FEDERATED_USER_ID_ALREADY_LINKED:"credential-already-in-use",MISSING_REQ_TYPE:"internal-error",EMAIL_NOT_FOUND:"user-not-found",RESET_PASSWORD_EXCEED_LIMIT:"too-many-requests",EXPIRED_OOB_CODE:"expired-action-code",INVALID_OOB_CODE:"invalid-action-code",MISSING_OOB_CODE:"internal-error",CREDENTIAL_TOO_OLD_LOGIN_AGAIN:"requires-recent-login",INVALID_ID_TOKEN:"invalid-user-token",TOKEN_EXPIRED:"user-token-expired",USER_NOT_FOUND:"user-token-expired",TOO_MANY_ATTEMPTS_TRY_LATER:"too-many-requests",INVALID_CODE:"invalid-verification-code",INVALID_SESSION_INFO:"invalid-verification-id",INVALID_TEMPORARY_PROOF:"invalid-credential",MISSING_SESSION_INFO:"missing-verification-id",SESSION_EXPIRED:"code-expired",MISSING_ANDROID_PACKAGE_NAME:"missing-android-pkg-name",UNAUTHORIZED_DOMAIN:"unauthorized-continue-uri",INVALID_OAUTH_CLIENT_ID:"invalid-oauth-client-id",ADMIN_ONLY_OPERATION:"admin-restricted-operation",INVALID_MFA_PENDING_CREDENTIAL:"invalid-multi-factor-session",MFA_ENROLLMENT_NOT_FOUND:"multi-factor-info-not-found",MISSING_MFA_ENROLLMENT_ID:"missing-multi-factor-info",MISSING_MFA_PENDING_CREDENTIAL:"missing-multi-factor-session",SECOND_FACTOR_EXISTS:"second-factor-already-in-use",SECOND_FACTOR_LIMIT_EXCEEDED:"maximum-second-factor-count-exceeded",BLOCKING_FUNCTION_ERROR_RESPONSE:"internal-error",RECAPTCHA_NOT_ENABLED:"recaptcha-not-enabled",MISSING_RECAPTCHA_TOKEN:"missing-recaptcha-token",INVALID_RECAPTCHA_TOKEN:"invalid-recaptcha-token",INVALID_RECAPTCHA_ACTION:"invalid-recaptcha-action",MISSING_CLIENT_TYPE:"missing-client-type",MISSING_RECAPTCHA_VERSION:"missing-recaptcha-version",INVALID_RECAPTCHA_VERSION:"invalid-recaptcha-version",INVALID_REQ_TYPE:"invalid-req-type"},Lf=new Rf(3e4,6e4);
2101
2200
  /**
2102
2201
  * @license
2103
2202
  * Copyright 2020 Google LLC
@@ -2113,7 +2212,7 @@ class Al{constructor(t,e){this.shortDelay=t,this.longDelay=e,_l(e>t,"Short delay
2113
2212
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2114
2213
  * See the License for the specific language governing permissions and
2115
2214
  * limitations under the License.
2116
- */const Nl={CREDENTIAL_MISMATCH:"custom-token-mismatch",MISSING_CUSTOM_TOKEN:"internal-error",INVALID_IDENTIFIER:"invalid-email",MISSING_CONTINUE_URI:"internal-error",INVALID_PASSWORD:"wrong-password",MISSING_PASSWORD:"internal-error",EMAIL_EXISTS:"email-already-in-use",PASSWORD_LOGIN_DISABLED:"operation-not-allowed",INVALID_IDP_RESPONSE:"invalid-credential",INVALID_PENDING_TOKEN:"invalid-credential",FEDERATED_USER_ID_ALREADY_LINKED:"credential-already-in-use",MISSING_REQ_TYPE:"internal-error",EMAIL_NOT_FOUND:"user-not-found",RESET_PASSWORD_EXCEED_LIMIT:"too-many-requests",EXPIRED_OOB_CODE:"expired-action-code",INVALID_OOB_CODE:"invalid-action-code",MISSING_OOB_CODE:"internal-error",CREDENTIAL_TOO_OLD_LOGIN_AGAIN:"requires-recent-login",INVALID_ID_TOKEN:"invalid-user-token",TOKEN_EXPIRED:"user-token-expired",USER_NOT_FOUND:"user-token-expired",TOO_MANY_ATTEMPTS_TRY_LATER:"too-many-requests",INVALID_CODE:"invalid-verification-code",INVALID_SESSION_INFO:"invalid-verification-id",INVALID_TEMPORARY_PROOF:"invalid-credential",MISSING_SESSION_INFO:"missing-verification-id",SESSION_EXPIRED:"code-expired",MISSING_ANDROID_PACKAGE_NAME:"missing-android-pkg-name",UNAUTHORIZED_DOMAIN:"unauthorized-continue-uri",INVALID_OAUTH_CLIENT_ID:"invalid-oauth-client-id",ADMIN_ONLY_OPERATION:"admin-restricted-operation",INVALID_MFA_PENDING_CREDENTIAL:"invalid-multi-factor-session",MFA_ENROLLMENT_NOT_FOUND:"multi-factor-info-not-found",MISSING_MFA_ENROLLMENT_ID:"missing-multi-factor-info",MISSING_MFA_PENDING_CREDENTIAL:"missing-multi-factor-session",SECOND_FACTOR_EXISTS:"second-factor-already-in-use",SECOND_FACTOR_LIMIT_EXCEEDED:"maximum-second-factor-count-exceeded",BLOCKING_FUNCTION_ERROR_RESPONSE:"internal-error"},Rl=new Al(3e4,6e4);
2215
+ */function Pf(t,e){return t.tenantId&&!e.tenantId?Object.assign(Object.assign({},e),{tenantId:t.tenantId}):e}async function Mf(t,e,n,r,s={}){return xf(t,s,(async()=>{let s={},i={};r&&("GET"===e?i=r:s={body:JSON.stringify(r)});const o=v(Object.assign({key:t.config.apiKey},i)).slice(1),a=await t._getAdditionalHeaders();return a["Content-Type"]="application/json",t.languageCode&&(a["X-Firebase-Locale"]=t.languageCode),Df.fetch()(Ff(t,t.config.apiHost,n,o),Object.assign({method:e,headers:a,referrerPolicy:"no-referrer"},s))}))}async function xf(t,e,n){t._canInitEmulator=!1;const r=Object.assign(Object.assign({},Of),e);try{const e=new Vf(t),s=await Promise.race([n(),e.promise]);e.clearNetworkTimeout();const i=await s.json();if("needConfirmation"in i)throw Bf(t,"account-exists-with-different-credential",i);if(s.ok&&!("errorMessage"in i))return i;{const e=s.ok?i.errorMessage:i.error.message,[n,o]=e.split(" : ");if("FEDERATED_USER_ID_ALREADY_LINKED"===n)throw Bf(t,"credential-already-in-use",i);if("EMAIL_EXISTS"===n)throw Bf(t,"email-already-in-use",i);if("USER_DISABLED"===n)throw Bf(t,"user-disabled",i);const a=r[n]||n.toLowerCase().replace(/[_\s]+/g,"-");if(o)throw function(t,e,n){const r=Object.assign(Object.assign({},gf()),{[e]:n});return new p("auth","Firebase",r).create(e,{appName:t.name})}(t,a,o);_f(t,a)}}catch(e){if(e instanceof f)throw e;_f(t,"network-request-failed",{message:String(e)})}}async function Uf(t,e,n,r,s={}){const i=await Mf(t,e,n,r,s);return"mfaPendingCredential"in i&&_f(t,"multi-factor-auth-required",{_serverResponse:i}),i}function Ff(t,e,n,r){const s=`${e}${n}?${r}`;return t.config.emulator?Nf(t.config,s):`${t.config.apiScheme}://${s}`}class Vf{constructor(t){this.auth=t,this.timer=null,this.promise=new Promise(((t,e)=>{this.timer=setTimeout((()=>e(Tf(this.auth,"network-request-failed"))),Lf.get())}))}clearNetworkTimeout(){clearTimeout(this.timer)}}function Bf(t,e,n){const r={appName:t.name};n.email&&(r.email=n.email),n.phoneNumber&&(r.phoneNumber=n.phoneNumber);const s=Tf(t,e,r);return s.customData._tokenResponse=n,s}
2117
2216
  /**
2118
2217
  * @license
2119
2218
  * Copyright 2020 Google LLC
@@ -2129,7 +2228,7 @@ class Al{constructor(t,e){this.shortDelay=t,this.longDelay=e,_l(e>t,"Short delay
2129
2228
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2130
2229
  * See the License for the specific language governing permissions and
2131
2230
  * limitations under the License.
2132
- */function Ol(t,e){return t.tenantId&&!e.tenantId?Object.assign(Object.assign({},e),{tenantId:t.tenantId}):e}async function Dl(t,e,n,s,r={}){return Ll(t,r,(async()=>{let r={},i={};s&&("GET"===e?i=s:r={body:JSON.stringify(s)});const o=y(Object.assign({key:t.config.apiKey},i)).slice(1),a=await t._getAdditionalHeaders();return a["Content-Type"]="application/json",t.languageCode&&(a["X-Firebase-Locale"]=t.languageCode),kl.fetch()(Ml(t,t.config.apiHost,n,o),Object.assign({method:e,headers:a,referrerPolicy:"no-referrer"},r))}))}async function Ll(t,e,n){t._canInitEmulator=!1;const s=Object.assign(Object.assign({},Nl),e);try{const e=new xl(t),r=await Promise.race([n(),e.promise]);e.clearNetworkTimeout();const i=await r.json();if("needConfirmation"in i)throw Ul(t,"account-exists-with-different-credential",i);if(r.ok&&!("errorMessage"in i))return i;{const e=r.ok?i.errorMessage:i.error.message,[n,o]=e.split(" : ");if("FEDERATED_USER_ID_ALREADY_LINKED"===n)throw Ul(t,"credential-already-in-use",i);if("EMAIL_EXISTS"===n)throw Ul(t,"email-already-in-use",i);if("USER_DISABLED"===n)throw Ul(t,"user-disabled",i);const a=s[n]||n.toLowerCase().replace(/[_\s]+/g,"-");if(o)throw function(t,e,n){const s=Object.assign(Object.assign({},hl()),{[e]:n});return new f("auth","Firebase",s).create(e,{appName:t.name})}(t,a,o);gl(t,a)}}catch(e){if(e instanceof d)throw e;gl(t,"network-request-failed")}}async function Pl(t,e,n,s,r={}){const i=await Dl(t,e,n,s,r);return"mfaPendingCredential"in i&&gl(t,"multi-factor-auth-required",{_serverResponse:i}),i}function Ml(t,e,n,s){const r=`${e}${n}?${s}`;return t.config.emulator?Cl(t.config,r):`${t.config.apiScheme}://${r}`}class xl{constructor(t){this.auth=t,this.timer=null,this.promise=new Promise(((t,e)=>{this.timer=setTimeout((()=>e(ml(this.auth,"network-request-failed"))),Rl.get())}))}clearNetworkTimeout(){clearTimeout(this.timer)}}function Ul(t,e,n){const s={appName:t.name};n.email&&(s.email=n.email),n.phoneNumber&&(s.phoneNumber=n.phoneNumber);const r=ml(t,e,s);return r.customData._tokenResponse=n,r}
2231
+ */
2133
2232
  /**
2134
2233
  * @license
2135
2234
  * Copyright 2020 Google LLC
@@ -2146,6 +2245,7 @@ class Al{constructor(t,e){this.shortDelay=t,this.longDelay=e,_l(e>t,"Short delay
2146
2245
  * See the License for the specific language governing permissions and
2147
2246
  * limitations under the License.
2148
2247
  */
2248
+ function Hf(t){if(t)try{const e=new Date(Number(t));if(!isNaN(e.getTime()))return e.toUTCString()}catch(t){}}function jf(t){return 1e3*Number(t)}function $f(t){const[e,n,r]=t.split(".");if(void 0===e||void 0===n||void 0===r)return wf("JWT malformed, contained fewer than 3 sections"),null;try{const t=o(n);return t?JSON.parse(t):(wf("Failed to decode base64 JWT payload"),null)}catch(t){return wf("Caught error parsing JWT payload as JSON",null==t?void 0:t.toString()),null}}
2149
2249
  /**
2150
2250
  * @license
2151
2251
  * Copyright 2020 Google LLC
@@ -2162,7 +2262,7 @@ class Al{constructor(t,e){this.shortDelay=t,this.longDelay=e,_l(e>t,"Short delay
2162
2262
  * See the License for the specific language governing permissions and
2163
2263
  * limitations under the License.
2164
2264
  */
2165
- function Fl(t){if(t)try{const e=new Date(Number(t));if(!isNaN(e.getTime()))return e.toUTCString()}catch(t){}}function Vl(t){return 1e3*Number(t)}function Bl(t){const[e,n,s]=t.split(".");if(void 0===e||void 0===n||void 0===s)return pl("JWT malformed, contained fewer than 3 sections"),null;try{const t=i(n);return t?JSON.parse(t):(pl("Failed to decode base64 JWT payload"),null)}catch(t){return pl("Caught error parsing JWT payload as JSON",null==t?void 0:t.toString()),null}}
2265
+ async function qf(t,e,n=!1){if(n)return e;try{return await e}catch(e){throw e instanceof f&&function({code:t}){return"auth/user-disabled"===t||"auth/user-token-expired"===t}
2166
2266
  /**
2167
2267
  * @license
2168
2268
  * Copyright 2020 Google LLC
@@ -2178,8 +2278,7 @@ function Fl(t){if(t)try{const e=new Date(Number(t));if(!isNaN(e.getTime()))retur
2178
2278
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2179
2279
  * See the License for the specific language governing permissions and
2180
2280
  * limitations under the License.
2181
- */
2182
- async function Hl(t,e,n=!1){if(n)return e;try{return await e}catch(e){throw e instanceof d&&function({code:t}){return"auth/user-disabled"===t||"auth/user-token-expired"===t}
2281
+ */(e)&&t.auth.currentUser===t&&await t.auth.signOut(),e}}class Kf{constructor(t){this.user=t,this.isRunning=!1,this.timerId=null,this.errorBackoff=3e4}_start(){this.isRunning||(this.isRunning=!0,this.schedule())}_stop(){this.isRunning&&(this.isRunning=!1,null!==this.timerId&&clearTimeout(this.timerId))}getInterval(t){var e;if(t){const t=this.errorBackoff;return this.errorBackoff=Math.min(2*this.errorBackoff,96e4),t}{this.errorBackoff=3e4;const t=(null!==(e=this.user.stsTokenManager.expirationTime)&&void 0!==e?e:0)-Date.now()-3e5;return Math.max(0,t)}}schedule(t=!1){if(!this.isRunning)return;const e=this.getInterval(t);this.timerId=setTimeout((async()=>{await this.iteration()}),e)}async iteration(){try{await this.user.getIdToken(!0)}catch(t){return void("auth/network-request-failed"===(null==t?void 0:t.code)&&this.schedule(!0))}this.schedule()}}
2183
2282
  /**
2184
2283
  * @license
2185
2284
  * Copyright 2020 Google LLC
@@ -2195,10 +2294,10 @@ async function Hl(t,e,n=!1){if(n)return e;try{return await e}catch(e){throw e in
2195
2294
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2196
2295
  * See the License for the specific language governing permissions and
2197
2296
  * limitations under the License.
2198
- */(e)&&t.auth.currentUser===t&&await t.auth.signOut(),e}}class jl{constructor(t){this.user=t,this.isRunning=!1,this.timerId=null,this.errorBackoff=3e4}_start(){this.isRunning||(this.isRunning=!0,this.schedule())}_stop(){this.isRunning&&(this.isRunning=!1,null!==this.timerId&&clearTimeout(this.timerId))}getInterval(t){var e;if(t){const t=this.errorBackoff;return this.errorBackoff=Math.min(2*this.errorBackoff,96e4),t}{this.errorBackoff=3e4;const t=(null!==(e=this.user.stsTokenManager.expirationTime)&&void 0!==e?e:0)-Date.now()-3e5;return Math.max(0,t)}}schedule(t=!1){if(!this.isRunning)return;const e=this.getInterval(t);this.timerId=setTimeout((async()=>{await this.iteration()}),e)}async iteration(){try{await this.user.getIdToken(!0)}catch(t){return void("auth/network-request-failed"===(null==t?void 0:t.code)&&this.schedule(!0))}this.schedule()}}
2297
+ */class Wf{constructor(t,e){this.createdAt=t,this.lastLoginAt=e,this._initializeTime()}_initializeTime(){this.lastSignInTime=Hf(this.lastLoginAt),this.creationTime=Hf(this.createdAt)}_copy(t){this.createdAt=t.createdAt,this.lastLoginAt=t.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}}
2199
2298
  /**
2200
2299
  * @license
2201
- * Copyright 2020 Google LLC
2300
+ * Copyright 2019 Google LLC
2202
2301
  *
2203
2302
  * Licensed under the Apache License, Version 2.0 (the "License");
2204
2303
  * you may not use this file except in compliance with the License.
@@ -2211,10 +2310,10 @@ async function Hl(t,e,n=!1){if(n)return e;try{return await e}catch(e){throw e in
2211
2310
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2212
2311
  * See the License for the specific language governing permissions and
2213
2312
  * limitations under the License.
2214
- */class ql{constructor(t,e){this.createdAt=t,this.lastLoginAt=e,this._initializeTime()}_initializeTime(){this.lastSignInTime=Fl(this.lastLoginAt),this.creationTime=Fl(this.createdAt)}_copy(t){this.createdAt=t.createdAt,this.lastLoginAt=t.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}}
2313
+ */async function Gf(t){var e;const n=t.auth,r=await t.getIdToken(),s=await qf(t,async function(t,e){return Mf(t,"POST","/v1/accounts:lookup",e)}(n,{idToken:r}));Sf(null==s?void 0:s.users.length,n,"internal-error");const i=s.users[0];t._notifyReloadListener(i);const o=(null===(e=i.providerUserInfo)||void 0===e?void 0:e.length)?i.providerUserInfo.map((t=>{var{providerId:e}=t,n=ff(t,["providerId"]);return{providerId:e,uid:n.rawId||"",displayName:n.displayName||null,email:n.email||null,phoneNumber:n.phoneNumber||null,photoURL:n.photoUrl||null}})):[];const a=(c=t.providerData,u=o,[...c.filter((t=>!u.some((e=>e.providerId===t.providerId)))),...u]);var c,u;const h=t.isAnonymous,l=!(t.email&&i.passwordHash||(null==a?void 0:a.length)),d=!!h&&l,f={uid:i.localId,displayName:i.displayName||null,photoURL:i.photoUrl||null,email:i.email||null,emailVerified:i.emailVerified||!1,phoneNumber:i.phoneNumber||null,tenantId:i.tenantId||null,providerData:a,metadata:new Wf(i.createdAt,i.lastLoginAt),isAnonymous:d};Object.assign(t,f)}
2215
2314
  /**
2216
2315
  * @license
2217
- * Copyright 2019 Google LLC
2316
+ * Copyright 2020 Google LLC
2218
2317
  *
2219
2318
  * Licensed under the Apache License, Version 2.0 (the "License");
2220
2319
  * you may not use this file except in compliance with the License.
@@ -2227,7 +2326,8 @@ async function Hl(t,e,n=!1){if(n)return e;try{return await e}catch(e){throw e in
2227
2326
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2228
2327
  * See the License for the specific language governing permissions and
2229
2328
  * limitations under the License.
2230
- */async function Kl(t){var e;const n=t.auth,s=await t.getIdToken(),r=await Hl(t,async function(t,e){return Dl(t,"POST","/v1/accounts:lookup",e)}(n,{idToken:s}));vl(null==r?void 0:r.users.length,n,"internal-error");const i=r.users[0];t._notifyReloadListener(i);const o=(null===(e=i.providerUserInfo)||void 0===e?void 0:e.length)?i.providerUserInfo.map((t=>{var{providerId:e}=t,n=cl(t,["providerId"]);return{providerId:e,uid:n.rawId||"",displayName:n.displayName||null,email:n.email||null,phoneNumber:n.phoneNumber||null,photoURL:n.photoUrl||null}})):[];const a=(c=t.providerData,u=o,[...c.filter((t=>!u.some((e=>e.providerId===t.providerId)))),...u]);var c,u;const h=t.isAnonymous,l=!(t.email&&i.passwordHash||(null==a?void 0:a.length)),d=!!h&&l,f={uid:i.localId,displayName:i.displayName||null,photoURL:i.photoUrl||null,email:i.email||null,emailVerified:i.emailVerified||!1,phoneNumber:i.phoneNumber||null,tenantId:i.tenantId||null,providerData:a,metadata:new ql(i.createdAt,i.lastLoginAt),isAnonymous:d};Object.assign(t,f)}
2329
+ */
2330
+ class zf{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(t){Sf(t.idToken,"internal-error"),Sf(void 0!==t.idToken,"internal-error"),Sf(void 0!==t.refreshToken,"internal-error");const e="expiresIn"in t&&void 0!==t.expiresIn?Number(t.expiresIn):function(t){const e=$f(t);return Sf(e,"internal-error"),Sf(void 0!==e.exp,"internal-error"),Sf(void 0!==e.iat,"internal-error"),Number(e.exp)-Number(e.iat)}(t.idToken);this.updateTokensAndExpiration(t.idToken,t.refreshToken,e)}async getToken(t,e=!1){return Sf(!this.accessToken||this.refreshToken,t,"user-token-expired"),e||!this.accessToken||this.isExpired?this.refreshToken?(await this.refresh(t,this.refreshToken),this.accessToken):null:this.accessToken}clearRefreshToken(){this.refreshToken=null}async refresh(t,e){const{accessToken:n,refreshToken:r,expiresIn:s}=
2231
2331
  /**
2232
2332
  * @license
2233
2333
  * Copyright 2020 Google LLC
@@ -2243,8 +2343,7 @@ async function Hl(t,e,n=!1){if(n)return e;try{return await e}catch(e){throw e in
2243
2343
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2244
2344
  * See the License for the specific language governing permissions and
2245
2345
  * limitations under the License.
2246
- */
2247
- class Gl{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(t){vl(t.idToken,"internal-error"),vl(void 0!==t.idToken,"internal-error"),vl(void 0!==t.refreshToken,"internal-error");const e="expiresIn"in t&&void 0!==t.expiresIn?Number(t.expiresIn):function(t){const e=Bl(t);return vl(e,"internal-error"),vl(void 0!==e.exp,"internal-error"),vl(void 0!==e.iat,"internal-error"),Number(e.exp)-Number(e.iat)}(t.idToken);this.updateTokensAndExpiration(t.idToken,t.refreshToken,e)}async getToken(t,e=!1){return vl(!this.accessToken||this.refreshToken,t,"user-token-expired"),e||!this.accessToken||this.isExpired?this.refreshToken?(await this.refresh(t,this.refreshToken),this.accessToken):null:this.accessToken}clearRefreshToken(){this.refreshToken=null}async refresh(t,e){const{accessToken:n,refreshToken:s,expiresIn:r}=await
2346
+ */await async function(t,e){const n=await xf(t,{},(async()=>{const n=v({grant_type:"refresh_token",refresh_token:e}).slice(1),{tokenApiHost:r,apiKey:s}=t.config,i=Ff(t,r,"/v1/token",`key=${s}`),o=await t._getAdditionalHeaders();return o["Content-Type"]="application/x-www-form-urlencoded",Df.fetch()(i,{method:"POST",headers:o,body:n})}));return{accessToken:n.access_token,expiresIn:n.expires_in,refreshToken:n.refresh_token}}(t,e);this.updateTokensAndExpiration(n,r,Number(s))}updateTokensAndExpiration(t,e,n){this.refreshToken=e||null,this.accessToken=t||null,this.expirationTime=Date.now()+1e3*n}static fromJSON(t,e){const{refreshToken:n,accessToken:r,expirationTime:s}=e,i=new zf;return n&&(Sf("string"==typeof n,"internal-error",{appName:t}),i.refreshToken=n),r&&(Sf("string"==typeof r,"internal-error",{appName:t}),i.accessToken=r),s&&(Sf("number"==typeof s,"internal-error",{appName:t}),i.expirationTime=s),i}toJSON(){return{refreshToken:this.refreshToken,accessToken:this.accessToken,expirationTime:this.expirationTime}}_assign(t){this.accessToken=t.accessToken,this.refreshToken=t.refreshToken,this.expirationTime=t.expirationTime}_clone(){return Object.assign(new zf,this.toJSON())}_performRefresh(){return If("not implemented")}}
2248
2347
  /**
2249
2348
  * @license
2250
2349
  * Copyright 2020 Google LLC
@@ -2260,8 +2359,7 @@ class Gl{constructor(){this.refreshToken=null,this.accessToken=null,this.expirat
2260
2359
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2261
2360
  * See the License for the specific language governing permissions and
2262
2361
  * limitations under the License.
2263
- */
2264
- async function(t,e){const n=await Ll(t,{},(async()=>{const n=y({grant_type:"refresh_token",refresh_token:e}).slice(1),{tokenApiHost:s,apiKey:r}=t.config,i=Ml(t,s,"/v1/token",`key=${r}`),o=await t._getAdditionalHeaders();return o["Content-Type"]="application/x-www-form-urlencoded",kl.fetch()(i,{method:"POST",headers:o,body:n})}));return{accessToken:n.access_token,expiresIn:n.expires_in,refreshToken:n.refresh_token}}(t,e);this.updateTokensAndExpiration(n,s,Number(r))}updateTokensAndExpiration(t,e,n){this.refreshToken=e||null,this.accessToken=t||null,this.expirationTime=Date.now()+1e3*n}static fromJSON(t,e){const{refreshToken:n,accessToken:s,expirationTime:r}=e,i=new Gl;return n&&(vl("string"==typeof n,"internal-error",{appName:t}),i.refreshToken=n),s&&(vl("string"==typeof s,"internal-error",{appName:t}),i.accessToken=s),r&&(vl("number"==typeof r,"internal-error",{appName:t}),i.expirationTime=r),i}toJSON(){return{refreshToken:this.refreshToken,accessToken:this.accessToken,expirationTime:this.expirationTime}}_assign(t){this.accessToken=t.accessToken,this.refreshToken=t.refreshToken,this.expirationTime=t.expirationTime}_clone(){return Object.assign(new Gl,this.toJSON())}_performRefresh(){return wl("not implemented")}}
2362
+ */function Qf(t,e){Sf("string"==typeof t||void 0===t,"internal-error",{appName:e})}class Yf{constructor(t){var{uid:e,auth:n,stsTokenManager:r}=t,s=ff(t,["uid","auth","stsTokenManager"]);this.providerId="firebase",this.proactiveRefresh=new Kf(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=e,this.auth=n,this.stsTokenManager=r,this.accessToken=r.accessToken,this.displayName=s.displayName||null,this.email=s.email||null,this.emailVerified=s.emailVerified||!1,this.phoneNumber=s.phoneNumber||null,this.photoURL=s.photoURL||null,this.isAnonymous=s.isAnonymous||!1,this.tenantId=s.tenantId||null,this.providerData=s.providerData?[...s.providerData]:[],this.metadata=new Wf(s.createdAt||void 0,s.lastLoginAt||void 0)}async getIdToken(t){const e=await qf(this,this.stsTokenManager.getToken(this.auth,t));return Sf(e,this.auth,"internal-error"),this.accessToken!==e&&(this.accessToken=e,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),e}getIdTokenResult(t){return async function(t,e=!1){const n=S(t),r=await n.getIdToken(e),s=$f(r);Sf(s&&s.exp&&s.auth_time&&s.iat,n.auth,"internal-error");const i="object"==typeof s.firebase?s.firebase:void 0,o=null==i?void 0:i.sign_in_provider;return{claims:s,token:r,authTime:Hf(jf(s.auth_time)),issuedAtTime:Hf(jf(s.iat)),expirationTime:Hf(jf(s.exp)),signInProvider:o||null,signInSecondFactor:(null==i?void 0:i.sign_in_second_factor)||null}}(this,t)}reload(){return async function(t){const e=S(t);await Gf(e),await e.auth._persistUserIfCurrent(e),e.auth._notifyListenersIfCurrent(e)}(this)}_assign(t){this!==t&&(Sf(this.uid===t.uid,this.auth,"internal-error"),this.displayName=t.displayName,this.photoURL=t.photoURL,this.email=t.email,this.emailVerified=t.emailVerified,this.phoneNumber=t.phoneNumber,this.isAnonymous=t.isAnonymous,this.tenantId=t.tenantId,this.providerData=t.providerData.map((t=>Object.assign({},t))),this.metadata._copy(t.metadata),this.stsTokenManager._assign(t.stsTokenManager))}_clone(t){const e=new Yf(Object.assign(Object.assign({},this),{auth:t,stsTokenManager:this.stsTokenManager._clone()}));return e.metadata._copy(this.metadata),e}_onReload(t){Sf(!this.reloadListener,this.auth,"internal-error"),this.reloadListener=t,this.reloadUserInfo&&(this._notifyReloadListener(this.reloadUserInfo),this.reloadUserInfo=null)}_notifyReloadListener(t){this.reloadListener?this.reloadListener(t):this.reloadUserInfo=t}_startProactiveRefresh(){this.proactiveRefresh._start()}_stopProactiveRefresh(){this.proactiveRefresh._stop()}async _updateTokensIfNecessary(t,e=!1){let n=!1;t.idToken&&t.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(t),n=!0),e&&await Gf(this),await this.auth._persistUserIfCurrent(this),n&&this.auth._notifyListenersIfCurrent(this)}async delete(){const t=await this.getIdToken();return await qf(this,async function(t,e){return Mf(t,"POST","/v1/accounts:delete",e)}(this.auth,{idToken:t})),this.stsTokenManager.clearRefreshToken(),this.auth.signOut()}toJSON(){return Object.assign(Object.assign({uid:this.uid,email:this.email||void 0,emailVerified:this.emailVerified,displayName:this.displayName||void 0,isAnonymous:this.isAnonymous,photoURL:this.photoURL||void 0,phoneNumber:this.phoneNumber||void 0,tenantId:this.tenantId||void 0,providerData:this.providerData.map((t=>Object.assign({},t))),stsTokenManager:this.stsTokenManager.toJSON(),_redirectEventId:this._redirectEventId},this.metadata.toJSON()),{apiKey:this.auth.config.apiKey,appName:this.auth.name})}get refreshToken(){return this.stsTokenManager.refreshToken||""}static _fromJSON(t,e){var n,r,s,i,o,a,c,u;const h=null!==(n=e.displayName)&&void 0!==n?n:void 0,l=null!==(r=e.email)&&void 0!==r?r:void 0,d=null!==(s=e.phoneNumber)&&void 0!==s?s:void 0,f=null!==(i=e.photoURL)&&void 0!==i?i:void 0,p=null!==(o=e.tenantId)&&void 0!==o?o:void 0,g=null!==(a=e._redirectEventId)&&void 0!==a?a:void 0,m=null!==(c=e.createdAt)&&void 0!==c?c:void 0,y=null!==(u=e.lastLoginAt)&&void 0!==u?u:void 0,{uid:v,emailVerified:w,isAnonymous:_,providerData:T,stsTokenManager:E}=e;Sf(v&&E,t,"internal-error");const S=zf.fromJSON(this.name,E);Sf("string"==typeof v,t,"internal-error"),Qf(h,t.name),Qf(l,t.name),Sf("boolean"==typeof w,t,"internal-error"),Sf("boolean"==typeof _,t,"internal-error"),Qf(d,t.name),Qf(f,t.name),Qf(p,t.name),Qf(g,t.name),Qf(m,t.name),Qf(y,t.name);const I=new Yf({uid:v,auth:t,email:l,emailVerified:w,displayName:h,isAnonymous:_,photoURL:f,phoneNumber:d,tenantId:p,stsTokenManager:S,createdAt:m,lastLoginAt:y});return T&&Array.isArray(T)&&(I.providerData=T.map((t=>Object.assign({},t)))),g&&(I._redirectEventId=g),I}static async _fromIdTokenResponse(t,e,n=!1){const r=new zf;r.updateFromServerResponse(e);const s=new Yf({uid:e.localId,auth:t,stsTokenManager:r,isAnonymous:n});return await Gf(s),s}}
2265
2363
  /**
2266
2364
  * @license
2267
2365
  * Copyright 2020 Google LLC
@@ -2277,7 +2375,7 @@ async function(t,e){const n=await Ll(t,{},(async()=>{const n=y({grant_type:"refr
2277
2375
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2278
2376
  * See the License for the specific language governing permissions and
2279
2377
  * limitations under the License.
2280
- */function Wl(t,e){vl("string"==typeof t||void 0===t,"internal-error",{appName:e})}class zl{constructor(t){var{uid:e,auth:n,stsTokenManager:s}=t,r=cl(t,["uid","auth","stsTokenManager"]);this.providerId="firebase",this.proactiveRefresh=new jl(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=e,this.auth=n,this.stsTokenManager=s,this.accessToken=s.accessToken,this.displayName=r.displayName||null,this.email=r.email||null,this.emailVerified=r.emailVerified||!1,this.phoneNumber=r.phoneNumber||null,this.photoURL=r.photoURL||null,this.isAnonymous=r.isAnonymous||!1,this.tenantId=r.tenantId||null,this.providerData=r.providerData?[...r.providerData]:[],this.metadata=new ql(r.createdAt||void 0,r.lastLoginAt||void 0)}async getIdToken(t){const e=await Hl(this,this.stsTokenManager.getToken(this.auth,t));return vl(e,this.auth,"internal-error"),this.accessToken!==e&&(this.accessToken=e,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),e}getIdTokenResult(t){return async function(t,e=!1){const n=I(t),s=await n.getIdToken(e),r=Bl(s);vl(r&&r.exp&&r.auth_time&&r.iat,n.auth,"internal-error");const i="object"==typeof r.firebase?r.firebase:void 0,o=null==i?void 0:i.sign_in_provider;return{claims:r,token:s,authTime:Fl(Vl(r.auth_time)),issuedAtTime:Fl(Vl(r.iat)),expirationTime:Fl(Vl(r.exp)),signInProvider:o||null,signInSecondFactor:(null==i?void 0:i.sign_in_second_factor)||null}}(this,t)}reload(){return async function(t){const e=I(t);await Kl(e),await e.auth._persistUserIfCurrent(e),e.auth._notifyListenersIfCurrent(e)}(this)}_assign(t){this!==t&&(vl(this.uid===t.uid,this.auth,"internal-error"),this.displayName=t.displayName,this.photoURL=t.photoURL,this.email=t.email,this.emailVerified=t.emailVerified,this.phoneNumber=t.phoneNumber,this.isAnonymous=t.isAnonymous,this.tenantId=t.tenantId,this.providerData=t.providerData.map((t=>Object.assign({},t))),this.metadata._copy(t.metadata),this.stsTokenManager._assign(t.stsTokenManager))}_clone(t){return new zl(Object.assign(Object.assign({},this),{auth:t,stsTokenManager:this.stsTokenManager._clone()}))}_onReload(t){vl(!this.reloadListener,this.auth,"internal-error"),this.reloadListener=t,this.reloadUserInfo&&(this._notifyReloadListener(this.reloadUserInfo),this.reloadUserInfo=null)}_notifyReloadListener(t){this.reloadListener?this.reloadListener(t):this.reloadUserInfo=t}_startProactiveRefresh(){this.proactiveRefresh._start()}_stopProactiveRefresh(){this.proactiveRefresh._stop()}async _updateTokensIfNecessary(t,e=!1){let n=!1;t.idToken&&t.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(t),n=!0),e&&await Kl(this),await this.auth._persistUserIfCurrent(this),n&&this.auth._notifyListenersIfCurrent(this)}async delete(){const t=await this.getIdToken();return await Hl(this,async function(t,e){return Dl(t,"POST","/v1/accounts:delete",e)}(this.auth,{idToken:t})),this.stsTokenManager.clearRefreshToken(),this.auth.signOut()}toJSON(){return Object.assign(Object.assign({uid:this.uid,email:this.email||void 0,emailVerified:this.emailVerified,displayName:this.displayName||void 0,isAnonymous:this.isAnonymous,photoURL:this.photoURL||void 0,phoneNumber:this.phoneNumber||void 0,tenantId:this.tenantId||void 0,providerData:this.providerData.map((t=>Object.assign({},t))),stsTokenManager:this.stsTokenManager.toJSON(),_redirectEventId:this._redirectEventId},this.metadata.toJSON()),{apiKey:this.auth.config.apiKey,appName:this.auth.name})}get refreshToken(){return this.stsTokenManager.refreshToken||""}static _fromJSON(t,e){var n,s,r,i,o,a,c,u;const h=null!==(n=e.displayName)&&void 0!==n?n:void 0,l=null!==(s=e.email)&&void 0!==s?s:void 0,d=null!==(r=e.phoneNumber)&&void 0!==r?r:void 0,f=null!==(i=e.photoURL)&&void 0!==i?i:void 0,p=null!==(o=e.tenantId)&&void 0!==o?o:void 0,g=null!==(a=e._redirectEventId)&&void 0!==a?a:void 0,m=null!==(c=e.createdAt)&&void 0!==c?c:void 0,y=null!==(u=e.lastLoginAt)&&void 0!==u?u:void 0,{uid:v,emailVerified:w,isAnonymous:_,providerData:T,stsTokenManager:I}=e;vl(v&&I,t,"internal-error");const E=Gl.fromJSON(this.name,I);vl("string"==typeof v,t,"internal-error"),Wl(h,t.name),Wl(l,t.name),vl("boolean"==typeof w,t,"internal-error"),vl("boolean"==typeof _,t,"internal-error"),Wl(d,t.name),Wl(f,t.name),Wl(p,t.name),Wl(g,t.name),Wl(m,t.name),Wl(y,t.name);const S=new zl({uid:v,auth:t,email:l,emailVerified:w,displayName:h,isAnonymous:_,photoURL:f,phoneNumber:d,tenantId:p,stsTokenManager:E,createdAt:m,lastLoginAt:y});return T&&Array.isArray(T)&&(S.providerData=T.map((t=>Object.assign({},t)))),g&&(S._redirectEventId=g),S}static async _fromIdTokenResponse(t,e,n=!1){const s=new Gl;s.updateFromServerResponse(e);const r=new zl({uid:e.localId,auth:t,stsTokenManager:s,isAnonymous:n});return await Kl(r),r}}
2378
+ */const Jf=new Map;function Xf(t){bf(t instanceof Function,"Expected a class definition");let e=Jf.get(t);return e?(bf(e instanceof t,"Instance stored in cache mismatched with class"),e):(e=new t,Jf.set(t,e),e)}
2281
2379
  /**
2282
2380
  * @license
2283
2381
  * Copyright 2019 Google LLC
@@ -2293,7 +2391,7 @@ async function(t,e){const n=await Ll(t,{},(async()=>{const n=y({grant_type:"refr
2293
2391
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2294
2392
  * See the License for the specific language governing permissions and
2295
2393
  * limitations under the License.
2296
- */class $l{constructor(){this.type="NONE",this.storage={}}async _isAvailable(){return!0}async _set(t,e){this.storage[t]=e}async _get(t){const e=this.storage[t];return void 0===e?null:e}async _remove(t){delete this.storage[t]}_addListener(t,e){}_removeListener(t,e){}}$l.type="NONE";const Ql=$l;
2394
+ */class Zf{constructor(){this.type="NONE",this.storage={}}async _isAvailable(){return!0}async _set(t,e){this.storage[t]=e}async _get(t){const e=this.storage[t];return void 0===e?null:e}async _remove(t){delete this.storage[t]}_addListener(t,e){}_removeListener(t,e){}}Zf.type="NONE";const tp=Zf;
2297
2395
  /**
2298
2396
  * @license
2299
2397
  * Copyright 2019 Google LLC
@@ -2309,7 +2407,7 @@ async function(t,e){const n=await Ll(t,{},(async()=>{const n=y({grant_type:"refr
2309
2407
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2310
2408
  * See the License for the specific language governing permissions and
2311
2409
  * limitations under the License.
2312
- */function Jl(t,e,n){return`firebase:${t}:${e}:${n}`}class Yl{constructor(t,e,n){this.persistence=t,this.auth=e,this.userKey=n;const{config:s,name:r}=this.auth;this.fullUserKey=Jl(this.userKey,s.apiKey,r),this.fullPersistenceKey=Jl("persistence",s.apiKey,r),this.boundEventHandler=e._onStorageEvent.bind(e),this.persistence._addListener(this.fullUserKey,this.boundEventHandler)}setCurrentUser(t){return this.persistence._set(this.fullUserKey,t.toJSON())}async getCurrentUser(){const t=await this.persistence._get(this.fullUserKey);return t?zl._fromJSON(this.auth,t):null}removeCurrentUser(){return this.persistence._remove(this.fullUserKey)}savePersistenceForRedirect(){return this.persistence._set(this.fullPersistenceKey,this.persistence.type)}async setPersistence(t){if(this.persistence===t)return;const e=await this.getCurrentUser();return await this.removeCurrentUser(),this.persistence=t,e?this.setCurrentUser(e):void 0}delete(){this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}static async create(t,e,n="authUser"){if(!e.length)return new Yl(Il(Ql),t,n);const s=(await Promise.all(e.map((async t=>{if(await t._isAvailable())return t})))).filter((t=>t));let r=s[0]||Il(Ql);const i=Jl(n,t.config.apiKey,t.name);let o=null;for(const n of e)try{const e=await n._get(i);if(e){const s=zl._fromJSON(t,e);n!==r&&(o=s),r=n;break}}catch(t){}const a=s.filter((t=>t._shouldAllowMigration));return r._shouldAllowMigration&&a.length?(r=a[0],o&&await r._set(i,o.toJSON()),await Promise.all(e.map((async t=>{if(t!==r)try{await t._remove(i)}catch(t){}}))),new Yl(r,t,n)):new Yl(r,t,n)}}
2410
+ */function ep(t,e,n){return`firebase:${t}:${e}:${n}`}class np{constructor(t,e,n){this.persistence=t,this.auth=e,this.userKey=n;const{config:r,name:s}=this.auth;this.fullUserKey=ep(this.userKey,r.apiKey,s),this.fullPersistenceKey=ep("persistence",r.apiKey,s),this.boundEventHandler=e._onStorageEvent.bind(e),this.persistence._addListener(this.fullUserKey,this.boundEventHandler)}setCurrentUser(t){return this.persistence._set(this.fullUserKey,t.toJSON())}async getCurrentUser(){const t=await this.persistence._get(this.fullUserKey);return t?Yf._fromJSON(this.auth,t):null}removeCurrentUser(){return this.persistence._remove(this.fullUserKey)}savePersistenceForRedirect(){return this.persistence._set(this.fullPersistenceKey,this.persistence.type)}async setPersistence(t){if(this.persistence===t)return;const e=await this.getCurrentUser();return await this.removeCurrentUser(),this.persistence=t,e?this.setCurrentUser(e):void 0}delete(){this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}static async create(t,e,n="authUser"){if(!e.length)return new np(Xf(tp),t,n);const r=(await Promise.all(e.map((async t=>{if(await t._isAvailable())return t})))).filter((t=>t));let s=r[0]||Xf(tp);const i=ep(n,t.config.apiKey,t.name);let o=null;for(const n of e)try{const e=await n._get(i);if(e){const r=Yf._fromJSON(t,e);n!==s&&(o=r),s=n;break}}catch(t){}const a=r.filter((t=>t._shouldAllowMigration));return s._shouldAllowMigration&&a.length?(s=a[0],o&&await s._set(i,o.toJSON()),await Promise.all(e.map((async t=>{if(t!==s)try{await t._remove(i)}catch(t){}}))),new np(s,t,n)):new np(s,t,n)}}
2313
2411
  /**
2314
2412
  * @license
2315
2413
  * Copyright 2020 Google LLC
@@ -2325,7 +2423,7 @@ async function(t,e){const n=await Ll(t,{},(async()=>{const n=y({grant_type:"refr
2325
2423
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2326
2424
  * See the License for the specific language governing permissions and
2327
2425
  * limitations under the License.
2328
- */function Xl(t){const e=t.toLowerCase();if(e.includes("opera/")||e.includes("opr/")||e.includes("opios/"))return"Opera";if(nd(e))return"IEMobile";if(e.includes("msie")||e.includes("trident/"))return"IE";if(e.includes("edge/"))return"Edge";if(Zl(e))return"Firefox";if(e.includes("silk/"))return"Silk";if(rd(e))return"Blackberry";if(id(e))return"Webos";if(td(e))return"Safari";if((e.includes("chrome/")||ed(e))&&!e.includes("edge/"))return"Chrome";if(sd(e))return"Android";{const e=/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/,n=t.match(e);if(2===(null==n?void 0:n.length))return n[1]}return"Other"}function Zl(t=o()){return/firefox\//i.test(t)}function td(t=o()){const e=t.toLowerCase();return e.includes("safari/")&&!e.includes("chrome/")&&!e.includes("crios/")&&!e.includes("android")}function ed(t=o()){return/crios\//i.test(t)}function nd(t=o()){return/iemobile/i.test(t)}function sd(t=o()){return/android/i.test(t)}function rd(t=o()){return/blackberry/i.test(t)}function id(t=o()){return/webos/i.test(t)}function od(t=o()){return/iphone|ipad|ipod/i.test(t)||/macintosh/i.test(t)&&/mobile/i.test(t)}function ad(){return function(){const t=o();return t.indexOf("MSIE ")>=0||t.indexOf("Trident/")>=0}()&&10===document.documentMode}function cd(t=o()){return od(t)||sd(t)||id(t)||rd(t)||/windows phone/i.test(t)||nd(t)}
2426
+ */function rp(t){const e=t.toLowerCase();if(e.includes("opera/")||e.includes("opr/")||e.includes("opios/"))return"Opera";if(ap(e))return"IEMobile";if(e.includes("msie")||e.includes("trident/"))return"IE";if(e.includes("edge/"))return"Edge";if(sp(e))return"Firefox";if(e.includes("silk/"))return"Silk";if(up(e))return"Blackberry";if(hp(e))return"Webos";if(ip(e))return"Safari";if((e.includes("chrome/")||op(e))&&!e.includes("edge/"))return"Chrome";if(cp(e))return"Android";{const e=/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/,n=t.match(e);if(2===(null==n?void 0:n.length))return n[1]}return"Other"}function sp(t=d()){return/firefox\//i.test(t)}function ip(t=d()){const e=t.toLowerCase();return e.includes("safari/")&&!e.includes("chrome/")&&!e.includes("crios/")&&!e.includes("android")}function op(t=d()){return/crios\//i.test(t)}function ap(t=d()){return/iemobile/i.test(t)}function cp(t=d()){return/android/i.test(t)}function up(t=d()){return/blackberry/i.test(t)}function hp(t=d()){return/webos/i.test(t)}function lp(t=d()){return/iphone|ipad|ipod/i.test(t)||/macintosh/i.test(t)&&/mobile/i.test(t)}function dp(){return function(){const t=d();return t.indexOf("MSIE ")>=0||t.indexOf("Trident/")>=0}()&&10===document.documentMode}function fp(t=d()){return lp(t)||cp(t)||hp(t)||up(t)||/windows phone/i.test(t)||ap(t)}
2329
2427
  /**
2330
2428
  * @license
2331
2429
  * Copyright 2020 Google LLC
@@ -2342,7 +2440,23 @@ async function(t,e){const n=await Ll(t,{},(async()=>{const n=y({grant_type:"refr
2342
2440
  * See the License for the specific language governing permissions and
2343
2441
  * limitations under the License.
2344
2442
  */
2345
- function ud(t,e=[]){let n;switch(t){case"Browser":n=Xl(o());break;case"Worker":n=`${Xl(o())}-${t}`;break;default:n=t}const s=e.length?e.join(","):"FirebaseCore-web";return`${n}/JsCore/${ct}/${s}`}
2443
+ function pp(t,e=[]){let n;switch(t){case"Browser":n=rp(d());break;case"Worker":n=`${rp(d())}-${t}`;break;default:n=t}const r=e.length?e.join(","):"FirebaseCore-web";return`${n}/JsCore/${Pt}/${r}`}async function gp(t,e){return Mf(t,"GET","/v2/recaptchaConfig",Pf(t,e))}function mp(t){return void 0!==t&&void 0!==t.enterprise}class yp{constructor(t){if(this.siteKey="",this.emailPasswordEnabled=!1,void 0===t.recaptchaKey)throw new Error("recaptchaKey undefined");this.siteKey=t.recaptchaKey.split("/")[3],this.emailPasswordEnabled=t.recaptchaEnforcementState.some((t=>"EMAIL_PASSWORD_PROVIDER"===t.provider&&"OFF"!==t.enforcementState))}}
2444
+ /**
2445
+ * @license
2446
+ * Copyright 2020 Google LLC
2447
+ *
2448
+ * Licensed under the Apache License, Version 2.0 (the "License");
2449
+ * you may not use this file except in compliance with the License.
2450
+ * You may obtain a copy of the License at
2451
+ *
2452
+ * http://www.apache.org/licenses/LICENSE-2.0
2453
+ *
2454
+ * Unless required by applicable law or agreed to in writing, software
2455
+ * distributed under the License is distributed on an "AS IS" BASIS,
2456
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2457
+ * See the License for the specific language governing permissions and
2458
+ * limitations under the License.
2459
+ */function vp(t){return new Promise(((e,n)=>{const r=document.createElement("script");r.setAttribute("src",t),r.onload=e,r.onerror=t=>{const e=Tf("internal-error");e.customData=t,n(e)},r.type="text/javascript",r.charset="UTF-8",function(){var t,e;return null!==(e=null===(t=document.getElementsByTagName("head"))||void 0===t?void 0:t[0])&&void 0!==e?e:document}().appendChild(r)}))}class wp{constructor(t){this.type="recaptcha-enterprise",this.auth=Sp(t)}async verify(t="verify",e=!1){function n(e,n,r){const s=window.grecaptcha;mp(s)?s.enterprise.ready((()=>{s.enterprise.execute(e,{action:t}).then((t=>{n(t)})).catch((()=>{n("NO_RECAPTCHA")}))})):r(Error("No reCAPTCHA enterprise script loaded."))}return new Promise(((t,r)=>{(async function(t){if(!e){if(null==t.tenantId&&null!=t._agentRecaptchaConfig)return t._agentRecaptchaConfig.siteKey;if(null!=t.tenantId&&void 0!==t._tenantRecaptchaConfigs[t.tenantId])return t._tenantRecaptchaConfigs[t.tenantId].siteKey}return new Promise((async(e,n)=>{gp(t,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}).then((r=>{if(void 0!==r.recaptchaKey){const n=new yp(r);return null==t.tenantId?t._agentRecaptchaConfig=n:t._tenantRecaptchaConfigs[t.tenantId]=n,e(n.siteKey)}n(new Error("recaptcha Enterprise site key undefined"))})).catch((t=>{n(t)}))}))})(this.auth).then((s=>{if(!e&&mp(window.grecaptcha))n(s,t,r);else{if("undefined"==typeof window)return void r(new Error("RecaptchaVerifier is only supported in browser"));vp("https://www.google.com/recaptcha/enterprise.js?render="+s).then((()=>{n(s,t,r)})).catch((t=>{r(t)}))}})).catch((t=>{r(t)}))}))}}async function _p(t,e,n,r=!1){const s=new wp(t);let i;try{i=await s.verify(n)}catch(t){i=await s.verify(n,!0)}const o=Object.assign({},e);return r?Object.assign(o,{captchaResp:i}):Object.assign(o,{captchaResponse:i}),Object.assign(o,{clientType:"CLIENT_TYPE_WEB"}),Object.assign(o,{recaptchaVersion:"RECAPTCHA_ENTERPRISE"}),o}
2346
2460
  /**
2347
2461
  * @license
2348
2462
  * Copyright 2022 Google LLC
@@ -2358,7 +2472,7 @@ function ud(t,e=[]){let n;switch(t){case"Browser":n=Xl(o());break;case"Worker":n
2358
2472
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2359
2473
  * See the License for the specific language governing permissions and
2360
2474
  * limitations under the License.
2361
- */class hd{constructor(t){this.auth=t,this.queue=[]}pushCallback(t,e){const n=e=>new Promise(((n,s)=>{try{n(t(e))}catch(t){s(t)}}));n.onAbort=e,this.queue.push(n);const s=this.queue.length-1;return()=>{this.queue[s]=()=>Promise.resolve()}}async runMiddleware(t){if(this.auth.currentUser===t)return;const e=[];try{for(const n of this.queue)await n(t),n.onAbort&&e.push(n.onAbort)}catch(t){e.reverse();for(const t of e)try{t()}catch(t){}throw this.auth._errorFactory.create("login-blocked",{originalMessage:null==t?void 0:t.message})}}}
2475
+ */class Tp{constructor(t){this.auth=t,this.queue=[]}pushCallback(t,e){const n=e=>new Promise(((n,r)=>{try{n(t(e))}catch(t){r(t)}}));n.onAbort=e,this.queue.push(n);const r=this.queue.length-1;return()=>{this.queue[r]=()=>Promise.resolve()}}async runMiddleware(t){if(this.auth.currentUser===t)return;const e=[];try{for(const n of this.queue)await n(t),n.onAbort&&e.push(n.onAbort)}catch(t){e.reverse();for(const t of e)try{t()}catch(t){}throw this.auth._errorFactory.create("login-blocked",{originalMessage:null==t?void 0:t.message})}}}
2362
2476
  /**
2363
2477
  * @license
2364
2478
  * Copyright 2020 Google LLC
@@ -2374,7 +2488,7 @@ function ud(t,e=[]){let n;switch(t){case"Browser":n=Xl(o());break;case"Worker":n
2374
2488
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2375
2489
  * See the License for the specific language governing permissions and
2376
2490
  * limitations under the License.
2377
- */class ld{constructor(t,e,n){this.app=t,this.heartbeatServiceProvider=e,this.config=n,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new fd(this),this.idTokenSubscription=new fd(this),this.beforeStateQueue=new hd(this),this.redirectUser=null,this.isProactiveRefreshEnabled=!1,this._canInitEmulator=!0,this._isInitialized=!1,this._deleted=!1,this._initializationPromise=null,this._popupRedirectResolver=null,this._errorFactory=ll,this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=t.name,this.clientVersion=n.sdkClientVersion}_initializeWithPersistence(t,e){return e&&(this._popupRedirectResolver=Il(e)),this._initializationPromise=this.queue((async()=>{var n,s;if(!this._deleted&&(this.persistenceManager=await Yl.create(this,t),!this._deleted)){if(null===(n=this._popupRedirectResolver)||void 0===n?void 0:n._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch(t){}await this.initializeCurrentUser(e),this.lastNotifiedUid=(null===(s=this.currentUser)||void 0===s?void 0:s.uid)||null,this._deleted||(this._isInitialized=!0)}})),this._initializationPromise}async _onStorageEvent(){if(this._deleted)return;const t=await this.assertedPersistence.getCurrentUser();return this.currentUser||t?this.currentUser&&t&&this.currentUser.uid===t.uid?(this._currentUser._assign(t),void await this.currentUser.getIdToken()):void await this._updateCurrentUser(t,!0):void 0}async initializeCurrentUser(t){var e;const n=await this.assertedPersistence.getCurrentUser();let s=n,r=!1;if(t&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();const n=null===(e=this.redirectUser)||void 0===e?void 0:e._redirectEventId,i=null==s?void 0:s._redirectEventId,o=await this.tryRedirectSignIn(t);n&&n!==i||!(null==o?void 0:o.user)||(s=o.user,r=!0)}if(!s)return this.directlySetCurrentUser(null);if(!s._redirectEventId){if(r)try{await this.beforeStateQueue.runMiddleware(s)}catch(t){s=n,this._popupRedirectResolver._overrideRedirectResult(this,(()=>Promise.reject(t)))}return s?this.reloadAndSetCurrentUserOrClear(s):this.directlySetCurrentUser(null)}return vl(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===s._redirectEventId?this.directlySetCurrentUser(s):this.reloadAndSetCurrentUserOrClear(s)}async tryRedirectSignIn(t){let e=null;try{e=await this._popupRedirectResolver._completeRedirectFn(this,t,!0)}catch(t){await this._setRedirectUser(null)}return e}async reloadAndSetCurrentUserOrClear(t){try{await Kl(t)}catch(t){if("auth/network-request-failed"!==(null==t?void 0:t.code))return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(t)}useDeviceLanguage(){this.languageCode=function(){if("undefined"==typeof navigator)return null;const t=navigator;return t.languages&&t.languages[0]||t.language||null}()}async _delete(){this._deleted=!0}async updateCurrentUser(t){const e=t?I(t):null;return e&&vl(e.auth.config.apiKey===this.config.apiKey,this,"invalid-user-token"),this._updateCurrentUser(e&&e._clone(this))}async _updateCurrentUser(t,e=!1){if(!this._deleted)return t&&vl(this.tenantId===t.tenantId,this,"tenant-id-mismatch"),e||await this.beforeStateQueue.runMiddleware(t),this.queue((async()=>{await this.directlySetCurrentUser(t),this.notifyAuthListeners()}))}async signOut(){return await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0)}setPersistence(t){return this.queue((async()=>{await this.assertedPersistence.setPersistence(Il(t))}))}_getPersistence(){return this.assertedPersistence.persistence.type}_updateErrorMap(t){this._errorFactory=new f("auth","Firebase",t())}onAuthStateChanged(t,e,n){return this.registerStateListener(this.authStateSubscription,t,e,n)}beforeAuthStateChanged(t,e){return this.beforeStateQueue.pushCallback(t,e)}onIdTokenChanged(t,e,n){return this.registerStateListener(this.idTokenSubscription,t,e,n)}toJSON(){var t;return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:null===(t=this._currentUser)||void 0===t?void 0:t.toJSON()}}async _setRedirectUser(t,e){const n=await this.getOrInitRedirectPersistenceManager(e);return null===t?n.removeCurrentUser():n.setCurrentUser(t)}async getOrInitRedirectPersistenceManager(t){if(!this.redirectPersistenceManager){const e=t&&Il(t)||this._popupRedirectResolver;vl(e,this,"argument-error"),this.redirectPersistenceManager=await Yl.create(this,[Il(e._redirectPersistence)],"redirectUser"),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager}async _redirectUserForId(t){var e,n;return this._isInitialized&&await this.queue((async()=>{})),(null===(e=this._currentUser)||void 0===e?void 0:e._redirectEventId)===t?this._currentUser:(null===(n=this.redirectUser)||void 0===n?void 0:n._redirectEventId)===t?this.redirectUser:null}async _persistUserIfCurrent(t){if(t===this.currentUser)return this.queue((async()=>this.directlySetCurrentUser(t)))}_notifyListenersIfCurrent(t){t===this.currentUser&&this.notifyAuthListeners()}_key(){return`${this.config.authDomain}:${this.config.apiKey}:${this.name}`}_startProactiveRefresh(){this.isProactiveRefreshEnabled=!0,this.currentUser&&this._currentUser._startProactiveRefresh()}_stopProactiveRefresh(){this.isProactiveRefreshEnabled=!1,this.currentUser&&this._currentUser._stopProactiveRefresh()}get _currentUser(){return this.currentUser}notifyAuthListeners(){var t,e;if(!this._isInitialized)return;this.idTokenSubscription.next(this.currentUser);const n=null!==(e=null===(t=this.currentUser)||void 0===t?void 0:t.uid)&&void 0!==e?e:null;this.lastNotifiedUid!==n&&(this.lastNotifiedUid=n,this.authStateSubscription.next(this.currentUser))}registerStateListener(t,e,n,s){if(this._deleted)return()=>{};const r="function"==typeof e?e:e.next.bind(e),i=this._isInitialized?Promise.resolve():this._initializationPromise;return vl(i,this,"internal-error"),i.then((()=>r(this.currentUser))),"function"==typeof e?t.addObserver(e,n,s):t.addObserver(e)}async directlySetCurrentUser(t){this.currentUser&&this.currentUser!==t&&this._currentUser._stopProactiveRefresh(),t&&this.isProactiveRefreshEnabled&&t._startProactiveRefresh(),this.currentUser=t,t?await this.assertedPersistence.setCurrentUser(t):await this.assertedPersistence.removeCurrentUser()}queue(t){return this.operations=this.operations.then(t,t),this.operations}get assertedPersistence(){return vl(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(t){t&&!this.frameworks.includes(t)&&(this.frameworks.push(t),this.frameworks.sort(),this.clientVersion=ud(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){var t;const e={"X-Client-Version":this.clientVersion};this.app.options.appId&&(e["X-Firebase-gmpid"]=this.app.options.appId);const n=await(null===(t=this.heartbeatServiceProvider.getImmediate({optional:!0}))||void 0===t?void 0:t.getHeartbeatsHeader());return n&&(e["X-Firebase-Client"]=n),e}}function dd(t){return I(t)}class fd{constructor(t){this.auth=t,this.observer=null,this.addObserver=function(t,e){const n=new _(t,e);return n.subscribe.bind(n)}((t=>this.observer=t))}get next(){return vl(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}function pd(t,e,n){const s=dd(t);vl(s._canInitEmulator,s,"emulator-config-failed"),vl(/^https?:\/\//.test(e),s,"invalid-emulator-scheme");const r=!!(null==n?void 0:n.disableWarnings),i=gd(e),{host:o,port:a}=function(t){const e=gd(t),n=/(\/\/)?([^?#/]+)/.exec(t.substr(e.length));if(!n)return{host:"",port:null};const s=n[2].split("@").pop()||"",r=/^(\[[^\]]+\])(:|$)/.exec(s);if(r){const t=r[1];return{host:t,port:md(s.substr(t.length+1))}}{const[t,e]=s.split(":");return{host:t,port:md(e)}}}(e),c=null===a?"":`:${a}`;s.config.emulator={url:`${i}//${o}${c}/`},s.settings.appVerificationDisabledForTesting=!0,s.emulatorConfig=Object.freeze({host:o,port:a,protocol:i.replace(":",""),options:Object.freeze({disableWarnings:r})}),r||function(){function t(){const t=document.createElement("p"),e=t.style;t.innerText="Running in emulator mode. Do not use with production credentials.",e.position="fixed",e.width="100%",e.backgroundColor="#ffffff",e.border=".1em solid #000000",e.color="#b50000",e.bottom="0px",e.left="0px",e.margin="0px",e.zIndex="10000",e.textAlign="center",t.classList.add("firebase-emulator-warning"),document.body.appendChild(t)}"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",t):t())}
2491
+ */class Ep{constructor(t,e,n,r){this.app=t,this.heartbeatServiceProvider=e,this.appCheckServiceProvider=n,this.config=r,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new Ip(this),this.idTokenSubscription=new Ip(this),this.beforeStateQueue=new Tp(this),this.redirectUser=null,this.isProactiveRefreshEnabled=!1,this._canInitEmulator=!0,this._isInitialized=!1,this._deleted=!1,this._initializationPromise=null,this._popupRedirectResolver=null,this._errorFactory=mf,this._agentRecaptchaConfig=null,this._tenantRecaptchaConfigs={},this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=t.name,this.clientVersion=r.sdkClientVersion}_initializeWithPersistence(t,e){return e&&(this._popupRedirectResolver=Xf(e)),this._initializationPromise=this.queue((async()=>{var n,r;if(!this._deleted&&(this.persistenceManager=await np.create(this,t),!this._deleted)){if(null===(n=this._popupRedirectResolver)||void 0===n?void 0:n._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch(t){}await this.initializeCurrentUser(e),this.lastNotifiedUid=(null===(r=this.currentUser)||void 0===r?void 0:r.uid)||null,this._deleted||(this._isInitialized=!0)}})),this._initializationPromise}async _onStorageEvent(){if(this._deleted)return;const t=await this.assertedPersistence.getCurrentUser();return this.currentUser||t?this.currentUser&&t&&this.currentUser.uid===t.uid?(this._currentUser._assign(t),void await this.currentUser.getIdToken()):void await this._updateCurrentUser(t,!0):void 0}async initializeCurrentUser(t){var e;const n=await this.assertedPersistence.getCurrentUser();let r=n,s=!1;if(t&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();const n=null===(e=this.redirectUser)||void 0===e?void 0:e._redirectEventId,i=null==r?void 0:r._redirectEventId,o=await this.tryRedirectSignIn(t);n&&n!==i||!(null==o?void 0:o.user)||(r=o.user,s=!0)}if(!r)return this.directlySetCurrentUser(null);if(!r._redirectEventId){if(s)try{await this.beforeStateQueue.runMiddleware(r)}catch(t){r=n,this._popupRedirectResolver._overrideRedirectResult(this,(()=>Promise.reject(t)))}return r?this.reloadAndSetCurrentUserOrClear(r):this.directlySetCurrentUser(null)}return Sf(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===r._redirectEventId?this.directlySetCurrentUser(r):this.reloadAndSetCurrentUserOrClear(r)}async tryRedirectSignIn(t){let e=null;try{e=await this._popupRedirectResolver._completeRedirectFn(this,t,!0)}catch(t){await this._setRedirectUser(null)}return e}async reloadAndSetCurrentUserOrClear(t){try{await Gf(t)}catch(t){if("auth/network-request-failed"!==(null==t?void 0:t.code))return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(t)}useDeviceLanguage(){this.languageCode=function(){if("undefined"==typeof navigator)return null;const t=navigator;return t.languages&&t.languages[0]||t.language||null}()}async _delete(){this._deleted=!0}async updateCurrentUser(t){const e=t?S(t):null;return e&&Sf(e.auth.config.apiKey===this.config.apiKey,this,"invalid-user-token"),this._updateCurrentUser(e&&e._clone(this))}async _updateCurrentUser(t,e=!1){if(!this._deleted)return t&&Sf(this.tenantId===t.tenantId,this,"tenant-id-mismatch"),e||await this.beforeStateQueue.runMiddleware(t),this.queue((async()=>{await this.directlySetCurrentUser(t),this.notifyAuthListeners()}))}async signOut(){return await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0)}setPersistence(t){return this.queue((async()=>{await this.assertedPersistence.setPersistence(Xf(t))}))}async initializeRecaptchaConfig(){const t=await gp(this,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}),e=new yp(t);if(null==this.tenantId?this._agentRecaptchaConfig=e:this._tenantRecaptchaConfigs[this.tenantId]=e,e.emailPasswordEnabled){new wp(this).verify()}}_getRecaptchaConfig(){return null==this.tenantId?this._agentRecaptchaConfig:this._tenantRecaptchaConfigs[this.tenantId]}_getPersistence(){return this.assertedPersistence.persistence.type}_updateErrorMap(t){this._errorFactory=new p("auth","Firebase",t())}onAuthStateChanged(t,e,n){return this.registerStateListener(this.authStateSubscription,t,e,n)}beforeAuthStateChanged(t,e){return this.beforeStateQueue.pushCallback(t,e)}onIdTokenChanged(t,e,n){return this.registerStateListener(this.idTokenSubscription,t,e,n)}toJSON(){var t;return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:null===(t=this._currentUser)||void 0===t?void 0:t.toJSON()}}async _setRedirectUser(t,e){const n=await this.getOrInitRedirectPersistenceManager(e);return null===t?n.removeCurrentUser():n.setCurrentUser(t)}async getOrInitRedirectPersistenceManager(t){if(!this.redirectPersistenceManager){const e=t&&Xf(t)||this._popupRedirectResolver;Sf(e,this,"argument-error"),this.redirectPersistenceManager=await np.create(this,[Xf(e._redirectPersistence)],"redirectUser"),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager}async _redirectUserForId(t){var e,n;return this._isInitialized&&await this.queue((async()=>{})),(null===(e=this._currentUser)||void 0===e?void 0:e._redirectEventId)===t?this._currentUser:(null===(n=this.redirectUser)||void 0===n?void 0:n._redirectEventId)===t?this.redirectUser:null}async _persistUserIfCurrent(t){if(t===this.currentUser)return this.queue((async()=>this.directlySetCurrentUser(t)))}_notifyListenersIfCurrent(t){t===this.currentUser&&this.notifyAuthListeners()}_key(){return`${this.config.authDomain}:${this.config.apiKey}:${this.name}`}_startProactiveRefresh(){this.isProactiveRefreshEnabled=!0,this.currentUser&&this._currentUser._startProactiveRefresh()}_stopProactiveRefresh(){this.isProactiveRefreshEnabled=!1,this.currentUser&&this._currentUser._stopProactiveRefresh()}get _currentUser(){return this.currentUser}notifyAuthListeners(){var t,e;if(!this._isInitialized)return;this.idTokenSubscription.next(this.currentUser);const n=null!==(e=null===(t=this.currentUser)||void 0===t?void 0:t.uid)&&void 0!==e?e:null;this.lastNotifiedUid!==n&&(this.lastNotifiedUid=n,this.authStateSubscription.next(this.currentUser))}registerStateListener(t,e,n,r){if(this._deleted)return()=>{};const s="function"==typeof e?e:e.next.bind(e),i=this._isInitialized?Promise.resolve():this._initializationPromise;return Sf(i,this,"internal-error"),i.then((()=>s(this.currentUser))),"function"==typeof e?t.addObserver(e,n,r):t.addObserver(e)}async directlySetCurrentUser(t){this.currentUser&&this.currentUser!==t&&this._currentUser._stopProactiveRefresh(),t&&this.isProactiveRefreshEnabled&&t._startProactiveRefresh(),this.currentUser=t,t?await this.assertedPersistence.setCurrentUser(t):await this.assertedPersistence.removeCurrentUser()}queue(t){return this.operations=this.operations.then(t,t),this.operations}get assertedPersistence(){return Sf(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(t){t&&!this.frameworks.includes(t)&&(this.frameworks.push(t),this.frameworks.sort(),this.clientVersion=pp(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){var t;const e={"X-Client-Version":this.clientVersion};this.app.options.appId&&(e["X-Firebase-gmpid"]=this.app.options.appId);const n=await(null===(t=this.heartbeatServiceProvider.getImmediate({optional:!0}))||void 0===t?void 0:t.getHeartbeatsHeader());n&&(e["X-Firebase-Client"]=n);const r=await this._getAppCheckToken();return r&&(e["X-Firebase-AppCheck"]=r),e}async _getAppCheckToken(){var t;const e=await(null===(t=this.appCheckServiceProvider.getImmediate({optional:!0}))||void 0===t?void 0:t.getToken());return(null==e?void 0:e.error)&&function(t,...e){vf.logLevel<=k.WARN&&vf.warn(`Auth (${Pt}): ${t}`,...e)}(`Error while retrieving App Check token: ${e.error}`),null==e?void 0:e.token}}function Sp(t){return S(t)}class Ip{constructor(t){this.auth=t,this.observer=null,this.addObserver=function(t,e){const n=new T(t,e);return n.subscribe.bind(n)}((t=>this.observer=t))}get next(){return Sf(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}
2378
2492
  /**
2379
2493
  * @license
2380
2494
  * Copyright 2020 Google LLC
@@ -2390,7 +2504,7 @@ function ud(t,e=[]){let n;switch(t){case"Browser":n=Xl(o());break;case"Worker":n
2390
2504
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2391
2505
  * See the License for the specific language governing permissions and
2392
2506
  * limitations under the License.
2393
- */()}function gd(t){const e=t.indexOf(":");return e<0?"":t.substr(0,e+1)}function md(t){if(!t)return null;const e=Number(t);return isNaN(e)?null:e}class yd{constructor(t,e){this.providerId=t,this.signInMethod=e}toJSON(){return wl("not implemented")}_getIdTokenResponse(t){return wl("not implemented")}_linkToIdToken(t,e){return wl("not implemented")}_getReauthenticationResolver(t){return wl("not implemented")}}
2507
+ */function bp(t,e,n){const r=Sp(t);Sf(r._canInitEmulator,r,"emulator-config-failed"),Sf(/^https?:\/\//.test(e),r,"invalid-emulator-scheme");const s=!!(null==n?void 0:n.disableWarnings),i=Ap(e),{host:o,port:a}=function(t){const e=Ap(t),n=/(\/\/)?([^?#/]+)/.exec(t.substr(e.length));if(!n)return{host:"",port:null};const r=n[2].split("@").pop()||"",s=/^(\[[^\]]+\])(:|$)/.exec(r);if(s){const t=s[1];return{host:t,port:Cp(r.substr(t.length+1))}}{const[t,e]=r.split(":");return{host:t,port:Cp(e)}}}(e),c=null===a?"":`:${a}`;r.config.emulator={url:`${i}//${o}${c}/`},r.settings.appVerificationDisabledForTesting=!0,r.emulatorConfig=Object.freeze({host:o,port:a,protocol:i.replace(":",""),options:Object.freeze({disableWarnings:s})}),s||function(){function t(){const t=document.createElement("p"),e=t.style;t.innerText="Running in emulator mode. Do not use with production credentials.",e.position="fixed",e.width="100%",e.backgroundColor="#ffffff",e.border=".1em solid #000000",e.color="#b50000",e.bottom="0px",e.left="0px",e.margin="0px",e.zIndex="10000",e.textAlign="center",t.classList.add("firebase-emulator-warning"),document.body.appendChild(t)}"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",t):t())}
2394
2508
  /**
2395
2509
  * @license
2396
2510
  * Copyright 2020 Google LLC
@@ -2406,7 +2520,7 @@ function ud(t,e=[]){let n;switch(t){case"Browser":n=Xl(o());break;case"Worker":n
2406
2520
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2407
2521
  * See the License for the specific language governing permissions and
2408
2522
  * limitations under the License.
2409
- */async function vd(t,e){return async function(t,e){return Dl(t,"POST","/v1/accounts:sendOobCode",Ol(t,e))}(t,e)}
2523
+ */()}function Ap(t){const e=t.indexOf(":");return e<0?"":t.substr(0,e+1)}function Cp(t){if(!t)return null;const e=Number(t);return isNaN(e)?null:e}class kp{constructor(t,e){this.providerId=t,this.signInMethod=e}toJSON(){return If("not implemented")}_getIdTokenResponse(t){return If("not implemented")}_linkToIdToken(t,e){return If("not implemented")}_getReauthenticationResolver(t){return If("not implemented")}}
2410
2524
  /**
2411
2525
  * @license
2412
2526
  * Copyright 2020 Google LLC
@@ -2439,7 +2553,7 @@ function ud(t,e=[]){let n;switch(t){case"Browser":n=Xl(o());break;case"Worker":n
2439
2553
  * See the License for the specific language governing permissions and
2440
2554
  * limitations under the License.
2441
2555
  */
2442
- class wd extends yd{constructor(t,e,n,s=null){super("password",n),this._email=t,this._password=e,this._tenantId=s}static _fromEmailAndPassword(t,e){return new wd(t,e,"password")}static _fromEmailAndCode(t,e,n=null){return new wd(t,e,"emailLink",n)}toJSON(){return{email:this._email,password:this._password,signInMethod:this.signInMethod,tenantId:this._tenantId}}static fromJSON(t){const e="string"==typeof t?JSON.parse(t):t;if((null==e?void 0:e.email)&&(null==e?void 0:e.password)){if("password"===e.signInMethod)return this._fromEmailAndPassword(e.email,e.password);if("emailLink"===e.signInMethod)return this._fromEmailAndCode(e.email,e.password,e.tenantId)}return null}async _getIdTokenResponse(t){switch(this.signInMethod){case"password":
2556
+ async function Rp(t,e){return Uf(t,"POST","/v1/accounts:signInWithPassword",Pf(t,e))}async function Np(t,e){return async function(t,e){return Mf(t,"POST","/v1/accounts:sendOobCode",Pf(t,e))}(t,e)}
2443
2557
  /**
2444
2558
  * @license
2445
2559
  * Copyright 2020 Google LLC
@@ -2456,7 +2570,6 @@ class wd extends yd{constructor(t,e,n,s=null){super("password",n),this._email=t,
2456
2570
  * See the License for the specific language governing permissions and
2457
2571
  * limitations under the License.
2458
2572
  */
2459
- return async function(t,e){return Pl(t,"POST","/v1/accounts:signInWithPassword",Ol(t,e))}(t,{returnSecureToken:!0,email:this._email,password:this._password});case"emailLink":return async function(t,e){return Pl(t,"POST","/v1/accounts:signInWithEmailLink",Ol(t,e))}(t,{email:this._email,oobCode:this._password});default:gl(t,"internal-error")}}async _linkToIdToken(t,e){switch(this.signInMethod){case"password":return async function(t,e){return Dl(t,"POST","/v1/accounts:update",e)}(t,{idToken:e,returnSecureToken:!0,email:this._email,password:this._password});case"emailLink":return async function(t,e){return Pl(t,"POST","/v1/accounts:signInWithEmailLink",Ol(t,e))}(t,{idToken:e,email:this._email,oobCode:this._password});default:gl(t,"internal-error")}}_getReauthenticationResolver(t){return this._getIdTokenResponse(t)}}
2460
2573
  /**
2461
2574
  * @license
2462
2575
  * Copyright 2020 Google LLC
@@ -2472,7 +2585,8 @@ return async function(t,e){return Pl(t,"POST","/v1/accounts:signInWithPassword",
2472
2585
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2473
2586
  * See the License for the specific language governing permissions and
2474
2587
  * limitations under the License.
2475
- */async function _d(t,e){return Pl(t,"POST","/v1/accounts:signInWithIdp",Ol(t,e))}
2588
+ */
2589
+ class Dp extends kp{constructor(t,e,n,r=null){super("password",n),this._email=t,this._password=e,this._tenantId=r}static _fromEmailAndPassword(t,e){return new Dp(t,e,"password")}static _fromEmailAndCode(t,e,n=null){return new Dp(t,e,"emailLink",n)}toJSON(){return{email:this._email,password:this._password,signInMethod:this.signInMethod,tenantId:this._tenantId}}static fromJSON(t){const e="string"==typeof t?JSON.parse(t):t;if((null==e?void 0:e.email)&&(null==e?void 0:e.password)){if("password"===e.signInMethod)return this._fromEmailAndPassword(e.email,e.password);if("emailLink"===e.signInMethod)return this._fromEmailAndCode(e.email,e.password,e.tenantId)}return null}async _getIdTokenResponse(t){var e;switch(this.signInMethod){case"password":const n={returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"};if(null===(e=t._getRecaptchaConfig())||void 0===e?void 0:e.emailPasswordEnabled){const e=await _p(t,n,"signInWithPassword");return Rp(t,e)}return Rp(t,n).catch((async e=>{if("auth/missing-recaptcha-token"===e.code){console.log("Sign-in with email address and password is protected by reCAPTCHA for this project. Automatically triggering the reCAPTCHA flow and restarting the sign-in flow.");const e=await _p(t,n,"signInWithPassword");return Rp(t,e)}return Promise.reject(e)}));case"emailLink":return async function(t,e){return Uf(t,"POST","/v1/accounts:signInWithEmailLink",Pf(t,e))}(t,{email:this._email,oobCode:this._password});default:_f(t,"internal-error")}}async _linkToIdToken(t,e){switch(this.signInMethod){case"password":return async function(t,e){return Mf(t,"POST","/v1/accounts:update",e)}(t,{idToken:e,returnSecureToken:!0,email:this._email,password:this._password});case"emailLink":return async function(t,e){return Uf(t,"POST","/v1/accounts:signInWithEmailLink",Pf(t,e))}(t,{idToken:e,email:this._email,oobCode:this._password});default:_f(t,"internal-error")}}_getReauthenticationResolver(t){return this._getIdTokenResponse(t)}}
2476
2590
  /**
2477
2591
  * @license
2478
2592
  * Copyright 2020 Google LLC
@@ -2488,7 +2602,7 @@ return async function(t,e){return Pl(t,"POST","/v1/accounts:signInWithPassword",
2488
2602
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2489
2603
  * See the License for the specific language governing permissions and
2490
2604
  * limitations under the License.
2491
- */class Td extends yd{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(t){const e=new Td(t.providerId,t.signInMethod);return t.idToken||t.accessToken?(t.idToken&&(e.idToken=t.idToken),t.accessToken&&(e.accessToken=t.accessToken),t.nonce&&!t.pendingToken&&(e.nonce=t.nonce),t.pendingToken&&(e.pendingToken=t.pendingToken)):t.oauthToken&&t.oauthTokenSecret?(e.accessToken=t.oauthToken,e.secret=t.oauthTokenSecret):gl("argument-error"),e}toJSON(){return{idToken:this.idToken,accessToken:this.accessToken,secret:this.secret,nonce:this.nonce,pendingToken:this.pendingToken,providerId:this.providerId,signInMethod:this.signInMethod}}static fromJSON(t){const e="string"==typeof t?JSON.parse(t):t,{providerId:n,signInMethod:s}=e,r=cl(e,["providerId","signInMethod"]);if(!n||!s)return null;const i=new Td(n,s);return i.idToken=r.idToken||void 0,i.accessToken=r.accessToken||void 0,i.secret=r.secret,i.nonce=r.nonce,i.pendingToken=r.pendingToken||null,i}_getIdTokenResponse(t){return _d(t,this.buildRequest())}_linkToIdToken(t,e){const n=this.buildRequest();return n.idToken=e,_d(t,n)}_getReauthenticationResolver(t){const e=this.buildRequest();return e.autoCreate=!1,_d(t,e)}buildRequest(){const t={requestUri:"http://localhost",returnSecureToken:!0};if(this.pendingToken)t.pendingToken=this.pendingToken;else{const e={};this.idToken&&(e.id_token=this.idToken),this.accessToken&&(e.access_token=this.accessToken),this.secret&&(e.oauth_token_secret=this.secret),e.providerId=this.providerId,this.nonce&&!this.pendingToken&&(e.nonce=this.nonce),t.postBody=y(e)}return t}}
2605
+ */async function Op(t,e){return Uf(t,"POST","/v1/accounts:signInWithIdp",Pf(t,e))}
2492
2606
  /**
2493
2607
  * @license
2494
2608
  * Copyright 2020 Google LLC
@@ -2504,7 +2618,7 @@ return async function(t,e){return Pl(t,"POST","/v1/accounts:signInWithPassword",
2504
2618
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2505
2619
  * See the License for the specific language governing permissions and
2506
2620
  * limitations under the License.
2507
- */class Id{constructor(t){var e,n,s,r,i,o;const a=v(w(t)),c=null!==(e=a.apiKey)&&void 0!==e?e:null,u=null!==(n=a.oobCode)&&void 0!==n?n:null,h=function(t){switch(t){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!==(s=a.mode)&&void 0!==s?s:null);vl(c&&u&&h,"argument-error"),this.apiKey=c,this.operation=h,this.code=u,this.continueUrl=null!==(r=a.continueUrl)&&void 0!==r?r:null,this.languageCode=null!==(i=a.languageCode)&&void 0!==i?i:null,this.tenantId=null!==(o=a.tenantId)&&void 0!==o?o:null}static parseLink(t){const e=function(t){const e=v(w(t)).link,n=e?v(w(e)).deep_link_id:null,s=v(w(t)).deep_link_id;return(s?v(w(s)).link:null)||s||n||e||t}(t);try{return new Id(e)}catch(t){return null}}}
2621
+ */class Lp extends kp{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(t){const e=new Lp(t.providerId,t.signInMethod);return t.idToken||t.accessToken?(t.idToken&&(e.idToken=t.idToken),t.accessToken&&(e.accessToken=t.accessToken),t.nonce&&!t.pendingToken&&(e.nonce=t.nonce),t.pendingToken&&(e.pendingToken=t.pendingToken)):t.oauthToken&&t.oauthTokenSecret?(e.accessToken=t.oauthToken,e.secret=t.oauthTokenSecret):_f("argument-error"),e}toJSON(){return{idToken:this.idToken,accessToken:this.accessToken,secret:this.secret,nonce:this.nonce,pendingToken:this.pendingToken,providerId:this.providerId,signInMethod:this.signInMethod}}static fromJSON(t){const e="string"==typeof t?JSON.parse(t):t,{providerId:n,signInMethod:r}=e,s=ff(e,["providerId","signInMethod"]);if(!n||!r)return null;const i=new Lp(n,r);return i.idToken=s.idToken||void 0,i.accessToken=s.accessToken||void 0,i.secret=s.secret,i.nonce=s.nonce,i.pendingToken=s.pendingToken||null,i}_getIdTokenResponse(t){return Op(t,this.buildRequest())}_linkToIdToken(t,e){const n=this.buildRequest();return n.idToken=e,Op(t,n)}_getReauthenticationResolver(t){const e=this.buildRequest();return e.autoCreate=!1,Op(t,e)}buildRequest(){const t={requestUri:"http://localhost",returnSecureToken:!0};if(this.pendingToken)t.pendingToken=this.pendingToken;else{const e={};this.idToken&&(e.id_token=this.idToken),this.accessToken&&(e.access_token=this.accessToken),this.secret&&(e.oauth_token_secret=this.secret),e.providerId=this.providerId,this.nonce&&!this.pendingToken&&(e.nonce=this.nonce),t.postBody=v(e)}return t}}
2508
2622
  /**
2509
2623
  * @license
2510
2624
  * Copyright 2020 Google LLC
@@ -2520,7 +2634,7 @@ return async function(t,e){return Pl(t,"POST","/v1/accounts:signInWithPassword",
2520
2634
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2521
2635
  * See the License for the specific language governing permissions and
2522
2636
  * limitations under the License.
2523
- */class Ed{constructor(){this.providerId=Ed.PROVIDER_ID}static credential(t,e){return wd._fromEmailAndPassword(t,e)}static credentialWithLink(t,e){const n=Id.parseLink(e);return vl(n,"argument-error"),wd._fromEmailAndCode(t,n.code,n.tenantId)}}Ed.PROVIDER_ID="password",Ed.EMAIL_PASSWORD_SIGN_IN_METHOD="password",Ed.EMAIL_LINK_SIGN_IN_METHOD="emailLink";
2637
+ */class Pp{constructor(t){var e,n,r,s,i,o;const a=w(_(t)),c=null!==(e=a.apiKey)&&void 0!==e?e:null,u=null!==(n=a.oobCode)&&void 0!==n?n:null,h=function(t){switch(t){case"recoverEmail":return"RECOVER_EMAIL";case"resetPassword":return"PASSWORD_RESET";case"signIn":return"EMAIL_SIGNIN";case"verifyEmail":return"VERIFY_EMAIL";case"verifyAndChangeEmail":return"VERIFY_AND_CHANGE_EMAIL";case"revertSecondFactorAddition":return"REVERT_SECOND_FACTOR_ADDITION";default:return null}}(null!==(r=a.mode)&&void 0!==r?r:null);Sf(c&&u&&h,"argument-error"),this.apiKey=c,this.operation=h,this.code=u,this.continueUrl=null!==(s=a.continueUrl)&&void 0!==s?s:null,this.languageCode=null!==(i=a.languageCode)&&void 0!==i?i:null,this.tenantId=null!==(o=a.tenantId)&&void 0!==o?o:null}static parseLink(t){const e=function(t){const e=w(_(t)).link,n=e?w(_(e)).deep_link_id:null,r=w(_(t)).deep_link_id;return(r?w(_(r)).link:null)||r||n||e||t}(t);try{return new Pp(e)}catch(t){return null}}}
2524
2638
  /**
2525
2639
  * @license
2526
2640
  * Copyright 2020 Google LLC
@@ -2536,11 +2650,10 @@ return async function(t,e){return Pl(t,"POST","/v1/accounts:signInWithPassword",
2536
2650
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2537
2651
  * See the License for the specific language governing permissions and
2538
2652
  * limitations under the License.
2539
- */
2540
- class Sd{constructor(t){this.providerId=t,this.defaultLanguageCode=null,this.customParameters={}}setDefaultLanguage(t){this.defaultLanguageCode=t}setCustomParameters(t){return this.customParameters=t,this}getCustomParameters(){return this.customParameters}}
2653
+ */class Mp{constructor(){this.providerId=Mp.PROVIDER_ID}static credential(t,e){return Dp._fromEmailAndPassword(t,e)}static credentialWithLink(t,e){const n=Pp.parseLink(e);return Sf(n,"argument-error"),Dp._fromEmailAndCode(t,n.code,n.tenantId)}}Mp.PROVIDER_ID="password",Mp.EMAIL_PASSWORD_SIGN_IN_METHOD="password",Mp.EMAIL_LINK_SIGN_IN_METHOD="emailLink";
2541
2654
  /**
2542
2655
  * @license
2543
- * Copyright 2019 Google LLC
2656
+ * Copyright 2020 Google LLC
2544
2657
  *
2545
2658
  * Licensed under the Apache License, Version 2.0 (the "License");
2546
2659
  * you may not use this file except in compliance with the License.
@@ -2553,10 +2666,11 @@ class Sd{constructor(t){this.providerId=t,this.defaultLanguageCode=null,this.cus
2553
2666
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2554
2667
  * See the License for the specific language governing permissions and
2555
2668
  * limitations under the License.
2556
- */class bd extends Sd{constructor(){super(...arguments),this.scopes=[]}addScope(t){return this.scopes.includes(t)||this.scopes.push(t),this}getScopes(){return[...this.scopes]}}
2669
+ */
2670
+ class xp{constructor(t){this.providerId=t,this.defaultLanguageCode=null,this.customParameters={}}setDefaultLanguage(t){this.defaultLanguageCode=t}setCustomParameters(t){return this.customParameters=t,this}getCustomParameters(){return this.customParameters}}
2557
2671
  /**
2558
2672
  * @license
2559
- * Copyright 2020 Google LLC
2673
+ * Copyright 2019 Google LLC
2560
2674
  *
2561
2675
  * Licensed under the Apache License, Version 2.0 (the "License");
2562
2676
  * you may not use this file except in compliance with the License.
@@ -2569,7 +2683,7 @@ class Sd{constructor(t){this.providerId=t,this.defaultLanguageCode=null,this.cus
2569
2683
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2570
2684
  * See the License for the specific language governing permissions and
2571
2685
  * limitations under the License.
2572
- */class Ad extends bd{constructor(){super("facebook.com")}static credential(t){return Td._fromParams({providerId:Ad.PROVIDER_ID,signInMethod:Ad.FACEBOOK_SIGN_IN_METHOD,accessToken:t})}static credentialFromResult(t){return Ad.credentialFromTaggedObject(t)}static credentialFromError(t){return Ad.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t||!("oauthAccessToken"in t))return null;if(!t.oauthAccessToken)return null;try{return Ad.credential(t.oauthAccessToken)}catch(t){return null}}}Ad.FACEBOOK_SIGN_IN_METHOD="facebook.com",Ad.PROVIDER_ID="facebook.com";
2686
+ */class Up extends xp{constructor(){super(...arguments),this.scopes=[]}addScope(t){return this.scopes.includes(t)||this.scopes.push(t),this}getScopes(){return[...this.scopes]}}
2573
2687
  /**
2574
2688
  * @license
2575
2689
  * Copyright 2020 Google LLC
@@ -2585,8 +2699,7 @@ class Sd{constructor(t){this.providerId=t,this.defaultLanguageCode=null,this.cus
2585
2699
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2586
2700
  * See the License for the specific language governing permissions and
2587
2701
  * limitations under the License.
2588
- */
2589
- class Cd extends bd{constructor(){super("google.com"),this.addScope("profile")}static credential(t,e){return Td._fromParams({providerId:Cd.PROVIDER_ID,signInMethod:Cd.GOOGLE_SIGN_IN_METHOD,idToken:t,accessToken:e})}static credentialFromResult(t){return Cd.credentialFromTaggedObject(t)}static credentialFromError(t){return Cd.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t)return null;const{oauthIdToken:e,oauthAccessToken:n}=t;if(!e&&!n)return null;try{return Cd.credential(e,n)}catch(t){return null}}}Cd.GOOGLE_SIGN_IN_METHOD="google.com",Cd.PROVIDER_ID="google.com";
2702
+ */class Fp extends Up{constructor(){super("facebook.com")}static credential(t){return Lp._fromParams({providerId:Fp.PROVIDER_ID,signInMethod:Fp.FACEBOOK_SIGN_IN_METHOD,accessToken:t})}static credentialFromResult(t){return Fp.credentialFromTaggedObject(t)}static credentialFromError(t){return Fp.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t||!("oauthAccessToken"in t))return null;if(!t.oauthAccessToken)return null;try{return Fp.credential(t.oauthAccessToken)}catch(t){return null}}}Fp.FACEBOOK_SIGN_IN_METHOD="facebook.com",Fp.PROVIDER_ID="facebook.com";
2590
2703
  /**
2591
2704
  * @license
2592
2705
  * Copyright 2020 Google LLC
@@ -2603,7 +2716,7 @@ class Cd extends bd{constructor(){super("google.com"),this.addScope("profile")}s
2603
2716
  * See the License for the specific language governing permissions and
2604
2717
  * limitations under the License.
2605
2718
  */
2606
- class kd extends bd{constructor(){super("github.com")}static credential(t){return Td._fromParams({providerId:kd.PROVIDER_ID,signInMethod:kd.GITHUB_SIGN_IN_METHOD,accessToken:t})}static credentialFromResult(t){return kd.credentialFromTaggedObject(t)}static credentialFromError(t){return kd.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t||!("oauthAccessToken"in t))return null;if(!t.oauthAccessToken)return null;try{return kd.credential(t.oauthAccessToken)}catch(t){return null}}}kd.GITHUB_SIGN_IN_METHOD="github.com",kd.PROVIDER_ID="github.com";
2719
+ class Vp extends Up{constructor(){super("google.com"),this.addScope("profile")}static credential(t,e){return Lp._fromParams({providerId:Vp.PROVIDER_ID,signInMethod:Vp.GOOGLE_SIGN_IN_METHOD,idToken:t,accessToken:e})}static credentialFromResult(t){return Vp.credentialFromTaggedObject(t)}static credentialFromError(t){return Vp.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t)return null;const{oauthIdToken:e,oauthAccessToken:n}=t;if(!e&&!n)return null;try{return Vp.credential(e,n)}catch(t){return null}}}Vp.GOOGLE_SIGN_IN_METHOD="google.com",Vp.PROVIDER_ID="google.com";
2607
2720
  /**
2608
2721
  * @license
2609
2722
  * Copyright 2020 Google LLC
@@ -2620,7 +2733,7 @@ class kd extends bd{constructor(){super("github.com")}static credential(t){retur
2620
2733
  * See the License for the specific language governing permissions and
2621
2734
  * limitations under the License.
2622
2735
  */
2623
- class Nd extends bd{constructor(){super("twitter.com")}static credential(t,e){return Td._fromParams({providerId:Nd.PROVIDER_ID,signInMethod:Nd.TWITTER_SIGN_IN_METHOD,oauthToken:t,oauthTokenSecret:e})}static credentialFromResult(t){return Nd.credentialFromTaggedObject(t)}static credentialFromError(t){return Nd.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t)return null;const{oauthAccessToken:e,oauthTokenSecret:n}=t;if(!e||!n)return null;try{return Nd.credential(e,n)}catch(t){return null}}}Nd.TWITTER_SIGN_IN_METHOD="twitter.com",Nd.PROVIDER_ID="twitter.com";
2736
+ class Bp extends Up{constructor(){super("github.com")}static credential(t){return Lp._fromParams({providerId:Bp.PROVIDER_ID,signInMethod:Bp.GITHUB_SIGN_IN_METHOD,accessToken:t})}static credentialFromResult(t){return Bp.credentialFromTaggedObject(t)}static credentialFromError(t){return Bp.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t||!("oauthAccessToken"in t))return null;if(!t.oauthAccessToken)return null;try{return Bp.credential(t.oauthAccessToken)}catch(t){return null}}}Bp.GITHUB_SIGN_IN_METHOD="github.com",Bp.PROVIDER_ID="github.com";
2624
2737
  /**
2625
2738
  * @license
2626
2739
  * Copyright 2020 Google LLC
@@ -2637,7 +2750,7 @@ class Nd extends bd{constructor(){super("twitter.com")}static credential(t,e){re
2637
2750
  * See the License for the specific language governing permissions and
2638
2751
  * limitations under the License.
2639
2752
  */
2640
- class Rd{constructor(t){this.user=t.user,this.providerId=t.providerId,this._tokenResponse=t._tokenResponse,this.operationType=t.operationType}static async _fromIdTokenResponse(t,e,n,s=!1){const r=await zl._fromIdTokenResponse(t,n,s),i=Od(n);return new Rd({user:r,providerId:i,_tokenResponse:n,operationType:e})}static async _forOperation(t,e,n){await t._updateTokensIfNecessary(n,!0);const s=Od(n);return new Rd({user:t,providerId:s,_tokenResponse:n,operationType:e})}}function Od(t){return t.providerId?t.providerId:"phoneNumber"in t?"phone":null}
2753
+ class Hp extends Up{constructor(){super("twitter.com")}static credential(t,e){return Lp._fromParams({providerId:Hp.PROVIDER_ID,signInMethod:Hp.TWITTER_SIGN_IN_METHOD,oauthToken:t,oauthTokenSecret:e})}static credentialFromResult(t){return Hp.credentialFromTaggedObject(t)}static credentialFromError(t){return Hp.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t)return null;const{oauthAccessToken:e,oauthTokenSecret:n}=t;if(!e||!n)return null;try{return Hp.credential(e,n)}catch(t){return null}}}Hp.TWITTER_SIGN_IN_METHOD="twitter.com",Hp.PROVIDER_ID="twitter.com";
2641
2754
  /**
2642
2755
  * @license
2643
2756
  * Copyright 2020 Google LLC
@@ -2653,7 +2766,8 @@ class Rd{constructor(t){this.user=t.user,this.providerId=t.providerId,this._toke
2653
2766
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2654
2767
  * See the License for the specific language governing permissions and
2655
2768
  * limitations under the License.
2656
- */class Dd extends d{constructor(t,e,n,s){var r;super(e.code,e.message),this.operationType=n,this.user=s,Object.setPrototypeOf(this,Dd.prototype),this.customData={appName:t.name,tenantId:null!==(r=t.tenantId)&&void 0!==r?r:void 0,_serverResponse:e.customData._serverResponse,operationType:n}}static _fromErrorAndOperation(t,e,n,s){return new Dd(t,e,n,s)}}function Ld(t,e,n,s){return("reauthenticate"===e?n._getReauthenticationResolver(t):n._getIdTokenResponse(t)).catch((n=>{if("auth/multi-factor-auth-required"===n.code)throw Dd._fromErrorAndOperation(t,n,e,s);throw n}))}
2769
+ */
2770
+ class jp{constructor(t){this.user=t.user,this.providerId=t.providerId,this._tokenResponse=t._tokenResponse,this.operationType=t.operationType}static async _fromIdTokenResponse(t,e,n,r=!1){const s=await Yf._fromIdTokenResponse(t,n,r),i=$p(n);return new jp({user:s,providerId:i,_tokenResponse:n,operationType:e})}static async _forOperation(t,e,n){await t._updateTokensIfNecessary(n,!0);const r=$p(n);return new jp({user:t,providerId:r,_tokenResponse:n,operationType:e})}}function $p(t){return t.providerId?t.providerId:"phoneNumber"in t?"phone":null}
2657
2771
  /**
2658
2772
  * @license
2659
2773
  * Copyright 2020 Google LLC
@@ -2669,8 +2783,7 @@ class Rd{constructor(t){this.user=t.user,this.providerId=t.providerId,this._toke
2669
2783
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2670
2784
  * See the License for the specific language governing permissions and
2671
2785
  * limitations under the License.
2672
- */
2673
- async function Pd(t,e,n=!1){const s="signIn",r=await Ld(t,s,e),i=await Rd._fromIdTokenResponse(t,s,r);return n||await t._updateCurrentUser(i.user),i}
2786
+ */class qp extends f{constructor(t,e,n,r){var s;super(e.code,e.message),this.operationType=n,this.user=r,Object.setPrototypeOf(this,qp.prototype),this.customData={appName:t.name,tenantId:null!==(s=t.tenantId)&&void 0!==s?s:void 0,_serverResponse:e.customData._serverResponse,operationType:n}}static _fromErrorAndOperation(t,e,n,r){return new qp(t,e,n,r)}}function Kp(t,e,n,r){return("reauthenticate"===e?n._getReauthenticationResolver(t):n._getIdTokenResponse(t)).catch((n=>{if("auth/multi-factor-auth-required"===n.code)throw qp._fromErrorAndOperation(t,n,e,r);throw n}))}
2674
2787
  /**
2675
2788
  * @license
2676
2789
  * Copyright 2020 Google LLC
@@ -2687,7 +2800,7 @@ async function Pd(t,e,n=!1){const s="signIn",r=await Ld(t,s,e),i=await Rd._fromI
2687
2800
  * See the License for the specific language governing permissions and
2688
2801
  * limitations under the License.
2689
2802
  */
2690
- async function Md(t,e,n){const s=I(t),r={requestType:"PASSWORD_RESET",email:e};n&&
2803
+ async function Wp(t,e,n=!1){const r="signIn",s=await Kp(t,r,e),i=await jp._fromIdTokenResponse(t,r,s);return n||await t._updateCurrentUser(i.user),i}
2691
2804
  /**
2692
2805
  * @license
2693
2806
  * Copyright 2020 Google LLC
@@ -2704,10 +2817,10 @@ async function Md(t,e,n){const s=I(t),r={requestType:"PASSWORD_RESET",email:e};n
2704
2817
  * See the License for the specific language governing permissions and
2705
2818
  * limitations under the License.
2706
2819
  */
2707
- function(t,e,n){var s;vl((null===(s=n.url)||void 0===s?void 0:s.length)>0,t,"invalid-continue-uri"),vl(void 0===n.dynamicLinkDomain||n.dynamicLinkDomain.length>0,t,"invalid-dynamic-link-domain"),e.continueUrl=n.url,e.dynamicLinkDomain=n.dynamicLinkDomain,e.canHandleCodeInApp=n.handleCodeInApp,n.iOS&&(vl(n.iOS.bundleId.length>0,t,"missing-ios-bundle-id"),e.iOSBundleId=n.iOS.bundleId),n.android&&(vl(n.android.packageName.length>0,t,"missing-android-pkg-name"),e.androidInstallApp=n.android.installApp,e.androidMinimumVersionCode=n.android.minimumVersion,e.androidPackageName=n.android.packageName)}(s,r,n),await vd(s,r)}async function xd(t,e,n){await async function(t,e){return Dl(t,"POST","/v1/accounts:resetPassword",Ol(t,e))}(I(t),{oobCode:e,newPassword:n})}function Ud(t,e,n){return async function(t,e){return Pd(dd(t),e)}(I(t),Ed.credential(e,n))}const Fd="__sak";
2820
+ function Gp(t,e,n){var r;Sf((null===(r=n.url)||void 0===r?void 0:r.length)>0,t,"invalid-continue-uri"),Sf(void 0===n.dynamicLinkDomain||n.dynamicLinkDomain.length>0,t,"invalid-dynamic-link-domain"),e.continueUrl=n.url,e.dynamicLinkDomain=n.dynamicLinkDomain,e.canHandleCodeInApp=n.handleCodeInApp,n.iOS&&(Sf(n.iOS.bundleId.length>0,t,"missing-ios-bundle-id"),e.iOSBundleId=n.iOS.bundleId),n.android&&(Sf(n.android.packageName.length>0,t,"missing-android-pkg-name"),e.androidInstallApp=n.android.installApp,e.androidMinimumVersionCode=n.android.minimumVersion,e.androidPackageName=n.android.packageName)}
2708
2821
  /**
2709
2822
  * @license
2710
- * Copyright 2019 Google LLC
2823
+ * Copyright 2020 Google LLC
2711
2824
  *
2712
2825
  * Licensed under the Apache License, Version 2.0 (the "License");
2713
2826
  * you may not use this file except in compliance with the License.
@@ -2720,10 +2833,10 @@ function(t,e,n){var s;vl((null===(s=n.url)||void 0===s?void 0:s.length)>0,t,"inv
2720
2833
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2721
2834
  * See the License for the specific language governing permissions and
2722
2835
  * limitations under the License.
2723
- */class Vd{constructor(t,e){this.storageRetriever=t,this.type=e}_isAvailable(){try{return this.storage?(this.storage.setItem(Fd,"1"),this.storage.removeItem(Fd),Promise.resolve(!0)):Promise.resolve(!1)}catch(t){return Promise.resolve(!1)}}_set(t,e){return this.storage.setItem(t,JSON.stringify(e)),Promise.resolve()}_get(t){const e=this.storage.getItem(t);return Promise.resolve(e?JSON.parse(e):null)}_remove(t){return this.storage.removeItem(t),Promise.resolve()}get storage(){return this.storageRetriever()}}
2836
+ */async function zp(t,e,n){await async function(t,e){return Mf(t,"POST","/v1/accounts:resetPassword",Pf(t,e))}(S(t),{oobCode:e,newPassword:n})}function Qp(t,e,n){return async function(t,e){return Wp(Sp(t),e)}(S(t),Mp.credential(e,n))}const Yp="__sak";
2724
2837
  /**
2725
2838
  * @license
2726
- * Copyright 2020 Google LLC
2839
+ * Copyright 2019 Google LLC
2727
2840
  *
2728
2841
  * Licensed under the Apache License, Version 2.0 (the "License");
2729
2842
  * you may not use this file except in compliance with the License.
@@ -2736,7 +2849,7 @@ function(t,e,n){var s;vl((null===(s=n.url)||void 0===s?void 0:s.length)>0,t,"inv
2736
2849
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2737
2850
  * See the License for the specific language governing permissions and
2738
2851
  * limitations under the License.
2739
- */class Bd extends Vd{constructor(){super((()=>window.localStorage),"LOCAL"),this.boundEventHandler=(t,e)=>this.onStorageEvent(t,e),this.listeners={},this.localCache={},this.pollTimer=null,this.safariLocalStorageNotSynced=function(){const t=o();return td(t)||od(t)}()&&function(){try{return!(!window||window===window.top)}catch(t){return!1}}(),this.fallbackToPolling=cd(),this._shouldAllowMigration=!0}forAllChangedKeys(t){for(const e of Object.keys(this.listeners)){const n=this.storage.getItem(e),s=this.localCache[e];n!==s&&t(e,s,n)}}onStorageEvent(t,e=!1){if(!t.key)return void this.forAllChangedKeys(((t,e,n)=>{this.notifyListeners(t,n)}));const n=t.key;if(e?this.detachListener():this.stopPolling(),this.safariLocalStorageNotSynced){const s=this.storage.getItem(n);if(t.newValue!==s)null!==t.newValue?this.storage.setItem(n,t.newValue):this.storage.removeItem(n);else if(this.localCache[n]===t.newValue&&!e)return}const s=()=>{const t=this.storage.getItem(n);(e||this.localCache[n]!==t)&&this.notifyListeners(n,t)},r=this.storage.getItem(n);ad()&&r!==t.newValue&&t.newValue!==t.oldValue?setTimeout(s,10):s()}notifyListeners(t,e){this.localCache[t]=e;const n=this.listeners[t];if(n)for(const t of Array.from(n))t(e?JSON.parse(e):e)}startPolling(){this.stopPolling(),this.pollTimer=setInterval((()=>{this.forAllChangedKeys(((t,e,n)=>{this.onStorageEvent(new StorageEvent("storage",{key:t,oldValue:e,newValue:n}),!0)}))}),1e3)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}attachListener(){window.addEventListener("storage",this.boundEventHandler)}detachListener(){window.removeEventListener("storage",this.boundEventHandler)}_addListener(t,e){0===Object.keys(this.listeners).length&&(this.fallbackToPolling?this.startPolling():this.attachListener()),this.listeners[t]||(this.listeners[t]=new Set,this.localCache[t]=this.storage.getItem(t)),this.listeners[t].add(e)}_removeListener(t,e){this.listeners[t]&&(this.listeners[t].delete(e),0===this.listeners[t].size&&delete this.listeners[t]),0===Object.keys(this.listeners).length&&(this.detachListener(),this.stopPolling())}async _set(t,e){await super._set(t,e),this.localCache[t]=JSON.stringify(e)}async _get(t){const e=await super._get(t);return this.localCache[t]=JSON.stringify(e),e}async _remove(t){await super._remove(t),delete this.localCache[t]}}Bd.type="LOCAL";const Hd=Bd;
2852
+ */class Jp{constructor(t,e){this.storageRetriever=t,this.type=e}_isAvailable(){try{return this.storage?(this.storage.setItem(Yp,"1"),this.storage.removeItem(Yp),Promise.resolve(!0)):Promise.resolve(!1)}catch(t){return Promise.resolve(!1)}}_set(t,e){return this.storage.setItem(t,JSON.stringify(e)),Promise.resolve()}_get(t){const e=this.storage.getItem(t);return Promise.resolve(e?JSON.parse(e):null)}_remove(t){return this.storage.removeItem(t),Promise.resolve()}get storage(){return this.storageRetriever()}}
2740
2853
  /**
2741
2854
  * @license
2742
2855
  * Copyright 2020 Google LLC
@@ -2752,10 +2865,10 @@ function(t,e,n){var s;vl((null===(s=n.url)||void 0===s?void 0:s.length)>0,t,"inv
2752
2865
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2753
2866
  * See the License for the specific language governing permissions and
2754
2867
  * limitations under the License.
2755
- */class jd extends Vd{constructor(){super((()=>window.sessionStorage),"SESSION")}_addListener(t,e){}_removeListener(t,e){}}jd.type="SESSION";const qd=jd;
2868
+ */class Xp extends Jp{constructor(){super((()=>window.localStorage),"LOCAL"),this.boundEventHandler=(t,e)=>this.onStorageEvent(t,e),this.listeners={},this.localCache={},this.pollTimer=null,this.safariLocalStorageNotSynced=function(){const t=d();return ip(t)||lp(t)}()&&function(){try{return!(!window||window===window.top)}catch(t){return!1}}(),this.fallbackToPolling=fp(),this._shouldAllowMigration=!0}forAllChangedKeys(t){for(const e of Object.keys(this.listeners)){const n=this.storage.getItem(e),r=this.localCache[e];n!==r&&t(e,r,n)}}onStorageEvent(t,e=!1){if(!t.key)return void this.forAllChangedKeys(((t,e,n)=>{this.notifyListeners(t,n)}));const n=t.key;if(e?this.detachListener():this.stopPolling(),this.safariLocalStorageNotSynced){const r=this.storage.getItem(n);if(t.newValue!==r)null!==t.newValue?this.storage.setItem(n,t.newValue):this.storage.removeItem(n);else if(this.localCache[n]===t.newValue&&!e)return}const r=()=>{const t=this.storage.getItem(n);(e||this.localCache[n]!==t)&&this.notifyListeners(n,t)},s=this.storage.getItem(n);dp()&&s!==t.newValue&&t.newValue!==t.oldValue?setTimeout(r,10):r()}notifyListeners(t,e){this.localCache[t]=e;const n=this.listeners[t];if(n)for(const t of Array.from(n))t(e?JSON.parse(e):e)}startPolling(){this.stopPolling(),this.pollTimer=setInterval((()=>{this.forAllChangedKeys(((t,e,n)=>{this.onStorageEvent(new StorageEvent("storage",{key:t,oldValue:e,newValue:n}),!0)}))}),1e3)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}attachListener(){window.addEventListener("storage",this.boundEventHandler)}detachListener(){window.removeEventListener("storage",this.boundEventHandler)}_addListener(t,e){0===Object.keys(this.listeners).length&&(this.fallbackToPolling?this.startPolling():this.attachListener()),this.listeners[t]||(this.listeners[t]=new Set,this.localCache[t]=this.storage.getItem(t)),this.listeners[t].add(e)}_removeListener(t,e){this.listeners[t]&&(this.listeners[t].delete(e),0===this.listeners[t].size&&delete this.listeners[t]),0===Object.keys(this.listeners).length&&(this.detachListener(),this.stopPolling())}async _set(t,e){await super._set(t,e),this.localCache[t]=JSON.stringify(e)}async _get(t){const e=await super._get(t);return this.localCache[t]=JSON.stringify(e),e}async _remove(t){await super._remove(t),delete this.localCache[t]}}Xp.type="LOCAL";const Zp=Xp;
2756
2869
  /**
2757
2870
  * @license
2758
- * Copyright 2019 Google LLC
2871
+ * Copyright 2020 Google LLC
2759
2872
  *
2760
2873
  * Licensed under the Apache License, Version 2.0 (the "License");
2761
2874
  * you may not use this file except in compliance with the License.
@@ -2768,7 +2881,7 @@ function(t,e,n){var s;vl((null===(s=n.url)||void 0===s?void 0:s.length)>0,t,"inv
2768
2881
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2769
2882
  * See the License for the specific language governing permissions and
2770
2883
  * limitations under the License.
2771
- */
2884
+ */class tg extends Jp{constructor(){super((()=>window.sessionStorage),"SESSION")}_addListener(t,e){}_removeListener(t,e){}}tg.type="SESSION";const eg=tg;
2772
2885
  /**
2773
2886
  * @license
2774
2887
  * Copyright 2019 Google LLC
@@ -2785,10 +2898,9 @@ function(t,e,n){var s;vl((null===(s=n.url)||void 0===s?void 0:s.length)>0,t,"inv
2785
2898
  * See the License for the specific language governing permissions and
2786
2899
  * limitations under the License.
2787
2900
  */
2788
- class Kd{constructor(t){this.eventTarget=t,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(t){const e=this.receivers.find((e=>e.isListeningto(t)));if(e)return e;const n=new Kd(t);return this.receivers.push(n),n}isListeningto(t){return this.eventTarget===t}async handleEvent(t){const e=t,{eventId:n,eventType:s,data:r}=e.data,i=this.handlersMap[s];if(!(null==i?void 0:i.size))return;e.ports[0].postMessage({status:"ack",eventId:n,eventType:s});const o=Array.from(i).map((async t=>t(e.origin,r))),a=await function(t){return Promise.all(t.map((async t=>{try{return{fulfilled:!0,value:await t}}catch(t){return{fulfilled:!1,reason:t}}})))}(o);e.ports[0].postMessage({status:"done",eventId:n,eventType:s,response:a})}_subscribe(t,e){0===Object.keys(this.handlersMap).length&&this.eventTarget.addEventListener("message",this.boundEventHandler),this.handlersMap[t]||(this.handlersMap[t]=new Set),this.handlersMap[t].add(e)}_unsubscribe(t,e){this.handlersMap[t]&&e&&this.handlersMap[t].delete(e),e&&0!==this.handlersMap[t].size||delete this.handlersMap[t],0===Object.keys(this.handlersMap).length&&this.eventTarget.removeEventListener("message",this.boundEventHandler)}}
2789
2901
  /**
2790
2902
  * @license
2791
- * Copyright 2020 Google LLC
2903
+ * Copyright 2019 Google LLC
2792
2904
  *
2793
2905
  * Licensed under the Apache License, Version 2.0 (the "License");
2794
2906
  * you may not use this file except in compliance with the License.
@@ -2802,10 +2914,10 @@ class Kd{constructor(t){this.eventTarget=t,this.handlersMap={},this.boundEventHa
2802
2914
  * See the License for the specific language governing permissions and
2803
2915
  * limitations under the License.
2804
2916
  */
2805
- function Gd(t="",e=10){let n="";for(let t=0;t<e;t++)n+=Math.floor(10*Math.random());return t+n}
2917
+ class ng{constructor(t){this.eventTarget=t,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(t){const e=this.receivers.find((e=>e.isListeningto(t)));if(e)return e;const n=new ng(t);return this.receivers.push(n),n}isListeningto(t){return this.eventTarget===t}async handleEvent(t){const e=t,{eventId:n,eventType:r,data:s}=e.data,i=this.handlersMap[r];if(!(null==i?void 0:i.size))return;e.ports[0].postMessage({status:"ack",eventId:n,eventType:r});const o=Array.from(i).map((async t=>t(e.origin,s))),a=await function(t){return Promise.all(t.map((async t=>{try{return{fulfilled:!0,value:await t}}catch(t){return{fulfilled:!1,reason:t}}})))}(o);e.ports[0].postMessage({status:"done",eventId:n,eventType:r,response:a})}_subscribe(t,e){0===Object.keys(this.handlersMap).length&&this.eventTarget.addEventListener("message",this.boundEventHandler),this.handlersMap[t]||(this.handlersMap[t]=new Set),this.handlersMap[t].add(e)}_unsubscribe(t,e){this.handlersMap[t]&&e&&this.handlersMap[t].delete(e),e&&0!==this.handlersMap[t].size||delete this.handlersMap[t],0===Object.keys(this.handlersMap).length&&this.eventTarget.removeEventListener("message",this.boundEventHandler)}}
2806
2918
  /**
2807
2919
  * @license
2808
- * Copyright 2019 Google LLC
2920
+ * Copyright 2020 Google LLC
2809
2921
  *
2810
2922
  * Licensed under the Apache License, Version 2.0 (the "License");
2811
2923
  * you may not use this file except in compliance with the License.
@@ -2818,10 +2930,11 @@ function Gd(t="",e=10){let n="";for(let t=0;t<e;t++)n+=Math.floor(10*Math.random
2818
2930
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2819
2931
  * See the License for the specific language governing permissions and
2820
2932
  * limitations under the License.
2821
- */Kd.receivers=[];class Wd{constructor(t){this.target=t,this.handlers=new Set}removeMessageHandler(t){t.messageChannel&&(t.messageChannel.port1.removeEventListener("message",t.onMessage),t.messageChannel.port1.close()),this.handlers.delete(t)}async _send(t,e,n=50){const s="undefined"!=typeof MessageChannel?new MessageChannel:null;if(!s)throw new Error("connection_unavailable");let r,i;return new Promise(((o,a)=>{const c=Gd("",20);s.port1.start();const u=setTimeout((()=>{a(new Error("unsupported_event"))}),n);i={messageChannel:s,onMessage(t){const e=t;if(e.data.eventId===c)switch(e.data.status){case"ack":clearTimeout(u),r=setTimeout((()=>{a(new Error("timeout"))}),3e3);break;case"done":clearTimeout(r),o(e.data.response);break;default:clearTimeout(u),clearTimeout(r),a(new Error("invalid_response"))}}},this.handlers.add(i),s.port1.addEventListener("message",i.onMessage),this.target.postMessage({eventType:t,eventId:c,data:e},[s.port2])})).finally((()=>{i&&this.removeMessageHandler(i)}))}}
2933
+ */
2934
+ function rg(t="",e=10){let n="";for(let t=0;t<e;t++)n+=Math.floor(10*Math.random());return t+n}
2822
2935
  /**
2823
2936
  * @license
2824
- * Copyright 2020 Google LLC
2937
+ * Copyright 2019 Google LLC
2825
2938
  *
2826
2939
  * Licensed under the Apache License, Version 2.0 (the "License");
2827
2940
  * you may not use this file except in compliance with the License.
@@ -2834,10 +2947,10 @@ function Gd(t="",e=10){let n="";for(let t=0;t<e;t++)n+=Math.floor(10*Math.random
2834
2947
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2835
2948
  * See the License for the specific language governing permissions and
2836
2949
  * limitations under the License.
2837
- */function zd(){return window}
2950
+ */ng.receivers=[];class sg{constructor(t){this.target=t,this.handlers=new Set}removeMessageHandler(t){t.messageChannel&&(t.messageChannel.port1.removeEventListener("message",t.onMessage),t.messageChannel.port1.close()),this.handlers.delete(t)}async _send(t,e,n=50){const r="undefined"!=typeof MessageChannel?new MessageChannel:null;if(!r)throw new Error("connection_unavailable");let s,i;return new Promise(((o,a)=>{const c=rg("",20);r.port1.start();const u=setTimeout((()=>{a(new Error("unsupported_event"))}),n);i={messageChannel:r,onMessage(t){const e=t;if(e.data.eventId===c)switch(e.data.status){case"ack":clearTimeout(u),s=setTimeout((()=>{a(new Error("timeout"))}),3e3);break;case"done":clearTimeout(s),o(e.data.response);break;default:clearTimeout(u),clearTimeout(s),a(new Error("invalid_response"))}}},this.handlers.add(i),r.port1.addEventListener("message",i.onMessage),this.target.postMessage({eventType:t,eventId:c,data:e},[r.port2])})).finally((()=>{i&&this.removeMessageHandler(i)}))}}
2838
2951
  /**
2839
2952
  * @license
2840
- * Copyright 2020 Google LLC.
2953
+ * Copyright 2020 Google LLC
2841
2954
  *
2842
2955
  * Licensed under the Apache License, Version 2.0 (the "License");
2843
2956
  * you may not use this file except in compliance with the License.
@@ -2850,11 +2963,10 @@ function Gd(t="",e=10){let n="";for(let t=0;t<e;t++)n+=Math.floor(10*Math.random
2850
2963
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2851
2964
  * See the License for the specific language governing permissions and
2852
2965
  * limitations under the License.
2853
- */
2854
- function $d(){return void 0!==zd().WorkerGlobalScope&&"function"==typeof zd().importScripts}
2966
+ */function ig(){return window}
2855
2967
  /**
2856
2968
  * @license
2857
- * Copyright 2019 Google LLC
2969
+ * Copyright 2020 Google LLC.
2858
2970
  *
2859
2971
  * Licensed under the Apache License, Version 2.0 (the "License");
2860
2972
  * you may not use this file except in compliance with the License.
@@ -2868,10 +2980,10 @@ function $d(){return void 0!==zd().WorkerGlobalScope&&"function"==typeof zd().im
2868
2980
  * See the License for the specific language governing permissions and
2869
2981
  * limitations under the License.
2870
2982
  */
2871
- const Qd="firebaseLocalStorageDb",Jd="firebaseLocalStorage",Yd="fbase_key";class Xd{constructor(t){this.request=t}toPromise(){return new Promise(((t,e)=>{this.request.addEventListener("success",(()=>{t(this.request.result)})),this.request.addEventListener("error",(()=>{e(this.request.error)}))}))}}function Zd(t,e){return t.transaction([Jd],e?"readwrite":"readonly").objectStore(Jd)}function tf(){const t=indexedDB.open(Qd,1);return new Promise(((e,n)=>{t.addEventListener("error",(()=>{n(t.error)})),t.addEventListener("upgradeneeded",(()=>{const e=t.result;try{e.createObjectStore(Jd,{keyPath:Yd})}catch(t){n(t)}})),t.addEventListener("success",(async()=>{const n=t.result;n.objectStoreNames.contains(Jd)?e(n):(n.close(),await function(){const t=indexedDB.deleteDatabase(Qd);return new Xd(t).toPromise()}(),e(await tf()))}))}))}async function ef(t,e,n){const s=Zd(t,!0).put({[Yd]:e,value:n});return new Xd(s).toPromise()}function nf(t,e){const n=Zd(t,!0).delete(e);return new Xd(n).toPromise()}class sf{constructor(){this.type="LOCAL",this._shouldAllowMigration=!0,this.listeners={},this.localCache={},this.pollTimer=null,this.pendingWrites=0,this.receiver=null,this.sender=null,this.serviceWorkerReceiverAvailable=!1,this.activeServiceWorker=null,this._workerInitializationPromise=this.initializeServiceWorkerMessaging().then((()=>{}),(()=>{}))}async _openDb(){return this.db||(this.db=await tf()),this.db}async _withRetries(t){let e=0;for(;;)try{const e=await this._openDb();return await t(e)}catch(t){if(e++>3)throw t;this.db&&(this.db.close(),this.db=void 0)}}async initializeServiceWorkerMessaging(){return $d()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=Kd._getInstance($d()?self:null),this.receiver._subscribe("keyChanged",(async(t,e)=>({keyProcessed:(await this._poll()).includes(e.key)}))),this.receiver._subscribe("ping",(async(t,e)=>["keyChanged"]))}async initializeSender(){var t,e;if(this.activeServiceWorker=await async function(){if(!(null===navigator||void 0===navigator?void 0:navigator.serviceWorker))return null;try{return(await navigator.serviceWorker.ready).active}catch(t){return null}}(),!this.activeServiceWorker)return;this.sender=new Wd(this.activeServiceWorker);const n=await this.sender._send("ping",{},800);n&&(null===(t=n[0])||void 0===t?void 0:t.fulfilled)&&(null===(e=n[0])||void 0===e?void 0:e.value.includes("keyChanged"))&&(this.serviceWorkerReceiverAvailable=!0)}async notifyServiceWorker(t){if(this.sender&&this.activeServiceWorker&&function(){var t;return(null===(t=null===navigator||void 0===navigator?void 0:navigator.serviceWorker)||void 0===t?void 0:t.controller)||null}()===this.activeServiceWorker)try{await this.sender._send("keyChanged",{key:t},this.serviceWorkerReceiverAvailable?800:50)}catch(t){}}async _isAvailable(){try{if(!indexedDB)return!1;const t=await tf();return await ef(t,Fd,"1"),await nf(t,Fd),!0}catch(t){}return!1}async _withPendingWrite(t){this.pendingWrites++;try{await t()}finally{this.pendingWrites--}}async _set(t,e){return this._withPendingWrite((async()=>(await this._withRetries((n=>ef(n,t,e))),this.localCache[t]=e,this.notifyServiceWorker(t))))}async _get(t){const e=await this._withRetries((e=>async function(t,e){const n=Zd(t,!1).get(e),s=await new Xd(n).toPromise();return void 0===s?null:s.value}(e,t)));return this.localCache[t]=e,e}async _remove(t){return this._withPendingWrite((async()=>(await this._withRetries((e=>nf(e,t))),delete this.localCache[t],this.notifyServiceWorker(t))))}async _poll(){const t=await this._withRetries((t=>{const e=Zd(t,!1).getAll();return new Xd(e).toPromise()}));if(!t)return[];if(0!==this.pendingWrites)return[];const e=[],n=new Set;for(const{fbase_key:s,value:r}of t)n.add(s),JSON.stringify(this.localCache[s])!==JSON.stringify(r)&&(this.notifyListeners(s,r),e.push(s));for(const t of Object.keys(this.localCache))this.localCache[t]&&!n.has(t)&&(this.notifyListeners(t,null),e.push(t));return e}notifyListeners(t,e){this.localCache[t]=e;const n=this.listeners[t];if(n)for(const t of Array.from(n))t(e)}startPolling(){this.stopPolling(),this.pollTimer=setInterval((async()=>this._poll()),800)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}_addListener(t,e){0===Object.keys(this.listeners).length&&this.startPolling(),this.listeners[t]||(this.listeners[t]=new Set,this._get(t)),this.listeners[t].add(e)}_removeListener(t,e){this.listeners[t]&&(this.listeners[t].delete(e),0===this.listeners[t].size&&delete this.listeners[t]),0===Object.keys(this.listeners).length&&this.stopPolling()}}sf.type="LOCAL";const rf=sf;
2983
+ function og(){return void 0!==ig().WorkerGlobalScope&&"function"==typeof ig().importScripts}
2872
2984
  /**
2873
2985
  * @license
2874
- * Copyright 2020 Google LLC
2986
+ * Copyright 2019 Google LLC
2875
2987
  *
2876
2988
  * Licensed under the Apache License, Version 2.0 (the "License");
2877
2989
  * you may not use this file except in compliance with the License.
@@ -2884,7 +2996,8 @@ const Qd="firebaseLocalStorageDb",Jd="firebaseLocalStorage",Yd="fbase_key";class
2884
2996
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2885
2997
  * See the License for the specific language governing permissions and
2886
2998
  * limitations under the License.
2887
- */function of(t){return new Promise(((e,n)=>{const s=document.createElement("script");s.setAttribute("src",t),s.onload=e,s.onerror=t=>{const e=ml("internal-error");e.customData=t,n(e)},s.type="text/javascript",s.charset="UTF-8",function(){var t,e;return null!==(e=null===(t=document.getElementsByTagName("head"))||void 0===t?void 0:t[0])&&void 0!==e?e:document}().appendChild(s)}))}new Al(3e4,6e4);
2999
+ */
3000
+ const ag="firebaseLocalStorageDb",cg="firebaseLocalStorage",ug="fbase_key";class hg{constructor(t){this.request=t}toPromise(){return new Promise(((t,e)=>{this.request.addEventListener("success",(()=>{t(this.request.result)})),this.request.addEventListener("error",(()=>{e(this.request.error)}))}))}}function lg(t,e){return t.transaction([cg],e?"readwrite":"readonly").objectStore(cg)}function dg(){const t=indexedDB.open(ag,1);return new Promise(((e,n)=>{t.addEventListener("error",(()=>{n(t.error)})),t.addEventListener("upgradeneeded",(()=>{const e=t.result;try{e.createObjectStore(cg,{keyPath:ug})}catch(t){n(t)}})),t.addEventListener("success",(async()=>{const n=t.result;n.objectStoreNames.contains(cg)?e(n):(n.close(),await function(){const t=indexedDB.deleteDatabase(ag);return new hg(t).toPromise()}(),e(await dg()))}))}))}async function fg(t,e,n){const r=lg(t,!0).put({[ug]:e,value:n});return new hg(r).toPromise()}function pg(t,e){const n=lg(t,!0).delete(e);return new hg(n).toPromise()}class gg{constructor(){this.type="LOCAL",this._shouldAllowMigration=!0,this.listeners={},this.localCache={},this.pollTimer=null,this.pendingWrites=0,this.receiver=null,this.sender=null,this.serviceWorkerReceiverAvailable=!1,this.activeServiceWorker=null,this._workerInitializationPromise=this.initializeServiceWorkerMessaging().then((()=>{}),(()=>{}))}async _openDb(){return this.db||(this.db=await dg()),this.db}async _withRetries(t){let e=0;for(;;)try{const e=await this._openDb();return await t(e)}catch(t){if(e++>3)throw t;this.db&&(this.db.close(),this.db=void 0)}}async initializeServiceWorkerMessaging(){return og()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=ng._getInstance(og()?self:null),this.receiver._subscribe("keyChanged",(async(t,e)=>({keyProcessed:(await this._poll()).includes(e.key)}))),this.receiver._subscribe("ping",(async(t,e)=>["keyChanged"]))}async initializeSender(){var t,e;if(this.activeServiceWorker=await async function(){if(!(null===navigator||void 0===navigator?void 0:navigator.serviceWorker))return null;try{return(await navigator.serviceWorker.ready).active}catch(t){return null}}(),!this.activeServiceWorker)return;this.sender=new sg(this.activeServiceWorker);const n=await this.sender._send("ping",{},800);n&&(null===(t=n[0])||void 0===t?void 0:t.fulfilled)&&(null===(e=n[0])||void 0===e?void 0:e.value.includes("keyChanged"))&&(this.serviceWorkerReceiverAvailable=!0)}async notifyServiceWorker(t){if(this.sender&&this.activeServiceWorker&&function(){var t;return(null===(t=null===navigator||void 0===navigator?void 0:navigator.serviceWorker)||void 0===t?void 0:t.controller)||null}()===this.activeServiceWorker)try{await this.sender._send("keyChanged",{key:t},this.serviceWorkerReceiverAvailable?800:50)}catch(t){}}async _isAvailable(){try{if(!indexedDB)return!1;const t=await dg();return await fg(t,Yp,"1"),await pg(t,Yp),!0}catch(t){}return!1}async _withPendingWrite(t){this.pendingWrites++;try{await t()}finally{this.pendingWrites--}}async _set(t,e){return this._withPendingWrite((async()=>(await this._withRetries((n=>fg(n,t,e))),this.localCache[t]=e,this.notifyServiceWorker(t))))}async _get(t){const e=await this._withRetries((e=>async function(t,e){const n=lg(t,!1).get(e),r=await new hg(n).toPromise();return void 0===r?null:r.value}(e,t)));return this.localCache[t]=e,e}async _remove(t){return this._withPendingWrite((async()=>(await this._withRetries((e=>pg(e,t))),delete this.localCache[t],this.notifyServiceWorker(t))))}async _poll(){const t=await this._withRetries((t=>{const e=lg(t,!1).getAll();return new hg(e).toPromise()}));if(!t)return[];if(0!==this.pendingWrites)return[];const e=[],n=new Set;for(const{fbase_key:r,value:s}of t)n.add(r),JSON.stringify(this.localCache[r])!==JSON.stringify(s)&&(this.notifyListeners(r,s),e.push(r));for(const t of Object.keys(this.localCache))this.localCache[t]&&!n.has(t)&&(this.notifyListeners(t,null),e.push(t));return e}notifyListeners(t,e){this.localCache[t]=e;const n=this.listeners[t];if(n)for(const t of Array.from(n))t(e)}startPolling(){this.stopPolling(),this.pollTimer=setInterval((async()=>this._poll()),800)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}_addListener(t,e){0===Object.keys(this.listeners).length&&this.startPolling(),this.listeners[t]||(this.listeners[t]=new Set,this._get(t)),this.listeners[t].add(e)}_removeListener(t,e){this.listeners[t]&&(this.listeners[t].delete(e),0===this.listeners[t].size&&delete this.listeners[t]),0===Object.keys(this.listeners).length&&this.stopPolling()}}gg.type="LOCAL";const mg=gg;new Rf(3e4,6e4);
2888
3001
  /**
2889
3002
  * @license
2890
3003
  * Copyright 2019 Google LLC
@@ -2901,7 +3014,7 @@ const Qd="firebaseLocalStorageDb",Jd="firebaseLocalStorage",Yd="fbase_key";class
2901
3014
  * See the License for the specific language governing permissions and
2902
3015
  * limitations under the License.
2903
3016
  */
2904
- class af extends yd{constructor(t){super("custom","custom"),this.params=t}_getIdTokenResponse(t){return _d(t,this._buildIdpRequest())}_linkToIdToken(t,e){return _d(t,this._buildIdpRequest(e))}_getReauthenticationResolver(t){return _d(t,this._buildIdpRequest())}_buildIdpRequest(t){const e={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 t&&(e.idToken=t),e}}function cf(t){return Pd(t.auth,new af(t),t.bypassAuthState)}function uf(t){const{auth:e,user:n}=t;return vl(n,e,"internal-error"),
3017
+ class yg extends kp{constructor(t){super("custom","custom"),this.params=t}_getIdTokenResponse(t){return Op(t,this._buildIdpRequest())}_linkToIdToken(t,e){return Op(t,this._buildIdpRequest(e))}_getReauthenticationResolver(t){return Op(t,this._buildIdpRequest())}_buildIdpRequest(t){const e={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 t&&(e.idToken=t),e}}function vg(t){return Wp(t.auth,new yg(t),t.bypassAuthState)}function wg(t){const{auth:e,user:n}=t;return Sf(n,e,"internal-error"),
2905
3018
  /**
2906
3019
  * @license
2907
3020
  * Copyright 2019 Google LLC
@@ -2918,7 +3031,7 @@ class af extends yd{constructor(t){super("custom","custom"),this.params=t}_getId
2918
3031
  * See the License for the specific language governing permissions and
2919
3032
  * limitations under the License.
2920
3033
  */
2921
- async function(t,e,n=!1){const{auth:s}=t,r="reauthenticate";try{const i=await Hl(t,Ld(s,r,e,t),n);vl(i.idToken,s,"internal-error");const o=Bl(i.idToken);vl(o,s,"internal-error");const{sub:a}=o;return vl(t.uid===a,s,"user-mismatch"),Rd._forOperation(t,r,i)}catch(t){throw"auth/user-not-found"===(null==t?void 0:t.code)&&gl(s,"user-mismatch"),t}}(n,new af(t),t.bypassAuthState)}async function hf(t){const{auth:e,user:n}=t;return vl(n,e,"internal-error"),async function(t,e,n=!1){const s=await Hl(t,e._linkToIdToken(t.auth,await t.getIdToken()),n);return Rd._forOperation(t,"link",s)}(n,new af(t),t.bypassAuthState)}
3034
+ async function(t,e,n=!1){const{auth:r}=t,s="reauthenticate";try{const i=await qf(t,Kp(r,s,e,t),n);Sf(i.idToken,r,"internal-error");const o=$f(i.idToken);Sf(o,r,"internal-error");const{sub:a}=o;return Sf(t.uid===a,r,"user-mismatch"),jp._forOperation(t,s,i)}catch(t){throw"auth/user-not-found"===(null==t?void 0:t.code)&&_f(r,"user-mismatch"),t}}(n,new yg(t),t.bypassAuthState)}async function _g(t){const{auth:e,user:n}=t;return Sf(n,e,"internal-error"),async function(t,e,n=!1){const r=await qf(t,e._linkToIdToken(t.auth,await t.getIdToken()),n);return jp._forOperation(t,"link",r)}(n,new yg(t),t.bypassAuthState)}
2922
3035
  /**
2923
3036
  * @license
2924
3037
  * Copyright 2020 Google LLC
@@ -2934,7 +3047,7 @@ async function(t,e,n=!1){const{auth:s}=t,r="reauthenticate";try{const i=await Hl
2934
3047
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2935
3048
  * See the License for the specific language governing permissions and
2936
3049
  * limitations under the License.
2937
- */class lf{constructor(t,e,n,s,r=!1){this.auth=t,this.resolver=n,this.user=s,this.bypassAuthState=r,this.pendingPromise=null,this.eventManager=null,this.filter=Array.isArray(e)?e:[e]}execute(){return new Promise((async(t,e)=>{this.pendingPromise={resolve:t,reject:e};try{this.eventManager=await this.resolver._initialize(this.auth),await this.onExecution(),this.eventManager.registerConsumer(this)}catch(t){this.reject(t)}}))}async onAuthEvent(t){const{urlResponse:e,sessionId:n,postBody:s,tenantId:r,error:i,type:o}=t;if(i)return void this.reject(i);const a={auth:this.auth,requestUri:e,sessionId:n,tenantId:r||void 0,postBody:s||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(o)(a))}catch(t){this.reject(t)}}onError(t){this.reject(t)}getIdpTask(t){switch(t){case"signInViaPopup":case"signInViaRedirect":return cf;case"linkViaPopup":case"linkViaRedirect":return hf;case"reauthViaPopup":case"reauthViaRedirect":return uf;default:gl(this.auth,"internal-error")}}resolve(t){_l(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(t),this.unregisterAndCleanUp()}reject(t){_l(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.reject(t),this.unregisterAndCleanUp()}unregisterAndCleanUp(){this.eventManager&&this.eventManager.unregisterConsumer(this),this.pendingPromise=null,this.cleanUp()}}
3050
+ */class Tg{constructor(t,e,n,r,s=!1){this.auth=t,this.resolver=n,this.user=r,this.bypassAuthState=s,this.pendingPromise=null,this.eventManager=null,this.filter=Array.isArray(e)?e:[e]}execute(){return new Promise((async(t,e)=>{this.pendingPromise={resolve:t,reject:e};try{this.eventManager=await this.resolver._initialize(this.auth),await this.onExecution(),this.eventManager.registerConsumer(this)}catch(t){this.reject(t)}}))}async onAuthEvent(t){const{urlResponse:e,sessionId:n,postBody:r,tenantId:s,error:i,type:o}=t;if(i)return void this.reject(i);const a={auth:this.auth,requestUri:e,sessionId:n,tenantId:s||void 0,postBody:r||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(o)(a))}catch(t){this.reject(t)}}onError(t){this.reject(t)}getIdpTask(t){switch(t){case"signInViaPopup":case"signInViaRedirect":return vg;case"linkViaPopup":case"linkViaRedirect":return _g;case"reauthViaPopup":case"reauthViaRedirect":return wg;default:_f(this.auth,"internal-error")}}resolve(t){bf(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(t),this.unregisterAndCleanUp()}reject(t){bf(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.reject(t),this.unregisterAndCleanUp()}unregisterAndCleanUp(){this.eventManager&&this.eventManager.unregisterConsumer(this),this.pendingPromise=null,this.cleanUp()}}
2938
3051
  /**
2939
3052
  * @license
2940
3053
  * Copyright 2020 Google LLC
@@ -2950,7 +3063,7 @@ async function(t,e,n=!1){const{auth:s}=t,r="reauthenticate";try{const i=await Hl
2950
3063
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2951
3064
  * See the License for the specific language governing permissions and
2952
3065
  * limitations under the License.
2953
- */const df=new Al(2e3,1e4);class ff extends lf{constructor(t,e,n,s,r){super(t,e,s,r),this.provider=n,this.authWindow=null,this.pollId=null,ff.currentPopupAction&&ff.currentPopupAction.cancel(),ff.currentPopupAction=this}async executeNotNull(){const t=await this.execute();return vl(t,this.auth,"internal-error"),t}async onExecution(){_l(1===this.filter.length,"Popup operations only handle one event");const t=Gd();this.authWindow=await this.resolver._openPopup(this.auth,this.provider,this.filter[0],t),this.authWindow.associatedEvent=t,this.resolver._originValidation(this.auth).catch((t=>{this.reject(t)})),this.resolver._isIframeWebStorageSupported(this.auth,(t=>{t||this.reject(ml(this.auth,"web-storage-unsupported"))})),this.pollUserCancellation()}get eventId(){var t;return(null===(t=this.authWindow)||void 0===t?void 0:t.associatedEvent)||null}cancel(){this.reject(ml(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,ff.currentPopupAction=null}pollUserCancellation(){const t=()=>{var e,n;(null===(n=null===(e=this.authWindow)||void 0===e?void 0:e.window)||void 0===n?void 0:n.closed)?this.pollId=window.setTimeout((()=>{this.pollId=null,this.reject(ml(this.auth,"popup-closed-by-user"))}),2e3):this.pollId=window.setTimeout(t,df.get())};t()}}ff.currentPopupAction=null;
3066
+ */const Eg=new Rf(2e3,1e4);class Sg extends Tg{constructor(t,e,n,r,s){super(t,e,r,s),this.provider=n,this.authWindow=null,this.pollId=null,Sg.currentPopupAction&&Sg.currentPopupAction.cancel(),Sg.currentPopupAction=this}async executeNotNull(){const t=await this.execute();return Sf(t,this.auth,"internal-error"),t}async onExecution(){bf(1===this.filter.length,"Popup operations only handle one event");const t=rg();this.authWindow=await this.resolver._openPopup(this.auth,this.provider,this.filter[0],t),this.authWindow.associatedEvent=t,this.resolver._originValidation(this.auth).catch((t=>{this.reject(t)})),this.resolver._isIframeWebStorageSupported(this.auth,(t=>{t||this.reject(Tf(this.auth,"web-storage-unsupported"))})),this.pollUserCancellation()}get eventId(){var t;return(null===(t=this.authWindow)||void 0===t?void 0:t.associatedEvent)||null}cancel(){this.reject(Tf(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,Sg.currentPopupAction=null}pollUserCancellation(){const t=()=>{var e,n;(null===(n=null===(e=this.authWindow)||void 0===e?void 0:e.window)||void 0===n?void 0:n.closed)?this.pollId=window.setTimeout((()=>{this.pollId=null,this.reject(Tf(this.auth,"popup-closed-by-user"))}),8e3):this.pollId=window.setTimeout(t,Eg.get())};t()}}Sg.currentPopupAction=null;
2954
3067
  /**
2955
3068
  * @license
2956
3069
  * Copyright 2020 Google LLC
@@ -2967,7 +3080,7 @@ async function(t,e,n=!1){const{auth:s}=t,r="reauthenticate";try{const i=await Hl
2967
3080
  * See the License for the specific language governing permissions and
2968
3081
  * limitations under the License.
2969
3082
  */
2970
- const pf="pendingRedirect",gf=new Map;class mf extends lf{constructor(t,e,n=!1){super(t,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],e,void 0,n),this.eventId=null}async execute(){let t=gf.get(this.auth._key());if(!t){try{const e=await async function(t,e){const n=function(t){return Jl(pf,t.config.apiKey,t.name)}(e),s=function(t){return Il(t._redirectPersistence)}(t);if(!await s._isAvailable())return!1;const r="true"===await s._get(n);return await s._remove(n),r}(this.resolver,this.auth)?await super.execute():null;t=()=>Promise.resolve(e)}catch(e){t=()=>Promise.reject(e)}gf.set(this.auth._key(),t)}return this.bypassAuthState||gf.set(this.auth._key(),(()=>Promise.resolve(null))),t()}async onAuthEvent(t){if("signInViaRedirect"===t.type)return super.onAuthEvent(t);if("unknown"!==t.type){if(t.eventId){const e=await this.auth._redirectUserForId(t.eventId);if(e)return this.user=e,super.onAuthEvent(t);this.resolve(null)}}else this.resolve(null)}async onExecution(){}cleanUp(){}}function yf(t,e){gf.set(t._key(),e)}async function vf(t,e,n=!1){const s=dd(t),r=
3083
+ const Ig="pendingRedirect",bg=new Map;class Ag extends Tg{constructor(t,e,n=!1){super(t,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],e,void 0,n),this.eventId=null}async execute(){let t=bg.get(this.auth._key());if(!t){try{const e=await async function(t,e){const n=function(t){return ep(Ig,t.config.apiKey,t.name)}(e),r=function(t){return Xf(t._redirectPersistence)}(t);if(!await r._isAvailable())return!1;const s="true"===await r._get(n);return await r._remove(n),s}(this.resolver,this.auth)?await super.execute():null;t=()=>Promise.resolve(e)}catch(e){t=()=>Promise.reject(e)}bg.set(this.auth._key(),t)}return this.bypassAuthState||bg.set(this.auth._key(),(()=>Promise.resolve(null))),t()}async onAuthEvent(t){if("signInViaRedirect"===t.type)return super.onAuthEvent(t);if("unknown"!==t.type){if(t.eventId){const e=await this.auth._redirectUserForId(t.eventId);if(e)return this.user=e,super.onAuthEvent(t);this.resolve(null)}}else this.resolve(null)}async onExecution(){}cleanUp(){}}function Cg(t,e){bg.set(t._key(),e)}async function kg(t,e,n=!1){const r=Sp(t),s=
2971
3084
  /**
2972
3085
  * @license
2973
3086
  * Copyright 2021 Google LLC
@@ -2984,7 +3097,7 @@ const pf="pendingRedirect",gf=new Map;class mf extends lf{constructor(t,e,n=!1){
2984
3097
  * See the License for the specific language governing permissions and
2985
3098
  * limitations under the License.
2986
3099
  */
2987
- function(t,e){return e?Il(e):(vl(t._popupRedirectResolver,t,"argument-error"),t._popupRedirectResolver)}(s,e),i=new mf(s,r,n),o=await i.execute();return o&&!n&&(delete o.user._redirectEventId,await s._persistUserIfCurrent(o.user),await s._setRedirectUser(null,e)),o}
3100
+ function(t,e){return e?Xf(e):(Sf(t._popupRedirectResolver,t,"argument-error"),t._popupRedirectResolver)}(r,e),i=new Ag(r,s,n),o=await i.execute();return o&&!n&&(delete o.user._redirectEventId,await r._persistUserIfCurrent(o.user),await r._setRedirectUser(null,e)),o}
2988
3101
  /**
2989
3102
  * @license
2990
3103
  * Copyright 2020 Google LLC
@@ -3000,7 +3113,7 @@ function(t,e){return e?Il(e):(vl(t._popupRedirectResolver,t,"argument-error"),t.
3000
3113
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3001
3114
  * See the License for the specific language governing permissions and
3002
3115
  * limitations under the License.
3003
- */class wf{constructor(t){this.auth=t,this.cachedEventUids=new Set,this.consumers=new Set,this.queuedRedirectEvent=null,this.hasHandledPotentialRedirect=!1,this.lastProcessedEventTime=Date.now()}registerConsumer(t){this.consumers.add(t),this.queuedRedirectEvent&&this.isEventForConsumer(this.queuedRedirectEvent,t)&&(this.sendToConsumer(this.queuedRedirectEvent,t),this.saveEventToCache(this.queuedRedirectEvent),this.queuedRedirectEvent=null)}unregisterConsumer(t){this.consumers.delete(t)}onEvent(t){if(this.hasEventBeenHandled(t))return!1;let e=!1;return this.consumers.forEach((n=>{this.isEventForConsumer(t,n)&&(e=!0,this.sendToConsumer(t,n),this.saveEventToCache(t))})),this.hasHandledPotentialRedirect||!function(t){switch(t.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return Tf(t);default:return!1}}
3116
+ */class Rg{constructor(t){this.auth=t,this.cachedEventUids=new Set,this.consumers=new Set,this.queuedRedirectEvent=null,this.hasHandledPotentialRedirect=!1,this.lastProcessedEventTime=Date.now()}registerConsumer(t){this.consumers.add(t),this.queuedRedirectEvent&&this.isEventForConsumer(this.queuedRedirectEvent,t)&&(this.sendToConsumer(this.queuedRedirectEvent,t),this.saveEventToCache(this.queuedRedirectEvent),this.queuedRedirectEvent=null)}unregisterConsumer(t){this.consumers.delete(t)}onEvent(t){if(this.hasEventBeenHandled(t))return!1;let e=!1;return this.consumers.forEach((n=>{this.isEventForConsumer(t,n)&&(e=!0,this.sendToConsumer(t,n),this.saveEventToCache(t))})),this.hasHandledPotentialRedirect||!function(t){switch(t.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return Dg(t);default:return!1}}
3004
3117
  /**
3005
3118
  * @license
3006
3119
  * Copyright 2020 Google LLC
@@ -3016,7 +3129,7 @@ function(t,e){return e?Il(e):(vl(t._popupRedirectResolver,t,"argument-error"),t.
3016
3129
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3017
3130
  * See the License for the specific language governing permissions and
3018
3131
  * limitations under the License.
3019
- */(t)||(this.hasHandledPotentialRedirect=!0,e||(this.queuedRedirectEvent=t,e=!0)),e}sendToConsumer(t,e){var n;if(t.error&&!Tf(t)){const s=(null===(n=t.error.code)||void 0===n?void 0:n.split("auth/")[1])||"internal-error";e.onError(ml(this.auth,s))}else e.onAuthEvent(t)}isEventForConsumer(t,e){const n=null===e.eventId||!!t.eventId&&t.eventId===e.eventId;return e.filter.includes(t.type)&&n}hasEventBeenHandled(t){return Date.now()-this.lastProcessedEventTime>=6e5&&this.cachedEventUids.clear(),this.cachedEventUids.has(_f(t))}saveEventToCache(t){this.cachedEventUids.add(_f(t)),this.lastProcessedEventTime=Date.now()}}function _f(t){return[t.type,t.eventId,t.sessionId,t.tenantId].filter((t=>t)).join("-")}function Tf({type:t,error:e}){return"unknown"===t&&"auth/no-auth-event"===(null==e?void 0:e.code)}
3132
+ */(t)||(this.hasHandledPotentialRedirect=!0,e||(this.queuedRedirectEvent=t,e=!0)),e}sendToConsumer(t,e){var n;if(t.error&&!Dg(t)){const r=(null===(n=t.error.code)||void 0===n?void 0:n.split("auth/")[1])||"internal-error";e.onError(Tf(this.auth,r))}else e.onAuthEvent(t)}isEventForConsumer(t,e){const n=null===e.eventId||!!t.eventId&&t.eventId===e.eventId;return e.filter.includes(t.type)&&n}hasEventBeenHandled(t){return Date.now()-this.lastProcessedEventTime>=6e5&&this.cachedEventUids.clear(),this.cachedEventUids.has(Ng(t))}saveEventToCache(t){this.cachedEventUids.add(Ng(t)),this.lastProcessedEventTime=Date.now()}}function Ng(t){return[t.type,t.eventId,t.sessionId,t.tenantId].filter((t=>t)).join("-")}function Dg({type:t,error:e}){return"unknown"===t&&"auth/no-auth-event"===(null==e?void 0:e.code)}
3020
3133
  /**
3021
3134
  * @license
3022
3135
  * Copyright 2020 Google LLC
@@ -3033,7 +3146,7 @@ function(t,e){return e?Il(e):(vl(t._popupRedirectResolver,t,"argument-error"),t.
3033
3146
  * See the License for the specific language governing permissions and
3034
3147
  * limitations under the License.
3035
3148
  */
3036
- const If=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,Ef=/^https?/;async function Sf(t){if(t.config.emulator)return;const{authorizedDomains:e}=await async function(t,e={}){return Dl(t,"GET","/v1/projects",e)}(t);for(const t of e)try{if(bf(t))return}catch(t){}gl(t,"unauthorized-domain")}function bf(t){const e=El(),{protocol:n,hostname:s}=new URL(e);if(t.startsWith("chrome-extension://")){const r=new URL(t);return""===r.hostname&&""===s?"chrome-extension:"===n&&t.replace("chrome-extension://","")===e.replace("chrome-extension://",""):"chrome-extension:"===n&&r.hostname===s}if(!Ef.test(n))return!1;if(If.test(t))return s===t;const r=t.replace(/\./g,"\\.");return new RegExp("^(.+\\."+r+"|"+r+")$","i").test(s)}
3149
+ const Og=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,Lg=/^https?/;async function Pg(t){if(t.config.emulator)return;const{authorizedDomains:e}=await async function(t,e={}){return Mf(t,"GET","/v1/projects",e)}(t);for(const t of e)try{if(Mg(t))return}catch(t){}_f(t,"unauthorized-domain")}function Mg(t){const e=Af(),{protocol:n,hostname:r}=new URL(e);if(t.startsWith("chrome-extension://")){const s=new URL(t);return""===s.hostname&&""===r?"chrome-extension:"===n&&t.replace("chrome-extension://","")===e.replace("chrome-extension://",""):"chrome-extension:"===n&&s.hostname===r}if(!Lg.test(n))return!1;if(Og.test(t))return r===t;const s=t.replace(/\./g,"\\.");return new RegExp("^(.+\\."+s+"|"+s+")$","i").test(r)}
3037
3150
  /**
3038
3151
  * @license
3039
3152
  * Copyright 2020 Google LLC.
@@ -3049,7 +3162,7 @@ const If=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,Ef=/^https?/;async function Sf(t
3049
3162
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3050
3163
  * See the License for the specific language governing permissions and
3051
3164
  * limitations under the License.
3052
- */const Af=new Al(3e4,6e4);function Cf(){const t=zd().___jsl;if(null==t?void 0:t.H)for(const e of Object.keys(t.H))if(t.H[e].r=t.H[e].r||[],t.H[e].L=t.H[e].L||[],t.H[e].r=[...t.H[e].L],t.CP)for(let e=0;e<t.CP.length;e++)t.CP[e]=null}function kf(t){return new Promise(((e,n)=>{var s,r,i;function o(){Cf(),gapi.load("gapi.iframes",{callback:()=>{e(gapi.iframes.getContext())},ontimeout:()=>{Cf(),n(ml(t,"network-request-failed"))},timeout:Af.get()})}if(null===(r=null===(s=zd().gapi)||void 0===s?void 0:s.iframes)||void 0===r?void 0:r.Iframe)e(gapi.iframes.getContext());else{if(!(null===(i=zd().gapi)||void 0===i?void 0:i.load)){const e=`__${"iframefcb"}${Math.floor(1e6*Math.random())}`;return zd()[e]=()=>{gapi.load?o():n(ml(t,"network-request-failed"))},of(`https://apis.google.com/js/api.js?onload=${e}`).catch((t=>n(t)))}o()}})).catch((t=>{throw Nf=null,t}))}let Nf=null;
3165
+ */const xg=new Rf(3e4,6e4);function Ug(){const t=ig().___jsl;if(null==t?void 0:t.H)for(const e of Object.keys(t.H))if(t.H[e].r=t.H[e].r||[],t.H[e].L=t.H[e].L||[],t.H[e].r=[...t.H[e].L],t.CP)for(let e=0;e<t.CP.length;e++)t.CP[e]=null}function Fg(t){return new Promise(((e,n)=>{var r,s,i;function o(){Ug(),gapi.load("gapi.iframes",{callback:()=>{e(gapi.iframes.getContext())},ontimeout:()=>{Ug(),n(Tf(t,"network-request-failed"))},timeout:xg.get()})}if(null===(s=null===(r=ig().gapi)||void 0===r?void 0:r.iframes)||void 0===s?void 0:s.Iframe)e(gapi.iframes.getContext());else{if(!(null===(i=ig().gapi)||void 0===i?void 0:i.load)){const e=`__${"iframefcb"}${Math.floor(1e6*Math.random())}`;return ig()[e]=()=>{gapi.load?o():n(Tf(t,"network-request-failed"))},vp(`https://apis.google.com/js/api.js?onload=${e}`).catch((t=>n(t)))}o()}})).catch((t=>{throw Vg=null,t}))}let Vg=null;
3053
3166
  /**
3054
3167
  * @license
3055
3168
  * Copyright 2020 Google LLC.
@@ -3066,7 +3179,7 @@ const If=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,Ef=/^https?/;async function Sf(t
3066
3179
  * See the License for the specific language governing permissions and
3067
3180
  * limitations under the License.
3068
3181
  */
3069
- const Rf=new Al(5e3,15e3),Of={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},Df=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function Lf(t){const e=t.config;vl(e.authDomain,t,"auth-domain-config-required");const n=e.emulator?Cl(e,"emulator/auth/iframe"):`https://${t.config.authDomain}/__/auth/iframe`,s={apiKey:e.apiKey,appName:t.name,v:ct},r=Df.get(t.config.apiHost);r&&(s.eid=r);const i=t._getFrameworks();return i.length&&(s.fw=i.join(",")),`${n}?${y(s).slice(1)}`}async function Pf(t){const e=await function(t){return Nf=Nf||kf(t),Nf}(t),n=zd().gapi;return vl(n,t,"internal-error"),e.open({where:document.body,url:Lf(t),messageHandlersFilter:n.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:Of,dontclear:!0},(e=>new Promise((async(n,s)=>{await e.restyle({setHideOnLeave:!1});const r=ml(t,"network-request-failed"),i=zd().setTimeout((()=>{s(r)}),Rf.get());function o(){zd().clearTimeout(i),n(e)}e.ping(o).then(o,(()=>{s(r)}))}))))}
3182
+ const Bg=new Rf(5e3,15e3),Hg="__/auth/iframe",jg="emulator/auth/iframe",$g={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},qg=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function Kg(t){const e=t.config;Sf(e.authDomain,t,"auth-domain-config-required");const n=e.emulator?Nf(e,jg):`https://${t.config.authDomain}/${Hg}`,r={apiKey:e.apiKey,appName:t.name,v:Pt},s=qg.get(t.config.apiHost);s&&(r.eid=s);const i=t._getFrameworks();return i.length&&(r.fw=i.join(",")),`${n}?${v(r).slice(1)}`}async function Wg(t){const e=await function(t){return Vg=Vg||Fg(t),Vg}(t),n=ig().gapi;return Sf(n,t,"internal-error"),e.open({where:document.body,url:Kg(t),messageHandlersFilter:n.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:$g,dontclear:!0},(e=>new Promise((async(n,r)=>{await e.restyle({setHideOnLeave:!1});const s=Tf(t,"network-request-failed"),i=ig().setTimeout((()=>{r(s)}),Bg.get());function o(){ig().clearTimeout(i),n(e)}e.ping(o).then(o,(()=>{r(s)}))}))))}
3070
3183
  /**
3071
3184
  * @license
3072
3185
  * Copyright 2020 Google LLC.
@@ -3082,7 +3195,7 @@ const Rf=new Al(5e3,15e3),Of={style:{position:"absolute",top:"-100px",width:"1px
3082
3195
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3083
3196
  * See the License for the specific language governing permissions and
3084
3197
  * limitations under the License.
3085
- */const Mf={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"};class xf{constructor(t){this.window=t,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch(t){}}}function Uf(t,e,n,s=500,r=600){const i=Math.max((window.screen.availHeight-r)/2,0).toString(),a=Math.max((window.screen.availWidth-s)/2,0).toString();let c="";const u=Object.assign(Object.assign({},Mf),{width:s.toString(),height:r.toString(),top:i,left:a}),h=o().toLowerCase();n&&(c=ed(h)?"_blank":n),Zl(h)&&(e=e||"http://localhost",u.scrollbars="yes");const l=Object.entries(u).reduce(((t,[e,n])=>`${t}${e}=${n},`),"");if(function(t=o()){var e;return od(t)&&!!(null===(e=window.navigator)||void 0===e?void 0:e.standalone)}(h)&&"_self"!==c)return function(t,e){const n=document.createElement("a");n.href=t,n.target=e;const s=document.createEvent("MouseEvent");s.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),n.dispatchEvent(s)}
3198
+ */const Gg={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"};class zg{constructor(t){this.window=t,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch(t){}}}function Qg(t,e,n,r=500,s=600){const i=Math.max((window.screen.availHeight-s)/2,0).toString(),o=Math.max((window.screen.availWidth-r)/2,0).toString();let a="";const c=Object.assign(Object.assign({},Gg),{width:r.toString(),height:s.toString(),top:i,left:o}),u=d().toLowerCase();n&&(a=op(u)?"_blank":n),sp(u)&&(e=e||"http://localhost",c.scrollbars="yes");const h=Object.entries(c).reduce(((t,[e,n])=>`${t}${e}=${n},`),"");if(function(t=d()){var e;return lp(t)&&!!(null===(e=window.navigator)||void 0===e?void 0:e.standalone)}(u)&&"_self"!==a)return function(t,e){const n=document.createElement("a");n.href=t,n.target=e;const r=document.createEvent("MouseEvent");r.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),n.dispatchEvent(r)}
3086
3199
  /**
3087
3200
  * @license
3088
3201
  * Copyright 2021 Google LLC
@@ -3098,7 +3211,7 @@ const Rf=new Al(5e3,15e3),Of={style:{position:"absolute",top:"-100px",width:"1px
3098
3211
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3099
3212
  * See the License for the specific language governing permissions and
3100
3213
  * limitations under the License.
3101
- */(e||"",c),new xf(null);const d=window.open(e||"",c,l);vl(d,t,"popup-blocked");try{d.focus()}catch(t){}return new xf(d)}const Ff="__/auth/handler",Vf="emulator/auth/handler";function Bf(t,e,n,s,r,i){vl(t.config.authDomain,t,"auth-domain-config-required"),vl(t.config.apiKey,t,"invalid-api-key");const o={apiKey:t.config.apiKey,appName:t.name,authType:n,redirectUrl:s,v:ct,eventId:r};if(e instanceof Sd){e.setDefaultLanguage(t.languageCode),o.providerId=e.providerId||"",function(t){for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0}(e.getCustomParameters())||(o.customParameters=JSON.stringify(e.getCustomParameters()));for(const[t,e]of Object.entries(i||{}))o[t]=e}if(e instanceof bd){const t=e.getScopes().filter((t=>""!==t));t.length>0&&(o.scopes=t.join(","))}t.tenantId&&(o.tid=t.tenantId);const a=o;for(const t of Object.keys(a))void 0===a[t]&&delete a[t];return`${function({config:t}){if(!t.emulator)return`https://${t.authDomain}/${Ff}`;return Cl(t,Vf)}
3214
+ */(e||"",a),new zg(null);const l=window.open(e||"",a,h);Sf(l,t,"popup-blocked");try{l.focus()}catch(t){}return new zg(l)}const Yg="__/auth/handler",Jg="emulator/auth/handler",Xg=encodeURIComponent("fac");async function Zg(t,e,n,r,s,i){Sf(t.config.authDomain,t,"auth-domain-config-required"),Sf(t.config.apiKey,t,"invalid-api-key");const o={apiKey:t.config.apiKey,appName:t.name,authType:n,redirectUrl:r,v:Pt,eventId:s};if(e instanceof xp){e.setDefaultLanguage(t.languageCode),o.providerId=e.providerId||"",function(t){for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0}(e.getCustomParameters())||(o.customParameters=JSON.stringify(e.getCustomParameters()));for(const[t,e]of Object.entries(i||{}))o[t]=e}if(e instanceof Up){const t=e.getScopes().filter((t=>""!==t));t.length>0&&(o.scopes=t.join(","))}t.tenantId&&(o.tid=t.tenantId);const a=o;for(const t of Object.keys(a))void 0===a[t]&&delete a[t];const c=await t._getAppCheckToken(),u=c?`#${Xg}=${encodeURIComponent(c)}`:"";return`${function({config:t}){if(!t.emulator)return`https://${t.authDomain}/${Yg}`;return Nf(t,Jg)}
3102
3215
  /**
3103
3216
  * @license
3104
3217
  * Copyright 2020 Google LLC
@@ -3114,7 +3227,7 @@ const Rf=new Al(5e3,15e3),Of={style:{position:"absolute",top:"-100px",width:"1px
3114
3227
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3115
3228
  * See the License for the specific language governing permissions and
3116
3229
  * limitations under the License.
3117
- */(t)}?${y(a).slice(1)}`}const Hf="webStorageSupport";const jf=class{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=qd,this._completeRedirectFn=vf,this._overrideRedirectResult=yf}async _openPopup(t,e,n,s){var r;_l(null===(r=this.eventManagers[t._key()])||void 0===r?void 0:r.manager,"_initialize() not called before _openPopup()");return Uf(t,Bf(t,e,n,El(),s),Gd())}async _openRedirect(t,e,n,s){var r;return await this._originValidation(t),r=Bf(t,e,n,El(),s),zd().location.href=r,new Promise((()=>{}))}_initialize(t){const e=t._key();if(this.eventManagers[e]){const{manager:t,promise:n}=this.eventManagers[e];return t?Promise.resolve(t):(_l(n,"If manager is not set, promise should be"),n)}const n=this.initAndGetManager(t);return this.eventManagers[e]={promise:n},n.catch((()=>{delete this.eventManagers[e]})),n}async initAndGetManager(t){const e=await Pf(t),n=new wf(t);return e.register("authEvent",(e=>{vl(null==e?void 0:e.authEvent,t,"invalid-auth-event");return{status:n.onEvent(e.authEvent)?"ACK":"ERROR"}}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[t._key()]={manager:n},this.iframes[t._key()]=e,n}_isIframeWebStorageSupported(t,e){this.iframes[t._key()].send(Hf,{type:Hf},(n=>{var s;const r=null===(s=null==n?void 0:n[0])||void 0===s?void 0:s[Hf];void 0!==r&&e(!!r),gl(t,"internal-error")}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(t){const e=t._key();return this.originValidationPromises[e]||(this.originValidationPromises[e]=Sf(t)),this.originValidationPromises[e]}get _shouldInitProactively(){return cd()||td()||od()}};var qf="@firebase/auth",Kf="0.21.0";
3230
+ */(t)}?${v(a).slice(1)}${u}`}const tm="webStorageSupport";const em=class{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=eg,this._completeRedirectFn=kg,this._overrideRedirectResult=Cg}async _openPopup(t,e,n,r){var s;bf(null===(s=this.eventManagers[t._key()])||void 0===s?void 0:s.manager,"_initialize() not called before _openPopup()");return Qg(t,await Zg(t,e,n,Af(),r),rg())}async _openRedirect(t,e,n,r){await this._originValidation(t);return function(t){ig().location.href=t}(await Zg(t,e,n,Af(),r)),new Promise((()=>{}))}_initialize(t){const e=t._key();if(this.eventManagers[e]){const{manager:t,promise:n}=this.eventManagers[e];return t?Promise.resolve(t):(bf(n,"If manager is not set, promise should be"),n)}const n=this.initAndGetManager(t);return this.eventManagers[e]={promise:n},n.catch((()=>{delete this.eventManagers[e]})),n}async initAndGetManager(t){const e=await Wg(t),n=new Rg(t);return e.register("authEvent",(e=>{Sf(null==e?void 0:e.authEvent,t,"invalid-auth-event");return{status:n.onEvent(e.authEvent)?"ACK":"ERROR"}}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[t._key()]={manager:n},this.iframes[t._key()]=e,n}_isIframeWebStorageSupported(t,e){this.iframes[t._key()].send(tm,{type:tm},(n=>{var r;const s=null===(r=null==n?void 0:n[0])||void 0===r?void 0:r[tm];void 0!==s&&e(!!s),_f(t,"internal-error")}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(t){const e=t._key();return this.originValidationPromises[e]||(this.originValidationPromises[e]=Pg(t)),this.originValidationPromises[e]}get _shouldInitProactively(){return fp()||ip()||lp()}};var nm="@firebase/auth",rm="0.23.2";
3118
3231
  /**
3119
3232
  * @license
3120
3233
  * Copyright 2020 Google LLC
@@ -3131,7 +3244,7 @@ const Rf=new Al(5e3,15e3),Of={style:{position:"absolute",top:"-100px",width:"1px
3131
3244
  * See the License for the specific language governing permissions and
3132
3245
  * limitations under the License.
3133
3246
  */
3134
- class Gf{constructor(t){this.auth=t,this.internalListeners=new Map}getUid(){var t;return this.assertAuthConfigured(),(null===(t=this.auth.currentUser)||void 0===t?void 0:t.uid)||null}async getToken(t){if(this.assertAuthConfigured(),await this.auth._initializationPromise,!this.auth.currentUser)return null;return{accessToken:await this.auth.currentUser.getIdToken(t)}}addAuthTokenListener(t){if(this.assertAuthConfigured(),this.internalListeners.has(t))return;const e=this.auth.onIdTokenChanged((e=>{t((null==e?void 0:e.stsTokenManager.accessToken)||null)}));this.internalListeners.set(t,e),this.updateProactiveRefresh()}removeAuthTokenListener(t){this.assertAuthConfigured();const e=this.internalListeners.get(t);e&&(this.internalListeners.delete(t),e(),this.updateProactiveRefresh())}assertAuthConfigured(){vl(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}}
3247
+ class sm{constructor(t){this.auth=t,this.internalListeners=new Map}getUid(){var t;return this.assertAuthConfigured(),(null===(t=this.auth.currentUser)||void 0===t?void 0:t.uid)||null}async getToken(t){if(this.assertAuthConfigured(),await this.auth._initializationPromise,!this.auth.currentUser)return null;return{accessToken:await this.auth.currentUser.getIdToken(t)}}addAuthTokenListener(t){if(this.assertAuthConfigured(),this.internalListeners.has(t))return;const e=this.auth.onIdTokenChanged((e=>{t((null==e?void 0:e.stsTokenManager.accessToken)||null)}));this.internalListeners.set(t,e),this.updateProactiveRefresh()}removeAuthTokenListener(t){this.assertAuthConfigured();const e=this.internalListeners.get(t);e&&(this.internalListeners.delete(t),e(),this.updateProactiveRefresh())}assertAuthConfigured(){Sf(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}}
3135
3248
  /**
3136
3249
  * @license
3137
3250
  * Copyright 2020 Google LLC
@@ -3164,5 +3277,5 @@ class Gf{constructor(t){this.auth=t,this.internalListeners=new Map}getUid(){var
3164
3277
  * See the License for the specific language governing permissions and
3165
3278
  * limitations under the License.
3166
3279
  */
3167
- const Wf=h("authIdTokenMaxAge")||300;let zf=null;function $f(t=ht()){const e=it(t,"auth");if(e.isInitialized())return e.getImmediate();const n=function(t,e){const n=it(t,"auth");if(n.isInitialized()){const t=n.getImmediate();if(g(n.getOptions(),null!=e?e:{}))return t;gl(t,"already-initialized")}return n.initialize({options:e})}(t,{popupRedirectResolver:jf,persistence:[rf,Hd,qd]}),s=h("authTokenSyncURL");if(s){const t=(r=s,async t=>{const e=t&&await t.getIdTokenResult(),n=e&&((new Date).getTime()-Date.parse(e.issuedAtTime))/1e3;if(n&&n>Wf)return;const s=null==e?void 0:e.token;zf!==s&&(zf=s,await fetch(r,{method:s?"POST":"DELETE",headers:s?{Authorization:`Bearer ${s}`}:{}}))});!function(t,e,n){I(t).beforeAuthStateChanged(e,n)}(n,t,(()=>t(n.currentUser))),function(t,e,n,s){I(t).onIdTokenChanged(e,n,s)}(n,(e=>t(e)))}var r;const i=u("auth");return i&&pd(n,`http://${i}`),n}var Qf;Qf="Browser",rt(new E("auth",((t,{options:e})=>{const n=t.getProvider("app").getImmediate(),s=t.getProvider("heartbeat"),{apiKey:r,authDomain:i}=n.options;return((t,n)=>{vl(r&&!r.includes(":"),"invalid-api-key",{appName:t.name}),vl(!(null==i?void 0:i.includes(":")),"argument-error",{appName:t.name});const s={apiKey:r,authDomain:i,clientPlatform:Qf,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:ud(Qf)},o=new ld(t,n,s);return function(t,e){const n=(null==e?void 0:e.persistence)||[],s=(Array.isArray(n)?n:[n]).map(Il);(null==e?void 0:e.errorMap)&&t._updateErrorMap(e.errorMap),t._initializeWithPersistence(s,null==e?void 0:e.popupRedirectResolver)}(o,e),o})(n,s)}),"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback(((t,e,n)=>{t.getProvider("auth-internal").initialize()}))),rt(new E("auth-internal",(t=>(t=>new Gf(t))(dd(t.getProvider("auth").getImmediate()))),"PRIVATE").setInstantiationMode("EXPLICIT")),lt(qf,Kf,function(t){switch(t){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";default:return}}(Qf)),lt(qf,Kf,"esm2017");class Jf extends Error{constructor(){super("Avatar not created"),this.name="AvatarNotCreatedError"}}class Yf extends Error{constructor(){super("user not logged in"),this.name="UserNotLoggedInError"}}class Xf extends Error{constructor(){super("no colorway size assets found"),this.name="NoColorwaySizeAssetsFoundError"}}const Zf="avatar not created";var tp=Object.freeze({__proto__:null,AvatarNotCreatedError:Jf,UserNotLoggedInError:Yf,NoColorwaySizeAssetsFoundError:Xf,AvatarNotCreated:Zf});class ep{constructor(t,e){this.firestore=t,this.brandUserId=null,this.auth=$f(e),this.auth.setPersistence(Hd)}get id(){var t;return null===(t=this.user)||void 0===t?void 0:t.uid}onInit(){return new Promise((t=>{const e=this.auth.onAuthStateChanged((n=>{this.setUser(n),t(Boolean(n)),e()}))}))}setUser(t){this.user=t}setBrandUserId(t){this.brandUserId=t}async getToken(){var t;if(!(null===(t=this.user)||void 0===t?void 0:t.uid))throw new Yf;return await this.user.getIdToken()}async getUserProfile(){var t;if(!(null===(t=this.user)||void 0===t?void 0:t.uid))throw new Yf;return(await tl(dh(this.firestore,"users",this.id))).data()}watchUserProfileForChanges(t){let e;const n=Hh(lh(this.firestore,"users"),qh(new Sh("__name__"),"==",this.id));return e=sl(n,(e=>t(e.docs[0].data()))),()=>e()}async login(t,e){this.auth.currentUser&&await this.auth.signOut();const n=await Ud(this.auth,t,e);this.setUser(n.user)}async logout(){await this.auth.signOut(),this.setUser(null)}async sendPasswordResetEmail(t){await Md(this.auth,t)}async confirmPasswordReset(t,e){await xd(this.auth,t,e)}}class np{constructor(){this.promisefyOnSnapshot=(t,e)=>{let n;return{promise:new Promise((s=>{n=sl(t,(t=>{s(t),e&&n()}))})),unsubscribe:()=>n()}};const t=ut(il.getInstance().firebase);this.firestore=_h(t),this.user=new ep(this.firestore,t)}onInit(){return this.user.onInit()}query(t,e,n=!0){const s=Hh(lh(this.firestore,t),e);return this.promisefyOnSnapshot(s,n)}getDocs(t,e){return nl(Hh(lh(this.firestore,t),...e))}async getDoc(t,e){const n=dh(this.firestore,t,e),s=await tl(n);return s.exists()?s.data():null}}const sp=t=>{if(t.code===dl)throw new Error("account has been disabled");throw new Error(t.message)};class rp{static get endpoint(){return il.getInstance().api.url}static async Fetch({user:t,endpointPath:e,method:n,body:s,useToken:r=!0}){const i=this.getUrl(e,r),o={method:n,headers:await this.getHeaders(t,r),credentials:"include"};s&&(o.body=JSON.stringify(s));const a=await fetch(i,o);if(a.ok)return a;if(500===a.status)throw new Error(a.statusText);const c=await a.json();return Promise.reject(c)}static getUrl(t,e){return e?`${this.endpoint}/v1${t}`:this.endpoint+t}static async getHeaders(t,e){if(!e)return{"Content-Type":"application/json"};return{"Content-Type":"application/json",Authorization:`Bearer ${await t.getToken()}`}}static Get(t,e,n){return this.Fetch({user:t,endpointPath:e,method:"GET",body:null,useToken:n})}static Post(t,e,n=null,s){return this.Fetch({user:t,endpointPath:e,method:"POST",body:n,useToken:s})}static Put(t,e,n,s){return this.Fetch({user:t,endpointPath:e,method:"PUT",body:n,useToken:s})}static Patch(t,e,n,s){return this.Fetch({user:t,endpointPath:e,method:"PATCH",body:n,useToken:s})}static Delete(t,e,n,s){return this.Fetch({user:t,endpointPath:e,method:"DELETE",body:n,useToken:s})}}class ip{constructor(t,e){this.brandId=t,this.firebase=e,this.measurementLocations=new Map}get user(){return this.firebase.user}get isLoggedIn(){return!this.firebase||Boolean(this.user.id)}async onInit(){return await this.getMeasurementLocations(),this.firebase.onInit()}async getRecommendedSizes(t){var e,n;if(!this.isLoggedIn)throw new Yf;try{const s=await rp.Get(this.user,`/styles/${t}/recommendation`),r=await s.json();return(null===(e=null==r?void 0:r.fits)||void 0===e?void 0:e.length)&&(null===(n=null==r?void 0:r.recommended_size)||void 0===n?void 0:n.id)?r:null}catch(t){if((null==t?void 0:t.error)===Zf)throw new Jf;throw t}}async submitTelephoneNumber(t){const e=t.replace(/[^\+0-9]/g,""),n=await rp.Post(this.user,"/ios-app-link",{phone_number:e},!1);console.log(n)}async getColorwaySizeAssetFromSku(t){const e=await this.getColorwaySizeAssets(null,[t]);if(!(null==e?void 0:e.size))throw new Xf;return Array.from(e.values())[0]}async getMeasurementLocationsFromSku(t,e=[]){const n=await this.getColorwaySizeAssetFromSku(t);if(!n)throw new Error("No colorway size asset found for sku");const s=await this.getStyle(n.style_id);if(!s)throw new Error("Style category not found for style id");const r=await this.getGetTaxonomy(s.style_garment_category_id);if(!r)throw new Error("Taxonomy not found for style garment category id");return(e.length?r.garment_measurement_locations.female.filter((t=>e.includes(t))):r.garment_measurement_locations.female).map((t=>this.measurementLocations.has(t)?this.measurementLocations.get(t):t))}async getStyleByBrandStyleId(t){var e,n;try{const s=[qh("brand_id","==",this.brandId)];s.push(qh("brand_style_id","==",t));return null===(n=null===(e=(await this.firebase.getDocs("styles",s)).docs)||void 0===e?void 0:e[0])||void 0===n?void 0:n.data()}catch(t){return sp(t)}}async getColorwaySizeAssets(t,e){const n=[qh("brand_id","==",this.brandId)];t&&n.push(qh("style_id","==",t)),(null==e?void 0:e.length)>0&&n.push(qh("sku","in",e));try{const t=await this.firebase.getDocs("colorway_size_assets",n),e=new Map;return t.forEach((t=>{const n=t.data();e.set(n.id,n)})),e}catch(t){return sp(t)}}async getStyle(t){try{return await this.firebase.getDoc("styles",String(t))}catch(t){return sp(t)}}async getGetTaxonomy(t){try{return await this.firebase.getDoc("style_garment_categories",String(t))}catch(t){return sp(t)}}async getMeasurementLocations(){(await this.fetchMeasurementLocations()).forEach((t=>{this.measurementLocations.set(t.name,t.label)}))}async fetchMeasurementLocations(){try{return(await this.firebase.getDocs("garment_measurement_locations",[])).docs.map((t=>t.data()))}catch(t){return sp(t)}}}const op=(t,e="dev")=>("dev"!==e&&"development"!==e||console.warn("TfrShop is in development mode"),il.getInstance().setEnv(e),new ip(t,new np));var ap;!function(t){t.ACROSS_BACK="across_back",t.ACROSS_FRONT="across_front",t.ACROSS_SHOULDER="across_shoulder",t.ANKLE="ankle",t.ARMEYE="arm_eye",t.ARM_LENGTH_FROM_SHOULDER="arm_length_from_shoulder",t.BACK_CROTCH_LENGTH="back_crotch_length",t.BACK_NECK_TO_EBLOW="back_neck_to_elbow",t.BELOW_KNEE="below_knee",t.BICEP="bicep",t.BUST="bust",t.BUST_POINT_TO_BUST_POINT="bust_point_to_bust_point",t.CALF="calf",t.CB_NECK_TO_WAIST="cb_neck_to_waist",t.CB_NECK_TO_WRIST="cb_neck_to_wrist",t.CF_NECK_TO_WAIST="cf_neck_to_waist",t.ELBOW="elbow",t.FOREARM="forearm",t.FRONT_CROTCH_LENGTH="front_crotch_length",t.HIGH_HIP_PLACEMENT_FROM_WAIST="high_hip_placement",t.HIGH_HIP="high_hip",t.HSP_TO_ACROSS_BACK="hsp_to_across_back",t.HSP_TO_ACROSS_FRONT="hsp_to_across_front",t.HSP_TO_BUST_POINT="hsp_to_bust_point",t.HSP_TO_LOW_HIP_POSITION="hsp_to_low_hip_position",t.HSP_TO_WAIST_POSITION="hsp_to_waist_position",t.INSEAM="inseam",t.KNEE="knee",t.LOW_HIP="low_hip",t.LOW_HIP_PLACEMENT_FROM_WAIST="low_hip_placement",t.MID_NECK="mid_neck",t.NECK_AT_BASE="neck_base",t.SHOULDER_DROP="shoulder_drop",t.SHOULDER_TO_SHOULDER="shoulder_to_shoulder",t.SIDE_WAIST_TO_FLOOR="side_waist_to_floor",t.SIDE_WAIST_TO_KNEE="side_waist_to_knee",t.THIGH="thigh",t.TOTAL_RISE_LENGTH="total_rise_length",t.UNDER_BUST="under_bust",t.VERTICAL_TRUNK="vertical_trunk",t.WAIST="waist",t.WRIST="wrist"}(ap||(ap={}));const cp={[ap.ACROSS_BACK]:"Across back",[ap.ACROSS_FRONT]:"Across front",[ap.ACROSS_SHOULDER]:"Across shoulder",[ap.ANKLE]:"Ankle",[ap.ARMEYE]:"Armeye",[ap.ARM_LENGTH_FROM_SHOULDER]:"Arm length from shoulder",[ap.BACK_CROTCH_LENGTH]:"Back crotch length",[ap.BACK_NECK_TO_EBLOW]:"Back neck to eblow",[ap.BELOW_KNEE]:"Below knee",[ap.BICEP]:"Bicep",[ap.BUST]:"Chest/Bust",[ap.BUST_POINT_TO_BUST_POINT]:"Bust point to bust point",[ap.CALF]:"Calf",[ap.CB_NECK_TO_WAIST]:"Cb neck to waist",[ap.CB_NECK_TO_WRIST]:"Cb neck to wrist",[ap.CF_NECK_TO_WAIST]:"Cf neck to waist",[ap.ELBOW]:"Elbow",[ap.FOREARM]:"Forearm",[ap.FRONT_CROTCH_LENGTH]:"Front crotch length",[ap.HIGH_HIP_PLACEMENT_FROM_WAIST]:"High hip placement from waist",[ap.HIGH_HIP]:"High hip",[ap.HSP_TO_ACROSS_BACK]:"Hsp to across back",[ap.HSP_TO_ACROSS_FRONT]:"Hsp to across front",[ap.HSP_TO_BUST_POINT]:"Hsp to bust point",[ap.HSP_TO_LOW_HIP_POSITION]:"Hsp to low hip position",[ap.HSP_TO_WAIST_POSITION]:"Hsp to waist position",[ap.INSEAM]:"Inseam",[ap.KNEE]:"Knee",[ap.LOW_HIP]:"Low hip",[ap.LOW_HIP_PLACEMENT_FROM_WAIST]:"Low hip placement from waist",[ap.MID_NECK]:"Mid neck",[ap.NECK_AT_BASE]:"Neck at base",[ap.SHOULDER_DROP]:"Shoulder drop",[ap.SHOULDER_TO_SHOULDER]:"Shoulder to shoulder",[ap.SIDE_WAIST_TO_FLOOR]:"Side waist to floor",[ap.SIDE_WAIST_TO_KNEE]:"Side waist to knee",[ap.THIGH]:"Thigh",[ap.TOTAL_RISE_LENGTH]:"Total rise length",[ap.UNDER_BUST]:"Under bust",[ap.VERTICAL_TRUNK]:"Vertical trunk",[ap.WAIST]:"Waist",[ap.WRIST]:"Wrist"};var up;!function(t){t.BLOUSES="blouses",t.COATS="coats",t.DRESSES="dresses",t.JACKETS="jackets",t.PANTS="pants",t.PUFFERS_AND_PARKAS="puffer_and_parkas",t.SHORTS="shorts",t.SKIRTS="skirts",t.SWEATERS="sweaters",t.T_SHIRTS_AND_TANKS="t_shirts_and_tanks"}(up||(up={}));const hp={[up.BLOUSES]:[ap.BUST,ap.ACROSS_SHOULDER,ap.WAIST,ap.LOW_HIP,ap.HIGH_HIP],[up.COATS]:[ap.BUST,ap.ACROSS_SHOULDER,ap.WAIST,ap.LOW_HIP,ap.HIGH_HIP],[up.DRESSES]:[ap.LOW_HIP,ap.BUST,ap.ACROSS_SHOULDER,ap.WAIST],[up.JACKETS]:[ap.BUST,ap.ACROSS_SHOULDER,ap.WAIST,ap.LOW_HIP,ap.HIGH_HIP],[up.PANTS]:[ap.LOW_HIP,ap.WAIST,ap.THIGH,ap.INSEAM],[up.PUFFERS_AND_PARKAS]:[ap.BUST,ap.ACROSS_SHOULDER,ap.WAIST,ap.LOW_HIP,ap.HIGH_HIP],[up.SHORTS]:[ap.LOW_HIP,ap.WAIST,ap.THIGH,ap.INSEAM],[up.SKIRTS]:[ap.LOW_HIP,ap.WAIST],[up.SWEATERS]:[ap.BUST,ap.ACROSS_SHOULDER,ap.WAIST,ap.LOW_HIP,ap.HIGH_HIP],[up.T_SHIRTS_AND_TANKS]:[ap.BUST,ap.ACROSS_SHOULDER,ap.WAIST,ap.LOW_HIP,ap.HIGH_HIP]},lp={activewear:"Active Wear",dresses:"Dresses",jackets_and_coats:"Jackets and Coats",jeans:"Jeans",jumpsuits_and_rompers:"Jumpsuits and Rompers",pants_and_shorts:"Pants and Shorts",skirts:"Skirts",suits_and_tailoring:"Suits and Tailoring",sweaters:"Sweaters",tops:"Tops"},dp={a_line:"A Line",a_line_flared:"A Line Flared",blazers:"Blazers",bodycon:"Bodycon",bodysuits:"Bodysuits",boiler_suits:"Boiler Suits",bootcut:"Bootcut",cardigans:"Cardigans",cigarette:"Cigarette",corsets_and_bustiers:"Corsets and Bustiers",crewnecks:"Crewnecks",culottes:"Culottes",denim:"Denim",denim_jackets:"Denim Jackets",denim_shorts:"Denim Shorts",fit_and_flare:"Fit and Flare",flared:"Flared",hoodies_and_zipups:"Hoodies and Zipups",joggers:"Joggers",jumpsuits:"Jumpsuits",knit:"Knit",leggings:"Leggings",mom:"Mom",overalls:"Overalls",parkas:"Parkas",peacoats:"Peacoats",pencil:"Pencil",pleated:"Pleated",polos:"Polos",puffer_jackets:"Puffer Jackets",raincoats:"Raincoats",relaxed:"Relaxed",rompers:"Rompers",shackets:"Shackets",shirt:"Shirt",shirts_and_blouses:"Shirts and Blouses",skater:"Skater",skinny:"Skinny",slim:"Slim",slip:"Slip",sports_bras:"Sports Bras",straight:"Straight",suit_jackets:"Suit Jackets",suit_skirts:"Suit Skirts",suit_trousers:"Suit Trousers",suit_vests:"Suit Vests",sweatshirts:"Sweatshirts",t_shirts:"T-Shirts",tank_tops_and_camisoles:"Tank Tops and Camisoles",tapered:"Tapered",trench_coats:"Trench Coats",trousers:"Trousers",turtlenecks:"Turtleneck",unitards:"Unitards",v_necks:"V-Necks",wide_leg:"Wide Leg",wrap:"Wrap"},fp={activewear:{leggings:up.PANTS,joggers:up.PANTS,sweatshirts:up.SWEATERS},dresses:{a_line:up.DRESSES,bodycon:up.DRESSES,fit_and_flare:up.DRESSES,knit:up.DRESSES,shirt:up.DRESSES,slip:up.DRESSES,straight:up.DRESSES,wrap:up.DRESSES},jackets_and_coats:{denim_jackets:up.JACKETS,parkas:up.PUFFERS_AND_PARKAS,peacoats:up.COATS,puffer_jackets:up.PUFFERS_AND_PARKAS,raincoats:up.COATS,rompers:up.COATS,shackets:up.JACKETS,trench_coats:up.COATS},jeans:{bootcut:up.PANTS,flared:up.PANTS,mom:up.PANTS,relaxed:up.PANTS,skinny:up.PANTS,slim:up.PANTS,straight:up.PANTS,tapered:up.PANTS,wide_leg:up.PANTS},jumpsuits_and_rompers:{boiler_suits:up.DRESSES,denim:up.DRESSES,jumpsuits:up.DRESSES,overalls:up.DRESSES,rompers:up.DRESSES,unitards:up.DRESSES},pants_and_shorts:{cigarette:up.PANTS,culottes:up.SHORTS,denim_shorts:up.SHORTS,flared:up.PANTS,joggers:up.PANTS,leggings:up.PANTS,skinny:up.PANTS,wide_leg:up.PANTS},skirts:{a_line_flared:up.SKIRTS,denim:up.SKIRTS,knit:up.SKIRTS,pencil:up.SKIRTS,pleated:up.SKIRTS,skater:up.SKIRTS,slip:up.SKIRTS,wrap:up.SKIRTS},suits_and_tailoring:{blazers:up.JACKETS,suit_jackets:up.JACKETS,suit_skirts:up.SKIRTS,suit_trousers:up.PANTS,suit_vests:up.SWEATERS,trousers:up.PANTS},sweaters:{cardigans:up.SWEATERS,crewnecks:up.SWEATERS,hoodies_and_zipups:up.SWEATERS,sweatshirts:up.SWEATERS,turtlenecks:up.SWEATERS,v_necks:up.SWEATERS},tops:{bodysuits:up.BLOUSES,corsets_and_bustiers:up.BLOUSES,polos:up.T_SHIRTS_AND_TANKS,shirts_and_blouses:up.BLOUSES,t_shirts:up.T_SHIRTS_AND_TANKS,tank_tops_and_camisoles:up.T_SHIRTS_AND_TANKS}};var pp;!function(t){t.TOO_TIGHT="too_tight",t.TIGHT="tight",t.SLIGHTLY_TIGHT="slightly_tight",t.PERFECT_FIT="perfect_fit",t.SLIGHTLY_LOOSE="slightly_loose",t.LOOSE="loose",t.OVERSIZED="oversized",t.TOO_SHORT="too_short",t.SHORT="short",t.SLIGHTLY_SHORT="slightly_short",t.SLIGHTLY_LONG="slightly_long",t.LONG="long",t.TOO_LONG="too_long"}(pp||(pp={}));const gp={[pp.TOO_TIGHT]:"Too Tight",[pp.TIGHT]:"Tight",[pp.SLIGHTLY_TIGHT]:"Slightly Tight",[pp.PERFECT_FIT]:"Perfect Fit",[pp.SLIGHTLY_LOOSE]:"Slightly Loose",[pp.LOOSE]:"Loose",[pp.OVERSIZED]:"Oversized",[pp.TOO_SHORT]:"Too Short",[pp.SHORT]:"Short",[pp.SLIGHTLY_SHORT]:"Slightly Short",[pp.SLIGHTLY_LONG]:"Slightly Long",[pp.LONG]:"Long",[pp.TOO_LONG]:"Too Long"};var mp;!function(t){t.NOT_CREATED="NOT_CREATED",t.CREATED="CREATED",t.PENDING="PENDING"}(mp||(mp={}));var yp=Object.freeze({__proto__:null,get AvatarState(){return mp},get MeasurementLocation(){return ap},MeasurementLocationName:cp,get Classification(){return up},ClassificationLocations:hp,CategoryNames:lp,Categories:["activewear","dresses","jackets_and_coats","jeans","jumpsuits_and_rompers","pants_and_shorts","skirts","suits_and_tailoring","sweaters","tops"],SubcategoryNames:dp,Taxonomy:fp,get Fit(){return pp},FitNames:gp});export{tp as Errors,op as initShop,t as requests,e as responses,yp as types};
3280
+ const im=h("authIdTokenMaxAge")||300;let om=null;function am(t=xt()){const e=Dt(t,"auth");if(e.isInitialized())return e.getImmediate();const n=function(t,e){const n=Dt(t,"auth");if(n.isInitialized()){const t=n.getImmediate();if(m(n.getOptions(),null!=e?e:{}))return t;_f(t,"already-initialized")}return n.initialize({options:e})}(t,{popupRedirectResolver:em,persistence:[mg,Zp,eg]}),r=h("authTokenSyncURL");if(r){const t=(s=r,async t=>{const e=t&&await t.getIdTokenResult(),n=e&&((new Date).getTime()-Date.parse(e.issuedAtTime))/1e3;if(n&&n>im)return;const r=null==e?void 0:e.token;om!==r&&(om=r,await fetch(s,{method:r?"POST":"DELETE",headers:r?{Authorization:`Bearer ${r}`}:{}}))});!function(t,e,n){S(t).beforeAuthStateChanged(e,n)}(n,t,(()=>t(n.currentUser))),function(t,e,n,r){S(t).onIdTokenChanged(e,n,r)}(n,(e=>t(e)))}var s;const i=(t=>{var e,n;return null===(n=null===(e=c())||void 0===e?void 0:e.emulatorHosts)||void 0===n?void 0:n[t]})("auth");return i&&bp(n,`http://${i}`),n}var cm;cm="Browser",Nt(new I("auth",((t,{options:e})=>{const n=t.getProvider("app").getImmediate(),r=t.getProvider("heartbeat"),s=t.getProvider("app-check-internal"),{apiKey:i,authDomain:o}=n.options;Sf(i&&!i.includes(":"),"invalid-api-key",{appName:n.name});const a={apiKey:i,authDomain:o,clientPlatform:cm,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:pp(cm)},c=new Ep(n,r,s,a);return function(t,e){const n=(null==e?void 0:e.persistence)||[],r=(Array.isArray(n)?n:[n]).map(Xf);(null==e?void 0:e.errorMap)&&t._updateErrorMap(e.errorMap),t._initializeWithPersistence(r,null==e?void 0:e.popupRedirectResolver)}(c,e),c}),"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback(((t,e,n)=>{t.getProvider("auth-internal").initialize()}))),Nt(new I("auth-internal",(t=>(t=>new sm(t))(Sp(t.getProvider("auth").getImmediate()))),"PRIVATE").setInstantiationMode("EXPLICIT")),Ut(nm,rm,function(t){switch(t){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";default:return}}(cm)),Ut(nm,rm,"esm2017");class um extends Error{constructor(){super("Avatar not created"),this.name="AvatarNotCreatedError"}}class hm extends Error{constructor(){super("user not logged in"),this.name="UserNotLoggedInError"}}class lm extends Error{constructor(){super("no colorway size assets found"),this.name="NoColorwaySizeAssetsFoundError"}}const dm="avatar not created";var fm=Object.freeze({__proto__:null,AvatarNotCreatedError:um,UserNotLoggedInError:hm,NoColorwaySizeAssetsFoundError:lm,AvatarNotCreated:dm});class pm{constructor(t,e){this.firestore=t,this.brandUserId=null,this.auth=am(e),this.auth.setPersistence(Zp)}get id(){var t;return null===(t=this.user)||void 0===t?void 0:t.uid}onInit(t){return new Promise((e=>{const n=this.auth.onAuthStateChanged((r=>{this.setUser(r),e(Boolean(r)),n(),r&&this.logUserLogin(t,r)}))}))}setUser(t){this.user=t}async logUserLogin(t,e){var n,r,s,i,o;try{const a=Ll(this.firestore,"user_logging",e.uid),c=await Rd(a),u=new Date,h=c.exists?c.data():null,l=null===(r=null===(n=null==h?void 0:h.brands)||void 0===n?void 0:n[t])||void 0===r?void 0:r.last_login;if(l&&uf(u).diff(uf(1e3*l.seconds),"days")<=7)return;const d=null!==(o=null===(i=null===(s=null==h?void 0:h.brands)||void 0===s?void 0:s[t])||void 0===i?void 0:i.logins)&&void 0!==o?o:[];d.push(u);const f={brands:{[t]:{brand_id:t,last_login:u,logins:d}},last_brand_id:t,created_at:c.exists()?c.data().created_at:u,updated_at:u};await Od(a,f,{merge:!0})}catch(t){console.error("LOGGING ERROR:",t)}}setBrandUserId(t){this.brandUserId=t}async getToken(){var t;if(!(null===(t=this.user)||void 0===t?void 0:t.uid))throw new hm;return await this.user.getIdToken()}async getUserProfile(){var t;if(!(null===(t=this.user)||void 0===t?void 0:t.uid))throw new hm;return(await Rd(Ll(this.firestore,"users",this.id))).data()}watchUserProfileForChanges(t){let e;const n=md(Ol(this.firestore,"users"),vd(new Kl("__name__"),"==",this.id));return e=Ld(n,(e=>t(e.docs[0].data()))),()=>e()}async login(t,e){this.auth.currentUser&&await this.auth.signOut();const n=await Qp(this.auth,t,e);this.setUser(n.user)}async logout(){await this.auth.signOut(),this.setUser(null)}async sendPasswordResetEmail(t){await async function(t,e,n){var r;const s=Sp(t),i={requestType:"PASSWORD_RESET",email:e,clientType:"CLIENT_TYPE_WEB"};if(null===(r=s._getRecaptchaConfig())||void 0===r?void 0:r.emailPasswordEnabled){const t=await _p(s,i,"getOobCode",!0);n&&Gp(s,t,n),await Np(s,t)}else n&&Gp(s,i,n),await Np(s,i).catch((async t=>{if("auth/missing-recaptcha-token"!==t.code)return Promise.reject(t);{console.log("Password resets are protected by reCAPTCHA for this project. Automatically triggering the reCAPTCHA flow and restarting the password reset flow.");const t=await _p(s,i,"getOobCode",!0);n&&Gp(s,t,n),await Np(s,t)}}))}(this.auth,t)}async confirmPasswordReset(t,e){await zp(this.auth,t,e)}}class gm{constructor(){this.promisefyOnSnapshot=(t,e)=>{let n;return{promise:new Promise((r=>{n=Ld(t,(t=>{r(t),e&&n()}))})),unsubscribe:()=>n()}};const t=Mt(Md.getInstance().firebase);this.firestore=function(t,e){const n="string"==typeof t?t:e||"(default)",r=Dt("object"==typeof t?t:xt(),"firestore").getImmediate({identifier:n});if(!r._initialized){const t=ne("firestore");t&&kl(r,...t)}return r}(t),this.user=new pm(this.firestore,t)}onInit(t){return this.user.onInit(t)}query(t,e,n=!0){const r=md(Ol(this.firestore,t),e);return this.promisefyOnSnapshot(r,n)}getDocs(t,e){return Dd(md(Ol(this.firestore,t),...e))}async getDoc(t,e){const n=Ll(this.firestore,t,e),r=await Rd(n);return r.exists()?r.data():null}}const mm=t=>{if(t.code===yf)throw new Error("account has been disabled");throw new Error(t.message)};class ym{static get endpoint(){return Md.getInstance().api.url}static async Fetch({user:t,endpointPath:e,method:n,body:r,useToken:s=!0}){const i=this.getUrl(e,s),o={method:n,headers:await this.getHeaders(t,s),credentials:"include"};r&&(o.body=JSON.stringify(r));const a=await fetch(i,o);if(a.ok)return a;if(500===a.status)throw new Error(a.statusText);const c=await a.json();return Promise.reject(c)}static getUrl(t,e){return e?`${this.endpoint}/v1${t}`:this.endpoint+t}static async getHeaders(t,e){if(!e)return{"Content-Type":"application/json"};return{"Content-Type":"application/json",Authorization:`Bearer ${await t.getToken()}`}}static Get(t,e,n){return this.Fetch({user:t,endpointPath:e,method:"GET",body:null,useToken:n})}static Post(t,e,n=null,r){return this.Fetch({user:t,endpointPath:e,method:"POST",body:n,useToken:r})}static Put(t,e,n,r){return this.Fetch({user:t,endpointPath:e,method:"PUT",body:n,useToken:r})}static Patch(t,e,n,r){return this.Fetch({user:t,endpointPath:e,method:"PATCH",body:n,useToken:r})}static Delete(t,e,n,r){return this.Fetch({user:t,endpointPath:e,method:"DELETE",body:n,useToken:r})}}class vm{constructor(t,e){this.brandId=t,this.firebase=e,this.measurementLocations=new Map}get user(){return this.firebase.user}get isLoggedIn(){return!this.firebase||Boolean(this.user.id)}async onInit(){return await this.getMeasurementLocations(),this.firebase.onInit(this.brandId)}async getRecommendedSizes(t){var e,n;if(!this.isLoggedIn)throw new hm;try{const r=await ym.Get(this.user,`/styles/${t}/recommendation`),s=await r.json();return(null===(e=null==s?void 0:s.fits)||void 0===e?void 0:e.length)&&(null===(n=null==s?void 0:s.recommended_size)||void 0===n?void 0:n.id)?s:null}catch(t){if((null==t?void 0:t.error)===dm)throw new um;throw t}}async submitTelephoneNumber(t){const e=t.replace(/[^\+0-9]/g,""),n=await ym.Post(this.user,"/ios-app-link",{phone_number:e},!1);console.log(n)}async getColorwaySizeAssetFromSku(t){const e=await this.getColorwaySizeAssets(null,[t]);if(!(null==e?void 0:e.size))throw new lm;return Array.from(e.values())[0]}async getColorwaySizeAssetFromBrandStyleId(t){const e=await this.getColorwaySizeAssets(t);if(!(null==e?void 0:e.size))throw new lm;return Array.from(e.values())[0]}async getMeasurementLocationsFromSku(t,e=[]){const n=await this.getColorwaySizeAssetFromSku(t);if(!n)throw new Error("No colorway size asset found for sku");const r=await this.getStyle(n.style_id);if(!r)throw new Error("Style category not found for style id");const s=await this.getGetTaxonomy(r.style_garment_category_id);if(!s)throw new Error("Taxonomy not found for style garment category id");return(e.length?s.garment_measurement_locations.female.filter((t=>e.includes(t))):s.garment_measurement_locations.female).map((t=>this.measurementLocations.has(t)?this.measurementLocations.get(t):t))}async getMeasurementLocationsFromBrandStyleId(t,e=[]){const n=await this.getColorwaySizeAssetFromBrandStyleId(t);if(!n)throw new Error("No colorway size asset found for brand style id");const r=await this.getStyle(n.style_id);if(!r)throw new Error("Style category not found for style id");const s=await this.getGetTaxonomy(r.style_garment_category_id);if(!s)throw new Error("Taxonomy not found for style garment category id");return(e.length?s.garment_measurement_locations.female.filter((t=>e.includes(t))):s.garment_measurement_locations.female).map((t=>this.measurementLocations.has(t)?this.measurementLocations.get(t):t))}async getStyleByBrandStyleId(t){var e,n;try{const r=[vd("brand_id","==",this.brandId)];r.push(vd("brand_style_id","==",t));return null===(n=null===(e=(await this.firebase.getDocs("styles",r)).docs)||void 0===e?void 0:e[0])||void 0===n?void 0:n.data()}catch(t){return mm(t)}}async getColorwaySizeAssets(t,e){const n=[vd("brand_id","==",this.brandId)];t&&n.push(vd("style_id","==",t)),(null==e?void 0:e.length)>0&&n.push(vd("sku","in",e));try{const t=await this.firebase.getDocs("colorway_size_assets",n),e=new Map;return t.forEach((t=>{const n=t.data();e.set(n.id,n)})),e}catch(t){return mm(t)}}async getStyle(t){try{return await this.firebase.getDoc("styles",String(t))}catch(t){return mm(t)}}async getGetTaxonomy(t){try{return await this.firebase.getDoc("style_garment_categories",String(t))}catch(t){return mm(t)}}async getMeasurementLocations(){(await this.fetchMeasurementLocations()).forEach((t=>{this.measurementLocations.set(t.name,t.label)}))}async fetchMeasurementLocations(){try{return(await this.firebase.getDocs("garment_measurement_locations",[])).docs.map((t=>t.data()))}catch(t){return mm(t)}}}const wm=(t,e="dev")=>("dev"!==e&&"development"!==e||console.warn("TfrShop is in development mode"),Md.getInstance().setEnv(e),new vm(t,new gm));var _m;!function(t){t.ACROSS_BACK="across_back",t.ACROSS_FRONT="across_front",t.ACROSS_SHOULDER="across_shoulder",t.ANKLE="ankle",t.ARMEYE="arm_eye",t.ARM_LENGTH_FROM_SHOULDER="arm_length_from_shoulder",t.BACK_CROTCH_LENGTH="back_crotch_length",t.BACK_NECK_TO_EBLOW="back_neck_to_elbow",t.BELOW_KNEE="below_knee",t.BICEP="bicep",t.BUST="bust",t.BUST_POINT_TO_BUST_POINT="bust_point_to_bust_point",t.CALF="calf",t.CB_NECK_TO_WAIST="cb_neck_to_waist",t.CB_NECK_TO_WRIST="cb_neck_to_wrist",t.CF_NECK_TO_WAIST="cf_neck_to_waist",t.ELBOW="elbow",t.FOREARM="forearm",t.FRONT_CROTCH_LENGTH="front_crotch_length",t.HIGH_HIP_PLACEMENT_FROM_WAIST="high_hip_placement",t.HIGH_HIP="high_hip",t.HSP_TO_ACROSS_BACK="hsp_to_across_back",t.HSP_TO_ACROSS_FRONT="hsp_to_across_front",t.HSP_TO_BUST_POINT="hsp_to_bust_point",t.HSP_TO_LOW_HIP_POSITION="hsp_to_low_hip_position",t.HSP_TO_WAIST_POSITION="hsp_to_waist_position",t.INSEAM="inseam",t.KNEE="knee",t.LOW_HIP="low_hip",t.LOW_HIP_PLACEMENT_FROM_WAIST="low_hip_placement",t.MID_NECK="mid_neck",t.NECK_AT_BASE="neck_base",t.SHOULDER_DROP="shoulder_drop",t.SHOULDER_TO_SHOULDER="shoulder_to_shoulder",t.SIDE_WAIST_TO_FLOOR="side_waist_to_floor",t.SIDE_WAIST_TO_KNEE="side_waist_to_knee",t.THIGH="thigh",t.TOTAL_RISE_LENGTH="total_rise_length",t.UNDER_BUST="under_bust",t.VERTICAL_TRUNK="vertical_trunk",t.WAIST="waist",t.WRIST="wrist"}(_m||(_m={}));const Tm={[_m.ACROSS_BACK]:"Across back",[_m.ACROSS_FRONT]:"Across front",[_m.ACROSS_SHOULDER]:"Across shoulder",[_m.ANKLE]:"Ankle",[_m.ARMEYE]:"Armeye",[_m.ARM_LENGTH_FROM_SHOULDER]:"Arm length from shoulder",[_m.BACK_CROTCH_LENGTH]:"Back crotch length",[_m.BACK_NECK_TO_EBLOW]:"Back neck to eblow",[_m.BELOW_KNEE]:"Below knee",[_m.BICEP]:"Bicep",[_m.BUST]:"Chest/Bust",[_m.BUST_POINT_TO_BUST_POINT]:"Bust point to bust point",[_m.CALF]:"Calf",[_m.CB_NECK_TO_WAIST]:"Cb neck to waist",[_m.CB_NECK_TO_WRIST]:"Cb neck to wrist",[_m.CF_NECK_TO_WAIST]:"Cf neck to waist",[_m.ELBOW]:"Elbow",[_m.FOREARM]:"Forearm",[_m.FRONT_CROTCH_LENGTH]:"Front crotch length",[_m.HIGH_HIP_PLACEMENT_FROM_WAIST]:"High hip placement from waist",[_m.HIGH_HIP]:"High hip",[_m.HSP_TO_ACROSS_BACK]:"Hsp to across back",[_m.HSP_TO_ACROSS_FRONT]:"Hsp to across front",[_m.HSP_TO_BUST_POINT]:"Hsp to bust point",[_m.HSP_TO_LOW_HIP_POSITION]:"Hsp to low hip position",[_m.HSP_TO_WAIST_POSITION]:"Hsp to waist position",[_m.INSEAM]:"Inseam",[_m.KNEE]:"Knee",[_m.LOW_HIP]:"Low hip",[_m.LOW_HIP_PLACEMENT_FROM_WAIST]:"Low hip placement from waist",[_m.MID_NECK]:"Mid neck",[_m.NECK_AT_BASE]:"Neck at base",[_m.SHOULDER_DROP]:"Shoulder drop",[_m.SHOULDER_TO_SHOULDER]:"Shoulder to shoulder",[_m.SIDE_WAIST_TO_FLOOR]:"Side waist to floor",[_m.SIDE_WAIST_TO_KNEE]:"Side waist to knee",[_m.THIGH]:"Thigh",[_m.TOTAL_RISE_LENGTH]:"Total rise length",[_m.UNDER_BUST]:"Under bust",[_m.VERTICAL_TRUNK]:"Vertical trunk",[_m.WAIST]:"Waist",[_m.WRIST]:"Wrist"};var Em;!function(t){t.BLOUSES="blouses",t.COATS="coats",t.DRESSES="dresses",t.JACKETS="jackets",t.PANTS="pants",t.PUFFERS_AND_PARKAS="puffer_and_parkas",t.SHORTS="shorts",t.SKIRTS="skirts",t.SWEATERS="sweaters",t.T_SHIRTS_AND_TANKS="t_shirts_and_tanks"}(Em||(Em={}));const Sm={[Em.BLOUSES]:[_m.BUST,_m.ACROSS_SHOULDER,_m.WAIST,_m.LOW_HIP,_m.HIGH_HIP],[Em.COATS]:[_m.BUST,_m.ACROSS_SHOULDER,_m.WAIST,_m.LOW_HIP,_m.HIGH_HIP],[Em.DRESSES]:[_m.LOW_HIP,_m.BUST,_m.ACROSS_SHOULDER,_m.WAIST],[Em.JACKETS]:[_m.BUST,_m.ACROSS_SHOULDER,_m.WAIST,_m.LOW_HIP,_m.HIGH_HIP],[Em.PANTS]:[_m.LOW_HIP,_m.WAIST,_m.THIGH,_m.INSEAM],[Em.PUFFERS_AND_PARKAS]:[_m.BUST,_m.ACROSS_SHOULDER,_m.WAIST,_m.LOW_HIP,_m.HIGH_HIP],[Em.SHORTS]:[_m.LOW_HIP,_m.WAIST,_m.THIGH,_m.INSEAM],[Em.SKIRTS]:[_m.LOW_HIP,_m.WAIST],[Em.SWEATERS]:[_m.BUST,_m.ACROSS_SHOULDER,_m.WAIST,_m.LOW_HIP,_m.HIGH_HIP],[Em.T_SHIRTS_AND_TANKS]:[_m.BUST,_m.ACROSS_SHOULDER,_m.WAIST,_m.LOW_HIP,_m.HIGH_HIP]},Im={activewear:"Active Wear",dresses:"Dresses",jackets_and_coats:"Jackets and Coats",jeans:"Jeans",jumpsuits_and_rompers:"Jumpsuits and Rompers",pants_and_shorts:"Pants and Shorts",skirts:"Skirts",suits_and_tailoring:"Suits and Tailoring",sweaters:"Sweaters",tops:"Tops"},bm={a_line:"A Line",a_line_flared:"A Line Flared",blazers:"Blazers",bodycon:"Bodycon",bodysuits:"Bodysuits",boiler_suits:"Boiler Suits",bootcut:"Bootcut",cardigans:"Cardigans",cigarette:"Cigarette",corsets_and_bustiers:"Corsets and Bustiers",crewnecks:"Crewnecks",culottes:"Culottes",denim:"Denim",denim_jackets:"Denim Jackets",denim_shorts:"Denim Shorts",fit_and_flare:"Fit and Flare",flared:"Flared",hoodies_and_zipups:"Hoodies and Zipups",joggers:"Joggers",jumpsuits:"Jumpsuits",knit:"Knit",leggings:"Leggings",mom:"Mom",overalls:"Overalls",parkas:"Parkas",peacoats:"Peacoats",pencil:"Pencil",pleated:"Pleated",polos:"Polos",puffer_jackets:"Puffer Jackets",raincoats:"Raincoats",relaxed:"Relaxed",rompers:"Rompers",shackets:"Shackets",shirt:"Shirt",shirts_and_blouses:"Shirts and Blouses",skater:"Skater",skinny:"Skinny",slim:"Slim",slip:"Slip",sports_bras:"Sports Bras",straight:"Straight",suit_jackets:"Suit Jackets",suit_skirts:"Suit Skirts",suit_trousers:"Suit Trousers",suit_vests:"Suit Vests",sweatshirts:"Sweatshirts",t_shirts:"T-Shirts",tank_tops_and_camisoles:"Tank Tops and Camisoles",tapered:"Tapered",trench_coats:"Trench Coats",trousers:"Trousers",turtlenecks:"Turtleneck",unitards:"Unitards",v_necks:"V-Necks",wide_leg:"Wide Leg",wrap:"Wrap"},Am={activewear:{leggings:Em.PANTS,joggers:Em.PANTS,sweatshirts:Em.SWEATERS},dresses:{a_line:Em.DRESSES,bodycon:Em.DRESSES,fit_and_flare:Em.DRESSES,knit:Em.DRESSES,shirt:Em.DRESSES,slip:Em.DRESSES,straight:Em.DRESSES,wrap:Em.DRESSES},jackets_and_coats:{denim_jackets:Em.JACKETS,parkas:Em.PUFFERS_AND_PARKAS,peacoats:Em.COATS,puffer_jackets:Em.PUFFERS_AND_PARKAS,raincoats:Em.COATS,rompers:Em.COATS,shackets:Em.JACKETS,trench_coats:Em.COATS},jeans:{bootcut:Em.PANTS,flared:Em.PANTS,mom:Em.PANTS,relaxed:Em.PANTS,skinny:Em.PANTS,slim:Em.PANTS,straight:Em.PANTS,tapered:Em.PANTS,wide_leg:Em.PANTS},jumpsuits_and_rompers:{boiler_suits:Em.DRESSES,denim:Em.DRESSES,jumpsuits:Em.DRESSES,overalls:Em.DRESSES,rompers:Em.DRESSES,unitards:Em.DRESSES},pants_and_shorts:{cigarette:Em.PANTS,culottes:Em.SHORTS,denim_shorts:Em.SHORTS,flared:Em.PANTS,joggers:Em.PANTS,leggings:Em.PANTS,skinny:Em.PANTS,wide_leg:Em.PANTS},skirts:{a_line_flared:Em.SKIRTS,denim:Em.SKIRTS,knit:Em.SKIRTS,pencil:Em.SKIRTS,pleated:Em.SKIRTS,skater:Em.SKIRTS,slip:Em.SKIRTS,wrap:Em.SKIRTS},suits_and_tailoring:{blazers:Em.JACKETS,suit_jackets:Em.JACKETS,suit_skirts:Em.SKIRTS,suit_trousers:Em.PANTS,suit_vests:Em.SWEATERS,trousers:Em.PANTS},sweaters:{cardigans:Em.SWEATERS,crewnecks:Em.SWEATERS,hoodies_and_zipups:Em.SWEATERS,sweatshirts:Em.SWEATERS,turtlenecks:Em.SWEATERS,v_necks:Em.SWEATERS},tops:{bodysuits:Em.BLOUSES,corsets_and_bustiers:Em.BLOUSES,polos:Em.T_SHIRTS_AND_TANKS,shirts_and_blouses:Em.BLOUSES,t_shirts:Em.T_SHIRTS_AND_TANKS,tank_tops_and_camisoles:Em.T_SHIRTS_AND_TANKS}};var Cm;!function(t){t.TOO_TIGHT="too_tight",t.TIGHT="tight",t.SLIGHTLY_TIGHT="slightly_tight",t.PERFECT_FIT="perfect_fit",t.SLIGHTLY_LOOSE="slightly_loose",t.LOOSE="loose",t.OVERSIZED="oversized",t.TOO_SHORT="too_short",t.SHORT="short",t.SLIGHTLY_SHORT="slightly_short",t.SLIGHTLY_LONG="slightly_long",t.LONG="long",t.TOO_LONG="too_long"}(Cm||(Cm={}));const km={[Cm.TOO_TIGHT]:"Too Tight",[Cm.TIGHT]:"Tight",[Cm.SLIGHTLY_TIGHT]:"Slightly Tight",[Cm.PERFECT_FIT]:"Perfect Fit",[Cm.SLIGHTLY_LOOSE]:"Slightly Loose",[Cm.LOOSE]:"Loose",[Cm.OVERSIZED]:"Oversized",[Cm.TOO_SHORT]:"Too Short",[Cm.SHORT]:"Short",[Cm.SLIGHTLY_SHORT]:"Slightly Short",[Cm.SLIGHTLY_LONG]:"Slightly Long",[Cm.LONG]:"Long",[Cm.TOO_LONG]:"Too Long"};var Rm;!function(t){t.NOT_CREATED="NOT_CREATED",t.CREATED="CREATED",t.PENDING="PENDING"}(Rm||(Rm={}));var Nm=Object.freeze({__proto__:null,get AvatarState(){return Rm},get MeasurementLocation(){return _m},MeasurementLocationName:Tm,get Classification(){return Em},ClassificationLocations:Sm,CategoryNames:Im,Categories:["activewear","dresses","jackets_and_coats","jeans","jumpsuits_and_rompers","pants_and_shorts","skirts","suits_and_tailoring","sweaters","tops"],SubcategoryNames:bm,Taxonomy:Am,get Fit(){return Cm},FitNames:km});export{fm as Errors,wm as initShop,t as requests,e as responses,Nm as types};
3168
3281
  //# sourceMappingURL=index.min.js.map