@entropic-bond/firebase 1.13.4 → 1.13.6

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,4 +1,4 @@
1
- (function(ve,Qt){typeof exports=="object"&&typeof module<"u"?Qt(exports):typeof define=="function"&&define.amd?define(["exports"],Qt):(ve=typeof globalThis<"u"?globalThis:ve||self,Qt(ve["entropic-bond-firebase"]={}))})(this,function(ve){"use strict";/**
1
+ (function(Te,Jt){typeof exports=="object"&&typeof module<"u"?Jt(exports):typeof define=="function"&&define.amd?define(["exports"],Jt):(Te=typeof globalThis<"u"?globalThis:Te||self,Jt(Te["entropic-bond-firebase"]={}))})(this,function(Te){"use strict";/**
2
2
  * @license
3
3
  * Copyright 2017 Google LLC
4
4
  *
@@ -28,7 +28,7 @@
28
28
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
29
29
  * See the License for the specific language governing permissions and
30
30
  * limitations under the License.
31
- */const Qt=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++]=s&63|128):(s&64512)===55296&&r+1<t.length&&(t.charCodeAt(r+1)&64512)===56320?(s=65536+((s&1023)<<10)+(t.charCodeAt(++r)&1023),e[n++]=s>>18|240,e[n++]=s>>12&63|128,e[n++]=s>>6&63|128,e[n++]=s&63|128):(e[n++]=s>>12|224,e[n++]=s>>6&63|128,e[n++]=s&63|128)}return e},Df=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((s&31)<<6|i&63)}else if(s>239&&s<365){const i=t[n++],o=t[n++],a=t[n++],c=((s&7)<<18|(i&63)<<12|(o&63)<<6|a&63)-65536;e[r++]=String.fromCharCode(55296+(c>>10)),e[r++]=String.fromCharCode(56320+(c&1023))}else{const i=t[n++],o=t[n++];e[r++]=String.fromCharCode((s&15)<<12|(i&63)<<6|o&63)}}return e.join("")},ec={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:typeof atob=="function",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 s=0;s<t.length;s+=3){const i=t[s],o=s+1<t.length,a=o?t[s+1]:0,c=s+2<t.length,u=c?t[s+2]:0,l=i>>2,h=(i&3)<<4|a>>4;let d=(a&15)<<2|u>>6,f=u&63;c||(f=64,o||(d=64)),r.push(n[l],n[h],n[d],n[f])}return r.join("")},encodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(t):this.encodeByteArray(Qt(t),e)},decodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(t):Df(this.decodeStringToByteArray(t,e))},decodeStringToByteArray(t,e){this.init_();const n=e?this.charToByteMapWebSafe_:this.charToByteMap_,r=[];for(let s=0;s<t.length;){const i=n[t.charAt(s++)],a=s<t.length?n[t.charAt(s)]:0;++s;const u=s<t.length?n[t.charAt(s)]:64;++s;const h=s<t.length?n[t.charAt(s)]:64;if(++s,i==null||a==null||u==null||h==null)throw new Nf;const d=i<<2|a>>4;if(r.push(d),u!==64){const f=a<<4&240|u>>2;if(r.push(f),h!==64){const E=u<<6&192|h;r.push(E)}}}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 Nf extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const Of=function(t){const e=Qt(t);return ec.encodeByteArray(e,!0)},Br=function(t){return Of(t).replace(/\./g,"")},tc=function(t){try{return ec.decodeString(t,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};/**
31
+ */const Jt=function(n){const e=[];let t=0;for(let r=0;r<n.length;r++){let s=n.charCodeAt(r);s<128?e[t++]=s:s<2048?(e[t++]=s>>6|192,e[t++]=s&63|128):(s&64512)===55296&&r+1<n.length&&(n.charCodeAt(r+1)&64512)===56320?(s=65536+((s&1023)<<10)+(n.charCodeAt(++r)&1023),e[t++]=s>>18|240,e[t++]=s>>12&63|128,e[t++]=s>>6&63|128,e[t++]=s&63|128):(e[t++]=s>>12|224,e[t++]=s>>6&63|128,e[t++]=s&63|128)}return e},Wf=function(n){const e=[];let t=0,r=0;for(;t<n.length;){const s=n[t++];if(s<128)e[r++]=String.fromCharCode(s);else if(s>191&&s<224){const i=n[t++];e[r++]=String.fromCharCode((s&31)<<6|i&63)}else if(s>239&&s<365){const i=n[t++],o=n[t++],a=n[t++],c=((s&7)<<18|(i&63)<<12|(o&63)<<6|a&63)-65536;e[r++]=String.fromCharCode(55296+(c>>10)),e[r++]=String.fromCharCode(56320+(c&1023))}else{const i=n[t++],o=n[t++];e[r++]=String.fromCharCode((s&15)<<12|(i&63)<<6|o&63)}}return e.join("")},cc={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:typeof atob=="function",encodeByteArray(n,e){if(!Array.isArray(n))throw Error("encodeByteArray takes an array as a parameter");this.init_();const t=e?this.byteToCharMapWebSafe_:this.byteToCharMap_,r=[];for(let s=0;s<n.length;s+=3){const i=n[s],o=s+1<n.length,a=o?n[s+1]:0,c=s+2<n.length,u=c?n[s+2]:0,l=i>>2,h=(i&3)<<4|a>>4;let d=(a&15)<<2|u>>6,f=u&63;c||(f=64,o||(d=64)),r.push(t[l],t[h],t[d],t[f])}return r.join("")},encodeString(n,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(n):this.encodeByteArray(Jt(n),e)},decodeString(n,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(n):Wf(this.decodeStringToByteArray(n,e))},decodeStringToByteArray(n,e){this.init_();const t=e?this.charToByteMapWebSafe_:this.charToByteMap_,r=[];for(let s=0;s<n.length;){const i=t[n.charAt(s++)],a=s<n.length?t[n.charAt(s)]:0;++s;const u=s<n.length?t[n.charAt(s)]:64;++s;const h=s<n.length?t[n.charAt(s)]:64;if(++s,i==null||a==null||u==null||h==null)throw new Gf;const d=i<<2|a>>4;if(r.push(d),u!==64){const f=a<<4&240|u>>2;if(r.push(f),h!==64){const E=u<<6&192|h;r.push(E)}}}return r},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let n=0;n<this.ENCODED_VALS.length;n++)this.byteToCharMap_[n]=this.ENCODED_VALS.charAt(n),this.charToByteMap_[this.byteToCharMap_[n]]=n,this.byteToCharMapWebSafe_[n]=this.ENCODED_VALS_WEBSAFE.charAt(n),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[n]]=n,n>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(n)]=n,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(n)]=n)}}};class Gf extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const Kf=function(n){const e=Jt(n);return cc.encodeByteArray(e,!0)},Hr=function(n){return Kf(n).replace(/\./g,"")},uc=function(n){try{return cc.decodeString(n,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};/**
32
32
  * @license
33
33
  * Copyright 2022 Google LLC
34
34
  *
@@ -43,7 +43,7 @@
43
43
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
44
44
  * See the License for the specific language governing permissions and
45
45
  * limitations under the License.
46
- */function Vf(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("Unable to locate global object.")}/**
46
+ */function Qf(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("Unable to locate global object.")}/**
47
47
  * @license
48
48
  * Copyright 2022 Google LLC
49
49
  *
@@ -58,7 +58,7 @@
58
58
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
59
59
  * See the License for the specific language governing permissions and
60
60
  * limitations under the License.
61
- */const Lf=()=>Vf().__FIREBASE_DEFAULTS__,Mf=()=>{if(typeof process>"u"||typeof process.env>"u")return;const t=process.env.__FIREBASE_DEFAULTS__;if(t)return JSON.parse(t)},xf=()=>{if(typeof document>"u")return;let t;try{t=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch{return}const e=t&&tc(t[1]);return e&&JSON.parse(e)},jr=()=>{try{return Lf()||Mf()||xf()}catch(t){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${t}`);return}},nc=t=>{var e,n;return(n=(e=jr())===null||e===void 0?void 0:e.emulatorHosts)===null||n===void 0?void 0:n[t]},Ti=t=>{const e=nc(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]},rc=()=>{var t;return(t=jr())===null||t===void 0?void 0:t.config},sc=t=>{var e;return(e=jr())===null||e===void 0?void 0:e[`_${t}`]};/**
61
+ */const Yf=()=>Qf().__FIREBASE_DEFAULTS__,Xf=()=>{if(typeof process>"u"||typeof process.env>"u")return;const n=process.env.__FIREBASE_DEFAULTS__;if(n)return JSON.parse(n)},Jf=()=>{if(typeof document>"u")return;let n;try{n=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch{return}const e=n&&uc(n[1]);return e&&JSON.parse(e)},Wr=()=>{try{return Yf()||Xf()||Jf()}catch(n){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${n}`);return}},lc=n=>{var e,t;return(t=(e=Wr())===null||e===void 0?void 0:e.emulatorHosts)===null||t===void 0?void 0:t[n]},Ri=n=>{const e=lc(n);if(!e)return;const t=e.lastIndexOf(":");if(t<=0||t+1===e.length)throw new Error(`Invalid host ${e} with no separate hostname and port!`);const r=parseInt(e.substring(t+1),10);return e[0]==="["?[e.substring(1,t-1),r]:[e.substring(0,t),r]},hc=()=>{var n;return(n=Wr())===null||n===void 0?void 0:n.config},dc=n=>{var e;return(e=Wr())===null||e===void 0?void 0:e[`_${n}`]};/**
62
62
  * @license
63
63
  * Copyright 2017 Google LLC
64
64
  *
@@ -73,7 +73,7 @@
73
73
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
74
74
  * See the License for the specific language governing permissions and
75
75
  * limitations under the License.
76
- */class Uf{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((e,n)=>{this.resolve=e,this.reject=n})}wrapCallback(e){return(n,r)=>{n?this.reject(n):this.resolve(r),typeof e=="function"&&(this.promise.catch(()=>{}),e.length===1?e(n):e(n,r))}}}/**
76
+ */class Zf{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}wrapCallback(e){return(t,r)=>{t?this.reject(t):this.resolve(r),typeof e=="function"&&(this.promise.catch(()=>{}),e.length===1?e(t):e(t,r))}}}/**
77
77
  * @license
78
78
  * Copyright 2021 Google LLC
79
79
  *
@@ -88,7 +88,7 @@
88
88
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
89
89
  * See the License for the specific language governing permissions and
90
90
  * limitations under the License.
91
- */function ic(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={alg:"none",type:"JWT"},r=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/${r}`,aud:r,iat:s,exp:s+3600,auth_time:s,sub:i,user_id:i,firebase:{sign_in_provider:"custom",identities:{}}},t);return[Br(JSON.stringify(n)),Br(JSON.stringify(o)),""].join(".")}/**
91
+ */function fc(n,e){if(n.uid)throw new Error('The "uid" field is no longer supported by mockUserToken. Please use "sub" instead for Firebase Auth User ID.');const t={alg:"none",type:"JWT"},r=e||"demo-project",s=n.iat||0,i=n.sub||n.user_id;if(!i)throw new Error("mockUserToken must contain 'sub' or 'user_id' field!");const o=Object.assign({iss:`https://securetoken.google.com/${r}`,aud:r,iat:s,exp:s+3600,auth_time:s,sub:i,user_id:i,firebase:{sign_in_provider:"custom",identities:{}}},n);return[Hr(JSON.stringify(t)),Hr(JSON.stringify(o)),""].join(".")}/**
92
92
  * @license
93
93
  * Copyright 2017 Google LLC
94
94
  *
@@ -103,7 +103,7 @@
103
103
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
104
104
  * See the License for the specific language governing permissions and
105
105
  * limitations under the License.
106
- */function W(){return typeof navigator<"u"&&typeof navigator.userAgent=="string"?navigator.userAgent:""}function Ff(){return typeof window<"u"&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(W())}function Bf(){var t;const e=(t=jr())===null||t===void 0?void 0:t.forceEnvironment;if(e==="node")return!0;if(e==="browser")return!1;try{return Object.prototype.toString.call(global.process)==="[object process]"}catch{return!1}}function jf(){const t=typeof chrome=="object"?chrome.runtime:typeof browser=="object"?browser.runtime:void 0;return typeof t=="object"&&t.id!==void 0}function $f(){return typeof navigator=="object"&&navigator.product==="ReactNative"}function qf(){const t=W();return t.indexOf("MSIE ")>=0||t.indexOf("Trident/")>=0}function zf(){return!Bf()&&!!navigator.userAgent&&navigator.userAgent.includes("Safari")&&!navigator.userAgent.includes("Chrome")}function oc(){try{return typeof indexedDB=="object"}catch{return!1}}function Hf(){return 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 i;e(((i=s.error)===null||i===void 0?void 0:i.message)||"")}}catch(n){e(n)}})}/**
106
+ */function W(){return typeof navigator<"u"&&typeof navigator.userAgent=="string"?navigator.userAgent:""}function ep(){return typeof window<"u"&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(W())}function tp(){var n;const e=(n=Wr())===null||n===void 0?void 0:n.forceEnvironment;if(e==="node")return!0;if(e==="browser")return!1;try{return Object.prototype.toString.call(global.process)==="[object process]"}catch{return!1}}function np(){const n=typeof chrome=="object"?chrome.runtime:typeof browser=="object"?browser.runtime:void 0;return typeof n=="object"&&n.id!==void 0}function rp(){return typeof navigator=="object"&&navigator.product==="ReactNative"}function sp(){const n=W();return n.indexOf("MSIE ")>=0||n.indexOf("Trident/")>=0}function ip(){return!tp()&&!!navigator.userAgent&&navigator.userAgent.includes("Safari")&&!navigator.userAgent.includes("Chrome")}function pc(){try{return typeof indexedDB=="object"}catch{return!1}}function op(){return new Promise((n,e)=>{try{let t=!0;const r="validate-browser-context-for-indexeddb-analytics-module",s=self.indexedDB.open(r);s.onsuccess=()=>{s.result.close(),t||self.indexedDB.deleteDatabase(r),n(!0)},s.onupgradeneeded=()=>{t=!1},s.onerror=()=>{var i;e(((i=s.error)===null||i===void 0?void 0:i.message)||"")}}catch(t){e(t)}})}/**
107
107
  * @license
108
108
  * Copyright 2017 Google LLC
109
109
  *
@@ -118,7 +118,7 @@
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
- */const Wf="FirebaseError";class Ce extends Error{constructor(e,n,r){super(n),this.code=e,this.customData=r,this.name=Wf,Object.setPrototypeOf(this,Ce.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,Nn.prototype.create)}}class Nn{constructor(e,n,r){this.service=e,this.serviceName=n,this.errors=r}create(e,...n){const r=n[0]||{},s=`${this.service}/${e}`,i=this.errors[e],o=i?Gf(i,r):"Error",a=`${this.serviceName}: ${o} (${s}).`;return new Ce(s,a,r)}}function Gf(t,e){return t.replace(Kf,(n,r)=>{const s=e[r];return s!=null?String(s):`<${r}?>`})}const Kf=/\{\$([^}]+)}/g;function Qf(t){for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0}function $r(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 i=t[s],o=e[s];if(ac(i)&&ac(o)){if(!$r(i,o))return!1}else if(i!==o)return!1}for(const s of r)if(!n.includes(s))return!1;return!0}function ac(t){return t!==null&&typeof t=="object"}/**
121
+ */const ap="FirebaseError";class De extends Error{constructor(e,t,r){super(t),this.code=e,this.customData=r,this.name=ap,Object.setPrototypeOf(this,De.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,Un.prototype.create)}}class Un{constructor(e,t,r){this.service=e,this.serviceName=t,this.errors=r}create(e,...t){const r=t[0]||{},s=`${this.service}/${e}`,i=this.errors[e],o=i?cp(i,r):"Error",a=`${this.serviceName}: ${o} (${s}).`;return new De(s,a,r)}}function cp(n,e){return n.replace(up,(t,r)=>{const s=e[r];return s!=null?String(s):`<${r}?>`})}const up=/\{\$([^}]+)}/g;function lp(n){for(const e in n)if(Object.prototype.hasOwnProperty.call(n,e))return!1;return!0}function Gr(n,e){if(n===e)return!0;const t=Object.keys(n),r=Object.keys(e);for(const s of t){if(!r.includes(s))return!1;const i=n[s],o=e[s];if(mc(i)&&mc(o)){if(!Gr(i,o))return!1}else if(i!==o)return!1}for(const s of r)if(!t.includes(s))return!1;return!0}function mc(n){return n!==null&&typeof n=="object"}/**
122
122
  * @license
123
123
  * Copyright 2017 Google LLC
124
124
  *
@@ -133,7 +133,7 @@
133
133
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
134
134
  * See the License for the specific language governing permissions and
135
135
  * limitations under the License.
136
- */function On(t){const e=[];for(const[n,r]of Object.entries(t))Array.isArray(r)?r.forEach(s=>{e.push(encodeURIComponent(n)+"="+encodeURIComponent(s))}):e.push(encodeURIComponent(n)+"="+encodeURIComponent(r));return e.length?"&"+e.join("&"):""}function Vn(t){const e={};return t.replace(/^\?/,"").split("&").forEach(r=>{if(r){const[s,i]=r.split("=");e[decodeURIComponent(s)]=decodeURIComponent(i)}}),e}function Ln(t){const e=t.indexOf("?");if(!e)return"";const n=t.indexOf("#",e);return t.substring(e,n>0?n:void 0)}function Yf(t,e){const n=new Xf(t,e);return n.subscribe.bind(n)}class Xf{constructor(e,n){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=n,this.task.then(()=>{e(this)}).catch(r=>{this.error(r)})}next(e){this.forEachObserver(n=>{n.next(e)})}error(e){this.forEachObserver(n=>{n.error(e)}),this.close(e)}complete(){this.forEachObserver(e=>{e.complete()}),this.close()}subscribe(e,n,r){let s;if(e===void 0&&n===void 0&&r===void 0)throw new Error("Missing Observer.");Jf(e,["next","error","complete"])?s=e:s={next:e,error:n,complete:r},s.next===void 0&&(s.next=wi),s.error===void 0&&(s.error=wi),s.complete===void 0&&(s.complete=wi);const i=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(()=>{try{this.finalError?s.error(this.finalError):s.complete()}catch{}}),this.observers.push(s),i}unsubscribeOne(e){this.observers===void 0||this.observers[e]===void 0||(delete this.observers[e],this.observerCount-=1,this.observerCount===0&&this.onNoObservers!==void 0&&this.onNoObservers(this))}forEachObserver(e){if(!this.finalized)for(let n=0;n<this.observers.length;n++)this.sendOne(n,e)}sendOne(e,n){this.task.then(()=>{if(this.observers!==void 0&&this.observers[e]!==void 0)try{n(this.observers[e])}catch(r){typeof console<"u"&&console.error&&console.error(r)}})}close(e){this.finalized||(this.finalized=!0,e!==void 0&&(this.finalError=e),this.task.then(()=>{this.observers=void 0,this.onNoObservers=void 0}))}}function Jf(t,e){if(typeof t!="object"||t===null)return!1;for(const n of e)if(n in t&&typeof t[n]=="function")return!0;return!1}function wi(){}/**
136
+ */function Fn(n){const e=[];for(const[t,r]of Object.entries(n))Array.isArray(r)?r.forEach(s=>{e.push(encodeURIComponent(t)+"="+encodeURIComponent(s))}):e.push(encodeURIComponent(t)+"="+encodeURIComponent(r));return e.length?"&"+e.join("&"):""}function Bn(n){const e={};return n.replace(/^\?/,"").split("&").forEach(r=>{if(r){const[s,i]=r.split("=");e[decodeURIComponent(s)]=decodeURIComponent(i)}}),e}function jn(n){const e=n.indexOf("?");if(!e)return"";const t=n.indexOf("#",e);return n.substring(e,t>0?t:void 0)}function hp(n,e){const t=new dp(n,e);return t.subscribe.bind(t)}class dp{constructor(e,t){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=t,this.task.then(()=>{e(this)}).catch(r=>{this.error(r)})}next(e){this.forEachObserver(t=>{t.next(e)})}error(e){this.forEachObserver(t=>{t.error(e)}),this.close(e)}complete(){this.forEachObserver(e=>{e.complete()}),this.close()}subscribe(e,t,r){let s;if(e===void 0&&t===void 0&&r===void 0)throw new Error("Missing Observer.");fp(e,["next","error","complete"])?s=e:s={next:e,error:t,complete:r},s.next===void 0&&(s.next=Pi),s.error===void 0&&(s.error=Pi),s.complete===void 0&&(s.complete=Pi);const i=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(()=>{try{this.finalError?s.error(this.finalError):s.complete()}catch{}}),this.observers.push(s),i}unsubscribeOne(e){this.observers===void 0||this.observers[e]===void 0||(delete this.observers[e],this.observerCount-=1,this.observerCount===0&&this.onNoObservers!==void 0&&this.onNoObservers(this))}forEachObserver(e){if(!this.finalized)for(let t=0;t<this.observers.length;t++)this.sendOne(t,e)}sendOne(e,t){this.task.then(()=>{if(this.observers!==void 0&&this.observers[e]!==void 0)try{t(this.observers[e])}catch(r){typeof console<"u"&&console.error&&console.error(r)}})}close(e){this.finalized||(this.finalized=!0,e!==void 0&&(this.finalError=e),this.task.then(()=>{this.observers=void 0,this.onNoObservers=void 0}))}}function fp(n,e){if(typeof n!="object"||n===null)return!1;for(const t of e)if(t in n&&typeof n[t]=="function")return!0;return!1}function Pi(){}/**
137
137
  * @license
138
138
  * Copyright 2021 Google LLC
139
139
  *
@@ -148,7 +148,7 @@
148
148
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
149
149
  * See the License for the specific language governing permissions and
150
150
  * limitations under the License.
151
- */function x(t){return t&&t._delegate?t._delegate:t}class Ye{constructor(e,n,r){this.name=e,this.instanceFactory=n,this.type=r,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(e){return this.instantiationMode=e,this}setMultipleInstances(e){return this.multipleInstances=e,this}setServiceProps(e){return this.serviceProps=e,this}setInstanceCreatedCallback(e){return this.onInstanceCreated=e,this}}/**
151
+ */function x(n){return n&&n._delegate?n._delegate:n}class Ze{constructor(e,t,r){this.name=e,this.instanceFactory=t,this.type=r,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(e){return this.instantiationMode=e,this}setMultipleInstances(e){return this.multipleInstances=e,this}setServiceProps(e){return this.serviceProps=e,this}setInstanceCreatedCallback(e){return this.onInstanceCreated=e,this}}/**
152
152
  * @license
153
153
  * Copyright 2019 Google LLC
154
154
  *
@@ -163,7 +163,7 @@
163
163
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
164
164
  * See the License for the specific language governing permissions and
165
165
  * limitations under the License.
166
- */const Pt="[DEFAULT]";/**
166
+ */const kt="[DEFAULT]";/**
167
167
  * @license
168
168
  * Copyright 2019 Google LLC
169
169
  *
@@ -178,7 +178,7 @@
178
178
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
179
179
  * See the License for the specific language governing permissions and
180
180
  * limitations under the License.
181
- */class Zf{constructor(e,n){this.name=e,this.container=n,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(e){const n=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(n)){const r=new Uf;if(this.instancesDeferred.set(n,r),this.isInitialized(n)||this.shouldAutoInitialize())try{const s=this.getOrInitializeService({instanceIdentifier:n});s&&r.resolve(s)}catch{}}return this.instancesDeferred.get(n).promise}getImmediate(e){var n;const r=this.normalizeInstanceIdentifier(e==null?void 0:e.identifier),s=(n=e==null?void 0:e.optional)!==null&&n!==void 0?n:!1;if(this.isInitialized(r)||this.shouldAutoInitialize())try{return this.getOrInitializeService({instanceIdentifier:r})}catch(i){if(s)return null;throw i}else{if(s)return null;throw Error(`Service ${this.name} is not available`)}}getComponent(){return this.component}setComponent(e){if(e.name!==this.name)throw Error(`Mismatching Component ${e.name} for Provider ${this.name}.`);if(this.component)throw Error(`Component for ${this.name} has already been provided`);if(this.component=e,!!this.shouldAutoInitialize()){if(tp(e))try{this.getOrInitializeService({instanceIdentifier:Pt})}catch{}for(const[n,r]of this.instancesDeferred.entries()){const s=this.normalizeInstanceIdentifier(n);try{const i=this.getOrInitializeService({instanceIdentifier:s});r.resolve(i)}catch{}}}}clearInstance(e=Pt){this.instancesDeferred.delete(e),this.instancesOptions.delete(e),this.instances.delete(e)}async delete(){const e=Array.from(this.instances.values());await Promise.all([...e.filter(n=>"INTERNAL"in n).map(n=>n.INTERNAL.delete()),...e.filter(n=>"_delete"in n).map(n=>n._delete())])}isComponentSet(){return this.component!=null}isInitialized(e=Pt){return this.instances.has(e)}getOptions(e=Pt){return this.instancesOptions.get(e)||{}}initialize(e={}){const{options:n={}}=e,r=this.normalizeInstanceIdentifier(e.instanceIdentifier);if(this.isInitialized(r))throw Error(`${this.name}(${r}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);const s=this.getOrInitializeService({instanceIdentifier:r,options:n});for(const[i,o]of this.instancesDeferred.entries()){const a=this.normalizeInstanceIdentifier(i);r===a&&o.resolve(s)}return s}onInit(e,n){var r;const s=this.normalizeInstanceIdentifier(n),i=(r=this.onInitCallbacks.get(s))!==null&&r!==void 0?r:new Set;i.add(e),this.onInitCallbacks.set(s,i);const o=this.instances.get(s);return o&&e(o,s),()=>{i.delete(e)}}invokeOnInitCallbacks(e,n){const r=this.onInitCallbacks.get(n);if(r)for(const s of r)try{s(e,n)}catch{}}getOrInitializeService({instanceIdentifier:e,options:n={}}){let r=this.instances.get(e);if(!r&&this.component&&(r=this.component.instanceFactory(this.container,{instanceIdentifier:ep(e),options:n}),this.instances.set(e,r),this.instancesOptions.set(e,n),this.invokeOnInitCallbacks(r,e),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,e,r)}catch{}return r||null}normalizeInstanceIdentifier(e=Pt){return this.component?this.component.multipleInstances?e:Pt:e}shouldAutoInitialize(){return!!this.component&&this.component.instantiationMode!=="EXPLICIT"}}function ep(t){return t===Pt?void 0:t}function tp(t){return t.instantiationMode==="EAGER"}/**
181
+ */class pp{constructor(e,t){this.name=e,this.container=t,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(e){const t=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(t)){const r=new Zf;if(this.instancesDeferred.set(t,r),this.isInitialized(t)||this.shouldAutoInitialize())try{const s=this.getOrInitializeService({instanceIdentifier:t});s&&r.resolve(s)}catch{}}return this.instancesDeferred.get(t).promise}getImmediate(e){var t;const r=this.normalizeInstanceIdentifier(e==null?void 0:e.identifier),s=(t=e==null?void 0:e.optional)!==null&&t!==void 0?t:!1;if(this.isInitialized(r)||this.shouldAutoInitialize())try{return this.getOrInitializeService({instanceIdentifier:r})}catch(i){if(s)return null;throw i}else{if(s)return null;throw Error(`Service ${this.name} is not available`)}}getComponent(){return this.component}setComponent(e){if(e.name!==this.name)throw Error(`Mismatching Component ${e.name} for Provider ${this.name}.`);if(this.component)throw Error(`Component for ${this.name} has already been provided`);if(this.component=e,!!this.shouldAutoInitialize()){if(gp(e))try{this.getOrInitializeService({instanceIdentifier:kt})}catch{}for(const[t,r]of this.instancesDeferred.entries()){const s=this.normalizeInstanceIdentifier(t);try{const i=this.getOrInitializeService({instanceIdentifier:s});r.resolve(i)}catch{}}}}clearInstance(e=kt){this.instancesDeferred.delete(e),this.instancesOptions.delete(e),this.instances.delete(e)}async delete(){const e=Array.from(this.instances.values());await Promise.all([...e.filter(t=>"INTERNAL"in t).map(t=>t.INTERNAL.delete()),...e.filter(t=>"_delete"in t).map(t=>t._delete())])}isComponentSet(){return this.component!=null}isInitialized(e=kt){return this.instances.has(e)}getOptions(e=kt){return this.instancesOptions.get(e)||{}}initialize(e={}){const{options:t={}}=e,r=this.normalizeInstanceIdentifier(e.instanceIdentifier);if(this.isInitialized(r))throw Error(`${this.name}(${r}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);const s=this.getOrInitializeService({instanceIdentifier:r,options:t});for(const[i,o]of this.instancesDeferred.entries()){const a=this.normalizeInstanceIdentifier(i);r===a&&o.resolve(s)}return s}onInit(e,t){var r;const s=this.normalizeInstanceIdentifier(t),i=(r=this.onInitCallbacks.get(s))!==null&&r!==void 0?r:new Set;i.add(e),this.onInitCallbacks.set(s,i);const o=this.instances.get(s);return o&&e(o,s),()=>{i.delete(e)}}invokeOnInitCallbacks(e,t){const r=this.onInitCallbacks.get(t);if(r)for(const s of r)try{s(e,t)}catch{}}getOrInitializeService({instanceIdentifier:e,options:t={}}){let r=this.instances.get(e);if(!r&&this.component&&(r=this.component.instanceFactory(this.container,{instanceIdentifier:mp(e),options:t}),this.instances.set(e,r),this.instancesOptions.set(e,t),this.invokeOnInitCallbacks(r,e),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,e,r)}catch{}return r||null}normalizeInstanceIdentifier(e=kt){return this.component?this.component.multipleInstances?e:kt:e}shouldAutoInitialize(){return!!this.component&&this.component.instantiationMode!=="EXPLICIT"}}function mp(n){return n===kt?void 0:n}function gp(n){return n.instantiationMode==="EAGER"}/**
182
182
  * @license
183
183
  * Copyright 2019 Google LLC
184
184
  *
@@ -193,7 +193,7 @@
193
193
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
194
194
  * See the License for the specific language governing permissions and
195
195
  * limitations under the License.
196
- */class np{constructor(e){this.name=e,this.providers=new Map}addComponent(e){const n=this.getProvider(e.name);if(n.isComponentSet())throw new Error(`Component ${e.name} has already been registered with ${this.name}`);n.setComponent(e)}addOrOverwriteComponent(e){this.getProvider(e.name).isComponentSet()&&this.providers.delete(e.name),this.addComponent(e)}getProvider(e){if(this.providers.has(e))return this.providers.get(e);const n=new Zf(e,this);return this.providers.set(e,n),n}getProviders(){return Array.from(this.providers.values())}}/**
196
+ */class _p{constructor(e){this.name=e,this.providers=new Map}addComponent(e){const t=this.getProvider(e.name);if(t.isComponentSet())throw new Error(`Component ${e.name} has already been registered with ${this.name}`);t.setComponent(e)}addOrOverwriteComponent(e){this.getProvider(e.name).isComponentSet()&&this.providers.delete(e.name),this.addComponent(e)}getProvider(e){if(this.providers.has(e))return this.providers.get(e);const t=new pp(e,this);return this.providers.set(e,t),t}getProviders(){return Array.from(this.providers.values())}}/**
197
197
  * @license
198
198
  * Copyright 2017 Google LLC
199
199
  *
@@ -208,7 +208,7 @@
208
208
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
209
209
  * See the License for the specific language governing permissions and
210
210
  * limitations under the License.
211
- */var N;(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"})(N||(N={}));const rp={debug:N.DEBUG,verbose:N.VERBOSE,info:N.INFO,warn:N.WARN,error:N.ERROR,silent:N.SILENT},sp=N.INFO,ip={[N.DEBUG]:"log",[N.VERBOSE]:"log",[N.INFO]:"info",[N.WARN]:"warn",[N.ERROR]:"error"},op=(t,e,...n)=>{if(e<t.logLevel)return;const r=new Date().toISOString(),s=ip[e];if(s)console[s](`[${r}] ${t.name}:`,...n);else throw new Error(`Attempted to log a message with an invalid logType (value: ${e})`)};class Ii{constructor(e){this.name=e,this._logLevel=sp,this._logHandler=op,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in N))throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel=typeof e=="string"?rp[e]:e}get logHandler(){return this._logHandler}set logHandler(e){if(typeof e!="function")throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=e}get userLogHandler(){return this._userLogHandler}set userLogHandler(e){this._userLogHandler=e}debug(...e){this._userLogHandler&&this._userLogHandler(this,N.DEBUG,...e),this._logHandler(this,N.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,N.VERBOSE,...e),this._logHandler(this,N.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,N.INFO,...e),this._logHandler(this,N.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,N.WARN,...e),this._logHandler(this,N.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,N.ERROR,...e),this._logHandler(this,N.ERROR,...e)}}const ap=(t,e)=>e.some(n=>t instanceof n);let cc,uc;function cp(){return cc||(cc=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function up(){return uc||(uc=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const lc=new WeakMap,Ai=new WeakMap,hc=new WeakMap,Ri=new WeakMap,Pi=new WeakMap;function lp(t){const e=new Promise((n,r)=>{const s=()=>{t.removeEventListener("success",i),t.removeEventListener("error",o)},i=()=>{n(ct(t.result)),s()},o=()=>{r(t.error),s()};t.addEventListener("success",i),t.addEventListener("error",o)});return e.then(n=>{n instanceof IDBCursor&&lc.set(n,t)}).catch(()=>{}),Pi.set(e,t),e}function hp(t){if(Ai.has(t))return;const e=new Promise((n,r)=>{const s=()=>{t.removeEventListener("complete",i),t.removeEventListener("error",o),t.removeEventListener("abort",o)},i=()=>{n(),s()},o=()=>{r(t.error||new DOMException("AbortError","AbortError")),s()};t.addEventListener("complete",i),t.addEventListener("error",o),t.addEventListener("abort",o)});Ai.set(t,e)}let Si={get(t,e,n){if(t instanceof IDBTransaction){if(e==="done")return Ai.get(t);if(e==="objectStoreNames")return t.objectStoreNames||hc.get(t);if(e==="store")return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return ct(t[e])},set(t,e,n){return t[e]=n,!0},has(t,e){return t instanceof IDBTransaction&&(e==="done"||e==="store")?!0:e in t}};function dp(t){Si=t(Si)}function fp(t){return t===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(e,...n){const r=t.call(bi(this),e,...n);return hc.set(r,e.sort?e.sort():[e]),ct(r)}:up().includes(t)?function(...e){return t.apply(bi(this),e),ct(lc.get(this))}:function(...e){return ct(t.apply(bi(this),e))}}function pp(t){return typeof t=="function"?fp(t):(t instanceof IDBTransaction&&hp(t),ap(t,cp())?new Proxy(t,Si):t)}function ct(t){if(t instanceof IDBRequest)return lp(t);if(Ri.has(t))return Ri.get(t);const e=pp(t);return e!==t&&(Ri.set(t,e),Pi.set(e,t)),e}const bi=t=>Pi.get(t);function mp(t,e,{blocked:n,upgrade:r,blocking:s,terminated:i}={}){const o=indexedDB.open(t,e),a=ct(o);return r&&o.addEventListener("upgradeneeded",c=>{r(ct(o.result),c.oldVersion,c.newVersion,ct(o.transaction),c)}),n&&o.addEventListener("blocked",c=>n(c.oldVersion,c.newVersion,c)),a.then(c=>{i&&c.addEventListener("close",()=>i()),s&&c.addEventListener("versionchange",u=>s(u.oldVersion,u.newVersion,u))}).catch(()=>{}),a}const gp=["get","getKey","getAll","getAllKeys","count"],_p=["put","add","delete","clear"],Ci=new Map;function dc(t,e){if(!(t instanceof IDBDatabase&&!(e in t)&&typeof e=="string"))return;if(Ci.get(e))return Ci.get(e);const n=e.replace(/FromIndex$/,""),r=e!==n,s=_p.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!(s||gp.includes(n)))return;const i=async function(o,...a){const c=this.transaction(o,s?"readwrite":"readonly");let u=c.store;return r&&(u=u.index(a.shift())),(await Promise.all([u[n](...a),s&&c.done]))[0]};return Ci.set(e,i),i}dp(t=>({...t,get:(e,n,r)=>dc(e,n)||t.get(e,n,r),has:(e,n)=>!!dc(e,n)||t.has(e,n)}));/**
211
+ */var N;(function(n){n[n.DEBUG=0]="DEBUG",n[n.VERBOSE=1]="VERBOSE",n[n.INFO=2]="INFO",n[n.WARN=3]="WARN",n[n.ERROR=4]="ERROR",n[n.SILENT=5]="SILENT"})(N||(N={}));const yp={debug:N.DEBUG,verbose:N.VERBOSE,info:N.INFO,warn:N.WARN,error:N.ERROR,silent:N.SILENT},vp=N.INFO,Ep={[N.DEBUG]:"log",[N.VERBOSE]:"log",[N.INFO]:"info",[N.WARN]:"warn",[N.ERROR]:"error"},Tp=(n,e,...t)=>{if(e<n.logLevel)return;const r=new Date().toISOString(),s=Ep[e];if(s)console[s](`[${r}] ${n.name}:`,...t);else throw new Error(`Attempted to log a message with an invalid logType (value: ${e})`)};class Si{constructor(e){this.name=e,this._logLevel=vp,this._logHandler=Tp,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in N))throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel=typeof e=="string"?yp[e]:e}get logHandler(){return this._logHandler}set logHandler(e){if(typeof e!="function")throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=e}get userLogHandler(){return this._userLogHandler}set userLogHandler(e){this._userLogHandler=e}debug(...e){this._userLogHandler&&this._userLogHandler(this,N.DEBUG,...e),this._logHandler(this,N.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,N.VERBOSE,...e),this._logHandler(this,N.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,N.INFO,...e),this._logHandler(this,N.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,N.WARN,...e),this._logHandler(this,N.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,N.ERROR,...e),this._logHandler(this,N.ERROR,...e)}}const wp=(n,e)=>e.some(t=>n instanceof t);let gc,_c;function Ip(){return gc||(gc=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function Ap(){return _c||(_c=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const yc=new WeakMap,bi=new WeakMap,vc=new WeakMap,Ci=new WeakMap,ki=new WeakMap;function Rp(n){const e=new Promise((t,r)=>{const s=()=>{n.removeEventListener("success",i),n.removeEventListener("error",o)},i=()=>{t(dt(n.result)),s()},o=()=>{r(n.error),s()};n.addEventListener("success",i),n.addEventListener("error",o)});return e.then(t=>{t instanceof IDBCursor&&yc.set(t,n)}).catch(()=>{}),ki.set(e,n),e}function Pp(n){if(bi.has(n))return;const e=new Promise((t,r)=>{const s=()=>{n.removeEventListener("complete",i),n.removeEventListener("error",o),n.removeEventListener("abort",o)},i=()=>{t(),s()},o=()=>{r(n.error||new DOMException("AbortError","AbortError")),s()};n.addEventListener("complete",i),n.addEventListener("error",o),n.addEventListener("abort",o)});bi.set(n,e)}let Di={get(n,e,t){if(n instanceof IDBTransaction){if(e==="done")return bi.get(n);if(e==="objectStoreNames")return n.objectStoreNames||vc.get(n);if(e==="store")return t.objectStoreNames[1]?void 0:t.objectStore(t.objectStoreNames[0])}return dt(n[e])},set(n,e,t){return n[e]=t,!0},has(n,e){return n instanceof IDBTransaction&&(e==="done"||e==="store")?!0:e in n}};function Sp(n){Di=n(Di)}function bp(n){return n===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(e,...t){const r=n.call(Ni(this),e,...t);return vc.set(r,e.sort?e.sort():[e]),dt(r)}:Ap().includes(n)?function(...e){return n.apply(Ni(this),e),dt(yc.get(this))}:function(...e){return dt(n.apply(Ni(this),e))}}function Cp(n){return typeof n=="function"?bp(n):(n instanceof IDBTransaction&&Pp(n),wp(n,Ip())?new Proxy(n,Di):n)}function dt(n){if(n instanceof IDBRequest)return Rp(n);if(Ci.has(n))return Ci.get(n);const e=Cp(n);return e!==n&&(Ci.set(n,e),ki.set(e,n)),e}const Ni=n=>ki.get(n);function kp(n,e,{blocked:t,upgrade:r,blocking:s,terminated:i}={}){const o=indexedDB.open(n,e),a=dt(o);return r&&o.addEventListener("upgradeneeded",c=>{r(dt(o.result),c.oldVersion,c.newVersion,dt(o.transaction),c)}),t&&o.addEventListener("blocked",c=>t(c.oldVersion,c.newVersion,c)),a.then(c=>{i&&c.addEventListener("close",()=>i()),s&&c.addEventListener("versionchange",u=>s(u.oldVersion,u.newVersion,u))}).catch(()=>{}),a}const Dp=["get","getKey","getAll","getAllKeys","count"],Np=["put","add","delete","clear"],Oi=new Map;function Ec(n,e){if(!(n instanceof IDBDatabase&&!(e in n)&&typeof e=="string"))return;if(Oi.get(e))return Oi.get(e);const t=e.replace(/FromIndex$/,""),r=e!==t,s=Np.includes(t);if(!(t in(r?IDBIndex:IDBObjectStore).prototype)||!(s||Dp.includes(t)))return;const i=async function(o,...a){const c=this.transaction(o,s?"readwrite":"readonly");let u=c.store;return r&&(u=u.index(a.shift())),(await Promise.all([u[t](...a),s&&c.done]))[0]};return Oi.set(e,i),i}Sp(n=>({...n,get:(e,t,r)=>Ec(e,t)||n.get(e,t,r),has:(e,t)=>!!Ec(e,t)||n.has(e,t)}));/**
212
212
  * @license
213
213
  * Copyright 2019 Google LLC
214
214
  *
@@ -223,7 +223,7 @@
223
223
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
224
224
  * See the License for the specific language governing permissions and
225
225
  * limitations under the License.
226
- */class yp{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(n=>{if(vp(n)){const r=n.getImmediate();return`${r.library}/${r.version}`}else return null}).filter(n=>n).join(" ")}}function vp(t){const e=t.getComponent();return(e==null?void 0:e.type)==="VERSION"}const ki="@firebase/app",fc="0.9.27";/**
226
+ */class Op{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(t=>{if(Vp(t)){const r=t.getImmediate();return`${r.library}/${r.version}`}else return null}).filter(t=>t).join(" ")}}function Vp(n){const e=n.getComponent();return(e==null?void 0:e.type)==="VERSION"}const Vi="@firebase/app",Tc="0.10.1";/**
227
227
  * @license
228
228
  * Copyright 2019 Google LLC
229
229
  *
@@ -238,7 +238,7 @@
238
238
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
239
239
  * See the License for the specific language governing permissions and
240
240
  * limitations under the License.
241
- */const St=new Ii("@firebase/app"),Ep="@firebase/app-compat",Tp="@firebase/analytics-compat",wp="@firebase/analytics",Ip="@firebase/app-check-compat",Ap="@firebase/app-check",Rp="@firebase/auth",Pp="@firebase/auth-compat",Sp="@firebase/database",bp="@firebase/database-compat",Cp="@firebase/functions",kp="@firebase/functions-compat",Dp="@firebase/installations",Np="@firebase/installations-compat",Op="@firebase/messaging",Vp="@firebase/messaging-compat",Lp="@firebase/performance",Mp="@firebase/performance-compat",xp="@firebase/remote-config",Up="@firebase/remote-config-compat",Fp="@firebase/storage",Bp="@firebase/storage-compat",jp="@firebase/firestore",$p="@firebase/firestore-compat",qp="firebase",zp="10.8.0";/**
241
+ */const Dt=new Si("@firebase/app"),Lp="@firebase/app-compat",Mp="@firebase/analytics-compat",xp="@firebase/analytics",Up="@firebase/app-check-compat",Fp="@firebase/app-check",Bp="@firebase/auth",jp="@firebase/auth-compat",qp="@firebase/database",$p="@firebase/database-compat",zp="@firebase/functions",Hp="@firebase/functions-compat",Wp="@firebase/installations",Gp="@firebase/installations-compat",Kp="@firebase/messaging",Qp="@firebase/messaging-compat",Yp="@firebase/performance",Xp="@firebase/performance-compat",Jp="@firebase/remote-config",Zp="@firebase/remote-config-compat",em="@firebase/storage",tm="@firebase/storage-compat",nm="@firebase/firestore",rm="@firebase/firestore-compat",sm="firebase",im="10.11.0";/**
242
242
  * @license
243
243
  * Copyright 2019 Google LLC
244
244
  *
@@ -253,7 +253,7 @@
253
253
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
254
254
  * See the License for the specific language governing permissions and
255
255
  * limitations under the License.
256
- */const Di="[DEFAULT]",Hp={[ki]:"fire-core",[Ep]:"fire-core-compat",[wp]:"fire-analytics",[Tp]:"fire-analytics-compat",[Ap]:"fire-app-check",[Ip]:"fire-app-check-compat",[Rp]:"fire-auth",[Pp]:"fire-auth-compat",[Sp]:"fire-rtdb",[bp]:"fire-rtdb-compat",[Cp]:"fire-fn",[kp]:"fire-fn-compat",[Dp]:"fire-iid",[Np]:"fire-iid-compat",[Op]:"fire-fcm",[Vp]:"fire-fcm-compat",[Lp]:"fire-perf",[Mp]:"fire-perf-compat",[xp]:"fire-rc",[Up]:"fire-rc-compat",[Fp]:"fire-gcs",[Bp]:"fire-gcs-compat",[jp]:"fire-fst",[$p]:"fire-fst-compat","fire-js":"fire-js",[qp]:"fire-js-all"};/**
256
+ */const Li="[DEFAULT]",om={[Vi]:"fire-core",[Lp]:"fire-core-compat",[xp]:"fire-analytics",[Mp]:"fire-analytics-compat",[Fp]:"fire-app-check",[Up]:"fire-app-check-compat",[Bp]:"fire-auth",[jp]:"fire-auth-compat",[qp]:"fire-rtdb",[$p]:"fire-rtdb-compat",[zp]:"fire-fn",[Hp]:"fire-fn-compat",[Wp]:"fire-iid",[Gp]:"fire-iid-compat",[Kp]:"fire-fcm",[Qp]:"fire-fcm-compat",[Yp]:"fire-perf",[Xp]:"fire-perf-compat",[Jp]:"fire-rc",[Zp]:"fire-rc-compat",[em]:"fire-gcs",[tm]:"fire-gcs-compat",[nm]:"fire-fst",[rm]:"fire-fst-compat","fire-js":"fire-js",[sm]:"fire-js-all"};/**
257
257
  * @license
258
258
  * Copyright 2019 Google LLC
259
259
  *
@@ -268,7 +268,7 @@
268
268
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
269
269
  * See the License for the specific language governing permissions and
270
270
  * limitations under the License.
271
- */const qr=new Map,Ni=new Map;function Wp(t,e){try{t.container.addComponent(e)}catch(n){St.debug(`Component ${e.name} failed to register with FirebaseApp ${t.name}`,n)}}function ut(t){const e=t.name;if(Ni.has(e))return St.debug(`There were multiple attempts to register component ${e}.`),!1;Ni.set(e,t);for(const n of qr.values())Wp(n,t);return!0}function Mn(t,e){const n=t.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),t.container.getProvider(e)}/**
271
+ */const Kr=new Map,am=new Map,Mi=new Map;function wc(n,e){try{n.container.addComponent(e)}catch(t){Dt.debug(`Component ${e.name} failed to register with FirebaseApp ${n.name}`,t)}}function ft(n){const e=n.name;if(Mi.has(e))return Dt.debug(`There were multiple attempts to register component ${e}.`),!1;Mi.set(e,n);for(const t of Kr.values())wc(t,n);for(const t of am.values())wc(t,n);return!0}function qn(n,e){const t=n.container.getProvider("heartbeat").getImmediate({optional:!0});return t&&t.triggerHeartbeat(),n.container.getProvider(e)}function Pe(n){return n.settings!==void 0}/**
272
272
  * @license
273
273
  * Copyright 2019 Google LLC
274
274
  *
@@ -283,7 +283,7 @@
283
283
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
284
284
  * See the License for the specific language governing permissions and
285
285
  * limitations under the License.
286
- */const Gp={"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}."},lt=new Nn("app","Firebase",Gp);/**
286
+ */const cm={"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","server-app-deleted":"Firebase Server App has been 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}.","finalization-registry-not-supported":"FirebaseServerApp deleteOnDeref field defined but the JS runtime does not support FinalizationRegistry.","invalid-server-app-environment":"FirebaseServerApp is not for use in browser environments."},pt=new Un("app","Firebase",cm);/**
287
287
  * @license
288
288
  * Copyright 2019 Google LLC
289
289
  *
@@ -298,7 +298,7 @@
298
298
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
299
299
  * See the License for the specific language governing permissions and
300
300
  * limitations under the License.
301
- */class Kp{constructor(e,n,r){this._isDeleted=!1,this._options=Object.assign({},e),this._config=Object.assign({},n),this._name=n.name,this._automaticDataCollectionEnabled=n.automaticDataCollectionEnabled,this._container=r,this.container.addComponent(new Ye("app",()=>this,"PUBLIC"))}get automaticDataCollectionEnabled(){return this.checkDestroyed(),this._automaticDataCollectionEnabled}set automaticDataCollectionEnabled(e){this.checkDestroyed(),this._automaticDataCollectionEnabled=e}get name(){return this.checkDestroyed(),this._name}get options(){return this.checkDestroyed(),this._options}get config(){return this.checkDestroyed(),this._config}get container(){return this._container}get isDeleted(){return this._isDeleted}set isDeleted(e){this._isDeleted=e}checkDestroyed(){if(this.isDeleted)throw lt.create("app-deleted",{appName:this._name})}}/**
301
+ */class um{constructor(e,t,r){this._isDeleted=!1,this._options=Object.assign({},e),this._config=Object.assign({},t),this._name=t.name,this._automaticDataCollectionEnabled=t.automaticDataCollectionEnabled,this._container=r,this.container.addComponent(new Ze("app",()=>this,"PUBLIC"))}get automaticDataCollectionEnabled(){return this.checkDestroyed(),this._automaticDataCollectionEnabled}set automaticDataCollectionEnabled(e){this.checkDestroyed(),this._automaticDataCollectionEnabled=e}get name(){return this.checkDestroyed(),this._name}get options(){return this.checkDestroyed(),this._options}get config(){return this.checkDestroyed(),this._config}get container(){return this._container}get isDeleted(){return this._isDeleted}set isDeleted(e){this._isDeleted=e}checkDestroyed(){if(this.isDeleted)throw pt.create("app-deleted",{appName:this._name})}}/**
302
302
  * @license
303
303
  * Copyright 2019 Google LLC
304
304
  *
@@ -313,7 +313,7 @@
313
313
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
314
314
  * See the License for the specific language governing permissions and
315
315
  * limitations under the License.
316
- */const bt=zp;function pc(t,e={}){let n=t;typeof e!="object"&&(e={name:e});const r=Object.assign({name:Di,automaticDataCollectionEnabled:!1},e),s=r.name;if(typeof s!="string"||!s)throw lt.create("bad-app-name",{appName:String(s)});if(n||(n=rc()),!n)throw lt.create("no-options");const i=qr.get(s);if(i){if($r(n,i.options)&&$r(r,i.config))return i;throw lt.create("duplicate-app",{appName:s})}const o=new np(s);for(const c of Ni.values())o.addComponent(c);const a=new Kp(n,r,o);return qr.set(s,a),a}function zr(t=Di){const e=qr.get(t);if(!e&&t===Di&&rc())return pc();if(!e)throw lt.create("no-app",{appName:t});return e}function Ae(t,e,n){var r;let s=(r=Hp[t])!==null&&r!==void 0?r:t;n&&(s+=`-${n}`);const i=s.match(/\s|\//),o=e.match(/\s|\//);if(i||o){const a=[`Unable to register library "${s}" with version "${e}":`];i&&a.push(`library name "${s}" contains illegal characters (whitespace or "/")`),i&&o&&a.push("and"),o&&a.push(`version name "${e}" contains illegal characters (whitespace or "/")`),St.warn(a.join(" "));return}ut(new Ye(`${s}-version`,()=>({library:s,version:e}),"VERSION"))}/**
316
+ */const Nt=im;function Ic(n,e={}){let t=n;typeof e!="object"&&(e={name:e});const r=Object.assign({name:Li,automaticDataCollectionEnabled:!1},e),s=r.name;if(typeof s!="string"||!s)throw pt.create("bad-app-name",{appName:String(s)});if(t||(t=hc()),!t)throw pt.create("no-options");const i=Kr.get(s);if(i){if(Gr(t,i.options)&&Gr(r,i.config))return i;throw pt.create("duplicate-app",{appName:s})}const o=new _p(s);for(const c of Mi.values())o.addComponent(c);const a=new um(t,r,o);return Kr.set(s,a),a}function Qr(n=Li){const e=Kr.get(n);if(!e&&n===Li&&hc())return Ic();if(!e)throw pt.create("no-app",{appName:n});return e}function Se(n,e,t){var r;let s=(r=om[n])!==null&&r!==void 0?r:n;t&&(s+=`-${t}`);const i=s.match(/\s|\//),o=e.match(/\s|\//);if(i||o){const a=[`Unable to register library "${s}" with version "${e}":`];i&&a.push(`library name "${s}" contains illegal characters (whitespace or "/")`),i&&o&&a.push("and"),o&&a.push(`version name "${e}" contains illegal characters (whitespace or "/")`),Dt.warn(a.join(" "));return}ft(new Ze(`${s}-version`,()=>({library:s,version:e}),"VERSION"))}/**
317
317
  * @license
318
318
  * Copyright 2021 Google LLC
319
319
  *
@@ -328,7 +328,7 @@
328
328
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
329
329
  * See the License for the specific language governing permissions and
330
330
  * limitations under the License.
331
- */const Qp="firebase-heartbeat-database",Yp=1,xn="firebase-heartbeat-store";let Oi=null;function mc(){return Oi||(Oi=mp(Qp,Yp,{upgrade:(t,e)=>{switch(e){case 0:try{t.createObjectStore(xn)}catch(n){console.warn(n)}}}}).catch(t=>{throw lt.create("idb-open",{originalErrorMessage:t.message})})),Oi}async function Xp(t){try{const n=(await mc()).transaction(xn),r=await n.objectStore(xn).get(_c(t));return await n.done,r}catch(e){if(e instanceof Ce)St.warn(e.message);else{const n=lt.create("idb-get",{originalErrorMessage:e==null?void 0:e.message});St.warn(n.message)}}}async function gc(t,e){try{const r=(await mc()).transaction(xn,"readwrite");await r.objectStore(xn).put(e,_c(t)),await r.done}catch(n){if(n instanceof Ce)St.warn(n.message);else{const r=lt.create("idb-set",{originalErrorMessage:n==null?void 0:n.message});St.warn(r.message)}}}function _c(t){return`${t.name}!${t.options.appId}`}/**
331
+ */const lm="firebase-heartbeat-database",hm=1,$n="firebase-heartbeat-store";let xi=null;function Ac(){return xi||(xi=kp(lm,hm,{upgrade:(n,e)=>{switch(e){case 0:try{n.createObjectStore($n)}catch(t){console.warn(t)}}}}).catch(n=>{throw pt.create("idb-open",{originalErrorMessage:n.message})})),xi}async function dm(n){try{const t=(await Ac()).transaction($n),r=await t.objectStore($n).get(Pc(n));return await t.done,r}catch(e){if(e instanceof De)Dt.warn(e.message);else{const t=pt.create("idb-get",{originalErrorMessage:e==null?void 0:e.message});Dt.warn(t.message)}}}async function Rc(n,e){try{const r=(await Ac()).transaction($n,"readwrite");await r.objectStore($n).put(e,Pc(n)),await r.done}catch(t){if(t instanceof De)Dt.warn(t.message);else{const r=pt.create("idb-set",{originalErrorMessage:t==null?void 0:t.message});Dt.warn(r.message)}}}function Pc(n){return`${n.name}!${n.options.appId}`}/**
332
332
  * @license
333
333
  * Copyright 2021 Google LLC
334
334
  *
@@ -343,7 +343,7 @@
343
343
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
344
344
  * See the License for the specific language governing permissions and
345
345
  * limitations under the License.
346
- */const Jp=1024,Zp=30*24*60*60*1e3;class em{constructor(e){this.container=e,this._heartbeatsCache=null;const n=this.container.getProvider("app").getImmediate();this._storage=new nm(n),this._heartbeatsCachePromise=this._storage.read().then(r=>(this._heartbeatsCache=r,r))}async triggerHeartbeat(){var e,n;const s=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),i=yc();if(!(((e=this._heartbeatsCache)===null||e===void 0?void 0:e.heartbeats)==null&&(this._heartbeatsCache=await this._heartbeatsCachePromise,((n=this._heartbeatsCache)===null||n===void 0?void 0:n.heartbeats)==null))&&!(this._heartbeatsCache.lastSentHeartbeatDate===i||this._heartbeatsCache.heartbeats.some(o=>o.date===i)))return this._heartbeatsCache.heartbeats.push({date:i,agent:s}),this._heartbeatsCache.heartbeats=this._heartbeatsCache.heartbeats.filter(o=>{const a=new Date(o.date).valueOf();return Date.now()-a<=Zp}),this._storage.overwrite(this._heartbeatsCache)}async getHeartbeatsHeader(){var e;if(this._heartbeatsCache===null&&await this._heartbeatsCachePromise,((e=this._heartbeatsCache)===null||e===void 0?void 0:e.heartbeats)==null||this._heartbeatsCache.heartbeats.length===0)return"";const n=yc(),{heartbeatsToSend:r,unsentEntries:s}=tm(this._heartbeatsCache.heartbeats),i=Br(JSON.stringify({version:2,heartbeats:r}));return this._heartbeatsCache.lastSentHeartbeatDate=n,s.length>0?(this._heartbeatsCache.heartbeats=s,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),i}}function yc(){return new Date().toISOString().substring(0,10)}function tm(t,e=Jp){const n=[];let r=t.slice();for(const s of t){const i=n.find(o=>o.agent===s.agent);if(i){if(i.dates.push(s.date),vc(n)>e){i.dates.pop();break}}else if(n.push({agent:s.agent,dates:[s.date]}),vc(n)>e){n.pop();break}r=r.slice(1)}return{heartbeatsToSend:n,unsentEntries:r}}class nm{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return oc()?Hf().then(()=>!0).catch(()=>!1):!1}async read(){if(await this._canUseIndexedDBPromise){const n=await Xp(this.app);return n!=null&&n.heartbeats?n:{heartbeats:[]}}else return{heartbeats:[]}}async overwrite(e){var n;if(await this._canUseIndexedDBPromise){const s=await this.read();return gc(this.app,{lastSentHeartbeatDate:(n=e.lastSentHeartbeatDate)!==null&&n!==void 0?n:s.lastSentHeartbeatDate,heartbeats:e.heartbeats})}else return}async add(e){var n;if(await this._canUseIndexedDBPromise){const s=await this.read();return gc(this.app,{lastSentHeartbeatDate:(n=e.lastSentHeartbeatDate)!==null&&n!==void 0?n:s.lastSentHeartbeatDate,heartbeats:[...s.heartbeats,...e.heartbeats]})}else return}}function vc(t){return Br(JSON.stringify({version:2,heartbeats:t})).length}/**
346
+ */const fm=1024,pm=30*24*60*60*1e3;class mm{constructor(e){this.container=e,this._heartbeatsCache=null;const t=this.container.getProvider("app").getImmediate();this._storage=new _m(t),this._heartbeatsCachePromise=this._storage.read().then(r=>(this._heartbeatsCache=r,r))}async triggerHeartbeat(){var e,t;const s=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),i=Sc();if(!(((e=this._heartbeatsCache)===null||e===void 0?void 0:e.heartbeats)==null&&(this._heartbeatsCache=await this._heartbeatsCachePromise,((t=this._heartbeatsCache)===null||t===void 0?void 0:t.heartbeats)==null))&&!(this._heartbeatsCache.lastSentHeartbeatDate===i||this._heartbeatsCache.heartbeats.some(o=>o.date===i)))return this._heartbeatsCache.heartbeats.push({date:i,agent:s}),this._heartbeatsCache.heartbeats=this._heartbeatsCache.heartbeats.filter(o=>{const a=new Date(o.date).valueOf();return Date.now()-a<=pm}),this._storage.overwrite(this._heartbeatsCache)}async getHeartbeatsHeader(){var e;if(this._heartbeatsCache===null&&await this._heartbeatsCachePromise,((e=this._heartbeatsCache)===null||e===void 0?void 0:e.heartbeats)==null||this._heartbeatsCache.heartbeats.length===0)return"";const t=Sc(),{heartbeatsToSend:r,unsentEntries:s}=gm(this._heartbeatsCache.heartbeats),i=Hr(JSON.stringify({version:2,heartbeats:r}));return this._heartbeatsCache.lastSentHeartbeatDate=t,s.length>0?(this._heartbeatsCache.heartbeats=s,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),i}}function Sc(){return new Date().toISOString().substring(0,10)}function gm(n,e=fm){const t=[];let r=n.slice();for(const s of n){const i=t.find(o=>o.agent===s.agent);if(i){if(i.dates.push(s.date),bc(t)>e){i.dates.pop();break}}else if(t.push({agent:s.agent,dates:[s.date]}),bc(t)>e){t.pop();break}r=r.slice(1)}return{heartbeatsToSend:t,unsentEntries:r}}class _m{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return pc()?op().then(()=>!0).catch(()=>!1):!1}async read(){if(await this._canUseIndexedDBPromise){const t=await dm(this.app);return t!=null&&t.heartbeats?t:{heartbeats:[]}}else return{heartbeats:[]}}async overwrite(e){var t;if(await this._canUseIndexedDBPromise){const s=await this.read();return Rc(this.app,{lastSentHeartbeatDate:(t=e.lastSentHeartbeatDate)!==null&&t!==void 0?t:s.lastSentHeartbeatDate,heartbeats:e.heartbeats})}else return}async add(e){var t;if(await this._canUseIndexedDBPromise){const s=await this.read();return Rc(this.app,{lastSentHeartbeatDate:(t=e.lastSentHeartbeatDate)!==null&&t!==void 0?t:s.lastSentHeartbeatDate,heartbeats:[...s.heartbeats,...e.heartbeats]})}else return}}function bc(n){return Hr(JSON.stringify({version:2,heartbeats:n})).length}/**
347
347
  * @license
348
348
  * Copyright 2019 Google LLC
349
349
  *
@@ -358,15 +358,15 @@
358
358
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
359
359
  * See the License for the specific language governing permissions and
360
360
  * limitations under the License.
361
- */function rm(t){ut(new Ye("platform-logger",e=>new yp(e),"PRIVATE")),ut(new Ye("heartbeat",e=>new em(e),"PRIVATE")),Ae(ki,fc,t),Ae(ki,fc,"esm2017"),Ae("fire-js","")}rm("");var sm=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},y,Vi=Vi||{},R=sm||self;function Hr(t){var e=typeof t;return e=e!="object"?e:t?Array.isArray(t)?"array":e:"null",e=="array"||e=="object"&&typeof t.length=="number"}function Un(t){var e=typeof t;return e=="object"&&t!=null||e=="function"}function im(t){return Object.prototype.hasOwnProperty.call(t,Li)&&t[Li]||(t[Li]=++om)}var Li="closure_uid_"+(1e9*Math.random()>>>0),om=0;function am(t,e,n){return t.call.apply(t.bind,arguments)}function cm(t,e,n){if(!t)throw Error();if(2<arguments.length){var r=Array.prototype.slice.call(arguments,2);return function(){var s=Array.prototype.slice.call(arguments);return Array.prototype.unshift.apply(s,r),t.apply(e,s)}}return function(){return t.apply(e,arguments)}}function ae(t,e,n){return Function.prototype.bind&&Function.prototype.bind.toString().indexOf("native code")!=-1?ae=am:ae=cm,ae.apply(null,arguments)}function Wr(t,e){var n=Array.prototype.slice.call(arguments,1);return function(){var r=n.slice();return r.push.apply(r,arguments),t.apply(this,r)}}function X(t,e){function n(){}n.prototype=e.prototype,t.$=e.prototype,t.prototype=new n,t.prototype.constructor=t,t.ac=function(r,s,i){for(var o=Array(arguments.length-2),a=2;a<arguments.length;a++)o[a-2]=arguments[a];return e.prototype[s].apply(r,o)}}function ht(){this.s=this.s,this.o=this.o}var um=0;ht.prototype.s=!1,ht.prototype.sa=function(){!this.s&&(this.s=!0,this.N(),um!=0)&&im(this)},ht.prototype.N=function(){if(this.o)for(;this.o.length;)this.o.shift()()};const Ec=Array.prototype.indexOf?function(t,e){return Array.prototype.indexOf.call(t,e,void 0)}:function(t,e){if(typeof t=="string")return typeof e!="string"||e.length!=1?-1:t.indexOf(e,0);for(let n=0;n<t.length;n++)if(n in t&&t[n]===e)return n;return-1};function Mi(t){const e=t.length;if(0<e){const n=Array(e);for(let r=0;r<e;r++)n[r]=t[r];return n}return[]}function Tc(t,e){for(let n=1;n<arguments.length;n++){const r=arguments[n];if(Hr(r)){const s=t.length||0,i=r.length||0;t.length=s+i;for(let o=0;o<i;o++)t[s+o]=r[o]}else t.push(r)}}function ce(t,e){this.type=t,this.g=this.target=e,this.defaultPrevented=!1}ce.prototype.h=function(){this.defaultPrevented=!0};var lm=function(){if(!R.addEventListener||!Object.defineProperty)return!1;var t=!1,e=Object.defineProperty({},"passive",{get:function(){t=!0}});try{const n=()=>{};R.addEventListener("test",n,e),R.removeEventListener("test",n,e)}catch{}return t}();function Fn(t){return/^[\s\xa0]*$/.test(t)}function Gr(){var t=R.navigator;return t&&(t=t.userAgent)?t:""}function xe(t){return Gr().indexOf(t)!=-1}function xi(t){return xi[" "](t),t}xi[" "]=function(){};function hm(t,e){var n=rg;return Object.prototype.hasOwnProperty.call(n,t)?n[t]:n[t]=e(t)}var dm=xe("Opera"),Yt=xe("Trident")||xe("MSIE"),wc=xe("Edge"),Ui=wc||Yt,Ic=xe("Gecko")&&!(Gr().toLowerCase().indexOf("webkit")!=-1&&!xe("Edge"))&&!(xe("Trident")||xe("MSIE"))&&!xe("Edge"),fm=Gr().toLowerCase().indexOf("webkit")!=-1&&!xe("Edge");function Ac(){var t=R.document;return t?t.documentMode:void 0}var Fi;e:{var Bi="",ji=function(){var t=Gr();if(Ic)return/rv:([^\);]+)(\)|;)/.exec(t);if(wc)return/Edge\/([\d\.]+)/.exec(t);if(Yt)return/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(t);if(fm)return/WebKit\/(\S+)/.exec(t);if(dm)return/(?:Version)[ \/]?(\S+)/.exec(t)}();if(ji&&(Bi=ji?ji[1]:""),Yt){var $i=Ac();if($i!=null&&$i>parseFloat(Bi)){Fi=String($i);break e}}Fi=Bi}var qi;if(R.document&&Yt){var Rc=Ac();qi=Rc||parseInt(Fi,10)||void 0}else qi=void 0;var pm=qi;function Bn(t,e){if(ce.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(Ic){e:{try{xi(e.nodeName);var s=!0;break e}catch{}s=!1}s||(e=null)}}else n=="mouseover"?e=t.fromElement:n=="mouseout"&&(e=t.toElement);this.relatedTarget=e,r?(this.clientX=r.clientX!==void 0?r.clientX:r.pageX,this.clientY=r.clientY!==void 0?r.clientY:r.pageY,this.screenX=r.screenX||0,this.screenY=r.screenY||0):(this.clientX=t.clientX!==void 0?t.clientX:t.pageX,this.clientY=t.clientY!==void 0?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=typeof t.pointerType=="string"?t.pointerType:mm[t.pointerType]||"",this.state=t.state,this.i=t,t.defaultPrevented&&Bn.$.h.call(this)}}X(Bn,ce);var mm={2:"touch",3:"pen",4:"mouse"};Bn.prototype.h=function(){Bn.$.h.call(this);var t=this.i;t.preventDefault?t.preventDefault():t.returnValue=!1};var jn="closure_listenable_"+(1e6*Math.random()|0),gm=0;function _m(t,e,n,r,s){this.listener=t,this.proxy=null,this.src=e,this.type=n,this.capture=!!r,this.la=s,this.key=++gm,this.fa=this.ia=!1}function Kr(t){t.fa=!0,t.listener=null,t.proxy=null,t.src=null,t.la=null}function zi(t,e,n){for(const r in t)e.call(n,t[r],r,t)}function ym(t,e){for(const n in t)e.call(void 0,t[n],n,t)}function Pc(t){const e={};for(const n in t)e[n]=t[n];return e}const Sc="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function bc(t,e){let n,r;for(let s=1;s<arguments.length;s++){r=arguments[s];for(n in r)t[n]=r[n];for(let i=0;i<Sc.length;i++)n=Sc[i],Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}}function Qr(t){this.src=t,this.g={},this.h=0}Qr.prototype.add=function(t,e,n,r,s){var i=t.toString();t=this.g[i],t||(t=this.g[i]=[],this.h++);var o=Wi(t,e,r,s);return-1<o?(e=t[o],n||(e.ia=!1)):(e=new _m(e,this.src,i,!!r,s),e.ia=n,t.push(e)),e};function Hi(t,e){var n=e.type;if(n in t.g){var r=t.g[n],s=Ec(r,e),i;(i=0<=s)&&Array.prototype.splice.call(r,s,1),i&&(Kr(e),t.g[n].length==0&&(delete t.g[n],t.h--))}}function Wi(t,e,n,r){for(var s=0;s<t.length;++s){var i=t[s];if(!i.fa&&i.listener==e&&i.capture==!!n&&i.la==r)return s}return-1}var Gi="closure_lm_"+(1e6*Math.random()|0),Ki={};function Cc(t,e,n,r,s){if(r&&r.once)return Dc(t,e,n,r,s);if(Array.isArray(e)){for(var i=0;i<e.length;i++)Cc(t,e[i],n,r,s);return null}return n=Ji(n),t&&t[jn]?t.O(e,n,Un(r)?!!r.capture:!!r,s):kc(t,e,n,!1,r,s)}function kc(t,e,n,r,s,i){if(!e)throw Error("Invalid event type");var o=Un(s)?!!s.capture:!!s,a=Yi(t);if(a||(t[Gi]=a=new Qr(t)),n=a.add(e,n,r,o,i),n.proxy)return n;if(r=vm(),n.proxy=r,r.src=t,r.listener=n,t.addEventListener)lm||(s=o),s===void 0&&(s=!1),t.addEventListener(e.toString(),r,s);else if(t.attachEvent)t.attachEvent(Oc(e.toString()),r);else if(t.addListener&&t.removeListener)t.addListener(r);else throw Error("addEventListener and attachEvent are unavailable.");return n}function vm(){function t(n){return e.call(t.src,t.listener,n)}const e=Em;return t}function Dc(t,e,n,r,s){if(Array.isArray(e)){for(var i=0;i<e.length;i++)Dc(t,e[i],n,r,s);return null}return n=Ji(n),t&&t[jn]?t.P(e,n,Un(r)?!!r.capture:!!r,s):kc(t,e,n,!0,r,s)}function Nc(t,e,n,r,s){if(Array.isArray(e))for(var i=0;i<e.length;i++)Nc(t,e[i],n,r,s);else r=Un(r)?!!r.capture:!!r,n=Ji(n),t&&t[jn]?(t=t.i,e=String(e).toString(),e in t.g&&(i=t.g[e],n=Wi(i,n,r,s),-1<n&&(Kr(i[n]),Array.prototype.splice.call(i,n,1),i.length==0&&(delete t.g[e],t.h--)))):t&&(t=Yi(t))&&(e=t.g[e.toString()],t=-1,e&&(t=Wi(e,n,r,s)),(n=-1<t?e[t]:null)&&Qi(n))}function Qi(t){if(typeof t!="number"&&t&&!t.fa){var e=t.src;if(e&&e[jn])Hi(e.i,t);else{var n=t.type,r=t.proxy;e.removeEventListener?e.removeEventListener(n,r,t.capture):e.detachEvent?e.detachEvent(Oc(n),r):e.addListener&&e.removeListener&&e.removeListener(r),(n=Yi(e))?(Hi(n,t),n.h==0&&(n.src=null,e[Gi]=null)):Kr(t)}}}function Oc(t){return t in Ki?Ki[t]:Ki[t]="on"+t}function Em(t,e){if(t.fa)t=!0;else{e=new Bn(e,this);var n=t.listener,r=t.la||t.src;t.ia&&Qi(t),t=n.call(r,e)}return t}function Yi(t){return t=t[Gi],t instanceof Qr?t:null}var Xi="__closure_events_fn_"+(1e9*Math.random()>>>0);function Ji(t){return typeof t=="function"?t:(t[Xi]||(t[Xi]=function(e){return t.handleEvent(e)}),t[Xi])}function J(){ht.call(this),this.i=new Qr(this),this.S=this,this.J=null}X(J,ht),J.prototype[jn]=!0,J.prototype.removeEventListener=function(t,e,n,r){Nc(this,t,e,n,r)};function ee(t,e){var n,r=t.J;if(r)for(n=[];r;r=r.J)n.push(r);if(t=t.S,r=e.type||e,typeof e=="string")e=new ce(e,t);else if(e instanceof ce)e.target=e.target||t;else{var s=e;e=new ce(r,t),bc(e,s)}if(s=!0,n)for(var i=n.length-1;0<=i;i--){var o=e.g=n[i];s=Yr(o,r,!0,e)&&s}if(o=e.g=t,s=Yr(o,r,!0,e)&&s,s=Yr(o,r,!1,e)&&s,n)for(i=0;i<n.length;i++)o=e.g=n[i],s=Yr(o,r,!1,e)&&s}J.prototype.N=function(){if(J.$.N.call(this),this.i){var t=this.i,e;for(e in t.g){for(var n=t.g[e],r=0;r<n.length;r++)Kr(n[r]);delete t.g[e],t.h--}}this.J=null},J.prototype.O=function(t,e,n,r){return this.i.add(String(t),e,!1,n,r)},J.prototype.P=function(t,e,n,r){return this.i.add(String(t),e,!0,n,r)};function Yr(t,e,n,r){if(e=t.i.g[String(e)],!e)return!0;e=e.concat();for(var s=!0,i=0;i<e.length;++i){var o=e[i];if(o&&!o.fa&&o.capture==n){var a=o.listener,c=o.la||o.src;o.ia&&Hi(t.i,o),s=a.call(c,r)!==!1&&s}}return s&&!r.defaultPrevented}var Zi=R.JSON.stringify;class Tm{constructor(e,n){this.i=e,this.j=n,this.h=0,this.g=null}get(){let e;return 0<this.h?(this.h--,e=this.g,this.g=e.next,e.next=null):e=this.i(),e}}function wm(){var t=eo;let e=null;return t.g&&(e=t.g,t.g=t.g.next,t.g||(t.h=null),e.next=null),e}class Im{constructor(){this.h=this.g=null}add(e,n){const r=Vc.get();r.set(e,n),this.h?this.h.next=r:this.g=r,this.h=r}}var Vc=new Tm(()=>new Am,t=>t.reset());class Am{constructor(){this.next=this.g=this.h=null}set(e,n){this.h=e,this.g=n,this.next=null}reset(){this.next=this.g=this.h=null}}function Rm(t){var e=1;t=t.split(":");const n=[];for(;0<e&&t.length;)n.push(t.shift()),e--;return t.length&&n.push(t.join(":")),n}function Pm(t){R.setTimeout(()=>{throw t},0)}let $n,qn=!1,eo=new Im,Lc=()=>{const t=R.Promise.resolve(void 0);$n=()=>{t.then(Sm)}};var Sm=()=>{for(var t;t=wm();){try{t.h.call(t.g)}catch(n){Pm(n)}var e=Vc;e.j(t),100>e.h&&(e.h++,t.next=e.g,e.g=t)}qn=!1};function Xr(t,e){J.call(this),this.h=t||1,this.g=e||R,this.j=ae(this.qb,this),this.l=Date.now()}X(Xr,J),y=Xr.prototype,y.ga=!1,y.T=null,y.qb=function(){if(this.ga){var t=Date.now()-this.l;0<t&&t<.8*this.h?this.T=this.g.setTimeout(this.j,this.h-t):(this.T&&(this.g.clearTimeout(this.T),this.T=null),ee(this,"tick"),this.ga&&(to(this),this.start()))}},y.start=function(){this.ga=!0,this.T||(this.T=this.g.setTimeout(this.j,this.h),this.l=Date.now())};function to(t){t.ga=!1,t.T&&(t.g.clearTimeout(t.T),t.T=null)}y.N=function(){Xr.$.N.call(this),to(this),delete this.g};function no(t,e,n){if(typeof t=="function")n&&(t=ae(t,n));else if(t&&typeof t.handleEvent=="function")t=ae(t.handleEvent,t);else throw Error("Invalid listener argument");return 2147483647<Number(e)?-1:R.setTimeout(t,e||0)}function Mc(t){t.g=no(()=>{t.g=null,t.i&&(t.i=!1,Mc(t))},t.j);const e=t.h;t.h=null,t.m.apply(null,e)}class bm extends ht{constructor(e,n){super(),this.m=e,this.j=n,this.h=null,this.i=!1,this.g=null}l(e){this.h=arguments,this.g?this.i=!0:Mc(this)}N(){super.N(),this.g&&(R.clearTimeout(this.g),this.g=null,this.i=!1,this.h=null)}}function zn(t){ht.call(this),this.h=t,this.g={}}X(zn,ht);var xc=[];function Uc(t,e,n,r){Array.isArray(n)||(n&&(xc[0]=n.toString()),n=xc);for(var s=0;s<n.length;s++){var i=Cc(e,n[s],r||t.handleEvent,!1,t.h||t);if(!i)break;t.g[i.key]=i}}function Fc(t){zi(t.g,function(e,n){this.g.hasOwnProperty(n)&&Qi(e)},t),t.g={}}zn.prototype.N=function(){zn.$.N.call(this),Fc(this)},zn.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")};function Jr(){this.g=!0}Jr.prototype.Ea=function(){this.g=!1};function Cm(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 l=u[0];u=u[1];var h=l.split("_");o=2<=h.length&&h[1]=="type"?o+(l+"="+u+"&"):o+(l+"=redacted&")}}else o=null;else o=i;return"XMLHTTP REQ ("+r+") [attempt "+s+"]: "+e+`
362
- `+n+`
363
- `+o})}function km(t,e,n,r,s,i,o){t.info(function(){return"XMLHTTP RESP ("+r+") [ attempt "+s+"]: "+e+`
364
- `+n+`
365
- `+i+" "+o})}function Xt(t,e,n,r){t.info(function(){return"XMLHTTP TEXT ("+e+"): "+Nm(t,n)+(r?" "+r:"")})}function Dm(t,e){t.info(function(){return"TIMEOUT: "+e})}Jr.prototype.info=function(){};function Nm(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(i!="noop"&&i!="stop"&&i!="close")for(var o=1;o<s.length;o++)s[o]=""}}}}return Zi(n)}catch{return e}}var Ct={},Bc=null;function Zr(){return Bc=Bc||new J}Ct.Ta="serverreachability";function jc(t){ce.call(this,Ct.Ta,t)}X(jc,ce);function Hn(t){const e=Zr();ee(e,new jc(e))}Ct.STAT_EVENT="statevent";function $c(t,e){ce.call(this,Ct.STAT_EVENT,t),this.stat=e}X($c,ce);function fe(t){const e=Zr();ee(e,new $c(e,t))}Ct.Ua="timingevent";function qc(t,e){ce.call(this,Ct.Ua,t),this.size=e}X(qc,ce);function Wn(t,e){if(typeof t!="function")throw Error("Fn must not be null and must be a function");return R.setTimeout(function(){t()},e)}var es={NO_ERROR:0,rb:1,Eb:2,Db:3,yb:4,Cb:5,Fb:6,Qa:7,TIMEOUT:8,Ib:9},zc={wb:"complete",Sb:"success",Ra:"error",Qa:"abort",Kb:"ready",Lb:"readystatechange",TIMEOUT:"timeout",Gb:"incrementaldata",Jb:"progress",zb:"downloadprogress",$b:"uploadprogress"};function ro(){}ro.prototype.h=null;function Hc(t){return t.h||(t.h=t.i())}function Wc(){}var Gn={OPEN:"a",vb:"b",Ra:"c",Hb:"d"};function so(){ce.call(this,"d")}X(so,ce);function io(){ce.call(this,"c")}X(io,ce);var oo;function ts(){}X(ts,ro),ts.prototype.g=function(){return new XMLHttpRequest},ts.prototype.i=function(){return{}},oo=new ts;function Kn(t,e,n,r){this.l=t,this.j=e,this.m=n,this.W=r||1,this.U=new zn(this),this.P=Om,t=Ui?125:void 0,this.V=new Xr(t),this.I=null,this.i=!1,this.u=this.B=this.A=this.L=this.G=this.Y=this.C=null,this.F=[],this.g=null,this.o=0,this.s=this.v=null,this.ca=-1,this.J=!1,this.O=0,this.M=null,this.ba=this.K=this.aa=this.S=!1,this.h=new Gc}function Gc(){this.i=null,this.g="",this.h=!1}var Om=45e3,Kc={},ao={};y=Kn.prototype,y.setTimeout=function(t){this.P=t};function co(t,e,n){t.L=1,t.A=is(Xe(e)),t.u=n,t.S=!0,Qc(t,null)}function Qc(t,e){t.G=Date.now(),Qn(t),t.B=Xe(t.A);var n=t.B,r=t.W;Array.isArray(r)||(r=[String(r)]),iu(n.i,"t",r),t.o=0,n=t.l.J,t.h=new Gc,t.g=Cu(t.l,n?e:null,!t.u),0<t.O&&(t.M=new bm(ae(t.Pa,t,t.g),t.O)),Uc(t.U,t.g,"readystatechange",t.nb),e=t.I?Pc(t.I):{},t.u?(t.v||(t.v="POST"),e["Content-Type"]="application/x-www-form-urlencoded",t.g.ha(t.B,t.v,t.u,e)):(t.v="GET",t.g.ha(t.B,t.v,null,e)),Hn(),Cm(t.j,t.v,t.B,t.m,t.W,t.u)}y.nb=function(t){t=t.target;const e=this.M;e&&Ue(t)==3?e.l():this.Pa(t)},y.Pa=function(t){try{if(t==this.g)e:{const l=Ue(this.g);var e=this.g.Ia();const h=this.g.da();if(!(3>l)&&(l!=3||Ui||this.g&&(this.h.h||this.g.ja()||_u(this.g)))){this.J||l!=4||e==7||(e==8||0>=h?Hn(3):Hn(2)),ns(this);var n=this.g.da();this.ca=n;t:if(Yc(this)){var r=_u(this.g);t="";var s=r.length,i=Ue(this.g)==4;if(!this.h.i){if(typeof TextDecoder>"u"){kt(this),Yn(this);var o="";break t}this.h.i=new R.TextDecoder}for(e=0;e<s;e++)this.h.h=!0,t+=this.h.i.decode(r[e],{stream:i&&e==s-1});r.length=0,this.h.g+=t,this.o=0,o=this.h.g}else o=this.g.ja();if(this.i=n==200,km(this.j,this.v,this.B,this.m,this.W,l,n),this.i){if(this.aa&&!this.K){t:{if(this.g){var a,c=this.g;if((a=c.g?c.g.getResponseHeader("X-HTTP-Initial-Response"):null)&&!Fn(a)){var u=a;break t}}u=null}if(n=u)Xt(this.j,this.m,n,"Initial handshake response via X-HTTP-Initial-Response"),this.K=!0,uo(this,n);else{this.i=!1,this.s=3,fe(12),kt(this),Yn(this);break e}}this.S?(Xc(this,l,o),Ui&&this.i&&l==3&&(Uc(this.U,this.V,"tick",this.mb),this.V.start())):(Xt(this.j,this.m,o,null),uo(this,o)),l==4&&kt(this),this.i&&!this.J&&(l==4?Ru(this.l,this):(this.i=!1,Qn(this)))}else eg(this.g),n==400&&0<o.indexOf("Unknown SID")?(this.s=3,fe(12)):(this.s=0,fe(13)),kt(this),Yn(this)}}}catch{}finally{}};function Yc(t){return t.g?t.v=="GET"&&t.L!=2&&t.l.Ha:!1}function Xc(t,e,n){let r=!0,s;for(;!t.J&&t.o<n.length;)if(s=Vm(t,n),s==ao){e==4&&(t.s=4,fe(14),r=!1),Xt(t.j,t.m,null,"[Incomplete Response]");break}else if(s==Kc){t.s=4,fe(15),Xt(t.j,t.m,n,"[Invalid Chunk]"),r=!1;break}else Xt(t.j,t.m,s,null),uo(t,s);Yc(t)&&t.o!=0&&(t.h.g=t.h.g.slice(t.o),t.o=0),e!=4||n.length!=0||t.h.h||(t.s=1,fe(16),r=!1),t.i=t.i&&r,r?0<n.length&&!t.ba&&(t.ba=!0,e=t.l,e.g==t&&e.ca&&!e.M&&(e.l.info("Great, no buffering proxy detected. Bytes received: "+n.length),_o(e),e.M=!0,fe(11))):(Xt(t.j,t.m,n,"[Invalid Chunked Response]"),kt(t),Yn(t))}y.mb=function(){if(this.g){var t=Ue(this.g),e=this.g.ja();this.o<e.length&&(ns(this),Xc(this,t,e),this.i&&t!=4&&Qn(this))}};function Vm(t,e){var n=t.o,r=e.indexOf(`
366
- `,n);return r==-1?ao:(n=Number(e.substring(n,r)),isNaN(n)?Kc:(r+=1,r+n>e.length?ao:(e=e.slice(r,r+n),t.o=r+n,e)))}y.cancel=function(){this.J=!0,kt(this)};function Qn(t){t.Y=Date.now()+t.P,Jc(t,t.P)}function Jc(t,e){if(t.C!=null)throw Error("WatchDog timer not null");t.C=Wn(ae(t.lb,t),e)}function ns(t){t.C&&(R.clearTimeout(t.C),t.C=null)}y.lb=function(){this.C=null;const t=Date.now();0<=t-this.Y?(Dm(this.j,this.B),this.L!=2&&(Hn(),fe(17)),kt(this),this.s=2,Yn(this)):Jc(this,this.Y-t)};function Yn(t){t.l.H==0||t.J||Ru(t.l,t)}function kt(t){ns(t);var e=t.M;e&&typeof e.sa=="function"&&e.sa(),t.M=null,to(t.V),Fc(t.U),t.g&&(e=t.g,t.g=null,e.abort(),e.sa())}function uo(t,e){try{var n=t.l;if(n.H!=0&&(n.g==t||lo(n.i,t))){if(!t.K&&lo(n.i,t)&&n.H==3){try{var r=n.Ja.g.parse(e)}catch{r=null}if(Array.isArray(r)&&r.length==3){var s=r;if(s[0]==0){e:if(!n.u){if(n.g)if(n.g.G+3e3<t.G)ds(n),ls(n);else break e;go(n),fe(18)}}else n.Fa=s[1],0<n.Fa-n.V&&37500>s[2]&&n.G&&n.A==0&&!n.v&&(n.v=Wn(ae(n.ib,n),6e3));if(1>=cu(n.i)&&n.oa){try{n.oa()}catch{}n.oa=void 0}}else Nt(n,11)}else if((t.K||n.g==t)&&ds(n),!Fn(e))for(s=n.Ja.g.parse(e),e=0;e<s.length;e++){let u=s[e];if(n.V=u[0],u=u[1],n.H==2)if(u[0]=="c"){n.K=u[1],n.pa=u[2];const l=u[3];l!=null&&(n.ra=l,n.l.info("VER="+n.ra));const h=u[4];h!=null&&(n.Ga=h,n.l.info("SVER="+n.Ga));const d=u[5];d!=null&&typeof d=="number"&&0<d&&(r=1.5*d,n.L=r,n.l.info("backChannelRequestTimeoutMs_="+r)),r=n;const f=t.g;if(f){const E=f.g?f.g.getResponseHeader("X-Client-Wire-Protocol"):null;if(E){var i=r.i;i.g||E.indexOf("spdy")==-1&&E.indexOf("quic")==-1&&E.indexOf("h2")==-1||(i.j=i.l,i.g=new Set,i.h&&(ho(i,i.h),i.h=null))}if(r.F){const T=f.g?f.g.getResponseHeader("X-HTTP-Session-Id"):null;T&&(r.Da=T,j(r.I,r.F,T))}}n.H=3,n.h&&n.h.Ba(),n.ca&&(n.S=Date.now()-t.G,n.l.info("Handshake RTT: "+n.S+"ms")),r=n;var o=t;if(r.wa=bu(r,r.J?r.pa:null,r.Y),o.K){uu(r.i,o);var a=o,c=r.L;c&&a.setTimeout(c),a.C&&(ns(a),Qn(a)),r.g=o}else Iu(r);0<n.j.length&&hs(n)}else u[0]!="stop"&&u[0]!="close"||Nt(n,7);else n.H==3&&(u[0]=="stop"||u[0]=="close"?u[0]=="stop"?Nt(n,7):mo(n):u[0]!="noop"&&n.h&&n.h.Aa(u),n.A=0)}}Hn(4)}catch{}}function Lm(t){if(t.Z&&typeof t.Z=="function")return t.Z();if(typeof Map<"u"&&t instanceof Map||typeof Set<"u"&&t instanceof Set)return Array.from(t.values());if(typeof t=="string")return t.split("");if(Hr(t)){for(var e=[],n=t.length,r=0;r<n;r++)e.push(t[r]);return e}e=[],n=0;for(r in t)e[n++]=t[r];return e}function Mm(t){if(t.ta&&typeof t.ta=="function")return t.ta();if(!t.Z||typeof t.Z!="function"){if(typeof Map<"u"&&t instanceof Map)return Array.from(t.keys());if(!(typeof Set<"u"&&t instanceof Set)){if(Hr(t)||typeof t=="string"){var e=[];t=t.length;for(var n=0;n<t;n++)e.push(n);return e}e=[],n=0;for(const r in t)e[n++]=r;return e}}}function Zc(t,e){if(t.forEach&&typeof t.forEach=="function")t.forEach(e,void 0);else if(Hr(t)||typeof t=="string")Array.prototype.forEach.call(t,e,void 0);else for(var n=Mm(t),r=Lm(t),s=r.length,i=0;i<s;i++)e.call(void 0,r[i],n&&n[i],t)}var eu=RegExp("^(?:([^:/?#.]+):)?(?://(?:([^\\\\/?#]*)@)?([^\\\\/?#]*?)(?::([0-9]+))?(?=[\\\\/?#]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#([\\s\\S]*))?$");function xm(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," ")):"")}}}function Dt(t){if(this.g=this.s=this.j="",this.m=null,this.o=this.l="",this.h=!1,t instanceof Dt){this.h=t.h,rs(this,t.j),this.s=t.s,this.g=t.g,ss(this,t.m),this.l=t.l;var e=t.i,n=new Zn;n.i=e.i,e.g&&(n.g=new Map(e.g),n.h=e.h),tu(this,n),this.o=t.o}else t&&(e=String(t).match(eu))?(this.h=!1,rs(this,e[1]||"",!0),this.s=Xn(e[2]||""),this.g=Xn(e[3]||"",!0),ss(this,e[4]),this.l=Xn(e[5]||"",!0),tu(this,e[6]||"",!0),this.o=Xn(e[7]||"")):(this.h=!1,this.i=new Zn(null,this.h))}Dt.prototype.toString=function(){var t=[],e=this.j;e&&t.push(Jn(e,nu,!0),":");var n=this.g;return(n||e=="file")&&(t.push("//"),(e=this.s)&&t.push(Jn(e,nu,!0),"@"),t.push(encodeURIComponent(String(n)).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),n=this.m,n!=null&&t.push(":",String(n))),(n=this.l)&&(this.g&&n.charAt(0)!="/"&&t.push("/"),t.push(Jn(n,n.charAt(0)=="/"?Bm:Fm,!0))),(n=this.i.toString())&&t.push("?",n),(n=this.o)&&t.push("#",Jn(n,$m)),t.join("")};function Xe(t){return new Dt(t)}function rs(t,e,n){t.j=n?Xn(e,!0):e,t.j&&(t.j=t.j.replace(/:$/,""))}function ss(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 tu(t,e,n){e instanceof Zn?(t.i=e,qm(t.i,t.h)):(n||(e=Jn(e,jm)),t.i=new Zn(e,t.h))}function j(t,e,n){t.i.set(e,n)}function is(t){return j(t,"zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^Date.now()).toString(36)),t}function Xn(t,e){return t?e?decodeURI(t.replace(/%25/g,"%2525")):decodeURIComponent(t):""}function Jn(t,e,n){return typeof t=="string"?(t=encodeURI(t).replace(e,Um),n&&(t=t.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),t):null}function Um(t){return t=t.charCodeAt(0),"%"+(t>>4&15).toString(16)+(t&15).toString(16)}var nu=/[#\/\?@]/g,Fm=/[#\?:]/g,Bm=/[#\?]/g,jm=/[#\?@]/g,$m=/#/g;function Zn(t,e){this.h=this.g=null,this.i=t||null,this.j=!!e}function dt(t){t.g||(t.g=new Map,t.h=0,t.i&&xm(t.i,function(e,n){t.add(decodeURIComponent(e.replace(/\+/g," ")),n)}))}y=Zn.prototype,y.add=function(t,e){dt(this),this.i=null,t=Jt(this,t);var n=this.g.get(t);return n||this.g.set(t,n=[]),n.push(e),this.h+=1,this};function ru(t,e){dt(t),e=Jt(t,e),t.g.has(e)&&(t.i=null,t.h-=t.g.get(e).length,t.g.delete(e))}function su(t,e){return dt(t),e=Jt(t,e),t.g.has(e)}y.forEach=function(t,e){dt(this),this.g.forEach(function(n,r){n.forEach(function(s){t.call(e,s,r,this)},this)},this)},y.ta=function(){dt(this);const t=Array.from(this.g.values()),e=Array.from(this.g.keys()),n=[];for(let r=0;r<e.length;r++){const s=t[r];for(let i=0;i<s.length;i++)n.push(e[r])}return n},y.Z=function(t){dt(this);let e=[];if(typeof t=="string")su(this,t)&&(e=e.concat(this.g.get(Jt(this,t))));else{t=Array.from(this.g.values());for(let n=0;n<t.length;n++)e=e.concat(t[n])}return e},y.set=function(t,e){return dt(this),this.i=null,t=Jt(this,t),su(this,t)&&(this.h-=this.g.get(t).length),this.g.set(t,[e]),this.h+=1,this},y.get=function(t,e){return t?(t=this.Z(t),0<t.length?String(t[0]):e):e};function iu(t,e,n){ru(t,e),0<n.length&&(t.i=null,t.g.set(Jt(t,e),Mi(n)),t.h+=n.length)}y.toString=function(){if(this.i)return this.i;if(!this.g)return"";const t=[],e=Array.from(this.g.keys());for(var n=0;n<e.length;n++){var r=e[n];const i=encodeURIComponent(String(r)),o=this.Z(r);for(r=0;r<o.length;r++){var s=i;o[r]!==""&&(s+="="+encodeURIComponent(String(o[r]))),t.push(s)}}return this.i=t.join("&")};function Jt(t,e){return e=String(e),t.j&&(e=e.toLowerCase()),e}function qm(t,e){e&&!t.j&&(dt(t),t.i=null,t.g.forEach(function(n,r){var s=r.toLowerCase();r!=s&&(ru(this,r),iu(this,s,n))},t)),t.j=e}var zm=class{constructor(t,e){this.g=t,this.map=e}};function ou(t){this.l=t||Hm,R.PerformanceNavigationTiming?(t=R.performance.getEntriesByType("navigation"),t=0<t.length&&(t[0].nextHopProtocol=="hq"||t[0].nextHopProtocol=="h2")):t=!!(R.g&&R.g.Ka&&R.g.Ka()&&R.g.Ka().dc),this.j=t?this.l:1,this.g=null,1<this.j&&(this.g=new Set),this.h=null,this.i=[]}var Hm=10;function au(t){return t.h?!0:t.g?t.g.size>=t.j:!1}function cu(t){return t.h?1:t.g?t.g.size:0}function lo(t,e){return t.h?t.h==e:t.g?t.g.has(e):!1}function ho(t,e){t.g?t.g.add(e):t.h=e}function uu(t,e){t.h&&t.h==e?t.h=null:t.g&&t.g.has(e)&&t.g.delete(e)}ou.prototype.cancel=function(){if(this.i=lu(this),this.h)this.h.cancel(),this.h=null;else if(this.g&&this.g.size!==0){for(const t of this.g.values())t.cancel();this.g.clear()}};function lu(t){if(t.h!=null)return t.i.concat(t.h.F);if(t.g!=null&&t.g.size!==0){let e=t.i;for(const n of t.g.values())e=e.concat(n.F);return e}return Mi(t.i)}var Wm=class{stringify(t){return R.JSON.stringify(t,void 0)}parse(t){return R.JSON.parse(t,void 0)}};function Gm(){this.g=new Wm}function Km(t,e,n){const r=n||"";try{Zc(t,function(s,i){let o=s;Un(s)&&(o=Zi(s)),e.push(r+i+"="+encodeURIComponent(o))})}catch(s){throw e.push(r+"type="+encodeURIComponent("_badmap")),s}}function Qm(t,e){const n=new Jr;if(R.Image){const r=new Image;r.onload=Wr(os,n,r,"TestLoadImage: loaded",!0,e),r.onerror=Wr(os,n,r,"TestLoadImage: error",!1,e),r.onabort=Wr(os,n,r,"TestLoadImage: abort",!1,e),r.ontimeout=Wr(os,n,r,"TestLoadImage: timeout",!1,e),R.setTimeout(function(){r.ontimeout&&r.ontimeout()},1e4),r.src=t}else e(!1)}function os(t,e,n,r,s){try{e.onload=null,e.onerror=null,e.onabort=null,e.ontimeout=null,s(r)}catch{}}function as(t){this.l=t.ec||null,this.j=t.ob||!1}X(as,ro),as.prototype.g=function(){return new cs(this.l,this.j)},as.prototype.i=function(t){return function(){return t}}({});function cs(t,e){J.call(this),this.F=t,this.u=e,this.m=void 0,this.readyState=fo,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}X(cs,J);var fo=0;y=cs.prototype,y.open=function(t,e){if(this.readyState!=fo)throw this.abort(),Error("Error reopening a connection");this.C=t,this.B=e,this.readyState=1,tr(this)},y.send=function(t){if(this.readyState!=1)throw this.abort(),Error("need to call open() first. ");this.g=!0;const e={headers:this.v,method:this.C,credentials:this.m,cache:void 0};t&&(e.body=t),(this.F||R).fetch(new Request(this.B,e)).then(this.$a.bind(this),this.ka.bind(this))},y.abort=function(){this.response=this.responseText="",this.v=new Headers,this.status=0,this.j&&this.j.cancel("Request was aborted.").catch(()=>{}),1<=this.readyState&&this.g&&this.readyState!=4&&(this.g=!1,er(this)),this.readyState=fo},y.$a=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,tr(this)),this.g&&(this.readyState=3,tr(this),this.g)))if(this.responseType==="arraybuffer")t.arrayBuffer().then(this.Ya.bind(this),this.ka.bind(this));else if(typeof R.ReadableStream<"u"&&"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;hu(this)}else t.text().then(this.Za.bind(this),this.ka.bind(this))};function hu(t){t.j.read().then(t.Xa.bind(t)).catch(t.ka.bind(t))}y.Xa=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?er(this):tr(this),this.readyState==3&&hu(this)}},y.Za=function(t){this.g&&(this.response=this.responseText=t,er(this))},y.Ya=function(t){this.g&&(this.response=t,er(this))},y.ka=function(){this.g&&er(this)};function er(t){t.readyState=4,t.l=null,t.j=null,t.A=null,tr(t)}y.setRequestHeader=function(t,e){this.v.append(t,e)},y.getResponseHeader=function(t){return this.h&&this.h.get(t.toLowerCase())||""},y.getAllResponseHeaders=function(){if(!this.h)return"";const t=[],e=this.h.entries();for(var n=e.next();!n.done;)n=n.value,t.push(n[0]+": "+n[1]),n=e.next();return t.join(`\r
367
- `)};function tr(t){t.onreadystatechange&&t.onreadystatechange.call(t)}Object.defineProperty(cs.prototype,"withCredentials",{get:function(){return this.m==="include"},set:function(t){this.m=t?"include":"same-origin"}});var Ym=R.JSON.parse;function H(t){J.call(this),this.headers=new Map,this.u=t||null,this.h=!1,this.C=this.g=null,this.I="",this.m=0,this.j="",this.l=this.G=this.v=this.F=!1,this.B=0,this.A=null,this.K=du,this.L=this.M=!1}X(H,J);var du="",Xm=/^https?$/i,Jm=["POST","PUT"];y=H.prototype,y.Oa=function(t){this.M=t},y.ha=function(t,e,n,r){if(this.g)throw Error("[goog.net.XhrIo] Object is active with another request="+this.I+"; newUri="+t);e=e?e.toUpperCase():"GET",this.I=t,this.j="",this.m=0,this.F=!1,this.h=!0,this.g=this.u?this.u.g():oo.g(),this.C=this.u?Hc(this.u):Hc(oo),this.g.onreadystatechange=ae(this.La,this);try{this.G=!0,this.g.open(e,String(t),!0),this.G=!1}catch(i){fu(this,i);return}if(t=n||"",n=new Map(this.headers),r)if(Object.getPrototypeOf(r)===Object.prototype)for(var s in r)n.set(s,r[s]);else if(typeof r.keys=="function"&&typeof r.get=="function")for(const i of r.keys())n.set(i,r.get(i));else throw Error("Unknown input type for opt_headers: "+String(r));r=Array.from(n.keys()).find(i=>i.toLowerCase()=="content-type"),s=R.FormData&&t instanceof R.FormData,!(0<=Ec(Jm,e))||r||s||n.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8");for(const[i,o]of n)this.g.setRequestHeader(i,o);this.K&&(this.g.responseType=this.K),"withCredentials"in this.g&&this.g.withCredentials!==this.M&&(this.g.withCredentials=this.M);try{gu(this),0<this.B&&((this.L=Zm(this.g))?(this.g.timeout=this.B,this.g.ontimeout=ae(this.ua,this)):this.A=no(this.ua,this.B,this)),this.v=!0,this.g.send(t),this.v=!1}catch(i){fu(this,i)}};function Zm(t){return Yt&&typeof t.timeout=="number"&&t.ontimeout!==void 0}y.ua=function(){typeof Vi<"u"&&this.g&&(this.j="Timed out after "+this.B+"ms, aborting",this.m=8,ee(this,"timeout"),this.abort(8))};function fu(t,e){t.h=!1,t.g&&(t.l=!0,t.g.abort(),t.l=!1),t.j=e,t.m=5,pu(t),us(t)}function pu(t){t.F||(t.F=!0,ee(t,"complete"),ee(t,"error"))}y.abort=function(t){this.g&&this.h&&(this.h=!1,this.l=!0,this.g.abort(),this.l=!1,this.m=t||7,ee(this,"complete"),ee(this,"abort"),us(this))},y.N=function(){this.g&&(this.h&&(this.h=!1,this.l=!0,this.g.abort(),this.l=!1),us(this,!0)),H.$.N.call(this)},y.La=function(){this.s||(this.G||this.v||this.l?mu(this):this.kb())},y.kb=function(){mu(this)};function mu(t){if(t.h&&typeof Vi<"u"&&(!t.C[1]||Ue(t)!=4||t.da()!=2)){if(t.v&&Ue(t)==4)no(t.La,0,t);else if(ee(t,"readystatechange"),Ue(t)==4){t.h=!1;try{const o=t.da();e:switch(o){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var e=!0;break e;default:e=!1}var n;if(!(n=e)){var r;if(r=o===0){var s=String(t.I).match(eu)[1]||null;!s&&R.self&&R.self.location&&(s=R.self.location.protocol.slice(0,-1)),r=!Xm.test(s?s.toLowerCase():"")}n=r}if(n)ee(t,"complete"),ee(t,"success");else{t.m=6;try{var i=2<Ue(t)?t.g.statusText:""}catch{i=""}t.j=i+" ["+t.da()+"]",pu(t)}}finally{us(t)}}}}function us(t,e){if(t.g){gu(t);const n=t.g,r=t.C[0]?()=>{}:null;t.g=null,t.C=null,e||ee(t,"ready");try{n.onreadystatechange=r}catch{}}}function gu(t){t.g&&t.L&&(t.g.ontimeout=null),t.A&&(R.clearTimeout(t.A),t.A=null)}y.isActive=function(){return!!this.g};function Ue(t){return t.g?t.g.readyState:0}y.da=function(){try{return 2<Ue(this)?this.g.status:-1}catch{return-1}},y.ja=function(){try{return this.g?this.g.responseText:""}catch{return""}},y.Wa=function(t){if(this.g){var e=this.g.responseText;return t&&e.indexOf(t)==0&&(e=e.substring(t.length)),Ym(e)}};function _u(t){try{if(!t.g)return null;if("response"in t.g)return t.g.response;switch(t.K){case du:case"text":return t.g.responseText;case"arraybuffer":if("mozResponseArrayBuffer"in t.g)return t.g.mozResponseArrayBuffer}return null}catch{return null}}function eg(t){const e={};t=(t.g&&2<=Ue(t)&&t.g.getAllResponseHeaders()||"").split(`\r
368
- `);for(let r=0;r<t.length;r++){if(Fn(t[r]))continue;var n=Rm(t[r]);const s=n[0];if(n=n[1],typeof n!="string")continue;n=n.trim();const i=e[s]||[];e[s]=i,i.push(n)}ym(e,function(r){return r.join(", ")})}y.Ia=function(){return this.m},y.Sa=function(){return typeof this.j=="string"?this.j:String(this.j)};function yu(t){let e="";return zi(t,function(n,r){e+=r,e+=":",e+=n,e+=`\r
369
- `}),e}function po(t,e,n){e:{for(r in n){var r=!1;break e}r=!0}r||(n=yu(n),typeof t=="string"?n!=null&&encodeURIComponent(String(n)):j(t,e,n))}function nr(t,e,n){return n&&n.internalChannelParams&&n.internalChannelParams[t]||e}function vu(t){this.Ga=0,this.j=[],this.l=new Jr,this.pa=this.wa=this.I=this.Y=this.g=this.Da=this.F=this.na=this.o=this.U=this.s=null,this.fb=this.W=0,this.cb=nr("failFast",!1,t),this.G=this.v=this.u=this.m=this.h=null,this.aa=!0,this.Fa=this.V=-1,this.ba=this.A=this.C=0,this.ab=nr("baseRetryDelayMs",5e3,t),this.hb=nr("retryDelaySeedMs",1e4,t),this.eb=nr("forwardChannelMaxRetries",2,t),this.xa=nr("forwardChannelRequestTimeoutMs",2e4,t),this.va=t&&t.xmlHttpFactory||void 0,this.Ha=t&&t.useFetchStreams||!1,this.L=void 0,this.J=t&&t.supportsCrossDomainXhr||!1,this.K="",this.i=new ou(t&&t.concurrentRequestLimit),this.Ja=new Gm,this.P=t&&t.fastHandshake||!1,this.O=t&&t.encodeInitMessageHeaders||!1,this.P&&this.O&&(this.O=!1),this.bb=t&&t.bc||!1,t&&t.Ea&&this.l.Ea(),t&&t.forceLongPolling&&(this.aa=!1),this.ca=!this.P&&this.aa&&t&&t.detectBufferingProxy||!1,this.qa=void 0,t&&t.longPollingTimeout&&0<t.longPollingTimeout&&(this.qa=t.longPollingTimeout),this.oa=void 0,this.S=0,this.M=!1,this.ma=this.B=null}y=vu.prototype,y.ra=8,y.H=1;function mo(t){if(Eu(t),t.H==3){var e=t.W++,n=Xe(t.I);if(j(n,"SID",t.K),j(n,"RID",e),j(n,"TYPE","terminate"),rr(t,n),e=new Kn(t,t.l,e),e.L=2,e.A=is(Xe(n)),n=!1,R.navigator&&R.navigator.sendBeacon)try{n=R.navigator.sendBeacon(e.A.toString(),"")}catch{}!n&&R.Image&&(new Image().src=e.A,n=!0),n||(e.g=Cu(e.l,null),e.g.ha(e.A)),e.G=Date.now(),Qn(e)}Su(t)}function ls(t){t.g&&(_o(t),t.g.cancel(),t.g=null)}function Eu(t){ls(t),t.u&&(R.clearTimeout(t.u),t.u=null),ds(t),t.i.cancel(),t.m&&(typeof t.m=="number"&&R.clearTimeout(t.m),t.m=null)}function hs(t){if(!au(t.i)&&!t.m){t.m=!0;var e=t.Na;$n||Lc(),qn||($n(),qn=!0),eo.add(e,t),t.C=0}}function tg(t,e){return cu(t.i)>=t.i.j-(t.m?1:0)?!1:t.m?(t.j=e.F.concat(t.j),!0):t.H==1||t.H==2||t.C>=(t.cb?0:t.eb)?!1:(t.m=Wn(ae(t.Na,t,e),Pu(t,t.C)),t.C++,!0)}y.Na=function(t){if(this.m)if(this.m=null,this.H==1){if(!t){this.W=Math.floor(1e5*Math.random()),t=this.W++;const s=new Kn(this,this.l,t);let i=this.s;if(this.U&&(i?(i=Pc(i),bc(i,this.U)):i=this.U),this.o!==null||this.O||(s.I=i,i=null),this.P)e:{for(var e=0,n=0;n<this.j.length;n++){t:{var r=this.j[n];if("__data__"in r.map&&(r=r.map.__data__,typeof r=="string")){r=r.length;break t}r=void 0}if(r===void 0)break;if(e+=r,4096<e){e=n;break e}if(e===4096||n===this.j.length-1){e=n+1;break e}}e=1e3}else e=1e3;e=wu(this,s,e),n=Xe(this.I),j(n,"RID",t),j(n,"CVER",22),this.F&&j(n,"X-HTTP-Session-Id",this.F),rr(this,n),i&&(this.O?e="headers="+encodeURIComponent(String(yu(i)))+"&"+e:this.o&&po(n,this.o,i)),ho(this.i,s),this.bb&&j(n,"TYPE","init"),this.P?(j(n,"$req",e),j(n,"SID","null"),s.aa=!0,co(s,n,null)):co(s,n,e),this.H=2}}else this.H==3&&(t?Tu(this,t):this.j.length==0||au(this.i)||Tu(this))};function Tu(t,e){var n;e?n=e.m:n=t.W++;const r=Xe(t.I);j(r,"SID",t.K),j(r,"RID",n),j(r,"AID",t.V),rr(t,r),t.o&&t.s&&po(r,t.o,t.s),n=new Kn(t,t.l,n,t.C+1),t.o===null&&(n.I=t.s),e&&(t.j=e.F.concat(t.j)),e=wu(t,n,1e3),n.setTimeout(Math.round(.5*t.xa)+Math.round(.5*t.xa*Math.random())),ho(t.i,n),co(n,r,e)}function rr(t,e){t.na&&zi(t.na,function(n,r){j(e,r,n)}),t.h&&Zc({},function(n,r){j(e,r,n)})}function wu(t,e,n){n=Math.min(t.j.length,n);var r=t.h?ae(t.h.Va,t.h,t):null;e:{var s=t.j;let i=-1;for(;;){const o=["count="+n];i==-1?0<n?(i=s[0].g,o.push("ofs="+i)):i=0:o.push("ofs="+i);let a=!0;for(let c=0;c<n;c++){let u=s[c].g;const l=s[c].map;if(u-=i,0>u)i=Math.max(0,s[c].g-100),a=!1;else try{Km(l,o,"req"+u+"_")}catch{r&&r(l)}}if(a){r=o.join("&");break e}}}return t=t.j.splice(0,n),e.F=t,r}function Iu(t){if(!t.g&&!t.u){t.ba=1;var e=t.Ma;$n||Lc(),qn||($n(),qn=!0),eo.add(e,t),t.A=0}}function go(t){return t.g||t.u||3<=t.A?!1:(t.ba++,t.u=Wn(ae(t.Ma,t),Pu(t,t.A)),t.A++,!0)}y.Ma=function(){if(this.u=null,Au(this),this.ca&&!(this.M||this.g==null||0>=this.S)){var t=2*this.S;this.l.info("BP detection timer enabled: "+t),this.B=Wn(ae(this.jb,this),t)}},y.jb=function(){this.B&&(this.B=null,this.l.info("BP detection timeout reached."),this.l.info("Buffering proxy detected and switch to long-polling!"),this.G=!1,this.M=!0,fe(10),ls(this),Au(this))};function _o(t){t.B!=null&&(R.clearTimeout(t.B),t.B=null)}function Au(t){t.g=new Kn(t,t.l,"rpc",t.ba),t.o===null&&(t.g.I=t.s),t.g.O=0;var e=Xe(t.wa);j(e,"RID","rpc"),j(e,"SID",t.K),j(e,"AID",t.V),j(e,"CI",t.G?"0":"1"),!t.G&&t.qa&&j(e,"TO",t.qa),j(e,"TYPE","xmlhttp"),rr(t,e),t.o&&t.s&&po(e,t.o,t.s),t.L&&t.g.setTimeout(t.L);var n=t.g;t=t.pa,n.L=1,n.A=is(Xe(e)),n.u=null,n.S=!0,Qc(n,t)}y.ib=function(){this.v!=null&&(this.v=null,ls(this),go(this),fe(19))};function ds(t){t.v!=null&&(R.clearTimeout(t.v),t.v=null)}function Ru(t,e){var n=null;if(t.g==e){ds(t),_o(t),t.g=null;var r=2}else if(lo(t.i,e))n=e.F,uu(t.i,e),r=1;else return;if(t.H!=0){if(e.i)if(r==1){n=e.u?e.u.length:0,e=Date.now()-e.G;var s=t.C;r=Zr(),ee(r,new qc(r,n)),hs(t)}else Iu(t);else if(s=e.s,s==3||s==0&&0<e.ca||!(r==1&&tg(t,e)||r==2&&go(t)))switch(n&&0<n.length&&(e=t.i,e.i=e.i.concat(n)),s){case 1:Nt(t,5);break;case 4:Nt(t,10);break;case 3:Nt(t,6);break;default:Nt(t,2)}}}function Pu(t,e){let n=t.ab+Math.floor(Math.random()*t.hb);return t.isActive()||(n*=2),n*e}function Nt(t,e){if(t.l.info("Error code "+e),e==2){var n=null;t.h&&(n=null);var r=ae(t.pb,t);n||(n=new Dt("//www.google.com/images/cleardot.gif"),R.location&&R.location.protocol=="http"||rs(n,"https"),is(n)),Qm(n.toString(),r)}else fe(2);t.H=0,t.h&&t.h.za(e),Su(t),Eu(t)}y.pb=function(t){t?(this.l.info("Successfully pinged google.com"),fe(2)):(this.l.info("Failed to ping google.com"),fe(1))};function Su(t){if(t.H=0,t.ma=[],t.h){const e=lu(t.i);(e.length!=0||t.j.length!=0)&&(Tc(t.ma,e),Tc(t.ma,t.j),t.i.i.length=0,Mi(t.j),t.j.length=0),t.h.ya()}}function bu(t,e,n){var r=n instanceof Dt?Xe(n):new Dt(n);if(r.g!="")e&&(r.g=e+"."+r.g),ss(r,r.m);else{var s=R.location;r=s.protocol,e=e?e+"."+s.hostname:s.hostname,s=+s.port;var i=new Dt(null);r&&rs(i,r),e&&(i.g=e),s&&ss(i,s),n&&(i.l=n),r=i}return n=t.F,e=t.Da,n&&e&&j(r,n,e),j(r,"VER",t.ra),rr(t,r),r}function Cu(t,e,n){if(e&&!t.J)throw Error("Can't create secondary domain capable XhrIo object.");return e=t.Ha&&!t.va?new H(new as({ob:n})):new H(t.va),e.Oa(t.J),e}y.isActive=function(){return!!this.h&&this.h.isActive(this)};function ku(){}y=ku.prototype,y.Ba=function(){},y.Aa=function(){},y.za=function(){},y.ya=function(){},y.isActive=function(){return!0},y.Va=function(){};function fs(){if(Yt&&!(10<=Number(pm)))throw Error("Environmental error: no available transport.")}fs.prototype.g=function(t,e){return new Ee(t,e)};function Ee(t,e){J.call(this),this.g=new vu(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.Ca&&(t?t["X-WebChannel-Client-Profile"]=e.Ca:t={"X-WebChannel-Client-Profile":e.Ca}),this.g.U=t,(t=e&&e.cc)&&!Fn(t)&&(this.g.o=t),this.A=e&&e.supportsCrossDomainXhr||!1,this.v=e&&e.sendRawJson||!1,(e=e&&e.httpSessionIdParam)&&!Fn(e)&&(this.g.F=e,t=this.h,t!==null&&e in t&&(t=this.h,e in t&&delete t[e])),this.j=new Zt(this)}X(Ee,J),Ee.prototype.m=function(){this.g.h=this.j,this.A&&(this.g.J=!0);var t=this.g,e=this.l,n=this.h||void 0;fe(0),t.Y=e,t.na=n||{},t.G=t.aa,t.I=bu(t,null,t.Y),hs(t)},Ee.prototype.close=function(){mo(this.g)},Ee.prototype.u=function(t){var e=this.g;if(typeof t=="string"){var n={};n.__data__=t,t=n}else this.v&&(n={},n.__data__=Zi(t),t=n);e.j.push(new zm(e.fb++,t)),e.H==3&&hs(e)},Ee.prototype.N=function(){this.g.h=null,delete this.j,mo(this.g),delete this.g,Ee.$.N.call(this)};function Du(t){so.call(this),t.__headers__&&(this.headers=t.__headers__,this.statusCode=t.__status__,delete t.__headers__,delete t.__status__);var e=t.__sm__;if(e){e:{for(const n in e){t=n;break e}t=void 0}(this.i=t)&&(t=this.i,e=e!==null&&t in e?e[t]:void 0),this.data=e}else this.data=t}X(Du,so);function Nu(){io.call(this),this.status=1}X(Nu,io);function Zt(t){this.g=t}X(Zt,ku),Zt.prototype.Ba=function(){ee(this.g,"a")},Zt.prototype.Aa=function(t){ee(this.g,new Du(t))},Zt.prototype.za=function(t){ee(this.g,new Nu)},Zt.prototype.ya=function(){ee(this.g,"b")};function ng(){this.blockSize=-1}function ke(){this.blockSize=-1,this.blockSize=64,this.g=Array(4),this.m=Array(this.blockSize),this.i=this.h=0,this.reset()}X(ke,ng),ke.prototype.reset=function(){this.g[0]=1732584193,this.g[1]=4023233417,this.g[2]=2562383102,this.g[3]=271733878,this.i=this.h=0};function yo(t,e,n){n||(n=0);var r=Array(16);if(typeof e=="string")for(var s=0;16>s;++s)r[s]=e.charCodeAt(n++)|e.charCodeAt(n++)<<8|e.charCodeAt(n++)<<16|e.charCodeAt(n++)<<24;else for(s=0;16>s;++s)r[s]=e[n++]|e[n++]<<8|e[n++]<<16|e[n++]<<24;e=t.g[0],n=t.g[1],s=t.g[2];var i=t.g[3],o=e+(i^n&(s^i))+r[0]+3614090360&4294967295;e=n+(o<<7&4294967295|o>>>25),o=i+(s^e&(n^s))+r[1]+3905402710&4294967295,i=e+(o<<12&4294967295|o>>>20),o=s+(n^i&(e^n))+r[2]+606105819&4294967295,s=i+(o<<17&4294967295|o>>>15),o=n+(e^s&(i^e))+r[3]+3250441966&4294967295,n=s+(o<<22&4294967295|o>>>10),o=e+(i^n&(s^i))+r[4]+4118548399&4294967295,e=n+(o<<7&4294967295|o>>>25),o=i+(s^e&(n^s))+r[5]+1200080426&4294967295,i=e+(o<<12&4294967295|o>>>20),o=s+(n^i&(e^n))+r[6]+2821735955&4294967295,s=i+(o<<17&4294967295|o>>>15),o=n+(e^s&(i^e))+r[7]+4249261313&4294967295,n=s+(o<<22&4294967295|o>>>10),o=e+(i^n&(s^i))+r[8]+1770035416&4294967295,e=n+(o<<7&4294967295|o>>>25),o=i+(s^e&(n^s))+r[9]+2336552879&4294967295,i=e+(o<<12&4294967295|o>>>20),o=s+(n^i&(e^n))+r[10]+4294925233&4294967295,s=i+(o<<17&4294967295|o>>>15),o=n+(e^s&(i^e))+r[11]+2304563134&4294967295,n=s+(o<<22&4294967295|o>>>10),o=e+(i^n&(s^i))+r[12]+1804603682&4294967295,e=n+(o<<7&4294967295|o>>>25),o=i+(s^e&(n^s))+r[13]+4254626195&4294967295,i=e+(o<<12&4294967295|o>>>20),o=s+(n^i&(e^n))+r[14]+2792965006&4294967295,s=i+(o<<17&4294967295|o>>>15),o=n+(e^s&(i^e))+r[15]+1236535329&4294967295,n=s+(o<<22&4294967295|o>>>10),o=e+(s^i&(n^s))+r[1]+4129170786&4294967295,e=n+(o<<5&4294967295|o>>>27),o=i+(n^s&(e^n))+r[6]+3225465664&4294967295,i=e+(o<<9&4294967295|o>>>23),o=s+(e^n&(i^e))+r[11]+643717713&4294967295,s=i+(o<<14&4294967295|o>>>18),o=n+(i^e&(s^i))+r[0]+3921069994&4294967295,n=s+(o<<20&4294967295|o>>>12),o=e+(s^i&(n^s))+r[5]+3593408605&4294967295,e=n+(o<<5&4294967295|o>>>27),o=i+(n^s&(e^n))+r[10]+38016083&4294967295,i=e+(o<<9&4294967295|o>>>23),o=s+(e^n&(i^e))+r[15]+3634488961&4294967295,s=i+(o<<14&4294967295|o>>>18),o=n+(i^e&(s^i))+r[4]+3889429448&4294967295,n=s+(o<<20&4294967295|o>>>12),o=e+(s^i&(n^s))+r[9]+568446438&4294967295,e=n+(o<<5&4294967295|o>>>27),o=i+(n^s&(e^n))+r[14]+3275163606&4294967295,i=e+(o<<9&4294967295|o>>>23),o=s+(e^n&(i^e))+r[3]+4107603335&4294967295,s=i+(o<<14&4294967295|o>>>18),o=n+(i^e&(s^i))+r[8]+1163531501&4294967295,n=s+(o<<20&4294967295|o>>>12),o=e+(s^i&(n^s))+r[13]+2850285829&4294967295,e=n+(o<<5&4294967295|o>>>27),o=i+(n^s&(e^n))+r[2]+4243563512&4294967295,i=e+(o<<9&4294967295|o>>>23),o=s+(e^n&(i^e))+r[7]+1735328473&4294967295,s=i+(o<<14&4294967295|o>>>18),o=n+(i^e&(s^i))+r[12]+2368359562&4294967295,n=s+(o<<20&4294967295|o>>>12),o=e+(n^s^i)+r[5]+4294588738&4294967295,e=n+(o<<4&4294967295|o>>>28),o=i+(e^n^s)+r[8]+2272392833&4294967295,i=e+(o<<11&4294967295|o>>>21),o=s+(i^e^n)+r[11]+1839030562&4294967295,s=i+(o<<16&4294967295|o>>>16),o=n+(s^i^e)+r[14]+4259657740&4294967295,n=s+(o<<23&4294967295|o>>>9),o=e+(n^s^i)+r[1]+2763975236&4294967295,e=n+(o<<4&4294967295|o>>>28),o=i+(e^n^s)+r[4]+1272893353&4294967295,i=e+(o<<11&4294967295|o>>>21),o=s+(i^e^n)+r[7]+4139469664&4294967295,s=i+(o<<16&4294967295|o>>>16),o=n+(s^i^e)+r[10]+3200236656&4294967295,n=s+(o<<23&4294967295|o>>>9),o=e+(n^s^i)+r[13]+681279174&4294967295,e=n+(o<<4&4294967295|o>>>28),o=i+(e^n^s)+r[0]+3936430074&4294967295,i=e+(o<<11&4294967295|o>>>21),o=s+(i^e^n)+r[3]+3572445317&4294967295,s=i+(o<<16&4294967295|o>>>16),o=n+(s^i^e)+r[6]+76029189&4294967295,n=s+(o<<23&4294967295|o>>>9),o=e+(n^s^i)+r[9]+3654602809&4294967295,e=n+(o<<4&4294967295|o>>>28),o=i+(e^n^s)+r[12]+3873151461&4294967295,i=e+(o<<11&4294967295|o>>>21),o=s+(i^e^n)+r[15]+530742520&4294967295,s=i+(o<<16&4294967295|o>>>16),o=n+(s^i^e)+r[2]+3299628645&4294967295,n=s+(o<<23&4294967295|o>>>9),o=e+(s^(n|~i))+r[0]+4096336452&4294967295,e=n+(o<<6&4294967295|o>>>26),o=i+(n^(e|~s))+r[7]+1126891415&4294967295,i=e+(o<<10&4294967295|o>>>22),o=s+(e^(i|~n))+r[14]+2878612391&4294967295,s=i+(o<<15&4294967295|o>>>17),o=n+(i^(s|~e))+r[5]+4237533241&4294967295,n=s+(o<<21&4294967295|o>>>11),o=e+(s^(n|~i))+r[12]+1700485571&4294967295,e=n+(o<<6&4294967295|o>>>26),o=i+(n^(e|~s))+r[3]+2399980690&4294967295,i=e+(o<<10&4294967295|o>>>22),o=s+(e^(i|~n))+r[10]+4293915773&4294967295,s=i+(o<<15&4294967295|o>>>17),o=n+(i^(s|~e))+r[1]+2240044497&4294967295,n=s+(o<<21&4294967295|o>>>11),o=e+(s^(n|~i))+r[8]+1873313359&4294967295,e=n+(o<<6&4294967295|o>>>26),o=i+(n^(e|~s))+r[15]+4264355552&4294967295,i=e+(o<<10&4294967295|o>>>22),o=s+(e^(i|~n))+r[6]+2734768916&4294967295,s=i+(o<<15&4294967295|o>>>17),o=n+(i^(s|~e))+r[13]+1309151649&4294967295,n=s+(o<<21&4294967295|o>>>11),o=e+(s^(n|~i))+r[4]+4149444226&4294967295,e=n+(o<<6&4294967295|o>>>26),o=i+(n^(e|~s))+r[11]+3174756917&4294967295,i=e+(o<<10&4294967295|o>>>22),o=s+(e^(i|~n))+r[2]+718787259&4294967295,s=i+(o<<15&4294967295|o>>>17),o=n+(i^(s|~e))+r[9]+3951481745&4294967295,t.g[0]=t.g[0]+e&4294967295,t.g[1]=t.g[1]+(s+(o<<21&4294967295|o>>>11))&4294967295,t.g[2]=t.g[2]+s&4294967295,t.g[3]=t.g[3]+i&4294967295}ke.prototype.j=function(t,e){e===void 0&&(e=t.length);for(var n=e-this.blockSize,r=this.m,s=this.h,i=0;i<e;){if(s==0)for(;i<=n;)yo(this,t,i),i+=this.blockSize;if(typeof t=="string"){for(;i<e;)if(r[s++]=t.charCodeAt(i++),s==this.blockSize){yo(this,r),s=0;break}}else for(;i<e;)if(r[s++]=t[i++],s==this.blockSize){yo(this,r),s=0;break}}this.h=s,this.i+=e},ke.prototype.l=function(){var t=Array((56>this.h?this.blockSize:2*this.blockSize)-this.h);t[0]=128;for(var e=1;e<t.length-8;++e)t[e]=0;var n=8*this.i;for(e=t.length-8;e<t.length;++e)t[e]=n&255,n/=256;for(this.j(t),t=Array(16),e=n=0;4>e;++e)for(var r=0;32>r;r+=8)t[n++]=this.g[e]>>>r&255;return t};function U(t,e){this.h=e;for(var n=[],r=!0,s=t.length-1;0<=s;s--){var i=t[s]|0;r&&i==e||(n[s]=i,r=!1)}this.g=n}var rg={};function vo(t){return-128<=t&&128>t?hm(t,function(e){return new U([e|0],0>e?-1:0)}):new U([t|0],0>t?-1:0)}function Fe(t){if(isNaN(t)||!isFinite(t))return en;if(0>t)return te(Fe(-t));for(var e=[],n=1,r=0;t>=n;r++)e[r]=t/n|0,n*=Eo;return new U(e,0)}function Ou(t,e){if(t.length==0)throw Error("number format error: empty string");if(e=e||10,2>e||36<e)throw Error("radix out of range: "+e);if(t.charAt(0)=="-")return te(Ou(t.substring(1),e));if(0<=t.indexOf("-"))throw Error('number format error: interior "-" character');for(var n=Fe(Math.pow(e,8)),r=en,s=0;s<t.length;s+=8){var i=Math.min(8,t.length-s),o=parseInt(t.substring(s,s+i),e);8>i?(i=Fe(Math.pow(e,i)),r=r.R(i).add(Fe(o))):(r=r.R(n),r=r.add(Fe(o)))}return r}var Eo=4294967296,en=vo(0),To=vo(1),Vu=vo(16777216);y=U.prototype,y.ea=function(){if(Re(this))return-te(this).ea();for(var t=0,e=1,n=0;n<this.g.length;n++){var r=this.D(n);t+=(0<=r?r:Eo+r)*e,e*=Eo}return t},y.toString=function(t){if(t=t||10,2>t||36<t)throw Error("radix out of range: "+t);if(Je(this))return"0";if(Re(this))return"-"+te(this).toString(t);for(var e=Fe(Math.pow(t,6)),n=this,r="";;){var s=gs(n,e).g;n=ps(n,s.R(e));var i=((0<n.g.length?n.g[0]:n.h)>>>0).toString(t);if(n=s,Je(n))return i+r;for(;6>i.length;)i="0"+i;r=i+r}},y.D=function(t){return 0>t?0:t<this.g.length?this.g[t]:this.h};function Je(t){if(t.h!=0)return!1;for(var e=0;e<t.g.length;e++)if(t.g[e]!=0)return!1;return!0}function Re(t){return t.h==-1}y.X=function(t){return t=ps(this,t),Re(t)?-1:Je(t)?0:1};function te(t){for(var e=t.g.length,n=[],r=0;r<e;r++)n[r]=~t.g[r];return new U(n,~t.h).add(To)}y.abs=function(){return Re(this)?te(this):this},y.add=function(t){for(var e=Math.max(this.g.length,t.g.length),n=[],r=0,s=0;s<=e;s++){var i=r+(this.D(s)&65535)+(t.D(s)&65535),o=(i>>>16)+(this.D(s)>>>16)+(t.D(s)>>>16);r=o>>>16,i&=65535,o&=65535,n[s]=o<<16|i}return new U(n,n[n.length-1]&-2147483648?-1:0)};function ps(t,e){return t.add(te(e))}y.R=function(t){if(Je(this)||Je(t))return en;if(Re(this))return Re(t)?te(this).R(te(t)):te(te(this).R(t));if(Re(t))return te(this.R(te(t)));if(0>this.X(Vu)&&0>t.X(Vu))return Fe(this.ea()*t.ea());for(var e=this.g.length+t.g.length,n=[],r=0;r<2*e;r++)n[r]=0;for(r=0;r<this.g.length;r++)for(var s=0;s<t.g.length;s++){var i=this.D(r)>>>16,o=this.D(r)&65535,a=t.D(s)>>>16,c=t.D(s)&65535;n[2*r+2*s]+=o*c,ms(n,2*r+2*s),n[2*r+2*s+1]+=i*c,ms(n,2*r+2*s+1),n[2*r+2*s+1]+=o*a,ms(n,2*r+2*s+1),n[2*r+2*s+2]+=i*a,ms(n,2*r+2*s+2)}for(r=0;r<e;r++)n[r]=n[2*r+1]<<16|n[2*r];for(r=e;r<2*e;r++)n[r]=0;return new U(n,0)};function ms(t,e){for(;(t[e]&65535)!=t[e];)t[e+1]+=t[e]>>>16,t[e]&=65535,e++}function sr(t,e){this.g=t,this.h=e}function gs(t,e){if(Je(e))throw Error("division by zero");if(Je(t))return new sr(en,en);if(Re(t))return e=gs(te(t),e),new sr(te(e.g),te(e.h));if(Re(e))return e=gs(t,te(e)),new sr(te(e.g),e.h);if(30<t.g.length){if(Re(t)||Re(e))throw Error("slowDivide_ only works with positive integers.");for(var n=To,r=e;0>=r.X(t);)n=Lu(n),r=Lu(r);var s=tn(n,1),i=tn(r,1);for(r=tn(r,2),n=tn(n,2);!Je(r);){var o=i.add(r);0>=o.X(t)&&(s=s.add(n),i=o),r=tn(r,1),n=tn(n,1)}return e=ps(t,s.R(e)),new sr(s,e)}for(s=en;0<=t.X(e);){for(n=Math.max(1,Math.floor(t.ea()/e.ea())),r=Math.ceil(Math.log(n)/Math.LN2),r=48>=r?1:Math.pow(2,r-48),i=Fe(n),o=i.R(e);Re(o)||0<o.X(t);)n-=r,i=Fe(n),o=i.R(e);Je(i)&&(i=To),s=s.add(i),t=ps(t,o)}return new sr(s,t)}y.gb=function(t){return gs(this,t).h},y.and=function(t){for(var e=Math.max(this.g.length,t.g.length),n=[],r=0;r<e;r++)n[r]=this.D(r)&t.D(r);return new U(n,this.h&t.h)},y.or=function(t){for(var e=Math.max(this.g.length,t.g.length),n=[],r=0;r<e;r++)n[r]=this.D(r)|t.D(r);return new U(n,this.h|t.h)},y.xor=function(t){for(var e=Math.max(this.g.length,t.g.length),n=[],r=0;r<e;r++)n[r]=this.D(r)^t.D(r);return new U(n,this.h^t.h)};function Lu(t){for(var e=t.g.length+1,n=[],r=0;r<e;r++)n[r]=t.D(r)<<1|t.D(r-1)>>>31;return new U(n,t.h)}function tn(t,e){var n=e>>5;e%=32;for(var r=t.g.length-n,s=[],i=0;i<r;i++)s[i]=0<e?t.D(i+n)>>>e|t.D(i+n+1)<<32-e:t.D(i+n);return new U(s,t.h)}fs.prototype.createWebChannel=fs.prototype.g,Ee.prototype.send=Ee.prototype.u,Ee.prototype.open=Ee.prototype.m,Ee.prototype.close=Ee.prototype.close,es.NO_ERROR=0,es.TIMEOUT=8,es.HTTP_ERROR=6,zc.COMPLETE="complete",Wc.EventType=Gn,Gn.OPEN="a",Gn.CLOSE="b",Gn.ERROR="c",Gn.MESSAGE="d",J.prototype.listen=J.prototype.O,H.prototype.listenOnce=H.prototype.P,H.prototype.getLastError=H.prototype.Sa,H.prototype.getLastErrorCode=H.prototype.Ia,H.prototype.getStatus=H.prototype.da,H.prototype.getResponseJson=H.prototype.Wa,H.prototype.getResponseText=H.prototype.ja,H.prototype.send=H.prototype.ha,H.prototype.setWithCredentials=H.prototype.Oa,ke.prototype.digest=ke.prototype.l,ke.prototype.reset=ke.prototype.reset,ke.prototype.update=ke.prototype.j,U.prototype.add=U.prototype.add,U.prototype.multiply=U.prototype.R,U.prototype.modulo=U.prototype.gb,U.prototype.compare=U.prototype.X,U.prototype.toNumber=U.prototype.ea,U.prototype.toString=U.prototype.toString,U.prototype.getBits=U.prototype.D,U.fromNumber=Fe,U.fromString=Ou;var sg=function(){return new fs},ig=function(){return Zr()},wo=es,og=zc,ag=Ct,Mu={xb:0,Ab:1,Bb:2,Ub:3,Zb:4,Wb:5,Xb:6,Vb:7,Tb:8,Yb:9,PROXY:10,NOPROXY:11,Rb:12,Nb:13,Ob:14,Mb:15,Pb:16,Qb:17,tb:18,sb:19,ub:20},_s=Wc,cg=H,ug=ke,nn=U;const xu="@firebase/firestore";/**
361
+ */function ym(n){ft(new Ze("platform-logger",e=>new Op(e),"PRIVATE")),ft(new Ze("heartbeat",e=>new mm(e),"PRIVATE")),Se(Vi,Tc,n),Se(Vi,Tc,"esm2017"),Se("fire-js","")}ym("");var vm=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},y,Ui=Ui||{},R=vm||self;function Yr(n){var e=typeof n;return e=e!="object"?e:n?Array.isArray(n)?"array":e:"null",e=="array"||e=="object"&&typeof n.length=="number"}function zn(n){var e=typeof n;return e=="object"&&n!=null||e=="function"}function Em(n){return Object.prototype.hasOwnProperty.call(n,Fi)&&n[Fi]||(n[Fi]=++Tm)}var Fi="closure_uid_"+(1e9*Math.random()>>>0),Tm=0;function wm(n,e,t){return n.call.apply(n.bind,arguments)}function Im(n,e,t){if(!n)throw Error();if(2<arguments.length){var r=Array.prototype.slice.call(arguments,2);return function(){var s=Array.prototype.slice.call(arguments);return Array.prototype.unshift.apply(s,r),n.apply(e,s)}}return function(){return n.apply(e,arguments)}}function ae(n,e,t){return Function.prototype.bind&&Function.prototype.bind.toString().indexOf("native code")!=-1?ae=wm:ae=Im,ae.apply(null,arguments)}function Xr(n,e){var t=Array.prototype.slice.call(arguments,1);return function(){var r=t.slice();return r.push.apply(r,arguments),n.apply(this,r)}}function X(n,e){function t(){}t.prototype=e.prototype,n.$=e.prototype,n.prototype=new t,n.prototype.constructor=n,n.ac=function(r,s,i){for(var o=Array(arguments.length-2),a=2;a<arguments.length;a++)o[a-2]=arguments[a];return e.prototype[s].apply(r,o)}}function mt(){this.s=this.s,this.o=this.o}var Am=0;mt.prototype.s=!1,mt.prototype.sa=function(){!this.s&&(this.s=!0,this.N(),Am!=0)&&Em(this)},mt.prototype.N=function(){if(this.o)for(;this.o.length;)this.o.shift()()};const Cc=Array.prototype.indexOf?function(n,e){return Array.prototype.indexOf.call(n,e,void 0)}:function(n,e){if(typeof n=="string")return typeof e!="string"||e.length!=1?-1:n.indexOf(e,0);for(let t=0;t<n.length;t++)if(t in n&&n[t]===e)return t;return-1};function Bi(n){const e=n.length;if(0<e){const t=Array(e);for(let r=0;r<e;r++)t[r]=n[r];return t}return[]}function kc(n,e){for(let t=1;t<arguments.length;t++){const r=arguments[t];if(Yr(r)){const s=n.length||0,i=r.length||0;n.length=s+i;for(let o=0;o<i;o++)n[s+o]=r[o]}else n.push(r)}}function ce(n,e){this.type=n,this.g=this.target=e,this.defaultPrevented=!1}ce.prototype.h=function(){this.defaultPrevented=!0};var Rm=function(){if(!R.addEventListener||!Object.defineProperty)return!1;var n=!1,e=Object.defineProperty({},"passive",{get:function(){n=!0}});try{const t=()=>{};R.addEventListener("test",t,e),R.removeEventListener("test",t,e)}catch{}return n}();function Hn(n){return/^[\s\xa0]*$/.test(n)}function Jr(){var n=R.navigator;return n&&(n=n.userAgent)?n:""}function Be(n){return Jr().indexOf(n)!=-1}function ji(n){return ji[" "](n),n}ji[" "]=function(){};function Pm(n,e){var t=yg;return Object.prototype.hasOwnProperty.call(t,n)?t[n]:t[n]=e(n)}var Sm=Be("Opera"),Zt=Be("Trident")||Be("MSIE"),Dc=Be("Edge"),qi=Dc||Zt,Nc=Be("Gecko")&&!(Jr().toLowerCase().indexOf("webkit")!=-1&&!Be("Edge"))&&!(Be("Trident")||Be("MSIE"))&&!Be("Edge"),bm=Jr().toLowerCase().indexOf("webkit")!=-1&&!Be("Edge");function Oc(){var n=R.document;return n?n.documentMode:void 0}var $i;e:{var zi="",Hi=function(){var n=Jr();if(Nc)return/rv:([^\);]+)(\)|;)/.exec(n);if(Dc)return/Edge\/([\d\.]+)/.exec(n);if(Zt)return/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(n);if(bm)return/WebKit\/(\S+)/.exec(n);if(Sm)return/(?:Version)[ \/]?(\S+)/.exec(n)}();if(Hi&&(zi=Hi?Hi[1]:""),Zt){var Wi=Oc();if(Wi!=null&&Wi>parseFloat(zi)){$i=String(Wi);break e}}$i=zi}var Gi;if(R.document&&Zt){var Vc=Oc();Gi=Vc||parseInt($i,10)||void 0}else Gi=void 0;var Cm=Gi;function Wn(n,e){if(ce.call(this,n?n.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,n){var t=this.type=n.type,r=n.changedTouches&&n.changedTouches.length?n.changedTouches[0]:null;if(this.target=n.target||n.srcElement,this.g=e,e=n.relatedTarget){if(Nc){e:{try{ji(e.nodeName);var s=!0;break e}catch{}s=!1}s||(e=null)}}else t=="mouseover"?e=n.fromElement:t=="mouseout"&&(e=n.toElement);this.relatedTarget=e,r?(this.clientX=r.clientX!==void 0?r.clientX:r.pageX,this.clientY=r.clientY!==void 0?r.clientY:r.pageY,this.screenX=r.screenX||0,this.screenY=r.screenY||0):(this.clientX=n.clientX!==void 0?n.clientX:n.pageX,this.clientY=n.clientY!==void 0?n.clientY:n.pageY,this.screenX=n.screenX||0,this.screenY=n.screenY||0),this.button=n.button,this.key=n.key||"",this.ctrlKey=n.ctrlKey,this.altKey=n.altKey,this.shiftKey=n.shiftKey,this.metaKey=n.metaKey,this.pointerId=n.pointerId||0,this.pointerType=typeof n.pointerType=="string"?n.pointerType:km[n.pointerType]||"",this.state=n.state,this.i=n,n.defaultPrevented&&Wn.$.h.call(this)}}X(Wn,ce);var km={2:"touch",3:"pen",4:"mouse"};Wn.prototype.h=function(){Wn.$.h.call(this);var n=this.i;n.preventDefault?n.preventDefault():n.returnValue=!1};var Gn="closure_listenable_"+(1e6*Math.random()|0),Dm=0;function Nm(n,e,t,r,s){this.listener=n,this.proxy=null,this.src=e,this.type=t,this.capture=!!r,this.la=s,this.key=++Dm,this.fa=this.ia=!1}function Zr(n){n.fa=!0,n.listener=null,n.proxy=null,n.src=null,n.la=null}function Ki(n,e,t){for(const r in n)e.call(t,n[r],r,n)}function Om(n,e){for(const t in n)e.call(void 0,n[t],t,n)}function Lc(n){const e={};for(const t in n)e[t]=n[t];return e}const Mc="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function xc(n,e){let t,r;for(let s=1;s<arguments.length;s++){r=arguments[s];for(t in r)n[t]=r[t];for(let i=0;i<Mc.length;i++)t=Mc[i],Object.prototype.hasOwnProperty.call(r,t)&&(n[t]=r[t])}}function es(n){this.src=n,this.g={},this.h=0}es.prototype.add=function(n,e,t,r,s){var i=n.toString();n=this.g[i],n||(n=this.g[i]=[],this.h++);var o=Yi(n,e,r,s);return-1<o?(e=n[o],t||(e.ia=!1)):(e=new Nm(e,this.src,i,!!r,s),e.ia=t,n.push(e)),e};function Qi(n,e){var t=e.type;if(t in n.g){var r=n.g[t],s=Cc(r,e),i;(i=0<=s)&&Array.prototype.splice.call(r,s,1),i&&(Zr(e),n.g[t].length==0&&(delete n.g[t],n.h--))}}function Yi(n,e,t,r){for(var s=0;s<n.length;++s){var i=n[s];if(!i.fa&&i.listener==e&&i.capture==!!t&&i.la==r)return s}return-1}var Xi="closure_lm_"+(1e6*Math.random()|0),Ji={};function Uc(n,e,t,r,s){if(r&&r.once)return Bc(n,e,t,r,s);if(Array.isArray(e)){for(var i=0;i<e.length;i++)Uc(n,e[i],t,r,s);return null}return t=no(t),n&&n[Gn]?n.O(e,t,zn(r)?!!r.capture:!!r,s):Fc(n,e,t,!1,r,s)}function Fc(n,e,t,r,s,i){if(!e)throw Error("Invalid event type");var o=zn(s)?!!s.capture:!!s,a=eo(n);if(a||(n[Xi]=a=new es(n)),t=a.add(e,t,r,o,i),t.proxy)return t;if(r=Vm(),t.proxy=r,r.src=n,r.listener=t,n.addEventListener)Rm||(s=o),s===void 0&&(s=!1),n.addEventListener(e.toString(),r,s);else if(n.attachEvent)n.attachEvent(qc(e.toString()),r);else if(n.addListener&&n.removeListener)n.addListener(r);else throw Error("addEventListener and attachEvent are unavailable.");return t}function Vm(){function n(t){return e.call(n.src,n.listener,t)}const e=Lm;return n}function Bc(n,e,t,r,s){if(Array.isArray(e)){for(var i=0;i<e.length;i++)Bc(n,e[i],t,r,s);return null}return t=no(t),n&&n[Gn]?n.P(e,t,zn(r)?!!r.capture:!!r,s):Fc(n,e,t,!0,r,s)}function jc(n,e,t,r,s){if(Array.isArray(e))for(var i=0;i<e.length;i++)jc(n,e[i],t,r,s);else r=zn(r)?!!r.capture:!!r,t=no(t),n&&n[Gn]?(n=n.i,e=String(e).toString(),e in n.g&&(i=n.g[e],t=Yi(i,t,r,s),-1<t&&(Zr(i[t]),Array.prototype.splice.call(i,t,1),i.length==0&&(delete n.g[e],n.h--)))):n&&(n=eo(n))&&(e=n.g[e.toString()],n=-1,e&&(n=Yi(e,t,r,s)),(t=-1<n?e[n]:null)&&Zi(t))}function Zi(n){if(typeof n!="number"&&n&&!n.fa){var e=n.src;if(e&&e[Gn])Qi(e.i,n);else{var t=n.type,r=n.proxy;e.removeEventListener?e.removeEventListener(t,r,n.capture):e.detachEvent?e.detachEvent(qc(t),r):e.addListener&&e.removeListener&&e.removeListener(r),(t=eo(e))?(Qi(t,n),t.h==0&&(t.src=null,e[Xi]=null)):Zr(n)}}}function qc(n){return n in Ji?Ji[n]:Ji[n]="on"+n}function Lm(n,e){if(n.fa)n=!0;else{e=new Wn(e,this);var t=n.listener,r=n.la||n.src;n.ia&&Zi(n),n=t.call(r,e)}return n}function eo(n){return n=n[Xi],n instanceof es?n:null}var to="__closure_events_fn_"+(1e9*Math.random()>>>0);function no(n){return typeof n=="function"?n:(n[to]||(n[to]=function(e){return n.handleEvent(e)}),n[to])}function J(){mt.call(this),this.i=new es(this),this.S=this,this.J=null}X(J,mt),J.prototype[Gn]=!0,J.prototype.removeEventListener=function(n,e,t,r){jc(this,n,e,t,r)};function ee(n,e){var t,r=n.J;if(r)for(t=[];r;r=r.J)t.push(r);if(n=n.S,r=e.type||e,typeof e=="string")e=new ce(e,n);else if(e instanceof ce)e.target=e.target||n;else{var s=e;e=new ce(r,n),xc(e,s)}if(s=!0,t)for(var i=t.length-1;0<=i;i--){var o=e.g=t[i];s=ts(o,r,!0,e)&&s}if(o=e.g=n,s=ts(o,r,!0,e)&&s,s=ts(o,r,!1,e)&&s,t)for(i=0;i<t.length;i++)o=e.g=t[i],s=ts(o,r,!1,e)&&s}J.prototype.N=function(){if(J.$.N.call(this),this.i){var n=this.i,e;for(e in n.g){for(var t=n.g[e],r=0;r<t.length;r++)Zr(t[r]);delete n.g[e],n.h--}}this.J=null},J.prototype.O=function(n,e,t,r){return this.i.add(String(n),e,!1,t,r)},J.prototype.P=function(n,e,t,r){return this.i.add(String(n),e,!0,t,r)};function ts(n,e,t,r){if(e=n.i.g[String(e)],!e)return!0;e=e.concat();for(var s=!0,i=0;i<e.length;++i){var o=e[i];if(o&&!o.fa&&o.capture==t){var a=o.listener,c=o.la||o.src;o.ia&&Qi(n.i,o),s=a.call(c,r)!==!1&&s}}return s&&!r.defaultPrevented}var ro=R.JSON.stringify;class Mm{constructor(e,t){this.i=e,this.j=t,this.h=0,this.g=null}get(){let e;return 0<this.h?(this.h--,e=this.g,this.g=e.next,e.next=null):e=this.i(),e}}function xm(){var n=so;let e=null;return n.g&&(e=n.g,n.g=n.g.next,n.g||(n.h=null),e.next=null),e}class Um{constructor(){this.h=this.g=null}add(e,t){const r=$c.get();r.set(e,t),this.h?this.h.next=r:this.g=r,this.h=r}}var $c=new Mm(()=>new Fm,n=>n.reset());class Fm{constructor(){this.next=this.g=this.h=null}set(e,t){this.h=e,this.g=t,this.next=null}reset(){this.next=this.g=this.h=null}}function Bm(n){var e=1;n=n.split(":");const t=[];for(;0<e&&n.length;)t.push(n.shift()),e--;return n.length&&t.push(n.join(":")),t}function jm(n){R.setTimeout(()=>{throw n},0)}let Kn,Qn=!1,so=new Um,zc=()=>{const n=R.Promise.resolve(void 0);Kn=()=>{n.then(qm)}};var qm=()=>{for(var n;n=xm();){try{n.h.call(n.g)}catch(t){jm(t)}var e=$c;e.j(n),100>e.h&&(e.h++,n.next=e.g,e.g=n)}Qn=!1};function ns(n,e){J.call(this),this.h=n||1,this.g=e||R,this.j=ae(this.qb,this),this.l=Date.now()}X(ns,J),y=ns.prototype,y.ga=!1,y.T=null,y.qb=function(){if(this.ga){var n=Date.now()-this.l;0<n&&n<.8*this.h?this.T=this.g.setTimeout(this.j,this.h-n):(this.T&&(this.g.clearTimeout(this.T),this.T=null),ee(this,"tick"),this.ga&&(io(this),this.start()))}},y.start=function(){this.ga=!0,this.T||(this.T=this.g.setTimeout(this.j,this.h),this.l=Date.now())};function io(n){n.ga=!1,n.T&&(n.g.clearTimeout(n.T),n.T=null)}y.N=function(){ns.$.N.call(this),io(this),delete this.g};function oo(n,e,t){if(typeof n=="function")t&&(n=ae(n,t));else if(n&&typeof n.handleEvent=="function")n=ae(n.handleEvent,n);else throw Error("Invalid listener argument");return 2147483647<Number(e)?-1:R.setTimeout(n,e||0)}function Hc(n){n.g=oo(()=>{n.g=null,n.i&&(n.i=!1,Hc(n))},n.j);const e=n.h;n.h=null,n.m.apply(null,e)}class $m extends mt{constructor(e,t){super(),this.m=e,this.j=t,this.h=null,this.i=!1,this.g=null}l(e){this.h=arguments,this.g?this.i=!0:Hc(this)}N(){super.N(),this.g&&(R.clearTimeout(this.g),this.g=null,this.i=!1,this.h=null)}}function Yn(n){mt.call(this),this.h=n,this.g={}}X(Yn,mt);var Wc=[];function Gc(n,e,t,r){Array.isArray(t)||(t&&(Wc[0]=t.toString()),t=Wc);for(var s=0;s<t.length;s++){var i=Uc(e,t[s],r||n.handleEvent,!1,n.h||n);if(!i)break;n.g[i.key]=i}}function Kc(n){Ki(n.g,function(e,t){this.g.hasOwnProperty(t)&&Zi(e)},n),n.g={}}Yn.prototype.N=function(){Yn.$.N.call(this),Kc(this)},Yn.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")};function rs(){this.g=!0}rs.prototype.Ea=function(){this.g=!1};function zm(n,e,t,r,s,i){n.info(function(){if(n.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 l=u[0];u=u[1];var h=l.split("_");o=2<=h.length&&h[1]=="type"?o+(l+"="+u+"&"):o+(l+"=redacted&")}}else o=null;else o=i;return"XMLHTTP REQ ("+r+") [attempt "+s+"]: "+e+`
362
+ `+t+`
363
+ `+o})}function Hm(n,e,t,r,s,i,o){n.info(function(){return"XMLHTTP RESP ("+r+") [ attempt "+s+"]: "+e+`
364
+ `+t+`
365
+ `+i+" "+o})}function en(n,e,t,r){n.info(function(){return"XMLHTTP TEXT ("+e+"): "+Gm(n,t)+(r?" "+r:"")})}function Wm(n,e){n.info(function(){return"TIMEOUT: "+e})}rs.prototype.info=function(){};function Gm(n,e){if(!n.g)return e;if(!e)return null;try{var t=JSON.parse(e);if(t){for(n=0;n<t.length;n++)if(Array.isArray(t[n])){var r=t[n];if(!(2>r.length)){var s=r[1];if(Array.isArray(s)&&!(1>s.length)){var i=s[0];if(i!="noop"&&i!="stop"&&i!="close")for(var o=1;o<s.length;o++)s[o]=""}}}}return ro(t)}catch{return e}}var Ot={},Qc=null;function ss(){return Qc=Qc||new J}Ot.Ta="serverreachability";function Yc(n){ce.call(this,Ot.Ta,n)}X(Yc,ce);function Xn(n){const e=ss();ee(e,new Yc(e))}Ot.STAT_EVENT="statevent";function Xc(n,e){ce.call(this,Ot.STAT_EVENT,n),this.stat=e}X(Xc,ce);function pe(n){const e=ss();ee(e,new Xc(e,n))}Ot.Ua="timingevent";function Jc(n,e){ce.call(this,Ot.Ua,n),this.size=e}X(Jc,ce);function Jn(n,e){if(typeof n!="function")throw Error("Fn must not be null and must be a function");return R.setTimeout(function(){n()},e)}var is={NO_ERROR:0,rb:1,Eb:2,Db:3,yb:4,Cb:5,Fb:6,Qa:7,TIMEOUT:8,Ib:9},Zc={wb:"complete",Sb:"success",Ra:"error",Qa:"abort",Kb:"ready",Lb:"readystatechange",TIMEOUT:"timeout",Gb:"incrementaldata",Jb:"progress",zb:"downloadprogress",$b:"uploadprogress"};function ao(){}ao.prototype.h=null;function eu(n){return n.h||(n.h=n.i())}function tu(){}var Zn={OPEN:"a",vb:"b",Ra:"c",Hb:"d"};function co(){ce.call(this,"d")}X(co,ce);function uo(){ce.call(this,"c")}X(uo,ce);var lo;function os(){}X(os,ao),os.prototype.g=function(){return new XMLHttpRequest},os.prototype.i=function(){return{}},lo=new os;function er(n,e,t,r){this.l=n,this.j=e,this.m=t,this.W=r||1,this.U=new Yn(this),this.P=Km,n=qi?125:void 0,this.V=new ns(n),this.I=null,this.i=!1,this.u=this.B=this.A=this.L=this.G=this.Y=this.C=null,this.F=[],this.g=null,this.o=0,this.s=this.v=null,this.ca=-1,this.J=!1,this.O=0,this.M=null,this.ba=this.K=this.aa=this.S=!1,this.h=new nu}function nu(){this.i=null,this.g="",this.h=!1}var Km=45e3,ru={},ho={};y=er.prototype,y.setTimeout=function(n){this.P=n};function fo(n,e,t){n.L=1,n.A=ls(et(e)),n.u=t,n.S=!0,su(n,null)}function su(n,e){n.G=Date.now(),tr(n),n.B=et(n.A);var t=n.B,r=n.W;Array.isArray(r)||(r=[String(r)]),pu(t.i,"t",r),n.o=0,t=n.l.J,n.h=new nu,n.g=Uu(n.l,t?e:null,!n.u),0<n.O&&(n.M=new $m(ae(n.Pa,n,n.g),n.O)),Gc(n.U,n.g,"readystatechange",n.nb),e=n.I?Lc(n.I):{},n.u?(n.v||(n.v="POST"),e["Content-Type"]="application/x-www-form-urlencoded",n.g.ha(n.B,n.v,n.u,e)):(n.v="GET",n.g.ha(n.B,n.v,null,e)),Xn(),zm(n.j,n.v,n.B,n.m,n.W,n.u)}y.nb=function(n){n=n.target;const e=this.M;e&&je(n)==3?e.l():this.Pa(n)},y.Pa=function(n){try{if(n==this.g)e:{const l=je(this.g);var e=this.g.Ia();const h=this.g.da();if(!(3>l)&&(l!=3||qi||this.g&&(this.h.h||this.g.ja()||Pu(this.g)))){this.J||l!=4||e==7||(e==8||0>=h?Xn(3):Xn(2)),as(this);var t=this.g.da();this.ca=t;t:if(iu(this)){var r=Pu(this.g);n="";var s=r.length,i=je(this.g)==4;if(!this.h.i){if(typeof TextDecoder>"u"){Vt(this),nr(this);var o="";break t}this.h.i=new R.TextDecoder}for(e=0;e<s;e++)this.h.h=!0,n+=this.h.i.decode(r[e],{stream:i&&e==s-1});r.length=0,this.h.g+=n,this.o=0,o=this.h.g}else o=this.g.ja();if(this.i=t==200,Hm(this.j,this.v,this.B,this.m,this.W,l,t),this.i){if(this.aa&&!this.K){t:{if(this.g){var a,c=this.g;if((a=c.g?c.g.getResponseHeader("X-HTTP-Initial-Response"):null)&&!Hn(a)){var u=a;break t}}u=null}if(t=u)en(this.j,this.m,t,"Initial handshake response via X-HTTP-Initial-Response"),this.K=!0,po(this,t);else{this.i=!1,this.s=3,pe(12),Vt(this),nr(this);break e}}this.S?(ou(this,l,o),qi&&this.i&&l==3&&(Gc(this.U,this.V,"tick",this.mb),this.V.start())):(en(this.j,this.m,o,null),po(this,o)),l==4&&Vt(this),this.i&&!this.J&&(l==4?Vu(this.l,this):(this.i=!1,tr(this)))}else mg(this.g),t==400&&0<o.indexOf("Unknown SID")?(this.s=3,pe(12)):(this.s=0,pe(13)),Vt(this),nr(this)}}}catch{}finally{}};function iu(n){return n.g?n.v=="GET"&&n.L!=2&&n.l.Ha:!1}function ou(n,e,t){let r=!0,s;for(;!n.J&&n.o<t.length;)if(s=Qm(n,t),s==ho){e==4&&(n.s=4,pe(14),r=!1),en(n.j,n.m,null,"[Incomplete Response]");break}else if(s==ru){n.s=4,pe(15),en(n.j,n.m,t,"[Invalid Chunk]"),r=!1;break}else en(n.j,n.m,s,null),po(n,s);iu(n)&&n.o!=0&&(n.h.g=n.h.g.slice(n.o),n.o=0),e!=4||t.length!=0||n.h.h||(n.s=1,pe(16),r=!1),n.i=n.i&&r,r?0<t.length&&!n.ba&&(n.ba=!0,e=n.l,e.g==n&&e.ca&&!e.M&&(e.l.info("Great, no buffering proxy detected. Bytes received: "+t.length),To(e),e.M=!0,pe(11))):(en(n.j,n.m,t,"[Invalid Chunked Response]"),Vt(n),nr(n))}y.mb=function(){if(this.g){var n=je(this.g),e=this.g.ja();this.o<e.length&&(as(this),ou(this,n,e),this.i&&n!=4&&tr(this))}};function Qm(n,e){var t=n.o,r=e.indexOf(`
366
+ `,t);return r==-1?ho:(t=Number(e.substring(t,r)),isNaN(t)?ru:(r+=1,r+t>e.length?ho:(e=e.slice(r,r+t),n.o=r+t,e)))}y.cancel=function(){this.J=!0,Vt(this)};function tr(n){n.Y=Date.now()+n.P,au(n,n.P)}function au(n,e){if(n.C!=null)throw Error("WatchDog timer not null");n.C=Jn(ae(n.lb,n),e)}function as(n){n.C&&(R.clearTimeout(n.C),n.C=null)}y.lb=function(){this.C=null;const n=Date.now();0<=n-this.Y?(Wm(this.j,this.B),this.L!=2&&(Xn(),pe(17)),Vt(this),this.s=2,nr(this)):au(this,this.Y-n)};function nr(n){n.l.H==0||n.J||Vu(n.l,n)}function Vt(n){as(n);var e=n.M;e&&typeof e.sa=="function"&&e.sa(),n.M=null,io(n.V),Kc(n.U),n.g&&(e=n.g,n.g=null,e.abort(),e.sa())}function po(n,e){try{var t=n.l;if(t.H!=0&&(t.g==n||mo(t.i,n))){if(!n.K&&mo(t.i,n)&&t.H==3){try{var r=t.Ja.g.parse(e)}catch{r=null}if(Array.isArray(r)&&r.length==3){var s=r;if(s[0]==0){e:if(!t.u){if(t.g)if(t.g.G+3e3<n.G)_s(t),ms(t);else break e;Eo(t),pe(18)}}else t.Fa=s[1],0<t.Fa-t.V&&37500>s[2]&&t.G&&t.A==0&&!t.v&&(t.v=Jn(ae(t.ib,t),6e3));if(1>=_u(t.i)&&t.oa){try{t.oa()}catch{}t.oa=void 0}}else Mt(t,11)}else if((n.K||t.g==n)&&_s(t),!Hn(e))for(s=t.Ja.g.parse(e),e=0;e<s.length;e++){let u=s[e];if(t.V=u[0],u=u[1],t.H==2)if(u[0]=="c"){t.K=u[1],t.pa=u[2];const l=u[3];l!=null&&(t.ra=l,t.l.info("VER="+t.ra));const h=u[4];h!=null&&(t.Ga=h,t.l.info("SVER="+t.Ga));const d=u[5];d!=null&&typeof d=="number"&&0<d&&(r=1.5*d,t.L=r,t.l.info("backChannelRequestTimeoutMs_="+r)),r=t;const f=n.g;if(f){const E=f.g?f.g.getResponseHeader("X-Client-Wire-Protocol"):null;if(E){var i=r.i;i.g||E.indexOf("spdy")==-1&&E.indexOf("quic")==-1&&E.indexOf("h2")==-1||(i.j=i.l,i.g=new Set,i.h&&(go(i,i.h),i.h=null))}if(r.F){const T=f.g?f.g.getResponseHeader("X-HTTP-Session-Id"):null;T&&(r.Da=T,j(r.I,r.F,T))}}t.H=3,t.h&&t.h.Ba(),t.ca&&(t.S=Date.now()-n.G,t.l.info("Handshake RTT: "+t.S+"ms")),r=t;var o=n;if(r.wa=xu(r,r.J?r.pa:null,r.Y),o.K){yu(r.i,o);var a=o,c=r.L;c&&a.setTimeout(c),a.C&&(as(a),tr(a)),r.g=o}else Nu(r);0<t.j.length&&gs(t)}else u[0]!="stop"&&u[0]!="close"||Mt(t,7);else t.H==3&&(u[0]=="stop"||u[0]=="close"?u[0]=="stop"?Mt(t,7):vo(t):u[0]!="noop"&&t.h&&t.h.Aa(u),t.A=0)}}Xn(4)}catch{}}function Ym(n){if(n.Z&&typeof n.Z=="function")return n.Z();if(typeof Map<"u"&&n instanceof Map||typeof Set<"u"&&n instanceof Set)return Array.from(n.values());if(typeof n=="string")return n.split("");if(Yr(n)){for(var e=[],t=n.length,r=0;r<t;r++)e.push(n[r]);return e}e=[],t=0;for(r in n)e[t++]=n[r];return e}function Xm(n){if(n.ta&&typeof n.ta=="function")return n.ta();if(!n.Z||typeof n.Z!="function"){if(typeof Map<"u"&&n instanceof Map)return Array.from(n.keys());if(!(typeof Set<"u"&&n instanceof Set)){if(Yr(n)||typeof n=="string"){var e=[];n=n.length;for(var t=0;t<n;t++)e.push(t);return e}e=[],t=0;for(const r in n)e[t++]=r;return e}}}function cu(n,e){if(n.forEach&&typeof n.forEach=="function")n.forEach(e,void 0);else if(Yr(n)||typeof n=="string")Array.prototype.forEach.call(n,e,void 0);else for(var t=Xm(n),r=Ym(n),s=r.length,i=0;i<s;i++)e.call(void 0,r[i],t&&t[i],n)}var uu=RegExp("^(?:([^:/?#.]+):)?(?://(?:([^\\\\/?#]*)@)?([^\\\\/?#]*?)(?::([0-9]+))?(?=[\\\\/?#]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#([\\s\\S]*))?$");function Jm(n,e){if(n){n=n.split("&");for(var t=0;t<n.length;t++){var r=n[t].indexOf("="),s=null;if(0<=r){var i=n[t].substring(0,r);s=n[t].substring(r+1)}else i=n[t];e(i,s?decodeURIComponent(s.replace(/\+/g," ")):"")}}}function Lt(n){if(this.g=this.s=this.j="",this.m=null,this.o=this.l="",this.h=!1,n instanceof Lt){this.h=n.h,cs(this,n.j),this.s=n.s,this.g=n.g,us(this,n.m),this.l=n.l;var e=n.i,t=new ir;t.i=e.i,e.g&&(t.g=new Map(e.g),t.h=e.h),lu(this,t),this.o=n.o}else n&&(e=String(n).match(uu))?(this.h=!1,cs(this,e[1]||"",!0),this.s=rr(e[2]||""),this.g=rr(e[3]||"",!0),us(this,e[4]),this.l=rr(e[5]||"",!0),lu(this,e[6]||"",!0),this.o=rr(e[7]||"")):(this.h=!1,this.i=new ir(null,this.h))}Lt.prototype.toString=function(){var n=[],e=this.j;e&&n.push(sr(e,hu,!0),":");var t=this.g;return(t||e=="file")&&(n.push("//"),(e=this.s)&&n.push(sr(e,hu,!0),"@"),n.push(encodeURIComponent(String(t)).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),t=this.m,t!=null&&n.push(":",String(t))),(t=this.l)&&(this.g&&t.charAt(0)!="/"&&n.push("/"),n.push(sr(t,t.charAt(0)=="/"?tg:eg,!0))),(t=this.i.toString())&&n.push("?",t),(t=this.o)&&n.push("#",sr(t,rg)),n.join("")};function et(n){return new Lt(n)}function cs(n,e,t){n.j=t?rr(e,!0):e,n.j&&(n.j=n.j.replace(/:$/,""))}function us(n,e){if(e){if(e=Number(e),isNaN(e)||0>e)throw Error("Bad port number "+e);n.m=e}else n.m=null}function lu(n,e,t){e instanceof ir?(n.i=e,sg(n.i,n.h)):(t||(e=sr(e,ng)),n.i=new ir(e,n.h))}function j(n,e,t){n.i.set(e,t)}function ls(n){return j(n,"zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^Date.now()).toString(36)),n}function rr(n,e){return n?e?decodeURI(n.replace(/%25/g,"%2525")):decodeURIComponent(n):""}function sr(n,e,t){return typeof n=="string"?(n=encodeURI(n).replace(e,Zm),t&&(n=n.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),n):null}function Zm(n){return n=n.charCodeAt(0),"%"+(n>>4&15).toString(16)+(n&15).toString(16)}var hu=/[#\/\?@]/g,eg=/[#\?:]/g,tg=/[#\?]/g,ng=/[#\?@]/g,rg=/#/g;function ir(n,e){this.h=this.g=null,this.i=n||null,this.j=!!e}function gt(n){n.g||(n.g=new Map,n.h=0,n.i&&Jm(n.i,function(e,t){n.add(decodeURIComponent(e.replace(/\+/g," ")),t)}))}y=ir.prototype,y.add=function(n,e){gt(this),this.i=null,n=tn(this,n);var t=this.g.get(n);return t||this.g.set(n,t=[]),t.push(e),this.h+=1,this};function du(n,e){gt(n),e=tn(n,e),n.g.has(e)&&(n.i=null,n.h-=n.g.get(e).length,n.g.delete(e))}function fu(n,e){return gt(n),e=tn(n,e),n.g.has(e)}y.forEach=function(n,e){gt(this),this.g.forEach(function(t,r){t.forEach(function(s){n.call(e,s,r,this)},this)},this)},y.ta=function(){gt(this);const n=Array.from(this.g.values()),e=Array.from(this.g.keys()),t=[];for(let r=0;r<e.length;r++){const s=n[r];for(let i=0;i<s.length;i++)t.push(e[r])}return t},y.Z=function(n){gt(this);let e=[];if(typeof n=="string")fu(this,n)&&(e=e.concat(this.g.get(tn(this,n))));else{n=Array.from(this.g.values());for(let t=0;t<n.length;t++)e=e.concat(n[t])}return e},y.set=function(n,e){return gt(this),this.i=null,n=tn(this,n),fu(this,n)&&(this.h-=this.g.get(n).length),this.g.set(n,[e]),this.h+=1,this},y.get=function(n,e){return n?(n=this.Z(n),0<n.length?String(n[0]):e):e};function pu(n,e,t){du(n,e),0<t.length&&(n.i=null,n.g.set(tn(n,e),Bi(t)),n.h+=t.length)}y.toString=function(){if(this.i)return this.i;if(!this.g)return"";const n=[],e=Array.from(this.g.keys());for(var t=0;t<e.length;t++){var r=e[t];const i=encodeURIComponent(String(r)),o=this.Z(r);for(r=0;r<o.length;r++){var s=i;o[r]!==""&&(s+="="+encodeURIComponent(String(o[r]))),n.push(s)}}return this.i=n.join("&")};function tn(n,e){return e=String(e),n.j&&(e=e.toLowerCase()),e}function sg(n,e){e&&!n.j&&(gt(n),n.i=null,n.g.forEach(function(t,r){var s=r.toLowerCase();r!=s&&(du(this,r),pu(this,s,t))},n)),n.j=e}var ig=class{constructor(n,e){this.g=n,this.map=e}};function mu(n){this.l=n||og,R.PerformanceNavigationTiming?(n=R.performance.getEntriesByType("navigation"),n=0<n.length&&(n[0].nextHopProtocol=="hq"||n[0].nextHopProtocol=="h2")):n=!!(R.g&&R.g.Ka&&R.g.Ka()&&R.g.Ka().dc),this.j=n?this.l:1,this.g=null,1<this.j&&(this.g=new Set),this.h=null,this.i=[]}var og=10;function gu(n){return n.h?!0:n.g?n.g.size>=n.j:!1}function _u(n){return n.h?1:n.g?n.g.size:0}function mo(n,e){return n.h?n.h==e:n.g?n.g.has(e):!1}function go(n,e){n.g?n.g.add(e):n.h=e}function yu(n,e){n.h&&n.h==e?n.h=null:n.g&&n.g.has(e)&&n.g.delete(e)}mu.prototype.cancel=function(){if(this.i=vu(this),this.h)this.h.cancel(),this.h=null;else if(this.g&&this.g.size!==0){for(const n of this.g.values())n.cancel();this.g.clear()}};function vu(n){if(n.h!=null)return n.i.concat(n.h.F);if(n.g!=null&&n.g.size!==0){let e=n.i;for(const t of n.g.values())e=e.concat(t.F);return e}return Bi(n.i)}var ag=class{stringify(n){return R.JSON.stringify(n,void 0)}parse(n){return R.JSON.parse(n,void 0)}};function cg(){this.g=new ag}function ug(n,e,t){const r=t||"";try{cu(n,function(s,i){let o=s;zn(s)&&(o=ro(s)),e.push(r+i+"="+encodeURIComponent(o))})}catch(s){throw e.push(r+"type="+encodeURIComponent("_badmap")),s}}function lg(n,e){const t=new rs;if(R.Image){const r=new Image;r.onload=Xr(hs,t,r,"TestLoadImage: loaded",!0,e),r.onerror=Xr(hs,t,r,"TestLoadImage: error",!1,e),r.onabort=Xr(hs,t,r,"TestLoadImage: abort",!1,e),r.ontimeout=Xr(hs,t,r,"TestLoadImage: timeout",!1,e),R.setTimeout(function(){r.ontimeout&&r.ontimeout()},1e4),r.src=n}else e(!1)}function hs(n,e,t,r,s){try{e.onload=null,e.onerror=null,e.onabort=null,e.ontimeout=null,s(r)}catch{}}function ds(n){this.l=n.ec||null,this.j=n.ob||!1}X(ds,ao),ds.prototype.g=function(){return new fs(this.l,this.j)},ds.prototype.i=function(n){return function(){return n}}({});function fs(n,e){J.call(this),this.F=n,this.u=e,this.m=void 0,this.readyState=_o,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}X(fs,J);var _o=0;y=fs.prototype,y.open=function(n,e){if(this.readyState!=_o)throw this.abort(),Error("Error reopening a connection");this.C=n,this.B=e,this.readyState=1,ar(this)},y.send=function(n){if(this.readyState!=1)throw this.abort(),Error("need to call open() first. ");this.g=!0;const e={headers:this.v,method:this.C,credentials:this.m,cache:void 0};n&&(e.body=n),(this.F||R).fetch(new Request(this.B,e)).then(this.$a.bind(this),this.ka.bind(this))},y.abort=function(){this.response=this.responseText="",this.v=new Headers,this.status=0,this.j&&this.j.cancel("Request was aborted.").catch(()=>{}),1<=this.readyState&&this.g&&this.readyState!=4&&(this.g=!1,or(this)),this.readyState=_o},y.$a=function(n){if(this.g&&(this.l=n,this.h||(this.status=this.l.status,this.statusText=this.l.statusText,this.h=n.headers,this.readyState=2,ar(this)),this.g&&(this.readyState=3,ar(this),this.g)))if(this.responseType==="arraybuffer")n.arrayBuffer().then(this.Ya.bind(this),this.ka.bind(this));else if(typeof R.ReadableStream<"u"&&"body"in n){if(this.j=n.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;Eu(this)}else n.text().then(this.Za.bind(this),this.ka.bind(this))};function Eu(n){n.j.read().then(n.Xa.bind(n)).catch(n.ka.bind(n))}y.Xa=function(n){if(this.g){if(this.u&&n.value)this.response.push(n.value);else if(!this.u){var e=n.value?n.value:new Uint8Array(0);(e=this.A.decode(e,{stream:!n.done}))&&(this.response=this.responseText+=e)}n.done?or(this):ar(this),this.readyState==3&&Eu(this)}},y.Za=function(n){this.g&&(this.response=this.responseText=n,or(this))},y.Ya=function(n){this.g&&(this.response=n,or(this))},y.ka=function(){this.g&&or(this)};function or(n){n.readyState=4,n.l=null,n.j=null,n.A=null,ar(n)}y.setRequestHeader=function(n,e){this.v.append(n,e)},y.getResponseHeader=function(n){return this.h&&this.h.get(n.toLowerCase())||""},y.getAllResponseHeaders=function(){if(!this.h)return"";const n=[],e=this.h.entries();for(var t=e.next();!t.done;)t=t.value,n.push(t[0]+": "+t[1]),t=e.next();return n.join(`\r
367
+ `)};function ar(n){n.onreadystatechange&&n.onreadystatechange.call(n)}Object.defineProperty(fs.prototype,"withCredentials",{get:function(){return this.m==="include"},set:function(n){this.m=n?"include":"same-origin"}});var hg=R.JSON.parse;function H(n){J.call(this),this.headers=new Map,this.u=n||null,this.h=!1,this.C=this.g=null,this.I="",this.m=0,this.j="",this.l=this.G=this.v=this.F=!1,this.B=0,this.A=null,this.K=Tu,this.L=this.M=!1}X(H,J);var Tu="",dg=/^https?$/i,fg=["POST","PUT"];y=H.prototype,y.Oa=function(n){this.M=n},y.ha=function(n,e,t,r){if(this.g)throw Error("[goog.net.XhrIo] Object is active with another request="+this.I+"; newUri="+n);e=e?e.toUpperCase():"GET",this.I=n,this.j="",this.m=0,this.F=!1,this.h=!0,this.g=this.u?this.u.g():lo.g(),this.C=this.u?eu(this.u):eu(lo),this.g.onreadystatechange=ae(this.La,this);try{this.G=!0,this.g.open(e,String(n),!0),this.G=!1}catch(i){wu(this,i);return}if(n=t||"",t=new Map(this.headers),r)if(Object.getPrototypeOf(r)===Object.prototype)for(var s in r)t.set(s,r[s]);else if(typeof r.keys=="function"&&typeof r.get=="function")for(const i of r.keys())t.set(i,r.get(i));else throw Error("Unknown input type for opt_headers: "+String(r));r=Array.from(t.keys()).find(i=>i.toLowerCase()=="content-type"),s=R.FormData&&n instanceof R.FormData,!(0<=Cc(fg,e))||r||s||t.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8");for(const[i,o]of t)this.g.setRequestHeader(i,o);this.K&&(this.g.responseType=this.K),"withCredentials"in this.g&&this.g.withCredentials!==this.M&&(this.g.withCredentials=this.M);try{Ru(this),0<this.B&&((this.L=pg(this.g))?(this.g.timeout=this.B,this.g.ontimeout=ae(this.ua,this)):this.A=oo(this.ua,this.B,this)),this.v=!0,this.g.send(n),this.v=!1}catch(i){wu(this,i)}};function pg(n){return Zt&&typeof n.timeout=="number"&&n.ontimeout!==void 0}y.ua=function(){typeof Ui<"u"&&this.g&&(this.j="Timed out after "+this.B+"ms, aborting",this.m=8,ee(this,"timeout"),this.abort(8))};function wu(n,e){n.h=!1,n.g&&(n.l=!0,n.g.abort(),n.l=!1),n.j=e,n.m=5,Iu(n),ps(n)}function Iu(n){n.F||(n.F=!0,ee(n,"complete"),ee(n,"error"))}y.abort=function(n){this.g&&this.h&&(this.h=!1,this.l=!0,this.g.abort(),this.l=!1,this.m=n||7,ee(this,"complete"),ee(this,"abort"),ps(this))},y.N=function(){this.g&&(this.h&&(this.h=!1,this.l=!0,this.g.abort(),this.l=!1),ps(this,!0)),H.$.N.call(this)},y.La=function(){this.s||(this.G||this.v||this.l?Au(this):this.kb())},y.kb=function(){Au(this)};function Au(n){if(n.h&&typeof Ui<"u"&&(!n.C[1]||je(n)!=4||n.da()!=2)){if(n.v&&je(n)==4)oo(n.La,0,n);else if(ee(n,"readystatechange"),je(n)==4){n.h=!1;try{const o=n.da();e:switch(o){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var e=!0;break e;default:e=!1}var t;if(!(t=e)){var r;if(r=o===0){var s=String(n.I).match(uu)[1]||null;!s&&R.self&&R.self.location&&(s=R.self.location.protocol.slice(0,-1)),r=!dg.test(s?s.toLowerCase():"")}t=r}if(t)ee(n,"complete"),ee(n,"success");else{n.m=6;try{var i=2<je(n)?n.g.statusText:""}catch{i=""}n.j=i+" ["+n.da()+"]",Iu(n)}}finally{ps(n)}}}}function ps(n,e){if(n.g){Ru(n);const t=n.g,r=n.C[0]?()=>{}:null;n.g=null,n.C=null,e||ee(n,"ready");try{t.onreadystatechange=r}catch{}}}function Ru(n){n.g&&n.L&&(n.g.ontimeout=null),n.A&&(R.clearTimeout(n.A),n.A=null)}y.isActive=function(){return!!this.g};function je(n){return n.g?n.g.readyState:0}y.da=function(){try{return 2<je(this)?this.g.status:-1}catch{return-1}},y.ja=function(){try{return this.g?this.g.responseText:""}catch{return""}},y.Wa=function(n){if(this.g){var e=this.g.responseText;return n&&e.indexOf(n)==0&&(e=e.substring(n.length)),hg(e)}};function Pu(n){try{if(!n.g)return null;if("response"in n.g)return n.g.response;switch(n.K){case Tu:case"text":return n.g.responseText;case"arraybuffer":if("mozResponseArrayBuffer"in n.g)return n.g.mozResponseArrayBuffer}return null}catch{return null}}function mg(n){const e={};n=(n.g&&2<=je(n)&&n.g.getAllResponseHeaders()||"").split(`\r
368
+ `);for(let r=0;r<n.length;r++){if(Hn(n[r]))continue;var t=Bm(n[r]);const s=t[0];if(t=t[1],typeof t!="string")continue;t=t.trim();const i=e[s]||[];e[s]=i,i.push(t)}Om(e,function(r){return r.join(", ")})}y.Ia=function(){return this.m},y.Sa=function(){return typeof this.j=="string"?this.j:String(this.j)};function Su(n){let e="";return Ki(n,function(t,r){e+=r,e+=":",e+=t,e+=`\r
369
+ `}),e}function yo(n,e,t){e:{for(r in t){var r=!1;break e}r=!0}r||(t=Su(t),typeof n=="string"?t!=null&&encodeURIComponent(String(t)):j(n,e,t))}function cr(n,e,t){return t&&t.internalChannelParams&&t.internalChannelParams[n]||e}function bu(n){this.Ga=0,this.j=[],this.l=new rs,this.pa=this.wa=this.I=this.Y=this.g=this.Da=this.F=this.na=this.o=this.U=this.s=null,this.fb=this.W=0,this.cb=cr("failFast",!1,n),this.G=this.v=this.u=this.m=this.h=null,this.aa=!0,this.Fa=this.V=-1,this.ba=this.A=this.C=0,this.ab=cr("baseRetryDelayMs",5e3,n),this.hb=cr("retryDelaySeedMs",1e4,n),this.eb=cr("forwardChannelMaxRetries",2,n),this.xa=cr("forwardChannelRequestTimeoutMs",2e4,n),this.va=n&&n.xmlHttpFactory||void 0,this.Ha=n&&n.useFetchStreams||!1,this.L=void 0,this.J=n&&n.supportsCrossDomainXhr||!1,this.K="",this.i=new mu(n&&n.concurrentRequestLimit),this.Ja=new cg,this.P=n&&n.fastHandshake||!1,this.O=n&&n.encodeInitMessageHeaders||!1,this.P&&this.O&&(this.O=!1),this.bb=n&&n.bc||!1,n&&n.Ea&&this.l.Ea(),n&&n.forceLongPolling&&(this.aa=!1),this.ca=!this.P&&this.aa&&n&&n.detectBufferingProxy||!1,this.qa=void 0,n&&n.longPollingTimeout&&0<n.longPollingTimeout&&(this.qa=n.longPollingTimeout),this.oa=void 0,this.S=0,this.M=!1,this.ma=this.B=null}y=bu.prototype,y.ra=8,y.H=1;function vo(n){if(Cu(n),n.H==3){var e=n.W++,t=et(n.I);if(j(t,"SID",n.K),j(t,"RID",e),j(t,"TYPE","terminate"),ur(n,t),e=new er(n,n.l,e),e.L=2,e.A=ls(et(t)),t=!1,R.navigator&&R.navigator.sendBeacon)try{t=R.navigator.sendBeacon(e.A.toString(),"")}catch{}!t&&R.Image&&(new Image().src=e.A,t=!0),t||(e.g=Uu(e.l,null),e.g.ha(e.A)),e.G=Date.now(),tr(e)}Mu(n)}function ms(n){n.g&&(To(n),n.g.cancel(),n.g=null)}function Cu(n){ms(n),n.u&&(R.clearTimeout(n.u),n.u=null),_s(n),n.i.cancel(),n.m&&(typeof n.m=="number"&&R.clearTimeout(n.m),n.m=null)}function gs(n){if(!gu(n.i)&&!n.m){n.m=!0;var e=n.Na;Kn||zc(),Qn||(Kn(),Qn=!0),so.add(e,n),n.C=0}}function gg(n,e){return _u(n.i)>=n.i.j-(n.m?1:0)?!1:n.m?(n.j=e.F.concat(n.j),!0):n.H==1||n.H==2||n.C>=(n.cb?0:n.eb)?!1:(n.m=Jn(ae(n.Na,n,e),Lu(n,n.C)),n.C++,!0)}y.Na=function(n){if(this.m)if(this.m=null,this.H==1){if(!n){this.W=Math.floor(1e5*Math.random()),n=this.W++;const s=new er(this,this.l,n);let i=this.s;if(this.U&&(i?(i=Lc(i),xc(i,this.U)):i=this.U),this.o!==null||this.O||(s.I=i,i=null),this.P)e:{for(var e=0,t=0;t<this.j.length;t++){t:{var r=this.j[t];if("__data__"in r.map&&(r=r.map.__data__,typeof r=="string")){r=r.length;break t}r=void 0}if(r===void 0)break;if(e+=r,4096<e){e=t;break e}if(e===4096||t===this.j.length-1){e=t+1;break e}}e=1e3}else e=1e3;e=Du(this,s,e),t=et(this.I),j(t,"RID",n),j(t,"CVER",22),this.F&&j(t,"X-HTTP-Session-Id",this.F),ur(this,t),i&&(this.O?e="headers="+encodeURIComponent(String(Su(i)))+"&"+e:this.o&&yo(t,this.o,i)),go(this.i,s),this.bb&&j(t,"TYPE","init"),this.P?(j(t,"$req",e),j(t,"SID","null"),s.aa=!0,fo(s,t,null)):fo(s,t,e),this.H=2}}else this.H==3&&(n?ku(this,n):this.j.length==0||gu(this.i)||ku(this))};function ku(n,e){var t;e?t=e.m:t=n.W++;const r=et(n.I);j(r,"SID",n.K),j(r,"RID",t),j(r,"AID",n.V),ur(n,r),n.o&&n.s&&yo(r,n.o,n.s),t=new er(n,n.l,t,n.C+1),n.o===null&&(t.I=n.s),e&&(n.j=e.F.concat(n.j)),e=Du(n,t,1e3),t.setTimeout(Math.round(.5*n.xa)+Math.round(.5*n.xa*Math.random())),go(n.i,t),fo(t,r,e)}function ur(n,e){n.na&&Ki(n.na,function(t,r){j(e,r,t)}),n.h&&cu({},function(t,r){j(e,r,t)})}function Du(n,e,t){t=Math.min(n.j.length,t);var r=n.h?ae(n.h.Va,n.h,n):null;e:{var s=n.j;let i=-1;for(;;){const o=["count="+t];i==-1?0<t?(i=s[0].g,o.push("ofs="+i)):i=0:o.push("ofs="+i);let a=!0;for(let c=0;c<t;c++){let u=s[c].g;const l=s[c].map;if(u-=i,0>u)i=Math.max(0,s[c].g-100),a=!1;else try{ug(l,o,"req"+u+"_")}catch{r&&r(l)}}if(a){r=o.join("&");break e}}}return n=n.j.splice(0,t),e.F=n,r}function Nu(n){if(!n.g&&!n.u){n.ba=1;var e=n.Ma;Kn||zc(),Qn||(Kn(),Qn=!0),so.add(e,n),n.A=0}}function Eo(n){return n.g||n.u||3<=n.A?!1:(n.ba++,n.u=Jn(ae(n.Ma,n),Lu(n,n.A)),n.A++,!0)}y.Ma=function(){if(this.u=null,Ou(this),this.ca&&!(this.M||this.g==null||0>=this.S)){var n=2*this.S;this.l.info("BP detection timer enabled: "+n),this.B=Jn(ae(this.jb,this),n)}},y.jb=function(){this.B&&(this.B=null,this.l.info("BP detection timeout reached."),this.l.info("Buffering proxy detected and switch to long-polling!"),this.G=!1,this.M=!0,pe(10),ms(this),Ou(this))};function To(n){n.B!=null&&(R.clearTimeout(n.B),n.B=null)}function Ou(n){n.g=new er(n,n.l,"rpc",n.ba),n.o===null&&(n.g.I=n.s),n.g.O=0;var e=et(n.wa);j(e,"RID","rpc"),j(e,"SID",n.K),j(e,"AID",n.V),j(e,"CI",n.G?"0":"1"),!n.G&&n.qa&&j(e,"TO",n.qa),j(e,"TYPE","xmlhttp"),ur(n,e),n.o&&n.s&&yo(e,n.o,n.s),n.L&&n.g.setTimeout(n.L);var t=n.g;n=n.pa,t.L=1,t.A=ls(et(e)),t.u=null,t.S=!0,su(t,n)}y.ib=function(){this.v!=null&&(this.v=null,ms(this),Eo(this),pe(19))};function _s(n){n.v!=null&&(R.clearTimeout(n.v),n.v=null)}function Vu(n,e){var t=null;if(n.g==e){_s(n),To(n),n.g=null;var r=2}else if(mo(n.i,e))t=e.F,yu(n.i,e),r=1;else return;if(n.H!=0){if(e.i)if(r==1){t=e.u?e.u.length:0,e=Date.now()-e.G;var s=n.C;r=ss(),ee(r,new Jc(r,t)),gs(n)}else Nu(n);else if(s=e.s,s==3||s==0&&0<e.ca||!(r==1&&gg(n,e)||r==2&&Eo(n)))switch(t&&0<t.length&&(e=n.i,e.i=e.i.concat(t)),s){case 1:Mt(n,5);break;case 4:Mt(n,10);break;case 3:Mt(n,6);break;default:Mt(n,2)}}}function Lu(n,e){let t=n.ab+Math.floor(Math.random()*n.hb);return n.isActive()||(t*=2),t*e}function Mt(n,e){if(n.l.info("Error code "+e),e==2){var t=null;n.h&&(t=null);var r=ae(n.pb,n);t||(t=new Lt("//www.google.com/images/cleardot.gif"),R.location&&R.location.protocol=="http"||cs(t,"https"),ls(t)),lg(t.toString(),r)}else pe(2);n.H=0,n.h&&n.h.za(e),Mu(n),Cu(n)}y.pb=function(n){n?(this.l.info("Successfully pinged google.com"),pe(2)):(this.l.info("Failed to ping google.com"),pe(1))};function Mu(n){if(n.H=0,n.ma=[],n.h){const e=vu(n.i);(e.length!=0||n.j.length!=0)&&(kc(n.ma,e),kc(n.ma,n.j),n.i.i.length=0,Bi(n.j),n.j.length=0),n.h.ya()}}function xu(n,e,t){var r=t instanceof Lt?et(t):new Lt(t);if(r.g!="")e&&(r.g=e+"."+r.g),us(r,r.m);else{var s=R.location;r=s.protocol,e=e?e+"."+s.hostname:s.hostname,s=+s.port;var i=new Lt(null);r&&cs(i,r),e&&(i.g=e),s&&us(i,s),t&&(i.l=t),r=i}return t=n.F,e=n.Da,t&&e&&j(r,t,e),j(r,"VER",n.ra),ur(n,r),r}function Uu(n,e,t){if(e&&!n.J)throw Error("Can't create secondary domain capable XhrIo object.");return e=n.Ha&&!n.va?new H(new ds({ob:t})):new H(n.va),e.Oa(n.J),e}y.isActive=function(){return!!this.h&&this.h.isActive(this)};function Fu(){}y=Fu.prototype,y.Ba=function(){},y.Aa=function(){},y.za=function(){},y.ya=function(){},y.isActive=function(){return!0},y.Va=function(){};function ys(){if(Zt&&!(10<=Number(Cm)))throw Error("Environmental error: no available transport.")}ys.prototype.g=function(n,e){return new we(n,e)};function we(n,e){J.call(this),this.g=new bu(e),this.l=n,this.h=e&&e.messageUrlParams||null,n=e&&e.messageHeaders||null,e&&e.clientProtocolHeaderRequired&&(n?n["X-Client-Protocol"]="webchannel":n={"X-Client-Protocol":"webchannel"}),this.g.s=n,n=e&&e.initMessageHeaders||null,e&&e.messageContentType&&(n?n["X-WebChannel-Content-Type"]=e.messageContentType:n={"X-WebChannel-Content-Type":e.messageContentType}),e&&e.Ca&&(n?n["X-WebChannel-Client-Profile"]=e.Ca:n={"X-WebChannel-Client-Profile":e.Ca}),this.g.U=n,(n=e&&e.cc)&&!Hn(n)&&(this.g.o=n),this.A=e&&e.supportsCrossDomainXhr||!1,this.v=e&&e.sendRawJson||!1,(e=e&&e.httpSessionIdParam)&&!Hn(e)&&(this.g.F=e,n=this.h,n!==null&&e in n&&(n=this.h,e in n&&delete n[e])),this.j=new nn(this)}X(we,J),we.prototype.m=function(){this.g.h=this.j,this.A&&(this.g.J=!0);var n=this.g,e=this.l,t=this.h||void 0;pe(0),n.Y=e,n.na=t||{},n.G=n.aa,n.I=xu(n,null,n.Y),gs(n)},we.prototype.close=function(){vo(this.g)},we.prototype.u=function(n){var e=this.g;if(typeof n=="string"){var t={};t.__data__=n,n=t}else this.v&&(t={},t.__data__=ro(n),n=t);e.j.push(new ig(e.fb++,n)),e.H==3&&gs(e)},we.prototype.N=function(){this.g.h=null,delete this.j,vo(this.g),delete this.g,we.$.N.call(this)};function Bu(n){co.call(this),n.__headers__&&(this.headers=n.__headers__,this.statusCode=n.__status__,delete n.__headers__,delete n.__status__);var e=n.__sm__;if(e){e:{for(const t in e){n=t;break e}n=void 0}(this.i=n)&&(n=this.i,e=e!==null&&n in e?e[n]:void 0),this.data=e}else this.data=n}X(Bu,co);function ju(){uo.call(this),this.status=1}X(ju,uo);function nn(n){this.g=n}X(nn,Fu),nn.prototype.Ba=function(){ee(this.g,"a")},nn.prototype.Aa=function(n){ee(this.g,new Bu(n))},nn.prototype.za=function(n){ee(this.g,new ju)},nn.prototype.ya=function(){ee(this.g,"b")};function _g(){this.blockSize=-1}function Ne(){this.blockSize=-1,this.blockSize=64,this.g=Array(4),this.m=Array(this.blockSize),this.i=this.h=0,this.reset()}X(Ne,_g),Ne.prototype.reset=function(){this.g[0]=1732584193,this.g[1]=4023233417,this.g[2]=2562383102,this.g[3]=271733878,this.i=this.h=0};function wo(n,e,t){t||(t=0);var r=Array(16);if(typeof e=="string")for(var s=0;16>s;++s)r[s]=e.charCodeAt(t++)|e.charCodeAt(t++)<<8|e.charCodeAt(t++)<<16|e.charCodeAt(t++)<<24;else for(s=0;16>s;++s)r[s]=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24;e=n.g[0],t=n.g[1],s=n.g[2];var i=n.g[3],o=e+(i^t&(s^i))+r[0]+3614090360&4294967295;e=t+(o<<7&4294967295|o>>>25),o=i+(s^e&(t^s))+r[1]+3905402710&4294967295,i=e+(o<<12&4294967295|o>>>20),o=s+(t^i&(e^t))+r[2]+606105819&4294967295,s=i+(o<<17&4294967295|o>>>15),o=t+(e^s&(i^e))+r[3]+3250441966&4294967295,t=s+(o<<22&4294967295|o>>>10),o=e+(i^t&(s^i))+r[4]+4118548399&4294967295,e=t+(o<<7&4294967295|o>>>25),o=i+(s^e&(t^s))+r[5]+1200080426&4294967295,i=e+(o<<12&4294967295|o>>>20),o=s+(t^i&(e^t))+r[6]+2821735955&4294967295,s=i+(o<<17&4294967295|o>>>15),o=t+(e^s&(i^e))+r[7]+4249261313&4294967295,t=s+(o<<22&4294967295|o>>>10),o=e+(i^t&(s^i))+r[8]+1770035416&4294967295,e=t+(o<<7&4294967295|o>>>25),o=i+(s^e&(t^s))+r[9]+2336552879&4294967295,i=e+(o<<12&4294967295|o>>>20),o=s+(t^i&(e^t))+r[10]+4294925233&4294967295,s=i+(o<<17&4294967295|o>>>15),o=t+(e^s&(i^e))+r[11]+2304563134&4294967295,t=s+(o<<22&4294967295|o>>>10),o=e+(i^t&(s^i))+r[12]+1804603682&4294967295,e=t+(o<<7&4294967295|o>>>25),o=i+(s^e&(t^s))+r[13]+4254626195&4294967295,i=e+(o<<12&4294967295|o>>>20),o=s+(t^i&(e^t))+r[14]+2792965006&4294967295,s=i+(o<<17&4294967295|o>>>15),o=t+(e^s&(i^e))+r[15]+1236535329&4294967295,t=s+(o<<22&4294967295|o>>>10),o=e+(s^i&(t^s))+r[1]+4129170786&4294967295,e=t+(o<<5&4294967295|o>>>27),o=i+(t^s&(e^t))+r[6]+3225465664&4294967295,i=e+(o<<9&4294967295|o>>>23),o=s+(e^t&(i^e))+r[11]+643717713&4294967295,s=i+(o<<14&4294967295|o>>>18),o=t+(i^e&(s^i))+r[0]+3921069994&4294967295,t=s+(o<<20&4294967295|o>>>12),o=e+(s^i&(t^s))+r[5]+3593408605&4294967295,e=t+(o<<5&4294967295|o>>>27),o=i+(t^s&(e^t))+r[10]+38016083&4294967295,i=e+(o<<9&4294967295|o>>>23),o=s+(e^t&(i^e))+r[15]+3634488961&4294967295,s=i+(o<<14&4294967295|o>>>18),o=t+(i^e&(s^i))+r[4]+3889429448&4294967295,t=s+(o<<20&4294967295|o>>>12),o=e+(s^i&(t^s))+r[9]+568446438&4294967295,e=t+(o<<5&4294967295|o>>>27),o=i+(t^s&(e^t))+r[14]+3275163606&4294967295,i=e+(o<<9&4294967295|o>>>23),o=s+(e^t&(i^e))+r[3]+4107603335&4294967295,s=i+(o<<14&4294967295|o>>>18),o=t+(i^e&(s^i))+r[8]+1163531501&4294967295,t=s+(o<<20&4294967295|o>>>12),o=e+(s^i&(t^s))+r[13]+2850285829&4294967295,e=t+(o<<5&4294967295|o>>>27),o=i+(t^s&(e^t))+r[2]+4243563512&4294967295,i=e+(o<<9&4294967295|o>>>23),o=s+(e^t&(i^e))+r[7]+1735328473&4294967295,s=i+(o<<14&4294967295|o>>>18),o=t+(i^e&(s^i))+r[12]+2368359562&4294967295,t=s+(o<<20&4294967295|o>>>12),o=e+(t^s^i)+r[5]+4294588738&4294967295,e=t+(o<<4&4294967295|o>>>28),o=i+(e^t^s)+r[8]+2272392833&4294967295,i=e+(o<<11&4294967295|o>>>21),o=s+(i^e^t)+r[11]+1839030562&4294967295,s=i+(o<<16&4294967295|o>>>16),o=t+(s^i^e)+r[14]+4259657740&4294967295,t=s+(o<<23&4294967295|o>>>9),o=e+(t^s^i)+r[1]+2763975236&4294967295,e=t+(o<<4&4294967295|o>>>28),o=i+(e^t^s)+r[4]+1272893353&4294967295,i=e+(o<<11&4294967295|o>>>21),o=s+(i^e^t)+r[7]+4139469664&4294967295,s=i+(o<<16&4294967295|o>>>16),o=t+(s^i^e)+r[10]+3200236656&4294967295,t=s+(o<<23&4294967295|o>>>9),o=e+(t^s^i)+r[13]+681279174&4294967295,e=t+(o<<4&4294967295|o>>>28),o=i+(e^t^s)+r[0]+3936430074&4294967295,i=e+(o<<11&4294967295|o>>>21),o=s+(i^e^t)+r[3]+3572445317&4294967295,s=i+(o<<16&4294967295|o>>>16),o=t+(s^i^e)+r[6]+76029189&4294967295,t=s+(o<<23&4294967295|o>>>9),o=e+(t^s^i)+r[9]+3654602809&4294967295,e=t+(o<<4&4294967295|o>>>28),o=i+(e^t^s)+r[12]+3873151461&4294967295,i=e+(o<<11&4294967295|o>>>21),o=s+(i^e^t)+r[15]+530742520&4294967295,s=i+(o<<16&4294967295|o>>>16),o=t+(s^i^e)+r[2]+3299628645&4294967295,t=s+(o<<23&4294967295|o>>>9),o=e+(s^(t|~i))+r[0]+4096336452&4294967295,e=t+(o<<6&4294967295|o>>>26),o=i+(t^(e|~s))+r[7]+1126891415&4294967295,i=e+(o<<10&4294967295|o>>>22),o=s+(e^(i|~t))+r[14]+2878612391&4294967295,s=i+(o<<15&4294967295|o>>>17),o=t+(i^(s|~e))+r[5]+4237533241&4294967295,t=s+(o<<21&4294967295|o>>>11),o=e+(s^(t|~i))+r[12]+1700485571&4294967295,e=t+(o<<6&4294967295|o>>>26),o=i+(t^(e|~s))+r[3]+2399980690&4294967295,i=e+(o<<10&4294967295|o>>>22),o=s+(e^(i|~t))+r[10]+4293915773&4294967295,s=i+(o<<15&4294967295|o>>>17),o=t+(i^(s|~e))+r[1]+2240044497&4294967295,t=s+(o<<21&4294967295|o>>>11),o=e+(s^(t|~i))+r[8]+1873313359&4294967295,e=t+(o<<6&4294967295|o>>>26),o=i+(t^(e|~s))+r[15]+4264355552&4294967295,i=e+(o<<10&4294967295|o>>>22),o=s+(e^(i|~t))+r[6]+2734768916&4294967295,s=i+(o<<15&4294967295|o>>>17),o=t+(i^(s|~e))+r[13]+1309151649&4294967295,t=s+(o<<21&4294967295|o>>>11),o=e+(s^(t|~i))+r[4]+4149444226&4294967295,e=t+(o<<6&4294967295|o>>>26),o=i+(t^(e|~s))+r[11]+3174756917&4294967295,i=e+(o<<10&4294967295|o>>>22),o=s+(e^(i|~t))+r[2]+718787259&4294967295,s=i+(o<<15&4294967295|o>>>17),o=t+(i^(s|~e))+r[9]+3951481745&4294967295,n.g[0]=n.g[0]+e&4294967295,n.g[1]=n.g[1]+(s+(o<<21&4294967295|o>>>11))&4294967295,n.g[2]=n.g[2]+s&4294967295,n.g[3]=n.g[3]+i&4294967295}Ne.prototype.j=function(n,e){e===void 0&&(e=n.length);for(var t=e-this.blockSize,r=this.m,s=this.h,i=0;i<e;){if(s==0)for(;i<=t;)wo(this,n,i),i+=this.blockSize;if(typeof n=="string"){for(;i<e;)if(r[s++]=n.charCodeAt(i++),s==this.blockSize){wo(this,r),s=0;break}}else for(;i<e;)if(r[s++]=n[i++],s==this.blockSize){wo(this,r),s=0;break}}this.h=s,this.i+=e},Ne.prototype.l=function(){var n=Array((56>this.h?this.blockSize:2*this.blockSize)-this.h);n[0]=128;for(var e=1;e<n.length-8;++e)n[e]=0;var t=8*this.i;for(e=n.length-8;e<n.length;++e)n[e]=t&255,t/=256;for(this.j(n),n=Array(16),e=t=0;4>e;++e)for(var r=0;32>r;r+=8)n[t++]=this.g[e]>>>r&255;return n};function U(n,e){this.h=e;for(var t=[],r=!0,s=n.length-1;0<=s;s--){var i=n[s]|0;r&&i==e||(t[s]=i,r=!1)}this.g=t}var yg={};function Io(n){return-128<=n&&128>n?Pm(n,function(e){return new U([e|0],0>e?-1:0)}):new U([n|0],0>n?-1:0)}function qe(n){if(isNaN(n)||!isFinite(n))return rn;if(0>n)return te(qe(-n));for(var e=[],t=1,r=0;n>=t;r++)e[r]=n/t|0,t*=Ao;return new U(e,0)}function qu(n,e){if(n.length==0)throw Error("number format error: empty string");if(e=e||10,2>e||36<e)throw Error("radix out of range: "+e);if(n.charAt(0)=="-")return te(qu(n.substring(1),e));if(0<=n.indexOf("-"))throw Error('number format error: interior "-" character');for(var t=qe(Math.pow(e,8)),r=rn,s=0;s<n.length;s+=8){var i=Math.min(8,n.length-s),o=parseInt(n.substring(s,s+i),e);8>i?(i=qe(Math.pow(e,i)),r=r.R(i).add(qe(o))):(r=r.R(t),r=r.add(qe(o)))}return r}var Ao=4294967296,rn=Io(0),Ro=Io(1),$u=Io(16777216);y=U.prototype,y.ea=function(){if(be(this))return-te(this).ea();for(var n=0,e=1,t=0;t<this.g.length;t++){var r=this.D(t);n+=(0<=r?r:Ao+r)*e,e*=Ao}return n},y.toString=function(n){if(n=n||10,2>n||36<n)throw Error("radix out of range: "+n);if(tt(this))return"0";if(be(this))return"-"+te(this).toString(n);for(var e=qe(Math.pow(n,6)),t=this,r="";;){var s=Ts(t,e).g;t=vs(t,s.R(e));var i=((0<t.g.length?t.g[0]:t.h)>>>0).toString(n);if(t=s,tt(t))return i+r;for(;6>i.length;)i="0"+i;r=i+r}},y.D=function(n){return 0>n?0:n<this.g.length?this.g[n]:this.h};function tt(n){if(n.h!=0)return!1;for(var e=0;e<n.g.length;e++)if(n.g[e]!=0)return!1;return!0}function be(n){return n.h==-1}y.X=function(n){return n=vs(this,n),be(n)?-1:tt(n)?0:1};function te(n){for(var e=n.g.length,t=[],r=0;r<e;r++)t[r]=~n.g[r];return new U(t,~n.h).add(Ro)}y.abs=function(){return be(this)?te(this):this},y.add=function(n){for(var e=Math.max(this.g.length,n.g.length),t=[],r=0,s=0;s<=e;s++){var i=r+(this.D(s)&65535)+(n.D(s)&65535),o=(i>>>16)+(this.D(s)>>>16)+(n.D(s)>>>16);r=o>>>16,i&=65535,o&=65535,t[s]=o<<16|i}return new U(t,t[t.length-1]&-2147483648?-1:0)};function vs(n,e){return n.add(te(e))}y.R=function(n){if(tt(this)||tt(n))return rn;if(be(this))return be(n)?te(this).R(te(n)):te(te(this).R(n));if(be(n))return te(this.R(te(n)));if(0>this.X($u)&&0>n.X($u))return qe(this.ea()*n.ea());for(var e=this.g.length+n.g.length,t=[],r=0;r<2*e;r++)t[r]=0;for(r=0;r<this.g.length;r++)for(var s=0;s<n.g.length;s++){var i=this.D(r)>>>16,o=this.D(r)&65535,a=n.D(s)>>>16,c=n.D(s)&65535;t[2*r+2*s]+=o*c,Es(t,2*r+2*s),t[2*r+2*s+1]+=i*c,Es(t,2*r+2*s+1),t[2*r+2*s+1]+=o*a,Es(t,2*r+2*s+1),t[2*r+2*s+2]+=i*a,Es(t,2*r+2*s+2)}for(r=0;r<e;r++)t[r]=t[2*r+1]<<16|t[2*r];for(r=e;r<2*e;r++)t[r]=0;return new U(t,0)};function Es(n,e){for(;(n[e]&65535)!=n[e];)n[e+1]+=n[e]>>>16,n[e]&=65535,e++}function lr(n,e){this.g=n,this.h=e}function Ts(n,e){if(tt(e))throw Error("division by zero");if(tt(n))return new lr(rn,rn);if(be(n))return e=Ts(te(n),e),new lr(te(e.g),te(e.h));if(be(e))return e=Ts(n,te(e)),new lr(te(e.g),e.h);if(30<n.g.length){if(be(n)||be(e))throw Error("slowDivide_ only works with positive integers.");for(var t=Ro,r=e;0>=r.X(n);)t=zu(t),r=zu(r);var s=sn(t,1),i=sn(r,1);for(r=sn(r,2),t=sn(t,2);!tt(r);){var o=i.add(r);0>=o.X(n)&&(s=s.add(t),i=o),r=sn(r,1),t=sn(t,1)}return e=vs(n,s.R(e)),new lr(s,e)}for(s=rn;0<=n.X(e);){for(t=Math.max(1,Math.floor(n.ea()/e.ea())),r=Math.ceil(Math.log(t)/Math.LN2),r=48>=r?1:Math.pow(2,r-48),i=qe(t),o=i.R(e);be(o)||0<o.X(n);)t-=r,i=qe(t),o=i.R(e);tt(i)&&(i=Ro),s=s.add(i),n=vs(n,o)}return new lr(s,n)}y.gb=function(n){return Ts(this,n).h},y.and=function(n){for(var e=Math.max(this.g.length,n.g.length),t=[],r=0;r<e;r++)t[r]=this.D(r)&n.D(r);return new U(t,this.h&n.h)},y.or=function(n){for(var e=Math.max(this.g.length,n.g.length),t=[],r=0;r<e;r++)t[r]=this.D(r)|n.D(r);return new U(t,this.h|n.h)},y.xor=function(n){for(var e=Math.max(this.g.length,n.g.length),t=[],r=0;r<e;r++)t[r]=this.D(r)^n.D(r);return new U(t,this.h^n.h)};function zu(n){for(var e=n.g.length+1,t=[],r=0;r<e;r++)t[r]=n.D(r)<<1|n.D(r-1)>>>31;return new U(t,n.h)}function sn(n,e){var t=e>>5;e%=32;for(var r=n.g.length-t,s=[],i=0;i<r;i++)s[i]=0<e?n.D(i+t)>>>e|n.D(i+t+1)<<32-e:n.D(i+t);return new U(s,n.h)}ys.prototype.createWebChannel=ys.prototype.g,we.prototype.send=we.prototype.u,we.prototype.open=we.prototype.m,we.prototype.close=we.prototype.close,is.NO_ERROR=0,is.TIMEOUT=8,is.HTTP_ERROR=6,Zc.COMPLETE="complete",tu.EventType=Zn,Zn.OPEN="a",Zn.CLOSE="b",Zn.ERROR="c",Zn.MESSAGE="d",J.prototype.listen=J.prototype.O,H.prototype.listenOnce=H.prototype.P,H.prototype.getLastError=H.prototype.Sa,H.prototype.getLastErrorCode=H.prototype.Ia,H.prototype.getStatus=H.prototype.da,H.prototype.getResponseJson=H.prototype.Wa,H.prototype.getResponseText=H.prototype.ja,H.prototype.send=H.prototype.ha,H.prototype.setWithCredentials=H.prototype.Oa,Ne.prototype.digest=Ne.prototype.l,Ne.prototype.reset=Ne.prototype.reset,Ne.prototype.update=Ne.prototype.j,U.prototype.add=U.prototype.add,U.prototype.multiply=U.prototype.R,U.prototype.modulo=U.prototype.gb,U.prototype.compare=U.prototype.X,U.prototype.toNumber=U.prototype.ea,U.prototype.toString=U.prototype.toString,U.prototype.getBits=U.prototype.D,U.fromNumber=qe,U.fromString=qu;var vg=function(){return new ys},Eg=function(){return ss()},Po=is,Tg=Zc,wg=Ot,Hu={xb:0,Ab:1,Bb:2,Ub:3,Zb:4,Wb:5,Xb:6,Vb:7,Tb:8,Yb:9,PROXY:10,NOPROXY:11,Rb:12,Nb:13,Ob:14,Mb:15,Pb:16,Qb:17,tb:18,sb:19,ub:20},ws=tu,Ig=H,Ag=Ne,on=U;const Wu="@firebase/firestore";/**
370
370
  * @license
371
371
  * Copyright 2017 Google LLC
372
372
  *
@@ -396,7 +396,7 @@
396
396
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
397
397
  * See the License for the specific language governing permissions and
398
398
  * limitations under the License.
399
- */let rn="10.8.0";/**
399
+ */let an="10.11.0";/**
400
400
  * @license
401
401
  * Copyright 2017 Google LLC
402
402
  *
@@ -411,7 +411,7 @@
411
411
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
412
412
  * See the License for the specific language governing permissions and
413
413
  * limitations under the License.
414
- */const Ot=new Ii("@firebase/firestore");function ir(){return Ot.logLevel}function v(t,...e){if(Ot.logLevel<=N.DEBUG){const n=e.map(Io);Ot.debug(`Firestore (${rn}): ${t}`,...n)}}function Be(t,...e){if(Ot.logLevel<=N.ERROR){const n=e.map(Io);Ot.error(`Firestore (${rn}): ${t}`,...n)}}function sn(t,...e){if(Ot.logLevel<=N.WARN){const n=e.map(Io);Ot.warn(`Firestore (${rn}): ${t}`,...n)}}function Io(t){if(typeof t=="string")return t;try{/**
414
+ */const xt=new Si("@firebase/firestore");function hr(){return xt.logLevel}function v(n,...e){if(xt.logLevel<=N.DEBUG){const t=e.map(So);xt.debug(`Firestore (${an}): ${n}`,...t)}}function $e(n,...e){if(xt.logLevel<=N.ERROR){const t=e.map(So);xt.error(`Firestore (${an}): ${n}`,...t)}}function cn(n,...e){if(xt.logLevel<=N.WARN){const t=e.map(So);xt.warn(`Firestore (${an}): ${n}`,...t)}}function So(n){if(typeof n=="string")return n;try{/**
415
415
  * @license
416
416
  * Copyright 2020 Google LLC
417
417
  *
@@ -426,7 +426,7 @@
426
426
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
427
427
  * See the License for the specific language governing permissions and
428
428
  * limitations under the License.
429
- */return function(n){return JSON.stringify(n)}(t)}catch{return t}}/**
429
+ */return function(t){return JSON.stringify(t)}(n)}catch{return n}}/**
430
430
  * @license
431
431
  * Copyright 2017 Google LLC
432
432
  *
@@ -441,7 +441,7 @@
441
441
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
442
442
  * See the License for the specific language governing permissions and
443
443
  * limitations under the License.
444
- */function A(t="Unexpected state"){const e=`FIRESTORE (${rn}) INTERNAL ASSERTION FAILED: `+t;throw Be(e),new Error(e)}function F(t,e){t||A()}function P(t,e){return t}/**
444
+ */function A(n="Unexpected state"){const e=`FIRESTORE (${an}) INTERNAL ASSERTION FAILED: `+n;throw $e(e),new Error(e)}function F(n,e){n||A()}function P(n,e){return n}/**
445
445
  * @license
446
446
  * Copyright 2017 Google LLC
447
447
  *
@@ -456,7 +456,7 @@
456
456
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
457
457
  * See the License for the specific language governing permissions and
458
458
  * limitations under the License.
459
- */const p={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 g extends Ce{constructor(e,n){super(e,n),this.code=e,this.message=n,this.toString=()=>`${this.name}: [code=${this.code}]: ${this.message}`}}/**
459
+ */const p={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 g extends De{constructor(e,t){super(e,t),this.code=e,this.message=t,this.toString=()=>`${this.name}: [code=${this.code}]: ${this.message}`}}/**
460
460
  * @license
461
461
  * Copyright 2017 Google LLC
462
462
  *
@@ -471,7 +471,7 @@
471
471
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
472
472
  * See the License for the specific language governing permissions and
473
473
  * limitations under the License.
474
- */class De{constructor(){this.promise=new Promise((e,n)=>{this.resolve=e,this.reject=n})}}/**
474
+ */class Oe{constructor(){this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}}/**
475
475
  * @license
476
476
  * Copyright 2017 Google LLC
477
477
  *
@@ -486,7 +486,7 @@
486
486
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
487
487
  * See the License for the specific language governing permissions and
488
488
  * limitations under the License.
489
- */class Uu{constructor(e,n){this.user=n,this.type="OAuth",this.headers=new Map,this.headers.set("Authorization",`Bearer ${e}`)}}class lg{getToken(){return Promise.resolve(null)}invalidateToken(){}start(e,n){e.enqueueRetryable(()=>n(ue.UNAUTHENTICATED))}shutdown(){}}class hg{constructor(e){this.token=e,this.changeListener=null}getToken(){return Promise.resolve(this.token)}invalidateToken(){}start(e,n){this.changeListener=n,e.enqueueRetryable(()=>n(this.token.user))}shutdown(){this.changeListener=null}}class dg{constructor(e){this.t=e,this.currentUser=ue.UNAUTHENTICATED,this.i=0,this.forceRefresh=!1,this.auth=null}start(e,n){let r=this.i;const s=c=>this.i!==r?(r=this.i,n(c)):Promise.resolve();let i=new De;this.o=()=>{this.i++,this.currentUser=this.u(),i.resolve(),i=new De,e.enqueueRetryable(()=>s(this.currentUser))};const o=()=>{const c=i;e.enqueueRetryable(async()=>{await c.promise,await s(this.currentUser)})},a=c=>{v("FirebaseAuthCredentialsProvider","Auth detected"),this.auth=c,this.auth.addAuthTokenListener(this.o),o()};this.t.onInit(c=>a(c)),setTimeout(()=>{if(!this.auth){const c=this.t.getImmediate({optional:!0});c?a(c):(v("FirebaseAuthCredentialsProvider","Auth not yet detected"),i.resolve(),i=new De)}},0),o()}getToken(){const e=this.i,n=this.forceRefresh;return this.forceRefresh=!1,this.auth?this.auth.getToken(n).then(r=>this.i!==e?(v("FirebaseAuthCredentialsProvider","getToken aborted due to token change."),this.getToken()):r?(F(typeof r.accessToken=="string"),new Uu(r.accessToken,this.currentUser)):null):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.auth&&this.auth.removeAuthTokenListener(this.o)}u(){const e=this.auth&&this.auth.getUid();return F(e===null||typeof e=="string"),new ue(e)}}class fg{constructor(e,n,r){this.l=e,this.h=n,this.P=r,this.type="FirstParty",this.user=ue.FIRST_PARTY,this.I=new Map}T(){return this.P?this.P():null}get headers(){this.I.set("X-Goog-AuthUser",this.l);const e=this.T();return e&&this.I.set("Authorization",e),this.h&&this.I.set("X-Goog-Iam-Authorization-Token",this.h),this.I}}class pg{constructor(e,n,r){this.l=e,this.h=n,this.P=r}getToken(){return Promise.resolve(new fg(this.l,this.h,this.P))}start(e,n){e.enqueueRetryable(()=>n(ue.FIRST_PARTY))}shutdown(){}invalidateToken(){}}class mg{constructor(e){this.value=e,this.type="AppCheck",this.headers=new Map,e&&e.length>0&&this.headers.set("x-firebase-appcheck",this.value)}}class gg{constructor(e){this.A=e,this.forceRefresh=!1,this.appCheck=null,this.R=null}start(e,n){const r=i=>{i.error!=null&&v("FirebaseAppCheckTokenProvider",`Error getting App Check token; using placeholder token instead. Error: ${i.error.message}`);const o=i.token!==this.R;return this.R=i.token,v("FirebaseAppCheckTokenProvider",`Received ${o?"new":"existing"} token.`),o?n(i.token):Promise.resolve()};this.o=i=>{e.enqueueRetryable(()=>r(i))};const s=i=>{v("FirebaseAppCheckTokenProvider","AppCheck detected"),this.appCheck=i,this.appCheck.addTokenListener(this.o)};this.A.onInit(i=>s(i)),setTimeout(()=>{if(!this.appCheck){const i=this.A.getImmediate({optional:!0});i?s(i):v("FirebaseAppCheckTokenProvider","AppCheck not yet detected")}},0)}getToken(){const e=this.forceRefresh;return this.forceRefresh=!1,this.appCheck?this.appCheck.getToken(e).then(n=>n?(F(typeof n.token=="string"),this.R=n.token,new mg(n.token)):null):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.appCheck&&this.appCheck.removeTokenListener(this.o)}}/**
489
+ */class Gu{constructor(e,t){this.user=t,this.type="OAuth",this.headers=new Map,this.headers.set("Authorization",`Bearer ${e}`)}}class Rg{getToken(){return Promise.resolve(null)}invalidateToken(){}start(e,t){e.enqueueRetryable(()=>t(ue.UNAUTHENTICATED))}shutdown(){}}class Pg{constructor(e){this.token=e,this.changeListener=null}getToken(){return Promise.resolve(this.token)}invalidateToken(){}start(e,t){this.changeListener=t,e.enqueueRetryable(()=>t(this.token.user))}shutdown(){this.changeListener=null}}class Sg{constructor(e){this.t=e,this.currentUser=ue.UNAUTHENTICATED,this.i=0,this.forceRefresh=!1,this.auth=null}start(e,t){let r=this.i;const s=c=>this.i!==r?(r=this.i,t(c)):Promise.resolve();let i=new Oe;this.o=()=>{this.i++,this.currentUser=this.u(),i.resolve(),i=new Oe,e.enqueueRetryable(()=>s(this.currentUser))};const o=()=>{const c=i;e.enqueueRetryable(async()=>{await c.promise,await s(this.currentUser)})},a=c=>{v("FirebaseAuthCredentialsProvider","Auth detected"),this.auth=c,this.auth.addAuthTokenListener(this.o),o()};this.t.onInit(c=>a(c)),setTimeout(()=>{if(!this.auth){const c=this.t.getImmediate({optional:!0});c?a(c):(v("FirebaseAuthCredentialsProvider","Auth not yet detected"),i.resolve(),i=new Oe)}},0),o()}getToken(){const e=this.i,t=this.forceRefresh;return this.forceRefresh=!1,this.auth?this.auth.getToken(t).then(r=>this.i!==e?(v("FirebaseAuthCredentialsProvider","getToken aborted due to token change."),this.getToken()):r?(F(typeof r.accessToken=="string"),new Gu(r.accessToken,this.currentUser)):null):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.auth&&this.auth.removeAuthTokenListener(this.o)}u(){const e=this.auth&&this.auth.getUid();return F(e===null||typeof e=="string"),new ue(e)}}class bg{constructor(e,t,r){this.l=e,this.h=t,this.P=r,this.type="FirstParty",this.user=ue.FIRST_PARTY,this.I=new Map}T(){return this.P?this.P():null}get headers(){this.I.set("X-Goog-AuthUser",this.l);const e=this.T();return e&&this.I.set("Authorization",e),this.h&&this.I.set("X-Goog-Iam-Authorization-Token",this.h),this.I}}class Cg{constructor(e,t,r){this.l=e,this.h=t,this.P=r}getToken(){return Promise.resolve(new bg(this.l,this.h,this.P))}start(e,t){e.enqueueRetryable(()=>t(ue.FIRST_PARTY))}shutdown(){}invalidateToken(){}}class kg{constructor(e){this.value=e,this.type="AppCheck",this.headers=new Map,e&&e.length>0&&this.headers.set("x-firebase-appcheck",this.value)}}class Dg{constructor(e){this.A=e,this.forceRefresh=!1,this.appCheck=null,this.R=null}start(e,t){const r=i=>{i.error!=null&&v("FirebaseAppCheckTokenProvider",`Error getting App Check token; using placeholder token instead. Error: ${i.error.message}`);const o=i.token!==this.R;return this.R=i.token,v("FirebaseAppCheckTokenProvider",`Received ${o?"new":"existing"} token.`),o?t(i.token):Promise.resolve()};this.o=i=>{e.enqueueRetryable(()=>r(i))};const s=i=>{v("FirebaseAppCheckTokenProvider","AppCheck detected"),this.appCheck=i,this.appCheck.addTokenListener(this.o)};this.A.onInit(i=>s(i)),setTimeout(()=>{if(!this.appCheck){const i=this.A.getImmediate({optional:!0});i?s(i):v("FirebaseAppCheckTokenProvider","AppCheck not yet detected")}},0)}getToken(){const e=this.forceRefresh;return this.forceRefresh=!1,this.appCheck?this.appCheck.getToken(e).then(t=>t?(F(typeof t.token=="string"),this.R=t.token,new kg(t.token)):null):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.appCheck&&this.appCheck.removeTokenListener(this.o)}}/**
490
490
  * @license
491
491
  * Copyright 2020 Google LLC
492
492
  *
@@ -501,7 +501,7 @@
501
501
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
502
502
  * See the License for the specific language governing permissions and
503
503
  * limitations under the License.
504
- */function _g(t){const e=typeof self<"u"&&(self.crypto||self.msCrypto),n=new Uint8Array(t);if(e&&typeof e.getRandomValues=="function")e.getRandomValues(n);else for(let r=0;r<t;r++)n[r]=Math.floor(256*Math.random());return n}/**
504
+ */function Ng(n){const e=typeof self<"u"&&(self.crypto||self.msCrypto),t=new Uint8Array(n);if(e&&typeof e.getRandomValues=="function")e.getRandomValues(t);else for(let r=0;r<n;r++)t[r]=Math.floor(256*Math.random());return t}/**
505
505
  * @license
506
506
  * Copyright 2017 Google LLC
507
507
  *
@@ -516,7 +516,7 @@
516
516
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
517
517
  * See the License for the specific language governing permissions and
518
518
  * limitations under the License.
519
- */class Fu{static newId(){const e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",n=Math.floor(256/e.length)*e.length;let r="";for(;r.length<20;){const s=_g(40);for(let i=0;i<s.length;++i)r.length<20&&s[i]<n&&(r+=e.charAt(s[i]%e.length))}return r}}function M(t,e){return t<e?-1:t>e?1:0}function on(t,e,n){return t.length===e.length&&t.every((r,s)=>n(r,e[s]))}/**
519
+ */class Ku{static newId(){const e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",t=Math.floor(256/e.length)*e.length;let r="";for(;r.length<20;){const s=Ng(40);for(let i=0;i<s.length;++i)r.length<20&&s[i]<t&&(r+=e.charAt(s[i]%e.length))}return r}}function M(n,e){return n<e?-1:n>e?1:0}function un(n,e,t){return n.length===e.length&&n.every((r,s)=>t(r,e[s]))}/**
520
520
  * @license
521
521
  * Copyright 2017 Google LLC
522
522
  *
@@ -531,7 +531,7 @@
531
531
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
532
532
  * See the License for the specific language governing permissions and
533
533
  * limitations under the License.
534
- */class Y{constructor(e,n){if(this.seconds=e,this.nanoseconds=n,n<0)throw new g(p.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+n);if(n>=1e9)throw new g(p.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+n);if(e<-62135596800)throw new g(p.INVALID_ARGUMENT,"Timestamp seconds out of range: "+e);if(e>=253402300800)throw new g(p.INVALID_ARGUMENT,"Timestamp seconds out of range: "+e)}static now(){return Y.fromMillis(Date.now())}static fromDate(e){return Y.fromMillis(e.getTime())}static fromMillis(e){const n=Math.floor(e/1e3),r=Math.floor(1e6*(e-1e3*n));return new Y(n,r)}toDate(){return new Date(this.toMillis())}toMillis(){return 1e3*this.seconds+this.nanoseconds/1e6}_compareTo(e){return this.seconds===e.seconds?M(this.nanoseconds,e.nanoseconds):M(this.seconds,e.seconds)}isEqual(e){return e.seconds===this.seconds&&e.nanoseconds===this.nanoseconds}toString(){return"Timestamp(seconds="+this.seconds+", nanoseconds="+this.nanoseconds+")"}toJSON(){return{seconds:this.seconds,nanoseconds:this.nanoseconds}}valueOf(){const e=this.seconds- -62135596800;return String(e).padStart(12,"0")+"."+String(this.nanoseconds).padStart(9,"0")}}/**
534
+ */class Y{constructor(e,t){if(this.seconds=e,this.nanoseconds=t,t<0)throw new g(p.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+t);if(t>=1e9)throw new g(p.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+t);if(e<-62135596800)throw new g(p.INVALID_ARGUMENT,"Timestamp seconds out of range: "+e);if(e>=253402300800)throw new g(p.INVALID_ARGUMENT,"Timestamp seconds out of range: "+e)}static now(){return Y.fromMillis(Date.now())}static fromDate(e){return Y.fromMillis(e.getTime())}static fromMillis(e){const t=Math.floor(e/1e3),r=Math.floor(1e6*(e-1e3*t));return new Y(t,r)}toDate(){return new Date(this.toMillis())}toMillis(){return 1e3*this.seconds+this.nanoseconds/1e6}_compareTo(e){return this.seconds===e.seconds?M(this.nanoseconds,e.nanoseconds):M(this.seconds,e.seconds)}isEqual(e){return e.seconds===this.seconds&&e.nanoseconds===this.nanoseconds}toString(){return"Timestamp(seconds="+this.seconds+", nanoseconds="+this.nanoseconds+")"}toJSON(){return{seconds:this.seconds,nanoseconds:this.nanoseconds}}valueOf(){const e=this.seconds- -62135596800;return String(e).padStart(12,"0")+"."+String(this.nanoseconds).padStart(9,"0")}}/**
535
535
  * @license
536
536
  * Copyright 2017 Google LLC
537
537
  *
@@ -561,7 +561,7 @@
561
561
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
562
562
  * See the License for the specific language governing permissions and
563
563
  * limitations under the License.
564
- */class or{constructor(e,n,r){n===void 0?n=0:n>e.length&&A(),r===void 0?r=e.length-n:r>e.length-n&&A(),this.segments=e,this.offset=n,this.len=r}get length(){return this.len}isEqual(e){return or.comparator(this,e)===0}child(e){const n=this.segments.slice(this.offset,this.limit());return e instanceof or?e.forEach(r=>{n.push(r)}):n.push(e),this.construct(n)}limit(){return this.offset+this.length}popFirst(e){return e=e===void 0?1:e,this.construct(this.segments,this.offset+e,this.length-e)}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(e){return this.segments[this.offset+e]}isEmpty(){return this.length===0}isPrefixOf(e){if(e.length<this.length)return!1;for(let n=0;n<this.length;n++)if(this.get(n)!==e.get(n))return!1;return!0}isImmediateParentOf(e){if(this.length+1!==e.length)return!1;for(let n=0;n<this.length;n++)if(this.get(n)!==e.get(n))return!1;return!0}forEach(e){for(let n=this.offset,r=this.limit();n<r;n++)e(this.segments[n])}toArray(){return this.segments.slice(this.offset,this.limit())}static comparator(e,n){const r=Math.min(e.length,n.length);for(let s=0;s<r;s++){const i=e.get(s),o=n.get(s);if(i<o)return-1;if(i>o)return 1}return e.length<n.length?-1:e.length>n.length?1:0}}class B extends or{construct(e,n,r){return new B(e,n,r)}canonicalString(){return this.toArray().join("/")}toString(){return this.canonicalString()}toUriEncodedString(){return this.toArray().map(encodeURIComponent).join("/")}static fromString(...e){const n=[];for(const r of e){if(r.indexOf("//")>=0)throw new g(p.INVALID_ARGUMENT,`Invalid segment (${r}). Paths must not contain // in them.`);n.push(...r.split("/").filter(s=>s.length>0))}return new B(n)}static emptyPath(){return new B([])}}const yg=/^[_a-zA-Z][_a-zA-Z0-9]*$/;class ne extends or{construct(e,n,r){return new ne(e,n,r)}static isValidIdentifier(e){return yg.test(e)}canonicalString(){return this.toArray().map(e=>(e=e.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),ne.isValidIdentifier(e)||(e="`"+e+"`"),e)).join(".")}toString(){return this.canonicalString()}isKeyField(){return this.length===1&&this.get(0)==="__name__"}static keyField(){return new ne(["__name__"])}static fromServerFormat(e){const n=[];let r="",s=0;const i=()=>{if(r.length===0)throw new g(p.INVALID_ARGUMENT,`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`);n.push(r),r=""};let o=!1;for(;s<e.length;){const a=e[s];if(a==="\\"){if(s+1===e.length)throw new g(p.INVALID_ARGUMENT,"Path has trailing escape character: "+e);const c=e[s+1];if(c!=="\\"&&c!=="."&&c!=="`")throw new g(p.INVALID_ARGUMENT,"Path has invalid escape sequence: "+e);r+=c,s+=2}else a==="`"?(o=!o,s++):a!=="."||o?(r+=a,s++):(i(),s++)}if(i(),o)throw new g(p.INVALID_ARGUMENT,"Unterminated ` in path: "+e);return new ne(n)}static emptyPath(){return new ne([])}}/**
564
+ */class dr{constructor(e,t,r){t===void 0?t=0:t>e.length&&A(),r===void 0?r=e.length-t:r>e.length-t&&A(),this.segments=e,this.offset=t,this.len=r}get length(){return this.len}isEqual(e){return dr.comparator(this,e)===0}child(e){const t=this.segments.slice(this.offset,this.limit());return e instanceof dr?e.forEach(r=>{t.push(r)}):t.push(e),this.construct(t)}limit(){return this.offset+this.length}popFirst(e){return e=e===void 0?1:e,this.construct(this.segments,this.offset+e,this.length-e)}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(e){return this.segments[this.offset+e]}isEmpty(){return this.length===0}isPrefixOf(e){if(e.length<this.length)return!1;for(let t=0;t<this.length;t++)if(this.get(t)!==e.get(t))return!1;return!0}isImmediateParentOf(e){if(this.length+1!==e.length)return!1;for(let t=0;t<this.length;t++)if(this.get(t)!==e.get(t))return!1;return!0}forEach(e){for(let t=this.offset,r=this.limit();t<r;t++)e(this.segments[t])}toArray(){return this.segments.slice(this.offset,this.limit())}static comparator(e,t){const r=Math.min(e.length,t.length);for(let s=0;s<r;s++){const i=e.get(s),o=t.get(s);if(i<o)return-1;if(i>o)return 1}return e.length<t.length?-1:e.length>t.length?1:0}}class B extends dr{construct(e,t,r){return new B(e,t,r)}canonicalString(){return this.toArray().join("/")}toString(){return this.canonicalString()}toUriEncodedString(){return this.toArray().map(encodeURIComponent).join("/")}static fromString(...e){const t=[];for(const r of e){if(r.indexOf("//")>=0)throw new g(p.INVALID_ARGUMENT,`Invalid segment (${r}). Paths must not contain // in them.`);t.push(...r.split("/").filter(s=>s.length>0))}return new B(t)}static emptyPath(){return new B([])}}const Og=/^[_a-zA-Z][_a-zA-Z0-9]*$/;class ne extends dr{construct(e,t,r){return new ne(e,t,r)}static isValidIdentifier(e){return Og.test(e)}canonicalString(){return this.toArray().map(e=>(e=e.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),ne.isValidIdentifier(e)||(e="`"+e+"`"),e)).join(".")}toString(){return this.canonicalString()}isKeyField(){return this.length===1&&this.get(0)==="__name__"}static keyField(){return new ne(["__name__"])}static fromServerFormat(e){const t=[];let r="",s=0;const i=()=>{if(r.length===0)throw new g(p.INVALID_ARGUMENT,`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`);t.push(r),r=""};let o=!1;for(;s<e.length;){const a=e[s];if(a==="\\"){if(s+1===e.length)throw new g(p.INVALID_ARGUMENT,"Path has trailing escape character: "+e);const c=e[s+1];if(c!=="\\"&&c!=="."&&c!=="`")throw new g(p.INVALID_ARGUMENT,"Path has invalid escape sequence: "+e);r+=c,s+=2}else a==="`"?(o=!o,s++):a!=="."||o?(r+=a,s++):(i(),s++)}if(i(),o)throw new g(p.INVALID_ARGUMENT,"Unterminated ` in path: "+e);return new ne(t)}static emptyPath(){return new ne([])}}/**
565
565
  * @license
566
566
  * Copyright 2017 Google LLC
567
567
  *
@@ -576,7 +576,7 @@
576
576
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
577
577
  * See the License for the specific language governing permissions and
578
578
  * limitations under the License.
579
- */class w{constructor(e){this.path=e}static fromPath(e){return new w(B.fromString(e))}static fromName(e){return new w(B.fromString(e).popFirst(5))}static empty(){return new w(B.emptyPath())}get collectionGroup(){return this.path.popLast().lastSegment()}hasCollectionId(e){return this.path.length>=2&&this.path.get(this.path.length-2)===e}getCollectionGroup(){return this.path.get(this.path.length-2)}getCollectionPath(){return this.path.popLast()}isEqual(e){return e!==null&&B.comparator(this.path,e.path)===0}toString(){return this.path.toString()}static comparator(e,n){return B.comparator(e.path,n.path)}static isDocumentKey(e){return e.length%2==0}static fromSegments(e){return new w(new B(e.slice()))}}function vg(t,e){const n=t.toTimestamp().seconds,r=t.toTimestamp().nanoseconds+1,s=S.fromTimestamp(r===1e9?new Y(n+1,0):new Y(n,r));return new ft(s,w.empty(),e)}function Eg(t){return new ft(t.readTime,t.key,-1)}class ft{constructor(e,n,r){this.readTime=e,this.documentKey=n,this.largestBatchId=r}static min(){return new ft(S.min(),w.empty(),-1)}static max(){return new ft(S.max(),w.empty(),-1)}}function Tg(t,e){let n=t.readTime.compareTo(e.readTime);return n!==0?n:(n=w.comparator(t.documentKey,e.documentKey),n!==0?n:M(t.largestBatchId,e.largestBatchId))}/**
579
+ */class w{constructor(e){this.path=e}static fromPath(e){return new w(B.fromString(e))}static fromName(e){return new w(B.fromString(e).popFirst(5))}static empty(){return new w(B.emptyPath())}get collectionGroup(){return this.path.popLast().lastSegment()}hasCollectionId(e){return this.path.length>=2&&this.path.get(this.path.length-2)===e}getCollectionGroup(){return this.path.get(this.path.length-2)}getCollectionPath(){return this.path.popLast()}isEqual(e){return e!==null&&B.comparator(this.path,e.path)===0}toString(){return this.path.toString()}static comparator(e,t){return B.comparator(e.path,t.path)}static isDocumentKey(e){return e.length%2==0}static fromSegments(e){return new w(new B(e.slice()))}}function Vg(n,e){const t=n.toTimestamp().seconds,r=n.toTimestamp().nanoseconds+1,s=S.fromTimestamp(r===1e9?new Y(t+1,0):new Y(t,r));return new _t(s,w.empty(),e)}function Lg(n){return new _t(n.readTime,n.key,-1)}class _t{constructor(e,t,r){this.readTime=e,this.documentKey=t,this.largestBatchId=r}static min(){return new _t(S.min(),w.empty(),-1)}static max(){return new _t(S.max(),w.empty(),-1)}}function Mg(n,e){let t=n.readTime.compareTo(e.readTime);return t!==0?t:(t=w.comparator(n.documentKey,e.documentKey),t!==0?t:M(n.largestBatchId,e.largestBatchId))}/**
580
580
  * @license
581
581
  * Copyright 2020 Google LLC
582
582
  *
@@ -591,7 +591,7 @@
591
591
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
592
592
  * See the License for the specific language governing permissions and
593
593
  * limitations under the License.
594
- */const wg="The current tab is not in the required state to perform this operation. It might be necessary to refresh the browser tab.";class Ig{constructor(){this.onCommittedListeners=[]}addOnCommittedListener(e){this.onCommittedListeners.push(e)}raiseOnCommittedEvent(){this.onCommittedListeners.forEach(e=>e())}}/**
594
+ */const xg="The current tab is not in the required state to perform this operation. It might be necessary to refresh the browser tab.";class Ug{constructor(){this.onCommittedListeners=[]}addOnCommittedListener(e){this.onCommittedListeners.push(e)}raiseOnCommittedEvent(){this.onCommittedListeners.forEach(e=>e())}}/**
595
595
  * @license
596
596
  * Copyright 2017 Google LLC
597
597
  *
@@ -606,7 +606,7 @@
606
606
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
607
607
  * See the License for the specific language governing permissions and
608
608
  * limitations under the License.
609
- */async function ar(t){if(t.code!==p.FAILED_PRECONDITION||t.message!==wg)throw t;v("LocalStore","Unexpectedly lost primary lease")}/**
609
+ */async function fr(n){if(n.code!==p.FAILED_PRECONDITION||n.message!==xg)throw n;v("LocalStore","Unexpectedly lost primary lease")}/**
610
610
  * @license
611
611
  * Copyright 2017 Google LLC
612
612
  *
@@ -621,7 +621,7 @@
621
621
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
622
622
  * See the License for the specific language governing permissions and
623
623
  * limitations under the License.
624
- */class m{constructor(e){this.nextCallback=null,this.catchCallback=null,this.result=void 0,this.error=void 0,this.isDone=!1,this.callbackAttached=!1,e(n=>{this.isDone=!0,this.result=n,this.nextCallback&&this.nextCallback(n)},n=>{this.isDone=!0,this.error=n,this.catchCallback&&this.catchCallback(n)})}catch(e){return this.next(void 0,e)}next(e,n){return this.callbackAttached&&A(),this.callbackAttached=!0,this.isDone?this.error?this.wrapFailure(n,this.error):this.wrapSuccess(e,this.result):new m((r,s)=>{this.nextCallback=i=>{this.wrapSuccess(e,i).next(r,s)},this.catchCallback=i=>{this.wrapFailure(n,i).next(r,s)}})}toPromise(){return new Promise((e,n)=>{this.next(e,n)})}wrapUserFunction(e){try{const n=e();return n instanceof m?n:m.resolve(n)}catch(n){return m.reject(n)}}wrapSuccess(e,n){return e?this.wrapUserFunction(()=>e(n)):m.resolve(n)}wrapFailure(e,n){return e?this.wrapUserFunction(()=>e(n)):m.reject(n)}static resolve(e){return new m((n,r)=>{n(e)})}static reject(e){return new m((n,r)=>{r(e)})}static waitFor(e){return new m((n,r)=>{let s=0,i=0,o=!1;e.forEach(a=>{++s,a.next(()=>{++i,o&&i===s&&n()},c=>r(c))}),o=!0,i===s&&n()})}static or(e){let n=m.resolve(!1);for(const r of e)n=n.next(s=>s?m.resolve(s):r());return n}static forEach(e,n){const r=[];return e.forEach((s,i)=>{r.push(n.call(this,s,i))}),this.waitFor(r)}static mapArray(e,n){return new m((r,s)=>{const i=e.length,o=new Array(i);let a=0;for(let c=0;c<i;c++){const u=c;n(e[u]).next(l=>{o[u]=l,++a,a===i&&r(o)},l=>s(l))}})}static doWhile(e,n){return new m((r,s)=>{const i=()=>{e()===!0?n().next(()=>{i()},s):r()};i()})}}/**
624
+ */class m{constructor(e){this.nextCallback=null,this.catchCallback=null,this.result=void 0,this.error=void 0,this.isDone=!1,this.callbackAttached=!1,e(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(e){return this.next(void 0,e)}next(e,t){return this.callbackAttached&&A(),this.callbackAttached=!0,this.isDone?this.error?this.wrapFailure(t,this.error):this.wrapSuccess(e,this.result):new m((r,s)=>{this.nextCallback=i=>{this.wrapSuccess(e,i).next(r,s)},this.catchCallback=i=>{this.wrapFailure(t,i).next(r,s)}})}toPromise(){return new Promise((e,t)=>{this.next(e,t)})}wrapUserFunction(e){try{const t=e();return t instanceof m?t:m.resolve(t)}catch(t){return m.reject(t)}}wrapSuccess(e,t){return e?this.wrapUserFunction(()=>e(t)):m.resolve(t)}wrapFailure(e,t){return e?this.wrapUserFunction(()=>e(t)):m.reject(t)}static resolve(e){return new m((t,r)=>{t(e)})}static reject(e){return new m((t,r)=>{r(e)})}static waitFor(e){return new m((t,r)=>{let s=0,i=0,o=!1;e.forEach(a=>{++s,a.next(()=>{++i,o&&i===s&&t()},c=>r(c))}),o=!0,i===s&&t()})}static or(e){let t=m.resolve(!1);for(const r of e)t=t.next(s=>s?m.resolve(s):r());return t}static forEach(e,t){const r=[];return e.forEach((s,i)=>{r.push(t.call(this,s,i))}),this.waitFor(r)}static mapArray(e,t){return new m((r,s)=>{const i=e.length,o=new Array(i);let a=0;for(let c=0;c<i;c++){const u=c;t(e[u]).next(l=>{o[u]=l,++a,a===i&&r(o)},l=>s(l))}})}static doWhile(e,t){return new m((r,s)=>{const i=()=>{e()===!0?t().next(()=>{i()},s):r()};i()})}}/**
625
625
  * @license
626
626
  * Copyright 2017 Google LLC
627
627
  *
@@ -636,7 +636,7 @@
636
636
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
637
637
  * See the License for the specific language governing permissions and
638
638
  * limitations under the License.
639
- */class Ao{constructor(e,n){this.action=e,this.transaction=n,this.aborted=!1,this.V=new De,this.transaction.oncomplete=()=>{this.V.resolve()},this.transaction.onabort=()=>{n.error?this.V.reject(new cr(e,n.error)):this.V.resolve()},this.transaction.onerror=r=>{const s=Ro(r.target.error);this.V.reject(new cr(e,s))}}static open(e,n,r,s){try{return new Ao(n,e.transaction(s,r))}catch(i){throw new cr(n,i)}}get m(){return this.V.promise}abort(e){e&&this.V.reject(e),this.aborted||(v("SimpleDb","Aborting transaction:",e?e.message:"Client-initiated abort"),this.aborted=!0,this.transaction.abort())}g(){const e=this.transaction;this.aborted||typeof e.commit!="function"||e.commit()}store(e){const n=this.transaction.objectStore(e);return new Rg(n)}}class Vt{constructor(e,n,r){this.name=e,this.version=n,this.p=r,Vt.S(W())===12.2&&Be("Firestore persistence suffers from a bug in iOS 12.2 Safari that may cause your app to stop working. See https://stackoverflow.com/q/56496296/110915 for details and a potential workaround.")}static delete(e){return v("SimpleDb","Removing database:",e),Lt(window.indexedDB.deleteDatabase(e)).toPromise()}static D(){if(!oc())return!1;if(Vt.C())return!0;const e=W(),n=Vt.S(e),r=0<n&&n<10,s=Vt.v(e),i=0<s&&s<4.5;return!(e.indexOf("MSIE ")>0||e.indexOf("Trident/")>0||e.indexOf("Edge/")>0||r||i)}static C(){var e;return typeof process<"u"&&((e=process.__PRIVATE_env)===null||e===void 0?void 0:e.F)==="YES"}static M(e,n){return e.store(n)}static S(e){const n=e.match(/i(?:phone|pad|pod) os ([\d_]+)/i),r=n?n[1].split("_").slice(0,2).join("."):"-1";return Number(r)}static v(e){const n=e.match(/Android ([\d.]+)/i),r=n?n[1].split(".").slice(0,2).join("."):"-1";return Number(r)}async O(e){return this.db||(v("SimpleDb","Opening database:",this.name),this.db=await new Promise((n,r)=>{const s=indexedDB.open(this.name,this.version);s.onsuccess=i=>{const o=i.target.result;n(o)},s.onblocked=()=>{r(new cr(e,"Cannot upgrade IndexedDB schema while another tab is open. Close all tabs that access Firestore and reload this page to proceed."))},s.onerror=i=>{const o=i.target.error;o.name==="VersionError"?r(new g(p.FAILED_PRECONDITION,"A newer version of the Firestore SDK was previously used and so the persisted data is not compatible with the version of the SDK you are now using. The SDK will operate with persistence disabled. If you need persistence, please re-upgrade to a newer version of the SDK or else clear the persisted IndexedDB data for your app to start fresh.")):o.name==="InvalidStateError"?r(new g(p.FAILED_PRECONDITION,"Unable to open an IndexedDB connection. This could be due to running in a private browsing session on a browser whose private browsing sessions do not support IndexedDB: "+o)):r(new cr(e,o))},s.onupgradeneeded=i=>{v("SimpleDb",'Database "'+this.name+'" requires upgrade from version:',i.oldVersion);const o=i.target.result;this.p.N(o,s.transaction,i.oldVersion,this.version).next(()=>{v("SimpleDb","Database upgrade to version "+this.version+" complete")})}})),this.B&&(this.db.onversionchange=n=>this.B(n)),this.db}L(e){this.B=e,this.db&&(this.db.onversionchange=n=>e(n))}async runTransaction(e,n,r,s){const i=n==="readonly";let o=0;for(;;){++o;try{this.db=await this.O(e);const a=Ao.open(this.db,e,i?"readonly":"readwrite",r),c=s(a).next(u=>(a.g(),u)).catch(u=>(a.abort(u),m.reject(u))).toPromise();return c.catch(()=>{}),await a.m,c}catch(a){const c=a,u=c.name!=="FirebaseError"&&o<3;if(v("SimpleDb","Transaction failed with error:",c.message,"Retrying:",u),this.close(),!u)return Promise.reject(c)}}}close(){this.db&&this.db.close(),this.db=void 0}}class Ag{constructor(e){this.k=e,this.q=!1,this.K=null}get isDone(){return this.q}get $(){return this.K}set cursor(e){this.k=e}done(){this.q=!0}U(e){this.K=e}delete(){return Lt(this.k.delete())}}class cr extends g{constructor(e,n){super(p.UNAVAILABLE,`IndexedDB transaction '${e}' failed: ${n}`),this.name="IndexedDbTransactionError"}}function ur(t){return t.name==="IndexedDbTransactionError"}class Rg{constructor(e){this.store=e}put(e,n){let r;return n!==void 0?(v("SimpleDb","PUT",this.store.name,e,n),r=this.store.put(n,e)):(v("SimpleDb","PUT",this.store.name,"<auto-key>",e),r=this.store.put(e)),Lt(r)}add(e){return v("SimpleDb","ADD",this.store.name,e,e),Lt(this.store.add(e))}get(e){return Lt(this.store.get(e)).next(n=>(n===void 0&&(n=null),v("SimpleDb","GET",this.store.name,e,n),n))}delete(e){return v("SimpleDb","DELETE",this.store.name,e),Lt(this.store.delete(e))}count(){return v("SimpleDb","COUNT",this.store.name),Lt(this.store.count())}W(e,n){const r=this.options(e,n),s=r.index?this.store.index(r.index):this.store;if(typeof s.getAll=="function"){const i=s.getAll(r.range);return new m((o,a)=>{i.onerror=c=>{a(c.target.error)},i.onsuccess=c=>{o(c.target.result)}})}{const i=this.cursor(r),o=[];return this.G(i,(a,c)=>{o.push(c)}).next(()=>o)}}j(e,n){const r=this.store.getAll(e,n===null?void 0:n);return new m((s,i)=>{r.onerror=o=>{i(o.target.error)},r.onsuccess=o=>{s(o.target.result)}})}H(e,n){v("SimpleDb","DELETE ALL",this.store.name);const r=this.options(e,n);r.J=!1;const s=this.cursor(r);return this.G(s,(i,o,a)=>a.delete())}Y(e,n){let r;n?r=e:(r={},n=e);const s=this.cursor(r);return this.G(s,n)}Z(e){const n=this.cursor({});return new m((r,s)=>{n.onerror=i=>{const o=Ro(i.target.error);s(o)},n.onsuccess=i=>{const o=i.target.result;o?e(o.primaryKey,o.value).next(a=>{a?o.continue():r()}):r()}})}G(e,n){const r=[];return new m((s,i)=>{e.onerror=o=>{i(o.target.error)},e.onsuccess=o=>{const a=o.target.result;if(!a)return void s();const c=new Ag(a),u=n(a.primaryKey,a.value,c);if(u instanceof m){const l=u.catch(h=>(c.done(),m.reject(h)));r.push(l)}c.isDone?s():c.$===null?a.continue():a.continue(c.$)}}).next(()=>m.waitFor(r))}options(e,n){let r;return e!==void 0&&(typeof e=="string"?r=e:n=e),{index:r,range:n}}cursor(e){let n="next";if(e.reverse&&(n="prev"),e.index){const r=this.store.index(e.index);return e.J?r.openKeyCursor(e.range,n):r.openCursor(e.range,n)}return this.store.openCursor(e.range,n)}}function Lt(t){return new m((e,n)=>{t.onsuccess=r=>{const s=r.target.result;e(s)},t.onerror=r=>{const s=Ro(r.target.error);n(s)}})}let Bu=!1;function Ro(t){const e=Vt.S(W());if(e>=12.2&&e<13){const n="An internal error was encountered in the Indexed Database server";if(t.message.indexOf(n)>=0){const r=new g("internal",`IOS_INDEXEDDB_BUG1: IndexedDb has thrown '${n}'. This is likely due to an unavoidable bug in iOS. See https://stackoverflow.com/q/56496296/110915 for details and a potential workaround.`);return Bu||(Bu=!0,setTimeout(()=>{throw r},0)),r}}return t}/**
639
+ */class bo{constructor(e,t){this.action=e,this.transaction=t,this.aborted=!1,this.V=new Oe,this.transaction.oncomplete=()=>{this.V.resolve()},this.transaction.onabort=()=>{t.error?this.V.reject(new pr(e,t.error)):this.V.resolve()},this.transaction.onerror=r=>{const s=Co(r.target.error);this.V.reject(new pr(e,s))}}static open(e,t,r,s){try{return new bo(t,e.transaction(s,r))}catch(i){throw new pr(t,i)}}get m(){return this.V.promise}abort(e){e&&this.V.reject(e),this.aborted||(v("SimpleDb","Aborting transaction:",e?e.message:"Client-initiated abort"),this.aborted=!0,this.transaction.abort())}g(){const e=this.transaction;this.aborted||typeof e.commit!="function"||e.commit()}store(e){const t=this.transaction.objectStore(e);return new Bg(t)}}class Ut{constructor(e,t,r){this.name=e,this.version=t,this.p=r,Ut.S(W())===12.2&&$e("Firestore persistence suffers from a bug in iOS 12.2 Safari that may cause your app to stop working. See https://stackoverflow.com/q/56496296/110915 for details and a potential workaround.")}static delete(e){return v("SimpleDb","Removing database:",e),Ft(window.indexedDB.deleteDatabase(e)).toPromise()}static D(){if(!pc())return!1;if(Ut.C())return!0;const e=W(),t=Ut.S(e),r=0<t&&t<10,s=Ut.v(e),i=0<s&&s<4.5;return!(e.indexOf("MSIE ")>0||e.indexOf("Trident/")>0||e.indexOf("Edge/")>0||r||i)}static C(){var e;return typeof process<"u"&&((e=process.__PRIVATE_env)===null||e===void 0?void 0:e.F)==="YES"}static M(e,t){return e.store(t)}static S(e){const t=e.match(/i(?:phone|pad|pod) os ([\d_]+)/i),r=t?t[1].split("_").slice(0,2).join("."):"-1";return Number(r)}static v(e){const t=e.match(/Android ([\d.]+)/i),r=t?t[1].split(".").slice(0,2).join("."):"-1";return Number(r)}async O(e){return this.db||(v("SimpleDb","Opening database:",this.name),this.db=await new Promise((t,r)=>{const s=indexedDB.open(this.name,this.version);s.onsuccess=i=>{const o=i.target.result;t(o)},s.onblocked=()=>{r(new pr(e,"Cannot upgrade IndexedDB schema while another tab is open. Close all tabs that access Firestore and reload this page to proceed."))},s.onerror=i=>{const o=i.target.error;o.name==="VersionError"?r(new g(p.FAILED_PRECONDITION,"A newer version of the Firestore SDK was previously used and so the persisted data is not compatible with the version of the SDK you are now using. The SDK will operate with persistence disabled. If you need persistence, please re-upgrade to a newer version of the SDK or else clear the persisted IndexedDB data for your app to start fresh.")):o.name==="InvalidStateError"?r(new g(p.FAILED_PRECONDITION,"Unable to open an IndexedDB connection. This could be due to running in a private browsing session on a browser whose private browsing sessions do not support IndexedDB: "+o)):r(new pr(e,o))},s.onupgradeneeded=i=>{v("SimpleDb",'Database "'+this.name+'" requires upgrade from version:',i.oldVersion);const o=i.target.result;this.p.N(o,s.transaction,i.oldVersion,this.version).next(()=>{v("SimpleDb","Database upgrade to version "+this.version+" complete")})}})),this.L&&(this.db.onversionchange=t=>this.L(t)),this.db}B(e){this.L=e,this.db&&(this.db.onversionchange=t=>e(t))}async runTransaction(e,t,r,s){const i=t==="readonly";let o=0;for(;;){++o;try{this.db=await this.O(e);const a=bo.open(this.db,e,i?"readonly":"readwrite",r),c=s(a).next(u=>(a.g(),u)).catch(u=>(a.abort(u),m.reject(u))).toPromise();return c.catch(()=>{}),await a.m,c}catch(a){const c=a,u=c.name!=="FirebaseError"&&o<3;if(v("SimpleDb","Transaction failed with error:",c.message,"Retrying:",u),this.close(),!u)return Promise.reject(c)}}}close(){this.db&&this.db.close(),this.db=void 0}}class Fg{constructor(e){this.k=e,this.q=!1,this.K=null}get isDone(){return this.q}get $(){return this.K}set cursor(e){this.k=e}done(){this.q=!0}U(e){this.K=e}delete(){return Ft(this.k.delete())}}class pr extends g{constructor(e,t){super(p.UNAVAILABLE,`IndexedDB transaction '${e}' failed: ${t}`),this.name="IndexedDbTransactionError"}}function mr(n){return n.name==="IndexedDbTransactionError"}class Bg{constructor(e){this.store=e}put(e,t){let r;return t!==void 0?(v("SimpleDb","PUT",this.store.name,e,t),r=this.store.put(t,e)):(v("SimpleDb","PUT",this.store.name,"<auto-key>",e),r=this.store.put(e)),Ft(r)}add(e){return v("SimpleDb","ADD",this.store.name,e,e),Ft(this.store.add(e))}get(e){return Ft(this.store.get(e)).next(t=>(t===void 0&&(t=null),v("SimpleDb","GET",this.store.name,e,t),t))}delete(e){return v("SimpleDb","DELETE",this.store.name,e),Ft(this.store.delete(e))}count(){return v("SimpleDb","COUNT",this.store.name),Ft(this.store.count())}W(e,t){const r=this.options(e,t),s=r.index?this.store.index(r.index):this.store;if(typeof s.getAll=="function"){const i=s.getAll(r.range);return new m((o,a)=>{i.onerror=c=>{a(c.target.error)},i.onsuccess=c=>{o(c.target.result)}})}{const i=this.cursor(r),o=[];return this.G(i,(a,c)=>{o.push(c)}).next(()=>o)}}j(e,t){const r=this.store.getAll(e,t===null?void 0:t);return new m((s,i)=>{r.onerror=o=>{i(o.target.error)},r.onsuccess=o=>{s(o.target.result)}})}H(e,t){v("SimpleDb","DELETE ALL",this.store.name);const r=this.options(e,t);r.J=!1;const s=this.cursor(r);return this.G(s,(i,o,a)=>a.delete())}Y(e,t){let r;t?r=e:(r={},t=e);const s=this.cursor(r);return this.G(s,t)}Z(e){const t=this.cursor({});return new m((r,s)=>{t.onerror=i=>{const o=Co(i.target.error);s(o)},t.onsuccess=i=>{const o=i.target.result;o?e(o.primaryKey,o.value).next(a=>{a?o.continue():r()}):r()}})}G(e,t){const r=[];return new m((s,i)=>{e.onerror=o=>{i(o.target.error)},e.onsuccess=o=>{const a=o.target.result;if(!a)return void s();const c=new Fg(a),u=t(a.primaryKey,a.value,c);if(u instanceof m){const l=u.catch(h=>(c.done(),m.reject(h)));r.push(l)}c.isDone?s():c.$===null?a.continue():a.continue(c.$)}}).next(()=>m.waitFor(r))}options(e,t){let r;return e!==void 0&&(typeof e=="string"?r=e:t=e),{index:r,range:t}}cursor(e){let t="next";if(e.reverse&&(t="prev"),e.index){const r=this.store.index(e.index);return e.J?r.openKeyCursor(e.range,t):r.openCursor(e.range,t)}return this.store.openCursor(e.range,t)}}function Ft(n){return new m((e,t)=>{n.onsuccess=r=>{const s=r.target.result;e(s)},n.onerror=r=>{const s=Co(r.target.error);t(s)}})}let Qu=!1;function Co(n){const e=Ut.S(W());if(e>=12.2&&e<13){const t="An internal error was encountered in the Indexed Database server";if(n.message.indexOf(t)>=0){const r=new g("internal",`IOS_INDEXEDDB_BUG1: IndexedDb has thrown '${t}'. This is likely due to an unavoidable bug in iOS. See https://stackoverflow.com/q/56496296/110915 for details and a potential workaround.`);return Qu||(Qu=!0,setTimeout(()=>{throw r},0)),r}}return n}/**
640
640
  * @license
641
641
  * Copyright 2018 Google LLC
642
642
  *
@@ -651,7 +651,7 @@
651
651
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
652
652
  * See the License for the specific language governing permissions and
653
653
  * limitations under the License.
654
- */class Po{constructor(e,n){this.previousValue=e,n&&(n.sequenceNumberHandler=r=>this.se(r),this.oe=r=>n.writeSequenceNumber(r))}se(e){return this.previousValue=Math.max(e,this.previousValue),this.previousValue}next(){const e=++this.previousValue;return this.oe&&this.oe(e),e}}Po._e=-1;function ys(t){return t==null}function vs(t){return t===0&&1/t==-1/0}function Pg(t){return typeof t=="number"&&Number.isInteger(t)&&!vs(t)&&t<=Number.MAX_SAFE_INTEGER&&t>=Number.MIN_SAFE_INTEGER}/**
654
+ */class ko{constructor(e,t){this.previousValue=e,t&&(t.sequenceNumberHandler=r=>this.se(r),this.oe=r=>t.writeSequenceNumber(r))}se(e){return this.previousValue=Math.max(e,this.previousValue),this.previousValue}next(){const e=++this.previousValue;return this.oe&&this.oe(e),e}}ko._e=-1;function Is(n){return n==null}function As(n){return n===0&&1/n==-1/0}function jg(n){return typeof n=="number"&&Number.isInteger(n)&&!As(n)&&n<=Number.MAX_SAFE_INTEGER&&n>=Number.MIN_SAFE_INTEGER}/**
655
655
  * @license
656
656
  * Copyright 2017 Google LLC
657
657
  *
@@ -666,7 +666,7 @@
666
666
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
667
667
  * See the License for the specific language governing permissions and
668
668
  * limitations under the License.
669
- */function ju(t){let e=0;for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&e++;return e}function Mt(t,e){for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&e(n,t[n])}function $u(t){for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0}/**
669
+ */function Yu(n){let e=0;for(const t in n)Object.prototype.hasOwnProperty.call(n,t)&&e++;return e}function Bt(n,e){for(const t in n)Object.prototype.hasOwnProperty.call(n,t)&&e(t,n[t])}function Xu(n){for(const e in n)if(Object.prototype.hasOwnProperty.call(n,e))return!1;return!0}/**
670
670
  * @license
671
671
  * Copyright 2017 Google LLC
672
672
  *
@@ -681,7 +681,7 @@
681
681
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
682
682
  * See the License for the specific language governing permissions and
683
683
  * limitations under the License.
684
- */class q{constructor(e,n){this.comparator=e,this.root=n||re.EMPTY}insert(e,n){return new q(this.comparator,this.root.insert(e,n,this.comparator).copy(null,null,re.BLACK,null,null))}remove(e){return new q(this.comparator,this.root.remove(e,this.comparator).copy(null,null,re.BLACK,null,null))}get(e){let n=this.root;for(;!n.isEmpty();){const r=this.comparator(e,n.key);if(r===0)return n.value;r<0?n=n.left:r>0&&(n=n.right)}return null}indexOf(e){let n=0,r=this.root;for(;!r.isEmpty();){const s=this.comparator(e,r.key);if(s===0)return n+r.left.size;s<0?r=r.left:(n+=r.left.size+1,r=r.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(e){return this.root.inorderTraversal(e)}forEach(e){this.inorderTraversal((n,r)=>(e(n,r),!1))}toString(){const e=[];return this.inorderTraversal((n,r)=>(e.push(`${n}:${r}`),!1)),`{${e.join(", ")}}`}reverseTraversal(e){return this.root.reverseTraversal(e)}getIterator(){return new Es(this.root,null,this.comparator,!1)}getIteratorFrom(e){return new Es(this.root,e,this.comparator,!1)}getReverseIterator(){return new Es(this.root,null,this.comparator,!0)}getReverseIteratorFrom(e){return new Es(this.root,e,this.comparator,!0)}}class Es{constructor(e,n,r,s){this.isReverse=s,this.nodeStack=[];let i=1;for(;!e.isEmpty();)if(i=n?r(e.key,n):1,n&&s&&(i*=-1),i<0)e=this.isReverse?e.left:e.right;else{if(i===0){this.nodeStack.push(e);break}this.nodeStack.push(e),e=this.isReverse?e.right:e.left}}getNext(){let e=this.nodeStack.pop();const n={key:e.key,value:e.value};if(this.isReverse)for(e=e.left;!e.isEmpty();)this.nodeStack.push(e),e=e.right;else for(e=e.right;!e.isEmpty();)this.nodeStack.push(e),e=e.left;return n}hasNext(){return this.nodeStack.length>0}peek(){if(this.nodeStack.length===0)return null;const e=this.nodeStack[this.nodeStack.length-1];return{key:e.key,value:e.value}}}class re{constructor(e,n,r,s,i){this.key=e,this.value=n,this.color=r??re.RED,this.left=s??re.EMPTY,this.right=i??re.EMPTY,this.size=this.left.size+1+this.right.size}copy(e,n,r,s,i){return new re(e??this.key,n??this.value,r??this.color,s??this.left,i??this.right)}isEmpty(){return!1}inorderTraversal(e){return this.left.inorderTraversal(e)||e(this.key,this.value)||this.right.inorderTraversal(e)}reverseTraversal(e){return this.right.reverseTraversal(e)||e(this.key,this.value)||this.left.reverseTraversal(e)}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(e,n,r){let s=this;const i=r(e,s.key);return s=i<0?s.copy(null,null,null,s.left.insert(e,n,r),null):i===0?s.copy(null,n,null,null,null):s.copy(null,null,null,null,s.right.insert(e,n,r)),s.fixUp()}removeMin(){if(this.left.isEmpty())return re.EMPTY;let e=this;return e.left.isRed()||e.left.left.isRed()||(e=e.moveRedLeft()),e=e.copy(null,null,null,e.left.removeMin(),null),e.fixUp()}remove(e,n){let r,s=this;if(n(e,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(e,n),null);else{if(s.left.isRed()&&(s=s.rotateRight()),s.right.isEmpty()||s.right.isRed()||s.right.left.isRed()||(s=s.moveRedRight()),n(e,s.key)===0){if(s.right.isEmpty())return re.EMPTY;r=s.right.min(),s=s.copy(r.key,r.value,null,null,s.right.removeMin())}s=s.copy(null,null,null,null,s.right.remove(e,n))}return s.fixUp()}isRed(){return this.color}fixUp(){let e=this;return e.right.isRed()&&!e.left.isRed()&&(e=e.rotateLeft()),e.left.isRed()&&e.left.left.isRed()&&(e=e.rotateRight()),e.left.isRed()&&e.right.isRed()&&(e=e.colorFlip()),e}moveRedLeft(){let e=this.colorFlip();return e.right.left.isRed()&&(e=e.copy(null,null,null,null,e.right.rotateRight()),e=e.rotateLeft(),e=e.colorFlip()),e}moveRedRight(){let e=this.colorFlip();return e.left.left.isRed()&&(e=e.rotateRight(),e=e.colorFlip()),e}rotateLeft(){const e=this.copy(null,null,re.RED,null,this.right.left);return this.right.copy(null,null,this.color,e,null)}rotateRight(){const e=this.copy(null,null,re.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,e)}colorFlip(){const e=this.left.copy(null,null,!this.left.color,null,null),n=this.right.copy(null,null,!this.right.color,null,null);return this.copy(null,null,!this.color,e,n)}checkMaxDepth(){const e=this.check();return Math.pow(2,e)<=this.size+1}check(){if(this.isRed()&&this.left.isRed()||this.right.isRed())throw A();const e=this.left.check();if(e!==this.right.check())throw A();return e+(this.isRed()?0:1)}}re.EMPTY=null,re.RED=!0,re.BLACK=!1,re.EMPTY=new class{constructor(){this.size=0}get key(){throw A()}get value(){throw A()}get color(){throw A()}get left(){throw A()}get right(){throw A()}copy(e,n,r,s,i){return this}insert(e,n,r){return new re(e,n)}remove(e,n){return this}isEmpty(){return!0}inorderTraversal(e){return!1}reverseTraversal(e){return!1}minKey(){return null}maxKey(){return null}isRed(){return!1}checkMaxDepth(){return!0}check(){return 0}};/**
684
+ */class ${constructor(e,t){this.comparator=e,this.root=t||re.EMPTY}insert(e,t){return new $(this.comparator,this.root.insert(e,t,this.comparator).copy(null,null,re.BLACK,null,null))}remove(e){return new $(this.comparator,this.root.remove(e,this.comparator).copy(null,null,re.BLACK,null,null))}get(e){let t=this.root;for(;!t.isEmpty();){const r=this.comparator(e,t.key);if(r===0)return t.value;r<0?t=t.left:r>0&&(t=t.right)}return null}indexOf(e){let t=0,r=this.root;for(;!r.isEmpty();){const s=this.comparator(e,r.key);if(s===0)return t+r.left.size;s<0?r=r.left:(t+=r.left.size+1,r=r.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(e){return this.root.inorderTraversal(e)}forEach(e){this.inorderTraversal((t,r)=>(e(t,r),!1))}toString(){const e=[];return this.inorderTraversal((t,r)=>(e.push(`${t}:${r}`),!1)),`{${e.join(", ")}}`}reverseTraversal(e){return this.root.reverseTraversal(e)}getIterator(){return new Rs(this.root,null,this.comparator,!1)}getIteratorFrom(e){return new Rs(this.root,e,this.comparator,!1)}getReverseIterator(){return new Rs(this.root,null,this.comparator,!0)}getReverseIteratorFrom(e){return new Rs(this.root,e,this.comparator,!0)}}class Rs{constructor(e,t,r,s){this.isReverse=s,this.nodeStack=[];let i=1;for(;!e.isEmpty();)if(i=t?r(e.key,t):1,t&&s&&(i*=-1),i<0)e=this.isReverse?e.left:e.right;else{if(i===0){this.nodeStack.push(e);break}this.nodeStack.push(e),e=this.isReverse?e.right:e.left}}getNext(){let e=this.nodeStack.pop();const t={key:e.key,value:e.value};if(this.isReverse)for(e=e.left;!e.isEmpty();)this.nodeStack.push(e),e=e.right;else for(e=e.right;!e.isEmpty();)this.nodeStack.push(e),e=e.left;return t}hasNext(){return this.nodeStack.length>0}peek(){if(this.nodeStack.length===0)return null;const e=this.nodeStack[this.nodeStack.length-1];return{key:e.key,value:e.value}}}class re{constructor(e,t,r,s,i){this.key=e,this.value=t,this.color=r??re.RED,this.left=s??re.EMPTY,this.right=i??re.EMPTY,this.size=this.left.size+1+this.right.size}copy(e,t,r,s,i){return new re(e??this.key,t??this.value,r??this.color,s??this.left,i??this.right)}isEmpty(){return!1}inorderTraversal(e){return this.left.inorderTraversal(e)||e(this.key,this.value)||this.right.inorderTraversal(e)}reverseTraversal(e){return this.right.reverseTraversal(e)||e(this.key,this.value)||this.left.reverseTraversal(e)}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(e,t,r){let s=this;const i=r(e,s.key);return s=i<0?s.copy(null,null,null,s.left.insert(e,t,r),null):i===0?s.copy(null,t,null,null,null):s.copy(null,null,null,null,s.right.insert(e,t,r)),s.fixUp()}removeMin(){if(this.left.isEmpty())return re.EMPTY;let e=this;return e.left.isRed()||e.left.left.isRed()||(e=e.moveRedLeft()),e=e.copy(null,null,null,e.left.removeMin(),null),e.fixUp()}remove(e,t){let r,s=this;if(t(e,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(e,t),null);else{if(s.left.isRed()&&(s=s.rotateRight()),s.right.isEmpty()||s.right.isRed()||s.right.left.isRed()||(s=s.moveRedRight()),t(e,s.key)===0){if(s.right.isEmpty())return re.EMPTY;r=s.right.min(),s=s.copy(r.key,r.value,null,null,s.right.removeMin())}s=s.copy(null,null,null,null,s.right.remove(e,t))}return s.fixUp()}isRed(){return this.color}fixUp(){let e=this;return e.right.isRed()&&!e.left.isRed()&&(e=e.rotateLeft()),e.left.isRed()&&e.left.left.isRed()&&(e=e.rotateRight()),e.left.isRed()&&e.right.isRed()&&(e=e.colorFlip()),e}moveRedLeft(){let e=this.colorFlip();return e.right.left.isRed()&&(e=e.copy(null,null,null,null,e.right.rotateRight()),e=e.rotateLeft(),e=e.colorFlip()),e}moveRedRight(){let e=this.colorFlip();return e.left.left.isRed()&&(e=e.rotateRight(),e=e.colorFlip()),e}rotateLeft(){const e=this.copy(null,null,re.RED,null,this.right.left);return this.right.copy(null,null,this.color,e,null)}rotateRight(){const e=this.copy(null,null,re.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,e)}colorFlip(){const e=this.left.copy(null,null,!this.left.color,null,null),t=this.right.copy(null,null,!this.right.color,null,null);return this.copy(null,null,!this.color,e,t)}checkMaxDepth(){const e=this.check();return Math.pow(2,e)<=this.size+1}check(){if(this.isRed()&&this.left.isRed()||this.right.isRed())throw A();const e=this.left.check();if(e!==this.right.check())throw A();return e+(this.isRed()?0:1)}}re.EMPTY=null,re.RED=!0,re.BLACK=!1,re.EMPTY=new class{constructor(){this.size=0}get key(){throw A()}get value(){throw A()}get color(){throw A()}get left(){throw A()}get right(){throw A()}copy(e,t,r,s,i){return this}insert(e,t,r){return new re(e,t)}remove(e,t){return this}isEmpty(){return!0}inorderTraversal(e){return!1}reverseTraversal(e){return!1}minKey(){return null}maxKey(){return null}isRed(){return!1}checkMaxDepth(){return!0}check(){return 0}};/**
685
685
  * @license
686
686
  * Copyright 2017 Google LLC
687
687
  *
@@ -696,7 +696,7 @@
696
696
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
697
697
  * See the License for the specific language governing permissions and
698
698
  * limitations under the License.
699
- */class se{constructor(e){this.comparator=e,this.data=new q(this.comparator)}has(e){return this.data.get(e)!==null}first(){return this.data.minKey()}last(){return this.data.maxKey()}get size(){return this.data.size}indexOf(e){return this.data.indexOf(e)}forEach(e){this.data.inorderTraversal((n,r)=>(e(n),!1))}forEachInRange(e,n){const r=this.data.getIteratorFrom(e[0]);for(;r.hasNext();){const s=r.getNext();if(this.comparator(s.key,e[1])>=0)return;n(s.key)}}forEachWhile(e,n){let r;for(r=n!==void 0?this.data.getIteratorFrom(n):this.data.getIterator();r.hasNext();)if(!e(r.getNext().key))return}firstAfterOrEqual(e){const n=this.data.getIteratorFrom(e);return n.hasNext()?n.getNext().key:null}getIterator(){return new qu(this.data.getIterator())}getIteratorFrom(e){return new qu(this.data.getIteratorFrom(e))}add(e){return this.copy(this.data.remove(e).insert(e,!0))}delete(e){return this.has(e)?this.copy(this.data.remove(e)):this}isEmpty(){return this.data.isEmpty()}unionWith(e){let n=this;return n.size<e.size&&(n=e,e=this),e.forEach(r=>{n=n.add(r)}),n}isEqual(e){if(!(e instanceof se)||this.size!==e.size)return!1;const n=this.data.getIterator(),r=e.data.getIterator();for(;n.hasNext();){const s=n.getNext().key,i=r.getNext().key;if(this.comparator(s,i)!==0)return!1}return!0}toArray(){const e=[];return this.forEach(n=>{e.push(n)}),e}toString(){const e=[];return this.forEach(n=>e.push(n)),"SortedSet("+e.toString()+")"}copy(e){const n=new se(this.comparator);return n.data=e,n}}class qu{constructor(e){this.iter=e}getNext(){return this.iter.getNext().key}hasNext(){return this.iter.hasNext()}}/**
699
+ */class se{constructor(e){this.comparator=e,this.data=new $(this.comparator)}has(e){return this.data.get(e)!==null}first(){return this.data.minKey()}last(){return this.data.maxKey()}get size(){return this.data.size}indexOf(e){return this.data.indexOf(e)}forEach(e){this.data.inorderTraversal((t,r)=>(e(t),!1))}forEachInRange(e,t){const r=this.data.getIteratorFrom(e[0]);for(;r.hasNext();){const s=r.getNext();if(this.comparator(s.key,e[1])>=0)return;t(s.key)}}forEachWhile(e,t){let r;for(r=t!==void 0?this.data.getIteratorFrom(t):this.data.getIterator();r.hasNext();)if(!e(r.getNext().key))return}firstAfterOrEqual(e){const t=this.data.getIteratorFrom(e);return t.hasNext()?t.getNext().key:null}getIterator(){return new Ju(this.data.getIterator())}getIteratorFrom(e){return new Ju(this.data.getIteratorFrom(e))}add(e){return this.copy(this.data.remove(e).insert(e,!0))}delete(e){return this.has(e)?this.copy(this.data.remove(e)):this}isEmpty(){return this.data.isEmpty()}unionWith(e){let t=this;return t.size<e.size&&(t=e,e=this),e.forEach(r=>{t=t.add(r)}),t}isEqual(e){if(!(e instanceof se)||this.size!==e.size)return!1;const t=this.data.getIterator(),r=e.data.getIterator();for(;t.hasNext();){const s=t.getNext().key,i=r.getNext().key;if(this.comparator(s,i)!==0)return!1}return!0}toArray(){const e=[];return this.forEach(t=>{e.push(t)}),e}toString(){const e=[];return this.forEach(t=>e.push(t)),"SortedSet("+e.toString()+")"}copy(e){const t=new se(this.comparator);return t.data=e,t}}class Ju{constructor(e){this.iter=e}getNext(){return this.iter.getNext().key}hasNext(){return this.iter.hasNext()}}/**
700
700
  * @license
701
701
  * Copyright 2020 Google LLC
702
702
  *
@@ -711,7 +711,7 @@
711
711
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
712
712
  * See the License for the specific language governing permissions and
713
713
  * limitations under the License.
714
- */class Te{constructor(e){this.fields=e,e.sort(ne.comparator)}static empty(){return new Te([])}unionWith(e){let n=new se(ne.comparator);for(const r of this.fields)n=n.add(r);for(const r of e)n=n.add(r);return new Te(n.toArray())}covers(e){for(const n of this.fields)if(n.isPrefixOf(e))return!0;return!1}isEqual(e){return on(this.fields,e.fields,(n,r)=>n.isEqual(r))}}/**
714
+ */class Ie{constructor(e){this.fields=e,e.sort(ne.comparator)}static empty(){return new Ie([])}unionWith(e){let t=new se(ne.comparator);for(const r of this.fields)t=t.add(r);for(const r of e)t=t.add(r);return new Ie(t.toArray())}covers(e){for(const t of this.fields)if(t.isPrefixOf(e))return!0;return!1}isEqual(e){return un(this.fields,e.fields,(t,r)=>t.isEqual(r))}}/**
715
715
  * @license
716
716
  * Copyright 2023 Google LLC
717
717
  *
@@ -726,7 +726,7 @@
726
726
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
727
727
  * See the License for the specific language governing permissions and
728
728
  * limitations under the License.
729
- */class zu extends Error{constructor(){super(...arguments),this.name="Base64DecodeError"}}/**
729
+ */class Zu extends Error{constructor(){super(...arguments),this.name="Base64DecodeError"}}/**
730
730
  * @license
731
731
  * Copyright 2020 Google LLC
732
732
  *
@@ -741,7 +741,7 @@
741
741
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
742
742
  * See the License for the specific language governing permissions and
743
743
  * limitations under the License.
744
- */class le{constructor(e){this.binaryString=e}static fromBase64String(e){const n=function(s){try{return atob(s)}catch(i){throw typeof DOMException<"u"&&i instanceof DOMException?new zu("Invalid base64 string: "+i):i}}(e);return new le(n)}static fromUint8Array(e){const n=function(s){let i="";for(let o=0;o<s.length;++o)i+=String.fromCharCode(s[o]);return i}(e);return new le(n)}[Symbol.iterator](){let e=0;return{next:()=>e<this.binaryString.length?{value:this.binaryString.charCodeAt(e++),done:!1}:{value:void 0,done:!0}}}toBase64(){return function(n){return btoa(n)}(this.binaryString)}toUint8Array(){return function(n){const r=new Uint8Array(n.length);for(let s=0;s<n.length;s++)r[s]=n.charCodeAt(s);return r}(this.binaryString)}approximateByteSize(){return 2*this.binaryString.length}compareTo(e){return M(this.binaryString,e.binaryString)}isEqual(e){return this.binaryString===e.binaryString}}le.EMPTY_BYTE_STRING=new le("");const Sg=new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);function pt(t){if(F(!!t),typeof t=="string"){let e=0;const n=Sg.exec(t);if(F(!!n),n[1]){let s=n[1];s=(s+"000000000").substr(0,9),e=Number(s)}const r=new Date(t);return{seconds:Math.floor(r.getTime()/1e3),nanos:e}}return{seconds:G(t.seconds),nanos:G(t.nanos)}}function G(t){return typeof t=="number"?t:typeof t=="string"?Number(t):0}function xt(t){return typeof t=="string"?le.fromBase64String(t):le.fromUint8Array(t)}/**
744
+ */class le{constructor(e){this.binaryString=e}static fromBase64String(e){const t=function(s){try{return atob(s)}catch(i){throw typeof DOMException<"u"&&i instanceof DOMException?new Zu("Invalid base64 string: "+i):i}}(e);return new le(t)}static fromUint8Array(e){const t=function(s){let i="";for(let o=0;o<s.length;++o)i+=String.fromCharCode(s[o]);return i}(e);return new le(t)}[Symbol.iterator](){let e=0;return{next:()=>e<this.binaryString.length?{value:this.binaryString.charCodeAt(e++),done:!1}:{value:void 0,done:!0}}}toBase64(){return function(t){return btoa(t)}(this.binaryString)}toUint8Array(){return function(t){const r=new Uint8Array(t.length);for(let s=0;s<t.length;s++)r[s]=t.charCodeAt(s);return r}(this.binaryString)}approximateByteSize(){return 2*this.binaryString.length}compareTo(e){return M(this.binaryString,e.binaryString)}isEqual(e){return this.binaryString===e.binaryString}}le.EMPTY_BYTE_STRING=new le("");const qg=new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);function yt(n){if(F(!!n),typeof n=="string"){let e=0;const t=qg.exec(n);if(F(!!t),t[1]){let s=t[1];s=(s+"000000000").substr(0,9),e=Number(s)}const r=new Date(n);return{seconds:Math.floor(r.getTime()/1e3),nanos:e}}return{seconds:G(n.seconds),nanos:G(n.nanos)}}function G(n){return typeof n=="number"?n:typeof n=="string"?Number(n):0}function jt(n){return typeof n=="string"?le.fromBase64String(n):le.fromUint8Array(n)}/**
745
745
  * @license
746
746
  * Copyright 2020 Google LLC
747
747
  *
@@ -756,7 +756,7 @@
756
756
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
757
757
  * See the License for the specific language governing permissions and
758
758
  * limitations under the License.
759
- */function Ts(t){var e,n;return((n=(((e=t==null?void 0:t.mapValue)===null||e===void 0?void 0:e.fields)||{}).__type__)===null||n===void 0?void 0:n.stringValue)==="server_timestamp"}function So(t){const e=t.mapValue.fields.__previous_value__;return Ts(e)?So(e):e}function lr(t){const e=pt(t.mapValue.fields.__local_write_time__.timestampValue);return new Y(e.seconds,e.nanos)}/**
759
+ */function Ps(n){var e,t;return((t=(((e=n==null?void 0:n.mapValue)===null||e===void 0?void 0:e.fields)||{}).__type__)===null||t===void 0?void 0:t.stringValue)==="server_timestamp"}function Do(n){const e=n.mapValue.fields.__previous_value__;return Ps(e)?Do(e):e}function gr(n){const e=yt(n.mapValue.fields.__local_write_time__.timestampValue);return new Y(e.seconds,e.nanos)}/**
760
760
  * @license
761
761
  * Copyright 2017 Google LLC
762
762
  *
@@ -771,7 +771,7 @@
771
771
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
772
772
  * See the License for the specific language governing permissions and
773
773
  * limitations under the License.
774
- */class bg{constructor(e,n,r,s,i,o,a,c,u){this.databaseId=e,this.appId=n,this.persistenceKey=r,this.host=s,this.ssl=i,this.forceLongPolling=o,this.autoDetectLongPolling=a,this.longPollingOptions=c,this.useFetchStreams=u}}class hr{constructor(e,n){this.projectId=e,this.database=n||"(default)"}static empty(){return new hr("","")}get isDefaultDatabase(){return this.database==="(default)"}isEqual(e){return e instanceof hr&&e.projectId===this.projectId&&e.database===this.database}}/**
774
+ */class $g{constructor(e,t,r,s,i,o,a,c,u){this.databaseId=e,this.appId=t,this.persistenceKey=r,this.host=s,this.ssl=i,this.forceLongPolling=o,this.autoDetectLongPolling=a,this.longPollingOptions=c,this.useFetchStreams=u}}class _r{constructor(e,t){this.projectId=e,this.database=t||"(default)"}static empty(){return new _r("","")}get isDefaultDatabase(){return this.database==="(default)"}isEqual(e){return e instanceof _r&&e.projectId===this.projectId&&e.database===this.database}}/**
775
775
  * @license
776
776
  * Copyright 2020 Google LLC
777
777
  *
@@ -786,7 +786,7 @@
786
786
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
787
787
  * See the License for the specific language governing permissions and
788
788
  * limitations under the License.
789
- */const ws={mapValue:{fields:{__type__:{stringValue:"__max__"}}}};function Ut(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?Ts(t)?4:Cg(t)?9007199254740991:10:A()}function je(t,e){if(t===e)return!0;const n=Ut(t);if(n!==Ut(e))return!1;switch(n){case 0:case 9007199254740991:return!0;case 1:return t.booleanValue===e.booleanValue;case 4:return lr(t).isEqual(lr(e));case 3:return function(s,i){if(typeof s.timestampValue=="string"&&typeof i.timestampValue=="string"&&s.timestampValue.length===i.timestampValue.length)return s.timestampValue===i.timestampValue;const o=pt(s.timestampValue),a=pt(i.timestampValue);return o.seconds===a.seconds&&o.nanos===a.nanos}(t,e);case 5:return t.stringValue===e.stringValue;case 6:return function(s,i){return xt(s.bytesValue).isEqual(xt(i.bytesValue))}(t,e);case 7:return t.referenceValue===e.referenceValue;case 8:return function(s,i){return G(s.geoPointValue.latitude)===G(i.geoPointValue.latitude)&&G(s.geoPointValue.longitude)===G(i.geoPointValue.longitude)}(t,e);case 2:return function(s,i){if("integerValue"in s&&"integerValue"in i)return G(s.integerValue)===G(i.integerValue);if("doubleValue"in s&&"doubleValue"in i){const o=G(s.doubleValue),a=G(i.doubleValue);return o===a?vs(o)===vs(a):isNaN(o)&&isNaN(a)}return!1}(t,e);case 9:return on(t.arrayValue.values||[],e.arrayValue.values||[],je);case 10:return function(s,i){const o=s.mapValue.fields||{},a=i.mapValue.fields||{};if(ju(o)!==ju(a))return!1;for(const c in o)if(o.hasOwnProperty(c)&&(a[c]===void 0||!je(o[c],a[c])))return!1;return!0}(t,e);default:return A()}}function dr(t,e){return(t.values||[]).find(n=>je(n,e))!==void 0}function an(t,e){if(t===e)return 0;const n=Ut(t),r=Ut(e);if(n!==r)return M(n,r);switch(n){case 0:case 9007199254740991:return 0;case 1:return M(t.booleanValue,e.booleanValue);case 2:return function(i,o){const a=G(i.integerValue||i.doubleValue),c=G(o.integerValue||o.doubleValue);return a<c?-1:a>c?1:a===c?0:isNaN(a)?isNaN(c)?0:-1:1}(t,e);case 3:return Hu(t.timestampValue,e.timestampValue);case 4:return Hu(lr(t),lr(e));case 5:return M(t.stringValue,e.stringValue);case 6:return function(i,o){const a=xt(i),c=xt(o);return a.compareTo(c)}(t.bytesValue,e.bytesValue);case 7:return function(i,o){const a=i.split("/"),c=o.split("/");for(let u=0;u<a.length&&u<c.length;u++){const l=M(a[u],c[u]);if(l!==0)return l}return M(a.length,c.length)}(t.referenceValue,e.referenceValue);case 8:return function(i,o){const a=M(G(i.latitude),G(o.latitude));return a!==0?a:M(G(i.longitude),G(o.longitude))}(t.geoPointValue,e.geoPointValue);case 9:return function(i,o){const a=i.values||[],c=o.values||[];for(let u=0;u<a.length&&u<c.length;++u){const l=an(a[u],c[u]);if(l)return l}return M(a.length,c.length)}(t.arrayValue,e.arrayValue);case 10:return function(i,o){if(i===ws.mapValue&&o===ws.mapValue)return 0;if(i===ws.mapValue)return 1;if(o===ws.mapValue)return-1;const a=i.fields||{},c=Object.keys(a),u=o.fields||{},l=Object.keys(u);c.sort(),l.sort();for(let h=0;h<c.length&&h<l.length;++h){const d=M(c[h],l[h]);if(d!==0)return d;const f=an(a[c[h]],u[l[h]]);if(f!==0)return f}return M(c.length,l.length)}(t.mapValue,e.mapValue);default:throw A()}}function Hu(t,e){if(typeof t=="string"&&typeof e=="string"&&t.length===e.length)return M(t,e);const n=pt(t),r=pt(e),s=M(n.seconds,r.seconds);return s!==0?s:M(n.nanos,r.nanos)}function cn(t){return bo(t)}function bo(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(n){const r=pt(n);return`time(${r.seconds},${r.nanos})`}(t.timestampValue):"stringValue"in t?t.stringValue:"bytesValue"in t?function(n){return xt(n).toBase64()}(t.bytesValue):"referenceValue"in t?function(n){return w.fromName(n).toString()}(t.referenceValue):"geoPointValue"in t?function(n){return`geo(${n.latitude},${n.longitude})`}(t.geoPointValue):"arrayValue"in t?function(n){let r="[",s=!0;for(const i of n.values||[])s?s=!1:r+=",",r+=bo(i);return r+"]"}(t.arrayValue):"mapValue"in t?function(n){const r=Object.keys(n.fields||{}).sort();let s="{",i=!0;for(const o of r)i?i=!1:s+=",",s+=`${o}:${bo(n.fields[o])}`;return s+"}"}(t.mapValue):A()}function Is(t,e){return{referenceValue:`projects/${t.projectId}/databases/${t.database}/documents/${e.path.canonicalString()}`}}function Co(t){return!!t&&"integerValue"in t}function ko(t){return!!t&&"arrayValue"in t}function Wu(t){return!!t&&"nullValue"in t}function Gu(t){return!!t&&"doubleValue"in t&&isNaN(Number(t.doubleValue))}function As(t){return!!t&&"mapValue"in t}function fr(t){if(t.geoPointValue)return{geoPointValue:Object.assign({},t.geoPointValue)};if(t.timestampValue&&typeof t.timestampValue=="object")return{timestampValue:Object.assign({},t.timestampValue)};if(t.mapValue){const e={mapValue:{fields:{}}};return Mt(t.mapValue.fields,(n,r)=>e.mapValue.fields[n]=fr(r)),e}if(t.arrayValue){const e={arrayValue:{values:[]}};for(let n=0;n<(t.arrayValue.values||[]).length;++n)e.arrayValue.values[n]=fr(t.arrayValue.values[n]);return e}return Object.assign({},t)}function Cg(t){return(((t.mapValue||{}).fields||{}).__type__||{}).stringValue==="__max__"}/**
789
+ */const Ss={mapValue:{fields:{__type__:{stringValue:"__max__"}}}};function qt(n){return"nullValue"in n?0:"booleanValue"in n?1:"integerValue"in n||"doubleValue"in n?2:"timestampValue"in n?3:"stringValue"in n?5:"bytesValue"in n?6:"referenceValue"in n?7:"geoPointValue"in n?8:"arrayValue"in n?9:"mapValue"in n?Ps(n)?4:zg(n)?9007199254740991:10:A()}function ze(n,e){if(n===e)return!0;const t=qt(n);if(t!==qt(e))return!1;switch(t){case 0:case 9007199254740991:return!0;case 1:return n.booleanValue===e.booleanValue;case 4:return gr(n).isEqual(gr(e));case 3:return function(s,i){if(typeof s.timestampValue=="string"&&typeof i.timestampValue=="string"&&s.timestampValue.length===i.timestampValue.length)return s.timestampValue===i.timestampValue;const o=yt(s.timestampValue),a=yt(i.timestampValue);return o.seconds===a.seconds&&o.nanos===a.nanos}(n,e);case 5:return n.stringValue===e.stringValue;case 6:return function(s,i){return jt(s.bytesValue).isEqual(jt(i.bytesValue))}(n,e);case 7:return n.referenceValue===e.referenceValue;case 8:return function(s,i){return G(s.geoPointValue.latitude)===G(i.geoPointValue.latitude)&&G(s.geoPointValue.longitude)===G(i.geoPointValue.longitude)}(n,e);case 2:return function(s,i){if("integerValue"in s&&"integerValue"in i)return G(s.integerValue)===G(i.integerValue);if("doubleValue"in s&&"doubleValue"in i){const o=G(s.doubleValue),a=G(i.doubleValue);return o===a?As(o)===As(a):isNaN(o)&&isNaN(a)}return!1}(n,e);case 9:return un(n.arrayValue.values||[],e.arrayValue.values||[],ze);case 10:return function(s,i){const o=s.mapValue.fields||{},a=i.mapValue.fields||{};if(Yu(o)!==Yu(a))return!1;for(const c in o)if(o.hasOwnProperty(c)&&(a[c]===void 0||!ze(o[c],a[c])))return!1;return!0}(n,e);default:return A()}}function yr(n,e){return(n.values||[]).find(t=>ze(t,e))!==void 0}function ln(n,e){if(n===e)return 0;const t=qt(n),r=qt(e);if(t!==r)return M(t,r);switch(t){case 0:case 9007199254740991:return 0;case 1:return M(n.booleanValue,e.booleanValue);case 2:return function(i,o){const a=G(i.integerValue||i.doubleValue),c=G(o.integerValue||o.doubleValue);return a<c?-1:a>c?1:a===c?0:isNaN(a)?isNaN(c)?0:-1:1}(n,e);case 3:return el(n.timestampValue,e.timestampValue);case 4:return el(gr(n),gr(e));case 5:return M(n.stringValue,e.stringValue);case 6:return function(i,o){const a=jt(i),c=jt(o);return a.compareTo(c)}(n.bytesValue,e.bytesValue);case 7:return function(i,o){const a=i.split("/"),c=o.split("/");for(let u=0;u<a.length&&u<c.length;u++){const l=M(a[u],c[u]);if(l!==0)return l}return M(a.length,c.length)}(n.referenceValue,e.referenceValue);case 8:return function(i,o){const a=M(G(i.latitude),G(o.latitude));return a!==0?a:M(G(i.longitude),G(o.longitude))}(n.geoPointValue,e.geoPointValue);case 9:return function(i,o){const a=i.values||[],c=o.values||[];for(let u=0;u<a.length&&u<c.length;++u){const l=ln(a[u],c[u]);if(l)return l}return M(a.length,c.length)}(n.arrayValue,e.arrayValue);case 10:return function(i,o){if(i===Ss.mapValue&&o===Ss.mapValue)return 0;if(i===Ss.mapValue)return 1;if(o===Ss.mapValue)return-1;const a=i.fields||{},c=Object.keys(a),u=o.fields||{},l=Object.keys(u);c.sort(),l.sort();for(let h=0;h<c.length&&h<l.length;++h){const d=M(c[h],l[h]);if(d!==0)return d;const f=ln(a[c[h]],u[l[h]]);if(f!==0)return f}return M(c.length,l.length)}(n.mapValue,e.mapValue);default:throw A()}}function el(n,e){if(typeof n=="string"&&typeof e=="string"&&n.length===e.length)return M(n,e);const t=yt(n),r=yt(e),s=M(t.seconds,r.seconds);return s!==0?s:M(t.nanos,r.nanos)}function hn(n){return No(n)}function No(n){return"nullValue"in n?"null":"booleanValue"in n?""+n.booleanValue:"integerValue"in n?""+n.integerValue:"doubleValue"in n?""+n.doubleValue:"timestampValue"in n?function(t){const r=yt(t);return`time(${r.seconds},${r.nanos})`}(n.timestampValue):"stringValue"in n?n.stringValue:"bytesValue"in n?function(t){return jt(t).toBase64()}(n.bytesValue):"referenceValue"in n?function(t){return w.fromName(t).toString()}(n.referenceValue):"geoPointValue"in n?function(t){return`geo(${t.latitude},${t.longitude})`}(n.geoPointValue):"arrayValue"in n?function(t){let r="[",s=!0;for(const i of t.values||[])s?s=!1:r+=",",r+=No(i);return r+"]"}(n.arrayValue):"mapValue"in n?function(t){const r=Object.keys(t.fields||{}).sort();let s="{",i=!0;for(const o of r)i?i=!1:s+=",",s+=`${o}:${No(t.fields[o])}`;return s+"}"}(n.mapValue):A()}function bs(n,e){return{referenceValue:`projects/${n.projectId}/databases/${n.database}/documents/${e.path.canonicalString()}`}}function Oo(n){return!!n&&"integerValue"in n}function Vo(n){return!!n&&"arrayValue"in n}function tl(n){return!!n&&"nullValue"in n}function nl(n){return!!n&&"doubleValue"in n&&isNaN(Number(n.doubleValue))}function Cs(n){return!!n&&"mapValue"in n}function vr(n){if(n.geoPointValue)return{geoPointValue:Object.assign({},n.geoPointValue)};if(n.timestampValue&&typeof n.timestampValue=="object")return{timestampValue:Object.assign({},n.timestampValue)};if(n.mapValue){const e={mapValue:{fields:{}}};return Bt(n.mapValue.fields,(t,r)=>e.mapValue.fields[t]=vr(r)),e}if(n.arrayValue){const e={arrayValue:{values:[]}};for(let t=0;t<(n.arrayValue.values||[]).length;++t)e.arrayValue.values[t]=vr(n.arrayValue.values[t]);return e}return Object.assign({},n)}function zg(n){return(((n.mapValue||{}).fields||{}).__type__||{}).stringValue==="__max__"}/**
790
790
  * @license
791
791
  * Copyright 2017 Google LLC
792
792
  *
@@ -801,7 +801,7 @@
801
801
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
802
802
  * See the License for the specific language governing permissions and
803
803
  * limitations under the License.
804
- */class me{constructor(e){this.value=e}static empty(){return new me({mapValue:{}})}field(e){if(e.isEmpty())return this.value;{let n=this.value;for(let r=0;r<e.length-1;++r)if(n=(n.mapValue.fields||{})[e.get(r)],!As(n))return null;return n=(n.mapValue.fields||{})[e.lastSegment()],n||null}}set(e,n){this.getFieldsMap(e.popLast())[e.lastSegment()]=fr(n)}setAll(e){let n=ne.emptyPath(),r={},s=[];e.forEach((o,a)=>{if(!n.isImmediateParentOf(a)){const c=this.getFieldsMap(n);this.applyChanges(c,r,s),r={},s=[],n=a.popLast()}o?r[a.lastSegment()]=fr(o):s.push(a.lastSegment())});const i=this.getFieldsMap(n);this.applyChanges(i,r,s)}delete(e){const n=this.field(e.popLast());As(n)&&n.mapValue.fields&&delete n.mapValue.fields[e.lastSegment()]}isEqual(e){return je(this.value,e.value)}getFieldsMap(e){let n=this.value;n.mapValue.fields||(n.mapValue={fields:{}});for(let r=0;r<e.length;++r){let s=n.mapValue.fields[e.get(r)];As(s)&&s.mapValue.fields||(s={mapValue:{fields:{}}},n.mapValue.fields[e.get(r)]=s),n=s}return n.mapValue.fields}applyChanges(e,n,r){Mt(n,(s,i)=>e[s]=i);for(const s of r)delete e[s]}clone(){return new me(fr(this.value))}}function Ku(t){const e=[];return Mt(t.fields,(n,r)=>{const s=new ne([n]);if(As(r)){const i=Ku(r.mapValue).fields;if(i.length===0)e.push(s);else for(const o of i)e.push(s.child(o))}else e.push(s)}),new Te(e)}/**
804
+ */class _e{constructor(e){this.value=e}static empty(){return new _e({mapValue:{}})}field(e){if(e.isEmpty())return this.value;{let t=this.value;for(let r=0;r<e.length-1;++r)if(t=(t.mapValue.fields||{})[e.get(r)],!Cs(t))return null;return t=(t.mapValue.fields||{})[e.lastSegment()],t||null}}set(e,t){this.getFieldsMap(e.popLast())[e.lastSegment()]=vr(t)}setAll(e){let t=ne.emptyPath(),r={},s=[];e.forEach((o,a)=>{if(!t.isImmediateParentOf(a)){const c=this.getFieldsMap(t);this.applyChanges(c,r,s),r={},s=[],t=a.popLast()}o?r[a.lastSegment()]=vr(o):s.push(a.lastSegment())});const i=this.getFieldsMap(t);this.applyChanges(i,r,s)}delete(e){const t=this.field(e.popLast());Cs(t)&&t.mapValue.fields&&delete t.mapValue.fields[e.lastSegment()]}isEqual(e){return ze(this.value,e.value)}getFieldsMap(e){let t=this.value;t.mapValue.fields||(t.mapValue={fields:{}});for(let r=0;r<e.length;++r){let s=t.mapValue.fields[e.get(r)];Cs(s)&&s.mapValue.fields||(s={mapValue:{fields:{}}},t.mapValue.fields[e.get(r)]=s),t=s}return t.mapValue.fields}applyChanges(e,t,r){Bt(t,(s,i)=>e[s]=i);for(const s of r)delete e[s]}clone(){return new _e(vr(this.value))}}function rl(n){const e=[];return Bt(n.fields,(t,r)=>{const s=new ne([t]);if(Cs(r)){const i=rl(r.mapValue).fields;if(i.length===0)e.push(s);else for(const o of i)e.push(s.child(o))}else e.push(s)}),new Ie(e)}/**
805
805
  * @license
806
806
  * Copyright 2017 Google LLC
807
807
  *
@@ -816,7 +816,7 @@
816
816
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
817
817
  * See the License for the specific language governing permissions and
818
818
  * limitations under the License.
819
- */class he{constructor(e,n,r,s,i,o,a){this.key=e,this.documentType=n,this.version=r,this.readTime=s,this.createTime=i,this.data=o,this.documentState=a}static newInvalidDocument(e){return new he(e,0,S.min(),S.min(),S.min(),me.empty(),0)}static newFoundDocument(e,n,r,s){return new he(e,1,n,S.min(),r,s,0)}static newNoDocument(e,n){return new he(e,2,n,S.min(),S.min(),me.empty(),0)}static newUnknownDocument(e,n){return new he(e,3,n,S.min(),S.min(),me.empty(),2)}convertToFoundDocument(e,n){return!this.createTime.isEqual(S.min())||this.documentType!==2&&this.documentType!==0||(this.createTime=e),this.version=e,this.documentType=1,this.data=n,this.documentState=0,this}convertToNoDocument(e){return this.version=e,this.documentType=2,this.data=me.empty(),this.documentState=0,this}convertToUnknownDocument(e){return this.version=e,this.documentType=3,this.data=me.empty(),this.documentState=2,this}setHasCommittedMutations(){return this.documentState=2,this}setHasLocalMutations(){return this.documentState=1,this.version=S.min(),this}setReadTime(e){return this.readTime=e,this}get hasLocalMutations(){return this.documentState===1}get hasCommittedMutations(){return this.documentState===2}get hasPendingWrites(){return this.hasLocalMutations||this.hasCommittedMutations}isValidDocument(){return this.documentType!==0}isFoundDocument(){return this.documentType===1}isNoDocument(){return this.documentType===2}isUnknownDocument(){return this.documentType===3}isEqual(e){return e instanceof he&&this.key.isEqual(e.key)&&this.version.isEqual(e.version)&&this.documentType===e.documentType&&this.documentState===e.documentState&&this.data.isEqual(e.data)}mutableCopy(){return new he(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}})`}}/**
819
+ */class he{constructor(e,t,r,s,i,o,a){this.key=e,this.documentType=t,this.version=r,this.readTime=s,this.createTime=i,this.data=o,this.documentState=a}static newInvalidDocument(e){return new he(e,0,S.min(),S.min(),S.min(),_e.empty(),0)}static newFoundDocument(e,t,r,s){return new he(e,1,t,S.min(),r,s,0)}static newNoDocument(e,t){return new he(e,2,t,S.min(),S.min(),_e.empty(),0)}static newUnknownDocument(e,t){return new he(e,3,t,S.min(),S.min(),_e.empty(),2)}convertToFoundDocument(e,t){return!this.createTime.isEqual(S.min())||this.documentType!==2&&this.documentType!==0||(this.createTime=e),this.version=e,this.documentType=1,this.data=t,this.documentState=0,this}convertToNoDocument(e){return this.version=e,this.documentType=2,this.data=_e.empty(),this.documentState=0,this}convertToUnknownDocument(e){return this.version=e,this.documentType=3,this.data=_e.empty(),this.documentState=2,this}setHasCommittedMutations(){return this.documentState=2,this}setHasLocalMutations(){return this.documentState=1,this.version=S.min(),this}setReadTime(e){return this.readTime=e,this}get hasLocalMutations(){return this.documentState===1}get hasCommittedMutations(){return this.documentState===2}get hasPendingWrites(){return this.hasLocalMutations||this.hasCommittedMutations}isValidDocument(){return this.documentType!==0}isFoundDocument(){return this.documentType===1}isNoDocument(){return this.documentType===2}isUnknownDocument(){return this.documentType===3}isEqual(e){return e instanceof he&&this.key.isEqual(e.key)&&this.version.isEqual(e.version)&&this.documentType===e.documentType&&this.documentState===e.documentState&&this.data.isEqual(e.data)}mutableCopy(){return new he(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}})`}}/**
820
820
  * @license
821
821
  * Copyright 2022 Google LLC
822
822
  *
@@ -831,7 +831,7 @@
831
831
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
832
832
  * See the License for the specific language governing permissions and
833
833
  * limitations under the License.
834
- */class un{constructor(e,n){this.position=e,this.inclusive=n}}function Qu(t,e,n){let r=0;for(let s=0;s<t.position.length;s++){const i=e[s],o=t.position[s];if(i.field.isKeyField()?r=w.comparator(w.fromName(o.referenceValue),n.key):r=an(o,n.data.field(i.field)),i.dir==="desc"&&(r*=-1),r!==0)break}return r}function Yu(t,e){if(t===null)return e===null;if(e===null||t.inclusive!==e.inclusive||t.position.length!==e.position.length)return!1;for(let n=0;n<t.position.length;n++)if(!je(t.position[n],e.position[n]))return!1;return!0}/**
834
+ */class dn{constructor(e,t){this.position=e,this.inclusive=t}}function sl(n,e,t){let r=0;for(let s=0;s<n.position.length;s++){const i=e[s],o=n.position[s];if(i.field.isKeyField()?r=w.comparator(w.fromName(o.referenceValue),t.key):r=ln(o,t.data.field(i.field)),i.dir==="desc"&&(r*=-1),r!==0)break}return r}function il(n,e){if(n===null)return e===null;if(e===null||n.inclusive!==e.inclusive||n.position.length!==e.position.length)return!1;for(let t=0;t<n.position.length;t++)if(!ze(n.position[t],e.position[t]))return!1;return!0}/**
835
835
  * @license
836
836
  * Copyright 2022 Google LLC
837
837
  *
@@ -846,7 +846,7 @@
846
846
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
847
847
  * See the License for the specific language governing permissions and
848
848
  * limitations under the License.
849
- */class pr{constructor(e,n="asc"){this.field=e,this.dir=n}}function kg(t,e){return t.dir===e.dir&&t.field.isEqual(e.field)}/**
849
+ */class Er{constructor(e,t="asc"){this.field=e,this.dir=t}}function Hg(n,e){return n.dir===e.dir&&n.field.isEqual(e.field)}/**
850
850
  * @license
851
851
  * Copyright 2022 Google LLC
852
852
  *
@@ -861,7 +861,7 @@
861
861
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
862
862
  * See the License for the specific language governing permissions and
863
863
  * limitations under the License.
864
- */class Xu{}class K extends Xu{constructor(e,n,r){super(),this.field=e,this.op=n,this.value=r}static create(e,n,r){return e.isKeyField()?n==="in"||n==="not-in"?this.createKeyFieldInFilter(e,n,r):new Ng(e,n,r):n==="array-contains"?new Lg(e,r):n==="in"?new Mg(e,r):n==="not-in"?new xg(e,r):n==="array-contains-any"?new Ug(e,r):new K(e,n,r)}static createKeyFieldInFilter(e,n,r){return n==="in"?new Og(e,r):new Vg(e,r)}matches(e){const n=e.data.field(this.field);return this.op==="!="?n!==null&&this.matchesComparison(an(n,this.value)):n!==null&&Ut(this.value)===Ut(n)&&this.matchesComparison(an(n,this.value))}matchesComparison(e){switch(this.op){case"<":return e<0;case"<=":return e<=0;case"==":return e===0;case"!=":return e!==0;case">":return e>0;case">=":return e>=0;default:return A()}}isInequality(){return["<","<=",">",">=","!=","not-in"].indexOf(this.op)>=0}getFlattenedFilters(){return[this]}getFilters(){return[this]}}class Ne extends Xu{constructor(e,n){super(),this.filters=e,this.op=n,this.ue=null}static create(e,n){return new Ne(e,n)}matches(e){return Ju(this)?this.filters.find(n=>!n.matches(e))===void 0:this.filters.find(n=>n.matches(e))!==void 0}getFlattenedFilters(){return this.ue!==null||(this.ue=this.filters.reduce((e,n)=>e.concat(n.getFlattenedFilters()),[])),this.ue}getFilters(){return Object.assign([],this.filters)}}function Ju(t){return t.op==="and"}function Zu(t){return Dg(t)&&Ju(t)}function Dg(t){for(const e of t.filters)if(e instanceof Ne)return!1;return!0}function Do(t){if(t instanceof K)return t.field.canonicalString()+t.op.toString()+cn(t.value);if(Zu(t))return t.filters.map(e=>Do(e)).join(",");{const e=t.filters.map(n=>Do(n)).join(",");return`${t.op}(${e})`}}function el(t,e){return t instanceof K?function(r,s){return s instanceof K&&r.op===s.op&&r.field.isEqual(s.field)&&je(r.value,s.value)}(t,e):t instanceof Ne?function(r,s){return s instanceof Ne&&r.op===s.op&&r.filters.length===s.filters.length?r.filters.reduce((i,o,a)=>i&&el(o,s.filters[a]),!0):!1}(t,e):void A()}function tl(t){return t instanceof K?function(n){return`${n.field.canonicalString()} ${n.op} ${cn(n.value)}`}(t):t instanceof Ne?function(n){return n.op.toString()+" {"+n.getFilters().map(tl).join(" ,")+"}"}(t):"Filter"}class Ng extends K{constructor(e,n,r){super(e,n,r),this.key=w.fromName(r.referenceValue)}matches(e){const n=w.comparator(e.key,this.key);return this.matchesComparison(n)}}class Og extends K{constructor(e,n){super(e,"in",n),this.keys=nl("in",n)}matches(e){return this.keys.some(n=>n.isEqual(e.key))}}class Vg extends K{constructor(e,n){super(e,"not-in",n),this.keys=nl("not-in",n)}matches(e){return!this.keys.some(n=>n.isEqual(e.key))}}function nl(t,e){var n;return(((n=e.arrayValue)===null||n===void 0?void 0:n.values)||[]).map(r=>w.fromName(r.referenceValue))}class Lg extends K{constructor(e,n){super(e,"array-contains",n)}matches(e){const n=e.data.field(this.field);return ko(n)&&dr(n.arrayValue,this.value)}}class Mg extends K{constructor(e,n){super(e,"in",n)}matches(e){const n=e.data.field(this.field);return n!==null&&dr(this.value.arrayValue,n)}}class xg extends K{constructor(e,n){super(e,"not-in",n)}matches(e){if(dr(this.value.arrayValue,{nullValue:"NULL_VALUE"}))return!1;const n=e.data.field(this.field);return n!==null&&!dr(this.value.arrayValue,n)}}class Ug extends K{constructor(e,n){super(e,"array-contains-any",n)}matches(e){const n=e.data.field(this.field);return!(!ko(n)||!n.arrayValue.values)&&n.arrayValue.values.some(r=>dr(this.value.arrayValue,r))}}/**
864
+ */class ol{}class K extends ol{constructor(e,t,r){super(),this.field=e,this.op=t,this.value=r}static create(e,t,r){return e.isKeyField()?t==="in"||t==="not-in"?this.createKeyFieldInFilter(e,t,r):new Gg(e,t,r):t==="array-contains"?new Yg(e,r):t==="in"?new Xg(e,r):t==="not-in"?new Jg(e,r):t==="array-contains-any"?new Zg(e,r):new K(e,t,r)}static createKeyFieldInFilter(e,t,r){return t==="in"?new Kg(e,r):new Qg(e,r)}matches(e){const t=e.data.field(this.field);return this.op==="!="?t!==null&&this.matchesComparison(ln(t,this.value)):t!==null&&qt(this.value)===qt(t)&&this.matchesComparison(ln(t,this.value))}matchesComparison(e){switch(this.op){case"<":return e<0;case"<=":return e<=0;case"==":return e===0;case"!=":return e!==0;case">":return e>0;case">=":return e>=0;default:return A()}}isInequality(){return["<","<=",">",">=","!=","not-in"].indexOf(this.op)>=0}getFlattenedFilters(){return[this]}getFilters(){return[this]}}class Ve extends ol{constructor(e,t){super(),this.filters=e,this.op=t,this.ue=null}static create(e,t){return new Ve(e,t)}matches(e){return al(this)?this.filters.find(t=>!t.matches(e))===void 0:this.filters.find(t=>t.matches(e))!==void 0}getFlattenedFilters(){return this.ue!==null||(this.ue=this.filters.reduce((e,t)=>e.concat(t.getFlattenedFilters()),[])),this.ue}getFilters(){return Object.assign([],this.filters)}}function al(n){return n.op==="and"}function cl(n){return Wg(n)&&al(n)}function Wg(n){for(const e of n.filters)if(e instanceof Ve)return!1;return!0}function Lo(n){if(n instanceof K)return n.field.canonicalString()+n.op.toString()+hn(n.value);if(cl(n))return n.filters.map(e=>Lo(e)).join(",");{const e=n.filters.map(t=>Lo(t)).join(",");return`${n.op}(${e})`}}function ul(n,e){return n instanceof K?function(r,s){return s instanceof K&&r.op===s.op&&r.field.isEqual(s.field)&&ze(r.value,s.value)}(n,e):n instanceof Ve?function(r,s){return s instanceof Ve&&r.op===s.op&&r.filters.length===s.filters.length?r.filters.reduce((i,o,a)=>i&&ul(o,s.filters[a]),!0):!1}(n,e):void A()}function ll(n){return n instanceof K?function(t){return`${t.field.canonicalString()} ${t.op} ${hn(t.value)}`}(n):n instanceof Ve?function(t){return t.op.toString()+" {"+t.getFilters().map(ll).join(" ,")+"}"}(n):"Filter"}class Gg extends K{constructor(e,t,r){super(e,t,r),this.key=w.fromName(r.referenceValue)}matches(e){const t=w.comparator(e.key,this.key);return this.matchesComparison(t)}}class Kg extends K{constructor(e,t){super(e,"in",t),this.keys=hl("in",t)}matches(e){return this.keys.some(t=>t.isEqual(e.key))}}class Qg extends K{constructor(e,t){super(e,"not-in",t),this.keys=hl("not-in",t)}matches(e){return!this.keys.some(t=>t.isEqual(e.key))}}function hl(n,e){var t;return(((t=e.arrayValue)===null||t===void 0?void 0:t.values)||[]).map(r=>w.fromName(r.referenceValue))}class Yg extends K{constructor(e,t){super(e,"array-contains",t)}matches(e){const t=e.data.field(this.field);return Vo(t)&&yr(t.arrayValue,this.value)}}class Xg extends K{constructor(e,t){super(e,"in",t)}matches(e){const t=e.data.field(this.field);return t!==null&&yr(this.value.arrayValue,t)}}class Jg extends K{constructor(e,t){super(e,"not-in",t)}matches(e){if(yr(this.value.arrayValue,{nullValue:"NULL_VALUE"}))return!1;const t=e.data.field(this.field);return t!==null&&!yr(this.value.arrayValue,t)}}class Zg extends K{constructor(e,t){super(e,"array-contains-any",t)}matches(e){const t=e.data.field(this.field);return!(!Vo(t)||!t.arrayValue.values)&&t.arrayValue.values.some(r=>yr(this.value.arrayValue,r))}}/**
865
865
  * @license
866
866
  * Copyright 2019 Google LLC
867
867
  *
@@ -876,7 +876,7 @@
876
876
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
877
877
  * See the License for the specific language governing permissions and
878
878
  * limitations under the License.
879
- */class Fg{constructor(e,n=null,r=[],s=[],i=null,o=null,a=null){this.path=e,this.collectionGroup=n,this.orderBy=r,this.filters=s,this.limit=i,this.startAt=o,this.endAt=a,this.ce=null}}function rl(t,e=null,n=[],r=[],s=null,i=null,o=null){return new Fg(t,e,n,r,s,i,o)}function No(t){const e=P(t);if(e.ce===null){let n=e.path.canonicalString();e.collectionGroup!==null&&(n+="|cg:"+e.collectionGroup),n+="|f:",n+=e.filters.map(r=>Do(r)).join(","),n+="|ob:",n+=e.orderBy.map(r=>function(i){return i.field.canonicalString()+i.dir}(r)).join(","),ys(e.limit)||(n+="|l:",n+=e.limit),e.startAt&&(n+="|lb:",n+=e.startAt.inclusive?"b:":"a:",n+=e.startAt.position.map(r=>cn(r)).join(",")),e.endAt&&(n+="|ub:",n+=e.endAt.inclusive?"a:":"b:",n+=e.endAt.position.map(r=>cn(r)).join(",")),e.ce=n}return e.ce}function Oo(t,e){if(t.limit!==e.limit||t.orderBy.length!==e.orderBy.length)return!1;for(let n=0;n<t.orderBy.length;n++)if(!kg(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(!el(t.filters[n],e.filters[n]))return!1;return t.collectionGroup===e.collectionGroup&&!!t.path.isEqual(e.path)&&!!Yu(t.startAt,e.startAt)&&Yu(t.endAt,e.endAt)}function Vo(t){return w.isDocumentKey(t.path)&&t.collectionGroup===null&&t.filters.length===0}/**
879
+ */class e_{constructor(e,t=null,r=[],s=[],i=null,o=null,a=null){this.path=e,this.collectionGroup=t,this.orderBy=r,this.filters=s,this.limit=i,this.startAt=o,this.endAt=a,this.ce=null}}function dl(n,e=null,t=[],r=[],s=null,i=null,o=null){return new e_(n,e,t,r,s,i,o)}function Mo(n){const e=P(n);if(e.ce===null){let t=e.path.canonicalString();e.collectionGroup!==null&&(t+="|cg:"+e.collectionGroup),t+="|f:",t+=e.filters.map(r=>Lo(r)).join(","),t+="|ob:",t+=e.orderBy.map(r=>function(i){return i.field.canonicalString()+i.dir}(r)).join(","),Is(e.limit)||(t+="|l:",t+=e.limit),e.startAt&&(t+="|lb:",t+=e.startAt.inclusive?"b:":"a:",t+=e.startAt.position.map(r=>hn(r)).join(",")),e.endAt&&(t+="|ub:",t+=e.endAt.inclusive?"a:":"b:",t+=e.endAt.position.map(r=>hn(r)).join(",")),e.ce=t}return e.ce}function xo(n,e){if(n.limit!==e.limit||n.orderBy.length!==e.orderBy.length)return!1;for(let t=0;t<n.orderBy.length;t++)if(!Hg(n.orderBy[t],e.orderBy[t]))return!1;if(n.filters.length!==e.filters.length)return!1;for(let t=0;t<n.filters.length;t++)if(!ul(n.filters[t],e.filters[t]))return!1;return n.collectionGroup===e.collectionGroup&&!!n.path.isEqual(e.path)&&!!il(n.startAt,e.startAt)&&il(n.endAt,e.endAt)}function Uo(n){return w.isDocumentKey(n.path)&&n.collectionGroup===null&&n.filters.length===0}/**
880
880
  * @license
881
881
  * Copyright 2017 Google LLC
882
882
  *
@@ -891,7 +891,7 @@
891
891
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
892
892
  * See the License for the specific language governing permissions and
893
893
  * limitations under the License.
894
- */class Ft{constructor(e,n=null,r=[],s=[],i=null,o="F",a=null,c=null){this.path=e,this.collectionGroup=n,this.explicitOrderBy=r,this.filters=s,this.limit=i,this.limitType=o,this.startAt=a,this.endAt=c,this.le=null,this.he=null,this.Pe=null,this.startAt,this.endAt}}function Bg(t,e,n,r,s,i,o,a){return new Ft(t,e,n,r,s,i,o,a)}function Lo(t){return new Ft(t)}function sl(t){return t.filters.length===0&&t.limit===null&&t.startAt==null&&t.endAt==null&&(t.explicitOrderBy.length===0||t.explicitOrderBy.length===1&&t.explicitOrderBy[0].field.isKeyField())}function Mo(t){return t.collectionGroup!==null}function ln(t){const e=P(t);if(e.le===null){e.le=[];const n=new Set;for(const i of e.explicitOrderBy)e.le.push(i),n.add(i.field.canonicalString());const r=e.explicitOrderBy.length>0?e.explicitOrderBy[e.explicitOrderBy.length-1].dir:"asc";(function(o){let a=new se(ne.comparator);return o.filters.forEach(c=>{c.getFlattenedFilters().forEach(u=>{u.isInequality()&&(a=a.add(u.field))})}),a})(e).forEach(i=>{n.has(i.canonicalString())||i.isKeyField()||e.le.push(new pr(i,r))}),n.has(ne.keyField().canonicalString())||e.le.push(new pr(ne.keyField(),r))}return e.le}function $e(t){const e=P(t);return e.he||(e.he=il(e,ln(t))),e.he}function il(t,e){if(t.limitType==="F")return rl(t.path,t.collectionGroup,e,t.filters,t.limit,t.startAt,t.endAt);{e=e.map(s=>{const i=s.dir==="desc"?"asc":"desc";return new pr(s.field,i)});const n=t.endAt?new un(t.endAt.position,t.endAt.inclusive):null,r=t.startAt?new un(t.startAt.position,t.startAt.inclusive):null;return rl(t.path,t.collectionGroup,e,t.filters,t.limit,n,r)}}function xo(t,e){const n=t.filters.concat([e]);return new Ft(t.path,t.collectionGroup,t.explicitOrderBy.slice(),n,t.limit,t.limitType,t.startAt,t.endAt)}function Rs(t,e,n){return new Ft(t.path,t.collectionGroup,t.explicitOrderBy.slice(),t.filters.slice(),e,n,t.startAt,t.endAt)}function Ps(t,e){return Oo($e(t),$e(e))&&t.limitType===e.limitType}function ol(t){return`${No($e(t))}|lt:${t.limitType}`}function hn(t){return`Query(target=${function(n){let r=n.path.canonicalString();return n.collectionGroup!==null&&(r+=" collectionGroup="+n.collectionGroup),n.filters.length>0&&(r+=`, filters: [${n.filters.map(s=>tl(s)).join(", ")}]`),ys(n.limit)||(r+=", limit: "+n.limit),n.orderBy.length>0&&(r+=`, orderBy: [${n.orderBy.map(s=>function(o){return`${o.field.canonicalString()} (${o.dir})`}(s)).join(", ")}]`),n.startAt&&(r+=", startAt: ",r+=n.startAt.inclusive?"b:":"a:",r+=n.startAt.position.map(s=>cn(s)).join(",")),n.endAt&&(r+=", endAt: ",r+=n.endAt.inclusive?"a:":"b:",r+=n.endAt.position.map(s=>cn(s)).join(",")),`Target(${r})`}($e(t))}; limitType=${t.limitType})`}function Ss(t,e){return e.isFoundDocument()&&function(r,s){const i=s.key.path;return r.collectionGroup!==null?s.key.hasCollectionId(r.collectionGroup)&&r.path.isPrefixOf(i):w.isDocumentKey(r.path)?r.path.isEqual(i):r.path.isImmediateParentOf(i)}(t,e)&&function(r,s){for(const i of ln(r))if(!i.field.isKeyField()&&s.data.field(i.field)===null)return!1;return!0}(t,e)&&function(r,s){for(const i of r.filters)if(!i.matches(s))return!1;return!0}(t,e)&&function(r,s){return!(r.startAt&&!function(o,a,c){const u=Qu(o,a,c);return o.inclusive?u<=0:u<0}(r.startAt,ln(r),s)||r.endAt&&!function(o,a,c){const u=Qu(o,a,c);return o.inclusive?u>=0:u>0}(r.endAt,ln(r),s))}(t,e)}function jg(t){return t.collectionGroup||(t.path.length%2==1?t.path.lastSegment():t.path.get(t.path.length-2))}function al(t){return(e,n)=>{let r=!1;for(const s of ln(t)){const i=$g(s,e,n);if(i!==0)return i;r=r||s.field.isKeyField()}return 0}}function $g(t,e,n){const r=t.field.isKeyField()?w.comparator(e.key,n.key):function(i,o,a){const c=o.data.field(i),u=a.data.field(i);return c!==null&&u!==null?an(c,u):A()}(t.field,e,n);switch(t.dir){case"asc":return r;case"desc":return-1*r;default:return A()}}/**
894
+ */class $t{constructor(e,t=null,r=[],s=[],i=null,o="F",a=null,c=null){this.path=e,this.collectionGroup=t,this.explicitOrderBy=r,this.filters=s,this.limit=i,this.limitType=o,this.startAt=a,this.endAt=c,this.le=null,this.he=null,this.Pe=null,this.startAt,this.endAt}}function t_(n,e,t,r,s,i,o,a){return new $t(n,e,t,r,s,i,o,a)}function Fo(n){return new $t(n)}function fl(n){return n.filters.length===0&&n.limit===null&&n.startAt==null&&n.endAt==null&&(n.explicitOrderBy.length===0||n.explicitOrderBy.length===1&&n.explicitOrderBy[0].field.isKeyField())}function Bo(n){return n.collectionGroup!==null}function fn(n){const e=P(n);if(e.le===null){e.le=[];const t=new Set;for(const i of e.explicitOrderBy)e.le.push(i),t.add(i.field.canonicalString());const r=e.explicitOrderBy.length>0?e.explicitOrderBy[e.explicitOrderBy.length-1].dir:"asc";(function(o){let a=new se(ne.comparator);return o.filters.forEach(c=>{c.getFlattenedFilters().forEach(u=>{u.isInequality()&&(a=a.add(u.field))})}),a})(e).forEach(i=>{t.has(i.canonicalString())||i.isKeyField()||e.le.push(new Er(i,r))}),t.has(ne.keyField().canonicalString())||e.le.push(new Er(ne.keyField(),r))}return e.le}function He(n){const e=P(n);return e.he||(e.he=pl(e,fn(n))),e.he}function pl(n,e){if(n.limitType==="F")return dl(n.path,n.collectionGroup,e,n.filters,n.limit,n.startAt,n.endAt);{e=e.map(s=>{const i=s.dir==="desc"?"asc":"desc";return new Er(s.field,i)});const t=n.endAt?new dn(n.endAt.position,n.endAt.inclusive):null,r=n.startAt?new dn(n.startAt.position,n.startAt.inclusive):null;return dl(n.path,n.collectionGroup,e,n.filters,n.limit,t,r)}}function jo(n,e){const t=n.filters.concat([e]);return new $t(n.path,n.collectionGroup,n.explicitOrderBy.slice(),t,n.limit,n.limitType,n.startAt,n.endAt)}function ks(n,e,t){return new $t(n.path,n.collectionGroup,n.explicitOrderBy.slice(),n.filters.slice(),e,t,n.startAt,n.endAt)}function Ds(n,e){return xo(He(n),He(e))&&n.limitType===e.limitType}function ml(n){return`${Mo(He(n))}|lt:${n.limitType}`}function pn(n){return`Query(target=${function(t){let r=t.path.canonicalString();return t.collectionGroup!==null&&(r+=" collectionGroup="+t.collectionGroup),t.filters.length>0&&(r+=`, filters: [${t.filters.map(s=>ll(s)).join(", ")}]`),Is(t.limit)||(r+=", limit: "+t.limit),t.orderBy.length>0&&(r+=`, orderBy: [${t.orderBy.map(s=>function(o){return`${o.field.canonicalString()} (${o.dir})`}(s)).join(", ")}]`),t.startAt&&(r+=", startAt: ",r+=t.startAt.inclusive?"b:":"a:",r+=t.startAt.position.map(s=>hn(s)).join(",")),t.endAt&&(r+=", endAt: ",r+=t.endAt.inclusive?"a:":"b:",r+=t.endAt.position.map(s=>hn(s)).join(",")),`Target(${r})`}(He(n))}; limitType=${n.limitType})`}function Ns(n,e){return e.isFoundDocument()&&function(r,s){const i=s.key.path;return r.collectionGroup!==null?s.key.hasCollectionId(r.collectionGroup)&&r.path.isPrefixOf(i):w.isDocumentKey(r.path)?r.path.isEqual(i):r.path.isImmediateParentOf(i)}(n,e)&&function(r,s){for(const i of fn(r))if(!i.field.isKeyField()&&s.data.field(i.field)===null)return!1;return!0}(n,e)&&function(r,s){for(const i of r.filters)if(!i.matches(s))return!1;return!0}(n,e)&&function(r,s){return!(r.startAt&&!function(o,a,c){const u=sl(o,a,c);return o.inclusive?u<=0:u<0}(r.startAt,fn(r),s)||r.endAt&&!function(o,a,c){const u=sl(o,a,c);return o.inclusive?u>=0:u>0}(r.endAt,fn(r),s))}(n,e)}function n_(n){return n.collectionGroup||(n.path.length%2==1?n.path.lastSegment():n.path.get(n.path.length-2))}function gl(n){return(e,t)=>{let r=!1;for(const s of fn(n)){const i=r_(s,e,t);if(i!==0)return i;r=r||s.field.isKeyField()}return 0}}function r_(n,e,t){const r=n.field.isKeyField()?w.comparator(e.key,t.key):function(i,o,a){const c=o.data.field(i),u=a.data.field(i);return c!==null&&u!==null?ln(c,u):A()}(n.field,e,t);switch(n.dir){case"asc":return r;case"desc":return-1*r;default:return A()}}/**
895
895
  * @license
896
896
  * Copyright 2017 Google LLC
897
897
  *
@@ -906,7 +906,7 @@
906
906
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
907
907
  * See the License for the specific language governing permissions and
908
908
  * limitations under the License.
909
- */class dn{constructor(e,n){this.mapKeyFn=e,this.equalsFn=n,this.inner={},this.innerSize=0}get(e){const n=this.mapKeyFn(e),r=this.inner[n];if(r!==void 0){for(const[s,i]of r)if(this.equalsFn(s,e))return i}}has(e){return this.get(e)!==void 0}set(e,n){const r=this.mapKeyFn(e),s=this.inner[r];if(s===void 0)return this.inner[r]=[[e,n]],void this.innerSize++;for(let i=0;i<s.length;i++)if(this.equalsFn(s[i][0],e))return void(s[i]=[e,n]);s.push([e,n]),this.innerSize++}delete(e){const n=this.mapKeyFn(e),r=this.inner[n];if(r===void 0)return!1;for(let s=0;s<r.length;s++)if(this.equalsFn(r[s][0],e))return r.length===1?delete this.inner[n]:r.splice(s,1),this.innerSize--,!0;return!1}forEach(e){Mt(this.inner,(n,r)=>{for(const[s,i]of r)e(s,i)})}isEmpty(){return $u(this.inner)}size(){return this.innerSize}}/**
909
+ */class mn{constructor(e,t){this.mapKeyFn=e,this.equalsFn=t,this.inner={},this.innerSize=0}get(e){const t=this.mapKeyFn(e),r=this.inner[t];if(r!==void 0){for(const[s,i]of r)if(this.equalsFn(s,e))return i}}has(e){return this.get(e)!==void 0}set(e,t){const r=this.mapKeyFn(e),s=this.inner[r];if(s===void 0)return this.inner[r]=[[e,t]],void this.innerSize++;for(let i=0;i<s.length;i++)if(this.equalsFn(s[i][0],e))return void(s[i]=[e,t]);s.push([e,t]),this.innerSize++}delete(e){const t=this.mapKeyFn(e),r=this.inner[t];if(r===void 0)return!1;for(let s=0;s<r.length;s++)if(this.equalsFn(r[s][0],e))return r.length===1?delete this.inner[t]:r.splice(s,1),this.innerSize--,!0;return!1}forEach(e){Bt(this.inner,(t,r)=>{for(const[s,i]of r)e(s,i)})}isEmpty(){return Xu(this.inner)}size(){return this.innerSize}}/**
910
910
  * @license
911
911
  * Copyright 2017 Google LLC
912
912
  *
@@ -921,7 +921,7 @@
921
921
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
922
922
  * See the License for the specific language governing permissions and
923
923
  * limitations under the License.
924
- */const qg=new q(w.comparator);function Ze(){return qg}const cl=new q(w.comparator);function mr(...t){let e=cl;for(const n of t)e=e.insert(n.key,n);return e}function ul(t){let e=cl;return t.forEach((n,r)=>e=e.insert(n,r.overlayedDocument)),e}function Bt(){return gr()}function ll(){return gr()}function gr(){return new dn(t=>t.toString(),(t,e)=>t.isEqual(e))}const zg=new q(w.comparator),Hg=new se(w.comparator);function D(...t){let e=Hg;for(const n of t)e=e.add(n);return e}const Wg=new se(M);function Gg(){return Wg}/**
924
+ */const s_=new $(w.comparator);function nt(){return s_}const _l=new $(w.comparator);function Tr(...n){let e=_l;for(const t of n)e=e.insert(t.key,t);return e}function yl(n){let e=_l;return n.forEach((t,r)=>e=e.insert(t,r.overlayedDocument)),e}function zt(){return wr()}function vl(){return wr()}function wr(){return new mn(n=>n.toString(),(n,e)=>n.isEqual(e))}const i_=new $(w.comparator),o_=new se(w.comparator);function D(...n){let e=o_;for(const t of n)e=e.add(t);return e}const a_=new se(M);function c_(){return a_}/**
925
925
  * @license
926
926
  * Copyright 2020 Google LLC
927
927
  *
@@ -936,7 +936,7 @@
936
936
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
937
937
  * See the License for the specific language governing permissions and
938
938
  * limitations under the License.
939
- */function hl(t,e){if(t.useProto3Json){if(isNaN(e))return{doubleValue:"NaN"};if(e===1/0)return{doubleValue:"Infinity"};if(e===-1/0)return{doubleValue:"-Infinity"}}return{doubleValue:vs(e)?"-0":e}}function dl(t){return{integerValue:""+t}}function Kg(t,e){return Pg(e)?dl(e):hl(t,e)}/**
939
+ */function El(n,e){if(n.useProto3Json){if(isNaN(e))return{doubleValue:"NaN"};if(e===1/0)return{doubleValue:"Infinity"};if(e===-1/0)return{doubleValue:"-Infinity"}}return{doubleValue:As(e)?"-0":e}}function Tl(n){return{integerValue:""+n}}function u_(n,e){return jg(e)?Tl(e):El(n,e)}/**
940
940
  * @license
941
941
  * Copyright 2018 Google LLC
942
942
  *
@@ -951,7 +951,7 @@
951
951
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
952
952
  * See the License for the specific language governing permissions and
953
953
  * limitations under the License.
954
- */class bs{constructor(){this._=void 0}}function Qg(t,e,n){return t instanceof Cs?function(s,i){const o={fields:{__type__:{stringValue:"server_timestamp"},__local_write_time__:{timestampValue:{seconds:s.seconds,nanos:s.nanoseconds}}}};return i&&Ts(i)&&(i=So(i)),i&&(o.fields.__previous_value__=i),{mapValue:o}}(n,e):t instanceof _r?pl(t,e):t instanceof yr?ml(t,e):function(s,i){const o=fl(s,i),a=gl(o)+gl(s.Ie);return Co(o)&&Co(s.Ie)?dl(a):hl(s.serializer,a)}(t,e)}function Yg(t,e,n){return t instanceof _r?pl(t,e):t instanceof yr?ml(t,e):n}function fl(t,e){return t instanceof ks?function(r){return Co(r)||function(i){return!!i&&"doubleValue"in i}(r)}(e)?e:{integerValue:0}:null}class Cs extends bs{}class _r extends bs{constructor(e){super(),this.elements=e}}function pl(t,e){const n=_l(e);for(const r of t.elements)n.some(s=>je(s,r))||n.push(r);return{arrayValue:{values:n}}}class yr extends bs{constructor(e){super(),this.elements=e}}function ml(t,e){let n=_l(e);for(const r of t.elements)n=n.filter(s=>!je(s,r));return{arrayValue:{values:n}}}class ks extends bs{constructor(e,n){super(),this.serializer=e,this.Ie=n}}function gl(t){return G(t.integerValue||t.doubleValue)}function _l(t){return ko(t)&&t.arrayValue.values?t.arrayValue.values.slice():[]}function Xg(t,e){return t.field.isEqual(e.field)&&function(r,s){return r instanceof _r&&s instanceof _r||r instanceof yr&&s instanceof yr?on(r.elements,s.elements,je):r instanceof ks&&s instanceof ks?je(r.Ie,s.Ie):r instanceof Cs&&s instanceof Cs}(t.transform,e.transform)}class Jg{constructor(e,n){this.version=e,this.transformResults=n}}class Pe{constructor(e,n){this.updateTime=e,this.exists=n}static none(){return new Pe}static exists(e){return new Pe(void 0,e)}static updateTime(e){return new Pe(e)}get isNone(){return this.updateTime===void 0&&this.exists===void 0}isEqual(e){return this.exists===e.exists&&(this.updateTime?!!e.updateTime&&this.updateTime.isEqual(e.updateTime):!e.updateTime)}}function Ds(t,e){return t.updateTime!==void 0?e.isFoundDocument()&&e.version.isEqual(t.updateTime):t.exists===void 0||t.exists===e.isFoundDocument()}class Ns{}function yl(t,e){if(!t.hasLocalMutations||e&&e.fields.length===0)return null;if(e===null)return t.isNoDocument()?new Os(t.key,Pe.none()):new Er(t.key,t.data,Pe.none());{const n=t.data,r=me.empty();let s=new se(ne.comparator);for(let i of e.fields)if(!s.has(i)){let o=n.field(i);o===null&&i.length>1&&(i=i.popLast(),o=n.field(i)),o===null?r.delete(i):r.set(i,o),s=s.add(i)}return new mt(t.key,r,new Te(s.toArray()),Pe.none())}}function Zg(t,e,n){t instanceof Er?function(s,i,o){const a=s.value.clone(),c=Tl(s.fieldTransforms,i,o.transformResults);a.setAll(c),i.convertToFoundDocument(o.version,a).setHasCommittedMutations()}(t,e,n):t instanceof mt?function(s,i,o){if(!Ds(s.precondition,i))return void i.convertToUnknownDocument(o.version);const a=Tl(s.fieldTransforms,i,o.transformResults),c=i.data;c.setAll(El(s)),c.setAll(a),i.convertToFoundDocument(o.version,c).setHasCommittedMutations()}(t,e,n):function(s,i,o){i.convertToNoDocument(o.version).setHasCommittedMutations()}(0,e,n)}function vr(t,e,n,r){return t instanceof Er?function(i,o,a,c){if(!Ds(i.precondition,o))return a;const u=i.value.clone(),l=wl(i.fieldTransforms,c,o);return u.setAll(l),o.convertToFoundDocument(o.version,u).setHasLocalMutations(),null}(t,e,n,r):t instanceof mt?function(i,o,a,c){if(!Ds(i.precondition,o))return a;const u=wl(i.fieldTransforms,c,o),l=o.data;return l.setAll(El(i)),l.setAll(u),o.convertToFoundDocument(o.version,l).setHasLocalMutations(),a===null?null:a.unionWith(i.fieldMask.fields).unionWith(i.fieldTransforms.map(h=>h.field))}(t,e,n,r):function(i,o,a){return Ds(i.precondition,o)?(o.convertToNoDocument(o.version).setHasLocalMutations(),null):a}(t,e,n)}function e_(t,e){let n=null;for(const r of t.fieldTransforms){const s=e.data.field(r.field),i=fl(r.transform,s||null);i!=null&&(n===null&&(n=me.empty()),n.set(r.field,i))}return n||null}function vl(t,e){return t.type===e.type&&!!t.key.isEqual(e.key)&&!!t.precondition.isEqual(e.precondition)&&!!function(r,s){return r===void 0&&s===void 0||!(!r||!s)&&on(r,s,(i,o)=>Xg(i,o))}(t.fieldTransforms,e.fieldTransforms)&&(t.type===0?t.value.isEqual(e.value):t.type!==1||t.data.isEqual(e.data)&&t.fieldMask.isEqual(e.fieldMask))}class Er extends Ns{constructor(e,n,r,s=[]){super(),this.key=e,this.value=n,this.precondition=r,this.fieldTransforms=s,this.type=0}getFieldMask(){return null}}class mt extends Ns{constructor(e,n,r,s,i=[]){super(),this.key=e,this.data=n,this.fieldMask=r,this.precondition=s,this.fieldTransforms=i,this.type=1}getFieldMask(){return this.fieldMask}}function El(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 Tl(t,e,n){const r=new Map;F(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,Yg(o,a,n[s]))}return r}function wl(t,e,n){const r=new Map;for(const s of t){const i=s.transform,o=n.data.field(s.field);r.set(s.field,Qg(i,o,e))}return r}class Os extends Ns{constructor(e,n){super(),this.key=e,this.precondition=n,this.type=2,this.fieldTransforms=[]}getFieldMask(){return null}}class t_ extends Ns{constructor(e,n){super(),this.key=e,this.precondition=n,this.type=3,this.fieldTransforms=[]}getFieldMask(){return null}}/**
954
+ */class Os{constructor(){this._=void 0}}function l_(n,e,t){return n instanceof Vs?function(s,i){const o={fields:{__type__:{stringValue:"server_timestamp"},__local_write_time__:{timestampValue:{seconds:s.seconds,nanos:s.nanoseconds}}}};return i&&Ps(i)&&(i=Do(i)),i&&(o.fields.__previous_value__=i),{mapValue:o}}(t,e):n instanceof Ir?Il(n,e):n instanceof Ar?Al(n,e):function(s,i){const o=wl(s,i),a=Rl(o)+Rl(s.Ie);return Oo(o)&&Oo(s.Ie)?Tl(a):El(s.serializer,a)}(n,e)}function h_(n,e,t){return n instanceof Ir?Il(n,e):n instanceof Ar?Al(n,e):t}function wl(n,e){return n instanceof Ls?function(r){return Oo(r)||function(i){return!!i&&"doubleValue"in i}(r)}(e)?e:{integerValue:0}:null}class Vs extends Os{}class Ir extends Os{constructor(e){super(),this.elements=e}}function Il(n,e){const t=Pl(e);for(const r of n.elements)t.some(s=>ze(s,r))||t.push(r);return{arrayValue:{values:t}}}class Ar extends Os{constructor(e){super(),this.elements=e}}function Al(n,e){let t=Pl(e);for(const r of n.elements)t=t.filter(s=>!ze(s,r));return{arrayValue:{values:t}}}class Ls extends Os{constructor(e,t){super(),this.serializer=e,this.Ie=t}}function Rl(n){return G(n.integerValue||n.doubleValue)}function Pl(n){return Vo(n)&&n.arrayValue.values?n.arrayValue.values.slice():[]}function d_(n,e){return n.field.isEqual(e.field)&&function(r,s){return r instanceof Ir&&s instanceof Ir||r instanceof Ar&&s instanceof Ar?un(r.elements,s.elements,ze):r instanceof Ls&&s instanceof Ls?ze(r.Ie,s.Ie):r instanceof Vs&&s instanceof Vs}(n.transform,e.transform)}class f_{constructor(e,t){this.version=e,this.transformResults=t}}class Ce{constructor(e,t){this.updateTime=e,this.exists=t}static none(){return new Ce}static exists(e){return new Ce(void 0,e)}static updateTime(e){return new Ce(e)}get isNone(){return this.updateTime===void 0&&this.exists===void 0}isEqual(e){return this.exists===e.exists&&(this.updateTime?!!e.updateTime&&this.updateTime.isEqual(e.updateTime):!e.updateTime)}}function Ms(n,e){return n.updateTime!==void 0?e.isFoundDocument()&&e.version.isEqual(n.updateTime):n.exists===void 0||n.exists===e.isFoundDocument()}class xs{}function Sl(n,e){if(!n.hasLocalMutations||e&&e.fields.length===0)return null;if(e===null)return n.isNoDocument()?new Us(n.key,Ce.none()):new Pr(n.key,n.data,Ce.none());{const t=n.data,r=_e.empty();let s=new se(ne.comparator);for(let i of e.fields)if(!s.has(i)){let o=t.field(i);o===null&&i.length>1&&(i=i.popLast(),o=t.field(i)),o===null?r.delete(i):r.set(i,o),s=s.add(i)}return new vt(n.key,r,new Ie(s.toArray()),Ce.none())}}function p_(n,e,t){n instanceof Pr?function(s,i,o){const a=s.value.clone(),c=kl(s.fieldTransforms,i,o.transformResults);a.setAll(c),i.convertToFoundDocument(o.version,a).setHasCommittedMutations()}(n,e,t):n instanceof vt?function(s,i,o){if(!Ms(s.precondition,i))return void i.convertToUnknownDocument(o.version);const a=kl(s.fieldTransforms,i,o.transformResults),c=i.data;c.setAll(Cl(s)),c.setAll(a),i.convertToFoundDocument(o.version,c).setHasCommittedMutations()}(n,e,t):function(s,i,o){i.convertToNoDocument(o.version).setHasCommittedMutations()}(0,e,t)}function Rr(n,e,t,r){return n instanceof Pr?function(i,o,a,c){if(!Ms(i.precondition,o))return a;const u=i.value.clone(),l=Dl(i.fieldTransforms,c,o);return u.setAll(l),o.convertToFoundDocument(o.version,u).setHasLocalMutations(),null}(n,e,t,r):n instanceof vt?function(i,o,a,c){if(!Ms(i.precondition,o))return a;const u=Dl(i.fieldTransforms,c,o),l=o.data;return l.setAll(Cl(i)),l.setAll(u),o.convertToFoundDocument(o.version,l).setHasLocalMutations(),a===null?null:a.unionWith(i.fieldMask.fields).unionWith(i.fieldTransforms.map(h=>h.field))}(n,e,t,r):function(i,o,a){return Ms(i.precondition,o)?(o.convertToNoDocument(o.version).setHasLocalMutations(),null):a}(n,e,t)}function m_(n,e){let t=null;for(const r of n.fieldTransforms){const s=e.data.field(r.field),i=wl(r.transform,s||null);i!=null&&(t===null&&(t=_e.empty()),t.set(r.field,i))}return t||null}function bl(n,e){return n.type===e.type&&!!n.key.isEqual(e.key)&&!!n.precondition.isEqual(e.precondition)&&!!function(r,s){return r===void 0&&s===void 0||!(!r||!s)&&un(r,s,(i,o)=>d_(i,o))}(n.fieldTransforms,e.fieldTransforms)&&(n.type===0?n.value.isEqual(e.value):n.type!==1||n.data.isEqual(e.data)&&n.fieldMask.isEqual(e.fieldMask))}class Pr extends xs{constructor(e,t,r,s=[]){super(),this.key=e,this.value=t,this.precondition=r,this.fieldTransforms=s,this.type=0}getFieldMask(){return null}}class vt extends xs{constructor(e,t,r,s,i=[]){super(),this.key=e,this.data=t,this.fieldMask=r,this.precondition=s,this.fieldTransforms=i,this.type=1}getFieldMask(){return this.fieldMask}}function Cl(n){const e=new Map;return n.fieldMask.fields.forEach(t=>{if(!t.isEmpty()){const r=n.data.field(t);e.set(t,r)}}),e}function kl(n,e,t){const r=new Map;F(n.length===t.length);for(let s=0;s<t.length;s++){const i=n[s],o=i.transform,a=e.data.field(i.field);r.set(i.field,h_(o,a,t[s]))}return r}function Dl(n,e,t){const r=new Map;for(const s of n){const i=s.transform,o=t.data.field(s.field);r.set(s.field,l_(i,o,e))}return r}class Us extends xs{constructor(e,t){super(),this.key=e,this.precondition=t,this.type=2,this.fieldTransforms=[]}getFieldMask(){return null}}class g_ extends xs{constructor(e,t){super(),this.key=e,this.precondition=t,this.type=3,this.fieldTransforms=[]}getFieldMask(){return null}}/**
955
955
  * @license
956
956
  * Copyright 2017 Google LLC
957
957
  *
@@ -966,7 +966,7 @@
966
966
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
967
967
  * See the License for the specific language governing permissions and
968
968
  * limitations under the License.
969
- */class n_{constructor(e,n,r,s){this.batchId=e,this.localWriteTime=n,this.baseMutations=r,this.mutations=s}applyToRemoteDocument(e,n){const r=n.mutationResults;for(let s=0;s<this.mutations.length;s++){const i=this.mutations[s];i.key.isEqual(e.key)&&Zg(i,e,r[s])}}applyToLocalView(e,n){for(const r of this.baseMutations)r.key.isEqual(e.key)&&(n=vr(r,e,n,this.localWriteTime));for(const r of this.mutations)r.key.isEqual(e.key)&&(n=vr(r,e,n,this.localWriteTime));return n}applyToLocalDocumentSet(e,n){const r=ll();return this.mutations.forEach(s=>{const i=e.get(s.key),o=i.overlayedDocument;let a=this.applyToLocalView(o,i.mutatedFields);a=n.has(s.key)?null:a;const c=yl(o,a);c!==null&&r.set(s.key,c),o.isValidDocument()||o.convertToNoDocument(S.min())}),r}keys(){return this.mutations.reduce((e,n)=>e.add(n.key),D())}isEqual(e){return this.batchId===e.batchId&&on(this.mutations,e.mutations,(n,r)=>vl(n,r))&&on(this.baseMutations,e.baseMutations,(n,r)=>vl(n,r))}}class Uo{constructor(e,n,r,s){this.batch=e,this.commitVersion=n,this.mutationResults=r,this.docVersions=s}static from(e,n,r){F(e.mutations.length===r.length);let s=function(){return zg}();const i=e.mutations;for(let o=0;o<i.length;o++)s=s.insert(i[o].key,r[o].version);return new Uo(e,n,r,s)}}/**
969
+ */class __{constructor(e,t,r,s){this.batchId=e,this.localWriteTime=t,this.baseMutations=r,this.mutations=s}applyToRemoteDocument(e,t){const r=t.mutationResults;for(let s=0;s<this.mutations.length;s++){const i=this.mutations[s];i.key.isEqual(e.key)&&p_(i,e,r[s])}}applyToLocalView(e,t){for(const r of this.baseMutations)r.key.isEqual(e.key)&&(t=Rr(r,e,t,this.localWriteTime));for(const r of this.mutations)r.key.isEqual(e.key)&&(t=Rr(r,e,t,this.localWriteTime));return t}applyToLocalDocumentSet(e,t){const r=vl();return this.mutations.forEach(s=>{const i=e.get(s.key),o=i.overlayedDocument;let a=this.applyToLocalView(o,i.mutatedFields);a=t.has(s.key)?null:a;const c=Sl(o,a);c!==null&&r.set(s.key,c),o.isValidDocument()||o.convertToNoDocument(S.min())}),r}keys(){return this.mutations.reduce((e,t)=>e.add(t.key),D())}isEqual(e){return this.batchId===e.batchId&&un(this.mutations,e.mutations,(t,r)=>bl(t,r))&&un(this.baseMutations,e.baseMutations,(t,r)=>bl(t,r))}}class qo{constructor(e,t,r,s){this.batch=e,this.commitVersion=t,this.mutationResults=r,this.docVersions=s}static from(e,t,r){F(e.mutations.length===r.length);let s=function(){return i_}();const i=e.mutations;for(let o=0;o<i.length;o++)s=s.insert(i[o].key,r[o].version);return new qo(e,t,r,s)}}/**
970
970
  * @license
971
971
  * Copyright 2022 Google LLC
972
972
  *
@@ -981,7 +981,7 @@
981
981
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
982
982
  * See the License for the specific language governing permissions and
983
983
  * limitations under the License.
984
- */class r_{constructor(e,n){this.largestBatchId=e,this.mutation=n}getKey(){return this.mutation.key}isEqual(e){return e!==null&&this.mutation===e.mutation}toString(){return`Overlay{
984
+ */class y_{constructor(e,t){this.largestBatchId=e,this.mutation=t}getKey(){return this.mutation.key}isEqual(e){return e!==null&&this.mutation===e.mutation}toString(){return`Overlay{
985
985
  largestBatchId: ${this.largestBatchId},
986
986
  mutation: ${this.mutation.toString()}
987
987
  }`}}/**
@@ -999,7 +999,7 @@
999
999
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1000
1000
  * See the License for the specific language governing permissions and
1001
1001
  * limitations under the License.
1002
- */class s_{constructor(e,n,r){this.alias=e,this.aggregateType=n,this.fieldPath=r}}/**
1002
+ */class v_{constructor(e,t,r){this.alias=e,this.aggregateType=t,this.fieldPath=r}}/**
1003
1003
  * @license
1004
1004
  * Copyright 2017 Google LLC
1005
1005
  *
@@ -1014,7 +1014,7 @@
1014
1014
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1015
1015
  * See the License for the specific language governing permissions and
1016
1016
  * limitations under the License.
1017
- */class i_{constructor(e,n){this.count=e,this.unchangedNames=n}}/**
1017
+ */class E_{constructor(e,t){this.count=e,this.unchangedNames=t}}/**
1018
1018
  * @license
1019
1019
  * Copyright 2017 Google LLC
1020
1020
  *
@@ -1029,7 +1029,7 @@
1029
1029
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1030
1030
  * See the License for the specific language governing permissions and
1031
1031
  * limitations under the License.
1032
- */var Q,V;function o_(t){switch(t){default:return A();case p.CANCELLED:case p.UNKNOWN:case p.DEADLINE_EXCEEDED:case p.RESOURCE_EXHAUSTED:case p.INTERNAL:case p.UNAVAILABLE:case p.UNAUTHENTICATED:return!1;case p.INVALID_ARGUMENT:case p.NOT_FOUND:case p.ALREADY_EXISTS:case p.PERMISSION_DENIED:case p.FAILED_PRECONDITION:case p.ABORTED:case p.OUT_OF_RANGE:case p.UNIMPLEMENTED:case p.DATA_LOSS:return!0}}function Il(t){if(t===void 0)return Be("GRPC error has no .code"),p.UNKNOWN;switch(t){case Q.OK:return p.OK;case Q.CANCELLED:return p.CANCELLED;case Q.UNKNOWN:return p.UNKNOWN;case Q.DEADLINE_EXCEEDED:return p.DEADLINE_EXCEEDED;case Q.RESOURCE_EXHAUSTED:return p.RESOURCE_EXHAUSTED;case Q.INTERNAL:return p.INTERNAL;case Q.UNAVAILABLE:return p.UNAVAILABLE;case Q.UNAUTHENTICATED:return p.UNAUTHENTICATED;case Q.INVALID_ARGUMENT:return p.INVALID_ARGUMENT;case Q.NOT_FOUND:return p.NOT_FOUND;case Q.ALREADY_EXISTS:return p.ALREADY_EXISTS;case Q.PERMISSION_DENIED:return p.PERMISSION_DENIED;case Q.FAILED_PRECONDITION:return p.FAILED_PRECONDITION;case Q.ABORTED:return p.ABORTED;case Q.OUT_OF_RANGE:return p.OUT_OF_RANGE;case Q.UNIMPLEMENTED:return p.UNIMPLEMENTED;case Q.DATA_LOSS:return p.DATA_LOSS;default:return A()}}(V=Q||(Q={}))[V.OK=0]="OK",V[V.CANCELLED=1]="CANCELLED",V[V.UNKNOWN=2]="UNKNOWN",V[V.INVALID_ARGUMENT=3]="INVALID_ARGUMENT",V[V.DEADLINE_EXCEEDED=4]="DEADLINE_EXCEEDED",V[V.NOT_FOUND=5]="NOT_FOUND",V[V.ALREADY_EXISTS=6]="ALREADY_EXISTS",V[V.PERMISSION_DENIED=7]="PERMISSION_DENIED",V[V.UNAUTHENTICATED=16]="UNAUTHENTICATED",V[V.RESOURCE_EXHAUSTED=8]="RESOURCE_EXHAUSTED",V[V.FAILED_PRECONDITION=9]="FAILED_PRECONDITION",V[V.ABORTED=10]="ABORTED",V[V.OUT_OF_RANGE=11]="OUT_OF_RANGE",V[V.UNIMPLEMENTED=12]="UNIMPLEMENTED",V[V.INTERNAL=13]="INTERNAL",V[V.UNAVAILABLE=14]="UNAVAILABLE",V[V.DATA_LOSS=15]="DATA_LOSS";/**
1032
+ */var Q,V;function T_(n){switch(n){default:return A();case p.CANCELLED:case p.UNKNOWN:case p.DEADLINE_EXCEEDED:case p.RESOURCE_EXHAUSTED:case p.INTERNAL:case p.UNAVAILABLE:case p.UNAUTHENTICATED:return!1;case p.INVALID_ARGUMENT:case p.NOT_FOUND:case p.ALREADY_EXISTS:case p.PERMISSION_DENIED:case p.FAILED_PRECONDITION:case p.ABORTED:case p.OUT_OF_RANGE:case p.UNIMPLEMENTED:case p.DATA_LOSS:return!0}}function Nl(n){if(n===void 0)return $e("GRPC error has no .code"),p.UNKNOWN;switch(n){case Q.OK:return p.OK;case Q.CANCELLED:return p.CANCELLED;case Q.UNKNOWN:return p.UNKNOWN;case Q.DEADLINE_EXCEEDED:return p.DEADLINE_EXCEEDED;case Q.RESOURCE_EXHAUSTED:return p.RESOURCE_EXHAUSTED;case Q.INTERNAL:return p.INTERNAL;case Q.UNAVAILABLE:return p.UNAVAILABLE;case Q.UNAUTHENTICATED:return p.UNAUTHENTICATED;case Q.INVALID_ARGUMENT:return p.INVALID_ARGUMENT;case Q.NOT_FOUND:return p.NOT_FOUND;case Q.ALREADY_EXISTS:return p.ALREADY_EXISTS;case Q.PERMISSION_DENIED:return p.PERMISSION_DENIED;case Q.FAILED_PRECONDITION:return p.FAILED_PRECONDITION;case Q.ABORTED:return p.ABORTED;case Q.OUT_OF_RANGE:return p.OUT_OF_RANGE;case Q.UNIMPLEMENTED:return p.UNIMPLEMENTED;case Q.DATA_LOSS:return p.DATA_LOSS;default:return A()}}(V=Q||(Q={}))[V.OK=0]="OK",V[V.CANCELLED=1]="CANCELLED",V[V.UNKNOWN=2]="UNKNOWN",V[V.INVALID_ARGUMENT=3]="INVALID_ARGUMENT",V[V.DEADLINE_EXCEEDED=4]="DEADLINE_EXCEEDED",V[V.NOT_FOUND=5]="NOT_FOUND",V[V.ALREADY_EXISTS=6]="ALREADY_EXISTS",V[V.PERMISSION_DENIED=7]="PERMISSION_DENIED",V[V.UNAUTHENTICATED=16]="UNAUTHENTICATED",V[V.RESOURCE_EXHAUSTED=8]="RESOURCE_EXHAUSTED",V[V.FAILED_PRECONDITION=9]="FAILED_PRECONDITION",V[V.ABORTED=10]="ABORTED",V[V.OUT_OF_RANGE=11]="OUT_OF_RANGE",V[V.UNIMPLEMENTED=12]="UNIMPLEMENTED",V[V.INTERNAL=13]="INTERNAL",V[V.UNAVAILABLE=14]="UNAVAILABLE",V[V.DATA_LOSS=15]="DATA_LOSS";/**
1033
1033
  * @license
1034
1034
  * Copyright 2023 Google LLC
1035
1035
  *
@@ -1044,7 +1044,7 @@
1044
1044
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1045
1045
  * See the License for the specific language governing permissions and
1046
1046
  * limitations under the License.
1047
- */function a_(){return new TextEncoder}/**
1047
+ */function w_(){return new TextEncoder}/**
1048
1048
  * @license
1049
1049
  * Copyright 2022 Google LLC
1050
1050
  *
@@ -1059,7 +1059,7 @@
1059
1059
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1060
1060
  * See the License for the specific language governing permissions and
1061
1061
  * limitations under the License.
1062
- */const c_=new nn([4294967295,4294967295],0);function Al(t){const e=a_().encode(t),n=new ug;return n.update(e),new Uint8Array(n.digest())}function Rl(t){const e=new DataView(t.buffer),n=e.getUint32(0,!0),r=e.getUint32(4,!0),s=e.getUint32(8,!0),i=e.getUint32(12,!0);return[new nn([n,r],0),new nn([s,i],0)]}class Fo{constructor(e,n,r){if(this.bitmap=e,this.padding=n,this.hashCount=r,n<0||n>=8)throw new Tr(`Invalid padding: ${n}`);if(r<0)throw new Tr(`Invalid hash count: ${r}`);if(e.length>0&&this.hashCount===0)throw new Tr(`Invalid hash count: ${r}`);if(e.length===0&&n!==0)throw new Tr(`Invalid padding when bitmap length is 0: ${n}`);this.Te=8*e.length-n,this.Ee=nn.fromNumber(this.Te)}de(e,n,r){let s=e.add(n.multiply(nn.fromNumber(r)));return s.compare(c_)===1&&(s=new nn([s.getBits(0),s.getBits(1)],0)),s.modulo(this.Ee).toNumber()}Ae(e){return(this.bitmap[Math.floor(e/8)]&1<<e%8)!=0}mightContain(e){if(this.Te===0)return!1;const n=Al(e),[r,s]=Rl(n);for(let i=0;i<this.hashCount;i++){const o=this.de(r,s,i);if(!this.Ae(o))return!1}return!0}static create(e,n,r){const s=e%8==0?0:8-e%8,i=new Uint8Array(Math.ceil(e/8)),o=new Fo(i,s,n);return r.forEach(a=>o.insert(a)),o}insert(e){if(this.Te===0)return;const n=Al(e),[r,s]=Rl(n);for(let i=0;i<this.hashCount;i++){const o=this.de(r,s,i);this.Re(o)}}Re(e){const n=Math.floor(e/8),r=e%8;this.bitmap[n]|=1<<r}}class Tr extends Error{constructor(){super(...arguments),this.name="BloomFilterError"}}/**
1062
+ */const I_=new on([4294967295,4294967295],0);function Ol(n){const e=w_().encode(n),t=new Ag;return t.update(e),new Uint8Array(t.digest())}function Vl(n){const e=new DataView(n.buffer),t=e.getUint32(0,!0),r=e.getUint32(4,!0),s=e.getUint32(8,!0),i=e.getUint32(12,!0);return[new on([t,r],0),new on([s,i],0)]}class $o{constructor(e,t,r){if(this.bitmap=e,this.padding=t,this.hashCount=r,t<0||t>=8)throw new Sr(`Invalid padding: ${t}`);if(r<0)throw new Sr(`Invalid hash count: ${r}`);if(e.length>0&&this.hashCount===0)throw new Sr(`Invalid hash count: ${r}`);if(e.length===0&&t!==0)throw new Sr(`Invalid padding when bitmap length is 0: ${t}`);this.Te=8*e.length-t,this.Ee=on.fromNumber(this.Te)}de(e,t,r){let s=e.add(t.multiply(on.fromNumber(r)));return s.compare(I_)===1&&(s=new on([s.getBits(0),s.getBits(1)],0)),s.modulo(this.Ee).toNumber()}Ae(e){return(this.bitmap[Math.floor(e/8)]&1<<e%8)!=0}mightContain(e){if(this.Te===0)return!1;const t=Ol(e),[r,s]=Vl(t);for(let i=0;i<this.hashCount;i++){const o=this.de(r,s,i);if(!this.Ae(o))return!1}return!0}static create(e,t,r){const s=e%8==0?0:8-e%8,i=new Uint8Array(Math.ceil(e/8)),o=new $o(i,s,t);return r.forEach(a=>o.insert(a)),o}insert(e){if(this.Te===0)return;const t=Ol(e),[r,s]=Vl(t);for(let i=0;i<this.hashCount;i++){const o=this.de(r,s,i);this.Re(o)}}Re(e){const t=Math.floor(e/8),r=e%8;this.bitmap[t]|=1<<r}}class Sr extends Error{constructor(){super(...arguments),this.name="BloomFilterError"}}/**
1063
1063
  * @license
1064
1064
  * Copyright 2017 Google LLC
1065
1065
  *
@@ -1074,7 +1074,7 @@
1074
1074
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1075
1075
  * See the License for the specific language governing permissions and
1076
1076
  * limitations under the License.
1077
- */class Vs{constructor(e,n,r,s,i){this.snapshotVersion=e,this.targetChanges=n,this.targetMismatches=r,this.documentUpdates=s,this.resolvedLimboDocuments=i}static createSynthesizedRemoteEventForCurrentChange(e,n,r){const s=new Map;return s.set(e,wr.createSynthesizedTargetChangeForCurrentChange(e,n,r)),new Vs(S.min(),s,new q(M),Ze(),D())}}class wr{constructor(e,n,r,s,i){this.resumeToken=e,this.current=n,this.addedDocuments=r,this.modifiedDocuments=s,this.removedDocuments=i}static createSynthesizedTargetChangeForCurrentChange(e,n,r){return new wr(r,n,D(),D(),D())}}/**
1077
+ */class Fs{constructor(e,t,r,s,i){this.snapshotVersion=e,this.targetChanges=t,this.targetMismatches=r,this.documentUpdates=s,this.resolvedLimboDocuments=i}static createSynthesizedRemoteEventForCurrentChange(e,t,r){const s=new Map;return s.set(e,br.createSynthesizedTargetChangeForCurrentChange(e,t,r)),new Fs(S.min(),s,new $(M),nt(),D())}}class br{constructor(e,t,r,s,i){this.resumeToken=e,this.current=t,this.addedDocuments=r,this.modifiedDocuments=s,this.removedDocuments=i}static createSynthesizedTargetChangeForCurrentChange(e,t,r){return new br(r,t,D(),D(),D())}}/**
1078
1078
  * @license
1079
1079
  * Copyright 2017 Google LLC
1080
1080
  *
@@ -1089,7 +1089,7 @@
1089
1089
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1090
1090
  * See the License for the specific language governing permissions and
1091
1091
  * limitations under the License.
1092
- */class Ls{constructor(e,n,r,s){this.Ve=e,this.removedTargetIds=n,this.key=r,this.me=s}}class Pl{constructor(e,n){this.targetId=e,this.fe=n}}class Sl{constructor(e,n,r=le.EMPTY_BYTE_STRING,s=null){this.state=e,this.targetIds=n,this.resumeToken=r,this.cause=s}}class bl{constructor(){this.ge=0,this.pe=kl(),this.ye=le.EMPTY_BYTE_STRING,this.we=!1,this.Se=!0}get current(){return this.we}get resumeToken(){return this.ye}get be(){return this.ge!==0}get De(){return this.Se}Ce(e){e.approximateByteSize()>0&&(this.Se=!0,this.ye=e)}ve(){let e=D(),n=D(),r=D();return this.pe.forEach((s,i)=>{switch(i){case 0:e=e.add(s);break;case 2:n=n.add(s);break;case 1:r=r.add(s);break;default:A()}}),new wr(this.ye,this.we,e,n,r)}Fe(){this.Se=!1,this.pe=kl()}Me(e,n){this.Se=!0,this.pe=this.pe.insert(e,n)}xe(e){this.Se=!0,this.pe=this.pe.remove(e)}Oe(){this.ge+=1}Ne(){this.ge-=1,F(this.ge>=0)}Be(){this.Se=!0,this.we=!0}}class u_{constructor(e){this.Le=e,this.ke=new Map,this.qe=Ze(),this.Qe=Cl(),this.Ke=new q(M)}$e(e){for(const n of e.Ve)e.me&&e.me.isFoundDocument()?this.Ue(n,e.me):this.We(n,e.key,e.me);for(const n of e.removedTargetIds)this.We(n,e.key,e.me)}Ge(e){this.forEachTarget(e,n=>{const r=this.ze(n);switch(e.state){case 0:this.je(n)&&r.Ce(e.resumeToken);break;case 1:r.Ne(),r.be||r.Fe(),r.Ce(e.resumeToken);break;case 2:r.Ne(),r.be||this.removeTarget(n);break;case 3:this.je(n)&&(r.Be(),r.Ce(e.resumeToken));break;case 4:this.je(n)&&(this.He(n),r.Ce(e.resumeToken));break;default:A()}})}forEachTarget(e,n){e.targetIds.length>0?e.targetIds.forEach(n):this.ke.forEach((r,s)=>{this.je(s)&&n(s)})}Je(e){const n=e.targetId,r=e.fe.count,s=this.Ye(n);if(s){const i=s.target;if(Vo(i))if(r===0){const o=new w(i.path);this.We(n,o,he.newNoDocument(o,S.min()))}else F(r===1);else{const o=this.Ze(n);if(o!==r){const a=this.Xe(e),c=a?this.et(a,e,o):1;if(c!==0){this.He(n);const u=c===2?"TargetPurposeExistenceFilterMismatchBloom":"TargetPurposeExistenceFilterMismatch";this.Ke=this.Ke.insert(n,u)}}}}}Xe(e){const n=e.fe.unchangedNames;if(!n||!n.bits)return null;const{bits:{bitmap:r="",padding:s=0},hashCount:i=0}=n;let o,a;try{o=xt(r).toUint8Array()}catch(c){if(c instanceof zu)return sn("Decoding the base64 bloom filter in existence filter failed ("+c.message+"); ignoring the bloom filter and falling back to full re-query."),null;throw c}try{a=new Fo(o,s,i)}catch(c){return sn(c instanceof Tr?"BloomFilter error: ":"Applying bloom filter failed: ",c),null}return a.Te===0?null:a}et(e,n,r){return n.fe.count===r-this.rt(e,n.targetId)?0:2}rt(e,n){const r=this.Le.getRemoteKeysForTarget(n);let s=0;return r.forEach(i=>{const o=this.Le.nt(),a=`projects/${o.projectId}/databases/${o.database}/documents/${i.path.canonicalString()}`;e.mightContain(a)||(this.We(n,i,null),s++)}),s}it(e){const n=new Map;this.ke.forEach((i,o)=>{const a=this.Ye(o);if(a){if(i.current&&Vo(a.target)){const c=new w(a.target.path);this.qe.get(c)!==null||this.st(o,c)||this.We(o,c,he.newNoDocument(c,e))}i.De&&(n.set(o,i.ve()),i.Fe())}});let r=D();this.Qe.forEach((i,o)=>{let a=!0;o.forEachWhile(c=>{const u=this.Ye(c);return!u||u.purpose==="TargetPurposeLimboResolution"||(a=!1,!1)}),a&&(r=r.add(i))}),this.qe.forEach((i,o)=>o.setReadTime(e));const s=new Vs(e,n,this.Ke,this.qe,r);return this.qe=Ze(),this.Qe=Cl(),this.Ke=new q(M),s}Ue(e,n){if(!this.je(e))return;const r=this.st(e,n.key)?2:0;this.ze(e).Me(n.key,r),this.qe=this.qe.insert(n.key,n),this.Qe=this.Qe.insert(n.key,this.ot(n.key).add(e))}We(e,n,r){if(!this.je(e))return;const s=this.ze(e);this.st(e,n)?s.Me(n,1):s.xe(n),this.Qe=this.Qe.insert(n,this.ot(n).delete(e)),r&&(this.qe=this.qe.insert(n,r))}removeTarget(e){this.ke.delete(e)}Ze(e){const n=this.ze(e).ve();return this.Le.getRemoteKeysForTarget(e).size+n.addedDocuments.size-n.removedDocuments.size}Oe(e){this.ze(e).Oe()}ze(e){let n=this.ke.get(e);return n||(n=new bl,this.ke.set(e,n)),n}ot(e){let n=this.Qe.get(e);return n||(n=new se(M),this.Qe=this.Qe.insert(e,n)),n}je(e){const n=this.Ye(e)!==null;return n||v("WatchChangeAggregator","Detected inactive target",e),n}Ye(e){const n=this.ke.get(e);return n&&n.be?null:this.Le._t(e)}He(e){this.ke.set(e,new bl),this.Le.getRemoteKeysForTarget(e).forEach(n=>{this.We(e,n,null)})}st(e,n){return this.Le.getRemoteKeysForTarget(e).has(n)}}function Cl(){return new q(w.comparator)}function kl(){return new q(w.comparator)}const l_={asc:"ASCENDING",desc:"DESCENDING"},h_={"<":"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"},d_={and:"AND",or:"OR"};class f_{constructor(e,n){this.databaseId=e,this.useProto3Json=n}}function Bo(t,e){return t.useProto3Json||ys(e)?e:{value:e}}function Ms(t,e){return t.useProto3Json?`${new Date(1e3*e.seconds).toISOString().replace(/\.\d*/,"").replace("Z","")}.${("000000000"+e.nanoseconds).slice(-9)}Z`:{seconds:""+e.seconds,nanos:e.nanoseconds}}function Dl(t,e){return t.useProto3Json?e.toBase64():e.toUint8Array()}function p_(t,e){return Ms(t,e.toTimestamp())}function qe(t){return F(!!t),S.fromTimestamp(function(n){const r=pt(n);return new Y(r.seconds,r.nanos)}(t))}function jo(t,e){return $o(t,e).canonicalString()}function $o(t,e){const n=function(s){return new B(["projects",s.projectId,"databases",s.database])}(t).child("documents");return e===void 0?n:n.child(e)}function Nl(t){const e=B.fromString(t);return F(Fl(e)),e}function qo(t,e){return jo(t.databaseId,e.path)}function zo(t,e){const n=Nl(e);if(n.get(1)!==t.databaseId.projectId)throw new g(p.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 g(p.INVALID_ARGUMENT,"Tried to deserialize key from different database: "+n.get(3)+" vs "+t.databaseId.database);return new w(Vl(n))}function Ol(t,e){return jo(t.databaseId,e)}function m_(t){const e=Nl(t);return e.length===4?B.emptyPath():Vl(e)}function Ho(t){return new B(["projects",t.databaseId.projectId,"databases",t.databaseId.database]).canonicalString()}function Vl(t){return F(t.length>4&&t.get(4)==="documents"),t.popFirst(5)}function Ll(t,e,n){return{name:qo(t,e),fields:n.value.mapValue.fields}}function g_(t,e){let n;if("targetChange"in e){e.targetChange;const r=function(u){return u==="NO_CHANGE"?0:u==="ADD"?1:u==="REMOVE"?2:u==="CURRENT"?3:u==="RESET"?4:A()}(e.targetChange.targetChangeType||"NO_CHANGE"),s=e.targetChange.targetIds||[],i=function(u,l){return u.useProto3Json?(F(l===void 0||typeof l=="string"),le.fromBase64String(l||"")):(F(l===void 0||l instanceof Uint8Array),le.fromUint8Array(l||new Uint8Array))}(t,e.targetChange.resumeToken),o=e.targetChange.cause,a=o&&function(u){const l=u.code===void 0?p.UNKNOWN:Il(u.code);return new g(l,u.message||"")}(o);n=new Sl(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=zo(t,r.document.name),i=qe(r.document.updateTime),o=r.document.createTime?qe(r.document.createTime):S.min(),a=new me({mapValue:{fields:r.document.fields}}),c=he.newFoundDocument(s,i,o,a),u=r.targetIds||[],l=r.removedTargetIds||[];n=new Ls(u,l,c.key,c)}else if("documentDelete"in e){e.documentDelete;const r=e.documentDelete;r.document;const s=zo(t,r.document),i=r.readTime?qe(r.readTime):S.min(),o=he.newNoDocument(s,i),a=r.removedTargetIds||[];n=new Ls([],a,o.key,o)}else if("documentRemove"in e){e.documentRemove;const r=e.documentRemove;r.document;const s=zo(t,r.document),i=r.removedTargetIds||[];n=new Ls([],i,s,null)}else{if(!("filter"in e))return A();{e.filter;const r=e.filter;r.targetId;const{count:s=0,unchangedNames:i}=r,o=new i_(s,i),a=r.targetId;n=new Pl(a,o)}}return n}function __(t,e){let n;if(e instanceof Er)n={update:Ll(t,e.key,e.value)};else if(e instanceof Os)n={delete:qo(t,e.key)};else if(e instanceof mt)n={update:Ll(t,e.key,e.data),updateMask:R_(e.fieldMask)};else{if(!(e instanceof t_))return A();n={verify:qo(t,e.key)}}return e.fieldTransforms.length>0&&(n.updateTransforms=e.fieldTransforms.map(r=>function(i,o){const a=o.transform;if(a instanceof Cs)return{fieldPath:o.field.canonicalString(),setToServerValue:"REQUEST_TIME"};if(a instanceof _r)return{fieldPath:o.field.canonicalString(),appendMissingElements:{values:a.elements}};if(a instanceof yr)return{fieldPath:o.field.canonicalString(),removeAllFromArray:{values:a.elements}};if(a instanceof ks)return{fieldPath:o.field.canonicalString(),increment:a.Ie};throw A()}(0,r))),e.precondition.isNone||(n.currentDocument=function(s,i){return i.updateTime!==void 0?{updateTime:p_(s,i.updateTime)}:i.exists!==void 0?{exists:i.exists}:A()}(t,e.precondition)),n}function y_(t,e){return t&&t.length>0?(F(e!==void 0),t.map(n=>function(s,i){let o=s.updateTime?qe(s.updateTime):qe(i);return o.isEqual(S.min())&&(o=qe(i)),new Jg(o,s.transformResults||[])}(n,e))):[]}function v_(t,e){return{documents:[Ol(t,e.path)]}}function Ml(t,e){const n={structuredQuery:{}},r=e.path;let s;e.collectionGroup!==null?(s=r,n.structuredQuery.from=[{collectionId:e.collectionGroup,allDescendants:!0}]):(s=r.popLast(),n.structuredQuery.from=[{collectionId:r.lastSegment()}]),n.parent=Ol(t,s);const i=function(u){if(u.length!==0)return Ul(Ne.create(u,"and"))}(e.filters);i&&(n.structuredQuery.where=i);const o=function(u){if(u.length!==0)return u.map(l=>function(d){return{field:gt(d.field),direction:w_(d.dir)}}(l))}(e.orderBy);o&&(n.structuredQuery.orderBy=o);const a=Bo(t,e.limit);return a!==null&&(n.structuredQuery.limit=a),e.startAt&&(n.structuredQuery.startAt=function(u){return{before:u.inclusive,values:u.position}}(e.startAt)),e.endAt&&(n.structuredQuery.endAt=function(u){return{before:!u.inclusive,values:u.position}}(e.endAt)),{ut:n,parent:s}}function E_(t){let e=m_(t.parent);const n=t.structuredQuery,r=n.from?n.from.length:0;let s=null;if(r>0){F(r===1);const l=n.from[0];l.allDescendants?s=l.collectionId:e=e.child(l.collectionId)}let i=[];n.where&&(i=function(h){const d=xl(h);return d instanceof Ne&&Zu(d)?d.getFilters():[d]}(n.where));let o=[];n.orderBy&&(o=function(h){return h.map(d=>function(E){return new pr(fn(E.field),function(_){switch(_){case"ASCENDING":return"asc";case"DESCENDING":return"desc";default:return}}(E.direction))}(d))}(n.orderBy));let a=null;n.limit&&(a=function(h){let d;return d=typeof h=="object"?h.value:h,ys(d)?null:d}(n.limit));let c=null;n.startAt&&(c=function(h){const d=!!h.before,f=h.values||[];return new un(f,d)}(n.startAt));let u=null;return n.endAt&&(u=function(h){const d=!h.before,f=h.values||[];return new un(f,d)}(n.endAt)),Bg(e,s,o,i,a,"F",c,u)}function T_(t,e){const n=function(s){switch(s){case"TargetPurposeListen":return null;case"TargetPurposeExistenceFilterMismatch":return"existence-filter-mismatch";case"TargetPurposeExistenceFilterMismatchBloom":return"existence-filter-mismatch-bloom";case"TargetPurposeLimboResolution":return"limbo-document";default:return A()}}(e.purpose);return n==null?null:{"goog-listen-tags":n}}function xl(t){return t.unaryFilter!==void 0?function(n){switch(n.unaryFilter.op){case"IS_NAN":const r=fn(n.unaryFilter.field);return K.create(r,"==",{doubleValue:NaN});case"IS_NULL":const s=fn(n.unaryFilter.field);return K.create(s,"==",{nullValue:"NULL_VALUE"});case"IS_NOT_NAN":const i=fn(n.unaryFilter.field);return K.create(i,"!=",{doubleValue:NaN});case"IS_NOT_NULL":const o=fn(n.unaryFilter.field);return K.create(o,"!=",{nullValue:"NULL_VALUE"});default:return A()}}(t):t.fieldFilter!==void 0?function(n){return K.create(fn(n.fieldFilter.field),function(s){switch(s){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 A()}}(n.fieldFilter.op),n.fieldFilter.value)}(t):t.compositeFilter!==void 0?function(n){return Ne.create(n.compositeFilter.filters.map(r=>xl(r)),function(s){switch(s){case"AND":return"and";case"OR":return"or";default:return A()}}(n.compositeFilter.op))}(t):A()}function w_(t){return l_[t]}function I_(t){return h_[t]}function A_(t){return d_[t]}function gt(t){return{fieldPath:t.canonicalString()}}function fn(t){return ne.fromServerFormat(t.fieldPath)}function Ul(t){return t instanceof K?function(n){if(n.op==="=="){if(Gu(n.value))return{unaryFilter:{field:gt(n.field),op:"IS_NAN"}};if(Wu(n.value))return{unaryFilter:{field:gt(n.field),op:"IS_NULL"}}}else if(n.op==="!="){if(Gu(n.value))return{unaryFilter:{field:gt(n.field),op:"IS_NOT_NAN"}};if(Wu(n.value))return{unaryFilter:{field:gt(n.field),op:"IS_NOT_NULL"}}}return{fieldFilter:{field:gt(n.field),op:I_(n.op),value:n.value}}}(t):t instanceof Ne?function(n){const r=n.getFilters().map(s=>Ul(s));return r.length===1?r[0]:{compositeFilter:{op:A_(n.op),filters:r}}}(t):A()}function R_(t){const e=[];return t.fields.forEach(n=>e.push(n.canonicalString())),{fieldPaths:e}}function Fl(t){return t.length>=4&&t.get(0)==="projects"&&t.get(2)==="databases"}/**
1092
+ */class Bs{constructor(e,t,r,s){this.Ve=e,this.removedTargetIds=t,this.key=r,this.me=s}}class Ll{constructor(e,t){this.targetId=e,this.fe=t}}class Ml{constructor(e,t,r=le.EMPTY_BYTE_STRING,s=null){this.state=e,this.targetIds=t,this.resumeToken=r,this.cause=s}}class xl{constructor(){this.ge=0,this.pe=Fl(),this.ye=le.EMPTY_BYTE_STRING,this.we=!1,this.Se=!0}get current(){return this.we}get resumeToken(){return this.ye}get be(){return this.ge!==0}get De(){return this.Se}Ce(e){e.approximateByteSize()>0&&(this.Se=!0,this.ye=e)}ve(){let e=D(),t=D(),r=D();return this.pe.forEach((s,i)=>{switch(i){case 0:e=e.add(s);break;case 2:t=t.add(s);break;case 1:r=r.add(s);break;default:A()}}),new br(this.ye,this.we,e,t,r)}Fe(){this.Se=!1,this.pe=Fl()}Me(e,t){this.Se=!0,this.pe=this.pe.insert(e,t)}xe(e){this.Se=!0,this.pe=this.pe.remove(e)}Oe(){this.ge+=1}Ne(){this.ge-=1,F(this.ge>=0)}Le(){this.Se=!0,this.we=!0}}class A_{constructor(e){this.Be=e,this.ke=new Map,this.qe=nt(),this.Qe=Ul(),this.Ke=new $(M)}$e(e){for(const t of e.Ve)e.me&&e.me.isFoundDocument()?this.Ue(t,e.me):this.We(t,e.key,e.me);for(const t of e.removedTargetIds)this.We(t,e.key,e.me)}Ge(e){this.forEachTarget(e,t=>{const r=this.ze(t);switch(e.state){case 0:this.je(t)&&r.Ce(e.resumeToken);break;case 1:r.Ne(),r.be||r.Fe(),r.Ce(e.resumeToken);break;case 2:r.Ne(),r.be||this.removeTarget(t);break;case 3:this.je(t)&&(r.Le(),r.Ce(e.resumeToken));break;case 4:this.je(t)&&(this.He(t),r.Ce(e.resumeToken));break;default:A()}})}forEachTarget(e,t){e.targetIds.length>0?e.targetIds.forEach(t):this.ke.forEach((r,s)=>{this.je(s)&&t(s)})}Je(e){const t=e.targetId,r=e.fe.count,s=this.Ye(t);if(s){const i=s.target;if(Uo(i))if(r===0){const o=new w(i.path);this.We(t,o,he.newNoDocument(o,S.min()))}else F(r===1);else{const o=this.Ze(t);if(o!==r){const a=this.Xe(e),c=a?this.et(a,e,o):1;if(c!==0){this.He(t);const u=c===2?"TargetPurposeExistenceFilterMismatchBloom":"TargetPurposeExistenceFilterMismatch";this.Ke=this.Ke.insert(t,u)}}}}}Xe(e){const t=e.fe.unchangedNames;if(!t||!t.bits)return null;const{bits:{bitmap:r="",padding:s=0},hashCount:i=0}=t;let o,a;try{o=jt(r).toUint8Array()}catch(c){if(c instanceof Zu)return cn("Decoding the base64 bloom filter in existence filter failed ("+c.message+"); ignoring the bloom filter and falling back to full re-query."),null;throw c}try{a=new $o(o,s,i)}catch(c){return cn(c instanceof Sr?"BloomFilter error: ":"Applying bloom filter failed: ",c),null}return a.Te===0?null:a}et(e,t,r){return t.fe.count===r-this.rt(e,t.targetId)?0:2}rt(e,t){const r=this.Be.getRemoteKeysForTarget(t);let s=0;return r.forEach(i=>{const o=this.Be.nt(),a=`projects/${o.projectId}/databases/${o.database}/documents/${i.path.canonicalString()}`;e.mightContain(a)||(this.We(t,i,null),s++)}),s}it(e){const t=new Map;this.ke.forEach((i,o)=>{const a=this.Ye(o);if(a){if(i.current&&Uo(a.target)){const c=new w(a.target.path);this.qe.get(c)!==null||this.st(o,c)||this.We(o,c,he.newNoDocument(c,e))}i.De&&(t.set(o,i.ve()),i.Fe())}});let r=D();this.Qe.forEach((i,o)=>{let a=!0;o.forEachWhile(c=>{const u=this.Ye(c);return!u||u.purpose==="TargetPurposeLimboResolution"||(a=!1,!1)}),a&&(r=r.add(i))}),this.qe.forEach((i,o)=>o.setReadTime(e));const s=new Fs(e,t,this.Ke,this.qe,r);return this.qe=nt(),this.Qe=Ul(),this.Ke=new $(M),s}Ue(e,t){if(!this.je(e))return;const r=this.st(e,t.key)?2:0;this.ze(e).Me(t.key,r),this.qe=this.qe.insert(t.key,t),this.Qe=this.Qe.insert(t.key,this.ot(t.key).add(e))}We(e,t,r){if(!this.je(e))return;const s=this.ze(e);this.st(e,t)?s.Me(t,1):s.xe(t),this.Qe=this.Qe.insert(t,this.ot(t).delete(e)),r&&(this.qe=this.qe.insert(t,r))}removeTarget(e){this.ke.delete(e)}Ze(e){const t=this.ze(e).ve();return this.Be.getRemoteKeysForTarget(e).size+t.addedDocuments.size-t.removedDocuments.size}Oe(e){this.ze(e).Oe()}ze(e){let t=this.ke.get(e);return t||(t=new xl,this.ke.set(e,t)),t}ot(e){let t=this.Qe.get(e);return t||(t=new se(M),this.Qe=this.Qe.insert(e,t)),t}je(e){const t=this.Ye(e)!==null;return t||v("WatchChangeAggregator","Detected inactive target",e),t}Ye(e){const t=this.ke.get(e);return t&&t.be?null:this.Be._t(e)}He(e){this.ke.set(e,new xl),this.Be.getRemoteKeysForTarget(e).forEach(t=>{this.We(e,t,null)})}st(e,t){return this.Be.getRemoteKeysForTarget(e).has(t)}}function Ul(){return new $(w.comparator)}function Fl(){return new $(w.comparator)}const R_={asc:"ASCENDING",desc:"DESCENDING"},P_={"<":"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"},S_={and:"AND",or:"OR"};class b_{constructor(e,t){this.databaseId=e,this.useProto3Json=t}}function zo(n,e){return n.useProto3Json||Is(e)?e:{value:e}}function js(n,e){return n.useProto3Json?`${new Date(1e3*e.seconds).toISOString().replace(/\.\d*/,"").replace("Z","")}.${("000000000"+e.nanoseconds).slice(-9)}Z`:{seconds:""+e.seconds,nanos:e.nanoseconds}}function Bl(n,e){return n.useProto3Json?e.toBase64():e.toUint8Array()}function C_(n,e){return js(n,e.toTimestamp())}function We(n){return F(!!n),S.fromTimestamp(function(t){const r=yt(t);return new Y(r.seconds,r.nanos)}(n))}function Ho(n,e){return Wo(n,e).canonicalString()}function Wo(n,e){const t=function(s){return new B(["projects",s.projectId,"databases",s.database])}(n).child("documents");return e===void 0?t:t.child(e)}function jl(n){const e=B.fromString(n);return F(Kl(e)),e}function Go(n,e){return Ho(n.databaseId,e.path)}function Ko(n,e){const t=jl(e);if(t.get(1)!==n.databaseId.projectId)throw new g(p.INVALID_ARGUMENT,"Tried to deserialize key from different project: "+t.get(1)+" vs "+n.databaseId.projectId);if(t.get(3)!==n.databaseId.database)throw new g(p.INVALID_ARGUMENT,"Tried to deserialize key from different database: "+t.get(3)+" vs "+n.databaseId.database);return new w($l(t))}function ql(n,e){return Ho(n.databaseId,e)}function k_(n){const e=jl(n);return e.length===4?B.emptyPath():$l(e)}function Qo(n){return new B(["projects",n.databaseId.projectId,"databases",n.databaseId.database]).canonicalString()}function $l(n){return F(n.length>4&&n.get(4)==="documents"),n.popFirst(5)}function zl(n,e,t){return{name:Go(n,e),fields:t.value.mapValue.fields}}function D_(n,e){let t;if("targetChange"in e){e.targetChange;const r=function(u){return u==="NO_CHANGE"?0:u==="ADD"?1:u==="REMOVE"?2:u==="CURRENT"?3:u==="RESET"?4:A()}(e.targetChange.targetChangeType||"NO_CHANGE"),s=e.targetChange.targetIds||[],i=function(u,l){return u.useProto3Json?(F(l===void 0||typeof l=="string"),le.fromBase64String(l||"")):(F(l===void 0||l instanceof Buffer||l instanceof Uint8Array),le.fromUint8Array(l||new Uint8Array))}(n,e.targetChange.resumeToken),o=e.targetChange.cause,a=o&&function(u){const l=u.code===void 0?p.UNKNOWN:Nl(u.code);return new g(l,u.message||"")}(o);t=new Ml(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=Ko(n,r.document.name),i=We(r.document.updateTime),o=r.document.createTime?We(r.document.createTime):S.min(),a=new _e({mapValue:{fields:r.document.fields}}),c=he.newFoundDocument(s,i,o,a),u=r.targetIds||[],l=r.removedTargetIds||[];t=new Bs(u,l,c.key,c)}else if("documentDelete"in e){e.documentDelete;const r=e.documentDelete;r.document;const s=Ko(n,r.document),i=r.readTime?We(r.readTime):S.min(),o=he.newNoDocument(s,i),a=r.removedTargetIds||[];t=new Bs([],a,o.key,o)}else if("documentRemove"in e){e.documentRemove;const r=e.documentRemove;r.document;const s=Ko(n,r.document),i=r.removedTargetIds||[];t=new Bs([],i,s,null)}else{if(!("filter"in e))return A();{e.filter;const r=e.filter;r.targetId;const{count:s=0,unchangedNames:i}=r,o=new E_(s,i),a=r.targetId;t=new Ll(a,o)}}return t}function N_(n,e){let t;if(e instanceof Pr)t={update:zl(n,e.key,e.value)};else if(e instanceof Us)t={delete:Go(n,e.key)};else if(e instanceof vt)t={update:zl(n,e.key,e.data),updateMask:B_(e.fieldMask)};else{if(!(e instanceof g_))return A();t={verify:Go(n,e.key)}}return e.fieldTransforms.length>0&&(t.updateTransforms=e.fieldTransforms.map(r=>function(i,o){const a=o.transform;if(a instanceof Vs)return{fieldPath:o.field.canonicalString(),setToServerValue:"REQUEST_TIME"};if(a instanceof Ir)return{fieldPath:o.field.canonicalString(),appendMissingElements:{values:a.elements}};if(a instanceof Ar)return{fieldPath:o.field.canonicalString(),removeAllFromArray:{values:a.elements}};if(a instanceof Ls)return{fieldPath:o.field.canonicalString(),increment:a.Ie};throw A()}(0,r))),e.precondition.isNone||(t.currentDocument=function(s,i){return i.updateTime!==void 0?{updateTime:C_(s,i.updateTime)}:i.exists!==void 0?{exists:i.exists}:A()}(n,e.precondition)),t}function O_(n,e){return n&&n.length>0?(F(e!==void 0),n.map(t=>function(s,i){let o=s.updateTime?We(s.updateTime):We(i);return o.isEqual(S.min())&&(o=We(i)),new f_(o,s.transformResults||[])}(t,e))):[]}function V_(n,e){return{documents:[ql(n,e.path)]}}function Hl(n,e){const t={structuredQuery:{}},r=e.path;let s;e.collectionGroup!==null?(s=r,t.structuredQuery.from=[{collectionId:e.collectionGroup,allDescendants:!0}]):(s=r.popLast(),t.structuredQuery.from=[{collectionId:r.lastSegment()}]),t.parent=ql(n,s);const i=function(u){if(u.length!==0)return Gl(Ve.create(u,"and"))}(e.filters);i&&(t.structuredQuery.where=i);const o=function(u){if(u.length!==0)return u.map(l=>function(d){return{field:Et(d.field),direction:x_(d.dir)}}(l))}(e.orderBy);o&&(t.structuredQuery.orderBy=o);const a=zo(n,e.limit);return a!==null&&(t.structuredQuery.limit=a),e.startAt&&(t.structuredQuery.startAt=function(u){return{before:u.inclusive,values:u.position}}(e.startAt)),e.endAt&&(t.structuredQuery.endAt=function(u){return{before:!u.inclusive,values:u.position}}(e.endAt)),{ut:t,parent:s}}function L_(n){let e=k_(n.parent);const t=n.structuredQuery,r=t.from?t.from.length:0;let s=null;if(r>0){F(r===1);const l=t.from[0];l.allDescendants?s=l.collectionId:e=e.child(l.collectionId)}let i=[];t.where&&(i=function(h){const d=Wl(h);return d instanceof Ve&&cl(d)?d.getFilters():[d]}(t.where));let o=[];t.orderBy&&(o=function(h){return h.map(d=>function(E){return new Er(gn(E.field),function(_){switch(_){case"ASCENDING":return"asc";case"DESCENDING":return"desc";default:return}}(E.direction))}(d))}(t.orderBy));let a=null;t.limit&&(a=function(h){let d;return d=typeof h=="object"?h.value:h,Is(d)?null:d}(t.limit));let c=null;t.startAt&&(c=function(h){const d=!!h.before,f=h.values||[];return new dn(f,d)}(t.startAt));let u=null;return t.endAt&&(u=function(h){const d=!h.before,f=h.values||[];return new dn(f,d)}(t.endAt)),t_(e,s,o,i,a,"F",c,u)}function M_(n,e){const t=function(s){switch(s){case"TargetPurposeListen":return null;case"TargetPurposeExistenceFilterMismatch":return"existence-filter-mismatch";case"TargetPurposeExistenceFilterMismatchBloom":return"existence-filter-mismatch-bloom";case"TargetPurposeLimboResolution":return"limbo-document";default:return A()}}(e.purpose);return t==null?null:{"goog-listen-tags":t}}function Wl(n){return n.unaryFilter!==void 0?function(t){switch(t.unaryFilter.op){case"IS_NAN":const r=gn(t.unaryFilter.field);return K.create(r,"==",{doubleValue:NaN});case"IS_NULL":const s=gn(t.unaryFilter.field);return K.create(s,"==",{nullValue:"NULL_VALUE"});case"IS_NOT_NAN":const i=gn(t.unaryFilter.field);return K.create(i,"!=",{doubleValue:NaN});case"IS_NOT_NULL":const o=gn(t.unaryFilter.field);return K.create(o,"!=",{nullValue:"NULL_VALUE"});default:return A()}}(n):n.fieldFilter!==void 0?function(t){return K.create(gn(t.fieldFilter.field),function(s){switch(s){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 A()}}(t.fieldFilter.op),t.fieldFilter.value)}(n):n.compositeFilter!==void 0?function(t){return Ve.create(t.compositeFilter.filters.map(r=>Wl(r)),function(s){switch(s){case"AND":return"and";case"OR":return"or";default:return A()}}(t.compositeFilter.op))}(n):A()}function x_(n){return R_[n]}function U_(n){return P_[n]}function F_(n){return S_[n]}function Et(n){return{fieldPath:n.canonicalString()}}function gn(n){return ne.fromServerFormat(n.fieldPath)}function Gl(n){return n instanceof K?function(t){if(t.op==="=="){if(nl(t.value))return{unaryFilter:{field:Et(t.field),op:"IS_NAN"}};if(tl(t.value))return{unaryFilter:{field:Et(t.field),op:"IS_NULL"}}}else if(t.op==="!="){if(nl(t.value))return{unaryFilter:{field:Et(t.field),op:"IS_NOT_NAN"}};if(tl(t.value))return{unaryFilter:{field:Et(t.field),op:"IS_NOT_NULL"}}}return{fieldFilter:{field:Et(t.field),op:U_(t.op),value:t.value}}}(n):n instanceof Ve?function(t){const r=t.getFilters().map(s=>Gl(s));return r.length===1?r[0]:{compositeFilter:{op:F_(t.op),filters:r}}}(n):A()}function B_(n){const e=[];return n.fields.forEach(t=>e.push(t.canonicalString())),{fieldPaths:e}}function Kl(n){return n.length>=4&&n.get(0)==="projects"&&n.get(2)==="databases"}/**
1093
1093
  * @license
1094
1094
  * Copyright 2017 Google LLC
1095
1095
  *
@@ -1104,7 +1104,7 @@
1104
1104
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1105
1105
  * See the License for the specific language governing permissions and
1106
1106
  * limitations under the License.
1107
- */class _t{constructor(e,n,r,s,i=S.min(),o=S.min(),a=le.EMPTY_BYTE_STRING,c=null){this.target=e,this.targetId=n,this.purpose=r,this.sequenceNumber=s,this.snapshotVersion=i,this.lastLimboFreeSnapshotVersion=o,this.resumeToken=a,this.expectedCount=c}withSequenceNumber(e){return new _t(this.target,this.targetId,this.purpose,e,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,this.expectedCount)}withResumeToken(e,n){return new _t(this.target,this.targetId,this.purpose,this.sequenceNumber,n,this.lastLimboFreeSnapshotVersion,e,null)}withExpectedCount(e){return new _t(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,e)}withLastLimboFreeSnapshotVersion(e){return new _t(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,e,this.resumeToken,this.expectedCount)}}/**
1107
+ */class Tt{constructor(e,t,r,s,i=S.min(),o=S.min(),a=le.EMPTY_BYTE_STRING,c=null){this.target=e,this.targetId=t,this.purpose=r,this.sequenceNumber=s,this.snapshotVersion=i,this.lastLimboFreeSnapshotVersion=o,this.resumeToken=a,this.expectedCount=c}withSequenceNumber(e){return new Tt(this.target,this.targetId,this.purpose,e,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,this.expectedCount)}withResumeToken(e,t){return new Tt(this.target,this.targetId,this.purpose,this.sequenceNumber,t,this.lastLimboFreeSnapshotVersion,e,null)}withExpectedCount(e){return new Tt(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,e)}withLastLimboFreeSnapshotVersion(e){return new Tt(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,e,this.resumeToken,this.expectedCount)}}/**
1108
1108
  * @license
1109
1109
  * Copyright 2017 Google LLC
1110
1110
  *
@@ -1119,7 +1119,7 @@
1119
1119
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1120
1120
  * See the License for the specific language governing permissions and
1121
1121
  * limitations under the License.
1122
- */class P_{constructor(e){this.ct=e}}function S_(t){const e=E_({parent:t.parent,structuredQuery:t.structuredQuery});return t.limitType==="LAST"?Rs(e,e.limit,"L"):e}/**
1122
+ */class j_{constructor(e){this.ct=e}}function q_(n){const e=L_({parent:n.parent,structuredQuery:n.structuredQuery});return n.limitType==="LAST"?ks(e,e.limit,"L"):e}/**
1123
1123
  * @license
1124
1124
  * Copyright 2019 Google LLC
1125
1125
  *
@@ -1134,7 +1134,7 @@
1134
1134
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1135
1135
  * See the License for the specific language governing permissions and
1136
1136
  * limitations under the License.
1137
- */class b_{constructor(){this._n=new C_}addToCollectionParentIndex(e,n){return this._n.add(n),m.resolve()}getCollectionParents(e,n){return m.resolve(this._n.getEntries(n))}addFieldIndex(e,n){return m.resolve()}deleteFieldIndex(e,n){return m.resolve()}deleteAllFieldIndexes(e){return m.resolve()}createTargetIndexes(e,n){return m.resolve()}getDocumentsMatchingTarget(e,n){return m.resolve(null)}getIndexType(e,n){return m.resolve(0)}getFieldIndexes(e,n){return m.resolve([])}getNextCollectionGroupToUpdate(e){return m.resolve(null)}getMinOffset(e,n){return m.resolve(ft.min())}getMinOffsetFromCollectionGroup(e,n){return m.resolve(ft.min())}updateCollectionGroup(e,n,r){return m.resolve()}updateIndexEntries(e,n){return m.resolve()}}class C_{constructor(){this.index={}}add(e){const n=e.lastSegment(),r=e.popLast(),s=this.index[n]||new se(B.comparator),i=!s.has(r);return this.index[n]=s.add(r),i}has(e){const n=e.lastSegment(),r=e.popLast(),s=this.index[n];return s&&s.has(r)}getEntries(e){return(this.index[e]||new se(B.comparator)).toArray()}}/**
1137
+ */class $_{constructor(){this._n=new z_}addToCollectionParentIndex(e,t){return this._n.add(t),m.resolve()}getCollectionParents(e,t){return m.resolve(this._n.getEntries(t))}addFieldIndex(e,t){return m.resolve()}deleteFieldIndex(e,t){return m.resolve()}deleteAllFieldIndexes(e){return m.resolve()}createTargetIndexes(e,t){return m.resolve()}getDocumentsMatchingTarget(e,t){return m.resolve(null)}getIndexType(e,t){return m.resolve(0)}getFieldIndexes(e,t){return m.resolve([])}getNextCollectionGroupToUpdate(e){return m.resolve(null)}getMinOffset(e,t){return m.resolve(_t.min())}getMinOffsetFromCollectionGroup(e,t){return m.resolve(_t.min())}updateCollectionGroup(e,t,r){return m.resolve()}updateIndexEntries(e,t){return m.resolve()}}class z_{constructor(){this.index={}}add(e){const t=e.lastSegment(),r=e.popLast(),s=this.index[t]||new se(B.comparator),i=!s.has(r);return this.index[t]=s.add(r),i}has(e){const t=e.lastSegment(),r=e.popLast(),s=this.index[t];return s&&s.has(r)}getEntries(e){return(this.index[e]||new se(B.comparator)).toArray()}}/**
1138
1138
  * @license
1139
1139
  * Copyright 2017 Google LLC
1140
1140
  *
@@ -1149,7 +1149,7 @@
1149
1149
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1150
1150
  * See the License for the specific language governing permissions and
1151
1151
  * limitations under the License.
1152
- */class pn{constructor(e){this.On=e}next(){return this.On+=2,this.On}static Nn(){return new pn(0)}static Bn(){return new pn(-1)}}/**
1152
+ */class _n{constructor(e){this.On=e}next(){return this.On+=2,this.On}static Nn(){return new _n(0)}static Ln(){return new _n(-1)}}/**
1153
1153
  * @license
1154
1154
  * Copyright 2017 Google LLC
1155
1155
  *
@@ -1164,7 +1164,7 @@
1164
1164
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1165
1165
  * See the License for the specific language governing permissions and
1166
1166
  * limitations under the License.
1167
- */class k_{constructor(){this.changes=new dn(e=>e.toString(),(e,n)=>e.isEqual(n)),this.changesApplied=!1}addEntry(e){this.assertNotApplied(),this.changes.set(e.key,e)}removeEntry(e,n){this.assertNotApplied(),this.changes.set(e,he.newInvalidDocument(e).setReadTime(n))}getEntry(e,n){this.assertNotApplied();const r=this.changes.get(n);return r!==void 0?m.resolve(r):this.getFromCache(e,n)}getEntries(e,n){return this.getAllFromCache(e,n)}apply(e){return this.assertNotApplied(),this.changesApplied=!0,this.applyChanges(e)}assertNotApplied(){}}/**
1167
+ */class H_{constructor(){this.changes=new mn(e=>e.toString(),(e,t)=>e.isEqual(t)),this.changesApplied=!1}addEntry(e){this.assertNotApplied(),this.changes.set(e.key,e)}removeEntry(e,t){this.assertNotApplied(),this.changes.set(e,he.newInvalidDocument(e).setReadTime(t))}getEntry(e,t){this.assertNotApplied();const r=this.changes.get(t);return r!==void 0?m.resolve(r):this.getFromCache(e,t)}getEntries(e,t){return this.getAllFromCache(e,t)}apply(e){return this.assertNotApplied(),this.changesApplied=!0,this.applyChanges(e)}assertNotApplied(){}}/**
1168
1168
  * @license
1169
1169
  * Copyright 2017 Google LLC
1170
1170
  *
@@ -1194,7 +1194,7 @@
1194
1194
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1195
1195
  * See the License for the specific language governing permissions and
1196
1196
  * limitations under the License.
1197
- */class D_{constructor(e,n){this.overlayedDocument=e,this.mutatedFields=n}}/**
1197
+ */class W_{constructor(e,t){this.overlayedDocument=e,this.mutatedFields=t}}/**
1198
1198
  * @license
1199
1199
  * Copyright 2017 Google LLC
1200
1200
  *
@@ -1209,7 +1209,7 @@
1209
1209
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1210
1210
  * See the License for the specific language governing permissions and
1211
1211
  * limitations under the License.
1212
- */class N_{constructor(e,n,r,s){this.remoteDocumentCache=e,this.mutationQueue=n,this.documentOverlayCache=r,this.indexManager=s}getDocument(e,n){let r=null;return this.documentOverlayCache.getOverlay(e,n).next(s=>(r=s,this.remoteDocumentCache.getEntry(e,n))).next(s=>(r!==null&&vr(r.mutation,s,Te.empty(),Y.now()),s))}getDocuments(e,n){return this.remoteDocumentCache.getEntries(e,n).next(r=>this.getLocalViewOfDocuments(e,r,D()).next(()=>r))}getLocalViewOfDocuments(e,n,r=D()){const s=Bt();return this.populateOverlays(e,s,n).next(()=>this.computeViews(e,n,s,r).next(i=>{let o=mr();return i.forEach((a,c)=>{o=o.insert(a,c.overlayedDocument)}),o}))}getOverlayedDocuments(e,n){const r=Bt();return this.populateOverlays(e,r,n).next(()=>this.computeViews(e,n,r,D()))}populateOverlays(e,n,r){const s=[];return r.forEach(i=>{n.has(i)||s.push(i)}),this.documentOverlayCache.getOverlays(e,s).next(i=>{i.forEach((o,a)=>{n.set(o,a)})})}computeViews(e,n,r,s){let i=Ze();const o=gr(),a=function(){return gr()}();return n.forEach((c,u)=>{const l=r.get(u.key);s.has(u.key)&&(l===void 0||l.mutation instanceof mt)?i=i.insert(u.key,u):l!==void 0?(o.set(u.key,l.mutation.getFieldMask()),vr(l.mutation,u,l.mutation.getFieldMask(),Y.now())):o.set(u.key,Te.empty())}),this.recalculateAndSaveOverlays(e,i).next(c=>(c.forEach((u,l)=>o.set(u,l)),n.forEach((u,l)=>{var h;return a.set(u,new D_(l,(h=o.get(u))!==null&&h!==void 0?h:null))}),a))}recalculateAndSaveOverlays(e,n){const r=gr();let s=new q((o,a)=>o-a),i=D();return this.mutationQueue.getAllMutationBatchesAffectingDocumentKeys(e,n).next(o=>{for(const a of o)a.keys().forEach(c=>{const u=n.get(c);if(u===null)return;let l=r.get(c)||Te.empty();l=a.applyToLocalView(u,l),r.set(c,l);const h=(s.get(a.batchId)||D()).add(c);s=s.insert(a.batchId,h)})}).next(()=>{const o=[],a=s.getReverseIterator();for(;a.hasNext();){const c=a.getNext(),u=c.key,l=c.value,h=ll();l.forEach(d=>{if(!i.has(d)){const f=yl(n.get(d),r.get(d));f!==null&&h.set(d,f),i=i.add(d)}}),o.push(this.documentOverlayCache.saveOverlays(e,u,h))}return m.waitFor(o)}).next(()=>r)}recalculateAndSaveOverlaysForDocumentKeys(e,n){return this.remoteDocumentCache.getEntries(e,n).next(r=>this.recalculateAndSaveOverlays(e,r))}getDocumentsMatchingQuery(e,n,r,s){return function(o){return w.isDocumentKey(o.path)&&o.collectionGroup===null&&o.filters.length===0}(n)?this.getDocumentsMatchingDocumentQuery(e,n.path):Mo(n)?this.getDocumentsMatchingCollectionGroupQuery(e,n,r,s):this.getDocumentsMatchingCollectionQuery(e,n,r,s)}getNextDocuments(e,n,r,s){return this.remoteDocumentCache.getAllFromCollectionGroup(e,n,r,s).next(i=>{const o=s-i.size>0?this.documentOverlayCache.getOverlaysForCollectionGroup(e,n,r.largestBatchId,s-i.size):m.resolve(Bt());let a=-1,c=i;return o.next(u=>m.forEach(u,(l,h)=>(a<h.largestBatchId&&(a=h.largestBatchId),i.get(l)?m.resolve():this.remoteDocumentCache.getEntry(e,l).next(d=>{c=c.insert(l,d)}))).next(()=>this.populateOverlays(e,u,i)).next(()=>this.computeViews(e,c,u,D())).next(l=>({batchId:a,changes:ul(l)})))})}getDocumentsMatchingDocumentQuery(e,n){return this.getDocument(e,new w(n)).next(r=>{let s=mr();return r.isFoundDocument()&&(s=s.insert(r.key,r)),s})}getDocumentsMatchingCollectionGroupQuery(e,n,r,s){const i=n.collectionGroup;let o=mr();return this.indexManager.getCollectionParents(e,i).next(a=>m.forEach(a,c=>{const u=function(h,d){return new Ft(d,null,h.explicitOrderBy.slice(),h.filters.slice(),h.limit,h.limitType,h.startAt,h.endAt)}(n,c.child(i));return this.getDocumentsMatchingCollectionQuery(e,u,r,s).next(l=>{l.forEach((h,d)=>{o=o.insert(h,d)})})}).next(()=>o))}getDocumentsMatchingCollectionQuery(e,n,r,s){let i;return this.documentOverlayCache.getOverlaysForCollection(e,n.path,r.largestBatchId).next(o=>(i=o,this.remoteDocumentCache.getDocumentsMatchingQuery(e,n,r,i,s))).next(o=>{i.forEach((c,u)=>{const l=u.getKey();o.get(l)===null&&(o=o.insert(l,he.newInvalidDocument(l)))});let a=mr();return o.forEach((c,u)=>{const l=i.get(c);l!==void 0&&vr(l.mutation,u,Te.empty(),Y.now()),Ss(n,u)&&(a=a.insert(c,u))}),a})}}/**
1212
+ */class G_{constructor(e,t,r,s){this.remoteDocumentCache=e,this.mutationQueue=t,this.documentOverlayCache=r,this.indexManager=s}getDocument(e,t){let r=null;return this.documentOverlayCache.getOverlay(e,t).next(s=>(r=s,this.remoteDocumentCache.getEntry(e,t))).next(s=>(r!==null&&Rr(r.mutation,s,Ie.empty(),Y.now()),s))}getDocuments(e,t){return this.remoteDocumentCache.getEntries(e,t).next(r=>this.getLocalViewOfDocuments(e,r,D()).next(()=>r))}getLocalViewOfDocuments(e,t,r=D()){const s=zt();return this.populateOverlays(e,s,t).next(()=>this.computeViews(e,t,s,r).next(i=>{let o=Tr();return i.forEach((a,c)=>{o=o.insert(a,c.overlayedDocument)}),o}))}getOverlayedDocuments(e,t){const r=zt();return this.populateOverlays(e,r,t).next(()=>this.computeViews(e,t,r,D()))}populateOverlays(e,t,r){const s=[];return r.forEach(i=>{t.has(i)||s.push(i)}),this.documentOverlayCache.getOverlays(e,s).next(i=>{i.forEach((o,a)=>{t.set(o,a)})})}computeViews(e,t,r,s){let i=nt();const o=wr(),a=function(){return wr()}();return t.forEach((c,u)=>{const l=r.get(u.key);s.has(u.key)&&(l===void 0||l.mutation instanceof vt)?i=i.insert(u.key,u):l!==void 0?(o.set(u.key,l.mutation.getFieldMask()),Rr(l.mutation,u,l.mutation.getFieldMask(),Y.now())):o.set(u.key,Ie.empty())}),this.recalculateAndSaveOverlays(e,i).next(c=>(c.forEach((u,l)=>o.set(u,l)),t.forEach((u,l)=>{var h;return a.set(u,new W_(l,(h=o.get(u))!==null&&h!==void 0?h:null))}),a))}recalculateAndSaveOverlays(e,t){const r=wr();let s=new $((o,a)=>o-a),i=D();return this.mutationQueue.getAllMutationBatchesAffectingDocumentKeys(e,t).next(o=>{for(const a of o)a.keys().forEach(c=>{const u=t.get(c);if(u===null)return;let l=r.get(c)||Ie.empty();l=a.applyToLocalView(u,l),r.set(c,l);const h=(s.get(a.batchId)||D()).add(c);s=s.insert(a.batchId,h)})}).next(()=>{const o=[],a=s.getReverseIterator();for(;a.hasNext();){const c=a.getNext(),u=c.key,l=c.value,h=vl();l.forEach(d=>{if(!i.has(d)){const f=Sl(t.get(d),r.get(d));f!==null&&h.set(d,f),i=i.add(d)}}),o.push(this.documentOverlayCache.saveOverlays(e,u,h))}return m.waitFor(o)}).next(()=>r)}recalculateAndSaveOverlaysForDocumentKeys(e,t){return this.remoteDocumentCache.getEntries(e,t).next(r=>this.recalculateAndSaveOverlays(e,r))}getDocumentsMatchingQuery(e,t,r,s){return function(o){return w.isDocumentKey(o.path)&&o.collectionGroup===null&&o.filters.length===0}(t)?this.getDocumentsMatchingDocumentQuery(e,t.path):Bo(t)?this.getDocumentsMatchingCollectionGroupQuery(e,t,r,s):this.getDocumentsMatchingCollectionQuery(e,t,r,s)}getNextDocuments(e,t,r,s){return this.remoteDocumentCache.getAllFromCollectionGroup(e,t,r,s).next(i=>{const o=s-i.size>0?this.documentOverlayCache.getOverlaysForCollectionGroup(e,t,r.largestBatchId,s-i.size):m.resolve(zt());let a=-1,c=i;return o.next(u=>m.forEach(u,(l,h)=>(a<h.largestBatchId&&(a=h.largestBatchId),i.get(l)?m.resolve():this.remoteDocumentCache.getEntry(e,l).next(d=>{c=c.insert(l,d)}))).next(()=>this.populateOverlays(e,u,i)).next(()=>this.computeViews(e,c,u,D())).next(l=>({batchId:a,changes:yl(l)})))})}getDocumentsMatchingDocumentQuery(e,t){return this.getDocument(e,new w(t)).next(r=>{let s=Tr();return r.isFoundDocument()&&(s=s.insert(r.key,r)),s})}getDocumentsMatchingCollectionGroupQuery(e,t,r,s){const i=t.collectionGroup;let o=Tr();return this.indexManager.getCollectionParents(e,i).next(a=>m.forEach(a,c=>{const u=function(h,d){return new $t(d,null,h.explicitOrderBy.slice(),h.filters.slice(),h.limit,h.limitType,h.startAt,h.endAt)}(t,c.child(i));return this.getDocumentsMatchingCollectionQuery(e,u,r,s).next(l=>{l.forEach((h,d)=>{o=o.insert(h,d)})})}).next(()=>o))}getDocumentsMatchingCollectionQuery(e,t,r,s){let i;return this.documentOverlayCache.getOverlaysForCollection(e,t.path,r.largestBatchId).next(o=>(i=o,this.remoteDocumentCache.getDocumentsMatchingQuery(e,t,r,i,s))).next(o=>{i.forEach((c,u)=>{const l=u.getKey();o.get(l)===null&&(o=o.insert(l,he.newInvalidDocument(l)))});let a=Tr();return o.forEach((c,u)=>{const l=i.get(c);l!==void 0&&Rr(l.mutation,u,Ie.empty(),Y.now()),Ns(t,u)&&(a=a.insert(c,u))}),a})}}/**
1213
1213
  * @license
1214
1214
  * Copyright 2020 Google LLC
1215
1215
  *
@@ -1224,7 +1224,7 @@
1224
1224
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1225
1225
  * See the License for the specific language governing permissions and
1226
1226
  * limitations under the License.
1227
- */class O_{constructor(e){this.serializer=e,this.cr=new Map,this.lr=new Map}getBundleMetadata(e,n){return m.resolve(this.cr.get(n))}saveBundleMetadata(e,n){return this.cr.set(n.id,function(s){return{id:s.id,version:s.version,createTime:qe(s.createTime)}}(n)),m.resolve()}getNamedQuery(e,n){return m.resolve(this.lr.get(n))}saveNamedQuery(e,n){return this.lr.set(n.name,function(s){return{name:s.name,query:S_(s.bundledQuery),readTime:qe(s.readTime)}}(n)),m.resolve()}}/**
1227
+ */class K_{constructor(e){this.serializer=e,this.cr=new Map,this.lr=new Map}getBundleMetadata(e,t){return m.resolve(this.cr.get(t))}saveBundleMetadata(e,t){return this.cr.set(t.id,function(s){return{id:s.id,version:s.version,createTime:We(s.createTime)}}(t)),m.resolve()}getNamedQuery(e,t){return m.resolve(this.lr.get(t))}saveNamedQuery(e,t){return this.lr.set(t.name,function(s){return{name:s.name,query:q_(s.bundledQuery),readTime:We(s.readTime)}}(t)),m.resolve()}}/**
1228
1228
  * @license
1229
1229
  * Copyright 2022 Google LLC
1230
1230
  *
@@ -1239,7 +1239,7 @@
1239
1239
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1240
1240
  * See the License for the specific language governing permissions and
1241
1241
  * limitations under the License.
1242
- */class V_{constructor(){this.overlays=new q(w.comparator),this.hr=new Map}getOverlay(e,n){return m.resolve(this.overlays.get(n))}getOverlays(e,n){const r=Bt();return m.forEach(n,s=>this.getOverlay(e,s).next(i=>{i!==null&&r.set(s,i)})).next(()=>r)}saveOverlays(e,n,r){return r.forEach((s,i)=>{this.ht(e,n,i)}),m.resolve()}removeOverlaysForBatchId(e,n,r){const s=this.hr.get(r);return s!==void 0&&(s.forEach(i=>this.overlays=this.overlays.remove(i)),this.hr.delete(r)),m.resolve()}getOverlaysForCollection(e,n,r){const s=Bt(),i=n.length+1,o=new w(n.child("")),a=this.overlays.getIteratorFrom(o);for(;a.hasNext();){const c=a.getNext().value,u=c.getKey();if(!n.isPrefixOf(u.path))break;u.path.length===i&&c.largestBatchId>r&&s.set(c.getKey(),c)}return m.resolve(s)}getOverlaysForCollectionGroup(e,n,r,s){let i=new q((u,l)=>u-l);const o=this.overlays.getIterator();for(;o.hasNext();){const u=o.getNext().value;if(u.getKey().getCollectionGroup()===n&&u.largestBatchId>r){let l=i.get(u.largestBatchId);l===null&&(l=Bt(),i=i.insert(u.largestBatchId,l)),l.set(u.getKey(),u)}}const a=Bt(),c=i.getIterator();for(;c.hasNext()&&(c.getNext().value.forEach((u,l)=>a.set(u,l)),!(a.size()>=s)););return m.resolve(a)}ht(e,n,r){const s=this.overlays.get(r.key);if(s!==null){const o=this.hr.get(s.largestBatchId).delete(r.key);this.hr.set(s.largestBatchId,o)}this.overlays=this.overlays.insert(r.key,new r_(n,r));let i=this.hr.get(n);i===void 0&&(i=D(),this.hr.set(n,i)),this.hr.set(n,i.add(r.key))}}/**
1242
+ */class Q_{constructor(){this.overlays=new $(w.comparator),this.hr=new Map}getOverlay(e,t){return m.resolve(this.overlays.get(t))}getOverlays(e,t){const r=zt();return m.forEach(t,s=>this.getOverlay(e,s).next(i=>{i!==null&&r.set(s,i)})).next(()=>r)}saveOverlays(e,t,r){return r.forEach((s,i)=>{this.ht(e,t,i)}),m.resolve()}removeOverlaysForBatchId(e,t,r){const s=this.hr.get(r);return s!==void 0&&(s.forEach(i=>this.overlays=this.overlays.remove(i)),this.hr.delete(r)),m.resolve()}getOverlaysForCollection(e,t,r){const s=zt(),i=t.length+1,o=new w(t.child("")),a=this.overlays.getIteratorFrom(o);for(;a.hasNext();){const c=a.getNext().value,u=c.getKey();if(!t.isPrefixOf(u.path))break;u.path.length===i&&c.largestBatchId>r&&s.set(c.getKey(),c)}return m.resolve(s)}getOverlaysForCollectionGroup(e,t,r,s){let i=new $((u,l)=>u-l);const o=this.overlays.getIterator();for(;o.hasNext();){const u=o.getNext().value;if(u.getKey().getCollectionGroup()===t&&u.largestBatchId>r){let l=i.get(u.largestBatchId);l===null&&(l=zt(),i=i.insert(u.largestBatchId,l)),l.set(u.getKey(),u)}}const a=zt(),c=i.getIterator();for(;c.hasNext()&&(c.getNext().value.forEach((u,l)=>a.set(u,l)),!(a.size()>=s)););return m.resolve(a)}ht(e,t,r){const s=this.overlays.get(r.key);if(s!==null){const o=this.hr.get(s.largestBatchId).delete(r.key);this.hr.set(s.largestBatchId,o)}this.overlays=this.overlays.insert(r.key,new y_(t,r));let i=this.hr.get(t);i===void 0&&(i=D(),this.hr.set(t,i)),this.hr.set(t,i.add(r.key))}}/**
1243
1243
  * @license
1244
1244
  * Copyright 2017 Google LLC
1245
1245
  *
@@ -1254,7 +1254,7 @@
1254
1254
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1255
1255
  * See the License for the specific language governing permissions and
1256
1256
  * limitations under the License.
1257
- */class Wo{constructor(){this.Pr=new se(Z.Ir),this.Tr=new se(Z.Er)}isEmpty(){return this.Pr.isEmpty()}addReference(e,n){const r=new Z(e,n);this.Pr=this.Pr.add(r),this.Tr=this.Tr.add(r)}dr(e,n){e.forEach(r=>this.addReference(r,n))}removeReference(e,n){this.Ar(new Z(e,n))}Rr(e,n){e.forEach(r=>this.removeReference(r,n))}Vr(e){const n=new w(new B([])),r=new Z(n,e),s=new Z(n,e+1),i=[];return this.Tr.forEachInRange([r,s],o=>{this.Ar(o),i.push(o.key)}),i}mr(){this.Pr.forEach(e=>this.Ar(e))}Ar(e){this.Pr=this.Pr.delete(e),this.Tr=this.Tr.delete(e)}gr(e){const n=new w(new B([])),r=new Z(n,e),s=new Z(n,e+1);let i=D();return this.Tr.forEachInRange([r,s],o=>{i=i.add(o.key)}),i}containsKey(e){const n=new Z(e,0),r=this.Pr.firstAfterOrEqual(n);return r!==null&&e.isEqual(r.key)}}class Z{constructor(e,n){this.key=e,this.pr=n}static Ir(e,n){return w.comparator(e.key,n.key)||M(e.pr,n.pr)}static Er(e,n){return M(e.pr,n.pr)||w.comparator(e.key,n.key)}}/**
1257
+ */class Yo{constructor(){this.Pr=new se(Z.Ir),this.Tr=new se(Z.Er)}isEmpty(){return this.Pr.isEmpty()}addReference(e,t){const r=new Z(e,t);this.Pr=this.Pr.add(r),this.Tr=this.Tr.add(r)}dr(e,t){e.forEach(r=>this.addReference(r,t))}removeReference(e,t){this.Ar(new Z(e,t))}Rr(e,t){e.forEach(r=>this.removeReference(r,t))}Vr(e){const t=new w(new B([])),r=new Z(t,e),s=new Z(t,e+1),i=[];return this.Tr.forEachInRange([r,s],o=>{this.Ar(o),i.push(o.key)}),i}mr(){this.Pr.forEach(e=>this.Ar(e))}Ar(e){this.Pr=this.Pr.delete(e),this.Tr=this.Tr.delete(e)}gr(e){const t=new w(new B([])),r=new Z(t,e),s=new Z(t,e+1);let i=D();return this.Tr.forEachInRange([r,s],o=>{i=i.add(o.key)}),i}containsKey(e){const t=new Z(e,0),r=this.Pr.firstAfterOrEqual(t);return r!==null&&e.isEqual(r.key)}}class Z{constructor(e,t){this.key=e,this.pr=t}static Ir(e,t){return w.comparator(e.key,t.key)||M(e.pr,t.pr)}static Er(e,t){return M(e.pr,t.pr)||w.comparator(e.key,t.key)}}/**
1258
1258
  * @license
1259
1259
  * Copyright 2017 Google LLC
1260
1260
  *
@@ -1269,7 +1269,7 @@
1269
1269
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1270
1270
  * See the License for the specific language governing permissions and
1271
1271
  * limitations under the License.
1272
- */class L_{constructor(e,n){this.indexManager=e,this.referenceDelegate=n,this.mutationQueue=[],this.yr=1,this.wr=new se(Z.Ir)}checkEmpty(e){return m.resolve(this.mutationQueue.length===0)}addMutationBatch(e,n,r,s){const i=this.yr;this.yr++,this.mutationQueue.length>0&&this.mutationQueue[this.mutationQueue.length-1];const o=new n_(i,n,r,s);this.mutationQueue.push(o);for(const a of s)this.wr=this.wr.add(new Z(a.key,i)),this.indexManager.addToCollectionParentIndex(e,a.key.path.popLast());return m.resolve(o)}lookupMutationBatch(e,n){return m.resolve(this.Sr(n))}getNextMutationBatchAfterBatchId(e,n){const r=n+1,s=this.br(r),i=s<0?0:s;return m.resolve(this.mutationQueue.length>i?this.mutationQueue[i]:null)}getHighestUnacknowledgedBatchId(){return m.resolve(this.mutationQueue.length===0?-1:this.yr-1)}getAllMutationBatches(e){return m.resolve(this.mutationQueue.slice())}getAllMutationBatchesAffectingDocumentKey(e,n){const r=new Z(n,0),s=new Z(n,Number.POSITIVE_INFINITY),i=[];return this.wr.forEachInRange([r,s],o=>{const a=this.Sr(o.pr);i.push(a)}),m.resolve(i)}getAllMutationBatchesAffectingDocumentKeys(e,n){let r=new se(M);return n.forEach(s=>{const i=new Z(s,0),o=new Z(s,Number.POSITIVE_INFINITY);this.wr.forEachInRange([i,o],a=>{r=r.add(a.pr)})}),m.resolve(this.Dr(r))}getAllMutationBatchesAffectingQuery(e,n){const r=n.path,s=r.length+1;let i=r;w.isDocumentKey(i)||(i=i.child(""));const o=new Z(new w(i),0);let a=new se(M);return this.wr.forEachWhile(c=>{const u=c.key.path;return!!r.isPrefixOf(u)&&(u.length===s&&(a=a.add(c.pr)),!0)},o),m.resolve(this.Dr(a))}Dr(e){const n=[];return e.forEach(r=>{const s=this.Sr(r);s!==null&&n.push(s)}),n}removeMutationBatch(e,n){F(this.Cr(n.batchId,"removed")===0),this.mutationQueue.shift();let r=this.wr;return m.forEach(n.mutations,s=>{const i=new Z(s.key,n.batchId);return r=r.delete(i),this.referenceDelegate.markPotentiallyOrphaned(e,s.key)}).next(()=>{this.wr=r})}Mn(e){}containsKey(e,n){const r=new Z(n,0),s=this.wr.firstAfterOrEqual(r);return m.resolve(n.isEqual(s&&s.key))}performConsistencyCheck(e){return this.mutationQueue.length,m.resolve()}Cr(e,n){return this.br(e)}br(e){return this.mutationQueue.length===0?0:e-this.mutationQueue[0].batchId}Sr(e){const n=this.br(e);return n<0||n>=this.mutationQueue.length?null:this.mutationQueue[n]}}/**
1272
+ */class Y_{constructor(e,t){this.indexManager=e,this.referenceDelegate=t,this.mutationQueue=[],this.yr=1,this.wr=new se(Z.Ir)}checkEmpty(e){return m.resolve(this.mutationQueue.length===0)}addMutationBatch(e,t,r,s){const i=this.yr;this.yr++,this.mutationQueue.length>0&&this.mutationQueue[this.mutationQueue.length-1];const o=new __(i,t,r,s);this.mutationQueue.push(o);for(const a of s)this.wr=this.wr.add(new Z(a.key,i)),this.indexManager.addToCollectionParentIndex(e,a.key.path.popLast());return m.resolve(o)}lookupMutationBatch(e,t){return m.resolve(this.Sr(t))}getNextMutationBatchAfterBatchId(e,t){const r=t+1,s=this.br(r),i=s<0?0:s;return m.resolve(this.mutationQueue.length>i?this.mutationQueue[i]:null)}getHighestUnacknowledgedBatchId(){return m.resolve(this.mutationQueue.length===0?-1:this.yr-1)}getAllMutationBatches(e){return m.resolve(this.mutationQueue.slice())}getAllMutationBatchesAffectingDocumentKey(e,t){const r=new Z(t,0),s=new Z(t,Number.POSITIVE_INFINITY),i=[];return this.wr.forEachInRange([r,s],o=>{const a=this.Sr(o.pr);i.push(a)}),m.resolve(i)}getAllMutationBatchesAffectingDocumentKeys(e,t){let r=new se(M);return t.forEach(s=>{const i=new Z(s,0),o=new Z(s,Number.POSITIVE_INFINITY);this.wr.forEachInRange([i,o],a=>{r=r.add(a.pr)})}),m.resolve(this.Dr(r))}getAllMutationBatchesAffectingQuery(e,t){const r=t.path,s=r.length+1;let i=r;w.isDocumentKey(i)||(i=i.child(""));const o=new Z(new w(i),0);let a=new se(M);return this.wr.forEachWhile(c=>{const u=c.key.path;return!!r.isPrefixOf(u)&&(u.length===s&&(a=a.add(c.pr)),!0)},o),m.resolve(this.Dr(a))}Dr(e){const t=[];return e.forEach(r=>{const s=this.Sr(r);s!==null&&t.push(s)}),t}removeMutationBatch(e,t){F(this.Cr(t.batchId,"removed")===0),this.mutationQueue.shift();let r=this.wr;return m.forEach(t.mutations,s=>{const i=new Z(s.key,t.batchId);return r=r.delete(i),this.referenceDelegate.markPotentiallyOrphaned(e,s.key)}).next(()=>{this.wr=r})}Mn(e){}containsKey(e,t){const r=new Z(t,0),s=this.wr.firstAfterOrEqual(r);return m.resolve(t.isEqual(s&&s.key))}performConsistencyCheck(e){return this.mutationQueue.length,m.resolve()}Cr(e,t){return this.br(e)}br(e){return this.mutationQueue.length===0?0:e-this.mutationQueue[0].batchId}Sr(e){const t=this.br(e);return t<0||t>=this.mutationQueue.length?null:this.mutationQueue[t]}}/**
1273
1273
  * @license
1274
1274
  * Copyright 2017 Google LLC
1275
1275
  *
@@ -1284,7 +1284,7 @@
1284
1284
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1285
1285
  * See the License for the specific language governing permissions and
1286
1286
  * limitations under the License.
1287
- */class M_{constructor(e){this.vr=e,this.docs=function(){return new q(w.comparator)}(),this.size=0}setIndexManager(e){this.indexManager=e}addEntry(e,n){const r=n.key,s=this.docs.get(r),i=s?s.size:0,o=this.vr(n);return this.docs=this.docs.insert(r,{document:n.mutableCopy(),size:o}),this.size+=o-i,this.indexManager.addToCollectionParentIndex(e,r.path.popLast())}removeEntry(e){const n=this.docs.get(e);n&&(this.docs=this.docs.remove(e),this.size-=n.size)}getEntry(e,n){const r=this.docs.get(n);return m.resolve(r?r.document.mutableCopy():he.newInvalidDocument(n))}getEntries(e,n){let r=Ze();return n.forEach(s=>{const i=this.docs.get(s);r=r.insert(s,i?i.document.mutableCopy():he.newInvalidDocument(s))}),m.resolve(r)}getDocumentsMatchingQuery(e,n,r,s){let i=Ze();const o=n.path,a=new w(o.child("")),c=this.docs.getIteratorFrom(a);for(;c.hasNext();){const{key:u,value:{document:l}}=c.getNext();if(!o.isPrefixOf(u.path))break;u.path.length>o.length+1||Tg(Eg(l),r)<=0||(s.has(l.key)||Ss(n,l))&&(i=i.insert(l.key,l.mutableCopy()))}return m.resolve(i)}getAllFromCollectionGroup(e,n,r,s){A()}Fr(e,n){return m.forEach(this.docs,r=>n(r))}newChangeBuffer(e){return new x_(this)}getSize(e){return m.resolve(this.size)}}class x_ extends k_{constructor(e){super(),this.ar=e}applyChanges(e){const n=[];return this.changes.forEach((r,s)=>{s.isValidDocument()?n.push(this.ar.addEntry(e,s)):this.ar.removeEntry(r)}),m.waitFor(n)}getFromCache(e,n){return this.ar.getEntry(e,n)}getAllFromCache(e,n){return this.ar.getEntries(e,n)}}/**
1287
+ */class X_{constructor(e){this.vr=e,this.docs=function(){return new $(w.comparator)}(),this.size=0}setIndexManager(e){this.indexManager=e}addEntry(e,t){const r=t.key,s=this.docs.get(r),i=s?s.size:0,o=this.vr(t);return this.docs=this.docs.insert(r,{document:t.mutableCopy(),size:o}),this.size+=o-i,this.indexManager.addToCollectionParentIndex(e,r.path.popLast())}removeEntry(e){const t=this.docs.get(e);t&&(this.docs=this.docs.remove(e),this.size-=t.size)}getEntry(e,t){const r=this.docs.get(t);return m.resolve(r?r.document.mutableCopy():he.newInvalidDocument(t))}getEntries(e,t){let r=nt();return t.forEach(s=>{const i=this.docs.get(s);r=r.insert(s,i?i.document.mutableCopy():he.newInvalidDocument(s))}),m.resolve(r)}getDocumentsMatchingQuery(e,t,r,s){let i=nt();const o=t.path,a=new w(o.child("")),c=this.docs.getIteratorFrom(a);for(;c.hasNext();){const{key:u,value:{document:l}}=c.getNext();if(!o.isPrefixOf(u.path))break;u.path.length>o.length+1||Mg(Lg(l),r)<=0||(s.has(l.key)||Ns(t,l))&&(i=i.insert(l.key,l.mutableCopy()))}return m.resolve(i)}getAllFromCollectionGroup(e,t,r,s){A()}Fr(e,t){return m.forEach(this.docs,r=>t(r))}newChangeBuffer(e){return new J_(this)}getSize(e){return m.resolve(this.size)}}class J_ extends H_{constructor(e){super(),this.ar=e}applyChanges(e){const t=[];return this.changes.forEach((r,s)=>{s.isValidDocument()?t.push(this.ar.addEntry(e,s)):this.ar.removeEntry(r)}),m.waitFor(t)}getFromCache(e,t){return this.ar.getEntry(e,t)}getAllFromCache(e,t){return this.ar.getEntries(e,t)}}/**
1288
1288
  * @license
1289
1289
  * Copyright 2017 Google LLC
1290
1290
  *
@@ -1299,7 +1299,7 @@
1299
1299
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1300
1300
  * See the License for the specific language governing permissions and
1301
1301
  * limitations under the License.
1302
- */class U_{constructor(e){this.persistence=e,this.Mr=new dn(n=>No(n),Oo),this.lastRemoteSnapshotVersion=S.min(),this.highestTargetId=0,this.Or=0,this.Nr=new Wo,this.targetCount=0,this.Br=pn.Nn()}forEachTarget(e,n){return this.Mr.forEach((r,s)=>n(s)),m.resolve()}getLastRemoteSnapshotVersion(e){return m.resolve(this.lastRemoteSnapshotVersion)}getHighestSequenceNumber(e){return m.resolve(this.Or)}allocateTargetId(e){return this.highestTargetId=this.Br.next(),m.resolve(this.highestTargetId)}setTargetsMetadata(e,n,r){return r&&(this.lastRemoteSnapshotVersion=r),n>this.Or&&(this.Or=n),m.resolve()}qn(e){this.Mr.set(e.target,e);const n=e.targetId;n>this.highestTargetId&&(this.Br=new pn(n),this.highestTargetId=n),e.sequenceNumber>this.Or&&(this.Or=e.sequenceNumber)}addTargetData(e,n){return this.qn(n),this.targetCount+=1,m.resolve()}updateTargetData(e,n){return this.qn(n),m.resolve()}removeTargetData(e,n){return this.Mr.delete(n.target),this.Nr.Vr(n.targetId),this.targetCount-=1,m.resolve()}removeTargets(e,n,r){let s=0;const i=[];return this.Mr.forEach((o,a)=>{a.sequenceNumber<=n&&r.get(a.targetId)===null&&(this.Mr.delete(o),i.push(this.removeMatchingKeysForTargetId(e,a.targetId)),s++)}),m.waitFor(i).next(()=>s)}getTargetCount(e){return m.resolve(this.targetCount)}getTargetData(e,n){const r=this.Mr.get(n)||null;return m.resolve(r)}addMatchingKeys(e,n,r){return this.Nr.dr(n,r),m.resolve()}removeMatchingKeys(e,n,r){this.Nr.Rr(n,r);const s=this.persistence.referenceDelegate,i=[];return s&&n.forEach(o=>{i.push(s.markPotentiallyOrphaned(e,o))}),m.waitFor(i)}removeMatchingKeysForTargetId(e,n){return this.Nr.Vr(n),m.resolve()}getMatchingKeysForTargetId(e,n){const r=this.Nr.gr(n);return m.resolve(r)}containsKey(e,n){return m.resolve(this.Nr.containsKey(n))}}/**
1302
+ */class Z_{constructor(e){this.persistence=e,this.Mr=new mn(t=>Mo(t),xo),this.lastRemoteSnapshotVersion=S.min(),this.highestTargetId=0,this.Or=0,this.Nr=new Yo,this.targetCount=0,this.Lr=_n.Nn()}forEachTarget(e,t){return this.Mr.forEach((r,s)=>t(s)),m.resolve()}getLastRemoteSnapshotVersion(e){return m.resolve(this.lastRemoteSnapshotVersion)}getHighestSequenceNumber(e){return m.resolve(this.Or)}allocateTargetId(e){return this.highestTargetId=this.Lr.next(),m.resolve(this.highestTargetId)}setTargetsMetadata(e,t,r){return r&&(this.lastRemoteSnapshotVersion=r),t>this.Or&&(this.Or=t),m.resolve()}qn(e){this.Mr.set(e.target,e);const t=e.targetId;t>this.highestTargetId&&(this.Lr=new _n(t),this.highestTargetId=t),e.sequenceNumber>this.Or&&(this.Or=e.sequenceNumber)}addTargetData(e,t){return this.qn(t),this.targetCount+=1,m.resolve()}updateTargetData(e,t){return this.qn(t),m.resolve()}removeTargetData(e,t){return this.Mr.delete(t.target),this.Nr.Vr(t.targetId),this.targetCount-=1,m.resolve()}removeTargets(e,t,r){let s=0;const i=[];return this.Mr.forEach((o,a)=>{a.sequenceNumber<=t&&r.get(a.targetId)===null&&(this.Mr.delete(o),i.push(this.removeMatchingKeysForTargetId(e,a.targetId)),s++)}),m.waitFor(i).next(()=>s)}getTargetCount(e){return m.resolve(this.targetCount)}getTargetData(e,t){const r=this.Mr.get(t)||null;return m.resolve(r)}addMatchingKeys(e,t,r){return this.Nr.dr(t,r),m.resolve()}removeMatchingKeys(e,t,r){this.Nr.Rr(t,r);const s=this.persistence.referenceDelegate,i=[];return s&&t.forEach(o=>{i.push(s.markPotentiallyOrphaned(e,o))}),m.waitFor(i)}removeMatchingKeysForTargetId(e,t){return this.Nr.Vr(t),m.resolve()}getMatchingKeysForTargetId(e,t){const r=this.Nr.gr(t);return m.resolve(r)}containsKey(e,t){return m.resolve(this.Nr.containsKey(t))}}/**
1303
1303
  * @license
1304
1304
  * Copyright 2017 Google LLC
1305
1305
  *
@@ -1314,7 +1314,7 @@
1314
1314
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1315
1315
  * See the License for the specific language governing permissions and
1316
1316
  * limitations under the License.
1317
- */class F_{constructor(e,n){this.Lr={},this.overlays={},this.kr=new Po(0),this.qr=!1,this.qr=!0,this.referenceDelegate=e(this),this.Qr=new U_(this),this.indexManager=new b_,this.remoteDocumentCache=function(s){return new M_(s)}(r=>this.referenceDelegate.Kr(r)),this.serializer=new P_(n),this.$r=new O_(this.serializer)}start(){return Promise.resolve()}shutdown(){return this.qr=!1,Promise.resolve()}get started(){return this.qr}setDatabaseDeletedListener(){}setNetworkEnabled(){}getIndexManager(e){return this.indexManager}getDocumentOverlayCache(e){let n=this.overlays[e.toKey()];return n||(n=new V_,this.overlays[e.toKey()]=n),n}getMutationQueue(e,n){let r=this.Lr[e.toKey()];return r||(r=new L_(n,this.referenceDelegate),this.Lr[e.toKey()]=r),r}getTargetCache(){return this.Qr}getRemoteDocumentCache(){return this.remoteDocumentCache}getBundleCache(){return this.$r}runTransaction(e,n,r){v("MemoryPersistence","Starting transaction:",e);const s=new B_(this.kr.next());return this.referenceDelegate.Ur(),r(s).next(i=>this.referenceDelegate.Wr(s).next(()=>i)).toPromise().then(i=>(s.raiseOnCommittedEvent(),i))}Gr(e,n){return m.or(Object.values(this.Lr).map(r=>()=>r.containsKey(e,n)))}}class B_ extends Ig{constructor(e){super(),this.currentSequenceNumber=e}}class Go{constructor(e){this.persistence=e,this.zr=new Wo,this.jr=null}static Hr(e){return new Go(e)}get Jr(){if(this.jr)return this.jr;throw A()}addReference(e,n,r){return this.zr.addReference(r,n),this.Jr.delete(r.toString()),m.resolve()}removeReference(e,n,r){return this.zr.removeReference(r,n),this.Jr.add(r.toString()),m.resolve()}markPotentiallyOrphaned(e,n){return this.Jr.add(n.toString()),m.resolve()}removeTarget(e,n){this.zr.Vr(n.targetId).forEach(s=>this.Jr.add(s.toString()));const r=this.persistence.getTargetCache();return r.getMatchingKeysForTargetId(e,n.targetId).next(s=>{s.forEach(i=>this.Jr.add(i.toString()))}).next(()=>r.removeTargetData(e,n))}Ur(){this.jr=new Set}Wr(e){const n=this.persistence.getRemoteDocumentCache().newChangeBuffer();return m.forEach(this.Jr,r=>{const s=w.fromPath(r);return this.Yr(e,s).next(i=>{i||n.removeEntry(s,S.min())})}).next(()=>(this.jr=null,n.apply(e)))}updateLimboDocument(e,n){return this.Yr(e,n).next(r=>{r?this.Jr.delete(n.toString()):this.Jr.add(n.toString())})}Kr(e){return 0}Yr(e,n){return m.or([()=>m.resolve(this.zr.containsKey(n)),()=>this.persistence.getTargetCache().containsKey(e,n),()=>this.persistence.Gr(e,n)])}}/**
1317
+ */class ey{constructor(e,t){this.Br={},this.overlays={},this.kr=new ko(0),this.qr=!1,this.qr=!0,this.referenceDelegate=e(this),this.Qr=new Z_(this),this.indexManager=new $_,this.remoteDocumentCache=function(s){return new X_(s)}(r=>this.referenceDelegate.Kr(r)),this.serializer=new j_(t),this.$r=new K_(this.serializer)}start(){return Promise.resolve()}shutdown(){return this.qr=!1,Promise.resolve()}get started(){return this.qr}setDatabaseDeletedListener(){}setNetworkEnabled(){}getIndexManager(e){return this.indexManager}getDocumentOverlayCache(e){let t=this.overlays[e.toKey()];return t||(t=new Q_,this.overlays[e.toKey()]=t),t}getMutationQueue(e,t){let r=this.Br[e.toKey()];return r||(r=new Y_(t,this.referenceDelegate),this.Br[e.toKey()]=r),r}getTargetCache(){return this.Qr}getRemoteDocumentCache(){return this.remoteDocumentCache}getBundleCache(){return this.$r}runTransaction(e,t,r){v("MemoryPersistence","Starting transaction:",e);const s=new ty(this.kr.next());return this.referenceDelegate.Ur(),r(s).next(i=>this.referenceDelegate.Wr(s).next(()=>i)).toPromise().then(i=>(s.raiseOnCommittedEvent(),i))}Gr(e,t){return m.or(Object.values(this.Br).map(r=>()=>r.containsKey(e,t)))}}class ty extends Ug{constructor(e){super(),this.currentSequenceNumber=e}}class Xo{constructor(e){this.persistence=e,this.zr=new Yo,this.jr=null}static Hr(e){return new Xo(e)}get Jr(){if(this.jr)return this.jr;throw A()}addReference(e,t,r){return this.zr.addReference(r,t),this.Jr.delete(r.toString()),m.resolve()}removeReference(e,t,r){return this.zr.removeReference(r,t),this.Jr.add(r.toString()),m.resolve()}markPotentiallyOrphaned(e,t){return this.Jr.add(t.toString()),m.resolve()}removeTarget(e,t){this.zr.Vr(t.targetId).forEach(s=>this.Jr.add(s.toString()));const r=this.persistence.getTargetCache();return r.getMatchingKeysForTargetId(e,t.targetId).next(s=>{s.forEach(i=>this.Jr.add(i.toString()))}).next(()=>r.removeTargetData(e,t))}Ur(){this.jr=new Set}Wr(e){const t=this.persistence.getRemoteDocumentCache().newChangeBuffer();return m.forEach(this.Jr,r=>{const s=w.fromPath(r);return this.Yr(e,s).next(i=>{i||t.removeEntry(s,S.min())})}).next(()=>(this.jr=null,t.apply(e)))}updateLimboDocument(e,t){return this.Yr(e,t).next(r=>{r?this.Jr.delete(t.toString()):this.Jr.add(t.toString())})}Kr(e){return 0}Yr(e,t){return m.or([()=>m.resolve(this.zr.containsKey(t)),()=>this.persistence.getTargetCache().containsKey(e,t),()=>this.persistence.Gr(e,t)])}}/**
1318
1318
  * @license
1319
1319
  * Copyright 2017 Google LLC
1320
1320
  *
@@ -1329,7 +1329,7 @@
1329
1329
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1330
1330
  * See the License for the specific language governing permissions and
1331
1331
  * limitations under the License.
1332
- */class Ko{constructor(e,n,r,s){this.targetId=e,this.fromCache=n,this.qi=r,this.Qi=s}static Ki(e,n){let r=D(),s=D();for(const i of n.docChanges)switch(i.type){case 0:r=r.add(i.doc.key);break;case 1:s=s.add(i.doc.key)}return new Ko(e,n.fromCache,r,s)}}/**
1332
+ */class Jo{constructor(e,t,r,s){this.targetId=e,this.fromCache=t,this.qi=r,this.Qi=s}static Ki(e,t){let r=D(),s=D();for(const i of t.docChanges)switch(i.type){case 0:r=r.add(i.doc.key);break;case 1:s=s.add(i.doc.key)}return new Jo(e,t.fromCache,r,s)}}/**
1333
1333
  * @license
1334
1334
  * Copyright 2023 Google LLC
1335
1335
  *
@@ -1344,7 +1344,7 @@
1344
1344
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1345
1345
  * See the License for the specific language governing permissions and
1346
1346
  * limitations under the License.
1347
- */class j_{constructor(){this._documentReadCount=0}get documentReadCount(){return this._documentReadCount}incrementDocumentReadCount(e){this._documentReadCount+=e}}/**
1347
+ */class ny{constructor(){this._documentReadCount=0}get documentReadCount(){return this._documentReadCount}incrementDocumentReadCount(e){this._documentReadCount+=e}}/**
1348
1348
  * @license
1349
1349
  * Copyright 2019 Google LLC
1350
1350
  *
@@ -1359,7 +1359,7 @@
1359
1359
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1360
1360
  * See the License for the specific language governing permissions and
1361
1361
  * limitations under the License.
1362
- */class $_{constructor(){this.$i=!1,this.Ui=!1,this.Wi=100,this.Gi=function(){return zf()?8:Vt.v(W())>0?6:4}()}initialize(e,n){this.zi=e,this.indexManager=n,this.$i=!0}getDocumentsMatchingQuery(e,n,r,s){const i={result:null};return this.ji(e,n).next(o=>{i.result=o}).next(()=>{if(!i.result)return this.Hi(e,n,s,r).next(o=>{i.result=o})}).next(()=>{if(i.result)return;const o=new j_;return this.Ji(e,n,o).next(a=>{if(i.result=a,this.Ui)return this.Yi(e,n,o,a.size)})}).next(()=>i.result)}Yi(e,n,r,s){return r.documentReadCount<this.Wi?(ir()<=N.DEBUG&&v("QueryEngine","SDK will not create cache indexes for query:",hn(n),"since it only creates cache indexes for collection contains","more than or equal to",this.Wi,"documents"),m.resolve()):(ir()<=N.DEBUG&&v("QueryEngine","Query:",hn(n),"scans",r.documentReadCount,"local documents and returns",s,"documents as results."),r.documentReadCount>this.Gi*s?(ir()<=N.DEBUG&&v("QueryEngine","The SDK decides to create cache indexes for query:",hn(n),"as using cache indexes may help improve performance."),this.indexManager.createTargetIndexes(e,$e(n))):m.resolve())}ji(e,n){if(sl(n))return m.resolve(null);let r=$e(n);return this.indexManager.getIndexType(e,r).next(s=>s===0?null:(n.limit!==null&&s===1&&(n=Rs(n,null,"F"),r=$e(n)),this.indexManager.getDocumentsMatchingTarget(e,r).next(i=>{const o=D(...i);return this.zi.getDocuments(e,o).next(a=>this.indexManager.getMinOffset(e,r).next(c=>{const u=this.Zi(n,a);return this.Xi(n,u,o,c.readTime)?this.ji(e,Rs(n,null,"F")):this.es(e,u,n,c)}))})))}Hi(e,n,r,s){return sl(n)||s.isEqual(S.min())?m.resolve(null):this.zi.getDocuments(e,r).next(i=>{const o=this.Zi(n,i);return this.Xi(n,o,r,s)?m.resolve(null):(ir()<=N.DEBUG&&v("QueryEngine","Re-using previous result from %s to execute query: %s",s.toString(),hn(n)),this.es(e,o,n,vg(s,-1)).next(a=>a))})}Zi(e,n){let r=new se(al(e));return n.forEach((s,i)=>{Ss(e,i)&&(r=r.add(i))}),r}Xi(e,n,r,s){if(e.limit===null)return!1;if(r.size!==n.size)return!0;const i=e.limitType==="F"?n.last():n.first();return!!i&&(i.hasPendingWrites||i.version.compareTo(s)>0)}Ji(e,n,r){return ir()<=N.DEBUG&&v("QueryEngine","Using full collection scan to execute query:",hn(n)),this.zi.getDocumentsMatchingQuery(e,n,ft.min(),r)}es(e,n,r,s){return this.zi.getDocumentsMatchingQuery(e,r,s).next(i=>(n.forEach(o=>{i=i.insert(o.key,o)}),i))}}/**
1362
+ */class ry{constructor(){this.$i=!1,this.Ui=!1,this.Wi=100,this.Gi=function(){return ip()?8:Ut.v(W())>0?6:4}()}initialize(e,t){this.zi=e,this.indexManager=t,this.$i=!0}getDocumentsMatchingQuery(e,t,r,s){const i={result:null};return this.ji(e,t).next(o=>{i.result=o}).next(()=>{if(!i.result)return this.Hi(e,t,s,r).next(o=>{i.result=o})}).next(()=>{if(i.result)return;const o=new ny;return this.Ji(e,t,o).next(a=>{if(i.result=a,this.Ui)return this.Yi(e,t,o,a.size)})}).next(()=>i.result)}Yi(e,t,r,s){return r.documentReadCount<this.Wi?(hr()<=N.DEBUG&&v("QueryEngine","SDK will not create cache indexes for query:",pn(t),"since it only creates cache indexes for collection contains","more than or equal to",this.Wi,"documents"),m.resolve()):(hr()<=N.DEBUG&&v("QueryEngine","Query:",pn(t),"scans",r.documentReadCount,"local documents and returns",s,"documents as results."),r.documentReadCount>this.Gi*s?(hr()<=N.DEBUG&&v("QueryEngine","The SDK decides to create cache indexes for query:",pn(t),"as using cache indexes may help improve performance."),this.indexManager.createTargetIndexes(e,He(t))):m.resolve())}ji(e,t){if(fl(t))return m.resolve(null);let r=He(t);return this.indexManager.getIndexType(e,r).next(s=>s===0?null:(t.limit!==null&&s===1&&(t=ks(t,null,"F"),r=He(t)),this.indexManager.getDocumentsMatchingTarget(e,r).next(i=>{const o=D(...i);return this.zi.getDocuments(e,o).next(a=>this.indexManager.getMinOffset(e,r).next(c=>{const u=this.Zi(t,a);return this.Xi(t,u,o,c.readTime)?this.ji(e,ks(t,null,"F")):this.es(e,u,t,c)}))})))}Hi(e,t,r,s){return fl(t)||s.isEqual(S.min())?m.resolve(null):this.zi.getDocuments(e,r).next(i=>{const o=this.Zi(t,i);return this.Xi(t,o,r,s)?m.resolve(null):(hr()<=N.DEBUG&&v("QueryEngine","Re-using previous result from %s to execute query: %s",s.toString(),pn(t)),this.es(e,o,t,Vg(s,-1)).next(a=>a))})}Zi(e,t){let r=new se(gl(e));return t.forEach((s,i)=>{Ns(e,i)&&(r=r.add(i))}),r}Xi(e,t,r,s){if(e.limit===null)return!1;if(r.size!==t.size)return!0;const i=e.limitType==="F"?t.last():t.first();return!!i&&(i.hasPendingWrites||i.version.compareTo(s)>0)}Ji(e,t,r){return hr()<=N.DEBUG&&v("QueryEngine","Using full collection scan to execute query:",pn(t)),this.zi.getDocumentsMatchingQuery(e,t,_t.min(),r)}es(e,t,r,s){return this.zi.getDocumentsMatchingQuery(e,r,s).next(i=>(t.forEach(o=>{i=i.insert(o.key,o)}),i))}}/**
1363
1363
  * @license
1364
1364
  * Copyright 2020 Google LLC
1365
1365
  *
@@ -1374,7 +1374,7 @@
1374
1374
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1375
1375
  * See the License for the specific language governing permissions and
1376
1376
  * limitations under the License.
1377
- */class q_{constructor(e,n,r,s){this.persistence=e,this.ts=n,this.serializer=s,this.ns=new q(M),this.rs=new dn(i=>No(i),Oo),this.ss=new Map,this.os=e.getRemoteDocumentCache(),this.Qr=e.getTargetCache(),this.$r=e.getBundleCache(),this._s(r)}_s(e){this.documentOverlayCache=this.persistence.getDocumentOverlayCache(e),this.indexManager=this.persistence.getIndexManager(e),this.mutationQueue=this.persistence.getMutationQueue(e,this.indexManager),this.localDocuments=new N_(this.os,this.mutationQueue,this.documentOverlayCache,this.indexManager),this.os.setIndexManager(this.indexManager),this.ts.initialize(this.localDocuments,this.indexManager)}collectGarbage(e){return this.persistence.runTransaction("Collect garbage","readwrite-primary",n=>e.collect(n,this.ns))}}function z_(t,e,n,r){return new q_(t,e,n,r)}async function Bl(t,e){const n=P(t);return await n.persistence.runTransaction("Handle user change","readonly",r=>{let s;return n.mutationQueue.getAllMutationBatches(r).next(i=>(s=i,n._s(e),n.mutationQueue.getAllMutationBatches(r))).next(i=>{const o=[],a=[];let c=D();for(const u of s){o.push(u.batchId);for(const l of u.mutations)c=c.add(l.key)}for(const u of i){a.push(u.batchId);for(const l of u.mutations)c=c.add(l.key)}return n.localDocuments.getDocuments(r,c).next(u=>({us:u,removedBatchIds:o,addedBatchIds:a}))})})}function H_(t,e){const n=P(t);return n.persistence.runTransaction("Acknowledge batch","readwrite-primary",r=>{const s=e.batch.keys(),i=n.os.newChangeBuffer({trackRemovals:!0});return function(a,c,u,l){const h=u.batch,d=h.keys();let f=m.resolve();return d.forEach(E=>{f=f.next(()=>l.getEntry(c,E)).next(T=>{const _=u.docVersions.get(E);F(_!==null),T.version.compareTo(_)<0&&(h.applyToRemoteDocument(T,u),T.isValidDocument()&&(T.setReadTime(u.commitVersion),l.addEntry(T)))})}),f.next(()=>a.mutationQueue.removeMutationBatch(c,h))}(n,r,e,i).next(()=>i.apply(r)).next(()=>n.mutationQueue.performConsistencyCheck(r)).next(()=>n.documentOverlayCache.removeOverlaysForBatchId(r,s,e.batch.batchId)).next(()=>n.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(r,function(a){let c=D();for(let u=0;u<a.mutationResults.length;++u)a.mutationResults[u].transformResults.length>0&&(c=c.add(a.batch.mutations[u].key));return c}(e))).next(()=>n.localDocuments.getDocuments(r,s))})}function jl(t){const e=P(t);return e.persistence.runTransaction("Get last remote snapshot version","readonly",n=>e.Qr.getLastRemoteSnapshotVersion(n))}function W_(t,e){const n=P(t),r=e.snapshotVersion;let s=n.ns;return n.persistence.runTransaction("Apply remote event","readwrite-primary",i=>{const o=n.os.newChangeBuffer({trackRemovals:!0});s=n.ns;const a=[];e.targetChanges.forEach((l,h)=>{const d=s.get(h);if(!d)return;a.push(n.Qr.removeMatchingKeys(i,l.removedDocuments,h).next(()=>n.Qr.addMatchingKeys(i,l.addedDocuments,h)));let f=d.withSequenceNumber(i.currentSequenceNumber);e.targetMismatches.get(h)!==null?f=f.withResumeToken(le.EMPTY_BYTE_STRING,S.min()).withLastLimboFreeSnapshotVersion(S.min()):l.resumeToken.approximateByteSize()>0&&(f=f.withResumeToken(l.resumeToken,r)),s=s.insert(h,f),function(T,_,C){return T.resumeToken.approximateByteSize()===0||_.snapshotVersion.toMicroseconds()-T.snapshotVersion.toMicroseconds()>=3e8?!0:C.addedDocuments.size+C.modifiedDocuments.size+C.removedDocuments.size>0}(d,f,l)&&a.push(n.Qr.updateTargetData(i,f))});let c=Ze(),u=D();if(e.documentUpdates.forEach(l=>{e.resolvedLimboDocuments.has(l)&&a.push(n.persistence.referenceDelegate.updateLimboDocument(i,l))}),a.push(G_(i,o,e.documentUpdates).next(l=>{c=l.cs,u=l.ls})),!r.isEqual(S.min())){const l=n.Qr.getLastRemoteSnapshotVersion(i).next(h=>n.Qr.setTargetsMetadata(i,i.currentSequenceNumber,r));a.push(l)}return m.waitFor(a).next(()=>o.apply(i)).next(()=>n.localDocuments.getLocalViewOfDocuments(i,c,u)).next(()=>c)}).then(i=>(n.ns=s,i))}function G_(t,e,n){let r=D(),s=D();return n.forEach(i=>r=r.add(i)),e.getEntries(t,r).next(i=>{let o=Ze();return n.forEach((a,c)=>{const u=i.get(a);c.isFoundDocument()!==u.isFoundDocument()&&(s=s.add(a)),c.isNoDocument()&&c.version.isEqual(S.min())?(e.removeEntry(a,c.readTime),o=o.insert(a,c)):!u.isValidDocument()||c.version.compareTo(u.version)>0||c.version.compareTo(u.version)===0&&u.hasPendingWrites?(e.addEntry(c),o=o.insert(a,c)):v("LocalStore","Ignoring outdated watch update for ",a,". Current version:",u.version," Watch version:",c.version)}),{cs:o,ls:s}})}function K_(t,e){const n=P(t);return n.persistence.runTransaction("Get next mutation batch","readonly",r=>(e===void 0&&(e=-1),n.mutationQueue.getNextMutationBatchAfterBatchId(r,e)))}function Q_(t,e){const n=P(t);return n.persistence.runTransaction("Allocate target","readwrite",r=>{let s;return n.Qr.getTargetData(r,e).next(i=>i?(s=i,m.resolve(s)):n.Qr.allocateTargetId(r).next(o=>(s=new _t(e,o,"TargetPurposeListen",r.currentSequenceNumber),n.Qr.addTargetData(r,s).next(()=>s))))}).then(r=>{const s=n.ns.get(r.targetId);return(s===null||r.snapshotVersion.compareTo(s.snapshotVersion)>0)&&(n.ns=n.ns.insert(r.targetId,r),n.rs.set(e,r.targetId)),r})}async function Qo(t,e,n){const r=P(t),s=r.ns.get(e),i=n?"readwrite":"readwrite-primary";try{n||await r.persistence.runTransaction("Release target",i,o=>r.persistence.referenceDelegate.removeTarget(o,s))}catch(o){if(!ur(o))throw o;v("LocalStore",`Failed to update sequence numbers for target ${e}: ${o}`)}r.ns=r.ns.remove(e),r.rs.delete(s.target)}function $l(t,e,n){const r=P(t);let s=S.min(),i=D();return r.persistence.runTransaction("Execute query","readwrite",o=>function(c,u,l){const h=P(c),d=h.rs.get(l);return d!==void 0?m.resolve(h.ns.get(d)):h.Qr.getTargetData(u,l)}(r,o,$e(e)).next(a=>{if(a)return s=a.lastLimboFreeSnapshotVersion,r.Qr.getMatchingKeysForTargetId(o,a.targetId).next(c=>{i=c})}).next(()=>r.ts.getDocumentsMatchingQuery(o,e,n?s:S.min(),n?i:D())).next(a=>(Y_(r,jg(e),a),{documents:a,hs:i})))}function Y_(t,e,n){let r=t.ss.get(e)||S.min();n.forEach((s,i)=>{i.readTime.compareTo(r)>0&&(r=i.readTime)}),t.ss.set(e,r)}class ql{constructor(){this.activeTargetIds=Gg()}As(e){this.activeTargetIds=this.activeTargetIds.add(e)}Rs(e){this.activeTargetIds=this.activeTargetIds.delete(e)}ds(){const e={activeTargetIds:this.activeTargetIds.toArray(),updateTimeMs:Date.now()};return JSON.stringify(e)}}class X_{constructor(){this.no=new ql,this.ro={},this.onlineStateHandler=null,this.sequenceNumberHandler=null}addPendingMutation(e){}updateMutationState(e,n,r){}addLocalQueryTarget(e){return this.no.As(e),this.ro[e]||"not-current"}updateQueryState(e,n,r){this.ro[e]=n}removeLocalQueryTarget(e){this.no.Rs(e)}isLocalQueryTarget(e){return this.no.activeTargetIds.has(e)}clearQueryState(e){delete this.ro[e]}getAllActiveQueryTargets(){return this.no.activeTargetIds}isActiveQueryTarget(e){return this.no.activeTargetIds.has(e)}start(){return this.no=new ql,Promise.resolve()}handleUserChange(e,n,r){}setOnlineState(e){}shutdown(){}writeSequenceNumber(e){}notifyBundleLoaded(e){}}/**
1377
+ */class sy{constructor(e,t,r,s){this.persistence=e,this.ts=t,this.serializer=s,this.ns=new $(M),this.rs=new mn(i=>Mo(i),xo),this.ss=new Map,this.os=e.getRemoteDocumentCache(),this.Qr=e.getTargetCache(),this.$r=e.getBundleCache(),this._s(r)}_s(e){this.documentOverlayCache=this.persistence.getDocumentOverlayCache(e),this.indexManager=this.persistence.getIndexManager(e),this.mutationQueue=this.persistence.getMutationQueue(e,this.indexManager),this.localDocuments=new G_(this.os,this.mutationQueue,this.documentOverlayCache,this.indexManager),this.os.setIndexManager(this.indexManager),this.ts.initialize(this.localDocuments,this.indexManager)}collectGarbage(e){return this.persistence.runTransaction("Collect garbage","readwrite-primary",t=>e.collect(t,this.ns))}}function iy(n,e,t,r){return new sy(n,e,t,r)}async function Ql(n,e){const t=P(n);return await t.persistence.runTransaction("Handle user change","readonly",r=>{let s;return t.mutationQueue.getAllMutationBatches(r).next(i=>(s=i,t._s(e),t.mutationQueue.getAllMutationBatches(r))).next(i=>{const o=[],a=[];let c=D();for(const u of s){o.push(u.batchId);for(const l of u.mutations)c=c.add(l.key)}for(const u of i){a.push(u.batchId);for(const l of u.mutations)c=c.add(l.key)}return t.localDocuments.getDocuments(r,c).next(u=>({us:u,removedBatchIds:o,addedBatchIds:a}))})})}function oy(n,e){const t=P(n);return t.persistence.runTransaction("Acknowledge batch","readwrite-primary",r=>{const s=e.batch.keys(),i=t.os.newChangeBuffer({trackRemovals:!0});return function(a,c,u,l){const h=u.batch,d=h.keys();let f=m.resolve();return d.forEach(E=>{f=f.next(()=>l.getEntry(c,E)).next(T=>{const _=u.docVersions.get(E);F(_!==null),T.version.compareTo(_)<0&&(h.applyToRemoteDocument(T,u),T.isValidDocument()&&(T.setReadTime(u.commitVersion),l.addEntry(T)))})}),f.next(()=>a.mutationQueue.removeMutationBatch(c,h))}(t,r,e,i).next(()=>i.apply(r)).next(()=>t.mutationQueue.performConsistencyCheck(r)).next(()=>t.documentOverlayCache.removeOverlaysForBatchId(r,s,e.batch.batchId)).next(()=>t.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(r,function(a){let c=D();for(let u=0;u<a.mutationResults.length;++u)a.mutationResults[u].transformResults.length>0&&(c=c.add(a.batch.mutations[u].key));return c}(e))).next(()=>t.localDocuments.getDocuments(r,s))})}function Yl(n){const e=P(n);return e.persistence.runTransaction("Get last remote snapshot version","readonly",t=>e.Qr.getLastRemoteSnapshotVersion(t))}function ay(n,e){const t=P(n),r=e.snapshotVersion;let s=t.ns;return t.persistence.runTransaction("Apply remote event","readwrite-primary",i=>{const o=t.os.newChangeBuffer({trackRemovals:!0});s=t.ns;const a=[];e.targetChanges.forEach((l,h)=>{const d=s.get(h);if(!d)return;a.push(t.Qr.removeMatchingKeys(i,l.removedDocuments,h).next(()=>t.Qr.addMatchingKeys(i,l.addedDocuments,h)));let f=d.withSequenceNumber(i.currentSequenceNumber);e.targetMismatches.get(h)!==null?f=f.withResumeToken(le.EMPTY_BYTE_STRING,S.min()).withLastLimboFreeSnapshotVersion(S.min()):l.resumeToken.approximateByteSize()>0&&(f=f.withResumeToken(l.resumeToken,r)),s=s.insert(h,f),function(T,_,C){return T.resumeToken.approximateByteSize()===0||_.snapshotVersion.toMicroseconds()-T.snapshotVersion.toMicroseconds()>=3e8?!0:C.addedDocuments.size+C.modifiedDocuments.size+C.removedDocuments.size>0}(d,f,l)&&a.push(t.Qr.updateTargetData(i,f))});let c=nt(),u=D();if(e.documentUpdates.forEach(l=>{e.resolvedLimboDocuments.has(l)&&a.push(t.persistence.referenceDelegate.updateLimboDocument(i,l))}),a.push(cy(i,o,e.documentUpdates).next(l=>{c=l.cs,u=l.ls})),!r.isEqual(S.min())){const l=t.Qr.getLastRemoteSnapshotVersion(i).next(h=>t.Qr.setTargetsMetadata(i,i.currentSequenceNumber,r));a.push(l)}return m.waitFor(a).next(()=>o.apply(i)).next(()=>t.localDocuments.getLocalViewOfDocuments(i,c,u)).next(()=>c)}).then(i=>(t.ns=s,i))}function cy(n,e,t){let r=D(),s=D();return t.forEach(i=>r=r.add(i)),e.getEntries(n,r).next(i=>{let o=nt();return t.forEach((a,c)=>{const u=i.get(a);c.isFoundDocument()!==u.isFoundDocument()&&(s=s.add(a)),c.isNoDocument()&&c.version.isEqual(S.min())?(e.removeEntry(a,c.readTime),o=o.insert(a,c)):!u.isValidDocument()||c.version.compareTo(u.version)>0||c.version.compareTo(u.version)===0&&u.hasPendingWrites?(e.addEntry(c),o=o.insert(a,c)):v("LocalStore","Ignoring outdated watch update for ",a,". Current version:",u.version," Watch version:",c.version)}),{cs:o,ls:s}})}function uy(n,e){const t=P(n);return t.persistence.runTransaction("Get next mutation batch","readonly",r=>(e===void 0&&(e=-1),t.mutationQueue.getNextMutationBatchAfterBatchId(r,e)))}function ly(n,e){const t=P(n);return t.persistence.runTransaction("Allocate target","readwrite",r=>{let s;return t.Qr.getTargetData(r,e).next(i=>i?(s=i,m.resolve(s)):t.Qr.allocateTargetId(r).next(o=>(s=new Tt(e,o,"TargetPurposeListen",r.currentSequenceNumber),t.Qr.addTargetData(r,s).next(()=>s))))}).then(r=>{const s=t.ns.get(r.targetId);return(s===null||r.snapshotVersion.compareTo(s.snapshotVersion)>0)&&(t.ns=t.ns.insert(r.targetId,r),t.rs.set(e,r.targetId)),r})}async function Zo(n,e,t){const r=P(n),s=r.ns.get(e),i=t?"readwrite":"readwrite-primary";try{t||await r.persistence.runTransaction("Release target",i,o=>r.persistence.referenceDelegate.removeTarget(o,s))}catch(o){if(!mr(o))throw o;v("LocalStore",`Failed to update sequence numbers for target ${e}: ${o}`)}r.ns=r.ns.remove(e),r.rs.delete(s.target)}function Xl(n,e,t){const r=P(n);let s=S.min(),i=D();return r.persistence.runTransaction("Execute query","readwrite",o=>function(c,u,l){const h=P(c),d=h.rs.get(l);return d!==void 0?m.resolve(h.ns.get(d)):h.Qr.getTargetData(u,l)}(r,o,He(e)).next(a=>{if(a)return s=a.lastLimboFreeSnapshotVersion,r.Qr.getMatchingKeysForTargetId(o,a.targetId).next(c=>{i=c})}).next(()=>r.ts.getDocumentsMatchingQuery(o,e,t?s:S.min(),t?i:D())).next(a=>(hy(r,n_(e),a),{documents:a,hs:i})))}function hy(n,e,t){let r=n.ss.get(e)||S.min();t.forEach((s,i)=>{i.readTime.compareTo(r)>0&&(r=i.readTime)}),n.ss.set(e,r)}class Jl{constructor(){this.activeTargetIds=c_()}As(e){this.activeTargetIds=this.activeTargetIds.add(e)}Rs(e){this.activeTargetIds=this.activeTargetIds.delete(e)}ds(){const e={activeTargetIds:this.activeTargetIds.toArray(),updateTimeMs:Date.now()};return JSON.stringify(e)}}class dy{constructor(){this.no=new Jl,this.ro={},this.onlineStateHandler=null,this.sequenceNumberHandler=null}addPendingMutation(e){}updateMutationState(e,t,r){}addLocalQueryTarget(e){return this.no.As(e),this.ro[e]||"not-current"}updateQueryState(e,t,r){this.ro[e]=t}removeLocalQueryTarget(e){this.no.Rs(e)}isLocalQueryTarget(e){return this.no.activeTargetIds.has(e)}clearQueryState(e){delete this.ro[e]}getAllActiveQueryTargets(){return this.no.activeTargetIds}isActiveQueryTarget(e){return this.no.activeTargetIds.has(e)}start(){return this.no=new Jl,Promise.resolve()}handleUserChange(e,t,r){}setOnlineState(e){}shutdown(){}writeSequenceNumber(e){}notifyBundleLoaded(e){}}/**
1378
1378
  * @license
1379
1379
  * Copyright 2019 Google LLC
1380
1380
  *
@@ -1389,7 +1389,7 @@
1389
1389
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1390
1390
  * See the License for the specific language governing permissions and
1391
1391
  * limitations under the License.
1392
- */class J_{io(e){}shutdown(){}}/**
1392
+ */class fy{io(e){}shutdown(){}}/**
1393
1393
  * @license
1394
1394
  * Copyright 2019 Google LLC
1395
1395
  *
@@ -1404,7 +1404,7 @@
1404
1404
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1405
1405
  * See the License for the specific language governing permissions and
1406
1406
  * limitations under the License.
1407
- */class zl{constructor(){this.so=()=>this.oo(),this._o=()=>this.ao(),this.uo=[],this.co()}io(e){this.uo.push(e)}shutdown(){window.removeEventListener("online",this.so),window.removeEventListener("offline",this._o)}co(){window.addEventListener("online",this.so),window.addEventListener("offline",this._o)}oo(){v("ConnectivityMonitor","Network connectivity changed: AVAILABLE");for(const e of this.uo)e(0)}ao(){v("ConnectivityMonitor","Network connectivity changed: UNAVAILABLE");for(const e of this.uo)e(1)}static D(){return typeof window<"u"&&window.addEventListener!==void 0&&window.removeEventListener!==void 0}}/**
1407
+ */class Zl{constructor(){this.so=()=>this.oo(),this._o=()=>this.ao(),this.uo=[],this.co()}io(e){this.uo.push(e)}shutdown(){window.removeEventListener("online",this.so),window.removeEventListener("offline",this._o)}co(){window.addEventListener("online",this.so),window.addEventListener("offline",this._o)}oo(){v("ConnectivityMonitor","Network connectivity changed: AVAILABLE");for(const e of this.uo)e(0)}ao(){v("ConnectivityMonitor","Network connectivity changed: UNAVAILABLE");for(const e of this.uo)e(1)}static D(){return typeof window<"u"&&window.addEventListener!==void 0&&window.removeEventListener!==void 0}}/**
1408
1408
  * @license
1409
1409
  * Copyright 2023 Google LLC
1410
1410
  *
@@ -1419,7 +1419,7 @@
1419
1419
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1420
1420
  * See the License for the specific language governing permissions and
1421
1421
  * limitations under the License.
1422
- */let xs=null;function Yo(){return xs===null?xs=function(){return 268435456+Math.round(2147483648*Math.random())}():xs++,"0x"+xs.toString(16)}/**
1422
+ */let qs=null;function ea(){return qs===null?qs=function(){return 268435456+Math.round(2147483648*Math.random())}():qs++,"0x"+qs.toString(16)}/**
1423
1423
  * @license
1424
1424
  * Copyright 2020 Google LLC
1425
1425
  *
@@ -1434,7 +1434,7 @@
1434
1434
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1435
1435
  * See the License for the specific language governing permissions and
1436
1436
  * limitations under the License.
1437
- */const Z_={BatchGetDocuments:"batchGet",Commit:"commit",RunQuery:"runQuery",RunAggregationQuery:"runAggregationQuery"};/**
1437
+ */const py={BatchGetDocuments:"batchGet",Commit:"commit",RunQuery:"runQuery",RunAggregationQuery:"runAggregationQuery"};/**
1438
1438
  * @license
1439
1439
  * Copyright 2017 Google LLC
1440
1440
  *
@@ -1449,7 +1449,7 @@
1449
1449
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1450
1450
  * See the License for the specific language governing permissions and
1451
1451
  * limitations under the License.
1452
- */class ey{constructor(e){this.lo=e.lo,this.ho=e.ho}Po(e){this.Io=e}To(e){this.Eo=e}onMessage(e){this.Ao=e}close(){this.ho()}send(e){this.lo(e)}Ro(){this.Io()}Vo(e){this.Eo(e)}mo(e){this.Ao(e)}}/**
1452
+ */class my{constructor(e){this.lo=e.lo,this.ho=e.ho}Po(e){this.Io=e}To(e){this.Eo=e}onMessage(e){this.Ao=e}close(){this.ho()}send(e){this.lo(e)}Ro(){this.Io()}Vo(e){this.Eo(e)}mo(e){this.Ao(e)}}/**
1453
1453
  * @license
1454
1454
  * Copyright 2017 Google LLC
1455
1455
  *
@@ -1464,7 +1464,7 @@
1464
1464
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1465
1465
  * See the License for the specific language governing permissions and
1466
1466
  * limitations under the License.
1467
- */const de="WebChannelConnection";class ty extends class{constructor(n){this.databaseInfo=n,this.databaseId=n.databaseId;const r=n.ssl?"https":"http",s=encodeURIComponent(this.databaseId.projectId),i=encodeURIComponent(this.databaseId.database);this.fo=r+"://"+n.host,this.po=`projects/${s}/databases/${i}`,this.yo=this.databaseId.database==="(default)"?`project_id=${s}`:`project_id=${s}&database_id=${i}`}get wo(){return!1}So(n,r,s,i,o){const a=Yo(),c=this.bo(n,r.toUriEncodedString());v("RestConnection",`Sending RPC '${n}' ${a}:`,c,s);const u={"google-cloud-resource-prefix":this.po,"x-goog-request-params":this.yo};return this.Do(u,i,o),this.Co(n,c,u,s).then(l=>(v("RestConnection",`Received RPC '${n}' ${a}: `,l),l),l=>{throw sn("RestConnection",`RPC '${n}' ${a} failed with error: `,l,"url: ",c,"request:",s),l})}vo(n,r,s,i,o,a){return this.So(n,r,s,i,o)}Do(n,r,s){n["X-Goog-Api-Client"]=function(){return"gl-js/ fire/"+rn}(),n["Content-Type"]="text/plain",this.databaseInfo.appId&&(n["X-Firebase-GMPID"]=this.databaseInfo.appId),r&&r.headers.forEach((i,o)=>n[o]=i),s&&s.headers.forEach((i,o)=>n[o]=i)}bo(n,r){const s=Z_[n];return`${this.fo}/v1/${r}:${s}`}terminate(){}}{constructor(e){super(e),this.forceLongPolling=e.forceLongPolling,this.autoDetectLongPolling=e.autoDetectLongPolling,this.useFetchStreams=e.useFetchStreams,this.longPollingOptions=e.longPollingOptions}Co(e,n,r,s){const i=Yo();return new Promise((o,a)=>{const c=new cg;c.setWithCredentials(!0),c.listenOnce(og.COMPLETE,()=>{try{switch(c.getLastErrorCode()){case wo.NO_ERROR:const l=c.getResponseJson();v(de,`XHR for RPC '${e}' ${i} received:`,JSON.stringify(l)),o(l);break;case wo.TIMEOUT:v(de,`RPC '${e}' ${i} timed out`),a(new g(p.DEADLINE_EXCEEDED,"Request time out"));break;case wo.HTTP_ERROR:const h=c.getStatus();if(v(de,`RPC '${e}' ${i} failed with status:`,h,"response text:",c.getResponseText()),h>0){let d=c.getResponseJson();Array.isArray(d)&&(d=d[0]);const f=d==null?void 0:d.error;if(f&&f.status&&f.message){const E=function(_){const C=_.toLowerCase().replace(/_/g,"-");return Object.values(p).indexOf(C)>=0?C:p.UNKNOWN}(f.status);a(new g(E,f.message))}else a(new g(p.UNKNOWN,"Server responded with status "+c.getStatus()))}else a(new g(p.UNAVAILABLE,"Connection failed."));break;default:A()}}finally{v(de,`RPC '${e}' ${i} completed.`)}});const u=JSON.stringify(s);v(de,`RPC '${e}' ${i} sending request:`,s),c.send(n,"POST",u,r,15)})}Fo(e,n,r){const s=Yo(),i=[this.fo,"/","google.firestore.v1.Firestore","/",e,"/channel"],o=sg(),a=ig(),c={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},u=this.longPollingOptions.timeoutSeconds;u!==void 0&&(c.longPollingTimeout=Math.round(1e3*u)),this.useFetchStreams&&(c.useFetchStreams=!0),this.Do(c.initMessageHeaders,n,r),c.encodeInitMessageHeaders=!0;const l=i.join("");v(de,`Creating RPC '${e}' stream ${s}: ${l}`,c);const h=o.createWebChannel(l,c);let d=!1,f=!1;const E=new ey({lo:_=>{f?v(de,`Not sending because RPC '${e}' stream ${s} is closed:`,_):(d||(v(de,`Opening RPC '${e}' stream ${s} transport.`),h.open(),d=!0),v(de,`RPC '${e}' stream ${s} sending:`,_),h.send(_))},ho:()=>h.close()}),T=(_,C,L)=>{_.listen(C,k=>{try{L(k)}catch(O){setTimeout(()=>{throw O},0)}})};return T(h,_s.EventType.OPEN,()=>{f||v(de,`RPC '${e}' stream ${s} transport opened.`)}),T(h,_s.EventType.CLOSE,()=>{f||(f=!0,v(de,`RPC '${e}' stream ${s} transport closed`),E.Vo())}),T(h,_s.EventType.ERROR,_=>{f||(f=!0,sn(de,`RPC '${e}' stream ${s} transport errored:`,_),E.Vo(new g(p.UNAVAILABLE,"The operation could not be completed")))}),T(h,_s.EventType.MESSAGE,_=>{var C;if(!f){const L=_.data[0];F(!!L);const k=L,O=k.error||((C=k[0])===null||C===void 0?void 0:C.error);if(O){v(de,`RPC '${e}' stream ${s} received error:`,O);const _e=O.status;let oe=function(at){const Ei=Q[at];if(Ei!==void 0)return Il(Ei)}(_e),Me=O.message;oe===void 0&&(oe=p.INTERNAL,Me="Unknown error status: "+_e+" with message "+O.message),f=!0,E.Vo(new g(oe,Me)),h.close()}else v(de,`RPC '${e}' stream ${s} received:`,L),E.mo(L)}}),T(a,ag.STAT_EVENT,_=>{_.stat===Mu.PROXY?v(de,`RPC '${e}' stream ${s} detected buffering proxy`):_.stat===Mu.NOPROXY&&v(de,`RPC '${e}' stream ${s} detected no buffering proxy`)}),setTimeout(()=>{E.Ro()},0),E}}function Xo(){return typeof document<"u"?document:null}/**
1467
+ */const de="WebChannelConnection";class gy extends class{constructor(t){this.databaseInfo=t,this.databaseId=t.databaseId;const r=t.ssl?"https":"http",s=encodeURIComponent(this.databaseId.projectId),i=encodeURIComponent(this.databaseId.database);this.fo=r+"://"+t.host,this.po=`projects/${s}/databases/${i}`,this.yo=this.databaseId.database==="(default)"?`project_id=${s}`:`project_id=${s}&database_id=${i}`}get wo(){return!1}So(t,r,s,i,o){const a=ea(),c=this.bo(t,r.toUriEncodedString());v("RestConnection",`Sending RPC '${t}' ${a}:`,c,s);const u={"google-cloud-resource-prefix":this.po,"x-goog-request-params":this.yo};return this.Do(u,i,o),this.Co(t,c,u,s).then(l=>(v("RestConnection",`Received RPC '${t}' ${a}: `,l),l),l=>{throw cn("RestConnection",`RPC '${t}' ${a} failed with error: `,l,"url: ",c,"request:",s),l})}vo(t,r,s,i,o,a){return this.So(t,r,s,i,o)}Do(t,r,s){t["X-Goog-Api-Client"]=function(){return"gl-js/ fire/"+an}(),t["Content-Type"]="text/plain",this.databaseInfo.appId&&(t["X-Firebase-GMPID"]=this.databaseInfo.appId),r&&r.headers.forEach((i,o)=>t[o]=i),s&&s.headers.forEach((i,o)=>t[o]=i)}bo(t,r){const s=py[t];return`${this.fo}/v1/${r}:${s}`}terminate(){}}{constructor(e){super(e),this.forceLongPolling=e.forceLongPolling,this.autoDetectLongPolling=e.autoDetectLongPolling,this.useFetchStreams=e.useFetchStreams,this.longPollingOptions=e.longPollingOptions}Co(e,t,r,s){const i=ea();return new Promise((o,a)=>{const c=new Ig;c.setWithCredentials(!0),c.listenOnce(Tg.COMPLETE,()=>{try{switch(c.getLastErrorCode()){case Po.NO_ERROR:const l=c.getResponseJson();v(de,`XHR for RPC '${e}' ${i} received:`,JSON.stringify(l)),o(l);break;case Po.TIMEOUT:v(de,`RPC '${e}' ${i} timed out`),a(new g(p.DEADLINE_EXCEEDED,"Request time out"));break;case Po.HTTP_ERROR:const h=c.getStatus();if(v(de,`RPC '${e}' ${i} failed with status:`,h,"response text:",c.getResponseText()),h>0){let d=c.getResponseJson();Array.isArray(d)&&(d=d[0]);const f=d==null?void 0:d.error;if(f&&f.status&&f.message){const E=function(_){const C=_.toLowerCase().replace(/_/g,"-");return Object.values(p).indexOf(C)>=0?C:p.UNKNOWN}(f.status);a(new g(E,f.message))}else a(new g(p.UNKNOWN,"Server responded with status "+c.getStatus()))}else a(new g(p.UNAVAILABLE,"Connection failed."));break;default:A()}}finally{v(de,`RPC '${e}' ${i} completed.`)}});const u=JSON.stringify(s);v(de,`RPC '${e}' ${i} sending request:`,s),c.send(t,"POST",u,r,15)})}Fo(e,t,r){const s=ea(),i=[this.fo,"/","google.firestore.v1.Firestore","/",e,"/channel"],o=vg(),a=Eg(),c={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},u=this.longPollingOptions.timeoutSeconds;u!==void 0&&(c.longPollingTimeout=Math.round(1e3*u)),this.useFetchStreams&&(c.useFetchStreams=!0),this.Do(c.initMessageHeaders,t,r),c.encodeInitMessageHeaders=!0;const l=i.join("");v(de,`Creating RPC '${e}' stream ${s}: ${l}`,c);const h=o.createWebChannel(l,c);let d=!1,f=!1;const E=new my({lo:_=>{f?v(de,`Not sending because RPC '${e}' stream ${s} is closed:`,_):(d||(v(de,`Opening RPC '${e}' stream ${s} transport.`),h.open(),d=!0),v(de,`RPC '${e}' stream ${s} sending:`,_),h.send(_))},ho:()=>h.close()}),T=(_,C,L)=>{_.listen(C,k=>{try{L(k)}catch(O){setTimeout(()=>{throw O},0)}})};return T(h,ws.EventType.OPEN,()=>{f||v(de,`RPC '${e}' stream ${s} transport opened.`)}),T(h,ws.EventType.CLOSE,()=>{f||(f=!0,v(de,`RPC '${e}' stream ${s} transport closed`),E.Vo())}),T(h,ws.EventType.ERROR,_=>{f||(f=!0,cn(de,`RPC '${e}' stream ${s} transport errored:`,_),E.Vo(new g(p.UNAVAILABLE,"The operation could not be completed")))}),T(h,ws.EventType.MESSAGE,_=>{var C;if(!f){const L=_.data[0];F(!!L);const k=L,O=k.error||((C=k[0])===null||C===void 0?void 0:C.error);if(O){v(de,`RPC '${e}' stream ${s} received error:`,O);const ve=O.status;let oe=function(ht){const Ai=Q[ht];if(Ai!==void 0)return Nl(Ai)}(ve),Fe=O.message;oe===void 0&&(oe=p.INTERNAL,Fe="Unknown error status: "+ve+" with message "+O.message),f=!0,E.Vo(new g(oe,Fe)),h.close()}else v(de,`RPC '${e}' stream ${s} received:`,L),E.mo(L)}}),T(a,wg.STAT_EVENT,_=>{_.stat===Hu.PROXY?v(de,`RPC '${e}' stream ${s} detected buffering proxy`):_.stat===Hu.NOPROXY&&v(de,`RPC '${e}' stream ${s} detected no buffering proxy`)}),setTimeout(()=>{E.Ro()},0),E}}function ta(){return typeof document<"u"?document:null}/**
1468
1468
  * @license
1469
1469
  * Copyright 2020 Google LLC
1470
1470
  *
@@ -1479,7 +1479,7 @@
1479
1479
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1480
1480
  * See the License for the specific language governing permissions and
1481
1481
  * limitations under the License.
1482
- */function Us(t){return new f_(t,!0)}/**
1482
+ */function $s(n){return new b_(n,!0)}/**
1483
1483
  * @license
1484
1484
  * Copyright 2017 Google LLC
1485
1485
  *
@@ -1494,7 +1494,7 @@
1494
1494
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1495
1495
  * See the License for the specific language governing permissions and
1496
1496
  * limitations under the License.
1497
- */class Hl{constructor(e,n,r=1e3,s=1.5,i=6e4){this.oi=e,this.timerId=n,this.Mo=r,this.xo=s,this.Oo=i,this.No=0,this.Bo=null,this.Lo=Date.now(),this.reset()}reset(){this.No=0}ko(){this.No=this.Oo}qo(e){this.cancel();const n=Math.floor(this.No+this.Qo()),r=Math.max(0,Date.now()-this.Lo),s=Math.max(0,n-r);s>0&&v("ExponentialBackoff",`Backing off for ${s} ms (base delay: ${this.No} ms, delay with jitter: ${n} ms, last attempt: ${r} ms ago)`),this.Bo=this.oi.enqueueAfterDelay(this.timerId,s,()=>(this.Lo=Date.now(),e())),this.No*=this.xo,this.No<this.Mo&&(this.No=this.Mo),this.No>this.Oo&&(this.No=this.Oo)}Ko(){this.Bo!==null&&(this.Bo.skipDelay(),this.Bo=null)}cancel(){this.Bo!==null&&(this.Bo.cancel(),this.Bo=null)}Qo(){return(Math.random()-.5)*this.No}}/**
1497
+ */class eh{constructor(e,t,r=1e3,s=1.5,i=6e4){this.oi=e,this.timerId=t,this.Mo=r,this.xo=s,this.Oo=i,this.No=0,this.Lo=null,this.Bo=Date.now(),this.reset()}reset(){this.No=0}ko(){this.No=this.Oo}qo(e){this.cancel();const t=Math.floor(this.No+this.Qo()),r=Math.max(0,Date.now()-this.Bo),s=Math.max(0,t-r);s>0&&v("ExponentialBackoff",`Backing off for ${s} ms (base delay: ${this.No} ms, delay with jitter: ${t} ms, last attempt: ${r} ms ago)`),this.Lo=this.oi.enqueueAfterDelay(this.timerId,s,()=>(this.Bo=Date.now(),e())),this.No*=this.xo,this.No<this.Mo&&(this.No=this.Mo),this.No>this.Oo&&(this.No=this.Oo)}Ko(){this.Lo!==null&&(this.Lo.skipDelay(),this.Lo=null)}cancel(){this.Lo!==null&&(this.Lo.cancel(),this.Lo=null)}Qo(){return(Math.random()-.5)*this.No}}/**
1498
1498
  * @license
1499
1499
  * Copyright 2017 Google LLC
1500
1500
  *
@@ -1509,7 +1509,7 @@
1509
1509
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1510
1510
  * See the License for the specific language governing permissions and
1511
1511
  * limitations under the License.
1512
- */class Wl{constructor(e,n,r,s,i,o,a,c){this.oi=e,this.$o=r,this.Uo=s,this.connection=i,this.authCredentialsProvider=o,this.appCheckCredentialsProvider=a,this.listener=c,this.state=0,this.Wo=0,this.Go=null,this.zo=null,this.stream=null,this.jo=new Hl(e,n)}Ho(){return this.state===1||this.state===5||this.Jo()}Jo(){return this.state===2||this.state===3}start(){this.state!==4?this.auth():this.Yo()}async stop(){this.Ho()&&await this.close(0)}Zo(){this.state=0,this.jo.reset()}Xo(){this.Jo()&&this.Go===null&&(this.Go=this.oi.enqueueAfterDelay(this.$o,6e4,()=>this.e_()))}t_(e){this.n_(),this.stream.send(e)}async e_(){if(this.Jo())return this.close(0)}n_(){this.Go&&(this.Go.cancel(),this.Go=null)}r_(){this.zo&&(this.zo.cancel(),this.zo=null)}async close(e,n){this.n_(),this.r_(),this.jo.cancel(),this.Wo++,e!==4?this.jo.reset():n&&n.code===p.RESOURCE_EXHAUSTED?(Be(n.toString()),Be("Using maximum backoff delay to prevent overloading the backend."),this.jo.ko()):n&&n.code===p.UNAUTHENTICATED&&this.state!==3&&(this.authCredentialsProvider.invalidateToken(),this.appCheckCredentialsProvider.invalidateToken()),this.stream!==null&&(this.i_(),this.stream.close(),this.stream=null),this.state=e,await this.listener.To(n)}i_(){}auth(){this.state=1;const e=this.s_(this.Wo),n=this.Wo;Promise.all([this.authCredentialsProvider.getToken(),this.appCheckCredentialsProvider.getToken()]).then(([r,s])=>{this.Wo===n&&this.o_(r,s)},r=>{e(()=>{const s=new g(p.UNKNOWN,"Fetching auth token failed: "+r.message);return this.__(s)})})}o_(e,n){const r=this.s_(this.Wo);this.stream=this.a_(e,n),this.stream.Po(()=>{r(()=>(this.state=2,this.zo=this.oi.enqueueAfterDelay(this.Uo,1e4,()=>(this.Jo()&&(this.state=3),Promise.resolve())),this.listener.Po()))}),this.stream.To(s=>{r(()=>this.__(s))}),this.stream.onMessage(s=>{r(()=>this.onMessage(s))})}Yo(){this.state=5,this.jo.qo(async()=>{this.state=0,this.start()})}__(e){return v("PersistentStream",`close with error: ${e}`),this.stream=null,this.close(4,e)}s_(e){return n=>{this.oi.enqueueAndForget(()=>this.Wo===e?n():(v("PersistentStream","stream callback skipped by getCloseGuardedDispatcher."),Promise.resolve()))}}}class ny extends Wl{constructor(e,n,r,s,i,o){super(e,"listen_stream_connection_backoff","listen_stream_idle","health_check_timeout",n,r,s,o),this.serializer=i}a_(e,n){return this.connection.Fo("Listen",e,n)}onMessage(e){this.jo.reset();const n=g_(this.serializer,e),r=function(i){if(!("targetChange"in i))return S.min();const o=i.targetChange;return o.targetIds&&o.targetIds.length?S.min():o.readTime?qe(o.readTime):S.min()}(e);return this.listener.u_(n,r)}c_(e){const n={};n.database=Ho(this.serializer),n.addTarget=function(i,o){let a;const c=o.target;if(a=Vo(c)?{documents:v_(i,c)}:{query:Ml(i,c).ut},a.targetId=o.targetId,o.resumeToken.approximateByteSize()>0){a.resumeToken=Dl(i,o.resumeToken);const u=Bo(i,o.expectedCount);u!==null&&(a.expectedCount=u)}else if(o.snapshotVersion.compareTo(S.min())>0){a.readTime=Ms(i,o.snapshotVersion.toTimestamp());const u=Bo(i,o.expectedCount);u!==null&&(a.expectedCount=u)}return a}(this.serializer,e);const r=T_(this.serializer,e);r&&(n.labels=r),this.t_(n)}l_(e){const n={};n.database=Ho(this.serializer),n.removeTarget=e,this.t_(n)}}class ry extends Wl{constructor(e,n,r,s,i,o){super(e,"write_stream_connection_backoff","write_stream_idle","health_check_timeout",n,r,s,o),this.serializer=i,this.h_=!1}get P_(){return this.h_}start(){this.h_=!1,this.lastStreamToken=void 0,super.start()}i_(){this.h_&&this.I_([])}a_(e,n){return this.connection.Fo("Write",e,n)}onMessage(e){if(F(!!e.streamToken),this.lastStreamToken=e.streamToken,this.h_){this.jo.reset();const n=y_(e.writeResults,e.commitTime),r=qe(e.commitTime);return this.listener.T_(r,n)}return F(!e.writeResults||e.writeResults.length===0),this.h_=!0,this.listener.E_()}d_(){const e={};e.database=Ho(this.serializer),this.t_(e)}I_(e){const n={streamToken:this.lastStreamToken,writes:e.map(r=>__(this.serializer,r))};this.t_(n)}}/**
1512
+ */class th{constructor(e,t,r,s,i,o,a,c){this.oi=e,this.$o=r,this.Uo=s,this.connection=i,this.authCredentialsProvider=o,this.appCheckCredentialsProvider=a,this.listener=c,this.state=0,this.Wo=0,this.Go=null,this.zo=null,this.stream=null,this.jo=new eh(e,t)}Ho(){return this.state===1||this.state===5||this.Jo()}Jo(){return this.state===2||this.state===3}start(){this.state!==4?this.auth():this.Yo()}async stop(){this.Ho()&&await this.close(0)}Zo(){this.state=0,this.jo.reset()}Xo(){this.Jo()&&this.Go===null&&(this.Go=this.oi.enqueueAfterDelay(this.$o,6e4,()=>this.e_()))}t_(e){this.n_(),this.stream.send(e)}async e_(){if(this.Jo())return this.close(0)}n_(){this.Go&&(this.Go.cancel(),this.Go=null)}r_(){this.zo&&(this.zo.cancel(),this.zo=null)}async close(e,t){this.n_(),this.r_(),this.jo.cancel(),this.Wo++,e!==4?this.jo.reset():t&&t.code===p.RESOURCE_EXHAUSTED?($e(t.toString()),$e("Using maximum backoff delay to prevent overloading the backend."),this.jo.ko()):t&&t.code===p.UNAUTHENTICATED&&this.state!==3&&(this.authCredentialsProvider.invalidateToken(),this.appCheckCredentialsProvider.invalidateToken()),this.stream!==null&&(this.i_(),this.stream.close(),this.stream=null),this.state=e,await this.listener.To(t)}i_(){}auth(){this.state=1;const e=this.s_(this.Wo),t=this.Wo;Promise.all([this.authCredentialsProvider.getToken(),this.appCheckCredentialsProvider.getToken()]).then(([r,s])=>{this.Wo===t&&this.o_(r,s)},r=>{e(()=>{const s=new g(p.UNKNOWN,"Fetching auth token failed: "+r.message);return this.__(s)})})}o_(e,t){const r=this.s_(this.Wo);this.stream=this.a_(e,t),this.stream.Po(()=>{r(()=>(this.state=2,this.zo=this.oi.enqueueAfterDelay(this.Uo,1e4,()=>(this.Jo()&&(this.state=3),Promise.resolve())),this.listener.Po()))}),this.stream.To(s=>{r(()=>this.__(s))}),this.stream.onMessage(s=>{r(()=>this.onMessage(s))})}Yo(){this.state=5,this.jo.qo(async()=>{this.state=0,this.start()})}__(e){return v("PersistentStream",`close with error: ${e}`),this.stream=null,this.close(4,e)}s_(e){return t=>{this.oi.enqueueAndForget(()=>this.Wo===e?t():(v("PersistentStream","stream callback skipped by getCloseGuardedDispatcher."),Promise.resolve()))}}}class _y extends th{constructor(e,t,r,s,i,o){super(e,"listen_stream_connection_backoff","listen_stream_idle","health_check_timeout",t,r,s,o),this.serializer=i}a_(e,t){return this.connection.Fo("Listen",e,t)}onMessage(e){this.jo.reset();const t=D_(this.serializer,e),r=function(i){if(!("targetChange"in i))return S.min();const o=i.targetChange;return o.targetIds&&o.targetIds.length?S.min():o.readTime?We(o.readTime):S.min()}(e);return this.listener.u_(t,r)}c_(e){const t={};t.database=Qo(this.serializer),t.addTarget=function(i,o){let a;const c=o.target;if(a=Uo(c)?{documents:V_(i,c)}:{query:Hl(i,c).ut},a.targetId=o.targetId,o.resumeToken.approximateByteSize()>0){a.resumeToken=Bl(i,o.resumeToken);const u=zo(i,o.expectedCount);u!==null&&(a.expectedCount=u)}else if(o.snapshotVersion.compareTo(S.min())>0){a.readTime=js(i,o.snapshotVersion.toTimestamp());const u=zo(i,o.expectedCount);u!==null&&(a.expectedCount=u)}return a}(this.serializer,e);const r=M_(this.serializer,e);r&&(t.labels=r),this.t_(t)}l_(e){const t={};t.database=Qo(this.serializer),t.removeTarget=e,this.t_(t)}}class yy extends th{constructor(e,t,r,s,i,o){super(e,"write_stream_connection_backoff","write_stream_idle","health_check_timeout",t,r,s,o),this.serializer=i,this.h_=!1}get P_(){return this.h_}start(){this.h_=!1,this.lastStreamToken=void 0,super.start()}i_(){this.h_&&this.I_([])}a_(e,t){return this.connection.Fo("Write",e,t)}onMessage(e){if(F(!!e.streamToken),this.lastStreamToken=e.streamToken,this.h_){this.jo.reset();const t=O_(e.writeResults,e.commitTime),r=We(e.commitTime);return this.listener.T_(r,t)}return F(!e.writeResults||e.writeResults.length===0),this.h_=!0,this.listener.E_()}d_(){const e={};e.database=Qo(this.serializer),this.t_(e)}I_(e){const t={streamToken:this.lastStreamToken,writes:e.map(r=>N_(this.serializer,r))};this.t_(t)}}/**
1513
1513
  * @license
1514
1514
  * Copyright 2017 Google LLC
1515
1515
  *
@@ -1524,8 +1524,8 @@
1524
1524
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1525
1525
  * See the License for the specific language governing permissions and
1526
1526
  * limitations under the License.
1527
- */class sy extends class{}{constructor(e,n,r,s){super(),this.authCredentials=e,this.appCheckCredentials=n,this.connection=r,this.serializer=s,this.A_=!1}R_(){if(this.A_)throw new g(p.FAILED_PRECONDITION,"The client has already been terminated.")}So(e,n,r,s){return this.R_(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then(([i,o])=>this.connection.So(e,$o(n,r),s,i,o)).catch(i=>{throw i.name==="FirebaseError"?(i.code===p.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),i):new g(p.UNKNOWN,i.toString())})}vo(e,n,r,s,i){return this.R_(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then(([o,a])=>this.connection.vo(e,$o(n,r),s,o,a,i)).catch(o=>{throw o.name==="FirebaseError"?(o.code===p.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),o):new g(p.UNKNOWN,o.toString())})}terminate(){this.A_=!0,this.connection.terminate()}}async function iy(t,e,n){var r;const s=P(t),{request:i,V_:o,parent:a}=function(h,d,f){const{ut:E,parent:T}=Ml(h,d),_={},C=[];let L=0;return f.forEach(k=>{const O="aggregate_"+L++;_[O]=k.alias,k.aggregateType==="count"?C.push({alias:O,count:{}}):k.aggregateType==="avg"?C.push({alias:O,avg:{field:gt(k.fieldPath)}}):k.aggregateType==="sum"&&C.push({alias:O,sum:{field:gt(k.fieldPath)}})}),{request:{structuredAggregationQuery:{aggregations:C,structuredQuery:E.structuredQuery},parent:E.parent},V_:_,parent:T}}(s.serializer,function(h){const d=P(h);return d.Pe||(d.Pe=il(d,h.explicitOrderBy)),d.Pe}(e),n);s.connection.wo||delete i.parent;const c=(await s.vo("RunAggregationQuery",s.serializer.databaseId,a,i,1)).filter(l=>!!l.result);F(c.length===1);const u=(r=c[0].result)===null||r===void 0?void 0:r.aggregateFields;return Object.keys(u).reduce((l,h)=>(l[o[h]]=u[h],l),{})}class oy{constructor(e,n){this.asyncQueue=e,this.onlineStateHandler=n,this.state="Unknown",this.m_=0,this.f_=null,this.g_=!0}p_(){this.m_===0&&(this.y_("Unknown"),this.f_=this.asyncQueue.enqueueAfterDelay("online_state_timeout",1e4,()=>(this.f_=null,this.w_("Backend didn't respond within 10 seconds."),this.y_("Offline"),Promise.resolve())))}S_(e){this.state==="Online"?this.y_("Unknown"):(this.m_++,this.m_>=1&&(this.b_(),this.w_(`Connection failed 1 times. Most recent error: ${e.toString()}`),this.y_("Offline")))}set(e){this.b_(),this.m_=0,e==="Online"&&(this.g_=!1),this.y_(e)}y_(e){e!==this.state&&(this.state=e,this.onlineStateHandler(e))}w_(e){const n=`Could not reach Cloud Firestore backend. ${e}
1528
- This 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.g_?(Be(n),this.g_=!1):v("OnlineStateTracker",n)}b_(){this.f_!==null&&(this.f_.cancel(),this.f_=null)}}/**
1527
+ */class vy extends class{}{constructor(e,t,r,s){super(),this.authCredentials=e,this.appCheckCredentials=t,this.connection=r,this.serializer=s,this.A_=!1}R_(){if(this.A_)throw new g(p.FAILED_PRECONDITION,"The client has already been terminated.")}So(e,t,r,s){return this.R_(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then(([i,o])=>this.connection.So(e,Wo(t,r),s,i,o)).catch(i=>{throw i.name==="FirebaseError"?(i.code===p.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),i):new g(p.UNKNOWN,i.toString())})}vo(e,t,r,s,i){return this.R_(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then(([o,a])=>this.connection.vo(e,Wo(t,r),s,o,a,i)).catch(o=>{throw o.name==="FirebaseError"?(o.code===p.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),o):new g(p.UNKNOWN,o.toString())})}terminate(){this.A_=!0,this.connection.terminate()}}async function Ey(n,e,t){var r;const s=P(n),{request:i,V_:o,parent:a}=function(h,d,f){const{ut:E,parent:T}=Hl(h,d),_={},C=[];let L=0;return f.forEach(k=>{const O="aggregate_"+L++;_[O]=k.alias,k.aggregateType==="count"?C.push({alias:O,count:{}}):k.aggregateType==="avg"?C.push({alias:O,avg:{field:Et(k.fieldPath)}}):k.aggregateType==="sum"&&C.push({alias:O,sum:{field:Et(k.fieldPath)}})}),{request:{structuredAggregationQuery:{aggregations:C,structuredQuery:E.structuredQuery},parent:E.parent},V_:_,parent:T}}(s.serializer,function(h){const d=P(h);return d.Pe||(d.Pe=pl(d,h.explicitOrderBy)),d.Pe}(e),t);s.connection.wo||delete i.parent;const c=(await s.vo("RunAggregationQuery",s.serializer.databaseId,a,i,1)).filter(l=>!!l.result);F(c.length===1);const u=(r=c[0].result)===null||r===void 0?void 0:r.aggregateFields;return Object.keys(u).reduce((l,h)=>(l[o[h]]=u[h],l),{})}class Ty{constructor(e,t){this.asyncQueue=e,this.onlineStateHandler=t,this.state="Unknown",this.m_=0,this.f_=null,this.g_=!0}p_(){this.m_===0&&(this.y_("Unknown"),this.f_=this.asyncQueue.enqueueAfterDelay("online_state_timeout",1e4,()=>(this.f_=null,this.w_("Backend didn't respond within 10 seconds."),this.y_("Offline"),Promise.resolve())))}S_(e){this.state==="Online"?this.y_("Unknown"):(this.m_++,this.m_>=1&&(this.b_(),this.w_(`Connection failed 1 times. Most recent error: ${e.toString()}`),this.y_("Offline")))}set(e){this.b_(),this.m_=0,e==="Online"&&(this.g_=!1),this.y_(e)}y_(e){e!==this.state&&(this.state=e,this.onlineStateHandler(e))}w_(e){const t=`Could not reach Cloud Firestore backend. ${e}
1528
+ This 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.g_?($e(t),this.g_=!1):v("OnlineStateTracker",t)}b_(){this.f_!==null&&(this.f_.cancel(),this.f_=null)}}/**
1529
1529
  * @license
1530
1530
  * Copyright 2017 Google LLC
1531
1531
  *
@@ -1540,7 +1540,7 @@ This typically indicates that your device does not have a healthy Internet conne
1540
1540
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1541
1541
  * See the License for the specific language governing permissions and
1542
1542
  * limitations under the License.
1543
- */class ay{constructor(e,n,r,s,i){this.localStore=e,this.datastore=n,this.asyncQueue=r,this.remoteSyncer={},this.D_=[],this.C_=new Map,this.v_=new Set,this.F_=[],this.M_=i,this.M_.io(o=>{r.enqueueAndForget(async()=>{jt(this)&&(v("RemoteStore","Restarting streams for network reachability change."),await async function(c){const u=P(c);u.v_.add(4),await Ir(u),u.x_.set("Unknown"),u.v_.delete(4),await Fs(u)}(this))})}),this.x_=new oy(r,s)}}async function Fs(t){if(jt(t))for(const e of t.F_)await e(!0)}async function Ir(t){for(const e of t.F_)await e(!1)}function Gl(t,e){const n=P(t);n.C_.has(e.targetId)||(n.C_.set(e.targetId,e),ea(n)?Zo(n):mn(n).Jo()&&Jo(n,e))}function Kl(t,e){const n=P(t),r=mn(n);n.C_.delete(e),r.Jo()&&Ql(n,e),n.C_.size===0&&(r.Jo()?r.Xo():jt(n)&&n.x_.set("Unknown"))}function Jo(t,e){if(t.O_.Oe(e.targetId),e.resumeToken.approximateByteSize()>0||e.snapshotVersion.compareTo(S.min())>0){const n=t.remoteSyncer.getRemoteKeysForTarget(e.targetId).size;e=e.withExpectedCount(n)}mn(t).c_(e)}function Ql(t,e){t.O_.Oe(e),mn(t).l_(e)}function Zo(t){t.O_=new u_({getRemoteKeysForTarget:e=>t.remoteSyncer.getRemoteKeysForTarget(e),_t:e=>t.C_.get(e)||null,nt:()=>t.datastore.serializer.databaseId}),mn(t).start(),t.x_.p_()}function ea(t){return jt(t)&&!mn(t).Ho()&&t.C_.size>0}function jt(t){return P(t).v_.size===0}function Yl(t){t.O_=void 0}async function cy(t){t.C_.forEach((e,n)=>{Jo(t,e)})}async function uy(t,e){Yl(t),ea(t)?(t.x_.S_(e),Zo(t)):t.x_.set("Unknown")}async function ly(t,e,n){if(t.x_.set("Online"),e instanceof Sl&&e.state===2&&e.cause)try{await async function(s,i){const o=i.cause;for(const a of i.targetIds)s.C_.has(a)&&(await s.remoteSyncer.rejectListen(a,o),s.C_.delete(a),s.O_.removeTarget(a))}(t,e)}catch(r){v("RemoteStore","Failed to remove targets %s: %s ",e.targetIds.join(","),r),await Bs(t,r)}else if(e instanceof Ls?t.O_.$e(e):e instanceof Pl?t.O_.Je(e):t.O_.Ge(e),!n.isEqual(S.min()))try{const r=await jl(t.localStore);n.compareTo(r)>=0&&await function(i,o){const a=i.O_.it(o);return a.targetChanges.forEach((c,u)=>{if(c.resumeToken.approximateByteSize()>0){const l=i.C_.get(u);l&&i.C_.set(u,l.withResumeToken(c.resumeToken,o))}}),a.targetMismatches.forEach((c,u)=>{const l=i.C_.get(c);if(!l)return;i.C_.set(c,l.withResumeToken(le.EMPTY_BYTE_STRING,l.snapshotVersion)),Ql(i,c);const h=new _t(l.target,c,u,l.sequenceNumber);Jo(i,h)}),i.remoteSyncer.applyRemoteEvent(a)}(t,n)}catch(r){v("RemoteStore","Failed to raise snapshot:",r),await Bs(t,r)}}async function Bs(t,e,n){if(!ur(e))throw e;t.v_.add(1),await Ir(t),t.x_.set("Offline"),n||(n=()=>jl(t.localStore)),t.asyncQueue.enqueueRetryable(async()=>{v("RemoteStore","Retrying IndexedDB access"),await n(),t.v_.delete(1),await Fs(t)})}function Xl(t,e){return e().catch(n=>Bs(t,n,e))}async function js(t){const e=P(t),n=yt(e);let r=e.D_.length>0?e.D_[e.D_.length-1].batchId:-1;for(;hy(e);)try{const s=await K_(e.localStore,r);if(s===null){e.D_.length===0&&n.Xo();break}r=s.batchId,dy(e,s)}catch(s){await Bs(e,s)}Jl(e)&&Zl(e)}function hy(t){return jt(t)&&t.D_.length<10}function dy(t,e){t.D_.push(e);const n=yt(t);n.Jo()&&n.P_&&n.I_(e.mutations)}function Jl(t){return jt(t)&&!yt(t).Ho()&&t.D_.length>0}function Zl(t){yt(t).start()}async function fy(t){yt(t).d_()}async function py(t){const e=yt(t);for(const n of t.D_)e.I_(n.mutations)}async function my(t,e,n){const r=t.D_.shift(),s=Uo.from(r,e,n);await Xl(t,()=>t.remoteSyncer.applySuccessfulWrite(s)),await js(t)}async function gy(t,e){e&&yt(t).P_&&await async function(r,s){if(function(o){return o_(o)&&o!==p.ABORTED}(s.code)){const i=r.D_.shift();yt(r).Zo(),await Xl(r,()=>r.remoteSyncer.rejectFailedWrite(i.batchId,s)),await js(r)}}(t,e),Jl(t)&&Zl(t)}async function eh(t,e){const n=P(t);n.asyncQueue.verifyOperationInProgress(),v("RemoteStore","RemoteStore received new credentials");const r=jt(n);n.v_.add(3),await Ir(n),r&&n.x_.set("Unknown"),await n.remoteSyncer.handleCredentialChange(e),n.v_.delete(3),await Fs(n)}async function _y(t,e){const n=P(t);e?(n.v_.delete(2),await Fs(n)):e||(n.v_.add(2),await Ir(n),n.x_.set("Unknown"))}function mn(t){return t.N_||(t.N_=function(n,r,s){const i=P(n);return i.R_(),new ny(r,i.connection,i.authCredentials,i.appCheckCredentials,i.serializer,s)}(t.datastore,t.asyncQueue,{Po:cy.bind(null,t),To:uy.bind(null,t),u_:ly.bind(null,t)}),t.F_.push(async e=>{e?(t.N_.Zo(),ea(t)?Zo(t):t.x_.set("Unknown")):(await t.N_.stop(),Yl(t))})),t.N_}function yt(t){return t.B_||(t.B_=function(n,r,s){const i=P(n);return i.R_(),new ry(r,i.connection,i.authCredentials,i.appCheckCredentials,i.serializer,s)}(t.datastore,t.asyncQueue,{Po:fy.bind(null,t),To:gy.bind(null,t),E_:py.bind(null,t),T_:my.bind(null,t)}),t.F_.push(async e=>{e?(t.B_.Zo(),await js(t)):(await t.B_.stop(),t.D_.length>0&&(v("RemoteStore",`Stopping write stream with ${t.D_.length} pending writes`),t.D_=[]))})),t.B_}/**
1543
+ */class wy{constructor(e,t,r,s,i){this.localStore=e,this.datastore=t,this.asyncQueue=r,this.remoteSyncer={},this.D_=[],this.C_=new Map,this.v_=new Set,this.F_=[],this.M_=i,this.M_.io(o=>{r.enqueueAndForget(async()=>{Ht(this)&&(v("RemoteStore","Restarting streams for network reachability change."),await async function(c){const u=P(c);u.v_.add(4),await Cr(u),u.x_.set("Unknown"),u.v_.delete(4),await zs(u)}(this))})}),this.x_=new Ty(r,s)}}async function zs(n){if(Ht(n))for(const e of n.F_)await e(!0)}async function Cr(n){for(const e of n.F_)await e(!1)}function nh(n,e){const t=P(n);t.C_.has(e.targetId)||(t.C_.set(e.targetId,e),ia(t)?sa(t):yn(t).Jo()&&ra(t,e))}function na(n,e){const t=P(n),r=yn(t);t.C_.delete(e),r.Jo()&&rh(t,e),t.C_.size===0&&(r.Jo()?r.Xo():Ht(t)&&t.x_.set("Unknown"))}function ra(n,e){if(n.O_.Oe(e.targetId),e.resumeToken.approximateByteSize()>0||e.snapshotVersion.compareTo(S.min())>0){const t=n.remoteSyncer.getRemoteKeysForTarget(e.targetId).size;e=e.withExpectedCount(t)}yn(n).c_(e)}function rh(n,e){n.O_.Oe(e),yn(n).l_(e)}function sa(n){n.O_=new A_({getRemoteKeysForTarget:e=>n.remoteSyncer.getRemoteKeysForTarget(e),_t:e=>n.C_.get(e)||null,nt:()=>n.datastore.serializer.databaseId}),yn(n).start(),n.x_.p_()}function ia(n){return Ht(n)&&!yn(n).Ho()&&n.C_.size>0}function Ht(n){return P(n).v_.size===0}function sh(n){n.O_=void 0}async function Iy(n){n.C_.forEach((e,t)=>{ra(n,e)})}async function Ay(n,e){sh(n),ia(n)?(n.x_.S_(e),sa(n)):n.x_.set("Unknown")}async function Ry(n,e,t){if(n.x_.set("Online"),e instanceof Ml&&e.state===2&&e.cause)try{await async function(s,i){const o=i.cause;for(const a of i.targetIds)s.C_.has(a)&&(await s.remoteSyncer.rejectListen(a,o),s.C_.delete(a),s.O_.removeTarget(a))}(n,e)}catch(r){v("RemoteStore","Failed to remove targets %s: %s ",e.targetIds.join(","),r),await Hs(n,r)}else if(e instanceof Bs?n.O_.$e(e):e instanceof Ll?n.O_.Je(e):n.O_.Ge(e),!t.isEqual(S.min()))try{const r=await Yl(n.localStore);t.compareTo(r)>=0&&await function(i,o){const a=i.O_.it(o);return a.targetChanges.forEach((c,u)=>{if(c.resumeToken.approximateByteSize()>0){const l=i.C_.get(u);l&&i.C_.set(u,l.withResumeToken(c.resumeToken,o))}}),a.targetMismatches.forEach((c,u)=>{const l=i.C_.get(c);if(!l)return;i.C_.set(c,l.withResumeToken(le.EMPTY_BYTE_STRING,l.snapshotVersion)),rh(i,c);const h=new Tt(l.target,c,u,l.sequenceNumber);ra(i,h)}),i.remoteSyncer.applyRemoteEvent(a)}(n,t)}catch(r){v("RemoteStore","Failed to raise snapshot:",r),await Hs(n,r)}}async function Hs(n,e,t){if(!mr(e))throw e;n.v_.add(1),await Cr(n),n.x_.set("Offline"),t||(t=()=>Yl(n.localStore)),n.asyncQueue.enqueueRetryable(async()=>{v("RemoteStore","Retrying IndexedDB access"),await t(),n.v_.delete(1),await zs(n)})}function ih(n,e){return e().catch(t=>Hs(n,t,e))}async function Ws(n){const e=P(n),t=wt(e);let r=e.D_.length>0?e.D_[e.D_.length-1].batchId:-1;for(;Py(e);)try{const s=await uy(e.localStore,r);if(s===null){e.D_.length===0&&t.Xo();break}r=s.batchId,Sy(e,s)}catch(s){await Hs(e,s)}oh(e)&&ah(e)}function Py(n){return Ht(n)&&n.D_.length<10}function Sy(n,e){n.D_.push(e);const t=wt(n);t.Jo()&&t.P_&&t.I_(e.mutations)}function oh(n){return Ht(n)&&!wt(n).Ho()&&n.D_.length>0}function ah(n){wt(n).start()}async function by(n){wt(n).d_()}async function Cy(n){const e=wt(n);for(const t of n.D_)e.I_(t.mutations)}async function ky(n,e,t){const r=n.D_.shift(),s=qo.from(r,e,t);await ih(n,()=>n.remoteSyncer.applySuccessfulWrite(s)),await Ws(n)}async function Dy(n,e){e&&wt(n).P_&&await async function(r,s){if(function(o){return T_(o)&&o!==p.ABORTED}(s.code)){const i=r.D_.shift();wt(r).Zo(),await ih(r,()=>r.remoteSyncer.rejectFailedWrite(i.batchId,s)),await Ws(r)}}(n,e),oh(n)&&ah(n)}async function ch(n,e){const t=P(n);t.asyncQueue.verifyOperationInProgress(),v("RemoteStore","RemoteStore received new credentials");const r=Ht(t);t.v_.add(3),await Cr(t),r&&t.x_.set("Unknown"),await t.remoteSyncer.handleCredentialChange(e),t.v_.delete(3),await zs(t)}async function Ny(n,e){const t=P(n);e?(t.v_.delete(2),await zs(t)):e||(t.v_.add(2),await Cr(t),t.x_.set("Unknown"))}function yn(n){return n.N_||(n.N_=function(t,r,s){const i=P(t);return i.R_(),new _y(r,i.connection,i.authCredentials,i.appCheckCredentials,i.serializer,s)}(n.datastore,n.asyncQueue,{Po:Iy.bind(null,n),To:Ay.bind(null,n),u_:Ry.bind(null,n)}),n.F_.push(async e=>{e?(n.N_.Zo(),ia(n)?sa(n):n.x_.set("Unknown")):(await n.N_.stop(),sh(n))})),n.N_}function wt(n){return n.L_||(n.L_=function(t,r,s){const i=P(t);return i.R_(),new yy(r,i.connection,i.authCredentials,i.appCheckCredentials,i.serializer,s)}(n.datastore,n.asyncQueue,{Po:by.bind(null,n),To:Dy.bind(null,n),E_:Cy.bind(null,n),T_:ky.bind(null,n)}),n.F_.push(async e=>{e?(n.L_.Zo(),await Ws(n)):(await n.L_.stop(),n.D_.length>0&&(v("RemoteStore",`Stopping write stream with ${n.D_.length} pending writes`),n.D_=[]))})),n.L_}/**
1544
1544
  * @license
1545
1545
  * Copyright 2017 Google LLC
1546
1546
  *
@@ -1555,7 +1555,7 @@ This typically indicates that your device does not have a healthy Internet conne
1555
1555
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1556
1556
  * See the License for the specific language governing permissions and
1557
1557
  * limitations under the License.
1558
- */class ta{constructor(e,n,r,s,i){this.asyncQueue=e,this.timerId=n,this.targetTimeMs=r,this.op=s,this.removalCallback=i,this.deferred=new De,this.then=this.deferred.promise.then.bind(this.deferred.promise),this.deferred.promise.catch(o=>{})}get promise(){return this.deferred.promise}static createAndSchedule(e,n,r,s,i){const o=Date.now()+r,a=new ta(e,n,o,s,i);return a.start(r),a}start(e){this.timerHandle=setTimeout(()=>this.handleDelayElapsed(),e)}skipDelay(){return this.handleDelayElapsed()}cancel(e){this.timerHandle!==null&&(this.clearTimeout(),this.deferred.reject(new g(p.CANCELLED,"Operation cancelled"+(e?": "+e:""))))}handleDelayElapsed(){this.asyncQueue.enqueueAndForget(()=>this.timerHandle!==null?(this.clearTimeout(),this.op().then(e=>this.deferred.resolve(e))):Promise.resolve())}clearTimeout(){this.timerHandle!==null&&(this.removalCallback(this),clearTimeout(this.timerHandle),this.timerHandle=null)}}function na(t,e){if(Be("AsyncQueue",`${e}: ${t}`),ur(t))return new g(p.UNAVAILABLE,`${e}: ${t}`);throw t}/**
1558
+ */class oa{constructor(e,t,r,s,i){this.asyncQueue=e,this.timerId=t,this.targetTimeMs=r,this.op=s,this.removalCallback=i,this.deferred=new Oe,this.then=this.deferred.promise.then.bind(this.deferred.promise),this.deferred.promise.catch(o=>{})}get promise(){return this.deferred.promise}static createAndSchedule(e,t,r,s,i){const o=Date.now()+r,a=new oa(e,t,o,s,i);return a.start(r),a}start(e){this.timerHandle=setTimeout(()=>this.handleDelayElapsed(),e)}skipDelay(){return this.handleDelayElapsed()}cancel(e){this.timerHandle!==null&&(this.clearTimeout(),this.deferred.reject(new g(p.CANCELLED,"Operation cancelled"+(e?": "+e:""))))}handleDelayElapsed(){this.asyncQueue.enqueueAndForget(()=>this.timerHandle!==null?(this.clearTimeout(),this.op().then(e=>this.deferred.resolve(e))):Promise.resolve())}clearTimeout(){this.timerHandle!==null&&(this.removalCallback(this),clearTimeout(this.timerHandle),this.timerHandle=null)}}function aa(n,e){if($e("AsyncQueue",`${e}: ${n}`),mr(n))return new g(p.UNAVAILABLE,`${e}: ${n}`);throw n}/**
1559
1559
  * @license
1560
1560
  * Copyright 2017 Google LLC
1561
1561
  *
@@ -1570,10 +1570,10 @@ This typically indicates that your device does not have a healthy Internet conne
1570
1570
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1571
1571
  * See the License for the specific language governing permissions and
1572
1572
  * limitations under the License.
1573
- */class gn{constructor(e){this.comparator=e?(n,r)=>e(n,r)||w.comparator(n.key,r.key):(n,r)=>w.comparator(n.key,r.key),this.keyedMap=mr(),this.sortedSet=new q(this.comparator)}static emptySet(e){return new gn(e.comparator)}has(e){return this.keyedMap.get(e)!=null}get(e){return this.keyedMap.get(e)}first(){return this.sortedSet.minKey()}last(){return this.sortedSet.maxKey()}isEmpty(){return this.sortedSet.isEmpty()}indexOf(e){const n=this.keyedMap.get(e);return n?this.sortedSet.indexOf(n):-1}get size(){return this.sortedSet.size}forEach(e){this.sortedSet.inorderTraversal((n,r)=>(e(n),!1))}add(e){const n=this.delete(e.key);return n.copy(n.keyedMap.insert(e.key,e),n.sortedSet.insert(e,null))}delete(e){const n=this.get(e);return n?this.copy(this.keyedMap.remove(e),this.sortedSet.remove(n)):this}isEqual(e){if(!(e instanceof gn)||this.size!==e.size)return!1;const n=this.sortedSet.getIterator(),r=e.sortedSet.getIterator();for(;n.hasNext();){const s=n.getNext().key,i=r.getNext().key;if(!s.isEqual(i))return!1}return!0}toString(){const e=[];return this.forEach(n=>{e.push(n.toString())}),e.length===0?"DocumentSet ()":`DocumentSet (
1573
+ */class vn{constructor(e){this.comparator=e?(t,r)=>e(t,r)||w.comparator(t.key,r.key):(t,r)=>w.comparator(t.key,r.key),this.keyedMap=Tr(),this.sortedSet=new $(this.comparator)}static emptySet(e){return new vn(e.comparator)}has(e){return this.keyedMap.get(e)!=null}get(e){return this.keyedMap.get(e)}first(){return this.sortedSet.minKey()}last(){return this.sortedSet.maxKey()}isEmpty(){return this.sortedSet.isEmpty()}indexOf(e){const t=this.keyedMap.get(e);return t?this.sortedSet.indexOf(t):-1}get size(){return this.sortedSet.size}forEach(e){this.sortedSet.inorderTraversal((t,r)=>(e(t),!1))}add(e){const t=this.delete(e.key);return t.copy(t.keyedMap.insert(e.key,e),t.sortedSet.insert(e,null))}delete(e){const t=this.get(e);return t?this.copy(this.keyedMap.remove(e),this.sortedSet.remove(t)):this}isEqual(e){if(!(e instanceof vn)||this.size!==e.size)return!1;const t=this.sortedSet.getIterator(),r=e.sortedSet.getIterator();for(;t.hasNext();){const s=t.getNext().key,i=r.getNext().key;if(!s.isEqual(i))return!1}return!0}toString(){const e=[];return this.forEach(t=>{e.push(t.toString())}),e.length===0?"DocumentSet ()":`DocumentSet (
1574
1574
  `+e.join(`
1575
1575
  `)+`
1576
- )`}copy(e,n){const r=new gn;return r.comparator=this.comparator,r.keyedMap=e,r.sortedSet=n,r}}/**
1576
+ )`}copy(e,t){const r=new vn;return r.comparator=this.comparator,r.keyedMap=e,r.sortedSet=t,r}}/**
1577
1577
  * @license
1578
1578
  * Copyright 2017 Google LLC
1579
1579
  *
@@ -1588,7 +1588,7 @@ This typically indicates that your device does not have a healthy Internet conne
1588
1588
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1589
1589
  * See the License for the specific language governing permissions and
1590
1590
  * limitations under the License.
1591
- */class th{constructor(){this.L_=new q(w.comparator)}track(e){const n=e.doc.key,r=this.L_.get(n);r?e.type!==0&&r.type===3?this.L_=this.L_.insert(n,e):e.type===3&&r.type!==1?this.L_=this.L_.insert(n,{type:r.type,doc:e.doc}):e.type===2&&r.type===2?this.L_=this.L_.insert(n,{type:2,doc:e.doc}):e.type===2&&r.type===0?this.L_=this.L_.insert(n,{type:0,doc:e.doc}):e.type===1&&r.type===0?this.L_=this.L_.remove(n):e.type===1&&r.type===2?this.L_=this.L_.insert(n,{type:1,doc:r.doc}):e.type===0&&r.type===1?this.L_=this.L_.insert(n,{type:2,doc:e.doc}):A():this.L_=this.L_.insert(n,e)}k_(){const e=[];return this.L_.inorderTraversal((n,r)=>{e.push(r)}),e}}class _n{constructor(e,n,r,s,i,o,a,c,u){this.query=e,this.docs=n,this.oldDocs=r,this.docChanges=s,this.mutatedKeys=i,this.fromCache=o,this.syncStateChanged=a,this.excludesMetadataChanges=c,this.hasCachedResults=u}static fromInitialDocuments(e,n,r,s,i){const o=[];return n.forEach(a=>{o.push({type:0,doc:a})}),new _n(e,n,gn.emptySet(n),o,r,s,!0,!1,i)}get hasPendingWrites(){return!this.mutatedKeys.isEmpty()}isEqual(e){if(!(this.fromCache===e.fromCache&&this.hasCachedResults===e.hasCachedResults&&this.syncStateChanged===e.syncStateChanged&&this.mutatedKeys.isEqual(e.mutatedKeys)&&Ps(this.query,e.query)&&this.docs.isEqual(e.docs)&&this.oldDocs.isEqual(e.oldDocs)))return!1;const n=this.docChanges,r=e.docChanges;if(n.length!==r.length)return!1;for(let s=0;s<n.length;s++)if(n[s].type!==r[s].type||!n[s].doc.isEqual(r[s].doc))return!1;return!0}}/**
1591
+ */class uh{constructor(){this.B_=new $(w.comparator)}track(e){const t=e.doc.key,r=this.B_.get(t);r?e.type!==0&&r.type===3?this.B_=this.B_.insert(t,e):e.type===3&&r.type!==1?this.B_=this.B_.insert(t,{type:r.type,doc:e.doc}):e.type===2&&r.type===2?this.B_=this.B_.insert(t,{type:2,doc:e.doc}):e.type===2&&r.type===0?this.B_=this.B_.insert(t,{type:0,doc:e.doc}):e.type===1&&r.type===0?this.B_=this.B_.remove(t):e.type===1&&r.type===2?this.B_=this.B_.insert(t,{type:1,doc:r.doc}):e.type===0&&r.type===1?this.B_=this.B_.insert(t,{type:2,doc:e.doc}):A():this.B_=this.B_.insert(t,e)}k_(){const e=[];return this.B_.inorderTraversal((t,r)=>{e.push(r)}),e}}class En{constructor(e,t,r,s,i,o,a,c,u){this.query=e,this.docs=t,this.oldDocs=r,this.docChanges=s,this.mutatedKeys=i,this.fromCache=o,this.syncStateChanged=a,this.excludesMetadataChanges=c,this.hasCachedResults=u}static fromInitialDocuments(e,t,r,s,i){const o=[];return t.forEach(a=>{o.push({type:0,doc:a})}),new En(e,t,vn.emptySet(t),o,r,s,!0,!1,i)}get hasPendingWrites(){return!this.mutatedKeys.isEmpty()}isEqual(e){if(!(this.fromCache===e.fromCache&&this.hasCachedResults===e.hasCachedResults&&this.syncStateChanged===e.syncStateChanged&&this.mutatedKeys.isEqual(e.mutatedKeys)&&Ds(this.query,e.query)&&this.docs.isEqual(e.docs)&&this.oldDocs.isEqual(e.oldDocs)))return!1;const t=this.docChanges,r=e.docChanges;if(t.length!==r.length)return!1;for(let s=0;s<t.length;s++)if(t[s].type!==r[s].type||!t[s].doc.isEqual(r[s].doc))return!1;return!0}}/**
1592
1592
  * @license
1593
1593
  * Copyright 2017 Google LLC
1594
1594
  *
@@ -1603,7 +1603,7 @@ This typically indicates that your device does not have a healthy Internet conne
1603
1603
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1604
1604
  * See the License for the specific language governing permissions and
1605
1605
  * limitations under the License.
1606
- */class yy{constructor(){this.q_=void 0,this.Q_=[]}}class vy{constructor(){this.queries=new dn(e=>ol(e),Ps),this.onlineState="Unknown",this.K_=new Set}}async function nh(t,e){const n=P(t),r=e.query;let s=!1,i=n.queries.get(r);if(i||(s=!0,i=new yy),s)try{i.q_=await n.onListen(r)}catch(o){const a=na(o,`Initialization of query '${hn(e.query)}' failed`);return void e.onError(a)}n.queries.set(r,i),i.Q_.push(e),e.U_(n.onlineState),i.q_&&e.W_(i.q_)&&ra(n)}async function rh(t,e){const n=P(t),r=e.query;let s=!1;const i=n.queries.get(r);if(i){const o=i.Q_.indexOf(e);o>=0&&(i.Q_.splice(o,1),s=i.Q_.length===0)}if(s)return n.queries.delete(r),n.onUnlisten(r)}function Ey(t,e){const n=P(t);let r=!1;for(const s of e){const i=s.query,o=n.queries.get(i);if(o){for(const a of o.Q_)a.W_(s)&&(r=!0);o.q_=s}}r&&ra(n)}function Ty(t,e,n){const r=P(t),s=r.queries.get(e);if(s)for(const i of s.Q_)i.onError(n);r.queries.delete(e)}function ra(t){t.K_.forEach(e=>{e.next()})}class sh{constructor(e,n,r){this.query=e,this.G_=n,this.z_=!1,this.j_=null,this.onlineState="Unknown",this.options=r||{}}W_(e){if(!this.options.includeMetadataChanges){const r=[];for(const s of e.docChanges)s.type!==3&&r.push(s);e=new _n(e.query,e.docs,e.oldDocs,r,e.mutatedKeys,e.fromCache,e.syncStateChanged,!0,e.hasCachedResults)}let n=!1;return this.z_?this.H_(e)&&(this.G_.next(e),n=!0):this.J_(e,this.onlineState)&&(this.Y_(e),n=!0),this.j_=e,n}onError(e){this.G_.error(e)}U_(e){this.onlineState=e;let n=!1;return this.j_&&!this.z_&&this.J_(this.j_,e)&&(this.Y_(this.j_),n=!0),n}J_(e,n){if(!e.fromCache)return!0;const r=n!=="Offline";return(!this.options.Z_||!r)&&(!e.docs.isEmpty()||e.hasCachedResults||n==="Offline")}H_(e){if(e.docChanges.length>0)return!0;const n=this.j_&&this.j_.hasPendingWrites!==e.hasPendingWrites;return!(!e.syncStateChanged&&!n)&&this.options.includeMetadataChanges===!0}Y_(e){e=_n.fromInitialDocuments(e.query,e.docs,e.mutatedKeys,e.fromCache,e.hasCachedResults),this.z_=!0,this.G_.next(e)}}/**
1606
+ */class Oy{constructor(){this.q_=void 0,this.Q_=[]}K_(){return this.Q_.some(e=>e.U_())}}class Vy{constructor(){this.queries=new mn(e=>ml(e),Ds),this.onlineState="Unknown",this.W_=new Set}}async function lh(n,e){const t=P(n);let r=3;const s=e.query;let i=t.queries.get(s);i?!i.K_()&&e.U_()&&(r=2):(i=new Oy,r=e.U_()?0:1);try{switch(r){case 0:i.q_=await t.onListen(s,!0);break;case 1:i.q_=await t.onListen(s,!1);break;case 2:await t.onFirstRemoteStoreListen(s)}}catch(o){const a=aa(o,`Initialization of query '${pn(e.query)}' failed`);return void e.onError(a)}t.queries.set(s,i),i.Q_.push(e),e.G_(t.onlineState),i.q_&&e.z_(i.q_)&&ca(t)}async function hh(n,e){const t=P(n),r=e.query;let s=3;const i=t.queries.get(r);if(i){const o=i.Q_.indexOf(e);o>=0&&(i.Q_.splice(o,1),i.Q_.length===0?s=e.U_()?0:1:!i.K_()&&e.U_()&&(s=2))}switch(s){case 0:return t.queries.delete(r),t.onUnlisten(r,!0);case 1:return t.queries.delete(r),t.onUnlisten(r,!1);case 2:return t.onLastRemoteStoreUnlisten(r);default:return}}function Ly(n,e){const t=P(n);let r=!1;for(const s of e){const i=s.query,o=t.queries.get(i);if(o){for(const a of o.Q_)a.z_(s)&&(r=!0);o.q_=s}}r&&ca(t)}function My(n,e,t){const r=P(n),s=r.queries.get(e);if(s)for(const i of s.Q_)i.onError(t);r.queries.delete(e)}function ca(n){n.W_.forEach(e=>{e.next()})}var ua,dh;(dh=ua||(ua={})).j_="default",dh.Cache="cache";class fh{constructor(e,t,r){this.query=e,this.H_=t,this.J_=!1,this.Y_=null,this.onlineState="Unknown",this.options=r||{}}z_(e){if(!this.options.includeMetadataChanges){const r=[];for(const s of e.docChanges)s.type!==3&&r.push(s);e=new En(e.query,e.docs,e.oldDocs,r,e.mutatedKeys,e.fromCache,e.syncStateChanged,!0,e.hasCachedResults)}let t=!1;return this.J_?this.Z_(e)&&(this.H_.next(e),t=!0):this.X_(e,this.onlineState)&&(this.ea(e),t=!0),this.Y_=e,t}onError(e){this.H_.error(e)}G_(e){this.onlineState=e;let t=!1;return this.Y_&&!this.J_&&this.X_(this.Y_,e)&&(this.ea(this.Y_),t=!0),t}X_(e,t){if(!e.fromCache||!this.U_())return!0;const r=t!=="Offline";return(!this.options.ta||!r)&&(!e.docs.isEmpty()||e.hasCachedResults||t==="Offline")}Z_(e){if(e.docChanges.length>0)return!0;const t=this.Y_&&this.Y_.hasPendingWrites!==e.hasPendingWrites;return!(!e.syncStateChanged&&!t)&&this.options.includeMetadataChanges===!0}ea(e){e=En.fromInitialDocuments(e.query,e.docs,e.mutatedKeys,e.fromCache,e.hasCachedResults),this.J_=!0,this.H_.next(e)}U_(){return this.options.source!==ua.Cache}}/**
1607
1607
  * @license
1608
1608
  * Copyright 2017 Google LLC
1609
1609
  *
@@ -1618,7 +1618,7 @@ This typically indicates that your device does not have a healthy Internet conne
1618
1618
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1619
1619
  * See the License for the specific language governing permissions and
1620
1620
  * limitations under the License.
1621
- */class ih{constructor(e){this.key=e}}class oh{constructor(e){this.key=e}}class wy{constructor(e,n){this.query=e,this.oa=n,this._a=null,this.hasCachedResults=!1,this.current=!1,this.aa=D(),this.mutatedKeys=D(),this.ua=al(e),this.ca=new gn(this.ua)}get la(){return this.oa}ha(e,n){const r=n?n.Pa:new th,s=n?n.ca:this.ca;let i=n?n.mutatedKeys:this.mutatedKeys,o=s,a=!1;const c=this.query.limitType==="F"&&s.size===this.query.limit?s.last():null,u=this.query.limitType==="L"&&s.size===this.query.limit?s.first():null;if(e.inorderTraversal((l,h)=>{const d=s.get(l),f=Ss(this.query,h)?h:null,E=!!d&&this.mutatedKeys.has(d.key),T=!!f&&(f.hasLocalMutations||this.mutatedKeys.has(f.key)&&f.hasCommittedMutations);let _=!1;d&&f?d.data.isEqual(f.data)?E!==T&&(r.track({type:3,doc:f}),_=!0):this.Ia(d,f)||(r.track({type:2,doc:f}),_=!0,(c&&this.ua(f,c)>0||u&&this.ua(f,u)<0)&&(a=!0)):!d&&f?(r.track({type:0,doc:f}),_=!0):d&&!f&&(r.track({type:1,doc:d}),_=!0,(c||u)&&(a=!0)),_&&(f?(o=o.add(f),i=T?i.add(l):i.delete(l)):(o=o.delete(l),i=i.delete(l)))}),this.query.limit!==null)for(;o.size>this.query.limit;){const l=this.query.limitType==="F"?o.last():o.first();o=o.delete(l.key),i=i.delete(l.key),r.track({type:1,doc:l})}return{ca:o,Pa:r,Xi:a,mutatedKeys:i}}Ia(e,n){return e.hasLocalMutations&&n.hasCommittedMutations&&!n.hasLocalMutations}applyChanges(e,n,r,s){const i=this.ca;this.ca=e.ca,this.mutatedKeys=e.mutatedKeys;const o=e.Pa.k_();o.sort((l,h)=>function(f,E){const T=_=>{switch(_){case 0:return 1;case 2:case 3:return 2;case 1:return 0;default:return A()}};return T(f)-T(E)}(l.type,h.type)||this.ua(l.doc,h.doc)),this.Ta(r),s=s!=null&&s;const a=n&&!s?this.Ea():[],c=this.aa.size===0&&this.current&&!s?1:0,u=c!==this._a;return this._a=c,o.length!==0||u?{snapshot:new _n(this.query,e.ca,i,o,e.mutatedKeys,c===0,u,!1,!!r&&r.resumeToken.approximateByteSize()>0),da:a}:{da:a}}U_(e){return this.current&&e==="Offline"?(this.current=!1,this.applyChanges({ca:this.ca,Pa:new th,mutatedKeys:this.mutatedKeys,Xi:!1},!1)):{da:[]}}Aa(e){return!this.oa.has(e)&&!!this.ca.has(e)&&!this.ca.get(e).hasLocalMutations}Ta(e){e&&(e.addedDocuments.forEach(n=>this.oa=this.oa.add(n)),e.modifiedDocuments.forEach(n=>{}),e.removedDocuments.forEach(n=>this.oa=this.oa.delete(n)),this.current=e.current)}Ea(){if(!this.current)return[];const e=this.aa;this.aa=D(),this.ca.forEach(r=>{this.Aa(r.key)&&(this.aa=this.aa.add(r.key))});const n=[];return e.forEach(r=>{this.aa.has(r)||n.push(new oh(r))}),this.aa.forEach(r=>{e.has(r)||n.push(new ih(r))}),n}Ra(e){this.oa=e.hs,this.aa=D();const n=this.ha(e.documents);return this.applyChanges(n,!0)}Va(){return _n.fromInitialDocuments(this.query,this.ca,this.mutatedKeys,this._a===0,this.hasCachedResults)}}class Iy{constructor(e,n,r){this.query=e,this.targetId=n,this.view=r}}class Ay{constructor(e){this.key=e,this.ma=!1}}class Ry{constructor(e,n,r,s,i,o){this.localStore=e,this.remoteStore=n,this.eventManager=r,this.sharedClientState=s,this.currentUser=i,this.maxConcurrentLimboResolutions=o,this.fa={},this.ga=new dn(a=>ol(a),Ps),this.pa=new Map,this.ya=new Set,this.wa=new q(w.comparator),this.Sa=new Map,this.ba=new Wo,this.Da={},this.Ca=new Map,this.va=pn.Bn(),this.onlineState="Unknown",this.Fa=void 0}get isPrimaryClient(){return this.Fa===!0}}async function Py(t,e){const n=My(t);let r,s;const i=n.ga.get(e);if(i)r=i.targetId,n.sharedClientState.addLocalQueryTarget(r),s=i.view.Va();else{const o=await Q_(n.localStore,$e(e)),a=n.sharedClientState.addLocalQueryTarget(o.targetId);r=o.targetId,s=await Sy(n,e,r,a==="current",o.resumeToken),n.isPrimaryClient&&Gl(n.remoteStore,o)}return s}async function Sy(t,e,n,r,s){t.Ma=(h,d,f)=>async function(T,_,C,L){let k=_.view.ha(C);k.Xi&&(k=await $l(T.localStore,_.query,!1).then(({documents:Me})=>_.view.ha(Me,k)));const O=L&&L.targetChanges.get(_.targetId),_e=L&&L.targetMismatches.get(_.targetId)!=null,oe=_.view.applyChanges(k,T.isPrimaryClient,O,_e);return dh(T,_.targetId,oe.da),oe.snapshot}(t,h,d,f);const i=await $l(t.localStore,e,!0),o=new wy(e,i.hs),a=o.ha(i.documents),c=wr.createSynthesizedTargetChangeForCurrentChange(n,r&&t.onlineState!=="Offline",s),u=o.applyChanges(a,t.isPrimaryClient,c);dh(t,n,u.da);const l=new Iy(e,n,o);return t.ga.set(e,l),t.pa.has(n)?t.pa.get(n).push(e):t.pa.set(n,[e]),u.snapshot}async function by(t,e){const n=P(t),r=n.ga.get(e),s=n.pa.get(r.targetId);if(s.length>1)return n.pa.set(r.targetId,s.filter(i=>!Ps(i,e))),void n.ga.delete(e);n.isPrimaryClient?(n.sharedClientState.removeLocalQueryTarget(r.targetId),n.sharedClientState.isActiveQueryTarget(r.targetId)||await Qo(n.localStore,r.targetId,!1).then(()=>{n.sharedClientState.clearQueryState(r.targetId),Kl(n.remoteStore,r.targetId),sa(n,r.targetId)}).catch(ar)):(sa(n,r.targetId),await Qo(n.localStore,r.targetId,!0))}async function Cy(t,e,n){const r=xy(t);try{const s=await function(o,a){const c=P(o),u=Y.now(),l=a.reduce((f,E)=>f.add(E.key),D());let h,d;return c.persistence.runTransaction("Locally write mutations","readwrite",f=>{let E=Ze(),T=D();return c.os.getEntries(f,l).next(_=>{E=_,E.forEach((C,L)=>{L.isValidDocument()||(T=T.add(C))})}).next(()=>c.localDocuments.getOverlayedDocuments(f,E)).next(_=>{h=_;const C=[];for(const L of a){const k=e_(L,h.get(L.key).overlayedDocument);k!=null&&C.push(new mt(L.key,k,Ku(k.value.mapValue),Pe.exists(!0)))}return c.mutationQueue.addMutationBatch(f,u,C,a)}).next(_=>{d=_;const C=_.applyToLocalDocumentSet(h,T);return c.documentOverlayCache.saveOverlays(f,_.batchId,C)})}).then(()=>({batchId:d.batchId,changes:ul(h)}))}(r.localStore,e);r.sharedClientState.addPendingMutation(s.batchId),function(o,a,c){let u=o.Da[o.currentUser.toKey()];u||(u=new q(M)),u=u.insert(a,c),o.Da[o.currentUser.toKey()]=u}(r,s.batchId,n),await Ar(r,s.changes),await js(r.remoteStore)}catch(s){const i=na(s,"Failed to persist write");n.reject(i)}}async function ah(t,e){const n=P(t);try{const r=await W_(n.localStore,e);e.targetChanges.forEach((s,i)=>{const o=n.Sa.get(i);o&&(F(s.addedDocuments.size+s.modifiedDocuments.size+s.removedDocuments.size<=1),s.addedDocuments.size>0?o.ma=!0:s.modifiedDocuments.size>0?F(o.ma):s.removedDocuments.size>0&&(F(o.ma),o.ma=!1))}),await Ar(n,r,e)}catch(r){await ar(r)}}function ch(t,e,n){const r=P(t);if(r.isPrimaryClient&&n===0||!r.isPrimaryClient&&n===1){const s=[];r.ga.forEach((i,o)=>{const a=o.view.U_(e);a.snapshot&&s.push(a.snapshot)}),function(o,a){const c=P(o);c.onlineState=a;let u=!1;c.queries.forEach((l,h)=>{for(const d of h.Q_)d.U_(a)&&(u=!0)}),u&&ra(c)}(r.eventManager,e),s.length&&r.fa.u_(s),r.onlineState=e,r.isPrimaryClient&&r.sharedClientState.setOnlineState(e)}}async function ky(t,e,n){const r=P(t);r.sharedClientState.updateQueryState(e,"rejected",n);const s=r.Sa.get(e),i=s&&s.key;if(i){let o=new q(w.comparator);o=o.insert(i,he.newNoDocument(i,S.min()));const a=D().add(i),c=new Vs(S.min(),new Map,new q(M),o,a);await ah(r,c),r.wa=r.wa.remove(i),r.Sa.delete(e),ia(r)}else await Qo(r.localStore,e,!1).then(()=>sa(r,e,n)).catch(ar)}async function Dy(t,e){const n=P(t),r=e.batch.batchId;try{const s=await H_(n.localStore,e);lh(n,r,null),uh(n,r),n.sharedClientState.updateMutationState(r,"acknowledged"),await Ar(n,s)}catch(s){await ar(s)}}async function Ny(t,e,n){const r=P(t);try{const s=await function(o,a){const c=P(o);return c.persistence.runTransaction("Reject batch","readwrite-primary",u=>{let l;return c.mutationQueue.lookupMutationBatch(u,a).next(h=>(F(h!==null),l=h.keys(),c.mutationQueue.removeMutationBatch(u,h))).next(()=>c.mutationQueue.performConsistencyCheck(u)).next(()=>c.documentOverlayCache.removeOverlaysForBatchId(u,l,a)).next(()=>c.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(u,l)).next(()=>c.localDocuments.getDocuments(u,l))})}(r.localStore,e);lh(r,e,n),uh(r,e),r.sharedClientState.updateMutationState(e,"rejected",n),await Ar(r,s)}catch(s){await ar(s)}}function uh(t,e){(t.Ca.get(e)||[]).forEach(n=>{n.resolve()}),t.Ca.delete(e)}function lh(t,e,n){const r=P(t);let s=r.Da[r.currentUser.toKey()];if(s){const i=s.get(e);i&&(n?i.reject(n):i.resolve(),s=s.remove(e)),r.Da[r.currentUser.toKey()]=s}}function sa(t,e,n=null){t.sharedClientState.removeLocalQueryTarget(e);for(const r of t.pa.get(e))t.ga.delete(r),n&&t.fa.xa(r,n);t.pa.delete(e),t.isPrimaryClient&&t.ba.Vr(e).forEach(r=>{t.ba.containsKey(r)||hh(t,r)})}function hh(t,e){t.ya.delete(e.path.canonicalString());const n=t.wa.get(e);n!==null&&(Kl(t.remoteStore,n),t.wa=t.wa.remove(e),t.Sa.delete(n),ia(t))}function dh(t,e,n){for(const r of n)r instanceof ih?(t.ba.addReference(r.key,e),Oy(t,r)):r instanceof oh?(v("SyncEngine","Document no longer in limbo: "+r.key),t.ba.removeReference(r.key,e),t.ba.containsKey(r.key)||hh(t,r.key)):A()}function Oy(t,e){const n=e.key,r=n.path.canonicalString();t.wa.get(n)||t.ya.has(r)||(v("SyncEngine","New document in limbo: "+n),t.ya.add(r),ia(t))}function ia(t){for(;t.ya.size>0&&t.wa.size<t.maxConcurrentLimboResolutions;){const e=t.ya.values().next().value;t.ya.delete(e);const n=new w(B.fromString(e)),r=t.va.next();t.Sa.set(r,new Ay(n)),t.wa=t.wa.insert(n,r),Gl(t.remoteStore,new _t($e(Lo(n.path)),r,"TargetPurposeLimboResolution",Po._e))}}async function Ar(t,e,n){const r=P(t),s=[],i=[],o=[];r.ga.isEmpty()||(r.ga.forEach((a,c)=>{o.push(r.Ma(c,e,n).then(u=>{if((u||n)&&r.isPrimaryClient&&r.sharedClientState.updateQueryState(c.targetId,u!=null&&u.fromCache?"not-current":"current"),u){s.push(u);const l=Ko.Ki(c.targetId,u);i.push(l)}}))}),await Promise.all(o),r.fa.u_(s),await async function(c,u){const l=P(c);try{await l.persistence.runTransaction("notifyLocalViewChanges","readwrite",h=>m.forEach(u,d=>m.forEach(d.qi,f=>l.persistence.referenceDelegate.addReference(h,d.targetId,f)).next(()=>m.forEach(d.Qi,f=>l.persistence.referenceDelegate.removeReference(h,d.targetId,f)))))}catch(h){if(!ur(h))throw h;v("LocalStore","Failed to update sequence numbers: "+h)}for(const h of u){const d=h.targetId;if(!h.fromCache){const f=l.ns.get(d),E=f.snapshotVersion,T=f.withLastLimboFreeSnapshotVersion(E);l.ns=l.ns.insert(d,T)}}}(r.localStore,i))}async function Vy(t,e){const n=P(t);if(!n.currentUser.isEqual(e)){v("SyncEngine","User change. New user:",e.toKey());const r=await Bl(n.localStore,e);n.currentUser=e,function(i,o){i.Ca.forEach(a=>{a.forEach(c=>{c.reject(new g(p.CANCELLED,o))})}),i.Ca.clear()}(n,"'waitForPendingWrites' promise is rejected due to a user change."),n.sharedClientState.handleUserChange(e,r.removedBatchIds,r.addedBatchIds),await Ar(n,r.us)}}function Ly(t,e){const n=P(t),r=n.Sa.get(e);if(r&&r.ma)return D().add(r.key);{let s=D();const i=n.pa.get(e);if(!i)return s;for(const o of i){const a=n.ga.get(o);s=s.unionWith(a.view.la)}return s}}function My(t){const e=P(t);return e.remoteStore.remoteSyncer.applyRemoteEvent=ah.bind(null,e),e.remoteStore.remoteSyncer.getRemoteKeysForTarget=Ly.bind(null,e),e.remoteStore.remoteSyncer.rejectListen=ky.bind(null,e),e.fa.u_=Ey.bind(null,e.eventManager),e.fa.xa=Ty.bind(null,e.eventManager),e}function xy(t){const e=P(t);return e.remoteStore.remoteSyncer.applySuccessfulWrite=Dy.bind(null,e),e.remoteStore.remoteSyncer.rejectFailedWrite=Ny.bind(null,e),e}class fh{constructor(){this.synchronizeTabs=!1}async initialize(e){this.serializer=Us(e.databaseInfo.databaseId),this.sharedClientState=this.createSharedClientState(e),this.persistence=this.createPersistence(e),await this.persistence.start(),this.localStore=this.createLocalStore(e),this.gcScheduler=this.createGarbageCollectionScheduler(e,this.localStore),this.indexBackfillerScheduler=this.createIndexBackfillerScheduler(e,this.localStore)}createGarbageCollectionScheduler(e,n){return null}createIndexBackfillerScheduler(e,n){return null}createLocalStore(e){return z_(this.persistence,new $_,e.initialUser,this.serializer)}createPersistence(e){return new F_(Go.Hr,this.serializer)}createSharedClientState(e){return new X_}async terminate(){var e,n;(e=this.gcScheduler)===null||e===void 0||e.stop(),(n=this.indexBackfillerScheduler)===null||n===void 0||n.stop(),this.sharedClientState.shutdown(),await this.persistence.shutdown()}}class Uy{async initialize(e,n){this.localStore||(this.localStore=e.localStore,this.sharedClientState=e.sharedClientState,this.datastore=this.createDatastore(n),this.remoteStore=this.createRemoteStore(n),this.eventManager=this.createEventManager(n),this.syncEngine=this.createSyncEngine(n,!e.synchronizeTabs),this.sharedClientState.onlineStateHandler=r=>ch(this.syncEngine,r,1),this.remoteStore.remoteSyncer.handleCredentialChange=Vy.bind(null,this.syncEngine),await _y(this.remoteStore,this.syncEngine.isPrimaryClient))}createEventManager(e){return function(){return new vy}()}createDatastore(e){const n=Us(e.databaseInfo.databaseId),r=function(i){return new ty(i)}(e.databaseInfo);return function(i,o,a,c){return new sy(i,o,a,c)}(e.authCredentials,e.appCheckCredentials,r,n)}createRemoteStore(e){return function(r,s,i,o,a){return new ay(r,s,i,o,a)}(this.localStore,this.datastore,e.asyncQueue,n=>ch(this.syncEngine,n,0),function(){return zl.D()?new zl:new J_}())}createSyncEngine(e,n){return function(s,i,o,a,c,u,l){const h=new Ry(s,i,o,a,c,u);return l&&(h.Fa=!0),h}(this.localStore,this.remoteStore,this.eventManager,this.sharedClientState,e.initialUser,e.maxConcurrentLimboResolutions,n)}async terminate(){var e;await async function(r){const s=P(r);v("RemoteStore","RemoteStore shutting down."),s.v_.add(5),await Ir(s),s.M_.shutdown(),s.x_.set("Unknown")}(this.remoteStore),(e=this.datastore)===null||e===void 0||e.terminate()}}/**
1621
+ */class ph{constructor(e){this.key=e}}class mh{constructor(e){this.key=e}}class xy{constructor(e,t){this.query=e,this.ua=t,this.ca=null,this.hasCachedResults=!1,this.current=!1,this.la=D(),this.mutatedKeys=D(),this.ha=gl(e),this.Pa=new vn(this.ha)}get Ia(){return this.ua}Ta(e,t){const r=t?t.Ea:new uh,s=t?t.Pa:this.Pa;let i=t?t.mutatedKeys:this.mutatedKeys,o=s,a=!1;const c=this.query.limitType==="F"&&s.size===this.query.limit?s.last():null,u=this.query.limitType==="L"&&s.size===this.query.limit?s.first():null;if(e.inorderTraversal((l,h)=>{const d=s.get(l),f=Ns(this.query,h)?h:null,E=!!d&&this.mutatedKeys.has(d.key),T=!!f&&(f.hasLocalMutations||this.mutatedKeys.has(f.key)&&f.hasCommittedMutations);let _=!1;d&&f?d.data.isEqual(f.data)?E!==T&&(r.track({type:3,doc:f}),_=!0):this.da(d,f)||(r.track({type:2,doc:f}),_=!0,(c&&this.ha(f,c)>0||u&&this.ha(f,u)<0)&&(a=!0)):!d&&f?(r.track({type:0,doc:f}),_=!0):d&&!f&&(r.track({type:1,doc:d}),_=!0,(c||u)&&(a=!0)),_&&(f?(o=o.add(f),i=T?i.add(l):i.delete(l)):(o=o.delete(l),i=i.delete(l)))}),this.query.limit!==null)for(;o.size>this.query.limit;){const l=this.query.limitType==="F"?o.last():o.first();o=o.delete(l.key),i=i.delete(l.key),r.track({type:1,doc:l})}return{Pa:o,Ea:r,Xi:a,mutatedKeys:i}}da(e,t){return e.hasLocalMutations&&t.hasCommittedMutations&&!t.hasLocalMutations}applyChanges(e,t,r,s){const i=this.Pa;this.Pa=e.Pa,this.mutatedKeys=e.mutatedKeys;const o=e.Ea.k_();o.sort((l,h)=>function(f,E){const T=_=>{switch(_){case 0:return 1;case 2:case 3:return 2;case 1:return 0;default:return A()}};return T(f)-T(E)}(l.type,h.type)||this.ha(l.doc,h.doc)),this.Aa(r),s=s!=null&&s;const a=t&&!s?this.Ra():[],c=this.la.size===0&&this.current&&!s?1:0,u=c!==this.ca;return this.ca=c,o.length!==0||u?{snapshot:new En(this.query,e.Pa,i,o,e.mutatedKeys,c===0,u,!1,!!r&&r.resumeToken.approximateByteSize()>0),Va:a}:{Va:a}}G_(e){return this.current&&e==="Offline"?(this.current=!1,this.applyChanges({Pa:this.Pa,Ea:new uh,mutatedKeys:this.mutatedKeys,Xi:!1},!1)):{Va:[]}}ma(e){return!this.ua.has(e)&&!!this.Pa.has(e)&&!this.Pa.get(e).hasLocalMutations}Aa(e){e&&(e.addedDocuments.forEach(t=>this.ua=this.ua.add(t)),e.modifiedDocuments.forEach(t=>{}),e.removedDocuments.forEach(t=>this.ua=this.ua.delete(t)),this.current=e.current)}Ra(){if(!this.current)return[];const e=this.la;this.la=D(),this.Pa.forEach(r=>{this.ma(r.key)&&(this.la=this.la.add(r.key))});const t=[];return e.forEach(r=>{this.la.has(r)||t.push(new mh(r))}),this.la.forEach(r=>{e.has(r)||t.push(new ph(r))}),t}fa(e){this.ua=e.hs,this.la=D();const t=this.Ta(e.documents);return this.applyChanges(t,!0)}ga(){return En.fromInitialDocuments(this.query,this.Pa,this.mutatedKeys,this.ca===0,this.hasCachedResults)}}class Uy{constructor(e,t,r){this.query=e,this.targetId=t,this.view=r}}class Fy{constructor(e){this.key=e,this.pa=!1}}class By{constructor(e,t,r,s,i,o){this.localStore=e,this.remoteStore=t,this.eventManager=r,this.sharedClientState=s,this.currentUser=i,this.maxConcurrentLimboResolutions=o,this.ya={},this.wa=new mn(a=>ml(a),Ds),this.Sa=new Map,this.ba=new Set,this.Da=new $(w.comparator),this.Ca=new Map,this.va=new Yo,this.Fa={},this.Ma=new Map,this.xa=_n.Ln(),this.onlineState="Unknown",this.Oa=void 0}get isPrimaryClient(){return this.Oa===!0}}async function jy(n,e,t=!0){const r=Ih(n);let s;const i=r.wa.get(e);return i?(r.sharedClientState.addLocalQueryTarget(i.targetId),s=i.view.ga()):s=await gh(r,e,t,!0),s}async function qy(n,e){const t=Ih(n);await gh(t,e,!0,!1)}async function gh(n,e,t,r){const s=await ly(n.localStore,He(e)),i=s.targetId,o=t?n.sharedClientState.addLocalQueryTarget(i):"not-current";let a;return r&&(a=await $y(n,e,i,o==="current",s.resumeToken)),n.isPrimaryClient&&t&&nh(n.remoteStore,s),a}async function $y(n,e,t,r,s){n.Na=(h,d,f)=>async function(T,_,C,L){let k=_.view.Ta(C);k.Xi&&(k=await Xl(T.localStore,_.query,!1).then(({documents:Fe})=>_.view.Ta(Fe,k)));const O=L&&L.targetChanges.get(_.targetId),ve=L&&L.targetMismatches.get(_.targetId)!=null,oe=_.view.applyChanges(k,T.isPrimaryClient,O,ve);return wh(T,_.targetId,oe.Va),oe.snapshot}(n,h,d,f);const i=await Xl(n.localStore,e,!0),o=new xy(e,i.hs),a=o.Ta(i.documents),c=br.createSynthesizedTargetChangeForCurrentChange(t,r&&n.onlineState!=="Offline",s),u=o.applyChanges(a,n.isPrimaryClient,c);wh(n,t,u.Va);const l=new Uy(e,t,o);return n.wa.set(e,l),n.Sa.has(t)?n.Sa.get(t).push(e):n.Sa.set(t,[e]),u.snapshot}async function zy(n,e,t){const r=P(n),s=r.wa.get(e),i=r.Sa.get(s.targetId);if(i.length>1)return r.Sa.set(s.targetId,i.filter(o=>!Ds(o,e))),void r.wa.delete(e);r.isPrimaryClient?(r.sharedClientState.removeLocalQueryTarget(s.targetId),r.sharedClientState.isActiveQueryTarget(s.targetId)||await Zo(r.localStore,s.targetId,!1).then(()=>{r.sharedClientState.clearQueryState(s.targetId),t&&na(r.remoteStore,s.targetId),la(r,s.targetId)}).catch(fr)):(la(r,s.targetId),await Zo(r.localStore,s.targetId,!0))}async function Hy(n,e){const t=P(n),r=t.wa.get(e),s=t.Sa.get(r.targetId);t.isPrimaryClient&&s.length===1&&(t.sharedClientState.removeLocalQueryTarget(r.targetId),na(t.remoteStore,r.targetId))}async function Wy(n,e,t){const r=Zy(n);try{const s=await function(o,a){const c=P(o),u=Y.now(),l=a.reduce((f,E)=>f.add(E.key),D());let h,d;return c.persistence.runTransaction("Locally write mutations","readwrite",f=>{let E=nt(),T=D();return c.os.getEntries(f,l).next(_=>{E=_,E.forEach((C,L)=>{L.isValidDocument()||(T=T.add(C))})}).next(()=>c.localDocuments.getOverlayedDocuments(f,E)).next(_=>{h=_;const C=[];for(const L of a){const k=m_(L,h.get(L.key).overlayedDocument);k!=null&&C.push(new vt(L.key,k,rl(k.value.mapValue),Ce.exists(!0)))}return c.mutationQueue.addMutationBatch(f,u,C,a)}).next(_=>{d=_;const C=_.applyToLocalDocumentSet(h,T);return c.documentOverlayCache.saveOverlays(f,_.batchId,C)})}).then(()=>({batchId:d.batchId,changes:yl(h)}))}(r.localStore,e);r.sharedClientState.addPendingMutation(s.batchId),function(o,a,c){let u=o.Fa[o.currentUser.toKey()];u||(u=new $(M)),u=u.insert(a,c),o.Fa[o.currentUser.toKey()]=u}(r,s.batchId,t),await kr(r,s.changes),await Ws(r.remoteStore)}catch(s){const i=aa(s,"Failed to persist write");t.reject(i)}}async function _h(n,e){const t=P(n);try{const r=await ay(t.localStore,e);e.targetChanges.forEach((s,i)=>{const o=t.Ca.get(i);o&&(F(s.addedDocuments.size+s.modifiedDocuments.size+s.removedDocuments.size<=1),s.addedDocuments.size>0?o.pa=!0:s.modifiedDocuments.size>0?F(o.pa):s.removedDocuments.size>0&&(F(o.pa),o.pa=!1))}),await kr(t,r,e)}catch(r){await fr(r)}}function yh(n,e,t){const r=P(n);if(r.isPrimaryClient&&t===0||!r.isPrimaryClient&&t===1){const s=[];r.wa.forEach((i,o)=>{const a=o.view.G_(e);a.snapshot&&s.push(a.snapshot)}),function(o,a){const c=P(o);c.onlineState=a;let u=!1;c.queries.forEach((l,h)=>{for(const d of h.Q_)d.G_(a)&&(u=!0)}),u&&ca(c)}(r.eventManager,e),s.length&&r.ya.u_(s),r.onlineState=e,r.isPrimaryClient&&r.sharedClientState.setOnlineState(e)}}async function Gy(n,e,t){const r=P(n);r.sharedClientState.updateQueryState(e,"rejected",t);const s=r.Ca.get(e),i=s&&s.key;if(i){let o=new $(w.comparator);o=o.insert(i,he.newNoDocument(i,S.min()));const a=D().add(i),c=new Fs(S.min(),new Map,new $(M),o,a);await _h(r,c),r.Da=r.Da.remove(i),r.Ca.delete(e),ha(r)}else await Zo(r.localStore,e,!1).then(()=>la(r,e,t)).catch(fr)}async function Ky(n,e){const t=P(n),r=e.batch.batchId;try{const s=await oy(t.localStore,e);Eh(t,r,null),vh(t,r),t.sharedClientState.updateMutationState(r,"acknowledged"),await kr(t,s)}catch(s){await fr(s)}}async function Qy(n,e,t){const r=P(n);try{const s=await function(o,a){const c=P(o);return c.persistence.runTransaction("Reject batch","readwrite-primary",u=>{let l;return c.mutationQueue.lookupMutationBatch(u,a).next(h=>(F(h!==null),l=h.keys(),c.mutationQueue.removeMutationBatch(u,h))).next(()=>c.mutationQueue.performConsistencyCheck(u)).next(()=>c.documentOverlayCache.removeOverlaysForBatchId(u,l,a)).next(()=>c.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(u,l)).next(()=>c.localDocuments.getDocuments(u,l))})}(r.localStore,e);Eh(r,e,t),vh(r,e),r.sharedClientState.updateMutationState(e,"rejected",t),await kr(r,s)}catch(s){await fr(s)}}function vh(n,e){(n.Ma.get(e)||[]).forEach(t=>{t.resolve()}),n.Ma.delete(e)}function Eh(n,e,t){const r=P(n);let s=r.Fa[r.currentUser.toKey()];if(s){const i=s.get(e);i&&(t?i.reject(t):i.resolve(),s=s.remove(e)),r.Fa[r.currentUser.toKey()]=s}}function la(n,e,t=null){n.sharedClientState.removeLocalQueryTarget(e);for(const r of n.Sa.get(e))n.wa.delete(r),t&&n.ya.La(r,t);n.Sa.delete(e),n.isPrimaryClient&&n.va.Vr(e).forEach(r=>{n.va.containsKey(r)||Th(n,r)})}function Th(n,e){n.ba.delete(e.path.canonicalString());const t=n.Da.get(e);t!==null&&(na(n.remoteStore,t),n.Da=n.Da.remove(e),n.Ca.delete(t),ha(n))}function wh(n,e,t){for(const r of t)r instanceof ph?(n.va.addReference(r.key,e),Yy(n,r)):r instanceof mh?(v("SyncEngine","Document no longer in limbo: "+r.key),n.va.removeReference(r.key,e),n.va.containsKey(r.key)||Th(n,r.key)):A()}function Yy(n,e){const t=e.key,r=t.path.canonicalString();n.Da.get(t)||n.ba.has(r)||(v("SyncEngine","New document in limbo: "+t),n.ba.add(r),ha(n))}function ha(n){for(;n.ba.size>0&&n.Da.size<n.maxConcurrentLimboResolutions;){const e=n.ba.values().next().value;n.ba.delete(e);const t=new w(B.fromString(e)),r=n.xa.next();n.Ca.set(r,new Fy(t)),n.Da=n.Da.insert(t,r),nh(n.remoteStore,new Tt(He(Fo(t.path)),r,"TargetPurposeLimboResolution",ko._e))}}async function kr(n,e,t){const r=P(n),s=[],i=[],o=[];r.wa.isEmpty()||(r.wa.forEach((a,c)=>{o.push(r.Na(c,e,t).then(u=>{if((u||t)&&r.isPrimaryClient&&r.sharedClientState.updateQueryState(c.targetId,u!=null&&u.fromCache?"not-current":"current"),u){s.push(u);const l=Jo.Ki(c.targetId,u);i.push(l)}}))}),await Promise.all(o),r.ya.u_(s),await async function(c,u){const l=P(c);try{await l.persistence.runTransaction("notifyLocalViewChanges","readwrite",h=>m.forEach(u,d=>m.forEach(d.qi,f=>l.persistence.referenceDelegate.addReference(h,d.targetId,f)).next(()=>m.forEach(d.Qi,f=>l.persistence.referenceDelegate.removeReference(h,d.targetId,f)))))}catch(h){if(!mr(h))throw h;v("LocalStore","Failed to update sequence numbers: "+h)}for(const h of u){const d=h.targetId;if(!h.fromCache){const f=l.ns.get(d),E=f.snapshotVersion,T=f.withLastLimboFreeSnapshotVersion(E);l.ns=l.ns.insert(d,T)}}}(r.localStore,i))}async function Xy(n,e){const t=P(n);if(!t.currentUser.isEqual(e)){v("SyncEngine","User change. New user:",e.toKey());const r=await Ql(t.localStore,e);t.currentUser=e,function(i,o){i.Ma.forEach(a=>{a.forEach(c=>{c.reject(new g(p.CANCELLED,o))})}),i.Ma.clear()}(t,"'waitForPendingWrites' promise is rejected due to a user change."),t.sharedClientState.handleUserChange(e,r.removedBatchIds,r.addedBatchIds),await kr(t,r.us)}}function Jy(n,e){const t=P(n),r=t.Ca.get(e);if(r&&r.pa)return D().add(r.key);{let s=D();const i=t.Sa.get(e);if(!i)return s;for(const o of i){const a=t.wa.get(o);s=s.unionWith(a.view.Ia)}return s}}function Ih(n){const e=P(n);return e.remoteStore.remoteSyncer.applyRemoteEvent=_h.bind(null,e),e.remoteStore.remoteSyncer.getRemoteKeysForTarget=Jy.bind(null,e),e.remoteStore.remoteSyncer.rejectListen=Gy.bind(null,e),e.ya.u_=Ly.bind(null,e.eventManager),e.ya.La=My.bind(null,e.eventManager),e}function Zy(n){const e=P(n);return e.remoteStore.remoteSyncer.applySuccessfulWrite=Ky.bind(null,e),e.remoteStore.remoteSyncer.rejectFailedWrite=Qy.bind(null,e),e}class Ah{constructor(){this.synchronizeTabs=!1}async initialize(e){this.serializer=$s(e.databaseInfo.databaseId),this.sharedClientState=this.createSharedClientState(e),this.persistence=this.createPersistence(e),await this.persistence.start(),this.localStore=this.createLocalStore(e),this.gcScheduler=this.createGarbageCollectionScheduler(e,this.localStore),this.indexBackfillerScheduler=this.createIndexBackfillerScheduler(e,this.localStore)}createGarbageCollectionScheduler(e,t){return null}createIndexBackfillerScheduler(e,t){return null}createLocalStore(e){return iy(this.persistence,new ry,e.initialUser,this.serializer)}createPersistence(e){return new ey(Xo.Hr,this.serializer)}createSharedClientState(e){return new dy}async terminate(){var e,t;(e=this.gcScheduler)===null||e===void 0||e.stop(),(t=this.indexBackfillerScheduler)===null||t===void 0||t.stop(),this.sharedClientState.shutdown(),await this.persistence.shutdown()}}class ev{async initialize(e,t){this.localStore||(this.localStore=e.localStore,this.sharedClientState=e.sharedClientState,this.datastore=this.createDatastore(t),this.remoteStore=this.createRemoteStore(t),this.eventManager=this.createEventManager(t),this.syncEngine=this.createSyncEngine(t,!e.synchronizeTabs),this.sharedClientState.onlineStateHandler=r=>yh(this.syncEngine,r,1),this.remoteStore.remoteSyncer.handleCredentialChange=Xy.bind(null,this.syncEngine),await Ny(this.remoteStore,this.syncEngine.isPrimaryClient))}createEventManager(e){return function(){return new Vy}()}createDatastore(e){const t=$s(e.databaseInfo.databaseId),r=function(i){return new gy(i)}(e.databaseInfo);return function(i,o,a,c){return new vy(i,o,a,c)}(e.authCredentials,e.appCheckCredentials,r,t)}createRemoteStore(e){return function(r,s,i,o,a){return new wy(r,s,i,o,a)}(this.localStore,this.datastore,e.asyncQueue,t=>yh(this.syncEngine,t,0),function(){return Zl.D()?new Zl:new fy}())}createSyncEngine(e,t){return function(s,i,o,a,c,u,l){const h=new By(s,i,o,a,c,u);return l&&(h.Oa=!0),h}(this.localStore,this.remoteStore,this.eventManager,this.sharedClientState,e.initialUser,e.maxConcurrentLimboResolutions,t)}async terminate(){var e;await async function(r){const s=P(r);v("RemoteStore","RemoteStore shutting down."),s.v_.add(5),await Cr(s),s.M_.shutdown(),s.x_.set("Unknown")}(this.remoteStore),(e=this.datastore)===null||e===void 0||e.terminate()}}/**
1622
1622
  * @license
1623
1623
  * Copyright 2020 Google LLC
1624
1624
  *
@@ -1648,7 +1648,7 @@ This typically indicates that your device does not have a healthy Internet conne
1648
1648
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1649
1649
  * See the License for the specific language governing permissions and
1650
1650
  * limitations under the License.
1651
- */class ph{constructor(e){this.observer=e,this.muted=!1}next(e){this.observer.next&&this.Ba(this.observer.next,e)}error(e){this.observer.error?this.Ba(this.observer.error,e):Be("Uncaught Error in snapshot listener:",e.toString())}La(){this.muted=!0}Ba(e,n){this.muted||setTimeout(()=>{this.muted||e(n)},0)}}/**
1651
+ */class Rh{constructor(e){this.observer=e,this.muted=!1}next(e){this.observer.next&&this.qa(this.observer.next,e)}error(e){this.observer.error?this.qa(this.observer.error,e):$e("Uncaught Error in snapshot listener:",e.toString())}Qa(){this.muted=!0}qa(e,t){this.muted||setTimeout(()=>{this.muted||e(t)},0)}}/**
1652
1652
  * @license
1653
1653
  * Copyright 2017 Google LLC
1654
1654
  *
@@ -1663,7 +1663,7 @@ This typically indicates that your device does not have a healthy Internet conne
1663
1663
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1664
1664
  * See the License for the specific language governing permissions and
1665
1665
  * limitations under the License.
1666
- */class Fy{constructor(e,n,r,s){this.authCredentials=e,this.appCheckCredentials=n,this.asyncQueue=r,this.databaseInfo=s,this.user=ue.UNAUTHENTICATED,this.clientId=Fu.newId(),this.authCredentialListener=()=>Promise.resolve(),this.appCheckCredentialListener=()=>Promise.resolve(),this.authCredentials.start(r,async i=>{v("FirestoreClient","Received user=",i.uid),await this.authCredentialListener(i),this.user=i}),this.appCheckCredentials.start(r,i=>(v("FirestoreClient","Received new app check token=",i),this.appCheckCredentialListener(i,this.user)))}get configuration(){return{asyncQueue:this.asyncQueue,databaseInfo:this.databaseInfo,clientId:this.clientId,authCredentials:this.authCredentials,appCheckCredentials:this.appCheckCredentials,initialUser:this.user,maxConcurrentLimboResolutions:100}}setCredentialChangeListener(e){this.authCredentialListener=e}setAppCheckTokenChangeListener(e){this.appCheckCredentialListener=e}verifyNotTerminated(){if(this.asyncQueue.isShuttingDown)throw new g(p.FAILED_PRECONDITION,"The client has already been terminated.")}terminate(){this.asyncQueue.enterRestrictedMode();const e=new De;return this.asyncQueue.enqueueAndForgetEvenWhileRestricted(async()=>{try{this._onlineComponents&&await this._onlineComponents.terminate(),this._offlineComponents&&await this._offlineComponents.terminate(),this.authCredentials.shutdown(),this.appCheckCredentials.shutdown(),e.resolve()}catch(n){const r=na(n,"Failed to shutdown persistence");e.reject(r)}}),e.promise}}async function oa(t,e){t.asyncQueue.verifyOperationInProgress(),v("FirestoreClient","Initializing OfflineComponentProvider");const n=t.configuration;await e.initialize(n);let r=n.initialUser;t.setCredentialChangeListener(async s=>{r.isEqual(s)||(await Bl(e.localStore,s),r=s)}),e.persistence.setDatabaseDeletedListener(()=>t.terminate()),t._offlineComponents=e}async function mh(t,e){t.asyncQueue.verifyOperationInProgress();const n=await jy(t);v("FirestoreClient","Initializing OnlineComponentProvider"),await e.initialize(n,t.configuration),t.setCredentialChangeListener(r=>eh(e.remoteStore,r)),t.setAppCheckTokenChangeListener((r,s)=>eh(e.remoteStore,s)),t._onlineComponents=e}function By(t){return t.name==="FirebaseError"?t.code===p.FAILED_PRECONDITION||t.code===p.UNIMPLEMENTED:!(typeof DOMException<"u"&&t instanceof DOMException)||t.code===22||t.code===20||t.code===11}async function jy(t){if(!t._offlineComponents)if(t._uninitializedComponentsProvider){v("FirestoreClient","Using user provided OfflineComponentProvider");try{await oa(t,t._uninitializedComponentsProvider._offline)}catch(e){const n=e;if(!By(n))throw n;sn("Error using user provided cache. Falling back to memory cache: "+n),await oa(t,new fh)}}else v("FirestoreClient","Using default OfflineComponentProvider"),await oa(t,new fh);return t._offlineComponents}async function aa(t){return t._onlineComponents||(t._uninitializedComponentsProvider?(v("FirestoreClient","Using user provided OnlineComponentProvider"),await mh(t,t._uninitializedComponentsProvider._online)):(v("FirestoreClient","Using default OnlineComponentProvider"),await mh(t,new Uy))),t._onlineComponents}function $y(t){return aa(t).then(e=>e.syncEngine)}function qy(t){return aa(t).then(e=>e.datastore)}async function gh(t){const e=await aa(t),n=e.eventManager;return n.onListen=Py.bind(null,e.syncEngine),n.onUnlisten=by.bind(null,e.syncEngine),n}function zy(t,e,n={}){const r=new De;return t.asyncQueue.enqueueAndForget(async()=>function(i,o,a,c,u){const l=new ph({next:d=>{o.enqueueAndForget(()=>rh(i,h));const f=d.docs.has(a);!f&&d.fromCache?u.reject(new g(p.UNAVAILABLE,"Failed to get document because the client is offline.")):f&&d.fromCache&&c&&c.source==="server"?u.reject(new g(p.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.)')):u.resolve(d)},error:d=>u.reject(d)}),h=new sh(Lo(a.path),l,{includeMetadataChanges:!0,Z_:!0});return nh(i,h)}(await gh(t),t.asyncQueue,e,n,r)),r.promise}function Hy(t,e,n={}){const r=new De;return t.asyncQueue.enqueueAndForget(async()=>function(i,o,a,c,u){const l=new ph({next:d=>{o.enqueueAndForget(()=>rh(i,h)),d.fromCache&&c.source==="server"?u.reject(new g(p.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.)')):u.resolve(d)},error:d=>u.reject(d)}),h=new sh(a,l,{includeMetadataChanges:!0,Z_:!0});return nh(i,h)}(await gh(t),t.asyncQueue,e,n,r)),r.promise}/**
1666
+ */class tv{constructor(e,t,r,s){this.authCredentials=e,this.appCheckCredentials=t,this.asyncQueue=r,this.databaseInfo=s,this.user=ue.UNAUTHENTICATED,this.clientId=Ku.newId(),this.authCredentialListener=()=>Promise.resolve(),this.appCheckCredentialListener=()=>Promise.resolve(),this.authCredentials.start(r,async i=>{v("FirestoreClient","Received user=",i.uid),await this.authCredentialListener(i),this.user=i}),this.appCheckCredentials.start(r,i=>(v("FirestoreClient","Received new app check token=",i),this.appCheckCredentialListener(i,this.user)))}get configuration(){return{asyncQueue:this.asyncQueue,databaseInfo:this.databaseInfo,clientId:this.clientId,authCredentials:this.authCredentials,appCheckCredentials:this.appCheckCredentials,initialUser:this.user,maxConcurrentLimboResolutions:100}}setCredentialChangeListener(e){this.authCredentialListener=e}setAppCheckTokenChangeListener(e){this.appCheckCredentialListener=e}verifyNotTerminated(){if(this.asyncQueue.isShuttingDown)throw new g(p.FAILED_PRECONDITION,"The client has already been terminated.")}terminate(){this.asyncQueue.enterRestrictedMode();const e=new Oe;return this.asyncQueue.enqueueAndForgetEvenWhileRestricted(async()=>{try{this._onlineComponents&&await this._onlineComponents.terminate(),this._offlineComponents&&await this._offlineComponents.terminate(),this.authCredentials.shutdown(),this.appCheckCredentials.shutdown(),e.resolve()}catch(t){const r=aa(t,"Failed to shutdown persistence");e.reject(r)}}),e.promise}}async function da(n,e){n.asyncQueue.verifyOperationInProgress(),v("FirestoreClient","Initializing OfflineComponentProvider");const t=n.configuration;await e.initialize(t);let r=t.initialUser;n.setCredentialChangeListener(async s=>{r.isEqual(s)||(await Ql(e.localStore,s),r=s)}),e.persistence.setDatabaseDeletedListener(()=>n.terminate()),n._offlineComponents=e}async function Ph(n,e){n.asyncQueue.verifyOperationInProgress();const t=await rv(n);v("FirestoreClient","Initializing OnlineComponentProvider"),await e.initialize(t,n.configuration),n.setCredentialChangeListener(r=>ch(e.remoteStore,r)),n.setAppCheckTokenChangeListener((r,s)=>ch(e.remoteStore,s)),n._onlineComponents=e}function nv(n){return n.name==="FirebaseError"?n.code===p.FAILED_PRECONDITION||n.code===p.UNIMPLEMENTED:!(typeof DOMException<"u"&&n instanceof DOMException)||n.code===22||n.code===20||n.code===11}async function rv(n){if(!n._offlineComponents)if(n._uninitializedComponentsProvider){v("FirestoreClient","Using user provided OfflineComponentProvider");try{await da(n,n._uninitializedComponentsProvider._offline)}catch(e){const t=e;if(!nv(t))throw t;cn("Error using user provided cache. Falling back to memory cache: "+t),await da(n,new Ah)}}else v("FirestoreClient","Using default OfflineComponentProvider"),await da(n,new Ah);return n._offlineComponents}async function fa(n){return n._onlineComponents||(n._uninitializedComponentsProvider?(v("FirestoreClient","Using user provided OnlineComponentProvider"),await Ph(n,n._uninitializedComponentsProvider._online)):(v("FirestoreClient","Using default OnlineComponentProvider"),await Ph(n,new ev))),n._onlineComponents}function sv(n){return fa(n).then(e=>e.syncEngine)}function iv(n){return fa(n).then(e=>e.datastore)}async function Sh(n){const e=await fa(n),t=e.eventManager;return t.onListen=jy.bind(null,e.syncEngine),t.onUnlisten=zy.bind(null,e.syncEngine),t.onFirstRemoteStoreListen=qy.bind(null,e.syncEngine),t.onLastRemoteStoreUnlisten=Hy.bind(null,e.syncEngine),t}function ov(n,e,t={}){const r=new Oe;return n.asyncQueue.enqueueAndForget(async()=>function(i,o,a,c,u){const l=new Rh({next:d=>{o.enqueueAndForget(()=>hh(i,h));const f=d.docs.has(a);!f&&d.fromCache?u.reject(new g(p.UNAVAILABLE,"Failed to get document because the client is offline.")):f&&d.fromCache&&c&&c.source==="server"?u.reject(new g(p.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.)')):u.resolve(d)},error:d=>u.reject(d)}),h=new fh(Fo(a.path),l,{includeMetadataChanges:!0,ta:!0});return lh(i,h)}(await Sh(n),n.asyncQueue,e,t,r)),r.promise}function av(n,e,t={}){const r=new Oe;return n.asyncQueue.enqueueAndForget(async()=>function(i,o,a,c,u){const l=new Rh({next:d=>{o.enqueueAndForget(()=>hh(i,h)),d.fromCache&&c.source==="server"?u.reject(new g(p.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.)')):u.resolve(d)},error:d=>u.reject(d)}),h=new fh(a,l,{includeMetadataChanges:!0,ta:!0});return lh(i,h)}(await Sh(n),n.asyncQueue,e,t,r)),r.promise}/**
1667
1667
  * @license
1668
1668
  * Copyright 2023 Google LLC
1669
1669
  *
@@ -1678,7 +1678,7 @@ This typically indicates that your device does not have a healthy Internet conne
1678
1678
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1679
1679
  * See the License for the specific language governing permissions and
1680
1680
  * limitations under the License.
1681
- */function _h(t){const e={};return t.timeoutSeconds!==void 0&&(e.timeoutSeconds=t.timeoutSeconds),e}/**
1681
+ */function bh(n){const e={};return n.timeoutSeconds!==void 0&&(e.timeoutSeconds=n.timeoutSeconds),e}/**
1682
1682
  * @license
1683
1683
  * Copyright 2020 Google LLC
1684
1684
  *
@@ -1693,7 +1693,7 @@ This typically indicates that your device does not have a healthy Internet conne
1693
1693
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1694
1694
  * See the License for the specific language governing permissions and
1695
1695
  * limitations under the License.
1696
- */const yh=new Map;/**
1696
+ */const Ch=new Map;/**
1697
1697
  * @license
1698
1698
  * Copyright 2017 Google LLC
1699
1699
  *
@@ -1708,7 +1708,7 @@ This typically indicates that your device does not have a healthy Internet conne
1708
1708
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1709
1709
  * See the License for the specific language governing permissions and
1710
1710
  * limitations under the License.
1711
- */function vh(t,e,n){if(!n)throw new g(p.INVALID_ARGUMENT,`Function ${t}() cannot be called with an empty ${e}.`)}function Wy(t,e,n,r){if(e===!0&&r===!0)throw new g(p.INVALID_ARGUMENT,`${t} and ${n} cannot be used together.`)}function Eh(t){if(!w.isDocumentKey(t))throw new g(p.INVALID_ARGUMENT,`Invalid document reference. Document references must have an even number of segments, but ${t} has ${t.length}.`)}function Th(t){if(w.isDocumentKey(t))throw new g(p.INVALID_ARGUMENT,`Invalid collection reference. Collection references must have an odd number of segments, but ${t} has ${t.length}.`)}function $s(t){if(t===void 0)return"undefined";if(t===null)return"null";if(typeof t=="string")return t.length>20&&(t=`${t.substring(0,20)}...`),JSON.stringify(t);if(typeof t=="number"||typeof t=="boolean")return""+t;if(typeof t=="object"){if(t instanceof Array)return"an array";{const e=function(r){return r.constructor?r.constructor.name:null}(t);return e?`a custom ${e} object`:"an object"}}return typeof t=="function"?"a function":A()}function vt(t,e){if("_delegate"in t&&(t=t._delegate),!(t instanceof e)){if(e.name===t.constructor.name)throw new g(p.INVALID_ARGUMENT,"Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");{const n=$s(t);throw new g(p.INVALID_ARGUMENT,`Expected type '${e.name}', but it was: ${n}`)}}return t}function Gy(t,e){if(e<=0)throw new g(p.INVALID_ARGUMENT,`Function ${t}() requires a positive number, but it was: ${e}.`)}/**
1711
+ */function kh(n,e,t){if(!t)throw new g(p.INVALID_ARGUMENT,`Function ${n}() cannot be called with an empty ${e}.`)}function cv(n,e,t,r){if(e===!0&&r===!0)throw new g(p.INVALID_ARGUMENT,`${n} and ${t} cannot be used together.`)}function Dh(n){if(!w.isDocumentKey(n))throw new g(p.INVALID_ARGUMENT,`Invalid document reference. Document references must have an even number of segments, but ${n} has ${n.length}.`)}function Nh(n){if(w.isDocumentKey(n))throw new g(p.INVALID_ARGUMENT,`Invalid collection reference. Collection references must have an odd number of segments, but ${n} has ${n.length}.`)}function Gs(n){if(n===void 0)return"undefined";if(n===null)return"null";if(typeof n=="string")return n.length>20&&(n=`${n.substring(0,20)}...`),JSON.stringify(n);if(typeof n=="number"||typeof n=="boolean")return""+n;if(typeof n=="object"){if(n instanceof Array)return"an array";{const e=function(r){return r.constructor?r.constructor.name:null}(n);return e?`a custom ${e} object`:"an object"}}return typeof n=="function"?"a function":A()}function It(n,e){if("_delegate"in n&&(n=n._delegate),!(n instanceof e)){if(e.name===n.constructor.name)throw new g(p.INVALID_ARGUMENT,"Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");{const t=Gs(n);throw new g(p.INVALID_ARGUMENT,`Expected type '${e.name}', but it was: ${t}`)}}return n}function uv(n,e){if(e<=0)throw new g(p.INVALID_ARGUMENT,`Function ${n}() requires a positive number, but it was: ${e}.`)}/**
1712
1712
  * @license
1713
1713
  * Copyright 2020 Google LLC
1714
1714
  *
@@ -1723,7 +1723,7 @@ This typically indicates that your device does not have a healthy Internet conne
1723
1723
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1724
1724
  * See the License for the specific language governing permissions and
1725
1725
  * limitations under the License.
1726
- */class wh{constructor(e){var n,r;if(e.host===void 0){if(e.ssl!==void 0)throw new g(p.INVALID_ARGUMENT,"Can't provide ssl option if host option is not set");this.host="firestore.googleapis.com",this.ssl=!0}else this.host=e.host,this.ssl=(n=e.ssl)===null||n===void 0||n;if(this.credentials=e.credentials,this.ignoreUndefinedProperties=!!e.ignoreUndefinedProperties,this.localCache=e.localCache,e.cacheSizeBytes===void 0)this.cacheSizeBytes=41943040;else{if(e.cacheSizeBytes!==-1&&e.cacheSizeBytes<1048576)throw new g(p.INVALID_ARGUMENT,"cacheSizeBytes must be at least 1048576");this.cacheSizeBytes=e.cacheSizeBytes}Wy("experimentalForceLongPolling",e.experimentalForceLongPolling,"experimentalAutoDetectLongPolling",e.experimentalAutoDetectLongPolling),this.experimentalForceLongPolling=!!e.experimentalForceLongPolling,this.experimentalForceLongPolling?this.experimentalAutoDetectLongPolling=!1:e.experimentalAutoDetectLongPolling===void 0?this.experimentalAutoDetectLongPolling=!0:this.experimentalAutoDetectLongPolling=!!e.experimentalAutoDetectLongPolling,this.experimentalLongPollingOptions=_h((r=e.experimentalLongPollingOptions)!==null&&r!==void 0?r:{}),function(i){if(i.timeoutSeconds!==void 0){if(isNaN(i.timeoutSeconds))throw new g(p.INVALID_ARGUMENT,`invalid long polling timeout: ${i.timeoutSeconds} (must not be NaN)`);if(i.timeoutSeconds<5)throw new g(p.INVALID_ARGUMENT,`invalid long polling timeout: ${i.timeoutSeconds} (minimum allowed value is 5)`);if(i.timeoutSeconds>30)throw new g(p.INVALID_ARGUMENT,`invalid long polling timeout: ${i.timeoutSeconds} (maximum allowed value is 30)`)}}(this.experimentalLongPollingOptions),this.useFetchStreams=!!e.useFetchStreams}isEqual(e){return this.host===e.host&&this.ssl===e.ssl&&this.credentials===e.credentials&&this.cacheSizeBytes===e.cacheSizeBytes&&this.experimentalForceLongPolling===e.experimentalForceLongPolling&&this.experimentalAutoDetectLongPolling===e.experimentalAutoDetectLongPolling&&function(r,s){return r.timeoutSeconds===s.timeoutSeconds}(this.experimentalLongPollingOptions,e.experimentalLongPollingOptions)&&this.ignoreUndefinedProperties===e.ignoreUndefinedProperties&&this.useFetchStreams===e.useFetchStreams}}class qs{constructor(e,n,r,s){this._authCredentials=e,this._appCheckCredentials=n,this._databaseId=r,this._app=s,this.type="firestore-lite",this._persistenceKey="(lite)",this._settings=new wh({}),this._settingsFrozen=!1}get app(){if(!this._app)throw new g(p.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 this._terminateTask!==void 0}_setSettings(e){if(this._settingsFrozen)throw new g(p.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 wh(e),e.credentials!==void 0&&(this._authCredentials=function(r){if(!r)return new lg;switch(r.type){case"firstParty":return new pg(r.sessionIndex||"0",r.iamToken||null,r.authTokenFactory||null);case"provider":return r.client;default:throw new g(p.INVALID_ARGUMENT,"makeAuthCredentialsProvider failed due to invalid credential type")}}(e.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(n){const r=yh.get(n);r&&(v("ComponentProvider","Removing Datastore"),yh.delete(n),r.terminate())}(this),Promise.resolve()}}function Ih(t,e,n,r={}){var s;const i=(t=vt(t,qs))._getSettings(),o=`${e}:${n}`;if(i.host!=="firestore.googleapis.com"&&i.host!==o&&sn("Host has been set in both settings() and connectFirestoreEmulator(), emulator host will be used."),t._setSettings(Object.assign(Object.assign({},i),{host:o,ssl:!1})),r.mockUserToken){let a,c;if(typeof r.mockUserToken=="string")a=r.mockUserToken,c=ue.MOCK_USER;else{a=ic(r.mockUserToken,(s=t._app)===null||s===void 0?void 0:s.options.projectId);const u=r.mockUserToken.sub||r.mockUserToken.user_id;if(!u)throw new g(p.INVALID_ARGUMENT,"mockUserToken must contain 'sub' or 'user_id' field!");c=new ue(u)}t._authCredentials=new hg(new Uu(a,c))}}/**
1726
+ */class Oh{constructor(e){var t,r;if(e.host===void 0){if(e.ssl!==void 0)throw new g(p.INVALID_ARGUMENT,"Can't provide ssl option if host option is not set");this.host="firestore.googleapis.com",this.ssl=!0}else this.host=e.host,this.ssl=(t=e.ssl)===null||t===void 0||t;if(this.credentials=e.credentials,this.ignoreUndefinedProperties=!!e.ignoreUndefinedProperties,this.localCache=e.localCache,e.cacheSizeBytes===void 0)this.cacheSizeBytes=41943040;else{if(e.cacheSizeBytes!==-1&&e.cacheSizeBytes<1048576)throw new g(p.INVALID_ARGUMENT,"cacheSizeBytes must be at least 1048576");this.cacheSizeBytes=e.cacheSizeBytes}cv("experimentalForceLongPolling",e.experimentalForceLongPolling,"experimentalAutoDetectLongPolling",e.experimentalAutoDetectLongPolling),this.experimentalForceLongPolling=!!e.experimentalForceLongPolling,this.experimentalForceLongPolling?this.experimentalAutoDetectLongPolling=!1:e.experimentalAutoDetectLongPolling===void 0?this.experimentalAutoDetectLongPolling=!0:this.experimentalAutoDetectLongPolling=!!e.experimentalAutoDetectLongPolling,this.experimentalLongPollingOptions=bh((r=e.experimentalLongPollingOptions)!==null&&r!==void 0?r:{}),function(i){if(i.timeoutSeconds!==void 0){if(isNaN(i.timeoutSeconds))throw new g(p.INVALID_ARGUMENT,`invalid long polling timeout: ${i.timeoutSeconds} (must not be NaN)`);if(i.timeoutSeconds<5)throw new g(p.INVALID_ARGUMENT,`invalid long polling timeout: ${i.timeoutSeconds} (minimum allowed value is 5)`);if(i.timeoutSeconds>30)throw new g(p.INVALID_ARGUMENT,`invalid long polling timeout: ${i.timeoutSeconds} (maximum allowed value is 30)`)}}(this.experimentalLongPollingOptions),this.useFetchStreams=!!e.useFetchStreams}isEqual(e){return this.host===e.host&&this.ssl===e.ssl&&this.credentials===e.credentials&&this.cacheSizeBytes===e.cacheSizeBytes&&this.experimentalForceLongPolling===e.experimentalForceLongPolling&&this.experimentalAutoDetectLongPolling===e.experimentalAutoDetectLongPolling&&function(r,s){return r.timeoutSeconds===s.timeoutSeconds}(this.experimentalLongPollingOptions,e.experimentalLongPollingOptions)&&this.ignoreUndefinedProperties===e.ignoreUndefinedProperties&&this.useFetchStreams===e.useFetchStreams}}class Ks{constructor(e,t,r,s){this._authCredentials=e,this._appCheckCredentials=t,this._databaseId=r,this._app=s,this.type="firestore-lite",this._persistenceKey="(lite)",this._settings=new Oh({}),this._settingsFrozen=!1}get app(){if(!this._app)throw new g(p.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 this._terminateTask!==void 0}_setSettings(e){if(this._settingsFrozen)throw new g(p.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 Oh(e),e.credentials!==void 0&&(this._authCredentials=function(r){if(!r)return new Rg;switch(r.type){case"firstParty":return new Cg(r.sessionIndex||"0",r.iamToken||null,r.authTokenFactory||null);case"provider":return r.client;default:throw new g(p.INVALID_ARGUMENT,"makeAuthCredentialsProvider failed due to invalid credential type")}}(e.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 r=Ch.get(t);r&&(v("ComponentProvider","Removing Datastore"),Ch.delete(t),r.terminate())}(this),Promise.resolve()}}function Vh(n,e,t,r={}){var s;const i=(n=It(n,Ks))._getSettings(),o=`${e}:${t}`;if(i.host!=="firestore.googleapis.com"&&i.host!==o&&cn("Host has been set in both settings() and connectFirestoreEmulator(), emulator host will be used."),n._setSettings(Object.assign(Object.assign({},i),{host:o,ssl:!1})),r.mockUserToken){let a,c;if(typeof r.mockUserToken=="string")a=r.mockUserToken,c=ue.MOCK_USER;else{a=fc(r.mockUserToken,(s=n._app)===null||s===void 0?void 0:s.options.projectId);const u=r.mockUserToken.sub||r.mockUserToken.user_id;if(!u)throw new g(p.INVALID_ARGUMENT,"mockUserToken must contain 'sub' or 'user_id' field!");c=new ue(u)}n._authCredentials=new Pg(new Gu(a,c))}}/**
1727
1727
  * @license
1728
1728
  * Copyright 2020 Google LLC
1729
1729
  *
@@ -1738,7 +1738,7 @@ This typically indicates that your device does not have a healthy Internet conne
1738
1738
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1739
1739
  * See the License for the specific language governing permissions and
1740
1740
  * limitations under the License.
1741
- */class et{constructor(e,n,r){this.converter=n,this._query=r,this.type="query",this.firestore=e}withConverter(e){return new et(this.firestore,e,this._query)}}class we{constructor(e,n,r){this.converter=n,this._key=r,this.type="document",this.firestore=e}get _path(){return this._key.path}get id(){return this._key.path.lastSegment()}get path(){return this._key.path.canonicalString()}get parent(){return new Et(this.firestore,this.converter,this._key.path.popLast())}withConverter(e){return new we(this.firestore,e,this._key)}}class Et extends et{constructor(e,n,r){super(e,n,Lo(r)),this._path=r,this.type="collection"}get id(){return this._query.path.lastSegment()}get path(){return this._query.path.canonicalString()}get parent(){const e=this._path.popLast();return e.isEmpty()?null:new we(this.firestore,null,new w(e))}withConverter(e){return new Et(this.firestore,e,this._path)}}function Ah(t,e,...n){if(t=x(t),vh("collection","path",e),t instanceof qs){const r=B.fromString(e,...n);return Th(r),new Et(t,null,r)}{if(!(t instanceof we||t instanceof Et))throw new g(p.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const r=t._path.child(B.fromString(e,...n));return Th(r),new Et(t.firestore,null,r)}}function ca(t,e,...n){if(t=x(t),arguments.length===1&&(e=Fu.newId()),vh("doc","path",e),t instanceof qs){const r=B.fromString(e,...n);return Eh(r),new we(t,null,new w(r))}{if(!(t instanceof we||t instanceof Et))throw new g(p.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const r=t._path.child(B.fromString(e,...n));return Eh(r),new we(t.firestore,t instanceof Et?t.converter:null,new w(r))}}/**
1741
+ */class rt{constructor(e,t,r){this.converter=t,this._query=r,this.type="query",this.firestore=e}withConverter(e){return new rt(this.firestore,e,this._query)}}class Ae{constructor(e,t,r){this.converter=t,this._key=r,this.type="document",this.firestore=e}get _path(){return this._key.path}get id(){return this._key.path.lastSegment()}get path(){return this._key.path.canonicalString()}get parent(){return new At(this.firestore,this.converter,this._key.path.popLast())}withConverter(e){return new Ae(this.firestore,e,this._key)}}class At extends rt{constructor(e,t,r){super(e,t,Fo(r)),this._path=r,this.type="collection"}get id(){return this._query.path.lastSegment()}get path(){return this._query.path.canonicalString()}get parent(){const e=this._path.popLast();return e.isEmpty()?null:new Ae(this.firestore,null,new w(e))}withConverter(e){return new At(this.firestore,e,this._path)}}function Lh(n,e,...t){if(n=x(n),kh("collection","path",e),n instanceof Ks){const r=B.fromString(e,...t);return Nh(r),new At(n,null,r)}{if(!(n instanceof Ae||n instanceof At))throw new g(p.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const r=n._path.child(B.fromString(e,...t));return Nh(r),new At(n.firestore,null,r)}}function pa(n,e,...t){if(n=x(n),arguments.length===1&&(e=Ku.newId()),kh("doc","path",e),n instanceof Ks){const r=B.fromString(e,...t);return Dh(r),new Ae(n,null,new w(r))}{if(!(n instanceof Ae||n instanceof At))throw new g(p.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const r=n._path.child(B.fromString(e,...t));return Dh(r),new Ae(n.firestore,n instanceof At?n.converter:null,new w(r))}}/**
1742
1742
  * @license
1743
1743
  * Copyright 2020 Google LLC
1744
1744
  *
@@ -1753,8 +1753,8 @@ This typically indicates that your device does not have a healthy Internet conne
1753
1753
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1754
1754
  * See the License for the specific language governing permissions and
1755
1755
  * limitations under the License.
1756
- */class Ky{constructor(){this.Xa=Promise.resolve(),this.eu=[],this.tu=!1,this.nu=[],this.ru=null,this.iu=!1,this.su=!1,this.ou=[],this.jo=new Hl(this,"async_queue_retry"),this._u=()=>{const n=Xo();n&&v("AsyncQueue","Visibility state changed to "+n.visibilityState),this.jo.Ko()};const e=Xo();e&&typeof e.addEventListener=="function"&&e.addEventListener("visibilitychange",this._u)}get isShuttingDown(){return this.tu}enqueueAndForget(e){this.enqueue(e)}enqueueAndForgetEvenWhileRestricted(e){this.au(),this.uu(e)}enterRestrictedMode(e){if(!this.tu){this.tu=!0,this.su=e||!1;const n=Xo();n&&typeof n.removeEventListener=="function"&&n.removeEventListener("visibilitychange",this._u)}}enqueue(e){if(this.au(),this.tu)return new Promise(()=>{});const n=new De;return this.uu(()=>this.tu&&this.su?Promise.resolve():(e().then(n.resolve,n.reject),n.promise)).then(()=>n.promise)}enqueueRetryable(e){this.enqueueAndForget(()=>(this.eu.push(e),this.cu()))}async cu(){if(this.eu.length!==0){try{await this.eu[0](),this.eu.shift(),this.jo.reset()}catch(e){if(!ur(e))throw e;v("AsyncQueue","Operation failed with retryable error: "+e)}this.eu.length>0&&this.jo.qo(()=>this.cu())}}uu(e){const n=this.Xa.then(()=>(this.iu=!0,e().catch(r=>{this.ru=r,this.iu=!1;const s=function(o){let a=o.message||"";return o.stack&&(a=o.stack.includes(o.message)?o.stack:o.message+`
1757
- `+o.stack),a}(r);throw Be("INTERNAL UNHANDLED ERROR: ",s),r}).then(r=>(this.iu=!1,r))));return this.Xa=n,n}enqueueAfterDelay(e,n,r){this.au(),this.ou.indexOf(e)>-1&&(n=0);const s=ta.createAndSchedule(this,e,n,r,i=>this.lu(i));return this.nu.push(s),s}au(){this.ru&&A()}verifyOperationInProgress(){}async hu(){let e;do e=this.Xa,await e;while(e!==this.Xa)}Pu(e){for(const n of this.nu)if(n.timerId===e)return!0;return!1}Iu(e){return this.hu().then(()=>{this.nu.sort((n,r)=>n.targetTimeMs-r.targetTimeMs);for(const n of this.nu)if(n.skipDelay(),e!=="all"&&n.timerId===e)break;return this.hu()})}Tu(e){this.ou.push(e)}lu(e){const n=this.nu.indexOf(e);this.nu.splice(n,1)}}class yn extends qs{constructor(e,n,r,s){super(e,n,r,s),this.type="firestore",this._queue=function(){return new Ky}(),this._persistenceKey=(s==null?void 0:s.name)||"[DEFAULT]"}_terminate(){return this._firestoreClient||Rh(this),this._firestoreClient.terminate()}}function Qy(t,e){const n=typeof t=="object"?t:zr(),r=typeof t=="string"?t:e||"(default)",s=Mn(n,"firestore").getImmediate({identifier:r});if(!s._initialized){const i=Ti("firestore");i&&Ih(s,...i)}return s}function Rr(t){return t._firestoreClient||Rh(t),t._firestoreClient.verifyNotTerminated(),t._firestoreClient}function Rh(t){var e,n,r;const s=t._freezeSettings(),i=function(a,c,u,l){return new bg(a,c,u,l.host,l.ssl,l.experimentalForceLongPolling,l.experimentalAutoDetectLongPolling,_h(l.experimentalLongPollingOptions),l.useFetchStreams)}(t._databaseId,((e=t._app)===null||e===void 0?void 0:e.options.appId)||"",t._persistenceKey,s);t._firestoreClient=new Fy(t._authCredentials,t._appCheckCredentials,t._queue,i),!((n=s.localCache)===null||n===void 0)&&n._offlineComponentProvider&&(!((r=s.localCache)===null||r===void 0)&&r._onlineComponentProvider)&&(t._firestoreClient._uninitializedComponentsProvider={_offlineKind:s.localCache.kind,_offline:s.localCache._offlineComponentProvider,_online:s.localCache._onlineComponentProvider})}/**
1756
+ */class lv{constructor(){this.nu=Promise.resolve(),this.ru=[],this.iu=!1,this.su=[],this.ou=null,this._u=!1,this.au=!1,this.uu=[],this.jo=new eh(this,"async_queue_retry"),this.cu=()=>{const t=ta();t&&v("AsyncQueue","Visibility state changed to "+t.visibilityState),this.jo.Ko()};const e=ta();e&&typeof e.addEventListener=="function"&&e.addEventListener("visibilitychange",this.cu)}get isShuttingDown(){return this.iu}enqueueAndForget(e){this.enqueue(e)}enqueueAndForgetEvenWhileRestricted(e){this.lu(),this.hu(e)}enterRestrictedMode(e){if(!this.iu){this.iu=!0,this.au=e||!1;const t=ta();t&&typeof t.removeEventListener=="function"&&t.removeEventListener("visibilitychange",this.cu)}}enqueue(e){if(this.lu(),this.iu)return new Promise(()=>{});const t=new Oe;return this.hu(()=>this.iu&&this.au?Promise.resolve():(e().then(t.resolve,t.reject),t.promise)).then(()=>t.promise)}enqueueRetryable(e){this.enqueueAndForget(()=>(this.ru.push(e),this.Pu()))}async Pu(){if(this.ru.length!==0){try{await this.ru[0](),this.ru.shift(),this.jo.reset()}catch(e){if(!mr(e))throw e;v("AsyncQueue","Operation failed with retryable error: "+e)}this.ru.length>0&&this.jo.qo(()=>this.Pu())}}hu(e){const t=this.nu.then(()=>(this._u=!0,e().catch(r=>{this.ou=r,this._u=!1;const s=function(o){let a=o.message||"";return o.stack&&(a=o.stack.includes(o.message)?o.stack:o.message+`
1757
+ `+o.stack),a}(r);throw $e("INTERNAL UNHANDLED ERROR: ",s),r}).then(r=>(this._u=!1,r))));return this.nu=t,t}enqueueAfterDelay(e,t,r){this.lu(),this.uu.indexOf(e)>-1&&(t=0);const s=oa.createAndSchedule(this,e,t,r,i=>this.Iu(i));return this.su.push(s),s}lu(){this.ou&&A()}verifyOperationInProgress(){}async Tu(){let e;do e=this.nu,await e;while(e!==this.nu)}Eu(e){for(const t of this.su)if(t.timerId===e)return!0;return!1}du(e){return this.Tu().then(()=>{this.su.sort((t,r)=>t.targetTimeMs-r.targetTimeMs);for(const t of this.su)if(t.skipDelay(),e!=="all"&&t.timerId===e)break;return this.Tu()})}Au(e){this.uu.push(e)}Iu(e){const t=this.su.indexOf(e);this.su.splice(t,1)}}class Tn extends Ks{constructor(e,t,r,s){super(e,t,r,s),this.type="firestore",this._queue=function(){return new lv}(),this._persistenceKey=(s==null?void 0:s.name)||"[DEFAULT]"}_terminate(){return this._firestoreClient||Mh(this),this._firestoreClient.terminate()}}function hv(n,e){const t=typeof n=="object"?n:Qr(),r=typeof n=="string"?n:e||"(default)",s=qn(t,"firestore").getImmediate({identifier:r});if(!s._initialized){const i=Ri("firestore");i&&Vh(s,...i)}return s}function Dr(n){return n._firestoreClient||Mh(n),n._firestoreClient.verifyNotTerminated(),n._firestoreClient}function Mh(n){var e,t,r;const s=n._freezeSettings(),i=function(a,c,u,l){return new $g(a,c,u,l.host,l.ssl,l.experimentalForceLongPolling,l.experimentalAutoDetectLongPolling,bh(l.experimentalLongPollingOptions),l.useFetchStreams)}(n._databaseId,((e=n._app)===null||e===void 0?void 0:e.options.appId)||"",n._persistenceKey,s);n._firestoreClient=new tv(n._authCredentials,n._appCheckCredentials,n._queue,i),!((t=s.localCache)===null||t===void 0)&&t._offlineComponentProvider&&(!((r=s.localCache)===null||r===void 0)&&r._onlineComponentProvider)&&(n._firestoreClient._uninitializedComponentsProvider={_offlineKind:s.localCache.kind,_offline:s.localCache._offlineComponentProvider,_online:s.localCache._onlineComponentProvider})}/**
1758
1758
  * @license
1759
1759
  * Copyright 2020 Google LLC
1760
1760
  *
@@ -1784,7 +1784,7 @@ This typically indicates that your device does not have a healthy Internet conne
1784
1784
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1785
1785
  * See the License for the specific language governing permissions and
1786
1786
  * limitations under the License.
1787
- */class Yy{constructor(e="count",n){this._internalFieldPath=n,this.type="AggregateField",this.aggregateType=e}}class Xy{constructor(e,n,r){this._userDataWriter=n,this._data=r,this.type="AggregateQuerySnapshot",this.query=e}data(){return this._userDataWriter.convertObjectMap(this._data)}}/**
1787
+ */class dv{constructor(e="count",t){this._internalFieldPath=t,this.type="AggregateField",this.aggregateType=e}}class fv{constructor(e,t,r){this._userDataWriter=t,this._data=r,this.type="AggregateQuerySnapshot",this.query=e}data(){return this._userDataWriter.convertObjectMap(this._data)}}/**
1788
1788
  * @license
1789
1789
  * Copyright 2020 Google LLC
1790
1790
  *
@@ -1799,7 +1799,7 @@ This typically indicates that your device does not have a healthy Internet conne
1799
1799
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1800
1800
  * See the License for the specific language governing permissions and
1801
1801
  * limitations under the License.
1802
- */class vn{constructor(e){this._byteString=e}static fromBase64String(e){try{return new vn(le.fromBase64String(e))}catch(n){throw new g(p.INVALID_ARGUMENT,"Failed to construct data from Base64 string: "+n)}}static fromUint8Array(e){return new vn(le.fromUint8Array(e))}toBase64(){return this._byteString.toBase64()}toUint8Array(){return this._byteString.toUint8Array()}toString(){return"Bytes(base64: "+this.toBase64()+")"}isEqual(e){return this._byteString.isEqual(e._byteString)}}/**
1802
+ */class wn{constructor(e){this._byteString=e}static fromBase64String(e){try{return new wn(le.fromBase64String(e))}catch(t){throw new g(p.INVALID_ARGUMENT,"Failed to construct data from Base64 string: "+t)}}static fromUint8Array(e){return new wn(le.fromUint8Array(e))}toBase64(){return this._byteString.toBase64()}toUint8Array(){return this._byteString.toUint8Array()}toString(){return"Bytes(base64: "+this.toBase64()+")"}isEqual(e){return this._byteString.isEqual(e._byteString)}}/**
1803
1803
  * @license
1804
1804
  * Copyright 2020 Google LLC
1805
1805
  *
@@ -1814,7 +1814,7 @@ This typically indicates that your device does not have a healthy Internet conne
1814
1814
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1815
1815
  * See the License for the specific language governing permissions and
1816
1816
  * limitations under the License.
1817
- */class zs{constructor(...e){for(let n=0;n<e.length;++n)if(e[n].length===0)throw new g(p.INVALID_ARGUMENT,"Invalid field name at argument $(i + 1). Field names must not be empty.");this._internalPath=new ne(e)}isEqual(e){return this._internalPath.isEqual(e._internalPath)}}/**
1817
+ */class Qs{constructor(...e){for(let t=0;t<e.length;++t)if(e[t].length===0)throw new g(p.INVALID_ARGUMENT,"Invalid field name at argument $(i + 1). Field names must not be empty.");this._internalPath=new ne(e)}isEqual(e){return this._internalPath.isEqual(e._internalPath)}}/**
1818
1818
  * @license
1819
1819
  * Copyright 2020 Google LLC
1820
1820
  *
@@ -1829,7 +1829,7 @@ This typically indicates that your device does not have a healthy Internet conne
1829
1829
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1830
1830
  * See the License for the specific language governing permissions and
1831
1831
  * limitations under the License.
1832
- */class ua{constructor(e){this._methodName=e}}/**
1832
+ */class ma{constructor(e){this._methodName=e}}/**
1833
1833
  * @license
1834
1834
  * Copyright 2017 Google LLC
1835
1835
  *
@@ -1844,7 +1844,7 @@ This typically indicates that your device does not have a healthy Internet conne
1844
1844
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1845
1845
  * See the License for the specific language governing permissions and
1846
1846
  * limitations under the License.
1847
- */class la{constructor(e,n){if(!isFinite(e)||e<-90||e>90)throw new g(p.INVALID_ARGUMENT,"Latitude must be a number between -90 and 90, but was: "+e);if(!isFinite(n)||n<-180||n>180)throw new g(p.INVALID_ARGUMENT,"Longitude must be a number between -180 and 180, but was: "+n);this._lat=e,this._long=n}get latitude(){return this._lat}get longitude(){return this._long}isEqual(e){return this._lat===e._lat&&this._long===e._long}toJSON(){return{latitude:this._lat,longitude:this._long}}_compareTo(e){return M(this._lat,e._lat)||M(this._long,e._long)}}/**
1847
+ */class ga{constructor(e,t){if(!isFinite(e)||e<-90||e>90)throw new g(p.INVALID_ARGUMENT,"Latitude must be a number between -90 and 90, but was: "+e);if(!isFinite(t)||t<-180||t>180)throw new g(p.INVALID_ARGUMENT,"Longitude must be a number between -180 and 180, but was: "+t);this._lat=e,this._long=t}get latitude(){return this._lat}get longitude(){return this._long}isEqual(e){return this._lat===e._lat&&this._long===e._long}toJSON(){return{latitude:this._lat,longitude:this._long}}_compareTo(e){return M(this._lat,e._lat)||M(this._long,e._long)}}/**
1848
1848
  * @license
1849
1849
  * Copyright 2017 Google LLC
1850
1850
  *
@@ -1859,7 +1859,7 @@ This typically indicates that your device does not have a healthy Internet conne
1859
1859
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1860
1860
  * See the License for the specific language governing permissions and
1861
1861
  * limitations under the License.
1862
- */const Jy=/^__.*__$/;class Zy{constructor(e,n,r){this.data=e,this.fieldMask=n,this.fieldTransforms=r}toMutation(e,n){return this.fieldMask!==null?new mt(e,this.data,this.fieldMask,n,this.fieldTransforms):new Er(e,this.data,n,this.fieldTransforms)}}class Ph{constructor(e,n,r){this.data=e,this.fieldMask=n,this.fieldTransforms=r}toMutation(e,n){return new mt(e,this.data,this.fieldMask,n,this.fieldTransforms)}}function Sh(t){switch(t){case 0:case 2:case 1:return!0;case 3:case 4:return!1;default:throw A()}}class ha{constructor(e,n,r,s,i,o){this.settings=e,this.databaseId=n,this.serializer=r,this.ignoreUndefinedProperties=s,i===void 0&&this.Eu(),this.fieldTransforms=i||[],this.fieldMask=o||[]}get path(){return this.settings.path}get du(){return this.settings.du}Au(e){return new ha(Object.assign(Object.assign({},this.settings),e),this.databaseId,this.serializer,this.ignoreUndefinedProperties,this.fieldTransforms,this.fieldMask)}Ru(e){var n;const r=(n=this.path)===null||n===void 0?void 0:n.child(e),s=this.Au({path:r,Vu:!1});return s.mu(e),s}fu(e){var n;const r=(n=this.path)===null||n===void 0?void 0:n.child(e),s=this.Au({path:r,Vu:!1});return s.Eu(),s}gu(e){return this.Au({path:void 0,Vu:!0})}pu(e){return Ws(e,this.settings.methodName,this.settings.yu||!1,this.path,this.settings.wu)}contains(e){return this.fieldMask.find(n=>e.isPrefixOf(n))!==void 0||this.fieldTransforms.find(n=>e.isPrefixOf(n.field))!==void 0}Eu(){if(this.path)for(let e=0;e<this.path.length;e++)this.mu(this.path.get(e))}mu(e){if(e.length===0)throw this.pu("Document fields must not be empty");if(Sh(this.du)&&Jy.test(e))throw this.pu('Document fields cannot begin and end with "__"')}}class ev{constructor(e,n,r){this.databaseId=e,this.ignoreUndefinedProperties=n,this.serializer=r||Us(e)}Su(e,n,r,s=!1){return new ha({du:e,methodName:n,wu:r,path:ne.emptyPath(),Vu:!1,yu:s},this.databaseId,this.serializer,this.ignoreUndefinedProperties)}}function da(t){const e=t._freezeSettings(),n=Us(t._databaseId);return new ev(t._databaseId,!!e.ignoreUndefinedProperties,n)}function tv(t,e,n,r,s,i={}){const o=t.Su(i.merge||i.mergeFields?2:0,e,n,s);fa("Data must be an object, but it was:",o,r);const a=Ch(r,o);let c,u;if(i.merge)c=new Te(o.fieldMask),u=o.fieldTransforms;else if(i.mergeFields){const l=[];for(const h of i.mergeFields){const d=pa(e,h,n);if(!o.contains(d))throw new g(p.INVALID_ARGUMENT,`Field '${d}' is specified in your field mask but missing from your input data.`);Dh(l,d)||l.push(d)}c=new Te(l),u=o.fieldTransforms.filter(h=>c.covers(h.field))}else c=null,u=o.fieldTransforms;return new Zy(new me(a),c,u)}class Hs extends ua{_toFieldTransform(e){if(e.du!==2)throw e.du===1?e.pu(`${this._methodName}() can only appear at the top level of your update data`):e.pu(`${this._methodName}() cannot be used with set() unless you pass {merge:true}`);return e.fieldMask.push(e.path),null}isEqual(e){return e instanceof Hs}}function nv(t,e,n,r){const s=t.Su(1,e,n);fa("Data must be an object, but it was:",s,r);const i=[],o=me.empty();Mt(r,(c,u)=>{const l=ma(e,c,n);u=x(u);const h=s.fu(l);if(u instanceof Hs)i.push(l);else{const d=Pr(u,h);d!=null&&(i.push(l),o.set(l,d))}});const a=new Te(i);return new Ph(o,a,s.fieldTransforms)}function rv(t,e,n,r,s,i){const o=t.Su(1,e,n),a=[pa(e,r,n)],c=[s];if(i.length%2!=0)throw new g(p.INVALID_ARGUMENT,`Function ${e}() needs to be called with an even number of arguments that alternate between field names and values.`);for(let d=0;d<i.length;d+=2)a.push(pa(e,i[d])),c.push(i[d+1]);const u=[],l=me.empty();for(let d=a.length-1;d>=0;--d)if(!Dh(u,a[d])){const f=a[d];let E=c[d];E=x(E);const T=o.fu(f);if(E instanceof Hs)u.push(f);else{const _=Pr(E,T);_!=null&&(u.push(f),l.set(f,_))}}const h=new Te(u);return new Ph(l,h,o.fieldTransforms)}function bh(t,e,n,r=!1){return Pr(n,t.Su(r?4:3,e))}function Pr(t,e){if(kh(t=x(t)))return fa("Unsupported field value:",e,t),Ch(t,e);if(t instanceof ua)return function(r,s){if(!Sh(s.du))throw s.pu(`${r._methodName}() can only be used with update() and set()`);if(!s.path)throw s.pu(`${r._methodName}() is not currently supported inside arrays`);const i=r._toFieldTransform(s);i&&s.fieldTransforms.push(i)}(t,e),null;if(t===void 0&&e.ignoreUndefinedProperties)return null;if(e.path&&e.fieldMask.push(e.path),t instanceof Array){if(e.settings.Vu&&e.du!==4)throw e.pu("Nested arrays are not supported");return function(r,s){const i=[];let o=0;for(const a of r){let c=Pr(a,s.gu(o));c==null&&(c={nullValue:"NULL_VALUE"}),i.push(c),o++}return{arrayValue:{values:i}}}(t,e)}return function(r,s){if((r=x(r))===null)return{nullValue:"NULL_VALUE"};if(typeof r=="number")return Kg(s.serializer,r);if(typeof r=="boolean")return{booleanValue:r};if(typeof r=="string")return{stringValue:r};if(r instanceof Date){const i=Y.fromDate(r);return{timestampValue:Ms(s.serializer,i)}}if(r instanceof Y){const i=new Y(r.seconds,1e3*Math.floor(r.nanoseconds/1e3));return{timestampValue:Ms(s.serializer,i)}}if(r instanceof la)return{geoPointValue:{latitude:r.latitude,longitude:r.longitude}};if(r instanceof vn)return{bytesValue:Dl(s.serializer,r._byteString)};if(r instanceof we){const i=s.databaseId,o=r.firestore._databaseId;if(!o.isEqual(i))throw s.pu(`Document reference is for database ${o.projectId}/${o.database} but should be for database ${i.projectId}/${i.database}`);return{referenceValue:jo(r.firestore._databaseId||s.databaseId,r._key.path)}}throw s.pu(`Unsupported field value: ${$s(r)}`)}(t,e)}function Ch(t,e){const n={};return $u(t)?e.path&&e.path.length>0&&e.fieldMask.push(e.path):Mt(t,(r,s)=>{const i=Pr(s,e.Ru(r));i!=null&&(n[r]=i)}),{mapValue:{fields:n}}}function kh(t){return!(typeof t!="object"||t===null||t instanceof Array||t instanceof Date||t instanceof Y||t instanceof la||t instanceof vn||t instanceof we||t instanceof ua)}function fa(t,e,n){if(!kh(n)||!function(s){return typeof s=="object"&&s!==null&&(Object.getPrototypeOf(s)===Object.prototype||Object.getPrototypeOf(s)===null)}(n)){const r=$s(n);throw r==="an object"?e.pu(t+" a custom object"):e.pu(t+" "+r)}}function pa(t,e,n){if((e=x(e))instanceof zs)return e._internalPath;if(typeof e=="string")return ma(t,e);throw Ws("Field path arguments must be of type string or ",t,!1,void 0,n)}const sv=new RegExp("[~\\*/\\[\\]]");function ma(t,e,n){if(e.search(sv)>=0)throw Ws(`Invalid field path (${e}). Paths must not contain '~', '*', '/', '[', or ']'`,t,!1,void 0,n);try{return new zs(...e.split("."))._internalPath}catch{throw Ws(`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`,t,!1,void 0,n)}}function Ws(t,e,n,r,s){const i=r&&!r.isEmpty(),o=s!==void 0;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 g(p.INVALID_ARGUMENT,a+t+c)}function Dh(t,e){return t.some(n=>n.isEqual(e))}/**
1862
+ */const pv=/^__.*__$/;class mv{constructor(e,t,r){this.data=e,this.fieldMask=t,this.fieldTransforms=r}toMutation(e,t){return this.fieldMask!==null?new vt(e,this.data,this.fieldMask,t,this.fieldTransforms):new Pr(e,this.data,t,this.fieldTransforms)}}class xh{constructor(e,t,r){this.data=e,this.fieldMask=t,this.fieldTransforms=r}toMutation(e,t){return new vt(e,this.data,this.fieldMask,t,this.fieldTransforms)}}function Uh(n){switch(n){case 0:case 2:case 1:return!0;case 3:case 4:return!1;default:throw A()}}class _a{constructor(e,t,r,s,i,o){this.settings=e,this.databaseId=t,this.serializer=r,this.ignoreUndefinedProperties=s,i===void 0&&this.Ru(),this.fieldTransforms=i||[],this.fieldMask=o||[]}get path(){return this.settings.path}get Vu(){return this.settings.Vu}mu(e){return new _a(Object.assign(Object.assign({},this.settings),e),this.databaseId,this.serializer,this.ignoreUndefinedProperties,this.fieldTransforms,this.fieldMask)}fu(e){var t;const r=(t=this.path)===null||t===void 0?void 0:t.child(e),s=this.mu({path:r,gu:!1});return s.pu(e),s}yu(e){var t;const r=(t=this.path)===null||t===void 0?void 0:t.child(e),s=this.mu({path:r,gu:!1});return s.Ru(),s}wu(e){return this.mu({path:void 0,gu:!0})}Su(e){return Xs(e,this.settings.methodName,this.settings.bu||!1,this.path,this.settings.Du)}contains(e){return this.fieldMask.find(t=>e.isPrefixOf(t))!==void 0||this.fieldTransforms.find(t=>e.isPrefixOf(t.field))!==void 0}Ru(){if(this.path)for(let e=0;e<this.path.length;e++)this.pu(this.path.get(e))}pu(e){if(e.length===0)throw this.Su("Document fields must not be empty");if(Uh(this.Vu)&&pv.test(e))throw this.Su('Document fields cannot begin and end with "__"')}}class gv{constructor(e,t,r){this.databaseId=e,this.ignoreUndefinedProperties=t,this.serializer=r||$s(e)}Cu(e,t,r,s=!1){return new _a({Vu:e,methodName:t,Du:r,path:ne.emptyPath(),gu:!1,bu:s},this.databaseId,this.serializer,this.ignoreUndefinedProperties)}}function ya(n){const e=n._freezeSettings(),t=$s(n._databaseId);return new gv(n._databaseId,!!e.ignoreUndefinedProperties,t)}function _v(n,e,t,r,s,i={}){const o=n.Cu(i.merge||i.mergeFields?2:0,e,t,s);va("Data must be an object, but it was:",o,r);const a=Bh(r,o);let c,u;if(i.merge)c=new Ie(o.fieldMask),u=o.fieldTransforms;else if(i.mergeFields){const l=[];for(const h of i.mergeFields){const d=Ea(e,h,t);if(!o.contains(d))throw new g(p.INVALID_ARGUMENT,`Field '${d}' is specified in your field mask but missing from your input data.`);qh(l,d)||l.push(d)}c=new Ie(l),u=o.fieldTransforms.filter(h=>c.covers(h.field))}else c=null,u=o.fieldTransforms;return new mv(new _e(a),c,u)}class Ys extends ma{_toFieldTransform(e){if(e.Vu!==2)throw e.Vu===1?e.Su(`${this._methodName}() can only appear at the top level of your update data`):e.Su(`${this._methodName}() cannot be used with set() unless you pass {merge:true}`);return e.fieldMask.push(e.path),null}isEqual(e){return e instanceof Ys}}function yv(n,e,t,r){const s=n.Cu(1,e,t);va("Data must be an object, but it was:",s,r);const i=[],o=_e.empty();Bt(r,(c,u)=>{const l=Ta(e,c,t);u=x(u);const h=s.yu(l);if(u instanceof Ys)i.push(l);else{const d=Nr(u,h);d!=null&&(i.push(l),o.set(l,d))}});const a=new Ie(i);return new xh(o,a,s.fieldTransforms)}function vv(n,e,t,r,s,i){const o=n.Cu(1,e,t),a=[Ea(e,r,t)],c=[s];if(i.length%2!=0)throw new g(p.INVALID_ARGUMENT,`Function ${e}() needs to be called with an even number of arguments that alternate between field names and values.`);for(let d=0;d<i.length;d+=2)a.push(Ea(e,i[d])),c.push(i[d+1]);const u=[],l=_e.empty();for(let d=a.length-1;d>=0;--d)if(!qh(u,a[d])){const f=a[d];let E=c[d];E=x(E);const T=o.yu(f);if(E instanceof Ys)u.push(f);else{const _=Nr(E,T);_!=null&&(u.push(f),l.set(f,_))}}const h=new Ie(u);return new xh(l,h,o.fieldTransforms)}function Fh(n,e,t,r=!1){return Nr(t,n.Cu(r?4:3,e))}function Nr(n,e){if(jh(n=x(n)))return va("Unsupported field value:",e,n),Bh(n,e);if(n instanceof ma)return function(r,s){if(!Uh(s.Vu))throw s.Su(`${r._methodName}() can only be used with update() and set()`);if(!s.path)throw s.Su(`${r._methodName}() is not currently supported inside arrays`);const i=r._toFieldTransform(s);i&&s.fieldTransforms.push(i)}(n,e),null;if(n===void 0&&e.ignoreUndefinedProperties)return null;if(e.path&&e.fieldMask.push(e.path),n instanceof Array){if(e.settings.gu&&e.Vu!==4)throw e.Su("Nested arrays are not supported");return function(r,s){const i=[];let o=0;for(const a of r){let c=Nr(a,s.wu(o));c==null&&(c={nullValue:"NULL_VALUE"}),i.push(c),o++}return{arrayValue:{values:i}}}(n,e)}return function(r,s){if((r=x(r))===null)return{nullValue:"NULL_VALUE"};if(typeof r=="number")return u_(s.serializer,r);if(typeof r=="boolean")return{booleanValue:r};if(typeof r=="string")return{stringValue:r};if(r instanceof Date){const i=Y.fromDate(r);return{timestampValue:js(s.serializer,i)}}if(r instanceof Y){const i=new Y(r.seconds,1e3*Math.floor(r.nanoseconds/1e3));return{timestampValue:js(s.serializer,i)}}if(r instanceof ga)return{geoPointValue:{latitude:r.latitude,longitude:r.longitude}};if(r instanceof wn)return{bytesValue:Bl(s.serializer,r._byteString)};if(r instanceof Ae){const i=s.databaseId,o=r.firestore._databaseId;if(!o.isEqual(i))throw s.Su(`Document reference is for database ${o.projectId}/${o.database} but should be for database ${i.projectId}/${i.database}`);return{referenceValue:Ho(r.firestore._databaseId||s.databaseId,r._key.path)}}throw s.Su(`Unsupported field value: ${Gs(r)}`)}(n,e)}function Bh(n,e){const t={};return Xu(n)?e.path&&e.path.length>0&&e.fieldMask.push(e.path):Bt(n,(r,s)=>{const i=Nr(s,e.fu(r));i!=null&&(t[r]=i)}),{mapValue:{fields:t}}}function jh(n){return!(typeof n!="object"||n===null||n instanceof Array||n instanceof Date||n instanceof Y||n instanceof ga||n instanceof wn||n instanceof Ae||n instanceof ma)}function va(n,e,t){if(!jh(t)||!function(s){return typeof s=="object"&&s!==null&&(Object.getPrototypeOf(s)===Object.prototype||Object.getPrototypeOf(s)===null)}(t)){const r=Gs(t);throw r==="an object"?e.Su(n+" a custom object"):e.Su(n+" "+r)}}function Ea(n,e,t){if((e=x(e))instanceof Qs)return e._internalPath;if(typeof e=="string")return Ta(n,e);throw Xs("Field path arguments must be of type string or ",n,!1,void 0,t)}const Ev=new RegExp("[~\\*/\\[\\]]");function Ta(n,e,t){if(e.search(Ev)>=0)throw Xs(`Invalid field path (${e}). Paths must not contain '~', '*', '/', '[', or ']'`,n,!1,void 0,t);try{return new Qs(...e.split("."))._internalPath}catch{throw Xs(`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`,n,!1,void 0,t)}}function Xs(n,e,t,r,s){const i=r&&!r.isEmpty(),o=s!==void 0;let a=`Function ${e}() called with invalid data`;t&&(a+=" (via `toFirestore()`)"),a+=". ";let c="";return(i||o)&&(c+=" (found",i&&(c+=` in field ${r}`),o&&(c+=` in document ${s}`),c+=")"),new g(p.INVALID_ARGUMENT,a+n+c)}function qh(n,e){return n.some(t=>t.isEqual(e))}/**
1863
1863
  * @license
1864
1864
  * Copyright 2020 Google LLC
1865
1865
  *
@@ -1874,7 +1874,7 @@ This typically indicates that your device does not have a healthy Internet conne
1874
1874
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1875
1875
  * See the License for the specific language governing permissions and
1876
1876
  * limitations under the License.
1877
- */class ga{constructor(e,n,r,s,i){this._firestore=e,this._userDataWriter=n,this._key=r,this._document=s,this._converter=i}get id(){return this._key.path.lastSegment()}get ref(){return new we(this._firestore,this._converter,this._key)}exists(){return this._document!==null}data(){if(this._document){if(this._converter){const e=new iv(this._firestore,this._userDataWriter,this._key,this._document,null);return this._converter.fromFirestore(e)}return this._userDataWriter.convertValue(this._document.data.value)}}get(e){if(this._document){const n=this._document.data.field(Gs("DocumentSnapshot.get",e));if(n!==null)return this._userDataWriter.convertValue(n)}}}class iv extends ga{data(){return super.data()}}function Gs(t,e){return typeof e=="string"?ma(t,e):e instanceof zs?e._internalPath:e._delegate._internalPath}/**
1877
+ */class wa{constructor(e,t,r,s,i){this._firestore=e,this._userDataWriter=t,this._key=r,this._document=s,this._converter=i}get id(){return this._key.path.lastSegment()}get ref(){return new Ae(this._firestore,this._converter,this._key)}exists(){return this._document!==null}data(){if(this._document){if(this._converter){const e=new Tv(this._firestore,this._userDataWriter,this._key,this._document,null);return this._converter.fromFirestore(e)}return this._userDataWriter.convertValue(this._document.data.value)}}get(e){if(this._document){const t=this._document.data.field(Js("DocumentSnapshot.get",e));if(t!==null)return this._userDataWriter.convertValue(t)}}}class Tv extends wa{data(){return super.data()}}function Js(n,e){return typeof e=="string"?Ta(n,e):e instanceof Qs?e._internalPath:e._delegate._internalPath}/**
1878
1878
  * @license
1879
1879
  * Copyright 2020 Google LLC
1880
1880
  *
@@ -1889,7 +1889,7 @@ This typically indicates that your device does not have a healthy Internet conne
1889
1889
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1890
1890
  * See the License for the specific language governing permissions and
1891
1891
  * limitations under the License.
1892
- */function ov(t){if(t.limitType==="L"&&t.explicitOrderBy.length===0)throw new g(p.UNIMPLEMENTED,"limitToLast() queries require specifying at least one orderBy() clause")}class _a{}class Ks extends _a{}function Nh(t,e,...n){let r=[];e instanceof _a&&r.push(e),r=r.concat(n),function(i){const o=i.filter(c=>c instanceof En).length,a=i.filter(c=>c instanceof Sr).length;if(o>1||o>0&&a>0)throw new g(p.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(...)))`.")}(r);for(const s of r)t=s._apply(t);return t}class Sr extends Ks{constructor(e,n,r){super(),this._field=e,this._op=n,this._value=r,this.type="where"}static _create(e,n,r){return new Sr(e,n,r)}_apply(e){const n=this._parse(e);return xh(e._query,n),new et(e.firestore,e.converter,xo(e._query,n))}_parse(e){const n=da(e.firestore);return function(i,o,a,c,u,l,h){let d;if(u.isKeyField()){if(l==="array-contains"||l==="array-contains-any")throw new g(p.INVALID_ARGUMENT,`Invalid Query. You can't perform '${l}' queries on documentId().`);if(l==="in"||l==="not-in"){Mh(h,l);const f=[];for(const E of h)f.push(Lh(c,i,E));d={arrayValue:{values:f}}}else d=Lh(c,i,h)}else l!=="in"&&l!=="not-in"&&l!=="array-contains-any"||Mh(h,l),d=bh(a,o,h,l==="in"||l==="not-in");return K.create(u,l,d)}(e._query,"where",n,e.firestore._databaseId,this._field,this._op,this._value)}}function Oh(t,e,n){const r=e,s=Gs("where",t);return Sr._create(s,r,n)}class En extends _a{constructor(e,n){super(),this.type=e,this._queryConstraints=n}static _create(e,n){return new En(e,n)}_parse(e){const n=this._queryConstraints.map(r=>r._parse(e)).filter(r=>r.getFilters().length>0);return n.length===1?n[0]:Ne.create(n,this._getOperator())}_apply(e){const n=this._parse(e);return n.getFilters().length===0?e:(function(s,i){let o=s;const a=i.getFlattenedFilters();for(const c of a)xh(o,c),o=xo(o,c)}(e._query,n),new et(e.firestore,e.converter,xo(e._query,n)))}_getQueryConstraints(){return this._queryConstraints}_getOperator(){return this.type==="and"?"and":"or"}}function av(...t){return t.forEach(e=>Uh("or",e)),En._create("or",t)}function cv(...t){return t.forEach(e=>Uh("and",e)),En._create("and",t)}class ya extends Ks{constructor(e,n){super(),this._field=e,this._direction=n,this.type="orderBy"}static _create(e,n){return new ya(e,n)}_apply(e){const n=function(s,i,o){if(s.startAt!==null)throw new g(p.INVALID_ARGUMENT,"Invalid query. You must not call startAt() or startAfter() before calling orderBy().");if(s.endAt!==null)throw new g(p.INVALID_ARGUMENT,"Invalid query. You must not call endAt() or endBefore() before calling orderBy().");return new pr(i,o)}(e._query,this._field,this._direction);return new et(e.firestore,e.converter,function(s,i){const o=s.explicitOrderBy.concat([i]);return new Ft(s.path,s.collectionGroup,o,s.filters.slice(),s.limit,s.limitType,s.startAt,s.endAt)}(e._query,n))}}function uv(t,e="asc"){const n=e,r=Gs("orderBy",t);return ya._create(r,n)}class va extends Ks{constructor(e,n,r){super(),this.type=e,this._limit=n,this._limitType=r}static _create(e,n,r){return new va(e,n,r)}_apply(e){return new et(e.firestore,e.converter,Rs(e._query,this._limit,this._limitType))}}function Vh(t){return Gy("limit",t),va._create("limit",t,"F")}class Ea extends Ks{constructor(e,n,r){super(),this.type=e,this._docOrFields=n,this._inclusive=r}static _create(e,n,r){return new Ea(e,n,r)}_apply(e){const n=hv(e,this.type,this._docOrFields,this._inclusive);return new et(e.firestore,e.converter,function(s,i){return new Ft(s.path,s.collectionGroup,s.explicitOrderBy.slice(),s.filters.slice(),s.limit,s.limitType,i,s.endAt)}(e._query,n))}}function lv(...t){return Ea._create("startAfter",t,!1)}function hv(t,e,n,r){if(n[0]=x(n[0]),n[0]instanceof ga)return function(i,o,a,c,u){if(!c)throw new g(p.NOT_FOUND,`Can't use a DocumentSnapshot that doesn't exist for ${a}().`);const l=[];for(const h of ln(i))if(h.field.isKeyField())l.push(Is(o,c.key));else{const d=c.data.field(h.field);if(Ts(d))throw new g(p.INVALID_ARGUMENT,'Invalid query. You are trying to start or end a query using a document for which the field "'+h.field+'" is an uncommitted server timestamp. (Since the value of this field is unknown, you cannot start/end a query with it.)');if(d===null){const f=h.field.canonicalString();throw new g(p.INVALID_ARGUMENT,`Invalid query. You are trying to start or end a query using a document for which the field '${f}' (used as the orderBy) does not exist.`)}l.push(d)}return new un(l,u)}(t._query,t.firestore._databaseId,e,n[0]._document,r);{const s=da(t.firestore);return function(o,a,c,u,l,h){const d=o.explicitOrderBy;if(l.length>d.length)throw new g(p.INVALID_ARGUMENT,`Too many arguments provided to ${u}(). The number of arguments must be less than or equal to the number of orderBy() clauses`);const f=[];for(let E=0;E<l.length;E++){const T=l[E];if(d[E].field.isKeyField()){if(typeof T!="string")throw new g(p.INVALID_ARGUMENT,`Invalid query. Expected a string for document ID in ${u}(), but got a ${typeof T}`);if(!Mo(o)&&T.indexOf("/")!==-1)throw new g(p.INVALID_ARGUMENT,`Invalid query. When querying a collection and ordering by documentId(), the value passed to ${u}() must be a plain document ID, but '${T}' contains a slash.`);const _=o.path.child(B.fromString(T));if(!w.isDocumentKey(_))throw new g(p.INVALID_ARGUMENT,`Invalid query. When querying a collection group and ordering by documentId(), the value passed to ${u}() must result in a valid document path, but '${_}' is not because it contains an odd number of segments.`);const C=new w(_);f.push(Is(a,C))}else{const _=bh(c,u,T);f.push(_)}}return new un(f,h)}(t._query,t.firestore._databaseId,s,e,n,r)}}function Lh(t,e,n){if(typeof(n=x(n))=="string"){if(n==="")throw new g(p.INVALID_ARGUMENT,"Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");if(!Mo(e)&&n.indexOf("/")!==-1)throw new g(p.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(B.fromString(n));if(!w.isDocumentKey(r))throw new g(p.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 Is(t,new w(r))}if(n instanceof we)return Is(t,n._key);throw new g(p.INVALID_ARGUMENT,`Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${$s(n)}.`)}function Mh(t,e){if(!Array.isArray(t)||t.length===0)throw new g(p.INVALID_ARGUMENT,`Invalid Query. A non-empty array is required for '${e.toString()}' filters.`)}function xh(t,e){const n=function(s,i){for(const o of s)for(const a of o.getFlattenedFilters())if(i.indexOf(a.op)>=0)return a.op;return null}(t.filters,function(s){switch(s){case"!=":return["!=","not-in"];case"array-contains-any":case"in":return["not-in"];case"not-in":return["array-contains-any","in","not-in","!="];default:return[]}}(e.op));if(n!==null)throw n===e.op?new g(p.INVALID_ARGUMENT,`Invalid query. You cannot use more than one '${e.op.toString()}' filter.`):new g(p.INVALID_ARGUMENT,`Invalid query. You cannot use '${e.op.toString()}' filters with '${n.toString()}' filters.`)}function Uh(t,e){if(!(e instanceof Sr||e instanceof En))throw new g(p.INVALID_ARGUMENT,`Function ${t}() requires AppliableConstraints created with a call to 'where(...)', 'or(...)', or 'and(...)'.`)}class dv{convertValue(e,n="none"){switch(Ut(e)){case 0:return null;case 1:return e.booleanValue;case 2:return G(e.integerValue||e.doubleValue);case 3:return this.convertTimestamp(e.timestampValue);case 4:return this.convertServerTimestamp(e,n);case 5:return e.stringValue;case 6:return this.convertBytes(xt(e.bytesValue));case 7:return this.convertReference(e.referenceValue);case 8:return this.convertGeoPoint(e.geoPointValue);case 9:return this.convertArray(e.arrayValue,n);case 10:return this.convertObject(e.mapValue,n);default:throw A()}}convertObject(e,n){return this.convertObjectMap(e.fields,n)}convertObjectMap(e,n="none"){const r={};return Mt(e,(s,i)=>{r[s]=this.convertValue(i,n)}),r}convertGeoPoint(e){return new la(G(e.latitude),G(e.longitude))}convertArray(e,n){return(e.values||[]).map(r=>this.convertValue(r,n))}convertServerTimestamp(e,n){switch(n){case"previous":const r=So(e);return r==null?null:this.convertValue(r,n);case"estimate":return this.convertTimestamp(lr(e));default:return null}}convertTimestamp(e){const n=pt(e);return new Y(n.seconds,n.nanos)}convertDocumentKey(e,n){const r=B.fromString(e);F(Fl(r));const s=new hr(r.get(1),r.get(3)),i=new w(r.popFirst(5));return s.isEqual(n)||Be(`Document ${i} 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 (${n.projectId}/${n.database}) instead.`),i}}/**
1892
+ */function wv(n){if(n.limitType==="L"&&n.explicitOrderBy.length===0)throw new g(p.UNIMPLEMENTED,"limitToLast() queries require specifying at least one orderBy() clause")}class Ia{}class Zs extends Ia{}function $h(n,e,...t){let r=[];e instanceof Ia&&r.push(e),r=r.concat(t),function(i){const o=i.filter(c=>c instanceof In).length,a=i.filter(c=>c instanceof Or).length;if(o>1||o>0&&a>0)throw new g(p.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(...)))`.")}(r);for(const s of r)n=s._apply(n);return n}class Or extends Zs{constructor(e,t,r){super(),this._field=e,this._op=t,this._value=r,this.type="where"}static _create(e,t,r){return new Or(e,t,r)}_apply(e){const t=this._parse(e);return Kh(e._query,t),new rt(e.firestore,e.converter,jo(e._query,t))}_parse(e){const t=ya(e.firestore);return function(i,o,a,c,u,l,h){let d;if(u.isKeyField()){if(l==="array-contains"||l==="array-contains-any")throw new g(p.INVALID_ARGUMENT,`Invalid Query. You can't perform '${l}' queries on documentId().`);if(l==="in"||l==="not-in"){Gh(h,l);const f=[];for(const E of h)f.push(Wh(c,i,E));d={arrayValue:{values:f}}}else d=Wh(c,i,h)}else l!=="in"&&l!=="not-in"&&l!=="array-contains-any"||Gh(h,l),d=Fh(a,o,h,l==="in"||l==="not-in");return K.create(u,l,d)}(e._query,"where",t,e.firestore._databaseId,this._field,this._op,this._value)}}function zh(n,e,t){const r=e,s=Js("where",n);return Or._create(s,r,t)}class In extends Ia{constructor(e,t){super(),this.type=e,this._queryConstraints=t}static _create(e,t){return new In(e,t)}_parse(e){const t=this._queryConstraints.map(r=>r._parse(e)).filter(r=>r.getFilters().length>0);return t.length===1?t[0]:Ve.create(t,this._getOperator())}_apply(e){const t=this._parse(e);return t.getFilters().length===0?e:(function(s,i){let o=s;const a=i.getFlattenedFilters();for(const c of a)Kh(o,c),o=jo(o,c)}(e._query,t),new rt(e.firestore,e.converter,jo(e._query,t)))}_getQueryConstraints(){return this._queryConstraints}_getOperator(){return this.type==="and"?"and":"or"}}function Iv(...n){return n.forEach(e=>Qh("or",e)),In._create("or",n)}function Av(...n){return n.forEach(e=>Qh("and",e)),In._create("and",n)}class Aa extends Zs{constructor(e,t){super(),this._field=e,this._direction=t,this.type="orderBy"}static _create(e,t){return new Aa(e,t)}_apply(e){const t=function(s,i,o){if(s.startAt!==null)throw new g(p.INVALID_ARGUMENT,"Invalid query. You must not call startAt() or startAfter() before calling orderBy().");if(s.endAt!==null)throw new g(p.INVALID_ARGUMENT,"Invalid query. You must not call endAt() or endBefore() before calling orderBy().");return new Er(i,o)}(e._query,this._field,this._direction);return new rt(e.firestore,e.converter,function(s,i){const o=s.explicitOrderBy.concat([i]);return new $t(s.path,s.collectionGroup,o,s.filters.slice(),s.limit,s.limitType,s.startAt,s.endAt)}(e._query,t))}}function Rv(n,e="asc"){const t=e,r=Js("orderBy",n);return Aa._create(r,t)}class Ra extends Zs{constructor(e,t,r){super(),this.type=e,this._limit=t,this._limitType=r}static _create(e,t,r){return new Ra(e,t,r)}_apply(e){return new rt(e.firestore,e.converter,ks(e._query,this._limit,this._limitType))}}function Hh(n){return uv("limit",n),Ra._create("limit",n,"F")}class Pa extends Zs{constructor(e,t,r){super(),this.type=e,this._docOrFields=t,this._inclusive=r}static _create(e,t,r){return new Pa(e,t,r)}_apply(e){const t=Sv(e,this.type,this._docOrFields,this._inclusive);return new rt(e.firestore,e.converter,function(s,i){return new $t(s.path,s.collectionGroup,s.explicitOrderBy.slice(),s.filters.slice(),s.limit,s.limitType,i,s.endAt)}(e._query,t))}}function Pv(...n){return Pa._create("startAfter",n,!1)}function Sv(n,e,t,r){if(t[0]=x(t[0]),t[0]instanceof wa)return function(i,o,a,c,u){if(!c)throw new g(p.NOT_FOUND,`Can't use a DocumentSnapshot that doesn't exist for ${a}().`);const l=[];for(const h of fn(i))if(h.field.isKeyField())l.push(bs(o,c.key));else{const d=c.data.field(h.field);if(Ps(d))throw new g(p.INVALID_ARGUMENT,'Invalid query. You are trying to start or end a query using a document for which the field "'+h.field+'" is an uncommitted server timestamp. (Since the value of this field is unknown, you cannot start/end a query with it.)');if(d===null){const f=h.field.canonicalString();throw new g(p.INVALID_ARGUMENT,`Invalid query. You are trying to start or end a query using a document for which the field '${f}' (used as the orderBy) does not exist.`)}l.push(d)}return new dn(l,u)}(n._query,n.firestore._databaseId,e,t[0]._document,r);{const s=ya(n.firestore);return function(o,a,c,u,l,h){const d=o.explicitOrderBy;if(l.length>d.length)throw new g(p.INVALID_ARGUMENT,`Too many arguments provided to ${u}(). The number of arguments must be less than or equal to the number of orderBy() clauses`);const f=[];for(let E=0;E<l.length;E++){const T=l[E];if(d[E].field.isKeyField()){if(typeof T!="string")throw new g(p.INVALID_ARGUMENT,`Invalid query. Expected a string for document ID in ${u}(), but got a ${typeof T}`);if(!Bo(o)&&T.indexOf("/")!==-1)throw new g(p.INVALID_ARGUMENT,`Invalid query. When querying a collection and ordering by documentId(), the value passed to ${u}() must be a plain document ID, but '${T}' contains a slash.`);const _=o.path.child(B.fromString(T));if(!w.isDocumentKey(_))throw new g(p.INVALID_ARGUMENT,`Invalid query. When querying a collection group and ordering by documentId(), the value passed to ${u}() must result in a valid document path, but '${_}' is not because it contains an odd number of segments.`);const C=new w(_);f.push(bs(a,C))}else{const _=Fh(c,u,T);f.push(_)}}return new dn(f,h)}(n._query,n.firestore._databaseId,s,e,t,r)}}function Wh(n,e,t){if(typeof(t=x(t))=="string"){if(t==="")throw new g(p.INVALID_ARGUMENT,"Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");if(!Bo(e)&&t.indexOf("/")!==-1)throw new g(p.INVALID_ARGUMENT,`Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '${t}' contains a '/' character.`);const r=e.path.child(B.fromString(t));if(!w.isDocumentKey(r))throw new g(p.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 bs(n,new w(r))}if(t instanceof Ae)return bs(n,t._key);throw new g(p.INVALID_ARGUMENT,`Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${Gs(t)}.`)}function Gh(n,e){if(!Array.isArray(n)||n.length===0)throw new g(p.INVALID_ARGUMENT,`Invalid Query. A non-empty array is required for '${e.toString()}' filters.`)}function Kh(n,e){const t=function(s,i){for(const o of s)for(const a of o.getFlattenedFilters())if(i.indexOf(a.op)>=0)return a.op;return null}(n.filters,function(s){switch(s){case"!=":return["!=","not-in"];case"array-contains-any":case"in":return["not-in"];case"not-in":return["array-contains-any","in","not-in","!="];default:return[]}}(e.op));if(t!==null)throw t===e.op?new g(p.INVALID_ARGUMENT,`Invalid query. You cannot use more than one '${e.op.toString()}' filter.`):new g(p.INVALID_ARGUMENT,`Invalid query. You cannot use '${e.op.toString()}' filters with '${t.toString()}' filters.`)}function Qh(n,e){if(!(e instanceof Or||e instanceof In))throw new g(p.INVALID_ARGUMENT,`Function ${n}() requires AppliableConstraints created with a call to 'where(...)', 'or(...)', or 'and(...)'.`)}class bv{convertValue(e,t="none"){switch(qt(e)){case 0:return null;case 1:return e.booleanValue;case 2:return G(e.integerValue||e.doubleValue);case 3:return this.convertTimestamp(e.timestampValue);case 4:return this.convertServerTimestamp(e,t);case 5:return e.stringValue;case 6:return this.convertBytes(jt(e.bytesValue));case 7:return this.convertReference(e.referenceValue);case 8:return this.convertGeoPoint(e.geoPointValue);case 9:return this.convertArray(e.arrayValue,t);case 10:return this.convertObject(e.mapValue,t);default:throw A()}}convertObject(e,t){return this.convertObjectMap(e.fields,t)}convertObjectMap(e,t="none"){const r={};return Bt(e,(s,i)=>{r[s]=this.convertValue(i,t)}),r}convertGeoPoint(e){return new ga(G(e.latitude),G(e.longitude))}convertArray(e,t){return(e.values||[]).map(r=>this.convertValue(r,t))}convertServerTimestamp(e,t){switch(t){case"previous":const r=Do(e);return r==null?null:this.convertValue(r,t);case"estimate":return this.convertTimestamp(gr(e));default:return null}}convertTimestamp(e){const t=yt(e);return new Y(t.seconds,t.nanos)}convertDocumentKey(e,t){const r=B.fromString(e);F(Kl(r));const s=new _r(r.get(1),r.get(3)),i=new w(r.popFirst(5));return s.isEqual(t)||$e(`Document ${i} 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 (${t.projectId}/${t.database}) instead.`),i}}/**
1893
1893
  * @license
1894
1894
  * Copyright 2020 Google LLC
1895
1895
  *
@@ -1904,7 +1904,7 @@ This typically indicates that your device does not have a healthy Internet conne
1904
1904
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1905
1905
  * See the License for the specific language governing permissions and
1906
1906
  * limitations under the License.
1907
- */function fv(t,e,n){let r;return r=t?n&&(n.merge||n.mergeFields)?t.toFirestore(e,n):t.toFirestore(e):e,r}function pv(){return new Yy("count")}/**
1907
+ */function Cv(n,e,t){let r;return r=n?t&&(t.merge||t.mergeFields)?n.toFirestore(e,t):n.toFirestore(e):e,r}function kv(){return new dv("count")}/**
1908
1908
  * @license
1909
1909
  * Copyright 2020 Google LLC
1910
1910
  *
@@ -1919,7 +1919,7 @@ This typically indicates that your device does not have a healthy Internet conne
1919
1919
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1920
1920
  * See the License for the specific language governing permissions and
1921
1921
  * limitations under the License.
1922
- */class br{constructor(e,n){this.hasPendingWrites=e,this.fromCache=n}isEqual(e){return this.hasPendingWrites===e.hasPendingWrites&&this.fromCache===e.fromCache}}class Fh extends ga{constructor(e,n,r,s,i,o){super(e,n,r,s,o),this._firestore=e,this._firestoreImpl=e,this.metadata=i}exists(){return super.exists()}data(e={}){if(this._document){if(this._converter){const n=new Qs(this._firestore,this._userDataWriter,this._key,this._document,this.metadata,null);return this._converter.fromFirestore(n,e)}return this._userDataWriter.convertValue(this._document.data.value,e.serverTimestamps)}}get(e,n={}){if(this._document){const r=this._document.data.field(Gs("DocumentSnapshot.get",e));if(r!==null)return this._userDataWriter.convertValue(r,n.serverTimestamps)}}}class Qs extends Fh{data(e={}){return super.data(e)}}class mv{constructor(e,n,r,s){this._firestore=e,this._userDataWriter=n,this._snapshot=s,this.metadata=new br(s.hasPendingWrites,s.fromCache),this.query=r}get docs(){const e=[];return this.forEach(n=>e.push(n)),e}get size(){return this._snapshot.docs.size}get empty(){return this.size===0}forEach(e,n){this._snapshot.docs.forEach(r=>{e.call(n,new Qs(this._firestore,this._userDataWriter,r.key,r,new br(this._snapshot.mutatedKeys.has(r.key),this._snapshot.fromCache),this.query.converter))})}docChanges(e={}){const n=!!e.includeMetadataChanges;if(n&&this._snapshot.excludesMetadataChanges)throw new g(p.INVALID_ARGUMENT,"To include metadata changes with your document changes, you must also pass { includeMetadataChanges:true } to onSnapshot().");return this._cachedChanges&&this._cachedChangesIncludeMetadataChanges===n||(this._cachedChanges=function(s,i){if(s._snapshot.oldDocs.isEmpty()){let o=0;return s._snapshot.docChanges.map(a=>{const c=new Qs(s._firestore,s._userDataWriter,a.doc.key,a.doc,new br(s._snapshot.mutatedKeys.has(a.doc.key),s._snapshot.fromCache),s.query.converter);return a.doc,{type:"added",doc:c,oldIndex:-1,newIndex:o++}})}{let o=s._snapshot.oldDocs;return s._snapshot.docChanges.filter(a=>i||a.type!==3).map(a=>{const c=new Qs(s._firestore,s._userDataWriter,a.doc.key,a.doc,new br(s._snapshot.mutatedKeys.has(a.doc.key),s._snapshot.fromCache),s.query.converter);let u=-1,l=-1;return a.type!==0&&(u=o.indexOf(a.doc.key),o=o.delete(a.doc.key)),a.type!==1&&(o=o.add(a.doc),l=o.indexOf(a.doc.key)),{type:gv(a.type),doc:c,oldIndex:u,newIndex:l}})}}(this,n),this._cachedChangesIncludeMetadataChanges=n),this._cachedChanges}}function gv(t){switch(t){case 0:return"added";case 2:case 3:return"modified";case 1:return"removed";default:return A()}}/**
1922
+ */class Vr{constructor(e,t){this.hasPendingWrites=e,this.fromCache=t}isEqual(e){return this.hasPendingWrites===e.hasPendingWrites&&this.fromCache===e.fromCache}}class Yh extends wa{constructor(e,t,r,s,i,o){super(e,t,r,s,o),this._firestore=e,this._firestoreImpl=e,this.metadata=i}exists(){return super.exists()}data(e={}){if(this._document){if(this._converter){const t=new ei(this._firestore,this._userDataWriter,this._key,this._document,this.metadata,null);return this._converter.fromFirestore(t,e)}return this._userDataWriter.convertValue(this._document.data.value,e.serverTimestamps)}}get(e,t={}){if(this._document){const r=this._document.data.field(Js("DocumentSnapshot.get",e));if(r!==null)return this._userDataWriter.convertValue(r,t.serverTimestamps)}}}class ei extends Yh{data(e={}){return super.data(e)}}class Dv{constructor(e,t,r,s){this._firestore=e,this._userDataWriter=t,this._snapshot=s,this.metadata=new Vr(s.hasPendingWrites,s.fromCache),this.query=r}get docs(){const e=[];return this.forEach(t=>e.push(t)),e}get size(){return this._snapshot.docs.size}get empty(){return this.size===0}forEach(e,t){this._snapshot.docs.forEach(r=>{e.call(t,new ei(this._firestore,this._userDataWriter,r.key,r,new Vr(this._snapshot.mutatedKeys.has(r.key),this._snapshot.fromCache),this.query.converter))})}docChanges(e={}){const t=!!e.includeMetadataChanges;if(t&&this._snapshot.excludesMetadataChanges)throw new g(p.INVALID_ARGUMENT,"To include metadata changes with your document changes, you must also pass { includeMetadataChanges:true } to onSnapshot().");return this._cachedChanges&&this._cachedChangesIncludeMetadataChanges===t||(this._cachedChanges=function(s,i){if(s._snapshot.oldDocs.isEmpty()){let o=0;return s._snapshot.docChanges.map(a=>{const c=new ei(s._firestore,s._userDataWriter,a.doc.key,a.doc,new Vr(s._snapshot.mutatedKeys.has(a.doc.key),s._snapshot.fromCache),s.query.converter);return a.doc,{type:"added",doc:c,oldIndex:-1,newIndex:o++}})}{let o=s._snapshot.oldDocs;return s._snapshot.docChanges.filter(a=>i||a.type!==3).map(a=>{const c=new ei(s._firestore,s._userDataWriter,a.doc.key,a.doc,new Vr(s._snapshot.mutatedKeys.has(a.doc.key),s._snapshot.fromCache),s.query.converter);let u=-1,l=-1;return a.type!==0&&(u=o.indexOf(a.doc.key),o=o.delete(a.doc.key)),a.type!==1&&(o=o.add(a.doc),l=o.indexOf(a.doc.key)),{type:Nv(a.type),doc:c,oldIndex:u,newIndex:l}})}}(this,t),this._cachedChangesIncludeMetadataChanges=t),this._cachedChanges}}function Nv(n){switch(n){case 0:return"added";case 2:case 3:return"modified";case 1:return"removed";default:return A()}}/**
1923
1923
  * @license
1924
1924
  * Copyright 2020 Google LLC
1925
1925
  *
@@ -1934,7 +1934,7 @@ This typically indicates that your device does not have a healthy Internet conne
1934
1934
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1935
1935
  * See the License for the specific language governing permissions and
1936
1936
  * limitations under the License.
1937
- */function _v(t){t=vt(t,we);const e=vt(t.firestore,yn);return zy(Rr(e),t._key).then(n=>Ev(e,t,n))}class Ta extends dv{constructor(e){super(),this.firestore=e}convertBytes(e){return new vn(e)}convertReference(e){const n=this.convertDocumentKey(e,this.firestore._databaseId);return new we(this.firestore,null,n)}}function yv(t){t=vt(t,et);const e=vt(t.firestore,yn),n=Rr(e),r=new Ta(e);return ov(t._query),Hy(n,t._query).then(s=>new mv(e,r,t,s))}function vv(t){return Bh(vt(t.firestore,yn),[new Os(t._key,Pe.none())])}function Bh(t,e){return function(r,s){const i=new De;return r.asyncQueue.enqueueAndForget(async()=>Cy(await $y(r),s,i)),i.promise}(Rr(t),e)}function Ev(t,e,n){const r=n.docs.get(e._key),s=new Ta(t);return new Fh(t,s,e._key,r,new br(n.hasPendingWrites,n.fromCache),e.converter)}/**
1937
+ */function Ov(n){n=It(n,Ae);const e=It(n.firestore,Tn);return ov(Dr(e),n._key).then(t=>Mv(e,n,t))}class Sa extends bv{constructor(e){super(),this.firestore=e}convertBytes(e){return new wn(e)}convertReference(e){const t=this.convertDocumentKey(e,this.firestore._databaseId);return new Ae(this.firestore,null,t)}}function Vv(n){n=It(n,rt);const e=It(n.firestore,Tn),t=Dr(e),r=new Sa(e);return wv(n._query),av(t,n._query).then(s=>new Dv(e,r,n,s))}function Lv(n){return Xh(It(n.firestore,Tn),[new Us(n._key,Ce.none())])}function Xh(n,e){return function(r,s){const i=new Oe;return r.asyncQueue.enqueueAndForget(async()=>Wy(await sv(r),s,i)),i.promise}(Dr(n),e)}function Mv(n,e,t){const r=t.docs.get(e._key),s=new Sa(n);return new Yh(n,s,e._key,r,new Vr(t.hasPendingWrites,t.fromCache),e.converter)}/**
1938
1938
  * @license
1939
1939
  * Copyright 2022 Google LLC
1940
1940
  *
@@ -1949,7 +1949,7 @@ This typically indicates that your device does not have a healthy Internet conne
1949
1949
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1950
1950
  * See the License for the specific language governing permissions and
1951
1951
  * limitations under the License.
1952
- */function Tv(t){return wv(t,{count:pv()})}function wv(t,e){const n=vt(t.firestore,yn),r=Rr(n),s=function(o,a){const c=[];for(const u in o)Object.prototype.hasOwnProperty.call(o,u)&&c.push(a(o[u],u,o));return c}(e,(i,o)=>new s_(o,i.aggregateType,i._internalFieldPath));return function(o,a,c){const u=new De;return o.asyncQueue.enqueueAndForget(async()=>{try{const l=await qy(o);u.resolve(iy(l,a,c))}catch(l){u.reject(l)}}),u.promise}(r,t._query,s).then(i=>function(a,c,u){const l=new Ta(a);return new Xy(c,l,u)}(n,t,i))}/**
1952
+ */function xv(n){return Uv(n,{count:kv()})}function Uv(n,e){const t=It(n.firestore,Tn),r=Dr(t),s=function(o,a){const c=[];for(const u in o)Object.prototype.hasOwnProperty.call(o,u)&&c.push(a(o[u],u,o));return c}(e,(i,o)=>new v_(o,i.aggregateType,i._internalFieldPath));return function(o,a,c){const u=new Oe;return o.asyncQueue.enqueueAndForget(async()=>{try{const l=await iv(o);u.resolve(Ey(l,a,c))}catch(l){u.reject(l)}}),u.promise}(r,n._query,s).then(i=>function(a,c,u){const l=new Sa(a);return new fv(c,l,u)}(t,n,i))}/**
1953
1953
  * @license
1954
1954
  * Copyright 2020 Google LLC
1955
1955
  *
@@ -1964,7 +1964,7 @@ This typically indicates that your device does not have a healthy Internet conne
1964
1964
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1965
1965
  * See the License for the specific language governing permissions and
1966
1966
  * limitations under the License.
1967
- */class Iv{constructor(e,n){this._firestore=e,this._commitHandler=n,this._mutations=[],this._committed=!1,this._dataReader=da(e)}set(e,n,r){this._verifyNotCommitted();const s=wa(e,this._firestore),i=fv(s.converter,n,r),o=tv(this._dataReader,"WriteBatch.set",s._key,i,s.converter!==null,r);return this._mutations.push(o.toMutation(s._key,Pe.none())),this}update(e,n,r,...s){this._verifyNotCommitted();const i=wa(e,this._firestore);let o;return o=typeof(n=x(n))=="string"||n instanceof zs?rv(this._dataReader,"WriteBatch.update",i._key,n,r,s):nv(this._dataReader,"WriteBatch.update",i._key,n),this._mutations.push(o.toMutation(i._key,Pe.exists(!0))),this}delete(e){this._verifyNotCommitted();const n=wa(e,this._firestore);return this._mutations=this._mutations.concat(new Os(n._key,Pe.none())),this}commit(){return this._verifyNotCommitted(),this._committed=!0,this._mutations.length>0?this._commitHandler(this._mutations):Promise.resolve()}_verifyNotCommitted(){if(this._committed)throw new g(p.FAILED_PRECONDITION,"A write batch can no longer be used after commit() has been called.")}}function wa(t,e){if((t=x(t)).firestore!==e)throw new g(p.INVALID_ARGUMENT,"Provided document reference is from a different Firestore instance.");return t}/**
1967
+ */class Fv{constructor(e,t){this._firestore=e,this._commitHandler=t,this._mutations=[],this._committed=!1,this._dataReader=ya(e)}set(e,t,r){this._verifyNotCommitted();const s=ba(e,this._firestore),i=Cv(s.converter,t,r),o=_v(this._dataReader,"WriteBatch.set",s._key,i,s.converter!==null,r);return this._mutations.push(o.toMutation(s._key,Ce.none())),this}update(e,t,r,...s){this._verifyNotCommitted();const i=ba(e,this._firestore);let o;return o=typeof(t=x(t))=="string"||t instanceof Qs?vv(this._dataReader,"WriteBatch.update",i._key,t,r,s):yv(this._dataReader,"WriteBatch.update",i._key,t),this._mutations.push(o.toMutation(i._key,Ce.exists(!0))),this}delete(e){this._verifyNotCommitted();const t=ba(e,this._firestore);return this._mutations=this._mutations.concat(new Us(t._key,Ce.none())),this}commit(){return this._verifyNotCommitted(),this._committed=!0,this._mutations.length>0?this._commitHandler(this._mutations):Promise.resolve()}_verifyNotCommitted(){if(this._committed)throw new g(p.FAILED_PRECONDITION,"A write batch can no longer be used after commit() has been called.")}}function ba(n,e){if((n=x(n)).firestore!==e)throw new g(p.INVALID_ARGUMENT,"Provided document reference is from a different Firestore instance.");return n}/**
1968
1968
  * @license
1969
1969
  * Copyright 2020 Google LLC
1970
1970
  *
@@ -1979,13 +1979,13 @@ This typically indicates that your device does not have a healthy Internet conne
1979
1979
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1980
1980
  * See the License for the specific language governing permissions and
1981
1981
  * limitations under the License.
1982
- */function Av(t){return Rr(t=vt(t,yn)),new Iv(t,e=>Bh(t,e))}(function(e,n=!0){(function(s){rn=s})(bt),ut(new Ye("firestore",(r,{instanceIdentifier:s,options:i})=>{const o=r.getProvider("app").getImmediate(),a=new yn(new dg(r.getProvider("auth-internal")),new gg(r.getProvider("app-check-internal")),function(u,l){if(!Object.prototype.hasOwnProperty.apply(u.options,["projectId"]))throw new g(p.INVALID_ARGUMENT,'"projectId" not provided in firebase.initializeApp.');return new hr(u.options.projectId,l)}(o,s),o);return i=Object.assign({useFetchStreams:n},i),a._setSettings(i),a},"PUBLIC").setMultipleInstances(!0)),Ae(xu,"4.4.2",e),Ae(xu,"4.4.2","esm2017")})();class jh{constructor(){this.subscribers=new Set}subscribe(e){return this.subscribers.add(e),()=>this.unsubscribe(e)}unsubscribe(e){this.subscribers.delete(e)}notify(e){this.subscribers.forEach(n=>n(e))}get subscribersCount(){return this.subscribers.size}}let Ys;const Rv=new Uint8Array(16);function Pv(){if(!Ys&&(Ys=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Ys))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Ys(Rv)}const ie=[];for(let t=0;t<256;++t)ie.push((t+256).toString(16).slice(1));function Sv(t,e=0){return ie[t[e+0]]+ie[t[e+1]]+ie[t[e+2]]+ie[t[e+3]]+"-"+ie[t[e+4]]+ie[t[e+5]]+"-"+ie[t[e+6]]+ie[t[e+7]]+"-"+ie[t[e+8]]+ie[t[e+9]]+"-"+ie[t[e+10]]+ie[t[e+11]]+ie[t[e+12]]+ie[t[e+13]]+ie[t[e+14]]+ie[t[e+15]]}const bv=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),$h={randomUUID:bv};function Cv(t,e,n){if($h.randomUUID&&!e&&!t)return $h.randomUUID();t=t||{};const r=t.random||(t.rng||Pv)();if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,e){n=n||0;for(let s=0;s<16;++s)e[n+s]=r[s];return e}return Sv(r)}var kv=Object.defineProperty,Dv=Object.getOwnPropertyDescriptor,Nv=(t,e,n,r)=>{for(var s=r>1?void 0:r?Dv(e,n):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(s=(r?o(e,n,s):o(s))||s);return r&&s&&kv(e,n,s),s},Se;const qh=(Se=class{static registerFactory(t,e,n){this._factoryMap[t]={factory:e,annotation:n}}static classFactory(t){if(!t)throw new Error("You should provide a class name.");if(!this._factoryMap[t])throw new Error(`You should register class ${t} prior to use.`);return this._factoryMap[t].factory}static registeredClasses(){return Object.keys(this._factoryMap)}static classesExtending(t){return Object.entries(this._factoryMap).filter(([,e])=>new e.factory instanceof t).map(([e])=>e)}static annotations(t){if(t instanceof Se?t=t.className:typeof t=="string"||(t=new t().className),!this._factoryMap[t])throw new Error(`You should register class ${t} prior to use.`);return this._factoryMap[t].annotation}constructor(t=Cv()){this._id=t}get className(){return this.__className}setId(t){this._id=t}get id(){return this._id}afterDeserialize(){}beforeSerialize(){}getPersistentProperties(){return this._persistentProperties?this._persistentProperties.map(t=>({...t,name:t.name.slice(1)})):[]}getPropInfo(t){const e=this.getPersistentProperties().find(n=>n.name===t);if(!e)throw new Error(`Property "${t}" has not been registered.`);return e}isRequired(t){return this.getPropInfo(t).validator!=null}isPropValueValid(t){const e=this.getPropInfo(t);return e.validator?e.validator(this[e.name],e,this):!0}clone(t){const e=t.toObject();return delete e.id,this.fromObject(e)}fromObject(t){return this.fromObj(t),this.afterDeserialize(),this}fromObj(t){return this._persistentProperties?(this._persistentProperties.forEach(e=>{const n=this.removeUnderscore(e),r=t[n];r!=null&&(this[e.name]=this.fromDeepObject(r))}),this):this}toObject(){const t={},e=this.toObj(t);return this.pushDocument(t,this.className,e),{...e,__rootCollections:t}}toObj(t){if(!this._persistentProperties)return{};this.beforeSerialize();const e={};if(!this.className)throw new Error("You should register this class prior to streaming it.");return this._persistentProperties.forEach(n=>{const r=this[n.name],s=this.removeUnderscore(n);r!=null&&(n.isReference?e[s]=this.toReferenceObj(n,t):e[s]=this.toDeepObj(r,t),n.searchableArray&&(e[Se.searchableArrayNameFor(s)]=r.map(i=>i.id)))}),e.__className=this.className,e}static searchableArrayNameFor(t){return`__${t}_searchable`}fromDeepObject(t){if(t==null)return t;if(Array.isArray(t))return t.map(e=>this.fromDeepObject(e));if(t.__documentReference){const e=t,n=Se.createInstance(e);return n.__documentReference=t.__documentReference,n}if(t.__className)return Se.createInstance(t);if(typeof t=="object"){const e={};return Object.entries(t).forEach(([n,r])=>e[n]=this.fromDeepObject(r)),e}return t}toDeepObj(t,e){if(t!=null){if(Array.isArray(t))return t.map(n=>this.toDeepObj(n,e));if(t.__documentReference)return t;if(t instanceof Se)return t.toObj(e);if(typeof t=="object"){const n={};return Object.entries(t).forEach(([r,s])=>n[r]=this.toDeepObj(s,e)),n}return t}}toReferenceObj(t,e){const n=this[t.name],r=s=>{let i;return typeof t.storeInCollection=="function"?i=t.storeInCollection(s,t):i=t.storeInCollection||s.className,i};return Array.isArray(n)?n.map(s=>(t.isPureReference||this.pushDocument(e,r(s),s),this.buildRefObject(s,r(s),t.forcedPersistentProps))):(t.isPureReference||this.pushDocument(e,r(n),n),this.buildRefObject(n,r(n),t.forcedPersistentProps))}buildRefObject(t,e,n){const r=n==null?void 0:n.reduce((s,i)=>(t[i]!==void 0&&(s[i]=t[i]),s),{});return{id:t.id,__className:t.className||t.__className,__documentReference:{storedInCollection:e},...r}}pushDocument(t,e,n){if("__documentReference"in n&&n.__documentReference)return;t[e]||(t[e]=[]);const r=this.toDeepObj(n,t);t[e].push(r)}removeUnderscore(t){return t.name.slice(1)}static createReference(t){const e=Se.createInstance(t);return e.__documentReference=t.__documentReference||{storedInCollection:e.className},e}static createInstance(t){if(typeof t=="string")return new(Se.classFactory(t));try{return new(Se.classFactory(t.__className))().fromObject(t)}catch(e){const n=Object.entries(t).filter(([r,s])=>s!=null&&typeof s!="function").map(([r,s])=>`${r}: ${s}`).join(`,
1982
+ */function Bv(n){return Dr(n=It(n,Tn)),new Fv(n,e=>Xh(n,e))}(function(e,t=!0){(function(s){an=s})(Nt),ft(new Ze("firestore",(r,{instanceIdentifier:s,options:i})=>{const o=r.getProvider("app").getImmediate(),a=new Tn(new Sg(r.getProvider("auth-internal")),new Dg(r.getProvider("app-check-internal")),function(u,l){if(!Object.prototype.hasOwnProperty.apply(u.options,["projectId"]))throw new g(p.INVALID_ARGUMENT,'"projectId" not provided in firebase.initializeApp.');return new _r(u.options.projectId,l)}(o,s),o);return i=Object.assign({useFetchStreams:t},i),a._setSettings(i),a},"PUBLIC").setMultipleInstances(!0)),Se(Wu,"4.6.0",e),Se(Wu,"4.6.0","esm2017")})();class Jh{constructor(){this.subscribers=new Set}subscribe(e){return this.subscribers.add(e),()=>this.unsubscribe(e)}unsubscribe(e){this.subscribers.delete(e)}notify(e){this.subscribers.forEach(t=>t(e))}get subscribersCount(){return this.subscribers.size}}let ti;const jv=new Uint8Array(16);function qv(){if(!ti&&(ti=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!ti))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ti(jv)}const ie=[];for(let n=0;n<256;++n)ie.push((n+256).toString(16).slice(1));function $v(n,e=0){return ie[n[e+0]]+ie[n[e+1]]+ie[n[e+2]]+ie[n[e+3]]+"-"+ie[n[e+4]]+ie[n[e+5]]+"-"+ie[n[e+6]]+ie[n[e+7]]+"-"+ie[n[e+8]]+ie[n[e+9]]+"-"+ie[n[e+10]]+ie[n[e+11]]+ie[n[e+12]]+ie[n[e+13]]+ie[n[e+14]]+ie[n[e+15]]}const zv=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Zh={randomUUID:zv};function Hv(n,e,t){if(Zh.randomUUID&&!e&&!n)return Zh.randomUUID();n=n||{};const r=n.random||(n.rng||qv)();if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,e){t=t||0;for(let s=0;s<16;++s)e[t+s]=r[s];return e}return $v(r)}var Wv=Object.defineProperty,Gv=Object.getOwnPropertyDescriptor,Kv=(n,e,t,r)=>{for(var s=r>1?void 0:r?Gv(e,t):e,i=n.length-1,o;i>=0;i--)(o=n[i])&&(s=(r?o(e,t,s):o(s))||s);return r&&s&&Wv(e,t,s),s},fe;const ed=(fe=class{static registerFactory(n,e,t){this._factoryMap[n]={factory:e,annotation:t}}static classFactory(n){if(!n)throw new Error("You should provide a class name.");if(!this._factoryMap[n])throw new Error(`You should register class ${n} prior to use.`);return this._factoryMap[n].factory}static registeredClasses(){return Object.keys(this._factoryMap)}static classesExtending(n){return Object.entries(this._factoryMap).filter(([,e])=>new e.factory instanceof n).map(([e])=>e)}static annotations(n){if(n instanceof fe?n=n.className:typeof n=="string"||(n=new n().className),!this._factoryMap[n])throw new Error(`You should register class ${n} prior to use.`);return this._factoryMap[n].annotation}constructor(n=Hv()){this._id=n}get className(){return this.__className}setId(n){this._id=n}get id(){return this._id}afterDeserialize(){}beforeSerialize(){}getPersistentProperties(){return this._persistentProperties?this._persistentProperties.map(n=>({...n,name:n.name.slice(1)})):[]}getPropInfo(n){const e=this.getPersistentProperties().find(t=>t.name===n);if(!e)throw new Error(`Property "${n}" has not been registered.`);return e}isRequired(n){return this.getPropInfo(n).validator!=null}isPropValueValid(n){const e=this.getPropInfo(n);return e.validator?e.validator(this[e.name],e,this):!0}clone(n){const e=n.toObject();return delete e.id,this.fromObject(e)}fromObject(n){return this.fromObj(n),this.afterDeserialize(),this}fromObj(n){return this._persistentProperties?(this._persistentProperties.forEach(e=>{const t=this.removeUnderscore(e),r=n[t];r!=null&&(this[e.name]=this.fromDeepObject(r))}),this):this}toObject(){const n={},e=this.toObj(n);return this.pushDocument(n,this.className,e),{...e,__rootCollections:n}}toObj(n){if(!this._persistentProperties)return{};this.beforeSerialize();const e={};if(!this.className)throw new Error("You should register this class prior to streaming it.");return this._persistentProperties.forEach(t=>{const r=this[t.name],s=this.removeUnderscore(t);r!=null&&(t.isReference?e[s]=this.toReferenceObj(t,n):e[s]=this.toDeepObj(r,n),t.searchableArray&&(e[fe.searchableArrayNameFor(s)]=r.map(i=>i.id)))}),e.__className=this.className,e}static searchableArrayNameFor(n){return`__${n}_searchable`}fromDeepObject(n){if(n==null)return n;if(Array.isArray(n))return n.map(e=>this.fromDeepObject(e));if(n.__documentReference){const e=n,t=fe.createInstance(e);return t.__documentReference=n.__documentReference,t}if(n.__className)return fe.createInstance(n);if(typeof n=="object"){const e={};return Object.entries(n).forEach(([t,r])=>e[t]=this.fromDeepObject(r)),e}return n}toDeepObj(n,e){if(n!=null){if(Array.isArray(n))return n.map(t=>this.toDeepObj(t,e));if(n.__documentReference)return n;if(n instanceof fe)return n.toObj(e);if(typeof n=="object"){const t={};return Object.entries(n).forEach(([r,s])=>t[r]=this.toDeepObj(s,e)),t}return n}}static collectionPath(n,e){let t;return typeof e.storeInCollection=="function"?t=e.storeInCollection(n,e):t=e.storeInCollection??n.className,t}toReferenceObj(n,e){const t=this[n.name];return Array.isArray(t)?t.map(r=>(n.isPureReference||this.pushDocument(e,fe.collectionPath(r,n),r),this.buildRefObject(r,fe.collectionPath(r,n),n.forcedPersistentProps))):(n.isPureReference||this.pushDocument(e,fe.collectionPath(t,n),t),this.buildRefObject(t,fe.collectionPath(t,n),n.forcedPersistentProps))}buildRefObject(n,e,t){const r=t==null?void 0:t.reduce((s,i)=>(n[i]!==void 0&&(s[i]=n[i]),s),{});return{id:n.id,__className:n.className||n.__className,__documentReference:{storedInCollection:e},...r}}pushDocument(n,e,t){if("__documentReference"in t&&t.__documentReference)return;n[e]||(n[e]=[]);const r=this.toDeepObj(t,n);n[e].push(r)}removeUnderscore(n){return n.name.slice(1)}static createReference(n){const e=fe.createInstance(n);return e.__documentReference=n.__documentReference||{storedInCollection:e.className},e}static createInstance(n){if(typeof n=="string")return new(fe.classFactory(n));try{return new(fe.classFactory(n.__className))().fromObject(n)}catch(e){const t=Object.entries(n).filter(([r,s])=>s!=null&&typeof s!="function").map(([r,s])=>`${r}: ${s}`).join(`,
1983
1983
  `);throw new Error(`${e}
1984
1984
  -----> Class name not found in object:
1985
1985
  {
1986
- ${n}
1986
+ ${t}
1987
1987
  }
1988
- `)}}static propInfo(t,e){return Se.createInstance(t).getPropInfo(e)}},Se._factoryMap={},Se);Nv([Tn],qh.prototype,"_id",2);let Xs=qh;function Tn(t,e){return Ov()(t,e)}function Ov(t){return function(e,n){Object.getOwnPropertyDescriptor(e,"_persistentProperties")||(e._persistentProperties?e._persistentProperties=[...e._persistentProperties]:e._persistentProperties=[]);const r=e._persistentProperties.find(s=>s.name===n);r?Object.assign(r,t):e._persistentProperties.push({name:n,...t})}}function Vv(t,e){return n=>{Xs.registerFactory(t,n,e),n.prototype.__className=t}}class Js{static toPropertyPathOperations(e){return e?e.map(n=>{if(Js.isArrayOperator(n.operator)&&n.value[0]instanceof Xs)return{property:Xs.searchableArrayNameFor(n.property),operator:n.operator,value:n.value.map(i=>i.id),aggregate:n.aggregate};const[r,s]=this.toPropertyPathValue(n.value);return{property:`${String(n.property)}${r?"."+r:""}`,operator:n.operator,value:s,aggregate:n.aggregate}}):[]}static isArrayOperator(e){return e==="containsAny"||e==="contains"}static toPropertyPathValue(e){if(typeof e=="object"&&!Array.isArray(e)){const n=Object.keys(e)[0],[r,s]=this.toPropertyPathValue(e[n]);return[`${n}${r?"."+r:""}`,s]}else return[void 0,e]}}const zh=class Dn{static registerCloudStorage(e,n){Dn._cloudStorageFactoryMap[e]=n}static createInstance(e){const n=Dn._cloudStorageFactoryMap[e];if(!n)throw new Error(`You should register the ${e} cloud storage provider prior to use it`);return n()}get className(){return this.__className}static useCloudStorage(e){Dn._defaultCloudStorage=e}static get defaultCloudStorage(){if(!Dn._defaultCloudStorage)throw new Error("You should define a default cloud storage provider prior to use it");return Dn._defaultCloudStorage}};zh._cloudStorageFactoryMap={};let wn=zh;function Hh(t,e){return wn.registerCloudStorage(t,e),n=>{n.prototype.__className=t}}var Lv=Object.defineProperty,Mv=Object.getOwnPropertyDescriptor,xv=(t,e,n,r)=>{for(var s=r>1?void 0:r?Mv(e,n):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(s=(r?o(e,n,s):o(s))||s);return r&&s&&Lv(e,n,s),s};let Ia=class extends wn{constructor(t=""){super(),this._simulateDelay=0,this._pendingPromises=[],this.mockFileSystem={},this._pathToMockFiles=t}simulateDelay(t){return this._simulateDelay=t,this}resolveWithDelay(t){if(this._simulateDelay<=0)return Promise.resolve(t);const e=new Promise(n=>{setTimeout(()=>n(t),this._simulateDelay)});return this._pendingPromises.push(e),e.finally(()=>this._pendingPromises=this._pendingPromises.filter(n=>n===e)),e}save(t,e){const n=t;this._onProgress&&this._onProgress(0,100),this.mockFileSystem[t]=JSON.stringify(e),this._onProgress&&this._onProgress(100,100);const r=e instanceof File?e.name:n;return this.resolveWithDelay(r)}uploadControl(){return{resume:()=>{},pause:()=>{},cancel:()=>{},onProgress:t=>this._onProgress=t}}getUrl(t){return Promise.resolve(this._pathToMockFiles+t)}delete(t){return delete this.mockFileSystem[t],this.resolveWithDelay()}};Ia=xv([Hh("MockCloudStorage",()=>new Ia)],Ia);var Uv=Object.defineProperty,Fv=Object.getOwnPropertyDescriptor,In=(t,e,n,r)=>{for(var s=r>1?void 0:r?Fv(e,n):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(s=(r?o(e,n,s):o(s))||s);return r&&s&&Uv(e,n,s),s};let $t=class extends Xs{constructor(){super(...arguments),this._onChange=new jh}async save({data:t,fileName:e,progress:n,cloudStorageProvider:r}={}){const s=t||this._pendingData;s&&(this._reference&&await this.delete(),this.provider=r||wn.defaultCloudStorage,this._originalFileName=e||(s instanceof File?s.name:void 0),this._reference=await this.provider.save(this.id,s,n),this._url=await this.provider.getUrl(this._reference),this._pendingData=void 0,this._onChange.notify({event:0,storedFile:this}))}uploadControl(){return this.provider.uploadControl()}async delete(){if(!this._reference)throw new Error("Cannot delete a not stored file");await this.provider.delete(this._reference),this._reference=void 0,this._url=void 0,this._onChange.notify({event:2,storedFile:this})}set provider(t){this._provider=t,this._cloudStorageProviderName=t.className}get provider(){if(!this._provider)try{this._provider=wn.createInstance(this._cloudStorageProviderName)}catch{this._provider=wn.defaultCloudStorage}return this._provider}get url(){return this._url}get mimeType(){return this._mimeType}setDataToStore(t){return this._pendingData=t,this._originalFileName=t instanceof File?t.name:void 0,this._mimeType=t instanceof Blob?t.type:void 0,this._onChange.notify({event:1,pendingData:t,storedFile:this}),this}get originalFileName(){return this._originalFileName}onChange(t){return this._onChange.subscribe(t)}};In([Tn],$t.prototype,"_reference",2),In([Tn],$t.prototype,"_url",2),In([Tn],$t.prototype,"_cloudStorageProviderName",2),In([Tn],$t.prototype,"_originalFileName",2),In([Tn],$t.prototype,"_mimeType",2),$t=In([Vv("StoredFile")],$t);class Wh{}const Gh=class ye extends Wh{constructor(){if(super(),this._onAuthStateChange=new jh,!ye._authService)throw new Error(ye.error.shouldBeRegistered);ye._authService.onAuthStateChange(e=>this.authStateChanged(e))}static useAuthService(e){ye._authService!=e&&(ye._authService=e,this._instance=void 0)}static get instance(){return this._instance||(this._instance=new this)}signUp(e){return ye._authService.signUp(e)}login(e){return ye._authService.login(e)}logout(){return ye._authService.logout()}resetEmailPassword(e){return ye._authService.resetEmailPassword(e)}resendVerificationEmail(e,n,r){return ye._authService.resendVerificationEmail(e,n,r)}refreshToken(){return ye._authService.refreshToken()}onAuthStateChange(e){return this._onAuthStateChange.subscribe(e)}removeAuthStateChange(e){this._onAuthStateChange.unsubscribe(e)}linkAdditionalProvider(e){return ye._authService.linkAdditionalProvider(e)}unlinkProvider(e){return ye._authService.unlinkProvider(e)}authStateChanged(e){this._onAuthStateChange.notify(e)}};Gh.error={shouldBeRegistered:"You should register an auth service before using Auth."},Gh._instance=void 0;function Zs(t){return t?t.replace(/([-_ ][\w])/g,e=>e.toUpperCase().replace("-","").replace("_","").replace(" ","")):""}var Bv="firebase",jv="10.8.0";/**
1988
+ `)}}static propInfo(n,e){return fe.createInstance(n).getPropInfo(e)}},fe._factoryMap={},fe);Kv([An],ed.prototype,"_id",2);let me=ed;function An(n,e){return Qv()(n,e)}function Qv(n){return function(e,t){Object.getOwnPropertyDescriptor(e,"_persistentProperties")||(e._persistentProperties?e._persistentProperties=[...e._persistentProperties]:e._persistentProperties=[]);const r=e._persistentProperties.find(s=>s.name===t);r?Object.assign(r,n):e._persistentProperties.push({name:t,...n})}}function Yv(n,e){return t=>{me.registerFactory(n,t,e),t.prototype.__className=n}}const td=class Hf{constructor(e,t,r){if(r){if(!(t instanceof me))throw new Error(Hf.error.persistentNeedForSubCollection);this.collectionName=`${t.className}/${t.id}/${r}`}else this.collectionName=t instanceof me?t.className:t;this._stream=e}findById(e,t){return new Promise((r,s)=>{this._stream.findById(e,this.collectionName).then(i=>{i?(t?t.fromObject(i):t=me.createInstance(i),r(t)):r(void 0)}).catch(i=>s(i))})}save(e){const t=e.toObject();return this.collectionName!==t.__className&&(t.__rootCollections[this.collectionName]=t.__rootCollections[t.__className],delete t.__rootCollections[t.__className]),new Promise((r,s)=>{this._stream.save(t.__rootCollections).then(()=>r()).catch(i=>s(i))})}delete(e){return new Promise((t,r)=>{this._stream.delete(e,this.collectionName).then(()=>t()).catch(s=>r(s))})}find(){return new Xv(this)}query(e={},t){if(t){const r=t instanceof me?t.className:t;e.operations||(e.operations=[]),e.operations.push({property:"__className",operator:"==",value:r})}return this.mapToInstance(()=>this._stream.find(this.preprocessQueryObject(e),this.collectionName))}count(e){return this._stream.count(e,this.collectionName)}next(e){return this.mapToInstance(()=>this._stream.next(e))}mapToInstance(e){return new Promise((t,r)=>{e().then(s=>t(s.map(i=>me.createInstance(i)))).catch(s=>r(s))})}preprocessQueryObject(e){var t;if(Object.values(e).length===0)return e;const r=((t=e.operations)==null?void 0:t.map(s=>{const i=s.value[0]??s.value;return Rn.isArrayOperator(s.operator)&&i instanceof me?{property:me.searchableArrayNameFor(s.property),operator:s.operator,value:Array.isArray(s.value)?s.value.map(o=>o.id):i.id,aggregate:s.aggregate}:{property:s.property,operator:s.operator,value:s.value instanceof me?{id:s.value.id}:s.value,aggregate:s.aggregate}}))??[];return{...e,operations:r}}};td.error={persistentNeedForSubCollection:"The document parameter for a sub-collection should be a Persistent instace",invalidQueryOrder:"Cannot add where calls after or calls"};let ni=td;class Xv{constructor(e){this.queryObject={operations:[]},this.model=e}where(e,t,r,s){var i,o,a;if((o=(i=this.queryObject.operations)==null?void 0:i.at(-1))!=null&&o.aggregate&&!s)throw new Error(ni.error.invalidQueryOrder);return(a=this.queryObject.operations)==null||a.push({property:e,operator:t,value:r,aggregate:s}),this}whereDeepProp(e,t,r,s){var i,o,a;if((o=(i=this.queryObject.operations)==null?void 0:i.at(-1))!=null&&o.aggregate&&!s)throw new Error(ni.error.invalidQueryOrder);const c=e.split(".");let u={},l=c.length>1?u:r;return c.slice(1).forEach((h,d)=>{u[h]=d<c.length-2?{}:r,u=u[h]}),(a=this.queryObject.operations)==null||a.push({property:c[0],operator:t,value:l,aggregate:s}),this}and(e,t,r){return this.where(e,t,r)}andDeepProp(e,t,r){return this.whereDeepProp(e,t,r)}or(e,t,r){return this.where(e,t,r,!0)}orDeepProp(e,t,r){return this.whereDeepProp(e,t,r,!0)}instanceOf(e){var t;const r=e instanceof me?e.className:e;return(t=this.queryObject.operations)==null||t.push({property:"__className",operator:"==",value:r}),this}get(e){return e&&(this.queryObject.limit=e),this.model.query(this.queryObject)}limit(e){return this.queryObject.limit=e,this}orderBy(e,t="asc"){return this.queryObject.sort={propertyName:e,order:t},this}orderByDeepProp(e,t="asc"){return this.queryObject.sort={propertyName:e,order:t},this}count(){return this.model.count(this.queryObject)}}const nd=class Mn{constructor(){}static useDataSource(e){this._dataSource=e}static get dataSource(){return Mn._dataSource}static getModel(e){if(!Mn._dataSource)throw new Error(this.error.shouldBeRegistered);return new ni(Mn._dataSource,e)}static getModelForSubCollection(e,t){if(!Mn._dataSource)throw new Error(this.error.shouldBeRegistered);return new ni(Mn._dataSource,e,t)}static async populate(e){if(!e)return;const t=async r=>{const s=r;if(!s.__documentReference)return r;const i=await this.getModel(s.__documentReference.storedInCollection).findById(s.id,r);return i&&(i.__documentReference=void 0),i};return Array.isArray(e)?(await Promise.all(e.map(r=>t(r)))).filter(r=>r):t(e)}static isPopulated(e){return Array.isArray(e)?e.reduce((t,r)=>t&&r.__documentReference===void 0,!0):e.__documentReference===void 0}};nd.error={shouldBeRegistered:"You should register a data source before using the data Store."};let Jv=nd;class Rn{installReferencePersistentPropsUpdaters(e,t=!0){this.onUpdate=e;const r=[],s=Rn.getSystemRegisteredReferencesWithStoredProps();return Object.entries(s).forEach(([i,o])=>{o.forEach(a=>{const c=this.documentChangeListerner(a,u=>this.onDocumentChange(u,a,i));if(c)r.push(c);else if(t)throw new Error("The method documentChangeListerner has not been implemented in the concrete data source")})}),r}documentChangeListerner(e,t){}static toPropertyPathOperations(e){return e?e.map(t=>{if(Rn.isArrayOperator(t.operator)&&t.value[0]instanceof me)return{property:me.searchableArrayNameFor(t.property),operator:t.operator,value:t.value.map(i=>i.id),aggregate:t.aggregate};const[r,s]=this.toPropertyPathValue(t.value);return{property:`${String(t.property)}${r?"."+r:""}`,operator:t.operator,value:s,aggregate:t.aggregate}}):[]}static isArrayOperator(e){return e==="containsAny"||e==="contains"}static toPropertyPathValue(e){if(typeof e=="object"&&!Array.isArray(e)){const t=Object.keys(e)[0],[r,s]=this.toPropertyPathValue(e[t]);return[`${t}${r?"."+r:""}`,s]}else return[void 0,e]}async onDocumentChange(e,t,r){if(!e.before||!t.forcedPersistentProps)return;const s=Jv.getModel(r);let i=s.find();t.forcedPersistentProps.forEach(a=>{const c=e.before[a],u=e.after[a];c!==u&&(i=i.orDeepProp(`${t.name}.${a}`,"==",c))});const o=await i.get();return Promise.all([o.map(async a=>{var c;(c=t.forcedPersistentProps)==null||c.forEach(async u=>{var l;const h=e.before[u],d=e.after[u];h!==d&&(a[`_${t.name}`][`_${u}`]=d,await s.save(a),(l=this.onUpdate)==null||l.call(this,a))})})])}static getSystemRegisteredReferencesWithStoredProps(){return me.registeredClasses().reduce((e,t)=>{const r=me.createInstance(t).getPersistentProperties().filter(s=>s.forcedPersistentProps);return r.length>0&&(e[t]=r),e},{})}}const rd=class xn{static registerCloudStorage(e,t){xn._cloudStorageFactoryMap[e]=t}static createInstance(e){const t=xn._cloudStorageFactoryMap[e];if(!t)throw new Error(`You should register the ${e} cloud storage provider prior to use it`);return t()}get className(){return this.__className}static useCloudStorage(e){xn._defaultCloudStorage=e}static get defaultCloudStorage(){if(!xn._defaultCloudStorage)throw new Error("You should define a default cloud storage provider prior to use it");return xn._defaultCloudStorage}};rd._cloudStorageFactoryMap={};let Pn=rd;function sd(n,e){return Pn.registerCloudStorage(n,e),t=>{t.prototype.__className=n}}var Zv=Object.defineProperty,eE=Object.getOwnPropertyDescriptor,tE=(n,e,t,r)=>{for(var s=r>1?void 0:r?eE(e,t):e,i=n.length-1,o;i>=0;i--)(o=n[i])&&(s=(r?o(e,t,s):o(s))||s);return r&&s&&Zv(e,t,s),s};let Ca=class extends Pn{constructor(n=""){super(),this._simulateDelay=0,this._pendingPromises=[],this.mockFileSystem={},this._pathToMockFiles=n}simulateDelay(n){return this._simulateDelay=n,this}resolveWithDelay(n){if(this._simulateDelay<=0)return Promise.resolve(n);const e=new Promise(t=>{setTimeout(()=>t(n),this._simulateDelay)});return this._pendingPromises.push(e),e.finally(()=>this._pendingPromises=this._pendingPromises.filter(t=>t===e)),e}save(n,e){const t=n;this._onProgress&&this._onProgress(0,100),this.mockFileSystem[n]=JSON.stringify(e),this._onProgress&&this._onProgress(100,100);const r=e instanceof File?e.name:t;return this.resolveWithDelay(r)}uploadControl(){return{resume:()=>{},pause:()=>{},cancel:()=>{},onProgress:n=>this._onProgress=n}}getUrl(n){return Promise.resolve(this._pathToMockFiles+n)}delete(n){return delete this.mockFileSystem[n],this.resolveWithDelay()}};Ca=tE([sd("MockCloudStorage",()=>new Ca)],Ca);var nE=Object.defineProperty,rE=Object.getOwnPropertyDescriptor,Sn=(n,e,t,r)=>{for(var s=r>1?void 0:r?rE(e,t):e,i=n.length-1,o;i>=0;i--)(o=n[i])&&(s=(r?o(e,t,s):o(s))||s);return r&&s&&nE(e,t,s),s};let Wt=class extends me{constructor(){super(...arguments),this._onChange=new Jh}async save({data:n,fileName:e,progress:t,cloudStorageProvider:r}={}){const s=n||this._pendingData;s&&(this._reference&&await this.delete(),this.provider=r||Pn.defaultCloudStorage,this._originalFileName=e||(s instanceof File?s.name:void 0),this._reference=await this.provider.save(this.id,s,t),this._url=await this.provider.getUrl(this._reference),this._pendingData=void 0,this._onChange.notify({event:0,storedFile:this}))}uploadControl(){return this.provider.uploadControl()}async delete(){if(!this._reference)throw new Error("Cannot delete a not stored file");await this.provider.delete(this._reference),this._reference=void 0,this._url=void 0,this._onChange.notify({event:2,storedFile:this})}set provider(n){this._provider=n,this._cloudStorageProviderName=n.className}get provider(){if(!this._provider)try{this._provider=Pn.createInstance(this._cloudStorageProviderName)}catch{this._provider=Pn.defaultCloudStorage}return this._provider}get url(){return this._url}get mimeType(){return this._mimeType}setDataToStore(n){return this._pendingData=n,this._originalFileName=n instanceof File?n.name:void 0,this._mimeType=n instanceof Blob?n.type:void 0,this._onChange.notify({event:1,pendingData:n,storedFile:this}),this}get originalFileName(){return this._originalFileName}onChange(n){return this._onChange.subscribe(n)}};Sn([An],Wt.prototype,"_reference",2),Sn([An],Wt.prototype,"_url",2),Sn([An],Wt.prototype,"_cloudStorageProviderName",2),Sn([An],Wt.prototype,"_originalFileName",2),Sn([An],Wt.prototype,"_mimeType",2),Wt=Sn([Yv("StoredFile")],Wt);class id{}const od=class Ee extends id{constructor(){if(super(),this._onAuthStateChange=new Jh,!Ee._authService)throw new Error(Ee.error.shouldBeRegistered);Ee._authService.onAuthStateChange(e=>this.authStateChanged(e))}static useAuthService(e){Ee._authService!=e&&(Ee._authService=e,this._instance=void 0)}static get instance(){return this._instance||(this._instance=new this)}signUp(e){return Ee._authService.signUp(e)}login(e){return Ee._authService.login(e)}logout(){return Ee._authService.logout()}resetEmailPassword(e){return Ee._authService.resetEmailPassword(e)}resendVerificationEmail(e,t,r){return Ee._authService.resendVerificationEmail(e,t,r)}refreshToken(){return Ee._authService.refreshToken()}onAuthStateChange(e){return this._onAuthStateChange.subscribe(e)}removeAuthStateChange(e){this._onAuthStateChange.unsubscribe(e)}linkAdditionalProvider(e){return Ee._authService.linkAdditionalProvider(e)}unlinkProvider(e){return Ee._authService.unlinkProvider(e)}authStateChanged(e){this._onAuthStateChange.notify(e)}};od.error={shouldBeRegistered:"You should register an auth service before using Auth."},od._instance=void 0;function ri(n){return n?n.replace(/([-_ ][\w])/g,e=>e.toUpperCase().replace("-","").replace("_","").replace(" ","")):""}var sE="firebase",iE="10.11.0";/**
1989
1989
  * @license
1990
1990
  * Copyright 2020 Google LLC
1991
1991
  *
@@ -2000,7 +2000,7 @@ This typically indicates that your device does not have a healthy Internet conne
2000
2000
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2001
2001
  * See the License for the specific language governing permissions and
2002
2002
  * limitations under the License.
2003
- */Ae(Bv,jv,"app");function Aa(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,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}typeof SuppressedError=="function"&&SuppressedError;function Kh(){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 $v=Kh,Qh=new Nn("auth","Firebase",Kh());/**
2003
+ */Se(sE,iE,"app");function ka(n,e){var t={};for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&e.indexOf(r)<0&&(t[r]=n[r]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(n);s<r.length;s++)e.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(n,r[s])&&(t[r[s]]=n[r[s]]);return t}typeof SuppressedError=="function"&&SuppressedError;function ad(){return{"dependent-sdk-initialized-before-auth":"Another Firebase SDK was initialized and is trying to use Auth before Auth is initialized. Please be sure to call `initializeAuth` or `getAuth` before starting any other Firebase SDK."}}const oE=ad,cd=new Un("auth","Firebase",ad());/**
2004
2004
  * @license
2005
2005
  * Copyright 2020 Google LLC
2006
2006
  *
@@ -2015,7 +2015,7 @@ This typically indicates that your device does not have a healthy Internet conne
2015
2015
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2016
2016
  * See the License for the specific language governing permissions and
2017
2017
  * limitations under the License.
2018
- */const ei=new Ii("@firebase/auth");function qv(t,...e){ei.logLevel<=N.WARN&&ei.warn(`Auth (${bt}): ${t}`,...e)}function ti(t,...e){ei.logLevel<=N.ERROR&&ei.error(`Auth (${bt}): ${t}`,...e)}/**
2018
+ */const si=new Si("@firebase/auth");function aE(n,...e){si.logLevel<=N.WARN&&si.warn(`Auth (${Nt}): ${n}`,...e)}function ii(n,...e){si.logLevel<=N.ERROR&&si.error(`Auth (${Nt}): ${n}`,...e)}/**
2019
2019
  * @license
2020
2020
  * Copyright 2020 Google LLC
2021
2021
  *
@@ -2030,7 +2030,7 @@ This typically indicates that your device does not have a healthy Internet conne
2030
2030
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2031
2031
  * See the License for the specific language governing permissions and
2032
2032
  * limitations under the License.
2033
- */function be(t,...e){throw Ra(t,...e)}function ze(t,...e){return Ra(t,...e)}function Yh(t,e,n){const r=Object.assign(Object.assign({},$v()),{[e]:n});return new Nn("auth","Firebase",r).create(e,{appName:t.name})}function Xh(t,e,n){const r=n;if(!(e instanceof r))throw r.name!==e.constructor.name&&be(t,"argument-error"),Yh(t,"argument-error",`Type of ${e.constructor.name} does not match expected instance.Did you pass a reference from a different Auth SDK?`)}function Ra(t,...e){if(typeof t!="string"){const n=e[0],r=[...e.slice(1)];return r[0]&&(r[0].appName=t.name),t._errorFactory.create(n,...r)}return Qh.create(t,...e)}function I(t,e,...n){if(!t)throw Ra(e,...n)}function tt(t){const e="INTERNAL ASSERTION FAILED: "+t;throw ti(e),new Error(e)}function nt(t,e){t||tt(e)}/**
2033
+ */function ke(n,...e){throw Na(n,...e)}function Le(n,...e){return Na(n,...e)}function Da(n,e,t){const r=Object.assign(Object.assign({},oE()),{[e]:t});return new Un("auth","Firebase",r).create(e,{appName:n.name})}function Ge(n){return Da(n,"operation-not-supported-in-this-environment","Operations that alter the current user are not supported in conjunction with FirebaseServerApp")}function ud(n,e,t){const r=t;if(!(e instanceof r))throw r.name!==e.constructor.name&&ke(n,"argument-error"),Da(n,"argument-error",`Type of ${e.constructor.name} does not match expected instance.Did you pass a reference from a different Auth SDK?`)}function Na(n,...e){if(typeof n!="string"){const t=e[0],r=[...e.slice(1)];return r[0]&&(r[0].appName=n.name),n._errorFactory.create(t,...r)}return cd.create(n,...e)}function I(n,e,...t){if(!n)throw Na(e,...t)}function st(n){const e="INTERNAL ASSERTION FAILED: "+n;throw ii(e),new Error(e)}function it(n,e){n||st(e)}/**
2034
2034
  * @license
2035
2035
  * Copyright 2020 Google LLC
2036
2036
  *
@@ -2045,7 +2045,7 @@ This typically indicates that your device does not have a healthy Internet conne
2045
2045
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2046
2046
  * See the License for the specific language governing permissions and
2047
2047
  * limitations under the License.
2048
- */function Pa(){var t;return typeof self<"u"&&((t=self.location)===null||t===void 0?void 0:t.href)||""}function zv(){return Jh()==="http:"||Jh()==="https:"}function Jh(){var t;return typeof self<"u"&&((t=self.location)===null||t===void 0?void 0:t.protocol)||null}/**
2048
+ */function Oa(){var n;return typeof self<"u"&&((n=self.location)===null||n===void 0?void 0:n.href)||""}function cE(){return ld()==="http:"||ld()==="https:"}function ld(){var n;return typeof self<"u"&&((n=self.location)===null||n===void 0?void 0:n.protocol)||null}/**
2049
2049
  * @license
2050
2050
  * Copyright 2020 Google LLC
2051
2051
  *
@@ -2060,7 +2060,7 @@ This typically indicates that your device does not have a healthy Internet conne
2060
2060
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2061
2061
  * See the License for the specific language governing permissions and
2062
2062
  * limitations under the License.
2063
- */function Hv(){return typeof navigator<"u"&&navigator&&"onLine"in navigator&&typeof navigator.onLine=="boolean"&&(zv()||jf()||"connection"in navigator)?navigator.onLine:!0}function Wv(){if(typeof navigator>"u")return null;const t=navigator;return t.languages&&t.languages[0]||t.language||null}/**
2063
+ */function uE(){return typeof navigator<"u"&&navigator&&"onLine"in navigator&&typeof navigator.onLine=="boolean"&&(cE()||np()||"connection"in navigator)?navigator.onLine:!0}function lE(){if(typeof navigator>"u")return null;const n=navigator;return n.languages&&n.languages[0]||n.language||null}/**
2064
2064
  * @license
2065
2065
  * Copyright 2020 Google LLC
2066
2066
  *
@@ -2075,7 +2075,7 @@ This typically indicates that your device does not have a healthy Internet conne
2075
2075
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2076
2076
  * See the License for the specific language governing permissions and
2077
2077
  * limitations under the License.
2078
- */class Cr{constructor(e,n){this.shortDelay=e,this.longDelay=n,nt(n>e,"Short delay should be less than long delay!"),this.isMobile=Ff()||$f()}get(){return Hv()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}}/**
2078
+ */class Lr{constructor(e,t){this.shortDelay=e,this.longDelay=t,it(t>e,"Short delay should be less than long delay!"),this.isMobile=ep()||rp()}get(){return uE()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}}/**
2079
2079
  * @license
2080
2080
  * Copyright 2020 Google LLC
2081
2081
  *
@@ -2090,7 +2090,7 @@ This typically indicates that your device does not have a healthy Internet conne
2090
2090
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2091
2091
  * See the License for the specific language governing permissions and
2092
2092
  * limitations under the License.
2093
- */function Sa(t,e){nt(t.emulator,"Emulator should always be set here");const{url:n}=t.emulator;return e?`${n}${e.startsWith("/")?e.slice(1):e}`:n}/**
2093
+ */function Va(n,e){it(n.emulator,"Emulator should always be set here");const{url:t}=n.emulator;return e?`${t}${e.startsWith("/")?e.slice(1):e}`:t}/**
2094
2094
  * @license
2095
2095
  * Copyright 2020 Google LLC
2096
2096
  *
@@ -2105,7 +2105,7 @@ This typically indicates that your device does not have a healthy Internet conne
2105
2105
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2106
2106
  * See the License for the specific language governing permissions and
2107
2107
  * limitations under the License.
2108
- */class Zh{static initialize(e,n,r){this.fetchImpl=e,n&&(this.headersImpl=n),r&&(this.responseImpl=r)}static fetch(){if(this.fetchImpl)return this.fetchImpl;if(typeof self<"u"&&"fetch"in self)return self.fetch;if(typeof globalThis<"u"&&globalThis.fetch)return globalThis.fetch;if(typeof fetch<"u")return fetch;tt("Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static headers(){if(this.headersImpl)return this.headersImpl;if(typeof self<"u"&&"Headers"in self)return self.Headers;if(typeof globalThis<"u"&&globalThis.Headers)return globalThis.Headers;if(typeof Headers<"u")return Headers;tt("Could not find Headers implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static response(){if(this.responseImpl)return this.responseImpl;if(typeof self<"u"&&"Response"in self)return self.Response;if(typeof globalThis<"u"&&globalThis.Response)return globalThis.Response;if(typeof Response<"u")return Response;tt("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}}/**
2108
+ */class hd{static initialize(e,t,r){this.fetchImpl=e,t&&(this.headersImpl=t),r&&(this.responseImpl=r)}static fetch(){if(this.fetchImpl)return this.fetchImpl;if(typeof self<"u"&&"fetch"in self)return self.fetch;if(typeof globalThis<"u"&&globalThis.fetch)return globalThis.fetch;if(typeof fetch<"u")return fetch;st("Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static headers(){if(this.headersImpl)return this.headersImpl;if(typeof self<"u"&&"Headers"in self)return self.Headers;if(typeof globalThis<"u"&&globalThis.Headers)return globalThis.Headers;if(typeof Headers<"u")return Headers;st("Could not find Headers implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static response(){if(this.responseImpl)return this.responseImpl;if(typeof self<"u"&&"Response"in self)return self.Response;if(typeof globalThis<"u"&&globalThis.Response)return globalThis.Response;if(typeof Response<"u")return Response;st("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}}/**
2109
2109
  * @license
2110
2110
  * Copyright 2020 Google LLC
2111
2111
  *
@@ -2120,7 +2120,7 @@ This typically indicates that your device does not have a healthy Internet conne
2120
2120
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2121
2121
  * See the License for the specific language governing permissions and
2122
2122
  * limitations under the License.
2123
- */const Gv={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",INVALID_LOGIN_CREDENTIALS:"invalid-credential",EMAIL_EXISTS:"email-already-in-use",PASSWORD_LOGIN_DISABLED:"operation-not-allowed",INVALID_IDP_RESPONSE:"invalid-credential",INVALID_PENDING_TOKEN:"invalid-credential",FEDERATED_USER_ID_ALREADY_LINKED:"credential-already-in-use",MISSING_REQ_TYPE:"internal-error",EMAIL_NOT_FOUND:"user-not-found",RESET_PASSWORD_EXCEED_LIMIT:"too-many-requests",EXPIRED_OOB_CODE:"expired-action-code",INVALID_OOB_CODE:"invalid-action-code",MISSING_OOB_CODE:"internal-error",CREDENTIAL_TOO_OLD_LOGIN_AGAIN:"requires-recent-login",INVALID_ID_TOKEN:"invalid-user-token",TOKEN_EXPIRED:"user-token-expired",USER_NOT_FOUND:"user-token-expired",TOO_MANY_ATTEMPTS_TRY_LATER:"too-many-requests",PASSWORD_DOES_NOT_MEET_REQUIREMENTS:"password-does-not-meet-requirements",INVALID_CODE:"invalid-verification-code",INVALID_SESSION_INFO:"invalid-verification-id",INVALID_TEMPORARY_PROOF:"invalid-credential",MISSING_SESSION_INFO:"missing-verification-id",SESSION_EXPIRED:"code-expired",MISSING_ANDROID_PACKAGE_NAME:"missing-android-pkg-name",UNAUTHORIZED_DOMAIN:"unauthorized-continue-uri",INVALID_OAUTH_CLIENT_ID:"invalid-oauth-client-id",ADMIN_ONLY_OPERATION:"admin-restricted-operation",INVALID_MFA_PENDING_CREDENTIAL:"invalid-multi-factor-session",MFA_ENROLLMENT_NOT_FOUND:"multi-factor-info-not-found",MISSING_MFA_ENROLLMENT_ID:"missing-multi-factor-info",MISSING_MFA_PENDING_CREDENTIAL:"missing-multi-factor-session",SECOND_FACTOR_EXISTS:"second-factor-already-in-use",SECOND_FACTOR_LIMIT_EXCEEDED:"maximum-second-factor-count-exceeded",BLOCKING_FUNCTION_ERROR_RESPONSE:"internal-error",RECAPTCHA_NOT_ENABLED:"recaptcha-not-enabled",MISSING_RECAPTCHA_TOKEN:"missing-recaptcha-token",INVALID_RECAPTCHA_TOKEN:"invalid-recaptcha-token",INVALID_RECAPTCHA_ACTION:"invalid-recaptcha-action",MISSING_CLIENT_TYPE:"missing-client-type",MISSING_RECAPTCHA_VERSION:"missing-recaptcha-version",INVALID_RECAPTCHA_VERSION:"invalid-recaptcha-version",INVALID_REQ_TYPE:"invalid-req-type"};/**
2123
+ */const hE={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",INVALID_LOGIN_CREDENTIALS:"invalid-credential",EMAIL_EXISTS:"email-already-in-use",PASSWORD_LOGIN_DISABLED:"operation-not-allowed",INVALID_IDP_RESPONSE:"invalid-credential",INVALID_PENDING_TOKEN:"invalid-credential",FEDERATED_USER_ID_ALREADY_LINKED:"credential-already-in-use",MISSING_REQ_TYPE:"internal-error",EMAIL_NOT_FOUND:"user-not-found",RESET_PASSWORD_EXCEED_LIMIT:"too-many-requests",EXPIRED_OOB_CODE:"expired-action-code",INVALID_OOB_CODE:"invalid-action-code",MISSING_OOB_CODE:"internal-error",CREDENTIAL_TOO_OLD_LOGIN_AGAIN:"requires-recent-login",INVALID_ID_TOKEN:"invalid-user-token",TOKEN_EXPIRED:"user-token-expired",USER_NOT_FOUND:"user-token-expired",TOO_MANY_ATTEMPTS_TRY_LATER:"too-many-requests",PASSWORD_DOES_NOT_MEET_REQUIREMENTS:"password-does-not-meet-requirements",INVALID_CODE:"invalid-verification-code",INVALID_SESSION_INFO:"invalid-verification-id",INVALID_TEMPORARY_PROOF:"invalid-credential",MISSING_SESSION_INFO:"missing-verification-id",SESSION_EXPIRED:"code-expired",MISSING_ANDROID_PACKAGE_NAME:"missing-android-pkg-name",UNAUTHORIZED_DOMAIN:"unauthorized-continue-uri",INVALID_OAUTH_CLIENT_ID:"invalid-oauth-client-id",ADMIN_ONLY_OPERATION:"admin-restricted-operation",INVALID_MFA_PENDING_CREDENTIAL:"invalid-multi-factor-session",MFA_ENROLLMENT_NOT_FOUND:"multi-factor-info-not-found",MISSING_MFA_ENROLLMENT_ID:"missing-multi-factor-info",MISSING_MFA_PENDING_CREDENTIAL:"missing-multi-factor-session",SECOND_FACTOR_EXISTS:"second-factor-already-in-use",SECOND_FACTOR_LIMIT_EXCEEDED:"maximum-second-factor-count-exceeded",BLOCKING_FUNCTION_ERROR_RESPONSE:"internal-error",RECAPTCHA_NOT_ENABLED:"recaptcha-not-enabled",MISSING_RECAPTCHA_TOKEN:"missing-recaptcha-token",INVALID_RECAPTCHA_TOKEN:"invalid-recaptcha-token",INVALID_RECAPTCHA_ACTION:"invalid-recaptcha-action",MISSING_CLIENT_TYPE:"missing-client-type",MISSING_RECAPTCHA_VERSION:"missing-recaptcha-version",INVALID_RECAPTCHA_VERSION:"invalid-recaptcha-version",INVALID_REQ_TYPE:"invalid-req-type"};/**
2124
2124
  * @license
2125
2125
  * Copyright 2020 Google LLC
2126
2126
  *
@@ -2135,7 +2135,7 @@ This typically indicates that your device does not have a healthy Internet conne
2135
2135
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2136
2136
  * See the License for the specific language governing permissions and
2137
2137
  * limitations under the License.
2138
- */const Kv=new Cr(3e4,6e4);function rt(t,e){return t.tenantId&&!e.tenantId?Object.assign(Object.assign({},e),{tenantId:t.tenantId}):e}async function Oe(t,e,n,r,s={}){return ed(t,s,async()=>{let i={},o={};r&&(e==="GET"?o=r:i={body:JSON.stringify(r)});const a=On(Object.assign({key:t.config.apiKey},o)).slice(1),c=await t._getAdditionalHeaders();return c["Content-Type"]="application/json",t.languageCode&&(c["X-Firebase-Locale"]=t.languageCode),Zh.fetch()(td(t,t.config.apiHost,n,a),Object.assign({method:e,headers:c,referrerPolicy:"no-referrer"},i))})}async function ed(t,e,n){t._canInitEmulator=!1;const r=Object.assign(Object.assign({},Gv),e);try{const s=new Yv(t),i=await Promise.race([n(),s.promise]);s.clearNetworkTimeout();const o=await i.json();if("needConfirmation"in o)throw ni(t,"account-exists-with-different-credential",o);if(i.ok&&!("errorMessage"in o))return o;{const a=i.ok?o.errorMessage:o.error.message,[c,u]=a.split(" : ");if(c==="FEDERATED_USER_ID_ALREADY_LINKED")throw ni(t,"credential-already-in-use",o);if(c==="EMAIL_EXISTS")throw ni(t,"email-already-in-use",o);if(c==="USER_DISABLED")throw ni(t,"user-disabled",o);const l=r[c]||c.toLowerCase().replace(/[_\s]+/g,"-");if(u)throw Yh(t,l,u);be(t,l)}}catch(s){if(s instanceof Ce)throw s;be(t,"network-request-failed",{message:String(s)})}}async function kr(t,e,n,r,s={}){const i=await Oe(t,e,n,r,s);return"mfaPendingCredential"in i&&be(t,"multi-factor-auth-required",{_serverResponse:i}),i}function td(t,e,n,r){const s=`${e}${n}?${r}`;return t.config.emulator?Sa(t.config,s):`${t.config.apiScheme}://${s}`}function Qv(t){switch(t){case"ENFORCE":return"ENFORCE";case"AUDIT":return"AUDIT";case"OFF":return"OFF";default:return"ENFORCEMENT_STATE_UNSPECIFIED"}}class Yv{constructor(e){this.auth=e,this.timer=null,this.promise=new Promise((n,r)=>{this.timer=setTimeout(()=>r(ze(this.auth,"network-request-failed")),Kv.get())})}clearNetworkTimeout(){clearTimeout(this.timer)}}function ni(t,e,n){const r={appName:t.name};n.email&&(r.email=n.email),n.phoneNumber&&(r.phoneNumber=n.phoneNumber);const s=ze(t,e,r);return s.customData._tokenResponse=n,s}function nd(t){return t!==void 0&&t.enterprise!==void 0}class Xv{constructor(e){if(this.siteKey="",this.recaptchaEnforcementState=[],e.recaptchaKey===void 0)throw new Error("recaptchaKey undefined");this.siteKey=e.recaptchaKey.split("/")[3],this.recaptchaEnforcementState=e.recaptchaEnforcementState}getProviderEnforcementState(e){if(!this.recaptchaEnforcementState||this.recaptchaEnforcementState.length===0)return null;for(const n of this.recaptchaEnforcementState)if(n.provider&&n.provider===e)return Qv(n.enforcementState);return null}isProviderEnabled(e){return this.getProviderEnforcementState(e)==="ENFORCE"||this.getProviderEnforcementState(e)==="AUDIT"}}async function Jv(t,e){return Oe(t,"GET","/v2/recaptchaConfig",rt(t,e))}/**
2138
+ */const dE=new Lr(3e4,6e4);function ot(n,e){return n.tenantId&&!e.tenantId?Object.assign(Object.assign({},e),{tenantId:n.tenantId}):e}async function Me(n,e,t,r,s={}){return dd(n,s,async()=>{let i={},o={};r&&(e==="GET"?o=r:i={body:JSON.stringify(r)});const a=Fn(Object.assign({key:n.config.apiKey},o)).slice(1),c=await n._getAdditionalHeaders();return c["Content-Type"]="application/json",n.languageCode&&(c["X-Firebase-Locale"]=n.languageCode),hd.fetch()(fd(n,n.config.apiHost,t,a),Object.assign({method:e,headers:c,referrerPolicy:"no-referrer"},i))})}async function dd(n,e,t){n._canInitEmulator=!1;const r=Object.assign(Object.assign({},hE),e);try{const s=new pE(n),i=await Promise.race([t(),s.promise]);s.clearNetworkTimeout();const o=await i.json();if("needConfirmation"in o)throw oi(n,"account-exists-with-different-credential",o);if(i.ok&&!("errorMessage"in o))return o;{const a=i.ok?o.errorMessage:o.error.message,[c,u]=a.split(" : ");if(c==="FEDERATED_USER_ID_ALREADY_LINKED")throw oi(n,"credential-already-in-use",o);if(c==="EMAIL_EXISTS")throw oi(n,"email-already-in-use",o);if(c==="USER_DISABLED")throw oi(n,"user-disabled",o);const l=r[c]||c.toLowerCase().replace(/[_\s]+/g,"-");if(u)throw Da(n,l,u);ke(n,l)}}catch(s){if(s instanceof De)throw s;ke(n,"network-request-failed",{message:String(s)})}}async function Mr(n,e,t,r,s={}){const i=await Me(n,e,t,r,s);return"mfaPendingCredential"in i&&ke(n,"multi-factor-auth-required",{_serverResponse:i}),i}function fd(n,e,t,r){const s=`${e}${t}?${r}`;return n.config.emulator?Va(n.config,s):`${n.config.apiScheme}://${s}`}function fE(n){switch(n){case"ENFORCE":return"ENFORCE";case"AUDIT":return"AUDIT";case"OFF":return"OFF";default:return"ENFORCEMENT_STATE_UNSPECIFIED"}}class pE{constructor(e){this.auth=e,this.timer=null,this.promise=new Promise((t,r)=>{this.timer=setTimeout(()=>r(Le(this.auth,"network-request-failed")),dE.get())})}clearNetworkTimeout(){clearTimeout(this.timer)}}function oi(n,e,t){const r={appName:n.name};t.email&&(r.email=t.email),t.phoneNumber&&(r.phoneNumber=t.phoneNumber);const s=Le(n,e,r);return s.customData._tokenResponse=t,s}function pd(n){return n!==void 0&&n.enterprise!==void 0}class mE{constructor(e){if(this.siteKey="",this.recaptchaEnforcementState=[],e.recaptchaKey===void 0)throw new Error("recaptchaKey undefined");this.siteKey=e.recaptchaKey.split("/")[3],this.recaptchaEnforcementState=e.recaptchaEnforcementState}getProviderEnforcementState(e){if(!this.recaptchaEnforcementState||this.recaptchaEnforcementState.length===0)return null;for(const t of this.recaptchaEnforcementState)if(t.provider&&t.provider===e)return fE(t.enforcementState);return null}isProviderEnabled(e){return this.getProviderEnforcementState(e)==="ENFORCE"||this.getProviderEnforcementState(e)==="AUDIT"}}async function gE(n,e){return Me(n,"GET","/v2/recaptchaConfig",ot(n,e))}/**
2139
2139
  * @license
2140
2140
  * Copyright 2020 Google LLC
2141
2141
  *
@@ -2150,7 +2150,7 @@ This typically indicates that your device does not have a healthy Internet conne
2150
2150
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2151
2151
  * See the License for the specific language governing permissions and
2152
2152
  * limitations under the License.
2153
- */async function Zv(t,e){return Oe(t,"POST","/v1/accounts:delete",e)}async function eE(t,e){return Oe(t,"POST","/v1/accounts:update",e)}async function tE(t,e){return Oe(t,"POST","/v1/accounts:lookup",e)}/**
2153
+ */async function _E(n,e){return Me(n,"POST","/v1/accounts:delete",e)}async function yE(n,e){return Me(n,"POST","/v1/accounts:update",e)}async function md(n,e){return Me(n,"POST","/v1/accounts:lookup",e)}/**
2154
2154
  * @license
2155
2155
  * Copyright 2020 Google LLC
2156
2156
  *
@@ -2165,7 +2165,7 @@ This typically indicates that your device does not have a healthy Internet conne
2165
2165
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2166
2166
  * See the License for the specific language governing permissions and
2167
2167
  * limitations under the License.
2168
- */function Dr(t){if(t)try{const e=new Date(Number(t));if(!isNaN(e.getTime()))return e.toUTCString()}catch{}}async function nE(t,e=!1){const n=x(t),r=await n.getIdToken(e),s=Ca(r);I(s&&s.exp&&s.auth_time&&s.iat,n.auth,"internal-error");const i=typeof s.firebase=="object"?s.firebase:void 0,o=i==null?void 0:i.sign_in_provider;return{claims:s,token:r,authTime:Dr(ba(s.auth_time)),issuedAtTime:Dr(ba(s.iat)),expirationTime:Dr(ba(s.exp)),signInProvider:o||null,signInSecondFactor:(i==null?void 0:i.sign_in_second_factor)||null}}function ba(t){return Number(t)*1e3}function Ca(t){const[e,n,r]=t.split(".");if(e===void 0||n===void 0||r===void 0)return ti("JWT malformed, contained fewer than 3 sections"),null;try{const s=tc(n);return s?JSON.parse(s):(ti("Failed to decode base64 JWT payload"),null)}catch(s){return ti("Caught error parsing JWT payload as JSON",s==null?void 0:s.toString()),null}}function rE(t){const e=Ca(t);return I(e,"internal-error"),I(typeof e.exp<"u","internal-error"),I(typeof e.iat<"u","internal-error"),Number(e.exp)-Number(e.iat)}/**
2168
+ */function xr(n){if(n)try{const e=new Date(Number(n));if(!isNaN(e.getTime()))return e.toUTCString()}catch{}}async function vE(n,e=!1){const t=x(n),r=await t.getIdToken(e),s=Ma(r);I(s&&s.exp&&s.auth_time&&s.iat,t.auth,"internal-error");const i=typeof s.firebase=="object"?s.firebase:void 0,o=i==null?void 0:i.sign_in_provider;return{claims:s,token:r,authTime:xr(La(s.auth_time)),issuedAtTime:xr(La(s.iat)),expirationTime:xr(La(s.exp)),signInProvider:o||null,signInSecondFactor:(i==null?void 0:i.sign_in_second_factor)||null}}function La(n){return Number(n)*1e3}function Ma(n){const[e,t,r]=n.split(".");if(e===void 0||t===void 0||r===void 0)return ii("JWT malformed, contained fewer than 3 sections"),null;try{const s=uc(t);return s?JSON.parse(s):(ii("Failed to decode base64 JWT payload"),null)}catch(s){return ii("Caught error parsing JWT payload as JSON",s==null?void 0:s.toString()),null}}function gd(n){const e=Ma(n);return I(e,"internal-error"),I(typeof e.exp<"u","internal-error"),I(typeof e.iat<"u","internal-error"),Number(e.exp)-Number(e.iat)}/**
2169
2169
  * @license
2170
2170
  * Copyright 2020 Google LLC
2171
2171
  *
@@ -2180,7 +2180,7 @@ This typically indicates that your device does not have a healthy Internet conne
2180
2180
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2181
2181
  * See the License for the specific language governing permissions and
2182
2182
  * limitations under the License.
2183
- */async function An(t,e,n=!1){if(n)return e;try{return await e}catch(r){throw r instanceof Ce&&sE(r)&&t.auth.currentUser===t&&await t.auth.signOut(),r}}function sE({code:t}){return t==="auth/user-disabled"||t==="auth/user-token-expired"}/**
2183
+ */async function bn(n,e,t=!1){if(t)return e;try{return await e}catch(r){throw r instanceof De&&EE(r)&&n.auth.currentUser===n&&await n.auth.signOut(),r}}function EE({code:n}){return n==="auth/user-disabled"||n==="auth/user-token-expired"}/**
2184
2184
  * @license
2185
2185
  * Copyright 2020 Google LLC
2186
2186
  *
@@ -2195,7 +2195,7 @@ This typically indicates that your device does not have a healthy Internet conne
2195
2195
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2196
2196
  * See the License for the specific language governing permissions and
2197
2197
  * limitations under the License.
2198
- */class iE{constructor(e){this.user=e,this.isRunning=!1,this.timerId=null,this.errorBackoff=3e4}_start(){this.isRunning||(this.isRunning=!0,this.schedule())}_stop(){this.isRunning&&(this.isRunning=!1,this.timerId!==null&&clearTimeout(this.timerId))}getInterval(e){var n;if(e){const r=this.errorBackoff;return this.errorBackoff=Math.min(this.errorBackoff*2,96e4),r}else{this.errorBackoff=3e4;const s=((n=this.user.stsTokenManager.expirationTime)!==null&&n!==void 0?n:0)-Date.now()-3e5;return Math.max(0,s)}}schedule(e=!1){if(!this.isRunning)return;const n=this.getInterval(e);this.timerId=setTimeout(async()=>{await this.iteration()},n)}async iteration(){try{await this.user.getIdToken(!0)}catch(e){(e==null?void 0:e.code)==="auth/network-request-failed"&&this.schedule(!0);return}this.schedule()}}/**
2198
+ */class TE{constructor(e){this.user=e,this.isRunning=!1,this.timerId=null,this.errorBackoff=3e4}_start(){this.isRunning||(this.isRunning=!0,this.schedule())}_stop(){this.isRunning&&(this.isRunning=!1,this.timerId!==null&&clearTimeout(this.timerId))}getInterval(e){var t;if(e){const r=this.errorBackoff;return this.errorBackoff=Math.min(this.errorBackoff*2,96e4),r}else{this.errorBackoff=3e4;const s=((t=this.user.stsTokenManager.expirationTime)!==null&&t!==void 0?t:0)-Date.now()-3e5;return Math.max(0,s)}}schedule(e=!1){if(!this.isRunning)return;const t=this.getInterval(e);this.timerId=setTimeout(async()=>{await this.iteration()},t)}async iteration(){try{await this.user.getIdToken(!0)}catch(e){(e==null?void 0:e.code)==="auth/network-request-failed"&&this.schedule(!0);return}this.schedule()}}/**
2199
2199
  * @license
2200
2200
  * Copyright 2020 Google LLC
2201
2201
  *
@@ -2210,7 +2210,7 @@ This typically indicates that your device does not have a healthy Internet conne
2210
2210
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2211
2211
  * See the License for the specific language governing permissions and
2212
2212
  * limitations under the License.
2213
- */class rd{constructor(e,n){this.createdAt=e,this.lastLoginAt=n,this._initializeTime()}_initializeTime(){this.lastSignInTime=Dr(this.lastLoginAt),this.creationTime=Dr(this.createdAt)}_copy(e){this.createdAt=e.createdAt,this.lastLoginAt=e.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}}/**
2213
+ */class xa{constructor(e,t){this.createdAt=e,this.lastLoginAt=t,this._initializeTime()}_initializeTime(){this.lastSignInTime=xr(this.lastLoginAt),this.creationTime=xr(this.createdAt)}_copy(e){this.createdAt=e.createdAt,this.lastLoginAt=e.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}}/**
2214
2214
  * @license
2215
2215
  * Copyright 2019 Google LLC
2216
2216
  *
@@ -2225,7 +2225,7 @@ This typically indicates that your device does not have a healthy Internet conne
2225
2225
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2226
2226
  * See the License for the specific language governing permissions and
2227
2227
  * limitations under the License.
2228
- */async function Nr(t){var e;const n=t.auth,r=await t.getIdToken(),s=await An(t,tE(n,{idToken:r}));I(s==null?void 0:s.users.length,n,"internal-error");const i=s.users[0];t._notifyReloadListener(i);const o=!((e=i.providerUserInfo)===null||e===void 0)&&e.length?cE(i.providerUserInfo):[],a=aE(t.providerData,o),c=t.isAnonymous,u=!(t.email&&i.passwordHash)&&!(a!=null&&a.length),l=c?u:!1,h={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 rd(i.createdAt,i.lastLoginAt),isAnonymous:l};Object.assign(t,h)}async function oE(t){const e=x(t);await Nr(e),await e.auth._persistUserIfCurrent(e),e.auth._notifyListenersIfCurrent(e)}function aE(t,e){return[...t.filter(r=>!e.some(s=>s.providerId===r.providerId)),...e]}function cE(t){return t.map(e=>{var{providerId:n}=e,r=Aa(e,["providerId"]);return{providerId:n,uid:r.rawId||"",displayName:r.displayName||null,email:r.email||null,phoneNumber:r.phoneNumber||null,photoURL:r.photoUrl||null}})}/**
2228
+ */async function Ur(n){var e;const t=n.auth,r=await n.getIdToken(),s=await bn(n,md(t,{idToken:r}));I(s==null?void 0:s.users.length,t,"internal-error");const i=s.users[0];n._notifyReloadListener(i);const o=!((e=i.providerUserInfo)===null||e===void 0)&&e.length?_d(i.providerUserInfo):[],a=IE(n.providerData,o),c=n.isAnonymous,u=!(n.email&&i.passwordHash)&&!(a!=null&&a.length),l=c?u:!1,h={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 xa(i.createdAt,i.lastLoginAt),isAnonymous:l};Object.assign(n,h)}async function wE(n){const e=x(n);await Ur(e),await e.auth._persistUserIfCurrent(e),e.auth._notifyListenersIfCurrent(e)}function IE(n,e){return[...n.filter(r=>!e.some(s=>s.providerId===r.providerId)),...e]}function _d(n){return n.map(e=>{var{providerId:t}=e,r=ka(e,["providerId"]);return{providerId:t,uid:r.rawId||"",displayName:r.displayName||null,email:r.email||null,phoneNumber:r.phoneNumber||null,photoURL:r.photoUrl||null}})}/**
2229
2229
  * @license
2230
2230
  * Copyright 2020 Google LLC
2231
2231
  *
@@ -2240,7 +2240,7 @@ This typically indicates that your device does not have a healthy Internet conne
2240
2240
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2241
2241
  * See the License for the specific language governing permissions and
2242
2242
  * limitations under the License.
2243
- */async function uE(t,e){const n=await ed(t,{},async()=>{const r=On({grant_type:"refresh_token",refresh_token:e}).slice(1),{tokenApiHost:s,apiKey:i}=t.config,o=td(t,s,"/v1/token",`key=${i}`),a=await t._getAdditionalHeaders();return a["Content-Type"]="application/x-www-form-urlencoded",Zh.fetch()(o,{method:"POST",headers:a,body:r})});return{accessToken:n.access_token,expiresIn:n.expires_in,refreshToken:n.refresh_token}}async function lE(t,e){return Oe(t,"POST","/v2/accounts:revokeToken",rt(t,e))}/**
2243
+ */async function AE(n,e){const t=await dd(n,{},async()=>{const r=Fn({grant_type:"refresh_token",refresh_token:e}).slice(1),{tokenApiHost:s,apiKey:i}=n.config,o=fd(n,s,"/v1/token",`key=${i}`),a=await n._getAdditionalHeaders();return a["Content-Type"]="application/x-www-form-urlencoded",hd.fetch()(o,{method:"POST",headers:a,body:r})});return{accessToken:t.access_token,expiresIn:t.expires_in,refreshToken:t.refresh_token}}async function RE(n,e){return Me(n,"POST","/v2/accounts:revokeToken",ot(n,e))}/**
2244
2244
  * @license
2245
2245
  * Copyright 2020 Google LLC
2246
2246
  *
@@ -2255,7 +2255,7 @@ This typically indicates that your device does not have a healthy Internet conne
2255
2255
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2256
2256
  * See the License for the specific language governing permissions and
2257
2257
  * limitations under the License.
2258
- */class Or{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(e){I(e.idToken,"internal-error"),I(typeof e.idToken<"u","internal-error"),I(typeof e.refreshToken<"u","internal-error");const n="expiresIn"in e&&typeof e.expiresIn<"u"?Number(e.expiresIn):rE(e.idToken);this.updateTokensAndExpiration(e.idToken,e.refreshToken,n)}async getToken(e,n=!1){return I(!this.accessToken||this.refreshToken,e,"user-token-expired"),!n&&this.accessToken&&!this.isExpired?this.accessToken:this.refreshToken?(await this.refresh(e,this.refreshToken),this.accessToken):null}clearRefreshToken(){this.refreshToken=null}async refresh(e,n){const{accessToken:r,refreshToken:s,expiresIn:i}=await uE(e,n);this.updateTokensAndExpiration(r,s,Number(i))}updateTokensAndExpiration(e,n,r){this.refreshToken=n||null,this.accessToken=e||null,this.expirationTime=Date.now()+r*1e3}static fromJSON(e,n){const{refreshToken:r,accessToken:s,expirationTime:i}=n,o=new Or;return r&&(I(typeof r=="string","internal-error",{appName:e}),o.refreshToken=r),s&&(I(typeof s=="string","internal-error",{appName:e}),o.accessToken=s),i&&(I(typeof i=="number","internal-error",{appName:e}),o.expirationTime=i),o}toJSON(){return{refreshToken:this.refreshToken,accessToken:this.accessToken,expirationTime:this.expirationTime}}_assign(e){this.accessToken=e.accessToken,this.refreshToken=e.refreshToken,this.expirationTime=e.expirationTime}_clone(){return Object.assign(new Or,this.toJSON())}_performRefresh(){return tt("not implemented")}}/**
2258
+ */class Cn{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(e){I(e.idToken,"internal-error"),I(typeof e.idToken<"u","internal-error"),I(typeof e.refreshToken<"u","internal-error");const t="expiresIn"in e&&typeof e.expiresIn<"u"?Number(e.expiresIn):gd(e.idToken);this.updateTokensAndExpiration(e.idToken,e.refreshToken,t)}updateFromIdToken(e){I(e.length!==0,"internal-error");const t=gd(e);this.updateTokensAndExpiration(e,null,t)}async getToken(e,t=!1){return!t&&this.accessToken&&!this.isExpired?this.accessToken:(I(this.refreshToken,e,"user-token-expired"),this.refreshToken?(await this.refresh(e,this.refreshToken),this.accessToken):null)}clearRefreshToken(){this.refreshToken=null}async refresh(e,t){const{accessToken:r,refreshToken:s,expiresIn:i}=await AE(e,t);this.updateTokensAndExpiration(r,s,Number(i))}updateTokensAndExpiration(e,t,r){this.refreshToken=t||null,this.accessToken=e||null,this.expirationTime=Date.now()+r*1e3}static fromJSON(e,t){const{refreshToken:r,accessToken:s,expirationTime:i}=t,o=new Cn;return r&&(I(typeof r=="string","internal-error",{appName:e}),o.refreshToken=r),s&&(I(typeof s=="string","internal-error",{appName:e}),o.accessToken=s),i&&(I(typeof i=="number","internal-error",{appName:e}),o.expirationTime=i),o}toJSON(){return{refreshToken:this.refreshToken,accessToken:this.accessToken,expirationTime:this.expirationTime}}_assign(e){this.accessToken=e.accessToken,this.refreshToken=e.refreshToken,this.expirationTime=e.expirationTime}_clone(){return Object.assign(new Cn,this.toJSON())}_performRefresh(){return st("not implemented")}}/**
2259
2259
  * @license
2260
2260
  * Copyright 2020 Google LLC
2261
2261
  *
@@ -2270,7 +2270,7 @@ This typically indicates that your device does not have a healthy Internet conne
2270
2270
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2271
2271
  * See the License for the specific language governing permissions and
2272
2272
  * limitations under the License.
2273
- */function Tt(t,e){I(typeof t=="string"||typeof t>"u","internal-error",{appName:e})}class qt{constructor(e){var{uid:n,auth:r,stsTokenManager:s}=e,i=Aa(e,["uid","auth","stsTokenManager"]);this.providerId="firebase",this.proactiveRefresh=new iE(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=n,this.auth=r,this.stsTokenManager=s,this.accessToken=s.accessToken,this.displayName=i.displayName||null,this.email=i.email||null,this.emailVerified=i.emailVerified||!1,this.phoneNumber=i.phoneNumber||null,this.photoURL=i.photoURL||null,this.isAnonymous=i.isAnonymous||!1,this.tenantId=i.tenantId||null,this.providerData=i.providerData?[...i.providerData]:[],this.metadata=new rd(i.createdAt||void 0,i.lastLoginAt||void 0)}async getIdToken(e){const n=await An(this,this.stsTokenManager.getToken(this.auth,e));return I(n,this.auth,"internal-error"),this.accessToken!==n&&(this.accessToken=n,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),n}getIdTokenResult(e){return nE(this,e)}reload(){return oE(this)}_assign(e){this!==e&&(I(this.uid===e.uid,this.auth,"internal-error"),this.displayName=e.displayName,this.photoURL=e.photoURL,this.email=e.email,this.emailVerified=e.emailVerified,this.phoneNumber=e.phoneNumber,this.isAnonymous=e.isAnonymous,this.tenantId=e.tenantId,this.providerData=e.providerData.map(n=>Object.assign({},n)),this.metadata._copy(e.metadata),this.stsTokenManager._assign(e.stsTokenManager))}_clone(e){const n=new qt(Object.assign(Object.assign({},this),{auth:e,stsTokenManager:this.stsTokenManager._clone()}));return n.metadata._copy(this.metadata),n}_onReload(e){I(!this.reloadListener,this.auth,"internal-error"),this.reloadListener=e,this.reloadUserInfo&&(this._notifyReloadListener(this.reloadUserInfo),this.reloadUserInfo=null)}_notifyReloadListener(e){this.reloadListener?this.reloadListener(e):this.reloadUserInfo=e}_startProactiveRefresh(){this.proactiveRefresh._start()}_stopProactiveRefresh(){this.proactiveRefresh._stop()}async _updateTokensIfNecessary(e,n=!1){let r=!1;e.idToken&&e.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(e),r=!0),n&&await Nr(this),await this.auth._persistUserIfCurrent(this),r&&this.auth._notifyListenersIfCurrent(this)}async delete(){const e=await this.getIdToken();return await An(this,Zv(this.auth,{idToken:e})),this.stsTokenManager.clearRefreshToken(),this.auth.signOut()}toJSON(){return Object.assign(Object.assign({uid:this.uid,email:this.email||void 0,emailVerified:this.emailVerified,displayName:this.displayName||void 0,isAnonymous:this.isAnonymous,photoURL:this.photoURL||void 0,phoneNumber:this.phoneNumber||void 0,tenantId:this.tenantId||void 0,providerData:this.providerData.map(e=>Object.assign({},e)),stsTokenManager:this.stsTokenManager.toJSON(),_redirectEventId:this._redirectEventId},this.metadata.toJSON()),{apiKey:this.auth.config.apiKey,appName:this.auth.name})}get refreshToken(){return this.stsTokenManager.refreshToken||""}static _fromJSON(e,n){var r,s,i,o,a,c,u,l;const h=(r=n.displayName)!==null&&r!==void 0?r:void 0,d=(s=n.email)!==null&&s!==void 0?s:void 0,f=(i=n.phoneNumber)!==null&&i!==void 0?i:void 0,E=(o=n.photoURL)!==null&&o!==void 0?o:void 0,T=(a=n.tenantId)!==null&&a!==void 0?a:void 0,_=(c=n._redirectEventId)!==null&&c!==void 0?c:void 0,C=(u=n.createdAt)!==null&&u!==void 0?u:void 0,L=(l=n.lastLoginAt)!==null&&l!==void 0?l:void 0,{uid:k,emailVerified:O,isAnonymous:_e,providerData:oe,stsTokenManager:Me}=n;I(k&&Me,e,"internal-error");const Rt=Or.fromJSON(this.name,Me);I(typeof k=="string",e,"internal-error"),Tt(h,e.name),Tt(d,e.name),I(typeof O=="boolean",e,"internal-error"),I(typeof _e=="boolean",e,"internal-error"),Tt(f,e.name),Tt(E,e.name),Tt(T,e.name),Tt(_,e.name),Tt(C,e.name),Tt(L,e.name);const at=new qt({uid:k,auth:e,email:d,emailVerified:O,displayName:h,isAnonymous:_e,photoURL:E,phoneNumber:f,tenantId:T,stsTokenManager:Rt,createdAt:C,lastLoginAt:L});return oe&&Array.isArray(oe)&&(at.providerData=oe.map(Ei=>Object.assign({},Ei))),_&&(at._redirectEventId=_),at}static async _fromIdTokenResponse(e,n,r=!1){const s=new Or;s.updateFromServerResponse(n);const i=new qt({uid:n.localId,auth:e,stsTokenManager:s,isAnonymous:r});return await Nr(i),i}}/**
2273
+ */function Rt(n,e){I(typeof n=="string"||typeof n>"u","internal-error",{appName:e})}class at{constructor(e){var{uid:t,auth:r,stsTokenManager:s}=e,i=ka(e,["uid","auth","stsTokenManager"]);this.providerId="firebase",this.proactiveRefresh=new TE(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=t,this.auth=r,this.stsTokenManager=s,this.accessToken=s.accessToken,this.displayName=i.displayName||null,this.email=i.email||null,this.emailVerified=i.emailVerified||!1,this.phoneNumber=i.phoneNumber||null,this.photoURL=i.photoURL||null,this.isAnonymous=i.isAnonymous||!1,this.tenantId=i.tenantId||null,this.providerData=i.providerData?[...i.providerData]:[],this.metadata=new xa(i.createdAt||void 0,i.lastLoginAt||void 0)}async getIdToken(e){const t=await bn(this,this.stsTokenManager.getToken(this.auth,e));return I(t,this.auth,"internal-error"),this.accessToken!==t&&(this.accessToken=t,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),t}getIdTokenResult(e){return vE(this,e)}reload(){return wE(this)}_assign(e){this!==e&&(I(this.uid===e.uid,this.auth,"internal-error"),this.displayName=e.displayName,this.photoURL=e.photoURL,this.email=e.email,this.emailVerified=e.emailVerified,this.phoneNumber=e.phoneNumber,this.isAnonymous=e.isAnonymous,this.tenantId=e.tenantId,this.providerData=e.providerData.map(t=>Object.assign({},t)),this.metadata._copy(e.metadata),this.stsTokenManager._assign(e.stsTokenManager))}_clone(e){const t=new at(Object.assign(Object.assign({},this),{auth:e,stsTokenManager:this.stsTokenManager._clone()}));return t.metadata._copy(this.metadata),t}_onReload(e){I(!this.reloadListener,this.auth,"internal-error"),this.reloadListener=e,this.reloadUserInfo&&(this._notifyReloadListener(this.reloadUserInfo),this.reloadUserInfo=null)}_notifyReloadListener(e){this.reloadListener?this.reloadListener(e):this.reloadUserInfo=e}_startProactiveRefresh(){this.proactiveRefresh._start()}_stopProactiveRefresh(){this.proactiveRefresh._stop()}async _updateTokensIfNecessary(e,t=!1){let r=!1;e.idToken&&e.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(e),r=!0),t&&await Ur(this),await this.auth._persistUserIfCurrent(this),r&&this.auth._notifyListenersIfCurrent(this)}async delete(){if(Pe(this.auth.app))return Promise.reject(Ge(this.auth));const e=await this.getIdToken();return await bn(this,_E(this.auth,{idToken:e})),this.stsTokenManager.clearRefreshToken(),this.auth.signOut()}toJSON(){return Object.assign(Object.assign({uid:this.uid,email:this.email||void 0,emailVerified:this.emailVerified,displayName:this.displayName||void 0,isAnonymous:this.isAnonymous,photoURL:this.photoURL||void 0,phoneNumber:this.phoneNumber||void 0,tenantId:this.tenantId||void 0,providerData:this.providerData.map(e=>Object.assign({},e)),stsTokenManager:this.stsTokenManager.toJSON(),_redirectEventId:this._redirectEventId},this.metadata.toJSON()),{apiKey:this.auth.config.apiKey,appName:this.auth.name})}get refreshToken(){return this.stsTokenManager.refreshToken||""}static _fromJSON(e,t){var r,s,i,o,a,c,u,l;const h=(r=t.displayName)!==null&&r!==void 0?r:void 0,d=(s=t.email)!==null&&s!==void 0?s:void 0,f=(i=t.phoneNumber)!==null&&i!==void 0?i:void 0,E=(o=t.photoURL)!==null&&o!==void 0?o:void 0,T=(a=t.tenantId)!==null&&a!==void 0?a:void 0,_=(c=t._redirectEventId)!==null&&c!==void 0?c:void 0,C=(u=t.createdAt)!==null&&u!==void 0?u:void 0,L=(l=t.lastLoginAt)!==null&&l!==void 0?l:void 0,{uid:k,emailVerified:O,isAnonymous:ve,providerData:oe,stsTokenManager:Fe}=t;I(k&&Fe,e,"internal-error");const Ct=Cn.fromJSON(this.name,Fe);I(typeof k=="string",e,"internal-error"),Rt(h,e.name),Rt(d,e.name),I(typeof O=="boolean",e,"internal-error"),I(typeof ve=="boolean",e,"internal-error"),Rt(f,e.name),Rt(E,e.name),Rt(T,e.name),Rt(_,e.name),Rt(C,e.name),Rt(L,e.name);const ht=new at({uid:k,auth:e,email:d,emailVerified:O,displayName:h,isAnonymous:ve,photoURL:E,phoneNumber:f,tenantId:T,stsTokenManager:Ct,createdAt:C,lastLoginAt:L});return oe&&Array.isArray(oe)&&(ht.providerData=oe.map(Ai=>Object.assign({},Ai))),_&&(ht._redirectEventId=_),ht}static async _fromIdTokenResponse(e,t,r=!1){const s=new Cn;s.updateFromServerResponse(t);const i=new at({uid:t.localId,auth:e,stsTokenManager:s,isAnonymous:r});return await Ur(i),i}static async _fromGetAccountInfoResponse(e,t,r){const s=t.users[0];I(s.localId!==void 0,"internal-error");const i=s.providerUserInfo!==void 0?_d(s.providerUserInfo):[],o=!(s.email&&s.passwordHash)&&!(i!=null&&i.length),a=new Cn;a.updateFromIdToken(r);const c=new at({uid:s.localId,auth:e,stsTokenManager:a,isAnonymous:o}),u={uid:s.localId,displayName:s.displayName||null,photoURL:s.photoUrl||null,email:s.email||null,emailVerified:s.emailVerified||!1,phoneNumber:s.phoneNumber||null,tenantId:s.tenantId||null,providerData:i,metadata:new xa(s.createdAt,s.lastLoginAt),isAnonymous:!(s.email&&s.passwordHash)&&!(i!=null&&i.length)};return Object.assign(c,u),c}}/**
2274
2274
  * @license
2275
2275
  * Copyright 2020 Google LLC
2276
2276
  *
@@ -2285,7 +2285,7 @@ This typically indicates that your device does not have a healthy Internet conne
2285
2285
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2286
2286
  * See the License for the specific language governing permissions and
2287
2287
  * limitations under the License.
2288
- */const sd=new Map;function st(t){nt(t instanceof Function,"Expected a class definition");let e=sd.get(t);return e?(nt(e instanceof t,"Instance stored in cache mismatched with class"),e):(e=new t,sd.set(t,e),e)}/**
2288
+ */const yd=new Map;function ct(n){it(n instanceof Function,"Expected a class definition");let e=yd.get(n);return e?(it(e instanceof n,"Instance stored in cache mismatched with class"),e):(e=new n,yd.set(n,e),e)}/**
2289
2289
  * @license
2290
2290
  * Copyright 2019 Google LLC
2291
2291
  *
@@ -2300,7 +2300,7 @@ This typically indicates that your device does not have a healthy Internet conne
2300
2300
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2301
2301
  * See the License for the specific language governing permissions and
2302
2302
  * limitations under the License.
2303
- */class id{constructor(){this.type="NONE",this.storage={}}async _isAvailable(){return!0}async _set(e,n){this.storage[e]=n}async _get(e){const n=this.storage[e];return n===void 0?null:n}async _remove(e){delete this.storage[e]}_addListener(e,n){}_removeListener(e,n){}}id.type="NONE";const od=id;/**
2303
+ */class vd{constructor(){this.type="NONE",this.storage={}}async _isAvailable(){return!0}async _set(e,t){this.storage[e]=t}async _get(e){const t=this.storage[e];return t===void 0?null:t}async _remove(e){delete this.storage[e]}_addListener(e,t){}_removeListener(e,t){}}vd.type="NONE";const Ed=vd;/**
2304
2304
  * @license
2305
2305
  * Copyright 2019 Google LLC
2306
2306
  *
@@ -2315,7 +2315,7 @@ This typically indicates that your device does not have a healthy Internet conne
2315
2315
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2316
2316
  * See the License for the specific language governing permissions and
2317
2317
  * limitations under the License.
2318
- */function ri(t,e,n){return`firebase:${t}:${e}:${n}`}class Rn{constructor(e,n,r){this.persistence=e,this.auth=n,this.userKey=r;const{config:s,name:i}=this.auth;this.fullUserKey=ri(this.userKey,s.apiKey,i),this.fullPersistenceKey=ri("persistence",s.apiKey,i),this.boundEventHandler=n._onStorageEvent.bind(n),this.persistence._addListener(this.fullUserKey,this.boundEventHandler)}setCurrentUser(e){return this.persistence._set(this.fullUserKey,e.toJSON())}async getCurrentUser(){const e=await this.persistence._get(this.fullUserKey);return e?qt._fromJSON(this.auth,e):null}removeCurrentUser(){return this.persistence._remove(this.fullUserKey)}savePersistenceForRedirect(){return this.persistence._set(this.fullPersistenceKey,this.persistence.type)}async setPersistence(e){if(this.persistence===e)return;const n=await this.getCurrentUser();if(await this.removeCurrentUser(),this.persistence=e,n)return this.setCurrentUser(n)}delete(){this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}static async create(e,n,r="authUser"){if(!n.length)return new Rn(st(od),e,r);const s=(await Promise.all(n.map(async u=>{if(await u._isAvailable())return u}))).filter(u=>u);let i=s[0]||st(od);const o=ri(r,e.config.apiKey,e.name);let a=null;for(const u of n)try{const l=await u._get(o);if(l){const h=qt._fromJSON(e,l);u!==i&&(a=h),i=u;break}}catch{}const c=s.filter(u=>u._shouldAllowMigration);return!i._shouldAllowMigration||!c.length?new Rn(i,e,r):(i=c[0],a&&await i._set(o,a.toJSON()),await Promise.all(n.map(async u=>{if(u!==i)try{await u._remove(o)}catch{}})),new Rn(i,e,r))}}/**
2318
+ */function ai(n,e,t){return`firebase:${n}:${e}:${t}`}class kn{constructor(e,t,r){this.persistence=e,this.auth=t,this.userKey=r;const{config:s,name:i}=this.auth;this.fullUserKey=ai(this.userKey,s.apiKey,i),this.fullPersistenceKey=ai("persistence",s.apiKey,i),this.boundEventHandler=t._onStorageEvent.bind(t),this.persistence._addListener(this.fullUserKey,this.boundEventHandler)}setCurrentUser(e){return this.persistence._set(this.fullUserKey,e.toJSON())}async getCurrentUser(){const e=await this.persistence._get(this.fullUserKey);return e?at._fromJSON(this.auth,e):null}removeCurrentUser(){return this.persistence._remove(this.fullUserKey)}savePersistenceForRedirect(){return this.persistence._set(this.fullPersistenceKey,this.persistence.type)}async setPersistence(e){if(this.persistence===e)return;const t=await this.getCurrentUser();if(await this.removeCurrentUser(),this.persistence=e,t)return this.setCurrentUser(t)}delete(){this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}static async create(e,t,r="authUser"){if(!t.length)return new kn(ct(Ed),e,r);const s=(await Promise.all(t.map(async u=>{if(await u._isAvailable())return u}))).filter(u=>u);let i=s[0]||ct(Ed);const o=ai(r,e.config.apiKey,e.name);let a=null;for(const u of t)try{const l=await u._get(o);if(l){const h=at._fromJSON(e,l);u!==i&&(a=h),i=u;break}}catch{}const c=s.filter(u=>u._shouldAllowMigration);return!i._shouldAllowMigration||!c.length?new kn(i,e,r):(i=c[0],a&&await i._set(o,a.toJSON()),await Promise.all(t.map(async u=>{if(u!==i)try{await u._remove(o)}catch{}})),new kn(i,e,r))}}/**
2319
2319
  * @license
2320
2320
  * Copyright 2020 Google LLC
2321
2321
  *
@@ -2330,7 +2330,7 @@ This typically indicates that your device does not have a healthy Internet conne
2330
2330
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2331
2331
  * See the License for the specific language governing permissions and
2332
2332
  * limitations under the License.
2333
- */function ad(t){const e=t.toLowerCase();if(e.includes("opera/")||e.includes("opr/")||e.includes("opios/"))return"Opera";if(ld(e))return"IEMobile";if(e.includes("msie")||e.includes("trident/"))return"IE";if(e.includes("edge/"))return"Edge";if(cd(e))return"Firefox";if(e.includes("silk/"))return"Silk";if(dd(e))return"Blackberry";if(fd(e))return"Webos";if(ka(e))return"Safari";if((e.includes("chrome/")||ud(e))&&!e.includes("edge/"))return"Chrome";if(hd(e))return"Android";{const n=/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/,r=t.match(n);if((r==null?void 0:r.length)===2)return r[1]}return"Other"}function cd(t=W()){return/firefox\//i.test(t)}function ka(t=W()){const e=t.toLowerCase();return e.includes("safari/")&&!e.includes("chrome/")&&!e.includes("crios/")&&!e.includes("android")}function ud(t=W()){return/crios\//i.test(t)}function ld(t=W()){return/iemobile/i.test(t)}function hd(t=W()){return/android/i.test(t)}function dd(t=W()){return/blackberry/i.test(t)}function fd(t=W()){return/webos/i.test(t)}function si(t=W()){return/iphone|ipad|ipod/i.test(t)||/macintosh/i.test(t)&&/mobile/i.test(t)}function hE(t=W()){var e;return si(t)&&!!(!((e=window.navigator)===null||e===void 0)&&e.standalone)}function dE(){return qf()&&document.documentMode===10}function pd(t=W()){return si(t)||hd(t)||fd(t)||dd(t)||/windows phone/i.test(t)||ld(t)}function fE(){try{return!!(window&&window!==window.top)}catch{return!1}}/**
2333
+ */function Td(n){const e=n.toLowerCase();if(e.includes("opera/")||e.includes("opr/")||e.includes("opios/"))return"Opera";if(Ad(e))return"IEMobile";if(e.includes("msie")||e.includes("trident/"))return"IE";if(e.includes("edge/"))return"Edge";if(wd(e))return"Firefox";if(e.includes("silk/"))return"Silk";if(Pd(e))return"Blackberry";if(Sd(e))return"Webos";if(Ua(e))return"Safari";if((e.includes("chrome/")||Id(e))&&!e.includes("edge/"))return"Chrome";if(Rd(e))return"Android";{const t=/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/,r=n.match(t);if((r==null?void 0:r.length)===2)return r[1]}return"Other"}function wd(n=W()){return/firefox\//i.test(n)}function Ua(n=W()){const e=n.toLowerCase();return e.includes("safari/")&&!e.includes("chrome/")&&!e.includes("crios/")&&!e.includes("android")}function Id(n=W()){return/crios\//i.test(n)}function Ad(n=W()){return/iemobile/i.test(n)}function Rd(n=W()){return/android/i.test(n)}function Pd(n=W()){return/blackberry/i.test(n)}function Sd(n=W()){return/webos/i.test(n)}function ci(n=W()){return/iphone|ipad|ipod/i.test(n)||/macintosh/i.test(n)&&/mobile/i.test(n)}function PE(n=W()){var e;return ci(n)&&!!(!((e=window.navigator)===null||e===void 0)&&e.standalone)}function SE(){return sp()&&document.documentMode===10}function bd(n=W()){return ci(n)||Rd(n)||Sd(n)||Pd(n)||/windows phone/i.test(n)||Ad(n)}function bE(){try{return!!(window&&window!==window.top)}catch{return!1}}/**
2334
2334
  * @license
2335
2335
  * Copyright 2020 Google LLC
2336
2336
  *
@@ -2345,7 +2345,7 @@ This typically indicates that your device does not have a healthy Internet conne
2345
2345
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2346
2346
  * See the License for the specific language governing permissions and
2347
2347
  * limitations under the License.
2348
- */function md(t,e=[]){let n;switch(t){case"Browser":n=ad(W());break;case"Worker":n=`${ad(W())}-${t}`;break;default:n=t}const r=e.length?e.join(","):"FirebaseCore-web";return`${n}/JsCore/${bt}/${r}`}/**
2348
+ */function Cd(n,e=[]){let t;switch(n){case"Browser":t=Td(W());break;case"Worker":t=`${Td(W())}-${n}`;break;default:t=n}const r=e.length?e.join(","):"FirebaseCore-web";return`${t}/JsCore/${Nt}/${r}`}/**
2349
2349
  * @license
2350
2350
  * Copyright 2022 Google LLC
2351
2351
  *
@@ -2360,7 +2360,7 @@ This typically indicates that your device does not have a healthy Internet conne
2360
2360
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2361
2361
  * See the License for the specific language governing permissions and
2362
2362
  * limitations under the License.
2363
- */class pE{constructor(e){this.auth=e,this.queue=[]}pushCallback(e,n){const r=i=>new Promise((o,a)=>{try{const c=e(i);o(c)}catch(c){a(c)}});r.onAbort=n,this.queue.push(r);const s=this.queue.length-1;return()=>{this.queue[s]=()=>Promise.resolve()}}async runMiddleware(e){if(this.auth.currentUser===e)return;const n=[];try{for(const r of this.queue)await r(e),r.onAbort&&n.push(r.onAbort)}catch(r){n.reverse();for(const s of n)try{s()}catch{}throw this.auth._errorFactory.create("login-blocked",{originalMessage:r==null?void 0:r.message})}}}/**
2363
+ */class CE{constructor(e){this.auth=e,this.queue=[]}pushCallback(e,t){const r=i=>new Promise((o,a)=>{try{const c=e(i);o(c)}catch(c){a(c)}});r.onAbort=t,this.queue.push(r);const s=this.queue.length-1;return()=>{this.queue[s]=()=>Promise.resolve()}}async runMiddleware(e){if(this.auth.currentUser===e)return;const t=[];try{for(const r of this.queue)await r(e),r.onAbort&&t.push(r.onAbort)}catch(r){t.reverse();for(const s of t)try{s()}catch{}throw this.auth._errorFactory.create("login-blocked",{originalMessage:r==null?void 0:r.message})}}}/**
2364
2364
  * @license
2365
2365
  * Copyright 2023 Google LLC
2366
2366
  *
@@ -2375,7 +2375,7 @@ This typically indicates that your device does not have a healthy Internet conne
2375
2375
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2376
2376
  * See the License for the specific language governing permissions and
2377
2377
  * limitations under the License.
2378
- */async function mE(t,e={}){return Oe(t,"GET","/v2/passwordPolicy",rt(t,e))}/**
2378
+ */async function kE(n,e={}){return Me(n,"GET","/v2/passwordPolicy",ot(n,e))}/**
2379
2379
  * @license
2380
2380
  * Copyright 2023 Google LLC
2381
2381
  *
@@ -2390,7 +2390,7 @@ This typically indicates that your device does not have a healthy Internet conne
2390
2390
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2391
2391
  * See the License for the specific language governing permissions and
2392
2392
  * limitations under the License.
2393
- */const gE=6;class _E{constructor(e){var n,r,s,i;const o=e.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=(n=o.minPasswordLength)!==null&&n!==void 0?n:gE,o.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=o.maxPasswordLength),o.containsLowercaseCharacter!==void 0&&(this.customStrengthOptions.containsLowercaseLetter=o.containsLowercaseCharacter),o.containsUppercaseCharacter!==void 0&&(this.customStrengthOptions.containsUppercaseLetter=o.containsUppercaseCharacter),o.containsNumericCharacter!==void 0&&(this.customStrengthOptions.containsNumericCharacter=o.containsNumericCharacter),o.containsNonAlphanumericCharacter!==void 0&&(this.customStrengthOptions.containsNonAlphanumericCharacter=o.containsNonAlphanumericCharacter),this.enforcementState=e.enforcementState,this.enforcementState==="ENFORCEMENT_STATE_UNSPECIFIED"&&(this.enforcementState="OFF"),this.allowedNonAlphanumericCharacters=(s=(r=e.allowedNonAlphanumericCharacters)===null||r===void 0?void 0:r.join(""))!==null&&s!==void 0?s:"",this.forceUpgradeOnSignin=(i=e.forceUpgradeOnSignin)!==null&&i!==void 0?i:!1,this.schemaVersion=e.schemaVersion}validatePassword(e){var n,r,s,i,o,a;const c={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(e,c),this.validatePasswordCharacterOptions(e,c),c.isValid&&(c.isValid=(n=c.meetsMinPasswordLength)!==null&&n!==void 0?n:!0),c.isValid&&(c.isValid=(r=c.meetsMaxPasswordLength)!==null&&r!==void 0?r:!0),c.isValid&&(c.isValid=(s=c.containsLowercaseLetter)!==null&&s!==void 0?s:!0),c.isValid&&(c.isValid=(i=c.containsUppercaseLetter)!==null&&i!==void 0?i:!0),c.isValid&&(c.isValid=(o=c.containsNumericCharacter)!==null&&o!==void 0?o:!0),c.isValid&&(c.isValid=(a=c.containsNonAlphanumericCharacter)!==null&&a!==void 0?a:!0),c}validatePasswordLengthOptions(e,n){const r=this.customStrengthOptions.minPasswordLength,s=this.customStrengthOptions.maxPasswordLength;r&&(n.meetsMinPasswordLength=e.length>=r),s&&(n.meetsMaxPasswordLength=e.length<=s)}validatePasswordCharacterOptions(e,n){this.updatePasswordCharacterOptionsStatuses(n,!1,!1,!1,!1);let r;for(let s=0;s<e.length;s++)r=e.charAt(s),this.updatePasswordCharacterOptionsStatuses(n,r>="a"&&r<="z",r>="A"&&r<="Z",r>="0"&&r<="9",this.allowedNonAlphanumericCharacters.includes(r))}updatePasswordCharacterOptionsStatuses(e,n,r,s,i){this.customStrengthOptions.containsLowercaseLetter&&(e.containsLowercaseLetter||(e.containsLowercaseLetter=n)),this.customStrengthOptions.containsUppercaseLetter&&(e.containsUppercaseLetter||(e.containsUppercaseLetter=r)),this.customStrengthOptions.containsNumericCharacter&&(e.containsNumericCharacter||(e.containsNumericCharacter=s)),this.customStrengthOptions.containsNonAlphanumericCharacter&&(e.containsNonAlphanumericCharacter||(e.containsNonAlphanumericCharacter=i))}}/**
2393
+ */const DE=6;class NE{constructor(e){var t,r,s,i;const o=e.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=(t=o.minPasswordLength)!==null&&t!==void 0?t:DE,o.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=o.maxPasswordLength),o.containsLowercaseCharacter!==void 0&&(this.customStrengthOptions.containsLowercaseLetter=o.containsLowercaseCharacter),o.containsUppercaseCharacter!==void 0&&(this.customStrengthOptions.containsUppercaseLetter=o.containsUppercaseCharacter),o.containsNumericCharacter!==void 0&&(this.customStrengthOptions.containsNumericCharacter=o.containsNumericCharacter),o.containsNonAlphanumericCharacter!==void 0&&(this.customStrengthOptions.containsNonAlphanumericCharacter=o.containsNonAlphanumericCharacter),this.enforcementState=e.enforcementState,this.enforcementState==="ENFORCEMENT_STATE_UNSPECIFIED"&&(this.enforcementState="OFF"),this.allowedNonAlphanumericCharacters=(s=(r=e.allowedNonAlphanumericCharacters)===null||r===void 0?void 0:r.join(""))!==null&&s!==void 0?s:"",this.forceUpgradeOnSignin=(i=e.forceUpgradeOnSignin)!==null&&i!==void 0?i:!1,this.schemaVersion=e.schemaVersion}validatePassword(e){var t,r,s,i,o,a;const c={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(e,c),this.validatePasswordCharacterOptions(e,c),c.isValid&&(c.isValid=(t=c.meetsMinPasswordLength)!==null&&t!==void 0?t:!0),c.isValid&&(c.isValid=(r=c.meetsMaxPasswordLength)!==null&&r!==void 0?r:!0),c.isValid&&(c.isValid=(s=c.containsLowercaseLetter)!==null&&s!==void 0?s:!0),c.isValid&&(c.isValid=(i=c.containsUppercaseLetter)!==null&&i!==void 0?i:!0),c.isValid&&(c.isValid=(o=c.containsNumericCharacter)!==null&&o!==void 0?o:!0),c.isValid&&(c.isValid=(a=c.containsNonAlphanumericCharacter)!==null&&a!==void 0?a:!0),c}validatePasswordLengthOptions(e,t){const r=this.customStrengthOptions.minPasswordLength,s=this.customStrengthOptions.maxPasswordLength;r&&(t.meetsMinPasswordLength=e.length>=r),s&&(t.meetsMaxPasswordLength=e.length<=s)}validatePasswordCharacterOptions(e,t){this.updatePasswordCharacterOptionsStatuses(t,!1,!1,!1,!1);let r;for(let s=0;s<e.length;s++)r=e.charAt(s),this.updatePasswordCharacterOptionsStatuses(t,r>="a"&&r<="z",r>="A"&&r<="Z",r>="0"&&r<="9",this.allowedNonAlphanumericCharacters.includes(r))}updatePasswordCharacterOptionsStatuses(e,t,r,s,i){this.customStrengthOptions.containsLowercaseLetter&&(e.containsLowercaseLetter||(e.containsLowercaseLetter=t)),this.customStrengthOptions.containsUppercaseLetter&&(e.containsUppercaseLetter||(e.containsUppercaseLetter=r)),this.customStrengthOptions.containsNumericCharacter&&(e.containsNumericCharacter||(e.containsNumericCharacter=s)),this.customStrengthOptions.containsNonAlphanumericCharacter&&(e.containsNonAlphanumericCharacter||(e.containsNonAlphanumericCharacter=i))}}/**
2394
2394
  * @license
2395
2395
  * Copyright 2020 Google LLC
2396
2396
  *
@@ -2405,7 +2405,7 @@ This typically indicates that your device does not have a healthy Internet conne
2405
2405
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2406
2406
  * See the License for the specific language governing permissions and
2407
2407
  * limitations under the License.
2408
- */class yE{constructor(e,n,r,s){this.app=e,this.heartbeatServiceProvider=n,this.appCheckServiceProvider=r,this.config=s,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new gd(this),this.idTokenSubscription=new gd(this),this.beforeStateQueue=new pE(this),this.redirectUser=null,this.isProactiveRefreshEnabled=!1,this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION=1,this._canInitEmulator=!0,this._isInitialized=!1,this._deleted=!1,this._initializationPromise=null,this._popupRedirectResolver=null,this._errorFactory=Qh,this._agentRecaptchaConfig=null,this._tenantRecaptchaConfigs={},this._projectPasswordPolicy=null,this._tenantPasswordPolicies={},this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=e.name,this.clientVersion=s.sdkClientVersion}_initializeWithPersistence(e,n){return n&&(this._popupRedirectResolver=st(n)),this._initializationPromise=this.queue(async()=>{var r,s;if(!this._deleted&&(this.persistenceManager=await Rn.create(this,e),!this._deleted)){if(!((r=this._popupRedirectResolver)===null||r===void 0)&&r._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch{}await this.initializeCurrentUser(n),this.lastNotifiedUid=((s=this.currentUser)===null||s===void 0?void 0:s.uid)||null,!this._deleted&&(this._isInitialized=!0)}}),this._initializationPromise}async _onStorageEvent(){if(this._deleted)return;const e=await this.assertedPersistence.getCurrentUser();if(!(!this.currentUser&&!e)){if(this.currentUser&&e&&this.currentUser.uid===e.uid){this._currentUser._assign(e),await this.currentUser.getIdToken();return}await this._updateCurrentUser(e,!0)}}async initializeCurrentUser(e){var n;const r=await this.assertedPersistence.getCurrentUser();let s=r,i=!1;if(e&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();const o=(n=this.redirectUser)===null||n===void 0?void 0:n._redirectEventId,a=s==null?void 0:s._redirectEventId,c=await this.tryRedirectSignIn(e);(!o||o===a)&&(c!=null&&c.user)&&(s=c.user,i=!0)}if(!s)return this.directlySetCurrentUser(null);if(!s._redirectEventId){if(i)try{await this.beforeStateQueue.runMiddleware(s)}catch(o){s=r,this._popupRedirectResolver._overrideRedirectResult(this,()=>Promise.reject(o))}return s?this.reloadAndSetCurrentUserOrClear(s):this.directlySetCurrentUser(null)}return I(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===s._redirectEventId?this.directlySetCurrentUser(s):this.reloadAndSetCurrentUserOrClear(s)}async tryRedirectSignIn(e){let n=null;try{n=await this._popupRedirectResolver._completeRedirectFn(this,e,!0)}catch{await this._setRedirectUser(null)}return n}async reloadAndSetCurrentUserOrClear(e){try{await Nr(e)}catch(n){if((n==null?void 0:n.code)!=="auth/network-request-failed")return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(e)}useDeviceLanguage(){this.languageCode=Wv()}async _delete(){this._deleted=!0}async updateCurrentUser(e){const n=e?x(e):null;return n&&I(n.auth.config.apiKey===this.config.apiKey,this,"invalid-user-token"),this._updateCurrentUser(n&&n._clone(this))}async _updateCurrentUser(e,n=!1){if(!this._deleted)return e&&I(this.tenantId===e.tenantId,this,"tenant-id-mismatch"),n||await this.beforeStateQueue.runMiddleware(e),this.queue(async()=>{await this.directlySetCurrentUser(e),this.notifyAuthListeners()})}async signOut(){return await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0)}setPersistence(e){return this.queue(async()=>{await this.assertedPersistence.setPersistence(st(e))})}_getRecaptchaConfig(){return this.tenantId==null?this._agentRecaptchaConfig:this._tenantRecaptchaConfigs[this.tenantId]}async validatePassword(e){this._getPasswordPolicyInternal()||await this._updatePasswordPolicy();const n=this._getPasswordPolicyInternal();return n.schemaVersion!==this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION?Promise.reject(this._errorFactory.create("unsupported-password-policy-schema-version",{})):n.validatePassword(e)}_getPasswordPolicyInternal(){return this.tenantId===null?this._projectPasswordPolicy:this._tenantPasswordPolicies[this.tenantId]}async _updatePasswordPolicy(){const e=await mE(this),n=new _E(e);this.tenantId===null?this._projectPasswordPolicy=n:this._tenantPasswordPolicies[this.tenantId]=n}_getPersistence(){return this.assertedPersistence.persistence.type}_updateErrorMap(e){this._errorFactory=new Nn("auth","Firebase",e())}onAuthStateChanged(e,n,r){return this.registerStateListener(this.authStateSubscription,e,n,r)}beforeAuthStateChanged(e,n){return this.beforeStateQueue.pushCallback(e,n)}onIdTokenChanged(e,n,r){return this.registerStateListener(this.idTokenSubscription,e,n,r)}authStateReady(){return new Promise((e,n)=>{if(this.currentUser)e();else{const r=this.onAuthStateChanged(()=>{r(),e()},n)}})}async revokeAccessToken(e){if(this.currentUser){const n=await this.currentUser.getIdToken(),r={providerId:"apple.com",tokenType:"ACCESS_TOKEN",token:e,idToken:n};this.tenantId!=null&&(r.tenantId=this.tenantId),await lE(this,r)}}toJSON(){var e;return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:(e=this._currentUser)===null||e===void 0?void 0:e.toJSON()}}async _setRedirectUser(e,n){const r=await this.getOrInitRedirectPersistenceManager(n);return e===null?r.removeCurrentUser():r.setCurrentUser(e)}async getOrInitRedirectPersistenceManager(e){if(!this.redirectPersistenceManager){const n=e&&st(e)||this._popupRedirectResolver;I(n,this,"argument-error"),this.redirectPersistenceManager=await Rn.create(this,[st(n._redirectPersistence)],"redirectUser"),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager}async _redirectUserForId(e){var n,r;return this._isInitialized&&await this.queue(async()=>{}),((n=this._currentUser)===null||n===void 0?void 0:n._redirectEventId)===e?this._currentUser:((r=this.redirectUser)===null||r===void 0?void 0:r._redirectEventId)===e?this.redirectUser:null}async _persistUserIfCurrent(e){if(e===this.currentUser)return this.queue(async()=>this.directlySetCurrentUser(e))}_notifyListenersIfCurrent(e){e===this.currentUser&&this.notifyAuthListeners()}_key(){return`${this.config.authDomain}:${this.config.apiKey}:${this.name}`}_startProactiveRefresh(){this.isProactiveRefreshEnabled=!0,this.currentUser&&this._currentUser._startProactiveRefresh()}_stopProactiveRefresh(){this.isProactiveRefreshEnabled=!1,this.currentUser&&this._currentUser._stopProactiveRefresh()}get _currentUser(){return this.currentUser}notifyAuthListeners(){var e,n;if(!this._isInitialized)return;this.idTokenSubscription.next(this.currentUser);const r=(n=(e=this.currentUser)===null||e===void 0?void 0:e.uid)!==null&&n!==void 0?n:null;this.lastNotifiedUid!==r&&(this.lastNotifiedUid=r,this.authStateSubscription.next(this.currentUser))}registerStateListener(e,n,r,s){if(this._deleted)return()=>{};const i=typeof n=="function"?n:n.next.bind(n);let o=!1;const a=this._isInitialized?Promise.resolve():this._initializationPromise;if(I(a,this,"internal-error"),a.then(()=>{o||i(this.currentUser)}),typeof n=="function"){const c=e.addObserver(n,r,s);return()=>{o=!0,c()}}else{const c=e.addObserver(n);return()=>{o=!0,c()}}}async directlySetCurrentUser(e){this.currentUser&&this.currentUser!==e&&this._currentUser._stopProactiveRefresh(),e&&this.isProactiveRefreshEnabled&&e._startProactiveRefresh(),this.currentUser=e,e?await this.assertedPersistence.setCurrentUser(e):await this.assertedPersistence.removeCurrentUser()}queue(e){return this.operations=this.operations.then(e,e),this.operations}get assertedPersistence(){return I(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(e){!e||this.frameworks.includes(e)||(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=md(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){var e;const n={"X-Client-Version":this.clientVersion};this.app.options.appId&&(n["X-Firebase-gmpid"]=this.app.options.appId);const r=await((e=this.heartbeatServiceProvider.getImmediate({optional:!0}))===null||e===void 0?void 0:e.getHeartbeatsHeader());r&&(n["X-Firebase-Client"]=r);const s=await this._getAppCheckToken();return s&&(n["X-Firebase-AppCheck"]=s),n}async _getAppCheckToken(){var e;const n=await((e=this.appCheckServiceProvider.getImmediate({optional:!0}))===null||e===void 0?void 0:e.getToken());return n!=null&&n.error&&qv(`Error while retrieving App Check token: ${n.error}`),n==null?void 0:n.token}}function He(t){return x(t)}class gd{constructor(e){this.auth=e,this.observer=null,this.addObserver=Yf(n=>this.observer=n)}get next(){return I(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}/**
2408
+ */class OE{constructor(e,t,r,s){this.app=e,this.heartbeatServiceProvider=t,this.appCheckServiceProvider=r,this.config=s,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new kd(this),this.idTokenSubscription=new kd(this),this.beforeStateQueue=new CE(this),this.redirectUser=null,this.isProactiveRefreshEnabled=!1,this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION=1,this._canInitEmulator=!0,this._isInitialized=!1,this._deleted=!1,this._initializationPromise=null,this._popupRedirectResolver=null,this._errorFactory=cd,this._agentRecaptchaConfig=null,this._tenantRecaptchaConfigs={},this._projectPasswordPolicy=null,this._tenantPasswordPolicies={},this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=e.name,this.clientVersion=s.sdkClientVersion}_initializeWithPersistence(e,t){return t&&(this._popupRedirectResolver=ct(t)),this._initializationPromise=this.queue(async()=>{var r,s;if(!this._deleted&&(this.persistenceManager=await kn.create(this,e),!this._deleted)){if(!((r=this._popupRedirectResolver)===null||r===void 0)&&r._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch{}await this.initializeCurrentUser(t),this.lastNotifiedUid=((s=this.currentUser)===null||s===void 0?void 0:s.uid)||null,!this._deleted&&(this._isInitialized=!0)}}),this._initializationPromise}async _onStorageEvent(){if(this._deleted)return;const e=await this.assertedPersistence.getCurrentUser();if(!(!this.currentUser&&!e)){if(this.currentUser&&e&&this.currentUser.uid===e.uid){this._currentUser._assign(e),await this.currentUser.getIdToken();return}await this._updateCurrentUser(e,!0)}}async initializeCurrentUserFromIdToken(e){try{const t=await md(this,{idToken:e}),r=await at._fromGetAccountInfoResponse(this,t,e);await this.directlySetCurrentUser(r)}catch(t){console.warn("FirebaseServerApp could not login user with provided authIdToken: ",t),await this.directlySetCurrentUser(null)}}async initializeCurrentUser(e){var t;if(Pe(this.app)){const o=this.app.settings.authIdToken;return o?new Promise(a=>{setTimeout(()=>this.initializeCurrentUserFromIdToken(o).then(a,a))}):this.directlySetCurrentUser(null)}const r=await this.assertedPersistence.getCurrentUser();let s=r,i=!1;if(e&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();const o=(t=this.redirectUser)===null||t===void 0?void 0:t._redirectEventId,a=s==null?void 0:s._redirectEventId,c=await this.tryRedirectSignIn(e);(!o||o===a)&&(c!=null&&c.user)&&(s=c.user,i=!0)}if(!s)return this.directlySetCurrentUser(null);if(!s._redirectEventId){if(i)try{await this.beforeStateQueue.runMiddleware(s)}catch(o){s=r,this._popupRedirectResolver._overrideRedirectResult(this,()=>Promise.reject(o))}return s?this.reloadAndSetCurrentUserOrClear(s):this.directlySetCurrentUser(null)}return I(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===s._redirectEventId?this.directlySetCurrentUser(s):this.reloadAndSetCurrentUserOrClear(s)}async tryRedirectSignIn(e){let t=null;try{t=await this._popupRedirectResolver._completeRedirectFn(this,e,!0)}catch{await this._setRedirectUser(null)}return t}async reloadAndSetCurrentUserOrClear(e){try{await Ur(e)}catch(t){if((t==null?void 0:t.code)!=="auth/network-request-failed")return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(e)}useDeviceLanguage(){this.languageCode=lE()}async _delete(){this._deleted=!0}async updateCurrentUser(e){if(Pe(this.app))return Promise.reject(Ge(this));const t=e?x(e):null;return t&&I(t.auth.config.apiKey===this.config.apiKey,this,"invalid-user-token"),this._updateCurrentUser(t&&t._clone(this))}async _updateCurrentUser(e,t=!1){if(!this._deleted)return e&&I(this.tenantId===e.tenantId,this,"tenant-id-mismatch"),t||await this.beforeStateQueue.runMiddleware(e),this.queue(async()=>{await this.directlySetCurrentUser(e),this.notifyAuthListeners()})}async signOut(){return Pe(this.app)?Promise.reject(Ge(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(e){return Pe(this.app)?Promise.reject(Ge(this)):this.queue(async()=>{await this.assertedPersistence.setPersistence(ct(e))})}_getRecaptchaConfig(){return this.tenantId==null?this._agentRecaptchaConfig:this._tenantRecaptchaConfigs[this.tenantId]}async validatePassword(e){this._getPasswordPolicyInternal()||await this._updatePasswordPolicy();const t=this._getPasswordPolicyInternal();return t.schemaVersion!==this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION?Promise.reject(this._errorFactory.create("unsupported-password-policy-schema-version",{})):t.validatePassword(e)}_getPasswordPolicyInternal(){return this.tenantId===null?this._projectPasswordPolicy:this._tenantPasswordPolicies[this.tenantId]}async _updatePasswordPolicy(){const e=await kE(this),t=new NE(e);this.tenantId===null?this._projectPasswordPolicy=t:this._tenantPasswordPolicies[this.tenantId]=t}_getPersistence(){return this.assertedPersistence.persistence.type}_updateErrorMap(e){this._errorFactory=new Un("auth","Firebase",e())}onAuthStateChanged(e,t,r){return this.registerStateListener(this.authStateSubscription,e,t,r)}beforeAuthStateChanged(e,t){return this.beforeStateQueue.pushCallback(e,t)}onIdTokenChanged(e,t,r){return this.registerStateListener(this.idTokenSubscription,e,t,r)}authStateReady(){return new Promise((e,t)=>{if(this.currentUser)e();else{const r=this.onAuthStateChanged(()=>{r(),e()},t)}})}async revokeAccessToken(e){if(this.currentUser){const t=await this.currentUser.getIdToken(),r={providerId:"apple.com",tokenType:"ACCESS_TOKEN",token:e,idToken:t};this.tenantId!=null&&(r.tenantId=this.tenantId),await RE(this,r)}}toJSON(){var e;return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:(e=this._currentUser)===null||e===void 0?void 0:e.toJSON()}}async _setRedirectUser(e,t){const r=await this.getOrInitRedirectPersistenceManager(t);return e===null?r.removeCurrentUser():r.setCurrentUser(e)}async getOrInitRedirectPersistenceManager(e){if(!this.redirectPersistenceManager){const t=e&&ct(e)||this._popupRedirectResolver;I(t,this,"argument-error"),this.redirectPersistenceManager=await kn.create(this,[ct(t._redirectPersistence)],"redirectUser"),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager}async _redirectUserForId(e){var t,r;return this._isInitialized&&await this.queue(async()=>{}),((t=this._currentUser)===null||t===void 0?void 0:t._redirectEventId)===e?this._currentUser:((r=this.redirectUser)===null||r===void 0?void 0:r._redirectEventId)===e?this.redirectUser:null}async _persistUserIfCurrent(e){if(e===this.currentUser)return this.queue(async()=>this.directlySetCurrentUser(e))}_notifyListenersIfCurrent(e){e===this.currentUser&&this.notifyAuthListeners()}_key(){return`${this.config.authDomain}:${this.config.apiKey}:${this.name}`}_startProactiveRefresh(){this.isProactiveRefreshEnabled=!0,this.currentUser&&this._currentUser._startProactiveRefresh()}_stopProactiveRefresh(){this.isProactiveRefreshEnabled=!1,this.currentUser&&this._currentUser._stopProactiveRefresh()}get _currentUser(){return this.currentUser}notifyAuthListeners(){var e,t;if(!this._isInitialized)return;this.idTokenSubscription.next(this.currentUser);const r=(t=(e=this.currentUser)===null||e===void 0?void 0:e.uid)!==null&&t!==void 0?t:null;this.lastNotifiedUid!==r&&(this.lastNotifiedUid=r,this.authStateSubscription.next(this.currentUser))}registerStateListener(e,t,r,s){if(this._deleted)return()=>{};const i=typeof t=="function"?t:t.next.bind(t);let o=!1;const a=this._isInitialized?Promise.resolve():this._initializationPromise;if(I(a,this,"internal-error"),a.then(()=>{o||i(this.currentUser)}),typeof t=="function"){const c=e.addObserver(t,r,s);return()=>{o=!0,c()}}else{const c=e.addObserver(t);return()=>{o=!0,c()}}}async directlySetCurrentUser(e){this.currentUser&&this.currentUser!==e&&this._currentUser._stopProactiveRefresh(),e&&this.isProactiveRefreshEnabled&&e._startProactiveRefresh(),this.currentUser=e,e?await this.assertedPersistence.setCurrentUser(e):await this.assertedPersistence.removeCurrentUser()}queue(e){return this.operations=this.operations.then(e,e),this.operations}get assertedPersistence(){return I(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(e){!e||this.frameworks.includes(e)||(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=Cd(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){var e;const t={"X-Client-Version":this.clientVersion};this.app.options.appId&&(t["X-Firebase-gmpid"]=this.app.options.appId);const r=await((e=this.heartbeatServiceProvider.getImmediate({optional:!0}))===null||e===void 0?void 0:e.getHeartbeatsHeader());r&&(t["X-Firebase-Client"]=r);const s=await this._getAppCheckToken();return s&&(t["X-Firebase-AppCheck"]=s),t}async _getAppCheckToken(){var e;const t=await((e=this.appCheckServiceProvider.getImmediate({optional:!0}))===null||e===void 0?void 0:e.getToken());return t!=null&&t.error&&aE(`Error while retrieving App Check token: ${t.error}`),t==null?void 0:t.token}}function Ke(n){return x(n)}class kd{constructor(e){this.auth=e,this.observer=null,this.addObserver=hp(t=>this.observer=t)}get next(){return I(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}/**
2409
2409
  * @license
2410
2410
  * Copyright 2020 Google LLC
2411
2411
  *
@@ -2420,7 +2420,7 @@ This typically indicates that your device does not have a healthy Internet conne
2420
2420
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2421
2421
  * See the License for the specific language governing permissions and
2422
2422
  * limitations under the License.
2423
- */let ii={async loadJS(){throw new Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function vE(t){ii=t}function _d(t){return ii.loadJS(t)}function EE(){return ii.recaptchaEnterpriseScript}function TE(){return ii.gapiScript}function wE(t){return`__${t}${Math.floor(Math.random()*1e6)}`}const IE="recaptcha-enterprise",AE="NO_RECAPTCHA";class RE{constructor(e){this.type=IE,this.auth=He(e)}async verify(e="verify",n=!1){async function r(i){if(!n){if(i.tenantId==null&&i._agentRecaptchaConfig!=null)return i._agentRecaptchaConfig.siteKey;if(i.tenantId!=null&&i._tenantRecaptchaConfigs[i.tenantId]!==void 0)return i._tenantRecaptchaConfigs[i.tenantId].siteKey}return new Promise(async(o,a)=>{Jv(i,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}).then(c=>{if(c.recaptchaKey===void 0)a(new Error("recaptcha Enterprise site key undefined"));else{const u=new Xv(c);return i.tenantId==null?i._agentRecaptchaConfig=u:i._tenantRecaptchaConfigs[i.tenantId]=u,o(u.siteKey)}}).catch(c=>{a(c)})})}function s(i,o,a){const c=window.grecaptcha;nd(c)?c.enterprise.ready(()=>{c.enterprise.execute(i,{action:e}).then(u=>{o(u)}).catch(()=>{o(AE)})}):a(Error("No reCAPTCHA enterprise script loaded."))}return new Promise((i,o)=>{r(this.auth).then(a=>{if(!n&&nd(window.grecaptcha))s(a,i,o);else{if(typeof window>"u"){o(new Error("RecaptchaVerifier is only supported in browser"));return}let c=EE();c.length!==0&&(c+=a),_d(c).then(()=>{s(a,i,o)}).catch(u=>{o(u)})}}).catch(a=>{o(a)})})}}async function yd(t,e,n,r=!1){const s=new RE(t);let i;try{i=await s.verify(n)}catch{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}async function oi(t,e,n,r){var s;if(!((s=t._getRecaptchaConfig())===null||s===void 0)&&s.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")){const i=await yd(t,e,n,n==="getOobCode");return r(t,i)}else return r(t,e).catch(async i=>{if(i.code==="auth/missing-recaptcha-token"){console.log(`${n} is protected by reCAPTCHA Enterprise for this project. Automatically triggering the reCAPTCHA flow and restarting the flow.`);const o=await yd(t,e,n,n==="getOobCode");return r(t,o)}else return Promise.reject(i)})}/**
2423
+ */let ui={async loadJS(){throw new Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function VE(n){ui=n}function Dd(n){return ui.loadJS(n)}function LE(){return ui.recaptchaEnterpriseScript}function ME(){return ui.gapiScript}function xE(n){return`__${n}${Math.floor(Math.random()*1e6)}`}const UE="recaptcha-enterprise",FE="NO_RECAPTCHA";class BE{constructor(e){this.type=UE,this.auth=Ke(e)}async verify(e="verify",t=!1){async function r(i){if(!t){if(i.tenantId==null&&i._agentRecaptchaConfig!=null)return i._agentRecaptchaConfig.siteKey;if(i.tenantId!=null&&i._tenantRecaptchaConfigs[i.tenantId]!==void 0)return i._tenantRecaptchaConfigs[i.tenantId].siteKey}return new Promise(async(o,a)=>{gE(i,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}).then(c=>{if(c.recaptchaKey===void 0)a(new Error("recaptcha Enterprise site key undefined"));else{const u=new mE(c);return i.tenantId==null?i._agentRecaptchaConfig=u:i._tenantRecaptchaConfigs[i.tenantId]=u,o(u.siteKey)}}).catch(c=>{a(c)})})}function s(i,o,a){const c=window.grecaptcha;pd(c)?c.enterprise.ready(()=>{c.enterprise.execute(i,{action:e}).then(u=>{o(u)}).catch(()=>{o(FE)})}):a(Error("No reCAPTCHA enterprise script loaded."))}return new Promise((i,o)=>{r(this.auth).then(a=>{if(!t&&pd(window.grecaptcha))s(a,i,o);else{if(typeof window>"u"){o(new Error("RecaptchaVerifier is only supported in browser"));return}let c=LE();c.length!==0&&(c+=a),Dd(c).then(()=>{s(a,i,o)}).catch(u=>{o(u)})}}).catch(a=>{o(a)})})}}async function Nd(n,e,t,r=!1){const s=new BE(n);let i;try{i=await s.verify(t)}catch{i=await s.verify(t,!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}async function li(n,e,t,r){var s;if(!((s=n._getRecaptchaConfig())===null||s===void 0)&&s.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")){const i=await Nd(n,e,t,t==="getOobCode");return r(n,i)}else return r(n,e).catch(async i=>{if(i.code==="auth/missing-recaptcha-token"){console.log(`${t} is protected by reCAPTCHA Enterprise for this project. Automatically triggering the reCAPTCHA flow and restarting the flow.`);const o=await Nd(n,e,t,t==="getOobCode");return r(n,o)}else return Promise.reject(i)})}/**
2424
2424
  * @license
2425
2425
  * Copyright 2020 Google LLC
2426
2426
  *
@@ -2435,7 +2435,7 @@ This typically indicates that your device does not have a healthy Internet conne
2435
2435
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2436
2436
  * See the License for the specific language governing permissions and
2437
2437
  * limitations under the License.
2438
- */function PE(t,e){const n=Mn(t,"auth");if(n.isInitialized()){const s=n.getImmediate(),i=n.getOptions();if($r(i,e??{}))return s;be(s,"already-initialized")}return n.initialize({options:e})}function SE(t,e){const n=(e==null?void 0:e.persistence)||[],r=(Array.isArray(n)?n:[n]).map(st);e!=null&&e.errorMap&&t._updateErrorMap(e.errorMap),t._initializeWithPersistence(r,e==null?void 0:e.popupRedirectResolver)}function vd(t,e,n){const r=He(t);I(r._canInitEmulator,r,"emulator-config-failed"),I(/^https?:\/\//.test(e),r,"invalid-emulator-scheme");const s=!!(n!=null&&n.disableWarnings),i=Ed(e),{host:o,port:a}=bE(e),c=a===null?"":`:${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||CE()}function Ed(t){const e=t.indexOf(":");return e<0?"":t.substr(0,e+1)}function bE(t){const e=Ed(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 i=s[1];return{host:i,port:Td(r.substr(i.length+1))}}else{const[i,o]=r.split(":");return{host:i,port:Td(o)}}}function Td(t){if(!t)return null;const e=Number(t);return isNaN(e)?null:e}function CE(){function t(){const e=document.createElement("p"),n=e.style;e.innerText="Running in emulator mode. Do not use with production credentials.",n.position="fixed",n.width="100%",n.backgroundColor="#ffffff",n.border=".1em solid #000000",n.color="#b50000",n.bottom="0px",n.left="0px",n.margin="0px",n.zIndex="10000",n.textAlign="center",e.classList.add("firebase-emulator-warning"),document.body.appendChild(e)}typeof console<"u"&&typeof console.info=="function"&&console.info("WARNING: You are using the Auth Emulator, which is intended for local testing only. Do not use with production credentials."),typeof window<"u"&&typeof document<"u"&&(document.readyState==="loading"?window.addEventListener("DOMContentLoaded",t):t())}/**
2438
+ */function jE(n,e){const t=qn(n,"auth");if(t.isInitialized()){const s=t.getImmediate(),i=t.getOptions();if(Gr(i,e??{}))return s;ke(s,"already-initialized")}return t.initialize({options:e})}function qE(n,e){const t=(e==null?void 0:e.persistence)||[],r=(Array.isArray(t)?t:[t]).map(ct);e!=null&&e.errorMap&&n._updateErrorMap(e.errorMap),n._initializeWithPersistence(r,e==null?void 0:e.popupRedirectResolver)}function Od(n,e,t){const r=Ke(n);I(r._canInitEmulator,r,"emulator-config-failed"),I(/^https?:\/\//.test(e),r,"invalid-emulator-scheme");const s=!!(t!=null&&t.disableWarnings),i=Vd(e),{host:o,port:a}=$E(e),c=a===null?"":`:${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||zE()}function Vd(n){const e=n.indexOf(":");return e<0?"":n.substr(0,e+1)}function $E(n){const e=Vd(n),t=/(\/\/)?([^?#/]+)/.exec(n.substr(e.length));if(!t)return{host:"",port:null};const r=t[2].split("@").pop()||"",s=/^(\[[^\]]+\])(:|$)/.exec(r);if(s){const i=s[1];return{host:i,port:Ld(r.substr(i.length+1))}}else{const[i,o]=r.split(":");return{host:i,port:Ld(o)}}}function Ld(n){if(!n)return null;const e=Number(n);return isNaN(e)?null:e}function zE(){function n(){const e=document.createElement("p"),t=e.style;e.innerText="Running in emulator mode. Do not use with production credentials.",t.position="fixed",t.width="100%",t.backgroundColor="#ffffff",t.border=".1em solid #000000",t.color="#b50000",t.bottom="0px",t.left="0px",t.margin="0px",t.zIndex="10000",t.textAlign="center",e.classList.add("firebase-emulator-warning"),document.body.appendChild(e)}typeof console<"u"&&typeof console.info=="function"&&console.info("WARNING: You are using the Auth Emulator, which is intended for local testing only. Do not use with production credentials."),typeof window<"u"&&typeof document<"u"&&(document.readyState==="loading"?window.addEventListener("DOMContentLoaded",n):n())}/**
2439
2439
  * @license
2440
2440
  * Copyright 2020 Google LLC
2441
2441
  *
@@ -2450,7 +2450,7 @@ This typically indicates that your device does not have a healthy Internet conne
2450
2450
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2451
2451
  * See the License for the specific language governing permissions and
2452
2452
  * limitations under the License.
2453
- */class Da{constructor(e,n){this.providerId=e,this.signInMethod=n}toJSON(){return tt("not implemented")}_getIdTokenResponse(e){return tt("not implemented")}_linkToIdToken(e,n){return tt("not implemented")}_getReauthenticationResolver(e){return tt("not implemented")}}async function kE(t,e){return Oe(t,"POST","/v1/accounts:signUp",e)}/**
2453
+ */class Fa{constructor(e,t){this.providerId=e,this.signInMethod=t}toJSON(){return st("not implemented")}_getIdTokenResponse(e){return st("not implemented")}_linkToIdToken(e,t){return st("not implemented")}_getReauthenticationResolver(e){return st("not implemented")}}async function HE(n,e){return Me(n,"POST","/v1/accounts:signUp",e)}/**
2454
2454
  * @license
2455
2455
  * Copyright 2020 Google LLC
2456
2456
  *
@@ -2465,7 +2465,7 @@ This typically indicates that your device does not have a healthy Internet conne
2465
2465
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2466
2466
  * See the License for the specific language governing permissions and
2467
2467
  * limitations under the License.
2468
- */async function DE(t,e){return kr(t,"POST","/v1/accounts:signInWithPassword",rt(t,e))}async function wd(t,e){return Oe(t,"POST","/v1/accounts:sendOobCode",rt(t,e))}async function NE(t,e){return wd(t,e)}async function OE(t,e){return wd(t,e)}/**
2468
+ */async function WE(n,e){return Mr(n,"POST","/v1/accounts:signInWithPassword",ot(n,e))}async function Md(n,e){return Me(n,"POST","/v1/accounts:sendOobCode",ot(n,e))}async function GE(n,e){return Md(n,e)}async function KE(n,e){return Md(n,e)}/**
2469
2469
  * @license
2470
2470
  * Copyright 2020 Google LLC
2471
2471
  *
@@ -2480,7 +2480,7 @@ This typically indicates that your device does not have a healthy Internet conne
2480
2480
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2481
2481
  * See the License for the specific language governing permissions and
2482
2482
  * limitations under the License.
2483
- */async function VE(t,e){return kr(t,"POST","/v1/accounts:signInWithEmailLink",rt(t,e))}async function LE(t,e){return kr(t,"POST","/v1/accounts:signInWithEmailLink",rt(t,e))}/**
2483
+ */async function QE(n,e){return Mr(n,"POST","/v1/accounts:signInWithEmailLink",ot(n,e))}async function YE(n,e){return Mr(n,"POST","/v1/accounts:signInWithEmailLink",ot(n,e))}/**
2484
2484
  * @license
2485
2485
  * Copyright 2020 Google LLC
2486
2486
  *
@@ -2495,7 +2495,7 @@ This typically indicates that your device does not have a healthy Internet conne
2495
2495
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2496
2496
  * See the License for the specific language governing permissions and
2497
2497
  * limitations under the License.
2498
- */class Vr extends Da{constructor(e,n,r,s=null){super("password",r),this._email=e,this._password=n,this._tenantId=s}static _fromEmailAndPassword(e,n){return new Vr(e,n,"password")}static _fromEmailAndCode(e,n,r=null){return new Vr(e,n,"emailLink",r)}toJSON(){return{email:this._email,password:this._password,signInMethod:this.signInMethod,tenantId:this._tenantId}}static fromJSON(e){const n=typeof e=="string"?JSON.parse(e):e;if(n!=null&&n.email&&(n!=null&&n.password)){if(n.signInMethod==="password")return this._fromEmailAndPassword(n.email,n.password);if(n.signInMethod==="emailLink")return this._fromEmailAndCode(n.email,n.password,n.tenantId)}return null}async _getIdTokenResponse(e){switch(this.signInMethod){case"password":const n={returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"};return oi(e,n,"signInWithPassword",DE);case"emailLink":return VE(e,{email:this._email,oobCode:this._password});default:be(e,"internal-error")}}async _linkToIdToken(e,n){switch(this.signInMethod){case"password":const r={idToken:n,returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"};return oi(e,r,"signUpPassword",kE);case"emailLink":return LE(e,{idToken:n,email:this._email,oobCode:this._password});default:be(e,"internal-error")}}_getReauthenticationResolver(e){return this._getIdTokenResponse(e)}}/**
2498
+ */class Fr extends Fa{constructor(e,t,r,s=null){super("password",r),this._email=e,this._password=t,this._tenantId=s}static _fromEmailAndPassword(e,t){return new Fr(e,t,"password")}static _fromEmailAndCode(e,t,r=null){return new Fr(e,t,"emailLink",r)}toJSON(){return{email:this._email,password:this._password,signInMethod:this.signInMethod,tenantId:this._tenantId}}static fromJSON(e){const t=typeof e=="string"?JSON.parse(e):e;if(t!=null&&t.email&&(t!=null&&t.password)){if(t.signInMethod==="password")return this._fromEmailAndPassword(t.email,t.password);if(t.signInMethod==="emailLink")return this._fromEmailAndCode(t.email,t.password,t.tenantId)}return null}async _getIdTokenResponse(e){switch(this.signInMethod){case"password":const t={returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"};return li(e,t,"signInWithPassword",WE);case"emailLink":return QE(e,{email:this._email,oobCode:this._password});default:ke(e,"internal-error")}}async _linkToIdToken(e,t){switch(this.signInMethod){case"password":const r={idToken:t,returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"};return li(e,r,"signUpPassword",HE);case"emailLink":return YE(e,{idToken:t,email:this._email,oobCode:this._password});default:ke(e,"internal-error")}}_getReauthenticationResolver(e){return this._getIdTokenResponse(e)}}/**
2499
2499
  * @license
2500
2500
  * Copyright 2020 Google LLC
2501
2501
  *
@@ -2510,7 +2510,7 @@ This typically indicates that your device does not have a healthy Internet conne
2510
2510
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2511
2511
  * See the License for the specific language governing permissions and
2512
2512
  * limitations under the License.
2513
- */async function Pn(t,e){return kr(t,"POST","/v1/accounts:signInWithIdp",rt(t,e))}/**
2513
+ */async function Dn(n,e){return Mr(n,"POST","/v1/accounts:signInWithIdp",ot(n,e))}/**
2514
2514
  * @license
2515
2515
  * Copyright 2020 Google LLC
2516
2516
  *
@@ -2525,7 +2525,7 @@ This typically indicates that your device does not have a healthy Internet conne
2525
2525
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2526
2526
  * See the License for the specific language governing permissions and
2527
2527
  * limitations under the License.
2528
- */const ME="http://localhost";class zt extends Da{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(e){const n=new zt(e.providerId,e.signInMethod);return e.idToken||e.accessToken?(e.idToken&&(n.idToken=e.idToken),e.accessToken&&(n.accessToken=e.accessToken),e.nonce&&!e.pendingToken&&(n.nonce=e.nonce),e.pendingToken&&(n.pendingToken=e.pendingToken)):e.oauthToken&&e.oauthTokenSecret?(n.accessToken=e.oauthToken,n.secret=e.oauthTokenSecret):be("argument-error"),n}toJSON(){return{idToken:this.idToken,accessToken:this.accessToken,secret:this.secret,nonce:this.nonce,pendingToken:this.pendingToken,providerId:this.providerId,signInMethod:this.signInMethod}}static fromJSON(e){const n=typeof e=="string"?JSON.parse(e):e,{providerId:r,signInMethod:s}=n,i=Aa(n,["providerId","signInMethod"]);if(!r||!s)return null;const o=new zt(r,s);return o.idToken=i.idToken||void 0,o.accessToken=i.accessToken||void 0,o.secret=i.secret,o.nonce=i.nonce,o.pendingToken=i.pendingToken||null,o}_getIdTokenResponse(e){const n=this.buildRequest();return Pn(e,n)}_linkToIdToken(e,n){const r=this.buildRequest();return r.idToken=n,Pn(e,r)}_getReauthenticationResolver(e){const n=this.buildRequest();return n.autoCreate=!1,Pn(e,n)}buildRequest(){const e={requestUri:ME,returnSecureToken:!0};if(this.pendingToken)e.pendingToken=this.pendingToken;else{const n={};this.idToken&&(n.id_token=this.idToken),this.accessToken&&(n.access_token=this.accessToken),this.secret&&(n.oauth_token_secret=this.secret),n.providerId=this.providerId,this.nonce&&!this.pendingToken&&(n.nonce=this.nonce),e.postBody=On(n)}return e}}/**
2528
+ */const XE="http://localhost";class Gt extends Fa{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(e){const t=new Gt(e.providerId,e.signInMethod);return e.idToken||e.accessToken?(e.idToken&&(t.idToken=e.idToken),e.accessToken&&(t.accessToken=e.accessToken),e.nonce&&!e.pendingToken&&(t.nonce=e.nonce),e.pendingToken&&(t.pendingToken=e.pendingToken)):e.oauthToken&&e.oauthTokenSecret?(t.accessToken=e.oauthToken,t.secret=e.oauthTokenSecret):ke("argument-error"),t}toJSON(){return{idToken:this.idToken,accessToken:this.accessToken,secret:this.secret,nonce:this.nonce,pendingToken:this.pendingToken,providerId:this.providerId,signInMethod:this.signInMethod}}static fromJSON(e){const t=typeof e=="string"?JSON.parse(e):e,{providerId:r,signInMethod:s}=t,i=ka(t,["providerId","signInMethod"]);if(!r||!s)return null;const o=new Gt(r,s);return o.idToken=i.idToken||void 0,o.accessToken=i.accessToken||void 0,o.secret=i.secret,o.nonce=i.nonce,o.pendingToken=i.pendingToken||null,o}_getIdTokenResponse(e){const t=this.buildRequest();return Dn(e,t)}_linkToIdToken(e,t){const r=this.buildRequest();return r.idToken=t,Dn(e,r)}_getReauthenticationResolver(e){const t=this.buildRequest();return t.autoCreate=!1,Dn(e,t)}buildRequest(){const e={requestUri:XE,returnSecureToken:!0};if(this.pendingToken)e.pendingToken=this.pendingToken;else{const t={};this.idToken&&(t.id_token=this.idToken),this.accessToken&&(t.access_token=this.accessToken),this.secret&&(t.oauth_token_secret=this.secret),t.providerId=this.providerId,this.nonce&&!this.pendingToken&&(t.nonce=this.nonce),e.postBody=Fn(t)}return e}}/**
2529
2529
  * @license
2530
2530
  * Copyright 2020 Google LLC
2531
2531
  *
@@ -2540,7 +2540,7 @@ This typically indicates that your device does not have a healthy Internet conne
2540
2540
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2541
2541
  * See the License for the specific language governing permissions and
2542
2542
  * limitations under the License.
2543
- */function xE(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}}function UE(t){const e=Vn(Ln(t)).link,n=e?Vn(Ln(e)).deep_link_id:null,r=Vn(Ln(t)).deep_link_id;return(r?Vn(Ln(r)).link:null)||r||n||e||t}class Na{constructor(e){var n,r,s,i,o,a;const c=Vn(Ln(e)),u=(n=c.apiKey)!==null&&n!==void 0?n:null,l=(r=c.oobCode)!==null&&r!==void 0?r:null,h=xE((s=c.mode)!==null&&s!==void 0?s:null);I(u&&l&&h,"argument-error"),this.apiKey=u,this.operation=h,this.code=l,this.continueUrl=(i=c.continueUrl)!==null&&i!==void 0?i:null,this.languageCode=(o=c.languageCode)!==null&&o!==void 0?o:null,this.tenantId=(a=c.tenantId)!==null&&a!==void 0?a:null}static parseLink(e){const n=UE(e);try{return new Na(n)}catch{return null}}}/**
2543
+ */function JE(n){switch(n){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}}function ZE(n){const e=Bn(jn(n)).link,t=e?Bn(jn(e)).deep_link_id:null,r=Bn(jn(n)).deep_link_id;return(r?Bn(jn(r)).link:null)||r||t||e||n}class Ba{constructor(e){var t,r,s,i,o,a;const c=Bn(jn(e)),u=(t=c.apiKey)!==null&&t!==void 0?t:null,l=(r=c.oobCode)!==null&&r!==void 0?r:null,h=JE((s=c.mode)!==null&&s!==void 0?s:null);I(u&&l&&h,"argument-error"),this.apiKey=u,this.operation=h,this.code=l,this.continueUrl=(i=c.continueUrl)!==null&&i!==void 0?i:null,this.languageCode=(o=c.languageCode)!==null&&o!==void 0?o:null,this.tenantId=(a=c.tenantId)!==null&&a!==void 0?a:null}static parseLink(e){const t=ZE(e);try{return new Ba(t)}catch{return null}}}/**
2544
2544
  * @license
2545
2545
  * Copyright 2020 Google LLC
2546
2546
  *
@@ -2555,7 +2555,7 @@ This typically indicates that your device does not have a healthy Internet conne
2555
2555
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2556
2556
  * See the License for the specific language governing permissions and
2557
2557
  * limitations under the License.
2558
- */class Sn{constructor(){this.providerId=Sn.PROVIDER_ID}static credential(e,n){return Vr._fromEmailAndPassword(e,n)}static credentialWithLink(e,n){const r=Na.parseLink(n);return I(r,"argument-error"),Vr._fromEmailAndCode(e,r.code,r.tenantId)}}Sn.PROVIDER_ID="password",Sn.EMAIL_PASSWORD_SIGN_IN_METHOD="password",Sn.EMAIL_LINK_SIGN_IN_METHOD="emailLink";/**
2558
+ */class Nn{constructor(){this.providerId=Nn.PROVIDER_ID}static credential(e,t){return Fr._fromEmailAndPassword(e,t)}static credentialWithLink(e,t){const r=Ba.parseLink(t);return I(r,"argument-error"),Fr._fromEmailAndCode(e,r.code,r.tenantId)}}Nn.PROVIDER_ID="password",Nn.EMAIL_PASSWORD_SIGN_IN_METHOD="password",Nn.EMAIL_LINK_SIGN_IN_METHOD="emailLink";/**
2559
2559
  * @license
2560
2560
  * Copyright 2020 Google LLC
2561
2561
  *
@@ -2570,7 +2570,7 @@ This typically indicates that your device does not have a healthy Internet conne
2570
2570
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2571
2571
  * See the License for the specific language governing permissions and
2572
2572
  * limitations under the License.
2573
- */class ai{constructor(e){this.providerId=e,this.defaultLanguageCode=null,this.customParameters={}}setDefaultLanguage(e){this.defaultLanguageCode=e}setCustomParameters(e){return this.customParameters=e,this}getCustomParameters(){return this.customParameters}}/**
2573
+ */class hi{constructor(e){this.providerId=e,this.defaultLanguageCode=null,this.customParameters={}}setDefaultLanguage(e){this.defaultLanguageCode=e}setCustomParameters(e){return this.customParameters=e,this}getCustomParameters(){return this.customParameters}}/**
2574
2574
  * @license
2575
2575
  * Copyright 2019 Google LLC
2576
2576
  *
@@ -2585,7 +2585,7 @@ This typically indicates that your device does not have a healthy Internet conne
2585
2585
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2586
2586
  * See the License for the specific language governing permissions and
2587
2587
  * limitations under the License.
2588
- */class Lr extends ai{constructor(){super(...arguments),this.scopes=[]}addScope(e){return this.scopes.includes(e)||this.scopes.push(e),this}getScopes(){return[...this.scopes]}}/**
2588
+ */class Br extends hi{constructor(){super(...arguments),this.scopes=[]}addScope(e){return this.scopes.includes(e)||this.scopes.push(e),this}getScopes(){return[...this.scopes]}}/**
2589
2589
  * @license
2590
2590
  * Copyright 2020 Google LLC
2591
2591
  *
@@ -2600,7 +2600,7 @@ This typically indicates that your device does not have a healthy Internet conne
2600
2600
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2601
2601
  * See the License for the specific language governing permissions and
2602
2602
  * limitations under the License.
2603
- */class We extends Lr{constructor(){super("facebook.com")}static credential(e){return zt._fromParams({providerId:We.PROVIDER_ID,signInMethod:We.FACEBOOK_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return We.credentialFromTaggedObject(e)}static credentialFromError(e){return We.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return We.credential(e.oauthAccessToken)}catch{return null}}}We.FACEBOOK_SIGN_IN_METHOD="facebook.com",We.PROVIDER_ID="facebook.com";/**
2603
+ */class Qe extends Br{constructor(){super("facebook.com")}static credential(e){return Gt._fromParams({providerId:Qe.PROVIDER_ID,signInMethod:Qe.FACEBOOK_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return Qe.credentialFromTaggedObject(e)}static credentialFromError(e){return Qe.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return Qe.credential(e.oauthAccessToken)}catch{return null}}}Qe.FACEBOOK_SIGN_IN_METHOD="facebook.com",Qe.PROVIDER_ID="facebook.com";/**
2604
2604
  * @license
2605
2605
  * Copyright 2020 Google LLC
2606
2606
  *
@@ -2615,7 +2615,7 @@ This typically indicates that your device does not have a healthy Internet conne
2615
2615
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2616
2616
  * See the License for the specific language governing permissions and
2617
2617
  * limitations under the License.
2618
- */class Ge extends Lr{constructor(){super("google.com"),this.addScope("profile")}static credential(e,n){return zt._fromParams({providerId:Ge.PROVIDER_ID,signInMethod:Ge.GOOGLE_SIGN_IN_METHOD,idToken:e,accessToken:n})}static credentialFromResult(e){return Ge.credentialFromTaggedObject(e)}static credentialFromError(e){return Ge.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthIdToken:n,oauthAccessToken:r}=e;if(!n&&!r)return null;try{return Ge.credential(n,r)}catch{return null}}}Ge.GOOGLE_SIGN_IN_METHOD="google.com",Ge.PROVIDER_ID="google.com";/**
2618
+ */class Ye extends Br{constructor(){super("google.com"),this.addScope("profile")}static credential(e,t){return Gt._fromParams({providerId:Ye.PROVIDER_ID,signInMethod:Ye.GOOGLE_SIGN_IN_METHOD,idToken:e,accessToken:t})}static credentialFromResult(e){return Ye.credentialFromTaggedObject(e)}static credentialFromError(e){return Ye.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthIdToken:t,oauthAccessToken:r}=e;if(!t&&!r)return null;try{return Ye.credential(t,r)}catch{return null}}}Ye.GOOGLE_SIGN_IN_METHOD="google.com",Ye.PROVIDER_ID="google.com";/**
2619
2619
  * @license
2620
2620
  * Copyright 2020 Google LLC
2621
2621
  *
@@ -2630,7 +2630,7 @@ This typically indicates that your device does not have a healthy Internet conne
2630
2630
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2631
2631
  * See the License for the specific language governing permissions and
2632
2632
  * limitations under the License.
2633
- */class wt extends Lr{constructor(){super("github.com")}static credential(e){return zt._fromParams({providerId:wt.PROVIDER_ID,signInMethod:wt.GITHUB_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return wt.credentialFromTaggedObject(e)}static credentialFromError(e){return wt.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return wt.credential(e.oauthAccessToken)}catch{return null}}}wt.GITHUB_SIGN_IN_METHOD="github.com",wt.PROVIDER_ID="github.com";/**
2633
+ */class Pt extends Br{constructor(){super("github.com")}static credential(e){return Gt._fromParams({providerId:Pt.PROVIDER_ID,signInMethod:Pt.GITHUB_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return Pt.credentialFromTaggedObject(e)}static credentialFromError(e){return Pt.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return Pt.credential(e.oauthAccessToken)}catch{return null}}}Pt.GITHUB_SIGN_IN_METHOD="github.com",Pt.PROVIDER_ID="github.com";/**
2634
2634
  * @license
2635
2635
  * Copyright 2020 Google LLC
2636
2636
  *
@@ -2645,7 +2645,7 @@ This typically indicates that your device does not have a healthy Internet conne
2645
2645
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2646
2646
  * See the License for the specific language governing permissions and
2647
2647
  * limitations under the License.
2648
- */class Ve extends Lr{constructor(){super("twitter.com")}static credential(e,n){return zt._fromParams({providerId:Ve.PROVIDER_ID,signInMethod:Ve.TWITTER_SIGN_IN_METHOD,oauthToken:e,oauthTokenSecret:n})}static credentialFromResult(e){return Ve.credentialFromTaggedObject(e)}static credentialFromError(e){return Ve.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthAccessToken:n,oauthTokenSecret:r}=e;if(!n||!r)return null;try{return Ve.credential(n,r)}catch{return null}}}Ve.TWITTER_SIGN_IN_METHOD="twitter.com",Ve.PROVIDER_ID="twitter.com";/**
2648
+ */class xe extends Br{constructor(){super("twitter.com")}static credential(e,t){return Gt._fromParams({providerId:xe.PROVIDER_ID,signInMethod:xe.TWITTER_SIGN_IN_METHOD,oauthToken:e,oauthTokenSecret:t})}static credentialFromResult(e){return xe.credentialFromTaggedObject(e)}static credentialFromError(e){return xe.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthAccessToken:t,oauthTokenSecret:r}=e;if(!t||!r)return null;try{return xe.credential(t,r)}catch{return null}}}xe.TWITTER_SIGN_IN_METHOD="twitter.com",xe.PROVIDER_ID="twitter.com";/**
2649
2649
  * @license
2650
2650
  * Copyright 2020 Google LLC
2651
2651
  *
@@ -2660,7 +2660,7 @@ This typically indicates that your device does not have a healthy Internet conne
2660
2660
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2661
2661
  * See the License for the specific language governing permissions and
2662
2662
  * limitations under the License.
2663
- */async function Id(t,e){return kr(t,"POST","/v1/accounts:signUp",rt(t,e))}/**
2663
+ */async function xd(n,e){return Mr(n,"POST","/v1/accounts:signUp",ot(n,e))}/**
2664
2664
  * @license
2665
2665
  * Copyright 2020 Google LLC
2666
2666
  *
@@ -2675,7 +2675,7 @@ This typically indicates that your device does not have a healthy Internet conne
2675
2675
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2676
2676
  * See the License for the specific language governing permissions and
2677
2677
  * limitations under the License.
2678
- */class it{constructor(e){this.user=e.user,this.providerId=e.providerId,this._tokenResponse=e._tokenResponse,this.operationType=e.operationType}static async _fromIdTokenResponse(e,n,r,s=!1){const i=await qt._fromIdTokenResponse(e,r,s),o=Ad(r);return new it({user:i,providerId:o,_tokenResponse:r,operationType:n})}static async _forOperation(e,n,r){await e._updateTokensIfNecessary(r,!0);const s=Ad(r);return new it({user:e,providerId:s,_tokenResponse:r,operationType:n})}}function Ad(t){return t.providerId?t.providerId:"phoneNumber"in t?"phone":null}/**
2678
+ */class ut{constructor(e){this.user=e.user,this.providerId=e.providerId,this._tokenResponse=e._tokenResponse,this.operationType=e.operationType}static async _fromIdTokenResponse(e,t,r,s=!1){const i=await at._fromIdTokenResponse(e,r,s),o=Ud(r);return new ut({user:i,providerId:o,_tokenResponse:r,operationType:t})}static async _forOperation(e,t,r){await e._updateTokensIfNecessary(r,!0);const s=Ud(r);return new ut({user:e,providerId:s,_tokenResponse:r,operationType:t})}}function Ud(n){return n.providerId?n.providerId:"phoneNumber"in n?"phone":null}/**
2679
2679
  * @license
2680
2680
  * Copyright 2020 Google LLC
2681
2681
  *
@@ -2690,7 +2690,7 @@ This typically indicates that your device does not have a healthy Internet conne
2690
2690
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2691
2691
  * See the License for the specific language governing permissions and
2692
2692
  * limitations under the License.
2693
- */async function FE(t){var e;const n=He(t);if(await n._initializationPromise,!((e=n.currentUser)===null||e===void 0)&&e.isAnonymous)return new it({user:n.currentUser,providerId:null,operationType:"signIn"});const r=await Id(n,{returnSecureToken:!0}),s=await it._fromIdTokenResponse(n,"signIn",r,!0);return await n._updateCurrentUser(s.user),s}/**
2693
+ */async function eT(n){var e;if(Pe(n.app))return Promise.reject(Ge(n));const t=Ke(n);if(await t._initializationPromise,!((e=t.currentUser)===null||e===void 0)&&e.isAnonymous)return new ut({user:t.currentUser,providerId:null,operationType:"signIn"});const r=await xd(t,{returnSecureToken:!0}),s=await ut._fromIdTokenResponse(t,"signIn",r,!0);return await t._updateCurrentUser(s.user),s}/**
2694
2694
  * @license
2695
2695
  * Copyright 2020 Google LLC
2696
2696
  *
@@ -2705,7 +2705,7 @@ This typically indicates that your device does not have a healthy Internet conne
2705
2705
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2706
2706
  * See the License for the specific language governing permissions and
2707
2707
  * limitations under the License.
2708
- */class ci extends Ce{constructor(e,n,r,s){var i;super(n.code,n.message),this.operationType=r,this.user=s,Object.setPrototypeOf(this,ci.prototype),this.customData={appName:e.name,tenantId:(i=e.tenantId)!==null&&i!==void 0?i:void 0,_serverResponse:n.customData._serverResponse,operationType:r}}static _fromErrorAndOperation(e,n,r,s){return new ci(e,n,r,s)}}function Rd(t,e,n,r){return(e==="reauthenticate"?n._getReauthenticationResolver(t):n._getIdTokenResponse(t)).catch(i=>{throw i.code==="auth/multi-factor-auth-required"?ci._fromErrorAndOperation(t,i,e,r):i})}/**
2708
+ */class di extends De{constructor(e,t,r,s){var i;super(t.code,t.message),this.operationType=r,this.user=s,Object.setPrototypeOf(this,di.prototype),this.customData={appName:e.name,tenantId:(i=e.tenantId)!==null&&i!==void 0?i:void 0,_serverResponse:t.customData._serverResponse,operationType:r}}static _fromErrorAndOperation(e,t,r,s){return new di(e,t,r,s)}}function Fd(n,e,t,r){return(e==="reauthenticate"?t._getReauthenticationResolver(n):t._getIdTokenResponse(n)).catch(i=>{throw i.code==="auth/multi-factor-auth-required"?di._fromErrorAndOperation(n,i,e,r):i})}/**
2709
2709
  * @license
2710
2710
  * Copyright 2020 Google LLC
2711
2711
  *
@@ -2720,7 +2720,7 @@ This typically indicates that your device does not have a healthy Internet conne
2720
2720
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2721
2721
  * See the License for the specific language governing permissions and
2722
2722
  * limitations under the License.
2723
- */function Pd(t){return new Set(t.map(({providerId:e})=>e).filter(e=>!!e))}/**
2723
+ */function Bd(n){return new Set(n.map(({providerId:e})=>e).filter(e=>!!e))}/**
2724
2724
  * @license
2725
2725
  * Copyright 2019 Google LLC
2726
2726
  *
@@ -2735,7 +2735,7 @@ This typically indicates that your device does not have a healthy Internet conne
2735
2735
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2736
2736
  * See the License for the specific language governing permissions and
2737
2737
  * limitations under the License.
2738
- */async function BE(t,e){const n=x(t);await $E(!0,n,e);const{providerUserInfo:r}=await eE(n.auth,{idToken:await n.getIdToken(),deleteProvider:[e]}),s=Pd(r||[]);return n.providerData=n.providerData.filter(i=>s.has(i.providerId)),s.has("phone")||(n.phoneNumber=null),await n.auth._persistUserIfCurrent(n),n}async function jE(t,e,n=!1){const r=await An(t,e._linkToIdToken(t.auth,await t.getIdToken()),n);return it._forOperation(t,"link",r)}async function $E(t,e,n){await Nr(e);const r=Pd(e.providerData),s=t===!1?"provider-already-linked":"no-such-provider";I(r.has(n)===t,e.auth,s)}/**
2738
+ */async function tT(n,e){const t=x(n);await rT(!0,t,e);const{providerUserInfo:r}=await yE(t.auth,{idToken:await t.getIdToken(),deleteProvider:[e]}),s=Bd(r||[]);return t.providerData=t.providerData.filter(i=>s.has(i.providerId)),s.has("phone")||(t.phoneNumber=null),await t.auth._persistUserIfCurrent(t),t}async function nT(n,e,t=!1){const r=await bn(n,e._linkToIdToken(n.auth,await n.getIdToken()),t);return ut._forOperation(n,"link",r)}async function rT(n,e,t){await Ur(e);const r=Bd(e.providerData),s=n===!1?"provider-already-linked":"no-such-provider";I(r.has(t)===n,e.auth,s)}/**
2739
2739
  * @license
2740
2740
  * Copyright 2019 Google LLC
2741
2741
  *
@@ -2750,7 +2750,7 @@ This typically indicates that your device does not have a healthy Internet conne
2750
2750
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2751
2751
  * See the License for the specific language governing permissions and
2752
2752
  * limitations under the License.
2753
- */async function qE(t,e,n=!1){const{auth:r}=t,s="reauthenticate";try{const i=await An(t,Rd(r,s,e,t),n);I(i.idToken,r,"internal-error");const o=Ca(i.idToken);I(o,r,"internal-error");const{sub:a}=o;return I(t.uid===a,r,"user-mismatch"),it._forOperation(t,s,i)}catch(i){throw(i==null?void 0:i.code)==="auth/user-not-found"&&be(r,"user-mismatch"),i}}/**
2753
+ */async function sT(n,e,t=!1){const{auth:r}=n;if(Pe(r.app))return Promise.reject(Ge(r));const s="reauthenticate";try{const i=await bn(n,Fd(r,s,e,n),t);I(i.idToken,r,"internal-error");const o=Ma(i.idToken);I(o,r,"internal-error");const{sub:a}=o;return I(n.uid===a,r,"user-mismatch"),ut._forOperation(n,s,i)}catch(i){throw(i==null?void 0:i.code)==="auth/user-not-found"&&ke(r,"user-mismatch"),i}}/**
2754
2754
  * @license
2755
2755
  * Copyright 2020 Google LLC
2756
2756
  *
@@ -2765,7 +2765,7 @@ This typically indicates that your device does not have a healthy Internet conne
2765
2765
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2766
2766
  * See the License for the specific language governing permissions and
2767
2767
  * limitations under the License.
2768
- */async function Sd(t,e,n=!1){const r="signIn",s=await Rd(t,r,e),i=await it._fromIdTokenResponse(t,r,s);return n||await t._updateCurrentUser(i.user),i}async function zE(t,e){return Sd(He(t),e)}/**
2768
+ */async function jd(n,e,t=!1){if(Pe(n.app))return Promise.reject(Ge(n));const r="signIn",s=await Fd(n,r,e),i=await ut._fromIdTokenResponse(n,r,s);return t||await n._updateCurrentUser(i.user),i}async function iT(n,e){return jd(Ke(n),e)}/**
2769
2769
  * @license
2770
2770
  * Copyright 2020 Google LLC
2771
2771
  *
@@ -2780,7 +2780,7 @@ This typically indicates that your device does not have a healthy Internet conne
2780
2780
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2781
2781
  * See the License for the specific language governing permissions and
2782
2782
  * limitations under the License.
2783
- */function bd(t,e,n){var r;I(((r=n.url)===null||r===void 0?void 0:r.length)>0,t,"invalid-continue-uri"),I(typeof n.dynamicLinkDomain>"u"||n.dynamicLinkDomain.length>0,t,"invalid-dynamic-link-domain"),e.continueUrl=n.url,e.dynamicLinkDomain=n.dynamicLinkDomain,e.canHandleCodeInApp=n.handleCodeInApp,n.iOS&&(I(n.iOS.bundleId.length>0,t,"missing-ios-bundle-id"),e.iOSBundleId=n.iOS.bundleId),n.android&&(I(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)}/**
2783
+ */function qd(n,e,t){var r;I(((r=t.url)===null||r===void 0?void 0:r.length)>0,n,"invalid-continue-uri"),I(typeof t.dynamicLinkDomain>"u"||t.dynamicLinkDomain.length>0,n,"invalid-dynamic-link-domain"),e.continueUrl=t.url,e.dynamicLinkDomain=t.dynamicLinkDomain,e.canHandleCodeInApp=t.handleCodeInApp,t.iOS&&(I(t.iOS.bundleId.length>0,n,"missing-ios-bundle-id"),e.iOSBundleId=t.iOS.bundleId),t.android&&(I(t.android.packageName.length>0,n,"missing-android-pkg-name"),e.androidInstallApp=t.android.installApp,e.androidMinimumVersionCode=t.android.minimumVersion,e.androidPackageName=t.android.packageName)}/**
2784
2784
  * @license
2785
2785
  * Copyright 2020 Google LLC
2786
2786
  *
@@ -2795,7 +2795,7 @@ This typically indicates that your device does not have a healthy Internet conne
2795
2795
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2796
2796
  * See the License for the specific language governing permissions and
2797
2797
  * limitations under the License.
2798
- */async function Cd(t){const e=He(t);e._getPasswordPolicyInternal()&&await e._updatePasswordPolicy()}async function HE(t,e,n){const r=He(t),s={requestType:"PASSWORD_RESET",email:e,clientType:"CLIENT_TYPE_WEB"};n&&bd(r,s,n),await oi(r,s,"getOobCode",OE)}async function WE(t,e,n){const r=He(t),o=await oi(r,{returnSecureToken:!0,email:e,password:n,clientType:"CLIENT_TYPE_WEB"},"signUpPassword",Id).catch(c=>{throw c.code==="auth/password-does-not-meet-requirements"&&Cd(t),c}),a=await it._fromIdTokenResponse(r,"signIn",o);return await r._updateCurrentUser(a.user),a}function kd(t,e,n){return zE(x(t),Sn.credential(e,n)).catch(async r=>{throw r.code==="auth/password-does-not-meet-requirements"&&Cd(t),r})}async function Dd(t,e){const n=x(t),s={requestType:"VERIFY_EMAIL",idToken:await t.getIdToken()};e&&bd(n.auth,s,e);const{email:i}=await NE(n.auth,s);i!==t.email&&await t.reload()}/**
2798
+ */async function $d(n){const e=Ke(n);e._getPasswordPolicyInternal()&&await e._updatePasswordPolicy()}async function oT(n,e,t){const r=Ke(n),s={requestType:"PASSWORD_RESET",email:e,clientType:"CLIENT_TYPE_WEB"};t&&qd(r,s,t),await li(r,s,"getOobCode",KE)}async function aT(n,e,t){if(Pe(n.app))return Promise.reject(Ge(n));const r=Ke(n),o=await li(r,{returnSecureToken:!0,email:e,password:t,clientType:"CLIENT_TYPE_WEB"},"signUpPassword",xd).catch(c=>{throw c.code==="auth/password-does-not-meet-requirements"&&$d(n),c}),a=await ut._fromIdTokenResponse(r,"signIn",o);return await r._updateCurrentUser(a.user),a}function zd(n,e,t){return Pe(n.app)?Promise.reject(Ge(n)):iT(x(n),Nn.credential(e,t)).catch(async r=>{throw r.code==="auth/password-does-not-meet-requirements"&&$d(n),r})}async function Hd(n,e){const t=x(n),s={requestType:"VERIFY_EMAIL",idToken:await n.getIdToken()};e&&qd(t.auth,s,e);const{email:i}=await GE(t.auth,s);i!==n.email&&await n.reload()}/**
2799
2799
  * @license
2800
2800
  * Copyright 2020 Google LLC
2801
2801
  *
@@ -2810,7 +2810,7 @@ This typically indicates that your device does not have a healthy Internet conne
2810
2810
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2811
2811
  * See the License for the specific language governing permissions and
2812
2812
  * limitations under the License.
2813
- */async function GE(t,e){return Oe(t,"POST","/v1/accounts:update",e)}/**
2813
+ */async function cT(n,e){return Me(n,"POST","/v1/accounts:update",e)}/**
2814
2814
  * @license
2815
2815
  * Copyright 2020 Google LLC
2816
2816
  *
@@ -2825,7 +2825,7 @@ This typically indicates that your device does not have a healthy Internet conne
2825
2825
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2826
2826
  * See the License for the specific language governing permissions and
2827
2827
  * limitations under the License.
2828
- */async function KE(t,{displayName:e,photoURL:n}){if(e===void 0&&n===void 0)return;const r=x(t),i={idToken:await r.getIdToken(),displayName:e,photoUrl:n,returnSecureToken:!0},o=await An(r,GE(r.auth,i));r.displayName=o.displayName||null,r.photoURL=o.photoUrl||null;const a=r.providerData.find(({providerId:c})=>c==="password");a&&(a.displayName=r.displayName,a.photoURL=r.photoURL),await r._updateTokensIfNecessary(o)}function QE(t,e,n,r){return x(t).onIdTokenChanged(e,n,r)}function YE(t,e,n){return x(t).beforeAuthStateChanged(e,n)}const ui="__sak";/**
2828
+ */async function uT(n,{displayName:e,photoURL:t}){if(e===void 0&&t===void 0)return;const r=x(n),i={idToken:await r.getIdToken(),displayName:e,photoUrl:t,returnSecureToken:!0},o=await bn(r,cT(r.auth,i));r.displayName=o.displayName||null,r.photoURL=o.photoUrl||null;const a=r.providerData.find(({providerId:c})=>c==="password");a&&(a.displayName=r.displayName,a.photoURL=r.photoURL),await r._updateTokensIfNecessary(o)}function lT(n,e,t,r){return x(n).onIdTokenChanged(e,t,r)}function hT(n,e,t){return x(n).beforeAuthStateChanged(e,t)}const fi="__sak";/**
2829
2829
  * @license
2830
2830
  * Copyright 2019 Google LLC
2831
2831
  *
@@ -2840,7 +2840,7 @@ This typically indicates that your device does not have a healthy Internet conne
2840
2840
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2841
2841
  * See the License for the specific language governing permissions and
2842
2842
  * limitations under the License.
2843
- */class Nd{constructor(e,n){this.storageRetriever=e,this.type=n}_isAvailable(){try{return this.storage?(this.storage.setItem(ui,"1"),this.storage.removeItem(ui),Promise.resolve(!0)):Promise.resolve(!1)}catch{return Promise.resolve(!1)}}_set(e,n){return this.storage.setItem(e,JSON.stringify(n)),Promise.resolve()}_get(e){const n=this.storage.getItem(e);return Promise.resolve(n?JSON.parse(n):null)}_remove(e){return this.storage.removeItem(e),Promise.resolve()}get storage(){return this.storageRetriever()}}/**
2843
+ */class Wd{constructor(e,t){this.storageRetriever=e,this.type=t}_isAvailable(){try{return this.storage?(this.storage.setItem(fi,"1"),this.storage.removeItem(fi),Promise.resolve(!0)):Promise.resolve(!1)}catch{return Promise.resolve(!1)}}_set(e,t){return this.storage.setItem(e,JSON.stringify(t)),Promise.resolve()}_get(e){const t=this.storage.getItem(e);return Promise.resolve(t?JSON.parse(t):null)}_remove(e){return this.storage.removeItem(e),Promise.resolve()}get storage(){return this.storageRetriever()}}/**
2844
2844
  * @license
2845
2845
  * Copyright 2020 Google LLC
2846
2846
  *
@@ -2855,7 +2855,7 @@ This typically indicates that your device does not have a healthy Internet conne
2855
2855
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2856
2856
  * See the License for the specific language governing permissions and
2857
2857
  * limitations under the License.
2858
- */function XE(){const t=W();return ka(t)||si(t)}const JE=1e3,ZE=10;class Od extends Nd{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(e,n)=>this.onStorageEvent(e,n),this.listeners={},this.localCache={},this.pollTimer=null,this.safariLocalStorageNotSynced=XE()&&fE(),this.fallbackToPolling=pd(),this._shouldAllowMigration=!0}forAllChangedKeys(e){for(const n of Object.keys(this.listeners)){const r=this.storage.getItem(n),s=this.localCache[n];r!==s&&e(n,s,r)}}onStorageEvent(e,n=!1){if(!e.key){this.forAllChangedKeys((o,a,c)=>{this.notifyListeners(o,c)});return}const r=e.key;if(n?this.detachListener():this.stopPolling(),this.safariLocalStorageNotSynced){const o=this.storage.getItem(r);if(e.newValue!==o)e.newValue!==null?this.storage.setItem(r,e.newValue):this.storage.removeItem(r);else if(this.localCache[r]===e.newValue&&!n)return}const s=()=>{const o=this.storage.getItem(r);!n&&this.localCache[r]===o||this.notifyListeners(r,o)},i=this.storage.getItem(r);dE()&&i!==e.newValue&&e.newValue!==e.oldValue?setTimeout(s,ZE):s()}notifyListeners(e,n){this.localCache[e]=n;const r=this.listeners[e];if(r)for(const s of Array.from(r))s(n&&JSON.parse(n))}startPolling(){this.stopPolling(),this.pollTimer=setInterval(()=>{this.forAllChangedKeys((e,n,r)=>{this.onStorageEvent(new StorageEvent("storage",{key:e,oldValue:n,newValue:r}),!0)})},JE)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}attachListener(){window.addEventListener("storage",this.boundEventHandler)}detachListener(){window.removeEventListener("storage",this.boundEventHandler)}_addListener(e,n){Object.keys(this.listeners).length===0&&(this.fallbackToPolling?this.startPolling():this.attachListener()),this.listeners[e]||(this.listeners[e]=new Set,this.localCache[e]=this.storage.getItem(e)),this.listeners[e].add(n)}_removeListener(e,n){this.listeners[e]&&(this.listeners[e].delete(n),this.listeners[e].size===0&&delete this.listeners[e]),Object.keys(this.listeners).length===0&&(this.detachListener(),this.stopPolling())}async _set(e,n){await super._set(e,n),this.localCache[e]=JSON.stringify(n)}async _get(e){const n=await super._get(e);return this.localCache[e]=JSON.stringify(n),n}async _remove(e){await super._remove(e),delete this.localCache[e]}}Od.type="LOCAL";const eT=Od;/**
2858
+ */function dT(){const n=W();return Ua(n)||ci(n)}const fT=1e3,pT=10;class Gd extends Wd{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(e,t)=>this.onStorageEvent(e,t),this.listeners={},this.localCache={},this.pollTimer=null,this.safariLocalStorageNotSynced=dT()&&bE(),this.fallbackToPolling=bd(),this._shouldAllowMigration=!0}forAllChangedKeys(e){for(const t of Object.keys(this.listeners)){const r=this.storage.getItem(t),s=this.localCache[t];r!==s&&e(t,s,r)}}onStorageEvent(e,t=!1){if(!e.key){this.forAllChangedKeys((o,a,c)=>{this.notifyListeners(o,c)});return}const r=e.key;if(t?this.detachListener():this.stopPolling(),this.safariLocalStorageNotSynced){const o=this.storage.getItem(r);if(e.newValue!==o)e.newValue!==null?this.storage.setItem(r,e.newValue):this.storage.removeItem(r);else if(this.localCache[r]===e.newValue&&!t)return}const s=()=>{const o=this.storage.getItem(r);!t&&this.localCache[r]===o||this.notifyListeners(r,o)},i=this.storage.getItem(r);SE()&&i!==e.newValue&&e.newValue!==e.oldValue?setTimeout(s,pT):s()}notifyListeners(e,t){this.localCache[e]=t;const r=this.listeners[e];if(r)for(const s of Array.from(r))s(t&&JSON.parse(t))}startPolling(){this.stopPolling(),this.pollTimer=setInterval(()=>{this.forAllChangedKeys((e,t,r)=>{this.onStorageEvent(new StorageEvent("storage",{key:e,oldValue:t,newValue:r}),!0)})},fT)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}attachListener(){window.addEventListener("storage",this.boundEventHandler)}detachListener(){window.removeEventListener("storage",this.boundEventHandler)}_addListener(e,t){Object.keys(this.listeners).length===0&&(this.fallbackToPolling?this.startPolling():this.attachListener()),this.listeners[e]||(this.listeners[e]=new Set,this.localCache[e]=this.storage.getItem(e)),this.listeners[e].add(t)}_removeListener(e,t){this.listeners[e]&&(this.listeners[e].delete(t),this.listeners[e].size===0&&delete this.listeners[e]),Object.keys(this.listeners).length===0&&(this.detachListener(),this.stopPolling())}async _set(e,t){await super._set(e,t),this.localCache[e]=JSON.stringify(t)}async _get(e){const t=await super._get(e);return this.localCache[e]=JSON.stringify(t),t}async _remove(e){await super._remove(e),delete this.localCache[e]}}Gd.type="LOCAL";const mT=Gd;/**
2859
2859
  * @license
2860
2860
  * Copyright 2020 Google LLC
2861
2861
  *
@@ -2870,7 +2870,7 @@ This typically indicates that your device does not have a healthy Internet conne
2870
2870
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2871
2871
  * See the License for the specific language governing permissions and
2872
2872
  * limitations under the License.
2873
- */class Vd extends Nd{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(e,n){}_removeListener(e,n){}}Vd.type="SESSION";const Ld=Vd;/**
2873
+ */class Kd extends Wd{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(e,t){}_removeListener(e,t){}}Kd.type="SESSION";const Qd=Kd;/**
2874
2874
  * @license
2875
2875
  * Copyright 2019 Google LLC
2876
2876
  *
@@ -2885,7 +2885,7 @@ This typically indicates that your device does not have a healthy Internet conne
2885
2885
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2886
2886
  * See the License for the specific language governing permissions and
2887
2887
  * limitations under the License.
2888
- */function tT(t){return Promise.all(t.map(async e=>{try{return{fulfilled:!0,value:await e}}catch(n){return{fulfilled:!1,reason:n}}}))}/**
2888
+ */function gT(n){return Promise.all(n.map(async e=>{try{return{fulfilled:!0,value:await e}}catch(t){return{fulfilled:!1,reason:t}}}))}/**
2889
2889
  * @license
2890
2890
  * Copyright 2019 Google LLC
2891
2891
  *
@@ -2900,7 +2900,7 @@ This typically indicates that your device does not have a healthy Internet conne
2900
2900
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2901
2901
  * See the License for the specific language governing permissions and
2902
2902
  * limitations under the License.
2903
- */class li{constructor(e){this.eventTarget=e,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(e){const n=this.receivers.find(s=>s.isListeningto(e));if(n)return n;const r=new li(e);return this.receivers.push(r),r}isListeningto(e){return this.eventTarget===e}async handleEvent(e){const n=e,{eventId:r,eventType:s,data:i}=n.data,o=this.handlersMap[s];if(!(o!=null&&o.size))return;n.ports[0].postMessage({status:"ack",eventId:r,eventType:s});const a=Array.from(o).map(async u=>u(n.origin,i)),c=await tT(a);n.ports[0].postMessage({status:"done",eventId:r,eventType:s,response:c})}_subscribe(e,n){Object.keys(this.handlersMap).length===0&&this.eventTarget.addEventListener("message",this.boundEventHandler),this.handlersMap[e]||(this.handlersMap[e]=new Set),this.handlersMap[e].add(n)}_unsubscribe(e,n){this.handlersMap[e]&&n&&this.handlersMap[e].delete(n),(!n||this.handlersMap[e].size===0)&&delete this.handlersMap[e],Object.keys(this.handlersMap).length===0&&this.eventTarget.removeEventListener("message",this.boundEventHandler)}}li.receivers=[];/**
2903
+ */class pi{constructor(e){this.eventTarget=e,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(e){const t=this.receivers.find(s=>s.isListeningto(e));if(t)return t;const r=new pi(e);return this.receivers.push(r),r}isListeningto(e){return this.eventTarget===e}async handleEvent(e){const t=e,{eventId:r,eventType:s,data:i}=t.data,o=this.handlersMap[s];if(!(o!=null&&o.size))return;t.ports[0].postMessage({status:"ack",eventId:r,eventType:s});const a=Array.from(o).map(async u=>u(t.origin,i)),c=await gT(a);t.ports[0].postMessage({status:"done",eventId:r,eventType:s,response:c})}_subscribe(e,t){Object.keys(this.handlersMap).length===0&&this.eventTarget.addEventListener("message",this.boundEventHandler),this.handlersMap[e]||(this.handlersMap[e]=new Set),this.handlersMap[e].add(t)}_unsubscribe(e,t){this.handlersMap[e]&&t&&this.handlersMap[e].delete(t),(!t||this.handlersMap[e].size===0)&&delete this.handlersMap[e],Object.keys(this.handlersMap).length===0&&this.eventTarget.removeEventListener("message",this.boundEventHandler)}}pi.receivers=[];/**
2904
2904
  * @license
2905
2905
  * Copyright 2020 Google LLC
2906
2906
  *
@@ -2915,7 +2915,7 @@ This typically indicates that your device does not have a healthy Internet conne
2915
2915
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2916
2916
  * See the License for the specific language governing permissions and
2917
2917
  * limitations under the License.
2918
- */function Oa(t="",e=10){let n="";for(let r=0;r<e;r++)n+=Math.floor(Math.random()*10);return t+n}/**
2918
+ */function ja(n="",e=10){let t="";for(let r=0;r<e;r++)t+=Math.floor(Math.random()*10);return n+t}/**
2919
2919
  * @license
2920
2920
  * Copyright 2019 Google LLC
2921
2921
  *
@@ -2930,7 +2930,7 @@ This typically indicates that your device does not have a healthy Internet conne
2930
2930
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2931
2931
  * See the License for the specific language governing permissions and
2932
2932
  * limitations under the License.
2933
- */class nT{constructor(e){this.target=e,this.handlers=new Set}removeMessageHandler(e){e.messageChannel&&(e.messageChannel.port1.removeEventListener("message",e.onMessage),e.messageChannel.port1.close()),this.handlers.delete(e)}async _send(e,n,r=50){const s=typeof MessageChannel<"u"?new MessageChannel:null;if(!s)throw new Error("connection_unavailable");let i,o;return new Promise((a,c)=>{const u=Oa("",20);s.port1.start();const l=setTimeout(()=>{c(new Error("unsupported_event"))},r);o={messageChannel:s,onMessage(h){const d=h;if(d.data.eventId===u)switch(d.data.status){case"ack":clearTimeout(l),i=setTimeout(()=>{c(new Error("timeout"))},3e3);break;case"done":clearTimeout(i),a(d.data.response);break;default:clearTimeout(l),clearTimeout(i),c(new Error("invalid_response"));break}}},this.handlers.add(o),s.port1.addEventListener("message",o.onMessage),this.target.postMessage({eventType:e,eventId:u,data:n},[s.port2])}).finally(()=>{o&&this.removeMessageHandler(o)})}}/**
2933
+ */class _T{constructor(e){this.target=e,this.handlers=new Set}removeMessageHandler(e){e.messageChannel&&(e.messageChannel.port1.removeEventListener("message",e.onMessage),e.messageChannel.port1.close()),this.handlers.delete(e)}async _send(e,t,r=50){const s=typeof MessageChannel<"u"?new MessageChannel:null;if(!s)throw new Error("connection_unavailable");let i,o;return new Promise((a,c)=>{const u=ja("",20);s.port1.start();const l=setTimeout(()=>{c(new Error("unsupported_event"))},r);o={messageChannel:s,onMessage(h){const d=h;if(d.data.eventId===u)switch(d.data.status){case"ack":clearTimeout(l),i=setTimeout(()=>{c(new Error("timeout"))},3e3);break;case"done":clearTimeout(i),a(d.data.response);break;default:clearTimeout(l),clearTimeout(i),c(new Error("invalid_response"));break}}},this.handlers.add(o),s.port1.addEventListener("message",o.onMessage),this.target.postMessage({eventType:e,eventId:u,data:t},[s.port2])}).finally(()=>{o&&this.removeMessageHandler(o)})}}/**
2934
2934
  * @license
2935
2935
  * Copyright 2020 Google LLC
2936
2936
  *
@@ -2945,7 +2945,7 @@ This typically indicates that your device does not have a healthy Internet conne
2945
2945
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2946
2946
  * See the License for the specific language governing permissions and
2947
2947
  * limitations under the License.
2948
- */function Ke(){return window}function rT(t){Ke().location.href=t}/**
2948
+ */function Xe(){return window}function yT(n){Xe().location.href=n}/**
2949
2949
  * @license
2950
2950
  * Copyright 2020 Google LLC.
2951
2951
  *
@@ -2960,7 +2960,7 @@ This typically indicates that your device does not have a healthy Internet conne
2960
2960
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2961
2961
  * See the License for the specific language governing permissions and
2962
2962
  * limitations under the License.
2963
- */function Md(){return typeof Ke().WorkerGlobalScope<"u"&&typeof Ke().importScripts=="function"}async function sT(){if(!(navigator!=null&&navigator.serviceWorker))return null;try{return(await navigator.serviceWorker.ready).active}catch{return null}}function iT(){var t;return((t=navigator==null?void 0:navigator.serviceWorker)===null||t===void 0?void 0:t.controller)||null}function oT(){return Md()?self:null}/**
2963
+ */function Yd(){return typeof Xe().WorkerGlobalScope<"u"&&typeof Xe().importScripts=="function"}async function vT(){if(!(navigator!=null&&navigator.serviceWorker))return null;try{return(await navigator.serviceWorker.ready).active}catch{return null}}function ET(){var n;return((n=navigator==null?void 0:navigator.serviceWorker)===null||n===void 0?void 0:n.controller)||null}function TT(){return Yd()?self:null}/**
2964
2964
  * @license
2965
2965
  * Copyright 2019 Google LLC
2966
2966
  *
@@ -2975,7 +2975,7 @@ This typically indicates that your device does not have a healthy Internet conne
2975
2975
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2976
2976
  * See the License for the specific language governing permissions and
2977
2977
  * limitations under the License.
2978
- */const xd="firebaseLocalStorageDb",aT=1,hi="firebaseLocalStorage",Ud="fbase_key";class Mr{constructor(e){this.request=e}toPromise(){return new Promise((e,n)=>{this.request.addEventListener("success",()=>{e(this.request.result)}),this.request.addEventListener("error",()=>{n(this.request.error)})})}}function di(t,e){return t.transaction([hi],e?"readwrite":"readonly").objectStore(hi)}function cT(){const t=indexedDB.deleteDatabase(xd);return new Mr(t).toPromise()}function Va(){const t=indexedDB.open(xd,aT);return new Promise((e,n)=>{t.addEventListener("error",()=>{n(t.error)}),t.addEventListener("upgradeneeded",()=>{const r=t.result;try{r.createObjectStore(hi,{keyPath:Ud})}catch(s){n(s)}}),t.addEventListener("success",async()=>{const r=t.result;r.objectStoreNames.contains(hi)?e(r):(r.close(),await cT(),e(await Va()))})})}async function Fd(t,e,n){const r=di(t,!0).put({[Ud]:e,value:n});return new Mr(r).toPromise()}async function uT(t,e){const n=di(t,!1).get(e),r=await new Mr(n).toPromise();return r===void 0?null:r.value}function Bd(t,e){const n=di(t,!0).delete(e);return new Mr(n).toPromise()}const lT=800,hT=3;class jd{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:(this.db=await Va(),this.db)}async _withRetries(e){let n=0;for(;;)try{const r=await this._openDb();return await e(r)}catch(r){if(n++>hT)throw r;this.db&&(this.db.close(),this.db=void 0)}}async initializeServiceWorkerMessaging(){return Md()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=li._getInstance(oT()),this.receiver._subscribe("keyChanged",async(e,n)=>({keyProcessed:(await this._poll()).includes(n.key)})),this.receiver._subscribe("ping",async(e,n)=>["keyChanged"])}async initializeSender(){var e,n;if(this.activeServiceWorker=await sT(),!this.activeServiceWorker)return;this.sender=new nT(this.activeServiceWorker);const r=await this.sender._send("ping",{},800);r&&!((e=r[0])===null||e===void 0)&&e.fulfilled&&!((n=r[0])===null||n===void 0)&&n.value.includes("keyChanged")&&(this.serviceWorkerReceiverAvailable=!0)}async notifyServiceWorker(e){if(!(!this.sender||!this.activeServiceWorker||iT()!==this.activeServiceWorker))try{await this.sender._send("keyChanged",{key:e},this.serviceWorkerReceiverAvailable?800:50)}catch{}}async _isAvailable(){try{if(!indexedDB)return!1;const e=await Va();return await Fd(e,ui,"1"),await Bd(e,ui),!0}catch{}return!1}async _withPendingWrite(e){this.pendingWrites++;try{await e()}finally{this.pendingWrites--}}async _set(e,n){return this._withPendingWrite(async()=>(await this._withRetries(r=>Fd(r,e,n)),this.localCache[e]=n,this.notifyServiceWorker(e)))}async _get(e){const n=await this._withRetries(r=>uT(r,e));return this.localCache[e]=n,n}async _remove(e){return this._withPendingWrite(async()=>(await this._withRetries(n=>Bd(n,e)),delete this.localCache[e],this.notifyServiceWorker(e)))}async _poll(){const e=await this._withRetries(s=>{const i=di(s,!1).getAll();return new Mr(i).toPromise()});if(!e)return[];if(this.pendingWrites!==0)return[];const n=[],r=new Set;if(e.length!==0)for(const{fbase_key:s,value:i}of e)r.add(s),JSON.stringify(this.localCache[s])!==JSON.stringify(i)&&(this.notifyListeners(s,i),n.push(s));for(const s of Object.keys(this.localCache))this.localCache[s]&&!r.has(s)&&(this.notifyListeners(s,null),n.push(s));return n}notifyListeners(e,n){this.localCache[e]=n;const r=this.listeners[e];if(r)for(const s of Array.from(r))s(n)}startPolling(){this.stopPolling(),this.pollTimer=setInterval(async()=>this._poll(),lT)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}_addListener(e,n){Object.keys(this.listeners).length===0&&this.startPolling(),this.listeners[e]||(this.listeners[e]=new Set,this._get(e)),this.listeners[e].add(n)}_removeListener(e,n){this.listeners[e]&&(this.listeners[e].delete(n),this.listeners[e].size===0&&delete this.listeners[e]),Object.keys(this.listeners).length===0&&this.stopPolling()}}jd.type="LOCAL";const dT=jd;new Cr(3e4,6e4);/**
2978
+ */const Xd="firebaseLocalStorageDb",wT=1,mi="firebaseLocalStorage",Jd="fbase_key";class jr{constructor(e){this.request=e}toPromise(){return new Promise((e,t)=>{this.request.addEventListener("success",()=>{e(this.request.result)}),this.request.addEventListener("error",()=>{t(this.request.error)})})}}function gi(n,e){return n.transaction([mi],e?"readwrite":"readonly").objectStore(mi)}function IT(){const n=indexedDB.deleteDatabase(Xd);return new jr(n).toPromise()}function qa(){const n=indexedDB.open(Xd,wT);return new Promise((e,t)=>{n.addEventListener("error",()=>{t(n.error)}),n.addEventListener("upgradeneeded",()=>{const r=n.result;try{r.createObjectStore(mi,{keyPath:Jd})}catch(s){t(s)}}),n.addEventListener("success",async()=>{const r=n.result;r.objectStoreNames.contains(mi)?e(r):(r.close(),await IT(),e(await qa()))})})}async function Zd(n,e,t){const r=gi(n,!0).put({[Jd]:e,value:t});return new jr(r).toPromise()}async function AT(n,e){const t=gi(n,!1).get(e),r=await new jr(t).toPromise();return r===void 0?null:r.value}function ef(n,e){const t=gi(n,!0).delete(e);return new jr(t).toPromise()}const RT=800,PT=3;class tf{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:(this.db=await qa(),this.db)}async _withRetries(e){let t=0;for(;;)try{const r=await this._openDb();return await e(r)}catch(r){if(t++>PT)throw r;this.db&&(this.db.close(),this.db=void 0)}}async initializeServiceWorkerMessaging(){return Yd()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=pi._getInstance(TT()),this.receiver._subscribe("keyChanged",async(e,t)=>({keyProcessed:(await this._poll()).includes(t.key)})),this.receiver._subscribe("ping",async(e,t)=>["keyChanged"])}async initializeSender(){var e,t;if(this.activeServiceWorker=await vT(),!this.activeServiceWorker)return;this.sender=new _T(this.activeServiceWorker);const r=await this.sender._send("ping",{},800);r&&!((e=r[0])===null||e===void 0)&&e.fulfilled&&!((t=r[0])===null||t===void 0)&&t.value.includes("keyChanged")&&(this.serviceWorkerReceiverAvailable=!0)}async notifyServiceWorker(e){if(!(!this.sender||!this.activeServiceWorker||ET()!==this.activeServiceWorker))try{await this.sender._send("keyChanged",{key:e},this.serviceWorkerReceiverAvailable?800:50)}catch{}}async _isAvailable(){try{if(!indexedDB)return!1;const e=await qa();return await Zd(e,fi,"1"),await ef(e,fi),!0}catch{}return!1}async _withPendingWrite(e){this.pendingWrites++;try{await e()}finally{this.pendingWrites--}}async _set(e,t){return this._withPendingWrite(async()=>(await this._withRetries(r=>Zd(r,e,t)),this.localCache[e]=t,this.notifyServiceWorker(e)))}async _get(e){const t=await this._withRetries(r=>AT(r,e));return this.localCache[e]=t,t}async _remove(e){return this._withPendingWrite(async()=>(await this._withRetries(t=>ef(t,e)),delete this.localCache[e],this.notifyServiceWorker(e)))}async _poll(){const e=await this._withRetries(s=>{const i=gi(s,!1).getAll();return new jr(i).toPromise()});if(!e)return[];if(this.pendingWrites!==0)return[];const t=[],r=new Set;if(e.length!==0)for(const{fbase_key:s,value:i}of e)r.add(s),JSON.stringify(this.localCache[s])!==JSON.stringify(i)&&(this.notifyListeners(s,i),t.push(s));for(const s of Object.keys(this.localCache))this.localCache[s]&&!r.has(s)&&(this.notifyListeners(s,null),t.push(s));return t}notifyListeners(e,t){this.localCache[e]=t;const r=this.listeners[e];if(r)for(const s of Array.from(r))s(t)}startPolling(){this.stopPolling(),this.pollTimer=setInterval(async()=>this._poll(),RT)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}_addListener(e,t){Object.keys(this.listeners).length===0&&this.startPolling(),this.listeners[e]||(this.listeners[e]=new Set,this._get(e)),this.listeners[e].add(t)}_removeListener(e,t){this.listeners[e]&&(this.listeners[e].delete(t),this.listeners[e].size===0&&delete this.listeners[e]),Object.keys(this.listeners).length===0&&this.stopPolling()}}tf.type="LOCAL";const ST=tf;new Lr(3e4,6e4);/**
2979
2979
  * @license
2980
2980
  * Copyright 2021 Google LLC
2981
2981
  *
@@ -2990,7 +2990,7 @@ This typically indicates that your device does not have a healthy Internet conne
2990
2990
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2991
2991
  * See the License for the specific language governing permissions and
2992
2992
  * limitations under the License.
2993
- */function La(t,e){return e?st(e):(I(t._popupRedirectResolver,t,"argument-error"),t._popupRedirectResolver)}/**
2993
+ */function $a(n,e){return e?ct(e):(I(n._popupRedirectResolver,n,"argument-error"),n._popupRedirectResolver)}/**
2994
2994
  * @license
2995
2995
  * Copyright 2019 Google LLC
2996
2996
  *
@@ -3005,7 +3005,7 @@ This typically indicates that your device does not have a healthy Internet conne
3005
3005
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3006
3006
  * See the License for the specific language governing permissions and
3007
3007
  * limitations under the License.
3008
- */class Ma extends Da{constructor(e){super("custom","custom"),this.params=e}_getIdTokenResponse(e){return Pn(e,this._buildIdpRequest())}_linkToIdToken(e,n){return Pn(e,this._buildIdpRequest(n))}_getReauthenticationResolver(e){return Pn(e,this._buildIdpRequest())}_buildIdpRequest(e){const n={requestUri:this.params.requestUri,sessionId:this.params.sessionId,postBody:this.params.postBody,tenantId:this.params.tenantId,pendingToken:this.params.pendingToken,returnSecureToken:!0,returnIdpCredential:!0};return e&&(n.idToken=e),n}}function fT(t){return Sd(t.auth,new Ma(t),t.bypassAuthState)}function pT(t){const{auth:e,user:n}=t;return I(n,e,"internal-error"),qE(n,new Ma(t),t.bypassAuthState)}async function mT(t){const{auth:e,user:n}=t;return I(n,e,"internal-error"),jE(n,new Ma(t),t.bypassAuthState)}/**
3008
+ */class za extends Fa{constructor(e){super("custom","custom"),this.params=e}_getIdTokenResponse(e){return Dn(e,this._buildIdpRequest())}_linkToIdToken(e,t){return Dn(e,this._buildIdpRequest(t))}_getReauthenticationResolver(e){return Dn(e,this._buildIdpRequest())}_buildIdpRequest(e){const t={requestUri:this.params.requestUri,sessionId:this.params.sessionId,postBody:this.params.postBody,tenantId:this.params.tenantId,pendingToken:this.params.pendingToken,returnSecureToken:!0,returnIdpCredential:!0};return e&&(t.idToken=e),t}}function bT(n){return jd(n.auth,new za(n),n.bypassAuthState)}function CT(n){const{auth:e,user:t}=n;return I(t,e,"internal-error"),sT(t,new za(n),n.bypassAuthState)}async function kT(n){const{auth:e,user:t}=n;return I(t,e,"internal-error"),nT(t,new za(n),n.bypassAuthState)}/**
3009
3009
  * @license
3010
3010
  * Copyright 2020 Google LLC
3011
3011
  *
@@ -3020,7 +3020,7 @@ This typically indicates that your device does not have a healthy Internet conne
3020
3020
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3021
3021
  * See the License for the specific language governing permissions and
3022
3022
  * limitations under the License.
3023
- */class $d{constructor(e,n,r,s,i=!1){this.auth=e,this.resolver=r,this.user=s,this.bypassAuthState=i,this.pendingPromise=null,this.eventManager=null,this.filter=Array.isArray(n)?n:[n]}execute(){return new Promise(async(e,n)=>{this.pendingPromise={resolve:e,reject:n};try{this.eventManager=await this.resolver._initialize(this.auth),await this.onExecution(),this.eventManager.registerConsumer(this)}catch(r){this.reject(r)}})}async onAuthEvent(e){const{urlResponse:n,sessionId:r,postBody:s,tenantId:i,error:o,type:a}=e;if(o){this.reject(o);return}const c={auth:this.auth,requestUri:n,sessionId:r,tenantId:i||void 0,postBody:s||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(a)(c))}catch(u){this.reject(u)}}onError(e){this.reject(e)}getIdpTask(e){switch(e){case"signInViaPopup":case"signInViaRedirect":return fT;case"linkViaPopup":case"linkViaRedirect":return mT;case"reauthViaPopup":case"reauthViaRedirect":return pT;default:be(this.auth,"internal-error")}}resolve(e){nt(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(e),this.unregisterAndCleanUp()}reject(e){nt(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.reject(e),this.unregisterAndCleanUp()}unregisterAndCleanUp(){this.eventManager&&this.eventManager.unregisterConsumer(this),this.pendingPromise=null,this.cleanUp()}}/**
3023
+ */class nf{constructor(e,t,r,s,i=!1){this.auth=e,this.resolver=r,this.user=s,this.bypassAuthState=i,this.pendingPromise=null,this.eventManager=null,this.filter=Array.isArray(t)?t:[t]}execute(){return new Promise(async(e,t)=>{this.pendingPromise={resolve:e,reject:t};try{this.eventManager=await this.resolver._initialize(this.auth),await this.onExecution(),this.eventManager.registerConsumer(this)}catch(r){this.reject(r)}})}async onAuthEvent(e){const{urlResponse:t,sessionId:r,postBody:s,tenantId:i,error:o,type:a}=e;if(o){this.reject(o);return}const c={auth:this.auth,requestUri:t,sessionId:r,tenantId:i||void 0,postBody:s||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(a)(c))}catch(u){this.reject(u)}}onError(e){this.reject(e)}getIdpTask(e){switch(e){case"signInViaPopup":case"signInViaRedirect":return bT;case"linkViaPopup":case"linkViaRedirect":return kT;case"reauthViaPopup":case"reauthViaRedirect":return CT;default:ke(this.auth,"internal-error")}}resolve(e){it(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(e),this.unregisterAndCleanUp()}reject(e){it(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.reject(e),this.unregisterAndCleanUp()}unregisterAndCleanUp(){this.eventManager&&this.eventManager.unregisterConsumer(this),this.pendingPromise=null,this.cleanUp()}}/**
3024
3024
  * @license
3025
3025
  * Copyright 2020 Google LLC
3026
3026
  *
@@ -3035,7 +3035,7 @@ This typically indicates that your device does not have a healthy Internet conne
3035
3035
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3036
3036
  * See the License for the specific language governing permissions and
3037
3037
  * limitations under the License.
3038
- */const gT=new Cr(2e3,1e4);async function xa(t,e,n){const r=He(t);Xh(t,e,ai);const s=La(r,n);return new It(r,"signInViaPopup",e,s).executeNotNull()}async function qd(t,e,n){const r=x(t);Xh(r.auth,e,ai);const s=La(r.auth,n);return new It(r.auth,"linkViaPopup",e,s,r).executeNotNull()}class It extends $d{constructor(e,n,r,s,i){super(e,n,s,i),this.provider=r,this.authWindow=null,this.pollId=null,It.currentPopupAction&&It.currentPopupAction.cancel(),It.currentPopupAction=this}async executeNotNull(){const e=await this.execute();return I(e,this.auth,"internal-error"),e}async onExecution(){nt(this.filter.length===1,"Popup operations only handle one event");const e=Oa();this.authWindow=await this.resolver._openPopup(this.auth,this.provider,this.filter[0],e),this.authWindow.associatedEvent=e,this.resolver._originValidation(this.auth).catch(n=>{this.reject(n)}),this.resolver._isIframeWebStorageSupported(this.auth,n=>{n||this.reject(ze(this.auth,"web-storage-unsupported"))}),this.pollUserCancellation()}get eventId(){var e;return((e=this.authWindow)===null||e===void 0?void 0:e.associatedEvent)||null}cancel(){this.reject(ze(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,It.currentPopupAction=null}pollUserCancellation(){const e=()=>{var n,r;if(!((r=(n=this.authWindow)===null||n===void 0?void 0:n.window)===null||r===void 0)&&r.closed){this.pollId=window.setTimeout(()=>{this.pollId=null,this.reject(ze(this.auth,"popup-closed-by-user"))},8e3);return}this.pollId=window.setTimeout(e,gT.get())};e()}}It.currentPopupAction=null;/**
3038
+ */const DT=new Lr(2e3,1e4);async function Ha(n,e,t){if(Pe(n.app))return Promise.reject(Le(n,"operation-not-supported-in-this-environment"));const r=Ke(n);ud(n,e,hi);const s=$a(r,t);return new St(r,"signInViaPopup",e,s).executeNotNull()}async function rf(n,e,t){const r=x(n);ud(r.auth,e,hi);const s=$a(r.auth,t);return new St(r.auth,"linkViaPopup",e,s,r).executeNotNull()}class St extends nf{constructor(e,t,r,s,i){super(e,t,s,i),this.provider=r,this.authWindow=null,this.pollId=null,St.currentPopupAction&&St.currentPopupAction.cancel(),St.currentPopupAction=this}async executeNotNull(){const e=await this.execute();return I(e,this.auth,"internal-error"),e}async onExecution(){it(this.filter.length===1,"Popup operations only handle one event");const e=ja();this.authWindow=await this.resolver._openPopup(this.auth,this.provider,this.filter[0],e),this.authWindow.associatedEvent=e,this.resolver._originValidation(this.auth).catch(t=>{this.reject(t)}),this.resolver._isIframeWebStorageSupported(this.auth,t=>{t||this.reject(Le(this.auth,"web-storage-unsupported"))}),this.pollUserCancellation()}get eventId(){var e;return((e=this.authWindow)===null||e===void 0?void 0:e.associatedEvent)||null}cancel(){this.reject(Le(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,St.currentPopupAction=null}pollUserCancellation(){const e=()=>{var t,r;if(!((r=(t=this.authWindow)===null||t===void 0?void 0:t.window)===null||r===void 0)&&r.closed){this.pollId=window.setTimeout(()=>{this.pollId=null,this.reject(Le(this.auth,"popup-closed-by-user"))},8e3);return}this.pollId=window.setTimeout(e,DT.get())};e()}}St.currentPopupAction=null;/**
3039
3039
  * @license
3040
3040
  * Copyright 2020 Google LLC
3041
3041
  *
@@ -3050,7 +3050,7 @@ This typically indicates that your device does not have a healthy Internet conne
3050
3050
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3051
3051
  * See the License for the specific language governing permissions and
3052
3052
  * limitations under the License.
3053
- */const _T="pendingRedirect",fi=new Map;class yT extends $d{constructor(e,n,r=!1){super(e,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],n,void 0,r),this.eventId=null}async execute(){let e=fi.get(this.auth._key());if(!e){try{const r=await vT(this.resolver,this.auth)?await super.execute():null;e=()=>Promise.resolve(r)}catch(n){e=()=>Promise.reject(n)}fi.set(this.auth._key(),e)}return this.bypassAuthState||fi.set(this.auth._key(),()=>Promise.resolve(null)),e()}async onAuthEvent(e){if(e.type==="signInViaRedirect")return super.onAuthEvent(e);if(e.type==="unknown"){this.resolve(null);return}if(e.eventId){const n=await this.auth._redirectUserForId(e.eventId);if(n)return this.user=n,super.onAuthEvent(e);this.resolve(null)}}async onExecution(){}cleanUp(){}}async function vT(t,e){const n=wT(e),r=TT(t);if(!await r._isAvailable())return!1;const s=await r._get(n)==="true";return await r._remove(n),s}function ET(t,e){fi.set(t._key(),e)}function TT(t){return st(t._redirectPersistence)}function wT(t){return ri(_T,t.config.apiKey,t.name)}async function IT(t,e,n=!1){const r=He(t),s=La(r,e),o=await new yT(r,s,n).execute();return o&&!n&&(delete o.user._redirectEventId,await r._persistUserIfCurrent(o.user),await r._setRedirectUser(null,e)),o}/**
3053
+ */const NT="pendingRedirect",_i=new Map;class OT extends nf{constructor(e,t,r=!1){super(e,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],t,void 0,r),this.eventId=null}async execute(){let e=_i.get(this.auth._key());if(!e){try{const r=await VT(this.resolver,this.auth)?await super.execute():null;e=()=>Promise.resolve(r)}catch(t){e=()=>Promise.reject(t)}_i.set(this.auth._key(),e)}return this.bypassAuthState||_i.set(this.auth._key(),()=>Promise.resolve(null)),e()}async onAuthEvent(e){if(e.type==="signInViaRedirect")return super.onAuthEvent(e);if(e.type==="unknown"){this.resolve(null);return}if(e.eventId){const t=await this.auth._redirectUserForId(e.eventId);if(t)return this.user=t,super.onAuthEvent(e);this.resolve(null)}}async onExecution(){}cleanUp(){}}async function VT(n,e){const t=xT(e),r=MT(n);if(!await r._isAvailable())return!1;const s=await r._get(t)==="true";return await r._remove(t),s}function LT(n,e){_i.set(n._key(),e)}function MT(n){return ct(n._redirectPersistence)}function xT(n){return ai(NT,n.config.apiKey,n.name)}async function UT(n,e,t=!1){if(Pe(n.app))return Promise.reject(Ge(n));const r=Ke(n),s=$a(r,e),o=await new OT(r,s,t).execute();return o&&!t&&(delete o.user._redirectEventId,await r._persistUserIfCurrent(o.user),await r._setRedirectUser(null,e)),o}/**
3054
3054
  * @license
3055
3055
  * Copyright 2020 Google LLC
3056
3056
  *
@@ -3065,7 +3065,7 @@ This typically indicates that your device does not have a healthy Internet conne
3065
3065
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3066
3066
  * See the License for the specific language governing permissions and
3067
3067
  * limitations under the License.
3068
- */const AT=10*60*1e3;class RT{constructor(e){this.auth=e,this.cachedEventUids=new Set,this.consumers=new Set,this.queuedRedirectEvent=null,this.hasHandledPotentialRedirect=!1,this.lastProcessedEventTime=Date.now()}registerConsumer(e){this.consumers.add(e),this.queuedRedirectEvent&&this.isEventForConsumer(this.queuedRedirectEvent,e)&&(this.sendToConsumer(this.queuedRedirectEvent,e),this.saveEventToCache(this.queuedRedirectEvent),this.queuedRedirectEvent=null)}unregisterConsumer(e){this.consumers.delete(e)}onEvent(e){if(this.hasEventBeenHandled(e))return!1;let n=!1;return this.consumers.forEach(r=>{this.isEventForConsumer(e,r)&&(n=!0,this.sendToConsumer(e,r),this.saveEventToCache(e))}),this.hasHandledPotentialRedirect||!PT(e)||(this.hasHandledPotentialRedirect=!0,n||(this.queuedRedirectEvent=e,n=!0)),n}sendToConsumer(e,n){var r;if(e.error&&!Hd(e)){const s=((r=e.error.code)===null||r===void 0?void 0:r.split("auth/")[1])||"internal-error";n.onError(ze(this.auth,s))}else n.onAuthEvent(e)}isEventForConsumer(e,n){const r=n.eventId===null||!!e.eventId&&e.eventId===n.eventId;return n.filter.includes(e.type)&&r}hasEventBeenHandled(e){return Date.now()-this.lastProcessedEventTime>=AT&&this.cachedEventUids.clear(),this.cachedEventUids.has(zd(e))}saveEventToCache(e){this.cachedEventUids.add(zd(e)),this.lastProcessedEventTime=Date.now()}}function zd(t){return[t.type,t.eventId,t.sessionId,t.tenantId].filter(e=>e).join("-")}function Hd({type:t,error:e}){return t==="unknown"&&(e==null?void 0:e.code)==="auth/no-auth-event"}function PT(t){switch(t.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return Hd(t);default:return!1}}/**
3068
+ */const FT=10*60*1e3;class BT{constructor(e){this.auth=e,this.cachedEventUids=new Set,this.consumers=new Set,this.queuedRedirectEvent=null,this.hasHandledPotentialRedirect=!1,this.lastProcessedEventTime=Date.now()}registerConsumer(e){this.consumers.add(e),this.queuedRedirectEvent&&this.isEventForConsumer(this.queuedRedirectEvent,e)&&(this.sendToConsumer(this.queuedRedirectEvent,e),this.saveEventToCache(this.queuedRedirectEvent),this.queuedRedirectEvent=null)}unregisterConsumer(e){this.consumers.delete(e)}onEvent(e){if(this.hasEventBeenHandled(e))return!1;let t=!1;return this.consumers.forEach(r=>{this.isEventForConsumer(e,r)&&(t=!0,this.sendToConsumer(e,r),this.saveEventToCache(e))}),this.hasHandledPotentialRedirect||!jT(e)||(this.hasHandledPotentialRedirect=!0,t||(this.queuedRedirectEvent=e,t=!0)),t}sendToConsumer(e,t){var r;if(e.error&&!of(e)){const s=((r=e.error.code)===null||r===void 0?void 0:r.split("auth/")[1])||"internal-error";t.onError(Le(this.auth,s))}else t.onAuthEvent(e)}isEventForConsumer(e,t){const r=t.eventId===null||!!e.eventId&&e.eventId===t.eventId;return t.filter.includes(e.type)&&r}hasEventBeenHandled(e){return Date.now()-this.lastProcessedEventTime>=FT&&this.cachedEventUids.clear(),this.cachedEventUids.has(sf(e))}saveEventToCache(e){this.cachedEventUids.add(sf(e)),this.lastProcessedEventTime=Date.now()}}function sf(n){return[n.type,n.eventId,n.sessionId,n.tenantId].filter(e=>e).join("-")}function of({type:n,error:e}){return n==="unknown"&&(e==null?void 0:e.code)==="auth/no-auth-event"}function jT(n){switch(n.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return of(n);default:return!1}}/**
3069
3069
  * @license
3070
3070
  * Copyright 2020 Google LLC
3071
3071
  *
@@ -3080,7 +3080,7 @@ This typically indicates that your device does not have a healthy Internet conne
3080
3080
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3081
3081
  * See the License for the specific language governing permissions and
3082
3082
  * limitations under the License.
3083
- */async function ST(t,e={}){return Oe(t,"GET","/v1/projects",e)}/**
3083
+ */async function qT(n,e={}){return Me(n,"GET","/v1/projects",e)}/**
3084
3084
  * @license
3085
3085
  * Copyright 2020 Google LLC
3086
3086
  *
@@ -3095,7 +3095,7 @@ This typically indicates that your device does not have a healthy Internet conne
3095
3095
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3096
3096
  * See the License for the specific language governing permissions and
3097
3097
  * limitations under the License.
3098
- */const bT=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,CT=/^https?/;async function kT(t){if(t.config.emulator)return;const{authorizedDomains:e}=await ST(t);for(const n of e)try{if(DT(n))return}catch{}be(t,"unauthorized-domain")}function DT(t){const e=Pa(),{protocol:n,hostname:r}=new URL(e);if(t.startsWith("chrome-extension://")){const o=new URL(t);return o.hostname===""&&r===""?n==="chrome-extension:"&&t.replace("chrome-extension://","")===e.replace("chrome-extension://",""):n==="chrome-extension:"&&o.hostname===r}if(!CT.test(n))return!1;if(bT.test(t))return r===t;const s=t.replace(/\./g,"\\.");return new RegExp("^(.+\\."+s+"|"+s+")$","i").test(r)}/**
3098
+ */const $T=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,zT=/^https?/;async function HT(n){if(n.config.emulator)return;const{authorizedDomains:e}=await qT(n);for(const t of e)try{if(WT(t))return}catch{}ke(n,"unauthorized-domain")}function WT(n){const e=Oa(),{protocol:t,hostname:r}=new URL(e);if(n.startsWith("chrome-extension://")){const o=new URL(n);return o.hostname===""&&r===""?t==="chrome-extension:"&&n.replace("chrome-extension://","")===e.replace("chrome-extension://",""):t==="chrome-extension:"&&o.hostname===r}if(!zT.test(t))return!1;if($T.test(n))return r===n;const s=n.replace(/\./g,"\\.");return new RegExp("^(.+\\."+s+"|"+s+")$","i").test(r)}/**
3099
3099
  * @license
3100
3100
  * Copyright 2020 Google LLC.
3101
3101
  *
@@ -3110,7 +3110,7 @@ This typically indicates that your device does not have a healthy Internet conne
3110
3110
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3111
3111
  * See the License for the specific language governing permissions and
3112
3112
  * limitations under the License.
3113
- */const NT=new Cr(3e4,6e4);function Wd(){const t=Ke().___jsl;if(t!=null&&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 n=0;n<t.CP.length;n++)t.CP[n]=null}}function OT(t){return new Promise((e,n)=>{var r,s,i;function o(){Wd(),gapi.load("gapi.iframes",{callback:()=>{e(gapi.iframes.getContext())},ontimeout:()=>{Wd(),n(ze(t,"network-request-failed"))},timeout:NT.get()})}if(!((s=(r=Ke().gapi)===null||r===void 0?void 0:r.iframes)===null||s===void 0)&&s.Iframe)e(gapi.iframes.getContext());else if(!((i=Ke().gapi)===null||i===void 0)&&i.load)o();else{const a=wE("iframefcb");return Ke()[a]=()=>{gapi.load?o():n(ze(t,"network-request-failed"))},_d(`${TE()}?onload=${a}`).catch(c=>n(c))}}).catch(e=>{throw pi=null,e})}let pi=null;function VT(t){return pi=pi||OT(t),pi}/**
3113
+ */const GT=new Lr(3e4,6e4);function af(){const n=Xe().___jsl;if(n!=null&&n.H){for(const e of Object.keys(n.H))if(n.H[e].r=n.H[e].r||[],n.H[e].L=n.H[e].L||[],n.H[e].r=[...n.H[e].L],n.CP)for(let t=0;t<n.CP.length;t++)n.CP[t]=null}}function KT(n){return new Promise((e,t)=>{var r,s,i;function o(){af(),gapi.load("gapi.iframes",{callback:()=>{e(gapi.iframes.getContext())},ontimeout:()=>{af(),t(Le(n,"network-request-failed"))},timeout:GT.get()})}if(!((s=(r=Xe().gapi)===null||r===void 0?void 0:r.iframes)===null||s===void 0)&&s.Iframe)e(gapi.iframes.getContext());else if(!((i=Xe().gapi)===null||i===void 0)&&i.load)o();else{const a=xE("iframefcb");return Xe()[a]=()=>{gapi.load?o():t(Le(n,"network-request-failed"))},Dd(`${ME()}?onload=${a}`).catch(c=>t(c))}}).catch(e=>{throw yi=null,e})}let yi=null;function QT(n){return yi=yi||KT(n),yi}/**
3114
3114
  * @license
3115
3115
  * Copyright 2020 Google LLC.
3116
3116
  *
@@ -3125,7 +3125,7 @@ This typically indicates that your device does not have a healthy Internet conne
3125
3125
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3126
3126
  * See the License for the specific language governing permissions and
3127
3127
  * limitations under the License.
3128
- */const LT=new Cr(5e3,15e3),MT="__/auth/iframe",xT="emulator/auth/iframe",UT={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},FT=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function BT(t){const e=t.config;I(e.authDomain,t,"auth-domain-config-required");const n=e.emulator?Sa(e,xT):`https://${t.config.authDomain}/${MT}`,r={apiKey:e.apiKey,appName:t.name,v:bt},s=FT.get(t.config.apiHost);s&&(r.eid=s);const i=t._getFrameworks();return i.length&&(r.fw=i.join(",")),`${n}?${On(r).slice(1)}`}async function jT(t){const e=await VT(t),n=Ke().gapi;return I(n,t,"internal-error"),e.open({where:document.body,url:BT(t),messageHandlersFilter:n.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:UT,dontclear:!0},r=>new Promise(async(s,i)=>{await r.restyle({setHideOnLeave:!1});const o=ze(t,"network-request-failed"),a=Ke().setTimeout(()=>{i(o)},LT.get());function c(){Ke().clearTimeout(a),s(r)}r.ping(c).then(c,()=>{i(o)})}))}/**
3128
+ */const YT=new Lr(5e3,15e3),XT="__/auth/iframe",JT="emulator/auth/iframe",ZT={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},ew=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function tw(n){const e=n.config;I(e.authDomain,n,"auth-domain-config-required");const t=e.emulator?Va(e,JT):`https://${n.config.authDomain}/${XT}`,r={apiKey:e.apiKey,appName:n.name,v:Nt},s=ew.get(n.config.apiHost);s&&(r.eid=s);const i=n._getFrameworks();return i.length&&(r.fw=i.join(",")),`${t}?${Fn(r).slice(1)}`}async function nw(n){const e=await QT(n),t=Xe().gapi;return I(t,n,"internal-error"),e.open({where:document.body,url:tw(n),messageHandlersFilter:t.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:ZT,dontclear:!0},r=>new Promise(async(s,i)=>{await r.restyle({setHideOnLeave:!1});const o=Le(n,"network-request-failed"),a=Xe().setTimeout(()=>{i(o)},YT.get());function c(){Xe().clearTimeout(a),s(r)}r.ping(c).then(c,()=>{i(o)})}))}/**
3129
3129
  * @license
3130
3130
  * Copyright 2020 Google LLC.
3131
3131
  *
@@ -3140,7 +3140,7 @@ This typically indicates that your device does not have a healthy Internet conne
3140
3140
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3141
3141
  * See the License for the specific language governing permissions and
3142
3142
  * limitations under the License.
3143
- */const $T={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"},qT=500,zT=600,HT="_blank",WT="http://localhost";class Gd{constructor(e){this.window=e,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch{}}}function GT(t,e,n,r=qT,s=zT){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({},$T),{width:r.toString(),height:s.toString(),top:i,left:o}),u=W().toLowerCase();n&&(a=ud(u)?HT:n),cd(u)&&(e=e||WT,c.scrollbars="yes");const l=Object.entries(c).reduce((d,[f,E])=>`${d}${f}=${E},`,"");if(hE(u)&&a!=="_self")return KT(e||"",a),new Gd(null);const h=window.open(e||"",a,l);I(h,t,"popup-blocked");try{h.focus()}catch{}return new Gd(h)}function KT(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)}/**
3143
+ */const rw={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"},sw=500,iw=600,ow="_blank",aw="http://localhost";class cf{constructor(e){this.window=e,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch{}}}function cw(n,e,t,r=sw,s=iw){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({},rw),{width:r.toString(),height:s.toString(),top:i,left:o}),u=W().toLowerCase();t&&(a=Id(u)?ow:t),wd(u)&&(e=e||aw,c.scrollbars="yes");const l=Object.entries(c).reduce((d,[f,E])=>`${d}${f}=${E},`,"");if(PE(u)&&a!=="_self")return uw(e||"",a),new cf(null);const h=window.open(e||"",a,l);I(h,n,"popup-blocked");try{h.focus()}catch{}return new cf(h)}function uw(n,e){const t=document.createElement("a");t.href=n,t.target=e;const r=document.createEvent("MouseEvent");r.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),t.dispatchEvent(r)}/**
3144
3144
  * @license
3145
3145
  * Copyright 2021 Google LLC
3146
3146
  *
@@ -3155,7 +3155,7 @@ This typically indicates that your device does not have a healthy Internet conne
3155
3155
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3156
3156
  * See the License for the specific language governing permissions and
3157
3157
  * limitations under the License.
3158
- */const QT="__/auth/handler",YT="emulator/auth/handler",XT=encodeURIComponent("fac");async function Kd(t,e,n,r,s,i){I(t.config.authDomain,t,"auth-domain-config-required"),I(t.config.apiKey,t,"invalid-api-key");const o={apiKey:t.config.apiKey,appName:t.name,authType:n,redirectUrl:r,v:bt,eventId:s};if(e instanceof ai){e.setDefaultLanguage(t.languageCode),o.providerId=e.providerId||"",Qf(e.getCustomParameters())||(o.customParameters=JSON.stringify(e.getCustomParameters()));for(const[l,h]of Object.entries(i||{}))o[l]=h}if(e instanceof Lr){const l=e.getScopes().filter(h=>h!=="");l.length>0&&(o.scopes=l.join(","))}t.tenantId&&(o.tid=t.tenantId);const a=o;for(const l of Object.keys(a))a[l]===void 0&&delete a[l];const c=await t._getAppCheckToken(),u=c?`#${XT}=${encodeURIComponent(c)}`:"";return`${JT(t)}?${On(a).slice(1)}${u}`}function JT({config:t}){return t.emulator?Sa(t,YT):`https://${t.authDomain}/${QT}`}/**
3158
+ */const lw="__/auth/handler",hw="emulator/auth/handler",dw=encodeURIComponent("fac");async function uf(n,e,t,r,s,i){I(n.config.authDomain,n,"auth-domain-config-required"),I(n.config.apiKey,n,"invalid-api-key");const o={apiKey:n.config.apiKey,appName:n.name,authType:t,redirectUrl:r,v:Nt,eventId:s};if(e instanceof hi){e.setDefaultLanguage(n.languageCode),o.providerId=e.providerId||"",lp(e.getCustomParameters())||(o.customParameters=JSON.stringify(e.getCustomParameters()));for(const[l,h]of Object.entries(i||{}))o[l]=h}if(e instanceof Br){const l=e.getScopes().filter(h=>h!=="");l.length>0&&(o.scopes=l.join(","))}n.tenantId&&(o.tid=n.tenantId);const a=o;for(const l of Object.keys(a))a[l]===void 0&&delete a[l];const c=await n._getAppCheckToken(),u=c?`#${dw}=${encodeURIComponent(c)}`:"";return`${fw(n)}?${Fn(a).slice(1)}${u}`}function fw({config:n}){return n.emulator?Va(n,hw):`https://${n.authDomain}/${lw}`}/**
3159
3159
  * @license
3160
3160
  * Copyright 2020 Google LLC
3161
3161
  *
@@ -3170,7 +3170,7 @@ This typically indicates that your device does not have a healthy Internet conne
3170
3170
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3171
3171
  * See the License for the specific language governing permissions and
3172
3172
  * limitations under the License.
3173
- */const Ua="webStorageSupport";class ZT{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=Ld,this._completeRedirectFn=IT,this._overrideRedirectResult=ET}async _openPopup(e,n,r,s){var i;nt((i=this.eventManagers[e._key()])===null||i===void 0?void 0:i.manager,"_initialize() not called before _openPopup()");const o=await Kd(e,n,r,Pa(),s);return GT(e,o,Oa())}async _openRedirect(e,n,r,s){await this._originValidation(e);const i=await Kd(e,n,r,Pa(),s);return rT(i),new Promise(()=>{})}_initialize(e){const n=e._key();if(this.eventManagers[n]){const{manager:s,promise:i}=this.eventManagers[n];return s?Promise.resolve(s):(nt(i,"If manager is not set, promise should be"),i)}const r=this.initAndGetManager(e);return this.eventManagers[n]={promise:r},r.catch(()=>{delete this.eventManagers[n]}),r}async initAndGetManager(e){const n=await jT(e),r=new RT(e);return n.register("authEvent",s=>(I(s==null?void 0:s.authEvent,e,"invalid-auth-event"),{status:r.onEvent(s.authEvent)?"ACK":"ERROR"}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[e._key()]={manager:r},this.iframes[e._key()]=n,r}_isIframeWebStorageSupported(e,n){this.iframes[e._key()].send(Ua,{type:Ua},s=>{var i;const o=(i=s==null?void 0:s[0])===null||i===void 0?void 0:i[Ua];o!==void 0&&n(!!o),be(e,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(e){const n=e._key();return this.originValidationPromises[n]||(this.originValidationPromises[n]=kT(e)),this.originValidationPromises[n]}get _shouldInitProactively(){return pd()||ka()||si()}}const ew=ZT;var Qd="@firebase/auth",Yd="1.6.0";/**
3173
+ */const Wa="webStorageSupport";class pw{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=Qd,this._completeRedirectFn=UT,this._overrideRedirectResult=LT}async _openPopup(e,t,r,s){var i;it((i=this.eventManagers[e._key()])===null||i===void 0?void 0:i.manager,"_initialize() not called before _openPopup()");const o=await uf(e,t,r,Oa(),s);return cw(e,o,ja())}async _openRedirect(e,t,r,s){await this._originValidation(e);const i=await uf(e,t,r,Oa(),s);return yT(i),new Promise(()=>{})}_initialize(e){const t=e._key();if(this.eventManagers[t]){const{manager:s,promise:i}=this.eventManagers[t];return s?Promise.resolve(s):(it(i,"If manager is not set, promise should be"),i)}const r=this.initAndGetManager(e);return this.eventManagers[t]={promise:r},r.catch(()=>{delete this.eventManagers[t]}),r}async initAndGetManager(e){const t=await nw(e),r=new BT(e);return t.register("authEvent",s=>(I(s==null?void 0:s.authEvent,e,"invalid-auth-event"),{status:r.onEvent(s.authEvent)?"ACK":"ERROR"}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[e._key()]={manager:r},this.iframes[e._key()]=t,r}_isIframeWebStorageSupported(e,t){this.iframes[e._key()].send(Wa,{type:Wa},s=>{var i;const o=(i=s==null?void 0:s[0])===null||i===void 0?void 0:i[Wa];o!==void 0&&t(!!o),ke(e,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(e){const t=e._key();return this.originValidationPromises[t]||(this.originValidationPromises[t]=HT(e)),this.originValidationPromises[t]}get _shouldInitProactively(){return bd()||Ua()||ci()}}const mw=pw;var lf="@firebase/auth",hf="1.7.1";/**
3174
3174
  * @license
3175
3175
  * Copyright 2020 Google LLC
3176
3176
  *
@@ -3185,7 +3185,7 @@ This typically indicates that your device does not have a healthy Internet conne
3185
3185
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3186
3186
  * See the License for the specific language governing permissions and
3187
3187
  * limitations under the License.
3188
- */class tw{constructor(e){this.auth=e,this.internalListeners=new Map}getUid(){var e;return this.assertAuthConfigured(),((e=this.auth.currentUser)===null||e===void 0?void 0:e.uid)||null}async getToken(e){return this.assertAuthConfigured(),await this.auth._initializationPromise,this.auth.currentUser?{accessToken:await this.auth.currentUser.getIdToken(e)}:null}addAuthTokenListener(e){if(this.assertAuthConfigured(),this.internalListeners.has(e))return;const n=this.auth.onIdTokenChanged(r=>{e((r==null?void 0:r.stsTokenManager.accessToken)||null)});this.internalListeners.set(e,n),this.updateProactiveRefresh()}removeAuthTokenListener(e){this.assertAuthConfigured();const n=this.internalListeners.get(e);n&&(this.internalListeners.delete(e),n(),this.updateProactiveRefresh())}assertAuthConfigured(){I(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}}/**
3188
+ */class gw{constructor(e){this.auth=e,this.internalListeners=new Map}getUid(){var e;return this.assertAuthConfigured(),((e=this.auth.currentUser)===null||e===void 0?void 0:e.uid)||null}async getToken(e){return this.assertAuthConfigured(),await this.auth._initializationPromise,this.auth.currentUser?{accessToken:await this.auth.currentUser.getIdToken(e)}:null}addAuthTokenListener(e){if(this.assertAuthConfigured(),this.internalListeners.has(e))return;const t=this.auth.onIdTokenChanged(r=>{e((r==null?void 0:r.stsTokenManager.accessToken)||null)});this.internalListeners.set(e,t),this.updateProactiveRefresh()}removeAuthTokenListener(e){this.assertAuthConfigured();const t=this.internalListeners.get(e);t&&(this.internalListeners.delete(e),t(),this.updateProactiveRefresh())}assertAuthConfigured(){I(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}}/**
3189
3189
  * @license
3190
3190
  * Copyright 2020 Google LLC
3191
3191
  *
@@ -3200,7 +3200,7 @@ This typically indicates that your device does not have a healthy Internet conne
3200
3200
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3201
3201
  * See the License for the specific language governing permissions and
3202
3202
  * limitations under the License.
3203
- */function nw(t){switch(t){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";case"WebExtension":return"web-extension";default:return}}function rw(t){ut(new Ye("auth",(e,{options:n})=>{const r=e.getProvider("app").getImmediate(),s=e.getProvider("heartbeat"),i=e.getProvider("app-check-internal"),{apiKey:o,authDomain:a}=r.options;I(o&&!o.includes(":"),"invalid-api-key",{appName:r.name});const c={apiKey:o,authDomain:a,clientPlatform:t,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:md(t)},u=new yE(r,s,i,c);return SE(u,n),u},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e,n,r)=>{e.getProvider("auth-internal").initialize()})),ut(new Ye("auth-internal",e=>{const n=He(e.getProvider("auth").getImmediate());return(r=>new tw(r))(n)},"PRIVATE").setInstantiationMode("EXPLICIT")),Ae(Qd,Yd,nw(t)),Ae(Qd,Yd,"esm2017")}/**
3203
+ */function _w(n){switch(n){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";case"WebExtension":return"web-extension";default:return}}function yw(n){ft(new Ze("auth",(e,{options:t})=>{const r=e.getProvider("app").getImmediate(),s=e.getProvider("heartbeat"),i=e.getProvider("app-check-internal"),{apiKey:o,authDomain:a}=r.options;I(o&&!o.includes(":"),"invalid-api-key",{appName:r.name});const c={apiKey:o,authDomain:a,clientPlatform:n,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:Cd(n)},u=new OE(r,s,i,c);return qE(u,t),u},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e,t,r)=>{e.getProvider("auth-internal").initialize()})),ft(new Ze("auth-internal",e=>{const t=Ke(e.getProvider("auth").getImmediate());return(r=>new gw(r))(t)},"PRIVATE").setInstantiationMode("EXPLICIT")),Se(lf,hf,_w(n)),Se(lf,hf,"esm2017")}/**
3204
3204
  * @license
3205
3205
  * Copyright 2021 Google LLC
3206
3206
  *
@@ -3215,7 +3215,7 @@ This typically indicates that your device does not have a healthy Internet conne
3215
3215
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3216
3216
  * See the License for the specific language governing permissions and
3217
3217
  * limitations under the License.
3218
- */const sw=5*60,iw=sc("authIdTokenMaxAge")||sw;let Xd=null;const ow=t=>async e=>{const n=e&&await e.getIdTokenResult(),r=n&&(new Date().getTime()-Date.parse(n.issuedAtTime))/1e3;if(r&&r>iw)return;const s=n==null?void 0:n.token;Xd!==s&&(Xd=s,await fetch(t,{method:s?"POST":"DELETE",headers:s?{Authorization:`Bearer ${s}`}:{}}))};function aw(t=zr()){const e=Mn(t,"auth");if(e.isInitialized())return e.getImmediate();const n=PE(t,{popupRedirectResolver:ew,persistence:[dT,eT,Ld]}),r=sc("authTokenSyncURL");if(r){const i=ow(r);YE(n,i,()=>i(n.currentUser)),QE(n,o=>i(o))}const s=nc("auth");return s&&vd(n,`http://${s}`),n}function cw(){var t,e;return(e=(t=document.getElementsByTagName("head"))===null||t===void 0?void 0:t[0])!==null&&e!==void 0?e:document}vE({loadJS(t){return new Promise((e,n)=>{const r=document.createElement("script");r.setAttribute("src",t),r.onload=e,r.onerror=s=>{const i=ze("internal-error");i.customData=s,n(i)},r.type="text/javascript",r.charset="UTF-8",cw().appendChild(r)})},gapiScript:"https://apis.google.com/js/api.js",recaptchaV2Script:"https://www.google.com/recaptcha/api.js",recaptchaEnterpriseScript:"https://www.google.com/recaptcha/enterprise.js?render="}),rw("Browser");/**
3218
+ */const vw=5*60,Ew=dc("authIdTokenMaxAge")||vw;let df=null;const Tw=n=>async e=>{const t=e&&await e.getIdTokenResult(),r=t&&(new Date().getTime()-Date.parse(t.issuedAtTime))/1e3;if(r&&r>Ew)return;const s=t==null?void 0:t.token;df!==s&&(df=s,await fetch(n,{method:s?"POST":"DELETE",headers:s?{Authorization:`Bearer ${s}`}:{}}))};function ww(n=Qr()){const e=qn(n,"auth");if(e.isInitialized())return e.getImmediate();const t=jE(n,{popupRedirectResolver:mw,persistence:[ST,mT,Qd]}),r=dc("authTokenSyncURL");if(r&&typeof isSecureContext=="boolean"&&isSecureContext){const i=new URL(r,location.origin);if(location.origin===i.origin){const o=Tw(i.toString());hT(t,o,()=>o(t.currentUser)),lT(t,a=>o(a))}}const s=lc("auth");return s&&Od(t,`http://${s}`),t}function Iw(){var n,e;return(e=(n=document.getElementsByTagName("head"))===null||n===void 0?void 0:n[0])!==null&&e!==void 0?e:document}VE({loadJS(n){return new Promise((e,t)=>{const r=document.createElement("script");r.setAttribute("src",n),r.onload=e,r.onerror=s=>{const i=Le("internal-error");i.customData=s,t(i)},r.type="text/javascript",r.charset="UTF-8",Iw().appendChild(r)})},gapiScript:"https://apis.google.com/js/api.js",recaptchaV2Script:"https://www.google.com/recaptcha/api.js",recaptchaEnterpriseScript:"https://www.google.com/recaptcha/enterprise.js?render="}),yw("Browser");/**
3219
3219
  * @license
3220
3220
  * Copyright 2017 Google LLC
3221
3221
  *
@@ -3230,7 +3230,7 @@ This typically indicates that your device does not have a healthy Internet conne
3230
3230
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3231
3231
  * See the License for the specific language governing permissions and
3232
3232
  * limitations under the License.
3233
- */const Jd="firebasestorage.googleapis.com",Zd="storageBucket",uw=2*60*1e3,lw=10*60*1e3,hw=1e3;/**
3233
+ */const ff="firebasestorage.googleapis.com",pf="storageBucket",Aw=2*60*1e3,Rw=10*60*1e3,Pw=1e3;/**
3234
3234
  * @license
3235
3235
  * Copyright 2017 Google LLC
3236
3236
  *
@@ -3245,8 +3245,8 @@ This typically indicates that your device does not have a healthy Internet conne
3245
3245
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3246
3246
  * See the License for the specific language governing permissions and
3247
3247
  * limitations under the License.
3248
- */class z extends Ce{constructor(e,n,r=0){super(Fa(e),`Firebase Storage: ${n} (${Fa(e)})`),this.status_=r,this.customData={serverResponse:null},this._baseMessage=this.message,Object.setPrototypeOf(this,z.prototype)}get status(){return this.status_}set status(e){this.status_=e}_codeEquals(e){return Fa(e)===this.code}get serverResponse(){return this.customData.serverResponse}set serverResponse(e){this.customData.serverResponse=e,this.customData.serverResponse?this.message=`${this._baseMessage}
3249
- ${this.customData.serverResponse}`:this.message=this._baseMessage}}var $;(function(t){t.UNKNOWN="unknown",t.OBJECT_NOT_FOUND="object-not-found",t.BUCKET_NOT_FOUND="bucket-not-found",t.PROJECT_NOT_FOUND="project-not-found",t.QUOTA_EXCEEDED="quota-exceeded",t.UNAUTHENTICATED="unauthenticated",t.UNAUTHORIZED="unauthorized",t.UNAUTHORIZED_APP="unauthorized-app",t.RETRY_LIMIT_EXCEEDED="retry-limit-exceeded",t.INVALID_CHECKSUM="invalid-checksum",t.CANCELED="canceled",t.INVALID_EVENT_NAME="invalid-event-name",t.INVALID_URL="invalid-url",t.INVALID_DEFAULT_BUCKET="invalid-default-bucket",t.NO_DEFAULT_BUCKET="no-default-bucket",t.CANNOT_SLICE_BLOB="cannot-slice-blob",t.SERVER_FILE_WRONG_SIZE="server-file-wrong-size",t.NO_DOWNLOAD_URL="no-download-url",t.INVALID_ARGUMENT="invalid-argument",t.INVALID_ARGUMENT_COUNT="invalid-argument-count",t.APP_DELETED="app-deleted",t.INVALID_ROOT_OPERATION="invalid-root-operation",t.INVALID_FORMAT="invalid-format",t.INTERNAL_ERROR="internal-error",t.UNSUPPORTED_ENVIRONMENT="unsupported-environment"})($||($={}));function Fa(t){return"storage/"+t}function Ba(){const t="An unknown error occurred, please check the error payload for server response.";return new z($.UNKNOWN,t)}function dw(t){return new z($.OBJECT_NOT_FOUND,"Object '"+t+"' does not exist.")}function fw(t){return new z($.QUOTA_EXCEEDED,"Quota for bucket '"+t+"' exceeded, please view quota on https://firebase.google.com/pricing/.")}function pw(){const t="User is not authenticated, please authenticate using Firebase Authentication and try again.";return new z($.UNAUTHENTICATED,t)}function mw(){return new z($.UNAUTHORIZED_APP,"This app does not have permission to access Firebase Storage on this project.")}function gw(t){return new z($.UNAUTHORIZED,"User does not have permission to access '"+t+"'.")}function ef(){return new z($.RETRY_LIMIT_EXCEEDED,"Max retry time for operation exceeded, please try again.")}function tf(){return new z($.CANCELED,"User canceled the upload/download.")}function _w(t){return new z($.INVALID_URL,"Invalid URL '"+t+"'.")}function yw(t){return new z($.INVALID_DEFAULT_BUCKET,"Invalid default bucket '"+t+"'.")}function vw(){return new z($.NO_DEFAULT_BUCKET,"No default bucket found. Did you set the '"+Zd+"' property when initializing the app?")}function nf(){return new z($.CANNOT_SLICE_BLOB,"Cannot slice blob for upload. Please retry the upload.")}function Ew(){return new z($.SERVER_FILE_WRONG_SIZE,"Server recorded incorrect upload file size, please retry the upload.")}function Tw(){return new z($.NO_DOWNLOAD_URL,"The given file does not have any download URLs.")}function ww(t){return new z($.UNSUPPORTED_ENVIRONMENT,`${t} is missing. Make sure to install the required polyfills. See https://firebase.google.com/docs/web/environments-js-sdk#polyfills for more information.`)}function ja(t){return new z($.INVALID_ARGUMENT,t)}function rf(){return new z($.APP_DELETED,"The Firebase app was deleted.")}function Iw(t){return new z($.INVALID_ROOT_OPERATION,"The operation '"+t+"' cannot be performed on a root reference, create a non-root reference using child, such as .child('file.png').")}function xr(t,e){return new z($.INVALID_FORMAT,"String does not match format '"+t+"': "+e)}function Ur(t){throw new z($.INTERNAL_ERROR,"Internal error: "+t)}/**
3248
+ */class z extends De{constructor(e,t,r=0){super(Ga(e),`Firebase Storage: ${t} (${Ga(e)})`),this.status_=r,this.customData={serverResponse:null},this._baseMessage=this.message,Object.setPrototypeOf(this,z.prototype)}get status(){return this.status_}set status(e){this.status_=e}_codeEquals(e){return Ga(e)===this.code}get serverResponse(){return this.customData.serverResponse}set serverResponse(e){this.customData.serverResponse=e,this.customData.serverResponse?this.message=`${this._baseMessage}
3249
+ ${this.customData.serverResponse}`:this.message=this._baseMessage}}var q;(function(n){n.UNKNOWN="unknown",n.OBJECT_NOT_FOUND="object-not-found",n.BUCKET_NOT_FOUND="bucket-not-found",n.PROJECT_NOT_FOUND="project-not-found",n.QUOTA_EXCEEDED="quota-exceeded",n.UNAUTHENTICATED="unauthenticated",n.UNAUTHORIZED="unauthorized",n.UNAUTHORIZED_APP="unauthorized-app",n.RETRY_LIMIT_EXCEEDED="retry-limit-exceeded",n.INVALID_CHECKSUM="invalid-checksum",n.CANCELED="canceled",n.INVALID_EVENT_NAME="invalid-event-name",n.INVALID_URL="invalid-url",n.INVALID_DEFAULT_BUCKET="invalid-default-bucket",n.NO_DEFAULT_BUCKET="no-default-bucket",n.CANNOT_SLICE_BLOB="cannot-slice-blob",n.SERVER_FILE_WRONG_SIZE="server-file-wrong-size",n.NO_DOWNLOAD_URL="no-download-url",n.INVALID_ARGUMENT="invalid-argument",n.INVALID_ARGUMENT_COUNT="invalid-argument-count",n.APP_DELETED="app-deleted",n.INVALID_ROOT_OPERATION="invalid-root-operation",n.INVALID_FORMAT="invalid-format",n.INTERNAL_ERROR="internal-error",n.UNSUPPORTED_ENVIRONMENT="unsupported-environment"})(q||(q={}));function Ga(n){return"storage/"+n}function Ka(){const n="An unknown error occurred, please check the error payload for server response.";return new z(q.UNKNOWN,n)}function Sw(n){return new z(q.OBJECT_NOT_FOUND,"Object '"+n+"' does not exist.")}function bw(n){return new z(q.QUOTA_EXCEEDED,"Quota for bucket '"+n+"' exceeded, please view quota on https://firebase.google.com/pricing/.")}function Cw(){const n="User is not authenticated, please authenticate using Firebase Authentication and try again.";return new z(q.UNAUTHENTICATED,n)}function kw(){return new z(q.UNAUTHORIZED_APP,"This app does not have permission to access Firebase Storage on this project.")}function Dw(n){return new z(q.UNAUTHORIZED,"User does not have permission to access '"+n+"'.")}function mf(){return new z(q.RETRY_LIMIT_EXCEEDED,"Max retry time for operation exceeded, please try again.")}function gf(){return new z(q.CANCELED,"User canceled the upload/download.")}function Nw(n){return new z(q.INVALID_URL,"Invalid URL '"+n+"'.")}function Ow(n){return new z(q.INVALID_DEFAULT_BUCKET,"Invalid default bucket '"+n+"'.")}function Vw(){return new z(q.NO_DEFAULT_BUCKET,"No default bucket found. Did you set the '"+pf+"' property when initializing the app?")}function _f(){return new z(q.CANNOT_SLICE_BLOB,"Cannot slice blob for upload. Please retry the upload.")}function Lw(){return new z(q.SERVER_FILE_WRONG_SIZE,"Server recorded incorrect upload file size, please retry the upload.")}function Mw(){return new z(q.NO_DOWNLOAD_URL,"The given file does not have any download URLs.")}function xw(n){return new z(q.UNSUPPORTED_ENVIRONMENT,`${n} is missing. Make sure to install the required polyfills. See https://firebase.google.com/docs/web/environments-js-sdk#polyfills for more information.`)}function Qa(n){return new z(q.INVALID_ARGUMENT,n)}function yf(){return new z(q.APP_DELETED,"The Firebase app was deleted.")}function Uw(n){return new z(q.INVALID_ROOT_OPERATION,"The operation '"+n+"' cannot be performed on a root reference, create a non-root reference using child, such as .child('file.png').")}function qr(n,e){return new z(q.INVALID_FORMAT,"String does not match format '"+n+"': "+e)}function $r(n){throw new z(q.INTERNAL_ERROR,"Internal error: "+n)}/**
3250
3250
  * @license
3251
3251
  * Copyright 2017 Google LLC
3252
3252
  *
@@ -3261,7 +3261,7 @@ ${this.customData.serverResponse}`:this.message=this._baseMessage}}var $;(functi
3261
3261
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3262
3262
  * See the License for the specific language governing permissions and
3263
3263
  * limitations under the License.
3264
- */class Ie{constructor(e,n){this.bucket=e,this.path_=n}get path(){return this.path_}get isRoot(){return this.path.length===0}fullServerUrl(){const e=encodeURIComponent;return"/b/"+e(this.bucket)+"/o/"+e(this.path)}bucketOnlyServerUrl(){return"/b/"+encodeURIComponent(this.bucket)+"/o"}static makeFromBucketSpec(e,n){let r;try{r=Ie.makeFromUrl(e,n)}catch{return new Ie(e,"")}if(r.path==="")return r;throw yw(e)}static makeFromUrl(e,n){let r=null;const s="([A-Za-z0-9.\\-_]+)";function i(O){O.path.charAt(O.path.length-1)==="/"&&(O.path_=O.path_.slice(0,-1))}const o="(/(.*))?$",a=new RegExp("^gs://"+s+o,"i"),c={bucket:1,path:3};function u(O){O.path_=decodeURIComponent(O.path)}const l="v[A-Za-z0-9_]+",h=n.replace(/[.]/g,"\\."),d="(/([^?#]*).*)?$",f=new RegExp(`^https?://${h}/${l}/b/${s}/o${d}`,"i"),E={bucket:1,path:3},T=n===Jd?"(?:storage.googleapis.com|storage.cloud.google.com)":n,_="([^?#]*)",C=new RegExp(`^https?://${T}/${s}/${_}`,"i"),k=[{regex:a,indices:c,postModify:i},{regex:f,indices:E,postModify:u},{regex:C,indices:{bucket:1,path:2},postModify:u}];for(let O=0;O<k.length;O++){const _e=k[O],oe=_e.regex.exec(e);if(oe){const Me=oe[_e.indices.bucket];let Rt=oe[_e.indices.path];Rt||(Rt=""),r=new Ie(Me,Rt),_e.postModify(r);break}}if(r==null)throw _w(e);return r}}class Aw{constructor(e){this.promise_=Promise.reject(e)}getPromise(){return this.promise_}cancel(e=!1){}}/**
3264
+ */class Re{constructor(e,t){this.bucket=e,this.path_=t}get path(){return this.path_}get isRoot(){return this.path.length===0}fullServerUrl(){const e=encodeURIComponent;return"/b/"+e(this.bucket)+"/o/"+e(this.path)}bucketOnlyServerUrl(){return"/b/"+encodeURIComponent(this.bucket)+"/o"}static makeFromBucketSpec(e,t){let r;try{r=Re.makeFromUrl(e,t)}catch{return new Re(e,"")}if(r.path==="")return r;throw Ow(e)}static makeFromUrl(e,t){let r=null;const s="([A-Za-z0-9.\\-_]+)";function i(O){O.path.charAt(O.path.length-1)==="/"&&(O.path_=O.path_.slice(0,-1))}const o="(/(.*))?$",a=new RegExp("^gs://"+s+o,"i"),c={bucket:1,path:3};function u(O){O.path_=decodeURIComponent(O.path)}const l="v[A-Za-z0-9_]+",h=t.replace(/[.]/g,"\\."),d="(/([^?#]*).*)?$",f=new RegExp(`^https?://${h}/${l}/b/${s}/o${d}`,"i"),E={bucket:1,path:3},T=t===ff?"(?:storage.googleapis.com|storage.cloud.google.com)":t,_="([^?#]*)",C=new RegExp(`^https?://${T}/${s}/${_}`,"i"),k=[{regex:a,indices:c,postModify:i},{regex:f,indices:E,postModify:u},{regex:C,indices:{bucket:1,path:2},postModify:u}];for(let O=0;O<k.length;O++){const ve=k[O],oe=ve.regex.exec(e);if(oe){const Fe=oe[ve.indices.bucket];let Ct=oe[ve.indices.path];Ct||(Ct=""),r=new Re(Fe,Ct),ve.postModify(r);break}}if(r==null)throw Nw(e);return r}}class Fw{constructor(e){this.promise_=Promise.reject(e)}getPromise(){return this.promise_}cancel(e=!1){}}/**
3265
3265
  * @license
3266
3266
  * Copyright 2017 Google LLC
3267
3267
  *
@@ -3276,7 +3276,7 @@ ${this.customData.serverResponse}`:this.message=this._baseMessage}}var $;(functi
3276
3276
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3277
3277
  * See the License for the specific language governing permissions and
3278
3278
  * limitations under the License.
3279
- */function Rw(t,e,n){let r=1,s=null,i=null,o=!1,a=0;function c(){return a===2}let u=!1;function l(..._){u||(u=!0,e.apply(null,_))}function h(_){s=setTimeout(()=>{s=null,t(f,c())},_)}function d(){i&&clearTimeout(i)}function f(_,...C){if(u){d();return}if(_){d(),l.call(null,_,...C);return}if(c()||o){d(),l.call(null,_,...C);return}r<64&&(r*=2);let k;a===1?(a=2,k=0):k=(r+Math.random())*1e3,h(k)}let E=!1;function T(_){E||(E=!0,d(),!u&&(s!==null?(_||(a=2),clearTimeout(s),h(0)):_||(a=1)))}return h(0),i=setTimeout(()=>{o=!0,T(!0)},n),T}function Pw(t){t(!1)}/**
3279
+ */function Bw(n,e,t){let r=1,s=null,i=null,o=!1,a=0;function c(){return a===2}let u=!1;function l(..._){u||(u=!0,e.apply(null,_))}function h(_){s=setTimeout(()=>{s=null,n(f,c())},_)}function d(){i&&clearTimeout(i)}function f(_,...C){if(u){d();return}if(_){d(),l.call(null,_,...C);return}if(c()||o){d(),l.call(null,_,...C);return}r<64&&(r*=2);let k;a===1?(a=2,k=0):k=(r+Math.random())*1e3,h(k)}let E=!1;function T(_){E||(E=!0,d(),!u&&(s!==null?(_||(a=2),clearTimeout(s),h(0)):_||(a=1)))}return h(0),i=setTimeout(()=>{o=!0,T(!0)},t),T}function jw(n){n(!1)}/**
3280
3280
  * @license
3281
3281
  * Copyright 2017 Google LLC
3282
3282
  *
@@ -3291,7 +3291,7 @@ ${this.customData.serverResponse}`:this.message=this._baseMessage}}var $;(functi
3291
3291
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3292
3292
  * See the License for the specific language governing permissions and
3293
3293
  * limitations under the License.
3294
- */function Sw(t){return t!==void 0}function bw(t){return typeof t=="function"}function Cw(t){return typeof t=="object"&&!Array.isArray(t)}function mi(t){return typeof t=="string"||t instanceof String}function sf(t){return $a()&&t instanceof Blob}function $a(){return typeof Blob<"u"}function of(t,e,n,r){if(r<e)throw ja(`Invalid value for '${t}'. Expected ${e} or greater.`);if(r>n)throw ja(`Invalid value for '${t}'. Expected ${n} or less.`)}/**
3294
+ */function qw(n){return n!==void 0}function $w(n){return typeof n=="function"}function zw(n){return typeof n=="object"&&!Array.isArray(n)}function vi(n){return typeof n=="string"||n instanceof String}function vf(n){return Ya()&&n instanceof Blob}function Ya(){return typeof Blob<"u"}function Ef(n,e,t,r){if(r<e)throw Qa(`Invalid value for '${n}'. Expected ${e} or greater.`);if(r>t)throw Qa(`Invalid value for '${n}'. Expected ${t} or less.`)}/**
3295
3295
  * @license
3296
3296
  * Copyright 2017 Google LLC
3297
3297
  *
@@ -3306,7 +3306,7 @@ ${this.customData.serverResponse}`:this.message=this._baseMessage}}var $;(functi
3306
3306
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3307
3307
  * See the License for the specific language governing permissions and
3308
3308
  * limitations under the License.
3309
- */function bn(t,e,n){let r=e;return n==null&&(r=`https://${e}`),`${n}://${r}/v0${t}`}function af(t){const e=encodeURIComponent;let n="?";for(const r in t)if(t.hasOwnProperty(r)){const s=e(r)+"="+e(t[r]);n=n+s+"&"}return n=n.slice(0,-1),n}/**
3309
+ */function On(n,e,t){let r=e;return t==null&&(r=`https://${e}`),`${t}://${r}/v0${n}`}function Tf(n){const e=encodeURIComponent;let t="?";for(const r in n)if(n.hasOwnProperty(r)){const s=e(r)+"="+e(n[r]);t=t+s+"&"}return t=t.slice(0,-1),t}/**
3310
3310
  * @license
3311
3311
  * Copyright 2017 Google LLC
3312
3312
  *
@@ -3321,7 +3321,7 @@ ${this.customData.serverResponse}`:this.message=this._baseMessage}}var $;(functi
3321
3321
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3322
3322
  * See the License for the specific language governing permissions and
3323
3323
  * limitations under the License.
3324
- */var Ht;(function(t){t[t.NO_ERROR=0]="NO_ERROR",t[t.NETWORK_ERROR=1]="NETWORK_ERROR",t[t.ABORT=2]="ABORT"})(Ht||(Ht={}));/**
3324
+ */var Kt;(function(n){n[n.NO_ERROR=0]="NO_ERROR",n[n.NETWORK_ERROR=1]="NETWORK_ERROR",n[n.ABORT=2]="ABORT"})(Kt||(Kt={}));/**
3325
3325
  * @license
3326
3326
  * Copyright 2022 Google LLC
3327
3327
  *
@@ -3336,7 +3336,7 @@ ${this.customData.serverResponse}`:this.message=this._baseMessage}}var $;(functi
3336
3336
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3337
3337
  * See the License for the specific language governing permissions and
3338
3338
  * limitations under the License.
3339
- */function cf(t,e){const n=t>=500&&t<600,s=[408,429].indexOf(t)!==-1,i=e.indexOf(t)!==-1;return n||s||i}/**
3339
+ */function wf(n,e){const t=n>=500&&n<600,s=[408,429].indexOf(n)!==-1,i=e.indexOf(n)!==-1;return t||s||i}/**
3340
3340
  * @license
3341
3341
  * Copyright 2017 Google LLC
3342
3342
  *
@@ -3351,7 +3351,7 @@ ${this.customData.serverResponse}`:this.message=this._baseMessage}}var $;(functi
3351
3351
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3352
3352
  * See the License for the specific language governing permissions and
3353
3353
  * limitations under the License.
3354
- */class kw{constructor(e,n,r,s,i,o,a,c,u,l,h,d=!0){this.url_=e,this.method_=n,this.headers_=r,this.body_=s,this.successCodes_=i,this.additionalRetryCodes_=o,this.callback_=a,this.errorCallback_=c,this.timeout_=u,this.progressCallback_=l,this.connectionFactory_=h,this.retry=d,this.pendingConnection_=null,this.backoffId_=null,this.canceled_=!1,this.appDelete_=!1,this.promise_=new Promise((f,E)=>{this.resolve_=f,this.reject_=E,this.start_()})}start_(){const e=(r,s)=>{if(s){r(!1,new gi(!1,null,!0));return}const i=this.connectionFactory_();this.pendingConnection_=i;const o=a=>{const c=a.loaded,u=a.lengthComputable?a.total:-1;this.progressCallback_!==null&&this.progressCallback_(c,u)};this.progressCallback_!==null&&i.addUploadProgressListener(o),i.send(this.url_,this.method_,this.body_,this.headers_).then(()=>{this.progressCallback_!==null&&i.removeUploadProgressListener(o),this.pendingConnection_=null;const a=i.getErrorCode()===Ht.NO_ERROR,c=i.getStatus();if(!a||cf(c,this.additionalRetryCodes_)&&this.retry){const l=i.getErrorCode()===Ht.ABORT;r(!1,new gi(!1,null,l));return}const u=this.successCodes_.indexOf(c)!==-1;r(!0,new gi(u,i))})},n=(r,s)=>{const i=this.resolve_,o=this.reject_,a=s.connection;if(s.wasSuccessCode)try{const c=this.callback_(a,a.getResponse());Sw(c)?i(c):i()}catch(c){o(c)}else if(a!==null){const c=Ba();c.serverResponse=a.getErrorText(),this.errorCallback_?o(this.errorCallback_(a,c)):o(c)}else if(s.canceled){const c=this.appDelete_?rf():tf();o(c)}else{const c=ef();o(c)}};this.canceled_?n(!1,new gi(!1,null,!0)):this.backoffId_=Rw(e,n,this.timeout_)}getPromise(){return this.promise_}cancel(e){this.canceled_=!0,this.appDelete_=e||!1,this.backoffId_!==null&&Pw(this.backoffId_),this.pendingConnection_!==null&&this.pendingConnection_.abort()}}class gi{constructor(e,n,r){this.wasSuccessCode=e,this.connection=n,this.canceled=!!r}}function Dw(t,e){e!==null&&e.length>0&&(t.Authorization="Firebase "+e)}function Nw(t,e){t["X-Firebase-Storage-Version"]="webjs/"+(e??"AppManager")}function Ow(t,e){e&&(t["X-Firebase-GMPID"]=e)}function Vw(t,e){e!==null&&(t["X-Firebase-AppCheck"]=e)}function Lw(t,e,n,r,s,i,o=!0){const a=af(t.urlParams),c=t.url+a,u=Object.assign({},t.headers);return Ow(u,e),Dw(u,n),Nw(u,i),Vw(u,r),new kw(c,t.method,u,t.body,t.successCodes,t.additionalRetryCodes,t.handler,t.errorHandler,t.timeout,t.progressCallback,s,o)}/**
3354
+ */class Hw{constructor(e,t,r,s,i,o,a,c,u,l,h,d=!0){this.url_=e,this.method_=t,this.headers_=r,this.body_=s,this.successCodes_=i,this.additionalRetryCodes_=o,this.callback_=a,this.errorCallback_=c,this.timeout_=u,this.progressCallback_=l,this.connectionFactory_=h,this.retry=d,this.pendingConnection_=null,this.backoffId_=null,this.canceled_=!1,this.appDelete_=!1,this.promise_=new Promise((f,E)=>{this.resolve_=f,this.reject_=E,this.start_()})}start_(){const e=(r,s)=>{if(s){r(!1,new Ei(!1,null,!0));return}const i=this.connectionFactory_();this.pendingConnection_=i;const o=a=>{const c=a.loaded,u=a.lengthComputable?a.total:-1;this.progressCallback_!==null&&this.progressCallback_(c,u)};this.progressCallback_!==null&&i.addUploadProgressListener(o),i.send(this.url_,this.method_,this.body_,this.headers_).then(()=>{this.progressCallback_!==null&&i.removeUploadProgressListener(o),this.pendingConnection_=null;const a=i.getErrorCode()===Kt.NO_ERROR,c=i.getStatus();if(!a||wf(c,this.additionalRetryCodes_)&&this.retry){const l=i.getErrorCode()===Kt.ABORT;r(!1,new Ei(!1,null,l));return}const u=this.successCodes_.indexOf(c)!==-1;r(!0,new Ei(u,i))})},t=(r,s)=>{const i=this.resolve_,o=this.reject_,a=s.connection;if(s.wasSuccessCode)try{const c=this.callback_(a,a.getResponse());qw(c)?i(c):i()}catch(c){o(c)}else if(a!==null){const c=Ka();c.serverResponse=a.getErrorText(),this.errorCallback_?o(this.errorCallback_(a,c)):o(c)}else if(s.canceled){const c=this.appDelete_?yf():gf();o(c)}else{const c=mf();o(c)}};this.canceled_?t(!1,new Ei(!1,null,!0)):this.backoffId_=Bw(e,t,this.timeout_)}getPromise(){return this.promise_}cancel(e){this.canceled_=!0,this.appDelete_=e||!1,this.backoffId_!==null&&jw(this.backoffId_),this.pendingConnection_!==null&&this.pendingConnection_.abort()}}class Ei{constructor(e,t,r){this.wasSuccessCode=e,this.connection=t,this.canceled=!!r}}function Ww(n,e){e!==null&&e.length>0&&(n.Authorization="Firebase "+e)}function Gw(n,e){n["X-Firebase-Storage-Version"]="webjs/"+(e??"AppManager")}function Kw(n,e){e&&(n["X-Firebase-GMPID"]=e)}function Qw(n,e){e!==null&&(n["X-Firebase-AppCheck"]=e)}function Yw(n,e,t,r,s,i,o=!0){const a=Tf(n.urlParams),c=n.url+a,u=Object.assign({},n.headers);return Kw(u,e),Ww(u,t),Gw(u,i),Qw(u,r),new Hw(c,n.method,u,n.body,n.successCodes,n.additionalRetryCodes,n.handler,n.errorHandler,n.timeout,n.progressCallback,s,o)}/**
3355
3355
  * @license
3356
3356
  * Copyright 2017 Google LLC
3357
3357
  *
@@ -3366,7 +3366,7 @@ ${this.customData.serverResponse}`:this.message=this._baseMessage}}var $;(functi
3366
3366
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3367
3367
  * See the License for the specific language governing permissions and
3368
3368
  * limitations under the License.
3369
- */function Mw(){return typeof BlobBuilder<"u"?BlobBuilder:typeof WebKitBlobBuilder<"u"?WebKitBlobBuilder:void 0}function xw(...t){const e=Mw();if(e!==void 0){const n=new e;for(let r=0;r<t.length;r++)n.append(t[r]);return n.getBlob()}else{if($a())return new Blob(t);throw new z($.UNSUPPORTED_ENVIRONMENT,"This browser doesn't seem to support creating Blobs")}}function Uw(t,e,n){return t.webkitSlice?t.webkitSlice(e,n):t.mozSlice?t.mozSlice(e,n):t.slice?t.slice(e,n):null}/**
3369
+ */function Xw(){return typeof BlobBuilder<"u"?BlobBuilder:typeof WebKitBlobBuilder<"u"?WebKitBlobBuilder:void 0}function Jw(...n){const e=Xw();if(e!==void 0){const t=new e;for(let r=0;r<n.length;r++)t.append(n[r]);return t.getBlob()}else{if(Ya())return new Blob(n);throw new z(q.UNSUPPORTED_ENVIRONMENT,"This browser doesn't seem to support creating Blobs")}}function Zw(n,e,t){return n.webkitSlice?n.webkitSlice(e,t):n.mozSlice?n.mozSlice(e,t):n.slice?n.slice(e,t):null}/**
3370
3370
  * @license
3371
3371
  * Copyright 2021 Google LLC
3372
3372
  *
@@ -3381,7 +3381,7 @@ ${this.customData.serverResponse}`:this.message=this._baseMessage}}var $;(functi
3381
3381
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3382
3382
  * See the License for the specific language governing permissions and
3383
3383
  * limitations under the License.
3384
- */function Fw(t){if(typeof atob>"u")throw ww("base-64");return atob(t)}/**
3384
+ */function eI(n){if(typeof atob>"u")throw xw("base-64");return atob(n)}/**
3385
3385
  * @license
3386
3386
  * Copyright 2017 Google LLC
3387
3387
  *
@@ -3396,7 +3396,7 @@ ${this.customData.serverResponse}`:this.message=this._baseMessage}}var $;(functi
3396
3396
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3397
3397
  * See the License for the specific language governing permissions and
3398
3398
  * limitations under the License.
3399
- */const Qe={RAW:"raw",BASE64:"base64",BASE64URL:"base64url",DATA_URL:"data_url"};class qa{constructor(e,n){this.data=e,this.contentType=n||null}}function Bw(t,e){switch(t){case Qe.RAW:return new qa(uf(e));case Qe.BASE64:case Qe.BASE64URL:return new qa(lf(t,e));case Qe.DATA_URL:return new qa($w(e),qw(e))}throw Ba()}function uf(t){const e=[];for(let n=0;n<t.length;n++){let r=t.charCodeAt(n);if(r<=127)e.push(r);else if(r<=2047)e.push(192|r>>6,128|r&63);else if((r&64512)===55296)if(!(n<t.length-1&&(t.charCodeAt(n+1)&64512)===56320))e.push(239,191,189);else{const i=r,o=t.charCodeAt(++n);r=65536|(i&1023)<<10|o&1023,e.push(240|r>>18,128|r>>12&63,128|r>>6&63,128|r&63)}else(r&64512)===56320?e.push(239,191,189):e.push(224|r>>12,128|r>>6&63,128|r&63)}return new Uint8Array(e)}function jw(t){let e;try{e=decodeURIComponent(t)}catch{throw xr(Qe.DATA_URL,"Malformed data URL.")}return uf(e)}function lf(t,e){switch(t){case Qe.BASE64:{const s=e.indexOf("-")!==-1,i=e.indexOf("_")!==-1;if(s||i)throw xr(t,"Invalid character '"+(s?"-":"_")+"' found: is it base64url encoded?");break}case Qe.BASE64URL:{const s=e.indexOf("+")!==-1,i=e.indexOf("/")!==-1;if(s||i)throw xr(t,"Invalid character '"+(s?"+":"/")+"' found: is it base64 encoded?");e=e.replace(/-/g,"+").replace(/_/g,"/");break}}let n;try{n=Fw(e)}catch(s){throw s.message.includes("polyfill")?s:xr(t,"Invalid character found")}const r=new Uint8Array(n.length);for(let s=0;s<n.length;s++)r[s]=n.charCodeAt(s);return r}class hf{constructor(e){this.base64=!1,this.contentType=null;const n=e.match(/^data:([^,]+)?,/);if(n===null)throw xr(Qe.DATA_URL,"Must be formatted 'data:[<mediatype>][;base64],<data>");const r=n[1]||null;r!=null&&(this.base64=zw(r,";base64"),this.contentType=this.base64?r.substring(0,r.length-7):r),this.rest=e.substring(e.indexOf(",")+1)}}function $w(t){const e=new hf(t);return e.base64?lf(Qe.BASE64,e.rest):jw(e.rest)}function qw(t){return new hf(t).contentType}function zw(t,e){return t.length>=e.length?t.substring(t.length-e.length)===e:!1}/**
3399
+ */const Je={RAW:"raw",BASE64:"base64",BASE64URL:"base64url",DATA_URL:"data_url"};class Xa{constructor(e,t){this.data=e,this.contentType=t||null}}function tI(n,e){switch(n){case Je.RAW:return new Xa(If(e));case Je.BASE64:case Je.BASE64URL:return new Xa(Af(n,e));case Je.DATA_URL:return new Xa(rI(e),sI(e))}throw Ka()}function If(n){const e=[];for(let t=0;t<n.length;t++){let r=n.charCodeAt(t);if(r<=127)e.push(r);else if(r<=2047)e.push(192|r>>6,128|r&63);else if((r&64512)===55296)if(!(t<n.length-1&&(n.charCodeAt(t+1)&64512)===56320))e.push(239,191,189);else{const i=r,o=n.charCodeAt(++t);r=65536|(i&1023)<<10|o&1023,e.push(240|r>>18,128|r>>12&63,128|r>>6&63,128|r&63)}else(r&64512)===56320?e.push(239,191,189):e.push(224|r>>12,128|r>>6&63,128|r&63)}return new Uint8Array(e)}function nI(n){let e;try{e=decodeURIComponent(n)}catch{throw qr(Je.DATA_URL,"Malformed data URL.")}return If(e)}function Af(n,e){switch(n){case Je.BASE64:{const s=e.indexOf("-")!==-1,i=e.indexOf("_")!==-1;if(s||i)throw qr(n,"Invalid character '"+(s?"-":"_")+"' found: is it base64url encoded?");break}case Je.BASE64URL:{const s=e.indexOf("+")!==-1,i=e.indexOf("/")!==-1;if(s||i)throw qr(n,"Invalid character '"+(s?"+":"/")+"' found: is it base64 encoded?");e=e.replace(/-/g,"+").replace(/_/g,"/");break}}let t;try{t=eI(e)}catch(s){throw s.message.includes("polyfill")?s:qr(n,"Invalid character found")}const r=new Uint8Array(t.length);for(let s=0;s<t.length;s++)r[s]=t.charCodeAt(s);return r}class Rf{constructor(e){this.base64=!1,this.contentType=null;const t=e.match(/^data:([^,]+)?,/);if(t===null)throw qr(Je.DATA_URL,"Must be formatted 'data:[<mediatype>][;base64],<data>");const r=t[1]||null;r!=null&&(this.base64=iI(r,";base64"),this.contentType=this.base64?r.substring(0,r.length-7):r),this.rest=e.substring(e.indexOf(",")+1)}}function rI(n){const e=new Rf(n);return e.base64?Af(Je.BASE64,e.rest):nI(e.rest)}function sI(n){return new Rf(n).contentType}function iI(n,e){return n.length>=e.length?n.substring(n.length-e.length)===e:!1}/**
3400
3400
  * @license
3401
3401
  * Copyright 2017 Google LLC
3402
3402
  *
@@ -3411,7 +3411,7 @@ ${this.customData.serverResponse}`:this.message=this._baseMessage}}var $;(functi
3411
3411
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3412
3412
  * See the License for the specific language governing permissions and
3413
3413
  * limitations under the License.
3414
- */class At{constructor(e,n){let r=0,s="";sf(e)?(this.data_=e,r=e.size,s=e.type):e instanceof ArrayBuffer?(n?this.data_=new Uint8Array(e):(this.data_=new Uint8Array(e.byteLength),this.data_.set(new Uint8Array(e))),r=this.data_.length):e instanceof Uint8Array&&(n?this.data_=e:(this.data_=new Uint8Array(e.length),this.data_.set(e)),r=e.length),this.size_=r,this.type_=s}size(){return this.size_}type(){return this.type_}slice(e,n){if(sf(this.data_)){const r=this.data_,s=Uw(r,e,n);return s===null?null:new At(s)}else{const r=new Uint8Array(this.data_.buffer,e,n-e);return new At(r,!0)}}static getBlob(...e){if($a()){const n=e.map(r=>r instanceof At?r.data_:r);return new At(xw.apply(null,n))}else{const n=e.map(o=>mi(o)?Bw(Qe.RAW,o).data:o.data_);let r=0;n.forEach(o=>{r+=o.byteLength});const s=new Uint8Array(r);let i=0;return n.forEach(o=>{for(let a=0;a<o.length;a++)s[i++]=o[a]}),new At(s,!0)}}uploadData(){return this.data_}}/**
3414
+ */class bt{constructor(e,t){let r=0,s="";vf(e)?(this.data_=e,r=e.size,s=e.type):e instanceof ArrayBuffer?(t?this.data_=new Uint8Array(e):(this.data_=new Uint8Array(e.byteLength),this.data_.set(new Uint8Array(e))),r=this.data_.length):e instanceof Uint8Array&&(t?this.data_=e:(this.data_=new Uint8Array(e.length),this.data_.set(e)),r=e.length),this.size_=r,this.type_=s}size(){return this.size_}type(){return this.type_}slice(e,t){if(vf(this.data_)){const r=this.data_,s=Zw(r,e,t);return s===null?null:new bt(s)}else{const r=new Uint8Array(this.data_.buffer,e,t-e);return new bt(r,!0)}}static getBlob(...e){if(Ya()){const t=e.map(r=>r instanceof bt?r.data_:r);return new bt(Jw.apply(null,t))}else{const t=e.map(o=>vi(o)?tI(Je.RAW,o).data:o.data_);let r=0;t.forEach(o=>{r+=o.byteLength});const s=new Uint8Array(r);let i=0;return t.forEach(o=>{for(let a=0;a<o.length;a++)s[i++]=o[a]}),new bt(s,!0)}}uploadData(){return this.data_}}/**
3415
3415
  * @license
3416
3416
  * Copyright 2017 Google LLC
3417
3417
  *
@@ -3426,7 +3426,7 @@ ${this.customData.serverResponse}`:this.message=this._baseMessage}}var $;(functi
3426
3426
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3427
3427
  * See the License for the specific language governing permissions and
3428
3428
  * limitations under the License.
3429
- */function df(t){let e;try{e=JSON.parse(t)}catch{return null}return Cw(e)?e:null}/**
3429
+ */function Pf(n){let e;try{e=JSON.parse(n)}catch{return null}return zw(e)?e:null}/**
3430
3430
  * @license
3431
3431
  * Copyright 2017 Google LLC
3432
3432
  *
@@ -3441,7 +3441,7 @@ ${this.customData.serverResponse}`:this.message=this._baseMessage}}var $;(functi
3441
3441
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3442
3442
  * See the License for the specific language governing permissions and
3443
3443
  * limitations under the License.
3444
- */function Hw(t){if(t.length===0)return null;const e=t.lastIndexOf("/");return e===-1?"":t.slice(0,e)}function Ww(t,e){const n=e.split("/").filter(r=>r.length>0).join("/");return t.length===0?n:t+"/"+n}function ff(t){const e=t.lastIndexOf("/",t.length-2);return e===-1?t:t.slice(e+1)}/**
3444
+ */function oI(n){if(n.length===0)return null;const e=n.lastIndexOf("/");return e===-1?"":n.slice(0,e)}function aI(n,e){const t=e.split("/").filter(r=>r.length>0).join("/");return n.length===0?t:n+"/"+t}function Sf(n){const e=n.lastIndexOf("/",n.length-2);return e===-1?n:n.slice(e+1)}/**
3445
3445
  * @license
3446
3446
  * Copyright 2017 Google LLC
3447
3447
  *
@@ -3456,7 +3456,7 @@ ${this.customData.serverResponse}`:this.message=this._baseMessage}}var $;(functi
3456
3456
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3457
3457
  * See the License for the specific language governing permissions and
3458
3458
  * limitations under the License.
3459
- */function Gw(t,e){return e}class pe{constructor(e,n,r,s){this.server=e,this.local=n||e,this.writable=!!r,this.xform=s||Gw}}let _i=null;function Kw(t){return!mi(t)||t.length<2?t:ff(t)}function pf(){if(_i)return _i;const t=[];t.push(new pe("bucket")),t.push(new pe("generation")),t.push(new pe("metageneration")),t.push(new pe("name","fullPath",!0));function e(i,o){return Kw(o)}const n=new pe("name");n.xform=e,t.push(n);function r(i,o){return o!==void 0?Number(o):o}const s=new pe("size");return s.xform=r,t.push(s),t.push(new pe("timeCreated")),t.push(new pe("updated")),t.push(new pe("md5Hash",null,!0)),t.push(new pe("cacheControl",null,!0)),t.push(new pe("contentDisposition",null,!0)),t.push(new pe("contentEncoding",null,!0)),t.push(new pe("contentLanguage",null,!0)),t.push(new pe("contentType",null,!0)),t.push(new pe("metadata","customMetadata",!0)),_i=t,_i}function Qw(t,e){function n(){const r=t.bucket,s=t.fullPath,i=new Ie(r,s);return e._makeStorageReference(i)}Object.defineProperty(t,"ref",{get:n})}function Yw(t,e,n){const r={};r.type="file";const s=n.length;for(let i=0;i<s;i++){const o=n[i];r[o.local]=o.xform(r,e[o.server])}return Qw(r,t),r}function mf(t,e,n){const r=df(e);return r===null?null:Yw(t,r,n)}function Xw(t,e,n,r){const s=df(e);if(s===null||!mi(s.downloadTokens))return null;const i=s.downloadTokens;if(i.length===0)return null;const o=encodeURIComponent;return i.split(",").map(u=>{const l=t.bucket,h=t.fullPath,d="/b/"+o(l)+"/o/"+o(h),f=bn(d,n,r),E=af({alt:"media",token:u});return f+E})[0]}function gf(t,e){const n={},r=e.length;for(let s=0;s<r;s++){const i=e[s];i.writable&&(n[i.server]=t[i.local])}return JSON.stringify(n)}class Wt{constructor(e,n,r,s){this.url=e,this.method=n,this.handler=r,this.timeout=s,this.urlParams={},this.headers={},this.body=null,this.errorHandler=null,this.progressCallback=null,this.successCodes=[200],this.additionalRetryCodes=[]}}/**
3459
+ */function cI(n,e){return e}class ge{constructor(e,t,r,s){this.server=e,this.local=t||e,this.writable=!!r,this.xform=s||cI}}let Ti=null;function uI(n){return!vi(n)||n.length<2?n:Sf(n)}function bf(){if(Ti)return Ti;const n=[];n.push(new ge("bucket")),n.push(new ge("generation")),n.push(new ge("metageneration")),n.push(new ge("name","fullPath",!0));function e(i,o){return uI(o)}const t=new ge("name");t.xform=e,n.push(t);function r(i,o){return o!==void 0?Number(o):o}const s=new ge("size");return s.xform=r,n.push(s),n.push(new ge("timeCreated")),n.push(new ge("updated")),n.push(new ge("md5Hash",null,!0)),n.push(new ge("cacheControl",null,!0)),n.push(new ge("contentDisposition",null,!0)),n.push(new ge("contentEncoding",null,!0)),n.push(new ge("contentLanguage",null,!0)),n.push(new ge("contentType",null,!0)),n.push(new ge("metadata","customMetadata",!0)),Ti=n,Ti}function lI(n,e){function t(){const r=n.bucket,s=n.fullPath,i=new Re(r,s);return e._makeStorageReference(i)}Object.defineProperty(n,"ref",{get:t})}function hI(n,e,t){const r={};r.type="file";const s=t.length;for(let i=0;i<s;i++){const o=t[i];r[o.local]=o.xform(r,e[o.server])}return lI(r,n),r}function Cf(n,e,t){const r=Pf(e);return r===null?null:hI(n,r,t)}function dI(n,e,t,r){const s=Pf(e);if(s===null||!vi(s.downloadTokens))return null;const i=s.downloadTokens;if(i.length===0)return null;const o=encodeURIComponent;return i.split(",").map(u=>{const l=n.bucket,h=n.fullPath,d="/b/"+o(l)+"/o/"+o(h),f=On(d,t,r),E=Tf({alt:"media",token:u});return f+E})[0]}function kf(n,e){const t={},r=e.length;for(let s=0;s<r;s++){const i=e[s];i.writable&&(t[i.server]=n[i.local])}return JSON.stringify(t)}class Qt{constructor(e,t,r,s){this.url=e,this.method=t,this.handler=r,this.timeout=s,this.urlParams={},this.headers={},this.body=null,this.errorHandler=null,this.progressCallback=null,this.successCodes=[200],this.additionalRetryCodes=[]}}/**
3460
3460
  * @license
3461
3461
  * Copyright 2017 Google LLC
3462
3462
  *
@@ -3471,7 +3471,7 @@ ${this.customData.serverResponse}`:this.message=this._baseMessage}}var $;(functi
3471
3471
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3472
3472
  * See the License for the specific language governing permissions and
3473
3473
  * limitations under the License.
3474
- */function ot(t){if(!t)throw Ba()}function za(t,e){function n(r,s){const i=mf(t,s,e);return ot(i!==null),i}return n}function Jw(t,e){function n(r,s){const i=mf(t,s,e);return ot(i!==null),Xw(i,s,t.host,t._protocol)}return n}function Fr(t){function e(n,r){let s;return n.getStatus()===401?n.getErrorText().includes("Firebase App Check token is invalid")?s=mw():s=pw():n.getStatus()===402?s=fw(t.bucket):n.getStatus()===403?s=gw(t.path):s=r,s.status=n.getStatus(),s.serverResponse=r.serverResponse,s}return e}function Ha(t){const e=Fr(t);function n(r,s){let i=e(r,s);return r.getStatus()===404&&(i=dw(t.path)),i.serverResponse=s.serverResponse,i}return n}function Zw(t,e,n){const r=e.fullServerUrl(),s=bn(r,t.host,t._protocol),i="GET",o=t.maxOperationRetryTime,a=new Wt(s,i,za(t,n),o);return a.errorHandler=Ha(e),a}function eI(t,e,n){const r=e.fullServerUrl(),s=bn(r,t.host,t._protocol),i="GET",o=t.maxOperationRetryTime,a=new Wt(s,i,Jw(t,n),o);return a.errorHandler=Ha(e),a}function tI(t,e){const n=e.fullServerUrl(),r=bn(n,t.host,t._protocol),s="DELETE",i=t.maxOperationRetryTime;function o(c,u){}const a=new Wt(r,s,o,i);return a.successCodes=[200,204],a.errorHandler=Ha(e),a}function nI(t,e){return t&&t.contentType||e&&e.type()||"application/octet-stream"}function _f(t,e,n){const r=Object.assign({},n);return r.fullPath=t.path,r.size=e.size(),r.contentType||(r.contentType=nI(null,e)),r}function rI(t,e,n,r,s){const i=e.bucketOnlyServerUrl(),o={"X-Goog-Upload-Protocol":"multipart"};function a(){let k="";for(let O=0;O<2;O++)k=k+Math.random().toString().slice(2);return k}const c=a();o["Content-Type"]="multipart/related; boundary="+c;const u=_f(e,r,s),l=gf(u,n),h="--"+c+`\r
3474
+ */function lt(n){if(!n)throw Ka()}function Ja(n,e){function t(r,s){const i=Cf(n,s,e);return lt(i!==null),i}return t}function fI(n,e){function t(r,s){const i=Cf(n,s,e);return lt(i!==null),dI(i,s,n.host,n._protocol)}return t}function zr(n){function e(t,r){let s;return t.getStatus()===401?t.getErrorText().includes("Firebase App Check token is invalid")?s=kw():s=Cw():t.getStatus()===402?s=bw(n.bucket):t.getStatus()===403?s=Dw(n.path):s=r,s.status=t.getStatus(),s.serverResponse=r.serverResponse,s}return e}function Za(n){const e=zr(n);function t(r,s){let i=e(r,s);return r.getStatus()===404&&(i=Sw(n.path)),i.serverResponse=s.serverResponse,i}return t}function pI(n,e,t){const r=e.fullServerUrl(),s=On(r,n.host,n._protocol),i="GET",o=n.maxOperationRetryTime,a=new Qt(s,i,Ja(n,t),o);return a.errorHandler=Za(e),a}function mI(n,e,t){const r=e.fullServerUrl(),s=On(r,n.host,n._protocol),i="GET",o=n.maxOperationRetryTime,a=new Qt(s,i,fI(n,t),o);return a.errorHandler=Za(e),a}function gI(n,e){const t=e.fullServerUrl(),r=On(t,n.host,n._protocol),s="DELETE",i=n.maxOperationRetryTime;function o(c,u){}const a=new Qt(r,s,o,i);return a.successCodes=[200,204],a.errorHandler=Za(e),a}function _I(n,e){return n&&n.contentType||e&&e.type()||"application/octet-stream"}function Df(n,e,t){const r=Object.assign({},t);return r.fullPath=n.path,r.size=e.size(),r.contentType||(r.contentType=_I(null,e)),r}function yI(n,e,t,r,s){const i=e.bucketOnlyServerUrl(),o={"X-Goog-Upload-Protocol":"multipart"};function a(){let k="";for(let O=0;O<2;O++)k=k+Math.random().toString().slice(2);return k}const c=a();o["Content-Type"]="multipart/related; boundary="+c;const u=Df(e,r,s),l=kf(u,t),h="--"+c+`\r
3475
3475
  Content-Type: application/json; charset=utf-8\r
3476
3476
  \r
3477
3477
  `+l+`\r
@@ -3479,7 +3479,7 @@ Content-Type: application/json; charset=utf-8\r
3479
3479
  Content-Type: `+u.contentType+`\r
3480
3480
  \r
3481
3481
  `,d=`\r
3482
- --`+c+"--",f=At.getBlob(h,r,d);if(f===null)throw nf();const E={name:u.fullPath},T=bn(i,t.host,t._protocol),_="POST",C=t.maxUploadRetryTime,L=new Wt(T,_,za(t,n),C);return L.urlParams=E,L.headers=o,L.body=f.uploadData(),L.errorHandler=Fr(e),L}class yi{constructor(e,n,r,s){this.current=e,this.total=n,this.finalized=!!r,this.metadata=s||null}}function Wa(t,e){let n=null;try{n=t.getResponseHeader("X-Goog-Upload-Status")}catch{ot(!1)}return ot(!!n&&(e||["active"]).indexOf(n)!==-1),n}function sI(t,e,n,r,s){const i=e.bucketOnlyServerUrl(),o=_f(e,r,s),a={name:o.fullPath},c=bn(i,t.host,t._protocol),u="POST",l={"X-Goog-Upload-Protocol":"resumable","X-Goog-Upload-Command":"start","X-Goog-Upload-Header-Content-Length":`${r.size()}`,"X-Goog-Upload-Header-Content-Type":o.contentType,"Content-Type":"application/json; charset=utf-8"},h=gf(o,n),d=t.maxUploadRetryTime;function f(T){Wa(T);let _;try{_=T.getResponseHeader("X-Goog-Upload-URL")}catch{ot(!1)}return ot(mi(_)),_}const E=new Wt(c,u,f,d);return E.urlParams=a,E.headers=l,E.body=h,E.errorHandler=Fr(e),E}function iI(t,e,n,r){const s={"X-Goog-Upload-Command":"query"};function i(u){const l=Wa(u,["active","final"]);let h=null;try{h=u.getResponseHeader("X-Goog-Upload-Size-Received")}catch{ot(!1)}h||ot(!1);const d=Number(h);return ot(!isNaN(d)),new yi(d,r.size(),l==="final")}const o="POST",a=t.maxUploadRetryTime,c=new Wt(n,o,i,a);return c.headers=s,c.errorHandler=Fr(e),c}const yf=256*1024;function oI(t,e,n,r,s,i,o,a){const c=new yi(0,0);if(o?(c.current=o.current,c.total=o.total):(c.current=0,c.total=r.size()),r.size()!==c.total)throw Ew();const u=c.total-c.current;let l=u;s>0&&(l=Math.min(l,s));const h=c.current,d=h+l;let f="";l===0?f="finalize":u===l?f="upload, finalize":f="upload";const E={"X-Goog-Upload-Command":f,"X-Goog-Upload-Offset":`${c.current}`},T=r.slice(h,d);if(T===null)throw nf();function _(O,_e){const oe=Wa(O,["active","final"]),Me=c.current+l,Rt=r.size();let at;return oe==="final"?at=za(e,i)(O,_e):at=null,new yi(Me,Rt,oe==="final",at)}const C="POST",L=e.maxUploadRetryTime,k=new Wt(n,C,_,L);return k.headers=E,k.body=T.uploadData(),k.progressCallback=a||null,k.errorHandler=Fr(t),k}const ge={RUNNING:"running",PAUSED:"paused",SUCCESS:"success",CANCELED:"canceled",ERROR:"error"};function Ga(t){switch(t){case"running":case"pausing":case"canceling":return ge.RUNNING;case"paused":return ge.PAUSED;case"success":return ge.SUCCESS;case"canceled":return ge.CANCELED;case"error":return ge.ERROR;default:return ge.ERROR}}/**
3482
+ --`+c+"--",f=bt.getBlob(h,r,d);if(f===null)throw _f();const E={name:u.fullPath},T=On(i,n.host,n._protocol),_="POST",C=n.maxUploadRetryTime,L=new Qt(T,_,Ja(n,t),C);return L.urlParams=E,L.headers=o,L.body=f.uploadData(),L.errorHandler=zr(e),L}class wi{constructor(e,t,r,s){this.current=e,this.total=t,this.finalized=!!r,this.metadata=s||null}}function ec(n,e){let t=null;try{t=n.getResponseHeader("X-Goog-Upload-Status")}catch{lt(!1)}return lt(!!t&&(e||["active"]).indexOf(t)!==-1),t}function vI(n,e,t,r,s){const i=e.bucketOnlyServerUrl(),o=Df(e,r,s),a={name:o.fullPath},c=On(i,n.host,n._protocol),u="POST",l={"X-Goog-Upload-Protocol":"resumable","X-Goog-Upload-Command":"start","X-Goog-Upload-Header-Content-Length":`${r.size()}`,"X-Goog-Upload-Header-Content-Type":o.contentType,"Content-Type":"application/json; charset=utf-8"},h=kf(o,t),d=n.maxUploadRetryTime;function f(T){ec(T);let _;try{_=T.getResponseHeader("X-Goog-Upload-URL")}catch{lt(!1)}return lt(vi(_)),_}const E=new Qt(c,u,f,d);return E.urlParams=a,E.headers=l,E.body=h,E.errorHandler=zr(e),E}function EI(n,e,t,r){const s={"X-Goog-Upload-Command":"query"};function i(u){const l=ec(u,["active","final"]);let h=null;try{h=u.getResponseHeader("X-Goog-Upload-Size-Received")}catch{lt(!1)}h||lt(!1);const d=Number(h);return lt(!isNaN(d)),new wi(d,r.size(),l==="final")}const o="POST",a=n.maxUploadRetryTime,c=new Qt(t,o,i,a);return c.headers=s,c.errorHandler=zr(e),c}const Nf=256*1024;function TI(n,e,t,r,s,i,o,a){const c=new wi(0,0);if(o?(c.current=o.current,c.total=o.total):(c.current=0,c.total=r.size()),r.size()!==c.total)throw Lw();const u=c.total-c.current;let l=u;s>0&&(l=Math.min(l,s));const h=c.current,d=h+l;let f="";l===0?f="finalize":u===l?f="upload, finalize":f="upload";const E={"X-Goog-Upload-Command":f,"X-Goog-Upload-Offset":`${c.current}`},T=r.slice(h,d);if(T===null)throw _f();function _(O,ve){const oe=ec(O,["active","final"]),Fe=c.current+l,Ct=r.size();let ht;return oe==="final"?ht=Ja(e,i)(O,ve):ht=null,new wi(Fe,Ct,oe==="final",ht)}const C="POST",L=e.maxUploadRetryTime,k=new Qt(t,C,_,L);return k.headers=E,k.body=T.uploadData(),k.progressCallback=a||null,k.errorHandler=zr(n),k}const ye={RUNNING:"running",PAUSED:"paused",SUCCESS:"success",CANCELED:"canceled",ERROR:"error"};function tc(n){switch(n){case"running":case"pausing":case"canceling":return ye.RUNNING;case"paused":return ye.PAUSED;case"success":return ye.SUCCESS;case"canceled":return ye.CANCELED;case"error":return ye.ERROR;default:return ye.ERROR}}/**
3483
3483
  * @license
3484
3484
  * Copyright 2017 Google LLC
3485
3485
  *
@@ -3494,7 +3494,7 @@ Content-Type: `+u.contentType+`\r
3494
3494
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3495
3495
  * See the License for the specific language governing permissions and
3496
3496
  * limitations under the License.
3497
- */class aI{constructor(e,n,r){if(bw(e)||n!=null||r!=null)this.next=e,this.error=n??void 0,this.complete=r??void 0;else{const i=e;this.next=i.next,this.error=i.error,this.complete=i.complete}}}/**
3497
+ */class wI{constructor(e,t,r){if($w(e)||t!=null||r!=null)this.next=e,this.error=t??void 0,this.complete=r??void 0;else{const i=e;this.next=i.next,this.error=i.error,this.complete=i.complete}}}/**
3498
3498
  * @license
3499
3499
  * Copyright 2017 Google LLC
3500
3500
  *
@@ -3509,7 +3509,7 @@ Content-Type: `+u.contentType+`\r
3509
3509
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3510
3510
  * See the License for the specific language governing permissions and
3511
3511
  * limitations under the License.
3512
- */function Cn(t){return(...e)=>{Promise.resolve().then(()=>t(...e))}}class cI{constructor(){this.sent_=!1,this.xhr_=new XMLHttpRequest,this.initXhr(),this.errorCode_=Ht.NO_ERROR,this.sendPromise_=new Promise(e=>{this.xhr_.addEventListener("abort",()=>{this.errorCode_=Ht.ABORT,e()}),this.xhr_.addEventListener("error",()=>{this.errorCode_=Ht.NETWORK_ERROR,e()}),this.xhr_.addEventListener("load",()=>{e()})})}send(e,n,r,s){if(this.sent_)throw Ur("cannot .send() more than once");if(this.sent_=!0,this.xhr_.open(n,e,!0),s!==void 0)for(const i in s)s.hasOwnProperty(i)&&this.xhr_.setRequestHeader(i,s[i].toString());return r!==void 0?this.xhr_.send(r):this.xhr_.send(),this.sendPromise_}getErrorCode(){if(!this.sent_)throw Ur("cannot .getErrorCode() before sending");return this.errorCode_}getStatus(){if(!this.sent_)throw Ur("cannot .getStatus() before sending");try{return this.xhr_.status}catch{return-1}}getResponse(){if(!this.sent_)throw Ur("cannot .getResponse() before sending");return this.xhr_.response}getErrorText(){if(!this.sent_)throw Ur("cannot .getErrorText() before sending");return this.xhr_.statusText}abort(){this.xhr_.abort()}getResponseHeader(e){return this.xhr_.getResponseHeader(e)}addUploadProgressListener(e){this.xhr_.upload!=null&&this.xhr_.upload.addEventListener("progress",e)}removeUploadProgressListener(e){this.xhr_.upload!=null&&this.xhr_.upload.removeEventListener("progress",e)}}class uI extends cI{initXhr(){this.xhr_.responseType="text"}}function Gt(){return new uI}/**
3512
+ */function Vn(n){return(...e)=>{Promise.resolve().then(()=>n(...e))}}class II{constructor(){this.sent_=!1,this.xhr_=new XMLHttpRequest,this.initXhr(),this.errorCode_=Kt.NO_ERROR,this.sendPromise_=new Promise(e=>{this.xhr_.addEventListener("abort",()=>{this.errorCode_=Kt.ABORT,e()}),this.xhr_.addEventListener("error",()=>{this.errorCode_=Kt.NETWORK_ERROR,e()}),this.xhr_.addEventListener("load",()=>{e()})})}send(e,t,r,s){if(this.sent_)throw $r("cannot .send() more than once");if(this.sent_=!0,this.xhr_.open(t,e,!0),s!==void 0)for(const i in s)s.hasOwnProperty(i)&&this.xhr_.setRequestHeader(i,s[i].toString());return r!==void 0?this.xhr_.send(r):this.xhr_.send(),this.sendPromise_}getErrorCode(){if(!this.sent_)throw $r("cannot .getErrorCode() before sending");return this.errorCode_}getStatus(){if(!this.sent_)throw $r("cannot .getStatus() before sending");try{return this.xhr_.status}catch{return-1}}getResponse(){if(!this.sent_)throw $r("cannot .getResponse() before sending");return this.xhr_.response}getErrorText(){if(!this.sent_)throw $r("cannot .getErrorText() before sending");return this.xhr_.statusText}abort(){this.xhr_.abort()}getResponseHeader(e){return this.xhr_.getResponseHeader(e)}addUploadProgressListener(e){this.xhr_.upload!=null&&this.xhr_.upload.addEventListener("progress",e)}removeUploadProgressListener(e){this.xhr_.upload!=null&&this.xhr_.upload.removeEventListener("progress",e)}}class AI extends II{initXhr(){this.xhr_.responseType="text"}}function Yt(){return new AI}/**
3513
3513
  * @license
3514
3514
  * Copyright 2017 Google LLC
3515
3515
  *
@@ -3524,7 +3524,7 @@ Content-Type: `+u.contentType+`\r
3524
3524
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3525
3525
  * See the License for the specific language governing permissions and
3526
3526
  * limitations under the License.
3527
- */class lI{constructor(e,n,r=null){this._transferred=0,this._needToFetchStatus=!1,this._needToFetchMetadata=!1,this._observers=[],this._error=void 0,this._uploadUrl=void 0,this._request=void 0,this._chunkMultiplier=1,this._resolve=void 0,this._reject=void 0,this._ref=e,this._blob=n,this._metadata=r,this._mappings=pf(),this._resumable=this._shouldDoResumable(this._blob),this._state="running",this._errorHandler=s=>{if(this._request=void 0,this._chunkMultiplier=1,s._codeEquals($.CANCELED))this._needToFetchStatus=!0,this.completeTransitions_();else{const i=this.isExponentialBackoffExpired();if(cf(s.status,[]))if(i)s=ef();else{this.sleepTime=Math.max(this.sleepTime*2,hw),this._needToFetchStatus=!0,this.completeTransitions_();return}this._error=s,this._transition("error")}},this._metadataErrorHandler=s=>{this._request=void 0,s._codeEquals($.CANCELED)?this.completeTransitions_():(this._error=s,this._transition("error"))},this.sleepTime=0,this.maxSleepTime=this._ref.storage.maxUploadRetryTime,this._promise=new Promise((s,i)=>{this._resolve=s,this._reject=i,this._start()}),this._promise.then(null,()=>{})}isExponentialBackoffExpired(){return this.sleepTime>this.maxSleepTime}_makeProgressCallback(){const e=this._transferred;return n=>this._updateProgress(e+n)}_shouldDoResumable(e){return e.size()>256*1024}_start(){this._state==="running"&&this._request===void 0&&(this._resumable?this._uploadUrl===void 0?this._createResumable():this._needToFetchStatus?this._fetchStatus():this._needToFetchMetadata?this._fetchMetadata():this.pendingTimeout=setTimeout(()=>{this.pendingTimeout=void 0,this._continueUpload()},this.sleepTime):this._oneShotUpload())}_resolveToken(e){Promise.all([this._ref.storage._getAuthToken(),this._ref.storage._getAppCheckToken()]).then(([n,r])=>{switch(this._state){case"running":e(n,r);break;case"canceling":this._transition("canceled");break;case"pausing":this._transition("paused");break}})}_createResumable(){this._resolveToken((e,n)=>{const r=sI(this._ref.storage,this._ref._location,this._mappings,this._blob,this._metadata),s=this._ref.storage._makeRequest(r,Gt,e,n);this._request=s,s.getPromise().then(i=>{this._request=void 0,this._uploadUrl=i,this._needToFetchStatus=!1,this.completeTransitions_()},this._errorHandler)})}_fetchStatus(){const e=this._uploadUrl;this._resolveToken((n,r)=>{const s=iI(this._ref.storage,this._ref._location,e,this._blob),i=this._ref.storage._makeRequest(s,Gt,n,r);this._request=i,i.getPromise().then(o=>{o=o,this._request=void 0,this._updateProgress(o.current),this._needToFetchStatus=!1,o.finalized&&(this._needToFetchMetadata=!0),this.completeTransitions_()},this._errorHandler)})}_continueUpload(){const e=yf*this._chunkMultiplier,n=new yi(this._transferred,this._blob.size()),r=this._uploadUrl;this._resolveToken((s,i)=>{let o;try{o=oI(this._ref._location,this._ref.storage,r,this._blob,e,this._mappings,n,this._makeProgressCallback())}catch(c){this._error=c,this._transition("error");return}const a=this._ref.storage._makeRequest(o,Gt,s,i,!1);this._request=a,a.getPromise().then(c=>{this._increaseMultiplier(),this._request=void 0,this._updateProgress(c.current),c.finalized?(this._metadata=c.metadata,this._transition("success")):this.completeTransitions_()},this._errorHandler)})}_increaseMultiplier(){yf*this._chunkMultiplier*2<32*1024*1024&&(this._chunkMultiplier*=2)}_fetchMetadata(){this._resolveToken((e,n)=>{const r=Zw(this._ref.storage,this._ref._location,this._mappings),s=this._ref.storage._makeRequest(r,Gt,e,n);this._request=s,s.getPromise().then(i=>{this._request=void 0,this._metadata=i,this._transition("success")},this._metadataErrorHandler)})}_oneShotUpload(){this._resolveToken((e,n)=>{const r=rI(this._ref.storage,this._ref._location,this._mappings,this._blob,this._metadata),s=this._ref.storage._makeRequest(r,Gt,e,n);this._request=s,s.getPromise().then(i=>{this._request=void 0,this._metadata=i,this._updateProgress(this._blob.size()),this._transition("success")},this._errorHandler)})}_updateProgress(e){const n=this._transferred;this._transferred=e,this._transferred!==n&&this._notifyObservers()}_transition(e){if(this._state!==e)switch(e){case"canceling":case"pausing":this._state=e,this._request!==void 0?this._request.cancel():this.pendingTimeout&&(clearTimeout(this.pendingTimeout),this.pendingTimeout=void 0,this.completeTransitions_());break;case"running":const n=this._state==="paused";this._state=e,n&&(this._notifyObservers(),this._start());break;case"paused":this._state=e,this._notifyObservers();break;case"canceled":this._error=tf(),this._state=e,this._notifyObservers();break;case"error":this._state=e,this._notifyObservers();break;case"success":this._state=e,this._notifyObservers();break}}completeTransitions_(){switch(this._state){case"pausing":this._transition("paused");break;case"canceling":this._transition("canceled");break;case"running":this._start();break}}get snapshot(){const e=Ga(this._state);return{bytesTransferred:this._transferred,totalBytes:this._blob.size(),state:e,metadata:this._metadata,task:this,ref:this._ref}}on(e,n,r,s){const i=new aI(n||void 0,r||void 0,s||void 0);return this._addObserver(i),()=>{this._removeObserver(i)}}then(e,n){return this._promise.then(e,n)}catch(e){return this.then(null,e)}_addObserver(e){this._observers.push(e),this._notifyObserver(e)}_removeObserver(e){const n=this._observers.indexOf(e);n!==-1&&this._observers.splice(n,1)}_notifyObservers(){this._finishPromise(),this._observers.slice().forEach(n=>{this._notifyObserver(n)})}_finishPromise(){if(this._resolve!==void 0){let e=!0;switch(Ga(this._state)){case ge.SUCCESS:Cn(this._resolve.bind(null,this.snapshot))();break;case ge.CANCELED:case ge.ERROR:const n=this._reject;Cn(n.bind(null,this._error))();break;default:e=!1;break}e&&(this._resolve=void 0,this._reject=void 0)}}_notifyObserver(e){switch(Ga(this._state)){case ge.RUNNING:case ge.PAUSED:e.next&&Cn(e.next.bind(e,this.snapshot))();break;case ge.SUCCESS:e.complete&&Cn(e.complete.bind(e))();break;case ge.CANCELED:case ge.ERROR:e.error&&Cn(e.error.bind(e,this._error))();break;default:e.error&&Cn(e.error.bind(e,this._error))()}}resume(){const e=this._state==="paused"||this._state==="pausing";return e&&this._transition("running"),e}pause(){const e=this._state==="running";return e&&this._transition("pausing"),e}cancel(){const e=this._state==="running"||this._state==="pausing";return e&&this._transition("canceling"),e}}/**
3527
+ */class RI{constructor(e,t,r=null){this._transferred=0,this._needToFetchStatus=!1,this._needToFetchMetadata=!1,this._observers=[],this._error=void 0,this._uploadUrl=void 0,this._request=void 0,this._chunkMultiplier=1,this._resolve=void 0,this._reject=void 0,this._ref=e,this._blob=t,this._metadata=r,this._mappings=bf(),this._resumable=this._shouldDoResumable(this._blob),this._state="running",this._errorHandler=s=>{if(this._request=void 0,this._chunkMultiplier=1,s._codeEquals(q.CANCELED))this._needToFetchStatus=!0,this.completeTransitions_();else{const i=this.isExponentialBackoffExpired();if(wf(s.status,[]))if(i)s=mf();else{this.sleepTime=Math.max(this.sleepTime*2,Pw),this._needToFetchStatus=!0,this.completeTransitions_();return}this._error=s,this._transition("error")}},this._metadataErrorHandler=s=>{this._request=void 0,s._codeEquals(q.CANCELED)?this.completeTransitions_():(this._error=s,this._transition("error"))},this.sleepTime=0,this.maxSleepTime=this._ref.storage.maxUploadRetryTime,this._promise=new Promise((s,i)=>{this._resolve=s,this._reject=i,this._start()}),this._promise.then(null,()=>{})}isExponentialBackoffExpired(){return this.sleepTime>this.maxSleepTime}_makeProgressCallback(){const e=this._transferred;return t=>this._updateProgress(e+t)}_shouldDoResumable(e){return e.size()>256*1024}_start(){this._state==="running"&&this._request===void 0&&(this._resumable?this._uploadUrl===void 0?this._createResumable():this._needToFetchStatus?this._fetchStatus():this._needToFetchMetadata?this._fetchMetadata():this.pendingTimeout=setTimeout(()=>{this.pendingTimeout=void 0,this._continueUpload()},this.sleepTime):this._oneShotUpload())}_resolveToken(e){Promise.all([this._ref.storage._getAuthToken(),this._ref.storage._getAppCheckToken()]).then(([t,r])=>{switch(this._state){case"running":e(t,r);break;case"canceling":this._transition("canceled");break;case"pausing":this._transition("paused");break}})}_createResumable(){this._resolveToken((e,t)=>{const r=vI(this._ref.storage,this._ref._location,this._mappings,this._blob,this._metadata),s=this._ref.storage._makeRequest(r,Yt,e,t);this._request=s,s.getPromise().then(i=>{this._request=void 0,this._uploadUrl=i,this._needToFetchStatus=!1,this.completeTransitions_()},this._errorHandler)})}_fetchStatus(){const e=this._uploadUrl;this._resolveToken((t,r)=>{const s=EI(this._ref.storage,this._ref._location,e,this._blob),i=this._ref.storage._makeRequest(s,Yt,t,r);this._request=i,i.getPromise().then(o=>{o=o,this._request=void 0,this._updateProgress(o.current),this._needToFetchStatus=!1,o.finalized&&(this._needToFetchMetadata=!0),this.completeTransitions_()},this._errorHandler)})}_continueUpload(){const e=Nf*this._chunkMultiplier,t=new wi(this._transferred,this._blob.size()),r=this._uploadUrl;this._resolveToken((s,i)=>{let o;try{o=TI(this._ref._location,this._ref.storage,r,this._blob,e,this._mappings,t,this._makeProgressCallback())}catch(c){this._error=c,this._transition("error");return}const a=this._ref.storage._makeRequest(o,Yt,s,i,!1);this._request=a,a.getPromise().then(c=>{this._increaseMultiplier(),this._request=void 0,this._updateProgress(c.current),c.finalized?(this._metadata=c.metadata,this._transition("success")):this.completeTransitions_()},this._errorHandler)})}_increaseMultiplier(){Nf*this._chunkMultiplier*2<32*1024*1024&&(this._chunkMultiplier*=2)}_fetchMetadata(){this._resolveToken((e,t)=>{const r=pI(this._ref.storage,this._ref._location,this._mappings),s=this._ref.storage._makeRequest(r,Yt,e,t);this._request=s,s.getPromise().then(i=>{this._request=void 0,this._metadata=i,this._transition("success")},this._metadataErrorHandler)})}_oneShotUpload(){this._resolveToken((e,t)=>{const r=yI(this._ref.storage,this._ref._location,this._mappings,this._blob,this._metadata),s=this._ref.storage._makeRequest(r,Yt,e,t);this._request=s,s.getPromise().then(i=>{this._request=void 0,this._metadata=i,this._updateProgress(this._blob.size()),this._transition("success")},this._errorHandler)})}_updateProgress(e){const t=this._transferred;this._transferred=e,this._transferred!==t&&this._notifyObservers()}_transition(e){if(this._state!==e)switch(e){case"canceling":case"pausing":this._state=e,this._request!==void 0?this._request.cancel():this.pendingTimeout&&(clearTimeout(this.pendingTimeout),this.pendingTimeout=void 0,this.completeTransitions_());break;case"running":const t=this._state==="paused";this._state=e,t&&(this._notifyObservers(),this._start());break;case"paused":this._state=e,this._notifyObservers();break;case"canceled":this._error=gf(),this._state=e,this._notifyObservers();break;case"error":this._state=e,this._notifyObservers();break;case"success":this._state=e,this._notifyObservers();break}}completeTransitions_(){switch(this._state){case"pausing":this._transition("paused");break;case"canceling":this._transition("canceled");break;case"running":this._start();break}}get snapshot(){const e=tc(this._state);return{bytesTransferred:this._transferred,totalBytes:this._blob.size(),state:e,metadata:this._metadata,task:this,ref:this._ref}}on(e,t,r,s){const i=new wI(t||void 0,r||void 0,s||void 0);return this._addObserver(i),()=>{this._removeObserver(i)}}then(e,t){return this._promise.then(e,t)}catch(e){return this.then(null,e)}_addObserver(e){this._observers.push(e),this._notifyObserver(e)}_removeObserver(e){const t=this._observers.indexOf(e);t!==-1&&this._observers.splice(t,1)}_notifyObservers(){this._finishPromise(),this._observers.slice().forEach(t=>{this._notifyObserver(t)})}_finishPromise(){if(this._resolve!==void 0){let e=!0;switch(tc(this._state)){case ye.SUCCESS:Vn(this._resolve.bind(null,this.snapshot))();break;case ye.CANCELED:case ye.ERROR:const t=this._reject;Vn(t.bind(null,this._error))();break;default:e=!1;break}e&&(this._resolve=void 0,this._reject=void 0)}}_notifyObserver(e){switch(tc(this._state)){case ye.RUNNING:case ye.PAUSED:e.next&&Vn(e.next.bind(e,this.snapshot))();break;case ye.SUCCESS:e.complete&&Vn(e.complete.bind(e))();break;case ye.CANCELED:case ye.ERROR:e.error&&Vn(e.error.bind(e,this._error))();break;default:e.error&&Vn(e.error.bind(e,this._error))()}}resume(){const e=this._state==="paused"||this._state==="pausing";return e&&this._transition("running"),e}pause(){const e=this._state==="running";return e&&this._transition("pausing"),e}cancel(){const e=this._state==="running"||this._state==="pausing";return e&&this._transition("canceling"),e}}/**
3528
3528
  * @license
3529
3529
  * Copyright 2019 Google LLC
3530
3530
  *
@@ -3539,7 +3539,7 @@ Content-Type: `+u.contentType+`\r
3539
3539
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3540
3540
  * See the License for the specific language governing permissions and
3541
3541
  * limitations under the License.
3542
- */class Kt{constructor(e,n){this._service=e,n instanceof Ie?this._location=n:this._location=Ie.makeFromUrl(n,e.host)}toString(){return"gs://"+this._location.bucket+"/"+this._location.path}_newRef(e,n){return new Kt(e,n)}get root(){const e=new Ie(this._location.bucket,"");return this._newRef(this._service,e)}get bucket(){return this._location.bucket}get fullPath(){return this._location.path}get name(){return ff(this._location.path)}get storage(){return this._service}get parent(){const e=Hw(this._location.path);if(e===null)return null;const n=new Ie(this._location.bucket,e);return new Kt(this._service,n)}_throwIfRoot(e){if(this._location.path==="")throw Iw(e)}}function hI(t,e,n){return t._throwIfRoot("uploadBytesResumable"),new lI(t,new At(e),n)}function dI(t){t._throwIfRoot("getDownloadURL");const e=eI(t.storage,t._location,pf());return t.storage.makeRequestWithTokens(e,Gt).then(n=>{if(n===null)throw Tw();return n})}function fI(t){t._throwIfRoot("deleteObject");const e=tI(t.storage,t._location);return t.storage.makeRequestWithTokens(e,Gt)}function pI(t,e){const n=Ww(t._location.path,e),r=new Ie(t._location.bucket,n);return new Kt(t.storage,r)}/**
3542
+ */class Xt{constructor(e,t){this._service=e,t instanceof Re?this._location=t:this._location=Re.makeFromUrl(t,e.host)}toString(){return"gs://"+this._location.bucket+"/"+this._location.path}_newRef(e,t){return new Xt(e,t)}get root(){const e=new Re(this._location.bucket,"");return this._newRef(this._service,e)}get bucket(){return this._location.bucket}get fullPath(){return this._location.path}get name(){return Sf(this._location.path)}get storage(){return this._service}get parent(){const e=oI(this._location.path);if(e===null)return null;const t=new Re(this._location.bucket,e);return new Xt(this._service,t)}_throwIfRoot(e){if(this._location.path==="")throw Uw(e)}}function PI(n,e,t){return n._throwIfRoot("uploadBytesResumable"),new RI(n,new bt(e),t)}function SI(n){n._throwIfRoot("getDownloadURL");const e=mI(n.storage,n._location,bf());return n.storage.makeRequestWithTokens(e,Yt).then(t=>{if(t===null)throw Mw();return t})}function bI(n){n._throwIfRoot("deleteObject");const e=gI(n.storage,n._location);return n.storage.makeRequestWithTokens(e,Yt)}function CI(n,e){const t=aI(n._location.path,e),r=new Re(n._location.bucket,t);return new Xt(n.storage,r)}/**
3543
3543
  * @license
3544
3544
  * Copyright 2017 Google LLC
3545
3545
  *
@@ -3554,7 +3554,7 @@ Content-Type: `+u.contentType+`\r
3554
3554
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3555
3555
  * See the License for the specific language governing permissions and
3556
3556
  * limitations under the License.
3557
- */function mI(t){return/^[A-Za-z]+:\/\//.test(t)}function gI(t,e){return new Kt(t,e)}function vf(t,e){if(t instanceof Ka){const n=t;if(n._bucket==null)throw vw();const r=new Kt(n,n._bucket);return e!=null?vf(r,e):r}else return e!==void 0?pI(t,e):t}function _I(t,e){if(e&&mI(e)){if(t instanceof Ka)return gI(t,e);throw ja("To use ref(service, url), the first argument must be a Storage instance.")}else return vf(t,e)}function Ef(t,e){const n=e==null?void 0:e[Zd];return n==null?null:Ie.makeFromBucketSpec(n,t)}function yI(t,e,n,r={}){t.host=`${e}:${n}`,t._protocol="http";const{mockUserToken:s}=r;s&&(t._overrideAuthToken=typeof s=="string"?s:ic(s,t.app.options.projectId))}class Ka{constructor(e,n,r,s,i){this.app=e,this._authProvider=n,this._appCheckProvider=r,this._url=s,this._firebaseVersion=i,this._bucket=null,this._host=Jd,this._protocol="https",this._appId=null,this._deleted=!1,this._maxOperationRetryTime=uw,this._maxUploadRetryTime=lw,this._requests=new Set,s!=null?this._bucket=Ie.makeFromBucketSpec(s,this._host):this._bucket=Ef(this._host,this.app.options)}get host(){return this._host}set host(e){this._host=e,this._url!=null?this._bucket=Ie.makeFromBucketSpec(this._url,e):this._bucket=Ef(e,this.app.options)}get maxUploadRetryTime(){return this._maxUploadRetryTime}set maxUploadRetryTime(e){of("time",0,Number.POSITIVE_INFINITY,e),this._maxUploadRetryTime=e}get maxOperationRetryTime(){return this._maxOperationRetryTime}set maxOperationRetryTime(e){of("time",0,Number.POSITIVE_INFINITY,e),this._maxOperationRetryTime=e}async _getAuthToken(){if(this._overrideAuthToken)return this._overrideAuthToken;const e=this._authProvider.getImmediate({optional:!0});if(e){const n=await e.getToken();if(n!==null)return n.accessToken}return null}async _getAppCheckToken(){const e=this._appCheckProvider.getImmediate({optional:!0});return e?(await e.getToken()).token:null}_delete(){return this._deleted||(this._deleted=!0,this._requests.forEach(e=>e.cancel()),this._requests.clear()),Promise.resolve()}_makeStorageReference(e){return new Kt(this,e)}_makeRequest(e,n,r,s,i=!0){if(this._deleted)return new Aw(rf());{const o=Lw(e,this._appId,r,s,n,this._firebaseVersion,i);return this._requests.add(o),o.getPromise().then(()=>this._requests.delete(o),()=>this._requests.delete(o)),o}}async makeRequestWithTokens(e,n){const[r,s]=await Promise.all([this._getAuthToken(),this._getAppCheckToken()]);return this._makeRequest(e,n,r,s).getPromise()}}const Tf="@firebase/storage",wf="0.12.1";/**
3557
+ */function kI(n){return/^[A-Za-z]+:\/\//.test(n)}function DI(n,e){return new Xt(n,e)}function Of(n,e){if(n instanceof nc){const t=n;if(t._bucket==null)throw Vw();const r=new Xt(t,t._bucket);return e!=null?Of(r,e):r}else return e!==void 0?CI(n,e):n}function NI(n,e){if(e&&kI(e)){if(n instanceof nc)return DI(n,e);throw Qa("To use ref(service, url), the first argument must be a Storage instance.")}else return Of(n,e)}function Vf(n,e){const t=e==null?void 0:e[pf];return t==null?null:Re.makeFromBucketSpec(t,n)}function OI(n,e,t,r={}){n.host=`${e}:${t}`,n._protocol="http";const{mockUserToken:s}=r;s&&(n._overrideAuthToken=typeof s=="string"?s:fc(s,n.app.options.projectId))}class nc{constructor(e,t,r,s,i){this.app=e,this._authProvider=t,this._appCheckProvider=r,this._url=s,this._firebaseVersion=i,this._bucket=null,this._host=ff,this._protocol="https",this._appId=null,this._deleted=!1,this._maxOperationRetryTime=Aw,this._maxUploadRetryTime=Rw,this._requests=new Set,s!=null?this._bucket=Re.makeFromBucketSpec(s,this._host):this._bucket=Vf(this._host,this.app.options)}get host(){return this._host}set host(e){this._host=e,this._url!=null?this._bucket=Re.makeFromBucketSpec(this._url,e):this._bucket=Vf(e,this.app.options)}get maxUploadRetryTime(){return this._maxUploadRetryTime}set maxUploadRetryTime(e){Ef("time",0,Number.POSITIVE_INFINITY,e),this._maxUploadRetryTime=e}get maxOperationRetryTime(){return this._maxOperationRetryTime}set maxOperationRetryTime(e){Ef("time",0,Number.POSITIVE_INFINITY,e),this._maxOperationRetryTime=e}async _getAuthToken(){if(this._overrideAuthToken)return this._overrideAuthToken;const e=this._authProvider.getImmediate({optional:!0});if(e){const t=await e.getToken();if(t!==null)return t.accessToken}return null}async _getAppCheckToken(){const e=this._appCheckProvider.getImmediate({optional:!0});return e?(await e.getToken()).token:null}_delete(){return this._deleted||(this._deleted=!0,this._requests.forEach(e=>e.cancel()),this._requests.clear()),Promise.resolve()}_makeStorageReference(e){return new Xt(this,e)}_makeRequest(e,t,r,s,i=!0){if(this._deleted)return new Fw(yf());{const o=Yw(e,this._appId,r,s,t,this._firebaseVersion,i);return this._requests.add(o),o.getPromise().then(()=>this._requests.delete(o),()=>this._requests.delete(o)),o}}async makeRequestWithTokens(e,t){const[r,s]=await Promise.all([this._getAuthToken(),this._getAppCheckToken()]);return this._makeRequest(e,t,r,s).getPromise()}}const Lf="@firebase/storage",Mf="0.12.4";/**
3558
3558
  * @license
3559
3559
  * Copyright 2020 Google LLC
3560
3560
  *
@@ -3569,7 +3569,7 @@ Content-Type: `+u.contentType+`\r
3569
3569
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3570
3570
  * See the License for the specific language governing permissions and
3571
3571
  * limitations under the License.
3572
- */const If="storage";function vI(t,e,n){return t=x(t),hI(t,e,n)}function EI(t){return t=x(t),dI(t)}function TI(t){return t=x(t),fI(t)}function Qa(t,e){return t=x(t),_I(t,e)}function wI(t=zr(),e){t=x(t);const r=Mn(t,If).getImmediate({identifier:e}),s=Ti("storage");return s&&Af(r,...s),r}function Af(t,e,n,r={}){yI(t,e,n,r)}function II(t,{instanceIdentifier:e}){const n=t.getProvider("app").getImmediate(),r=t.getProvider("auth-internal"),s=t.getProvider("app-check-internal");return new Ka(n,r,s,e,bt)}function AI(){ut(new Ye(If,II,"PUBLIC").setMultipleInstances(!0)),Ae(Tf,wf,""),Ae(Tf,wf,"esm2017")}AI();/**
3572
+ */const xf="storage";function VI(n,e,t){return n=x(n),PI(n,e,t)}function LI(n){return n=x(n),SI(n)}function MI(n){return n=x(n),bI(n)}function rc(n,e){return n=x(n),NI(n,e)}function xI(n=Qr(),e){n=x(n);const r=qn(n,xf).getImmediate({identifier:e}),s=Ri("storage");return s&&Uf(r,...s),r}function Uf(n,e,t,r={}){OI(n,e,t,r)}function UI(n,{instanceIdentifier:e}){const t=n.getProvider("app").getImmediate(),r=n.getProvider("auth-internal"),s=n.getProvider("app-check-internal");return new nc(t,r,s,e,Nt)}function FI(){ft(new Ze(xf,UI,"PUBLIC").setMultipleInstances(!0)),Se(Lf,Mf,""),Se(Lf,Mf,"esm2017")}FI();/**
3573
3573
  * @license
3574
3574
  * Copyright 2017 Google LLC
3575
3575
  *
@@ -3584,7 +3584,7 @@ Content-Type: `+u.contentType+`\r
3584
3584
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3585
3585
  * See the License for the specific language governing permissions and
3586
3586
  * limitations under the License.
3587
- */const RI="type.googleapis.com/google.protobuf.Int64Value",PI="type.googleapis.com/google.protobuf.UInt64Value";function Rf(t,e){const n={};for(const r in t)t.hasOwnProperty(r)&&(n[r]=e(t[r]));return n}function Ya(t){if(t==null)return null;if(t instanceof Number&&(t=t.valueOf()),typeof t=="number"&&isFinite(t)||t===!0||t===!1||Object.prototype.toString.call(t)==="[object String]")return t;if(t instanceof Date)return t.toISOString();if(Array.isArray(t))return t.map(e=>Ya(e));if(typeof t=="function"||typeof t=="object")return Rf(t,e=>Ya(e));throw new Error("Data cannot be encoded in JSON: "+t)}function vi(t){if(t==null)return t;if(t["@type"])switch(t["@type"]){case RI:case PI:{const e=Number(t.value);if(isNaN(e))throw new Error("Data cannot be decoded from JSON: "+t);return e}default:throw new Error("Data cannot be decoded from JSON: "+t)}return Array.isArray(t)?t.map(e=>vi(e)):typeof t=="function"||typeof t=="object"?Rf(t,e=>vi(e)):t}/**
3587
+ */const BI="type.googleapis.com/google.protobuf.Int64Value",jI="type.googleapis.com/google.protobuf.UInt64Value";function Ff(n,e){const t={};for(const r in n)n.hasOwnProperty(r)&&(t[r]=e(n[r]));return t}function sc(n){if(n==null)return null;if(n instanceof Number&&(n=n.valueOf()),typeof n=="number"&&isFinite(n)||n===!0||n===!1||Object.prototype.toString.call(n)==="[object String]")return n;if(n instanceof Date)return n.toISOString();if(Array.isArray(n))return n.map(e=>sc(e));if(typeof n=="function"||typeof n=="object")return Ff(n,e=>sc(e));throw new Error("Data cannot be encoded in JSON: "+n)}function Ii(n){if(n==null)return n;if(n["@type"])switch(n["@type"]){case BI:case jI:{const e=Number(n.value);if(isNaN(e))throw new Error("Data cannot be decoded from JSON: "+n);return e}default:throw new Error("Data cannot be decoded from JSON: "+n)}return Array.isArray(n)?n.map(e=>Ii(e)):typeof n=="function"||typeof n=="object"?Ff(n,e=>Ii(e)):n}/**
3588
3588
  * @license
3589
3589
  * Copyright 2020 Google LLC
3590
3590
  *
@@ -3599,7 +3599,7 @@ Content-Type: `+u.contentType+`\r
3599
3599
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3600
3600
  * See the License for the specific language governing permissions and
3601
3601
  * limitations under the License.
3602
- */const Xa="functions";/**
3602
+ */const ic="functions";/**
3603
3603
  * @license
3604
3604
  * Copyright 2017 Google LLC
3605
3605
  *
@@ -3614,7 +3614,7 @@ Content-Type: `+u.contentType+`\r
3614
3614
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3615
3615
  * See the License for the specific language governing permissions and
3616
3616
  * limitations under the License.
3617
- */const Pf={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 kn extends Ce{constructor(e,n,r){super(`${Xa}/${e}`,n||""),this.details=r}}function SI(t){if(t>=200&&t<300)return"ok";switch(t){case 0:return"internal";case 400:return"invalid-argument";case 401:return"unauthenticated";case 403:return"permission-denied";case 404:return"not-found";case 409:return"aborted";case 429:return"resource-exhausted";case 499:return"cancelled";case 500:return"internal";case 501:return"unimplemented";case 503:return"unavailable";case 504:return"deadline-exceeded"}return"unknown"}function bI(t,e){let n=SI(t),r=n,s;try{const i=e&&e.error;if(i){const o=i.status;if(typeof o=="string"){if(!Pf[o])return new kn("internal","internal");n=Pf[o],r=o}const a=i.message;typeof a=="string"&&(r=a),s=i.details,s!==void 0&&(s=vi(s))}}catch{}return n==="ok"?null:new kn(n,r,s)}/**
3617
+ */const Bf={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 Ln extends De{constructor(e,t,r){super(`${ic}/${e}`,t||""),this.details=r}}function qI(n){if(n>=200&&n<300)return"ok";switch(n){case 0:return"internal";case 400:return"invalid-argument";case 401:return"unauthenticated";case 403:return"permission-denied";case 404:return"not-found";case 409:return"aborted";case 429:return"resource-exhausted";case 499:return"cancelled";case 500:return"internal";case 501:return"unimplemented";case 503:return"unavailable";case 504:return"deadline-exceeded"}return"unknown"}function $I(n,e){let t=qI(n),r=t,s;try{const i=e&&e.error;if(i){const o=i.status;if(typeof o=="string"){if(!Bf[o])return new Ln("internal","internal");t=Bf[o],r=o}const a=i.message;typeof a=="string"&&(r=a),s=i.details,s!==void 0&&(s=Ii(s))}}catch{}return t==="ok"?null:new Ln(t,r,s)}/**
3618
3618
  * @license
3619
3619
  * Copyright 2017 Google LLC
3620
3620
  *
@@ -3629,7 +3629,7 @@ Content-Type: `+u.contentType+`\r
3629
3629
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3630
3630
  * See the License for the specific language governing permissions and
3631
3631
  * limitations under the License.
3632
- */class CI{constructor(e,n,r){this.auth=null,this.messaging=null,this.appCheck=null,this.auth=e.getImmediate({optional:!0}),this.messaging=n.getImmediate({optional:!0}),this.auth||e.get().then(s=>this.auth=s,()=>{}),this.messaging||n.get().then(s=>this.messaging=s,()=>{}),this.appCheck||r.get().then(s=>this.appCheck=s,()=>{})}async getAuthToken(){if(this.auth)try{const e=await this.auth.getToken();return e==null?void 0:e.accessToken}catch{return}}async getMessagingToken(){if(!(!this.messaging||!("Notification"in self)||Notification.permission!=="granted"))try{return await this.messaging.getToken()}catch{return}}async getAppCheckToken(e){if(this.appCheck){const n=e?await this.appCheck.getLimitedUseToken():await this.appCheck.getToken();return n.error?null:n.token}return null}async getContext(e){const n=await this.getAuthToken(),r=await this.getMessagingToken(),s=await this.getAppCheckToken(e);return{authToken:n,messagingToken:r,appCheckToken:s}}}/**
3632
+ */class zI{constructor(e,t,r){this.auth=null,this.messaging=null,this.appCheck=null,this.auth=e.getImmediate({optional:!0}),this.messaging=t.getImmediate({optional:!0}),this.auth||e.get().then(s=>this.auth=s,()=>{}),this.messaging||t.get().then(s=>this.messaging=s,()=>{}),this.appCheck||r.get().then(s=>this.appCheck=s,()=>{})}async getAuthToken(){if(this.auth)try{const e=await this.auth.getToken();return e==null?void 0:e.accessToken}catch{return}}async getMessagingToken(){if(!(!this.messaging||!("Notification"in self)||Notification.permission!=="granted"))try{return await this.messaging.getToken()}catch{return}}async getAppCheckToken(e){if(this.appCheck){const t=e?await this.appCheck.getLimitedUseToken():await this.appCheck.getToken();return t.error?null:t.token}return null}async getContext(e){const t=await this.getAuthToken(),r=await this.getMessagingToken(),s=await this.getAppCheckToken(e);return{authToken:t,messagingToken:r,appCheckToken:s}}}/**
3633
3633
  * @license
3634
3634
  * Copyright 2017 Google LLC
3635
3635
  *
@@ -3644,7 +3644,7 @@ Content-Type: `+u.contentType+`\r
3644
3644
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3645
3645
  * See the License for the specific language governing permissions and
3646
3646
  * limitations under the License.
3647
- */const Ja="us-central1";function kI(t){let e=null;return{promise:new Promise((n,r)=>{e=setTimeout(()=>{r(new kn("deadline-exceeded","deadline-exceeded"))},t)}),cancel:()=>{e&&clearTimeout(e)}}}class DI{constructor(e,n,r,s,i=Ja,o){this.app=e,this.fetchImpl=o,this.emulatorOrigin=null,this.contextProvider=new CI(n,r,s),this.cancelAllRequests=new Promise(a=>{this.deleteService=()=>Promise.resolve(a())});try{const a=new URL(i);this.customDomain=a.origin,this.region=Ja}catch{this.customDomain=null,this.region=i}}_delete(){return this.deleteService()}_url(e){const n=this.app.options.projectId;return this.emulatorOrigin!==null?`${this.emulatorOrigin}/${n}/${this.region}/${e}`:this.customDomain!==null?`${this.customDomain}/${e}`:`https://${this.region}-${n}.cloudfunctions.net/${e}`}}function NI(t,e,n){t.emulatorOrigin=`http://${e}:${n}`}function OI(t,e,n){return r=>LI(t,e,r,n||{})}async function VI(t,e,n,r){n["Content-Type"]="application/json";let s;try{s=await r(t,{method:"POST",body:JSON.stringify(e),headers:n})}catch{return{status:0,json:null}}let i=null;try{i=await s.json()}catch{}return{status:s.status,json:i}}function LI(t,e,n,r){const s=t._url(e);return MI(t,s,n,r)}async function MI(t,e,n,r){n=Ya(n);const s={data:n},i={},o=await t.contextProvider.getContext(r.limitedUseAppCheckTokens);o.authToken&&(i.Authorization="Bearer "+o.authToken),o.messagingToken&&(i["Firebase-Instance-ID-Token"]=o.messagingToken),o.appCheckToken!==null&&(i["X-Firebase-AppCheck"]=o.appCheckToken);const a=r.timeout||7e4,c=kI(a),u=await Promise.race([VI(e,s,i,t.fetchImpl),c.promise,t.cancelAllRequests]);if(c.cancel(),!u)throw new kn("cancelled","Firebase Functions instance was deleted.");const l=bI(u.status,u.json);if(l)throw l;if(!u.json)throw new kn("internal","Response is not valid JSON object.");let h=u.json.data;if(typeof h>"u"&&(h=u.json.result),typeof h>"u")throw new kn("internal","Response is missing data field.");return{data:vi(h)}}const Sf="@firebase/functions",bf="0.11.1";/**
3647
+ */const oc="us-central1";function HI(n){let e=null;return{promise:new Promise((t,r)=>{e=setTimeout(()=>{r(new Ln("deadline-exceeded","deadline-exceeded"))},n)}),cancel:()=>{e&&clearTimeout(e)}}}class WI{constructor(e,t,r,s,i=oc,o){this.app=e,this.fetchImpl=o,this.emulatorOrigin=null,this.contextProvider=new zI(t,r,s),this.cancelAllRequests=new Promise(a=>{this.deleteService=()=>Promise.resolve(a())});try{const a=new URL(i);this.customDomain=a.origin,this.region=oc}catch{this.customDomain=null,this.region=i}}_delete(){return this.deleteService()}_url(e){const t=this.app.options.projectId;return this.emulatorOrigin!==null?`${this.emulatorOrigin}/${t}/${this.region}/${e}`:this.customDomain!==null?`${this.customDomain}/${e}`:`https://${this.region}-${t}.cloudfunctions.net/${e}`}}function GI(n,e,t){n.emulatorOrigin=`http://${e}:${t}`}function KI(n,e,t){return r=>YI(n,e,r,t||{})}async function QI(n,e,t,r){t["Content-Type"]="application/json";let s;try{s=await r(n,{method:"POST",body:JSON.stringify(e),headers:t})}catch{return{status:0,json:null}}let i=null;try{i=await s.json()}catch{}return{status:s.status,json:i}}function YI(n,e,t,r){const s=n._url(e);return XI(n,s,t,r)}async function XI(n,e,t,r){t=sc(t);const s={data:t},i={},o=await n.contextProvider.getContext(r.limitedUseAppCheckTokens);o.authToken&&(i.Authorization="Bearer "+o.authToken),o.messagingToken&&(i["Firebase-Instance-ID-Token"]=o.messagingToken),o.appCheckToken!==null&&(i["X-Firebase-AppCheck"]=o.appCheckToken);const a=r.timeout||7e4,c=HI(a),u=await Promise.race([QI(e,s,i,n.fetchImpl),c.promise,n.cancelAllRequests]);if(c.cancel(),!u)throw new Ln("cancelled","Firebase Functions instance was deleted.");const l=$I(u.status,u.json);if(l)throw l;if(!u.json)throw new Ln("internal","Response is not valid JSON object.");let h=u.json.data;if(typeof h>"u"&&(h=u.json.result),typeof h>"u")throw new Ln("internal","Response is missing data field.");return{data:Ii(h)}}const jf="@firebase/functions",qf="0.11.4";/**
3648
3648
  * @license
3649
3649
  * Copyright 2019 Google LLC
3650
3650
  *
@@ -3659,7 +3659,7 @@ Content-Type: `+u.contentType+`\r
3659
3659
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3660
3660
  * See the License for the specific language governing permissions and
3661
3661
  * limitations under the License.
3662
- */const xI="auth-internal",UI="app-check-internal",FI="messaging-internal";function BI(t,e){const n=(r,{instanceIdentifier:s})=>{const i=r.getProvider("app").getImmediate(),o=r.getProvider(xI),a=r.getProvider(FI),c=r.getProvider(UI);return new DI(i,o,a,c,s,t)};ut(new Ye(Xa,n,"PUBLIC").setMultipleInstances(!0)),Ae(Sf,bf,e),Ae(Sf,bf,"esm2017")}/**
3662
+ */const JI="auth-internal",ZI="app-check-internal",eA="messaging-internal";function tA(n,e){const t=(r,{instanceIdentifier:s})=>{const i=r.getProvider("app").getImmediate(),o=r.getProvider(JI),a=r.getProvider(eA),c=r.getProvider(ZI);return new WI(i,o,a,c,s,n)};ft(new Ze(ic,t,"PUBLIC").setMultipleInstances(!0)),Se(jf,qf,e),Se(jf,qf,"esm2017")}/**
3663
3663
  * @license
3664
3664
  * Copyright 2020 Google LLC
3665
3665
  *
@@ -3674,5 +3674,5 @@ Content-Type: `+u.contentType+`\r
3674
3674
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3675
3675
  * See the License for the specific language governing permissions and
3676
3676
  * limitations under the License.
3677
- */function jI(t=zr(),e=Ja){const r=Mn(x(t),Xa).getImmediate({identifier:e}),s=Ti("functions");return s&&Cf(r,...s),r}function Cf(t,e,n){NI(x(t),e,n)}function $I(t,e,n){return OI(x(t),e,n)}BI(fetch.bind(self));const Le=class Le{static setFirebaseConfig(e){Le._firebaseConfig=e}static useEmulator(e){this._emulatorConfig={...Le.defaultEmulatorConfig,emulate:!0,...e}}static get emulator(){return this._emulatorConfig}constructor(){if(!Le._firebaseConfig)throw new Error("You should set a firebase config object before using Firebase");this._firebaseApp=pc(Le._firebaseConfig)}static get instance(){return this._instance||(this._instance=new Le)}firestore(){return Qy(this._firebaseApp)}storage(){return wI(this._firebaseApp)}auth(){return aw(this._firebaseApp)}functions(){return jI(this._firebaseApp,Le._region)}static setRegion(e){this._region=e}};Le.defaultEmulatorConfig={host:"localhost",firestorePort:8080,storagePort:9199,authPort:9099,functionsPort:5001,emulate:!1},Le._emulatorConfig=Le.defaultEmulatorConfig;let b=Le;class qI extends Js{constructor(e){var n;if(super(),this._lastLimit=0,e&&b.useEmulator(e),(n=b.emulator)!=null&&n.emulate){const{host:r,firestorePort:s}=b.emulator;Ih(b.instance.firestore(),r,s)}}findById(e,n){const r=b.instance.firestore();return new Promise(async s=>{try{const i=await _v(ca(r,n,e));s(i.data())}catch(i){return console.log(i),null}})}save(e){const n=b.instance.firestore(),r=Av(n);return Object.entries(e).forEach(([s,i])=>{i==null||i.forEach(o=>{const a=ca(n,s,o.id);r.set(a,o)})}),r.commit()}find(e,n){const r=this.queryObjectToQueryConstraints(e,n);return this.getFromQuery(r)}async count(e,n){const r=this.queryObjectToQueryConstraints(e,n);return(await Tv(r)).data().count}delete(e,n){const r=b.instance.firestore();return vv(ca(r,n,e))}next(e){if(!this._lastConstraints||!this._lastCollectionName)throw new Error("You should perform a query prior to using method next");const n=b.instance.firestore();this._lastLimit=e||this._lastLimit;const r=this._lastConstraints.nonFilterConstraints.concat(Vh(this._lastLimit),lv(this._lastDocRetrieved));return this.getFromQuery(Nh(Ah(n,this._lastCollectionName),...r))}queryObjectToQueryConstraints(e,n){var a;const r=b.instance.firestore(),s=[],i=[],o=[];return Js.toPropertyPathOperations(e.operations).forEach(c=>{const u=this.toFirebaseOperator(c.operator);c.aggregate?i.push(Oh(c.property,u,c.value)):s.push(Oh(c.property,u,c.value))}),(a=e.sort)!=null&&a.propertyName&&o.push(uv(e.sort.propertyName,e.sort.order)),this._lastConstraints={orConstraints:i,andConstraints:s,nonFilterConstraints:o},this._lastCollectionName=n,e.limit&&(this._lastLimit=e.limit,o.push(Vh(e.limit))),Nh(Ah(r,n),av(...i,cv(...s)),...o)}toFirebaseOperator(e){switch(e){case"==":case"!=":case"<":case"<=":case">":case">=":return e;case"contains":return"array-contains";case"containsAny":return"array-contains-any";default:return e}}getFromQuery(e){return new Promise(async n=>{const r=await yv(e);this._lastDocRetrieved=r.docs[r.docs.length-1],n(r.docs.map(s=>s.data()))})}}var zI=Object.defineProperty,HI=Object.getOwnPropertyDescriptor,WI=(t,e,n,r)=>{for(var s=r>1?void 0:r?HI(e,n):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(s=(r?o(e,n,s):o(s))||s);return r&&s&&zI(e,n,s),s};ve.FirebaseCloudStorage=class extends wn{constructor(e){var n;if(super(),e&&b.useEmulator(e),(n=b.emulator)!=null&&n.emulate){const{host:r,storagePort:s}=b.emulator;Af(b.instance.storage(),r,s)}}save(e,n,r){const s=b.instance.storage();return new Promise((i,o)=>{if(this._uploadTask=vI(Qa(s,e),n),r)var a=this._uploadTask.on("state_changed",c=>{r(c.bytesTransferred,c.totalBytes)},null,()=>a());this._uploadTask.then(()=>i(e)).catch(c=>o(c))})}getUrl(e){if(!e)return Promise.reject("needs a reference");const n=b.instance.storage();return EI(Qa(n,e))}uploadControl(){if(!this._uploadTask)throw new Error("You should call save() before uploadControl()");return{cancel:()=>{var e;return(e=this._uploadTask)==null?void 0:e.cancel()},pause:()=>{var e;return(e=this._uploadTask)==null?void 0:e.pause()},resume:()=>{var e;return(e=this._uploadTask)==null?void 0:e.resume()},onProgress:e=>{var n;return(n=this._uploadTask)==null?void 0:n.on("state_changed",r=>{e&&e(r.bytesTransferred,r.totalBytes)})}}}delete(e){const n=b.instance.storage();return TI(Qa(n,e))}},ve.FirebaseCloudStorage=WI([Hh("FirebaseCloudStorage",()=>new ve.FirebaseCloudStorage)],ve.FirebaseCloudStorage);const kf={twitter:()=>new Ve,facebook:()=>new We,google:()=>new Ge};class Za extends Wh{constructor(e){var n;if(super(),this.credentialProviders={},e&&b.useEmulator(e),(n=b.emulator)!=null&&n.emulate){const{host:r,authPort:s}=b.emulator;if(!r||!s)throw new Error("You should define a host and an auth emulator port to use the emulator");vd(b.instance.auth(),`http://${r}:${s}`)}this.registerCredentialProviders()}signUp(e){const{authProvider:n,verificationLink:r}=e;return n.slice(0,5)==="email"?new Promise(async(s,i)=>{try{const o=this.credentialProviders["email-sign-up"];if(!o)throw new Error(`The provider ${n} is not registered`);const a=await o(e);e.name&&await KE(a.user,{displayName:e.name}),r&&await Dd(a.user,{url:r}),s(await this.toUserCredentials(a.user))}catch(o){i({code:Zs(o.code.slice(5)),message:o.message})}}):this.login(e)}login(e){const{authProvider:n}=e;return new Promise(async(r,s)=>{try{const i=this.credentialProviders[n];if(!i)throw new Error(`The provider ${n} is not registered`);const o=await i(e);r(await this.toUserCredentials(o.user))}catch(i){s({code:i.code===400?"missingPassword":Zs(i.code.slice(5)),message:i.message})}})}logout(){return b.instance.auth().signOut()}resetEmailPassword(e){return new Promise(async(n,r)=>{try{await HE(b.instance.auth(),e),n()}catch(s){r({code:Zs(s.code.slice(5)),message:s.message})}})}resendVerificationEmail(e,n,r){return new Promise(async(s,i)=>{try{await kd(b.instance.auth(),e,n);const o=b.instance.auth().currentUser;if(!o){i({code:"userNotFound",message:"There is no logged in user"});return}await Dd(o,{url:r}),s()}catch(o){i({code:Zs(o.code.slice(5)),message:r})}})}refreshToken(){var e;return(e=b.instance.auth().currentUser)==null?void 0:e.getIdToken(!0)}onAuthStateChange(e){b.instance.auth().onAuthStateChanged(async n=>{e(n?await this.toUserCredentials(n):void 0)})}linkAdditionalProvider(e){const n=kf[e](),r=b.instance.auth().currentUser;if(!r)throw new Error("There is no logged in user");return qd(r,n)}unlinkProvider(e){const{currentUser:n}=b.instance.auth();if(!n)throw new Error("There is no logged in user");return n.providerData,BE(n,kf[e]().providerId)}async toUserCredentials(e){if(!e)throw new Error("The user in user credentials is not defined");const n=(await e.getIdTokenResult()).claims;return Za.convertCredentials(e,n)}static convertCredentials(e,n){return{id:e.uid,email:e.email??"",name:e.displayName??void 0,pictureUrl:e.photoURL??void 0,phoneNumber:e.phoneNumber??void 0,emailVerified:e.emailVerified,customData:{...n},lastLogin:Date.now(),creationDate:e.metadata.creationTime?new Date(e.metadata.creationTime).getTime():void 0}}registerCredentialProvider(e,n){this.credentialProviders[e]=n}registerCredentialProviders(){this.registerCredentialProvider("email-sign-up",e=>{if(!e.email||!e.password)throw new Error("Email and password are required");return WE(b.instance.auth(),e.email,e.password)}),this.registerCredentialProvider("email",e=>{if(!e.email||!e.password)throw new Error("Email and password are required");return kd(b.instance.auth(),e.email,e.password)}),this.registerCredentialProvider("google",()=>xa(b.instance.auth(),new Ge)),this.registerCredentialProvider("facebook",()=>xa(b.instance.auth(),new We)),this.registerCredentialProvider("twitter",()=>xa(b.instance.auth(),new Ve)),this.registerCredentialProvider("link-twitter",()=>{const e=b.instance.auth().currentUser;if(!e)throw new Error("There is no logged in user");return qd(e,new Ve)}),this.registerCredentialProvider("anonymous",()=>FE(b.instance.auth()))}}class GI{constructor(e,n){var r;if(e&&b.setRegion(e),n&&b.useEmulator(n),(r=b.emulator)!=null&&r.emulate){const{host:s,functionsPort:i}=b.emulator;Cf(b.instance.functions(),s,i)}}retrieveFunction(e){return $I(b.instance.functions(),e)}async callFunction(e,n){return(await e(n)).data}}ve.FirebaseAuth=Za,ve.FirebaseCloudFunctions=GI,ve.FirebaseDatasource=qI,ve.FirebaseHelper=b,Object.defineProperty(ve,Symbol.toStringTag,{value:"Module"})});
3677
+ */function nA(n=Qr(),e=oc){const r=qn(x(n),ic).getImmediate({identifier:e}),s=Ri("functions");return s&&$f(r,...s),r}function $f(n,e,t){GI(x(n),e,t)}function rA(n,e,t){return KI(x(n),e,t)}tA(fetch.bind(self));const Ue=class Ue{static setFirebaseConfig(e){Ue._firebaseConfig=e}static useEmulator(e){this._emulatorConfig={...Ue.defaultEmulatorConfig,emulate:!0,...e}}static get emulator(){return this._emulatorConfig}constructor(){if(!Ue._firebaseConfig)throw new Error("You should set a firebase config object before using Firebase");this._firebaseApp=Ic(Ue._firebaseConfig)}static get instance(){return this._instance||(this._instance=new Ue)}firestore(){return hv(this._firebaseApp)}storage(){return xI(this._firebaseApp)}auth(){return ww(this._firebaseApp)}functions(){return nA(this._firebaseApp,Ue._region)}static setRegion(e){this._region=e}};Ue.defaultEmulatorConfig={host:"localhost",firestorePort:8080,storagePort:9199,authPort:9099,functionsPort:5001,emulate:!1},Ue._emulatorConfig=Ue.defaultEmulatorConfig;let b=Ue;class sA extends Rn{constructor(e){var t;if(super(),this._lastLimit=0,e&&b.useEmulator(e),(t=b.emulator)!=null&&t.emulate){const{host:r,firestorePort:s}=b.emulator;Vh(b.instance.firestore(),r,s)}}findById(e,t){const r=b.instance.firestore();return new Promise(async s=>{try{const i=await Ov(pa(r,t,e));s(i.data())}catch(i){return console.log(i),null}})}save(e){const t=b.instance.firestore(),r=Bv(t);return Object.entries(e).forEach(([s,i])=>{i==null||i.forEach(o=>{const a=pa(t,s,o.id);r.set(a,o)})}),r.commit()}find(e,t){const r=this.queryObjectToQueryConstraints(e,t);return this.getFromQuery(r)}async count(e,t){const r=this.queryObjectToQueryConstraints(e,t);return(await xv(r)).data().count}delete(e,t){const r=b.instance.firestore();return Lv(pa(r,t,e))}next(e){if(!this._lastConstraints||!this._lastCollectionName)throw new Error("You should perform a query prior to using method next");const t=b.instance.firestore();this._lastLimit=e||this._lastLimit;const r=this._lastConstraints.nonFilterConstraints.concat(Hh(this._lastLimit),Pv(this._lastDocRetrieved));return this.getFromQuery($h(Lh(t,this._lastCollectionName),...r))}queryObjectToQueryConstraints(e,t){var a;const r=b.instance.firestore(),s=[],i=[],o=[];return Rn.toPropertyPathOperations(e.operations).forEach(c=>{const u=this.toFirebaseOperator(c.operator);c.aggregate?i.push(zh(c.property,u,c.value)):s.push(zh(c.property,u,c.value))}),(a=e.sort)!=null&&a.propertyName&&o.push(Rv(e.sort.propertyName,e.sort.order)),this._lastConstraints={orConstraints:i,andConstraints:s,nonFilterConstraints:o},this._lastCollectionName=t,e.limit&&(this._lastLimit=e.limit,o.push(Hh(e.limit))),$h(Lh(r,t),Iv(...i,Av(...s)),...o)}toFirebaseOperator(e){switch(e){case"==":case"!=":case"<":case"<=":case">":case">=":return e;case"contains":return"array-contains";case"containsAny":return"array-contains-any";default:return e}}getFromQuery(e){return new Promise(async t=>{const r=await Vv(e);this._lastDocRetrieved=r.docs[r.docs.length-1],t(r.docs.map(s=>s.data()))})}}var iA=Object.defineProperty,oA=Object.getOwnPropertyDescriptor,aA=(n,e,t,r)=>{for(var s=r>1?void 0:r?oA(e,t):e,i=n.length-1,o;i>=0;i--)(o=n[i])&&(s=(r?o(e,t,s):o(s))||s);return r&&s&&iA(e,t,s),s};Te.FirebaseCloudStorage=class extends Pn{constructor(e){var t;if(super(),e&&b.useEmulator(e),(t=b.emulator)!=null&&t.emulate){const{host:r,storagePort:s}=b.emulator;Uf(b.instance.storage(),r,s)}}save(e,t,r){const s=b.instance.storage();return new Promise((i,o)=>{if(this._uploadTask=VI(rc(s,e),t),r)var a=this._uploadTask.on("state_changed",c=>{r(c.bytesTransferred,c.totalBytes)},null,()=>a());this._uploadTask.then(()=>i(e)).catch(c=>o(c))})}getUrl(e){if(!e)return Promise.reject("needs a reference");const t=b.instance.storage();return LI(rc(t,e))}uploadControl(){if(!this._uploadTask)throw new Error("You should call save() before uploadControl()");return{cancel:()=>{var e;return(e=this._uploadTask)==null?void 0:e.cancel()},pause:()=>{var e;return(e=this._uploadTask)==null?void 0:e.pause()},resume:()=>{var e;return(e=this._uploadTask)==null?void 0:e.resume()},onProgress:e=>{var t;return(t=this._uploadTask)==null?void 0:t.on("state_changed",r=>{e&&e(r.bytesTransferred,r.totalBytes)})}}}delete(e){const t=b.instance.storage();return MI(rc(t,e))}},Te.FirebaseCloudStorage=aA([sd("FirebaseCloudStorage",()=>new Te.FirebaseCloudStorage)],Te.FirebaseCloudStorage);const zf={twitter:()=>new xe,facebook:()=>new Qe,google:()=>new Ye};class ac extends id{constructor(e){var t;if(super(),this.credentialProviders={},e&&b.useEmulator(e),(t=b.emulator)!=null&&t.emulate){const{host:r,authPort:s}=b.emulator;if(!r||!s)throw new Error("You should define a host and an auth emulator port to use the emulator");Od(b.instance.auth(),`http://${r}:${s}`)}this.registerCredentialProviders()}signUp(e){const{authProvider:t,verificationLink:r}=e;return t.slice(0,5)==="email"?new Promise(async(s,i)=>{try{const o=this.credentialProviders["email-sign-up"];if(!o)throw new Error(`The provider ${t} is not registered`);const a=await o(e);e.name&&await uT(a.user,{displayName:e.name}),r&&await Hd(a.user,{url:r}),s(await this.toUserCredentials(a.user))}catch(o){i({code:ri(o.code.slice(5)),message:o.message})}}):this.login(e)}login(e){const{authProvider:t}=e;return new Promise(async(r,s)=>{try{const i=this.credentialProviders[t];if(!i)throw new Error(`The provider ${t} is not registered`);const o=await i(e);r(await this.toUserCredentials(o.user))}catch(i){s({code:i.code===400?"missingPassword":ri(i.code.slice(5)),message:i.message})}})}logout(){return b.instance.auth().signOut()}resetEmailPassword(e){return new Promise(async(t,r)=>{try{await oT(b.instance.auth(),e),t()}catch(s){r({code:ri(s.code.slice(5)),message:s.message})}})}resendVerificationEmail(e,t,r){return new Promise(async(s,i)=>{try{await zd(b.instance.auth(),e,t);const o=b.instance.auth().currentUser;if(!o){i({code:"userNotFound",message:"There is no logged in user"});return}await Hd(o,{url:r}),s()}catch(o){i({code:ri(o.code.slice(5)),message:r})}})}refreshToken(){var e;return(e=b.instance.auth().currentUser)==null?void 0:e.getIdToken(!0)}onAuthStateChange(e){b.instance.auth().onAuthStateChanged(async t=>{e(t?await this.toUserCredentials(t):void 0)})}linkAdditionalProvider(e){const t=zf[e](),r=b.instance.auth().currentUser;if(!r)throw new Error("There is no logged in user");return rf(r,t)}unlinkProvider(e){const{currentUser:t}=b.instance.auth();if(!t)throw new Error("There is no logged in user");return t.providerData,tT(t,zf[e]().providerId)}async toUserCredentials(e){if(!e)throw new Error("The user in user credentials is not defined");const t=(await e.getIdTokenResult()).claims;return ac.convertCredentials(e,t)}static convertCredentials(e,t){return{id:e.uid,email:e.email??"",name:e.displayName??void 0,pictureUrl:e.photoURL??void 0,phoneNumber:e.phoneNumber??void 0,emailVerified:e.emailVerified,customData:{...t},lastLogin:Date.now(),creationDate:e.metadata.creationTime?new Date(e.metadata.creationTime).getTime():void 0}}registerCredentialProvider(e,t){this.credentialProviders[e]=t}registerCredentialProviders(){this.registerCredentialProvider("email-sign-up",e=>{if(!e.email||!e.password)throw new Error("Email and password are required");return aT(b.instance.auth(),e.email,e.password)}),this.registerCredentialProvider("email",e=>{if(!e.email||!e.password)throw new Error("Email and password are required");return zd(b.instance.auth(),e.email,e.password)}),this.registerCredentialProvider("google",()=>Ha(b.instance.auth(),new Ye)),this.registerCredentialProvider("facebook",()=>Ha(b.instance.auth(),new Qe)),this.registerCredentialProvider("twitter",()=>Ha(b.instance.auth(),new xe)),this.registerCredentialProvider("link-twitter",()=>{const e=b.instance.auth().currentUser;if(!e)throw new Error("There is no logged in user");return rf(e,new xe)}),this.registerCredentialProvider("anonymous",()=>eT(b.instance.auth()))}}class cA{constructor(e,t){var r;if(e&&b.setRegion(e),t&&b.useEmulator(t),(r=b.emulator)!=null&&r.emulate){const{host:s,functionsPort:i}=b.emulator;$f(b.instance.functions(),s,i)}}retrieveFunction(e){return rA(b.instance.functions(),e)}async callFunction(e,t){return(await e(t)).data}}Te.FirebaseAuth=ac,Te.FirebaseCloudFunctions=cA,Te.FirebaseDatasource=sA,Te.FirebaseHelper=b,Object.defineProperty(Te,Symbol.toStringTag,{value:"Module"})});
3678
3678
  //# sourceMappingURL=entropic-bond-firebase.umd.cjs.map