@chem-po/web-demo 0.0.4 → 0.0.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.
Files changed (45) hide show
  1. package/dist/assets/{Color-YHDXOIA2-DWRr93aM.js → Color-YHDXOIA2-CTixio2N.js} +1 -1
  2. package/dist/assets/DocsRenderer-CFRXHY34-3rO35qoa.js +575 -0
  3. package/dist/assets/ExampleItemView-CP2a92hN.js +1 -0
  4. package/dist/assets/{FirebaseList.stories-CcgPPh8J.js → FirebaseList.stories-Bj5Uw3uM.js} +1 -1
  5. package/dist/assets/{MobileFrame.stories-LQM_KmWY.js → MobileFrame.stories-C6fRoM1A.js} +1 -1
  6. package/dist/assets/{Playground.stories-BWtnuY6m.js → Playground.stories-BZjVwCHb.js} +1 -1
  7. package/dist/assets/{entry-preview-Dtem_WmJ.js → entry-preview-B_JVi5UV.js} +2 -2
  8. package/dist/assets/{entry-preview-docs-DJtt7OkJ.js → entry-preview-docs-CEaxHzqF.js} +1 -1
  9. package/dist/assets/{iframe-rmaPNljy.js → iframe-CiJg9Ueh.js} +2 -2
  10. package/dist/assets/{index-ChEI-nsM.js → index-BVLMb_CH.js} +1 -1
  11. package/dist/assets/{index-xnLS8IQ8.js → index-BcLeTgl6.js} +294 -250
  12. package/dist/assets/{index-iW6a2TEn.js → index-Bw5gtqQz.js} +2 -2
  13. package/dist/assets/{index-FTTXbSiM.js → index-DFweHObD.js} +1 -1
  14. package/dist/assets/{index-Ci6h_Amb.js → index-DqxVLU6x.js} +1 -1
  15. package/dist/assets/{index-DRjF_FHU.js → index-GiUgBvb1.js} +2 -2
  16. package/dist/assets/index-RoHUUooS.js +615 -0
  17. package/dist/assets/{jsx-runtime-DiklIkkE.js → jsx-runtime-CDt2p4po.js} +1 -1
  18. package/dist/assets/{list-WXUHTQch.js → list-RfpQMsfm.js} +2 -2
  19. package/dist/assets/{preview-DuTa5VuS.js → preview-D3WyzUYc.js} +5 -5
  20. package/dist/assets/{preview-ik5anPOD.js → preview-NEoZ8N1F.js} +1 -1
  21. package/dist/assets/{preview-D6hsmN8L.js → preview-ZjA0Xxw0.js} +2 -2
  22. package/dist/assets/{react-18-BPkW-q1l.js → react-18-B3VHhbvP.js} +1 -1
  23. package/dist/assets/{test-utils-DNRP7T0w.js → test-utils-PLR4qLHw.js} +1 -1
  24. package/dist/iframe.html +1 -1
  25. package/dist/index.html +1 -1
  26. package/dist/project.json +1 -1
  27. package/dist/sb-addons/chromatic-com-storybook-10/manager-bundle.js +11 -11
  28. package/dist/sb-addons/essentials-backgrounds-5/manager-bundle.js +3 -3
  29. package/dist/sb-addons/essentials-controls-2/manager-bundle.js +8 -8
  30. package/dist/sb-addons/essentials-docs-4/manager-bundle.js +4 -4
  31. package/dist/sb-addons/essentials-measure-8/manager-bundle.js +1 -1
  32. package/dist/sb-addons/essentials-outline-9/manager-bundle.js +1 -1
  33. package/dist/sb-addons/essentials-toolbars-7/manager-bundle.js +1 -1
  34. package/dist/sb-addons/essentials-viewport-6/manager-bundle.js +1 -1
  35. package/dist/sb-addons/interactions-11/manager-bundle.js +1 -1
  36. package/dist/sb-addons/links-1/manager-bundle.js +1 -1
  37. package/dist/sb-addons/remix-react-router-12/manager-bundle.js +2 -2
  38. package/dist/sb-addons/storybook-core-core-server-presets-0/common-manager-bundle.js +1 -1
  39. package/dist/sb-manager/globals-module-info.js +1 -0
  40. package/dist/sb-manager/globals-runtime.js +10372 -9836
  41. package/dist/sb-manager/runtime.js +119 -119
  42. package/package.json +6 -6
  43. package/dist/assets/DocsRenderer-CFRXHY34-D0gfqDQU.js +0 -575
  44. package/dist/assets/ExampleItemView-C7wLqYnj.js +0 -1
  45. package/dist/assets/index-DxqO1ZJV.js +0 -615
@@ -1,4 +1,4 @@
1
- import{x as zf,_ as wo,z as Ht,k as Gf,y as Wf}from"./index-DxqO1ZJV.js";import{r as nt}from"./index-DRjF_FHU.js";import{j as Kf}from"./jsx-runtime-DiklIkkE.js";const Qf=()=>{};var kc={};/**
1
+ import{x as Jf,y as Po,z as Gt,Q as Zf,A as ep}from"./index-RoHUUooS.js";import{r as nt}from"./index-GiUgBvb1.js";import{j as tp}from"./jsx-runtime-CDt2p4po.js";const np=()=>{};var Oc={};/**
2
2
  * @license
3
3
  * Copyright 2017 Google LLC
4
4
  *
@@ -13,7 +13,7 @@ import{x as zf,_ as wo,z as Ht,k as Gf,y as Wf}from"./index-DxqO1ZJV.js";import{
13
13
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
14
  * See the License for the specific language governing permissions and
15
15
  * limitations under the License.
16
- */const hl=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},Xf=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++],a=n[t++],c=n[t++],l=((s&7)<<18|(i&63)<<12|(a&63)<<6|c&63)-65536;e[r++]=String.fromCharCode(55296+(l>>10)),e[r++]=String.fromCharCode(56320+(l&1023))}else{const i=n[t++],a=n[t++];e[r++]=String.fromCharCode((s&15)<<12|(i&63)<<6|a&63)}}return e.join("")},dl={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],a=s+1<n.length,c=a?n[s+1]:0,l=s+2<n.length,d=l?n[s+2]:0,f=i>>2,m=(i&3)<<4|c>>4;let E=(c&15)<<2|d>>6,R=d&63;l||(R=64,a||(E=64)),r.push(t[f],t[m],t[E],t[R])}return r.join("")},encodeString(n,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(n):this.encodeByteArray(hl(n),e)},decodeString(n,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(n):Xf(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++)],c=s<n.length?t[n.charAt(s)]:0;++s;const d=s<n.length?t[n.charAt(s)]:64;++s;const m=s<n.length?t[n.charAt(s)]:64;if(++s,i==null||c==null||d==null||m==null)throw new Jf;const E=i<<2|c>>4;if(r.push(E),d!==64){const R=c<<4&240|d>>2;if(r.push(R),m!==64){const C=d<<6&192|m;r.push(C)}}}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 Jf extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const Yf=function(n){const e=hl(n);return dl.encodeByteArray(e,!0)},vs=function(n){return Yf(n).replace(/\./g,"")},fl=function(n){try{return dl.decodeString(n,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};/**
16
+ */const _l=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},rp=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++],a=n[t++],c=n[t++],l=((s&7)<<18|(i&63)<<12|(a&63)<<6|c&63)-65536;e[r++]=String.fromCharCode(55296+(l>>10)),e[r++]=String.fromCharCode(56320+(l&1023))}else{const i=n[t++],a=n[t++];e[r++]=String.fromCharCode((s&15)<<12|(i&63)<<6|a&63)}}return e.join("")},yl={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],a=s+1<n.length,c=a?n[s+1]:0,l=s+2<n.length,d=l?n[s+2]:0,f=i>>2,m=(i&3)<<4|c>>4;let _=(c&15)<<2|d>>6,R=d&63;l||(R=64,a||(_=64)),r.push(t[f],t[m],t[_],t[R])}return r.join("")},encodeString(n,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(n):this.encodeByteArray(_l(n),e)},decodeString(n,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(n):rp(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++)],c=s<n.length?t[n.charAt(s)]:0;++s;const d=s<n.length?t[n.charAt(s)]:64;++s;const m=s<n.length?t[n.charAt(s)]:64;if(++s,i==null||c==null||d==null||m==null)throw new sp;const _=i<<2|c>>4;if(r.push(_),d!==64){const R=c<<4&240|d>>2;if(r.push(R),m!==64){const S=d<<6&192|m;r.push(S)}}}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 sp extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const ip=function(n){const e=_l(n);return yl.encodeByteArray(e,!0)},As=function(n){return ip(n).replace(/\./g,"")},El=function(n){try{return yl.decodeString(n,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};/**
17
17
  * @license
18
18
  * Copyright 2022 Google LLC
19
19
  *
@@ -28,7 +28,7 @@ import{x as zf,_ as wo,z as Ht,k as Gf,y as Wf}from"./index-DxqO1ZJV.js";import{
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
- */function Zf(){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.")}/**
31
+ */function op(){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.")}/**
32
32
  * @license
33
33
  * Copyright 2022 Google LLC
34
34
  *
@@ -43,7 +43,7 @@ import{x as zf,_ as wo,z as Ht,k as Gf,y as Wf}from"./index-DxqO1ZJV.js";import{
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
- */const ep=()=>Zf().__FIREBASE_DEFAULTS__,tp=()=>{if(typeof process>"u"||typeof kc>"u")return;const n=kc.__FIREBASE_DEFAULTS__;if(n)return JSON.parse(n)},np=()=>{if(typeof document>"u")return;let n;try{n=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch{return}const e=n&&fl(n[1]);return e&&JSON.parse(e)},zs=()=>{try{return Qf()||ep()||tp()||np()}catch(n){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${n}`);return}},pl=n=>{var e,t;return(t=(e=zs())===null||e===void 0?void 0:e.emulatorHosts)===null||t===void 0?void 0:t[n]},Ao=n=>{const e=pl(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]},ml=()=>{var n;return(n=zs())===null||n===void 0?void 0:n.config},gl=n=>{var e;return(e=zs())===null||e===void 0?void 0:e[`_${n}`]};/**
46
+ */const ap=()=>op().__FIREBASE_DEFAULTS__,cp=()=>{if(typeof process>"u"||typeof Oc>"u")return;const n=Oc.__FIREBASE_DEFAULTS__;if(n)return JSON.parse(n)},up=()=>{if(typeof document>"u")return;let n;try{n=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch{return}const e=n&&El(n[1]);return e&&JSON.parse(e)},Ks=()=>{try{return np()||ap()||cp()||up()}catch(n){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${n}`);return}},Tl=n=>{var e,t;return(t=(e=Ks())===null||e===void 0?void 0:e.emulatorHosts)===null||t===void 0?void 0:t[n]},So=n=>{const e=Tl(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]},vl=()=>{var n;return(n=Ks())===null||n===void 0?void 0:n.config},Il=n=>{var e;return(e=Ks())===null||e===void 0?void 0:e[`_${n}`]};/**
47
47
  * @license
48
48
  * Copyright 2017 Google LLC
49
49
  *
@@ -58,7 +58,22 @@ import{x as zf,_ as wo,z as Ht,k as Gf,y as Wf}from"./index-DxqO1ZJV.js";import{
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
- */class rp{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))}}}/**
61
+ */class lp{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))}}}/**
62
+ * @license
63
+ * Copyright 2025 Google LLC
64
+ *
65
+ * Licensed under the Apache License, Version 2.0 (the "License");
66
+ * you may not use this file except in compliance with the License.
67
+ * You may obtain a copy of the License at
68
+ *
69
+ * http://www.apache.org/licenses/LICENSE-2.0
70
+ *
71
+ * Unless required by applicable law or agreed to in writing, software
72
+ * distributed under the License is distributed on an "AS IS" BASIS,
73
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
74
+ * See the License for the specific language governing permissions and
75
+ * limitations under the License.
76
+ */function Lt(n){return n.endsWith(".cloudworkstations.dev")}async function Qs(n){return(await fetch(n,{credentials:"include"})).ok}/**
62
77
  * @license
63
78
  * Copyright 2021 Google LLC
64
79
  *
@@ -73,7 +88,21 @@ import{x as zf,_ as wo,z as Ht,k as Gf,y as Wf}from"./index-DxqO1ZJV.js";import{
73
88
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
74
89
  * See the License for the specific language governing permissions and
75
90
  * limitations under the License.
76
- */function _l(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 a=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[vs(JSON.stringify(t)),vs(JSON.stringify(a)),""].join(".")}/**
91
+ */function wl(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 a=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[As(JSON.stringify(t)),As(JSON.stringify(a)),""].join(".")}const dr={};function hp(){const n={prod:[],emulator:[]};for(const e of Object.keys(dr))dr[e]?n.emulator.push(e):n.prod.push(e);return n}function dp(n){let e=document.getElementById(n),t=!1;return e||(e=document.createElement("div"),e.setAttribute("id",n),t=!0),{created:t,element:e}}let Lc=!1;function xt(n,e){if(typeof window>"u"||typeof document>"u"||!Lt(window.location.host)||dr[n]===e||dr[n]||Lc)return;dr[n]=e;function t(_){return`__firebase__banner__${_}`}const r="__firebase__banner",i=hp().prod.length>0;function a(){const _=document.getElementById(r);_&&_.remove()}function c(_){_.style.display="flex",_.style.background="#7faaf0",_.style.position="fixed",_.style.bottom="5px",_.style.left="5px",_.style.padding=".5em",_.style.borderRadius="5px",_.style.alignItems="center"}function l(_,R){_.setAttribute("width","24"),_.setAttribute("id",R),_.setAttribute("height","24"),_.setAttribute("viewBox","0 0 24 24"),_.setAttribute("fill","none"),_.style.marginLeft="-6px"}function d(){const _=document.createElement("span");return _.style.cursor="pointer",_.style.marginLeft="16px",_.style.fontSize="24px",_.innerHTML=" &times;",_.onclick=()=>{Lc=!0,a()},_}function f(_,R){_.setAttribute("id",R),_.innerText="Learn more",_.href="https://firebase.google.com/docs/studio/preview-apps#preview-backend",_.setAttribute("target","__blank"),_.style.paddingLeft="5px",_.style.textDecoration="underline"}function m(){const _=dp(r),R=t("text"),S=document.getElementById(R)||document.createElement("span"),N=t("learnmore"),k=document.getElementById(N)||document.createElement("a"),B=t("preprendIcon"),M=document.getElementById(B)||document.createElementNS("http://www.w3.org/2000/svg","svg");if(_.created){const x=_.element;c(x),f(k,N);const $=d();l(M,B),x.append(M,S,k,$),document.body.appendChild(x)}i?(S.innerText="Preview backend disconnected.",M.innerHTML=`<g clip-path="url(#clip0_6013_33858)">
92
+ <path d="M4.8 17.6L12 5.6L19.2 17.6H4.8ZM6.91667 16.4H17.0833L12 7.93333L6.91667 16.4ZM12 15.6C12.1667 15.6 12.3056 15.5444 12.4167 15.4333C12.5389 15.3111 12.6 15.1667 12.6 15C12.6 14.8333 12.5389 14.6944 12.4167 14.5833C12.3056 14.4611 12.1667 14.4 12 14.4C11.8333 14.4 11.6889 14.4611 11.5667 14.5833C11.4556 14.6944 11.4 14.8333 11.4 15C11.4 15.1667 11.4556 15.3111 11.5667 15.4333C11.6889 15.5444 11.8333 15.6 12 15.6ZM11.4 13.6H12.6V10.4H11.4V13.6Z" fill="#212121"/>
93
+ </g>
94
+ <defs>
95
+ <clipPath id="clip0_6013_33858">
96
+ <rect width="24" height="24" fill="white"/>
97
+ </clipPath>
98
+ </defs>`):(M.innerHTML=`<g clip-path="url(#clip0_6083_34804)">
99
+ <path d="M11.4 15.2H12.6V11.2H11.4V15.2ZM12 10C12.1667 10 12.3056 9.94444 12.4167 9.83333C12.5389 9.71111 12.6 9.56667 12.6 9.4C12.6 9.23333 12.5389 9.09444 12.4167 8.98333C12.3056 8.86111 12.1667 8.8 12 8.8C11.8333 8.8 11.6889 8.86111 11.5667 8.98333C11.4556 9.09444 11.4 9.23333 11.4 9.4C11.4 9.56667 11.4556 9.71111 11.5667 9.83333C11.6889 9.94444 11.8333 10 12 10ZM12 18.4C11.1222 18.4 10.2944 18.2333 9.51667 17.9C8.73889 17.5667 8.05556 17.1111 7.46667 16.5333C6.88889 15.9444 6.43333 15.2611 6.1 14.4833C5.76667 13.7056 5.6 12.8778 5.6 12C5.6 11.1111 5.76667 10.2833 6.1 9.51667C6.43333 8.73889 6.88889 8.06111 7.46667 7.48333C8.05556 6.89444 8.73889 6.43333 9.51667 6.1C10.2944 5.76667 11.1222 5.6 12 5.6C12.8889 5.6 13.7167 5.76667 14.4833 6.1C15.2611 6.43333 15.9389 6.89444 16.5167 7.48333C17.1056 8.06111 17.5667 8.73889 17.9 9.51667C18.2333 10.2833 18.4 11.1111 18.4 12C18.4 12.8778 18.2333 13.7056 17.9 14.4833C17.5667 15.2611 17.1056 15.9444 16.5167 16.5333C15.9389 17.1111 15.2611 17.5667 14.4833 17.9C13.7167 18.2333 12.8889 18.4 12 18.4ZM12 17.2C13.4444 17.2 14.6722 16.6944 15.6833 15.6833C16.6944 14.6722 17.2 13.4444 17.2 12C17.2 10.5556 16.6944 9.32778 15.6833 8.31667C14.6722 7.30555 13.4444 6.8 12 6.8C10.5556 6.8 9.32778 7.30555 8.31667 8.31667C7.30556 9.32778 6.8 10.5556 6.8 12C6.8 13.4444 7.30556 14.6722 8.31667 15.6833C9.32778 16.6944 10.5556 17.2 12 17.2Z" fill="#212121"/>
100
+ </g>
101
+ <defs>
102
+ <clipPath id="clip0_6083_34804">
103
+ <rect width="24" height="24" fill="white"/>
104
+ </clipPath>
105
+ </defs>`,S.innerText="Preview backend running in this workspace."),S.setAttribute("id",R)}document.readyState==="loading"?window.addEventListener("DOMContentLoaded",m):m()}/**
77
106
  * @license
78
107
  * Copyright 2017 Google LLC
79
108
  *
@@ -88,7 +117,7 @@ import{x as zf,_ as wo,z as Ht,k as Gf,y as Wf}from"./index-DxqO1ZJV.js";import{
88
117
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
89
118
  * See the License for the specific language governing permissions and
90
119
  * limitations under the License.
91
- */function we(){return typeof navigator<"u"&&typeof navigator.userAgent=="string"?navigator.userAgent:""}function sp(){return typeof window<"u"&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(we())}function ip(){var n;const e=(n=zs())===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 op(){return typeof navigator<"u"&&navigator.userAgent==="Cloudflare-Workers"}function ap(){const n=typeof chrome=="object"?chrome.runtime:typeof browser=="object"?browser.runtime:void 0;return typeof n=="object"&&n.id!==void 0}function cp(){return typeof navigator=="object"&&navigator.product==="ReactNative"}function up(){const n=we();return n.indexOf("MSIE ")>=0||n.indexOf("Trident/")>=0}function lp(){return!ip()&&!!navigator.userAgent&&navigator.userAgent.includes("Safari")&&!navigator.userAgent.includes("Chrome")}function hp(){try{return typeof indexedDB=="object"}catch{return!1}}function dp(){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)}})}/**
120
+ */function we(){return typeof navigator<"u"&&typeof navigator.userAgent=="string"?navigator.userAgent:""}function fp(){return typeof window<"u"&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(we())}function pp(){var n;const e=(n=Ks())===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 mp(){return typeof navigator<"u"&&navigator.userAgent==="Cloudflare-Workers"}function gp(){const n=typeof chrome=="object"?chrome.runtime:typeof browser=="object"?browser.runtime:void 0;return typeof n=="object"&&n.id!==void 0}function _p(){return typeof navigator=="object"&&navigator.product==="ReactNative"}function yp(){const n=we();return n.indexOf("MSIE ")>=0||n.indexOf("Trident/")>=0}function Ep(){return!pp()&&!!navigator.userAgent&&navigator.userAgent.includes("Safari")&&!navigator.userAgent.includes("Chrome")}function Tp(){try{return typeof indexedDB=="object"}catch{return!1}}function vp(){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)}})}/**
92
121
  * @license
93
122
  * Copyright 2017 Google LLC
94
123
  *
@@ -103,7 +132,7 @@ import{x as zf,_ as wo,z as Ht,k as Gf,y as Wf}from"./index-DxqO1ZJV.js";import{
103
132
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
104
133
  * See the License for the specific language governing permissions and
105
134
  * limitations under the License.
106
- */const fp="FirebaseError";class He extends Error{constructor(e,t,r){super(t),this.code=e,this.customData=r,this.name=fp,Object.setPrototypeOf(this,He.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,Rr.prototype.create)}}class Rr{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],a=i?pp(i,r):"Error",c=`${this.serviceName}: ${a} (${s}).`;return new He(s,c,r)}}function pp(n,e){return n.replace(mp,(t,r)=>{const s=e[r];return s!=null?String(s):`<${r}?>`})}const mp=/\{\$([^}]+)}/g;function gp(n){for(const e in n)if(Object.prototype.hasOwnProperty.call(n,e))return!1;return!0}function Qt(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],a=e[s];if(Nc(i)&&Nc(a)){if(!Qt(i,a))return!1}else if(i!==a)return!1}for(const s of r)if(!t.includes(s))return!1;return!0}function Nc(n){return n!==null&&typeof n=="object"}/**
135
+ */const Ip="FirebaseError";class ze extends Error{constructor(e,t,r){super(t),this.code=e,this.customData=r,this.name=Ip,Object.setPrototypeOf(this,ze.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,Sr.prototype.create)}}class Sr{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],a=i?wp(i,r):"Error",c=`${this.serviceName}: ${a} (${s}).`;return new ze(s,c,r)}}function wp(n,e){return n.replace(Ap,(t,r)=>{const s=e[r];return s!=null?String(s):`<${r}?>`})}const Ap=/\{\$([^}]+)}/g;function Rp(n){for(const e in n)if(Object.prototype.hasOwnProperty.call(n,e))return!1;return!0}function Yt(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],a=e[s];if(xc(i)&&xc(a)){if(!Yt(i,a))return!1}else if(i!==a)return!1}for(const s of r)if(!t.includes(s))return!1;return!0}function xc(n){return n!==null&&typeof n=="object"}/**
107
136
  * @license
108
137
  * Copyright 2017 Google LLC
109
138
  *
@@ -118,7 +147,7 @@ import{x as zf,_ as wo,z as Ht,k as Gf,y as Wf}from"./index-DxqO1ZJV.js";import{
118
147
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
119
148
  * See the License for the specific language governing permissions and
120
149
  * limitations under the License.
121
- */function br(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 sr(n){const e={};return n.replace(/^\?/,"").split("&").forEach(r=>{if(r){const[s,i]=r.split("=");e[decodeURIComponent(s)]=decodeURIComponent(i)}}),e}function ir(n){const e=n.indexOf("?");if(!e)return"";const t=n.indexOf("#",e);return n.substring(e,t>0?t:void 0)}function _p(n,e){const t=new yp(n,e);return t.subscribe.bind(t)}class yp{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.");Tp(e,["next","error","complete"])?s=e:s={next:e,error:t,complete:r},s.next===void 0&&(s.next=qi),s.error===void 0&&(s.error=qi),s.complete===void 0&&(s.complete=qi);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 Tp(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 qi(){}/**
150
+ */function Cr(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 or(n){const e={};return n.replace(/^\?/,"").split("&").forEach(r=>{if(r){const[s,i]=r.split("=");e[decodeURIComponent(s)]=decodeURIComponent(i)}}),e}function ar(n){const e=n.indexOf("?");if(!e)return"";const t=n.indexOf("#",e);return n.substring(e,t>0?t:void 0)}function bp(n,e){const t=new Pp(n,e);return t.subscribe.bind(t)}class Pp{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.");Sp(e,["next","error","complete"])?s=e:s={next:e,error:t,complete:r},s.next===void 0&&(s.next=Hi),s.error===void 0&&(s.error=Hi),s.complete===void 0&&(s.complete=Hi);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 Sp(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 Hi(){}/**
122
151
  * @license
123
152
  * Copyright 2021 Google LLC
124
153
  *
@@ -148,7 +177,7 @@ import{x as zf,_ as wo,z as Ht,k as Gf,y as Wf}from"./index-DxqO1ZJV.js";import{
148
177
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
149
178
  * See the License for the specific language governing permissions and
150
179
  * limitations under the License.
151
- */const zt="[DEFAULT]";/**
180
+ */const Wt="[DEFAULT]";/**
152
181
  * @license
153
182
  * Copyright 2019 Google LLC
154
183
  *
@@ -163,7 +192,7 @@ import{x as zf,_ as wo,z as Ht,k as Gf,y as Wf}from"./index-DxqO1ZJV.js";import{
163
192
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
164
193
  * See the License for the specific language governing permissions and
165
194
  * limitations under the License.
166
- */class Ep{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 rp;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(Ip(e))try{this.getOrInitializeService({instanceIdentifier:zt})}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=zt){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=zt){return this.instances.has(e)}getOptions(e=zt){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,a]of this.instancesDeferred.entries()){const c=this.normalizeInstanceIdentifier(i);r===c&&a.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 a=this.instances.get(s);return a&&e(a,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:vp(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=zt){return this.component?this.component.multipleInstances?e:zt:e}shouldAutoInitialize(){return!!this.component&&this.component.instantiationMode!=="EXPLICIT"}}function vp(n){return n===zt?void 0:n}function Ip(n){return n.instantiationMode==="EAGER"}/**
195
+ */class Cp{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 lp;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(Np(e))try{this.getOrInitializeService({instanceIdentifier:Wt})}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=Wt){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=Wt){return this.instances.has(e)}getOptions(e=Wt){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,a]of this.instancesDeferred.entries()){const c=this.normalizeInstanceIdentifier(i);r===c&&a.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 a=this.instances.get(s);return a&&e(a,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:kp(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=Wt){return this.component?this.component.multipleInstances?e:Wt:e}shouldAutoInitialize(){return!!this.component&&this.component.instantiationMode!=="EXPLICIT"}}function kp(n){return n===Wt?void 0:n}function Np(n){return n.instantiationMode==="EAGER"}/**
167
196
  * @license
168
197
  * Copyright 2019 Google LLC
169
198
  *
@@ -178,7 +207,7 @@ import{x as zf,_ as wo,z as Ht,k as Gf,y as Wf}from"./index-DxqO1ZJV.js";import{
178
207
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
179
208
  * See the License for the specific language governing permissions and
180
209
  * limitations under the License.
181
- */class wp{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 Ep(e,this);return this.providers.set(e,t),t}getProviders(){return Array.from(this.providers.values())}}/**
210
+ */class Dp{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 Cp(e,this);return this.providers.set(e,t),t}getProviders(){return Array.from(this.providers.values())}}/**
182
211
  * @license
183
212
  * Copyright 2017 Google LLC
184
213
  *
@@ -193,7 +222,7 @@ import{x as zf,_ as wo,z as Ht,k as Gf,y as Wf}from"./index-DxqO1ZJV.js";import{
193
222
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
194
223
  * See the License for the specific language governing permissions and
195
224
  * limitations under the License.
196
- */var z;(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"})(z||(z={}));const Ap={debug:z.DEBUG,verbose:z.VERBOSE,info:z.INFO,warn:z.WARN,error:z.ERROR,silent:z.SILENT},Rp=z.INFO,bp={[z.DEBUG]:"log",[z.VERBOSE]:"log",[z.INFO]:"info",[z.WARN]:"warn",[z.ERROR]:"error"},Pp=(n,e,...t)=>{if(e<n.logLevel)return;const r=new Date().toISOString(),s=bp[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 Ro{constructor(e){this.name=e,this._logLevel=Rp,this._logHandler=Pp,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in z))throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel=typeof e=="string"?Ap[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,z.DEBUG,...e),this._logHandler(this,z.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,z.VERBOSE,...e),this._logHandler(this,z.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,z.INFO,...e),this._logHandler(this,z.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,z.WARN,...e),this._logHandler(this,z.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,z.ERROR,...e),this._logHandler(this,z.ERROR,...e)}}/**
225
+ */var H;(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"})(H||(H={}));const Vp={debug:H.DEBUG,verbose:H.VERBOSE,info:H.INFO,warn:H.WARN,error:H.ERROR,silent:H.SILENT},Op=H.INFO,Lp={[H.DEBUG]:"log",[H.VERBOSE]:"log",[H.INFO]:"info",[H.WARN]:"warn",[H.ERROR]:"error"},xp=(n,e,...t)=>{if(e<n.logLevel)return;const r=new Date().toISOString(),s=Lp[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 Co{constructor(e){this.name=e,this._logLevel=Op,this._logHandler=xp,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in H))throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel=typeof e=="string"?Vp[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,H.DEBUG,...e),this._logHandler(this,H.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,H.VERBOSE,...e),this._logHandler(this,H.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,H.INFO,...e),this._logHandler(this,H.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,H.WARN,...e),this._logHandler(this,H.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,H.ERROR,...e),this._logHandler(this,H.ERROR,...e)}}/**
197
226
  * @license
198
227
  * Copyright 2019 Google LLC
199
228
  *
@@ -208,7 +237,7 @@ import{x as zf,_ as wo,z as Ht,k as Gf,y as Wf}from"./index-DxqO1ZJV.js";import{
208
237
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
209
238
  * See the License for the specific language governing permissions and
210
239
  * limitations under the License.
211
- */class Sp{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(t=>{if(Cp(t)){const r=t.getImmediate();return`${r.library}/${r.version}`}else return null}).filter(t=>t).join(" ")}}function Cp(n){const e=n.getComponent();return(e==null?void 0:e.type)==="VERSION"}const Yi="@firebase/app",Dc="0.11.4";/**
240
+ */class Mp{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(t=>{if(Up(t)){const r=t.getImmediate();return`${r.library}/${r.version}`}else return null}).filter(t=>t).join(" ")}}function Up(n){const e=n.getComponent();return(e==null?void 0:e.type)==="VERSION"}const no="@firebase/app",Mc="0.13.0";/**
212
241
  * @license
213
242
  * Copyright 2019 Google LLC
214
243
  *
@@ -223,7 +252,7 @@ import{x as zf,_ as wo,z as Ht,k as Gf,y as Wf}from"./index-DxqO1ZJV.js";import{
223
252
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
224
253
  * See the License for the specific language governing permissions and
225
254
  * limitations under the License.
226
- */const lt=new Ro("@firebase/app"),kp="@firebase/app-compat",Np="@firebase/analytics-compat",Dp="@firebase/analytics",Op="@firebase/app-check-compat",Vp="@firebase/app-check",Lp="@firebase/auth",Mp="@firebase/auth-compat",xp="@firebase/database",Up="@firebase/data-connect",Fp="@firebase/database-compat",Bp="@firebase/functions",qp="@firebase/functions-compat",$p="@firebase/installations",jp="@firebase/installations-compat",Hp="@firebase/messaging",zp="@firebase/messaging-compat",Gp="@firebase/performance",Wp="@firebase/performance-compat",Kp="@firebase/remote-config",Qp="@firebase/remote-config-compat",Xp="@firebase/storage",Jp="@firebase/storage-compat",Yp="@firebase/firestore",Zp="@firebase/vertexai",em="@firebase/firestore-compat",tm="firebase",nm="11.6.0";/**
255
+ */const lt=new Co("@firebase/app"),Fp="@firebase/app-compat",Bp="@firebase/analytics-compat",qp="@firebase/analytics",jp="@firebase/app-check-compat",$p="@firebase/app-check",zp="@firebase/auth",Hp="@firebase/auth-compat",Gp="@firebase/database",Wp="@firebase/data-connect",Kp="@firebase/database-compat",Qp="@firebase/functions",Xp="@firebase/functions-compat",Yp="@firebase/installations",Jp="@firebase/installations-compat",Zp="@firebase/messaging",em="@firebase/messaging-compat",tm="@firebase/performance",nm="@firebase/performance-compat",rm="@firebase/remote-config",sm="@firebase/remote-config-compat",im="@firebase/storage",om="@firebase/storage-compat",am="@firebase/firestore",cm="@firebase/ai",um="@firebase/firestore-compat",lm="firebase",hm="11.8.0";/**
227
256
  * @license
228
257
  * Copyright 2019 Google LLC
229
258
  *
@@ -238,7 +267,7 @@ import{x as zf,_ as wo,z as Ht,k as Gf,y as Wf}from"./index-DxqO1ZJV.js";import{
238
267
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
239
268
  * See the License for the specific language governing permissions and
240
269
  * limitations under the License.
241
- */const Zi="[DEFAULT]",rm={[Yi]:"fire-core",[kp]:"fire-core-compat",[Dp]:"fire-analytics",[Np]:"fire-analytics-compat",[Vp]:"fire-app-check",[Op]:"fire-app-check-compat",[Lp]:"fire-auth",[Mp]:"fire-auth-compat",[xp]:"fire-rtdb",[Up]:"fire-data-connect",[Fp]:"fire-rtdb-compat",[Bp]:"fire-fn",[qp]:"fire-fn-compat",[$p]:"fire-iid",[jp]:"fire-iid-compat",[Hp]:"fire-fcm",[zp]:"fire-fcm-compat",[Gp]:"fire-perf",[Wp]:"fire-perf-compat",[Kp]:"fire-rc",[Qp]:"fire-rc-compat",[Xp]:"fire-gcs",[Jp]:"fire-gcs-compat",[Yp]:"fire-fst",[em]:"fire-fst-compat",[Zp]:"fire-vertex","fire-js":"fire-js",[tm]:"fire-js-all"};/**
270
+ */const ro="[DEFAULT]",dm={[no]:"fire-core",[Fp]:"fire-core-compat",[qp]:"fire-analytics",[Bp]:"fire-analytics-compat",[$p]:"fire-app-check",[jp]:"fire-app-check-compat",[zp]:"fire-auth",[Hp]:"fire-auth-compat",[Gp]:"fire-rtdb",[Wp]:"fire-data-connect",[Kp]:"fire-rtdb-compat",[Qp]:"fire-fn",[Xp]:"fire-fn-compat",[Yp]:"fire-iid",[Jp]:"fire-iid-compat",[Zp]:"fire-fcm",[em]:"fire-fcm-compat",[tm]:"fire-perf",[nm]:"fire-perf-compat",[rm]:"fire-rc",[sm]:"fire-rc-compat",[im]:"fire-gcs",[om]:"fire-gcs-compat",[am]:"fire-fst",[um]:"fire-fst-compat",[cm]:"fire-vertex","fire-js":"fire-js",[lm]:"fire-js-all"};/**
242
271
  * @license
243
272
  * Copyright 2019 Google LLC
244
273
  *
@@ -253,7 +282,7 @@ import{x as zf,_ as wo,z as Ht,k as Gf,y as Wf}from"./index-DxqO1ZJV.js";import{
253
282
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
254
283
  * See the License for the specific language governing permissions and
255
284
  * limitations under the License.
256
- */const Is=new Map,sm=new Map,eo=new Map;function Oc(n,e){try{n.container.addComponent(e)}catch(t){lt.debug(`Component ${e.name} failed to register with FirebaseApp ${n.name}`,t)}}function St(n){const e=n.name;if(eo.has(e))return lt.debug(`There were multiple attempts to register component ${e}.`),!1;eo.set(e,n);for(const t of Is.values())Oc(t,n);for(const t of sm.values())Oc(t,n);return!0}function Pr(n,e){const t=n.container.getProvider("heartbeat").getImmediate({optional:!0});return t&&t.triggerHeartbeat(),n.container.getProvider(e)}function Pe(n){return n==null?!1:n.settings!==void 0}/**
285
+ */const Rs=new Map,fm=new Map,so=new Map;function Uc(n,e){try{n.container.addComponent(e)}catch(t){lt.debug(`Component ${e.name} failed to register with FirebaseApp ${n.name}`,t)}}function St(n){const e=n.name;if(so.has(e))return lt.debug(`There were multiple attempts to register component ${e}.`),!1;so.set(e,n);for(const t of Rs.values())Uc(t,n);for(const t of fm.values())Uc(t,n);return!0}function kr(n,e){const t=n.container.getProvider("heartbeat").getImmediate({optional:!0});return t&&t.triggerHeartbeat(),n.container.getProvider(e)}function Pe(n){return n==null?!1:n.settings!==void 0}/**
257
286
  * @license
258
287
  * Copyright 2019 Google LLC
259
288
  *
@@ -268,7 +297,7 @@ import{x as zf,_ as wo,z as Ht,k as Gf,y as Wf}from"./index-DxqO1ZJV.js";import{
268
297
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
269
298
  * See the License for the specific language governing permissions and
270
299
  * limitations under the License.
271
- */const im={"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."},Rt=new Rr("app","Firebase",im);/**
300
+ */const pm={"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."},Rt=new Sr("app","Firebase",pm);/**
272
301
  * @license
273
302
  * Copyright 2019 Google LLC
274
303
  *
@@ -283,7 +312,7 @@ import{x as zf,_ as wo,z as Ht,k as Gf,y as Wf}from"./index-DxqO1ZJV.js";import{
283
312
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
284
313
  * See the License for the specific language governing permissions and
285
314
  * limitations under the License.
286
- */class om{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 ut("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 Rt.create("app-deleted",{appName:this._name})}}/**
315
+ */class mm{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 ut("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 Rt.create("app-deleted",{appName:this._name})}}/**
287
316
  * @license
288
317
  * Copyright 2019 Google LLC
289
318
  *
@@ -298,7 +327,7 @@ import{x as zf,_ as wo,z as Ht,k as Gf,y as Wf}from"./index-DxqO1ZJV.js";import{
298
327
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
299
328
  * See the License for the specific language governing permissions and
300
329
  * limitations under the License.
301
- */const nn=nm;function am(n,e={}){let t=n;typeof e!="object"&&(e={name:e});const r=Object.assign({name:Zi,automaticDataCollectionEnabled:!1},e),s=r.name;if(typeof s!="string"||!s)throw Rt.create("bad-app-name",{appName:String(s)});if(t||(t=ml()),!t)throw Rt.create("no-options");const i=Is.get(s);if(i){if(Qt(t,i.options)&&Qt(r,i.config))return i;throw Rt.create("duplicate-app",{appName:s})}const a=new wp(s);for(const l of eo.values())a.addComponent(l);const c=new om(t,r,a);return Is.set(s,c),c}function Gs(n=Zi){const e=Is.get(n);if(!e&&n===Zi&&ml())return am();if(!e)throw Rt.create("no-app",{appName:n});return e}function qe(n,e,t){var r;let s=(r=rm[n])!==null&&r!==void 0?r:n;t&&(s+=`-${t}`);const i=s.match(/\s|\//),a=e.match(/\s|\//);if(i||a){const c=[`Unable to register library "${s}" with version "${e}":`];i&&c.push(`library name "${s}" contains illegal characters (whitespace or "/")`),i&&a&&c.push("and"),a&&c.push(`version name "${e}" contains illegal characters (whitespace or "/")`),lt.warn(c.join(" "));return}St(new ut(`${s}-version`,()=>({library:s,version:e}),"VERSION"))}/**
330
+ */const sn=hm;function gm(n,e={}){let t=n;typeof e!="object"&&(e={name:e});const r=Object.assign({name:ro,automaticDataCollectionEnabled:!0},e),s=r.name;if(typeof s!="string"||!s)throw Rt.create("bad-app-name",{appName:String(s)});if(t||(t=vl()),!t)throw Rt.create("no-options");const i=Rs.get(s);if(i){if(Yt(t,i.options)&&Yt(r,i.config))return i;throw Rt.create("duplicate-app",{appName:s})}const a=new Dp(s);for(const l of so.values())a.addComponent(l);const c=new mm(t,r,a);return Rs.set(s,c),c}function Xs(n=ro){const e=Rs.get(n);if(!e&&n===ro&&vl())return gm();if(!e)throw Rt.create("no-app",{appName:n});return e}function qe(n,e,t){var r;let s=(r=dm[n])!==null&&r!==void 0?r:n;t&&(s+=`-${t}`);const i=s.match(/\s|\//),a=e.match(/\s|\//);if(i||a){const c=[`Unable to register library "${s}" with version "${e}":`];i&&c.push(`library name "${s}" contains illegal characters (whitespace or "/")`),i&&a&&c.push("and"),a&&c.push(`version name "${e}" contains illegal characters (whitespace or "/")`),lt.warn(c.join(" "));return}St(new ut(`${s}-version`,()=>({library:s,version:e}),"VERSION"))}/**
302
331
  * @license
303
332
  * Copyright 2021 Google LLC
304
333
  *
@@ -313,7 +342,7 @@ import{x as zf,_ as wo,z as Ht,k as Gf,y as Wf}from"./index-DxqO1ZJV.js";import{
313
342
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
314
343
  * See the License for the specific language governing permissions and
315
344
  * limitations under the License.
316
- */const cm="firebase-heartbeat-database",um=1,mr="firebase-heartbeat-store";let $i=null;function yl(){return $i||($i=zf(cm,um,{upgrade:(n,e)=>{switch(e){case 0:try{n.createObjectStore(mr)}catch(t){console.warn(t)}}}}).catch(n=>{throw Rt.create("idb-open",{originalErrorMessage:n.message})})),$i}async function lm(n){try{const t=(await yl()).transaction(mr),r=await t.objectStore(mr).get(Tl(n));return await t.done,r}catch(e){if(e instanceof He)lt.warn(e.message);else{const t=Rt.create("idb-get",{originalErrorMessage:e==null?void 0:e.message});lt.warn(t.message)}}}async function Vc(n,e){try{const r=(await yl()).transaction(mr,"readwrite");await r.objectStore(mr).put(e,Tl(n)),await r.done}catch(t){if(t instanceof He)lt.warn(t.message);else{const r=Rt.create("idb-set",{originalErrorMessage:t==null?void 0:t.message});lt.warn(r.message)}}}function Tl(n){return`${n.name}!${n.options.appId}`}/**
345
+ */const _m="firebase-heartbeat-database",ym=1,yr="firebase-heartbeat-store";let Gi=null;function Al(){return Gi||(Gi=Jf(_m,ym,{upgrade:(n,e)=>{switch(e){case 0:try{n.createObjectStore(yr)}catch(t){console.warn(t)}}}}).catch(n=>{throw Rt.create("idb-open",{originalErrorMessage:n.message})})),Gi}async function Em(n){try{const t=(await Al()).transaction(yr),r=await t.objectStore(yr).get(Rl(n));return await t.done,r}catch(e){if(e instanceof ze)lt.warn(e.message);else{const t=Rt.create("idb-get",{originalErrorMessage:e==null?void 0:e.message});lt.warn(t.message)}}}async function Fc(n,e){try{const r=(await Al()).transaction(yr,"readwrite");await r.objectStore(yr).put(e,Rl(n)),await r.done}catch(t){if(t instanceof ze)lt.warn(t.message);else{const r=Rt.create("idb-set",{originalErrorMessage:t==null?void 0:t.message});lt.warn(r.message)}}}function Rl(n){return`${n.name}!${n.options.appId}`}/**
317
346
  * @license
318
347
  * Copyright 2021 Google LLC
319
348
  *
@@ -328,7 +357,7 @@ import{x as zf,_ as wo,z as Ht,k as Gf,y as Wf}from"./index-DxqO1ZJV.js";import{
328
357
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
329
358
  * See the License for the specific language governing permissions and
330
359
  * limitations under the License.
331
- */const hm=1024,dm=30;class fm{constructor(e){this.container=e,this._heartbeatsCache=null;const t=this.container.getProvider("app").getImmediate();this._storage=new mm(t),this._heartbeatsCachePromise=this._storage.read().then(r=>(this._heartbeatsCache=r,r))}async triggerHeartbeat(){var e,t;try{const s=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),i=Lc();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(a=>a.date===i))return;if(this._heartbeatsCache.heartbeats.push({date:i,agent:s}),this._heartbeatsCache.heartbeats.length>dm){const a=gm(this._heartbeatsCache.heartbeats);this._heartbeatsCache.heartbeats.splice(a,1)}return this._storage.overwrite(this._heartbeatsCache)}catch(r){lt.warn(r)}}async getHeartbeatsHeader(){var e;try{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=Lc(),{heartbeatsToSend:r,unsentEntries:s}=pm(this._heartbeatsCache.heartbeats),i=vs(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}catch(t){return lt.warn(t),""}}}function Lc(){return new Date().toISOString().substring(0,10)}function pm(n,e=hm){const t=[];let r=n.slice();for(const s of n){const i=t.find(a=>a.agent===s.agent);if(i){if(i.dates.push(s.date),Mc(t)>e){i.dates.pop();break}}else if(t.push({agent:s.agent,dates:[s.date]}),Mc(t)>e){t.pop();break}r=r.slice(1)}return{heartbeatsToSend:t,unsentEntries:r}}class mm{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return hp()?dp().then(()=>!0).catch(()=>!1):!1}async read(){if(await this._canUseIndexedDBPromise){const t=await lm(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 Vc(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 Vc(this.app,{lastSentHeartbeatDate:(t=e.lastSentHeartbeatDate)!==null&&t!==void 0?t:s.lastSentHeartbeatDate,heartbeats:[...s.heartbeats,...e.heartbeats]})}else return}}function Mc(n){return vs(JSON.stringify({version:2,heartbeats:n})).length}function gm(n){if(n.length===0)return-1;let e=0,t=n[0].date;for(let r=1;r<n.length;r++)n[r].date<t&&(t=n[r].date,e=r);return e}/**
360
+ */const Tm=1024,vm=30;class Im{constructor(e){this.container=e,this._heartbeatsCache=null;const t=this.container.getProvider("app").getImmediate();this._storage=new Am(t),this._heartbeatsCachePromise=this._storage.read().then(r=>(this._heartbeatsCache=r,r))}async triggerHeartbeat(){var e,t;try{const s=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),i=Bc();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(a=>a.date===i))return;if(this._heartbeatsCache.heartbeats.push({date:i,agent:s}),this._heartbeatsCache.heartbeats.length>vm){const a=Rm(this._heartbeatsCache.heartbeats);this._heartbeatsCache.heartbeats.splice(a,1)}return this._storage.overwrite(this._heartbeatsCache)}catch(r){lt.warn(r)}}async getHeartbeatsHeader(){var e;try{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=Bc(),{heartbeatsToSend:r,unsentEntries:s}=wm(this._heartbeatsCache.heartbeats),i=As(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}catch(t){return lt.warn(t),""}}}function Bc(){return new Date().toISOString().substring(0,10)}function wm(n,e=Tm){const t=[];let r=n.slice();for(const s of n){const i=t.find(a=>a.agent===s.agent);if(i){if(i.dates.push(s.date),qc(t)>e){i.dates.pop();break}}else if(t.push({agent:s.agent,dates:[s.date]}),qc(t)>e){t.pop();break}r=r.slice(1)}return{heartbeatsToSend:t,unsentEntries:r}}class Am{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return Tp()?vp().then(()=>!0).catch(()=>!1):!1}async read(){if(await this._canUseIndexedDBPromise){const t=await Em(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 Fc(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 Fc(this.app,{lastSentHeartbeatDate:(t=e.lastSentHeartbeatDate)!==null&&t!==void 0?t:s.lastSentHeartbeatDate,heartbeats:[...s.heartbeats,...e.heartbeats]})}else return}}function qc(n){return As(JSON.stringify({version:2,heartbeats:n})).length}function Rm(n){if(n.length===0)return-1;let e=0,t=n[0].date;for(let r=1;r<n.length;r++)n[r].date<t&&(t=n[r].date,e=r);return e}/**
332
361
  * @license
333
362
  * Copyright 2019 Google LLC
334
363
  *
@@ -343,7 +372,7 @@ import{x as zf,_ as wo,z as Ht,k as Gf,y as Wf}from"./index-DxqO1ZJV.js";import{
343
372
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
344
373
  * See the License for the specific language governing permissions and
345
374
  * limitations under the License.
346
- */function _m(n){St(new ut("platform-logger",e=>new Sp(e),"PRIVATE")),St(new ut("heartbeat",e=>new fm(e),"PRIVATE")),qe(Yi,Dc,n),qe(Yi,Dc,"esm2017"),qe("fire-js","")}_m("");/**
375
+ */function bm(n){St(new ut("platform-logger",e=>new Mp(e),"PRIVATE")),St(new ut("heartbeat",e=>new Im(e),"PRIVATE")),qe(no,Mc,n),qe(no,Mc,"esm2017"),qe("fire-js","")}bm("");/**
347
376
  * @license
348
377
  * Copyright 2017 Google LLC
349
378
  *
@@ -358,7 +387,7 @@ import{x as zf,_ as wo,z as Ht,k as Gf,y as Wf}from"./index-DxqO1ZJV.js";import{
358
387
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
359
388
  * See the License for the specific language governing permissions and
360
389
  * limitations under the License.
361
- */const ym="type.googleapis.com/google.protobuf.Int64Value",Tm="type.googleapis.com/google.protobuf.UInt64Value";function El(n,e){const t={};for(const r in n)n.hasOwnProperty(r)&&(t[r]=e(n[r]));return t}function ws(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=>ws(e));if(typeof n=="function"||typeof n=="object")return El(n,e=>ws(e));throw new Error("Data cannot be encoded in JSON: "+n)}function An(n){if(n==null)return n;if(n["@type"])switch(n["@type"]){case ym:case Tm:{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=>An(e)):typeof n=="function"||typeof n=="object"?El(n,e=>An(e)):n}/**
390
+ */const Pm="type.googleapis.com/google.protobuf.Int64Value",Sm="type.googleapis.com/google.protobuf.UInt64Value";function bl(n,e){const t={};for(const r in n)n.hasOwnProperty(r)&&(t[r]=e(n[r]));return t}function bs(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=>bs(e));if(typeof n=="function"||typeof n=="object")return bl(n,e=>bs(e));throw new Error("Data cannot be encoded in JSON: "+n)}function bn(n){if(n==null)return n;if(n["@type"])switch(n["@type"]){case Pm:case Sm:{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=>bn(e)):typeof n=="function"||typeof n=="object"?bl(n,e=>bn(e)):n}/**
362
391
  * @license
363
392
  * Copyright 2020 Google LLC
364
393
  *
@@ -373,7 +402,7 @@ import{x as zf,_ as wo,z as Ht,k as Gf,y as Wf}from"./index-DxqO1ZJV.js";import{
373
402
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
374
403
  * See the License for the specific language governing permissions and
375
404
  * limitations under the License.
376
- */const bo="functions";/**
405
+ */const ko="functions";/**
377
406
  * @license
378
407
  * Copyright 2017 Google LLC
379
408
  *
@@ -388,7 +417,7 @@ import{x as zf,_ as wo,z as Ht,k as Gf,y as Wf}from"./index-DxqO1ZJV.js";import{
388
417
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
389
418
  * See the License for the specific language governing permissions and
390
419
  * limitations under the License.
391
- */const xc={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 Ne extends He{constructor(e,t,r){super(`${bo}/${e}`,t||""),this.details=r,Object.setPrototypeOf(this,Ne.prototype)}}function Em(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 As(n,e){let t=Em(n),r=t,s;try{const i=e&&e.error;if(i){const a=i.status;if(typeof a=="string"){if(!xc[a])return new Ne("internal","internal");t=xc[a],r=a}const c=i.message;typeof c=="string"&&(r=c),s=i.details,s!==void 0&&(s=An(s))}}catch{}return t==="ok"?null:new Ne(t,r,s)}/**
420
+ */const jc={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 Ne extends ze{constructor(e,t,r){super(`${ko}/${e}`,t||""),this.details=r,Object.setPrototypeOf(this,Ne.prototype)}}function Cm(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 Ps(n,e){let t=Cm(n),r=t,s;try{const i=e&&e.error;if(i){const a=i.status;if(typeof a=="string"){if(!jc[a])return new Ne("internal","internal");t=jc[a],r=a}const c=i.message;typeof c=="string"&&(r=c),s=i.details,s!==void 0&&(s=bn(s))}}catch{}return t==="ok"?null:new Ne(t,r,s)}/**
392
421
  * @license
393
422
  * Copyright 2017 Google LLC
394
423
  *
@@ -403,7 +432,7 @@ import{x as zf,_ as wo,z as Ht,k as Gf,y as Wf}from"./index-DxqO1ZJV.js";import{
403
432
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
404
433
  * See the License for the specific language governing permissions and
405
434
  * limitations under the License.
406
- */class vm{constructor(e,t,r,s){this.app=e,this.auth=null,this.messaging=null,this.appCheck=null,this.serverAppAppCheckToken=null,Pe(e)&&e.settings.appCheckToken&&(this.serverAppAppCheckToken=e.settings.appCheckToken),this.auth=t.getImmediate({optional:!0}),this.messaging=r.getImmediate({optional:!0}),this.auth||t.get().then(i=>this.auth=i,()=>{}),this.messaging||r.get().then(i=>this.messaging=i,()=>{}),this.appCheck||s==null||s.get().then(i=>this.appCheck=i,()=>{})}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.serverAppAppCheckToken)return this.serverAppAppCheckToken;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}}}/**
435
+ */class km{constructor(e,t,r,s){this.app=e,this.auth=null,this.messaging=null,this.appCheck=null,this.serverAppAppCheckToken=null,Pe(e)&&e.settings.appCheckToken&&(this.serverAppAppCheckToken=e.settings.appCheckToken),this.auth=t.getImmediate({optional:!0}),this.messaging=r.getImmediate({optional:!0}),this.auth||t.get().then(i=>this.auth=i,()=>{}),this.messaging||r.get().then(i=>this.messaging=i,()=>{}),this.appCheck||s==null||s.get().then(i=>this.appCheck=i,()=>{})}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.serverAppAppCheckToken)return this.serverAppAppCheckToken;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}}}/**
407
436
  * @license
408
437
  * Copyright 2017 Google LLC
409
438
  *
@@ -418,8 +447,8 @@ import{x as zf,_ as wo,z as Ht,k as Gf,y as Wf}from"./index-DxqO1ZJV.js";import{
418
447
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
419
448
  * See the License for the specific language governing permissions and
420
449
  * limitations under the License.
421
- */const to="us-central1",Im=/^data: (.*?)(?:\n|$)/;function wm(n){let e=null;return{promise:new Promise((t,r)=>{e=setTimeout(()=>{r(new Ne("deadline-exceeded","deadline-exceeded"))},n)}),cancel:()=>{e&&clearTimeout(e)}}}class Am{constructor(e,t,r,s,i=to,a=(...c)=>fetch(...c)){this.app=e,this.fetchImpl=a,this.emulatorOrigin=null,this.contextProvider=new vm(e,t,r,s),this.cancelAllRequests=new Promise(c=>{this.deleteService=()=>Promise.resolve(c())});try{const c=new URL(i);this.customDomain=c.origin+(c.pathname==="/"?"":c.pathname),this.region=to}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 Rm(n,e,t){n.emulatorOrigin=`http://${e}:${t}`}function bm(n,e,t){const r=s=>Sm(n,e,s,{});return r.stream=(s,i)=>km(n,e,s,i),r}async function Pm(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}}async function vl(n,e){const t={},r=await n.contextProvider.getContext(e.limitedUseAppCheckTokens);return r.authToken&&(t.Authorization="Bearer "+r.authToken),r.messagingToken&&(t["Firebase-Instance-ID-Token"]=r.messagingToken),r.appCheckToken!==null&&(t["X-Firebase-AppCheck"]=r.appCheckToken),t}function Sm(n,e,t,r){const s=n._url(e);return Cm(n,s,t,r)}async function Cm(n,e,t,r){t=ws(t);const s={data:t},i=await vl(n,r),a=r.timeout||7e4,c=wm(a),l=await Promise.race([Pm(e,s,i,n.fetchImpl),c.promise,n.cancelAllRequests]);if(c.cancel(),!l)throw new Ne("cancelled","Firebase Functions instance was deleted.");const d=As(l.status,l.json);if(d)throw d;if(!l.json)throw new Ne("internal","Response is not valid JSON object.");let f=l.json.data;if(typeof f>"u"&&(f=l.json.result),typeof f>"u")throw new Ne("internal","Response is missing data field.");return{data:An(f)}}function km(n,e,t,r){const s=n._url(e);return Nm(n,s,t,r||{})}async function Nm(n,e,t,r){var s;t=ws(t);const i={data:t},a=await vl(n,r);a["Content-Type"]="application/json",a.Accept="text/event-stream";let c;try{c=await n.fetchImpl(e,{method:"POST",body:JSON.stringify(i),headers:a,signal:r==null?void 0:r.signal})}catch(R){if(R instanceof Error&&R.name==="AbortError"){const N=new Ne("cancelled","Request was cancelled.");return{data:Promise.reject(N),stream:{[Symbol.asyncIterator](){return{next(){return Promise.reject(N)}}}}}}const C=As(0,null);return{data:Promise.reject(C),stream:{[Symbol.asyncIterator](){return{next(){return Promise.reject(C)}}}}}}let l,d;const f=new Promise((R,C)=>{l=R,d=C});(s=r==null?void 0:r.signal)===null||s===void 0||s.addEventListener("abort",()=>{const R=new Ne("cancelled","Request was cancelled.");d(R)});const m=c.body.getReader(),E=Dm(m,l,d,r==null?void 0:r.signal);return{stream:{[Symbol.asyncIterator](){const R=E.getReader();return{async next(){const{value:C,done:N}=await R.read();return{value:C,done:N}},async return(){return await R.cancel(),{done:!0,value:void 0}}}}},data:f}}function Dm(n,e,t,r){const s=(a,c)=>{const l=a.match(Im);if(!l)return;const d=l[1];try{const f=JSON.parse(d);if("result"in f){e(An(f.result));return}if("message"in f){c.enqueue(An(f.message));return}if("error"in f){const m=As(0,f);c.error(m),t(m);return}}catch(f){if(f instanceof Ne){c.error(f),t(f);return}}},i=new TextDecoder;return new ReadableStream({start(a){let c="";return l();async function l(){if(r!=null&&r.aborted){const d=new Ne("cancelled","Request was cancelled");return a.error(d),t(d),Promise.resolve()}try{const{value:d,done:f}=await n.read();if(f){c.trim()&&s(c.trim(),a),a.close();return}if(r!=null&&r.aborted){const E=new Ne("cancelled","Request was cancelled");a.error(E),t(E),await n.cancel();return}c+=i.decode(d,{stream:!0});const m=c.split(`
422
- `);c=m.pop()||"";for(const E of m)E.trim()&&s(E.trim(),a);return l()}catch(d){const f=d instanceof Ne?d:As(0,null);a.error(f),t(f)}}},cancel(){return n.cancel()}})}const Uc="@firebase/functions",Fc="0.12.3";/**
450
+ */const io="us-central1",Nm=/^data: (.*?)(?:\n|$)/;function Dm(n){let e=null;return{promise:new Promise((t,r)=>{e=setTimeout(()=>{r(new Ne("deadline-exceeded","deadline-exceeded"))},n)}),cancel:()=>{e&&clearTimeout(e)}}}class Vm{constructor(e,t,r,s,i=io,a=(...c)=>fetch(...c)){this.app=e,this.fetchImpl=a,this.emulatorOrigin=null,this.contextProvider=new km(e,t,r,s),this.cancelAllRequests=new Promise(c=>{this.deleteService=()=>Promise.resolve(c())});try{const c=new URL(i);this.customDomain=c.origin+(c.pathname==="/"?"":c.pathname),this.region=io}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 Om(n,e,t){const r=Lt(e);n.emulatorOrigin=`http${r?"s":""}://${e}:${t}`,r&&(Qs(n.emulatorOrigin),xt("Functions",!0))}function Lm(n,e,t){const r=s=>Mm(n,e,s,{});return r.stream=(s,i)=>Fm(n,e,s,i),r}async function xm(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}}async function Pl(n,e){const t={},r=await n.contextProvider.getContext(e.limitedUseAppCheckTokens);return r.authToken&&(t.Authorization="Bearer "+r.authToken),r.messagingToken&&(t["Firebase-Instance-ID-Token"]=r.messagingToken),r.appCheckToken!==null&&(t["X-Firebase-AppCheck"]=r.appCheckToken),t}function Mm(n,e,t,r){const s=n._url(e);return Um(n,s,t,r)}async function Um(n,e,t,r){t=bs(t);const s={data:t},i=await Pl(n,r),a=r.timeout||7e4,c=Dm(a),l=await Promise.race([xm(e,s,i,n.fetchImpl),c.promise,n.cancelAllRequests]);if(c.cancel(),!l)throw new Ne("cancelled","Firebase Functions instance was deleted.");const d=Ps(l.status,l.json);if(d)throw d;if(!l.json)throw new Ne("internal","Response is not valid JSON object.");let f=l.json.data;if(typeof f>"u"&&(f=l.json.result),typeof f>"u")throw new Ne("internal","Response is missing data field.");return{data:bn(f)}}function Fm(n,e,t,r){const s=n._url(e);return Bm(n,s,t,r||{})}async function Bm(n,e,t,r){var s;t=bs(t);const i={data:t},a=await Pl(n,r);a["Content-Type"]="application/json",a.Accept="text/event-stream";let c;try{c=await n.fetchImpl(e,{method:"POST",body:JSON.stringify(i),headers:a,signal:r==null?void 0:r.signal})}catch(R){if(R instanceof Error&&R.name==="AbortError"){const N=new Ne("cancelled","Request was cancelled.");return{data:Promise.reject(N),stream:{[Symbol.asyncIterator](){return{next(){return Promise.reject(N)}}}}}}const S=Ps(0,null);return{data:Promise.reject(S),stream:{[Symbol.asyncIterator](){return{next(){return Promise.reject(S)}}}}}}let l,d;const f=new Promise((R,S)=>{l=R,d=S});(s=r==null?void 0:r.signal)===null||s===void 0||s.addEventListener("abort",()=>{const R=new Ne("cancelled","Request was cancelled.");d(R)});const m=c.body.getReader(),_=qm(m,l,d,r==null?void 0:r.signal);return{stream:{[Symbol.asyncIterator](){const R=_.getReader();return{async next(){const{value:S,done:N}=await R.read();return{value:S,done:N}},async return(){return await R.cancel(),{done:!0,value:void 0}}}}},data:f}}function qm(n,e,t,r){const s=(a,c)=>{const l=a.match(Nm);if(!l)return;const d=l[1];try{const f=JSON.parse(d);if("result"in f){e(bn(f.result));return}if("message"in f){c.enqueue(bn(f.message));return}if("error"in f){const m=Ps(0,f);c.error(m),t(m);return}}catch(f){if(f instanceof Ne){c.error(f),t(f);return}}},i=new TextDecoder;return new ReadableStream({start(a){let c="";return l();async function l(){if(r!=null&&r.aborted){const d=new Ne("cancelled","Request was cancelled");return a.error(d),t(d),Promise.resolve()}try{const{value:d,done:f}=await n.read();if(f){c.trim()&&s(c.trim(),a),a.close();return}if(r!=null&&r.aborted){const _=new Ne("cancelled","Request was cancelled");a.error(_),t(_),await n.cancel();return}c+=i.decode(d,{stream:!0});const m=c.split(`
451
+ `);c=m.pop()||"";for(const _ of m)_.trim()&&s(_.trim(),a);return l()}catch(d){const f=d instanceof Ne?d:Ps(0,null);a.error(f),t(f)}}},cancel(){return n.cancel()}})}const $c="@firebase/functions",zc="0.12.7";/**
423
452
  * @license
424
453
  * Copyright 2019 Google LLC
425
454
  *
@@ -434,7 +463,7 @@ import{x as zf,_ as wo,z as Ht,k as Gf,y as Wf}from"./index-DxqO1ZJV.js";import{
434
463
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
435
464
  * See the License for the specific language governing permissions and
436
465
  * limitations under the License.
437
- */const Om="auth-internal",Vm="app-check-internal",Lm="messaging-internal";function Mm(n){const e=(t,{instanceIdentifier:r})=>{const s=t.getProvider("app").getImmediate(),i=t.getProvider(Om),a=t.getProvider(Lm),c=t.getProvider(Vm);return new Am(s,i,a,c,r)};St(new ut(bo,e,"PUBLIC").setMultipleInstances(!0)),qe(Uc,Fc,n),qe(Uc,Fc,"esm2017")}/**
466
+ */const jm="auth-internal",$m="app-check-internal",zm="messaging-internal";function Hm(n){const e=(t,{instanceIdentifier:r})=>{const s=t.getProvider("app").getImmediate(),i=t.getProvider(jm),a=t.getProvider(zm),c=t.getProvider($m);return new Vm(s,i,a,c,r)};St(new ut(ko,e,"PUBLIC").setMultipleInstances(!0)),qe($c,zc,n),qe($c,zc,"esm2017")}/**
438
467
  * @license
439
468
  * Copyright 2020 Google LLC
440
469
  *
@@ -449,7 +478,7 @@ import{x as zf,_ as wo,z as Ht,k as Gf,y as Wf}from"./index-DxqO1ZJV.js";import{
449
478
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
450
479
  * See the License for the specific language governing permissions and
451
480
  * limitations under the License.
452
- */function xm(n=Gs(),e=to){const r=Pr(Z(n),bo).getImmediate({identifier:e}),s=Ao("functions");return s&&Um(r,...s),r}function Um(n,e,t){Rm(Z(n),e,t)}function Fm(n,e,t){return bm(Z(n),e)}Mm();function Il(){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 Bm=Il,wl=new Rr("auth","Firebase",Il());/**
481
+ */function Gm(n=Xs(),e=io){xt("Functions",!1);const r=kr(Z(n),ko).getImmediate({identifier:e}),s=So("functions");return s&&Wm(r,...s),r}function Wm(n,e,t){Om(Z(n),e,t)}function Km(n,e,t){return Lm(Z(n),e)}Hm();function Sl(){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 Qm=Sl,Cl=new Sr("auth","Firebase",Sl());/**
453
482
  * @license
454
483
  * Copyright 2020 Google LLC
455
484
  *
@@ -464,7 +493,7 @@ import{x as zf,_ as wo,z as Ht,k as Gf,y as Wf}from"./index-DxqO1ZJV.js";import{
464
493
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
465
494
  * See the License for the specific language governing permissions and
466
495
  * limitations under the License.
467
- */const Rs=new Ro("@firebase/auth");function qm(n,...e){Rs.logLevel<=z.WARN&&Rs.warn(`Auth (${nn}): ${n}`,...e)}function hs(n,...e){Rs.logLevel<=z.ERROR&&Rs.error(`Auth (${nn}): ${n}`,...e)}/**
496
+ */const Ss=new Co("@firebase/auth");function Xm(n,...e){Ss.logLevel<=H.WARN&&Ss.warn(`Auth (${sn}): ${n}`,...e)}function ps(n,...e){Ss.logLevel<=H.ERROR&&Ss.error(`Auth (${sn}): ${n}`,...e)}/**
468
497
  * @license
469
498
  * Copyright 2020 Google LLC
470
499
  *
@@ -479,7 +508,7 @@ import{x as zf,_ as wo,z as Ht,k as Gf,y as Wf}from"./index-DxqO1ZJV.js";import{
479
508
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
480
509
  * See the License for the specific language governing permissions and
481
510
  * limitations under the License.
482
- */function Me(n,...e){throw So(n,...e)}function $e(n,...e){return So(n,...e)}function Po(n,e,t){const r=Object.assign(Object.assign({},Bm()),{[e]:t});return new Rr("auth","Firebase",r).create(e,{appName:n.name})}function ot(n){return Po(n,"operation-not-supported-in-this-environment","Operations that alter the current user are not supported in conjunction with FirebaseServerApp")}function $m(n,e,t){const r=t;if(!(e instanceof r))throw r.name!==e.constructor.name&&Me(n,"argument-error"),Po(n,"argument-error",`Type of ${e.constructor.name} does not match expected instance.Did you pass a reference from a different Auth SDK?`)}function So(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 wl.create(n,...e)}function x(n,e,...t){if(!n)throw So(e,...t)}function st(n){const e="INTERNAL ASSERTION FAILED: "+n;throw hs(e),new Error(e)}function ht(n,e){n||st(e)}/**
511
+ */function xe(n,...e){throw Do(n,...e)}function je(n,...e){return Do(n,...e)}function No(n,e,t){const r=Object.assign(Object.assign({},Qm()),{[e]:t});return new Sr("auth","Firebase",r).create(e,{appName:n.name})}function ot(n){return No(n,"operation-not-supported-in-this-environment","Operations that alter the current user are not supported in conjunction with FirebaseServerApp")}function Ym(n,e,t){const r=t;if(!(e instanceof r))throw r.name!==e.constructor.name&&xe(n,"argument-error"),No(n,"argument-error",`Type of ${e.constructor.name} does not match expected instance.Did you pass a reference from a different Auth SDK?`)}function Do(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 Cl.create(n,...e)}function U(n,e,...t){if(!n)throw Do(e,...t)}function st(n){const e="INTERNAL ASSERTION FAILED: "+n;throw ps(e),new Error(e)}function ht(n,e){n||st(e)}/**
483
512
  * @license
484
513
  * Copyright 2020 Google LLC
485
514
  *
@@ -494,7 +523,7 @@ import{x as zf,_ as wo,z as Ht,k as Gf,y as Wf}from"./index-DxqO1ZJV.js";import{
494
523
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
495
524
  * See the License for the specific language governing permissions and
496
525
  * limitations under the License.
497
- */function no(){var n;return typeof self<"u"&&((n=self.location)===null||n===void 0?void 0:n.href)||""}function jm(){return Bc()==="http:"||Bc()==="https:"}function Bc(){var n;return typeof self<"u"&&((n=self.location)===null||n===void 0?void 0:n.protocol)||null}/**
526
+ */function oo(){var n;return typeof self<"u"&&((n=self.location)===null||n===void 0?void 0:n.href)||""}function Jm(){return Hc()==="http:"||Hc()==="https:"}function Hc(){var n;return typeof self<"u"&&((n=self.location)===null||n===void 0?void 0:n.protocol)||null}/**
498
527
  * @license
499
528
  * Copyright 2020 Google LLC
500
529
  *
@@ -509,7 +538,7 @@ import{x as zf,_ as wo,z as Ht,k as Gf,y as Wf}from"./index-DxqO1ZJV.js";import{
509
538
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
510
539
  * See the License for the specific language governing permissions and
511
540
  * limitations under the License.
512
- */function Hm(){return typeof navigator<"u"&&navigator&&"onLine"in navigator&&typeof navigator.onLine=="boolean"&&(jm()||ap()||"connection"in navigator)?navigator.onLine:!0}function zm(){if(typeof navigator>"u")return null;const n=navigator;return n.languages&&n.languages[0]||n.language||null}/**
541
+ */function Zm(){return typeof navigator<"u"&&navigator&&"onLine"in navigator&&typeof navigator.onLine=="boolean"&&(Jm()||gp()||"connection"in navigator)?navigator.onLine:!0}function eg(){if(typeof navigator>"u")return null;const n=navigator;return n.languages&&n.languages[0]||n.language||null}/**
513
542
  * @license
514
543
  * Copyright 2020 Google LLC
515
544
  *
@@ -524,7 +553,7 @@ import{x as zf,_ as wo,z as Ht,k as Gf,y as Wf}from"./index-DxqO1ZJV.js";import{
524
553
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
525
554
  * See the License for the specific language governing permissions and
526
555
  * limitations under the License.
527
- */class Sr{constructor(e,t){this.shortDelay=e,this.longDelay=t,ht(t>e,"Short delay should be less than long delay!"),this.isMobile=sp()||cp()}get(){return Hm()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}}/**
556
+ */class Nr{constructor(e,t){this.shortDelay=e,this.longDelay=t,ht(t>e,"Short delay should be less than long delay!"),this.isMobile=fp()||_p()}get(){return Zm()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}}/**
528
557
  * @license
529
558
  * Copyright 2020 Google LLC
530
559
  *
@@ -539,7 +568,7 @@ import{x as zf,_ as wo,z as Ht,k as Gf,y as Wf}from"./index-DxqO1ZJV.js";import{
539
568
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
540
569
  * See the License for the specific language governing permissions and
541
570
  * limitations under the License.
542
- */function Co(n,e){ht(n.emulator,"Emulator should always be set here");const{url:t}=n.emulator;return e?`${t}${e.startsWith("/")?e.slice(1):e}`:t}/**
571
+ */function Vo(n,e){ht(n.emulator,"Emulator should always be set here");const{url:t}=n.emulator;return e?`${t}${e.startsWith("/")?e.slice(1):e}`:t}/**
543
572
  * @license
544
573
  * Copyright 2020 Google LLC
545
574
  *
@@ -554,7 +583,7 @@ import{x as zf,_ as wo,z as Ht,k as Gf,y as Wf}from"./index-DxqO1ZJV.js";import{
554
583
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
555
584
  * See the License for the specific language governing permissions and
556
585
  * limitations under the License.
557
- */class Al{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")}}/**
586
+ */class kl{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")}}/**
558
587
  * @license
559
588
  * Copyright 2020 Google LLC
560
589
  *
@@ -569,7 +598,7 @@ import{x as zf,_ as wo,z as Ht,k as Gf,y as Wf}from"./index-DxqO1ZJV.js";import{
569
598
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
570
599
  * See the License for the specific language governing permissions and
571
600
  * limitations under the License.
572
- */const Gm={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"};/**
601
+ */const tg={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"};/**
573
602
  * @license
574
603
  * Copyright 2020 Google LLC
575
604
  *
@@ -584,7 +613,7 @@ import{x as zf,_ as wo,z as Ht,k as Gf,y as Wf}from"./index-DxqO1ZJV.js";import{
584
613
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
585
614
  * See the License for the specific language governing permissions and
586
615
  * limitations under the License.
587
- */const Wm=["/v1/accounts:signInWithCustomToken","/v1/accounts:signInWithEmailLink","/v1/accounts:signInWithIdp","/v1/accounts:signInWithPassword","/v1/accounts:signInWithPhoneNumber","/v1/token"],Km=new Sr(3e4,6e4);function Lt(n,e){return n.tenantId&&!e.tenantId?Object.assign(Object.assign({},e),{tenantId:n.tenantId}):e}async function Mt(n,e,t,r,s={}){return Rl(n,s,async()=>{let i={},a={};r&&(e==="GET"?a=r:i={body:JSON.stringify(r)});const c=br(Object.assign({key:n.config.apiKey},a)).slice(1),l=await n._getAdditionalHeaders();l["Content-Type"]="application/json",n.languageCode&&(l["X-Firebase-Locale"]=n.languageCode);const d=Object.assign({method:e,headers:l},i);return op()||(d.referrerPolicy="no-referrer"),Al.fetch()(await bl(n,n.config.apiHost,t,c),d)})}async function Rl(n,e,t){n._canInitEmulator=!1;const r=Object.assign(Object.assign({},Gm),e);try{const s=new Xm(n),i=await Promise.race([t(),s.promise]);s.clearNetworkTimeout();const a=await i.json();if("needConfirmation"in a)throw rs(n,"account-exists-with-different-credential",a);if(i.ok&&!("errorMessage"in a))return a;{const c=i.ok?a.errorMessage:a.error.message,[l,d]=c.split(" : ");if(l==="FEDERATED_USER_ID_ALREADY_LINKED")throw rs(n,"credential-already-in-use",a);if(l==="EMAIL_EXISTS")throw rs(n,"email-already-in-use",a);if(l==="USER_DISABLED")throw rs(n,"user-disabled",a);const f=r[l]||l.toLowerCase().replace(/[_\s]+/g,"-");if(d)throw Po(n,f,d);Me(n,f)}}catch(s){if(s instanceof He)throw s;Me(n,"network-request-failed",{message:String(s)})}}async function Cr(n,e,t,r,s={}){const i=await Mt(n,e,t,r,s);return"mfaPendingCredential"in i&&Me(n,"multi-factor-auth-required",{_serverResponse:i}),i}async function bl(n,e,t,r){const s=`${e}${t}?${r}`,i=n,a=i.config.emulator?Co(n.config,s):`${n.config.apiScheme}://${s}`;return Wm.includes(t)&&(await i._persistenceManagerAvailable,i._getPersistenceType()==="COOKIE")?i._getPersistence()._getFinalTarget(a).toString():a}function Qm(n){switch(n){case"ENFORCE":return"ENFORCE";case"AUDIT":return"AUDIT";case"OFF":return"OFF";default:return"ENFORCEMENT_STATE_UNSPECIFIED"}}class Xm{clearNetworkTimeout(){clearTimeout(this.timer)}constructor(e){this.auth=e,this.timer=null,this.promise=new Promise((t,r)=>{this.timer=setTimeout(()=>r($e(this.auth,"network-request-failed")),Km.get())})}}function rs(n,e,t){const r={appName:n.name};t.email&&(r.email=t.email),t.phoneNumber&&(r.phoneNumber=t.phoneNumber);const s=$e(n,e,r);return s.customData._tokenResponse=t,s}function qc(n){return n!==void 0&&n.enterprise!==void 0}class Jm{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 Qm(t.enforcementState);return null}isProviderEnabled(e){return this.getProviderEnforcementState(e)==="ENFORCE"||this.getProviderEnforcementState(e)==="AUDIT"}isAnyProviderEnabled(){return this.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")||this.isProviderEnabled("PHONE_PROVIDER")}}async function Ym(n,e){return Mt(n,"GET","/v2/recaptchaConfig",Lt(n,e))}/**
616
+ */const ng=["/v1/accounts:signInWithCustomToken","/v1/accounts:signInWithEmailLink","/v1/accounts:signInWithIdp","/v1/accounts:signInWithPassword","/v1/accounts:signInWithPhoneNumber","/v1/token"],rg=new Nr(3e4,6e4);function Mt(n,e){return n.tenantId&&!e.tenantId?Object.assign(Object.assign({},e),{tenantId:n.tenantId}):e}async function Ut(n,e,t,r,s={}){return Nl(n,s,async()=>{let i={},a={};r&&(e==="GET"?a=r:i={body:JSON.stringify(r)});const c=Cr(Object.assign({key:n.config.apiKey},a)).slice(1),l=await n._getAdditionalHeaders();l["Content-Type"]="application/json",n.languageCode&&(l["X-Firebase-Locale"]=n.languageCode);const d=Object.assign({method:e,headers:l},i);return mp()||(d.referrerPolicy="no-referrer"),n.emulatorConfig&&Lt(n.emulatorConfig.host)&&(d.credentials="include"),kl.fetch()(await Dl(n,n.config.apiHost,t,c),d)})}async function Nl(n,e,t){n._canInitEmulator=!1;const r=Object.assign(Object.assign({},tg),e);try{const s=new ig(n),i=await Promise.race([t(),s.promise]);s.clearNetworkTimeout();const a=await i.json();if("needConfirmation"in a)throw os(n,"account-exists-with-different-credential",a);if(i.ok&&!("errorMessage"in a))return a;{const c=i.ok?a.errorMessage:a.error.message,[l,d]=c.split(" : ");if(l==="FEDERATED_USER_ID_ALREADY_LINKED")throw os(n,"credential-already-in-use",a);if(l==="EMAIL_EXISTS")throw os(n,"email-already-in-use",a);if(l==="USER_DISABLED")throw os(n,"user-disabled",a);const f=r[l]||l.toLowerCase().replace(/[_\s]+/g,"-");if(d)throw No(n,f,d);xe(n,f)}}catch(s){if(s instanceof ze)throw s;xe(n,"network-request-failed",{message:String(s)})}}async function Dr(n,e,t,r,s={}){const i=await Ut(n,e,t,r,s);return"mfaPendingCredential"in i&&xe(n,"multi-factor-auth-required",{_serverResponse:i}),i}async function Dl(n,e,t,r){const s=`${e}${t}?${r}`,i=n,a=i.config.emulator?Vo(n.config,s):`${n.config.apiScheme}://${s}`;return ng.includes(t)&&(await i._persistenceManagerAvailable,i._getPersistenceType()==="COOKIE")?i._getPersistence()._getFinalTarget(a).toString():a}function sg(n){switch(n){case"ENFORCE":return"ENFORCE";case"AUDIT":return"AUDIT";case"OFF":return"OFF";default:return"ENFORCEMENT_STATE_UNSPECIFIED"}}class ig{clearNetworkTimeout(){clearTimeout(this.timer)}constructor(e){this.auth=e,this.timer=null,this.promise=new Promise((t,r)=>{this.timer=setTimeout(()=>r(je(this.auth,"network-request-failed")),rg.get())})}}function os(n,e,t){const r={appName:n.name};t.email&&(r.email=t.email),t.phoneNumber&&(r.phoneNumber=t.phoneNumber);const s=je(n,e,r);return s.customData._tokenResponse=t,s}function Gc(n){return n!==void 0&&n.enterprise!==void 0}class og{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 sg(t.enforcementState);return null}isProviderEnabled(e){return this.getProviderEnforcementState(e)==="ENFORCE"||this.getProviderEnforcementState(e)==="AUDIT"}isAnyProviderEnabled(){return this.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")||this.isProviderEnabled("PHONE_PROVIDER")}}async function ag(n,e){return Ut(n,"GET","/v2/recaptchaConfig",Mt(n,e))}/**
588
617
  * @license
589
618
  * Copyright 2020 Google LLC
590
619
  *
@@ -599,7 +628,7 @@ import{x as zf,_ as wo,z as Ht,k as Gf,y as Wf}from"./index-DxqO1ZJV.js";import{
599
628
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
600
629
  * See the License for the specific language governing permissions and
601
630
  * limitations under the License.
602
- */async function Zm(n,e){return Mt(n,"POST","/v1/accounts:delete",e)}async function bs(n,e){return Mt(n,"POST","/v1/accounts:lookup",e)}/**
631
+ */async function cg(n,e){return Ut(n,"POST","/v1/accounts:delete",e)}async function Cs(n,e){return Ut(n,"POST","/v1/accounts:lookup",e)}/**
603
632
  * @license
604
633
  * Copyright 2020 Google LLC
605
634
  *
@@ -614,7 +643,7 @@ import{x as zf,_ as wo,z as Ht,k as Gf,y as Wf}from"./index-DxqO1ZJV.js";import{
614
643
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
615
644
  * See the License for the specific language governing permissions and
616
645
  * limitations under the License.
617
- */function lr(n){if(n)try{const e=new Date(Number(n));if(!isNaN(e.getTime()))return e.toUTCString()}catch{}}async function Pl(n,e=!1){const t=Z(n),r=await t.getIdToken(e),s=ko(r);x(s&&s.exp&&s.auth_time&&s.iat,t.auth,"internal-error");const i=typeof s.firebase=="object"?s.firebase:void 0,a=i==null?void 0:i.sign_in_provider;return{claims:s,token:r,authTime:lr(ji(s.auth_time)),issuedAtTime:lr(ji(s.iat)),expirationTime:lr(ji(s.exp)),signInProvider:a||null,signInSecondFactor:(i==null?void 0:i.sign_in_second_factor)||null}}function ji(n){return Number(n)*1e3}function ko(n){const[e,t,r]=n.split(".");if(e===void 0||t===void 0||r===void 0)return hs("JWT malformed, contained fewer than 3 sections"),null;try{const s=fl(t);return s?JSON.parse(s):(hs("Failed to decode base64 JWT payload"),null)}catch(s){return hs("Caught error parsing JWT payload as JSON",s==null?void 0:s.toString()),null}}function $c(n){const e=ko(n);return x(e,"internal-error"),x(typeof e.exp<"u","internal-error"),x(typeof e.iat<"u","internal-error"),Number(e.exp)-Number(e.iat)}/**
646
+ */function fr(n){if(n)try{const e=new Date(Number(n));if(!isNaN(e.getTime()))return e.toUTCString()}catch{}}async function Vl(n,e=!1){const t=Z(n),r=await t.getIdToken(e),s=Oo(r);U(s&&s.exp&&s.auth_time&&s.iat,t.auth,"internal-error");const i=typeof s.firebase=="object"?s.firebase:void 0,a=i==null?void 0:i.sign_in_provider;return{claims:s,token:r,authTime:fr(Wi(s.auth_time)),issuedAtTime:fr(Wi(s.iat)),expirationTime:fr(Wi(s.exp)),signInProvider:a||null,signInSecondFactor:(i==null?void 0:i.sign_in_second_factor)||null}}function Wi(n){return Number(n)*1e3}function Oo(n){const[e,t,r]=n.split(".");if(e===void 0||t===void 0||r===void 0)return ps("JWT malformed, contained fewer than 3 sections"),null;try{const s=El(t);return s?JSON.parse(s):(ps("Failed to decode base64 JWT payload"),null)}catch(s){return ps("Caught error parsing JWT payload as JSON",s==null?void 0:s.toString()),null}}function Wc(n){const e=Oo(n);return U(e,"internal-error"),U(typeof e.exp<"u","internal-error"),U(typeof e.iat<"u","internal-error"),Number(e.exp)-Number(e.iat)}/**
618
647
  * @license
619
648
  * Copyright 2020 Google LLC
620
649
  *
@@ -629,7 +658,7 @@ import{x as zf,_ as wo,z as Ht,k as Gf,y as Wf}from"./index-DxqO1ZJV.js";import{
629
658
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
630
659
  * See the License for the specific language governing permissions and
631
660
  * limitations under the License.
632
- */async function gr(n,e,t=!1){if(t)return e;try{return await e}catch(r){throw r instanceof He&&eg(r)&&n.auth.currentUser===n&&await n.auth.signOut(),r}}function eg({code:n}){return n==="auth/user-disabled"||n==="auth/user-token-expired"}/**
661
+ */async function Er(n,e,t=!1){if(t)return e;try{return await e}catch(r){throw r instanceof ze&&ug(r)&&n.auth.currentUser===n&&await n.auth.signOut(),r}}function ug({code:n}){return n==="auth/user-disabled"||n==="auth/user-token-expired"}/**
633
662
  * @license
634
663
  * Copyright 2020 Google LLC
635
664
  *
@@ -644,7 +673,7 @@ import{x as zf,_ as wo,z as Ht,k as Gf,y as Wf}from"./index-DxqO1ZJV.js";import{
644
673
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
645
674
  * See the License for the specific language governing permissions and
646
675
  * limitations under the License.
647
- */class tg{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()}}/**
676
+ */class lg{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()}}/**
648
677
  * @license
649
678
  * Copyright 2020 Google LLC
650
679
  *
@@ -659,7 +688,7 @@ import{x as zf,_ as wo,z as Ht,k as Gf,y as Wf}from"./index-DxqO1ZJV.js";import{
659
688
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
660
689
  * See the License for the specific language governing permissions and
661
690
  * limitations under the License.
662
- */class ro{constructor(e,t){this.createdAt=e,this.lastLoginAt=t,this._initializeTime()}_initializeTime(){this.lastSignInTime=lr(this.lastLoginAt),this.creationTime=lr(this.createdAt)}_copy(e){this.createdAt=e.createdAt,this.lastLoginAt=e.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}}/**
691
+ */class ao{constructor(e,t){this.createdAt=e,this.lastLoginAt=t,this._initializeTime()}_initializeTime(){this.lastSignInTime=fr(this.lastLoginAt),this.creationTime=fr(this.createdAt)}_copy(e){this.createdAt=e.createdAt,this.lastLoginAt=e.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}}/**
663
692
  * @license
664
693
  * Copyright 2019 Google LLC
665
694
  *
@@ -674,7 +703,7 @@ import{x as zf,_ as wo,z as Ht,k as Gf,y as Wf}from"./index-DxqO1ZJV.js";import{
674
703
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
675
704
  * See the License for the specific language governing permissions and
676
705
  * limitations under the License.
677
- */async function Ps(n){var e;const t=n.auth,r=await n.getIdToken(),s=await gr(n,bs(t,{idToken:r}));x(s==null?void 0:s.users.length,t,"internal-error");const i=s.users[0];n._notifyReloadListener(i);const a=!((e=i.providerUserInfo)===null||e===void 0)&&e.length?Sl(i.providerUserInfo):[],c=rg(n.providerData,a),l=n.isAnonymous,d=!(n.email&&i.passwordHash)&&!(c!=null&&c.length),f=l?d:!1,m={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:c,metadata:new ro(i.createdAt,i.lastLoginAt),isAnonymous:f};Object.assign(n,m)}async function ng(n){const e=Z(n);await Ps(e),await e.auth._persistUserIfCurrent(e),e.auth._notifyListenersIfCurrent(e)}function rg(n,e){return[...n.filter(r=>!e.some(s=>s.providerId===r.providerId)),...e]}function Sl(n){return n.map(e=>{var{providerId:t}=e,r=wo(e,["providerId"]);return{providerId:t,uid:r.rawId||"",displayName:r.displayName||null,email:r.email||null,phoneNumber:r.phoneNumber||null,photoURL:r.photoUrl||null}})}/**
706
+ */async function ks(n){var e;const t=n.auth,r=await n.getIdToken(),s=await Er(n,Cs(t,{idToken:r}));U(s==null?void 0:s.users.length,t,"internal-error");const i=s.users[0];n._notifyReloadListener(i);const a=!((e=i.providerUserInfo)===null||e===void 0)&&e.length?Ol(i.providerUserInfo):[],c=dg(n.providerData,a),l=n.isAnonymous,d=!(n.email&&i.passwordHash)&&!(c!=null&&c.length),f=l?d:!1,m={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:c,metadata:new ao(i.createdAt,i.lastLoginAt),isAnonymous:f};Object.assign(n,m)}async function hg(n){const e=Z(n);await ks(e),await e.auth._persistUserIfCurrent(e),e.auth._notifyListenersIfCurrent(e)}function dg(n,e){return[...n.filter(r=>!e.some(s=>s.providerId===r.providerId)),...e]}function Ol(n){return n.map(e=>{var{providerId:t}=e,r=Po(e,["providerId"]);return{providerId:t,uid:r.rawId||"",displayName:r.displayName||null,email:r.email||null,phoneNumber:r.phoneNumber||null,photoURL:r.photoUrl||null}})}/**
678
707
  * @license
679
708
  * Copyright 2020 Google LLC
680
709
  *
@@ -689,7 +718,7 @@ import{x as zf,_ as wo,z as Ht,k as Gf,y as Wf}from"./index-DxqO1ZJV.js";import{
689
718
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
690
719
  * See the License for the specific language governing permissions and
691
720
  * limitations under the License.
692
- */async function sg(n,e){const t=await Rl(n,{},async()=>{const r=br({grant_type:"refresh_token",refresh_token:e}).slice(1),{tokenApiHost:s,apiKey:i}=n.config,a=await bl(n,s,"/v1/token",`key=${i}`),c=await n._getAdditionalHeaders();return c["Content-Type"]="application/x-www-form-urlencoded",Al.fetch()(a,{method:"POST",headers:c,body:r})});return{accessToken:t.access_token,expiresIn:t.expires_in,refreshToken:t.refresh_token}}async function ig(n,e){return Mt(n,"POST","/v2/accounts:revokeToken",Lt(n,e))}/**
721
+ */async function fg(n,e){const t=await Nl(n,{},async()=>{const r=Cr({grant_type:"refresh_token",refresh_token:e}).slice(1),{tokenApiHost:s,apiKey:i}=n.config,a=await Dl(n,s,"/v1/token",`key=${i}`),c=await n._getAdditionalHeaders();return c["Content-Type"]="application/x-www-form-urlencoded",kl.fetch()(a,{method:"POST",headers:c,body:r})});return{accessToken:t.access_token,expiresIn:t.expires_in,refreshToken:t.refresh_token}}async function pg(n,e){return Ut(n,"POST","/v2/accounts:revokeToken",Mt(n,e))}/**
693
722
  * @license
694
723
  * Copyright 2020 Google LLC
695
724
  *
@@ -704,7 +733,7 @@ import{x as zf,_ as wo,z as Ht,k as Gf,y as Wf}from"./index-DxqO1ZJV.js";import{
704
733
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
705
734
  * See the License for the specific language governing permissions and
706
735
  * limitations under the License.
707
- */class yn{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(e){x(e.idToken,"internal-error"),x(typeof e.idToken<"u","internal-error"),x(typeof e.refreshToken<"u","internal-error");const t="expiresIn"in e&&typeof e.expiresIn<"u"?Number(e.expiresIn):$c(e.idToken);this.updateTokensAndExpiration(e.idToken,e.refreshToken,t)}updateFromIdToken(e){x(e.length!==0,"internal-error");const t=$c(e);this.updateTokensAndExpiration(e,null,t)}async getToken(e,t=!1){return!t&&this.accessToken&&!this.isExpired?this.accessToken:(x(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 sg(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,a=new yn;return r&&(x(typeof r=="string","internal-error",{appName:e}),a.refreshToken=r),s&&(x(typeof s=="string","internal-error",{appName:e}),a.accessToken=s),i&&(x(typeof i=="number","internal-error",{appName:e}),a.expirationTime=i),a}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 yn,this.toJSON())}_performRefresh(){return st("not implemented")}}/**
736
+ */class Tn{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(e){U(e.idToken,"internal-error"),U(typeof e.idToken<"u","internal-error"),U(typeof e.refreshToken<"u","internal-error");const t="expiresIn"in e&&typeof e.expiresIn<"u"?Number(e.expiresIn):Wc(e.idToken);this.updateTokensAndExpiration(e.idToken,e.refreshToken,t)}updateFromIdToken(e){U(e.length!==0,"internal-error");const t=Wc(e);this.updateTokensAndExpiration(e,null,t)}async getToken(e,t=!1){return!t&&this.accessToken&&!this.isExpired?this.accessToken:(U(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 fg(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,a=new Tn;return r&&(U(typeof r=="string","internal-error",{appName:e}),a.refreshToken=r),s&&(U(typeof s=="string","internal-error",{appName:e}),a.accessToken=s),i&&(U(typeof i=="number","internal-error",{appName:e}),a.expirationTime=i),a}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 Tn,this.toJSON())}_performRefresh(){return st("not implemented")}}/**
708
737
  * @license
709
738
  * Copyright 2020 Google LLC
710
739
  *
@@ -719,7 +748,7 @@ import{x as zf,_ as wo,z as Ht,k as Gf,y as Wf}from"./index-DxqO1ZJV.js";import{
719
748
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
720
749
  * See the License for the specific language governing permissions and
721
750
  * limitations under the License.
722
- */function yt(n,e){x(typeof n=="string"||typeof n>"u","internal-error",{appName:e})}class Fe{constructor(e){var{uid:t,auth:r,stsTokenManager:s}=e,i=wo(e,["uid","auth","stsTokenManager"]);this.providerId="firebase",this.proactiveRefresh=new tg(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 ro(i.createdAt||void 0,i.lastLoginAt||void 0)}async getIdToken(e){const t=await gr(this,this.stsTokenManager.getToken(this.auth,e));return x(t,this.auth,"internal-error"),this.accessToken!==t&&(this.accessToken=t,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),t}getIdTokenResult(e){return Pl(this,e)}reload(){return ng(this)}_assign(e){this!==e&&(x(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 Fe(Object.assign(Object.assign({},this),{auth:e,stsTokenManager:this.stsTokenManager._clone()}));return t.metadata._copy(this.metadata),t}_onReload(e){x(!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 Ps(this),await this.auth._persistUserIfCurrent(this),r&&this.auth._notifyListenersIfCurrent(this)}async delete(){if(Pe(this.auth.app))return Promise.reject(ot(this.auth));const e=await this.getIdToken();return await gr(this,Zm(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,a,c,l,d,f;const m=(r=t.displayName)!==null&&r!==void 0?r:void 0,E=(s=t.email)!==null&&s!==void 0?s:void 0,R=(i=t.phoneNumber)!==null&&i!==void 0?i:void 0,C=(a=t.photoURL)!==null&&a!==void 0?a:void 0,N=(c=t.tenantId)!==null&&c!==void 0?c:void 0,k=(l=t._redirectEventId)!==null&&l!==void 0?l:void 0,F=(d=t.createdAt)!==null&&d!==void 0?d:void 0,$=(f=t.lastLoginAt)!==null&&f!==void 0?f:void 0,{uid:M,emailVerified:j,isAnonymous:ce,providerData:X,stsTokenManager:v}=t;x(M&&v,e,"internal-error");const g=yn.fromJSON(this.name,v);x(typeof M=="string",e,"internal-error"),yt(m,e.name),yt(E,e.name),x(typeof j=="boolean",e,"internal-error"),x(typeof ce=="boolean",e,"internal-error"),yt(R,e.name),yt(C,e.name),yt(N,e.name),yt(k,e.name),yt(F,e.name),yt($,e.name);const _=new Fe({uid:M,auth:e,email:E,emailVerified:j,displayName:m,isAnonymous:ce,photoURL:C,phoneNumber:R,tenantId:N,stsTokenManager:g,createdAt:F,lastLoginAt:$});return X&&Array.isArray(X)&&(_.providerData=X.map(T=>Object.assign({},T))),k&&(_._redirectEventId=k),_}static async _fromIdTokenResponse(e,t,r=!1){const s=new yn;s.updateFromServerResponse(t);const i=new Fe({uid:t.localId,auth:e,stsTokenManager:s,isAnonymous:r});return await Ps(i),i}static async _fromGetAccountInfoResponse(e,t,r){const s=t.users[0];x(s.localId!==void 0,"internal-error");const i=s.providerUserInfo!==void 0?Sl(s.providerUserInfo):[],a=!(s.email&&s.passwordHash)&&!(i!=null&&i.length),c=new yn;c.updateFromIdToken(r);const l=new Fe({uid:s.localId,auth:e,stsTokenManager:c,isAnonymous:a}),d={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 ro(s.createdAt,s.lastLoginAt),isAnonymous:!(s.email&&s.passwordHash)&&!(i!=null&&i.length)};return Object.assign(l,d),l}}/**
751
+ */function yt(n,e){U(typeof n=="string"||typeof n>"u","internal-error",{appName:e})}class Fe{constructor(e){var{uid:t,auth:r,stsTokenManager:s}=e,i=Po(e,["uid","auth","stsTokenManager"]);this.providerId="firebase",this.proactiveRefresh=new lg(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 ao(i.createdAt||void 0,i.lastLoginAt||void 0)}async getIdToken(e){const t=await Er(this,this.stsTokenManager.getToken(this.auth,e));return U(t,this.auth,"internal-error"),this.accessToken!==t&&(this.accessToken=t,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),t}getIdTokenResult(e){return Vl(this,e)}reload(){return hg(this)}_assign(e){this!==e&&(U(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 Fe(Object.assign(Object.assign({},this),{auth:e,stsTokenManager:this.stsTokenManager._clone()}));return t.metadata._copy(this.metadata),t}_onReload(e){U(!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 ks(this),await this.auth._persistUserIfCurrent(this),r&&this.auth._notifyListenersIfCurrent(this)}async delete(){if(Pe(this.auth.app))return Promise.reject(ot(this.auth));const e=await this.getIdToken();return await Er(this,cg(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,a,c,l,d,f;const m=(r=t.displayName)!==null&&r!==void 0?r:void 0,_=(s=t.email)!==null&&s!==void 0?s:void 0,R=(i=t.phoneNumber)!==null&&i!==void 0?i:void 0,S=(a=t.photoURL)!==null&&a!==void 0?a:void 0,N=(c=t.tenantId)!==null&&c!==void 0?c:void 0,k=(l=t._redirectEventId)!==null&&l!==void 0?l:void 0,B=(d=t.createdAt)!==null&&d!==void 0?d:void 0,M=(f=t.lastLoginAt)!==null&&f!==void 0?f:void 0,{uid:x,emailVerified:$,isAnonymous:ce,providerData:X,stsTokenManager:v}=t;U(x&&v,e,"internal-error");const g=Tn.fromJSON(this.name,v);U(typeof x=="string",e,"internal-error"),yt(m,e.name),yt(_,e.name),U(typeof $=="boolean",e,"internal-error"),U(typeof ce=="boolean",e,"internal-error"),yt(R,e.name),yt(S,e.name),yt(N,e.name),yt(k,e.name),yt(B,e.name),yt(M,e.name);const y=new Fe({uid:x,auth:e,email:_,emailVerified:$,displayName:m,isAnonymous:ce,photoURL:S,phoneNumber:R,tenantId:N,stsTokenManager:g,createdAt:B,lastLoginAt:M});return X&&Array.isArray(X)&&(y.providerData=X.map(T=>Object.assign({},T))),k&&(y._redirectEventId=k),y}static async _fromIdTokenResponse(e,t,r=!1){const s=new Tn;s.updateFromServerResponse(t);const i=new Fe({uid:t.localId,auth:e,stsTokenManager:s,isAnonymous:r});return await ks(i),i}static async _fromGetAccountInfoResponse(e,t,r){const s=t.users[0];U(s.localId!==void 0,"internal-error");const i=s.providerUserInfo!==void 0?Ol(s.providerUserInfo):[],a=!(s.email&&s.passwordHash)&&!(i!=null&&i.length),c=new Tn;c.updateFromIdToken(r);const l=new Fe({uid:s.localId,auth:e,stsTokenManager:c,isAnonymous:a}),d={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 ao(s.createdAt,s.lastLoginAt),isAnonymous:!(s.email&&s.passwordHash)&&!(i!=null&&i.length)};return Object.assign(l,d),l}}/**
723
752
  * @license
724
753
  * Copyright 2020 Google LLC
725
754
  *
@@ -734,7 +763,7 @@ import{x as zf,_ as wo,z as Ht,k as Gf,y as Wf}from"./index-DxqO1ZJV.js";import{
734
763
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
735
764
  * See the License for the specific language governing permissions and
736
765
  * limitations under the License.
737
- */const jc=new Map;function it(n){ht(n instanceof Function,"Expected a class definition");let e=jc.get(n);return e?(ht(e instanceof n,"Instance stored in cache mismatched with class"),e):(e=new n,jc.set(n,e),e)}/**
766
+ */const Kc=new Map;function it(n){ht(n instanceof Function,"Expected a class definition");let e=Kc.get(n);return e?(ht(e instanceof n,"Instance stored in cache mismatched with class"),e):(e=new n,Kc.set(n,e),e)}/**
738
767
  * @license
739
768
  * Copyright 2019 Google LLC
740
769
  *
@@ -749,7 +778,7 @@ import{x as zf,_ as wo,z as Ht,k as Gf,y as Wf}from"./index-DxqO1ZJV.js";import{
749
778
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
750
779
  * See the License for the specific language governing permissions and
751
780
  * limitations under the License.
752
- */class Cl{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){}}Cl.type="NONE";const Hc=Cl;/**
781
+ */class Ll{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){}}Ll.type="NONE";const Qc=Ll;/**
753
782
  * @license
754
783
  * Copyright 2019 Google LLC
755
784
  *
@@ -764,7 +793,7 @@ import{x as zf,_ as wo,z as Ht,k as Gf,y as Wf}from"./index-DxqO1ZJV.js";import{
764
793
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
765
794
  * See the License for the specific language governing permissions and
766
795
  * limitations under the License.
767
- */function ds(n,e,t){return`firebase:${n}:${e}:${t}`}class Tn{constructor(e,t,r){this.persistence=e,this.auth=t,this.userKey=r;const{config:s,name:i}=this.auth;this.fullUserKey=ds(this.userKey,s.apiKey,i),this.fullPersistenceKey=ds("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);if(!e)return null;if(typeof e=="string"){const t=await bs(this.auth,{idToken:e}).catch(()=>{});return t?Fe._fromGetAccountInfoResponse(this.auth,t,e):null}return Fe._fromJSON(this.auth,e)}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 Tn(it(Hc),e,r);const s=(await Promise.all(t.map(async d=>{if(await d._isAvailable())return d}))).filter(d=>d);let i=s[0]||it(Hc);const a=ds(r,e.config.apiKey,e.name);let c=null;for(const d of t)try{const f=await d._get(a);if(f){let m;if(typeof f=="string"){const E=await bs(e,{idToken:f}).catch(()=>{});if(!E)break;m=await Fe._fromGetAccountInfoResponse(e,E,f)}else m=Fe._fromJSON(e,f);d!==i&&(c=m),i=d;break}}catch{}const l=s.filter(d=>d._shouldAllowMigration);return!i._shouldAllowMigration||!l.length?new Tn(i,e,r):(i=l[0],c&&await i._set(a,c.toJSON()),await Promise.all(t.map(async d=>{if(d!==i)try{await d._remove(a)}catch{}})),new Tn(i,e,r))}}/**
796
+ */function ms(n,e,t){return`firebase:${n}:${e}:${t}`}class vn{constructor(e,t,r){this.persistence=e,this.auth=t,this.userKey=r;const{config:s,name:i}=this.auth;this.fullUserKey=ms(this.userKey,s.apiKey,i),this.fullPersistenceKey=ms("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);if(!e)return null;if(typeof e=="string"){const t=await Cs(this.auth,{idToken:e}).catch(()=>{});return t?Fe._fromGetAccountInfoResponse(this.auth,t,e):null}return Fe._fromJSON(this.auth,e)}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 vn(it(Qc),e,r);const s=(await Promise.all(t.map(async d=>{if(await d._isAvailable())return d}))).filter(d=>d);let i=s[0]||it(Qc);const a=ms(r,e.config.apiKey,e.name);let c=null;for(const d of t)try{const f=await d._get(a);if(f){let m;if(typeof f=="string"){const _=await Cs(e,{idToken:f}).catch(()=>{});if(!_)break;m=await Fe._fromGetAccountInfoResponse(e,_,f)}else m=Fe._fromJSON(e,f);d!==i&&(c=m),i=d;break}}catch{}const l=s.filter(d=>d._shouldAllowMigration);return!i._shouldAllowMigration||!l.length?new vn(i,e,r):(i=l[0],c&&await i._set(a,c.toJSON()),await Promise.all(t.map(async d=>{if(d!==i)try{await d._remove(a)}catch{}})),new vn(i,e,r))}}/**
768
797
  * @license
769
798
  * Copyright 2020 Google LLC
770
799
  *
@@ -779,7 +808,7 @@ import{x as zf,_ as wo,z as Ht,k as Gf,y as Wf}from"./index-DxqO1ZJV.js";import{
779
808
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
780
809
  * See the License for the specific language governing permissions and
781
810
  * limitations under the License.
782
- */function zc(n){const e=n.toLowerCase();if(e.includes("opera/")||e.includes("opr/")||e.includes("opios/"))return"Opera";if(Ol(e))return"IEMobile";if(e.includes("msie")||e.includes("trident/"))return"IE";if(e.includes("edge/"))return"Edge";if(kl(e))return"Firefox";if(e.includes("silk/"))return"Silk";if(Ll(e))return"Blackberry";if(Ml(e))return"Webos";if(Nl(e))return"Safari";if((e.includes("chrome/")||Dl(e))&&!e.includes("edge/"))return"Chrome";if(Vl(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 kl(n=we()){return/firefox\//i.test(n)}function Nl(n=we()){const e=n.toLowerCase();return e.includes("safari/")&&!e.includes("chrome/")&&!e.includes("crios/")&&!e.includes("android")}function Dl(n=we()){return/crios\//i.test(n)}function Ol(n=we()){return/iemobile/i.test(n)}function Vl(n=we()){return/android/i.test(n)}function Ll(n=we()){return/blackberry/i.test(n)}function Ml(n=we()){return/webos/i.test(n)}function No(n=we()){return/iphone|ipad|ipod/i.test(n)||/macintosh/i.test(n)&&/mobile/i.test(n)}function og(n=we()){var e;return No(n)&&!!(!((e=window.navigator)===null||e===void 0)&&e.standalone)}function ag(){return up()&&document.documentMode===10}function xl(n=we()){return No(n)||Vl(n)||Ml(n)||Ll(n)||/windows phone/i.test(n)||Ol(n)}/**
811
+ */function Xc(n){const e=n.toLowerCase();if(e.includes("opera/")||e.includes("opr/")||e.includes("opios/"))return"Opera";if(Fl(e))return"IEMobile";if(e.includes("msie")||e.includes("trident/"))return"IE";if(e.includes("edge/"))return"Edge";if(xl(e))return"Firefox";if(e.includes("silk/"))return"Silk";if(ql(e))return"Blackberry";if(jl(e))return"Webos";if(Ml(e))return"Safari";if((e.includes("chrome/")||Ul(e))&&!e.includes("edge/"))return"Chrome";if(Bl(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 xl(n=we()){return/firefox\//i.test(n)}function Ml(n=we()){const e=n.toLowerCase();return e.includes("safari/")&&!e.includes("chrome/")&&!e.includes("crios/")&&!e.includes("android")}function Ul(n=we()){return/crios\//i.test(n)}function Fl(n=we()){return/iemobile/i.test(n)}function Bl(n=we()){return/android/i.test(n)}function ql(n=we()){return/blackberry/i.test(n)}function jl(n=we()){return/webos/i.test(n)}function Lo(n=we()){return/iphone|ipad|ipod/i.test(n)||/macintosh/i.test(n)&&/mobile/i.test(n)}function mg(n=we()){var e;return Lo(n)&&!!(!((e=window.navigator)===null||e===void 0)&&e.standalone)}function gg(){return yp()&&document.documentMode===10}function $l(n=we()){return Lo(n)||Bl(n)||jl(n)||ql(n)||/windows phone/i.test(n)||Fl(n)}/**
783
812
  * @license
784
813
  * Copyright 2020 Google LLC
785
814
  *
@@ -794,7 +823,7 @@ import{x as zf,_ as wo,z as Ht,k as Gf,y as Wf}from"./index-DxqO1ZJV.js";import{
794
823
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
795
824
  * See the License for the specific language governing permissions and
796
825
  * limitations under the License.
797
- */function Ul(n,e=[]){let t;switch(n){case"Browser":t=zc(we());break;case"Worker":t=`${zc(we())}-${n}`;break;default:t=n}const r=e.length?e.join(","):"FirebaseCore-web";return`${t}/JsCore/${nn}/${r}`}/**
826
+ */function zl(n,e=[]){let t;switch(n){case"Browser":t=Xc(we());break;case"Worker":t=`${Xc(we())}-${n}`;break;default:t=n}const r=e.length?e.join(","):"FirebaseCore-web";return`${t}/JsCore/${sn}/${r}`}/**
798
827
  * @license
799
828
  * Copyright 2022 Google LLC
800
829
  *
@@ -809,7 +838,7 @@ import{x as zf,_ as wo,z as Ht,k as Gf,y as Wf}from"./index-DxqO1ZJV.js";import{
809
838
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
810
839
  * See the License for the specific language governing permissions and
811
840
  * limitations under the License.
812
- */class cg{constructor(e){this.auth=e,this.queue=[]}pushCallback(e,t){const r=i=>new Promise((a,c)=>{try{const l=e(i);a(l)}catch(l){c(l)}});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})}}}/**
841
+ */class _g{constructor(e){this.auth=e,this.queue=[]}pushCallback(e,t){const r=i=>new Promise((a,c)=>{try{const l=e(i);a(l)}catch(l){c(l)}});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})}}}/**
813
842
  * @license
814
843
  * Copyright 2023 Google LLC
815
844
  *
@@ -824,7 +853,7 @@ import{x as zf,_ as wo,z as Ht,k as Gf,y as Wf}from"./index-DxqO1ZJV.js";import{
824
853
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
825
854
  * See the License for the specific language governing permissions and
826
855
  * limitations under the License.
827
- */async function ug(n,e={}){return Mt(n,"GET","/v2/passwordPolicy",Lt(n,e))}/**
856
+ */async function yg(n,e={}){return Ut(n,"GET","/v2/passwordPolicy",Mt(n,e))}/**
828
857
  * @license
829
858
  * Copyright 2023 Google LLC
830
859
  *
@@ -839,7 +868,7 @@ import{x as zf,_ as wo,z as Ht,k as Gf,y as Wf}from"./index-DxqO1ZJV.js";import{
839
868
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
840
869
  * See the License for the specific language governing permissions and
841
870
  * limitations under the License.
842
- */const lg=6;class hg{constructor(e){var t,r,s,i;const a=e.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=(t=a.minPasswordLength)!==null&&t!==void 0?t:lg,a.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=a.maxPasswordLength),a.containsLowercaseCharacter!==void 0&&(this.customStrengthOptions.containsLowercaseLetter=a.containsLowercaseCharacter),a.containsUppercaseCharacter!==void 0&&(this.customStrengthOptions.containsUppercaseLetter=a.containsUppercaseCharacter),a.containsNumericCharacter!==void 0&&(this.customStrengthOptions.containsNumericCharacter=a.containsNumericCharacter),a.containsNonAlphanumericCharacter!==void 0&&(this.customStrengthOptions.containsNonAlphanumericCharacter=a.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,a,c;const l={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(e,l),this.validatePasswordCharacterOptions(e,l),l.isValid&&(l.isValid=(t=l.meetsMinPasswordLength)!==null&&t!==void 0?t:!0),l.isValid&&(l.isValid=(r=l.meetsMaxPasswordLength)!==null&&r!==void 0?r:!0),l.isValid&&(l.isValid=(s=l.containsLowercaseLetter)!==null&&s!==void 0?s:!0),l.isValid&&(l.isValid=(i=l.containsUppercaseLetter)!==null&&i!==void 0?i:!0),l.isValid&&(l.isValid=(a=l.containsNumericCharacter)!==null&&a!==void 0?a:!0),l.isValid&&(l.isValid=(c=l.containsNonAlphanumericCharacter)!==null&&c!==void 0?c:!0),l}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))}}/**
871
+ */const Eg=6;class Tg{constructor(e){var t,r,s,i;const a=e.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=(t=a.minPasswordLength)!==null&&t!==void 0?t:Eg,a.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=a.maxPasswordLength),a.containsLowercaseCharacter!==void 0&&(this.customStrengthOptions.containsLowercaseLetter=a.containsLowercaseCharacter),a.containsUppercaseCharacter!==void 0&&(this.customStrengthOptions.containsUppercaseLetter=a.containsUppercaseCharacter),a.containsNumericCharacter!==void 0&&(this.customStrengthOptions.containsNumericCharacter=a.containsNumericCharacter),a.containsNonAlphanumericCharacter!==void 0&&(this.customStrengthOptions.containsNonAlphanumericCharacter=a.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,a,c;const l={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(e,l),this.validatePasswordCharacterOptions(e,l),l.isValid&&(l.isValid=(t=l.meetsMinPasswordLength)!==null&&t!==void 0?t:!0),l.isValid&&(l.isValid=(r=l.meetsMaxPasswordLength)!==null&&r!==void 0?r:!0),l.isValid&&(l.isValid=(s=l.containsLowercaseLetter)!==null&&s!==void 0?s:!0),l.isValid&&(l.isValid=(i=l.containsUppercaseLetter)!==null&&i!==void 0?i:!0),l.isValid&&(l.isValid=(a=l.containsNumericCharacter)!==null&&a!==void 0?a:!0),l.isValid&&(l.isValid=(c=l.containsNonAlphanumericCharacter)!==null&&c!==void 0?c:!0),l}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))}}/**
843
872
  * @license
844
873
  * Copyright 2020 Google LLC
845
874
  *
@@ -854,7 +883,7 @@ import{x as zf,_ as wo,z as Ht,k as Gf,y as Wf}from"./index-DxqO1ZJV.js";import{
854
883
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
855
884
  * See the License for the specific language governing permissions and
856
885
  * limitations under the License.
857
- */class dg{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 Gc(this),this.idTokenSubscription=new Gc(this),this.beforeStateQueue=new cg(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=wl,this._agentRecaptchaConfig=null,this._tenantRecaptchaConfigs={},this._projectPasswordPolicy=null,this._tenantPasswordPolicies={},this._resolvePersistenceManagerAvailable=void 0,this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=e.name,this.clientVersion=s.sdkClientVersion,this._persistenceManagerAvailable=new Promise(i=>this._resolvePersistenceManagerAvailable=i)}_initializeWithPersistence(e,t){return t&&(this._popupRedirectResolver=it(t)),this._initializationPromise=this.queue(async()=>{var r,s,i;if(!this._deleted&&(this.persistenceManager=await Tn.create(this,e),(r=this._resolvePersistenceManagerAvailable)===null||r===void 0||r.call(this),!this._deleted)){if(!((s=this._popupRedirectResolver)===null||s===void 0)&&s._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch{}await this.initializeCurrentUser(t),this.lastNotifiedUid=((i=this.currentUser)===null||i===void 0?void 0:i.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 bs(this,{idToken:e}),r=await Fe._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 a=this.app.settings.authIdToken;return a?new Promise(c=>{setTimeout(()=>this.initializeCurrentUserFromIdToken(a).then(c,c))}):this.directlySetCurrentUser(null)}const r=await this.assertedPersistence.getCurrentUser();let s=r,i=!1;if(e&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();const a=(t=this.redirectUser)===null||t===void 0?void 0:t._redirectEventId,c=s==null?void 0:s._redirectEventId,l=await this.tryRedirectSignIn(e);(!a||a===c)&&(l!=null&&l.user)&&(s=l.user,i=!0)}if(!s)return this.directlySetCurrentUser(null);if(!s._redirectEventId){if(i)try{await this.beforeStateQueue.runMiddleware(s)}catch(a){s=r,this._popupRedirectResolver._overrideRedirectResult(this,()=>Promise.reject(a))}return s?this.reloadAndSetCurrentUserOrClear(s):this.directlySetCurrentUser(null)}return x(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 Ps(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=zm()}async _delete(){this._deleted=!0}async updateCurrentUser(e){if(Pe(this.app))return Promise.reject(ot(this));const t=e?Z(e):null;return t&&x(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&&x(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(ot(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(ot(this)):this.queue(async()=>{await this.assertedPersistence.setPersistence(it(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 ug(this),t=new hg(e);this.tenantId===null?this._projectPasswordPolicy=t:this._tenantPasswordPolicies[this.tenantId]=t}_getPersistenceType(){return this.assertedPersistence.persistence.type}_getPersistence(){return this.assertedPersistence.persistence}_updateErrorMap(e){this._errorFactory=new Rr("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 ig(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&&it(e)||this._popupRedirectResolver;x(t,this,"argument-error"),this.redirectPersistenceManager=await Tn.create(this,[it(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 a=!1;const c=this._isInitialized?Promise.resolve():this._initializationPromise;if(x(c,this,"internal-error"),c.then(()=>{a||i(this.currentUser)}),typeof t=="function"){const l=e.addObserver(t,r,s);return()=>{a=!0,l()}}else{const l=e.addObserver(t);return()=>{a=!0,l()}}}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 x(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(e){!e||this.frameworks.includes(e)||(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=Ul(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;if(Pe(this.app)&&this.app.settings.appCheckToken)return this.app.settings.appCheckToken;const t=await((e=this.appCheckServiceProvider.getImmediate({optional:!0}))===null||e===void 0?void 0:e.getToken());return t!=null&&t.error&&qm(`Error while retrieving App Check token: ${t.error}`),t==null?void 0:t.token}}function xt(n){return Z(n)}class Gc{constructor(e){this.auth=e,this.observer=null,this.addObserver=_p(t=>this.observer=t)}get next(){return x(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}/**
886
+ */class vg{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 Yc(this),this.idTokenSubscription=new Yc(this),this.beforeStateQueue=new _g(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=Cl,this._agentRecaptchaConfig=null,this._tenantRecaptchaConfigs={},this._projectPasswordPolicy=null,this._tenantPasswordPolicies={},this._resolvePersistenceManagerAvailable=void 0,this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=e.name,this.clientVersion=s.sdkClientVersion,this._persistenceManagerAvailable=new Promise(i=>this._resolvePersistenceManagerAvailable=i)}_initializeWithPersistence(e,t){return t&&(this._popupRedirectResolver=it(t)),this._initializationPromise=this.queue(async()=>{var r,s,i;if(!this._deleted&&(this.persistenceManager=await vn.create(this,e),(r=this._resolvePersistenceManagerAvailable)===null||r===void 0||r.call(this),!this._deleted)){if(!((s=this._popupRedirectResolver)===null||s===void 0)&&s._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch{}await this.initializeCurrentUser(t),this.lastNotifiedUid=((i=this.currentUser)===null||i===void 0?void 0:i.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 Cs(this,{idToken:e}),r=await Fe._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 a=this.app.settings.authIdToken;return a?new Promise(c=>{setTimeout(()=>this.initializeCurrentUserFromIdToken(a).then(c,c))}):this.directlySetCurrentUser(null)}const r=await this.assertedPersistence.getCurrentUser();let s=r,i=!1;if(e&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();const a=(t=this.redirectUser)===null||t===void 0?void 0:t._redirectEventId,c=s==null?void 0:s._redirectEventId,l=await this.tryRedirectSignIn(e);(!a||a===c)&&(l!=null&&l.user)&&(s=l.user,i=!0)}if(!s)return this.directlySetCurrentUser(null);if(!s._redirectEventId){if(i)try{await this.beforeStateQueue.runMiddleware(s)}catch(a){s=r,this._popupRedirectResolver._overrideRedirectResult(this,()=>Promise.reject(a))}return s?this.reloadAndSetCurrentUserOrClear(s):this.directlySetCurrentUser(null)}return U(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 ks(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=eg()}async _delete(){this._deleted=!0}async updateCurrentUser(e){if(Pe(this.app))return Promise.reject(ot(this));const t=e?Z(e):null;return t&&U(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&&U(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(ot(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(ot(this)):this.queue(async()=>{await this.assertedPersistence.setPersistence(it(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 yg(this),t=new Tg(e);this.tenantId===null?this._projectPasswordPolicy=t:this._tenantPasswordPolicies[this.tenantId]=t}_getPersistenceType(){return this.assertedPersistence.persistence.type}_getPersistence(){return this.assertedPersistence.persistence}_updateErrorMap(e){this._errorFactory=new Sr("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 pg(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&&it(e)||this._popupRedirectResolver;U(t,this,"argument-error"),this.redirectPersistenceManager=await vn.create(this,[it(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 a=!1;const c=this._isInitialized?Promise.resolve():this._initializationPromise;if(U(c,this,"internal-error"),c.then(()=>{a||i(this.currentUser)}),typeof t=="function"){const l=e.addObserver(t,r,s);return()=>{a=!0,l()}}else{const l=e.addObserver(t);return()=>{a=!0,l()}}}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 U(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(e){!e||this.frameworks.includes(e)||(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=zl(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;if(Pe(this.app)&&this.app.settings.appCheckToken)return this.app.settings.appCheckToken;const t=await((e=this.appCheckServiceProvider.getImmediate({optional:!0}))===null||e===void 0?void 0:e.getToken());return t!=null&&t.error&&Xm(`Error while retrieving App Check token: ${t.error}`),t==null?void 0:t.token}}function Ft(n){return Z(n)}class Yc{constructor(e){this.auth=e,this.observer=null,this.addObserver=bp(t=>this.observer=t)}get next(){return U(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}/**
858
887
  * @license
859
888
  * Copyright 2020 Google LLC
860
889
  *
@@ -869,7 +898,7 @@ import{x as zf,_ as wo,z as Ht,k as Gf,y as Wf}from"./index-DxqO1ZJV.js";import{
869
898
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
870
899
  * See the License for the specific language governing permissions and
871
900
  * limitations under the License.
872
- */let Ws={async loadJS(){throw new Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function fg(n){Ws=n}function Fl(n){return Ws.loadJS(n)}function pg(){return Ws.recaptchaEnterpriseScript}function mg(){return Ws.gapiScript}function gg(n){return`__${n}${Math.floor(Math.random()*1e6)}`}class _g{constructor(){this.enterprise=new yg}ready(e){e()}execute(e,t){return Promise.resolve("token")}render(e,t){return""}}class yg{ready(e){e()}execute(e,t){return Promise.resolve("token")}render(e,t){return""}}const Tg="recaptcha-enterprise",Bl="NO_RECAPTCHA";class Eg{constructor(e){this.type=Tg,this.auth=xt(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(a,c)=>{Ym(i,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}).then(l=>{if(l.recaptchaKey===void 0)c(new Error("recaptcha Enterprise site key undefined"));else{const d=new Jm(l);return i.tenantId==null?i._agentRecaptchaConfig=d:i._tenantRecaptchaConfigs[i.tenantId]=d,a(d.siteKey)}}).catch(l=>{c(l)})})}function s(i,a,c){const l=window.grecaptcha;qc(l)?l.enterprise.ready(()=>{l.enterprise.execute(i,{action:e}).then(d=>{a(d)}).catch(()=>{a(Bl)})}):c(Error("No reCAPTCHA enterprise script loaded."))}return this.auth.settings.appVerificationDisabledForTesting?new _g().execute("siteKey",{action:"verify"}):new Promise((i,a)=>{r(this.auth).then(c=>{if(!t&&qc(window.grecaptcha))s(c,i,a);else{if(typeof window>"u"){a(new Error("RecaptchaVerifier is only supported in browser"));return}let l=pg();l.length!==0&&(l+=c),Fl(l).then(()=>{s(c,i,a)}).catch(d=>{a(d)})}}).catch(c=>{a(c)})})}}async function Wc(n,e,t,r=!1,s=!1){const i=new Eg(n);let a;if(s)a=Bl;else try{a=await i.verify(t)}catch{a=await i.verify(t,!0)}const c=Object.assign({},e);if(t==="mfaSmsEnrollment"||t==="mfaSmsSignIn"){if("phoneEnrollmentInfo"in c){const l=c.phoneEnrollmentInfo.phoneNumber,d=c.phoneEnrollmentInfo.recaptchaToken;Object.assign(c,{phoneEnrollmentInfo:{phoneNumber:l,recaptchaToken:d,captchaResponse:a,clientType:"CLIENT_TYPE_WEB",recaptchaVersion:"RECAPTCHA_ENTERPRISE"}})}else if("phoneSignInInfo"in c){const l=c.phoneSignInInfo.recaptchaToken;Object.assign(c,{phoneSignInInfo:{recaptchaToken:l,captchaResponse:a,clientType:"CLIENT_TYPE_WEB",recaptchaVersion:"RECAPTCHA_ENTERPRISE"}})}return c}return r?Object.assign(c,{captchaResp:a}):Object.assign(c,{captchaResponse:a}),Object.assign(c,{clientType:"CLIENT_TYPE_WEB"}),Object.assign(c,{recaptchaVersion:"RECAPTCHA_ENTERPRISE"}),c}async function Kc(n,e,t,r,s){var i;if(!((i=n._getRecaptchaConfig())===null||i===void 0)&&i.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")){const a=await Wc(n,e,t,t==="getOobCode");return r(n,a)}else return r(n,e).catch(async a=>{if(a.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 c=await Wc(n,e,t,t==="getOobCode");return r(n,c)}else return Promise.reject(a)})}/**
901
+ */let Ys={async loadJS(){throw new Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function Ig(n){Ys=n}function Hl(n){return Ys.loadJS(n)}function wg(){return Ys.recaptchaEnterpriseScript}function Ag(){return Ys.gapiScript}function Rg(n){return`__${n}${Math.floor(Math.random()*1e6)}`}class bg{constructor(){this.enterprise=new Pg}ready(e){e()}execute(e,t){return Promise.resolve("token")}render(e,t){return""}}class Pg{ready(e){e()}execute(e,t){return Promise.resolve("token")}render(e,t){return""}}const Sg="recaptcha-enterprise",Gl="NO_RECAPTCHA";class Cg{constructor(e){this.type=Sg,this.auth=Ft(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(a,c)=>{ag(i,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}).then(l=>{if(l.recaptchaKey===void 0)c(new Error("recaptcha Enterprise site key undefined"));else{const d=new og(l);return i.tenantId==null?i._agentRecaptchaConfig=d:i._tenantRecaptchaConfigs[i.tenantId]=d,a(d.siteKey)}}).catch(l=>{c(l)})})}function s(i,a,c){const l=window.grecaptcha;Gc(l)?l.enterprise.ready(()=>{l.enterprise.execute(i,{action:e}).then(d=>{a(d)}).catch(()=>{a(Gl)})}):c(Error("No reCAPTCHA enterprise script loaded."))}return this.auth.settings.appVerificationDisabledForTesting?new bg().execute("siteKey",{action:"verify"}):new Promise((i,a)=>{r(this.auth).then(c=>{if(!t&&Gc(window.grecaptcha))s(c,i,a);else{if(typeof window>"u"){a(new Error("RecaptchaVerifier is only supported in browser"));return}let l=wg();l.length!==0&&(l+=c),Hl(l).then(()=>{s(c,i,a)}).catch(d=>{a(d)})}}).catch(c=>{a(c)})})}}async function Jc(n,e,t,r=!1,s=!1){const i=new Cg(n);let a;if(s)a=Gl;else try{a=await i.verify(t)}catch{a=await i.verify(t,!0)}const c=Object.assign({},e);if(t==="mfaSmsEnrollment"||t==="mfaSmsSignIn"){if("phoneEnrollmentInfo"in c){const l=c.phoneEnrollmentInfo.phoneNumber,d=c.phoneEnrollmentInfo.recaptchaToken;Object.assign(c,{phoneEnrollmentInfo:{phoneNumber:l,recaptchaToken:d,captchaResponse:a,clientType:"CLIENT_TYPE_WEB",recaptchaVersion:"RECAPTCHA_ENTERPRISE"}})}else if("phoneSignInInfo"in c){const l=c.phoneSignInInfo.recaptchaToken;Object.assign(c,{phoneSignInInfo:{recaptchaToken:l,captchaResponse:a,clientType:"CLIENT_TYPE_WEB",recaptchaVersion:"RECAPTCHA_ENTERPRISE"}})}return c}return r?Object.assign(c,{captchaResp:a}):Object.assign(c,{captchaResponse:a}),Object.assign(c,{clientType:"CLIENT_TYPE_WEB"}),Object.assign(c,{recaptchaVersion:"RECAPTCHA_ENTERPRISE"}),c}async function Zc(n,e,t,r,s){var i;if(!((i=n._getRecaptchaConfig())===null||i===void 0)&&i.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")){const a=await Jc(n,e,t,t==="getOobCode");return r(n,a)}else return r(n,e).catch(async a=>{if(a.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 c=await Jc(n,e,t,t==="getOobCode");return r(n,c)}else return Promise.reject(a)})}/**
873
902
  * @license
874
903
  * Copyright 2020 Google LLC
875
904
  *
@@ -884,7 +913,7 @@ import{x as zf,_ as wo,z as Ht,k as Gf,y as Wf}from"./index-DxqO1ZJV.js";import{
884
913
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
885
914
  * See the License for the specific language governing permissions and
886
915
  * limitations under the License.
887
- */function vg(n,e){const t=Pr(n,"auth");if(t.isInitialized()){const s=t.getImmediate(),i=t.getOptions();if(Qt(i,e??{}))return s;Me(s,"already-initialized")}return t.initialize({options:e})}function Ig(n,e){const t=(e==null?void 0:e.persistence)||[],r=(Array.isArray(t)?t:[t]).map(it);e!=null&&e.errorMap&&n._updateErrorMap(e.errorMap),n._initializeWithPersistence(r,e==null?void 0:e.popupRedirectResolver)}function wg(n,e,t){const r=xt(n);x(/^https?:\/\//.test(e),r,"invalid-emulator-scheme");const s=!1,i=ql(e),{host:a,port:c}=Ag(e),l=c===null?"":`:${c}`,d={url:`${i}//${a}${l}/`},f=Object.freeze({host:a,port:c,protocol:i.replace(":",""),options:Object.freeze({disableWarnings:s})});if(!r._canInitEmulator){x(r.config.emulator&&r.emulatorConfig,r,"emulator-config-failed"),x(Qt(d,r.config.emulator)&&Qt(f,r.emulatorConfig),r,"emulator-config-failed");return}r.config.emulator=d,r.emulatorConfig=f,r.settings.appVerificationDisabledForTesting=!0,Rg()}function ql(n){const e=n.indexOf(":");return e<0?"":n.substr(0,e+1)}function Ag(n){const e=ql(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:Qc(r.substr(i.length+1))}}else{const[i,a]=r.split(":");return{host:i,port:Qc(a)}}}function Qc(n){if(!n)return null;const e=Number(n);return isNaN(e)?null:e}function Rg(){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())}/**
916
+ */function kg(n,e){const t=kr(n,"auth");if(t.isInitialized()){const s=t.getImmediate(),i=t.getOptions();if(Yt(i,e??{}))return s;xe(s,"already-initialized")}return t.initialize({options:e})}function Ng(n,e){const t=(e==null?void 0:e.persistence)||[],r=(Array.isArray(t)?t:[t]).map(it);e!=null&&e.errorMap&&n._updateErrorMap(e.errorMap),n._initializeWithPersistence(r,e==null?void 0:e.popupRedirectResolver)}function Dg(n,e,t){const r=Ft(n);U(/^https?:\/\//.test(e),r,"invalid-emulator-scheme");const s=!1,i=Wl(e),{host:a,port:c}=Vg(e),l=c===null?"":`:${c}`,d={url:`${i}//${a}${l}/`},f=Object.freeze({host:a,port:c,protocol:i.replace(":",""),options:Object.freeze({disableWarnings:s})});if(!r._canInitEmulator){U(r.config.emulator&&r.emulatorConfig,r,"emulator-config-failed"),U(Yt(d,r.config.emulator)&&Yt(f,r.emulatorConfig),r,"emulator-config-failed");return}r.config.emulator=d,r.emulatorConfig=f,r.settings.appVerificationDisabledForTesting=!0,Lt(a)?(xt("Auth",!0),Qs(`${i}//${a}${l}`)):Og()}function Wl(n){const e=n.indexOf(":");return e<0?"":n.substr(0,e+1)}function Vg(n){const e=Wl(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:eu(r.substr(i.length+1))}}else{const[i,a]=r.split(":");return{host:i,port:eu(a)}}}function eu(n){if(!n)return null;const e=Number(n);return isNaN(e)?null:e}function Og(){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())}/**
888
917
  * @license
889
918
  * Copyright 2020 Google LLC
890
919
  *
@@ -899,7 +928,7 @@ import{x as zf,_ as wo,z as Ht,k as Gf,y as Wf}from"./index-DxqO1ZJV.js";import{
899
928
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
900
929
  * See the License for the specific language governing permissions and
901
930
  * limitations under the License.
902
- */class Do{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 bg(n,e){return Mt(n,"POST","/v1/accounts:signUp",e)}/**
931
+ */class xo{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 Lg(n,e){return Ut(n,"POST","/v1/accounts:signUp",e)}/**
903
932
  * @license
904
933
  * Copyright 2020 Google LLC
905
934
  *
@@ -914,7 +943,7 @@ import{x as zf,_ as wo,z as Ht,k as Gf,y as Wf}from"./index-DxqO1ZJV.js";import{
914
943
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
915
944
  * See the License for the specific language governing permissions and
916
945
  * limitations under the License.
917
- */async function Pg(n,e){return Cr(n,"POST","/v1/accounts:signInWithPassword",Lt(n,e))}/**
946
+ */async function xg(n,e){return Dr(n,"POST","/v1/accounts:signInWithPassword",Mt(n,e))}/**
918
947
  * @license
919
948
  * Copyright 2020 Google LLC
920
949
  *
@@ -929,7 +958,7 @@ import{x as zf,_ as wo,z as Ht,k as Gf,y as Wf}from"./index-DxqO1ZJV.js";import{
929
958
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
930
959
  * See the License for the specific language governing permissions and
931
960
  * limitations under the License.
932
- */async function Sg(n,e){return Cr(n,"POST","/v1/accounts:signInWithEmailLink",Lt(n,e))}async function Cg(n,e){return Cr(n,"POST","/v1/accounts:signInWithEmailLink",Lt(n,e))}/**
961
+ */async function Mg(n,e){return Dr(n,"POST","/v1/accounts:signInWithEmailLink",Mt(n,e))}async function Ug(n,e){return Dr(n,"POST","/v1/accounts:signInWithEmailLink",Mt(n,e))}/**
933
962
  * @license
934
963
  * Copyright 2020 Google LLC
935
964
  *
@@ -944,7 +973,7 @@ import{x as zf,_ as wo,z as Ht,k as Gf,y as Wf}from"./index-DxqO1ZJV.js";import{
944
973
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
945
974
  * See the License for the specific language governing permissions and
946
975
  * limitations under the License.
947
- */class _r extends Do{constructor(e,t,r,s=null){super("password",r),this._email=e,this._password=t,this._tenantId=s}static _fromEmailAndPassword(e,t){return new _r(e,t,"password")}static _fromEmailAndCode(e,t,r=null){return new _r(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 Kc(e,t,"signInWithPassword",Pg);case"emailLink":return Sg(e,{email:this._email,oobCode:this._password});default:Me(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 Kc(e,r,"signUpPassword",bg);case"emailLink":return Cg(e,{idToken:t,email:this._email,oobCode:this._password});default:Me(e,"internal-error")}}_getReauthenticationResolver(e){return this._getIdTokenResponse(e)}}/**
976
+ */class Tr extends xo{constructor(e,t,r,s=null){super("password",r),this._email=e,this._password=t,this._tenantId=s}static _fromEmailAndPassword(e,t){return new Tr(e,t,"password")}static _fromEmailAndCode(e,t,r=null){return new Tr(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 Zc(e,t,"signInWithPassword",xg);case"emailLink":return Mg(e,{email:this._email,oobCode:this._password});default:xe(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 Zc(e,r,"signUpPassword",Lg);case"emailLink":return Ug(e,{idToken:t,email:this._email,oobCode:this._password});default:xe(e,"internal-error")}}_getReauthenticationResolver(e){return this._getIdTokenResponse(e)}}/**
948
977
  * @license
949
978
  * Copyright 2020 Google LLC
950
979
  *
@@ -959,7 +988,7 @@ import{x as zf,_ as wo,z as Ht,k as Gf,y as Wf}from"./index-DxqO1ZJV.js";import{
959
988
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
960
989
  * See the License for the specific language governing permissions and
961
990
  * limitations under the License.
962
- */async function En(n,e){return Cr(n,"POST","/v1/accounts:signInWithIdp",Lt(n,e))}/**
991
+ */async function In(n,e){return Dr(n,"POST","/v1/accounts:signInWithIdp",Mt(n,e))}/**
963
992
  * @license
964
993
  * Copyright 2020 Google LLC
965
994
  *
@@ -974,7 +1003,7 @@ import{x as zf,_ as wo,z as Ht,k as Gf,y as Wf}from"./index-DxqO1ZJV.js";import{
974
1003
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
975
1004
  * See the License for the specific language governing permissions and
976
1005
  * limitations under the License.
977
- */const kg="http://localhost";class Xt extends Do{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(e){const t=new Xt(e.providerId,e.signInMethod);return e.idToken||e.accessToken?(e.idToken&&(t.idToken=e.idToken),e.accessToken&&(t.accessToken=e.accessToken),e.nonce&&!e.pendingToken&&(t.nonce=e.nonce),e.pendingToken&&(t.pendingToken=e.pendingToken)):e.oauthToken&&e.oauthTokenSecret?(t.accessToken=e.oauthToken,t.secret=e.oauthTokenSecret):Me("argument-error"),t}toJSON(){return{idToken:this.idToken,accessToken:this.accessToken,secret:this.secret,nonce:this.nonce,pendingToken:this.pendingToken,providerId:this.providerId,signInMethod:this.signInMethod}}static fromJSON(e){const t=typeof e=="string"?JSON.parse(e):e,{providerId:r,signInMethod:s}=t,i=wo(t,["providerId","signInMethod"]);if(!r||!s)return null;const a=new Xt(r,s);return a.idToken=i.idToken||void 0,a.accessToken=i.accessToken||void 0,a.secret=i.secret,a.nonce=i.nonce,a.pendingToken=i.pendingToken||null,a}_getIdTokenResponse(e){const t=this.buildRequest();return En(e,t)}_linkToIdToken(e,t){const r=this.buildRequest();return r.idToken=t,En(e,r)}_getReauthenticationResolver(e){const t=this.buildRequest();return t.autoCreate=!1,En(e,t)}buildRequest(){const e={requestUri:kg,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=br(t)}return e}}/**
1006
+ */const Fg="http://localhost";class Jt extends xo{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(e){const t=new Jt(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):xe("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=Po(t,["providerId","signInMethod"]);if(!r||!s)return null;const a=new Jt(r,s);return a.idToken=i.idToken||void 0,a.accessToken=i.accessToken||void 0,a.secret=i.secret,a.nonce=i.nonce,a.pendingToken=i.pendingToken||null,a}_getIdTokenResponse(e){const t=this.buildRequest();return In(e,t)}_linkToIdToken(e,t){const r=this.buildRequest();return r.idToken=t,In(e,r)}_getReauthenticationResolver(e){const t=this.buildRequest();return t.autoCreate=!1,In(e,t)}buildRequest(){const e={requestUri:Fg,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=Cr(t)}return e}}/**
978
1007
  * @license
979
1008
  * Copyright 2020 Google LLC
980
1009
  *
@@ -989,7 +1018,7 @@ import{x as zf,_ as wo,z as Ht,k as Gf,y as Wf}from"./index-DxqO1ZJV.js";import{
989
1018
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
990
1019
  * See the License for the specific language governing permissions and
991
1020
  * limitations under the License.
992
- */function Ng(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 Dg(n){const e=sr(ir(n)).link,t=e?sr(ir(e)).deep_link_id:null,r=sr(ir(n)).deep_link_id;return(r?sr(ir(r)).link:null)||r||t||e||n}class Oo{constructor(e){var t,r,s,i,a,c;const l=sr(ir(e)),d=(t=l.apiKey)!==null&&t!==void 0?t:null,f=(r=l.oobCode)!==null&&r!==void 0?r:null,m=Ng((s=l.mode)!==null&&s!==void 0?s:null);x(d&&f&&m,"argument-error"),this.apiKey=d,this.operation=m,this.code=f,this.continueUrl=(i=l.continueUrl)!==null&&i!==void 0?i:null,this.languageCode=(a=l.languageCode)!==null&&a!==void 0?a:null,this.tenantId=(c=l.tenantId)!==null&&c!==void 0?c:null}static parseLink(e){const t=Dg(e);try{return new Oo(t)}catch{return null}}}/**
1021
+ */function Bg(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 qg(n){const e=or(ar(n)).link,t=e?or(ar(e)).deep_link_id:null,r=or(ar(n)).deep_link_id;return(r?or(ar(r)).link:null)||r||t||e||n}class Mo{constructor(e){var t,r,s,i,a,c;const l=or(ar(e)),d=(t=l.apiKey)!==null&&t!==void 0?t:null,f=(r=l.oobCode)!==null&&r!==void 0?r:null,m=Bg((s=l.mode)!==null&&s!==void 0?s:null);U(d&&f&&m,"argument-error"),this.apiKey=d,this.operation=m,this.code=f,this.continueUrl=(i=l.continueUrl)!==null&&i!==void 0?i:null,this.languageCode=(a=l.lang)!==null&&a!==void 0?a:null,this.tenantId=(c=l.tenantId)!==null&&c!==void 0?c:null}static parseLink(e){const t=qg(e);try{return new Mo(t)}catch{return null}}}/**
993
1022
  * @license
994
1023
  * Copyright 2020 Google LLC
995
1024
  *
@@ -1004,7 +1033,7 @@ import{x as zf,_ as wo,z as Ht,k as Gf,y as Wf}from"./index-DxqO1ZJV.js";import{
1004
1033
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1005
1034
  * See the License for the specific language governing permissions and
1006
1035
  * limitations under the License.
1007
- */class On{constructor(){this.providerId=On.PROVIDER_ID}static credential(e,t){return _r._fromEmailAndPassword(e,t)}static credentialWithLink(e,t){const r=Oo.parseLink(t);return x(r,"argument-error"),_r._fromEmailAndCode(e,r.code,r.tenantId)}}On.PROVIDER_ID="password";On.EMAIL_PASSWORD_SIGN_IN_METHOD="password";On.EMAIL_LINK_SIGN_IN_METHOD="emailLink";/**
1036
+ */class Ln{constructor(){this.providerId=Ln.PROVIDER_ID}static credential(e,t){return Tr._fromEmailAndPassword(e,t)}static credentialWithLink(e,t){const r=Mo.parseLink(t);return U(r,"argument-error"),Tr._fromEmailAndCode(e,r.code,r.tenantId)}}Ln.PROVIDER_ID="password";Ln.EMAIL_PASSWORD_SIGN_IN_METHOD="password";Ln.EMAIL_LINK_SIGN_IN_METHOD="emailLink";/**
1008
1037
  * @license
1009
1038
  * Copyright 2020 Google LLC
1010
1039
  *
@@ -1019,7 +1048,7 @@ import{x as zf,_ as wo,z as Ht,k as Gf,y as Wf}from"./index-DxqO1ZJV.js";import{
1019
1048
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1020
1049
  * See the License for the specific language governing permissions and
1021
1050
  * limitations under the License.
1022
- */class Vo{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}}/**
1051
+ */class Uo{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}}/**
1023
1052
  * @license
1024
1053
  * Copyright 2019 Google LLC
1025
1054
  *
@@ -1034,7 +1063,7 @@ import{x as zf,_ as wo,z as Ht,k as Gf,y as Wf}from"./index-DxqO1ZJV.js";import{
1034
1063
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1035
1064
  * See the License for the specific language governing permissions and
1036
1065
  * limitations under the License.
1037
- */class kr extends Vo{constructor(){super(...arguments),this.scopes=[]}addScope(e){return this.scopes.includes(e)||this.scopes.push(e),this}getScopes(){return[...this.scopes]}}/**
1066
+ */class Vr extends Uo{constructor(){super(...arguments),this.scopes=[]}addScope(e){return this.scopes.includes(e)||this.scopes.push(e),this}getScopes(){return[...this.scopes]}}/**
1038
1067
  * @license
1039
1068
  * Copyright 2020 Google LLC
1040
1069
  *
@@ -1049,7 +1078,7 @@ import{x as zf,_ as wo,z as Ht,k as Gf,y as Wf}from"./index-DxqO1ZJV.js";import{
1049
1078
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1050
1079
  * See the License for the specific language governing permissions and
1051
1080
  * limitations under the License.
1052
- */class Tt extends kr{constructor(){super("facebook.com")}static credential(e){return Xt._fromParams({providerId:Tt.PROVIDER_ID,signInMethod:Tt.FACEBOOK_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return Tt.credentialFromTaggedObject(e)}static credentialFromError(e){return Tt.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return Tt.credential(e.oauthAccessToken)}catch{return null}}}Tt.FACEBOOK_SIGN_IN_METHOD="facebook.com";Tt.PROVIDER_ID="facebook.com";/**
1081
+ */class Et extends Vr{constructor(){super("facebook.com")}static credential(e){return Jt._fromParams({providerId:Et.PROVIDER_ID,signInMethod:Et.FACEBOOK_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return Et.credentialFromTaggedObject(e)}static credentialFromError(e){return Et.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return Et.credential(e.oauthAccessToken)}catch{return null}}}Et.FACEBOOK_SIGN_IN_METHOD="facebook.com";Et.PROVIDER_ID="facebook.com";/**
1053
1082
  * @license
1054
1083
  * Copyright 2020 Google LLC
1055
1084
  *
@@ -1064,7 +1093,7 @@ import{x as zf,_ as wo,z as Ht,k as Gf,y as Wf}from"./index-DxqO1ZJV.js";import{
1064
1093
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1065
1094
  * See the License for the specific language governing permissions and
1066
1095
  * limitations under the License.
1067
- */class rt extends kr{constructor(){super("google.com"),this.addScope("profile")}static credential(e,t){return Xt._fromParams({providerId:rt.PROVIDER_ID,signInMethod:rt.GOOGLE_SIGN_IN_METHOD,idToken:e,accessToken:t})}static credentialFromResult(e){return rt.credentialFromTaggedObject(e)}static credentialFromError(e){return rt.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthIdToken:t,oauthAccessToken:r}=e;if(!t&&!r)return null;try{return rt.credential(t,r)}catch{return null}}}rt.GOOGLE_SIGN_IN_METHOD="google.com";rt.PROVIDER_ID="google.com";/**
1096
+ */class rt extends Vr{constructor(){super("google.com"),this.addScope("profile")}static credential(e,t){return Jt._fromParams({providerId:rt.PROVIDER_ID,signInMethod:rt.GOOGLE_SIGN_IN_METHOD,idToken:e,accessToken:t})}static credentialFromResult(e){return rt.credentialFromTaggedObject(e)}static credentialFromError(e){return rt.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthIdToken:t,oauthAccessToken:r}=e;if(!t&&!r)return null;try{return rt.credential(t,r)}catch{return null}}}rt.GOOGLE_SIGN_IN_METHOD="google.com";rt.PROVIDER_ID="google.com";/**
1068
1097
  * @license
1069
1098
  * Copyright 2020 Google LLC
1070
1099
  *
@@ -1079,7 +1108,7 @@ import{x as zf,_ as wo,z as Ht,k as Gf,y as Wf}from"./index-DxqO1ZJV.js";import{
1079
1108
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1080
1109
  * See the License for the specific language governing permissions and
1081
1110
  * limitations under the License.
1082
- */class Et extends kr{constructor(){super("github.com")}static credential(e){return Xt._fromParams({providerId:Et.PROVIDER_ID,signInMethod:Et.GITHUB_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return Et.credentialFromTaggedObject(e)}static credentialFromError(e){return Et.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return Et.credential(e.oauthAccessToken)}catch{return null}}}Et.GITHUB_SIGN_IN_METHOD="github.com";Et.PROVIDER_ID="github.com";/**
1111
+ */class Tt extends Vr{constructor(){super("github.com")}static credential(e){return Jt._fromParams({providerId:Tt.PROVIDER_ID,signInMethod:Tt.GITHUB_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return Tt.credentialFromTaggedObject(e)}static credentialFromError(e){return Tt.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return Tt.credential(e.oauthAccessToken)}catch{return null}}}Tt.GITHUB_SIGN_IN_METHOD="github.com";Tt.PROVIDER_ID="github.com";/**
1083
1112
  * @license
1084
1113
  * Copyright 2020 Google LLC
1085
1114
  *
@@ -1094,7 +1123,7 @@ import{x as zf,_ as wo,z as Ht,k as Gf,y as Wf}from"./index-DxqO1ZJV.js";import{
1094
1123
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1095
1124
  * See the License for the specific language governing permissions and
1096
1125
  * limitations under the License.
1097
- */class vt extends kr{constructor(){super("twitter.com")}static credential(e,t){return Xt._fromParams({providerId:vt.PROVIDER_ID,signInMethod:vt.TWITTER_SIGN_IN_METHOD,oauthToken:e,oauthTokenSecret:t})}static credentialFromResult(e){return vt.credentialFromTaggedObject(e)}static credentialFromError(e){return vt.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthAccessToken:t,oauthTokenSecret:r}=e;if(!t||!r)return null;try{return vt.credential(t,r)}catch{return null}}}vt.TWITTER_SIGN_IN_METHOD="twitter.com";vt.PROVIDER_ID="twitter.com";/**
1126
+ */class vt extends Vr{constructor(){super("twitter.com")}static credential(e,t){return Jt._fromParams({providerId:vt.PROVIDER_ID,signInMethod:vt.TWITTER_SIGN_IN_METHOD,oauthToken:e,oauthTokenSecret:t})}static credentialFromResult(e){return vt.credentialFromTaggedObject(e)}static credentialFromError(e){return vt.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthAccessToken:t,oauthTokenSecret:r}=e;if(!t||!r)return null;try{return vt.credential(t,r)}catch{return null}}}vt.TWITTER_SIGN_IN_METHOD="twitter.com";vt.PROVIDER_ID="twitter.com";/**
1098
1127
  * @license
1099
1128
  * Copyright 2020 Google LLC
1100
1129
  *
@@ -1109,7 +1138,7 @@ import{x as zf,_ as wo,z as Ht,k as Gf,y as Wf}from"./index-DxqO1ZJV.js";import{
1109
1138
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1110
1139
  * See the License for the specific language governing permissions and
1111
1140
  * limitations under the License.
1112
- */class Jt{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 Fe._fromIdTokenResponse(e,r,s),a=Xc(r);return new Jt({user:i,providerId:a,_tokenResponse:r,operationType:t})}static async _forOperation(e,t,r){await e._updateTokensIfNecessary(r,!0);const s=Xc(r);return new Jt({user:e,providerId:s,_tokenResponse:r,operationType:t})}}function Xc(n){return n.providerId?n.providerId:"phoneNumber"in n?"phone":null}/**
1141
+ */class Zt{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 Fe._fromIdTokenResponse(e,r,s),a=tu(r);return new Zt({user:i,providerId:a,_tokenResponse:r,operationType:t})}static async _forOperation(e,t,r){await e._updateTokensIfNecessary(r,!0);const s=tu(r);return new Zt({user:e,providerId:s,_tokenResponse:r,operationType:t})}}function tu(n){return n.providerId?n.providerId:"phoneNumber"in n?"phone":null}/**
1113
1142
  * @license
1114
1143
  * Copyright 2020 Google LLC
1115
1144
  *
@@ -1124,7 +1153,7 @@ import{x as zf,_ as wo,z as Ht,k as Gf,y as Wf}from"./index-DxqO1ZJV.js";import{
1124
1153
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1125
1154
  * See the License for the specific language governing permissions and
1126
1155
  * limitations under the License.
1127
- */class Ss extends He{constructor(e,t,r,s){var i;super(t.code,t.message),this.operationType=r,this.user=s,Object.setPrototypeOf(this,Ss.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 Ss(e,t,r,s)}}function $l(n,e,t,r){return(e==="reauthenticate"?t._getReauthenticationResolver(n):t._getIdTokenResponse(n)).catch(i=>{throw i.code==="auth/multi-factor-auth-required"?Ss._fromErrorAndOperation(n,i,e,r):i})}async function Og(n,e,t=!1){const r=await gr(n,e._linkToIdToken(n.auth,await n.getIdToken()),t);return Jt._forOperation(n,"link",r)}/**
1156
+ */class Ns extends ze{constructor(e,t,r,s){var i;super(t.code,t.message),this.operationType=r,this.user=s,Object.setPrototypeOf(this,Ns.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 Ns(e,t,r,s)}}function Kl(n,e,t,r){return(e==="reauthenticate"?t._getReauthenticationResolver(n):t._getIdTokenResponse(n)).catch(i=>{throw i.code==="auth/multi-factor-auth-required"?Ns._fromErrorAndOperation(n,i,e,r):i})}async function jg(n,e,t=!1){const r=await Er(n,e._linkToIdToken(n.auth,await n.getIdToken()),t);return Zt._forOperation(n,"link",r)}/**
1128
1157
  * @license
1129
1158
  * Copyright 2019 Google LLC
1130
1159
  *
@@ -1139,7 +1168,7 @@ import{x as zf,_ as wo,z as Ht,k as Gf,y as Wf}from"./index-DxqO1ZJV.js";import{
1139
1168
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1140
1169
  * See the License for the specific language governing permissions and
1141
1170
  * limitations under the License.
1142
- */async function Vg(n,e,t=!1){const{auth:r}=n;if(Pe(r.app))return Promise.reject(ot(r));const s="reauthenticate";try{const i=await gr(n,$l(r,s,e,n),t);x(i.idToken,r,"internal-error");const a=ko(i.idToken);x(a,r,"internal-error");const{sub:c}=a;return x(n.uid===c,r,"user-mismatch"),Jt._forOperation(n,s,i)}catch(i){throw(i==null?void 0:i.code)==="auth/user-not-found"&&Me(r,"user-mismatch"),i}}/**
1171
+ */async function $g(n,e,t=!1){const{auth:r}=n;if(Pe(r.app))return Promise.reject(ot(r));const s="reauthenticate";try{const i=await Er(n,Kl(r,s,e,n),t);U(i.idToken,r,"internal-error");const a=Oo(i.idToken);U(a,r,"internal-error");const{sub:c}=a;return U(n.uid===c,r,"user-mismatch"),Zt._forOperation(n,s,i)}catch(i){throw(i==null?void 0:i.code)==="auth/user-not-found"&&xe(r,"user-mismatch"),i}}/**
1143
1172
  * @license
1144
1173
  * Copyright 2020 Google LLC
1145
1174
  *
@@ -1154,7 +1183,7 @@ import{x as zf,_ as wo,z as Ht,k as Gf,y as Wf}from"./index-DxqO1ZJV.js";import{
1154
1183
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1155
1184
  * See the License for the specific language governing permissions and
1156
1185
  * limitations under the License.
1157
- */async function jl(n,e,t=!1){if(Pe(n.app))return Promise.reject(ot(n));const r="signIn",s=await $l(n,r,e),i=await Jt._fromIdTokenResponse(n,r,s);return t||await n._updateCurrentUser(i.user),i}async function Lg(n,e){return jl(xt(n),e)}/**
1186
+ */async function Ql(n,e,t=!1){if(Pe(n.app))return Promise.reject(ot(n));const r="signIn",s=await Kl(n,r,e),i=await Zt._fromIdTokenResponse(n,r,s);return t||await n._updateCurrentUser(i.user),i}async function zg(n,e){return Ql(Ft(n),e)}/**
1158
1187
  * @license
1159
1188
  * Copyright 2020 Google LLC
1160
1189
  *
@@ -1169,7 +1198,7 @@ import{x as zf,_ as wo,z as Ht,k as Gf,y as Wf}from"./index-DxqO1ZJV.js";import{
1169
1198
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1170
1199
  * See the License for the specific language governing permissions and
1171
1200
  * limitations under the License.
1172
- */async function Mg(n,e){return Cr(n,"POST","/v1/accounts:signInWithCustomToken",Lt(n,e))}/**
1201
+ */async function Hg(n,e){return Dr(n,"POST","/v1/accounts:signInWithCustomToken",Mt(n,e))}/**
1173
1202
  * @license
1174
1203
  * Copyright 2020 Google LLC
1175
1204
  *
@@ -1184,7 +1213,7 @@ import{x as zf,_ as wo,z as Ht,k as Gf,y as Wf}from"./index-DxqO1ZJV.js";import{
1184
1213
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1185
1214
  * See the License for the specific language governing permissions and
1186
1215
  * limitations under the License.
1187
- */async function xg(n,e){if(Pe(n.app))return Promise.reject(ot(n));const t=xt(n),r=await Mg(t,{token:e,returnSecureToken:!0}),s=await Jt._fromIdTokenResponse(t,"signIn",r);return await t._updateCurrentUser(s.user),s}/**
1216
+ */async function Gg(n,e){if(Pe(n.app))return Promise.reject(ot(n));const t=Ft(n),r=await Hg(t,{token:e,returnSecureToken:!0}),s=await Zt._fromIdTokenResponse(t,"signIn",r);return await t._updateCurrentUser(s.user),s}/**
1188
1217
  * @license
1189
1218
  * Copyright 2020 Google LLC
1190
1219
  *
@@ -1199,7 +1228,7 @@ import{x as zf,_ as wo,z as Ht,k as Gf,y as Wf}from"./index-DxqO1ZJV.js";import{
1199
1228
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1200
1229
  * See the License for the specific language governing permissions and
1201
1230
  * limitations under the License.
1202
- */async function Ug(n){const e=xt(n);e._getPasswordPolicyInternal()&&await e._updatePasswordPolicy()}function Fg(n,e,t){return Pe(n.app)?Promise.reject(ot(n)):Lg(Z(n),On.credential(e,t)).catch(async r=>{throw r.code==="auth/password-does-not-meet-requirements"&&Ug(n),r})}function Bg(n,e,t,r){return Z(n).onIdTokenChanged(e,t,r)}function qg(n,e,t){return Z(n).beforeAuthStateChanged(e,t)}function Hl(n,e,t,r){return Z(n).onAuthStateChanged(e,t,r)}function $g(n){return Z(n).signOut()}const Cs="__sak";/**
1231
+ */async function Wg(n){const e=Ft(n);e._getPasswordPolicyInternal()&&await e._updatePasswordPolicy()}function Kg(n,e,t){return Pe(n.app)?Promise.reject(ot(n)):zg(Z(n),Ln.credential(e,t)).catch(async r=>{throw r.code==="auth/password-does-not-meet-requirements"&&Wg(n),r})}function Qg(n,e,t,r){return Z(n).onIdTokenChanged(e,t,r)}function Xg(n,e,t){return Z(n).beforeAuthStateChanged(e,t)}function Xl(n,e,t,r){return Z(n).onAuthStateChanged(e,t,r)}function Yg(n){return Z(n).signOut()}const Ds="__sak";/**
1203
1232
  * @license
1204
1233
  * Copyright 2019 Google LLC
1205
1234
  *
@@ -1214,7 +1243,7 @@ import{x as zf,_ as wo,z as Ht,k as Gf,y as Wf}from"./index-DxqO1ZJV.js";import{
1214
1243
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1215
1244
  * See the License for the specific language governing permissions and
1216
1245
  * limitations under the License.
1217
- */class zl{constructor(e,t){this.storageRetriever=e,this.type=t}_isAvailable(){try{return this.storage?(this.storage.setItem(Cs,"1"),this.storage.removeItem(Cs),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()}}/**
1246
+ */class Yl{constructor(e,t){this.storageRetriever=e,this.type=t}_isAvailable(){try{return this.storage?(this.storage.setItem(Ds,"1"),this.storage.removeItem(Ds),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()}}/**
1218
1247
  * @license
1219
1248
  * Copyright 2020 Google LLC
1220
1249
  *
@@ -1229,7 +1258,7 @@ import{x as zf,_ as wo,z as Ht,k as Gf,y as Wf}from"./index-DxqO1ZJV.js";import{
1229
1258
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1230
1259
  * See the License for the specific language governing permissions and
1231
1260
  * limitations under the License.
1232
- */const jg=1e3,Hg=10;class Gl extends zl{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(e,t)=>this.onStorageEvent(e,t),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=xl(),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((a,c,l)=>{this.notifyListeners(a,l)});return}const r=e.key;t?this.detachListener():this.stopPolling();const s=()=>{const a=this.storage.getItem(r);!t&&this.localCache[r]===a||this.notifyListeners(r,a)},i=this.storage.getItem(r);ag()&&i!==e.newValue&&e.newValue!==e.oldValue?setTimeout(s,Hg):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)})},jg)}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]}}Gl.type="LOCAL";const zg=Gl;/**
1261
+ */const Jg=1e3,Zg=10;class Jl extends Yl{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(e,t)=>this.onStorageEvent(e,t),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=$l(),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((a,c,l)=>{this.notifyListeners(a,l)});return}const r=e.key;t?this.detachListener():this.stopPolling();const s=()=>{const a=this.storage.getItem(r);!t&&this.localCache[r]===a||this.notifyListeners(r,a)},i=this.storage.getItem(r);gg()&&i!==e.newValue&&e.newValue!==e.oldValue?setTimeout(s,Zg):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)})},Jg)}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]}}Jl.type="LOCAL";const e_=Jl;/**
1233
1262
  * @license
1234
1263
  * Copyright 2020 Google LLC
1235
1264
  *
@@ -1244,7 +1273,7 @@ import{x as zf,_ as wo,z as Ht,k as Gf,y as Wf}from"./index-DxqO1ZJV.js";import{
1244
1273
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1245
1274
  * See the License for the specific language governing permissions and
1246
1275
  * limitations under the License.
1247
- */class Wl extends zl{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(e,t){}_removeListener(e,t){}}Wl.type="SESSION";const Kl=Wl;/**
1276
+ */class Zl extends Yl{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(e,t){}_removeListener(e,t){}}Zl.type="SESSION";const eh=Zl;/**
1248
1277
  * @license
1249
1278
  * Copyright 2019 Google LLC
1250
1279
  *
@@ -1259,7 +1288,7 @@ import{x as zf,_ as wo,z as Ht,k as Gf,y as Wf}from"./index-DxqO1ZJV.js";import{
1259
1288
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1260
1289
  * See the License for the specific language governing permissions and
1261
1290
  * limitations under the License.
1262
- */function Gg(n){return Promise.all(n.map(async e=>{try{return{fulfilled:!0,value:await e}}catch(t){return{fulfilled:!1,reason:t}}}))}/**
1291
+ */function t_(n){return Promise.all(n.map(async e=>{try{return{fulfilled:!0,value:await e}}catch(t){return{fulfilled:!1,reason:t}}}))}/**
1263
1292
  * @license
1264
1293
  * Copyright 2019 Google LLC
1265
1294
  *
@@ -1274,7 +1303,7 @@ import{x as zf,_ as wo,z as Ht,k as Gf,y as Wf}from"./index-DxqO1ZJV.js";import{
1274
1303
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1275
1304
  * See the License for the specific language governing permissions and
1276
1305
  * limitations under the License.
1277
- */class Ks{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 Ks(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,a=this.handlersMap[s];if(!(a!=null&&a.size))return;t.ports[0].postMessage({status:"ack",eventId:r,eventType:s});const c=Array.from(a).map(async d=>d(t.origin,i)),l=await Gg(c);t.ports[0].postMessage({status:"done",eventId:r,eventType:s,response:l})}_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)}}Ks.receivers=[];/**
1306
+ */class Js{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 Js(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,a=this.handlersMap[s];if(!(a!=null&&a.size))return;t.ports[0].postMessage({status:"ack",eventId:r,eventType:s});const c=Array.from(a).map(async d=>d(t.origin,i)),l=await t_(c);t.ports[0].postMessage({status:"done",eventId:r,eventType:s,response:l})}_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)}}Js.receivers=[];/**
1278
1307
  * @license
1279
1308
  * Copyright 2020 Google LLC
1280
1309
  *
@@ -1289,7 +1318,7 @@ import{x as zf,_ as wo,z as Ht,k as Gf,y as Wf}from"./index-DxqO1ZJV.js";import{
1289
1318
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1290
1319
  * See the License for the specific language governing permissions and
1291
1320
  * limitations under the License.
1292
- */function Lo(n="",e=10){let t="";for(let r=0;r<e;r++)t+=Math.floor(Math.random()*10);return n+t}/**
1321
+ */function Fo(n="",e=10){let t="";for(let r=0;r<e;r++)t+=Math.floor(Math.random()*10);return n+t}/**
1293
1322
  * @license
1294
1323
  * Copyright 2019 Google LLC
1295
1324
  *
@@ -1304,7 +1333,7 @@ import{x as zf,_ as wo,z as Ht,k as Gf,y as Wf}from"./index-DxqO1ZJV.js";import{
1304
1333
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1305
1334
  * See the License for the specific language governing permissions and
1306
1335
  * limitations under the License.
1307
- */class Wg{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,a;return new Promise((c,l)=>{const d=Lo("",20);s.port1.start();const f=setTimeout(()=>{l(new Error("unsupported_event"))},r);a={messageChannel:s,onMessage(m){const E=m;if(E.data.eventId===d)switch(E.data.status){case"ack":clearTimeout(f),i=setTimeout(()=>{l(new Error("timeout"))},3e3);break;case"done":clearTimeout(i),c(E.data.response);break;default:clearTimeout(f),clearTimeout(i),l(new Error("invalid_response"));break}}},this.handlers.add(a),s.port1.addEventListener("message",a.onMessage),this.target.postMessage({eventType:e,eventId:d,data:t},[s.port2])}).finally(()=>{a&&this.removeMessageHandler(a)})}}/**
1336
+ */class n_{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,a;return new Promise((c,l)=>{const d=Fo("",20);s.port1.start();const f=setTimeout(()=>{l(new Error("unsupported_event"))},r);a={messageChannel:s,onMessage(m){const _=m;if(_.data.eventId===d)switch(_.data.status){case"ack":clearTimeout(f),i=setTimeout(()=>{l(new Error("timeout"))},3e3);break;case"done":clearTimeout(i),c(_.data.response);break;default:clearTimeout(f),clearTimeout(i),l(new Error("invalid_response"));break}}},this.handlers.add(a),s.port1.addEventListener("message",a.onMessage),this.target.postMessage({eventType:e,eventId:d,data:t},[s.port2])}).finally(()=>{a&&this.removeMessageHandler(a)})}}/**
1308
1337
  * @license
1309
1338
  * Copyright 2020 Google LLC
1310
1339
  *
@@ -1319,7 +1348,7 @@ import{x as zf,_ as wo,z as Ht,k as Gf,y as Wf}from"./index-DxqO1ZJV.js";import{
1319
1348
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1320
1349
  * See the License for the specific language governing permissions and
1321
1350
  * limitations under the License.
1322
- */function Ke(){return window}function Kg(n){Ke().location.href=n}/**
1351
+ */function Ke(){return window}function r_(n){Ke().location.href=n}/**
1323
1352
  * @license
1324
1353
  * Copyright 2020 Google LLC.
1325
1354
  *
@@ -1334,7 +1363,7 @@ import{x as zf,_ as wo,z as Ht,k as Gf,y as Wf}from"./index-DxqO1ZJV.js";import{
1334
1363
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1335
1364
  * See the License for the specific language governing permissions and
1336
1365
  * limitations under the License.
1337
- */function Ql(){return typeof Ke().WorkerGlobalScope<"u"&&typeof Ke().importScripts=="function"}async function Qg(){if(!(navigator!=null&&navigator.serviceWorker))return null;try{return(await navigator.serviceWorker.ready).active}catch{return null}}function Xg(){var n;return((n=navigator==null?void 0:navigator.serviceWorker)===null||n===void 0?void 0:n.controller)||null}function Jg(){return Ql()?self:null}/**
1366
+ */function th(){return typeof Ke().WorkerGlobalScope<"u"&&typeof Ke().importScripts=="function"}async function s_(){if(!(navigator!=null&&navigator.serviceWorker))return null;try{return(await navigator.serviceWorker.ready).active}catch{return null}}function i_(){var n;return((n=navigator==null?void 0:navigator.serviceWorker)===null||n===void 0?void 0:n.controller)||null}function o_(){return th()?self:null}/**
1338
1367
  * @license
1339
1368
  * Copyright 2019 Google LLC
1340
1369
  *
@@ -1349,7 +1378,7 @@ import{x as zf,_ as wo,z as Ht,k as Gf,y as Wf}from"./index-DxqO1ZJV.js";import{
1349
1378
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1350
1379
  * See the License for the specific language governing permissions and
1351
1380
  * limitations under the License.
1352
- */const Xl="firebaseLocalStorageDb",Yg=1,ks="firebaseLocalStorage",Jl="fbase_key";class Nr{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 Qs(n,e){return n.transaction([ks],e?"readwrite":"readonly").objectStore(ks)}function Zg(){const n=indexedDB.deleteDatabase(Xl);return new Nr(n).toPromise()}function so(){const n=indexedDB.open(Xl,Yg);return new Promise((e,t)=>{n.addEventListener("error",()=>{t(n.error)}),n.addEventListener("upgradeneeded",()=>{const r=n.result;try{r.createObjectStore(ks,{keyPath:Jl})}catch(s){t(s)}}),n.addEventListener("success",async()=>{const r=n.result;r.objectStoreNames.contains(ks)?e(r):(r.close(),await Zg(),e(await so()))})})}async function Jc(n,e,t){const r=Qs(n,!0).put({[Jl]:e,value:t});return new Nr(r).toPromise()}async function e_(n,e){const t=Qs(n,!1).get(e),r=await new Nr(t).toPromise();return r===void 0?null:r.value}function Yc(n,e){const t=Qs(n,!0).delete(e);return new Nr(t).toPromise()}const t_=800,n_=3;class Yl{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 so(),this.db)}async _withRetries(e){let t=0;for(;;)try{const r=await this._openDb();return await e(r)}catch(r){if(t++>n_)throw r;this.db&&(this.db.close(),this.db=void 0)}}async initializeServiceWorkerMessaging(){return Ql()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=Ks._getInstance(Jg()),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 Qg(),!this.activeServiceWorker)return;this.sender=new Wg(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||Xg()!==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 so();return await Jc(e,Cs,"1"),await Yc(e,Cs),!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=>Jc(r,e,t)),this.localCache[e]=t,this.notifyServiceWorker(e)))}async _get(e){const t=await this._withRetries(r=>e_(r,e));return this.localCache[e]=t,t}async _remove(e){return this._withPendingWrite(async()=>(await this._withRetries(t=>Yc(t,e)),delete this.localCache[e],this.notifyServiceWorker(e)))}async _poll(){const e=await this._withRetries(s=>{const i=Qs(s,!1).getAll();return new Nr(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(),t_)}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()}}Yl.type="LOCAL";const r_=Yl;new Sr(3e4,6e4);/**
1381
+ */const nh="firebaseLocalStorageDb",a_=1,Vs="firebaseLocalStorage",rh="fbase_key";class Or{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 Zs(n,e){return n.transaction([Vs],e?"readwrite":"readonly").objectStore(Vs)}function c_(){const n=indexedDB.deleteDatabase(nh);return new Or(n).toPromise()}function co(){const n=indexedDB.open(nh,a_);return new Promise((e,t)=>{n.addEventListener("error",()=>{t(n.error)}),n.addEventListener("upgradeneeded",()=>{const r=n.result;try{r.createObjectStore(Vs,{keyPath:rh})}catch(s){t(s)}}),n.addEventListener("success",async()=>{const r=n.result;r.objectStoreNames.contains(Vs)?e(r):(r.close(),await c_(),e(await co()))})})}async function nu(n,e,t){const r=Zs(n,!0).put({[rh]:e,value:t});return new Or(r).toPromise()}async function u_(n,e){const t=Zs(n,!1).get(e),r=await new Or(t).toPromise();return r===void 0?null:r.value}function ru(n,e){const t=Zs(n,!0).delete(e);return new Or(t).toPromise()}const l_=800,h_=3;class sh{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 co(),this.db)}async _withRetries(e){let t=0;for(;;)try{const r=await this._openDb();return await e(r)}catch(r){if(t++>h_)throw r;this.db&&(this.db.close(),this.db=void 0)}}async initializeServiceWorkerMessaging(){return th()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=Js._getInstance(o_()),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 s_(),!this.activeServiceWorker)return;this.sender=new n_(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||i_()!==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 co();return await nu(e,Ds,"1"),await ru(e,Ds),!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=>nu(r,e,t)),this.localCache[e]=t,this.notifyServiceWorker(e)))}async _get(e){const t=await this._withRetries(r=>u_(r,e));return this.localCache[e]=t,t}async _remove(e){return this._withPendingWrite(async()=>(await this._withRetries(t=>ru(t,e)),delete this.localCache[e],this.notifyServiceWorker(e)))}async _poll(){const e=await this._withRetries(s=>{const i=Zs(s,!1).getAll();return new Or(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(),l_)}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()}}sh.type="LOCAL";const d_=sh;new Nr(3e4,6e4);/**
1353
1382
  * @license
1354
1383
  * Copyright 2021 Google LLC
1355
1384
  *
@@ -1364,7 +1393,7 @@ import{x as zf,_ as wo,z as Ht,k as Gf,y as Wf}from"./index-DxqO1ZJV.js";import{
1364
1393
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1365
1394
  * See the License for the specific language governing permissions and
1366
1395
  * limitations under the License.
1367
- */function Zl(n,e){return e?it(e):(x(n._popupRedirectResolver,n,"argument-error"),n._popupRedirectResolver)}/**
1396
+ */function ih(n,e){return e?it(e):(U(n._popupRedirectResolver,n,"argument-error"),n._popupRedirectResolver)}/**
1368
1397
  * @license
1369
1398
  * Copyright 2019 Google LLC
1370
1399
  *
@@ -1379,7 +1408,7 @@ import{x as zf,_ as wo,z as Ht,k as Gf,y as Wf}from"./index-DxqO1ZJV.js";import{
1379
1408
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1380
1409
  * See the License for the specific language governing permissions and
1381
1410
  * limitations under the License.
1382
- */class Mo extends Do{constructor(e){super("custom","custom"),this.params=e}_getIdTokenResponse(e){return En(e,this._buildIdpRequest())}_linkToIdToken(e,t){return En(e,this._buildIdpRequest(t))}_getReauthenticationResolver(e){return En(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 s_(n){return jl(n.auth,new Mo(n),n.bypassAuthState)}function i_(n){const{auth:e,user:t}=n;return x(t,e,"internal-error"),Vg(t,new Mo(n),n.bypassAuthState)}async function o_(n){const{auth:e,user:t}=n;return x(t,e,"internal-error"),Og(t,new Mo(n),n.bypassAuthState)}/**
1411
+ */class Bo extends xo{constructor(e){super("custom","custom"),this.params=e}_getIdTokenResponse(e){return In(e,this._buildIdpRequest())}_linkToIdToken(e,t){return In(e,this._buildIdpRequest(t))}_getReauthenticationResolver(e){return In(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 f_(n){return Ql(n.auth,new Bo(n),n.bypassAuthState)}function p_(n){const{auth:e,user:t}=n;return U(t,e,"internal-error"),$g(t,new Bo(n),n.bypassAuthState)}async function m_(n){const{auth:e,user:t}=n;return U(t,e,"internal-error"),jg(t,new Bo(n),n.bypassAuthState)}/**
1383
1412
  * @license
1384
1413
  * Copyright 2020 Google LLC
1385
1414
  *
@@ -1394,7 +1423,7 @@ import{x as zf,_ as wo,z as Ht,k as Gf,y as Wf}from"./index-DxqO1ZJV.js";import{
1394
1423
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1395
1424
  * See the License for the specific language governing permissions and
1396
1425
  * limitations under the License.
1397
- */class eh{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:a,type:c}=e;if(a){this.reject(a);return}const l={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(c)(l))}catch(d){this.reject(d)}}onError(e){this.reject(e)}getIdpTask(e){switch(e){case"signInViaPopup":case"signInViaRedirect":return s_;case"linkViaPopup":case"linkViaRedirect":return o_;case"reauthViaPopup":case"reauthViaRedirect":return i_;default:Me(this.auth,"internal-error")}}resolve(e){ht(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(e),this.unregisterAndCleanUp()}reject(e){ht(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()}}/**
1426
+ */class oh{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:a,type:c}=e;if(a){this.reject(a);return}const l={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(c)(l))}catch(d){this.reject(d)}}onError(e){this.reject(e)}getIdpTask(e){switch(e){case"signInViaPopup":case"signInViaRedirect":return f_;case"linkViaPopup":case"linkViaRedirect":return m_;case"reauthViaPopup":case"reauthViaRedirect":return p_;default:xe(this.auth,"internal-error")}}resolve(e){ht(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(e),this.unregisterAndCleanUp()}reject(e){ht(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()}}/**
1398
1427
  * @license
1399
1428
  * Copyright 2020 Google LLC
1400
1429
  *
@@ -1409,7 +1438,7 @@ import{x as zf,_ as wo,z as Ht,k as Gf,y as Wf}from"./index-DxqO1ZJV.js";import{
1409
1438
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1410
1439
  * See the License for the specific language governing permissions and
1411
1440
  * limitations under the License.
1412
- */const a_=new Sr(2e3,1e4);async function c_(n,e,t){if(Pe(n.app))return Promise.reject($e(n,"operation-not-supported-in-this-environment"));const r=xt(n);$m(n,e,Vo);const s=Zl(r,t);return new Gt(r,"signInViaPopup",e,s).executeNotNull()}class Gt extends eh{constructor(e,t,r,s,i){super(e,t,s,i),this.provider=r,this.authWindow=null,this.pollId=null,Gt.currentPopupAction&&Gt.currentPopupAction.cancel(),Gt.currentPopupAction=this}async executeNotNull(){const e=await this.execute();return x(e,this.auth,"internal-error"),e}async onExecution(){ht(this.filter.length===1,"Popup operations only handle one event");const e=Lo();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($e(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($e(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,Gt.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($e(this.auth,"popup-closed-by-user"))},8e3);return}this.pollId=window.setTimeout(e,a_.get())};e()}}Gt.currentPopupAction=null;/**
1441
+ */const g_=new Nr(2e3,1e4);async function __(n,e,t){if(Pe(n.app))return Promise.reject(je(n,"operation-not-supported-in-this-environment"));const r=Ft(n);Ym(n,e,Uo);const s=ih(r,t);return new Kt(r,"signInViaPopup",e,s).executeNotNull()}class Kt extends oh{constructor(e,t,r,s,i){super(e,t,s,i),this.provider=r,this.authWindow=null,this.pollId=null,Kt.currentPopupAction&&Kt.currentPopupAction.cancel(),Kt.currentPopupAction=this}async executeNotNull(){const e=await this.execute();return U(e,this.auth,"internal-error"),e}async onExecution(){ht(this.filter.length===1,"Popup operations only handle one event");const e=Fo();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(je(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(je(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,Kt.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(je(this.auth,"popup-closed-by-user"))},8e3);return}this.pollId=window.setTimeout(e,g_.get())};e()}}Kt.currentPopupAction=null;/**
1413
1442
  * @license
1414
1443
  * Copyright 2020 Google LLC
1415
1444
  *
@@ -1424,7 +1453,7 @@ import{x as zf,_ as wo,z as Ht,k as Gf,y as Wf}from"./index-DxqO1ZJV.js";import{
1424
1453
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1425
1454
  * See the License for the specific language governing permissions and
1426
1455
  * limitations under the License.
1427
- */const u_="pendingRedirect",fs=new Map;class l_ extends eh{constructor(e,t,r=!1){super(e,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],t,void 0,r),this.eventId=null}async execute(){let e=fs.get(this.auth._key());if(!e){try{const r=await h_(this.resolver,this.auth)?await super.execute():null;e=()=>Promise.resolve(r)}catch(t){e=()=>Promise.reject(t)}fs.set(this.auth._key(),e)}return this.bypassAuthState||fs.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 h_(n,e){const t=p_(e),r=f_(n);if(!await r._isAvailable())return!1;const s=await r._get(t)==="true";return await r._remove(t),s}function d_(n,e){fs.set(n._key(),e)}function f_(n){return it(n._redirectPersistence)}function p_(n){return ds(u_,n.config.apiKey,n.name)}async function m_(n,e,t=!1){if(Pe(n.app))return Promise.reject(ot(n));const r=xt(n),s=Zl(r,e),a=await new l_(r,s,t).execute();return a&&!t&&(delete a.user._redirectEventId,await r._persistUserIfCurrent(a.user),await r._setRedirectUser(null,e)),a}/**
1456
+ */const y_="pendingRedirect",gs=new Map;class E_ extends oh{constructor(e,t,r=!1){super(e,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],t,void 0,r),this.eventId=null}async execute(){let e=gs.get(this.auth._key());if(!e){try{const r=await T_(this.resolver,this.auth)?await super.execute():null;e=()=>Promise.resolve(r)}catch(t){e=()=>Promise.reject(t)}gs.set(this.auth._key(),e)}return this.bypassAuthState||gs.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 T_(n,e){const t=w_(e),r=I_(n);if(!await r._isAvailable())return!1;const s=await r._get(t)==="true";return await r._remove(t),s}function v_(n,e){gs.set(n._key(),e)}function I_(n){return it(n._redirectPersistence)}function w_(n){return ms(y_,n.config.apiKey,n.name)}async function A_(n,e,t=!1){if(Pe(n.app))return Promise.reject(ot(n));const r=Ft(n),s=ih(r,e),a=await new E_(r,s,t).execute();return a&&!t&&(delete a.user._redirectEventId,await r._persistUserIfCurrent(a.user),await r._setRedirectUser(null,e)),a}/**
1428
1457
  * @license
1429
1458
  * Copyright 2020 Google LLC
1430
1459
  *
@@ -1439,7 +1468,7 @@ import{x as zf,_ as wo,z as Ht,k as Gf,y as Wf}from"./index-DxqO1ZJV.js";import{
1439
1468
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1440
1469
  * See the License for the specific language governing permissions and
1441
1470
  * limitations under the License.
1442
- */const g_=10*60*1e3;class __{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||!y_(e)||(this.hasHandledPotentialRedirect=!0,t||(this.queuedRedirectEvent=e,t=!0)),t}sendToConsumer(e,t){var r;if(e.error&&!th(e)){const s=((r=e.error.code)===null||r===void 0?void 0:r.split("auth/")[1])||"internal-error";t.onError($e(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>=g_&&this.cachedEventUids.clear(),this.cachedEventUids.has(Zc(e))}saveEventToCache(e){this.cachedEventUids.add(Zc(e)),this.lastProcessedEventTime=Date.now()}}function Zc(n){return[n.type,n.eventId,n.sessionId,n.tenantId].filter(e=>e).join("-")}function th({type:n,error:e}){return n==="unknown"&&(e==null?void 0:e.code)==="auth/no-auth-event"}function y_(n){switch(n.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return th(n);default:return!1}}/**
1471
+ */const R_=10*60*1e3;class b_{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||!P_(e)||(this.hasHandledPotentialRedirect=!0,t||(this.queuedRedirectEvent=e,t=!0)),t}sendToConsumer(e,t){var r;if(e.error&&!ah(e)){const s=((r=e.error.code)===null||r===void 0?void 0:r.split("auth/")[1])||"internal-error";t.onError(je(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>=R_&&this.cachedEventUids.clear(),this.cachedEventUids.has(su(e))}saveEventToCache(e){this.cachedEventUids.add(su(e)),this.lastProcessedEventTime=Date.now()}}function su(n){return[n.type,n.eventId,n.sessionId,n.tenantId].filter(e=>e).join("-")}function ah({type:n,error:e}){return n==="unknown"&&(e==null?void 0:e.code)==="auth/no-auth-event"}function P_(n){switch(n.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return ah(n);default:return!1}}/**
1443
1472
  * @license
1444
1473
  * Copyright 2020 Google LLC
1445
1474
  *
@@ -1454,7 +1483,7 @@ import{x as zf,_ as wo,z as Ht,k as Gf,y as Wf}from"./index-DxqO1ZJV.js";import{
1454
1483
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1455
1484
  * See the License for the specific language governing permissions and
1456
1485
  * limitations under the License.
1457
- */async function T_(n,e={}){return Mt(n,"GET","/v1/projects",e)}/**
1486
+ */async function S_(n,e={}){return Ut(n,"GET","/v1/projects",e)}/**
1458
1487
  * @license
1459
1488
  * Copyright 2020 Google LLC
1460
1489
  *
@@ -1469,7 +1498,7 @@ import{x as zf,_ as wo,z as Ht,k as Gf,y as Wf}from"./index-DxqO1ZJV.js";import{
1469
1498
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1470
1499
  * See the License for the specific language governing permissions and
1471
1500
  * limitations under the License.
1472
- */const E_=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,v_=/^https?/;async function I_(n){if(n.config.emulator)return;const{authorizedDomains:e}=await T_(n);for(const t of e)try{if(w_(t))return}catch{}Me(n,"unauthorized-domain")}function w_(n){const e=no(),{protocol:t,hostname:r}=new URL(e);if(n.startsWith("chrome-extension://")){const a=new URL(n);return a.hostname===""&&r===""?t==="chrome-extension:"&&n.replace("chrome-extension://","")===e.replace("chrome-extension://",""):t==="chrome-extension:"&&a.hostname===r}if(!v_.test(t))return!1;if(E_.test(n))return r===n;const s=n.replace(/\./g,"\\.");return new RegExp("^(.+\\."+s+"|"+s+")$","i").test(r)}/**
1501
+ */const C_=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,k_=/^https?/;async function N_(n){if(n.config.emulator)return;const{authorizedDomains:e}=await S_(n);for(const t of e)try{if(D_(t))return}catch{}xe(n,"unauthorized-domain")}function D_(n){const e=oo(),{protocol:t,hostname:r}=new URL(e);if(n.startsWith("chrome-extension://")){const a=new URL(n);return a.hostname===""&&r===""?t==="chrome-extension:"&&n.replace("chrome-extension://","")===e.replace("chrome-extension://",""):t==="chrome-extension:"&&a.hostname===r}if(!k_.test(t))return!1;if(C_.test(n))return r===n;const s=n.replace(/\./g,"\\.");return new RegExp("^(.+\\."+s+"|"+s+")$","i").test(r)}/**
1473
1502
  * @license
1474
1503
  * Copyright 2020 Google LLC.
1475
1504
  *
@@ -1484,7 +1513,7 @@ import{x as zf,_ as wo,z as Ht,k as Gf,y as Wf}from"./index-DxqO1ZJV.js";import{
1484
1513
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1485
1514
  * See the License for the specific language governing permissions and
1486
1515
  * limitations under the License.
1487
- */const A_=new Sr(3e4,6e4);function eu(){const n=Ke().___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 R_(n){return new Promise((e,t)=>{var r,s,i;function a(){eu(),gapi.load("gapi.iframes",{callback:()=>{e(gapi.iframes.getContext())},ontimeout:()=>{eu(),t($e(n,"network-request-failed"))},timeout:A_.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)a();else{const c=gg("iframefcb");return Ke()[c]=()=>{gapi.load?a():t($e(n,"network-request-failed"))},Fl(`${mg()}?onload=${c}`).catch(l=>t(l))}}).catch(e=>{throw ps=null,e})}let ps=null;function b_(n){return ps=ps||R_(n),ps}/**
1516
+ */const V_=new Nr(3e4,6e4);function iu(){const n=Ke().___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 O_(n){return new Promise((e,t)=>{var r,s,i;function a(){iu(),gapi.load("gapi.iframes",{callback:()=>{e(gapi.iframes.getContext())},ontimeout:()=>{iu(),t(je(n,"network-request-failed"))},timeout:V_.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)a();else{const c=Rg("iframefcb");return Ke()[c]=()=>{gapi.load?a():t(je(n,"network-request-failed"))},Hl(`${Ag()}?onload=${c}`).catch(l=>t(l))}}).catch(e=>{throw _s=null,e})}let _s=null;function L_(n){return _s=_s||O_(n),_s}/**
1488
1517
  * @license
1489
1518
  * Copyright 2020 Google LLC.
1490
1519
  *
@@ -1499,7 +1528,7 @@ import{x as zf,_ as wo,z as Ht,k as Gf,y as Wf}from"./index-DxqO1ZJV.js";import{
1499
1528
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1500
1529
  * See the License for the specific language governing permissions and
1501
1530
  * limitations under the License.
1502
- */const P_=new Sr(5e3,15e3),S_="__/auth/iframe",C_="emulator/auth/iframe",k_={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},N_=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function D_(n){const e=n.config;x(e.authDomain,n,"auth-domain-config-required");const t=e.emulator?Co(e,C_):`https://${n.config.authDomain}/${S_}`,r={apiKey:e.apiKey,appName:n.name,v:nn},s=N_.get(n.config.apiHost);s&&(r.eid=s);const i=n._getFrameworks();return i.length&&(r.fw=i.join(",")),`${t}?${br(r).slice(1)}`}async function O_(n){const e=await b_(n),t=Ke().gapi;return x(t,n,"internal-error"),e.open({where:document.body,url:D_(n),messageHandlersFilter:t.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:k_,dontclear:!0},r=>new Promise(async(s,i)=>{await r.restyle({setHideOnLeave:!1});const a=$e(n,"network-request-failed"),c=Ke().setTimeout(()=>{i(a)},P_.get());function l(){Ke().clearTimeout(c),s(r)}r.ping(l).then(l,()=>{i(a)})}))}/**
1531
+ */const x_=new Nr(5e3,15e3),M_="__/auth/iframe",U_="emulator/auth/iframe",F_={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},B_=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function q_(n){const e=n.config;U(e.authDomain,n,"auth-domain-config-required");const t=e.emulator?Vo(e,U_):`https://${n.config.authDomain}/${M_}`,r={apiKey:e.apiKey,appName:n.name,v:sn},s=B_.get(n.config.apiHost);s&&(r.eid=s);const i=n._getFrameworks();return i.length&&(r.fw=i.join(",")),`${t}?${Cr(r).slice(1)}`}async function j_(n){const e=await L_(n),t=Ke().gapi;return U(t,n,"internal-error"),e.open({where:document.body,url:q_(n),messageHandlersFilter:t.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:F_,dontclear:!0},r=>new Promise(async(s,i)=>{await r.restyle({setHideOnLeave:!1});const a=je(n,"network-request-failed"),c=Ke().setTimeout(()=>{i(a)},x_.get());function l(){Ke().clearTimeout(c),s(r)}r.ping(l).then(l,()=>{i(a)})}))}/**
1503
1532
  * @license
1504
1533
  * Copyright 2020 Google LLC.
1505
1534
  *
@@ -1514,7 +1543,7 @@ import{x as zf,_ as wo,z as Ht,k as Gf,y as Wf}from"./index-DxqO1ZJV.js";import{
1514
1543
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1515
1544
  * See the License for the specific language governing permissions and
1516
1545
  * limitations under the License.
1517
- */const V_={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"},L_=500,M_=600,x_="_blank",U_="http://localhost";class tu{constructor(e){this.window=e,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch{}}}function F_(n,e,t,r=L_,s=M_){const i=Math.max((window.screen.availHeight-s)/2,0).toString(),a=Math.max((window.screen.availWidth-r)/2,0).toString();let c="";const l=Object.assign(Object.assign({},V_),{width:r.toString(),height:s.toString(),top:i,left:a}),d=we().toLowerCase();t&&(c=Dl(d)?x_:t),kl(d)&&(e=e||U_,l.scrollbars="yes");const f=Object.entries(l).reduce((E,[R,C])=>`${E}${R}=${C},`,"");if(og(d)&&c!=="_self")return B_(e||"",c),new tu(null);const m=window.open(e||"",c,f);x(m,n,"popup-blocked");try{m.focus()}catch{}return new tu(m)}function B_(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)}/**
1546
+ */const $_={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"},z_=500,H_=600,G_="_blank",W_="http://localhost";class ou{constructor(e){this.window=e,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch{}}}function K_(n,e,t,r=z_,s=H_){const i=Math.max((window.screen.availHeight-s)/2,0).toString(),a=Math.max((window.screen.availWidth-r)/2,0).toString();let c="";const l=Object.assign(Object.assign({},$_),{width:r.toString(),height:s.toString(),top:i,left:a}),d=we().toLowerCase();t&&(c=Ul(d)?G_:t),xl(d)&&(e=e||W_,l.scrollbars="yes");const f=Object.entries(l).reduce((_,[R,S])=>`${_}${R}=${S},`,"");if(mg(d)&&c!=="_self")return Q_(e||"",c),new ou(null);const m=window.open(e||"",c,f);U(m,n,"popup-blocked");try{m.focus()}catch{}return new ou(m)}function Q_(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)}/**
1518
1547
  * @license
1519
1548
  * Copyright 2021 Google LLC
1520
1549
  *
@@ -1529,7 +1558,7 @@ import{x as zf,_ as wo,z as Ht,k as Gf,y as Wf}from"./index-DxqO1ZJV.js";import{
1529
1558
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1530
1559
  * See the License for the specific language governing permissions and
1531
1560
  * limitations under the License.
1532
- */const q_="__/auth/handler",$_="emulator/auth/handler",j_=encodeURIComponent("fac");async function nu(n,e,t,r,s,i){x(n.config.authDomain,n,"auth-domain-config-required"),x(n.config.apiKey,n,"invalid-api-key");const a={apiKey:n.config.apiKey,appName:n.name,authType:t,redirectUrl:r,v:nn,eventId:s};if(e instanceof Vo){e.setDefaultLanguage(n.languageCode),a.providerId=e.providerId||"",gp(e.getCustomParameters())||(a.customParameters=JSON.stringify(e.getCustomParameters()));for(const[f,m]of Object.entries({}))a[f]=m}if(e instanceof kr){const f=e.getScopes().filter(m=>m!=="");f.length>0&&(a.scopes=f.join(","))}n.tenantId&&(a.tid=n.tenantId);const c=a;for(const f of Object.keys(c))c[f]===void 0&&delete c[f];const l=await n._getAppCheckToken(),d=l?`#${j_}=${encodeURIComponent(l)}`:"";return`${H_(n)}?${br(c).slice(1)}${d}`}function H_({config:n}){return n.emulator?Co(n,$_):`https://${n.authDomain}/${q_}`}/**
1561
+ */const X_="__/auth/handler",Y_="emulator/auth/handler",J_=encodeURIComponent("fac");async function au(n,e,t,r,s,i){U(n.config.authDomain,n,"auth-domain-config-required"),U(n.config.apiKey,n,"invalid-api-key");const a={apiKey:n.config.apiKey,appName:n.name,authType:t,redirectUrl:r,v:sn,eventId:s};if(e instanceof Uo){e.setDefaultLanguage(n.languageCode),a.providerId=e.providerId||"",Rp(e.getCustomParameters())||(a.customParameters=JSON.stringify(e.getCustomParameters()));for(const[f,m]of Object.entries({}))a[f]=m}if(e instanceof Vr){const f=e.getScopes().filter(m=>m!=="");f.length>0&&(a.scopes=f.join(","))}n.tenantId&&(a.tid=n.tenantId);const c=a;for(const f of Object.keys(c))c[f]===void 0&&delete c[f];const l=await n._getAppCheckToken(),d=l?`#${J_}=${encodeURIComponent(l)}`:"";return`${Z_(n)}?${Cr(c).slice(1)}${d}`}function Z_({config:n}){return n.emulator?Vo(n,Y_):`https://${n.authDomain}/${X_}`}/**
1533
1562
  * @license
1534
1563
  * Copyright 2020 Google LLC
1535
1564
  *
@@ -1544,7 +1573,7 @@ import{x as zf,_ as wo,z as Ht,k as Gf,y as Wf}from"./index-DxqO1ZJV.js";import{
1544
1573
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1545
1574
  * See the License for the specific language governing permissions and
1546
1575
  * limitations under the License.
1547
- */const Hi="webStorageSupport";class z_{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=Kl,this._completeRedirectFn=m_,this._overrideRedirectResult=d_}async _openPopup(e,t,r,s){var i;ht((i=this.eventManagers[e._key()])===null||i===void 0?void 0:i.manager,"_initialize() not called before _openPopup()");const a=await nu(e,t,r,no(),s);return F_(e,a,Lo())}async _openRedirect(e,t,r,s){await this._originValidation(e);const i=await nu(e,t,r,no(),s);return Kg(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):(ht(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 O_(e),r=new __(e);return t.register("authEvent",s=>(x(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(Hi,{type:Hi},s=>{var i;const a=(i=s==null?void 0:s[0])===null||i===void 0?void 0:i[Hi];a!==void 0&&t(!!a),Me(e,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(e){const t=e._key();return this.originValidationPromises[t]||(this.originValidationPromises[t]=I_(e)),this.originValidationPromises[t]}get _shouldInitProactively(){return xl()||Nl()||No()}}const G_=z_;var ru="@firebase/auth",su="1.10.0";/**
1576
+ */const Ki="webStorageSupport";class ey{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=eh,this._completeRedirectFn=A_,this._overrideRedirectResult=v_}async _openPopup(e,t,r,s){var i;ht((i=this.eventManagers[e._key()])===null||i===void 0?void 0:i.manager,"_initialize() not called before _openPopup()");const a=await au(e,t,r,oo(),s);return K_(e,a,Fo())}async _openRedirect(e,t,r,s){await this._originValidation(e);const i=await au(e,t,r,oo(),s);return r_(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):(ht(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 j_(e),r=new b_(e);return t.register("authEvent",s=>(U(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(Ki,{type:Ki},s=>{var i;const a=(i=s==null?void 0:s[0])===null||i===void 0?void 0:i[Ki];a!==void 0&&t(!!a),xe(e,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(e){const t=e._key();return this.originValidationPromises[t]||(this.originValidationPromises[t]=N_(e)),this.originValidationPromises[t]}get _shouldInitProactively(){return $l()||Ml()||Lo()}}const ty=ey;var cu="@firebase/auth",uu="1.10.5";/**
1548
1577
  * @license
1549
1578
  * Copyright 2020 Google LLC
1550
1579
  *
@@ -1559,7 +1588,7 @@ import{x as zf,_ as wo,z as Ht,k as Gf,y as Wf}from"./index-DxqO1ZJV.js";import{
1559
1588
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1560
1589
  * See the License for the specific language governing permissions and
1561
1590
  * limitations under the License.
1562
- */class W_{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(){x(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}}/**
1591
+ */class ny{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(){U(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}}/**
1563
1592
  * @license
1564
1593
  * Copyright 2020 Google LLC
1565
1594
  *
@@ -1574,7 +1603,7 @@ import{x as zf,_ as wo,z as Ht,k as Gf,y as Wf}from"./index-DxqO1ZJV.js";import{
1574
1603
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1575
1604
  * See the License for the specific language governing permissions and
1576
1605
  * limitations under the License.
1577
- */function K_(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 Q_(n){St(new ut("auth",(e,{options:t})=>{const r=e.getProvider("app").getImmediate(),s=e.getProvider("heartbeat"),i=e.getProvider("app-check-internal"),{apiKey:a,authDomain:c}=r.options;x(a&&!a.includes(":"),"invalid-api-key",{appName:r.name});const l={apiKey:a,authDomain:c,clientPlatform:n,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:Ul(n)},d=new dg(r,s,i,l);return Ig(d,t),d},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e,t,r)=>{e.getProvider("auth-internal").initialize()})),St(new ut("auth-internal",e=>{const t=xt(e.getProvider("auth").getImmediate());return(r=>new W_(r))(t)},"PRIVATE").setInstantiationMode("EXPLICIT")),qe(ru,su,K_(n)),qe(ru,su,"esm2017")}/**
1606
+ */function ry(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 sy(n){St(new ut("auth",(e,{options:t})=>{const r=e.getProvider("app").getImmediate(),s=e.getProvider("heartbeat"),i=e.getProvider("app-check-internal"),{apiKey:a,authDomain:c}=r.options;U(a&&!a.includes(":"),"invalid-api-key",{appName:r.name});const l={apiKey:a,authDomain:c,clientPlatform:n,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:zl(n)},d=new vg(r,s,i,l);return Ng(d,t),d},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e,t,r)=>{e.getProvider("auth-internal").initialize()})),St(new ut("auth-internal",e=>{const t=Ft(e.getProvider("auth").getImmediate());return(r=>new ny(r))(t)},"PRIVATE").setInstantiationMode("EXPLICIT")),qe(cu,uu,ry(n)),qe(cu,uu,"esm2017")}/**
1578
1607
  * @license
1579
1608
  * Copyright 2021 Google LLC
1580
1609
  *
@@ -1589,29 +1618,29 @@ import{x as zf,_ as wo,z as Ht,k as Gf,y as Wf}from"./index-DxqO1ZJV.js";import{
1589
1618
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1590
1619
  * See the License for the specific language governing permissions and
1591
1620
  * limitations under the License.
1592
- */const X_=5*60,J_=gl("authIdTokenMaxAge")||X_;let iu=null;const Y_=n=>async e=>{const t=e&&await e.getIdTokenResult(),r=t&&(new Date().getTime()-Date.parse(t.issuedAtTime))/1e3;if(r&&r>J_)return;const s=t==null?void 0:t.token;iu!==s&&(iu=s,await fetch(n,{method:s?"POST":"DELETE",headers:s?{Authorization:`Bearer ${s}`}:{}}))};function Z_(n=Gs()){const e=Pr(n,"auth");if(e.isInitialized())return e.getImmediate();const t=vg(n,{popupRedirectResolver:G_,persistence:[r_,zg,Kl]}),r=gl("authTokenSyncURL");if(r&&typeof isSecureContext=="boolean"&&isSecureContext){const i=new URL(r,location.origin);if(location.origin===i.origin){const a=Y_(i.toString());qg(t,a,()=>a(t.currentUser)),Bg(t,c=>a(c))}}const s=pl("auth");return s&&wg(t,`http://${s}`),t}function ey(){var n,e;return(e=(n=document.getElementsByTagName("head"))===null||n===void 0?void 0:n[0])!==null&&e!==void 0?e:document}fg({loadJS(n){return new Promise((e,t)=>{const r=document.createElement("script");r.setAttribute("src",n),r.onload=e,r.onerror=s=>{const i=$e("internal-error");i.customData=s,t(i)},r.type="text/javascript",r.charset="UTF-8",ey().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="});Q_("Browser");var ou=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};/** @license
1621
+ */const iy=5*60,oy=Il("authIdTokenMaxAge")||iy;let lu=null;const ay=n=>async e=>{const t=e&&await e.getIdTokenResult(),r=t&&(new Date().getTime()-Date.parse(t.issuedAtTime))/1e3;if(r&&r>oy)return;const s=t==null?void 0:t.token;lu!==s&&(lu=s,await fetch(n,{method:s?"POST":"DELETE",headers:s?{Authorization:`Bearer ${s}`}:{}}))};function cy(n=Xs()){const e=kr(n,"auth");if(e.isInitialized())return e.getImmediate();const t=kg(n,{popupRedirectResolver:ty,persistence:[d_,e_,eh]}),r=Il("authTokenSyncURL");if(r&&typeof isSecureContext=="boolean"&&isSecureContext){const i=new URL(r,location.origin);if(location.origin===i.origin){const a=ay(i.toString());Xg(t,a,()=>a(t.currentUser)),Qg(t,c=>a(c))}}const s=Tl("auth");return s?Dg(t,`http://${s}`):xt("Auth",!1),t}function uy(){var n,e;return(e=(n=document.getElementsByTagName("head"))===null||n===void 0?void 0:n[0])!==null&&e!==void 0?e:document}Ig({loadJS(n){return new Promise((e,t)=>{const r=document.createElement("script");r.setAttribute("src",n),r.onload=e,r.onerror=s=>{const i=je("internal-error");i.customData=s,t(i)},r.type="text/javascript",r.charset="UTF-8",uy().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="});sy("Browser");var hu=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};/** @license
1593
1622
  Copyright The Closure Library Authors.
1594
1623
  SPDX-License-Identifier: Apache-2.0
1595
- */var bt,nh;(function(){var n;/** @license
1624
+ */var bt,ch;(function(){var n;/** @license
1596
1625
 
1597
1626
  Copyright The Closure Library Authors.
1598
1627
  SPDX-License-Identifier: Apache-2.0
1599
- */function e(v,g){function _(){}_.prototype=g.prototype,v.D=g.prototype,v.prototype=new _,v.prototype.constructor=v,v.C=function(T,I,A){for(var y=Array(arguments.length-2),Ze=2;Ze<arguments.length;Ze++)y[Ze-2]=arguments[Ze];return g.prototype[I].apply(T,y)}}function t(){this.blockSize=-1}function r(){this.blockSize=-1,this.blockSize=64,this.g=Array(4),this.B=Array(this.blockSize),this.o=this.h=0,this.s()}e(r,t),r.prototype.s=function(){this.g[0]=1732584193,this.g[1]=4023233417,this.g[2]=2562383102,this.g[3]=271733878,this.o=this.h=0};function s(v,g,_){_||(_=0);var T=Array(16);if(typeof g=="string")for(var I=0;16>I;++I)T[I]=g.charCodeAt(_++)|g.charCodeAt(_++)<<8|g.charCodeAt(_++)<<16|g.charCodeAt(_++)<<24;else for(I=0;16>I;++I)T[I]=g[_++]|g[_++]<<8|g[_++]<<16|g[_++]<<24;g=v.g[0],_=v.g[1],I=v.g[2];var A=v.g[3],y=g+(A^_&(I^A))+T[0]+3614090360&4294967295;g=_+(y<<7&4294967295|y>>>25),y=A+(I^g&(_^I))+T[1]+3905402710&4294967295,A=g+(y<<12&4294967295|y>>>20),y=I+(_^A&(g^_))+T[2]+606105819&4294967295,I=A+(y<<17&4294967295|y>>>15),y=_+(g^I&(A^g))+T[3]+3250441966&4294967295,_=I+(y<<22&4294967295|y>>>10),y=g+(A^_&(I^A))+T[4]+4118548399&4294967295,g=_+(y<<7&4294967295|y>>>25),y=A+(I^g&(_^I))+T[5]+1200080426&4294967295,A=g+(y<<12&4294967295|y>>>20),y=I+(_^A&(g^_))+T[6]+2821735955&4294967295,I=A+(y<<17&4294967295|y>>>15),y=_+(g^I&(A^g))+T[7]+4249261313&4294967295,_=I+(y<<22&4294967295|y>>>10),y=g+(A^_&(I^A))+T[8]+1770035416&4294967295,g=_+(y<<7&4294967295|y>>>25),y=A+(I^g&(_^I))+T[9]+2336552879&4294967295,A=g+(y<<12&4294967295|y>>>20),y=I+(_^A&(g^_))+T[10]+4294925233&4294967295,I=A+(y<<17&4294967295|y>>>15),y=_+(g^I&(A^g))+T[11]+2304563134&4294967295,_=I+(y<<22&4294967295|y>>>10),y=g+(A^_&(I^A))+T[12]+1804603682&4294967295,g=_+(y<<7&4294967295|y>>>25),y=A+(I^g&(_^I))+T[13]+4254626195&4294967295,A=g+(y<<12&4294967295|y>>>20),y=I+(_^A&(g^_))+T[14]+2792965006&4294967295,I=A+(y<<17&4294967295|y>>>15),y=_+(g^I&(A^g))+T[15]+1236535329&4294967295,_=I+(y<<22&4294967295|y>>>10),y=g+(I^A&(_^I))+T[1]+4129170786&4294967295,g=_+(y<<5&4294967295|y>>>27),y=A+(_^I&(g^_))+T[6]+3225465664&4294967295,A=g+(y<<9&4294967295|y>>>23),y=I+(g^_&(A^g))+T[11]+643717713&4294967295,I=A+(y<<14&4294967295|y>>>18),y=_+(A^g&(I^A))+T[0]+3921069994&4294967295,_=I+(y<<20&4294967295|y>>>12),y=g+(I^A&(_^I))+T[5]+3593408605&4294967295,g=_+(y<<5&4294967295|y>>>27),y=A+(_^I&(g^_))+T[10]+38016083&4294967295,A=g+(y<<9&4294967295|y>>>23),y=I+(g^_&(A^g))+T[15]+3634488961&4294967295,I=A+(y<<14&4294967295|y>>>18),y=_+(A^g&(I^A))+T[4]+3889429448&4294967295,_=I+(y<<20&4294967295|y>>>12),y=g+(I^A&(_^I))+T[9]+568446438&4294967295,g=_+(y<<5&4294967295|y>>>27),y=A+(_^I&(g^_))+T[14]+3275163606&4294967295,A=g+(y<<9&4294967295|y>>>23),y=I+(g^_&(A^g))+T[3]+4107603335&4294967295,I=A+(y<<14&4294967295|y>>>18),y=_+(A^g&(I^A))+T[8]+1163531501&4294967295,_=I+(y<<20&4294967295|y>>>12),y=g+(I^A&(_^I))+T[13]+2850285829&4294967295,g=_+(y<<5&4294967295|y>>>27),y=A+(_^I&(g^_))+T[2]+4243563512&4294967295,A=g+(y<<9&4294967295|y>>>23),y=I+(g^_&(A^g))+T[7]+1735328473&4294967295,I=A+(y<<14&4294967295|y>>>18),y=_+(A^g&(I^A))+T[12]+2368359562&4294967295,_=I+(y<<20&4294967295|y>>>12),y=g+(_^I^A)+T[5]+4294588738&4294967295,g=_+(y<<4&4294967295|y>>>28),y=A+(g^_^I)+T[8]+2272392833&4294967295,A=g+(y<<11&4294967295|y>>>21),y=I+(A^g^_)+T[11]+1839030562&4294967295,I=A+(y<<16&4294967295|y>>>16),y=_+(I^A^g)+T[14]+4259657740&4294967295,_=I+(y<<23&4294967295|y>>>9),y=g+(_^I^A)+T[1]+2763975236&4294967295,g=_+(y<<4&4294967295|y>>>28),y=A+(g^_^I)+T[4]+1272893353&4294967295,A=g+(y<<11&4294967295|y>>>21),y=I+(A^g^_)+T[7]+4139469664&4294967295,I=A+(y<<16&4294967295|y>>>16),y=_+(I^A^g)+T[10]+3200236656&4294967295,_=I+(y<<23&4294967295|y>>>9),y=g+(_^I^A)+T[13]+681279174&4294967295,g=_+(y<<4&4294967295|y>>>28),y=A+(g^_^I)+T[0]+3936430074&4294967295,A=g+(y<<11&4294967295|y>>>21),y=I+(A^g^_)+T[3]+3572445317&4294967295,I=A+(y<<16&4294967295|y>>>16),y=_+(I^A^g)+T[6]+76029189&4294967295,_=I+(y<<23&4294967295|y>>>9),y=g+(_^I^A)+T[9]+3654602809&4294967295,g=_+(y<<4&4294967295|y>>>28),y=A+(g^_^I)+T[12]+3873151461&4294967295,A=g+(y<<11&4294967295|y>>>21),y=I+(A^g^_)+T[15]+530742520&4294967295,I=A+(y<<16&4294967295|y>>>16),y=_+(I^A^g)+T[2]+3299628645&4294967295,_=I+(y<<23&4294967295|y>>>9),y=g+(I^(_|~A))+T[0]+4096336452&4294967295,g=_+(y<<6&4294967295|y>>>26),y=A+(_^(g|~I))+T[7]+1126891415&4294967295,A=g+(y<<10&4294967295|y>>>22),y=I+(g^(A|~_))+T[14]+2878612391&4294967295,I=A+(y<<15&4294967295|y>>>17),y=_+(A^(I|~g))+T[5]+4237533241&4294967295,_=I+(y<<21&4294967295|y>>>11),y=g+(I^(_|~A))+T[12]+1700485571&4294967295,g=_+(y<<6&4294967295|y>>>26),y=A+(_^(g|~I))+T[3]+2399980690&4294967295,A=g+(y<<10&4294967295|y>>>22),y=I+(g^(A|~_))+T[10]+4293915773&4294967295,I=A+(y<<15&4294967295|y>>>17),y=_+(A^(I|~g))+T[1]+2240044497&4294967295,_=I+(y<<21&4294967295|y>>>11),y=g+(I^(_|~A))+T[8]+1873313359&4294967295,g=_+(y<<6&4294967295|y>>>26),y=A+(_^(g|~I))+T[15]+4264355552&4294967295,A=g+(y<<10&4294967295|y>>>22),y=I+(g^(A|~_))+T[6]+2734768916&4294967295,I=A+(y<<15&4294967295|y>>>17),y=_+(A^(I|~g))+T[13]+1309151649&4294967295,_=I+(y<<21&4294967295|y>>>11),y=g+(I^(_|~A))+T[4]+4149444226&4294967295,g=_+(y<<6&4294967295|y>>>26),y=A+(_^(g|~I))+T[11]+3174756917&4294967295,A=g+(y<<10&4294967295|y>>>22),y=I+(g^(A|~_))+T[2]+718787259&4294967295,I=A+(y<<15&4294967295|y>>>17),y=_+(A^(I|~g))+T[9]+3951481745&4294967295,v.g[0]=v.g[0]+g&4294967295,v.g[1]=v.g[1]+(I+(y<<21&4294967295|y>>>11))&4294967295,v.g[2]=v.g[2]+I&4294967295,v.g[3]=v.g[3]+A&4294967295}r.prototype.u=function(v,g){g===void 0&&(g=v.length);for(var _=g-this.blockSize,T=this.B,I=this.h,A=0;A<g;){if(I==0)for(;A<=_;)s(this,v,A),A+=this.blockSize;if(typeof v=="string"){for(;A<g;)if(T[I++]=v.charCodeAt(A++),I==this.blockSize){s(this,T),I=0;break}}else for(;A<g;)if(T[I++]=v[A++],I==this.blockSize){s(this,T),I=0;break}}this.h=I,this.o+=g},r.prototype.v=function(){var v=Array((56>this.h?this.blockSize:2*this.blockSize)-this.h);v[0]=128;for(var g=1;g<v.length-8;++g)v[g]=0;var _=8*this.o;for(g=v.length-8;g<v.length;++g)v[g]=_&255,_/=256;for(this.u(v),v=Array(16),g=_=0;4>g;++g)for(var T=0;32>T;T+=8)v[_++]=this.g[g]>>>T&255;return v};function i(v,g){var _=c;return Object.prototype.hasOwnProperty.call(_,v)?_[v]:_[v]=g(v)}function a(v,g){this.h=g;for(var _=[],T=!0,I=v.length-1;0<=I;I--){var A=v[I]|0;T&&A==g||(_[I]=A,T=!1)}this.g=_}var c={};function l(v){return-128<=v&&128>v?i(v,function(g){return new a([g|0],0>g?-1:0)}):new a([v|0],0>v?-1:0)}function d(v){if(isNaN(v)||!isFinite(v))return m;if(0>v)return k(d(-v));for(var g=[],_=1,T=0;v>=_;T++)g[T]=v/_|0,_*=4294967296;return new a(g,0)}function f(v,g){if(v.length==0)throw Error("number format error: empty string");if(g=g||10,2>g||36<g)throw Error("radix out of range: "+g);if(v.charAt(0)=="-")return k(f(v.substring(1),g));if(0<=v.indexOf("-"))throw Error('number format error: interior "-" character');for(var _=d(Math.pow(g,8)),T=m,I=0;I<v.length;I+=8){var A=Math.min(8,v.length-I),y=parseInt(v.substring(I,I+A),g);8>A?(A=d(Math.pow(g,A)),T=T.j(A).add(d(y))):(T=T.j(_),T=T.add(d(y)))}return T}var m=l(0),E=l(1),R=l(16777216);n=a.prototype,n.m=function(){if(N(this))return-k(this).m();for(var v=0,g=1,_=0;_<this.g.length;_++){var T=this.i(_);v+=(0<=T?T:4294967296+T)*g,g*=4294967296}return v},n.toString=function(v){if(v=v||10,2>v||36<v)throw Error("radix out of range: "+v);if(C(this))return"0";if(N(this))return"-"+k(this).toString(v);for(var g=d(Math.pow(v,6)),_=this,T="";;){var I=j(_,g).g;_=F(_,I.j(g));var A=((0<_.g.length?_.g[0]:_.h)>>>0).toString(v);if(_=I,C(_))return A+T;for(;6>A.length;)A="0"+A;T=A+T}},n.i=function(v){return 0>v?0:v<this.g.length?this.g[v]:this.h};function C(v){if(v.h!=0)return!1;for(var g=0;g<v.g.length;g++)if(v.g[g]!=0)return!1;return!0}function N(v){return v.h==-1}n.l=function(v){return v=F(this,v),N(v)?-1:C(v)?0:1};function k(v){for(var g=v.g.length,_=[],T=0;T<g;T++)_[T]=~v.g[T];return new a(_,~v.h).add(E)}n.abs=function(){return N(this)?k(this):this},n.add=function(v){for(var g=Math.max(this.g.length,v.g.length),_=[],T=0,I=0;I<=g;I++){var A=T+(this.i(I)&65535)+(v.i(I)&65535),y=(A>>>16)+(this.i(I)>>>16)+(v.i(I)>>>16);T=y>>>16,A&=65535,y&=65535,_[I]=y<<16|A}return new a(_,_[_.length-1]&-2147483648?-1:0)};function F(v,g){return v.add(k(g))}n.j=function(v){if(C(this)||C(v))return m;if(N(this))return N(v)?k(this).j(k(v)):k(k(this).j(v));if(N(v))return k(this.j(k(v)));if(0>this.l(R)&&0>v.l(R))return d(this.m()*v.m());for(var g=this.g.length+v.g.length,_=[],T=0;T<2*g;T++)_[T]=0;for(T=0;T<this.g.length;T++)for(var I=0;I<v.g.length;I++){var A=this.i(T)>>>16,y=this.i(T)&65535,Ze=v.i(I)>>>16,Fn=v.i(I)&65535;_[2*T+2*I]+=y*Fn,$(_,2*T+2*I),_[2*T+2*I+1]+=A*Fn,$(_,2*T+2*I+1),_[2*T+2*I+1]+=y*Ze,$(_,2*T+2*I+1),_[2*T+2*I+2]+=A*Ze,$(_,2*T+2*I+2)}for(T=0;T<g;T++)_[T]=_[2*T+1]<<16|_[2*T];for(T=g;T<2*g;T++)_[T]=0;return new a(_,0)};function $(v,g){for(;(v[g]&65535)!=v[g];)v[g+1]+=v[g]>>>16,v[g]&=65535,g++}function M(v,g){this.g=v,this.h=g}function j(v,g){if(C(g))throw Error("division by zero");if(C(v))return new M(m,m);if(N(v))return g=j(k(v),g),new M(k(g.g),k(g.h));if(N(g))return g=j(v,k(g)),new M(k(g.g),g.h);if(30<v.g.length){if(N(v)||N(g))throw Error("slowDivide_ only works with positive integers.");for(var _=E,T=g;0>=T.l(v);)_=ce(_),T=ce(T);var I=X(_,1),A=X(T,1);for(T=X(T,2),_=X(_,2);!C(T);){var y=A.add(T);0>=y.l(v)&&(I=I.add(_),A=y),T=X(T,1),_=X(_,1)}return g=F(v,I.j(g)),new M(I,g)}for(I=m;0<=v.l(g);){for(_=Math.max(1,Math.floor(v.m()/g.m())),T=Math.ceil(Math.log(_)/Math.LN2),T=48>=T?1:Math.pow(2,T-48),A=d(_),y=A.j(g);N(y)||0<y.l(v);)_-=T,A=d(_),y=A.j(g);C(A)&&(A=E),I=I.add(A),v=F(v,y)}return new M(I,v)}n.A=function(v){return j(this,v).h},n.and=function(v){for(var g=Math.max(this.g.length,v.g.length),_=[],T=0;T<g;T++)_[T]=this.i(T)&v.i(T);return new a(_,this.h&v.h)},n.or=function(v){for(var g=Math.max(this.g.length,v.g.length),_=[],T=0;T<g;T++)_[T]=this.i(T)|v.i(T);return new a(_,this.h|v.h)},n.xor=function(v){for(var g=Math.max(this.g.length,v.g.length),_=[],T=0;T<g;T++)_[T]=this.i(T)^v.i(T);return new a(_,this.h^v.h)};function ce(v){for(var g=v.g.length+1,_=[],T=0;T<g;T++)_[T]=v.i(T)<<1|v.i(T-1)>>>31;return new a(_,v.h)}function X(v,g){var _=g>>5;g%=32;for(var T=v.g.length-_,I=[],A=0;A<T;A++)I[A]=0<g?v.i(A+_)>>>g|v.i(A+_+1)<<32-g:v.i(A+_);return new a(I,v.h)}r.prototype.digest=r.prototype.v,r.prototype.reset=r.prototype.s,r.prototype.update=r.prototype.u,nh=r,a.prototype.add=a.prototype.add,a.prototype.multiply=a.prototype.j,a.prototype.modulo=a.prototype.A,a.prototype.compare=a.prototype.l,a.prototype.toNumber=a.prototype.m,a.prototype.toString=a.prototype.toString,a.prototype.getBits=a.prototype.i,a.fromNumber=d,a.fromString=f,bt=a}).apply(typeof ou<"u"?ou:typeof self<"u"?self:typeof window<"u"?window:{});var ss=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};/** @license
1628
+ */function e(v,g){function y(){}y.prototype=g.prototype,v.D=g.prototype,v.prototype=new y,v.prototype.constructor=v,v.C=function(T,I,A){for(var E=Array(arguments.length-2),Ze=2;Ze<arguments.length;Ze++)E[Ze-2]=arguments[Ze];return g.prototype[I].apply(T,E)}}function t(){this.blockSize=-1}function r(){this.blockSize=-1,this.blockSize=64,this.g=Array(4),this.B=Array(this.blockSize),this.o=this.h=0,this.s()}e(r,t),r.prototype.s=function(){this.g[0]=1732584193,this.g[1]=4023233417,this.g[2]=2562383102,this.g[3]=271733878,this.o=this.h=0};function s(v,g,y){y||(y=0);var T=Array(16);if(typeof g=="string")for(var I=0;16>I;++I)T[I]=g.charCodeAt(y++)|g.charCodeAt(y++)<<8|g.charCodeAt(y++)<<16|g.charCodeAt(y++)<<24;else for(I=0;16>I;++I)T[I]=g[y++]|g[y++]<<8|g[y++]<<16|g[y++]<<24;g=v.g[0],y=v.g[1],I=v.g[2];var A=v.g[3],E=g+(A^y&(I^A))+T[0]+3614090360&4294967295;g=y+(E<<7&4294967295|E>>>25),E=A+(I^g&(y^I))+T[1]+3905402710&4294967295,A=g+(E<<12&4294967295|E>>>20),E=I+(y^A&(g^y))+T[2]+606105819&4294967295,I=A+(E<<17&4294967295|E>>>15),E=y+(g^I&(A^g))+T[3]+3250441966&4294967295,y=I+(E<<22&4294967295|E>>>10),E=g+(A^y&(I^A))+T[4]+4118548399&4294967295,g=y+(E<<7&4294967295|E>>>25),E=A+(I^g&(y^I))+T[5]+1200080426&4294967295,A=g+(E<<12&4294967295|E>>>20),E=I+(y^A&(g^y))+T[6]+2821735955&4294967295,I=A+(E<<17&4294967295|E>>>15),E=y+(g^I&(A^g))+T[7]+4249261313&4294967295,y=I+(E<<22&4294967295|E>>>10),E=g+(A^y&(I^A))+T[8]+1770035416&4294967295,g=y+(E<<7&4294967295|E>>>25),E=A+(I^g&(y^I))+T[9]+2336552879&4294967295,A=g+(E<<12&4294967295|E>>>20),E=I+(y^A&(g^y))+T[10]+4294925233&4294967295,I=A+(E<<17&4294967295|E>>>15),E=y+(g^I&(A^g))+T[11]+2304563134&4294967295,y=I+(E<<22&4294967295|E>>>10),E=g+(A^y&(I^A))+T[12]+1804603682&4294967295,g=y+(E<<7&4294967295|E>>>25),E=A+(I^g&(y^I))+T[13]+4254626195&4294967295,A=g+(E<<12&4294967295|E>>>20),E=I+(y^A&(g^y))+T[14]+2792965006&4294967295,I=A+(E<<17&4294967295|E>>>15),E=y+(g^I&(A^g))+T[15]+1236535329&4294967295,y=I+(E<<22&4294967295|E>>>10),E=g+(I^A&(y^I))+T[1]+4129170786&4294967295,g=y+(E<<5&4294967295|E>>>27),E=A+(y^I&(g^y))+T[6]+3225465664&4294967295,A=g+(E<<9&4294967295|E>>>23),E=I+(g^y&(A^g))+T[11]+643717713&4294967295,I=A+(E<<14&4294967295|E>>>18),E=y+(A^g&(I^A))+T[0]+3921069994&4294967295,y=I+(E<<20&4294967295|E>>>12),E=g+(I^A&(y^I))+T[5]+3593408605&4294967295,g=y+(E<<5&4294967295|E>>>27),E=A+(y^I&(g^y))+T[10]+38016083&4294967295,A=g+(E<<9&4294967295|E>>>23),E=I+(g^y&(A^g))+T[15]+3634488961&4294967295,I=A+(E<<14&4294967295|E>>>18),E=y+(A^g&(I^A))+T[4]+3889429448&4294967295,y=I+(E<<20&4294967295|E>>>12),E=g+(I^A&(y^I))+T[9]+568446438&4294967295,g=y+(E<<5&4294967295|E>>>27),E=A+(y^I&(g^y))+T[14]+3275163606&4294967295,A=g+(E<<9&4294967295|E>>>23),E=I+(g^y&(A^g))+T[3]+4107603335&4294967295,I=A+(E<<14&4294967295|E>>>18),E=y+(A^g&(I^A))+T[8]+1163531501&4294967295,y=I+(E<<20&4294967295|E>>>12),E=g+(I^A&(y^I))+T[13]+2850285829&4294967295,g=y+(E<<5&4294967295|E>>>27),E=A+(y^I&(g^y))+T[2]+4243563512&4294967295,A=g+(E<<9&4294967295|E>>>23),E=I+(g^y&(A^g))+T[7]+1735328473&4294967295,I=A+(E<<14&4294967295|E>>>18),E=y+(A^g&(I^A))+T[12]+2368359562&4294967295,y=I+(E<<20&4294967295|E>>>12),E=g+(y^I^A)+T[5]+4294588738&4294967295,g=y+(E<<4&4294967295|E>>>28),E=A+(g^y^I)+T[8]+2272392833&4294967295,A=g+(E<<11&4294967295|E>>>21),E=I+(A^g^y)+T[11]+1839030562&4294967295,I=A+(E<<16&4294967295|E>>>16),E=y+(I^A^g)+T[14]+4259657740&4294967295,y=I+(E<<23&4294967295|E>>>9),E=g+(y^I^A)+T[1]+2763975236&4294967295,g=y+(E<<4&4294967295|E>>>28),E=A+(g^y^I)+T[4]+1272893353&4294967295,A=g+(E<<11&4294967295|E>>>21),E=I+(A^g^y)+T[7]+4139469664&4294967295,I=A+(E<<16&4294967295|E>>>16),E=y+(I^A^g)+T[10]+3200236656&4294967295,y=I+(E<<23&4294967295|E>>>9),E=g+(y^I^A)+T[13]+681279174&4294967295,g=y+(E<<4&4294967295|E>>>28),E=A+(g^y^I)+T[0]+3936430074&4294967295,A=g+(E<<11&4294967295|E>>>21),E=I+(A^g^y)+T[3]+3572445317&4294967295,I=A+(E<<16&4294967295|E>>>16),E=y+(I^A^g)+T[6]+76029189&4294967295,y=I+(E<<23&4294967295|E>>>9),E=g+(y^I^A)+T[9]+3654602809&4294967295,g=y+(E<<4&4294967295|E>>>28),E=A+(g^y^I)+T[12]+3873151461&4294967295,A=g+(E<<11&4294967295|E>>>21),E=I+(A^g^y)+T[15]+530742520&4294967295,I=A+(E<<16&4294967295|E>>>16),E=y+(I^A^g)+T[2]+3299628645&4294967295,y=I+(E<<23&4294967295|E>>>9),E=g+(I^(y|~A))+T[0]+4096336452&4294967295,g=y+(E<<6&4294967295|E>>>26),E=A+(y^(g|~I))+T[7]+1126891415&4294967295,A=g+(E<<10&4294967295|E>>>22),E=I+(g^(A|~y))+T[14]+2878612391&4294967295,I=A+(E<<15&4294967295|E>>>17),E=y+(A^(I|~g))+T[5]+4237533241&4294967295,y=I+(E<<21&4294967295|E>>>11),E=g+(I^(y|~A))+T[12]+1700485571&4294967295,g=y+(E<<6&4294967295|E>>>26),E=A+(y^(g|~I))+T[3]+2399980690&4294967295,A=g+(E<<10&4294967295|E>>>22),E=I+(g^(A|~y))+T[10]+4293915773&4294967295,I=A+(E<<15&4294967295|E>>>17),E=y+(A^(I|~g))+T[1]+2240044497&4294967295,y=I+(E<<21&4294967295|E>>>11),E=g+(I^(y|~A))+T[8]+1873313359&4294967295,g=y+(E<<6&4294967295|E>>>26),E=A+(y^(g|~I))+T[15]+4264355552&4294967295,A=g+(E<<10&4294967295|E>>>22),E=I+(g^(A|~y))+T[6]+2734768916&4294967295,I=A+(E<<15&4294967295|E>>>17),E=y+(A^(I|~g))+T[13]+1309151649&4294967295,y=I+(E<<21&4294967295|E>>>11),E=g+(I^(y|~A))+T[4]+4149444226&4294967295,g=y+(E<<6&4294967295|E>>>26),E=A+(y^(g|~I))+T[11]+3174756917&4294967295,A=g+(E<<10&4294967295|E>>>22),E=I+(g^(A|~y))+T[2]+718787259&4294967295,I=A+(E<<15&4294967295|E>>>17),E=y+(A^(I|~g))+T[9]+3951481745&4294967295,v.g[0]=v.g[0]+g&4294967295,v.g[1]=v.g[1]+(I+(E<<21&4294967295|E>>>11))&4294967295,v.g[2]=v.g[2]+I&4294967295,v.g[3]=v.g[3]+A&4294967295}r.prototype.u=function(v,g){g===void 0&&(g=v.length);for(var y=g-this.blockSize,T=this.B,I=this.h,A=0;A<g;){if(I==0)for(;A<=y;)s(this,v,A),A+=this.blockSize;if(typeof v=="string"){for(;A<g;)if(T[I++]=v.charCodeAt(A++),I==this.blockSize){s(this,T),I=0;break}}else for(;A<g;)if(T[I++]=v[A++],I==this.blockSize){s(this,T),I=0;break}}this.h=I,this.o+=g},r.prototype.v=function(){var v=Array((56>this.h?this.blockSize:2*this.blockSize)-this.h);v[0]=128;for(var g=1;g<v.length-8;++g)v[g]=0;var y=8*this.o;for(g=v.length-8;g<v.length;++g)v[g]=y&255,y/=256;for(this.u(v),v=Array(16),g=y=0;4>g;++g)for(var T=0;32>T;T+=8)v[y++]=this.g[g]>>>T&255;return v};function i(v,g){var y=c;return Object.prototype.hasOwnProperty.call(y,v)?y[v]:y[v]=g(v)}function a(v,g){this.h=g;for(var y=[],T=!0,I=v.length-1;0<=I;I--){var A=v[I]|0;T&&A==g||(y[I]=A,T=!1)}this.g=y}var c={};function l(v){return-128<=v&&128>v?i(v,function(g){return new a([g|0],0>g?-1:0)}):new a([v|0],0>v?-1:0)}function d(v){if(isNaN(v)||!isFinite(v))return m;if(0>v)return k(d(-v));for(var g=[],y=1,T=0;v>=y;T++)g[T]=v/y|0,y*=4294967296;return new a(g,0)}function f(v,g){if(v.length==0)throw Error("number format error: empty string");if(g=g||10,2>g||36<g)throw Error("radix out of range: "+g);if(v.charAt(0)=="-")return k(f(v.substring(1),g));if(0<=v.indexOf("-"))throw Error('number format error: interior "-" character');for(var y=d(Math.pow(g,8)),T=m,I=0;I<v.length;I+=8){var A=Math.min(8,v.length-I),E=parseInt(v.substring(I,I+A),g);8>A?(A=d(Math.pow(g,A)),T=T.j(A).add(d(E))):(T=T.j(y),T=T.add(d(E)))}return T}var m=l(0),_=l(1),R=l(16777216);n=a.prototype,n.m=function(){if(N(this))return-k(this).m();for(var v=0,g=1,y=0;y<this.g.length;y++){var T=this.i(y);v+=(0<=T?T:4294967296+T)*g,g*=4294967296}return v},n.toString=function(v){if(v=v||10,2>v||36<v)throw Error("radix out of range: "+v);if(S(this))return"0";if(N(this))return"-"+k(this).toString(v);for(var g=d(Math.pow(v,6)),y=this,T="";;){var I=$(y,g).g;y=B(y,I.j(g));var A=((0<y.g.length?y.g[0]:y.h)>>>0).toString(v);if(y=I,S(y))return A+T;for(;6>A.length;)A="0"+A;T=A+T}},n.i=function(v){return 0>v?0:v<this.g.length?this.g[v]:this.h};function S(v){if(v.h!=0)return!1;for(var g=0;g<v.g.length;g++)if(v.g[g]!=0)return!1;return!0}function N(v){return v.h==-1}n.l=function(v){return v=B(this,v),N(v)?-1:S(v)?0:1};function k(v){for(var g=v.g.length,y=[],T=0;T<g;T++)y[T]=~v.g[T];return new a(y,~v.h).add(_)}n.abs=function(){return N(this)?k(this):this},n.add=function(v){for(var g=Math.max(this.g.length,v.g.length),y=[],T=0,I=0;I<=g;I++){var A=T+(this.i(I)&65535)+(v.i(I)&65535),E=(A>>>16)+(this.i(I)>>>16)+(v.i(I)>>>16);T=E>>>16,A&=65535,E&=65535,y[I]=E<<16|A}return new a(y,y[y.length-1]&-2147483648?-1:0)};function B(v,g){return v.add(k(g))}n.j=function(v){if(S(this)||S(v))return m;if(N(this))return N(v)?k(this).j(k(v)):k(k(this).j(v));if(N(v))return k(this.j(k(v)));if(0>this.l(R)&&0>v.l(R))return d(this.m()*v.m());for(var g=this.g.length+v.g.length,y=[],T=0;T<2*g;T++)y[T]=0;for(T=0;T<this.g.length;T++)for(var I=0;I<v.g.length;I++){var A=this.i(T)>>>16,E=this.i(T)&65535,Ze=v.i(I)>>>16,qn=v.i(I)&65535;y[2*T+2*I]+=E*qn,M(y,2*T+2*I),y[2*T+2*I+1]+=A*qn,M(y,2*T+2*I+1),y[2*T+2*I+1]+=E*Ze,M(y,2*T+2*I+1),y[2*T+2*I+2]+=A*Ze,M(y,2*T+2*I+2)}for(T=0;T<g;T++)y[T]=y[2*T+1]<<16|y[2*T];for(T=g;T<2*g;T++)y[T]=0;return new a(y,0)};function M(v,g){for(;(v[g]&65535)!=v[g];)v[g+1]+=v[g]>>>16,v[g]&=65535,g++}function x(v,g){this.g=v,this.h=g}function $(v,g){if(S(g))throw Error("division by zero");if(S(v))return new x(m,m);if(N(v))return g=$(k(v),g),new x(k(g.g),k(g.h));if(N(g))return g=$(v,k(g)),new x(k(g.g),g.h);if(30<v.g.length){if(N(v)||N(g))throw Error("slowDivide_ only works with positive integers.");for(var y=_,T=g;0>=T.l(v);)y=ce(y),T=ce(T);var I=X(y,1),A=X(T,1);for(T=X(T,2),y=X(y,2);!S(T);){var E=A.add(T);0>=E.l(v)&&(I=I.add(y),A=E),T=X(T,1),y=X(y,1)}return g=B(v,I.j(g)),new x(I,g)}for(I=m;0<=v.l(g);){for(y=Math.max(1,Math.floor(v.m()/g.m())),T=Math.ceil(Math.log(y)/Math.LN2),T=48>=T?1:Math.pow(2,T-48),A=d(y),E=A.j(g);N(E)||0<E.l(v);)y-=T,A=d(y),E=A.j(g);S(A)&&(A=_),I=I.add(A),v=B(v,E)}return new x(I,v)}n.A=function(v){return $(this,v).h},n.and=function(v){for(var g=Math.max(this.g.length,v.g.length),y=[],T=0;T<g;T++)y[T]=this.i(T)&v.i(T);return new a(y,this.h&v.h)},n.or=function(v){for(var g=Math.max(this.g.length,v.g.length),y=[],T=0;T<g;T++)y[T]=this.i(T)|v.i(T);return new a(y,this.h|v.h)},n.xor=function(v){for(var g=Math.max(this.g.length,v.g.length),y=[],T=0;T<g;T++)y[T]=this.i(T)^v.i(T);return new a(y,this.h^v.h)};function ce(v){for(var g=v.g.length+1,y=[],T=0;T<g;T++)y[T]=v.i(T)<<1|v.i(T-1)>>>31;return new a(y,v.h)}function X(v,g){var y=g>>5;g%=32;for(var T=v.g.length-y,I=[],A=0;A<T;A++)I[A]=0<g?v.i(A+y)>>>g|v.i(A+y+1)<<32-g:v.i(A+y);return new a(I,v.h)}r.prototype.digest=r.prototype.v,r.prototype.reset=r.prototype.s,r.prototype.update=r.prototype.u,ch=r,a.prototype.add=a.prototype.add,a.prototype.multiply=a.prototype.j,a.prototype.modulo=a.prototype.A,a.prototype.compare=a.prototype.l,a.prototype.toNumber=a.prototype.m,a.prototype.toString=a.prototype.toString,a.prototype.getBits=a.prototype.i,a.fromNumber=d,a.fromString=f,bt=a}).apply(typeof hu<"u"?hu:typeof self<"u"?self:typeof window<"u"?window:{});var as=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};/** @license
1600
1629
  Copyright The Closure Library Authors.
1601
1630
  SPDX-License-Identifier: Apache-2.0
1602
- */var rh,or,sh,ms,io,ih,oh,ah;(function(){var n,e=typeof Object.defineProperties=="function"?Object.defineProperty:function(o,u,h){return o==Array.prototype||o==Object.prototype||(o[u]=h.value),o};function t(o){o=[typeof globalThis=="object"&&globalThis,o,typeof window=="object"&&window,typeof self=="object"&&self,typeof ss=="object"&&ss];for(var u=0;u<o.length;++u){var h=o[u];if(h&&h.Math==Math)return h}throw Error("Cannot find global object")}var r=t(this);function s(o,u){if(u)e:{var h=r;o=o.split(".");for(var p=0;p<o.length-1;p++){var w=o[p];if(!(w in h))break e;h=h[w]}o=o[o.length-1],p=h[o],u=u(p),u!=p&&u!=null&&e(h,o,{configurable:!0,writable:!0,value:u})}}function i(o,u){o instanceof String&&(o+="");var h=0,p=!1,w={next:function(){if(!p&&h<o.length){var b=h++;return{value:u(b,o[b]),done:!1}}return p=!0,{done:!0,value:void 0}}};return w[Symbol.iterator]=function(){return w},w}s("Array.prototype.values",function(o){return o||function(){return i(this,function(u,h){return h})}});/** @license
1631
+ */var uh,cr,lh,ys,uo,hh,dh,fh;(function(){var n,e=typeof Object.defineProperties=="function"?Object.defineProperty:function(o,u,h){return o==Array.prototype||o==Object.prototype||(o[u]=h.value),o};function t(o){o=[typeof globalThis=="object"&&globalThis,o,typeof window=="object"&&window,typeof self=="object"&&self,typeof as=="object"&&as];for(var u=0;u<o.length;++u){var h=o[u];if(h&&h.Math==Math)return h}throw Error("Cannot find global object")}var r=t(this);function s(o,u){if(u)e:{var h=r;o=o.split(".");for(var p=0;p<o.length-1;p++){var w=o[p];if(!(w in h))break e;h=h[w]}o=o[o.length-1],p=h[o],u=u(p),u!=p&&u!=null&&e(h,o,{configurable:!0,writable:!0,value:u})}}function i(o,u){o instanceof String&&(o+="");var h=0,p=!1,w={next:function(){if(!p&&h<o.length){var b=h++;return{value:u(b,o[b]),done:!1}}return p=!0,{done:!0,value:void 0}}};return w[Symbol.iterator]=function(){return w},w}s("Array.prototype.values",function(o){return o||function(){return i(this,function(u,h){return h})}});/** @license
1603
1632
 
1604
1633
  Copyright The Closure Library Authors.
1605
1634
  SPDX-License-Identifier: Apache-2.0
1606
- */var a=a||{},c=this||self;function l(o){var u=typeof o;return u=u!="object"?u:o?Array.isArray(o)?"array":u:"null",u=="array"||u=="object"&&typeof o.length=="number"}function d(o){var u=typeof o;return u=="object"&&o!=null||u=="function"}function f(o,u,h){return o.call.apply(o.bind,arguments)}function m(o,u,h){if(!o)throw Error();if(2<arguments.length){var p=Array.prototype.slice.call(arguments,2);return function(){var w=Array.prototype.slice.call(arguments);return Array.prototype.unshift.apply(w,p),o.apply(u,w)}}return function(){return o.apply(u,arguments)}}function E(o,u,h){return E=Function.prototype.bind&&Function.prototype.bind.toString().indexOf("native code")!=-1?f:m,E.apply(null,arguments)}function R(o,u){var h=Array.prototype.slice.call(arguments,1);return function(){var p=h.slice();return p.push.apply(p,arguments),o.apply(this,p)}}function C(o,u){function h(){}h.prototype=u.prototype,o.aa=u.prototype,o.prototype=new h,o.prototype.constructor=o,o.Qb=function(p,w,b){for(var D=Array(arguments.length-2),J=2;J<arguments.length;J++)D[J-2]=arguments[J];return u.prototype[w].apply(p,D)}}function N(o){const u=o.length;if(0<u){const h=Array(u);for(let p=0;p<u;p++)h[p]=o[p];return h}return[]}function k(o,u){for(let h=1;h<arguments.length;h++){const p=arguments[h];if(l(p)){const w=o.length||0,b=p.length||0;o.length=w+b;for(let D=0;D<b;D++)o[w+D]=p[D]}else o.push(p)}}class F{constructor(u,h){this.i=u,this.j=h,this.h=0,this.g=null}get(){let u;return 0<this.h?(this.h--,u=this.g,this.g=u.next,u.next=null):u=this.i(),u}}function $(o){return/^[\s\xa0]*$/.test(o)}function M(){var o=c.navigator;return o&&(o=o.userAgent)?o:""}function j(o){return j[" "](o),o}j[" "]=function(){};var ce=M().indexOf("Gecko")!=-1&&!(M().toLowerCase().indexOf("webkit")!=-1&&M().indexOf("Edge")==-1)&&!(M().indexOf("Trident")!=-1||M().indexOf("MSIE")!=-1)&&M().indexOf("Edge")==-1;function X(o,u,h){for(const p in o)u.call(h,o[p],p,o)}function v(o,u){for(const h in o)u.call(void 0,o[h],h,o)}function g(o){const u={};for(const h in o)u[h]=o[h];return u}const _="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function T(o,u){let h,p;for(let w=1;w<arguments.length;w++){p=arguments[w];for(h in p)o[h]=p[h];for(let b=0;b<_.length;b++)h=_[b],Object.prototype.hasOwnProperty.call(p,h)&&(o[h]=p[h])}}function I(o){var u=1;o=o.split(":");const h=[];for(;0<u&&o.length;)h.push(o.shift()),u--;return o.length&&h.push(o.join(":")),h}function A(o){c.setTimeout(()=>{throw o},0)}function y(){var o=_i;let u=null;return o.g&&(u=o.g,o.g=o.g.next,o.g||(o.h=null),u.next=null),u}class Ze{constructor(){this.h=this.g=null}add(u,h){const p=Fn.get();p.set(u,h),this.h?this.h.next=p:this.g=p,this.h=p}}var Fn=new F(()=>new lf,o=>o.reset());class lf{constructor(){this.next=this.g=this.h=null}set(u,h){this.h=u,this.g=h,this.next=null}reset(){this.next=this.g=this.h=null}}let Bn,qn=!1,_i=new Ze,ka=()=>{const o=c.Promise.resolve(void 0);Bn=()=>{o.then(hf)}};var hf=()=>{for(var o;o=y();){try{o.h.call(o.g)}catch(h){A(h)}var u=Fn;u.j(o),100>u.h&&(u.h++,o.next=u.g,u.g=o)}qn=!1};function pt(){this.s=this.s,this.C=this.C}pt.prototype.s=!1,pt.prototype.ma=function(){this.s||(this.s=!0,this.N())},pt.prototype.N=function(){if(this.C)for(;this.C.length;)this.C.shift()()};function ge(o,u){this.type=o,this.g=this.target=u,this.defaultPrevented=!1}ge.prototype.h=function(){this.defaultPrevented=!0};var df=function(){if(!c.addEventListener||!Object.defineProperty)return!1;var o=!1,u=Object.defineProperty({},"passive",{get:function(){o=!0}});try{const h=()=>{};c.addEventListener("test",h,u),c.removeEventListener("test",h,u)}catch{}return o}();function $n(o,u){if(ge.call(this,o?o.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,o){var h=this.type=o.type,p=o.changedTouches&&o.changedTouches.length?o.changedTouches[0]:null;if(this.target=o.target||o.srcElement,this.g=u,u=o.relatedTarget){if(ce){e:{try{j(u.nodeName);var w=!0;break e}catch{}w=!1}w||(u=null)}}else h=="mouseover"?u=o.fromElement:h=="mouseout"&&(u=o.toElement);this.relatedTarget=u,p?(this.clientX=p.clientX!==void 0?p.clientX:p.pageX,this.clientY=p.clientY!==void 0?p.clientY:p.pageY,this.screenX=p.screenX||0,this.screenY=p.screenY||0):(this.clientX=o.clientX!==void 0?o.clientX:o.pageX,this.clientY=o.clientY!==void 0?o.clientY:o.pageY,this.screenX=o.screenX||0,this.screenY=o.screenY||0),this.button=o.button,this.key=o.key||"",this.ctrlKey=o.ctrlKey,this.altKey=o.altKey,this.shiftKey=o.shiftKey,this.metaKey=o.metaKey,this.pointerId=o.pointerId||0,this.pointerType=typeof o.pointerType=="string"?o.pointerType:ff[o.pointerType]||"",this.state=o.state,this.i=o,o.defaultPrevented&&$n.aa.h.call(this)}}C($n,ge);var ff={2:"touch",3:"pen",4:"mouse"};$n.prototype.h=function(){$n.aa.h.call(this);var o=this.i;o.preventDefault?o.preventDefault():o.returnValue=!1};var Ur="closure_listenable_"+(1e6*Math.random()|0),pf=0;function mf(o,u,h,p,w){this.listener=o,this.proxy=null,this.src=u,this.type=h,this.capture=!!p,this.ha=w,this.key=++pf,this.da=this.fa=!1}function Fr(o){o.da=!0,o.listener=null,o.proxy=null,o.src=null,o.ha=null}function Br(o){this.src=o,this.g={},this.h=0}Br.prototype.add=function(o,u,h,p,w){var b=o.toString();o=this.g[b],o||(o=this.g[b]=[],this.h++);var D=Ti(o,u,p,w);return-1<D?(u=o[D],h||(u.fa=!1)):(u=new mf(u,this.src,b,!!p,w),u.fa=h,o.push(u)),u};function yi(o,u){var h=u.type;if(h in o.g){var p=o.g[h],w=Array.prototype.indexOf.call(p,u,void 0),b;(b=0<=w)&&Array.prototype.splice.call(p,w,1),b&&(Fr(u),o.g[h].length==0&&(delete o.g[h],o.h--))}}function Ti(o,u,h,p){for(var w=0;w<o.length;++w){var b=o[w];if(!b.da&&b.listener==u&&b.capture==!!h&&b.ha==p)return w}return-1}var Ei="closure_lm_"+(1e6*Math.random()|0),vi={};function Na(o,u,h,p,w){if(Array.isArray(u)){for(var b=0;b<u.length;b++)Na(o,u[b],h,p,w);return null}return h=Va(h),o&&o[Ur]?o.K(u,h,d(p)?!!p.capture:!1,w):gf(o,u,h,!1,p,w)}function gf(o,u,h,p,w,b){if(!u)throw Error("Invalid event type");var D=d(w)?!!w.capture:!!w,J=wi(o);if(J||(o[Ei]=J=new Br(o)),h=J.add(u,h,p,D,b),h.proxy)return h;if(p=_f(),h.proxy=p,p.src=o,p.listener=h,o.addEventListener)df||(w=D),w===void 0&&(w=!1),o.addEventListener(u.toString(),p,w);else if(o.attachEvent)o.attachEvent(Oa(u.toString()),p);else if(o.addListener&&o.removeListener)o.addListener(p);else throw Error("addEventListener and attachEvent are unavailable.");return h}function _f(){function o(h){return u.call(o.src,o.listener,h)}const u=yf;return o}function Da(o,u,h,p,w){if(Array.isArray(u))for(var b=0;b<u.length;b++)Da(o,u[b],h,p,w);else p=d(p)?!!p.capture:!!p,h=Va(h),o&&o[Ur]?(o=o.i,u=String(u).toString(),u in o.g&&(b=o.g[u],h=Ti(b,h,p,w),-1<h&&(Fr(b[h]),Array.prototype.splice.call(b,h,1),b.length==0&&(delete o.g[u],o.h--)))):o&&(o=wi(o))&&(u=o.g[u.toString()],o=-1,u&&(o=Ti(u,h,p,w)),(h=-1<o?u[o]:null)&&Ii(h))}function Ii(o){if(typeof o!="number"&&o&&!o.da){var u=o.src;if(u&&u[Ur])yi(u.i,o);else{var h=o.type,p=o.proxy;u.removeEventListener?u.removeEventListener(h,p,o.capture):u.detachEvent?u.detachEvent(Oa(h),p):u.addListener&&u.removeListener&&u.removeListener(p),(h=wi(u))?(yi(h,o),h.h==0&&(h.src=null,u[Ei]=null)):Fr(o)}}}function Oa(o){return o in vi?vi[o]:vi[o]="on"+o}function yf(o,u){if(o.da)o=!0;else{u=new $n(u,this);var h=o.listener,p=o.ha||o.src;o.fa&&Ii(o),o=h.call(p,u)}return o}function wi(o){return o=o[Ei],o instanceof Br?o:null}var Ai="__closure_events_fn_"+(1e9*Math.random()>>>0);function Va(o){return typeof o=="function"?o:(o[Ai]||(o[Ai]=function(u){return o.handleEvent(u)}),o[Ai])}function _e(){pt.call(this),this.i=new Br(this),this.M=this,this.F=null}C(_e,pt),_e.prototype[Ur]=!0,_e.prototype.removeEventListener=function(o,u,h,p){Da(this,o,u,h,p)};function Ae(o,u){var h,p=o.F;if(p)for(h=[];p;p=p.F)h.push(p);if(o=o.M,p=u.type||u,typeof u=="string")u=new ge(u,o);else if(u instanceof ge)u.target=u.target||o;else{var w=u;u=new ge(p,o),T(u,w)}if(w=!0,h)for(var b=h.length-1;0<=b;b--){var D=u.g=h[b];w=qr(D,p,!0,u)&&w}if(D=u.g=o,w=qr(D,p,!0,u)&&w,w=qr(D,p,!1,u)&&w,h)for(b=0;b<h.length;b++)D=u.g=h[b],w=qr(D,p,!1,u)&&w}_e.prototype.N=function(){if(_e.aa.N.call(this),this.i){var o=this.i,u;for(u in o.g){for(var h=o.g[u],p=0;p<h.length;p++)Fr(h[p]);delete o.g[u],o.h--}}this.F=null},_e.prototype.K=function(o,u,h,p){return this.i.add(String(o),u,!1,h,p)},_e.prototype.L=function(o,u,h,p){return this.i.add(String(o),u,!0,h,p)};function qr(o,u,h,p){if(u=o.i.g[String(u)],!u)return!0;u=u.concat();for(var w=!0,b=0;b<u.length;++b){var D=u[b];if(D&&!D.da&&D.capture==h){var J=D.listener,de=D.ha||D.src;D.fa&&yi(o.i,D),w=J.call(de,p)!==!1&&w}}return w&&!p.defaultPrevented}function La(o,u,h){if(typeof o=="function")h&&(o=E(o,h));else if(o&&typeof o.handleEvent=="function")o=E(o.handleEvent,o);else throw Error("Invalid listener argument");return 2147483647<Number(u)?-1:c.setTimeout(o,u||0)}function Ma(o){o.g=La(()=>{o.g=null,o.i&&(o.i=!1,Ma(o))},o.l);const u=o.h;o.h=null,o.m.apply(null,u)}class Tf extends pt{constructor(u,h){super(),this.m=u,this.l=h,this.h=null,this.i=!1,this.g=null}j(u){this.h=arguments,this.g?this.i=!0:Ma(this)}N(){super.N(),this.g&&(c.clearTimeout(this.g),this.g=null,this.i=!1,this.h=null)}}function jn(o){pt.call(this),this.h=o,this.g={}}C(jn,pt);var xa=[];function Ua(o){X(o.g,function(u,h){this.g.hasOwnProperty(h)&&Ii(u)},o),o.g={}}jn.prototype.N=function(){jn.aa.N.call(this),Ua(this)},jn.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")};var Ri=c.JSON.stringify,Ef=c.JSON.parse,vf=class{stringify(o){return c.JSON.stringify(o,void 0)}parse(o){return c.JSON.parse(o,void 0)}};function bi(){}bi.prototype.h=null;function Fa(o){return o.h||(o.h=o.i())}function Ba(){}var Hn={OPEN:"a",kb:"b",Ja:"c",wb:"d"};function Pi(){ge.call(this,"d")}C(Pi,ge);function Si(){ge.call(this,"c")}C(Si,ge);var Bt={},qa=null;function $r(){return qa=qa||new _e}Bt.La="serverreachability";function $a(o){ge.call(this,Bt.La,o)}C($a,ge);function zn(o){const u=$r();Ae(u,new $a(u))}Bt.STAT_EVENT="statevent";function ja(o,u){ge.call(this,Bt.STAT_EVENT,o),this.stat=u}C(ja,ge);function Re(o){const u=$r();Ae(u,new ja(u,o))}Bt.Ma="timingevent";function Ha(o,u){ge.call(this,Bt.Ma,o),this.size=u}C(Ha,ge);function Gn(o,u){if(typeof o!="function")throw Error("Fn must not be null and must be a function");return c.setTimeout(function(){o()},u)}function Wn(){this.g=!0}Wn.prototype.xa=function(){this.g=!1};function If(o,u,h,p,w,b){o.info(function(){if(o.g)if(b)for(var D="",J=b.split("&"),de=0;de<J.length;de++){var K=J[de].split("=");if(1<K.length){var ye=K[0];K=K[1];var Te=ye.split("_");D=2<=Te.length&&Te[1]=="type"?D+(ye+"="+K+"&"):D+(ye+"=redacted&")}}else D=null;else D=b;return"XMLHTTP REQ ("+p+") [attempt "+w+"]: "+u+`
1635
+ */var a=a||{},c=this||self;function l(o){var u=typeof o;return u=u!="object"?u:o?Array.isArray(o)?"array":u:"null",u=="array"||u=="object"&&typeof o.length=="number"}function d(o){var u=typeof o;return u=="object"&&o!=null||u=="function"}function f(o,u,h){return o.call.apply(o.bind,arguments)}function m(o,u,h){if(!o)throw Error();if(2<arguments.length){var p=Array.prototype.slice.call(arguments,2);return function(){var w=Array.prototype.slice.call(arguments);return Array.prototype.unshift.apply(w,p),o.apply(u,w)}}return function(){return o.apply(u,arguments)}}function _(o,u,h){return _=Function.prototype.bind&&Function.prototype.bind.toString().indexOf("native code")!=-1?f:m,_.apply(null,arguments)}function R(o,u){var h=Array.prototype.slice.call(arguments,1);return function(){var p=h.slice();return p.push.apply(p,arguments),o.apply(this,p)}}function S(o,u){function h(){}h.prototype=u.prototype,o.aa=u.prototype,o.prototype=new h,o.prototype.constructor=o,o.Qb=function(p,w,b){for(var D=Array(arguments.length-2),Y=2;Y<arguments.length;Y++)D[Y-2]=arguments[Y];return u.prototype[w].apply(p,D)}}function N(o){const u=o.length;if(0<u){const h=Array(u);for(let p=0;p<u;p++)h[p]=o[p];return h}return[]}function k(o,u){for(let h=1;h<arguments.length;h++){const p=arguments[h];if(l(p)){const w=o.length||0,b=p.length||0;o.length=w+b;for(let D=0;D<b;D++)o[w+D]=p[D]}else o.push(p)}}class B{constructor(u,h){this.i=u,this.j=h,this.h=0,this.g=null}get(){let u;return 0<this.h?(this.h--,u=this.g,this.g=u.next,u.next=null):u=this.i(),u}}function M(o){return/^[\s\xa0]*$/.test(o)}function x(){var o=c.navigator;return o&&(o=o.userAgent)?o:""}function $(o){return $[" "](o),o}$[" "]=function(){};var ce=x().indexOf("Gecko")!=-1&&!(x().toLowerCase().indexOf("webkit")!=-1&&x().indexOf("Edge")==-1)&&!(x().indexOf("Trident")!=-1||x().indexOf("MSIE")!=-1)&&x().indexOf("Edge")==-1;function X(o,u,h){for(const p in o)u.call(h,o[p],p,o)}function v(o,u){for(const h in o)u.call(void 0,o[h],h,o)}function g(o){const u={};for(const h in o)u[h]=o[h];return u}const y="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function T(o,u){let h,p;for(let w=1;w<arguments.length;w++){p=arguments[w];for(h in p)o[h]=p[h];for(let b=0;b<y.length;b++)h=y[b],Object.prototype.hasOwnProperty.call(p,h)&&(o[h]=p[h])}}function I(o){var u=1;o=o.split(":");const h=[];for(;0<u&&o.length;)h.push(o.shift()),u--;return o.length&&h.push(o.join(":")),h}function A(o){c.setTimeout(()=>{throw o},0)}function E(){var o=vi;let u=null;return o.g&&(u=o.g,o.g=o.g.next,o.g||(o.h=null),u.next=null),u}class Ze{constructor(){this.h=this.g=null}add(u,h){const p=qn.get();p.set(u,h),this.h?this.h.next=p:this.g=p,this.h=p}}var qn=new B(()=>new _f,o=>o.reset());class _f{constructor(){this.next=this.g=this.h=null}set(u,h){this.h=u,this.g=h,this.next=null}reset(){this.next=this.g=this.h=null}}let jn,$n=!1,vi=new Ze,Oa=()=>{const o=c.Promise.resolve(void 0);jn=()=>{o.then(yf)}};var yf=()=>{for(var o;o=E();){try{o.h.call(o.g)}catch(h){A(h)}var u=qn;u.j(o),100>u.h&&(u.h++,o.next=u.g,u.g=o)}$n=!1};function pt(){this.s=this.s,this.C=this.C}pt.prototype.s=!1,pt.prototype.ma=function(){this.s||(this.s=!0,this.N())},pt.prototype.N=function(){if(this.C)for(;this.C.length;)this.C.shift()()};function ge(o,u){this.type=o,this.g=this.target=u,this.defaultPrevented=!1}ge.prototype.h=function(){this.defaultPrevented=!0};var Ef=function(){if(!c.addEventListener||!Object.defineProperty)return!1;var o=!1,u=Object.defineProperty({},"passive",{get:function(){o=!0}});try{const h=()=>{};c.addEventListener("test",h,u),c.removeEventListener("test",h,u)}catch{}return o}();function zn(o,u){if(ge.call(this,o?o.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,o){var h=this.type=o.type,p=o.changedTouches&&o.changedTouches.length?o.changedTouches[0]:null;if(this.target=o.target||o.srcElement,this.g=u,u=o.relatedTarget){if(ce){e:{try{$(u.nodeName);var w=!0;break e}catch{}w=!1}w||(u=null)}}else h=="mouseover"?u=o.fromElement:h=="mouseout"&&(u=o.toElement);this.relatedTarget=u,p?(this.clientX=p.clientX!==void 0?p.clientX:p.pageX,this.clientY=p.clientY!==void 0?p.clientY:p.pageY,this.screenX=p.screenX||0,this.screenY=p.screenY||0):(this.clientX=o.clientX!==void 0?o.clientX:o.pageX,this.clientY=o.clientY!==void 0?o.clientY:o.pageY,this.screenX=o.screenX||0,this.screenY=o.screenY||0),this.button=o.button,this.key=o.key||"",this.ctrlKey=o.ctrlKey,this.altKey=o.altKey,this.shiftKey=o.shiftKey,this.metaKey=o.metaKey,this.pointerId=o.pointerId||0,this.pointerType=typeof o.pointerType=="string"?o.pointerType:Tf[o.pointerType]||"",this.state=o.state,this.i=o,o.defaultPrevented&&zn.aa.h.call(this)}}S(zn,ge);var Tf={2:"touch",3:"pen",4:"mouse"};zn.prototype.h=function(){zn.aa.h.call(this);var o=this.i;o.preventDefault?o.preventDefault():o.returnValue=!1};var qr="closure_listenable_"+(1e6*Math.random()|0),vf=0;function If(o,u,h,p,w){this.listener=o,this.proxy=null,this.src=u,this.type=h,this.capture=!!p,this.ha=w,this.key=++vf,this.da=this.fa=!1}function jr(o){o.da=!0,o.listener=null,o.proxy=null,o.src=null,o.ha=null}function $r(o){this.src=o,this.g={},this.h=0}$r.prototype.add=function(o,u,h,p,w){var b=o.toString();o=this.g[b],o||(o=this.g[b]=[],this.h++);var D=wi(o,u,p,w);return-1<D?(u=o[D],h||(u.fa=!1)):(u=new If(u,this.src,b,!!p,w),u.fa=h,o.push(u)),u};function Ii(o,u){var h=u.type;if(h in o.g){var p=o.g[h],w=Array.prototype.indexOf.call(p,u,void 0),b;(b=0<=w)&&Array.prototype.splice.call(p,w,1),b&&(jr(u),o.g[h].length==0&&(delete o.g[h],o.h--))}}function wi(o,u,h,p){for(var w=0;w<o.length;++w){var b=o[w];if(!b.da&&b.listener==u&&b.capture==!!h&&b.ha==p)return w}return-1}var Ai="closure_lm_"+(1e6*Math.random()|0),Ri={};function La(o,u,h,p,w){if(Array.isArray(u)){for(var b=0;b<u.length;b++)La(o,u[b],h,p,w);return null}return h=Ua(h),o&&o[qr]?o.K(u,h,d(p)?!!p.capture:!1,w):wf(o,u,h,!1,p,w)}function wf(o,u,h,p,w,b){if(!u)throw Error("Invalid event type");var D=d(w)?!!w.capture:!!w,Y=Pi(o);if(Y||(o[Ai]=Y=new $r(o)),h=Y.add(u,h,p,D,b),h.proxy)return h;if(p=Af(),h.proxy=p,p.src=o,p.listener=h,o.addEventListener)Ef||(w=D),w===void 0&&(w=!1),o.addEventListener(u.toString(),p,w);else if(o.attachEvent)o.attachEvent(Ma(u.toString()),p);else if(o.addListener&&o.removeListener)o.addListener(p);else throw Error("addEventListener and attachEvent are unavailable.");return h}function Af(){function o(h){return u.call(o.src,o.listener,h)}const u=Rf;return o}function xa(o,u,h,p,w){if(Array.isArray(u))for(var b=0;b<u.length;b++)xa(o,u[b],h,p,w);else p=d(p)?!!p.capture:!!p,h=Ua(h),o&&o[qr]?(o=o.i,u=String(u).toString(),u in o.g&&(b=o.g[u],h=wi(b,h,p,w),-1<h&&(jr(b[h]),Array.prototype.splice.call(b,h,1),b.length==0&&(delete o.g[u],o.h--)))):o&&(o=Pi(o))&&(u=o.g[u.toString()],o=-1,u&&(o=wi(u,h,p,w)),(h=-1<o?u[o]:null)&&bi(h))}function bi(o){if(typeof o!="number"&&o&&!o.da){var u=o.src;if(u&&u[qr])Ii(u.i,o);else{var h=o.type,p=o.proxy;u.removeEventListener?u.removeEventListener(h,p,o.capture):u.detachEvent?u.detachEvent(Ma(h),p):u.addListener&&u.removeListener&&u.removeListener(p),(h=Pi(u))?(Ii(h,o),h.h==0&&(h.src=null,u[Ai]=null)):jr(o)}}}function Ma(o){return o in Ri?Ri[o]:Ri[o]="on"+o}function Rf(o,u){if(o.da)o=!0;else{u=new zn(u,this);var h=o.listener,p=o.ha||o.src;o.fa&&bi(o),o=h.call(p,u)}return o}function Pi(o){return o=o[Ai],o instanceof $r?o:null}var Si="__closure_events_fn_"+(1e9*Math.random()>>>0);function Ua(o){return typeof o=="function"?o:(o[Si]||(o[Si]=function(u){return o.handleEvent(u)}),o[Si])}function _e(){pt.call(this),this.i=new $r(this),this.M=this,this.F=null}S(_e,pt),_e.prototype[qr]=!0,_e.prototype.removeEventListener=function(o,u,h,p){xa(this,o,u,h,p)};function Ae(o,u){var h,p=o.F;if(p)for(h=[];p;p=p.F)h.push(p);if(o=o.M,p=u.type||u,typeof u=="string")u=new ge(u,o);else if(u instanceof ge)u.target=u.target||o;else{var w=u;u=new ge(p,o),T(u,w)}if(w=!0,h)for(var b=h.length-1;0<=b;b--){var D=u.g=h[b];w=zr(D,p,!0,u)&&w}if(D=u.g=o,w=zr(D,p,!0,u)&&w,w=zr(D,p,!1,u)&&w,h)for(b=0;b<h.length;b++)D=u.g=h[b],w=zr(D,p,!1,u)&&w}_e.prototype.N=function(){if(_e.aa.N.call(this),this.i){var o=this.i,u;for(u in o.g){for(var h=o.g[u],p=0;p<h.length;p++)jr(h[p]);delete o.g[u],o.h--}}this.F=null},_e.prototype.K=function(o,u,h,p){return this.i.add(String(o),u,!1,h,p)},_e.prototype.L=function(o,u,h,p){return this.i.add(String(o),u,!0,h,p)};function zr(o,u,h,p){if(u=o.i.g[String(u)],!u)return!0;u=u.concat();for(var w=!0,b=0;b<u.length;++b){var D=u[b];if(D&&!D.da&&D.capture==h){var Y=D.listener,de=D.ha||D.src;D.fa&&Ii(o.i,D),w=Y.call(de,p)!==!1&&w}}return w&&!p.defaultPrevented}function Fa(o,u,h){if(typeof o=="function")h&&(o=_(o,h));else if(o&&typeof o.handleEvent=="function")o=_(o.handleEvent,o);else throw Error("Invalid listener argument");return 2147483647<Number(u)?-1:c.setTimeout(o,u||0)}function Ba(o){o.g=Fa(()=>{o.g=null,o.i&&(o.i=!1,Ba(o))},o.l);const u=o.h;o.h=null,o.m.apply(null,u)}class bf extends pt{constructor(u,h){super(),this.m=u,this.l=h,this.h=null,this.i=!1,this.g=null}j(u){this.h=arguments,this.g?this.i=!0:Ba(this)}N(){super.N(),this.g&&(c.clearTimeout(this.g),this.g=null,this.i=!1,this.h=null)}}function Hn(o){pt.call(this),this.h=o,this.g={}}S(Hn,pt);var qa=[];function ja(o){X(o.g,function(u,h){this.g.hasOwnProperty(h)&&bi(u)},o),o.g={}}Hn.prototype.N=function(){Hn.aa.N.call(this),ja(this)},Hn.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")};var Ci=c.JSON.stringify,Pf=c.JSON.parse,Sf=class{stringify(o){return c.JSON.stringify(o,void 0)}parse(o){return c.JSON.parse(o,void 0)}};function ki(){}ki.prototype.h=null;function $a(o){return o.h||(o.h=o.i())}function za(){}var Gn={OPEN:"a",kb:"b",Ja:"c",wb:"d"};function Ni(){ge.call(this,"d")}S(Ni,ge);function Di(){ge.call(this,"c")}S(Di,ge);var jt={},Ha=null;function Hr(){return Ha=Ha||new _e}jt.La="serverreachability";function Ga(o){ge.call(this,jt.La,o)}S(Ga,ge);function Wn(o){const u=Hr();Ae(u,new Ga(u))}jt.STAT_EVENT="statevent";function Wa(o,u){ge.call(this,jt.STAT_EVENT,o),this.stat=u}S(Wa,ge);function Re(o){const u=Hr();Ae(u,new Wa(u,o))}jt.Ma="timingevent";function Ka(o,u){ge.call(this,jt.Ma,o),this.size=u}S(Ka,ge);function Kn(o,u){if(typeof o!="function")throw Error("Fn must not be null and must be a function");return c.setTimeout(function(){o()},u)}function Qn(){this.g=!0}Qn.prototype.xa=function(){this.g=!1};function Cf(o,u,h,p,w,b){o.info(function(){if(o.g)if(b)for(var D="",Y=b.split("&"),de=0;de<Y.length;de++){var K=Y[de].split("=");if(1<K.length){var ye=K[0];K=K[1];var Ee=ye.split("_");D=2<=Ee.length&&Ee[1]=="type"?D+(ye+"="+K+"&"):D+(ye+"=redacted&")}}else D=null;else D=b;return"XMLHTTP REQ ("+p+") [attempt "+w+"]: "+u+`
1607
1636
  `+h+`
1608
- `+D})}function wf(o,u,h,p,w,b,D){o.info(function(){return"XMLHTTP RESP ("+p+") [ attempt "+w+"]: "+u+`
1637
+ `+D})}function kf(o,u,h,p,w,b,D){o.info(function(){return"XMLHTTP RESP ("+p+") [ attempt "+w+"]: "+u+`
1609
1638
  `+h+`
1610
- `+b+" "+D})}function un(o,u,h,p){o.info(function(){return"XMLHTTP TEXT ("+u+"): "+Rf(o,h)+(p?" "+p:"")})}function Af(o,u){o.info(function(){return"TIMEOUT: "+u})}Wn.prototype.info=function(){};function Rf(o,u){if(!o.g)return u;if(!u)return null;try{var h=JSON.parse(u);if(h){for(o=0;o<h.length;o++)if(Array.isArray(h[o])){var p=h[o];if(!(2>p.length)){var w=p[1];if(Array.isArray(w)&&!(1>w.length)){var b=w[0];if(b!="noop"&&b!="stop"&&b!="close")for(var D=1;D<w.length;D++)w[D]=""}}}}return Ri(h)}catch{return u}}var jr={NO_ERROR:0,gb:1,tb:2,sb:3,nb:4,rb:5,ub:6,Ia:7,TIMEOUT:8,xb:9},za={lb:"complete",Hb:"success",Ja:"error",Ia:"abort",zb:"ready",Ab:"readystatechange",TIMEOUT:"timeout",vb:"incrementaldata",yb:"progress",ob:"downloadprogress",Pb:"uploadprogress"},Ci;function Hr(){}C(Hr,bi),Hr.prototype.g=function(){return new XMLHttpRequest},Hr.prototype.i=function(){return{}},Ci=new Hr;function mt(o,u,h,p){this.j=o,this.i=u,this.l=h,this.R=p||1,this.U=new jn(this),this.I=45e3,this.H=null,this.o=!1,this.m=this.A=this.v=this.L=this.F=this.S=this.B=null,this.D=[],this.g=null,this.C=0,this.s=this.u=null,this.X=-1,this.J=!1,this.O=0,this.M=null,this.W=this.K=this.T=this.P=!1,this.h=new Ga}function Ga(){this.i=null,this.g="",this.h=!1}var Wa={},ki={};function Ni(o,u,h){o.L=1,o.v=Kr(et(u)),o.m=h,o.P=!0,Ka(o,null)}function Ka(o,u){o.F=Date.now(),zr(o),o.A=et(o.v);var h=o.A,p=o.R;Array.isArray(p)||(p=[String(p)]),cc(h.i,"t",p),o.C=0,h=o.j.J,o.h=new Ga,o.g=bc(o.j,h?u:null,!o.m),0<o.O&&(o.M=new Tf(E(o.Y,o,o.g),o.O)),u=o.U,h=o.g,p=o.ca;var w="readystatechange";Array.isArray(w)||(w&&(xa[0]=w.toString()),w=xa);for(var b=0;b<w.length;b++){var D=Na(h,w[b],p||u.handleEvent,!1,u.h||u);if(!D)break;u.g[D.key]=D}u=o.H?g(o.H):{},o.m?(o.u||(o.u="POST"),u["Content-Type"]="application/x-www-form-urlencoded",o.g.ea(o.A,o.u,o.m,u)):(o.u="GET",o.g.ea(o.A,o.u,null,u)),zn(),If(o.i,o.u,o.A,o.l,o.R,o.m)}mt.prototype.ca=function(o){o=o.target;const u=this.M;u&&tt(o)==3?u.j():this.Y(o)},mt.prototype.Y=function(o){try{if(o==this.g)e:{const Te=tt(this.g);var u=this.g.Ba();const dn=this.g.Z();if(!(3>Te)&&(Te!=3||this.g&&(this.h.h||this.g.oa()||mc(this.g)))){this.J||Te!=4||u==7||(u==8||0>=dn?zn(3):zn(2)),Di(this);var h=this.g.Z();this.X=h;t:if(Qa(this)){var p=mc(this.g);o="";var w=p.length,b=tt(this.g)==4;if(!this.h.i){if(typeof TextDecoder>"u"){qt(this),Kn(this);var D="";break t}this.h.i=new c.TextDecoder}for(u=0;u<w;u++)this.h.h=!0,o+=this.h.i.decode(p[u],{stream:!(b&&u==w-1)});p.length=0,this.h.g+=o,this.C=0,D=this.h.g}else D=this.g.oa();if(this.o=h==200,wf(this.i,this.u,this.A,this.l,this.R,Te,h),this.o){if(this.T&&!this.K){t:{if(this.g){var J,de=this.g;if((J=de.g?de.g.getResponseHeader("X-HTTP-Initial-Response"):null)&&!$(J)){var K=J;break t}}K=null}if(h=K)un(this.i,this.l,h,"Initial handshake response via X-HTTP-Initial-Response"),this.K=!0,Oi(this,h);else{this.o=!1,this.s=3,Re(12),qt(this),Kn(this);break e}}if(this.P){h=!0;let xe;for(;!this.J&&this.C<D.length;)if(xe=bf(this,D),xe==ki){Te==4&&(this.s=4,Re(14),h=!1),un(this.i,this.l,null,"[Incomplete Response]");break}else if(xe==Wa){this.s=4,Re(15),un(this.i,this.l,D,"[Invalid Chunk]"),h=!1;break}else un(this.i,this.l,xe,null),Oi(this,xe);if(Qa(this)&&this.C!=0&&(this.h.g=this.h.g.slice(this.C),this.C=0),Te!=4||D.length!=0||this.h.h||(this.s=1,Re(16),h=!1),this.o=this.o&&h,!h)un(this.i,this.l,D,"[Invalid Chunked Response]"),qt(this),Kn(this);else if(0<D.length&&!this.W){this.W=!0;var ye=this.j;ye.g==this&&ye.ba&&!ye.M&&(ye.j.info("Great, no buffering proxy detected. Bytes received: "+D.length),Fi(ye),ye.M=!0,Re(11))}}else un(this.i,this.l,D,null),Oi(this,D);Te==4&&qt(this),this.o&&!this.J&&(Te==4?Ic(this.j,this):(this.o=!1,zr(this)))}else jf(this.g),h==400&&0<D.indexOf("Unknown SID")?(this.s=3,Re(12)):(this.s=0,Re(13)),qt(this),Kn(this)}}}catch{}finally{}};function Qa(o){return o.g?o.u=="GET"&&o.L!=2&&o.j.Ca:!1}function bf(o,u){var h=o.C,p=u.indexOf(`
1611
- `,h);return p==-1?ki:(h=Number(u.substring(h,p)),isNaN(h)?Wa:(p+=1,p+h>u.length?ki:(u=u.slice(p,p+h),o.C=p+h,u)))}mt.prototype.cancel=function(){this.J=!0,qt(this)};function zr(o){o.S=Date.now()+o.I,Xa(o,o.I)}function Xa(o,u){if(o.B!=null)throw Error("WatchDog timer not null");o.B=Gn(E(o.ba,o),u)}function Di(o){o.B&&(c.clearTimeout(o.B),o.B=null)}mt.prototype.ba=function(){this.B=null;const o=Date.now();0<=o-this.S?(Af(this.i,this.A),this.L!=2&&(zn(),Re(17)),qt(this),this.s=2,Kn(this)):Xa(this,this.S-o)};function Kn(o){o.j.G==0||o.J||Ic(o.j,o)}function qt(o){Di(o);var u=o.M;u&&typeof u.ma=="function"&&u.ma(),o.M=null,Ua(o.U),o.g&&(u=o.g,o.g=null,u.abort(),u.ma())}function Oi(o,u){try{var h=o.j;if(h.G!=0&&(h.g==o||Vi(h.h,o))){if(!o.K&&Vi(h.h,o)&&h.G==3){try{var p=h.Da.g.parse(u)}catch{p=null}if(Array.isArray(p)&&p.length==3){var w=p;if(w[0]==0){e:if(!h.u){if(h.g)if(h.g.F+3e3<o.F)es(h),Yr(h);else break e;Ui(h),Re(18)}}else h.za=w[1],0<h.za-h.T&&37500>w[2]&&h.F&&h.v==0&&!h.C&&(h.C=Gn(E(h.Za,h),6e3));if(1>=Za(h.h)&&h.ca){try{h.ca()}catch{}h.ca=void 0}}else jt(h,11)}else if((o.K||h.g==o)&&es(h),!$(u))for(w=h.Da.g.parse(u),u=0;u<w.length;u++){let K=w[u];if(h.T=K[0],K=K[1],h.G==2)if(K[0]=="c"){h.K=K[1],h.ia=K[2];const ye=K[3];ye!=null&&(h.la=ye,h.j.info("VER="+h.la));const Te=K[4];Te!=null&&(h.Aa=Te,h.j.info("SVER="+h.Aa));const dn=K[5];dn!=null&&typeof dn=="number"&&0<dn&&(p=1.5*dn,h.L=p,h.j.info("backChannelRequestTimeoutMs_="+p)),p=h;const xe=o.g;if(xe){const ns=xe.g?xe.g.getResponseHeader("X-Client-Wire-Protocol"):null;if(ns){var b=p.h;b.g||ns.indexOf("spdy")==-1&&ns.indexOf("quic")==-1&&ns.indexOf("h2")==-1||(b.j=b.l,b.g=new Set,b.h&&(Li(b,b.h),b.h=null))}if(p.D){const Bi=xe.g?xe.g.getResponseHeader("X-HTTP-Session-Id"):null;Bi&&(p.ya=Bi,ee(p.I,p.D,Bi))}}h.G=3,h.l&&h.l.ua(),h.ba&&(h.R=Date.now()-o.F,h.j.info("Handshake RTT: "+h.R+"ms")),p=h;var D=o;if(p.qa=Rc(p,p.J?p.ia:null,p.W),D.K){ec(p.h,D);var J=D,de=p.L;de&&(J.I=de),J.B&&(Di(J),zr(J)),p.g=D}else Ec(p);0<h.i.length&&Zr(h)}else K[0]!="stop"&&K[0]!="close"||jt(h,7);else h.G==3&&(K[0]=="stop"||K[0]=="close"?K[0]=="stop"?jt(h,7):xi(h):K[0]!="noop"&&h.l&&h.l.ta(K),h.v=0)}}zn(4)}catch{}}var Pf=class{constructor(o,u){this.g=o,this.map=u}};function Ja(o){this.l=o||10,c.PerformanceNavigationTiming?(o=c.performance.getEntriesByType("navigation"),o=0<o.length&&(o[0].nextHopProtocol=="hq"||o[0].nextHopProtocol=="h2")):o=!!(c.chrome&&c.chrome.loadTimes&&c.chrome.loadTimes()&&c.chrome.loadTimes().wasFetchedViaSpdy),this.j=o?this.l:1,this.g=null,1<this.j&&(this.g=new Set),this.h=null,this.i=[]}function Ya(o){return o.h?!0:o.g?o.g.size>=o.j:!1}function Za(o){return o.h?1:o.g?o.g.size:0}function Vi(o,u){return o.h?o.h==u:o.g?o.g.has(u):!1}function Li(o,u){o.g?o.g.add(u):o.h=u}function ec(o,u){o.h&&o.h==u?o.h=null:o.g&&o.g.has(u)&&o.g.delete(u)}Ja.prototype.cancel=function(){if(this.i=tc(this),this.h)this.h.cancel(),this.h=null;else if(this.g&&this.g.size!==0){for(const o of this.g.values())o.cancel();this.g.clear()}};function tc(o){if(o.h!=null)return o.i.concat(o.h.D);if(o.g!=null&&o.g.size!==0){let u=o.i;for(const h of o.g.values())u=u.concat(h.D);return u}return N(o.i)}function Sf(o){if(o.V&&typeof o.V=="function")return o.V();if(typeof Map<"u"&&o instanceof Map||typeof Set<"u"&&o instanceof Set)return Array.from(o.values());if(typeof o=="string")return o.split("");if(l(o)){for(var u=[],h=o.length,p=0;p<h;p++)u.push(o[p]);return u}u=[],h=0;for(p in o)u[h++]=o[p];return u}function Cf(o){if(o.na&&typeof o.na=="function")return o.na();if(!o.V||typeof o.V!="function"){if(typeof Map<"u"&&o instanceof Map)return Array.from(o.keys());if(!(typeof Set<"u"&&o instanceof Set)){if(l(o)||typeof o=="string"){var u=[];o=o.length;for(var h=0;h<o;h++)u.push(h);return u}u=[],h=0;for(const p in o)u[h++]=p;return u}}}function nc(o,u){if(o.forEach&&typeof o.forEach=="function")o.forEach(u,void 0);else if(l(o)||typeof o=="string")Array.prototype.forEach.call(o,u,void 0);else for(var h=Cf(o),p=Sf(o),w=p.length,b=0;b<w;b++)u.call(void 0,p[b],h&&h[b],o)}var rc=RegExp("^(?:([^:/?#.]+):)?(?://(?:([^\\\\/?#]*)@)?([^\\\\/?#]*?)(?::([0-9]+))?(?=[\\\\/?#]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#([\\s\\S]*))?$");function kf(o,u){if(o){o=o.split("&");for(var h=0;h<o.length;h++){var p=o[h].indexOf("="),w=null;if(0<=p){var b=o[h].substring(0,p);w=o[h].substring(p+1)}else b=o[h];u(b,w?decodeURIComponent(w.replace(/\+/g," ")):"")}}}function $t(o){if(this.g=this.o=this.j="",this.s=null,this.m=this.l="",this.h=!1,o instanceof $t){this.h=o.h,Gr(this,o.j),this.o=o.o,this.g=o.g,Wr(this,o.s),this.l=o.l;var u=o.i,h=new Jn;h.i=u.i,u.g&&(h.g=new Map(u.g),h.h=u.h),sc(this,h),this.m=o.m}else o&&(u=String(o).match(rc))?(this.h=!1,Gr(this,u[1]||"",!0),this.o=Qn(u[2]||""),this.g=Qn(u[3]||"",!0),Wr(this,u[4]),this.l=Qn(u[5]||"",!0),sc(this,u[6]||"",!0),this.m=Qn(u[7]||"")):(this.h=!1,this.i=new Jn(null,this.h))}$t.prototype.toString=function(){var o=[],u=this.j;u&&o.push(Xn(u,ic,!0),":");var h=this.g;return(h||u=="file")&&(o.push("//"),(u=this.o)&&o.push(Xn(u,ic,!0),"@"),o.push(encodeURIComponent(String(h)).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),h=this.s,h!=null&&o.push(":",String(h))),(h=this.l)&&(this.g&&h.charAt(0)!="/"&&o.push("/"),o.push(Xn(h,h.charAt(0)=="/"?Of:Df,!0))),(h=this.i.toString())&&o.push("?",h),(h=this.m)&&o.push("#",Xn(h,Lf)),o.join("")};function et(o){return new $t(o)}function Gr(o,u,h){o.j=h?Qn(u,!0):u,o.j&&(o.j=o.j.replace(/:$/,""))}function Wr(o,u){if(u){if(u=Number(u),isNaN(u)||0>u)throw Error("Bad port number "+u);o.s=u}else o.s=null}function sc(o,u,h){u instanceof Jn?(o.i=u,Mf(o.i,o.h)):(h||(u=Xn(u,Vf)),o.i=new Jn(u,o.h))}function ee(o,u,h){o.i.set(u,h)}function Kr(o){return ee(o,"zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^Date.now()).toString(36)),o}function Qn(o,u){return o?u?decodeURI(o.replace(/%25/g,"%2525")):decodeURIComponent(o):""}function Xn(o,u,h){return typeof o=="string"?(o=encodeURI(o).replace(u,Nf),h&&(o=o.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),o):null}function Nf(o){return o=o.charCodeAt(0),"%"+(o>>4&15).toString(16)+(o&15).toString(16)}var ic=/[#\/\?@]/g,Df=/[#\?:]/g,Of=/[#\?]/g,Vf=/[#\?@]/g,Lf=/#/g;function Jn(o,u){this.h=this.g=null,this.i=o||null,this.j=!!u}function gt(o){o.g||(o.g=new Map,o.h=0,o.i&&kf(o.i,function(u,h){o.add(decodeURIComponent(u.replace(/\+/g," ")),h)}))}n=Jn.prototype,n.add=function(o,u){gt(this),this.i=null,o=ln(this,o);var h=this.g.get(o);return h||this.g.set(o,h=[]),h.push(u),this.h+=1,this};function oc(o,u){gt(o),u=ln(o,u),o.g.has(u)&&(o.i=null,o.h-=o.g.get(u).length,o.g.delete(u))}function ac(o,u){return gt(o),u=ln(o,u),o.g.has(u)}n.forEach=function(o,u){gt(this),this.g.forEach(function(h,p){h.forEach(function(w){o.call(u,w,p,this)},this)},this)},n.na=function(){gt(this);const o=Array.from(this.g.values()),u=Array.from(this.g.keys()),h=[];for(let p=0;p<u.length;p++){const w=o[p];for(let b=0;b<w.length;b++)h.push(u[p])}return h},n.V=function(o){gt(this);let u=[];if(typeof o=="string")ac(this,o)&&(u=u.concat(this.g.get(ln(this,o))));else{o=Array.from(this.g.values());for(let h=0;h<o.length;h++)u=u.concat(o[h])}return u},n.set=function(o,u){return gt(this),this.i=null,o=ln(this,o),ac(this,o)&&(this.h-=this.g.get(o).length),this.g.set(o,[u]),this.h+=1,this},n.get=function(o,u){return o?(o=this.V(o),0<o.length?String(o[0]):u):u};function cc(o,u,h){oc(o,u),0<h.length&&(o.i=null,o.g.set(ln(o,u),N(h)),o.h+=h.length)}n.toString=function(){if(this.i)return this.i;if(!this.g)return"";const o=[],u=Array.from(this.g.keys());for(var h=0;h<u.length;h++){var p=u[h];const b=encodeURIComponent(String(p)),D=this.V(p);for(p=0;p<D.length;p++){var w=b;D[p]!==""&&(w+="="+encodeURIComponent(String(D[p]))),o.push(w)}}return this.i=o.join("&")};function ln(o,u){return u=String(u),o.j&&(u=u.toLowerCase()),u}function Mf(o,u){u&&!o.j&&(gt(o),o.i=null,o.g.forEach(function(h,p){var w=p.toLowerCase();p!=w&&(oc(this,p),cc(this,w,h))},o)),o.j=u}function xf(o,u){const h=new Wn;if(c.Image){const p=new Image;p.onload=R(_t,h,"TestLoadImage: loaded",!0,u,p),p.onerror=R(_t,h,"TestLoadImage: error",!1,u,p),p.onabort=R(_t,h,"TestLoadImage: abort",!1,u,p),p.ontimeout=R(_t,h,"TestLoadImage: timeout",!1,u,p),c.setTimeout(function(){p.ontimeout&&p.ontimeout()},1e4),p.src=o}else u(!1)}function Uf(o,u){const h=new Wn,p=new AbortController,w=setTimeout(()=>{p.abort(),_t(h,"TestPingServer: timeout",!1,u)},1e4);fetch(o,{signal:p.signal}).then(b=>{clearTimeout(w),b.ok?_t(h,"TestPingServer: ok",!0,u):_t(h,"TestPingServer: server error",!1,u)}).catch(()=>{clearTimeout(w),_t(h,"TestPingServer: error",!1,u)})}function _t(o,u,h,p,w){try{w&&(w.onload=null,w.onerror=null,w.onabort=null,w.ontimeout=null),p(h)}catch{}}function Ff(){this.g=new vf}function Bf(o,u,h){const p=h||"";try{nc(o,function(w,b){let D=w;d(w)&&(D=Ri(w)),u.push(p+b+"="+encodeURIComponent(D))})}catch(w){throw u.push(p+"type="+encodeURIComponent("_badmap")),w}}function Qr(o){this.l=o.Ub||null,this.j=o.eb||!1}C(Qr,bi),Qr.prototype.g=function(){return new Xr(this.l,this.j)},Qr.prototype.i=function(o){return function(){return o}}({});function Xr(o,u){_e.call(this),this.D=o,this.o=u,this.m=void 0,this.status=this.readyState=0,this.responseType=this.responseText=this.response=this.statusText="",this.onreadystatechange=null,this.u=new Headers,this.h=null,this.B="GET",this.A="",this.g=!1,this.v=this.j=this.l=null}C(Xr,_e),n=Xr.prototype,n.open=function(o,u){if(this.readyState!=0)throw this.abort(),Error("Error reopening a connection");this.B=o,this.A=u,this.readyState=1,Zn(this)},n.send=function(o){if(this.readyState!=1)throw this.abort(),Error("need to call open() first. ");this.g=!0;const u={headers:this.u,method:this.B,credentials:this.m,cache:void 0};o&&(u.body=o),(this.D||c).fetch(new Request(this.A,u)).then(this.Sa.bind(this),this.ga.bind(this))},n.abort=function(){this.response=this.responseText="",this.u=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,Yn(this)),this.readyState=0},n.Sa=function(o){if(this.g&&(this.l=o,this.h||(this.status=this.l.status,this.statusText=this.l.statusText,this.h=o.headers,this.readyState=2,Zn(this)),this.g&&(this.readyState=3,Zn(this),this.g)))if(this.responseType==="arraybuffer")o.arrayBuffer().then(this.Qa.bind(this),this.ga.bind(this));else if(typeof c.ReadableStream<"u"&&"body"in o){if(this.j=o.body.getReader(),this.o){if(this.responseType)throw Error('responseType must be empty for "streamBinaryChunks" mode responses.');this.response=[]}else this.response=this.responseText="",this.v=new TextDecoder;uc(this)}else o.text().then(this.Ra.bind(this),this.ga.bind(this))};function uc(o){o.j.read().then(o.Pa.bind(o)).catch(o.ga.bind(o))}n.Pa=function(o){if(this.g){if(this.o&&o.value)this.response.push(o.value);else if(!this.o){var u=o.value?o.value:new Uint8Array(0);(u=this.v.decode(u,{stream:!o.done}))&&(this.response=this.responseText+=u)}o.done?Yn(this):Zn(this),this.readyState==3&&uc(this)}},n.Ra=function(o){this.g&&(this.response=this.responseText=o,Yn(this))},n.Qa=function(o){this.g&&(this.response=o,Yn(this))},n.ga=function(){this.g&&Yn(this)};function Yn(o){o.readyState=4,o.l=null,o.j=null,o.v=null,Zn(o)}n.setRequestHeader=function(o,u){this.u.append(o,u)},n.getResponseHeader=function(o){return this.h&&this.h.get(o.toLowerCase())||""},n.getAllResponseHeaders=function(){if(!this.h)return"";const o=[],u=this.h.entries();for(var h=u.next();!h.done;)h=h.value,o.push(h[0]+": "+h[1]),h=u.next();return o.join(`\r
1612
- `)};function Zn(o){o.onreadystatechange&&o.onreadystatechange.call(o)}Object.defineProperty(Xr.prototype,"withCredentials",{get:function(){return this.m==="include"},set:function(o){this.m=o?"include":"same-origin"}});function lc(o){let u="";return X(o,function(h,p){u+=p,u+=":",u+=h,u+=`\r
1613
- `}),u}function Mi(o,u,h){e:{for(p in h){var p=!1;break e}p=!0}p||(h=lc(h),typeof o=="string"?h!=null&&encodeURIComponent(String(h)):ee(o,u,h))}function se(o){_e.call(this),this.headers=new Map,this.o=o||null,this.h=!1,this.v=this.g=null,this.D="",this.m=0,this.l="",this.j=this.B=this.u=this.A=!1,this.I=null,this.H="",this.J=!1}C(se,_e);var qf=/^https?$/i,$f=["POST","PUT"];n=se.prototype,n.Ha=function(o){this.J=o},n.ea=function(o,u,h,p){if(this.g)throw Error("[goog.net.XhrIo] Object is active with another request="+this.D+"; newUri="+o);u=u?u.toUpperCase():"GET",this.D=o,this.l="",this.m=0,this.A=!1,this.h=!0,this.g=this.o?this.o.g():Ci.g(),this.v=this.o?Fa(this.o):Fa(Ci),this.g.onreadystatechange=E(this.Ea,this);try{this.B=!0,this.g.open(u,String(o),!0),this.B=!1}catch(b){hc(this,b);return}if(o=h||"",h=new Map(this.headers),p)if(Object.getPrototypeOf(p)===Object.prototype)for(var w in p)h.set(w,p[w]);else if(typeof p.keys=="function"&&typeof p.get=="function")for(const b of p.keys())h.set(b,p.get(b));else throw Error("Unknown input type for opt_headers: "+String(p));p=Array.from(h.keys()).find(b=>b.toLowerCase()=="content-type"),w=c.FormData&&o instanceof c.FormData,!(0<=Array.prototype.indexOf.call($f,u,void 0))||p||w||h.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8");for(const[b,D]of h)this.g.setRequestHeader(b,D);this.H&&(this.g.responseType=this.H),"withCredentials"in this.g&&this.g.withCredentials!==this.J&&(this.g.withCredentials=this.J);try{pc(this),this.u=!0,this.g.send(o),this.u=!1}catch(b){hc(this,b)}};function hc(o,u){o.h=!1,o.g&&(o.j=!0,o.g.abort(),o.j=!1),o.l=u,o.m=5,dc(o),Jr(o)}function dc(o){o.A||(o.A=!0,Ae(o,"complete"),Ae(o,"error"))}n.abort=function(o){this.g&&this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1,this.m=o||7,Ae(this,"complete"),Ae(this,"abort"),Jr(this))},n.N=function(){this.g&&(this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1),Jr(this,!0)),se.aa.N.call(this)},n.Ea=function(){this.s||(this.B||this.u||this.j?fc(this):this.bb())},n.bb=function(){fc(this)};function fc(o){if(o.h&&typeof a<"u"&&(!o.v[1]||tt(o)!=4||o.Z()!=2)){if(o.u&&tt(o)==4)La(o.Ea,0,o);else if(Ae(o,"readystatechange"),tt(o)==4){o.h=!1;try{const D=o.Z();e:switch(D){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var u=!0;break e;default:u=!1}var h;if(!(h=u)){var p;if(p=D===0){var w=String(o.D).match(rc)[1]||null;!w&&c.self&&c.self.location&&(w=c.self.location.protocol.slice(0,-1)),p=!qf.test(w?w.toLowerCase():"")}h=p}if(h)Ae(o,"complete"),Ae(o,"success");else{o.m=6;try{var b=2<tt(o)?o.g.statusText:""}catch{b=""}o.l=b+" ["+o.Z()+"]",dc(o)}}finally{Jr(o)}}}}function Jr(o,u){if(o.g){pc(o);const h=o.g,p=o.v[0]?()=>{}:null;o.g=null,o.v=null,u||Ae(o,"ready");try{h.onreadystatechange=p}catch{}}}function pc(o){o.I&&(c.clearTimeout(o.I),o.I=null)}n.isActive=function(){return!!this.g};function tt(o){return o.g?o.g.readyState:0}n.Z=function(){try{return 2<tt(this)?this.g.status:-1}catch{return-1}},n.oa=function(){try{return this.g?this.g.responseText:""}catch{return""}},n.Oa=function(o){if(this.g){var u=this.g.responseText;return o&&u.indexOf(o)==0&&(u=u.substring(o.length)),Ef(u)}};function mc(o){try{if(!o.g)return null;if("response"in o.g)return o.g.response;switch(o.H){case"":case"text":return o.g.responseText;case"arraybuffer":if("mozResponseArrayBuffer"in o.g)return o.g.mozResponseArrayBuffer}return null}catch{return null}}function jf(o){const u={};o=(o.g&&2<=tt(o)&&o.g.getAllResponseHeaders()||"").split(`\r
1614
- `);for(let p=0;p<o.length;p++){if($(o[p]))continue;var h=I(o[p]);const w=h[0];if(h=h[1],typeof h!="string")continue;h=h.trim();const b=u[w]||[];u[w]=b,b.push(h)}v(u,function(p){return p.join(", ")})}n.Ba=function(){return this.m},n.Ka=function(){return typeof this.l=="string"?this.l:String(this.l)};function er(o,u,h){return h&&h.internalChannelParams&&h.internalChannelParams[o]||u}function gc(o){this.Aa=0,this.i=[],this.j=new Wn,this.ia=this.qa=this.I=this.W=this.g=this.ya=this.D=this.H=this.m=this.S=this.o=null,this.Ya=this.U=0,this.Va=er("failFast",!1,o),this.F=this.C=this.u=this.s=this.l=null,this.X=!0,this.za=this.T=-1,this.Y=this.v=this.B=0,this.Ta=er("baseRetryDelayMs",5e3,o),this.cb=er("retryDelaySeedMs",1e4,o),this.Wa=er("forwardChannelMaxRetries",2,o),this.wa=er("forwardChannelRequestTimeoutMs",2e4,o),this.pa=o&&o.xmlHttpFactory||void 0,this.Xa=o&&o.Tb||void 0,this.Ca=o&&o.useFetchStreams||!1,this.L=void 0,this.J=o&&o.supportsCrossDomainXhr||!1,this.K="",this.h=new Ja(o&&o.concurrentRequestLimit),this.Da=new Ff,this.P=o&&o.fastHandshake||!1,this.O=o&&o.encodeInitMessageHeaders||!1,this.P&&this.O&&(this.O=!1),this.Ua=o&&o.Rb||!1,o&&o.xa&&this.j.xa(),o&&o.forceLongPolling&&(this.X=!1),this.ba=!this.P&&this.X&&o&&o.detectBufferingProxy||!1,this.ja=void 0,o&&o.longPollingTimeout&&0<o.longPollingTimeout&&(this.ja=o.longPollingTimeout),this.ca=void 0,this.R=0,this.M=!1,this.ka=this.A=null}n=gc.prototype,n.la=8,n.G=1,n.connect=function(o,u,h,p){Re(0),this.W=o,this.H=u||{},h&&p!==void 0&&(this.H.OSID=h,this.H.OAID=p),this.F=this.X,this.I=Rc(this,null,this.W),Zr(this)};function xi(o){if(_c(o),o.G==3){var u=o.U++,h=et(o.I);if(ee(h,"SID",o.K),ee(h,"RID",u),ee(h,"TYPE","terminate"),tr(o,h),u=new mt(o,o.j,u),u.L=2,u.v=Kr(et(h)),h=!1,c.navigator&&c.navigator.sendBeacon)try{h=c.navigator.sendBeacon(u.v.toString(),"")}catch{}!h&&c.Image&&(new Image().src=u.v,h=!0),h||(u.g=bc(u.j,null),u.g.ea(u.v)),u.F=Date.now(),zr(u)}Ac(o)}function Yr(o){o.g&&(Fi(o),o.g.cancel(),o.g=null)}function _c(o){Yr(o),o.u&&(c.clearTimeout(o.u),o.u=null),es(o),o.h.cancel(),o.s&&(typeof o.s=="number"&&c.clearTimeout(o.s),o.s=null)}function Zr(o){if(!Ya(o.h)&&!o.s){o.s=!0;var u=o.Ga;Bn||ka(),qn||(Bn(),qn=!0),_i.add(u,o),o.B=0}}function Hf(o,u){return Za(o.h)>=o.h.j-(o.s?1:0)?!1:o.s?(o.i=u.D.concat(o.i),!0):o.G==1||o.G==2||o.B>=(o.Va?0:o.Wa)?!1:(o.s=Gn(E(o.Ga,o,u),wc(o,o.B)),o.B++,!0)}n.Ga=function(o){if(this.s)if(this.s=null,this.G==1){if(!o){this.U=Math.floor(1e5*Math.random()),o=this.U++;const w=new mt(this,this.j,o);let b=this.o;if(this.S&&(b?(b=g(b),T(b,this.S)):b=this.S),this.m!==null||this.O||(w.H=b,b=null),this.P)e:{for(var u=0,h=0;h<this.i.length;h++){t:{var p=this.i[h];if("__data__"in p.map&&(p=p.map.__data__,typeof p=="string")){p=p.length;break t}p=void 0}if(p===void 0)break;if(u+=p,4096<u){u=h;break e}if(u===4096||h===this.i.length-1){u=h+1;break e}}u=1e3}else u=1e3;u=Tc(this,w,u),h=et(this.I),ee(h,"RID",o),ee(h,"CVER",22),this.D&&ee(h,"X-HTTP-Session-Id",this.D),tr(this,h),b&&(this.O?u="headers="+encodeURIComponent(String(lc(b)))+"&"+u:this.m&&Mi(h,this.m,b)),Li(this.h,w),this.Ua&&ee(h,"TYPE","init"),this.P?(ee(h,"$req",u),ee(h,"SID","null"),w.T=!0,Ni(w,h,null)):Ni(w,h,u),this.G=2}}else this.G==3&&(o?yc(this,o):this.i.length==0||Ya(this.h)||yc(this))};function yc(o,u){var h;u?h=u.l:h=o.U++;const p=et(o.I);ee(p,"SID",o.K),ee(p,"RID",h),ee(p,"AID",o.T),tr(o,p),o.m&&o.o&&Mi(p,o.m,o.o),h=new mt(o,o.j,h,o.B+1),o.m===null&&(h.H=o.o),u&&(o.i=u.D.concat(o.i)),u=Tc(o,h,1e3),h.I=Math.round(.5*o.wa)+Math.round(.5*o.wa*Math.random()),Li(o.h,h),Ni(h,p,u)}function tr(o,u){o.H&&X(o.H,function(h,p){ee(u,p,h)}),o.l&&nc({},function(h,p){ee(u,p,h)})}function Tc(o,u,h){h=Math.min(o.i.length,h);var p=o.l?E(o.l.Na,o.l,o):null;e:{var w=o.i;let b=-1;for(;;){const D=["count="+h];b==-1?0<h?(b=w[0].g,D.push("ofs="+b)):b=0:D.push("ofs="+b);let J=!0;for(let de=0;de<h;de++){let K=w[de].g;const ye=w[de].map;if(K-=b,0>K)b=Math.max(0,w[de].g-100),J=!1;else try{Bf(ye,D,"req"+K+"_")}catch{p&&p(ye)}}if(J){p=D.join("&");break e}}}return o=o.i.splice(0,h),u.D=o,p}function Ec(o){if(!o.g&&!o.u){o.Y=1;var u=o.Fa;Bn||ka(),qn||(Bn(),qn=!0),_i.add(u,o),o.v=0}}function Ui(o){return o.g||o.u||3<=o.v?!1:(o.Y++,o.u=Gn(E(o.Fa,o),wc(o,o.v)),o.v++,!0)}n.Fa=function(){if(this.u=null,vc(this),this.ba&&!(this.M||this.g==null||0>=this.R)){var o=2*this.R;this.j.info("BP detection timer enabled: "+o),this.A=Gn(E(this.ab,this),o)}},n.ab=function(){this.A&&(this.A=null,this.j.info("BP detection timeout reached."),this.j.info("Buffering proxy detected and switch to long-polling!"),this.F=!1,this.M=!0,Re(10),Yr(this),vc(this))};function Fi(o){o.A!=null&&(c.clearTimeout(o.A),o.A=null)}function vc(o){o.g=new mt(o,o.j,"rpc",o.Y),o.m===null&&(o.g.H=o.o),o.g.O=0;var u=et(o.qa);ee(u,"RID","rpc"),ee(u,"SID",o.K),ee(u,"AID",o.T),ee(u,"CI",o.F?"0":"1"),!o.F&&o.ja&&ee(u,"TO",o.ja),ee(u,"TYPE","xmlhttp"),tr(o,u),o.m&&o.o&&Mi(u,o.m,o.o),o.L&&(o.g.I=o.L);var h=o.g;o=o.ia,h.L=1,h.v=Kr(et(u)),h.m=null,h.P=!0,Ka(h,o)}n.Za=function(){this.C!=null&&(this.C=null,Yr(this),Ui(this),Re(19))};function es(o){o.C!=null&&(c.clearTimeout(o.C),o.C=null)}function Ic(o,u){var h=null;if(o.g==u){es(o),Fi(o),o.g=null;var p=2}else if(Vi(o.h,u))h=u.D,ec(o.h,u),p=1;else return;if(o.G!=0){if(u.o)if(p==1){h=u.m?u.m.length:0,u=Date.now()-u.F;var w=o.B;p=$r(),Ae(p,new Ha(p,h)),Zr(o)}else Ec(o);else if(w=u.s,w==3||w==0&&0<u.X||!(p==1&&Hf(o,u)||p==2&&Ui(o)))switch(h&&0<h.length&&(u=o.h,u.i=u.i.concat(h)),w){case 1:jt(o,5);break;case 4:jt(o,10);break;case 3:jt(o,6);break;default:jt(o,2)}}}function wc(o,u){let h=o.Ta+Math.floor(Math.random()*o.cb);return o.isActive()||(h*=2),h*u}function jt(o,u){if(o.j.info("Error code "+u),u==2){var h=E(o.fb,o),p=o.Xa;const w=!p;p=new $t(p||"//www.google.com/images/cleardot.gif"),c.location&&c.location.protocol=="http"||Gr(p,"https"),Kr(p),w?xf(p.toString(),h):Uf(p.toString(),h)}else Re(2);o.G=0,o.l&&o.l.sa(u),Ac(o),_c(o)}n.fb=function(o){o?(this.j.info("Successfully pinged google.com"),Re(2)):(this.j.info("Failed to ping google.com"),Re(1))};function Ac(o){if(o.G=0,o.ka=[],o.l){const u=tc(o.h);(u.length!=0||o.i.length!=0)&&(k(o.ka,u),k(o.ka,o.i),o.h.i.length=0,N(o.i),o.i.length=0),o.l.ra()}}function Rc(o,u,h){var p=h instanceof $t?et(h):new $t(h);if(p.g!="")u&&(p.g=u+"."+p.g),Wr(p,p.s);else{var w=c.location;p=w.protocol,u=u?u+"."+w.hostname:w.hostname,w=+w.port;var b=new $t(null);p&&Gr(b,p),u&&(b.g=u),w&&Wr(b,w),h&&(b.l=h),p=b}return h=o.D,u=o.ya,h&&u&&ee(p,h,u),ee(p,"VER",o.la),tr(o,p),p}function bc(o,u,h){if(u&&!o.J)throw Error("Can't create secondary domain capable XhrIo object.");return u=o.Ca&&!o.pa?new se(new Qr({eb:h})):new se(o.pa),u.Ha(o.J),u}n.isActive=function(){return!!this.l&&this.l.isActive(this)};function Pc(){}n=Pc.prototype,n.ua=function(){},n.ta=function(){},n.sa=function(){},n.ra=function(){},n.isActive=function(){return!0},n.Na=function(){};function ts(){}ts.prototype.g=function(o,u){return new De(o,u)};function De(o,u){_e.call(this),this.g=new gc(u),this.l=o,this.h=u&&u.messageUrlParams||null,o=u&&u.messageHeaders||null,u&&u.clientProtocolHeaderRequired&&(o?o["X-Client-Protocol"]="webchannel":o={"X-Client-Protocol":"webchannel"}),this.g.o=o,o=u&&u.initMessageHeaders||null,u&&u.messageContentType&&(o?o["X-WebChannel-Content-Type"]=u.messageContentType:o={"X-WebChannel-Content-Type":u.messageContentType}),u&&u.va&&(o?o["X-WebChannel-Client-Profile"]=u.va:o={"X-WebChannel-Client-Profile":u.va}),this.g.S=o,(o=u&&u.Sb)&&!$(o)&&(this.g.m=o),this.v=u&&u.supportsCrossDomainXhr||!1,this.u=u&&u.sendRawJson||!1,(u=u&&u.httpSessionIdParam)&&!$(u)&&(this.g.D=u,o=this.h,o!==null&&u in o&&(o=this.h,u in o&&delete o[u])),this.j=new hn(this)}C(De,_e),De.prototype.m=function(){this.g.l=this.j,this.v&&(this.g.J=!0),this.g.connect(this.l,this.h||void 0)},De.prototype.close=function(){xi(this.g)},De.prototype.o=function(o){var u=this.g;if(typeof o=="string"){var h={};h.__data__=o,o=h}else this.u&&(h={},h.__data__=Ri(o),o=h);u.i.push(new Pf(u.Ya++,o)),u.G==3&&Zr(u)},De.prototype.N=function(){this.g.l=null,delete this.j,xi(this.g),delete this.g,De.aa.N.call(this)};function Sc(o){Pi.call(this),o.__headers__&&(this.headers=o.__headers__,this.statusCode=o.__status__,delete o.__headers__,delete o.__status__);var u=o.__sm__;if(u){e:{for(const h in u){o=h;break e}o=void 0}(this.i=o)&&(o=this.i,u=u!==null&&o in u?u[o]:void 0),this.data=u}else this.data=o}C(Sc,Pi);function Cc(){Si.call(this),this.status=1}C(Cc,Si);function hn(o){this.g=o}C(hn,Pc),hn.prototype.ua=function(){Ae(this.g,"a")},hn.prototype.ta=function(o){Ae(this.g,new Sc(o))},hn.prototype.sa=function(o){Ae(this.g,new Cc)},hn.prototype.ra=function(){Ae(this.g,"b")},ts.prototype.createWebChannel=ts.prototype.g,De.prototype.send=De.prototype.o,De.prototype.open=De.prototype.m,De.prototype.close=De.prototype.close,ah=function(){return new ts},oh=function(){return $r()},ih=Bt,io={mb:0,pb:1,qb:2,Jb:3,Ob:4,Lb:5,Mb:6,Kb:7,Ib:8,Nb:9,PROXY:10,NOPROXY:11,Gb:12,Cb:13,Db:14,Bb:15,Eb:16,Fb:17,ib:18,hb:19,jb:20},jr.NO_ERROR=0,jr.TIMEOUT=8,jr.HTTP_ERROR=6,ms=jr,za.COMPLETE="complete",sh=za,Ba.EventType=Hn,Hn.OPEN="a",Hn.CLOSE="b",Hn.ERROR="c",Hn.MESSAGE="d",_e.prototype.listen=_e.prototype.K,or=Ba,se.prototype.listenOnce=se.prototype.L,se.prototype.getLastError=se.prototype.Ka,se.prototype.getLastErrorCode=se.prototype.Ba,se.prototype.getStatus=se.prototype.Z,se.prototype.getResponseJson=se.prototype.Oa,se.prototype.getResponseText=se.prototype.oa,se.prototype.send=se.prototype.ea,se.prototype.setWithCredentials=se.prototype.Ha,rh=se}).apply(typeof ss<"u"?ss:typeof self<"u"?self:typeof window<"u"?window:{});const au="@firebase/firestore",cu="4.7.10";/**
1639
+ `+b+" "+D})}function hn(o,u,h,p){o.info(function(){return"XMLHTTP TEXT ("+u+"): "+Df(o,h)+(p?" "+p:"")})}function Nf(o,u){o.info(function(){return"TIMEOUT: "+u})}Qn.prototype.info=function(){};function Df(o,u){if(!o.g)return u;if(!u)return null;try{var h=JSON.parse(u);if(h){for(o=0;o<h.length;o++)if(Array.isArray(h[o])){var p=h[o];if(!(2>p.length)){var w=p[1];if(Array.isArray(w)&&!(1>w.length)){var b=w[0];if(b!="noop"&&b!="stop"&&b!="close")for(var D=1;D<w.length;D++)w[D]=""}}}}return Ci(h)}catch{return u}}var Gr={NO_ERROR:0,gb:1,tb:2,sb:3,nb:4,rb:5,ub:6,Ia:7,TIMEOUT:8,xb:9},Qa={lb:"complete",Hb:"success",Ja:"error",Ia:"abort",zb:"ready",Ab:"readystatechange",TIMEOUT:"timeout",vb:"incrementaldata",yb:"progress",ob:"downloadprogress",Pb:"uploadprogress"},Vi;function Wr(){}S(Wr,ki),Wr.prototype.g=function(){return new XMLHttpRequest},Wr.prototype.i=function(){return{}},Vi=new Wr;function mt(o,u,h,p){this.j=o,this.i=u,this.l=h,this.R=p||1,this.U=new Hn(this),this.I=45e3,this.H=null,this.o=!1,this.m=this.A=this.v=this.L=this.F=this.S=this.B=null,this.D=[],this.g=null,this.C=0,this.s=this.u=null,this.X=-1,this.J=!1,this.O=0,this.M=null,this.W=this.K=this.T=this.P=!1,this.h=new Xa}function Xa(){this.i=null,this.g="",this.h=!1}var Ya={},Oi={};function Li(o,u,h){o.L=1,o.v=Yr(et(u)),o.m=h,o.P=!0,Ja(o,null)}function Ja(o,u){o.F=Date.now(),Kr(o),o.A=et(o.v);var h=o.A,p=o.R;Array.isArray(p)||(p=[String(p)]),dc(h.i,"t",p),o.C=0,h=o.j.J,o.h=new Xa,o.g=kc(o.j,h?u:null,!o.m),0<o.O&&(o.M=new bf(_(o.Y,o,o.g),o.O)),u=o.U,h=o.g,p=o.ca;var w="readystatechange";Array.isArray(w)||(w&&(qa[0]=w.toString()),w=qa);for(var b=0;b<w.length;b++){var D=La(h,w[b],p||u.handleEvent,!1,u.h||u);if(!D)break;u.g[D.key]=D}u=o.H?g(o.H):{},o.m?(o.u||(o.u="POST"),u["Content-Type"]="application/x-www-form-urlencoded",o.g.ea(o.A,o.u,o.m,u)):(o.u="GET",o.g.ea(o.A,o.u,null,u)),Wn(),Cf(o.i,o.u,o.A,o.l,o.R,o.m)}mt.prototype.ca=function(o){o=o.target;const u=this.M;u&&tt(o)==3?u.j():this.Y(o)},mt.prototype.Y=function(o){try{if(o==this.g)e:{const Ee=tt(this.g);var u=this.g.Ba();const pn=this.g.Z();if(!(3>Ee)&&(Ee!=3||this.g&&(this.h.h||this.g.oa()||Ec(this.g)))){this.J||Ee!=4||u==7||(u==8||0>=pn?Wn(3):Wn(2)),xi(this);var h=this.g.Z();this.X=h;t:if(Za(this)){var p=Ec(this.g);o="";var w=p.length,b=tt(this.g)==4;if(!this.h.i){if(typeof TextDecoder>"u"){$t(this),Xn(this);var D="";break t}this.h.i=new c.TextDecoder}for(u=0;u<w;u++)this.h.h=!0,o+=this.h.i.decode(p[u],{stream:!(b&&u==w-1)});p.length=0,this.h.g+=o,this.C=0,D=this.h.g}else D=this.g.oa();if(this.o=h==200,kf(this.i,this.u,this.A,this.l,this.R,Ee,h),this.o){if(this.T&&!this.K){t:{if(this.g){var Y,de=this.g;if((Y=de.g?de.g.getResponseHeader("X-HTTP-Initial-Response"):null)&&!M(Y)){var K=Y;break t}}K=null}if(h=K)hn(this.i,this.l,h,"Initial handshake response via X-HTTP-Initial-Response"),this.K=!0,Mi(this,h);else{this.o=!1,this.s=3,Re(12),$t(this),Xn(this);break e}}if(this.P){h=!0;let Me;for(;!this.J&&this.C<D.length;)if(Me=Vf(this,D),Me==Oi){Ee==4&&(this.s=4,Re(14),h=!1),hn(this.i,this.l,null,"[Incomplete Response]");break}else if(Me==Ya){this.s=4,Re(15),hn(this.i,this.l,D,"[Invalid Chunk]"),h=!1;break}else hn(this.i,this.l,Me,null),Mi(this,Me);if(Za(this)&&this.C!=0&&(this.h.g=this.h.g.slice(this.C),this.C=0),Ee!=4||D.length!=0||this.h.h||(this.s=1,Re(16),h=!1),this.o=this.o&&h,!h)hn(this.i,this.l,D,"[Invalid Chunked Response]"),$t(this),Xn(this);else if(0<D.length&&!this.W){this.W=!0;var ye=this.j;ye.g==this&&ye.ba&&!ye.M&&(ye.j.info("Great, no buffering proxy detected. Bytes received: "+D.length),$i(ye),ye.M=!0,Re(11))}}else hn(this.i,this.l,D,null),Mi(this,D);Ee==4&&$t(this),this.o&&!this.J&&(Ee==4?bc(this.j,this):(this.o=!1,Kr(this)))}else Xf(this.g),h==400&&0<D.indexOf("Unknown SID")?(this.s=3,Re(12)):(this.s=0,Re(13)),$t(this),Xn(this)}}}catch{}finally{}};function Za(o){return o.g?o.u=="GET"&&o.L!=2&&o.j.Ca:!1}function Vf(o,u){var h=o.C,p=u.indexOf(`
1640
+ `,h);return p==-1?Oi:(h=Number(u.substring(h,p)),isNaN(h)?Ya:(p+=1,p+h>u.length?Oi:(u=u.slice(p,p+h),o.C=p+h,u)))}mt.prototype.cancel=function(){this.J=!0,$t(this)};function Kr(o){o.S=Date.now()+o.I,ec(o,o.I)}function ec(o,u){if(o.B!=null)throw Error("WatchDog timer not null");o.B=Kn(_(o.ba,o),u)}function xi(o){o.B&&(c.clearTimeout(o.B),o.B=null)}mt.prototype.ba=function(){this.B=null;const o=Date.now();0<=o-this.S?(Nf(this.i,this.A),this.L!=2&&(Wn(),Re(17)),$t(this),this.s=2,Xn(this)):ec(this,this.S-o)};function Xn(o){o.j.G==0||o.J||bc(o.j,o)}function $t(o){xi(o);var u=o.M;u&&typeof u.ma=="function"&&u.ma(),o.M=null,ja(o.U),o.g&&(u=o.g,o.g=null,u.abort(),u.ma())}function Mi(o,u){try{var h=o.j;if(h.G!=0&&(h.g==o||Ui(h.h,o))){if(!o.K&&Ui(h.h,o)&&h.G==3){try{var p=h.Da.g.parse(u)}catch{p=null}if(Array.isArray(p)&&p.length==3){var w=p;if(w[0]==0){e:if(!h.u){if(h.g)if(h.g.F+3e3<o.F)rs(h),ts(h);else break e;ji(h),Re(18)}}else h.za=w[1],0<h.za-h.T&&37500>w[2]&&h.F&&h.v==0&&!h.C&&(h.C=Kn(_(h.Za,h),6e3));if(1>=rc(h.h)&&h.ca){try{h.ca()}catch{}h.ca=void 0}}else Ht(h,11)}else if((o.K||h.g==o)&&rs(h),!M(u))for(w=h.Da.g.parse(u),u=0;u<w.length;u++){let K=w[u];if(h.T=K[0],K=K[1],h.G==2)if(K[0]=="c"){h.K=K[1],h.ia=K[2];const ye=K[3];ye!=null&&(h.la=ye,h.j.info("VER="+h.la));const Ee=K[4];Ee!=null&&(h.Aa=Ee,h.j.info("SVER="+h.Aa));const pn=K[5];pn!=null&&typeof pn=="number"&&0<pn&&(p=1.5*pn,h.L=p,h.j.info("backChannelRequestTimeoutMs_="+p)),p=h;const Me=o.g;if(Me){const is=Me.g?Me.g.getResponseHeader("X-Client-Wire-Protocol"):null;if(is){var b=p.h;b.g||is.indexOf("spdy")==-1&&is.indexOf("quic")==-1&&is.indexOf("h2")==-1||(b.j=b.l,b.g=new Set,b.h&&(Fi(b,b.h),b.h=null))}if(p.D){const zi=Me.g?Me.g.getResponseHeader("X-HTTP-Session-Id"):null;zi&&(p.ya=zi,ee(p.I,p.D,zi))}}h.G=3,h.l&&h.l.ua(),h.ba&&(h.R=Date.now()-o.F,h.j.info("Handshake RTT: "+h.R+"ms")),p=h;var D=o;if(p.qa=Cc(p,p.J?p.ia:null,p.W),D.K){sc(p.h,D);var Y=D,de=p.L;de&&(Y.I=de),Y.B&&(xi(Y),Kr(Y)),p.g=D}else Ac(p);0<h.i.length&&ns(h)}else K[0]!="stop"&&K[0]!="close"||Ht(h,7);else h.G==3&&(K[0]=="stop"||K[0]=="close"?K[0]=="stop"?Ht(h,7):qi(h):K[0]!="noop"&&h.l&&h.l.ta(K),h.v=0)}}Wn(4)}catch{}}var Of=class{constructor(o,u){this.g=o,this.map=u}};function tc(o){this.l=o||10,c.PerformanceNavigationTiming?(o=c.performance.getEntriesByType("navigation"),o=0<o.length&&(o[0].nextHopProtocol=="hq"||o[0].nextHopProtocol=="h2")):o=!!(c.chrome&&c.chrome.loadTimes&&c.chrome.loadTimes()&&c.chrome.loadTimes().wasFetchedViaSpdy),this.j=o?this.l:1,this.g=null,1<this.j&&(this.g=new Set),this.h=null,this.i=[]}function nc(o){return o.h?!0:o.g?o.g.size>=o.j:!1}function rc(o){return o.h?1:o.g?o.g.size:0}function Ui(o,u){return o.h?o.h==u:o.g?o.g.has(u):!1}function Fi(o,u){o.g?o.g.add(u):o.h=u}function sc(o,u){o.h&&o.h==u?o.h=null:o.g&&o.g.has(u)&&o.g.delete(u)}tc.prototype.cancel=function(){if(this.i=ic(this),this.h)this.h.cancel(),this.h=null;else if(this.g&&this.g.size!==0){for(const o of this.g.values())o.cancel();this.g.clear()}};function ic(o){if(o.h!=null)return o.i.concat(o.h.D);if(o.g!=null&&o.g.size!==0){let u=o.i;for(const h of o.g.values())u=u.concat(h.D);return u}return N(o.i)}function Lf(o){if(o.V&&typeof o.V=="function")return o.V();if(typeof Map<"u"&&o instanceof Map||typeof Set<"u"&&o instanceof Set)return Array.from(o.values());if(typeof o=="string")return o.split("");if(l(o)){for(var u=[],h=o.length,p=0;p<h;p++)u.push(o[p]);return u}u=[],h=0;for(p in o)u[h++]=o[p];return u}function xf(o){if(o.na&&typeof o.na=="function")return o.na();if(!o.V||typeof o.V!="function"){if(typeof Map<"u"&&o instanceof Map)return Array.from(o.keys());if(!(typeof Set<"u"&&o instanceof Set)){if(l(o)||typeof o=="string"){var u=[];o=o.length;for(var h=0;h<o;h++)u.push(h);return u}u=[],h=0;for(const p in o)u[h++]=p;return u}}}function oc(o,u){if(o.forEach&&typeof o.forEach=="function")o.forEach(u,void 0);else if(l(o)||typeof o=="string")Array.prototype.forEach.call(o,u,void 0);else for(var h=xf(o),p=Lf(o),w=p.length,b=0;b<w;b++)u.call(void 0,p[b],h&&h[b],o)}var ac=RegExp("^(?:([^:/?#.]+):)?(?://(?:([^\\\\/?#]*)@)?([^\\\\/?#]*?)(?::([0-9]+))?(?=[\\\\/?#]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#([\\s\\S]*))?$");function Mf(o,u){if(o){o=o.split("&");for(var h=0;h<o.length;h++){var p=o[h].indexOf("="),w=null;if(0<=p){var b=o[h].substring(0,p);w=o[h].substring(p+1)}else b=o[h];u(b,w?decodeURIComponent(w.replace(/\+/g," ")):"")}}}function zt(o){if(this.g=this.o=this.j="",this.s=null,this.m=this.l="",this.h=!1,o instanceof zt){this.h=o.h,Qr(this,o.j),this.o=o.o,this.g=o.g,Xr(this,o.s),this.l=o.l;var u=o.i,h=new Zn;h.i=u.i,u.g&&(h.g=new Map(u.g),h.h=u.h),cc(this,h),this.m=o.m}else o&&(u=String(o).match(ac))?(this.h=!1,Qr(this,u[1]||"",!0),this.o=Yn(u[2]||""),this.g=Yn(u[3]||"",!0),Xr(this,u[4]),this.l=Yn(u[5]||"",!0),cc(this,u[6]||"",!0),this.m=Yn(u[7]||"")):(this.h=!1,this.i=new Zn(null,this.h))}zt.prototype.toString=function(){var o=[],u=this.j;u&&o.push(Jn(u,uc,!0),":");var h=this.g;return(h||u=="file")&&(o.push("//"),(u=this.o)&&o.push(Jn(u,uc,!0),"@"),o.push(encodeURIComponent(String(h)).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),h=this.s,h!=null&&o.push(":",String(h))),(h=this.l)&&(this.g&&h.charAt(0)!="/"&&o.push("/"),o.push(Jn(h,h.charAt(0)=="/"?Bf:Ff,!0))),(h=this.i.toString())&&o.push("?",h),(h=this.m)&&o.push("#",Jn(h,jf)),o.join("")};function et(o){return new zt(o)}function Qr(o,u,h){o.j=h?Yn(u,!0):u,o.j&&(o.j=o.j.replace(/:$/,""))}function Xr(o,u){if(u){if(u=Number(u),isNaN(u)||0>u)throw Error("Bad port number "+u);o.s=u}else o.s=null}function cc(o,u,h){u instanceof Zn?(o.i=u,$f(o.i,o.h)):(h||(u=Jn(u,qf)),o.i=new Zn(u,o.h))}function ee(o,u,h){o.i.set(u,h)}function Yr(o){return ee(o,"zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^Date.now()).toString(36)),o}function Yn(o,u){return o?u?decodeURI(o.replace(/%25/g,"%2525")):decodeURIComponent(o):""}function Jn(o,u,h){return typeof o=="string"?(o=encodeURI(o).replace(u,Uf),h&&(o=o.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),o):null}function Uf(o){return o=o.charCodeAt(0),"%"+(o>>4&15).toString(16)+(o&15).toString(16)}var uc=/[#\/\?@]/g,Ff=/[#\?:]/g,Bf=/[#\?]/g,qf=/[#\?@]/g,jf=/#/g;function Zn(o,u){this.h=this.g=null,this.i=o||null,this.j=!!u}function gt(o){o.g||(o.g=new Map,o.h=0,o.i&&Mf(o.i,function(u,h){o.add(decodeURIComponent(u.replace(/\+/g," ")),h)}))}n=Zn.prototype,n.add=function(o,u){gt(this),this.i=null,o=dn(this,o);var h=this.g.get(o);return h||this.g.set(o,h=[]),h.push(u),this.h+=1,this};function lc(o,u){gt(o),u=dn(o,u),o.g.has(u)&&(o.i=null,o.h-=o.g.get(u).length,o.g.delete(u))}function hc(o,u){return gt(o),u=dn(o,u),o.g.has(u)}n.forEach=function(o,u){gt(this),this.g.forEach(function(h,p){h.forEach(function(w){o.call(u,w,p,this)},this)},this)},n.na=function(){gt(this);const o=Array.from(this.g.values()),u=Array.from(this.g.keys()),h=[];for(let p=0;p<u.length;p++){const w=o[p];for(let b=0;b<w.length;b++)h.push(u[p])}return h},n.V=function(o){gt(this);let u=[];if(typeof o=="string")hc(this,o)&&(u=u.concat(this.g.get(dn(this,o))));else{o=Array.from(this.g.values());for(let h=0;h<o.length;h++)u=u.concat(o[h])}return u},n.set=function(o,u){return gt(this),this.i=null,o=dn(this,o),hc(this,o)&&(this.h-=this.g.get(o).length),this.g.set(o,[u]),this.h+=1,this},n.get=function(o,u){return o?(o=this.V(o),0<o.length?String(o[0]):u):u};function dc(o,u,h){lc(o,u),0<h.length&&(o.i=null,o.g.set(dn(o,u),N(h)),o.h+=h.length)}n.toString=function(){if(this.i)return this.i;if(!this.g)return"";const o=[],u=Array.from(this.g.keys());for(var h=0;h<u.length;h++){var p=u[h];const b=encodeURIComponent(String(p)),D=this.V(p);for(p=0;p<D.length;p++){var w=b;D[p]!==""&&(w+="="+encodeURIComponent(String(D[p]))),o.push(w)}}return this.i=o.join("&")};function dn(o,u){return u=String(u),o.j&&(u=u.toLowerCase()),u}function $f(o,u){u&&!o.j&&(gt(o),o.i=null,o.g.forEach(function(h,p){var w=p.toLowerCase();p!=w&&(lc(this,p),dc(this,w,h))},o)),o.j=u}function zf(o,u){const h=new Qn;if(c.Image){const p=new Image;p.onload=R(_t,h,"TestLoadImage: loaded",!0,u,p),p.onerror=R(_t,h,"TestLoadImage: error",!1,u,p),p.onabort=R(_t,h,"TestLoadImage: abort",!1,u,p),p.ontimeout=R(_t,h,"TestLoadImage: timeout",!1,u,p),c.setTimeout(function(){p.ontimeout&&p.ontimeout()},1e4),p.src=o}else u(!1)}function Hf(o,u){const h=new Qn,p=new AbortController,w=setTimeout(()=>{p.abort(),_t(h,"TestPingServer: timeout",!1,u)},1e4);fetch(o,{signal:p.signal}).then(b=>{clearTimeout(w),b.ok?_t(h,"TestPingServer: ok",!0,u):_t(h,"TestPingServer: server error",!1,u)}).catch(()=>{clearTimeout(w),_t(h,"TestPingServer: error",!1,u)})}function _t(o,u,h,p,w){try{w&&(w.onload=null,w.onerror=null,w.onabort=null,w.ontimeout=null),p(h)}catch{}}function Gf(){this.g=new Sf}function Wf(o,u,h){const p=h||"";try{oc(o,function(w,b){let D=w;d(w)&&(D=Ci(w)),u.push(p+b+"="+encodeURIComponent(D))})}catch(w){throw u.push(p+"type="+encodeURIComponent("_badmap")),w}}function Jr(o){this.l=o.Ub||null,this.j=o.eb||!1}S(Jr,ki),Jr.prototype.g=function(){return new Zr(this.l,this.j)},Jr.prototype.i=function(o){return function(){return o}}({});function Zr(o,u){_e.call(this),this.D=o,this.o=u,this.m=void 0,this.status=this.readyState=0,this.responseType=this.responseText=this.response=this.statusText="",this.onreadystatechange=null,this.u=new Headers,this.h=null,this.B="GET",this.A="",this.g=!1,this.v=this.j=this.l=null}S(Zr,_e),n=Zr.prototype,n.open=function(o,u){if(this.readyState!=0)throw this.abort(),Error("Error reopening a connection");this.B=o,this.A=u,this.readyState=1,tr(this)},n.send=function(o){if(this.readyState!=1)throw this.abort(),Error("need to call open() first. ");this.g=!0;const u={headers:this.u,method:this.B,credentials:this.m,cache:void 0};o&&(u.body=o),(this.D||c).fetch(new Request(this.A,u)).then(this.Sa.bind(this),this.ga.bind(this))},n.abort=function(){this.response=this.responseText="",this.u=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=0},n.Sa=function(o){if(this.g&&(this.l=o,this.h||(this.status=this.l.status,this.statusText=this.l.statusText,this.h=o.headers,this.readyState=2,tr(this)),this.g&&(this.readyState=3,tr(this),this.g)))if(this.responseType==="arraybuffer")o.arrayBuffer().then(this.Qa.bind(this),this.ga.bind(this));else if(typeof c.ReadableStream<"u"&&"body"in o){if(this.j=o.body.getReader(),this.o){if(this.responseType)throw Error('responseType must be empty for "streamBinaryChunks" mode responses.');this.response=[]}else this.response=this.responseText="",this.v=new TextDecoder;fc(this)}else o.text().then(this.Ra.bind(this),this.ga.bind(this))};function fc(o){o.j.read().then(o.Pa.bind(o)).catch(o.ga.bind(o))}n.Pa=function(o){if(this.g){if(this.o&&o.value)this.response.push(o.value);else if(!this.o){var u=o.value?o.value:new Uint8Array(0);(u=this.v.decode(u,{stream:!o.done}))&&(this.response=this.responseText+=u)}o.done?er(this):tr(this),this.readyState==3&&fc(this)}},n.Ra=function(o){this.g&&(this.response=this.responseText=o,er(this))},n.Qa=function(o){this.g&&(this.response=o,er(this))},n.ga=function(){this.g&&er(this)};function er(o){o.readyState=4,o.l=null,o.j=null,o.v=null,tr(o)}n.setRequestHeader=function(o,u){this.u.append(o,u)},n.getResponseHeader=function(o){return this.h&&this.h.get(o.toLowerCase())||""},n.getAllResponseHeaders=function(){if(!this.h)return"";const o=[],u=this.h.entries();for(var h=u.next();!h.done;)h=h.value,o.push(h[0]+": "+h[1]),h=u.next();return o.join(`\r
1641
+ `)};function tr(o){o.onreadystatechange&&o.onreadystatechange.call(o)}Object.defineProperty(Zr.prototype,"withCredentials",{get:function(){return this.m==="include"},set:function(o){this.m=o?"include":"same-origin"}});function pc(o){let u="";return X(o,function(h,p){u+=p,u+=":",u+=h,u+=`\r
1642
+ `}),u}function Bi(o,u,h){e:{for(p in h){var p=!1;break e}p=!0}p||(h=pc(h),typeof o=="string"?h!=null&&encodeURIComponent(String(h)):ee(o,u,h))}function se(o){_e.call(this),this.headers=new Map,this.o=o||null,this.h=!1,this.v=this.g=null,this.D="",this.m=0,this.l="",this.j=this.B=this.u=this.A=!1,this.I=null,this.H="",this.J=!1}S(se,_e);var Kf=/^https?$/i,Qf=["POST","PUT"];n=se.prototype,n.Ha=function(o){this.J=o},n.ea=function(o,u,h,p){if(this.g)throw Error("[goog.net.XhrIo] Object is active with another request="+this.D+"; newUri="+o);u=u?u.toUpperCase():"GET",this.D=o,this.l="",this.m=0,this.A=!1,this.h=!0,this.g=this.o?this.o.g():Vi.g(),this.v=this.o?$a(this.o):$a(Vi),this.g.onreadystatechange=_(this.Ea,this);try{this.B=!0,this.g.open(u,String(o),!0),this.B=!1}catch(b){mc(this,b);return}if(o=h||"",h=new Map(this.headers),p)if(Object.getPrototypeOf(p)===Object.prototype)for(var w in p)h.set(w,p[w]);else if(typeof p.keys=="function"&&typeof p.get=="function")for(const b of p.keys())h.set(b,p.get(b));else throw Error("Unknown input type for opt_headers: "+String(p));p=Array.from(h.keys()).find(b=>b.toLowerCase()=="content-type"),w=c.FormData&&o instanceof c.FormData,!(0<=Array.prototype.indexOf.call(Qf,u,void 0))||p||w||h.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8");for(const[b,D]of h)this.g.setRequestHeader(b,D);this.H&&(this.g.responseType=this.H),"withCredentials"in this.g&&this.g.withCredentials!==this.J&&(this.g.withCredentials=this.J);try{yc(this),this.u=!0,this.g.send(o),this.u=!1}catch(b){mc(this,b)}};function mc(o,u){o.h=!1,o.g&&(o.j=!0,o.g.abort(),o.j=!1),o.l=u,o.m=5,gc(o),es(o)}function gc(o){o.A||(o.A=!0,Ae(o,"complete"),Ae(o,"error"))}n.abort=function(o){this.g&&this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1,this.m=o||7,Ae(this,"complete"),Ae(this,"abort"),es(this))},n.N=function(){this.g&&(this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1),es(this,!0)),se.aa.N.call(this)},n.Ea=function(){this.s||(this.B||this.u||this.j?_c(this):this.bb())},n.bb=function(){_c(this)};function _c(o){if(o.h&&typeof a<"u"&&(!o.v[1]||tt(o)!=4||o.Z()!=2)){if(o.u&&tt(o)==4)Fa(o.Ea,0,o);else if(Ae(o,"readystatechange"),tt(o)==4){o.h=!1;try{const D=o.Z();e:switch(D){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var u=!0;break e;default:u=!1}var h;if(!(h=u)){var p;if(p=D===0){var w=String(o.D).match(ac)[1]||null;!w&&c.self&&c.self.location&&(w=c.self.location.protocol.slice(0,-1)),p=!Kf.test(w?w.toLowerCase():"")}h=p}if(h)Ae(o,"complete"),Ae(o,"success");else{o.m=6;try{var b=2<tt(o)?o.g.statusText:""}catch{b=""}o.l=b+" ["+o.Z()+"]",gc(o)}}finally{es(o)}}}}function es(o,u){if(o.g){yc(o);const h=o.g,p=o.v[0]?()=>{}:null;o.g=null,o.v=null,u||Ae(o,"ready");try{h.onreadystatechange=p}catch{}}}function yc(o){o.I&&(c.clearTimeout(o.I),o.I=null)}n.isActive=function(){return!!this.g};function tt(o){return o.g?o.g.readyState:0}n.Z=function(){try{return 2<tt(this)?this.g.status:-1}catch{return-1}},n.oa=function(){try{return this.g?this.g.responseText:""}catch{return""}},n.Oa=function(o){if(this.g){var u=this.g.responseText;return o&&u.indexOf(o)==0&&(u=u.substring(o.length)),Pf(u)}};function Ec(o){try{if(!o.g)return null;if("response"in o.g)return o.g.response;switch(o.H){case"":case"text":return o.g.responseText;case"arraybuffer":if("mozResponseArrayBuffer"in o.g)return o.g.mozResponseArrayBuffer}return null}catch{return null}}function Xf(o){const u={};o=(o.g&&2<=tt(o)&&o.g.getAllResponseHeaders()||"").split(`\r
1643
+ `);for(let p=0;p<o.length;p++){if(M(o[p]))continue;var h=I(o[p]);const w=h[0];if(h=h[1],typeof h!="string")continue;h=h.trim();const b=u[w]||[];u[w]=b,b.push(h)}v(u,function(p){return p.join(", ")})}n.Ba=function(){return this.m},n.Ka=function(){return typeof this.l=="string"?this.l:String(this.l)};function nr(o,u,h){return h&&h.internalChannelParams&&h.internalChannelParams[o]||u}function Tc(o){this.Aa=0,this.i=[],this.j=new Qn,this.ia=this.qa=this.I=this.W=this.g=this.ya=this.D=this.H=this.m=this.S=this.o=null,this.Ya=this.U=0,this.Va=nr("failFast",!1,o),this.F=this.C=this.u=this.s=this.l=null,this.X=!0,this.za=this.T=-1,this.Y=this.v=this.B=0,this.Ta=nr("baseRetryDelayMs",5e3,o),this.cb=nr("retryDelaySeedMs",1e4,o),this.Wa=nr("forwardChannelMaxRetries",2,o),this.wa=nr("forwardChannelRequestTimeoutMs",2e4,o),this.pa=o&&o.xmlHttpFactory||void 0,this.Xa=o&&o.Tb||void 0,this.Ca=o&&o.useFetchStreams||!1,this.L=void 0,this.J=o&&o.supportsCrossDomainXhr||!1,this.K="",this.h=new tc(o&&o.concurrentRequestLimit),this.Da=new Gf,this.P=o&&o.fastHandshake||!1,this.O=o&&o.encodeInitMessageHeaders||!1,this.P&&this.O&&(this.O=!1),this.Ua=o&&o.Rb||!1,o&&o.xa&&this.j.xa(),o&&o.forceLongPolling&&(this.X=!1),this.ba=!this.P&&this.X&&o&&o.detectBufferingProxy||!1,this.ja=void 0,o&&o.longPollingTimeout&&0<o.longPollingTimeout&&(this.ja=o.longPollingTimeout),this.ca=void 0,this.R=0,this.M=!1,this.ka=this.A=null}n=Tc.prototype,n.la=8,n.G=1,n.connect=function(o,u,h,p){Re(0),this.W=o,this.H=u||{},h&&p!==void 0&&(this.H.OSID=h,this.H.OAID=p),this.F=this.X,this.I=Cc(this,null,this.W),ns(this)};function qi(o){if(vc(o),o.G==3){var u=o.U++,h=et(o.I);if(ee(h,"SID",o.K),ee(h,"RID",u),ee(h,"TYPE","terminate"),rr(o,h),u=new mt(o,o.j,u),u.L=2,u.v=Yr(et(h)),h=!1,c.navigator&&c.navigator.sendBeacon)try{h=c.navigator.sendBeacon(u.v.toString(),"")}catch{}!h&&c.Image&&(new Image().src=u.v,h=!0),h||(u.g=kc(u.j,null),u.g.ea(u.v)),u.F=Date.now(),Kr(u)}Sc(o)}function ts(o){o.g&&($i(o),o.g.cancel(),o.g=null)}function vc(o){ts(o),o.u&&(c.clearTimeout(o.u),o.u=null),rs(o),o.h.cancel(),o.s&&(typeof o.s=="number"&&c.clearTimeout(o.s),o.s=null)}function ns(o){if(!nc(o.h)&&!o.s){o.s=!0;var u=o.Ga;jn||Oa(),$n||(jn(),$n=!0),vi.add(u,o),o.B=0}}function Yf(o,u){return rc(o.h)>=o.h.j-(o.s?1:0)?!1:o.s?(o.i=u.D.concat(o.i),!0):o.G==1||o.G==2||o.B>=(o.Va?0:o.Wa)?!1:(o.s=Kn(_(o.Ga,o,u),Pc(o,o.B)),o.B++,!0)}n.Ga=function(o){if(this.s)if(this.s=null,this.G==1){if(!o){this.U=Math.floor(1e5*Math.random()),o=this.U++;const w=new mt(this,this.j,o);let b=this.o;if(this.S&&(b?(b=g(b),T(b,this.S)):b=this.S),this.m!==null||this.O||(w.H=b,b=null),this.P)e:{for(var u=0,h=0;h<this.i.length;h++){t:{var p=this.i[h];if("__data__"in p.map&&(p=p.map.__data__,typeof p=="string")){p=p.length;break t}p=void 0}if(p===void 0)break;if(u+=p,4096<u){u=h;break e}if(u===4096||h===this.i.length-1){u=h+1;break e}}u=1e3}else u=1e3;u=wc(this,w,u),h=et(this.I),ee(h,"RID",o),ee(h,"CVER",22),this.D&&ee(h,"X-HTTP-Session-Id",this.D),rr(this,h),b&&(this.O?u="headers="+encodeURIComponent(String(pc(b)))+"&"+u:this.m&&Bi(h,this.m,b)),Fi(this.h,w),this.Ua&&ee(h,"TYPE","init"),this.P?(ee(h,"$req",u),ee(h,"SID","null"),w.T=!0,Li(w,h,null)):Li(w,h,u),this.G=2}}else this.G==3&&(o?Ic(this,o):this.i.length==0||nc(this.h)||Ic(this))};function Ic(o,u){var h;u?h=u.l:h=o.U++;const p=et(o.I);ee(p,"SID",o.K),ee(p,"RID",h),ee(p,"AID",o.T),rr(o,p),o.m&&o.o&&Bi(p,o.m,o.o),h=new mt(o,o.j,h,o.B+1),o.m===null&&(h.H=o.o),u&&(o.i=u.D.concat(o.i)),u=wc(o,h,1e3),h.I=Math.round(.5*o.wa)+Math.round(.5*o.wa*Math.random()),Fi(o.h,h),Li(h,p,u)}function rr(o,u){o.H&&X(o.H,function(h,p){ee(u,p,h)}),o.l&&oc({},function(h,p){ee(u,p,h)})}function wc(o,u,h){h=Math.min(o.i.length,h);var p=o.l?_(o.l.Na,o.l,o):null;e:{var w=o.i;let b=-1;for(;;){const D=["count="+h];b==-1?0<h?(b=w[0].g,D.push("ofs="+b)):b=0:D.push("ofs="+b);let Y=!0;for(let de=0;de<h;de++){let K=w[de].g;const ye=w[de].map;if(K-=b,0>K)b=Math.max(0,w[de].g-100),Y=!1;else try{Wf(ye,D,"req"+K+"_")}catch{p&&p(ye)}}if(Y){p=D.join("&");break e}}}return o=o.i.splice(0,h),u.D=o,p}function Ac(o){if(!o.g&&!o.u){o.Y=1;var u=o.Fa;jn||Oa(),$n||(jn(),$n=!0),vi.add(u,o),o.v=0}}function ji(o){return o.g||o.u||3<=o.v?!1:(o.Y++,o.u=Kn(_(o.Fa,o),Pc(o,o.v)),o.v++,!0)}n.Fa=function(){if(this.u=null,Rc(this),this.ba&&!(this.M||this.g==null||0>=this.R)){var o=2*this.R;this.j.info("BP detection timer enabled: "+o),this.A=Kn(_(this.ab,this),o)}},n.ab=function(){this.A&&(this.A=null,this.j.info("BP detection timeout reached."),this.j.info("Buffering proxy detected and switch to long-polling!"),this.F=!1,this.M=!0,Re(10),ts(this),Rc(this))};function $i(o){o.A!=null&&(c.clearTimeout(o.A),o.A=null)}function Rc(o){o.g=new mt(o,o.j,"rpc",o.Y),o.m===null&&(o.g.H=o.o),o.g.O=0;var u=et(o.qa);ee(u,"RID","rpc"),ee(u,"SID",o.K),ee(u,"AID",o.T),ee(u,"CI",o.F?"0":"1"),!o.F&&o.ja&&ee(u,"TO",o.ja),ee(u,"TYPE","xmlhttp"),rr(o,u),o.m&&o.o&&Bi(u,o.m,o.o),o.L&&(o.g.I=o.L);var h=o.g;o=o.ia,h.L=1,h.v=Yr(et(u)),h.m=null,h.P=!0,Ja(h,o)}n.Za=function(){this.C!=null&&(this.C=null,ts(this),ji(this),Re(19))};function rs(o){o.C!=null&&(c.clearTimeout(o.C),o.C=null)}function bc(o,u){var h=null;if(o.g==u){rs(o),$i(o),o.g=null;var p=2}else if(Ui(o.h,u))h=u.D,sc(o.h,u),p=1;else return;if(o.G!=0){if(u.o)if(p==1){h=u.m?u.m.length:0,u=Date.now()-u.F;var w=o.B;p=Hr(),Ae(p,new Ka(p,h)),ns(o)}else Ac(o);else if(w=u.s,w==3||w==0&&0<u.X||!(p==1&&Yf(o,u)||p==2&&ji(o)))switch(h&&0<h.length&&(u=o.h,u.i=u.i.concat(h)),w){case 1:Ht(o,5);break;case 4:Ht(o,10);break;case 3:Ht(o,6);break;default:Ht(o,2)}}}function Pc(o,u){let h=o.Ta+Math.floor(Math.random()*o.cb);return o.isActive()||(h*=2),h*u}function Ht(o,u){if(o.j.info("Error code "+u),u==2){var h=_(o.fb,o),p=o.Xa;const w=!p;p=new zt(p||"//www.google.com/images/cleardot.gif"),c.location&&c.location.protocol=="http"||Qr(p,"https"),Yr(p),w?zf(p.toString(),h):Hf(p.toString(),h)}else Re(2);o.G=0,o.l&&o.l.sa(u),Sc(o),vc(o)}n.fb=function(o){o?(this.j.info("Successfully pinged google.com"),Re(2)):(this.j.info("Failed to ping google.com"),Re(1))};function Sc(o){if(o.G=0,o.ka=[],o.l){const u=ic(o.h);(u.length!=0||o.i.length!=0)&&(k(o.ka,u),k(o.ka,o.i),o.h.i.length=0,N(o.i),o.i.length=0),o.l.ra()}}function Cc(o,u,h){var p=h instanceof zt?et(h):new zt(h);if(p.g!="")u&&(p.g=u+"."+p.g),Xr(p,p.s);else{var w=c.location;p=w.protocol,u=u?u+"."+w.hostname:w.hostname,w=+w.port;var b=new zt(null);p&&Qr(b,p),u&&(b.g=u),w&&Xr(b,w),h&&(b.l=h),p=b}return h=o.D,u=o.ya,h&&u&&ee(p,h,u),ee(p,"VER",o.la),rr(o,p),p}function kc(o,u,h){if(u&&!o.J)throw Error("Can't create secondary domain capable XhrIo object.");return u=o.Ca&&!o.pa?new se(new Jr({eb:h})):new se(o.pa),u.Ha(o.J),u}n.isActive=function(){return!!this.l&&this.l.isActive(this)};function Nc(){}n=Nc.prototype,n.ua=function(){},n.ta=function(){},n.sa=function(){},n.ra=function(){},n.isActive=function(){return!0},n.Na=function(){};function ss(){}ss.prototype.g=function(o,u){return new De(o,u)};function De(o,u){_e.call(this),this.g=new Tc(u),this.l=o,this.h=u&&u.messageUrlParams||null,o=u&&u.messageHeaders||null,u&&u.clientProtocolHeaderRequired&&(o?o["X-Client-Protocol"]="webchannel":o={"X-Client-Protocol":"webchannel"}),this.g.o=o,o=u&&u.initMessageHeaders||null,u&&u.messageContentType&&(o?o["X-WebChannel-Content-Type"]=u.messageContentType:o={"X-WebChannel-Content-Type":u.messageContentType}),u&&u.va&&(o?o["X-WebChannel-Client-Profile"]=u.va:o={"X-WebChannel-Client-Profile":u.va}),this.g.S=o,(o=u&&u.Sb)&&!M(o)&&(this.g.m=o),this.v=u&&u.supportsCrossDomainXhr||!1,this.u=u&&u.sendRawJson||!1,(u=u&&u.httpSessionIdParam)&&!M(u)&&(this.g.D=u,o=this.h,o!==null&&u in o&&(o=this.h,u in o&&delete o[u])),this.j=new fn(this)}S(De,_e),De.prototype.m=function(){this.g.l=this.j,this.v&&(this.g.J=!0),this.g.connect(this.l,this.h||void 0)},De.prototype.close=function(){qi(this.g)},De.prototype.o=function(o){var u=this.g;if(typeof o=="string"){var h={};h.__data__=o,o=h}else this.u&&(h={},h.__data__=Ci(o),o=h);u.i.push(new Of(u.Ya++,o)),u.G==3&&ns(u)},De.prototype.N=function(){this.g.l=null,delete this.j,qi(this.g),delete this.g,De.aa.N.call(this)};function Dc(o){Ni.call(this),o.__headers__&&(this.headers=o.__headers__,this.statusCode=o.__status__,delete o.__headers__,delete o.__status__);var u=o.__sm__;if(u){e:{for(const h in u){o=h;break e}o=void 0}(this.i=o)&&(o=this.i,u=u!==null&&o in u?u[o]:void 0),this.data=u}else this.data=o}S(Dc,Ni);function Vc(){Di.call(this),this.status=1}S(Vc,Di);function fn(o){this.g=o}S(fn,Nc),fn.prototype.ua=function(){Ae(this.g,"a")},fn.prototype.ta=function(o){Ae(this.g,new Dc(o))},fn.prototype.sa=function(o){Ae(this.g,new Vc)},fn.prototype.ra=function(){Ae(this.g,"b")},ss.prototype.createWebChannel=ss.prototype.g,De.prototype.send=De.prototype.o,De.prototype.open=De.prototype.m,De.prototype.close=De.prototype.close,fh=function(){return new ss},dh=function(){return Hr()},hh=jt,uo={mb:0,pb:1,qb:2,Jb:3,Ob:4,Lb:5,Mb:6,Kb:7,Ib:8,Nb:9,PROXY:10,NOPROXY:11,Gb:12,Cb:13,Db:14,Bb:15,Eb:16,Fb:17,ib:18,hb:19,jb:20},Gr.NO_ERROR=0,Gr.TIMEOUT=8,Gr.HTTP_ERROR=6,ys=Gr,Qa.COMPLETE="complete",lh=Qa,za.EventType=Gn,Gn.OPEN="a",Gn.CLOSE="b",Gn.ERROR="c",Gn.MESSAGE="d",_e.prototype.listen=_e.prototype.K,cr=za,se.prototype.listenOnce=se.prototype.L,se.prototype.getLastError=se.prototype.Ka,se.prototype.getLastErrorCode=se.prototype.Ba,se.prototype.getStatus=se.prototype.Z,se.prototype.getResponseJson=se.prototype.Oa,se.prototype.getResponseText=se.prototype.oa,se.prototype.send=se.prototype.ea,se.prototype.setWithCredentials=se.prototype.Ha,uh=se}).apply(typeof as<"u"?as:typeof self<"u"?self:typeof window<"u"?window:{});const du="@firebase/firestore",fu="4.7.15";/**
1615
1644
  * @license
1616
1645
  * Copyright 2017 Google LLC
1617
1646
  *
@@ -1641,7 +1670,7 @@ SPDX-License-Identifier: Apache-2.0
1641
1670
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1642
1671
  * See the License for the specific language governing permissions and
1643
1672
  * limitations under the License.
1644
- */let Vn="11.5.0";/**
1673
+ */let xn="11.8.0";/**
1645
1674
  * @license
1646
1675
  * Copyright 2017 Google LLC
1647
1676
  *
@@ -1656,7 +1685,7 @@ SPDX-License-Identifier: Apache-2.0
1656
1685
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1657
1686
  * See the License for the specific language governing permissions and
1658
1687
  * limitations under the License.
1659
- */const Yt=new Ro("@firebase/firestore");function pn(){return Yt.logLevel}function V(n,...e){if(Yt.logLevel<=z.DEBUG){const t=e.map(xo);Yt.debug(`Firestore (${Vn}): ${n}`,...t)}}function dt(n,...e){if(Yt.logLevel<=z.ERROR){const t=e.map(xo);Yt.error(`Firestore (${Vn}): ${n}`,...t)}}function Rn(n,...e){if(Yt.logLevel<=z.WARN){const t=e.map(xo);Yt.warn(`Firestore (${Vn}): ${n}`,...t)}}function xo(n){if(typeof n=="string")return n;try{/**
1688
+ */const en=new Co("@firebase/firestore");function gn(){return en.logLevel}function O(n,...e){if(en.logLevel<=H.DEBUG){const t=e.map(qo);en.debug(`Firestore (${xn}): ${n}`,...t)}}function dt(n,...e){if(en.logLevel<=H.ERROR){const t=e.map(qo);en.error(`Firestore (${xn}): ${n}`,...t)}}function Pn(n,...e){if(en.logLevel<=H.WARN){const t=e.map(qo);en.warn(`Firestore (${xn}): ${n}`,...t)}}function qo(n){if(typeof n=="string")return n;try{/**
1660
1689
  * @license
1661
1690
  * Copyright 2020 Google LLC
1662
1691
  *
@@ -1686,7 +1715,7 @@ SPDX-License-Identifier: Apache-2.0
1686
1715
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1687
1716
  * See the License for the specific language governing permissions and
1688
1717
  * limitations under the License.
1689
- */function U(n="Unexpected state"){const e=`FIRESTORE (${Vn}) INTERNAL ASSERTION FAILED: `+n;throw dt(e),new Error(e)}function Q(n,e){n||U()}function q(n,e){return n}/**
1718
+ */function F(n,e,t){let r="Unexpected state";typeof e=="string"?r=e:t=e,ph(n,r,t)}function ph(n,e,t){let r=`FIRESTORE (${xn}) INTERNAL ASSERTION FAILED: ${e} (ID: ${n.toString(16)})`;if(t!==void 0)try{r+=" CONTEXT: "+JSON.stringify(t)}catch{r+=" CONTEXT: "+t}throw dt(r),new Error(r)}function Q(n,e,t,r){let s="Unexpected state";typeof t=="string"?s=t:r=t,n||ph(e,s,r)}function j(n,e){return n}/**
1690
1719
  * @license
1691
1720
  * Copyright 2017 Google LLC
1692
1721
  *
@@ -1701,7 +1730,7 @@ SPDX-License-Identifier: Apache-2.0
1701
1730
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1702
1731
  * See the License for the specific language governing permissions and
1703
1732
  * limitations under the License.
1704
- */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 O extends He{constructor(e,t){super(e,t),this.code=e,this.message=t,this.toString=()=>`${this.name}: [code=${this.code}]: ${this.message}`}}/**
1733
+ */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 V extends ze{constructor(e,t){super(e,t),this.code=e,this.message=t,this.toString=()=>`${this.name}: [code=${this.code}]: ${this.message}`}}/**
1705
1734
  * @license
1706
1735
  * Copyright 2017 Google LLC
1707
1736
  *
@@ -1731,7 +1760,7 @@ SPDX-License-Identifier: Apache-2.0
1731
1760
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1732
1761
  * See the License for the specific language governing permissions and
1733
1762
  * limitations under the License.
1734
- */class ch{constructor(e,t){this.user=t,this.type="OAuth",this.headers=new Map,this.headers.set("Authorization",`Bearer ${e}`)}}class ty{getToken(){return Promise.resolve(null)}invalidateToken(){}start(e,t){e.enqueueRetryable(()=>t(ve.UNAUTHENTICATED))}shutdown(){}}class ny{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 ry{constructor(e){this.t=e,this.currentUser=ve.UNAUTHENTICATED,this.i=0,this.forceRefresh=!1,this.auth=null}start(e,t){Q(this.o===void 0);let r=this.i;const s=l=>this.i!==r?(r=this.i,t(l)):Promise.resolve();let i=new at;this.o=()=>{this.i++,this.currentUser=this.u(),i.resolve(),i=new at,e.enqueueRetryable(()=>s(this.currentUser))};const a=()=>{const l=i;e.enqueueRetryable(async()=>{await l.promise,await s(this.currentUser)})},c=l=>{V("FirebaseAuthCredentialsProvider","Auth detected"),this.auth=l,this.o&&(this.auth.addAuthTokenListener(this.o),a())};this.t.onInit(l=>c(l)),setTimeout(()=>{if(!this.auth){const l=this.t.getImmediate({optional:!0});l?c(l):(V("FirebaseAuthCredentialsProvider","Auth not yet detected"),i.resolve(),i=new at)}},0),a()}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?(Q(typeof r.accessToken=="string"),new ch(r.accessToken,this.currentUser)):null):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.auth&&this.o&&this.auth.removeAuthTokenListener(this.o),this.o=void 0}u(){const e=this.auth&&this.auth.getUid();return Q(e===null||typeof e=="string"),new ve(e)}}class sy{constructor(e,t,r){this.l=e,this.h=t,this.P=r,this.type="FirstParty",this.user=ve.FIRST_PARTY,this.T=new Map}I(){return this.P?this.P():null}get headers(){this.T.set("X-Goog-AuthUser",this.l);const e=this.I();return e&&this.T.set("Authorization",e),this.h&&this.T.set("X-Goog-Iam-Authorization-Token",this.h),this.T}}class iy{constructor(e,t,r){this.l=e,this.h=t,this.P=r}getToken(){return Promise.resolve(new sy(this.l,this.h,this.P))}start(e,t){e.enqueueRetryable(()=>t(ve.FIRST_PARTY))}shutdown(){}invalidateToken(){}}class uu{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 oy{constructor(e,t){this.A=t,this.forceRefresh=!1,this.appCheck=null,this.R=null,this.V=null,Pe(e)&&e.settings.appCheckToken&&(this.V=e.settings.appCheckToken)}start(e,t){Q(this.o===void 0);const r=i=>{i.error!=null&&V("FirebaseAppCheckTokenProvider",`Error getting App Check token; using placeholder token instead. Error: ${i.error.message}`);const a=i.token!==this.R;return this.R=i.token,V("FirebaseAppCheckTokenProvider",`Received ${a?"new":"existing"} token.`),a?t(i.token):Promise.resolve()};this.o=i=>{e.enqueueRetryable(()=>r(i))};const s=i=>{V("FirebaseAppCheckTokenProvider","AppCheck detected"),this.appCheck=i,this.o&&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(){if(this.V)return Promise.resolve(new uu(this.V));const e=this.forceRefresh;return this.forceRefresh=!1,this.appCheck?this.appCheck.getToken(e).then(t=>t?(Q(typeof t.token=="string"),this.R=t.token,new uu(t.token)):null):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.appCheck&&this.o&&this.appCheck.removeTokenListener(this.o),this.o=void 0}}/**
1763
+ */class mh{constructor(e,t){this.user=t,this.type="OAuth",this.headers=new Map,this.headers.set("Authorization",`Bearer ${e}`)}}class ly{getToken(){return Promise.resolve(null)}invalidateToken(){}start(e,t){e.enqueueRetryable(()=>t(ve.UNAUTHENTICATED))}shutdown(){}}class hy{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 dy{constructor(e){this.t=e,this.currentUser=ve.UNAUTHENTICATED,this.i=0,this.forceRefresh=!1,this.auth=null}start(e,t){Q(this.o===void 0,42304);let r=this.i;const s=l=>this.i!==r?(r=this.i,t(l)):Promise.resolve();let i=new at;this.o=()=>{this.i++,this.currentUser=this.u(),i.resolve(),i=new at,e.enqueueRetryable(()=>s(this.currentUser))};const a=()=>{const l=i;e.enqueueRetryable(async()=>{await l.promise,await s(this.currentUser)})},c=l=>{O("FirebaseAuthCredentialsProvider","Auth detected"),this.auth=l,this.o&&(this.auth.addAuthTokenListener(this.o),a())};this.t.onInit(l=>c(l)),setTimeout(()=>{if(!this.auth){const l=this.t.getImmediate({optional:!0});l?c(l):(O("FirebaseAuthCredentialsProvider","Auth not yet detected"),i.resolve(),i=new at)}},0),a()}getToken(){const e=this.i,t=this.forceRefresh;return this.forceRefresh=!1,this.auth?this.auth.getToken(t).then(r=>this.i!==e?(O("FirebaseAuthCredentialsProvider","getToken aborted due to token change."),this.getToken()):r?(Q(typeof r.accessToken=="string",31837,{l:r}),new mh(r.accessToken,this.currentUser)):null):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.auth&&this.o&&this.auth.removeAuthTokenListener(this.o),this.o=void 0}u(){const e=this.auth&&this.auth.getUid();return Q(e===null||typeof e=="string",2055,{h:e}),new ve(e)}}class fy{constructor(e,t,r){this.P=e,this.T=t,this.I=r,this.type="FirstParty",this.user=ve.FIRST_PARTY,this.A=new Map}R(){return this.I?this.I():null}get headers(){this.A.set("X-Goog-AuthUser",this.P);const e=this.R();return e&&this.A.set("Authorization",e),this.T&&this.A.set("X-Goog-Iam-Authorization-Token",this.T),this.A}}class py{constructor(e,t,r){this.P=e,this.T=t,this.I=r}getToken(){return Promise.resolve(new fy(this.P,this.T,this.I))}start(e,t){e.enqueueRetryable(()=>t(ve.FIRST_PARTY))}shutdown(){}invalidateToken(){}}class pu{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 my{constructor(e,t){this.V=t,this.forceRefresh=!1,this.appCheck=null,this.m=null,this.p=null,Pe(e)&&e.settings.appCheckToken&&(this.p=e.settings.appCheckToken)}start(e,t){Q(this.o===void 0,3512);const r=i=>{i.error!=null&&O("FirebaseAppCheckTokenProvider",`Error getting App Check token; using placeholder token instead. Error: ${i.error.message}`);const a=i.token!==this.m;return this.m=i.token,O("FirebaseAppCheckTokenProvider",`Received ${a?"new":"existing"} token.`),a?t(i.token):Promise.resolve()};this.o=i=>{e.enqueueRetryable(()=>r(i))};const s=i=>{O("FirebaseAppCheckTokenProvider","AppCheck detected"),this.appCheck=i,this.o&&this.appCheck.addTokenListener(this.o)};this.V.onInit(i=>s(i)),setTimeout(()=>{if(!this.appCheck){const i=this.V.getImmediate({optional:!0});i?s(i):O("FirebaseAppCheckTokenProvider","AppCheck not yet detected")}},0)}getToken(){if(this.p)return Promise.resolve(new pu(this.p));const e=this.forceRefresh;return this.forceRefresh=!1,this.appCheck?this.appCheck.getToken(e).then(t=>t?(Q(typeof t.token=="string",44558,{tokenResult:t}),this.m=t.token,new pu(t.token)):null):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.appCheck&&this.o&&this.appCheck.removeTokenListener(this.o),this.o=void 0}}/**
1735
1764
  * @license
1736
1765
  * Copyright 2020 Google LLC
1737
1766
  *
@@ -1746,7 +1775,7 @@ SPDX-License-Identifier: Apache-2.0
1746
1775
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1747
1776
  * See the License for the specific language governing permissions and
1748
1777
  * limitations under the License.
1749
- */function ay(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}/**
1778
+ */function gy(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}/**
1750
1779
  * @license
1751
1780
  * Copyright 2023 Google LLC
1752
1781
  *
@@ -1761,7 +1790,7 @@ SPDX-License-Identifier: Apache-2.0
1761
1790
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1762
1791
  * See the License for the specific language governing permissions and
1763
1792
  * limitations under the License.
1764
- */function uh(){return new TextEncoder}/**
1793
+ */function gh(){return new TextEncoder}/**
1765
1794
  * @license
1766
1795
  * Copyright 2017 Google LLC
1767
1796
  *
@@ -1776,7 +1805,7 @@ SPDX-License-Identifier: Apache-2.0
1776
1805
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1777
1806
  * See the License for the specific language governing permissions and
1778
1807
  * limitations under the License.
1779
- */class lh{static newId(){const e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",t=62*Math.floor(4.129032258064516);let r="";for(;r.length<20;){const s=ay(40);for(let i=0;i<s.length;++i)r.length<20&&s[i]<t&&(r+=e.charAt(s[i]%62))}return r}}function H(n,e){return n<e?-1:n>e?1:0}function oo(n,e){let t=0;for(;t<n.length&&t<e.length;){const r=n.codePointAt(t),s=e.codePointAt(t);if(r!==s){if(r<128&&s<128)return H(r,s);{const i=uh(),a=cy(i.encode(lu(n,t)),i.encode(lu(e,t)));return a!==0?a:H(r,s)}}t+=r>65535?2:1}return H(n.length,e.length)}function lu(n,e){return n.codePointAt(e)>65535?n.substring(e,e+2):n.substring(e,e+1)}function cy(n,e){for(let t=0;t<n.length&&t<e.length;++t)if(n[t]!==e[t])return H(n[t],e[t]);return H(n.length,e.length)}function bn(n,e,t){return n.length===e.length&&n.every((r,s)=>t(r,e[s]))}/**
1808
+ */class _h{static newId(){const e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",t=62*Math.floor(4.129032258064516);let r="";for(;r.length<20;){const s=gy(40);for(let i=0;i<s.length;++i)r.length<20&&s[i]<t&&(r+=e.charAt(s[i]%62))}return r}}function z(n,e){return n<e?-1:n>e?1:0}function lo(n,e){let t=0;for(;t<n.length&&t<e.length;){const r=n.codePointAt(t),s=e.codePointAt(t);if(r!==s){if(r<128&&s<128)return z(r,s);{const i=gh(),a=_y(i.encode(mu(n,t)),i.encode(mu(e,t)));return a!==0?a:z(r,s)}}t+=r>65535?2:1}return z(n.length,e.length)}function mu(n,e){return n.codePointAt(e)>65535?n.substring(e,e+2):n.substring(e,e+1)}function _y(n,e){for(let t=0;t<n.length&&t<e.length;++t)if(n[t]!==e[t])return z(n[t],e[t]);return z(n.length,e.length)}function Sn(n,e,t){return n.length===e.length&&n.every((r,s)=>t(r,e[s]))}/**
1780
1809
  * @license
1781
1810
  * Copyright 2017 Google LLC
1782
1811
  *
@@ -1791,7 +1820,7 @@ SPDX-License-Identifier: Apache-2.0
1791
1820
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1792
1821
  * See the License for the specific language governing permissions and
1793
1822
  * limitations under the License.
1794
- */const hu=-62135596800,du=1e6;class ue{static now(){return ue.fromMillis(Date.now())}static fromDate(e){return ue.fromMillis(e.getTime())}static fromMillis(e){const t=Math.floor(e/1e3),r=Math.floor((e-1e3*t)*du);return new ue(t,r)}constructor(e,t){if(this.seconds=e,this.nanoseconds=t,t<0)throw new O(P.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+t);if(t>=1e9)throw new O(P.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+t);if(e<hu)throw new O(P.INVALID_ARGUMENT,"Timestamp seconds out of range: "+e);if(e>=253402300800)throw new O(P.INVALID_ARGUMENT,"Timestamp seconds out of range: "+e)}toDate(){return new Date(this.toMillis())}toMillis(){return 1e3*this.seconds+this.nanoseconds/du}_compareTo(e){return this.seconds===e.seconds?H(this.nanoseconds,e.nanoseconds):H(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-hu;return String(e).padStart(12,"0")+"."+String(this.nanoseconds).padStart(9,"0")}}/**
1823
+ */const gu=-62135596800,_u=1e6;class ue{static now(){return ue.fromMillis(Date.now())}static fromDate(e){return ue.fromMillis(e.getTime())}static fromMillis(e){const t=Math.floor(e/1e3),r=Math.floor((e-1e3*t)*_u);return new ue(t,r)}constructor(e,t){if(this.seconds=e,this.nanoseconds=t,t<0)throw new V(P.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+t);if(t>=1e9)throw new V(P.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+t);if(e<gu)throw new V(P.INVALID_ARGUMENT,"Timestamp seconds out of range: "+e);if(e>=253402300800)throw new V(P.INVALID_ARGUMENT,"Timestamp seconds out of range: "+e)}toDate(){return new Date(this.toMillis())}toMillis(){return 1e3*this.seconds+this.nanoseconds/_u}_compareTo(e){return this.seconds===e.seconds?z(this.nanoseconds,e.nanoseconds):z(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-gu;return String(e).padStart(12,"0")+"."+String(this.nanoseconds).padStart(9,"0")}}/**
1795
1824
  * @license
1796
1825
  * Copyright 2017 Google LLC
1797
1826
  *
@@ -1806,7 +1835,7 @@ SPDX-License-Identifier: Apache-2.0
1806
1835
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1807
1836
  * See the License for the specific language governing permissions and
1808
1837
  * limitations under the License.
1809
- */class B{static fromTimestamp(e){return new B(e)}static min(){return new B(new ue(0,0))}static max(){return new B(new ue(253402300799,999999999))}constructor(e){this.timestamp=e}compareTo(e){return this.timestamp._compareTo(e.timestamp)}isEqual(e){return this.timestamp.isEqual(e.timestamp)}toMicroseconds(){return 1e6*this.timestamp.seconds+this.timestamp.nanoseconds/1e3}toString(){return"SnapshotVersion("+this.timestamp.toString()+")"}toTimestamp(){return this.timestamp}}/**
1838
+ */class q{static fromTimestamp(e){return new q(e)}static min(){return new q(new ue(0,0))}static max(){return new q(new ue(253402300799,999999999))}constructor(e){this.timestamp=e}compareTo(e){return this.timestamp._compareTo(e.timestamp)}isEqual(e){return this.timestamp.isEqual(e.timestamp)}toMicroseconds(){return 1e6*this.timestamp.seconds+this.timestamp.nanoseconds/1e3}toString(){return"SnapshotVersion("+this.timestamp.toString()+")"}toTimestamp(){return this.timestamp}}/**
1810
1839
  * @license
1811
1840
  * Copyright 2017 Google LLC
1812
1841
  *
@@ -1821,7 +1850,7 @@ SPDX-License-Identifier: Apache-2.0
1821
1850
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1822
1851
  * See the License for the specific language governing permissions and
1823
1852
  * limitations under the License.
1824
- */const fu="__name__";class Ge{constructor(e,t,r){t===void 0?t=0:t>e.length&&U(),r===void 0?r=e.length-t:r>e.length-t&&U(),this.segments=e,this.offset=t,this.len=r}get length(){return this.len}isEqual(e){return Ge.comparator(this,e)===0}child(e){const t=this.segments.slice(this.offset,this.limit());return e instanceof Ge?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=Ge.compareSegments(e.get(s),t.get(s));if(i!==0)return i}return H(e.length,t.length)}static compareSegments(e,t){const r=Ge.isNumericId(e),s=Ge.isNumericId(t);return r&&!s?-1:!r&&s?1:r&&s?Ge.extractNumericId(e).compare(Ge.extractNumericId(t)):oo(e,t)}static isNumericId(e){return e.startsWith("__id")&&e.endsWith("__")}static extractNumericId(e){return bt.fromString(e.substring(4,e.length-2))}}class Y extends Ge{construct(e,t,r){return new Y(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 O(P.INVALID_ARGUMENT,`Invalid segment (${r}). Paths must not contain // in them.`);t.push(...r.split("/").filter(s=>s.length>0))}return new Y(t)}static emptyPath(){return new Y([])}}const uy=/^[_a-zA-Z][_a-zA-Z0-9]*$/;class pe extends Ge{construct(e,t,r){return new pe(e,t,r)}static isValidIdentifier(e){return uy.test(e)}canonicalString(){return this.toArray().map(e=>(e=e.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),pe.isValidIdentifier(e)||(e="`"+e+"`"),e)).join(".")}toString(){return this.canonicalString()}isKeyField(){return this.length===1&&this.get(0)===fu}static keyField(){return new pe([fu])}static fromServerFormat(e){const t=[];let r="",s=0;const i=()=>{if(r.length===0)throw new O(P.INVALID_ARGUMENT,`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`);t.push(r),r=""};let a=!1;for(;s<e.length;){const c=e[s];if(c==="\\"){if(s+1===e.length)throw new O(P.INVALID_ARGUMENT,"Path has trailing escape character: "+e);const l=e[s+1];if(l!=="\\"&&l!=="."&&l!=="`")throw new O(P.INVALID_ARGUMENT,"Path has invalid escape sequence: "+e);r+=l,s+=2}else c==="`"?(a=!a,s++):c!=="."||a?(r+=c,s++):(i(),s++)}if(i(),a)throw new O(P.INVALID_ARGUMENT,"Unterminated ` in path: "+e);return new pe(t)}static emptyPath(){return new pe([])}}/**
1853
+ */const yu="__name__";class Ge{constructor(e,t,r){t===void 0?t=0:t>e.length&&F(637,{offset:t,range:e.length}),r===void 0?r=e.length-t:r>e.length-t&&F(1746,{length:r,range:e.length-t}),this.segments=e,this.offset=t,this.len=r}get length(){return this.len}isEqual(e){return Ge.comparator(this,e)===0}child(e){const t=this.segments.slice(this.offset,this.limit());return e instanceof Ge?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=Ge.compareSegments(e.get(s),t.get(s));if(i!==0)return i}return z(e.length,t.length)}static compareSegments(e,t){const r=Ge.isNumericId(e),s=Ge.isNumericId(t);return r&&!s?-1:!r&&s?1:r&&s?Ge.extractNumericId(e).compare(Ge.extractNumericId(t)):lo(e,t)}static isNumericId(e){return e.startsWith("__id")&&e.endsWith("__")}static extractNumericId(e){return bt.fromString(e.substring(4,e.length-2))}}class J extends Ge{construct(e,t,r){return new J(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 V(P.INVALID_ARGUMENT,`Invalid segment (${r}). Paths must not contain // in them.`);t.push(...r.split("/").filter(s=>s.length>0))}return new J(t)}static emptyPath(){return new J([])}}const yy=/^[_a-zA-Z][_a-zA-Z0-9]*$/;class pe extends Ge{construct(e,t,r){return new pe(e,t,r)}static isValidIdentifier(e){return yy.test(e)}canonicalString(){return this.toArray().map(e=>(e=e.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),pe.isValidIdentifier(e)||(e="`"+e+"`"),e)).join(".")}toString(){return this.canonicalString()}isKeyField(){return this.length===1&&this.get(0)===yu}static keyField(){return new pe([yu])}static fromServerFormat(e){const t=[];let r="",s=0;const i=()=>{if(r.length===0)throw new V(P.INVALID_ARGUMENT,`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`);t.push(r),r=""};let a=!1;for(;s<e.length;){const c=e[s];if(c==="\\"){if(s+1===e.length)throw new V(P.INVALID_ARGUMENT,"Path has trailing escape character: "+e);const l=e[s+1];if(l!=="\\"&&l!=="."&&l!=="`")throw new V(P.INVALID_ARGUMENT,"Path has invalid escape sequence: "+e);r+=l,s+=2}else c==="`"?(a=!a,s++):c!=="."||a?(r+=c,s++):(i(),s++)}if(i(),a)throw new V(P.INVALID_ARGUMENT,"Unterminated ` in path: "+e);return new pe(t)}static emptyPath(){return new pe([])}}/**
1825
1854
  * @license
1826
1855
  * Copyright 2017 Google LLC
1827
1856
  *
@@ -1836,7 +1865,7 @@ SPDX-License-Identifier: Apache-2.0
1836
1865
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1837
1866
  * See the License for the specific language governing permissions and
1838
1867
  * limitations under the License.
1839
- */class L{constructor(e){this.path=e}static fromPath(e){return new L(Y.fromString(e))}static fromName(e){return new L(Y.fromString(e).popFirst(5))}static empty(){return new L(Y.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&&Y.comparator(this.path,e.path)===0}toString(){return this.path.toString()}static comparator(e,t){return Y.comparator(e.path,t.path)}static isDocumentKey(e){return e.length%2==0}static fromSegments(e){return new L(new Y(e.slice()))}}/**
1868
+ */class L{constructor(e){this.path=e}static fromPath(e){return new L(J.fromString(e))}static fromName(e){return new L(J.fromString(e).popFirst(5))}static empty(){return new L(J.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&&J.comparator(this.path,e.path)===0}toString(){return this.path.toString()}static comparator(e,t){return J.comparator(e.path,t.path)}static isDocumentKey(e){return e.length%2==0}static fromSegments(e){return new L(new J(e.slice()))}}/**
1840
1869
  * @license
1841
1870
  * Copyright 2021 Google LLC
1842
1871
  *
@@ -1851,7 +1880,7 @@ SPDX-License-Identifier: Apache-2.0
1851
1880
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1852
1881
  * See the License for the specific language governing permissions and
1853
1882
  * limitations under the License.
1854
- */const yr=-1;function ly(n,e){const t=n.toTimestamp().seconds,r=n.toTimestamp().nanoseconds+1,s=B.fromTimestamp(r===1e9?new ue(t+1,0):new ue(t,r));return new Ct(s,L.empty(),e)}function hy(n){return new Ct(n.readTime,n.key,yr)}class Ct{constructor(e,t,r){this.readTime=e,this.documentKey=t,this.largestBatchId=r}static min(){return new Ct(B.min(),L.empty(),yr)}static max(){return new Ct(B.max(),L.empty(),yr)}}function dy(n,e){let t=n.readTime.compareTo(e.readTime);return t!==0?t:(t=L.comparator(n.documentKey,e.documentKey),t!==0?t:H(n.largestBatchId,e.largestBatchId))}/**
1883
+ */const vr=-1;function Ey(n,e){const t=n.toTimestamp().seconds,r=n.toTimestamp().nanoseconds+1,s=q.fromTimestamp(r===1e9?new ue(t+1,0):new ue(t,r));return new Ct(s,L.empty(),e)}function Ty(n){return new Ct(n.readTime,n.key,vr)}class Ct{constructor(e,t,r){this.readTime=e,this.documentKey=t,this.largestBatchId=r}static min(){return new Ct(q.min(),L.empty(),vr)}static max(){return new Ct(q.max(),L.empty(),vr)}}function vy(n,e){let t=n.readTime.compareTo(e.readTime);return t!==0?t:(t=L.comparator(n.documentKey,e.documentKey),t!==0?t:z(n.largestBatchId,e.largestBatchId))}/**
1855
1884
  * @license
1856
1885
  * Copyright 2020 Google LLC
1857
1886
  *
@@ -1866,7 +1895,7 @@ SPDX-License-Identifier: Apache-2.0
1866
1895
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1867
1896
  * See the License for the specific language governing permissions and
1868
1897
  * limitations under the License.
1869
- */const fy="The current tab is not in the required state to perform this operation. It might be necessary to refresh the browser tab.";class py{constructor(){this.onCommittedListeners=[]}addOnCommittedListener(e){this.onCommittedListeners.push(e)}raiseOnCommittedEvent(){this.onCommittedListeners.forEach(e=>e())}}/**
1898
+ */const Iy="The current tab is not in the required state to perform this operation. It might be necessary to refresh the browser tab.";class wy{constructor(){this.onCommittedListeners=[]}addOnCommittedListener(e){this.onCommittedListeners.push(e)}raiseOnCommittedEvent(){this.onCommittedListeners.forEach(e=>e())}}/**
1870
1899
  * @license
1871
1900
  * Copyright 2017 Google LLC
1872
1901
  *
@@ -1881,7 +1910,7 @@ SPDX-License-Identifier: Apache-2.0
1881
1910
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1882
1911
  * See the License for the specific language governing permissions and
1883
1912
  * limitations under the License.
1884
- */async function Ln(n){if(n.code!==P.FAILED_PRECONDITION||n.message!==fy)throw n;V("LocalStore","Unexpectedly lost primary lease")}/**
1913
+ */async function Mn(n){if(n.code!==P.FAILED_PRECONDITION||n.message!==Iy)throw n;O("LocalStore","Unexpectedly lost primary lease")}/**
1885
1914
  * @license
1886
1915
  * Copyright 2017 Google LLC
1887
1916
  *
@@ -1896,7 +1925,7 @@ SPDX-License-Identifier: Apache-2.0
1896
1925
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1897
1926
  * See the License for the specific language governing permissions and
1898
1927
  * limitations under the License.
1899
- */class S{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&&U(),this.callbackAttached=!0,this.isDone?this.error?this.wrapFailure(t,this.error):this.wrapSuccess(e,this.result):new S((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 S?t:S.resolve(t)}catch(t){return S.reject(t)}}wrapSuccess(e,t){return e?this.wrapUserFunction(()=>e(t)):S.resolve(t)}wrapFailure(e,t){return e?this.wrapUserFunction(()=>e(t)):S.reject(t)}static resolve(e){return new S((t,r)=>{t(e)})}static reject(e){return new S((t,r)=>{r(e)})}static waitFor(e){return new S((t,r)=>{let s=0,i=0,a=!1;e.forEach(c=>{++s,c.next(()=>{++i,a&&i===s&&t()},l=>r(l))}),a=!0,i===s&&t()})}static or(e){let t=S.resolve(!1);for(const r of e)t=t.next(s=>s?S.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 S((r,s)=>{const i=e.length,a=new Array(i);let c=0;for(let l=0;l<i;l++){const d=l;t(e[d]).next(f=>{a[d]=f,++c,c===i&&r(a)},f=>s(f))}})}static doWhile(e,t){return new S((r,s)=>{const i=()=>{e()===!0?t().next(()=>{i()},s):r()};i()})}}function my(n){const e=n.match(/Android ([\d.]+)/i),t=e?e[1].split(".").slice(0,2).join("."):"-1";return Number(t)}function Mn(n){return n.name==="IndexedDbTransactionError"}/**
1928
+ */class C{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&&F(59440),this.callbackAttached=!0,this.isDone?this.error?this.wrapFailure(t,this.error):this.wrapSuccess(e,this.result):new C((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 C?t:C.resolve(t)}catch(t){return C.reject(t)}}wrapSuccess(e,t){return e?this.wrapUserFunction(()=>e(t)):C.resolve(t)}wrapFailure(e,t){return e?this.wrapUserFunction(()=>e(t)):C.reject(t)}static resolve(e){return new C((t,r)=>{t(e)})}static reject(e){return new C((t,r)=>{r(e)})}static waitFor(e){return new C((t,r)=>{let s=0,i=0,a=!1;e.forEach(c=>{++s,c.next(()=>{++i,a&&i===s&&t()},l=>r(l))}),a=!0,i===s&&t()})}static or(e){let t=C.resolve(!1);for(const r of e)t=t.next(s=>s?C.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 C((r,s)=>{const i=e.length,a=new Array(i);let c=0;for(let l=0;l<i;l++){const d=l;t(e[d]).next(f=>{a[d]=f,++c,c===i&&r(a)},f=>s(f))}})}static doWhile(e,t){return new C((r,s)=>{const i=()=>{e()===!0?t().next(()=>{i()},s):r()};i()})}}function Ay(n){const e=n.match(/Android ([\d.]+)/i),t=e?e[1].split(".").slice(0,2).join("."):"-1";return Number(t)}function Un(n){return n.name==="IndexedDbTransactionError"}/**
1900
1929
  * @license
1901
1930
  * Copyright 2018 Google LLC
1902
1931
  *
@@ -1911,7 +1940,7 @@ SPDX-License-Identifier: Apache-2.0
1911
1940
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1912
1941
  * See the License for the specific language governing permissions and
1913
1942
  * limitations under the License.
1914
- */class Xs{constructor(e,t){this.previousValue=e,t&&(t.sequenceNumberHandler=r=>this.oe(r),this._e=r=>t.writeSequenceNumber(r))}oe(e){return this.previousValue=Math.max(e,this.previousValue),this.previousValue}next(){const e=++this.previousValue;return this._e&&this._e(e),e}}Xs.ae=-1;/**
1943
+ */class ei{constructor(e,t){this.previousValue=e,t&&(t.sequenceNumberHandler=r=>this.ue(r),this.ce=r=>t.writeSequenceNumber(r))}ue(e){return this.previousValue=Math.max(e,this.previousValue),this.previousValue}next(){const e=++this.previousValue;return this.ce&&this.ce(e),e}}ei.le=-1;/**
1915
1944
  * @license
1916
1945
  * Copyright 2017 Google LLC
1917
1946
  *
@@ -1926,7 +1955,7 @@ SPDX-License-Identifier: Apache-2.0
1926
1955
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1927
1956
  * See the License for the specific language governing permissions and
1928
1957
  * limitations under the License.
1929
- */const Uo=-1;function Js(n){return n==null}function Ns(n){return n===0&&1/n==-1/0}function gy(n){return typeof n=="number"&&Number.isInteger(n)&&!Ns(n)&&n<=Number.MAX_SAFE_INTEGER&&n>=Number.MIN_SAFE_INTEGER}/**
1958
+ */const jo=-1;function ti(n){return n==null}function Os(n){return n===0&&1/n==-1/0}function Ry(n){return typeof n=="number"&&Number.isInteger(n)&&!Os(n)&&n<=Number.MAX_SAFE_INTEGER&&n>=Number.MIN_SAFE_INTEGER}/**
1930
1959
  * @license
1931
1960
  * Copyright 2017 Google LLC
1932
1961
  *
@@ -1941,7 +1970,7 @@ SPDX-License-Identifier: Apache-2.0
1941
1970
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1942
1971
  * See the License for the specific language governing permissions and
1943
1972
  * limitations under the License.
1944
- */const hh="";function _y(n){let e="";for(let t=0;t<n.length;t++)e.length>0&&(e=pu(e)),e=yy(n.get(t),e);return pu(e)}function yy(n,e){let t=e;const r=n.length;for(let s=0;s<r;s++){const i=n.charAt(s);switch(i){case"\0":t+="";break;case hh:t+="";break;default:t+=i}}return t}function pu(n){return n+hh+""}/**
1973
+ */const yh="";function by(n){let e="";for(let t=0;t<n.length;t++)e.length>0&&(e=Eu(e)),e=Py(n.get(t),e);return Eu(e)}function Py(n,e){let t=e;const r=n.length;for(let s=0;s<r;s++){const i=n.charAt(s);switch(i){case"\0":t+="";break;case yh:t+="";break;default:t+=i}}return t}function Eu(n){return n+yh+""}/**
1945
1974
  * @license
1946
1975
  * Copyright 2017 Google LLC
1947
1976
  *
@@ -1956,7 +1985,7 @@ SPDX-License-Identifier: Apache-2.0
1956
1985
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1957
1986
  * See the License for the specific language governing permissions and
1958
1987
  * limitations under the License.
1959
- */function mu(n){let e=0;for(const t in n)Object.prototype.hasOwnProperty.call(n,t)&&e++;return e}function rn(n,e){for(const t in n)Object.prototype.hasOwnProperty.call(n,t)&&e(t,n[t])}function dh(n){for(const e in n)if(Object.prototype.hasOwnProperty.call(n,e))return!1;return!0}/**
1988
+ */function Tu(n){let e=0;for(const t in n)Object.prototype.hasOwnProperty.call(n,t)&&e++;return e}function on(n,e){for(const t in n)Object.prototype.hasOwnProperty.call(n,t)&&e(t,n[t])}function Eh(n){for(const e in n)if(Object.prototype.hasOwnProperty.call(n,e))return!1;return!0}/**
1960
1989
  * @license
1961
1990
  * Copyright 2017 Google LLC
1962
1991
  *
@@ -1971,7 +2000,7 @@ SPDX-License-Identifier: Apache-2.0
1971
2000
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1972
2001
  * See the License for the specific language governing permissions and
1973
2002
  * limitations under the License.
1974
- */class ne{constructor(e,t){this.comparator=e,this.root=t||fe.EMPTY}insert(e,t){return new ne(this.comparator,this.root.insert(e,t,this.comparator).copy(null,null,fe.BLACK,null,null))}remove(e){return new ne(this.comparator,this.root.remove(e,this.comparator).copy(null,null,fe.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 is(this.root,null,this.comparator,!1)}getIteratorFrom(e){return new is(this.root,e,this.comparator,!1)}getReverseIterator(){return new is(this.root,null,this.comparator,!0)}getReverseIteratorFrom(e){return new is(this.root,e,this.comparator,!0)}}class is{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 fe{constructor(e,t,r,s,i){this.key=e,this.value=t,this.color=r??fe.RED,this.left=s??fe.EMPTY,this.right=i??fe.EMPTY,this.size=this.left.size+1+this.right.size}copy(e,t,r,s,i){return new fe(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 fe.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 fe.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,fe.RED,null,this.right.left);return this.right.copy(null,null,this.color,e,null)}rotateRight(){const e=this.copy(null,null,fe.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 U();const e=this.left.check();if(e!==this.right.check())throw U();return e+(this.isRed()?0:1)}}fe.EMPTY=null,fe.RED=!0,fe.BLACK=!1;fe.EMPTY=new class{constructor(){this.size=0}get key(){throw U()}get value(){throw U()}get color(){throw U()}get left(){throw U()}get right(){throw U()}copy(e,t,r,s,i){return this}insert(e,t,r){return new fe(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}};/**
2003
+ */class ne{constructor(e,t){this.comparator=e,this.root=t||fe.EMPTY}insert(e,t){return new ne(this.comparator,this.root.insert(e,t,this.comparator).copy(null,null,fe.BLACK,null,null))}remove(e){return new ne(this.comparator,this.root.remove(e,this.comparator).copy(null,null,fe.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 cs(this.root,null,this.comparator,!1)}getIteratorFrom(e){return new cs(this.root,e,this.comparator,!1)}getReverseIterator(){return new cs(this.root,null,this.comparator,!0)}getReverseIteratorFrom(e){return new cs(this.root,e,this.comparator,!0)}}class cs{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 fe{constructor(e,t,r,s,i){this.key=e,this.value=t,this.color=r??fe.RED,this.left=s??fe.EMPTY,this.right=i??fe.EMPTY,this.size=this.left.size+1+this.right.size}copy(e,t,r,s,i){return new fe(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 fe.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 fe.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,fe.RED,null,this.right.left);return this.right.copy(null,null,this.color,e,null)}rotateRight(){const e=this.copy(null,null,fe.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())throw F(43730,{key:this.key,value:this.value});if(this.right.isRed())throw F(14113,{key:this.key,value:this.value});const e=this.left.check();if(e!==this.right.check())throw F(27949);return e+(this.isRed()?0:1)}}fe.EMPTY=null,fe.RED=!0,fe.BLACK=!1;fe.EMPTY=new class{constructor(){this.size=0}get key(){throw F(57766)}get value(){throw F(16141)}get color(){throw F(16727)}get left(){throw F(29726)}get right(){throw F(36894)}copy(e,t,r,s,i){return this}insert(e,t,r){return new fe(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}};/**
1975
2004
  * @license
1976
2005
  * Copyright 2017 Google LLC
1977
2006
  *
@@ -1986,7 +2015,7 @@ SPDX-License-Identifier: Apache-2.0
1986
2015
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1987
2016
  * See the License for the specific language governing permissions and
1988
2017
  * limitations under the License.
1989
- */class le{constructor(e){this.comparator=e,this.data=new ne(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 gu(this.data.getIterator())}getIteratorFrom(e){return new gu(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 le)||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 le(this.comparator);return t.data=e,t}}class gu{constructor(e){this.iter=e}getNext(){return this.iter.getNext().key}hasNext(){return this.iter.hasNext()}}/**
2018
+ */class le{constructor(e){this.comparator=e,this.data=new ne(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 vu(this.data.getIterator())}getIteratorFrom(e){return new vu(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 le)||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 le(this.comparator);return t.data=e,t}}class vu{constructor(e){this.iter=e}getNext(){return this.iter.getNext().key}hasNext(){return this.iter.hasNext()}}/**
1990
2019
  * @license
1991
2020
  * Copyright 2020 Google LLC
1992
2021
  *
@@ -2001,7 +2030,7 @@ SPDX-License-Identifier: Apache-2.0
2001
2030
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2002
2031
  * See the License for the specific language governing permissions and
2003
2032
  * limitations under the License.
2004
- */class Be{constructor(e){this.fields=e,e.sort(pe.comparator)}static empty(){return new Be([])}unionWith(e){let t=new le(pe.comparator);for(const r of this.fields)t=t.add(r);for(const r of e)t=t.add(r);return new Be(t.toArray())}covers(e){for(const t of this.fields)if(t.isPrefixOf(e))return!0;return!1}isEqual(e){return bn(this.fields,e.fields,(t,r)=>t.isEqual(r))}}/**
2033
+ */class Be{constructor(e){this.fields=e,e.sort(pe.comparator)}static empty(){return new Be([])}unionWith(e){let t=new le(pe.comparator);for(const r of this.fields)t=t.add(r);for(const r of e)t=t.add(r);return new Be(t.toArray())}covers(e){for(const t of this.fields)if(t.isPrefixOf(e))return!0;return!1}isEqual(e){return Sn(this.fields,e.fields,(t,r)=>t.isEqual(r))}}/**
2005
2034
  * @license
2006
2035
  * Copyright 2023 Google LLC
2007
2036
  *
@@ -2016,7 +2045,7 @@ SPDX-License-Identifier: Apache-2.0
2016
2045
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2017
2046
  * See the License for the specific language governing permissions and
2018
2047
  * limitations under the License.
2019
- */class fh extends Error{constructor(){super(...arguments),this.name="Base64DecodeError"}}/**
2048
+ */class Th extends Error{constructor(){super(...arguments),this.name="Base64DecodeError"}}/**
2020
2049
  * @license
2021
2050
  * Copyright 2020 Google LLC
2022
2051
  *
@@ -2031,7 +2060,7 @@ SPDX-License-Identifier: Apache-2.0
2031
2060
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2032
2061
  * See the License for the specific language governing permissions and
2033
2062
  * limitations under the License.
2034
- */class me{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 fh("Invalid base64 string: "+i):i}}(e);return new me(t)}static fromUint8Array(e){const t=function(s){let i="";for(let a=0;a<s.length;++a)i+=String.fromCharCode(s[a]);return i}(e);return new me(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 H(this.binaryString,e.binaryString)}isEqual(e){return this.binaryString===e.binaryString}}me.EMPTY_BYTE_STRING=new me("");const Ty=new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);function kt(n){if(Q(!!n),typeof n=="string"){let e=0;const t=Ty.exec(n);if(Q(!!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:ie(n.seconds),nanos:ie(n.nanos)}}function ie(n){return typeof n=="number"?n:typeof n=="string"?Number(n):0}function Nt(n){return typeof n=="string"?me.fromBase64String(n):me.fromUint8Array(n)}/**
2063
+ */class me{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 Th("Invalid base64 string: "+i):i}}(e);return new me(t)}static fromUint8Array(e){const t=function(s){let i="";for(let a=0;a<s.length;++a)i+=String.fromCharCode(s[a]);return i}(e);return new me(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 z(this.binaryString,e.binaryString)}isEqual(e){return this.binaryString===e.binaryString}}me.EMPTY_BYTE_STRING=new me("");const Sy=new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);function kt(n){if(Q(!!n,39018),typeof n=="string"){let e=0;const t=Sy.exec(n);if(Q(!!t,46558,{timestamp:n}),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:ie(n.seconds),nanos:ie(n.nanos)}}function ie(n){return typeof n=="number"?n:typeof n=="string"?Number(n):0}function Nt(n){return typeof n=="string"?me.fromBase64String(n):me.fromUint8Array(n)}/**
2035
2064
  * @license
2036
2065
  * Copyright 2020 Google LLC
2037
2066
  *
@@ -2046,7 +2075,7 @@ SPDX-License-Identifier: Apache-2.0
2046
2075
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2047
2076
  * See the License for the specific language governing permissions and
2048
2077
  * limitations under the License.
2049
- */const ph="server_timestamp",mh="__type__",gh="__previous_value__",_h="__local_write_time__";function Ys(n){var e,t;return((t=(((e=n==null?void 0:n.mapValue)===null||e===void 0?void 0:e.fields)||{})[mh])===null||t===void 0?void 0:t.stringValue)===ph}function Zs(n){const e=n.mapValue.fields[gh];return Ys(e)?Zs(e):e}function Tr(n){const e=kt(n.mapValue.fields[_h].timestampValue);return new ue(e.seconds,e.nanos)}/**
2078
+ */const vh="server_timestamp",Ih="__type__",wh="__previous_value__",Ah="__local_write_time__";function ni(n){var e,t;return((t=(((e=n==null?void 0:n.mapValue)===null||e===void 0?void 0:e.fields)||{})[Ih])===null||t===void 0?void 0:t.stringValue)===vh}function ri(n){const e=n.mapValue.fields[wh];return ni(e)?ri(e):e}function Ir(n){const e=kt(n.mapValue.fields[Ah].timestampValue);return new ue(e.seconds,e.nanos)}/**
2050
2079
  * @license
2051
2080
  * Copyright 2017 Google LLC
2052
2081
  *
@@ -2061,7 +2090,7 @@ SPDX-License-Identifier: Apache-2.0
2061
2090
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2062
2091
  * See the License for the specific language governing permissions and
2063
2092
  * limitations under the License.
2064
- */class Ey{constructor(e,t,r,s,i,a,c,l,d){this.databaseId=e,this.appId=t,this.persistenceKey=r,this.host=s,this.ssl=i,this.forceLongPolling=a,this.autoDetectLongPolling=c,this.longPollingOptions=l,this.useFetchStreams=d}}const Ds="(default)";class Er{constructor(e,t){this.projectId=e,this.database=t||Ds}static empty(){return new Er("","")}get isDefaultDatabase(){return this.database===Ds}isEqual(e){return e instanceof Er&&e.projectId===this.projectId&&e.database===this.database}}/**
2093
+ */class Cy{constructor(e,t,r,s,i,a,c,l,d,f){this.databaseId=e,this.appId=t,this.persistenceKey=r,this.host=s,this.ssl=i,this.forceLongPolling=a,this.autoDetectLongPolling=c,this.longPollingOptions=l,this.useFetchStreams=d,this.isUsingEmulator=f}}const Ls="(default)";class wr{constructor(e,t){this.projectId=e,this.database=t||Ls}static empty(){return new wr("","")}get isDefaultDatabase(){return this.database===Ls}isEqual(e){return e instanceof wr&&e.projectId===this.projectId&&e.database===this.database}}/**
2065
2094
  * @license
2066
2095
  * Copyright 2020 Google LLC
2067
2096
  *
@@ -2076,7 +2105,7 @@ SPDX-License-Identifier: Apache-2.0
2076
2105
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2077
2106
  * See the License for the specific language governing permissions and
2078
2107
  * limitations under the License.
2079
- */const yh="__type__",vy="__max__",os={mapValue:{}},Th="__vector__",Os="value";function Dt(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?Ys(n)?4:wy(n)?9007199254740991:Iy(n)?10:11:U()}function Ye(n,e){if(n===e)return!0;const t=Dt(n);if(t!==Dt(e))return!1;switch(t){case 0:case 9007199254740991:return!0;case 1:return n.booleanValue===e.booleanValue;case 4:return Tr(n).isEqual(Tr(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 a=kt(s.timestampValue),c=kt(i.timestampValue);return a.seconds===c.seconds&&a.nanos===c.nanos}(n,e);case 5:return n.stringValue===e.stringValue;case 6:return function(s,i){return Nt(s.bytesValue).isEqual(Nt(i.bytesValue))}(n,e);case 7:return n.referenceValue===e.referenceValue;case 8:return function(s,i){return ie(s.geoPointValue.latitude)===ie(i.geoPointValue.latitude)&&ie(s.geoPointValue.longitude)===ie(i.geoPointValue.longitude)}(n,e);case 2:return function(s,i){if("integerValue"in s&&"integerValue"in i)return ie(s.integerValue)===ie(i.integerValue);if("doubleValue"in s&&"doubleValue"in i){const a=ie(s.doubleValue),c=ie(i.doubleValue);return a===c?Ns(a)===Ns(c):isNaN(a)&&isNaN(c)}return!1}(n,e);case 9:return bn(n.arrayValue.values||[],e.arrayValue.values||[],Ye);case 10:case 11:return function(s,i){const a=s.mapValue.fields||{},c=i.mapValue.fields||{};if(mu(a)!==mu(c))return!1;for(const l in a)if(a.hasOwnProperty(l)&&(c[l]===void 0||!Ye(a[l],c[l])))return!1;return!0}(n,e);default:return U()}}function vr(n,e){return(n.values||[]).find(t=>Ye(t,e))!==void 0}function Pn(n,e){if(n===e)return 0;const t=Dt(n),r=Dt(e);if(t!==r)return H(t,r);switch(t){case 0:case 9007199254740991:return 0;case 1:return H(n.booleanValue,e.booleanValue);case 2:return function(i,a){const c=ie(i.integerValue||i.doubleValue),l=ie(a.integerValue||a.doubleValue);return c<l?-1:c>l?1:c===l?0:isNaN(c)?isNaN(l)?0:-1:1}(n,e);case 3:return _u(n.timestampValue,e.timestampValue);case 4:return _u(Tr(n),Tr(e));case 5:return oo(n.stringValue,e.stringValue);case 6:return function(i,a){const c=Nt(i),l=Nt(a);return c.compareTo(l)}(n.bytesValue,e.bytesValue);case 7:return function(i,a){const c=i.split("/"),l=a.split("/");for(let d=0;d<c.length&&d<l.length;d++){const f=H(c[d],l[d]);if(f!==0)return f}return H(c.length,l.length)}(n.referenceValue,e.referenceValue);case 8:return function(i,a){const c=H(ie(i.latitude),ie(a.latitude));return c!==0?c:H(ie(i.longitude),ie(a.longitude))}(n.geoPointValue,e.geoPointValue);case 9:return yu(n.arrayValue,e.arrayValue);case 10:return function(i,a){var c,l,d,f;const m=i.fields||{},E=a.fields||{},R=(c=m[Os])===null||c===void 0?void 0:c.arrayValue,C=(l=E[Os])===null||l===void 0?void 0:l.arrayValue,N=H(((d=R==null?void 0:R.values)===null||d===void 0?void 0:d.length)||0,((f=C==null?void 0:C.values)===null||f===void 0?void 0:f.length)||0);return N!==0?N:yu(R,C)}(n.mapValue,e.mapValue);case 11:return function(i,a){if(i===os.mapValue&&a===os.mapValue)return 0;if(i===os.mapValue)return 1;if(a===os.mapValue)return-1;const c=i.fields||{},l=Object.keys(c),d=a.fields||{},f=Object.keys(d);l.sort(),f.sort();for(let m=0;m<l.length&&m<f.length;++m){const E=oo(l[m],f[m]);if(E!==0)return E;const R=Pn(c[l[m]],d[f[m]]);if(R!==0)return R}return H(l.length,f.length)}(n.mapValue,e.mapValue);default:throw U()}}function _u(n,e){if(typeof n=="string"&&typeof e=="string"&&n.length===e.length)return H(n,e);const t=kt(n),r=kt(e),s=H(t.seconds,r.seconds);return s!==0?s:H(t.nanos,r.nanos)}function yu(n,e){const t=n.values||[],r=e.values||[];for(let s=0;s<t.length&&s<r.length;++s){const i=Pn(t[s],r[s]);if(i)return i}return H(t.length,r.length)}function Sn(n){return ao(n)}function ao(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=kt(t);return`time(${r.seconds},${r.nanos})`}(n.timestampValue):"stringValue"in n?n.stringValue:"bytesValue"in n?function(t){return Nt(t).toBase64()}(n.bytesValue):"referenceValue"in n?function(t){return L.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+=ao(i);return r+"]"}(n.arrayValue):"mapValue"in n?function(t){const r=Object.keys(t.fields||{}).sort();let s="{",i=!0;for(const a of r)i?i=!1:s+=",",s+=`${a}:${ao(t.fields[a])}`;return s+"}"}(n.mapValue):U()}function gs(n){switch(Dt(n)){case 0:case 1:return 4;case 2:return 8;case 3:case 8:return 16;case 4:const e=Zs(n);return e?16+gs(e):16;case 5:return 2*n.stringValue.length;case 6:return Nt(n.bytesValue).approximateByteSize();case 7:return n.referenceValue.length;case 9:return function(r){return(r.values||[]).reduce((s,i)=>s+gs(i),0)}(n.arrayValue);case 10:case 11:return function(r){let s=0;return rn(r.fields,(i,a)=>{s+=i.length+gs(a)}),s}(n.mapValue);default:throw U()}}function Vs(n,e){return{referenceValue:`projects/${n.projectId}/databases/${n.database}/documents/${e.path.canonicalString()}`}}function co(n){return!!n&&"integerValue"in n}function Fo(n){return!!n&&"arrayValue"in n}function Tu(n){return!!n&&"nullValue"in n}function Eu(n){return!!n&&"doubleValue"in n&&isNaN(Number(n.doubleValue))}function _s(n){return!!n&&"mapValue"in n}function Iy(n){var e,t;return((t=(((e=n==null?void 0:n.mapValue)===null||e===void 0?void 0:e.fields)||{})[yh])===null||t===void 0?void 0:t.stringValue)===Th}function hr(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 rn(n.mapValue.fields,(t,r)=>e.mapValue.fields[t]=hr(r)),e}if(n.arrayValue){const e={arrayValue:{values:[]}};for(let t=0;t<(n.arrayValue.values||[]).length;++t)e.arrayValue.values[t]=hr(n.arrayValue.values[t]);return e}return Object.assign({},n)}function wy(n){return(((n.mapValue||{}).fields||{}).__type__||{}).stringValue===vy}/**
2108
+ */const Rh="__type__",ky="__max__",us={mapValue:{}},bh="__vector__",xs="value";function Dt(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?ni(n)?4:Dy(n)?9007199254740991:Ny(n)?10:11:F(28295,{value:n})}function Je(n,e){if(n===e)return!0;const t=Dt(n);if(t!==Dt(e))return!1;switch(t){case 0:case 9007199254740991:return!0;case 1:return n.booleanValue===e.booleanValue;case 4:return Ir(n).isEqual(Ir(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 a=kt(s.timestampValue),c=kt(i.timestampValue);return a.seconds===c.seconds&&a.nanos===c.nanos}(n,e);case 5:return n.stringValue===e.stringValue;case 6:return function(s,i){return Nt(s.bytesValue).isEqual(Nt(i.bytesValue))}(n,e);case 7:return n.referenceValue===e.referenceValue;case 8:return function(s,i){return ie(s.geoPointValue.latitude)===ie(i.geoPointValue.latitude)&&ie(s.geoPointValue.longitude)===ie(i.geoPointValue.longitude)}(n,e);case 2:return function(s,i){if("integerValue"in s&&"integerValue"in i)return ie(s.integerValue)===ie(i.integerValue);if("doubleValue"in s&&"doubleValue"in i){const a=ie(s.doubleValue),c=ie(i.doubleValue);return a===c?Os(a)===Os(c):isNaN(a)&&isNaN(c)}return!1}(n,e);case 9:return Sn(n.arrayValue.values||[],e.arrayValue.values||[],Je);case 10:case 11:return function(s,i){const a=s.mapValue.fields||{},c=i.mapValue.fields||{};if(Tu(a)!==Tu(c))return!1;for(const l in a)if(a.hasOwnProperty(l)&&(c[l]===void 0||!Je(a[l],c[l])))return!1;return!0}(n,e);default:return F(52216,{left:n})}}function Ar(n,e){return(n.values||[]).find(t=>Je(t,e))!==void 0}function Cn(n,e){if(n===e)return 0;const t=Dt(n),r=Dt(e);if(t!==r)return z(t,r);switch(t){case 0:case 9007199254740991:return 0;case 1:return z(n.booleanValue,e.booleanValue);case 2:return function(i,a){const c=ie(i.integerValue||i.doubleValue),l=ie(a.integerValue||a.doubleValue);return c<l?-1:c>l?1:c===l?0:isNaN(c)?isNaN(l)?0:-1:1}(n,e);case 3:return Iu(n.timestampValue,e.timestampValue);case 4:return Iu(Ir(n),Ir(e));case 5:return lo(n.stringValue,e.stringValue);case 6:return function(i,a){const c=Nt(i),l=Nt(a);return c.compareTo(l)}(n.bytesValue,e.bytesValue);case 7:return function(i,a){const c=i.split("/"),l=a.split("/");for(let d=0;d<c.length&&d<l.length;d++){const f=z(c[d],l[d]);if(f!==0)return f}return z(c.length,l.length)}(n.referenceValue,e.referenceValue);case 8:return function(i,a){const c=z(ie(i.latitude),ie(a.latitude));return c!==0?c:z(ie(i.longitude),ie(a.longitude))}(n.geoPointValue,e.geoPointValue);case 9:return wu(n.arrayValue,e.arrayValue);case 10:return function(i,a){var c,l,d,f;const m=i.fields||{},_=a.fields||{},R=(c=m[xs])===null||c===void 0?void 0:c.arrayValue,S=(l=_[xs])===null||l===void 0?void 0:l.arrayValue,N=z(((d=R==null?void 0:R.values)===null||d===void 0?void 0:d.length)||0,((f=S==null?void 0:S.values)===null||f===void 0?void 0:f.length)||0);return N!==0?N:wu(R,S)}(n.mapValue,e.mapValue);case 11:return function(i,a){if(i===us.mapValue&&a===us.mapValue)return 0;if(i===us.mapValue)return 1;if(a===us.mapValue)return-1;const c=i.fields||{},l=Object.keys(c),d=a.fields||{},f=Object.keys(d);l.sort(),f.sort();for(let m=0;m<l.length&&m<f.length;++m){const _=lo(l[m],f[m]);if(_!==0)return _;const R=Cn(c[l[m]],d[f[m]]);if(R!==0)return R}return z(l.length,f.length)}(n.mapValue,e.mapValue);default:throw F(23264,{Pe:t})}}function Iu(n,e){if(typeof n=="string"&&typeof e=="string"&&n.length===e.length)return z(n,e);const t=kt(n),r=kt(e),s=z(t.seconds,r.seconds);return s!==0?s:z(t.nanos,r.nanos)}function wu(n,e){const t=n.values||[],r=e.values||[];for(let s=0;s<t.length&&s<r.length;++s){const i=Cn(t[s],r[s]);if(i)return i}return z(t.length,r.length)}function kn(n){return ho(n)}function ho(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=kt(t);return`time(${r.seconds},${r.nanos})`}(n.timestampValue):"stringValue"in n?n.stringValue:"bytesValue"in n?function(t){return Nt(t).toBase64()}(n.bytesValue):"referenceValue"in n?function(t){return L.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+=ho(i);return r+"]"}(n.arrayValue):"mapValue"in n?function(t){const r=Object.keys(t.fields||{}).sort();let s="{",i=!0;for(const a of r)i?i=!1:s+=",",s+=`${a}:${ho(t.fields[a])}`;return s+"}"}(n.mapValue):F(61005,{value:n})}function Es(n){switch(Dt(n)){case 0:case 1:return 4;case 2:return 8;case 3:case 8:return 16;case 4:const e=ri(n);return e?16+Es(e):16;case 5:return 2*n.stringValue.length;case 6:return Nt(n.bytesValue).approximateByteSize();case 7:return n.referenceValue.length;case 9:return function(r){return(r.values||[]).reduce((s,i)=>s+Es(i),0)}(n.arrayValue);case 10:case 11:return function(r){let s=0;return on(r.fields,(i,a)=>{s+=i.length+Es(a)}),s}(n.mapValue);default:throw F(13486,{value:n})}}function Ms(n,e){return{referenceValue:`projects/${n.projectId}/databases/${n.database}/documents/${e.path.canonicalString()}`}}function fo(n){return!!n&&"integerValue"in n}function $o(n){return!!n&&"arrayValue"in n}function Au(n){return!!n&&"nullValue"in n}function Ru(n){return!!n&&"doubleValue"in n&&isNaN(Number(n.doubleValue))}function Ts(n){return!!n&&"mapValue"in n}function Ny(n){var e,t;return((t=(((e=n==null?void 0:n.mapValue)===null||e===void 0?void 0:e.fields)||{})[Rh])===null||t===void 0?void 0:t.stringValue)===bh}function pr(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 on(n.mapValue.fields,(t,r)=>e.mapValue.fields[t]=pr(r)),e}if(n.arrayValue){const e={arrayValue:{values:[]}};for(let t=0;t<(n.arrayValue.values||[]).length;++t)e.arrayValue.values[t]=pr(n.arrayValue.values[t]);return e}return Object.assign({},n)}function Dy(n){return(((n.mapValue||{}).fields||{}).__type__||{}).stringValue===ky}/**
2080
2109
  * @license
2081
2110
  * Copyright 2017 Google LLC
2082
2111
  *
@@ -2091,7 +2120,7 @@ SPDX-License-Identifier: Apache-2.0
2091
2120
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2092
2121
  * See the License for the specific language governing permissions and
2093
2122
  * limitations under the License.
2094
- */class Ve{constructor(e){this.value=e}static empty(){return new Ve({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)],!_s(t))return null;return t=(t.mapValue.fields||{})[e.lastSegment()],t||null}}set(e,t){this.getFieldsMap(e.popLast())[e.lastSegment()]=hr(t)}setAll(e){let t=pe.emptyPath(),r={},s=[];e.forEach((a,c)=>{if(!t.isImmediateParentOf(c)){const l=this.getFieldsMap(t);this.applyChanges(l,r,s),r={},s=[],t=c.popLast()}a?r[c.lastSegment()]=hr(a):s.push(c.lastSegment())});const i=this.getFieldsMap(t);this.applyChanges(i,r,s)}delete(e){const t=this.field(e.popLast());_s(t)&&t.mapValue.fields&&delete t.mapValue.fields[e.lastSegment()]}isEqual(e){return Ye(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)];_s(s)&&s.mapValue.fields||(s={mapValue:{fields:{}}},t.mapValue.fields[e.get(r)]=s),t=s}return t.mapValue.fields}applyChanges(e,t,r){rn(t,(s,i)=>e[s]=i);for(const s of r)delete e[s]}clone(){return new Ve(hr(this.value))}}function Eh(n){const e=[];return rn(n.fields,(t,r)=>{const s=new pe([t]);if(_s(r)){const i=Eh(r.mapValue).fields;if(i.length===0)e.push(s);else for(const a of i)e.push(s.child(a))}else e.push(s)}),new Be(e)}/**
2123
+ */class Oe{constructor(e){this.value=e}static empty(){return new Oe({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)],!Ts(t))return null;return t=(t.mapValue.fields||{})[e.lastSegment()],t||null}}set(e,t){this.getFieldsMap(e.popLast())[e.lastSegment()]=pr(t)}setAll(e){let t=pe.emptyPath(),r={},s=[];e.forEach((a,c)=>{if(!t.isImmediateParentOf(c)){const l=this.getFieldsMap(t);this.applyChanges(l,r,s),r={},s=[],t=c.popLast()}a?r[c.lastSegment()]=pr(a):s.push(c.lastSegment())});const i=this.getFieldsMap(t);this.applyChanges(i,r,s)}delete(e){const t=this.field(e.popLast());Ts(t)&&t.mapValue.fields&&delete t.mapValue.fields[e.lastSegment()]}isEqual(e){return Je(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)];Ts(s)&&s.mapValue.fields||(s={mapValue:{fields:{}}},t.mapValue.fields[e.get(r)]=s),t=s}return t.mapValue.fields}applyChanges(e,t,r){on(t,(s,i)=>e[s]=i);for(const s of r)delete e[s]}clone(){return new Oe(pr(this.value))}}function Ph(n){const e=[];return on(n.fields,(t,r)=>{const s=new pe([t]);if(Ts(r)){const i=Ph(r.mapValue).fields;if(i.length===0)e.push(s);else for(const a of i)e.push(s.child(a))}else e.push(s)}),new Be(e)}/**
2095
2124
  * @license
2096
2125
  * Copyright 2017 Google LLC
2097
2126
  *
@@ -2106,7 +2135,7 @@ SPDX-License-Identifier: Apache-2.0
2106
2135
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2107
2136
  * See the License for the specific language governing permissions and
2108
2137
  * limitations under the License.
2109
- */class Ie{constructor(e,t,r,s,i,a,c){this.key=e,this.documentType=t,this.version=r,this.readTime=s,this.createTime=i,this.data=a,this.documentState=c}static newInvalidDocument(e){return new Ie(e,0,B.min(),B.min(),B.min(),Ve.empty(),0)}static newFoundDocument(e,t,r,s){return new Ie(e,1,t,B.min(),r,s,0)}static newNoDocument(e,t){return new Ie(e,2,t,B.min(),B.min(),Ve.empty(),0)}static newUnknownDocument(e,t){return new Ie(e,3,t,B.min(),B.min(),Ve.empty(),2)}convertToFoundDocument(e,t){return!this.createTime.isEqual(B.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=Ve.empty(),this.documentState=0,this}convertToUnknownDocument(e){return this.version=e,this.documentType=3,this.data=Ve.empty(),this.documentState=2,this}setHasCommittedMutations(){return this.documentState=2,this}setHasLocalMutations(){return this.documentState=1,this.version=B.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 Ie&&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 Ie(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}})`}}/**
2138
+ */class Ie{constructor(e,t,r,s,i,a,c){this.key=e,this.documentType=t,this.version=r,this.readTime=s,this.createTime=i,this.data=a,this.documentState=c}static newInvalidDocument(e){return new Ie(e,0,q.min(),q.min(),q.min(),Oe.empty(),0)}static newFoundDocument(e,t,r,s){return new Ie(e,1,t,q.min(),r,s,0)}static newNoDocument(e,t){return new Ie(e,2,t,q.min(),q.min(),Oe.empty(),0)}static newUnknownDocument(e,t){return new Ie(e,3,t,q.min(),q.min(),Oe.empty(),2)}convertToFoundDocument(e,t){return!this.createTime.isEqual(q.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=Oe.empty(),this.documentState=0,this}convertToUnknownDocument(e){return this.version=e,this.documentType=3,this.data=Oe.empty(),this.documentState=2,this}setHasCommittedMutations(){return this.documentState=2,this}setHasLocalMutations(){return this.documentState=1,this.version=q.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 Ie&&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 Ie(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}})`}}/**
2110
2139
  * @license
2111
2140
  * Copyright 2022 Google LLC
2112
2141
  *
@@ -2121,7 +2150,7 @@ SPDX-License-Identifier: Apache-2.0
2121
2150
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2122
2151
  * See the License for the specific language governing permissions and
2123
2152
  * limitations under the License.
2124
- */class Cn{constructor(e,t){this.position=e,this.inclusive=t}}function vu(n,e,t){let r=0;for(let s=0;s<n.position.length;s++){const i=e[s],a=n.position[s];if(i.field.isKeyField()?r=L.comparator(L.fromName(a.referenceValue),t.key):r=Pn(a,t.data.field(i.field)),i.dir==="desc"&&(r*=-1),r!==0)break}return r}function Iu(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(!Ye(n.position[t],e.position[t]))return!1;return!0}/**
2153
+ */class Nn{constructor(e,t){this.position=e,this.inclusive=t}}function bu(n,e,t){let r=0;for(let s=0;s<n.position.length;s++){const i=e[s],a=n.position[s];if(i.field.isKeyField()?r=L.comparator(L.fromName(a.referenceValue),t.key):r=Cn(a,t.data.field(i.field)),i.dir==="desc"&&(r*=-1),r!==0)break}return r}function Pu(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(!Je(n.position[t],e.position[t]))return!1;return!0}/**
2125
2154
  * @license
2126
2155
  * Copyright 2022 Google LLC
2127
2156
  *
@@ -2136,7 +2165,7 @@ SPDX-License-Identifier: Apache-2.0
2136
2165
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2137
2166
  * See the License for the specific language governing permissions and
2138
2167
  * limitations under the License.
2139
- */class Ir{constructor(e,t="asc"){this.field=e,this.dir=t}}function Ay(n,e){return n.dir===e.dir&&n.field.isEqual(e.field)}/**
2168
+ */class Rr{constructor(e,t="asc"){this.field=e,this.dir=t}}function Vy(n,e){return n.dir===e.dir&&n.field.isEqual(e.field)}/**
2140
2169
  * @license
2141
2170
  * Copyright 2022 Google LLC
2142
2171
  *
@@ -2151,7 +2180,7 @@ SPDX-License-Identifier: Apache-2.0
2151
2180
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2152
2181
  * See the License for the specific language governing permissions and
2153
2182
  * limitations under the License.
2154
- */class vh{}class ae extends vh{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 by(e,t,r):t==="array-contains"?new Cy(e,r):t==="in"?new ky(e,r):t==="not-in"?new Ny(e,r):t==="array-contains-any"?new Dy(e,r):new ae(e,t,r)}static createKeyFieldInFilter(e,t,r){return t==="in"?new Py(e,r):new Sy(e,r)}matches(e){const t=e.data.field(this.field);return this.op==="!="?t!==null&&this.matchesComparison(Pn(t,this.value)):t!==null&&Dt(this.value)===Dt(t)&&this.matchesComparison(Pn(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 U()}}isInequality(){return["<","<=",">",">=","!=","not-in"].indexOf(this.op)>=0}getFlattenedFilters(){return[this]}getFilters(){return[this]}}class je extends vh{constructor(e,t){super(),this.filters=e,this.op=t,this.ce=null}static create(e,t){return new je(e,t)}matches(e){return Ih(this)?this.filters.find(t=>!t.matches(e))===void 0:this.filters.find(t=>t.matches(e))!==void 0}getFlattenedFilters(){return this.ce!==null||(this.ce=this.filters.reduce((e,t)=>e.concat(t.getFlattenedFilters()),[])),this.ce}getFilters(){return Object.assign([],this.filters)}}function Ih(n){return n.op==="and"}function wh(n){return Ry(n)&&Ih(n)}function Ry(n){for(const e of n.filters)if(e instanceof je)return!1;return!0}function uo(n){if(n instanceof ae)return n.field.canonicalString()+n.op.toString()+Sn(n.value);if(wh(n))return n.filters.map(e=>uo(e)).join(",");{const e=n.filters.map(t=>uo(t)).join(",");return`${n.op}(${e})`}}function Ah(n,e){return n instanceof ae?function(r,s){return s instanceof ae&&r.op===s.op&&r.field.isEqual(s.field)&&Ye(r.value,s.value)}(n,e):n instanceof je?function(r,s){return s instanceof je&&r.op===s.op&&r.filters.length===s.filters.length?r.filters.reduce((i,a,c)=>i&&Ah(a,s.filters[c]),!0):!1}(n,e):void U()}function Rh(n){return n instanceof ae?function(t){return`${t.field.canonicalString()} ${t.op} ${Sn(t.value)}`}(n):n instanceof je?function(t){return t.op.toString()+" {"+t.getFilters().map(Rh).join(" ,")+"}"}(n):"Filter"}class by extends ae{constructor(e,t,r){super(e,t,r),this.key=L.fromName(r.referenceValue)}matches(e){const t=L.comparator(e.key,this.key);return this.matchesComparison(t)}}class Py extends ae{constructor(e,t){super(e,"in",t),this.keys=bh("in",t)}matches(e){return this.keys.some(t=>t.isEqual(e.key))}}class Sy extends ae{constructor(e,t){super(e,"not-in",t),this.keys=bh("not-in",t)}matches(e){return!this.keys.some(t=>t.isEqual(e.key))}}function bh(n,e){var t;return(((t=e.arrayValue)===null||t===void 0?void 0:t.values)||[]).map(r=>L.fromName(r.referenceValue))}class Cy extends ae{constructor(e,t){super(e,"array-contains",t)}matches(e){const t=e.data.field(this.field);return Fo(t)&&vr(t.arrayValue,this.value)}}class ky extends ae{constructor(e,t){super(e,"in",t)}matches(e){const t=e.data.field(this.field);return t!==null&&vr(this.value.arrayValue,t)}}class Ny extends ae{constructor(e,t){super(e,"not-in",t)}matches(e){if(vr(this.value.arrayValue,{nullValue:"NULL_VALUE"}))return!1;const t=e.data.field(this.field);return t!==null&&!vr(this.value.arrayValue,t)}}class Dy extends ae{constructor(e,t){super(e,"array-contains-any",t)}matches(e){const t=e.data.field(this.field);return!(!Fo(t)||!t.arrayValue.values)&&t.arrayValue.values.some(r=>vr(this.value.arrayValue,r))}}/**
2183
+ */class Sh{}class ae extends Sh{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 Ly(e,t,r):t==="array-contains"?new Uy(e,r):t==="in"?new Fy(e,r):t==="not-in"?new By(e,r):t==="array-contains-any"?new qy(e,r):new ae(e,t,r)}static createKeyFieldInFilter(e,t,r){return t==="in"?new xy(e,r):new My(e,r)}matches(e){const t=e.data.field(this.field);return this.op==="!="?t!==null&&t.nullValue===void 0&&this.matchesComparison(Cn(t,this.value)):t!==null&&Dt(this.value)===Dt(t)&&this.matchesComparison(Cn(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 F(47266,{operator:this.op})}}isInequality(){return["<","<=",">",">=","!=","not-in"].indexOf(this.op)>=0}getFlattenedFilters(){return[this]}getFilters(){return[this]}}class $e extends Sh{constructor(e,t){super(),this.filters=e,this.op=t,this.Te=null}static create(e,t){return new $e(e,t)}matches(e){return Ch(this)?this.filters.find(t=>!t.matches(e))===void 0:this.filters.find(t=>t.matches(e))!==void 0}getFlattenedFilters(){return this.Te!==null||(this.Te=this.filters.reduce((e,t)=>e.concat(t.getFlattenedFilters()),[])),this.Te}getFilters(){return Object.assign([],this.filters)}}function Ch(n){return n.op==="and"}function kh(n){return Oy(n)&&Ch(n)}function Oy(n){for(const e of n.filters)if(e instanceof $e)return!1;return!0}function po(n){if(n instanceof ae)return n.field.canonicalString()+n.op.toString()+kn(n.value);if(kh(n))return n.filters.map(e=>po(e)).join(",");{const e=n.filters.map(t=>po(t)).join(",");return`${n.op}(${e})`}}function Nh(n,e){return n instanceof ae?function(r,s){return s instanceof ae&&r.op===s.op&&r.field.isEqual(s.field)&&Je(r.value,s.value)}(n,e):n instanceof $e?function(r,s){return s instanceof $e&&r.op===s.op&&r.filters.length===s.filters.length?r.filters.reduce((i,a,c)=>i&&Nh(a,s.filters[c]),!0):!1}(n,e):void F(19439)}function Dh(n){return n instanceof ae?function(t){return`${t.field.canonicalString()} ${t.op} ${kn(t.value)}`}(n):n instanceof $e?function(t){return t.op.toString()+" {"+t.getFilters().map(Dh).join(" ,")+"}"}(n):"Filter"}class Ly extends ae{constructor(e,t,r){super(e,t,r),this.key=L.fromName(r.referenceValue)}matches(e){const t=L.comparator(e.key,this.key);return this.matchesComparison(t)}}class xy extends ae{constructor(e,t){super(e,"in",t),this.keys=Vh("in",t)}matches(e){return this.keys.some(t=>t.isEqual(e.key))}}class My extends ae{constructor(e,t){super(e,"not-in",t),this.keys=Vh("not-in",t)}matches(e){return!this.keys.some(t=>t.isEqual(e.key))}}function Vh(n,e){var t;return(((t=e.arrayValue)===null||t===void 0?void 0:t.values)||[]).map(r=>L.fromName(r.referenceValue))}class Uy extends ae{constructor(e,t){super(e,"array-contains",t)}matches(e){const t=e.data.field(this.field);return $o(t)&&Ar(t.arrayValue,this.value)}}class Fy extends ae{constructor(e,t){super(e,"in",t)}matches(e){const t=e.data.field(this.field);return t!==null&&Ar(this.value.arrayValue,t)}}class By extends ae{constructor(e,t){super(e,"not-in",t)}matches(e){if(Ar(this.value.arrayValue,{nullValue:"NULL_VALUE"}))return!1;const t=e.data.field(this.field);return t!==null&&t.nullValue===void 0&&!Ar(this.value.arrayValue,t)}}class qy extends ae{constructor(e,t){super(e,"array-contains-any",t)}matches(e){const t=e.data.field(this.field);return!(!$o(t)||!t.arrayValue.values)&&t.arrayValue.values.some(r=>Ar(this.value.arrayValue,r))}}/**
2155
2184
  * @license
2156
2185
  * Copyright 2019 Google LLC
2157
2186
  *
@@ -2166,7 +2195,7 @@ SPDX-License-Identifier: Apache-2.0
2166
2195
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2167
2196
  * See the License for the specific language governing permissions and
2168
2197
  * limitations under the License.
2169
- */class Oy{constructor(e,t=null,r=[],s=[],i=null,a=null,c=null){this.path=e,this.collectionGroup=t,this.orderBy=r,this.filters=s,this.limit=i,this.startAt=a,this.endAt=c,this.le=null}}function wu(n,e=null,t=[],r=[],s=null,i=null,a=null){return new Oy(n,e,t,r,s,i,a)}function Bo(n){const e=q(n);if(e.le===null){let t=e.path.canonicalString();e.collectionGroup!==null&&(t+="|cg:"+e.collectionGroup),t+="|f:",t+=e.filters.map(r=>uo(r)).join(","),t+="|ob:",t+=e.orderBy.map(r=>function(i){return i.field.canonicalString()+i.dir}(r)).join(","),Js(e.limit)||(t+="|l:",t+=e.limit),e.startAt&&(t+="|lb:",t+=e.startAt.inclusive?"b:":"a:",t+=e.startAt.position.map(r=>Sn(r)).join(",")),e.endAt&&(t+="|ub:",t+=e.endAt.inclusive?"a:":"b:",t+=e.endAt.position.map(r=>Sn(r)).join(",")),e.le=t}return e.le}function qo(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(!Ay(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(!Ah(n.filters[t],e.filters[t]))return!1;return n.collectionGroup===e.collectionGroup&&!!n.path.isEqual(e.path)&&!!Iu(n.startAt,e.startAt)&&Iu(n.endAt,e.endAt)}function lo(n){return L.isDocumentKey(n.path)&&n.collectionGroup===null&&n.filters.length===0}/**
2198
+ */class jy{constructor(e,t=null,r=[],s=[],i=null,a=null,c=null){this.path=e,this.collectionGroup=t,this.orderBy=r,this.filters=s,this.limit=i,this.startAt=a,this.endAt=c,this.Ie=null}}function Su(n,e=null,t=[],r=[],s=null,i=null,a=null){return new jy(n,e,t,r,s,i,a)}function zo(n){const e=j(n);if(e.Ie===null){let t=e.path.canonicalString();e.collectionGroup!==null&&(t+="|cg:"+e.collectionGroup),t+="|f:",t+=e.filters.map(r=>po(r)).join(","),t+="|ob:",t+=e.orderBy.map(r=>function(i){return i.field.canonicalString()+i.dir}(r)).join(","),ti(e.limit)||(t+="|l:",t+=e.limit),e.startAt&&(t+="|lb:",t+=e.startAt.inclusive?"b:":"a:",t+=e.startAt.position.map(r=>kn(r)).join(",")),e.endAt&&(t+="|ub:",t+=e.endAt.inclusive?"a:":"b:",t+=e.endAt.position.map(r=>kn(r)).join(",")),e.Ie=t}return e.Ie}function Ho(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(!Vy(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(!Nh(n.filters[t],e.filters[t]))return!1;return n.collectionGroup===e.collectionGroup&&!!n.path.isEqual(e.path)&&!!Pu(n.startAt,e.startAt)&&Pu(n.endAt,e.endAt)}function mo(n){return L.isDocumentKey(n.path)&&n.collectionGroup===null&&n.filters.length===0}/**
2170
2199
  * @license
2171
2200
  * Copyright 2017 Google LLC
2172
2201
  *
@@ -2181,7 +2210,7 @@ SPDX-License-Identifier: Apache-2.0
2181
2210
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2182
2211
  * See the License for the specific language governing permissions and
2183
2212
  * limitations under the License.
2184
- */class Ut{constructor(e,t=null,r=[],s=[],i=null,a="F",c=null,l=null){this.path=e,this.collectionGroup=t,this.explicitOrderBy=r,this.filters=s,this.limit=i,this.limitType=a,this.startAt=c,this.endAt=l,this.he=null,this.Pe=null,this.Te=null,this.startAt,this.endAt}}function Vy(n,e,t,r,s,i,a,c){return new Ut(n,e,t,r,s,i,a,c)}function ei(n){return new Ut(n)}function Au(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 $o(n){return n.collectionGroup!==null}function vn(n){const e=q(n);if(e.he===null){e.he=[];const t=new Set;for(const i of e.explicitOrderBy)e.he.push(i),t.add(i.field.canonicalString());const r=e.explicitOrderBy.length>0?e.explicitOrderBy[e.explicitOrderBy.length-1].dir:"asc";(function(a){let c=new le(pe.comparator);return a.filters.forEach(l=>{l.getFlattenedFilters().forEach(d=>{d.isInequality()&&(c=c.add(d.field))})}),c})(e).forEach(i=>{t.has(i.canonicalString())||i.isKeyField()||e.he.push(new Ir(i,r))}),t.has(pe.keyField().canonicalString())||e.he.push(new Ir(pe.keyField(),r))}return e.he}function Qe(n){const e=q(n);return e.Pe||(e.Pe=Ly(e,vn(n))),e.Pe}function Ly(n,e){if(n.limitType==="F")return wu(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 Ir(s.field,i)});const t=n.endAt?new Cn(n.endAt.position,n.endAt.inclusive):null,r=n.startAt?new Cn(n.startAt.position,n.startAt.inclusive):null;return wu(n.path,n.collectionGroup,e,n.filters,n.limit,t,r)}}function ho(n,e){const t=n.filters.concat([e]);return new Ut(n.path,n.collectionGroup,n.explicitOrderBy.slice(),t,n.limit,n.limitType,n.startAt,n.endAt)}function Ls(n,e,t){return new Ut(n.path,n.collectionGroup,n.explicitOrderBy.slice(),n.filters.slice(),e,t,n.startAt,n.endAt)}function ti(n,e){return qo(Qe(n),Qe(e))&&n.limitType===e.limitType}function Ph(n){return`${Bo(Qe(n))}|lt:${n.limitType}`}function mn(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=>Rh(s)).join(", ")}]`),Js(t.limit)||(r+=", limit: "+t.limit),t.orderBy.length>0&&(r+=`, orderBy: [${t.orderBy.map(s=>function(a){return`${a.field.canonicalString()} (${a.dir})`}(s)).join(", ")}]`),t.startAt&&(r+=", startAt: ",r+=t.startAt.inclusive?"b:":"a:",r+=t.startAt.position.map(s=>Sn(s)).join(",")),t.endAt&&(r+=", endAt: ",r+=t.endAt.inclusive?"a:":"b:",r+=t.endAt.position.map(s=>Sn(s)).join(",")),`Target(${r})`}(Qe(n))}; limitType=${n.limitType})`}function ni(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):L.isDocumentKey(r.path)?r.path.isEqual(i):r.path.isImmediateParentOf(i)}(n,e)&&function(r,s){for(const i of vn(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(a,c,l){const d=vu(a,c,l);return a.inclusive?d<=0:d<0}(r.startAt,vn(r),s)||r.endAt&&!function(a,c,l){const d=vu(a,c,l);return a.inclusive?d>=0:d>0}(r.endAt,vn(r),s))}(n,e)}function My(n){return n.collectionGroup||(n.path.length%2==1?n.path.lastSegment():n.path.get(n.path.length-2))}function Sh(n){return(e,t)=>{let r=!1;for(const s of vn(n)){const i=xy(s,e,t);if(i!==0)return i;r=r||s.field.isKeyField()}return 0}}function xy(n,e,t){const r=n.field.isKeyField()?L.comparator(e.key,t.key):function(i,a,c){const l=a.data.field(i),d=c.data.field(i);return l!==null&&d!==null?Pn(l,d):U()}(n.field,e,t);switch(n.dir){case"asc":return r;case"desc":return-1*r;default:return U()}}/**
2213
+ */class Bt{constructor(e,t=null,r=[],s=[],i=null,a="F",c=null,l=null){this.path=e,this.collectionGroup=t,this.explicitOrderBy=r,this.filters=s,this.limit=i,this.limitType=a,this.startAt=c,this.endAt=l,this.Ee=null,this.de=null,this.Ae=null,this.startAt,this.endAt}}function $y(n,e,t,r,s,i,a,c){return new Bt(n,e,t,r,s,i,a,c)}function si(n){return new Bt(n)}function Cu(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 Go(n){return n.collectionGroup!==null}function wn(n){const e=j(n);if(e.Ee===null){e.Ee=[];const t=new Set;for(const i of e.explicitOrderBy)e.Ee.push(i),t.add(i.field.canonicalString());const r=e.explicitOrderBy.length>0?e.explicitOrderBy[e.explicitOrderBy.length-1].dir:"asc";(function(a){let c=new le(pe.comparator);return a.filters.forEach(l=>{l.getFlattenedFilters().forEach(d=>{d.isInequality()&&(c=c.add(d.field))})}),c})(e).forEach(i=>{t.has(i.canonicalString())||i.isKeyField()||e.Ee.push(new Rr(i,r))}),t.has(pe.keyField().canonicalString())||e.Ee.push(new Rr(pe.keyField(),r))}return e.Ee}function Qe(n){const e=j(n);return e.de||(e.de=zy(e,wn(n))),e.de}function zy(n,e){if(n.limitType==="F")return Su(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 Rr(s.field,i)});const t=n.endAt?new Nn(n.endAt.position,n.endAt.inclusive):null,r=n.startAt?new Nn(n.startAt.position,n.startAt.inclusive):null;return Su(n.path,n.collectionGroup,e,n.filters,n.limit,t,r)}}function go(n,e){const t=n.filters.concat([e]);return new Bt(n.path,n.collectionGroup,n.explicitOrderBy.slice(),t,n.limit,n.limitType,n.startAt,n.endAt)}function Us(n,e,t){return new Bt(n.path,n.collectionGroup,n.explicitOrderBy.slice(),n.filters.slice(),e,t,n.startAt,n.endAt)}function ii(n,e){return Ho(Qe(n),Qe(e))&&n.limitType===e.limitType}function Oh(n){return`${zo(Qe(n))}|lt:${n.limitType}`}function _n(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=>Dh(s)).join(", ")}]`),ti(t.limit)||(r+=", limit: "+t.limit),t.orderBy.length>0&&(r+=`, orderBy: [${t.orderBy.map(s=>function(a){return`${a.field.canonicalString()} (${a.dir})`}(s)).join(", ")}]`),t.startAt&&(r+=", startAt: ",r+=t.startAt.inclusive?"b:":"a:",r+=t.startAt.position.map(s=>kn(s)).join(",")),t.endAt&&(r+=", endAt: ",r+=t.endAt.inclusive?"a:":"b:",r+=t.endAt.position.map(s=>kn(s)).join(",")),`Target(${r})`}(Qe(n))}; limitType=${n.limitType})`}function oi(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):L.isDocumentKey(r.path)?r.path.isEqual(i):r.path.isImmediateParentOf(i)}(n,e)&&function(r,s){for(const i of wn(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(a,c,l){const d=bu(a,c,l);return a.inclusive?d<=0:d<0}(r.startAt,wn(r),s)||r.endAt&&!function(a,c,l){const d=bu(a,c,l);return a.inclusive?d>=0:d>0}(r.endAt,wn(r),s))}(n,e)}function Hy(n){return n.collectionGroup||(n.path.length%2==1?n.path.lastSegment():n.path.get(n.path.length-2))}function Lh(n){return(e,t)=>{let r=!1;for(const s of wn(n)){const i=Gy(s,e,t);if(i!==0)return i;r=r||s.field.isKeyField()}return 0}}function Gy(n,e,t){const r=n.field.isKeyField()?L.comparator(e.key,t.key):function(i,a,c){const l=a.data.field(i),d=c.data.field(i);return l!==null&&d!==null?Cn(l,d):F(42886)}(n.field,e,t);switch(n.dir){case"asc":return r;case"desc":return-1*r;default:return F(19790,{direction:n.dir})}}/**
2185
2214
  * @license
2186
2215
  * Copyright 2017 Google LLC
2187
2216
  *
@@ -2196,7 +2225,7 @@ SPDX-License-Identifier: Apache-2.0
2196
2225
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2197
2226
  * See the License for the specific language governing permissions and
2198
2227
  * limitations under the License.
2199
- */class sn{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){rn(this.inner,(t,r)=>{for(const[s,i]of r)e(s,i)})}isEmpty(){return dh(this.inner)}size(){return this.innerSize}}/**
2228
+ */class an{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){on(this.inner,(t,r)=>{for(const[s,i]of r)e(s,i)})}isEmpty(){return Eh(this.inner)}size(){return this.innerSize}}/**
2200
2229
  * @license
2201
2230
  * Copyright 2017 Google LLC
2202
2231
  *
@@ -2211,7 +2240,7 @@ SPDX-License-Identifier: Apache-2.0
2211
2240
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2212
2241
  * See the License for the specific language governing permissions and
2213
2242
  * limitations under the License.
2214
- */const Uy=new ne(L.comparator);function ft(){return Uy}const Ch=new ne(L.comparator);function ar(...n){let e=Ch;for(const t of n)e=e.insert(t.key,t);return e}function kh(n){let e=Ch;return n.forEach((t,r)=>e=e.insert(t,r.overlayedDocument)),e}function Wt(){return dr()}function Nh(){return dr()}function dr(){return new sn(n=>n.toString(),(n,e)=>n.isEqual(e))}const Fy=new ne(L.comparator),By=new le(L.comparator);function G(...n){let e=By;for(const t of n)e=e.add(t);return e}const qy=new le(H);function $y(){return qy}/**
2243
+ */const Wy=new ne(L.comparator);function ft(){return Wy}const xh=new ne(L.comparator);function ur(...n){let e=xh;for(const t of n)e=e.insert(t.key,t);return e}function Mh(n){let e=xh;return n.forEach((t,r)=>e=e.insert(t,r.overlayedDocument)),e}function Qt(){return mr()}function Uh(){return mr()}function mr(){return new an(n=>n.toString(),(n,e)=>n.isEqual(e))}const Ky=new ne(L.comparator),Qy=new le(L.comparator);function G(...n){let e=Qy;for(const t of n)e=e.add(t);return e}const Xy=new le(z);function Yy(){return Xy}/**
2215
2244
  * @license
2216
2245
  * Copyright 2020 Google LLC
2217
2246
  *
@@ -2226,7 +2255,7 @@ SPDX-License-Identifier: Apache-2.0
2226
2255
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2227
2256
  * See the License for the specific language governing permissions and
2228
2257
  * limitations under the License.
2229
- */function jo(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:Ns(e)?"-0":e}}function Dh(n){return{integerValue:""+n}}function jy(n,e){return gy(e)?Dh(e):jo(n,e)}/**
2258
+ */function Wo(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:Os(e)?"-0":e}}function Fh(n){return{integerValue:""+n}}function Jy(n,e){return Ry(e)?Fh(e):Wo(n,e)}/**
2230
2259
  * @license
2231
2260
  * Copyright 2018 Google LLC
2232
2261
  *
@@ -2241,7 +2270,7 @@ SPDX-License-Identifier: Apache-2.0
2241
2270
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2242
2271
  * See the License for the specific language governing permissions and
2243
2272
  * limitations under the License.
2244
- */class ri{constructor(){this._=void 0}}function Hy(n,e,t){return n instanceof Ms?function(s,i){const a={fields:{[mh]:{stringValue:ph},[_h]:{timestampValue:{seconds:s.seconds,nanos:s.nanoseconds}}}};return i&&Ys(i)&&(i=Zs(i)),i&&(a.fields[gh]=i),{mapValue:a}}(t,e):n instanceof wr?Vh(n,e):n instanceof Ar?Lh(n,e):function(s,i){const a=Oh(s,i),c=Ru(a)+Ru(s.Ie);return co(a)&&co(s.Ie)?Dh(c):jo(s.serializer,c)}(n,e)}function zy(n,e,t){return n instanceof wr?Vh(n,e):n instanceof Ar?Lh(n,e):t}function Oh(n,e){return n instanceof xs?function(r){return co(r)||function(i){return!!i&&"doubleValue"in i}(r)}(e)?e:{integerValue:0}:null}class Ms extends ri{}class wr extends ri{constructor(e){super(),this.elements=e}}function Vh(n,e){const t=Mh(e);for(const r of n.elements)t.some(s=>Ye(s,r))||t.push(r);return{arrayValue:{values:t}}}class Ar extends ri{constructor(e){super(),this.elements=e}}function Lh(n,e){let t=Mh(e);for(const r of n.elements)t=t.filter(s=>!Ye(s,r));return{arrayValue:{values:t}}}class xs extends ri{constructor(e,t){super(),this.serializer=e,this.Ie=t}}function Ru(n){return ie(n.integerValue||n.doubleValue)}function Mh(n){return Fo(n)&&n.arrayValue.values?n.arrayValue.values.slice():[]}function Gy(n,e){return n.field.isEqual(e.field)&&function(r,s){return r instanceof wr&&s instanceof wr||r instanceof Ar&&s instanceof Ar?bn(r.elements,s.elements,Ye):r instanceof xs&&s instanceof xs?Ye(r.Ie,s.Ie):r instanceof Ms&&s instanceof Ms}(n.transform,e.transform)}class Wy{constructor(e,t){this.version=e,this.transformResults=t}}class Xe{constructor(e,t){this.updateTime=e,this.exists=t}static none(){return new Xe}static exists(e){return new Xe(void 0,e)}static updateTime(e){return new Xe(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 ys(n,e){return n.updateTime!==void 0?e.isFoundDocument()&&e.version.isEqual(n.updateTime):n.exists===void 0||n.exists===e.isFoundDocument()}class si{}function xh(n,e){if(!n.hasLocalMutations||e&&e.fields.length===0)return null;if(e===null)return n.isNoDocument()?new Ho(n.key,Xe.none()):new Dr(n.key,n.data,Xe.none());{const t=n.data,r=Ve.empty();let s=new le(pe.comparator);for(let i of e.fields)if(!s.has(i)){let a=t.field(i);a===null&&i.length>1&&(i=i.popLast(),a=t.field(i)),a===null?r.delete(i):r.set(i,a),s=s.add(i)}return new on(n.key,r,new Be(s.toArray()),Xe.none())}}function Ky(n,e,t){n instanceof Dr?function(s,i,a){const c=s.value.clone(),l=Pu(s.fieldTransforms,i,a.transformResults);c.setAll(l),i.convertToFoundDocument(a.version,c).setHasCommittedMutations()}(n,e,t):n instanceof on?function(s,i,a){if(!ys(s.precondition,i))return void i.convertToUnknownDocument(a.version);const c=Pu(s.fieldTransforms,i,a.transformResults),l=i.data;l.setAll(Uh(s)),l.setAll(c),i.convertToFoundDocument(a.version,l).setHasCommittedMutations()}(n,e,t):function(s,i,a){i.convertToNoDocument(a.version).setHasCommittedMutations()}(0,e,t)}function fr(n,e,t,r){return n instanceof Dr?function(i,a,c,l){if(!ys(i.precondition,a))return c;const d=i.value.clone(),f=Su(i.fieldTransforms,l,a);return d.setAll(f),a.convertToFoundDocument(a.version,d).setHasLocalMutations(),null}(n,e,t,r):n instanceof on?function(i,a,c,l){if(!ys(i.precondition,a))return c;const d=Su(i.fieldTransforms,l,a),f=a.data;return f.setAll(Uh(i)),f.setAll(d),a.convertToFoundDocument(a.version,f).setHasLocalMutations(),c===null?null:c.unionWith(i.fieldMask.fields).unionWith(i.fieldTransforms.map(m=>m.field))}(n,e,t,r):function(i,a,c){return ys(i.precondition,a)?(a.convertToNoDocument(a.version).setHasLocalMutations(),null):c}(n,e,t)}function Qy(n,e){let t=null;for(const r of n.fieldTransforms){const s=e.data.field(r.field),i=Oh(r.transform,s||null);i!=null&&(t===null&&(t=Ve.empty()),t.set(r.field,i))}return t||null}function bu(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)&&bn(r,s,(i,a)=>Gy(i,a))}(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 Dr extends si{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 on extends si{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 Uh(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 Pu(n,e,t){const r=new Map;Q(n.length===t.length);for(let s=0;s<t.length;s++){const i=n[s],a=i.transform,c=e.data.field(i.field);r.set(i.field,zy(a,c,t[s]))}return r}function Su(n,e,t){const r=new Map;for(const s of n){const i=s.transform,a=t.data.field(s.field);r.set(s.field,Hy(i,a,e))}return r}class Ho extends si{constructor(e,t){super(),this.key=e,this.precondition=t,this.type=2,this.fieldTransforms=[]}getFieldMask(){return null}}class Xy extends si{constructor(e,t){super(),this.key=e,this.precondition=t,this.type=3,this.fieldTransforms=[]}getFieldMask(){return null}}/**
2273
+ */class ai{constructor(){this._=void 0}}function Zy(n,e,t){return n instanceof Fs?function(s,i){const a={fields:{[Ih]:{stringValue:vh},[Ah]:{timestampValue:{seconds:s.seconds,nanos:s.nanoseconds}}}};return i&&ni(i)&&(i=ri(i)),i&&(a.fields[wh]=i),{mapValue:a}}(t,e):n instanceof br?qh(n,e):n instanceof Pr?jh(n,e):function(s,i){const a=Bh(s,i),c=ku(a)+ku(s.Re);return fo(a)&&fo(s.Re)?Fh(c):Wo(s.serializer,c)}(n,e)}function eE(n,e,t){return n instanceof br?qh(n,e):n instanceof Pr?jh(n,e):t}function Bh(n,e){return n instanceof Bs?function(r){return fo(r)||function(i){return!!i&&"doubleValue"in i}(r)}(e)?e:{integerValue:0}:null}class Fs extends ai{}class br extends ai{constructor(e){super(),this.elements=e}}function qh(n,e){const t=$h(e);for(const r of n.elements)t.some(s=>Je(s,r))||t.push(r);return{arrayValue:{values:t}}}class Pr extends ai{constructor(e){super(),this.elements=e}}function jh(n,e){let t=$h(e);for(const r of n.elements)t=t.filter(s=>!Je(s,r));return{arrayValue:{values:t}}}class Bs extends ai{constructor(e,t){super(),this.serializer=e,this.Re=t}}function ku(n){return ie(n.integerValue||n.doubleValue)}function $h(n){return $o(n)&&n.arrayValue.values?n.arrayValue.values.slice():[]}function tE(n,e){return n.field.isEqual(e.field)&&function(r,s){return r instanceof br&&s instanceof br||r instanceof Pr&&s instanceof Pr?Sn(r.elements,s.elements,Je):r instanceof Bs&&s instanceof Bs?Je(r.Re,s.Re):r instanceof Fs&&s instanceof Fs}(n.transform,e.transform)}class nE{constructor(e,t){this.version=e,this.transformResults=t}}class Xe{constructor(e,t){this.updateTime=e,this.exists=t}static none(){return new Xe}static exists(e){return new Xe(void 0,e)}static updateTime(e){return new Xe(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 vs(n,e){return n.updateTime!==void 0?e.isFoundDocument()&&e.version.isEqual(n.updateTime):n.exists===void 0||n.exists===e.isFoundDocument()}class ci{}function zh(n,e){if(!n.hasLocalMutations||e&&e.fields.length===0)return null;if(e===null)return n.isNoDocument()?new Ko(n.key,Xe.none()):new Lr(n.key,n.data,Xe.none());{const t=n.data,r=Oe.empty();let s=new le(pe.comparator);for(let i of e.fields)if(!s.has(i)){let a=t.field(i);a===null&&i.length>1&&(i=i.popLast(),a=t.field(i)),a===null?r.delete(i):r.set(i,a),s=s.add(i)}return new cn(n.key,r,new Be(s.toArray()),Xe.none())}}function rE(n,e,t){n instanceof Lr?function(s,i,a){const c=s.value.clone(),l=Du(s.fieldTransforms,i,a.transformResults);c.setAll(l),i.convertToFoundDocument(a.version,c).setHasCommittedMutations()}(n,e,t):n instanceof cn?function(s,i,a){if(!vs(s.precondition,i))return void i.convertToUnknownDocument(a.version);const c=Du(s.fieldTransforms,i,a.transformResults),l=i.data;l.setAll(Hh(s)),l.setAll(c),i.convertToFoundDocument(a.version,l).setHasCommittedMutations()}(n,e,t):function(s,i,a){i.convertToNoDocument(a.version).setHasCommittedMutations()}(0,e,t)}function gr(n,e,t,r){return n instanceof Lr?function(i,a,c,l){if(!vs(i.precondition,a))return c;const d=i.value.clone(),f=Vu(i.fieldTransforms,l,a);return d.setAll(f),a.convertToFoundDocument(a.version,d).setHasLocalMutations(),null}(n,e,t,r):n instanceof cn?function(i,a,c,l){if(!vs(i.precondition,a))return c;const d=Vu(i.fieldTransforms,l,a),f=a.data;return f.setAll(Hh(i)),f.setAll(d),a.convertToFoundDocument(a.version,f).setHasLocalMutations(),c===null?null:c.unionWith(i.fieldMask.fields).unionWith(i.fieldTransforms.map(m=>m.field))}(n,e,t,r):function(i,a,c){return vs(i.precondition,a)?(a.convertToNoDocument(a.version).setHasLocalMutations(),null):c}(n,e,t)}function sE(n,e){let t=null;for(const r of n.fieldTransforms){const s=e.data.field(r.field),i=Bh(r.transform,s||null);i!=null&&(t===null&&(t=Oe.empty()),t.set(r.field,i))}return t||null}function Nu(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)&&Sn(r,s,(i,a)=>tE(i,a))}(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 Lr extends ci{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 cn extends ci{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 Hh(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 Du(n,e,t){const r=new Map;Q(n.length===t.length,32656,{Ve:t.length,me:n.length});for(let s=0;s<t.length;s++){const i=n[s],a=i.transform,c=e.data.field(i.field);r.set(i.field,eE(a,c,t[s]))}return r}function Vu(n,e,t){const r=new Map;for(const s of n){const i=s.transform,a=t.data.field(s.field);r.set(s.field,Zy(i,a,e))}return r}class Ko extends ci{constructor(e,t){super(),this.key=e,this.precondition=t,this.type=2,this.fieldTransforms=[]}getFieldMask(){return null}}class iE extends ci{constructor(e,t){super(),this.key=e,this.precondition=t,this.type=3,this.fieldTransforms=[]}getFieldMask(){return null}}/**
2245
2274
  * @license
2246
2275
  * Copyright 2017 Google LLC
2247
2276
  *
@@ -2256,7 +2285,7 @@ SPDX-License-Identifier: Apache-2.0
2256
2285
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2257
2286
  * See the License for the specific language governing permissions and
2258
2287
  * limitations under the License.
2259
- */class Jy{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)&&Ky(i,e,r[s])}}applyToLocalView(e,t){for(const r of this.baseMutations)r.key.isEqual(e.key)&&(t=fr(r,e,t,this.localWriteTime));for(const r of this.mutations)r.key.isEqual(e.key)&&(t=fr(r,e,t,this.localWriteTime));return t}applyToLocalDocumentSet(e,t){const r=Nh();return this.mutations.forEach(s=>{const i=e.get(s.key),a=i.overlayedDocument;let c=this.applyToLocalView(a,i.mutatedFields);c=t.has(s.key)?null:c;const l=xh(a,c);l!==null&&r.set(s.key,l),a.isValidDocument()||a.convertToNoDocument(B.min())}),r}keys(){return this.mutations.reduce((e,t)=>e.add(t.key),G())}isEqual(e){return this.batchId===e.batchId&&bn(this.mutations,e.mutations,(t,r)=>bu(t,r))&&bn(this.baseMutations,e.baseMutations,(t,r)=>bu(t,r))}}class zo{constructor(e,t,r,s){this.batch=e,this.commitVersion=t,this.mutationResults=r,this.docVersions=s}static from(e,t,r){Q(e.mutations.length===r.length);let s=function(){return Fy}();const i=e.mutations;for(let a=0;a<i.length;a++)s=s.insert(i[a].key,r[a].version);return new zo(e,t,r,s)}}/**
2288
+ */class oE{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)&&rE(i,e,r[s])}}applyToLocalView(e,t){for(const r of this.baseMutations)r.key.isEqual(e.key)&&(t=gr(r,e,t,this.localWriteTime));for(const r of this.mutations)r.key.isEqual(e.key)&&(t=gr(r,e,t,this.localWriteTime));return t}applyToLocalDocumentSet(e,t){const r=Uh();return this.mutations.forEach(s=>{const i=e.get(s.key),a=i.overlayedDocument;let c=this.applyToLocalView(a,i.mutatedFields);c=t.has(s.key)?null:c;const l=zh(a,c);l!==null&&r.set(s.key,l),a.isValidDocument()||a.convertToNoDocument(q.min())}),r}keys(){return this.mutations.reduce((e,t)=>e.add(t.key),G())}isEqual(e){return this.batchId===e.batchId&&Sn(this.mutations,e.mutations,(t,r)=>Nu(t,r))&&Sn(this.baseMutations,e.baseMutations,(t,r)=>Nu(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){Q(e.mutations.length===r.length,58842,{fe:e.mutations.length,ge:r.length});let s=function(){return Ky}();const i=e.mutations;for(let a=0;a<i.length;a++)s=s.insert(i[a].key,r[a].version);return new Qo(e,t,r,s)}}/**
2260
2289
  * @license
2261
2290
  * Copyright 2022 Google LLC
2262
2291
  *
@@ -2271,7 +2300,7 @@ SPDX-License-Identifier: Apache-2.0
2271
2300
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2272
2301
  * See the License for the specific language governing permissions and
2273
2302
  * limitations under the License.
2274
- */class Yy{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{
2303
+ */class aE{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{
2275
2304
  largestBatchId: ${this.largestBatchId},
2276
2305
  mutation: ${this.mutation.toString()}
2277
2306
  }`}}/**
@@ -2289,7 +2318,7 @@ SPDX-License-Identifier: Apache-2.0
2289
2318
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2290
2319
  * See the License for the specific language governing permissions and
2291
2320
  * limitations under the License.
2292
- */class Zy{constructor(e,t){this.count=e,this.unchangedNames=t}}/**
2321
+ */class cE{constructor(e,t){this.count=e,this.unchangedNames=t}}/**
2293
2322
  * @license
2294
2323
  * Copyright 2017 Google LLC
2295
2324
  *
@@ -2304,7 +2333,7 @@ SPDX-License-Identifier: Apache-2.0
2304
2333
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2305
2334
  * See the License for the specific language governing permissions and
2306
2335
  * limitations under the License.
2307
- */var oe,W;function eT(n){switch(n){case P.OK:return U();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;default:return U()}}function Fh(n){if(n===void 0)return dt("GRPC error has no .code"),P.UNKNOWN;switch(n){case oe.OK:return P.OK;case oe.CANCELLED:return P.CANCELLED;case oe.UNKNOWN:return P.UNKNOWN;case oe.DEADLINE_EXCEEDED:return P.DEADLINE_EXCEEDED;case oe.RESOURCE_EXHAUSTED:return P.RESOURCE_EXHAUSTED;case oe.INTERNAL:return P.INTERNAL;case oe.UNAVAILABLE:return P.UNAVAILABLE;case oe.UNAUTHENTICATED:return P.UNAUTHENTICATED;case oe.INVALID_ARGUMENT:return P.INVALID_ARGUMENT;case oe.NOT_FOUND:return P.NOT_FOUND;case oe.ALREADY_EXISTS:return P.ALREADY_EXISTS;case oe.PERMISSION_DENIED:return P.PERMISSION_DENIED;case oe.FAILED_PRECONDITION:return P.FAILED_PRECONDITION;case oe.ABORTED:return P.ABORTED;case oe.OUT_OF_RANGE:return P.OUT_OF_RANGE;case oe.UNIMPLEMENTED:return P.UNIMPLEMENTED;case oe.DATA_LOSS:return P.DATA_LOSS;default:return U()}}(W=oe||(oe={}))[W.OK=0]="OK",W[W.CANCELLED=1]="CANCELLED",W[W.UNKNOWN=2]="UNKNOWN",W[W.INVALID_ARGUMENT=3]="INVALID_ARGUMENT",W[W.DEADLINE_EXCEEDED=4]="DEADLINE_EXCEEDED",W[W.NOT_FOUND=5]="NOT_FOUND",W[W.ALREADY_EXISTS=6]="ALREADY_EXISTS",W[W.PERMISSION_DENIED=7]="PERMISSION_DENIED",W[W.UNAUTHENTICATED=16]="UNAUTHENTICATED",W[W.RESOURCE_EXHAUSTED=8]="RESOURCE_EXHAUSTED",W[W.FAILED_PRECONDITION=9]="FAILED_PRECONDITION",W[W.ABORTED=10]="ABORTED",W[W.OUT_OF_RANGE=11]="OUT_OF_RANGE",W[W.UNIMPLEMENTED=12]="UNIMPLEMENTED",W[W.INTERNAL=13]="INTERNAL",W[W.UNAVAILABLE=14]="UNAVAILABLE",W[W.DATA_LOSS=15]="DATA_LOSS";/**
2336
+ */var oe,W;function uE(n){switch(n){case P.OK:return F(64938);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;default:return F(15467,{code:n})}}function Gh(n){if(n===void 0)return dt("GRPC error has no .code"),P.UNKNOWN;switch(n){case oe.OK:return P.OK;case oe.CANCELLED:return P.CANCELLED;case oe.UNKNOWN:return P.UNKNOWN;case oe.DEADLINE_EXCEEDED:return P.DEADLINE_EXCEEDED;case oe.RESOURCE_EXHAUSTED:return P.RESOURCE_EXHAUSTED;case oe.INTERNAL:return P.INTERNAL;case oe.UNAVAILABLE:return P.UNAVAILABLE;case oe.UNAUTHENTICATED:return P.UNAUTHENTICATED;case oe.INVALID_ARGUMENT:return P.INVALID_ARGUMENT;case oe.NOT_FOUND:return P.NOT_FOUND;case oe.ALREADY_EXISTS:return P.ALREADY_EXISTS;case oe.PERMISSION_DENIED:return P.PERMISSION_DENIED;case oe.FAILED_PRECONDITION:return P.FAILED_PRECONDITION;case oe.ABORTED:return P.ABORTED;case oe.OUT_OF_RANGE:return P.OUT_OF_RANGE;case oe.UNIMPLEMENTED:return P.UNIMPLEMENTED;case oe.DATA_LOSS:return P.DATA_LOSS;default:return F(39323,{code:n})}}(W=oe||(oe={}))[W.OK=0]="OK",W[W.CANCELLED=1]="CANCELLED",W[W.UNKNOWN=2]="UNKNOWN",W[W.INVALID_ARGUMENT=3]="INVALID_ARGUMENT",W[W.DEADLINE_EXCEEDED=4]="DEADLINE_EXCEEDED",W[W.NOT_FOUND=5]="NOT_FOUND",W[W.ALREADY_EXISTS=6]="ALREADY_EXISTS",W[W.PERMISSION_DENIED=7]="PERMISSION_DENIED",W[W.UNAUTHENTICATED=16]="UNAUTHENTICATED",W[W.RESOURCE_EXHAUSTED=8]="RESOURCE_EXHAUSTED",W[W.FAILED_PRECONDITION=9]="FAILED_PRECONDITION",W[W.ABORTED=10]="ABORTED",W[W.OUT_OF_RANGE=11]="OUT_OF_RANGE",W[W.UNIMPLEMENTED=12]="UNIMPLEMENTED",W[W.INTERNAL=13]="INTERNAL",W[W.UNAVAILABLE=14]="UNAVAILABLE",W[W.DATA_LOSS=15]="DATA_LOSS";/**
2308
2337
  * @license
2309
2338
  * Copyright 2022 Google LLC
2310
2339
  *
@@ -2319,7 +2348,7 @@ SPDX-License-Identifier: Apache-2.0
2319
2348
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2320
2349
  * See the License for the specific language governing permissions and
2321
2350
  * limitations under the License.
2322
- */const tT=new bt([4294967295,4294967295],0);function Cu(n){const e=uh().encode(n),t=new nh;return t.update(e),new Uint8Array(t.digest())}function ku(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 bt([t,r],0),new bt([s,i],0)]}class Go{constructor(e,t,r){if(this.bitmap=e,this.padding=t,this.hashCount=r,t<0||t>=8)throw new cr(`Invalid padding: ${t}`);if(r<0)throw new cr(`Invalid hash count: ${r}`);if(e.length>0&&this.hashCount===0)throw new cr(`Invalid hash count: ${r}`);if(e.length===0&&t!==0)throw new cr(`Invalid padding when bitmap length is 0: ${t}`);this.Ee=8*e.length-t,this.de=bt.fromNumber(this.Ee)}Ae(e,t,r){let s=e.add(t.multiply(bt.fromNumber(r)));return s.compare(tT)===1&&(s=new bt([s.getBits(0),s.getBits(1)],0)),s.modulo(this.de).toNumber()}Re(e){return!!(this.bitmap[Math.floor(e/8)]&1<<e%8)}mightContain(e){if(this.Ee===0)return!1;const t=Cu(e),[r,s]=ku(t);for(let i=0;i<this.hashCount;i++){const a=this.Ae(r,s,i);if(!this.Re(a))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)),a=new Go(i,s,t);return r.forEach(c=>a.insert(c)),a}insert(e){if(this.Ee===0)return;const t=Cu(e),[r,s]=ku(t);for(let i=0;i<this.hashCount;i++){const a=this.Ae(r,s,i);this.Ve(a)}}Ve(e){const t=Math.floor(e/8),r=e%8;this.bitmap[t]|=1<<r}}class cr extends Error{constructor(){super(...arguments),this.name="BloomFilterError"}}/**
2351
+ */const lE=new bt([4294967295,4294967295],0);function Ou(n){const e=gh().encode(n),t=new ch;return t.update(e),new Uint8Array(t.digest())}function Lu(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 bt([t,r],0),new bt([s,i],0)]}class Xo{constructor(e,t,r){if(this.bitmap=e,this.padding=t,this.hashCount=r,t<0||t>=8)throw new lr(`Invalid padding: ${t}`);if(r<0)throw new lr(`Invalid hash count: ${r}`);if(e.length>0&&this.hashCount===0)throw new lr(`Invalid hash count: ${r}`);if(e.length===0&&t!==0)throw new lr(`Invalid padding when bitmap length is 0: ${t}`);this.pe=8*e.length-t,this.ye=bt.fromNumber(this.pe)}we(e,t,r){let s=e.add(t.multiply(bt.fromNumber(r)));return s.compare(lE)===1&&(s=new bt([s.getBits(0),s.getBits(1)],0)),s.modulo(this.ye).toNumber()}Se(e){return!!(this.bitmap[Math.floor(e/8)]&1<<e%8)}mightContain(e){if(this.pe===0)return!1;const t=Ou(e),[r,s]=Lu(t);for(let i=0;i<this.hashCount;i++){const a=this.we(r,s,i);if(!this.Se(a))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)),a=new Xo(i,s,t);return r.forEach(c=>a.insert(c)),a}insert(e){if(this.pe===0)return;const t=Ou(e),[r,s]=Lu(t);for(let i=0;i<this.hashCount;i++){const a=this.we(r,s,i);this.be(a)}}be(e){const t=Math.floor(e/8),r=e%8;this.bitmap[t]|=1<<r}}class lr extends Error{constructor(){super(...arguments),this.name="BloomFilterError"}}/**
2323
2352
  * @license
2324
2353
  * Copyright 2017 Google LLC
2325
2354
  *
@@ -2334,7 +2363,7 @@ SPDX-License-Identifier: Apache-2.0
2334
2363
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2335
2364
  * See the License for the specific language governing permissions and
2336
2365
  * limitations under the License.
2337
- */class ii{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,Or.createSynthesizedTargetChangeForCurrentChange(e,t,r)),new ii(B.min(),s,new ne(H),ft(),G())}}class Or{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 Or(r,t,G(),G(),G())}}/**
2366
+ */class ui{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,xr.createSynthesizedTargetChangeForCurrentChange(e,t,r)),new ui(q.min(),s,new ne(z),ft(),G())}}class xr{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 xr(r,t,G(),G(),G())}}/**
2338
2367
  * @license
2339
2368
  * Copyright 2017 Google LLC
2340
2369
  *
@@ -2349,7 +2378,7 @@ SPDX-License-Identifier: Apache-2.0
2349
2378
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2350
2379
  * See the License for the specific language governing permissions and
2351
2380
  * limitations under the License.
2352
- */class Ts{constructor(e,t,r,s){this.me=e,this.removedTargetIds=t,this.key=r,this.fe=s}}class Bh{constructor(e,t){this.targetId=e,this.ge=t}}class qh{constructor(e,t,r=me.EMPTY_BYTE_STRING,s=null){this.state=e,this.targetIds=t,this.resumeToken=r,this.cause=s}}class Nu{constructor(){this.pe=0,this.ye=Du(),this.we=me.EMPTY_BYTE_STRING,this.Se=!1,this.be=!0}get current(){return this.Se}get resumeToken(){return this.we}get De(){return this.pe!==0}get ve(){return this.be}Ce(e){e.approximateByteSize()>0&&(this.be=!0,this.we=e)}Fe(){let e=G(),t=G(),r=G();return this.ye.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:U()}}),new Or(this.we,this.Se,e,t,r)}Me(){this.be=!1,this.ye=Du()}xe(e,t){this.be=!0,this.ye=this.ye.insert(e,t)}Oe(e){this.be=!0,this.ye=this.ye.remove(e)}Ne(){this.pe+=1}Be(){this.pe-=1,Q(this.pe>=0)}Le(){this.be=!0,this.Se=!0}}class nT{constructor(e){this.ke=e,this.qe=new Map,this.Qe=ft(),this.$e=as(),this.Ue=as(),this.Ke=new ne(H)}We(e){for(const t of e.me)e.fe&&e.fe.isFoundDocument()?this.Ge(t,e.fe):this.ze(t,e.key,e.fe);for(const t of e.removedTargetIds)this.ze(t,e.key,e.fe)}je(e){this.forEachTarget(e,t=>{const r=this.He(t);switch(e.state){case 0:this.Je(t)&&r.Ce(e.resumeToken);break;case 1:r.Be(),r.De||r.Me(),r.Ce(e.resumeToken);break;case 2:r.Be(),r.De||this.removeTarget(t);break;case 3:this.Je(t)&&(r.Le(),r.Ce(e.resumeToken));break;case 4:this.Je(t)&&(this.Ye(t),r.Ce(e.resumeToken));break;default:U()}})}forEachTarget(e,t){e.targetIds.length>0?e.targetIds.forEach(t):this.qe.forEach((r,s)=>{this.Je(s)&&t(s)})}Ze(e){const t=e.targetId,r=e.ge.count,s=this.Xe(t);if(s){const i=s.target;if(lo(i))if(r===0){const a=new L(i.path);this.ze(t,a,Ie.newNoDocument(a,B.min()))}else Q(r===1);else{const a=this.et(t);if(a!==r){const c=this.tt(e),l=c?this.nt(c,e,a):1;if(l!==0){this.Ye(t);const d=l===2?"TargetPurposeExistenceFilterMismatchBloom":"TargetPurposeExistenceFilterMismatch";this.Ke=this.Ke.insert(t,d)}}}}}tt(e){const t=e.ge.unchangedNames;if(!t||!t.bits)return null;const{bits:{bitmap:r="",padding:s=0},hashCount:i=0}=t;let a,c;try{a=Nt(r).toUint8Array()}catch(l){if(l instanceof fh)return Rn("Decoding the base64 bloom filter in existence filter failed ("+l.message+"); ignoring the bloom filter and falling back to full re-query."),null;throw l}try{c=new Go(a,s,i)}catch(l){return Rn(l instanceof cr?"BloomFilter error: ":"Applying bloom filter failed: ",l),null}return c.Ee===0?null:c}nt(e,t,r){return t.ge.count===r-this.st(e,t.targetId)?0:2}st(e,t){const r=this.ke.getRemoteKeysForTarget(t);let s=0;return r.forEach(i=>{const a=this.ke.it(),c=`projects/${a.projectId}/databases/${a.database}/documents/${i.path.canonicalString()}`;e.mightContain(c)||(this.ze(t,i,null),s++)}),s}ot(e){const t=new Map;this.qe.forEach((i,a)=>{const c=this.Xe(a);if(c){if(i.current&&lo(c.target)){const l=new L(c.target.path);this._t(l).has(a)||this.ut(a,l)||this.ze(a,l,Ie.newNoDocument(l,e))}i.ve&&(t.set(a,i.Fe()),i.Me())}});let r=G();this.Ue.forEach((i,a)=>{let c=!0;a.forEachWhile(l=>{const d=this.Xe(l);return!d||d.purpose==="TargetPurposeLimboResolution"||(c=!1,!1)}),c&&(r=r.add(i))}),this.Qe.forEach((i,a)=>a.setReadTime(e));const s=new ii(e,t,this.Ke,this.Qe,r);return this.Qe=ft(),this.$e=as(),this.Ue=as(),this.Ke=new ne(H),s}Ge(e,t){if(!this.Je(e))return;const r=this.ut(e,t.key)?2:0;this.He(e).xe(t.key,r),this.Qe=this.Qe.insert(t.key,t),this.$e=this.$e.insert(t.key,this._t(t.key).add(e)),this.Ue=this.Ue.insert(t.key,this.ct(t.key).add(e))}ze(e,t,r){if(!this.Je(e))return;const s=this.He(e);this.ut(e,t)?s.xe(t,1):s.Oe(t),this.Ue=this.Ue.insert(t,this.ct(t).delete(e)),this.Ue=this.Ue.insert(t,this.ct(t).add(e)),r&&(this.Qe=this.Qe.insert(t,r))}removeTarget(e){this.qe.delete(e)}et(e){const t=this.He(e).Fe();return this.ke.getRemoteKeysForTarget(e).size+t.addedDocuments.size-t.removedDocuments.size}Ne(e){this.He(e).Ne()}He(e){let t=this.qe.get(e);return t||(t=new Nu,this.qe.set(e,t)),t}ct(e){let t=this.Ue.get(e);return t||(t=new le(H),this.Ue=this.Ue.insert(e,t)),t}_t(e){let t=this.$e.get(e);return t||(t=new le(H),this.$e=this.$e.insert(e,t)),t}Je(e){const t=this.Xe(e)!==null;return t||V("WatchChangeAggregator","Detected inactive target",e),t}Xe(e){const t=this.qe.get(e);return t&&t.De?null:this.ke.lt(e)}Ye(e){this.qe.set(e,new Nu),this.ke.getRemoteKeysForTarget(e).forEach(t=>{this.ze(e,t,null)})}ut(e,t){return this.ke.getRemoteKeysForTarget(e).has(t)}}function as(){return new ne(L.comparator)}function Du(){return new ne(L.comparator)}const rT={asc:"ASCENDING",desc:"DESCENDING"},sT={"<":"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"},iT={and:"AND",or:"OR"};class oT{constructor(e,t){this.databaseId=e,this.useProto3Json=t}}function fo(n,e){return n.useProto3Json||Js(e)?e:{value:e}}function Us(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 $h(n,e){return n.useProto3Json?e.toBase64():e.toUint8Array()}function aT(n,e){return Us(n,e.toTimestamp())}function Je(n){return Q(!!n),B.fromTimestamp(function(t){const r=kt(t);return new ue(r.seconds,r.nanos)}(n))}function Wo(n,e){return po(n,e).canonicalString()}function po(n,e){const t=function(s){return new Y(["projects",s.projectId,"databases",s.database])}(n).child("documents");return e===void 0?t:t.child(e)}function jh(n){const e=Y.fromString(n);return Q(Kh(e)),e}function mo(n,e){return Wo(n.databaseId,e.path)}function zi(n,e){const t=jh(e);if(t.get(1)!==n.databaseId.projectId)throw new O(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 O(P.INVALID_ARGUMENT,"Tried to deserialize key from different database: "+t.get(3)+" vs "+n.databaseId.database);return new L(zh(t))}function Hh(n,e){return Wo(n.databaseId,e)}function cT(n){const e=jh(n);return e.length===4?Y.emptyPath():zh(e)}function go(n){return new Y(["projects",n.databaseId.projectId,"databases",n.databaseId.database]).canonicalString()}function zh(n){return Q(n.length>4&&n.get(4)==="documents"),n.popFirst(5)}function Ou(n,e,t){return{name:mo(n,e),fields:t.value.mapValue.fields}}function uT(n,e){let t;if("targetChange"in e){e.targetChange;const r=function(d){return d==="NO_CHANGE"?0:d==="ADD"?1:d==="REMOVE"?2:d==="CURRENT"?3:d==="RESET"?4:U()}(e.targetChange.targetChangeType||"NO_CHANGE"),s=e.targetChange.targetIds||[],i=function(d,f){return d.useProto3Json?(Q(f===void 0||typeof f=="string"),me.fromBase64String(f||"")):(Q(f===void 0||f instanceof Buffer||f instanceof Uint8Array),me.fromUint8Array(f||new Uint8Array))}(n,e.targetChange.resumeToken),a=e.targetChange.cause,c=a&&function(d){const f=d.code===void 0?P.UNKNOWN:Fh(d.code);return new O(f,d.message||"")}(a);t=new qh(r,s,i,c||null)}else if("documentChange"in e){e.documentChange;const r=e.documentChange;r.document,r.document.name,r.document.updateTime;const s=zi(n,r.document.name),i=Je(r.document.updateTime),a=r.document.createTime?Je(r.document.createTime):B.min(),c=new Ve({mapValue:{fields:r.document.fields}}),l=Ie.newFoundDocument(s,i,a,c),d=r.targetIds||[],f=r.removedTargetIds||[];t=new Ts(d,f,l.key,l)}else if("documentDelete"in e){e.documentDelete;const r=e.documentDelete;r.document;const s=zi(n,r.document),i=r.readTime?Je(r.readTime):B.min(),a=Ie.newNoDocument(s,i),c=r.removedTargetIds||[];t=new Ts([],c,a.key,a)}else if("documentRemove"in e){e.documentRemove;const r=e.documentRemove;r.document;const s=zi(n,r.document),i=r.removedTargetIds||[];t=new Ts([],i,s,null)}else{if(!("filter"in e))return U();{e.filter;const r=e.filter;r.targetId;const{count:s=0,unchangedNames:i}=r,a=new Zy(s,i),c=r.targetId;t=new Bh(c,a)}}return t}function lT(n,e){let t;if(e instanceof Dr)t={update:Ou(n,e.key,e.value)};else if(e instanceof Ho)t={delete:mo(n,e.key)};else if(e instanceof on)t={update:Ou(n,e.key,e.data),updateMask:TT(e.fieldMask)};else{if(!(e instanceof Xy))return U();t={verify:mo(n,e.key)}}return e.fieldTransforms.length>0&&(t.updateTransforms=e.fieldTransforms.map(r=>function(i,a){const c=a.transform;if(c instanceof Ms)return{fieldPath:a.field.canonicalString(),setToServerValue:"REQUEST_TIME"};if(c instanceof wr)return{fieldPath:a.field.canonicalString(),appendMissingElements:{values:c.elements}};if(c instanceof Ar)return{fieldPath:a.field.canonicalString(),removeAllFromArray:{values:c.elements}};if(c instanceof xs)return{fieldPath:a.field.canonicalString(),increment:c.Ie};throw U()}(0,r))),e.precondition.isNone||(t.currentDocument=function(s,i){return i.updateTime!==void 0?{updateTime:aT(s,i.updateTime)}:i.exists!==void 0?{exists:i.exists}:U()}(n,e.precondition)),t}function hT(n,e){return n&&n.length>0?(Q(e!==void 0),n.map(t=>function(s,i){let a=s.updateTime?Je(s.updateTime):Je(i);return a.isEqual(B.min())&&(a=Je(i)),new Wy(a,s.transformResults||[])}(t,e))):[]}function dT(n,e){return{documents:[Hh(n,e.path)]}}function fT(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=Hh(n,s);const i=function(d){if(d.length!==0)return Wh(je.create(d,"and"))}(e.filters);i&&(t.structuredQuery.where=i);const a=function(d){if(d.length!==0)return d.map(f=>function(E){return{field:gn(E.field),direction:gT(E.dir)}}(f))}(e.orderBy);a&&(t.structuredQuery.orderBy=a);const c=fo(n,e.limit);return c!==null&&(t.structuredQuery.limit=c),e.startAt&&(t.structuredQuery.startAt=function(d){return{before:d.inclusive,values:d.position}}(e.startAt)),e.endAt&&(t.structuredQuery.endAt=function(d){return{before:!d.inclusive,values:d.position}}(e.endAt)),{ht:t,parent:s}}function pT(n){let e=cT(n.parent);const t=n.structuredQuery,r=t.from?t.from.length:0;let s=null;if(r>0){Q(r===1);const f=t.from[0];f.allDescendants?s=f.collectionId:e=e.child(f.collectionId)}let i=[];t.where&&(i=function(m){const E=Gh(m);return E instanceof je&&wh(E)?E.getFilters():[E]}(t.where));let a=[];t.orderBy&&(a=function(m){return m.map(E=>function(C){return new Ir(_n(C.field),function(k){switch(k){case"ASCENDING":return"asc";case"DESCENDING":return"desc";default:return}}(C.direction))}(E))}(t.orderBy));let c=null;t.limit&&(c=function(m){let E;return E=typeof m=="object"?m.value:m,Js(E)?null:E}(t.limit));let l=null;t.startAt&&(l=function(m){const E=!!m.before,R=m.values||[];return new Cn(R,E)}(t.startAt));let d=null;return t.endAt&&(d=function(m){const E=!m.before,R=m.values||[];return new Cn(R,E)}(t.endAt)),Vy(e,s,a,i,c,"F",l,d)}function mT(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 U()}}(e.purpose);return t==null?null:{"goog-listen-tags":t}}function Gh(n){return n.unaryFilter!==void 0?function(t){switch(t.unaryFilter.op){case"IS_NAN":const r=_n(t.unaryFilter.field);return ae.create(r,"==",{doubleValue:NaN});case"IS_NULL":const s=_n(t.unaryFilter.field);return ae.create(s,"==",{nullValue:"NULL_VALUE"});case"IS_NOT_NAN":const i=_n(t.unaryFilter.field);return ae.create(i,"!=",{doubleValue:NaN});case"IS_NOT_NULL":const a=_n(t.unaryFilter.field);return ae.create(a,"!=",{nullValue:"NULL_VALUE"});default:return U()}}(n):n.fieldFilter!==void 0?function(t){return ae.create(_n(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 U()}}(t.fieldFilter.op),t.fieldFilter.value)}(n):n.compositeFilter!==void 0?function(t){return je.create(t.compositeFilter.filters.map(r=>Gh(r)),function(s){switch(s){case"AND":return"and";case"OR":return"or";default:return U()}}(t.compositeFilter.op))}(n):U()}function gT(n){return rT[n]}function _T(n){return sT[n]}function yT(n){return iT[n]}function gn(n){return{fieldPath:n.canonicalString()}}function _n(n){return pe.fromServerFormat(n.fieldPath)}function Wh(n){return n instanceof ae?function(t){if(t.op==="=="){if(Eu(t.value))return{unaryFilter:{field:gn(t.field),op:"IS_NAN"}};if(Tu(t.value))return{unaryFilter:{field:gn(t.field),op:"IS_NULL"}}}else if(t.op==="!="){if(Eu(t.value))return{unaryFilter:{field:gn(t.field),op:"IS_NOT_NAN"}};if(Tu(t.value))return{unaryFilter:{field:gn(t.field),op:"IS_NOT_NULL"}}}return{fieldFilter:{field:gn(t.field),op:_T(t.op),value:t.value}}}(n):n instanceof je?function(t){const r=t.getFilters().map(s=>Wh(s));return r.length===1?r[0]:{compositeFilter:{op:yT(t.op),filters:r}}}(n):U()}function TT(n){const e=[];return n.fields.forEach(t=>e.push(t.canonicalString())),{fieldPaths:e}}function Kh(n){return n.length>=4&&n.get(0)==="projects"&&n.get(2)==="databases"}/**
2381
+ */class Is{constructor(e,t,r,s){this.De=e,this.removedTargetIds=t,this.key=r,this.ve=s}}class Wh{constructor(e,t){this.targetId=e,this.Ce=t}}class Kh{constructor(e,t,r=me.EMPTY_BYTE_STRING,s=null){this.state=e,this.targetIds=t,this.resumeToken=r,this.cause=s}}class xu{constructor(){this.Fe=0,this.Me=Mu(),this.xe=me.EMPTY_BYTE_STRING,this.Oe=!1,this.Ne=!0}get current(){return this.Oe}get resumeToken(){return this.xe}get Be(){return this.Fe!==0}get Le(){return this.Ne}ke(e){e.approximateByteSize()>0&&(this.Ne=!0,this.xe=e)}qe(){let e=G(),t=G(),r=G();return this.Me.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:F(38017,{changeType:i})}}),new xr(this.xe,this.Oe,e,t,r)}Qe(){this.Ne=!1,this.Me=Mu()}$e(e,t){this.Ne=!0,this.Me=this.Me.insert(e,t)}Ue(e){this.Ne=!0,this.Me=this.Me.remove(e)}Ke(){this.Fe+=1}We(){this.Fe-=1,Q(this.Fe>=0,3241,{Fe:this.Fe})}Ge(){this.Ne=!0,this.Oe=!0}}class hE{constructor(e){this.ze=e,this.je=new Map,this.He=ft(),this.Je=ls(),this.Ye=ls(),this.Ze=new ne(z)}Xe(e){for(const t of e.De)e.ve&&e.ve.isFoundDocument()?this.et(t,e.ve):this.tt(t,e.key,e.ve);for(const t of e.removedTargetIds)this.tt(t,e.key,e.ve)}nt(e){this.forEachTarget(e,t=>{const r=this.rt(t);switch(e.state){case 0:this.it(t)&&r.ke(e.resumeToken);break;case 1:r.We(),r.Be||r.Qe(),r.ke(e.resumeToken);break;case 2:r.We(),r.Be||this.removeTarget(t);break;case 3:this.it(t)&&(r.Ge(),r.ke(e.resumeToken));break;case 4:this.it(t)&&(this.st(t),r.ke(e.resumeToken));break;default:F(56790,{state:e.state})}})}forEachTarget(e,t){e.targetIds.length>0?e.targetIds.forEach(t):this.je.forEach((r,s)=>{this.it(s)&&t(s)})}ot(e){const t=e.targetId,r=e.Ce.count,s=this._t(t);if(s){const i=s.target;if(mo(i))if(r===0){const a=new L(i.path);this.tt(t,a,Ie.newNoDocument(a,q.min()))}else Q(r===1,20013,{expectedCount:r});else{const a=this.ut(t);if(a!==r){const c=this.ct(e),l=c?this.lt(c,e,a):1;if(l!==0){this.st(t);const d=l===2?"TargetPurposeExistenceFilterMismatchBloom":"TargetPurposeExistenceFilterMismatch";this.Ze=this.Ze.insert(t,d)}}}}}ct(e){const t=e.Ce.unchangedNames;if(!t||!t.bits)return null;const{bits:{bitmap:r="",padding:s=0},hashCount:i=0}=t;let a,c;try{a=Nt(r).toUint8Array()}catch(l){if(l instanceof Th)return Pn("Decoding the base64 bloom filter in existence filter failed ("+l.message+"); ignoring the bloom filter and falling back to full re-query."),null;throw l}try{c=new Xo(a,s,i)}catch(l){return Pn(l instanceof lr?"BloomFilter error: ":"Applying bloom filter failed: ",l),null}return c.pe===0?null:c}lt(e,t,r){return t.Ce.count===r-this.Tt(e,t.targetId)?0:2}Tt(e,t){const r=this.ze.getRemoteKeysForTarget(t);let s=0;return r.forEach(i=>{const a=this.ze.Pt(),c=`projects/${a.projectId}/databases/${a.database}/documents/${i.path.canonicalString()}`;e.mightContain(c)||(this.tt(t,i,null),s++)}),s}It(e){const t=new Map;this.je.forEach((i,a)=>{const c=this._t(a);if(c){if(i.current&&mo(c.target)){const l=new L(c.target.path);this.Et(l).has(a)||this.dt(a,l)||this.tt(a,l,Ie.newNoDocument(l,e))}i.Le&&(t.set(a,i.qe()),i.Qe())}});let r=G();this.Ye.forEach((i,a)=>{let c=!0;a.forEachWhile(l=>{const d=this._t(l);return!d||d.purpose==="TargetPurposeLimboResolution"||(c=!1,!1)}),c&&(r=r.add(i))}),this.He.forEach((i,a)=>a.setReadTime(e));const s=new ui(e,t,this.Ze,this.He,r);return this.He=ft(),this.Je=ls(),this.Ye=ls(),this.Ze=new ne(z),s}et(e,t){if(!this.it(e))return;const r=this.dt(e,t.key)?2:0;this.rt(e).$e(t.key,r),this.He=this.He.insert(t.key,t),this.Je=this.Je.insert(t.key,this.Et(t.key).add(e)),this.Ye=this.Ye.insert(t.key,this.At(t.key).add(e))}tt(e,t,r){if(!this.it(e))return;const s=this.rt(e);this.dt(e,t)?s.$e(t,1):s.Ue(t),this.Ye=this.Ye.insert(t,this.At(t).delete(e)),this.Ye=this.Ye.insert(t,this.At(t).add(e)),r&&(this.He=this.He.insert(t,r))}removeTarget(e){this.je.delete(e)}ut(e){const t=this.rt(e).qe();return this.ze.getRemoteKeysForTarget(e).size+t.addedDocuments.size-t.removedDocuments.size}Ke(e){this.rt(e).Ke()}rt(e){let t=this.je.get(e);return t||(t=new xu,this.je.set(e,t)),t}At(e){let t=this.Ye.get(e);return t||(t=new le(z),this.Ye=this.Ye.insert(e,t)),t}Et(e){let t=this.Je.get(e);return t||(t=new le(z),this.Je=this.Je.insert(e,t)),t}it(e){const t=this._t(e)!==null;return t||O("WatchChangeAggregator","Detected inactive target",e),t}_t(e){const t=this.je.get(e);return t&&t.Be?null:this.ze.Rt(e)}st(e){this.je.set(e,new xu),this.ze.getRemoteKeysForTarget(e).forEach(t=>{this.tt(e,t,null)})}dt(e,t){return this.ze.getRemoteKeysForTarget(e).has(t)}}function ls(){return new ne(L.comparator)}function Mu(){return new ne(L.comparator)}const dE={asc:"ASCENDING",desc:"DESCENDING"},fE={"<":"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"},pE={and:"AND",or:"OR"};class mE{constructor(e,t){this.databaseId=e,this.useProto3Json=t}}function _o(n,e){return n.useProto3Json||ti(e)?e:{value:e}}function qs(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 Qh(n,e){return n.useProto3Json?e.toBase64():e.toUint8Array()}function gE(n,e){return qs(n,e.toTimestamp())}function Ye(n){return Q(!!n,49232),q.fromTimestamp(function(t){const r=kt(t);return new ue(r.seconds,r.nanos)}(n))}function Yo(n,e){return yo(n,e).canonicalString()}function yo(n,e){const t=function(s){return new J(["projects",s.projectId,"databases",s.database])}(n).child("documents");return e===void 0?t:t.child(e)}function Xh(n){const e=J.fromString(n);return Q(td(e),10190,{key:e.toString()}),e}function Eo(n,e){return Yo(n.databaseId,e.path)}function Qi(n,e){const t=Xh(e);if(t.get(1)!==n.databaseId.projectId)throw new V(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 V(P.INVALID_ARGUMENT,"Tried to deserialize key from different database: "+t.get(3)+" vs "+n.databaseId.database);return new L(Jh(t))}function Yh(n,e){return Yo(n.databaseId,e)}function _E(n){const e=Xh(n);return e.length===4?J.emptyPath():Jh(e)}function To(n){return new J(["projects",n.databaseId.projectId,"databases",n.databaseId.database]).canonicalString()}function Jh(n){return Q(n.length>4&&n.get(4)==="documents",29091,{key:n.toString()}),n.popFirst(5)}function Uu(n,e,t){return{name:Eo(n,e),fields:t.value.mapValue.fields}}function yE(n,e){let t;if("targetChange"in e){e.targetChange;const r=function(d){return d==="NO_CHANGE"?0:d==="ADD"?1:d==="REMOVE"?2:d==="CURRENT"?3:d==="RESET"?4:F(39313,{state:d})}(e.targetChange.targetChangeType||"NO_CHANGE"),s=e.targetChange.targetIds||[],i=function(d,f){return d.useProto3Json?(Q(f===void 0||typeof f=="string",58123),me.fromBase64String(f||"")):(Q(f===void 0||f instanceof Buffer||f instanceof Uint8Array,16193),me.fromUint8Array(f||new Uint8Array))}(n,e.targetChange.resumeToken),a=e.targetChange.cause,c=a&&function(d){const f=d.code===void 0?P.UNKNOWN:Gh(d.code);return new V(f,d.message||"")}(a);t=new Kh(r,s,i,c||null)}else if("documentChange"in e){e.documentChange;const r=e.documentChange;r.document,r.document.name,r.document.updateTime;const s=Qi(n,r.document.name),i=Ye(r.document.updateTime),a=r.document.createTime?Ye(r.document.createTime):q.min(),c=new Oe({mapValue:{fields:r.document.fields}}),l=Ie.newFoundDocument(s,i,a,c),d=r.targetIds||[],f=r.removedTargetIds||[];t=new Is(d,f,l.key,l)}else if("documentDelete"in e){e.documentDelete;const r=e.documentDelete;r.document;const s=Qi(n,r.document),i=r.readTime?Ye(r.readTime):q.min(),a=Ie.newNoDocument(s,i),c=r.removedTargetIds||[];t=new Is([],c,a.key,a)}else if("documentRemove"in e){e.documentRemove;const r=e.documentRemove;r.document;const s=Qi(n,r.document),i=r.removedTargetIds||[];t=new Is([],i,s,null)}else{if(!("filter"in e))return F(11601,{Vt:e});{e.filter;const r=e.filter;r.targetId;const{count:s=0,unchangedNames:i}=r,a=new cE(s,i),c=r.targetId;t=new Wh(c,a)}}return t}function EE(n,e){let t;if(e instanceof Lr)t={update:Uu(n,e.key,e.value)};else if(e instanceof Ko)t={delete:Eo(n,e.key)};else if(e instanceof cn)t={update:Uu(n,e.key,e.data),updateMask:SE(e.fieldMask)};else{if(!(e instanceof iE))return F(16599,{ft:e.type});t={verify:Eo(n,e.key)}}return e.fieldTransforms.length>0&&(t.updateTransforms=e.fieldTransforms.map(r=>function(i,a){const c=a.transform;if(c instanceof Fs)return{fieldPath:a.field.canonicalString(),setToServerValue:"REQUEST_TIME"};if(c instanceof br)return{fieldPath:a.field.canonicalString(),appendMissingElements:{values:c.elements}};if(c instanceof Pr)return{fieldPath:a.field.canonicalString(),removeAllFromArray:{values:c.elements}};if(c instanceof Bs)return{fieldPath:a.field.canonicalString(),increment:c.Re};throw F(20930,{transform:a.transform})}(0,r))),e.precondition.isNone||(t.currentDocument=function(s,i){return i.updateTime!==void 0?{updateTime:gE(s,i.updateTime)}:i.exists!==void 0?{exists:i.exists}:F(27497)}(n,e.precondition)),t}function TE(n,e){return n&&n.length>0?(Q(e!==void 0,14353),n.map(t=>function(s,i){let a=s.updateTime?Ye(s.updateTime):Ye(i);return a.isEqual(q.min())&&(a=Ye(i)),new nE(a,s.transformResults||[])}(t,e))):[]}function vE(n,e){return{documents:[Yh(n,e.path)]}}function IE(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=Yh(n,s);const i=function(d){if(d.length!==0)return ed($e.create(d,"and"))}(e.filters);i&&(t.structuredQuery.where=i);const a=function(d){if(d.length!==0)return d.map(f=>function(_){return{field:yn(_.field),direction:RE(_.dir)}}(f))}(e.orderBy);a&&(t.structuredQuery.orderBy=a);const c=_o(n,e.limit);return c!==null&&(t.structuredQuery.limit=c),e.startAt&&(t.structuredQuery.startAt=function(d){return{before:d.inclusive,values:d.position}}(e.startAt)),e.endAt&&(t.structuredQuery.endAt=function(d){return{before:!d.inclusive,values:d.position}}(e.endAt)),{gt:t,parent:s}}function wE(n){let e=_E(n.parent);const t=n.structuredQuery,r=t.from?t.from.length:0;let s=null;if(r>0){Q(r===1,65062);const f=t.from[0];f.allDescendants?s=f.collectionId:e=e.child(f.collectionId)}let i=[];t.where&&(i=function(m){const _=Zh(m);return _ instanceof $e&&kh(_)?_.getFilters():[_]}(t.where));let a=[];t.orderBy&&(a=function(m){return m.map(_=>function(S){return new Rr(En(S.field),function(k){switch(k){case"ASCENDING":return"asc";case"DESCENDING":return"desc";default:return}}(S.direction))}(_))}(t.orderBy));let c=null;t.limit&&(c=function(m){let _;return _=typeof m=="object"?m.value:m,ti(_)?null:_}(t.limit));let l=null;t.startAt&&(l=function(m){const _=!!m.before,R=m.values||[];return new Nn(R,_)}(t.startAt));let d=null;return t.endAt&&(d=function(m){const _=!m.before,R=m.values||[];return new Nn(R,_)}(t.endAt)),$y(e,s,a,i,c,"F",l,d)}function AE(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 F(28987,{purpose:s})}}(e.purpose);return t==null?null:{"goog-listen-tags":t}}function Zh(n){return n.unaryFilter!==void 0?function(t){switch(t.unaryFilter.op){case"IS_NAN":const r=En(t.unaryFilter.field);return ae.create(r,"==",{doubleValue:NaN});case"IS_NULL":const s=En(t.unaryFilter.field);return ae.create(s,"==",{nullValue:"NULL_VALUE"});case"IS_NOT_NAN":const i=En(t.unaryFilter.field);return ae.create(i,"!=",{doubleValue:NaN});case"IS_NOT_NULL":const a=En(t.unaryFilter.field);return ae.create(a,"!=",{nullValue:"NULL_VALUE"});case"OPERATOR_UNSPECIFIED":return F(61313);default:return F(60726)}}(n):n.fieldFilter!==void 0?function(t){return ae.create(En(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";case"OPERATOR_UNSPECIFIED":return F(58110);default:return F(50506)}}(t.fieldFilter.op),t.fieldFilter.value)}(n):n.compositeFilter!==void 0?function(t){return $e.create(t.compositeFilter.filters.map(r=>Zh(r)),function(s){switch(s){case"AND":return"and";case"OR":return"or";default:return F(1026)}}(t.compositeFilter.op))}(n):F(30097,{filter:n})}function RE(n){return dE[n]}function bE(n){return fE[n]}function PE(n){return pE[n]}function yn(n){return{fieldPath:n.canonicalString()}}function En(n){return pe.fromServerFormat(n.fieldPath)}function ed(n){return n instanceof ae?function(t){if(t.op==="=="){if(Ru(t.value))return{unaryFilter:{field:yn(t.field),op:"IS_NAN"}};if(Au(t.value))return{unaryFilter:{field:yn(t.field),op:"IS_NULL"}}}else if(t.op==="!="){if(Ru(t.value))return{unaryFilter:{field:yn(t.field),op:"IS_NOT_NAN"}};if(Au(t.value))return{unaryFilter:{field:yn(t.field),op:"IS_NOT_NULL"}}}return{fieldFilter:{field:yn(t.field),op:bE(t.op),value:t.value}}}(n):n instanceof $e?function(t){const r=t.getFilters().map(s=>ed(s));return r.length===1?r[0]:{compositeFilter:{op:PE(t.op),filters:r}}}(n):F(54877,{filter:n})}function SE(n){const e=[];return n.fields.forEach(t=>e.push(t.canonicalString())),{fieldPaths:e}}function td(n){return n.length>=4&&n.get(0)==="projects"&&n.get(2)==="databases"}/**
2353
2382
  * @license
2354
2383
  * Copyright 2017 Google LLC
2355
2384
  *
@@ -2364,7 +2393,7 @@ SPDX-License-Identifier: Apache-2.0
2364
2393
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2365
2394
  * See the License for the specific language governing permissions and
2366
2395
  * limitations under the License.
2367
- */class At{constructor(e,t,r,s,i=B.min(),a=B.min(),c=me.EMPTY_BYTE_STRING,l=null){this.target=e,this.targetId=t,this.purpose=r,this.sequenceNumber=s,this.snapshotVersion=i,this.lastLimboFreeSnapshotVersion=a,this.resumeToken=c,this.expectedCount=l}withSequenceNumber(e){return new At(this.target,this.targetId,this.purpose,e,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,this.expectedCount)}withResumeToken(e,t){return new At(this.target,this.targetId,this.purpose,this.sequenceNumber,t,this.lastLimboFreeSnapshotVersion,e,null)}withExpectedCount(e){return new At(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,e)}withLastLimboFreeSnapshotVersion(e){return new At(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,e,this.resumeToken,this.expectedCount)}}/**
2396
+ */class At{constructor(e,t,r,s,i=q.min(),a=q.min(),c=me.EMPTY_BYTE_STRING,l=null){this.target=e,this.targetId=t,this.purpose=r,this.sequenceNumber=s,this.snapshotVersion=i,this.lastLimboFreeSnapshotVersion=a,this.resumeToken=c,this.expectedCount=l}withSequenceNumber(e){return new At(this.target,this.targetId,this.purpose,e,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,this.expectedCount)}withResumeToken(e,t){return new At(this.target,this.targetId,this.purpose,this.sequenceNumber,t,this.lastLimboFreeSnapshotVersion,e,null)}withExpectedCount(e){return new At(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,e)}withLastLimboFreeSnapshotVersion(e){return new At(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,e,this.resumeToken,this.expectedCount)}}/**
2368
2397
  * @license
2369
2398
  * Copyright 2017 Google LLC
2370
2399
  *
@@ -2379,7 +2408,7 @@ SPDX-License-Identifier: Apache-2.0
2379
2408
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2380
2409
  * See the License for the specific language governing permissions and
2381
2410
  * limitations under the License.
2382
- */class ET{constructor(e){this.Tt=e}}function vT(n){const e=pT({parent:n.parent,structuredQuery:n.structuredQuery});return n.limitType==="LAST"?Ls(e,e.limit,"L"):e}/**
2411
+ */class CE{constructor(e){this.wt=e}}function kE(n){const e=wE({parent:n.parent,structuredQuery:n.structuredQuery});return n.limitType==="LAST"?Us(e,e.limit,"L"):e}/**
2383
2412
  * @license
2384
2413
  * Copyright 2019 Google LLC
2385
2414
  *
@@ -2394,7 +2423,7 @@ SPDX-License-Identifier: Apache-2.0
2394
2423
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2395
2424
  * See the License for the specific language governing permissions and
2396
2425
  * limitations under the License.
2397
- */class IT{constructor(){this.Tn=new wT}addToCollectionParentIndex(e,t){return this.Tn.add(t),S.resolve()}getCollectionParents(e,t){return S.resolve(this.Tn.getEntries(t))}addFieldIndex(e,t){return S.resolve()}deleteFieldIndex(e,t){return S.resolve()}deleteAllFieldIndexes(e){return S.resolve()}createTargetIndexes(e,t){return S.resolve()}getDocumentsMatchingTarget(e,t){return S.resolve(null)}getIndexType(e,t){return S.resolve(0)}getFieldIndexes(e,t){return S.resolve([])}getNextCollectionGroupToUpdate(e){return S.resolve(null)}getMinOffset(e,t){return S.resolve(Ct.min())}getMinOffsetFromCollectionGroup(e,t){return S.resolve(Ct.min())}updateCollectionGroup(e,t,r){return S.resolve()}updateIndexEntries(e,t){return S.resolve()}}class wT{constructor(){this.index={}}add(e){const t=e.lastSegment(),r=e.popLast(),s=this.index[t]||new le(Y.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 le(Y.comparator)).toArray()}}/**
2426
+ */class NE{constructor(){this.Cn=new DE}addToCollectionParentIndex(e,t){return this.Cn.add(t),C.resolve()}getCollectionParents(e,t){return C.resolve(this.Cn.getEntries(t))}addFieldIndex(e,t){return C.resolve()}deleteFieldIndex(e,t){return C.resolve()}deleteAllFieldIndexes(e){return C.resolve()}createTargetIndexes(e,t){return C.resolve()}getDocumentsMatchingTarget(e,t){return C.resolve(null)}getIndexType(e,t){return C.resolve(0)}getFieldIndexes(e,t){return C.resolve([])}getNextCollectionGroupToUpdate(e){return C.resolve(null)}getMinOffset(e,t){return C.resolve(Ct.min())}getMinOffsetFromCollectionGroup(e,t){return C.resolve(Ct.min())}updateCollectionGroup(e,t,r){return C.resolve()}updateIndexEntries(e,t){return C.resolve()}}class DE{constructor(){this.index={}}add(e){const t=e.lastSegment(),r=e.popLast(),s=this.index[t]||new le(J.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 le(J.comparator)).toArray()}}/**
2398
2427
  * @license
2399
2428
  * Copyright 2018 Google LLC
2400
2429
  *
@@ -2409,7 +2438,7 @@ SPDX-License-Identifier: Apache-2.0
2409
2438
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2410
2439
  * See the License for the specific language governing permissions and
2411
2440
  * limitations under the License.
2412
- */const Vu={didRun:!1,sequenceNumbersCollected:0,targetsRemoved:0,documentsRemoved:0},Qh=41943040;class Ce{static withCacheSize(e){return new Ce(e,Ce.DEFAULT_COLLECTION_PERCENTILE,Ce.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT)}constructor(e,t,r){this.cacheSizeCollectionThreshold=e,this.percentileToCollect=t,this.maximumSequenceNumbersToCollect=r}}/**
2441
+ */const Fu={didRun:!1,sequenceNumbersCollected:0,targetsRemoved:0,documentsRemoved:0},nd=41943040;class Ce{static withCacheSize(e){return new Ce(e,Ce.DEFAULT_COLLECTION_PERCENTILE,Ce.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT)}constructor(e,t,r){this.cacheSizeCollectionThreshold=e,this.percentileToCollect=t,this.maximumSequenceNumbersToCollect=r}}/**
2413
2442
  * @license
2414
2443
  * Copyright 2017 Google LLC
2415
2444
  *
@@ -2424,7 +2453,7 @@ SPDX-License-Identifier: Apache-2.0
2424
2453
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2425
2454
  * See the License for the specific language governing permissions and
2426
2455
  * limitations under the License.
2427
- */Ce.DEFAULT_COLLECTION_PERCENTILE=10,Ce.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT=1e3,Ce.DEFAULT=new Ce(Qh,Ce.DEFAULT_COLLECTION_PERCENTILE,Ce.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT),Ce.DISABLED=new Ce(-1,0,0);/**
2456
+ */Ce.DEFAULT_COLLECTION_PERCENTILE=10,Ce.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT=1e3,Ce.DEFAULT=new Ce(nd,Ce.DEFAULT_COLLECTION_PERCENTILE,Ce.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT),Ce.DISABLED=new Ce(-1,0,0);/**
2428
2457
  * @license
2429
2458
  * Copyright 2017 Google LLC
2430
2459
  *
@@ -2439,7 +2468,7 @@ SPDX-License-Identifier: Apache-2.0
2439
2468
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2440
2469
  * See the License for the specific language governing permissions and
2441
2470
  * limitations under the License.
2442
- */class kn{constructor(e){this.$n=e}next(){return this.$n+=2,this.$n}static Un(){return new kn(0)}static Kn(){return new kn(-1)}}/**
2471
+ */class Dn{constructor(e){this.ur=e}next(){return this.ur+=2,this.ur}static cr(){return new Dn(0)}static lr(){return new Dn(-1)}}/**
2443
2472
  * @license
2444
2473
  * Copyright 2020 Google LLC
2445
2474
  *
@@ -2454,12 +2483,12 @@ SPDX-License-Identifier: Apache-2.0
2454
2483
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2455
2484
  * See the License for the specific language governing permissions and
2456
2485
  * limitations under the License.
2457
- */const Lu="LruGarbageCollector",AT=1048576;function Mu([n,e],[t,r]){const s=H(n,t);return s===0?H(e,r):s}class RT{constructor(e){this.Hn=e,this.buffer=new le(Mu),this.Jn=0}Yn(){return++this.Jn}Zn(e){const t=[e,this.Yn()];if(this.buffer.size<this.Hn)this.buffer=this.buffer.add(t);else{const r=this.buffer.last();Mu(t,r)<0&&(this.buffer=this.buffer.delete(r).add(t))}}get maxValue(){return this.buffer.last()[0]}}class bT{constructor(e,t,r){this.garbageCollector=e,this.asyncQueue=t,this.localStore=r,this.Xn=null}start(){this.garbageCollector.params.cacheSizeCollectionThreshold!==-1&&this.er(6e4)}stop(){this.Xn&&(this.Xn.cancel(),this.Xn=null)}get started(){return this.Xn!==null}er(e){V(Lu,`Garbage collection scheduled in ${e}ms`),this.Xn=this.asyncQueue.enqueueAfterDelay("lru_garbage_collection",e,async()=>{this.Xn=null;try{await this.localStore.collectGarbage(this.garbageCollector)}catch(t){Mn(t)?V(Lu,"Ignoring IndexedDB error during garbage collection: ",t):await Ln(t)}await this.er(3e5)})}}class PT{constructor(e,t){this.tr=e,this.params=t}calculateTargetCount(e,t){return this.tr.nr(e).next(r=>Math.floor(t/100*r))}nthSequenceNumber(e,t){if(t===0)return S.resolve(Xs.ae);const r=new RT(t);return this.tr.forEachTarget(e,s=>r.Zn(s.sequenceNumber)).next(()=>this.tr.rr(e,s=>r.Zn(s))).next(()=>r.maxValue)}removeTargets(e,t,r){return this.tr.removeTargets(e,t,r)}removeOrphanedDocuments(e,t){return this.tr.removeOrphanedDocuments(e,t)}collect(e,t){return this.params.cacheSizeCollectionThreshold===-1?(V("LruGarbageCollector","Garbage collection skipped; disabled"),S.resolve(Vu)):this.getCacheSize(e).next(r=>r<this.params.cacheSizeCollectionThreshold?(V("LruGarbageCollector",`Garbage collection skipped; Cache size ${r} is lower than threshold ${this.params.cacheSizeCollectionThreshold}`),Vu):this.ir(e,t))}getCacheSize(e){return this.tr.getCacheSize(e)}ir(e,t){let r,s,i,a,c,l,d;const f=Date.now();return this.calculateTargetCount(e,this.params.percentileToCollect).next(m=>(m>this.params.maximumSequenceNumbersToCollect?(V("LruGarbageCollector",`Capping sequence numbers to collect down to the maximum of ${this.params.maximumSequenceNumbersToCollect} from ${m}`),s=this.params.maximumSequenceNumbersToCollect):s=m,a=Date.now(),this.nthSequenceNumber(e,s))).next(m=>(r=m,c=Date.now(),this.removeTargets(e,r,t))).next(m=>(i=m,l=Date.now(),this.removeOrphanedDocuments(e,r))).next(m=>(d=Date.now(),pn()<=z.DEBUG&&V("LruGarbageCollector",`LRU Garbage Collection
2486
+ */const Bu="LruGarbageCollector",VE=1048576;function qu([n,e],[t,r]){const s=z(n,t);return s===0?z(e,r):s}class OE{constructor(e){this.Er=e,this.buffer=new le(qu),this.dr=0}Ar(){return++this.dr}Rr(e){const t=[e,this.Ar()];if(this.buffer.size<this.Er)this.buffer=this.buffer.add(t);else{const r=this.buffer.last();qu(t,r)<0&&(this.buffer=this.buffer.delete(r).add(t))}}get maxValue(){return this.buffer.last()[0]}}class LE{constructor(e,t,r){this.garbageCollector=e,this.asyncQueue=t,this.localStore=r,this.Vr=null}start(){this.garbageCollector.params.cacheSizeCollectionThreshold!==-1&&this.mr(6e4)}stop(){this.Vr&&(this.Vr.cancel(),this.Vr=null)}get started(){return this.Vr!==null}mr(e){O(Bu,`Garbage collection scheduled in ${e}ms`),this.Vr=this.asyncQueue.enqueueAfterDelay("lru_garbage_collection",e,async()=>{this.Vr=null;try{await this.localStore.collectGarbage(this.garbageCollector)}catch(t){Un(t)?O(Bu,"Ignoring IndexedDB error during garbage collection: ",t):await Mn(t)}await this.mr(3e5)})}}class xE{constructor(e,t){this.gr=e,this.params=t}calculateTargetCount(e,t){return this.gr.pr(e).next(r=>Math.floor(t/100*r))}nthSequenceNumber(e,t){if(t===0)return C.resolve(ei.le);const r=new OE(t);return this.gr.forEachTarget(e,s=>r.Rr(s.sequenceNumber)).next(()=>this.gr.yr(e,s=>r.Rr(s))).next(()=>r.maxValue)}removeTargets(e,t,r){return this.gr.removeTargets(e,t,r)}removeOrphanedDocuments(e,t){return this.gr.removeOrphanedDocuments(e,t)}collect(e,t){return this.params.cacheSizeCollectionThreshold===-1?(O("LruGarbageCollector","Garbage collection skipped; disabled"),C.resolve(Fu)):this.getCacheSize(e).next(r=>r<this.params.cacheSizeCollectionThreshold?(O("LruGarbageCollector",`Garbage collection skipped; Cache size ${r} is lower than threshold ${this.params.cacheSizeCollectionThreshold}`),Fu):this.wr(e,t))}getCacheSize(e){return this.gr.getCacheSize(e)}wr(e,t){let r,s,i,a,c,l,d;const f=Date.now();return this.calculateTargetCount(e,this.params.percentileToCollect).next(m=>(m>this.params.maximumSequenceNumbersToCollect?(O("LruGarbageCollector",`Capping sequence numbers to collect down to the maximum of ${this.params.maximumSequenceNumbersToCollect} from ${m}`),s=this.params.maximumSequenceNumbersToCollect):s=m,a=Date.now(),this.nthSequenceNumber(e,s))).next(m=>(r=m,c=Date.now(),this.removeTargets(e,r,t))).next(m=>(i=m,l=Date.now(),this.removeOrphanedDocuments(e,r))).next(m=>(d=Date.now(),gn()<=H.DEBUG&&O("LruGarbageCollector",`LRU Garbage Collection
2458
2487
  Counted targets in ${a-f}ms
2459
2488
  Determined least recently used ${s} in `+(c-a)+`ms
2460
2489
  Removed ${i} targets in `+(l-c)+`ms
2461
2490
  Removed ${m} documents in `+(d-l)+`ms
2462
- Total Duration: ${d-f}ms`),S.resolve({didRun:!0,sequenceNumbersCollected:s,targetsRemoved:i,documentsRemoved:m})))}}function ST(n,e){return new PT(n,e)}/**
2491
+ Total Duration: ${d-f}ms`),C.resolve({didRun:!0,sequenceNumbersCollected:s,targetsRemoved:i,documentsRemoved:m})))}}function ME(n,e){return new xE(n,e)}/**
2463
2492
  * @license
2464
2493
  * Copyright 2017 Google LLC
2465
2494
  *
@@ -2474,7 +2503,7 @@ Total Duration: ${d-f}ms`),S.resolve({didRun:!0,sequenceNumbersCollected:s,targe
2474
2503
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2475
2504
  * See the License for the specific language governing permissions and
2476
2505
  * limitations under the License.
2477
- */class CT{constructor(){this.changes=new sn(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,Ie.newInvalidDocument(e).setReadTime(t))}getEntry(e,t){this.assertNotApplied();const r=this.changes.get(t);return r!==void 0?S.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(){}}/**
2506
+ */class UE{constructor(){this.changes=new an(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,Ie.newInvalidDocument(e).setReadTime(t))}getEntry(e,t){this.assertNotApplied();const r=this.changes.get(t);return r!==void 0?C.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(){}}/**
2478
2507
  * @license
2479
2508
  * Copyright 2017 Google LLC
2480
2509
  *
@@ -2504,7 +2533,7 @@ Total Duration: ${d-f}ms`),S.resolve({didRun:!0,sequenceNumbersCollected:s,targe
2504
2533
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2505
2534
  * See the License for the specific language governing permissions and
2506
2535
  * limitations under the License.
2507
- */class kT{constructor(e,t){this.overlayedDocument=e,this.mutatedFields=t}}/**
2536
+ */class FE{constructor(e,t){this.overlayedDocument=e,this.mutatedFields=t}}/**
2508
2537
  * @license
2509
2538
  * Copyright 2017 Google LLC
2510
2539
  *
@@ -2519,7 +2548,7 @@ Total Duration: ${d-f}ms`),S.resolve({didRun:!0,sequenceNumbersCollected:s,targe
2519
2548
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2520
2549
  * See the License for the specific language governing permissions and
2521
2550
  * limitations under the License.
2522
- */class NT{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&&fr(r.mutation,s,Be.empty(),ue.now()),s))}getDocuments(e,t){return this.remoteDocumentCache.getEntries(e,t).next(r=>this.getLocalViewOfDocuments(e,r,G()).next(()=>r))}getLocalViewOfDocuments(e,t,r=G()){const s=Wt();return this.populateOverlays(e,s,t).next(()=>this.computeViews(e,t,s,r).next(i=>{let a=ar();return i.forEach((c,l)=>{a=a.insert(c,l.overlayedDocument)}),a}))}getOverlayedDocuments(e,t){const r=Wt();return this.populateOverlays(e,r,t).next(()=>this.computeViews(e,t,r,G()))}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((a,c)=>{t.set(a,c)})})}computeViews(e,t,r,s){let i=ft();const a=dr(),c=function(){return dr()}();return t.forEach((l,d)=>{const f=r.get(d.key);s.has(d.key)&&(f===void 0||f.mutation instanceof on)?i=i.insert(d.key,d):f!==void 0?(a.set(d.key,f.mutation.getFieldMask()),fr(f.mutation,d,f.mutation.getFieldMask(),ue.now())):a.set(d.key,Be.empty())}),this.recalculateAndSaveOverlays(e,i).next(l=>(l.forEach((d,f)=>a.set(d,f)),t.forEach((d,f)=>{var m;return c.set(d,new kT(f,(m=a.get(d))!==null&&m!==void 0?m:null))}),c))}recalculateAndSaveOverlays(e,t){const r=dr();let s=new ne((a,c)=>a-c),i=G();return this.mutationQueue.getAllMutationBatchesAffectingDocumentKeys(e,t).next(a=>{for(const c of a)c.keys().forEach(l=>{const d=t.get(l);if(d===null)return;let f=r.get(l)||Be.empty();f=c.applyToLocalView(d,f),r.set(l,f);const m=(s.get(c.batchId)||G()).add(l);s=s.insert(c.batchId,m)})}).next(()=>{const a=[],c=s.getReverseIterator();for(;c.hasNext();){const l=c.getNext(),d=l.key,f=l.value,m=Nh();f.forEach(E=>{if(!i.has(E)){const R=xh(t.get(E),r.get(E));R!==null&&m.set(E,R),i=i.add(E)}}),a.push(this.documentOverlayCache.saveOverlays(e,d,m))}return S.waitFor(a)}).next(()=>r)}recalculateAndSaveOverlaysForDocumentKeys(e,t){return this.remoteDocumentCache.getEntries(e,t).next(r=>this.recalculateAndSaveOverlays(e,r))}getDocumentsMatchingQuery(e,t,r,s){return function(a){return L.isDocumentKey(a.path)&&a.collectionGroup===null&&a.filters.length===0}(t)?this.getDocumentsMatchingDocumentQuery(e,t.path):$o(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 a=s-i.size>0?this.documentOverlayCache.getOverlaysForCollectionGroup(e,t,r.largestBatchId,s-i.size):S.resolve(Wt());let c=yr,l=i;return a.next(d=>S.forEach(d,(f,m)=>(c<m.largestBatchId&&(c=m.largestBatchId),i.get(f)?S.resolve():this.remoteDocumentCache.getEntry(e,f).next(E=>{l=l.insert(f,E)}))).next(()=>this.populateOverlays(e,d,i)).next(()=>this.computeViews(e,l,d,G())).next(f=>({batchId:c,changes:kh(f)})))})}getDocumentsMatchingDocumentQuery(e,t){return this.getDocument(e,new L(t)).next(r=>{let s=ar();return r.isFoundDocument()&&(s=s.insert(r.key,r)),s})}getDocumentsMatchingCollectionGroupQuery(e,t,r,s){const i=t.collectionGroup;let a=ar();return this.indexManager.getCollectionParents(e,i).next(c=>S.forEach(c,l=>{const d=function(m,E){return new Ut(E,null,m.explicitOrderBy.slice(),m.filters.slice(),m.limit,m.limitType,m.startAt,m.endAt)}(t,l.child(i));return this.getDocumentsMatchingCollectionQuery(e,d,r,s).next(f=>{f.forEach((m,E)=>{a=a.insert(m,E)})})}).next(()=>a))}getDocumentsMatchingCollectionQuery(e,t,r,s){let i;return this.documentOverlayCache.getOverlaysForCollection(e,t.path,r.largestBatchId).next(a=>(i=a,this.remoteDocumentCache.getDocumentsMatchingQuery(e,t,r,i,s))).next(a=>{i.forEach((l,d)=>{const f=d.getKey();a.get(f)===null&&(a=a.insert(f,Ie.newInvalidDocument(f)))});let c=ar();return a.forEach((l,d)=>{const f=i.get(l);f!==void 0&&fr(f.mutation,d,Be.empty(),ue.now()),ni(t,d)&&(c=c.insert(l,d))}),c})}}/**
2551
+ */class BE{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&&gr(r.mutation,s,Be.empty(),ue.now()),s))}getDocuments(e,t){return this.remoteDocumentCache.getEntries(e,t).next(r=>this.getLocalViewOfDocuments(e,r,G()).next(()=>r))}getLocalViewOfDocuments(e,t,r=G()){const s=Qt();return this.populateOverlays(e,s,t).next(()=>this.computeViews(e,t,s,r).next(i=>{let a=ur();return i.forEach((c,l)=>{a=a.insert(c,l.overlayedDocument)}),a}))}getOverlayedDocuments(e,t){const r=Qt();return this.populateOverlays(e,r,t).next(()=>this.computeViews(e,t,r,G()))}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((a,c)=>{t.set(a,c)})})}computeViews(e,t,r,s){let i=ft();const a=mr(),c=function(){return mr()}();return t.forEach((l,d)=>{const f=r.get(d.key);s.has(d.key)&&(f===void 0||f.mutation instanceof cn)?i=i.insert(d.key,d):f!==void 0?(a.set(d.key,f.mutation.getFieldMask()),gr(f.mutation,d,f.mutation.getFieldMask(),ue.now())):a.set(d.key,Be.empty())}),this.recalculateAndSaveOverlays(e,i).next(l=>(l.forEach((d,f)=>a.set(d,f)),t.forEach((d,f)=>{var m;return c.set(d,new FE(f,(m=a.get(d))!==null&&m!==void 0?m:null))}),c))}recalculateAndSaveOverlays(e,t){const r=mr();let s=new ne((a,c)=>a-c),i=G();return this.mutationQueue.getAllMutationBatchesAffectingDocumentKeys(e,t).next(a=>{for(const c of a)c.keys().forEach(l=>{const d=t.get(l);if(d===null)return;let f=r.get(l)||Be.empty();f=c.applyToLocalView(d,f),r.set(l,f);const m=(s.get(c.batchId)||G()).add(l);s=s.insert(c.batchId,m)})}).next(()=>{const a=[],c=s.getReverseIterator();for(;c.hasNext();){const l=c.getNext(),d=l.key,f=l.value,m=Uh();f.forEach(_=>{if(!i.has(_)){const R=zh(t.get(_),r.get(_));R!==null&&m.set(_,R),i=i.add(_)}}),a.push(this.documentOverlayCache.saveOverlays(e,d,m))}return C.waitFor(a)}).next(()=>r)}recalculateAndSaveOverlaysForDocumentKeys(e,t){return this.remoteDocumentCache.getEntries(e,t).next(r=>this.recalculateAndSaveOverlays(e,r))}getDocumentsMatchingQuery(e,t,r,s){return function(a){return L.isDocumentKey(a.path)&&a.collectionGroup===null&&a.filters.length===0}(t)?this.getDocumentsMatchingDocumentQuery(e,t.path):Go(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 a=s-i.size>0?this.documentOverlayCache.getOverlaysForCollectionGroup(e,t,r.largestBatchId,s-i.size):C.resolve(Qt());let c=vr,l=i;return a.next(d=>C.forEach(d,(f,m)=>(c<m.largestBatchId&&(c=m.largestBatchId),i.get(f)?C.resolve():this.remoteDocumentCache.getEntry(e,f).next(_=>{l=l.insert(f,_)}))).next(()=>this.populateOverlays(e,d,i)).next(()=>this.computeViews(e,l,d,G())).next(f=>({batchId:c,changes:Mh(f)})))})}getDocumentsMatchingDocumentQuery(e,t){return this.getDocument(e,new L(t)).next(r=>{let s=ur();return r.isFoundDocument()&&(s=s.insert(r.key,r)),s})}getDocumentsMatchingCollectionGroupQuery(e,t,r,s){const i=t.collectionGroup;let a=ur();return this.indexManager.getCollectionParents(e,i).next(c=>C.forEach(c,l=>{const d=function(m,_){return new Bt(_,null,m.explicitOrderBy.slice(),m.filters.slice(),m.limit,m.limitType,m.startAt,m.endAt)}(t,l.child(i));return this.getDocumentsMatchingCollectionQuery(e,d,r,s).next(f=>{f.forEach((m,_)=>{a=a.insert(m,_)})})}).next(()=>a))}getDocumentsMatchingCollectionQuery(e,t,r,s){let i;return this.documentOverlayCache.getOverlaysForCollection(e,t.path,r.largestBatchId).next(a=>(i=a,this.remoteDocumentCache.getDocumentsMatchingQuery(e,t,r,i,s))).next(a=>{i.forEach((l,d)=>{const f=d.getKey();a.get(f)===null&&(a=a.insert(f,Ie.newInvalidDocument(f)))});let c=ur();return a.forEach((l,d)=>{const f=i.get(l);f!==void 0&&gr(f.mutation,d,Be.empty(),ue.now()),oi(t,d)&&(c=c.insert(l,d))}),c})}}/**
2523
2552
  * @license
2524
2553
  * Copyright 2020 Google LLC
2525
2554
  *
@@ -2534,7 +2563,7 @@ Total Duration: ${d-f}ms`),S.resolve({didRun:!0,sequenceNumbersCollected:s,targe
2534
2563
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2535
2564
  * See the License for the specific language governing permissions and
2536
2565
  * limitations under the License.
2537
- */class DT{constructor(e){this.serializer=e,this.dr=new Map,this.Ar=new Map}getBundleMetadata(e,t){return S.resolve(this.dr.get(t))}saveBundleMetadata(e,t){return this.dr.set(t.id,function(s){return{id:s.id,version:s.version,createTime:Je(s.createTime)}}(t)),S.resolve()}getNamedQuery(e,t){return S.resolve(this.Ar.get(t))}saveNamedQuery(e,t){return this.Ar.set(t.name,function(s){return{name:s.name,query:vT(s.bundledQuery),readTime:Je(s.readTime)}}(t)),S.resolve()}}/**
2566
+ */class qE{constructor(e){this.serializer=e,this.kr=new Map,this.qr=new Map}getBundleMetadata(e,t){return C.resolve(this.kr.get(t))}saveBundleMetadata(e,t){return this.kr.set(t.id,function(s){return{id:s.id,version:s.version,createTime:Ye(s.createTime)}}(t)),C.resolve()}getNamedQuery(e,t){return C.resolve(this.qr.get(t))}saveNamedQuery(e,t){return this.qr.set(t.name,function(s){return{name:s.name,query:kE(s.bundledQuery),readTime:Ye(s.readTime)}}(t)),C.resolve()}}/**
2538
2567
  * @license
2539
2568
  * Copyright 2022 Google LLC
2540
2569
  *
@@ -2549,7 +2578,7 @@ Total Duration: ${d-f}ms`),S.resolve({didRun:!0,sequenceNumbersCollected:s,targe
2549
2578
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2550
2579
  * See the License for the specific language governing permissions and
2551
2580
  * limitations under the License.
2552
- */class OT{constructor(){this.overlays=new ne(L.comparator),this.Rr=new Map}getOverlay(e,t){return S.resolve(this.overlays.get(t))}getOverlays(e,t){const r=Wt();return S.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.Et(e,t,i)}),S.resolve()}removeOverlaysForBatchId(e,t,r){const s=this.Rr.get(r);return s!==void 0&&(s.forEach(i=>this.overlays=this.overlays.remove(i)),this.Rr.delete(r)),S.resolve()}getOverlaysForCollection(e,t,r){const s=Wt(),i=t.length+1,a=new L(t.child("")),c=this.overlays.getIteratorFrom(a);for(;c.hasNext();){const l=c.getNext().value,d=l.getKey();if(!t.isPrefixOf(d.path))break;d.path.length===i&&l.largestBatchId>r&&s.set(l.getKey(),l)}return S.resolve(s)}getOverlaysForCollectionGroup(e,t,r,s){let i=new ne((d,f)=>d-f);const a=this.overlays.getIterator();for(;a.hasNext();){const d=a.getNext().value;if(d.getKey().getCollectionGroup()===t&&d.largestBatchId>r){let f=i.get(d.largestBatchId);f===null&&(f=Wt(),i=i.insert(d.largestBatchId,f)),f.set(d.getKey(),d)}}const c=Wt(),l=i.getIterator();for(;l.hasNext()&&(l.getNext().value.forEach((d,f)=>c.set(d,f)),!(c.size()>=s)););return S.resolve(c)}Et(e,t,r){const s=this.overlays.get(r.key);if(s!==null){const a=this.Rr.get(s.largestBatchId).delete(r.key);this.Rr.set(s.largestBatchId,a)}this.overlays=this.overlays.insert(r.key,new Yy(t,r));let i=this.Rr.get(t);i===void 0&&(i=G(),this.Rr.set(t,i)),this.Rr.set(t,i.add(r.key))}}/**
2581
+ */class jE{constructor(){this.overlays=new ne(L.comparator),this.Qr=new Map}getOverlay(e,t){return C.resolve(this.overlays.get(t))}getOverlays(e,t){const r=Qt();return C.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.bt(e,t,i)}),C.resolve()}removeOverlaysForBatchId(e,t,r){const s=this.Qr.get(r);return s!==void 0&&(s.forEach(i=>this.overlays=this.overlays.remove(i)),this.Qr.delete(r)),C.resolve()}getOverlaysForCollection(e,t,r){const s=Qt(),i=t.length+1,a=new L(t.child("")),c=this.overlays.getIteratorFrom(a);for(;c.hasNext();){const l=c.getNext().value,d=l.getKey();if(!t.isPrefixOf(d.path))break;d.path.length===i&&l.largestBatchId>r&&s.set(l.getKey(),l)}return C.resolve(s)}getOverlaysForCollectionGroup(e,t,r,s){let i=new ne((d,f)=>d-f);const a=this.overlays.getIterator();for(;a.hasNext();){const d=a.getNext().value;if(d.getKey().getCollectionGroup()===t&&d.largestBatchId>r){let f=i.get(d.largestBatchId);f===null&&(f=Qt(),i=i.insert(d.largestBatchId,f)),f.set(d.getKey(),d)}}const c=Qt(),l=i.getIterator();for(;l.hasNext()&&(l.getNext().value.forEach((d,f)=>c.set(d,f)),!(c.size()>=s)););return C.resolve(c)}bt(e,t,r){const s=this.overlays.get(r.key);if(s!==null){const a=this.Qr.get(s.largestBatchId).delete(r.key);this.Qr.set(s.largestBatchId,a)}this.overlays=this.overlays.insert(r.key,new aE(t,r));let i=this.Qr.get(t);i===void 0&&(i=G(),this.Qr.set(t,i)),this.Qr.set(t,i.add(r.key))}}/**
2553
2582
  * @license
2554
2583
  * Copyright 2024 Google LLC
2555
2584
  *
@@ -2564,7 +2593,7 @@ Total Duration: ${d-f}ms`),S.resolve({didRun:!0,sequenceNumbersCollected:s,targe
2564
2593
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2565
2594
  * See the License for the specific language governing permissions and
2566
2595
  * limitations under the License.
2567
- */class VT{constructor(){this.sessionToken=me.EMPTY_BYTE_STRING}getSessionToken(e){return S.resolve(this.sessionToken)}setSessionToken(e,t){return this.sessionToken=t,S.resolve()}}/**
2596
+ */class $E{constructor(){this.sessionToken=me.EMPTY_BYTE_STRING}getSessionToken(e){return C.resolve(this.sessionToken)}setSessionToken(e,t){return this.sessionToken=t,C.resolve()}}/**
2568
2597
  * @license
2569
2598
  * Copyright 2017 Google LLC
2570
2599
  *
@@ -2579,7 +2608,7 @@ Total Duration: ${d-f}ms`),S.resolve({didRun:!0,sequenceNumbersCollected:s,targe
2579
2608
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2580
2609
  * See the License for the specific language governing permissions and
2581
2610
  * limitations under the License.
2582
- */class Ko{constructor(){this.Vr=new le(he.mr),this.gr=new le(he.pr)}isEmpty(){return this.Vr.isEmpty()}addReference(e,t){const r=new he(e,t);this.Vr=this.Vr.add(r),this.gr=this.gr.add(r)}yr(e,t){e.forEach(r=>this.addReference(r,t))}removeReference(e,t){this.wr(new he(e,t))}Sr(e,t){e.forEach(r=>this.removeReference(r,t))}br(e){const t=new L(new Y([])),r=new he(t,e),s=new he(t,e+1),i=[];return this.gr.forEachInRange([r,s],a=>{this.wr(a),i.push(a.key)}),i}Dr(){this.Vr.forEach(e=>this.wr(e))}wr(e){this.Vr=this.Vr.delete(e),this.gr=this.gr.delete(e)}vr(e){const t=new L(new Y([])),r=new he(t,e),s=new he(t,e+1);let i=G();return this.gr.forEachInRange([r,s],a=>{i=i.add(a.key)}),i}containsKey(e){const t=new he(e,0),r=this.Vr.firstAfterOrEqual(t);return r!==null&&e.isEqual(r.key)}}class he{constructor(e,t){this.key=e,this.Cr=t}static mr(e,t){return L.comparator(e.key,t.key)||H(e.Cr,t.Cr)}static pr(e,t){return H(e.Cr,t.Cr)||L.comparator(e.key,t.key)}}/**
2611
+ */class Jo{constructor(){this.$r=new le(he.Ur),this.Kr=new le(he.Wr)}isEmpty(){return this.$r.isEmpty()}addReference(e,t){const r=new he(e,t);this.$r=this.$r.add(r),this.Kr=this.Kr.add(r)}Gr(e,t){e.forEach(r=>this.addReference(r,t))}removeReference(e,t){this.zr(new he(e,t))}jr(e,t){e.forEach(r=>this.removeReference(r,t))}Hr(e){const t=new L(new J([])),r=new he(t,e),s=new he(t,e+1),i=[];return this.Kr.forEachInRange([r,s],a=>{this.zr(a),i.push(a.key)}),i}Jr(){this.$r.forEach(e=>this.zr(e))}zr(e){this.$r=this.$r.delete(e),this.Kr=this.Kr.delete(e)}Yr(e){const t=new L(new J([])),r=new he(t,e),s=new he(t,e+1);let i=G();return this.Kr.forEachInRange([r,s],a=>{i=i.add(a.key)}),i}containsKey(e){const t=new he(e,0),r=this.$r.firstAfterOrEqual(t);return r!==null&&e.isEqual(r.key)}}class he{constructor(e,t){this.key=e,this.Zr=t}static Ur(e,t){return L.comparator(e.key,t.key)||z(e.Zr,t.Zr)}static Wr(e,t){return z(e.Zr,t.Zr)||L.comparator(e.key,t.key)}}/**
2583
2612
  * @license
2584
2613
  * Copyright 2017 Google LLC
2585
2614
  *
@@ -2594,7 +2623,7 @@ Total Duration: ${d-f}ms`),S.resolve({didRun:!0,sequenceNumbersCollected:s,targe
2594
2623
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2595
2624
  * See the License for the specific language governing permissions and
2596
2625
  * limitations under the License.
2597
- */class LT{constructor(e,t){this.indexManager=e,this.referenceDelegate=t,this.mutationQueue=[],this.Fr=1,this.Mr=new le(he.mr)}checkEmpty(e){return S.resolve(this.mutationQueue.length===0)}addMutationBatch(e,t,r,s){const i=this.Fr;this.Fr++,this.mutationQueue.length>0&&this.mutationQueue[this.mutationQueue.length-1];const a=new Jy(i,t,r,s);this.mutationQueue.push(a);for(const c of s)this.Mr=this.Mr.add(new he(c.key,i)),this.indexManager.addToCollectionParentIndex(e,c.key.path.popLast());return S.resolve(a)}lookupMutationBatch(e,t){return S.resolve(this.Or(t))}getNextMutationBatchAfterBatchId(e,t){const r=t+1,s=this.Nr(r),i=s<0?0:s;return S.resolve(this.mutationQueue.length>i?this.mutationQueue[i]:null)}getHighestUnacknowledgedBatchId(){return S.resolve(this.mutationQueue.length===0?Uo:this.Fr-1)}getAllMutationBatches(e){return S.resolve(this.mutationQueue.slice())}getAllMutationBatchesAffectingDocumentKey(e,t){const r=new he(t,0),s=new he(t,Number.POSITIVE_INFINITY),i=[];return this.Mr.forEachInRange([r,s],a=>{const c=this.Or(a.Cr);i.push(c)}),S.resolve(i)}getAllMutationBatchesAffectingDocumentKeys(e,t){let r=new le(H);return t.forEach(s=>{const i=new he(s,0),a=new he(s,Number.POSITIVE_INFINITY);this.Mr.forEachInRange([i,a],c=>{r=r.add(c.Cr)})}),S.resolve(this.Br(r))}getAllMutationBatchesAffectingQuery(e,t){const r=t.path,s=r.length+1;let i=r;L.isDocumentKey(i)||(i=i.child(""));const a=new he(new L(i),0);let c=new le(H);return this.Mr.forEachWhile(l=>{const d=l.key.path;return!!r.isPrefixOf(d)&&(d.length===s&&(c=c.add(l.Cr)),!0)},a),S.resolve(this.Br(c))}Br(e){const t=[];return e.forEach(r=>{const s=this.Or(r);s!==null&&t.push(s)}),t}removeMutationBatch(e,t){Q(this.Lr(t.batchId,"removed")===0),this.mutationQueue.shift();let r=this.Mr;return S.forEach(t.mutations,s=>{const i=new he(s.key,t.batchId);return r=r.delete(i),this.referenceDelegate.markPotentiallyOrphaned(e,s.key)}).next(()=>{this.Mr=r})}qn(e){}containsKey(e,t){const r=new he(t,0),s=this.Mr.firstAfterOrEqual(r);return S.resolve(t.isEqual(s&&s.key))}performConsistencyCheck(e){return this.mutationQueue.length,S.resolve()}Lr(e,t){return this.Nr(e)}Nr(e){return this.mutationQueue.length===0?0:e-this.mutationQueue[0].batchId}Or(e){const t=this.Nr(e);return t<0||t>=this.mutationQueue.length?null:this.mutationQueue[t]}}/**
2626
+ */class zE{constructor(e,t){this.indexManager=e,this.referenceDelegate=t,this.mutationQueue=[],this.nr=1,this.Xr=new le(he.Ur)}checkEmpty(e){return C.resolve(this.mutationQueue.length===0)}addMutationBatch(e,t,r,s){const i=this.nr;this.nr++,this.mutationQueue.length>0&&this.mutationQueue[this.mutationQueue.length-1];const a=new oE(i,t,r,s);this.mutationQueue.push(a);for(const c of s)this.Xr=this.Xr.add(new he(c.key,i)),this.indexManager.addToCollectionParentIndex(e,c.key.path.popLast());return C.resolve(a)}lookupMutationBatch(e,t){return C.resolve(this.ei(t))}getNextMutationBatchAfterBatchId(e,t){const r=t+1,s=this.ti(r),i=s<0?0:s;return C.resolve(this.mutationQueue.length>i?this.mutationQueue[i]:null)}getHighestUnacknowledgedBatchId(){return C.resolve(this.mutationQueue.length===0?jo:this.nr-1)}getAllMutationBatches(e){return C.resolve(this.mutationQueue.slice())}getAllMutationBatchesAffectingDocumentKey(e,t){const r=new he(t,0),s=new he(t,Number.POSITIVE_INFINITY),i=[];return this.Xr.forEachInRange([r,s],a=>{const c=this.ei(a.Zr);i.push(c)}),C.resolve(i)}getAllMutationBatchesAffectingDocumentKeys(e,t){let r=new le(z);return t.forEach(s=>{const i=new he(s,0),a=new he(s,Number.POSITIVE_INFINITY);this.Xr.forEachInRange([i,a],c=>{r=r.add(c.Zr)})}),C.resolve(this.ni(r))}getAllMutationBatchesAffectingQuery(e,t){const r=t.path,s=r.length+1;let i=r;L.isDocumentKey(i)||(i=i.child(""));const a=new he(new L(i),0);let c=new le(z);return this.Xr.forEachWhile(l=>{const d=l.key.path;return!!r.isPrefixOf(d)&&(d.length===s&&(c=c.add(l.Zr)),!0)},a),C.resolve(this.ni(c))}ni(e){const t=[];return e.forEach(r=>{const s=this.ei(r);s!==null&&t.push(s)}),t}removeMutationBatch(e,t){Q(this.ri(t.batchId,"removed")===0,55003),this.mutationQueue.shift();let r=this.Xr;return C.forEach(t.mutations,s=>{const i=new he(s.key,t.batchId);return r=r.delete(i),this.referenceDelegate.markPotentiallyOrphaned(e,s.key)}).next(()=>{this.Xr=r})}sr(e){}containsKey(e,t){const r=new he(t,0),s=this.Xr.firstAfterOrEqual(r);return C.resolve(t.isEqual(s&&s.key))}performConsistencyCheck(e){return this.mutationQueue.length,C.resolve()}ri(e,t){return this.ti(e)}ti(e){return this.mutationQueue.length===0?0:e-this.mutationQueue[0].batchId}ei(e){const t=this.ti(e);return t<0||t>=this.mutationQueue.length?null:this.mutationQueue[t]}}/**
2598
2627
  * @license
2599
2628
  * Copyright 2017 Google LLC
2600
2629
  *
@@ -2609,7 +2638,7 @@ Total Duration: ${d-f}ms`),S.resolve({didRun:!0,sequenceNumbersCollected:s,targe
2609
2638
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2610
2639
  * See the License for the specific language governing permissions and
2611
2640
  * limitations under the License.
2612
- */class MT{constructor(e){this.kr=e,this.docs=function(){return new ne(L.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,a=this.kr(t);return this.docs=this.docs.insert(r,{document:t.mutableCopy(),size:a}),this.size+=a-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 S.resolve(r?r.document.mutableCopy():Ie.newInvalidDocument(t))}getEntries(e,t){let r=ft();return t.forEach(s=>{const i=this.docs.get(s);r=r.insert(s,i?i.document.mutableCopy():Ie.newInvalidDocument(s))}),S.resolve(r)}getDocumentsMatchingQuery(e,t,r,s){let i=ft();const a=t.path,c=new L(a.child("__id-9223372036854775808__")),l=this.docs.getIteratorFrom(c);for(;l.hasNext();){const{key:d,value:{document:f}}=l.getNext();if(!a.isPrefixOf(d.path))break;d.path.length>a.length+1||dy(hy(f),r)<=0||(s.has(f.key)||ni(t,f))&&(i=i.insert(f.key,f.mutableCopy()))}return S.resolve(i)}getAllFromCollectionGroup(e,t,r,s){U()}qr(e,t){return S.forEach(this.docs,r=>t(r))}newChangeBuffer(e){return new xT(this)}getSize(e){return S.resolve(this.size)}}class xT extends CT{constructor(e){super(),this.Ir=e}applyChanges(e){const t=[];return this.changes.forEach((r,s)=>{s.isValidDocument()?t.push(this.Ir.addEntry(e,s)):this.Ir.removeEntry(r)}),S.waitFor(t)}getFromCache(e,t){return this.Ir.getEntry(e,t)}getAllFromCache(e,t){return this.Ir.getEntries(e,t)}}/**
2641
+ */class HE{constructor(e){this.ii=e,this.docs=function(){return new ne(L.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,a=this.ii(t);return this.docs=this.docs.insert(r,{document:t.mutableCopy(),size:a}),this.size+=a-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 C.resolve(r?r.document.mutableCopy():Ie.newInvalidDocument(t))}getEntries(e,t){let r=ft();return t.forEach(s=>{const i=this.docs.get(s);r=r.insert(s,i?i.document.mutableCopy():Ie.newInvalidDocument(s))}),C.resolve(r)}getDocumentsMatchingQuery(e,t,r,s){let i=ft();const a=t.path,c=new L(a.child("__id-9223372036854775808__")),l=this.docs.getIteratorFrom(c);for(;l.hasNext();){const{key:d,value:{document:f}}=l.getNext();if(!a.isPrefixOf(d.path))break;d.path.length>a.length+1||vy(Ty(f),r)<=0||(s.has(f.key)||oi(t,f))&&(i=i.insert(f.key,f.mutableCopy()))}return C.resolve(i)}getAllFromCollectionGroup(e,t,r,s){F(9500)}si(e,t){return C.forEach(this.docs,r=>t(r))}newChangeBuffer(e){return new GE(this)}getSize(e){return C.resolve(this.size)}}class GE extends UE{constructor(e){super(),this.Br=e}applyChanges(e){const t=[];return this.changes.forEach((r,s)=>{s.isValidDocument()?t.push(this.Br.addEntry(e,s)):this.Br.removeEntry(r)}),C.waitFor(t)}getFromCache(e,t){return this.Br.getEntry(e,t)}getAllFromCache(e,t){return this.Br.getEntries(e,t)}}/**
2613
2642
  * @license
2614
2643
  * Copyright 2017 Google LLC
2615
2644
  *
@@ -2624,7 +2653,7 @@ Total Duration: ${d-f}ms`),S.resolve({didRun:!0,sequenceNumbersCollected:s,targe
2624
2653
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2625
2654
  * See the License for the specific language governing permissions and
2626
2655
  * limitations under the License.
2627
- */class UT{constructor(e){this.persistence=e,this.Qr=new sn(t=>Bo(t),qo),this.lastRemoteSnapshotVersion=B.min(),this.highestTargetId=0,this.$r=0,this.Ur=new Ko,this.targetCount=0,this.Kr=kn.Un()}forEachTarget(e,t){return this.Qr.forEach((r,s)=>t(s)),S.resolve()}getLastRemoteSnapshotVersion(e){return S.resolve(this.lastRemoteSnapshotVersion)}getHighestSequenceNumber(e){return S.resolve(this.$r)}allocateTargetId(e){return this.highestTargetId=this.Kr.next(),S.resolve(this.highestTargetId)}setTargetsMetadata(e,t,r){return r&&(this.lastRemoteSnapshotVersion=r),t>this.$r&&(this.$r=t),S.resolve()}zn(e){this.Qr.set(e.target,e);const t=e.targetId;t>this.highestTargetId&&(this.Kr=new kn(t),this.highestTargetId=t),e.sequenceNumber>this.$r&&(this.$r=e.sequenceNumber)}addTargetData(e,t){return this.zn(t),this.targetCount+=1,S.resolve()}updateTargetData(e,t){return this.zn(t),S.resolve()}removeTargetData(e,t){return this.Qr.delete(t.target),this.Ur.br(t.targetId),this.targetCount-=1,S.resolve()}removeTargets(e,t,r){let s=0;const i=[];return this.Qr.forEach((a,c)=>{c.sequenceNumber<=t&&r.get(c.targetId)===null&&(this.Qr.delete(a),i.push(this.removeMatchingKeysForTargetId(e,c.targetId)),s++)}),S.waitFor(i).next(()=>s)}getTargetCount(e){return S.resolve(this.targetCount)}getTargetData(e,t){const r=this.Qr.get(t)||null;return S.resolve(r)}addMatchingKeys(e,t,r){return this.Ur.yr(t,r),S.resolve()}removeMatchingKeys(e,t,r){this.Ur.Sr(t,r);const s=this.persistence.referenceDelegate,i=[];return s&&t.forEach(a=>{i.push(s.markPotentiallyOrphaned(e,a))}),S.waitFor(i)}removeMatchingKeysForTargetId(e,t){return this.Ur.br(t),S.resolve()}getMatchingKeysForTargetId(e,t){const r=this.Ur.vr(t);return S.resolve(r)}containsKey(e,t){return S.resolve(this.Ur.containsKey(t))}}/**
2656
+ */class WE{constructor(e){this.persistence=e,this.oi=new an(t=>zo(t),Ho),this.lastRemoteSnapshotVersion=q.min(),this.highestTargetId=0,this._i=0,this.ai=new Jo,this.targetCount=0,this.ui=Dn.cr()}forEachTarget(e,t){return this.oi.forEach((r,s)=>t(s)),C.resolve()}getLastRemoteSnapshotVersion(e){return C.resolve(this.lastRemoteSnapshotVersion)}getHighestSequenceNumber(e){return C.resolve(this._i)}allocateTargetId(e){return this.highestTargetId=this.ui.next(),C.resolve(this.highestTargetId)}setTargetsMetadata(e,t,r){return r&&(this.lastRemoteSnapshotVersion=r),t>this._i&&(this._i=t),C.resolve()}Tr(e){this.oi.set(e.target,e);const t=e.targetId;t>this.highestTargetId&&(this.ui=new Dn(t),this.highestTargetId=t),e.sequenceNumber>this._i&&(this._i=e.sequenceNumber)}addTargetData(e,t){return this.Tr(t),this.targetCount+=1,C.resolve()}updateTargetData(e,t){return this.Tr(t),C.resolve()}removeTargetData(e,t){return this.oi.delete(t.target),this.ai.Hr(t.targetId),this.targetCount-=1,C.resolve()}removeTargets(e,t,r){let s=0;const i=[];return this.oi.forEach((a,c)=>{c.sequenceNumber<=t&&r.get(c.targetId)===null&&(this.oi.delete(a),i.push(this.removeMatchingKeysForTargetId(e,c.targetId)),s++)}),C.waitFor(i).next(()=>s)}getTargetCount(e){return C.resolve(this.targetCount)}getTargetData(e,t){const r=this.oi.get(t)||null;return C.resolve(r)}addMatchingKeys(e,t,r){return this.ai.Gr(t,r),C.resolve()}removeMatchingKeys(e,t,r){this.ai.jr(t,r);const s=this.persistence.referenceDelegate,i=[];return s&&t.forEach(a=>{i.push(s.markPotentiallyOrphaned(e,a))}),C.waitFor(i)}removeMatchingKeysForTargetId(e,t){return this.ai.Hr(t),C.resolve()}getMatchingKeysForTargetId(e,t){const r=this.ai.Yr(t);return C.resolve(r)}containsKey(e,t){return C.resolve(this.ai.containsKey(t))}}/**
2628
2657
  * @license
2629
2658
  * Copyright 2017 Google LLC
2630
2659
  *
@@ -2639,7 +2668,7 @@ Total Duration: ${d-f}ms`),S.resolve({didRun:!0,sequenceNumbersCollected:s,targe
2639
2668
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2640
2669
  * See the License for the specific language governing permissions and
2641
2670
  * limitations under the License.
2642
- */class Xh{constructor(e,t){this.Wr={},this.overlays={},this.Gr=new Xs(0),this.zr=!1,this.zr=!0,this.jr=new VT,this.referenceDelegate=e(this),this.Hr=new UT(this),this.indexManager=new IT,this.remoteDocumentCache=function(s){return new MT(s)}(r=>this.referenceDelegate.Jr(r)),this.serializer=new ET(t),this.Yr=new DT(this.serializer)}start(){return Promise.resolve()}shutdown(){return this.zr=!1,Promise.resolve()}get started(){return this.zr}setDatabaseDeletedListener(){}setNetworkEnabled(){}getIndexManager(e){return this.indexManager}getDocumentOverlayCache(e){let t=this.overlays[e.toKey()];return t||(t=new OT,this.overlays[e.toKey()]=t),t}getMutationQueue(e,t){let r=this.Wr[e.toKey()];return r||(r=new LT(t,this.referenceDelegate),this.Wr[e.toKey()]=r),r}getGlobalsCache(){return this.jr}getTargetCache(){return this.Hr}getRemoteDocumentCache(){return this.remoteDocumentCache}getBundleCache(){return this.Yr}runTransaction(e,t,r){V("MemoryPersistence","Starting transaction:",e);const s=new FT(this.Gr.next());return this.referenceDelegate.Zr(),r(s).next(i=>this.referenceDelegate.Xr(s).next(()=>i)).toPromise().then(i=>(s.raiseOnCommittedEvent(),i))}ei(e,t){return S.or(Object.values(this.Wr).map(r=>()=>r.containsKey(e,t)))}}class FT extends py{constructor(e){super(),this.currentSequenceNumber=e}}class Qo{constructor(e){this.persistence=e,this.ti=new Ko,this.ni=null}static ri(e){return new Qo(e)}get ii(){if(this.ni)return this.ni;throw U()}addReference(e,t,r){return this.ti.addReference(r,t),this.ii.delete(r.toString()),S.resolve()}removeReference(e,t,r){return this.ti.removeReference(r,t),this.ii.add(r.toString()),S.resolve()}markPotentiallyOrphaned(e,t){return this.ii.add(t.toString()),S.resolve()}removeTarget(e,t){this.ti.br(t.targetId).forEach(s=>this.ii.add(s.toString()));const r=this.persistence.getTargetCache();return r.getMatchingKeysForTargetId(e,t.targetId).next(s=>{s.forEach(i=>this.ii.add(i.toString()))}).next(()=>r.removeTargetData(e,t))}Zr(){this.ni=new Set}Xr(e){const t=this.persistence.getRemoteDocumentCache().newChangeBuffer();return S.forEach(this.ii,r=>{const s=L.fromPath(r);return this.si(e,s).next(i=>{i||t.removeEntry(s,B.min())})}).next(()=>(this.ni=null,t.apply(e)))}updateLimboDocument(e,t){return this.si(e,t).next(r=>{r?this.ii.delete(t.toString()):this.ii.add(t.toString())})}Jr(e){return 0}si(e,t){return S.or([()=>S.resolve(this.ti.containsKey(t)),()=>this.persistence.getTargetCache().containsKey(e,t),()=>this.persistence.ei(e,t)])}}class Fs{constructor(e,t){this.persistence=e,this.oi=new sn(r=>_y(r.path),(r,s)=>r.isEqual(s)),this.garbageCollector=ST(this,t)}static ri(e,t){return new Fs(e,t)}Zr(){}Xr(e){return S.resolve()}forEachTarget(e,t){return this.persistence.getTargetCache().forEachTarget(e,t)}nr(e){const t=this.sr(e);return this.persistence.getTargetCache().getTargetCount(e).next(r=>t.next(s=>r+s))}sr(e){let t=0;return this.rr(e,r=>{t++}).next(()=>t)}rr(e,t){return S.forEach(this.oi,(r,s)=>this.ar(e,r,s).next(i=>i?S.resolve():t(s)))}removeTargets(e,t,r){return this.persistence.getTargetCache().removeTargets(e,t,r)}removeOrphanedDocuments(e,t){let r=0;const s=this.persistence.getRemoteDocumentCache(),i=s.newChangeBuffer();return s.qr(e,a=>this.ar(e,a,t).next(c=>{c||(r++,i.removeEntry(a,B.min()))})).next(()=>i.apply(e)).next(()=>r)}markPotentiallyOrphaned(e,t){return this.oi.set(t,e.currentSequenceNumber),S.resolve()}removeTarget(e,t){const r=t.withSequenceNumber(e.currentSequenceNumber);return this.persistence.getTargetCache().updateTargetData(e,r)}addReference(e,t,r){return this.oi.set(r,e.currentSequenceNumber),S.resolve()}removeReference(e,t,r){return this.oi.set(r,e.currentSequenceNumber),S.resolve()}updateLimboDocument(e,t){return this.oi.set(t,e.currentSequenceNumber),S.resolve()}Jr(e){let t=e.key.toString().length;return e.isFoundDocument()&&(t+=gs(e.data.value)),t}ar(e,t,r){return S.or([()=>this.persistence.ei(e,t),()=>this.persistence.getTargetCache().containsKey(e,t),()=>{const s=this.oi.get(t);return S.resolve(s!==void 0&&s>r)}])}getCacheSize(e){return this.persistence.getRemoteDocumentCache().getSize(e)}}/**
2671
+ */class rd{constructor(e,t){this.ci={},this.overlays={},this.li=new ei(0),this.hi=!1,this.hi=!0,this.Pi=new $E,this.referenceDelegate=e(this),this.Ti=new WE(this),this.indexManager=new NE,this.remoteDocumentCache=function(s){return new HE(s)}(r=>this.referenceDelegate.Ii(r)),this.serializer=new CE(t),this.Ei=new qE(this.serializer)}start(){return Promise.resolve()}shutdown(){return this.hi=!1,Promise.resolve()}get started(){return this.hi}setDatabaseDeletedListener(){}setNetworkEnabled(){}getIndexManager(e){return this.indexManager}getDocumentOverlayCache(e){let t=this.overlays[e.toKey()];return t||(t=new jE,this.overlays[e.toKey()]=t),t}getMutationQueue(e,t){let r=this.ci[e.toKey()];return r||(r=new zE(t,this.referenceDelegate),this.ci[e.toKey()]=r),r}getGlobalsCache(){return this.Pi}getTargetCache(){return this.Ti}getRemoteDocumentCache(){return this.remoteDocumentCache}getBundleCache(){return this.Ei}runTransaction(e,t,r){O("MemoryPersistence","Starting transaction:",e);const s=new KE(this.li.next());return this.referenceDelegate.di(),r(s).next(i=>this.referenceDelegate.Ai(s).next(()=>i)).toPromise().then(i=>(s.raiseOnCommittedEvent(),i))}Ri(e,t){return C.or(Object.values(this.ci).map(r=>()=>r.containsKey(e,t)))}}class KE extends wy{constructor(e){super(),this.currentSequenceNumber=e}}class Zo{constructor(e){this.persistence=e,this.Vi=new Jo,this.mi=null}static fi(e){return new Zo(e)}get gi(){if(this.mi)return this.mi;throw F(60996)}addReference(e,t,r){return this.Vi.addReference(r,t),this.gi.delete(r.toString()),C.resolve()}removeReference(e,t,r){return this.Vi.removeReference(r,t),this.gi.add(r.toString()),C.resolve()}markPotentiallyOrphaned(e,t){return this.gi.add(t.toString()),C.resolve()}removeTarget(e,t){this.Vi.Hr(t.targetId).forEach(s=>this.gi.add(s.toString()));const r=this.persistence.getTargetCache();return r.getMatchingKeysForTargetId(e,t.targetId).next(s=>{s.forEach(i=>this.gi.add(i.toString()))}).next(()=>r.removeTargetData(e,t))}di(){this.mi=new Set}Ai(e){const t=this.persistence.getRemoteDocumentCache().newChangeBuffer();return C.forEach(this.gi,r=>{const s=L.fromPath(r);return this.pi(e,s).next(i=>{i||t.removeEntry(s,q.min())})}).next(()=>(this.mi=null,t.apply(e)))}updateLimboDocument(e,t){return this.pi(e,t).next(r=>{r?this.gi.delete(t.toString()):this.gi.add(t.toString())})}Ii(e){return 0}pi(e,t){return C.or([()=>C.resolve(this.Vi.containsKey(t)),()=>this.persistence.getTargetCache().containsKey(e,t),()=>this.persistence.Ri(e,t)])}}class js{constructor(e,t){this.persistence=e,this.yi=new an(r=>by(r.path),(r,s)=>r.isEqual(s)),this.garbageCollector=ME(this,t)}static fi(e,t){return new js(e,t)}di(){}Ai(e){return C.resolve()}forEachTarget(e,t){return this.persistence.getTargetCache().forEachTarget(e,t)}pr(e){const t=this.Sr(e);return this.persistence.getTargetCache().getTargetCount(e).next(r=>t.next(s=>r+s))}Sr(e){let t=0;return this.yr(e,r=>{t++}).next(()=>t)}yr(e,t){return C.forEach(this.yi,(r,s)=>this.Dr(e,r,s).next(i=>i?C.resolve():t(s)))}removeTargets(e,t,r){return this.persistence.getTargetCache().removeTargets(e,t,r)}removeOrphanedDocuments(e,t){let r=0;const s=this.persistence.getRemoteDocumentCache(),i=s.newChangeBuffer();return s.si(e,a=>this.Dr(e,a,t).next(c=>{c||(r++,i.removeEntry(a,q.min()))})).next(()=>i.apply(e)).next(()=>r)}markPotentiallyOrphaned(e,t){return this.yi.set(t,e.currentSequenceNumber),C.resolve()}removeTarget(e,t){const r=t.withSequenceNumber(e.currentSequenceNumber);return this.persistence.getTargetCache().updateTargetData(e,r)}addReference(e,t,r){return this.yi.set(r,e.currentSequenceNumber),C.resolve()}removeReference(e,t,r){return this.yi.set(r,e.currentSequenceNumber),C.resolve()}updateLimboDocument(e,t){return this.yi.set(t,e.currentSequenceNumber),C.resolve()}Ii(e){let t=e.key.toString().length;return e.isFoundDocument()&&(t+=Es(e.data.value)),t}Dr(e,t,r){return C.or([()=>this.persistence.Ri(e,t),()=>this.persistence.getTargetCache().containsKey(e,t),()=>{const s=this.yi.get(t);return C.resolve(s!==void 0&&s>r)}])}getCacheSize(e){return this.persistence.getRemoteDocumentCache().getSize(e)}}/**
2643
2672
  * @license
2644
2673
  * Copyright 2017 Google LLC
2645
2674
  *
@@ -2654,7 +2683,7 @@ Total Duration: ${d-f}ms`),S.resolve({didRun:!0,sequenceNumbersCollected:s,targe
2654
2683
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2655
2684
  * See the License for the specific language governing permissions and
2656
2685
  * limitations under the License.
2657
- */class Xo{constructor(e,t,r,s){this.targetId=e,this.fromCache=t,this.Hi=r,this.Ji=s}static Yi(e,t){let r=G(),s=G();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 Xo(e,t.fromCache,r,s)}}/**
2686
+ */class ea{constructor(e,t,r,s){this.targetId=e,this.fromCache=t,this.ds=r,this.As=s}static Rs(e,t){let r=G(),s=G();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 ea(e,t.fromCache,r,s)}}/**
2658
2687
  * @license
2659
2688
  * Copyright 2023 Google LLC
2660
2689
  *
@@ -2669,7 +2698,7 @@ Total Duration: ${d-f}ms`),S.resolve({didRun:!0,sequenceNumbersCollected:s,targe
2669
2698
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2670
2699
  * See the License for the specific language governing permissions and
2671
2700
  * limitations under the License.
2672
- */class BT{constructor(){this._documentReadCount=0}get documentReadCount(){return this._documentReadCount}incrementDocumentReadCount(e){this._documentReadCount+=e}}/**
2701
+ */class QE{constructor(){this._documentReadCount=0}get documentReadCount(){return this._documentReadCount}incrementDocumentReadCount(e){this._documentReadCount+=e}}/**
2673
2702
  * @license
2674
2703
  * Copyright 2019 Google LLC
2675
2704
  *
@@ -2684,7 +2713,7 @@ Total Duration: ${d-f}ms`),S.resolve({didRun:!0,sequenceNumbersCollected:s,targe
2684
2713
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2685
2714
  * See the License for the specific language governing permissions and
2686
2715
  * limitations under the License.
2687
- */class qT{constructor(){this.Zi=!1,this.Xi=!1,this.es=100,this.ts=function(){return lp()?8:my(we())>0?6:4}()}initialize(e,t){this.ns=e,this.indexManager=t,this.Zi=!0}getDocumentsMatchingQuery(e,t,r,s){const i={result:null};return this.rs(e,t).next(a=>{i.result=a}).next(()=>{if(!i.result)return this.ss(e,t,s,r).next(a=>{i.result=a})}).next(()=>{if(i.result)return;const a=new BT;return this._s(e,t,a).next(c=>{if(i.result=c,this.Xi)return this.us(e,t,a,c.size)})}).next(()=>i.result)}us(e,t,r,s){return r.documentReadCount<this.es?(pn()<=z.DEBUG&&V("QueryEngine","SDK will not create cache indexes for query:",mn(t),"since it only creates cache indexes for collection contains","more than or equal to",this.es,"documents"),S.resolve()):(pn()<=z.DEBUG&&V("QueryEngine","Query:",mn(t),"scans",r.documentReadCount,"local documents and returns",s,"documents as results."),r.documentReadCount>this.ts*s?(pn()<=z.DEBUG&&V("QueryEngine","The SDK decides to create cache indexes for query:",mn(t),"as using cache indexes may help improve performance."),this.indexManager.createTargetIndexes(e,Qe(t))):S.resolve())}rs(e,t){if(Au(t))return S.resolve(null);let r=Qe(t);return this.indexManager.getIndexType(e,r).next(s=>s===0?null:(t.limit!==null&&s===1&&(t=Ls(t,null,"F"),r=Qe(t)),this.indexManager.getDocumentsMatchingTarget(e,r).next(i=>{const a=G(...i);return this.ns.getDocuments(e,a).next(c=>this.indexManager.getMinOffset(e,r).next(l=>{const d=this.cs(t,c);return this.ls(t,d,a,l.readTime)?this.rs(e,Ls(t,null,"F")):this.hs(e,d,t,l)}))})))}ss(e,t,r,s){return Au(t)||s.isEqual(B.min())?S.resolve(null):this.ns.getDocuments(e,r).next(i=>{const a=this.cs(t,i);return this.ls(t,a,r,s)?S.resolve(null):(pn()<=z.DEBUG&&V("QueryEngine","Re-using previous result from %s to execute query: %s",s.toString(),mn(t)),this.hs(e,a,t,ly(s,yr)).next(c=>c))})}cs(e,t){let r=new le(Sh(e));return t.forEach((s,i)=>{ni(e,i)&&(r=r.add(i))}),r}ls(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)}_s(e,t,r){return pn()<=z.DEBUG&&V("QueryEngine","Using full collection scan to execute query:",mn(t)),this.ns.getDocumentsMatchingQuery(e,t,Ct.min(),r)}hs(e,t,r,s){return this.ns.getDocumentsMatchingQuery(e,r,s).next(i=>(t.forEach(a=>{i=i.insert(a.key,a)}),i))}}/**
2716
+ */class XE{constructor(){this.Vs=!1,this.fs=!1,this.gs=100,this.ps=function(){return Ep()?8:Ay(we())>0?6:4}()}initialize(e,t){this.ys=e,this.indexManager=t,this.Vs=!0}getDocumentsMatchingQuery(e,t,r,s){const i={result:null};return this.ws(e,t).next(a=>{i.result=a}).next(()=>{if(!i.result)return this.Ss(e,t,s,r).next(a=>{i.result=a})}).next(()=>{if(i.result)return;const a=new QE;return this.bs(e,t,a).next(c=>{if(i.result=c,this.fs)return this.Ds(e,t,a,c.size)})}).next(()=>i.result)}Ds(e,t,r,s){return r.documentReadCount<this.gs?(gn()<=H.DEBUG&&O("QueryEngine","SDK will not create cache indexes for query:",_n(t),"since it only creates cache indexes for collection contains","more than or equal to",this.gs,"documents"),C.resolve()):(gn()<=H.DEBUG&&O("QueryEngine","Query:",_n(t),"scans",r.documentReadCount,"local documents and returns",s,"documents as results."),r.documentReadCount>this.ps*s?(gn()<=H.DEBUG&&O("QueryEngine","The SDK decides to create cache indexes for query:",_n(t),"as using cache indexes may help improve performance."),this.indexManager.createTargetIndexes(e,Qe(t))):C.resolve())}ws(e,t){if(Cu(t))return C.resolve(null);let r=Qe(t);return this.indexManager.getIndexType(e,r).next(s=>s===0?null:(t.limit!==null&&s===1&&(t=Us(t,null,"F"),r=Qe(t)),this.indexManager.getDocumentsMatchingTarget(e,r).next(i=>{const a=G(...i);return this.ys.getDocuments(e,a).next(c=>this.indexManager.getMinOffset(e,r).next(l=>{const d=this.vs(t,c);return this.Cs(t,d,a,l.readTime)?this.ws(e,Us(t,null,"F")):this.Fs(e,d,t,l)}))})))}Ss(e,t,r,s){return Cu(t)||s.isEqual(q.min())?C.resolve(null):this.ys.getDocuments(e,r).next(i=>{const a=this.vs(t,i);return this.Cs(t,a,r,s)?C.resolve(null):(gn()<=H.DEBUG&&O("QueryEngine","Re-using previous result from %s to execute query: %s",s.toString(),_n(t)),this.Fs(e,a,t,Ey(s,vr)).next(c=>c))})}vs(e,t){let r=new le(Lh(e));return t.forEach((s,i)=>{oi(e,i)&&(r=r.add(i))}),r}Cs(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)}bs(e,t,r){return gn()<=H.DEBUG&&O("QueryEngine","Using full collection scan to execute query:",_n(t)),this.ys.getDocumentsMatchingQuery(e,t,Ct.min(),r)}Fs(e,t,r,s){return this.ys.getDocumentsMatchingQuery(e,r,s).next(i=>(t.forEach(a=>{i=i.insert(a.key,a)}),i))}}/**
2688
2717
  * @license
2689
2718
  * Copyright 2020 Google LLC
2690
2719
  *
@@ -2699,7 +2728,7 @@ Total Duration: ${d-f}ms`),S.resolve({didRun:!0,sequenceNumbersCollected:s,targe
2699
2728
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2700
2729
  * See the License for the specific language governing permissions and
2701
2730
  * limitations under the License.
2702
- */const Jo="LocalStore",$T=3e8;class jT{constructor(e,t,r,s){this.persistence=e,this.Ps=t,this.serializer=s,this.Ts=new ne(H),this.Is=new sn(i=>Bo(i),qo),this.Es=new Map,this.ds=e.getRemoteDocumentCache(),this.Hr=e.getTargetCache(),this.Yr=e.getBundleCache(),this.As(r)}As(e){this.documentOverlayCache=this.persistence.getDocumentOverlayCache(e),this.indexManager=this.persistence.getIndexManager(e),this.mutationQueue=this.persistence.getMutationQueue(e,this.indexManager),this.localDocuments=new NT(this.ds,this.mutationQueue,this.documentOverlayCache,this.indexManager),this.ds.setIndexManager(this.indexManager),this.Ps.initialize(this.localDocuments,this.indexManager)}collectGarbage(e){return this.persistence.runTransaction("Collect garbage","readwrite-primary",t=>e.collect(t,this.Ts))}}function HT(n,e,t,r){return new jT(n,e,t,r)}async function Jh(n,e){const t=q(n);return await t.persistence.runTransaction("Handle user change","readonly",r=>{let s;return t.mutationQueue.getAllMutationBatches(r).next(i=>(s=i,t.As(e),t.mutationQueue.getAllMutationBatches(r))).next(i=>{const a=[],c=[];let l=G();for(const d of s){a.push(d.batchId);for(const f of d.mutations)l=l.add(f.key)}for(const d of i){c.push(d.batchId);for(const f of d.mutations)l=l.add(f.key)}return t.localDocuments.getDocuments(r,l).next(d=>({Rs:d,removedBatchIds:a,addedBatchIds:c}))})})}function zT(n,e){const t=q(n);return t.persistence.runTransaction("Acknowledge batch","readwrite-primary",r=>{const s=e.batch.keys(),i=t.ds.newChangeBuffer({trackRemovals:!0});return function(c,l,d,f){const m=d.batch,E=m.keys();let R=S.resolve();return E.forEach(C=>{R=R.next(()=>f.getEntry(l,C)).next(N=>{const k=d.docVersions.get(C);Q(k!==null),N.version.compareTo(k)<0&&(m.applyToRemoteDocument(N,d),N.isValidDocument()&&(N.setReadTime(d.commitVersion),f.addEntry(N)))})}),R.next(()=>c.mutationQueue.removeMutationBatch(l,m))}(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(c){let l=G();for(let d=0;d<c.mutationResults.length;++d)c.mutationResults[d].transformResults.length>0&&(l=l.add(c.batch.mutations[d].key));return l}(e))).next(()=>t.localDocuments.getDocuments(r,s))})}function Yh(n){const e=q(n);return e.persistence.runTransaction("Get last remote snapshot version","readonly",t=>e.Hr.getLastRemoteSnapshotVersion(t))}function GT(n,e){const t=q(n),r=e.snapshotVersion;let s=t.Ts;return t.persistence.runTransaction("Apply remote event","readwrite-primary",i=>{const a=t.ds.newChangeBuffer({trackRemovals:!0});s=t.Ts;const c=[];e.targetChanges.forEach((f,m)=>{const E=s.get(m);if(!E)return;c.push(t.Hr.removeMatchingKeys(i,f.removedDocuments,m).next(()=>t.Hr.addMatchingKeys(i,f.addedDocuments,m)));let R=E.withSequenceNumber(i.currentSequenceNumber);e.targetMismatches.get(m)!==null?R=R.withResumeToken(me.EMPTY_BYTE_STRING,B.min()).withLastLimboFreeSnapshotVersion(B.min()):f.resumeToken.approximateByteSize()>0&&(R=R.withResumeToken(f.resumeToken,r)),s=s.insert(m,R),function(N,k,F){return N.resumeToken.approximateByteSize()===0||k.snapshotVersion.toMicroseconds()-N.snapshotVersion.toMicroseconds()>=$T?!0:F.addedDocuments.size+F.modifiedDocuments.size+F.removedDocuments.size>0}(E,R,f)&&c.push(t.Hr.updateTargetData(i,R))});let l=ft(),d=G();if(e.documentUpdates.forEach(f=>{e.resolvedLimboDocuments.has(f)&&c.push(t.persistence.referenceDelegate.updateLimboDocument(i,f))}),c.push(WT(i,a,e.documentUpdates).next(f=>{l=f.Vs,d=f.fs})),!r.isEqual(B.min())){const f=t.Hr.getLastRemoteSnapshotVersion(i).next(m=>t.Hr.setTargetsMetadata(i,i.currentSequenceNumber,r));c.push(f)}return S.waitFor(c).next(()=>a.apply(i)).next(()=>t.localDocuments.getLocalViewOfDocuments(i,l,d)).next(()=>l)}).then(i=>(t.Ts=s,i))}function WT(n,e,t){let r=G(),s=G();return t.forEach(i=>r=r.add(i)),e.getEntries(n,r).next(i=>{let a=ft();return t.forEach((c,l)=>{const d=i.get(c);l.isFoundDocument()!==d.isFoundDocument()&&(s=s.add(c)),l.isNoDocument()&&l.version.isEqual(B.min())?(e.removeEntry(c,l.readTime),a=a.insert(c,l)):!d.isValidDocument()||l.version.compareTo(d.version)>0||l.version.compareTo(d.version)===0&&d.hasPendingWrites?(e.addEntry(l),a=a.insert(c,l)):V(Jo,"Ignoring outdated watch update for ",c,". Current version:",d.version," Watch version:",l.version)}),{Vs:a,fs:s}})}function KT(n,e){const t=q(n);return t.persistence.runTransaction("Get next mutation batch","readonly",r=>(e===void 0&&(e=Uo),t.mutationQueue.getNextMutationBatchAfterBatchId(r,e)))}function QT(n,e){const t=q(n);return t.persistence.runTransaction("Allocate target","readwrite",r=>{let s;return t.Hr.getTargetData(r,e).next(i=>i?(s=i,S.resolve(s)):t.Hr.allocateTargetId(r).next(a=>(s=new At(e,a,"TargetPurposeListen",r.currentSequenceNumber),t.Hr.addTargetData(r,s).next(()=>s))))}).then(r=>{const s=t.Ts.get(r.targetId);return(s===null||r.snapshotVersion.compareTo(s.snapshotVersion)>0)&&(t.Ts=t.Ts.insert(r.targetId,r),t.Is.set(e,r.targetId)),r})}async function _o(n,e,t){const r=q(n),s=r.Ts.get(e),i=t?"readwrite":"readwrite-primary";try{t||await r.persistence.runTransaction("Release target",i,a=>r.persistence.referenceDelegate.removeTarget(a,s))}catch(a){if(!Mn(a))throw a;V(Jo,`Failed to update sequence numbers for target ${e}: ${a}`)}r.Ts=r.Ts.remove(e),r.Is.delete(s.target)}function xu(n,e,t){const r=q(n);let s=B.min(),i=G();return r.persistence.runTransaction("Execute query","readwrite",a=>function(l,d,f){const m=q(l),E=m.Is.get(f);return E!==void 0?S.resolve(m.Ts.get(E)):m.Hr.getTargetData(d,f)}(r,a,Qe(e)).next(c=>{if(c)return s=c.lastLimboFreeSnapshotVersion,r.Hr.getMatchingKeysForTargetId(a,c.targetId).next(l=>{i=l})}).next(()=>r.Ps.getDocumentsMatchingQuery(a,e,t?s:B.min(),t?i:G())).next(c=>(XT(r,My(e),c),{documents:c,gs:i})))}function XT(n,e,t){let r=n.Es.get(e)||B.min();t.forEach((s,i)=>{i.readTime.compareTo(r)>0&&(r=i.readTime)}),n.Es.set(e,r)}class Uu{constructor(){this.activeTargetIds=$y()}Ds(e){this.activeTargetIds=this.activeTargetIds.add(e)}vs(e){this.activeTargetIds=this.activeTargetIds.delete(e)}bs(){const e={activeTargetIds:this.activeTargetIds.toArray(),updateTimeMs:Date.now()};return JSON.stringify(e)}}class JT{constructor(){this.ho=new Uu,this.Po={},this.onlineStateHandler=null,this.sequenceNumberHandler=null}addPendingMutation(e){}updateMutationState(e,t,r){}addLocalQueryTarget(e,t=!0){return t&&this.ho.Ds(e),this.Po[e]||"not-current"}updateQueryState(e,t,r){this.Po[e]=t}removeLocalQueryTarget(e){this.ho.vs(e)}isLocalQueryTarget(e){return this.ho.activeTargetIds.has(e)}clearQueryState(e){delete this.Po[e]}getAllActiveQueryTargets(){return this.ho.activeTargetIds}isActiveQueryTarget(e){return this.ho.activeTargetIds.has(e)}start(){return this.ho=new Uu,Promise.resolve()}handleUserChange(e,t,r){}setOnlineState(e){}shutdown(){}writeSequenceNumber(e){}notifyBundleLoaded(e){}}/**
2731
+ */const ta="LocalStore",YE=3e8;class JE{constructor(e,t,r,s){this.persistence=e,this.Ms=t,this.serializer=s,this.xs=new ne(z),this.Os=new an(i=>zo(i),Ho),this.Ns=new Map,this.Bs=e.getRemoteDocumentCache(),this.Ti=e.getTargetCache(),this.Ei=e.getBundleCache(),this.Ls(r)}Ls(e){this.documentOverlayCache=this.persistence.getDocumentOverlayCache(e),this.indexManager=this.persistence.getIndexManager(e),this.mutationQueue=this.persistence.getMutationQueue(e,this.indexManager),this.localDocuments=new BE(this.Bs,this.mutationQueue,this.documentOverlayCache,this.indexManager),this.Bs.setIndexManager(this.indexManager),this.Ms.initialize(this.localDocuments,this.indexManager)}collectGarbage(e){return this.persistence.runTransaction("Collect garbage","readwrite-primary",t=>e.collect(t,this.xs))}}function ZE(n,e,t,r){return new JE(n,e,t,r)}async function sd(n,e){const t=j(n);return await t.persistence.runTransaction("Handle user change","readonly",r=>{let s;return t.mutationQueue.getAllMutationBatches(r).next(i=>(s=i,t.Ls(e),t.mutationQueue.getAllMutationBatches(r))).next(i=>{const a=[],c=[];let l=G();for(const d of s){a.push(d.batchId);for(const f of d.mutations)l=l.add(f.key)}for(const d of i){c.push(d.batchId);for(const f of d.mutations)l=l.add(f.key)}return t.localDocuments.getDocuments(r,l).next(d=>({ks:d,removedBatchIds:a,addedBatchIds:c}))})})}function eT(n,e){const t=j(n);return t.persistence.runTransaction("Acknowledge batch","readwrite-primary",r=>{const s=e.batch.keys(),i=t.Bs.newChangeBuffer({trackRemovals:!0});return function(c,l,d,f){const m=d.batch,_=m.keys();let R=C.resolve();return _.forEach(S=>{R=R.next(()=>f.getEntry(l,S)).next(N=>{const k=d.docVersions.get(S);Q(k!==null,48541),N.version.compareTo(k)<0&&(m.applyToRemoteDocument(N,d),N.isValidDocument()&&(N.setReadTime(d.commitVersion),f.addEntry(N)))})}),R.next(()=>c.mutationQueue.removeMutationBatch(l,m))}(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(c){let l=G();for(let d=0;d<c.mutationResults.length;++d)c.mutationResults[d].transformResults.length>0&&(l=l.add(c.batch.mutations[d].key));return l}(e))).next(()=>t.localDocuments.getDocuments(r,s))})}function id(n){const e=j(n);return e.persistence.runTransaction("Get last remote snapshot version","readonly",t=>e.Ti.getLastRemoteSnapshotVersion(t))}function tT(n,e){const t=j(n),r=e.snapshotVersion;let s=t.xs;return t.persistence.runTransaction("Apply remote event","readwrite-primary",i=>{const a=t.Bs.newChangeBuffer({trackRemovals:!0});s=t.xs;const c=[];e.targetChanges.forEach((f,m)=>{const _=s.get(m);if(!_)return;c.push(t.Ti.removeMatchingKeys(i,f.removedDocuments,m).next(()=>t.Ti.addMatchingKeys(i,f.addedDocuments,m)));let R=_.withSequenceNumber(i.currentSequenceNumber);e.targetMismatches.get(m)!==null?R=R.withResumeToken(me.EMPTY_BYTE_STRING,q.min()).withLastLimboFreeSnapshotVersion(q.min()):f.resumeToken.approximateByteSize()>0&&(R=R.withResumeToken(f.resumeToken,r)),s=s.insert(m,R),function(N,k,B){return N.resumeToken.approximateByteSize()===0||k.snapshotVersion.toMicroseconds()-N.snapshotVersion.toMicroseconds()>=YE?!0:B.addedDocuments.size+B.modifiedDocuments.size+B.removedDocuments.size>0}(_,R,f)&&c.push(t.Ti.updateTargetData(i,R))});let l=ft(),d=G();if(e.documentUpdates.forEach(f=>{e.resolvedLimboDocuments.has(f)&&c.push(t.persistence.referenceDelegate.updateLimboDocument(i,f))}),c.push(nT(i,a,e.documentUpdates).next(f=>{l=f.qs,d=f.Qs})),!r.isEqual(q.min())){const f=t.Ti.getLastRemoteSnapshotVersion(i).next(m=>t.Ti.setTargetsMetadata(i,i.currentSequenceNumber,r));c.push(f)}return C.waitFor(c).next(()=>a.apply(i)).next(()=>t.localDocuments.getLocalViewOfDocuments(i,l,d)).next(()=>l)}).then(i=>(t.xs=s,i))}function nT(n,e,t){let r=G(),s=G();return t.forEach(i=>r=r.add(i)),e.getEntries(n,r).next(i=>{let a=ft();return t.forEach((c,l)=>{const d=i.get(c);l.isFoundDocument()!==d.isFoundDocument()&&(s=s.add(c)),l.isNoDocument()&&l.version.isEqual(q.min())?(e.removeEntry(c,l.readTime),a=a.insert(c,l)):!d.isValidDocument()||l.version.compareTo(d.version)>0||l.version.compareTo(d.version)===0&&d.hasPendingWrites?(e.addEntry(l),a=a.insert(c,l)):O(ta,"Ignoring outdated watch update for ",c,". Current version:",d.version," Watch version:",l.version)}),{qs:a,Qs:s}})}function rT(n,e){const t=j(n);return t.persistence.runTransaction("Get next mutation batch","readonly",r=>(e===void 0&&(e=jo),t.mutationQueue.getNextMutationBatchAfterBatchId(r,e)))}function sT(n,e){const t=j(n);return t.persistence.runTransaction("Allocate target","readwrite",r=>{let s;return t.Ti.getTargetData(r,e).next(i=>i?(s=i,C.resolve(s)):t.Ti.allocateTargetId(r).next(a=>(s=new At(e,a,"TargetPurposeListen",r.currentSequenceNumber),t.Ti.addTargetData(r,s).next(()=>s))))}).then(r=>{const s=t.xs.get(r.targetId);return(s===null||r.snapshotVersion.compareTo(s.snapshotVersion)>0)&&(t.xs=t.xs.insert(r.targetId,r),t.Os.set(e,r.targetId)),r})}async function vo(n,e,t){const r=j(n),s=r.xs.get(e),i=t?"readwrite":"readwrite-primary";try{t||await r.persistence.runTransaction("Release target",i,a=>r.persistence.referenceDelegate.removeTarget(a,s))}catch(a){if(!Un(a))throw a;O(ta,`Failed to update sequence numbers for target ${e}: ${a}`)}r.xs=r.xs.remove(e),r.Os.delete(s.target)}function ju(n,e,t){const r=j(n);let s=q.min(),i=G();return r.persistence.runTransaction("Execute query","readwrite",a=>function(l,d,f){const m=j(l),_=m.Os.get(f);return _!==void 0?C.resolve(m.xs.get(_)):m.Ti.getTargetData(d,f)}(r,a,Qe(e)).next(c=>{if(c)return s=c.lastLimboFreeSnapshotVersion,r.Ti.getMatchingKeysForTargetId(a,c.targetId).next(l=>{i=l})}).next(()=>r.Ms.getDocumentsMatchingQuery(a,e,t?s:q.min(),t?i:G())).next(c=>(iT(r,Hy(e),c),{documents:c,$s:i})))}function iT(n,e,t){let r=n.Ns.get(e)||q.min();t.forEach((s,i)=>{i.readTime.compareTo(r)>0&&(r=i.readTime)}),n.Ns.set(e,r)}class $u{constructor(){this.activeTargetIds=Yy()}js(e){this.activeTargetIds=this.activeTargetIds.add(e)}Hs(e){this.activeTargetIds=this.activeTargetIds.delete(e)}zs(){const e={activeTargetIds:this.activeTargetIds.toArray(),updateTimeMs:Date.now()};return JSON.stringify(e)}}class oT{constructor(){this.xo=new $u,this.Oo={},this.onlineStateHandler=null,this.sequenceNumberHandler=null}addPendingMutation(e){}updateMutationState(e,t,r){}addLocalQueryTarget(e,t=!0){return t&&this.xo.js(e),this.Oo[e]||"not-current"}updateQueryState(e,t,r){this.Oo[e]=t}removeLocalQueryTarget(e){this.xo.Hs(e)}isLocalQueryTarget(e){return this.xo.activeTargetIds.has(e)}clearQueryState(e){delete this.Oo[e]}getAllActiveQueryTargets(){return this.xo.activeTargetIds}isActiveQueryTarget(e){return this.xo.activeTargetIds.has(e)}start(){return this.xo=new $u,Promise.resolve()}handleUserChange(e,t,r){}setOnlineState(e){}shutdown(){}writeSequenceNumber(e){}notifyBundleLoaded(e){}}/**
2703
2732
  * @license
2704
2733
  * Copyright 2019 Google LLC
2705
2734
  *
@@ -2714,7 +2743,7 @@ Total Duration: ${d-f}ms`),S.resolve({didRun:!0,sequenceNumbersCollected:s,targe
2714
2743
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2715
2744
  * See the License for the specific language governing permissions and
2716
2745
  * limitations under the License.
2717
- */class YT{To(e){}shutdown(){}}/**
2746
+ */class aT{No(e){}shutdown(){}}/**
2718
2747
  * @license
2719
2748
  * Copyright 2019 Google LLC
2720
2749
  *
@@ -2729,7 +2758,7 @@ Total Duration: ${d-f}ms`),S.resolve({didRun:!0,sequenceNumbersCollected:s,targe
2729
2758
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2730
2759
  * See the License for the specific language governing permissions and
2731
2760
  * limitations under the License.
2732
- */const Fu="ConnectivityMonitor";class Bu{constructor(){this.Io=()=>this.Eo(),this.Ao=()=>this.Ro(),this.Vo=[],this.mo()}To(e){this.Vo.push(e)}shutdown(){window.removeEventListener("online",this.Io),window.removeEventListener("offline",this.Ao)}mo(){window.addEventListener("online",this.Io),window.addEventListener("offline",this.Ao)}Eo(){V(Fu,"Network connectivity changed: AVAILABLE");for(const e of this.Vo)e(0)}Ro(){V(Fu,"Network connectivity changed: UNAVAILABLE");for(const e of this.Vo)e(1)}static D(){return typeof window<"u"&&window.addEventListener!==void 0&&window.removeEventListener!==void 0}}/**
2761
+ */const zu="ConnectivityMonitor";class Hu{constructor(){this.Bo=()=>this.Lo(),this.ko=()=>this.qo(),this.Qo=[],this.$o()}No(e){this.Qo.push(e)}shutdown(){window.removeEventListener("online",this.Bo),window.removeEventListener("offline",this.ko)}$o(){window.addEventListener("online",this.Bo),window.addEventListener("offline",this.ko)}Lo(){O(zu,"Network connectivity changed: AVAILABLE");for(const e of this.Qo)e(0)}qo(){O(zu,"Network connectivity changed: UNAVAILABLE");for(const e of this.Qo)e(1)}static C(){return typeof window<"u"&&window.addEventListener!==void 0&&window.removeEventListener!==void 0}}/**
2733
2762
  * @license
2734
2763
  * Copyright 2023 Google LLC
2735
2764
  *
@@ -2744,7 +2773,7 @@ Total Duration: ${d-f}ms`),S.resolve({didRun:!0,sequenceNumbersCollected:s,targe
2744
2773
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2745
2774
  * See the License for the specific language governing permissions and
2746
2775
  * limitations under the License.
2747
- */let cs=null;function yo(){return cs===null?cs=function(){return 268435456+Math.round(2147483648*Math.random())}():cs++,"0x"+cs.toString(16)}/**
2776
+ */let hs=null;function Io(){return hs===null?hs=function(){return 268435456+Math.round(2147483648*Math.random())}():hs++,"0x"+hs.toString(16)}/**
2748
2777
  * @license
2749
2778
  * Copyright 2020 Google LLC
2750
2779
  *
@@ -2759,7 +2788,7 @@ Total Duration: ${d-f}ms`),S.resolve({didRun:!0,sequenceNumbersCollected:s,targe
2759
2788
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2760
2789
  * See the License for the specific language governing permissions and
2761
2790
  * limitations under the License.
2762
- */const Gi="RestConnection",ZT={BatchGetDocuments:"batchGet",Commit:"commit",RunQuery:"runQuery",RunAggregationQuery:"runAggregationQuery"};class eE{get fo(){return!1}constructor(e){this.databaseInfo=e,this.databaseId=e.databaseId;const t=e.ssl?"https":"http",r=encodeURIComponent(this.databaseId.projectId),s=encodeURIComponent(this.databaseId.database);this.po=t+"://"+e.host,this.yo=`projects/${r}/databases/${s}`,this.wo=this.databaseId.database===Ds?`project_id=${r}`:`project_id=${r}&database_id=${s}`}So(e,t,r,s,i){const a=yo(),c=this.bo(e,t.toUriEncodedString());V(Gi,`Sending RPC '${e}' ${a}:`,c,r);const l={"google-cloud-resource-prefix":this.yo,"x-goog-request-params":this.wo};return this.Do(l,s,i),this.vo(e,c,l,r).then(d=>(V(Gi,`Received RPC '${e}' ${a}: `,d),d),d=>{throw Rn(Gi,`RPC '${e}' ${a} failed with error: `,d,"url: ",c,"request:",r),d})}Co(e,t,r,s,i,a){return this.So(e,t,r,s,i)}Do(e,t,r){e["X-Goog-Api-Client"]=function(){return"gl-js/ fire/"+Vn}(),e["Content-Type"]="text/plain",this.databaseInfo.appId&&(e["X-Firebase-GMPID"]=this.databaseInfo.appId),t&&t.headers.forEach((s,i)=>e[i]=s),r&&r.headers.forEach((s,i)=>e[i]=s)}bo(e,t){const r=ZT[e];return`${this.po}/v1/${t}:${r}`}terminate(){}}/**
2791
+ */const Xi="RestConnection",cT={BatchGetDocuments:"batchGet",Commit:"commit",RunQuery:"runQuery",RunAggregationQuery:"runAggregationQuery"};class uT{get Uo(){return!1}constructor(e){this.databaseInfo=e,this.databaseId=e.databaseId;const t=e.ssl?"https":"http",r=encodeURIComponent(this.databaseId.projectId),s=encodeURIComponent(this.databaseId.database);this.Ko=t+"://"+e.host,this.Wo=`projects/${r}/databases/${s}`,this.Go=this.databaseId.database===Ls?`project_id=${r}`:`project_id=${r}&database_id=${s}`}zo(e,t,r,s,i){const a=Io(),c=this.jo(e,t.toUriEncodedString());O(Xi,`Sending RPC '${e}' ${a}:`,c,r);const l={"google-cloud-resource-prefix":this.Wo,"x-goog-request-params":this.Go};this.Ho(l,s,i);const{host:d}=new URL(c),f=Lt(d);return this.Jo(e,c,l,r,f).then(m=>(O(Xi,`Received RPC '${e}' ${a}: `,m),m),m=>{throw Pn(Xi,`RPC '${e}' ${a} failed with error: `,m,"url: ",c,"request:",r),m})}Yo(e,t,r,s,i,a){return this.zo(e,t,r,s,i)}Ho(e,t,r){e["X-Goog-Api-Client"]=function(){return"gl-js/ fire/"+xn}(),e["Content-Type"]="text/plain",this.databaseInfo.appId&&(e["X-Firebase-GMPID"]=this.databaseInfo.appId),t&&t.headers.forEach((s,i)=>e[i]=s),r&&r.headers.forEach((s,i)=>e[i]=s)}jo(e,t){const r=cT[e];return`${this.Ko}/v1/${t}:${r}`}terminate(){}}/**
2763
2792
  * @license
2764
2793
  * Copyright 2017 Google LLC
2765
2794
  *
@@ -2774,7 +2803,7 @@ Total Duration: ${d-f}ms`),S.resolve({didRun:!0,sequenceNumbersCollected:s,targe
2774
2803
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2775
2804
  * See the License for the specific language governing permissions and
2776
2805
  * limitations under the License.
2777
- */class tE{constructor(e){this.Fo=e.Fo,this.Mo=e.Mo}xo(e){this.Oo=e}No(e){this.Bo=e}Lo(e){this.ko=e}onMessage(e){this.qo=e}close(){this.Mo()}send(e){this.Fo(e)}Qo(){this.Oo()}$o(){this.Bo()}Uo(e){this.ko(e)}Ko(e){this.qo(e)}}/**
2806
+ */class lT{constructor(e){this.Zo=e.Zo,this.Xo=e.Xo}e_(e){this.t_=e}n_(e){this.r_=e}i_(e){this.s_=e}onMessage(e){this.o_=e}close(){this.Xo()}send(e){this.Zo(e)}__(){this.t_()}a_(){this.r_()}u_(e){this.s_(e)}c_(e){this.o_(e)}}/**
2778
2807
  * @license
2779
2808
  * Copyright 2017 Google LLC
2780
2809
  *
@@ -2789,7 +2818,7 @@ Total Duration: ${d-f}ms`),S.resolve({didRun:!0,sequenceNumbersCollected:s,targe
2789
2818
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2790
2819
  * See the License for the specific language governing permissions and
2791
2820
  * limitations under the License.
2792
- */const Ee="WebChannelConnection";class nE extends eE{constructor(e){super(e),this.forceLongPolling=e.forceLongPolling,this.autoDetectLongPolling=e.autoDetectLongPolling,this.useFetchStreams=e.useFetchStreams,this.longPollingOptions=e.longPollingOptions}vo(e,t,r,s){const i=yo();return new Promise((a,c)=>{const l=new rh;l.setWithCredentials(!0),l.listenOnce(sh.COMPLETE,()=>{try{switch(l.getLastErrorCode()){case ms.NO_ERROR:const f=l.getResponseJson();V(Ee,`XHR for RPC '${e}' ${i} received:`,JSON.stringify(f)),a(f);break;case ms.TIMEOUT:V(Ee,`RPC '${e}' ${i} timed out`),c(new O(P.DEADLINE_EXCEEDED,"Request time out"));break;case ms.HTTP_ERROR:const m=l.getStatus();if(V(Ee,`RPC '${e}' ${i} failed with status:`,m,"response text:",l.getResponseText()),m>0){let E=l.getResponseJson();Array.isArray(E)&&(E=E[0]);const R=E==null?void 0:E.error;if(R&&R.status&&R.message){const C=function(k){const F=k.toLowerCase().replace(/_/g,"-");return Object.values(P).indexOf(F)>=0?F:P.UNKNOWN}(R.status);c(new O(C,R.message))}else c(new O(P.UNKNOWN,"Server responded with status "+l.getStatus()))}else c(new O(P.UNAVAILABLE,"Connection failed."));break;default:U()}}finally{V(Ee,`RPC '${e}' ${i} completed.`)}});const d=JSON.stringify(s);V(Ee,`RPC '${e}' ${i} sending request:`,s),l.send(t,"POST",d,r,15)})}Wo(e,t,r){const s=yo(),i=[this.po,"/","google.firestore.v1.Firestore","/",e,"/channel"],a=ah(),c=oh(),l={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},d=this.longPollingOptions.timeoutSeconds;d!==void 0&&(l.longPollingTimeout=Math.round(1e3*d)),this.useFetchStreams&&(l.useFetchStreams=!0),this.Do(l.initMessageHeaders,t,r),l.encodeInitMessageHeaders=!0;const f=i.join("");V(Ee,`Creating RPC '${e}' stream ${s}: ${f}`,l);const m=a.createWebChannel(f,l);let E=!1,R=!1;const C=new tE({Fo:k=>{R?V(Ee,`Not sending because RPC '${e}' stream ${s} is closed:`,k):(E||(V(Ee,`Opening RPC '${e}' stream ${s} transport.`),m.open(),E=!0),V(Ee,`RPC '${e}' stream ${s} sending:`,k),m.send(k))},Mo:()=>m.close()}),N=(k,F,$)=>{k.listen(F,M=>{try{$(M)}catch(j){setTimeout(()=>{throw j},0)}})};return N(m,or.EventType.OPEN,()=>{R||(V(Ee,`RPC '${e}' stream ${s} transport opened.`),C.Qo())}),N(m,or.EventType.CLOSE,()=>{R||(R=!0,V(Ee,`RPC '${e}' stream ${s} transport closed`),C.Uo())}),N(m,or.EventType.ERROR,k=>{R||(R=!0,Rn(Ee,`RPC '${e}' stream ${s} transport errored:`,k),C.Uo(new O(P.UNAVAILABLE,"The operation could not be completed")))}),N(m,or.EventType.MESSAGE,k=>{var F;if(!R){const $=k.data[0];Q(!!$);const M=$,j=(M==null?void 0:M.error)||((F=M[0])===null||F===void 0?void 0:F.error);if(j){V(Ee,`RPC '${e}' stream ${s} received error:`,j);const ce=j.status;let X=function(_){const T=oe[_];if(T!==void 0)return Fh(T)}(ce),v=j.message;X===void 0&&(X=P.INTERNAL,v="Unknown error status: "+ce+" with message "+j.message),R=!0,C.Uo(new O(X,v)),m.close()}else V(Ee,`RPC '${e}' stream ${s} received:`,$),C.Ko($)}}),N(c,ih.STAT_EVENT,k=>{k.stat===io.PROXY?V(Ee,`RPC '${e}' stream ${s} detected buffering proxy`):k.stat===io.NOPROXY&&V(Ee,`RPC '${e}' stream ${s} detected no buffering proxy`)}),setTimeout(()=>{C.$o()},0),C}}function Wi(){return typeof document<"u"?document:null}/**
2821
+ */const Te="WebChannelConnection";class hT extends uT{constructor(e){super(e),this.forceLongPolling=e.forceLongPolling,this.autoDetectLongPolling=e.autoDetectLongPolling,this.useFetchStreams=e.useFetchStreams,this.longPollingOptions=e.longPollingOptions}Jo(e,t,r,s,i){const a=Io();return new Promise((c,l)=>{const d=new uh;d.setWithCredentials(!0),d.listenOnce(lh.COMPLETE,()=>{try{switch(d.getLastErrorCode()){case ys.NO_ERROR:const m=d.getResponseJson();O(Te,`XHR for RPC '${e}' ${a} received:`,JSON.stringify(m)),c(m);break;case ys.TIMEOUT:O(Te,`RPC '${e}' ${a} timed out`),l(new V(P.DEADLINE_EXCEEDED,"Request time out"));break;case ys.HTTP_ERROR:const _=d.getStatus();if(O(Te,`RPC '${e}' ${a} failed with status:`,_,"response text:",d.getResponseText()),_>0){let R=d.getResponseJson();Array.isArray(R)&&(R=R[0]);const S=R==null?void 0:R.error;if(S&&S.status&&S.message){const N=function(B){const M=B.toLowerCase().replace(/_/g,"-");return Object.values(P).indexOf(M)>=0?M:P.UNKNOWN}(S.status);l(new V(N,S.message))}else l(new V(P.UNKNOWN,"Server responded with status "+d.getStatus()))}else l(new V(P.UNAVAILABLE,"Connection failed."));break;default:F(9055,{l_:e,streamId:a,h_:d.getLastErrorCode(),P_:d.getLastError()})}}finally{O(Te,`RPC '${e}' ${a} completed.`)}});const f=JSON.stringify(s);O(Te,`RPC '${e}' ${a} sending request:`,s),d.send(t,"POST",f,r,15)})}T_(e,t,r){const s=Io(),i=[this.Ko,"/","google.firestore.v1.Firestore","/",e,"/channel"],a=fh(),c=dh(),l={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},d=this.longPollingOptions.timeoutSeconds;d!==void 0&&(l.longPollingTimeout=Math.round(1e3*d)),this.useFetchStreams&&(l.useFetchStreams=!0),this.Ho(l.initMessageHeaders,t,r),l.encodeInitMessageHeaders=!0;const f=i.join("");O(Te,`Creating RPC '${e}' stream ${s}: ${f}`,l);const m=a.createWebChannel(f,l);let _=!1,R=!1;const S=new lT({Zo:k=>{R?O(Te,`Not sending because RPC '${e}' stream ${s} is closed:`,k):(_||(O(Te,`Opening RPC '${e}' stream ${s} transport.`),m.open(),_=!0),O(Te,`RPC '${e}' stream ${s} sending:`,k),m.send(k))},Xo:()=>m.close()}),N=(k,B,M)=>{k.listen(B,x=>{try{M(x)}catch($){setTimeout(()=>{throw $},0)}})};return N(m,cr.EventType.OPEN,()=>{R||(O(Te,`RPC '${e}' stream ${s} transport opened.`),S.__())}),N(m,cr.EventType.CLOSE,()=>{R||(R=!0,O(Te,`RPC '${e}' stream ${s} transport closed`),S.u_())}),N(m,cr.EventType.ERROR,k=>{R||(R=!0,Pn(Te,`RPC '${e}' stream ${s} transport errored. Name:`,k.name,"Message:",k.message),S.u_(new V(P.UNAVAILABLE,"The operation could not be completed")))}),N(m,cr.EventType.MESSAGE,k=>{var B;if(!R){const M=k.data[0];Q(!!M,16349);const x=M,$=(x==null?void 0:x.error)||((B=x[0])===null||B===void 0?void 0:B.error);if($){O(Te,`RPC '${e}' stream ${s} received error:`,$);const ce=$.status;let X=function(y){const T=oe[y];if(T!==void 0)return Gh(T)}(ce),v=$.message;X===void 0&&(X=P.INTERNAL,v="Unknown error status: "+ce+" with message "+$.message),R=!0,S.u_(new V(X,v)),m.close()}else O(Te,`RPC '${e}' stream ${s} received:`,M),S.c_(M)}}),N(c,hh.STAT_EVENT,k=>{k.stat===uo.PROXY?O(Te,`RPC '${e}' stream ${s} detected buffering proxy`):k.stat===uo.NOPROXY&&O(Te,`RPC '${e}' stream ${s} detected no buffering proxy`)}),setTimeout(()=>{S.a_()},0),S}}function Yi(){return typeof document<"u"?document:null}/**
2793
2822
  * @license
2794
2823
  * Copyright 2020 Google LLC
2795
2824
  *
@@ -2804,7 +2833,7 @@ Total Duration: ${d-f}ms`),S.resolve({didRun:!0,sequenceNumbersCollected:s,targe
2804
2833
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2805
2834
  * See the License for the specific language governing permissions and
2806
2835
  * limitations under the License.
2807
- */function oi(n){return new oT(n,!0)}/**
2836
+ */function li(n){return new mE(n,!0)}/**
2808
2837
  * @license
2809
2838
  * Copyright 2017 Google LLC
2810
2839
  *
@@ -2819,7 +2848,7 @@ Total Duration: ${d-f}ms`),S.resolve({didRun:!0,sequenceNumbersCollected:s,targe
2819
2848
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2820
2849
  * See the License for the specific language governing permissions and
2821
2850
  * limitations under the License.
2822
- */class Zh{constructor(e,t,r=1e3,s=1.5,i=6e4){this.Ti=e,this.timerId=t,this.Go=r,this.zo=s,this.jo=i,this.Ho=0,this.Jo=null,this.Yo=Date.now(),this.reset()}reset(){this.Ho=0}Zo(){this.Ho=this.jo}Xo(e){this.cancel();const t=Math.floor(this.Ho+this.e_()),r=Math.max(0,Date.now()-this.Yo),s=Math.max(0,t-r);s>0&&V("ExponentialBackoff",`Backing off for ${s} ms (base delay: ${this.Ho} ms, delay with jitter: ${t} ms, last attempt: ${r} ms ago)`),this.Jo=this.Ti.enqueueAfterDelay(this.timerId,s,()=>(this.Yo=Date.now(),e())),this.Ho*=this.zo,this.Ho<this.Go&&(this.Ho=this.Go),this.Ho>this.jo&&(this.Ho=this.jo)}t_(){this.Jo!==null&&(this.Jo.skipDelay(),this.Jo=null)}cancel(){this.Jo!==null&&(this.Jo.cancel(),this.Jo=null)}e_(){return(Math.random()-.5)*this.Ho}}/**
2851
+ */class od{constructor(e,t,r=1e3,s=1.5,i=6e4){this.xi=e,this.timerId=t,this.I_=r,this.E_=s,this.d_=i,this.A_=0,this.R_=null,this.V_=Date.now(),this.reset()}reset(){this.A_=0}m_(){this.A_=this.d_}f_(e){this.cancel();const t=Math.floor(this.A_+this.g_()),r=Math.max(0,Date.now()-this.V_),s=Math.max(0,t-r);s>0&&O("ExponentialBackoff",`Backing off for ${s} ms (base delay: ${this.A_} ms, delay with jitter: ${t} ms, last attempt: ${r} ms ago)`),this.R_=this.xi.enqueueAfterDelay(this.timerId,s,()=>(this.V_=Date.now(),e())),this.A_*=this.E_,this.A_<this.I_&&(this.A_=this.I_),this.A_>this.d_&&(this.A_=this.d_)}p_(){this.R_!==null&&(this.R_.skipDelay(),this.R_=null)}cancel(){this.R_!==null&&(this.R_.cancel(),this.R_=null)}g_(){return(Math.random()-.5)*this.A_}}/**
2823
2852
  * @license
2824
2853
  * Copyright 2017 Google LLC
2825
2854
  *
@@ -2834,7 +2863,7 @@ Total Duration: ${d-f}ms`),S.resolve({didRun:!0,sequenceNumbersCollected:s,targe
2834
2863
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2835
2864
  * See the License for the specific language governing permissions and
2836
2865
  * limitations under the License.
2837
- */const qu="PersistentStream";class ed{constructor(e,t,r,s,i,a,c,l){this.Ti=e,this.n_=r,this.r_=s,this.connection=i,this.authCredentialsProvider=a,this.appCheckCredentialsProvider=c,this.listener=l,this.state=0,this.i_=0,this.s_=null,this.o_=null,this.stream=null,this.__=0,this.a_=new Zh(e,t)}u_(){return this.state===1||this.state===5||this.c_()}c_(){return this.state===2||this.state===3}start(){this.__=0,this.state!==4?this.auth():this.l_()}async stop(){this.u_()&&await this.close(0)}h_(){this.state=0,this.a_.reset()}P_(){this.c_()&&this.s_===null&&(this.s_=this.Ti.enqueueAfterDelay(this.n_,6e4,()=>this.T_()))}I_(e){this.E_(),this.stream.send(e)}async T_(){if(this.c_())return this.close(0)}E_(){this.s_&&(this.s_.cancel(),this.s_=null)}d_(){this.o_&&(this.o_.cancel(),this.o_=null)}async close(e,t){this.E_(),this.d_(),this.a_.cancel(),this.i_++,e!==4?this.a_.reset():t&&t.code===P.RESOURCE_EXHAUSTED?(dt(t.toString()),dt("Using maximum backoff delay to prevent overloading the backend."),this.a_.Zo()):t&&t.code===P.UNAUTHENTICATED&&this.state!==3&&(this.authCredentialsProvider.invalidateToken(),this.appCheckCredentialsProvider.invalidateToken()),this.stream!==null&&(this.A_(),this.stream.close(),this.stream=null),this.state=e,await this.listener.Lo(t)}A_(){}auth(){this.state=1;const e=this.R_(this.i_),t=this.i_;Promise.all([this.authCredentialsProvider.getToken(),this.appCheckCredentialsProvider.getToken()]).then(([r,s])=>{this.i_===t&&this.V_(r,s)},r=>{e(()=>{const s=new O(P.UNKNOWN,"Fetching auth token failed: "+r.message);return this.m_(s)})})}V_(e,t){const r=this.R_(this.i_);this.stream=this.f_(e,t),this.stream.xo(()=>{r(()=>this.listener.xo())}),this.stream.No(()=>{r(()=>(this.state=2,this.o_=this.Ti.enqueueAfterDelay(this.r_,1e4,()=>(this.c_()&&(this.state=3),Promise.resolve())),this.listener.No()))}),this.stream.Lo(s=>{r(()=>this.m_(s))}),this.stream.onMessage(s=>{r(()=>++this.__==1?this.g_(s):this.onNext(s))})}l_(){this.state=5,this.a_.Xo(async()=>{this.state=0,this.start()})}m_(e){return V(qu,`close with error: ${e}`),this.stream=null,this.close(4,e)}R_(e){return t=>{this.Ti.enqueueAndForget(()=>this.i_===e?t():(V(qu,"stream callback skipped by getCloseGuardedDispatcher."),Promise.resolve()))}}}class rE extends ed{constructor(e,t,r,s,i,a){super(e,"listen_stream_connection_backoff","listen_stream_idle","health_check_timeout",t,r,s,a),this.serializer=i}f_(e,t){return this.connection.Wo("Listen",e,t)}g_(e){return this.onNext(e)}onNext(e){this.a_.reset();const t=uT(this.serializer,e),r=function(i){if(!("targetChange"in i))return B.min();const a=i.targetChange;return a.targetIds&&a.targetIds.length?B.min():a.readTime?Je(a.readTime):B.min()}(e);return this.listener.p_(t,r)}y_(e){const t={};t.database=go(this.serializer),t.addTarget=function(i,a){let c;const l=a.target;if(c=lo(l)?{documents:dT(i,l)}:{query:fT(i,l).ht},c.targetId=a.targetId,a.resumeToken.approximateByteSize()>0){c.resumeToken=$h(i,a.resumeToken);const d=fo(i,a.expectedCount);d!==null&&(c.expectedCount=d)}else if(a.snapshotVersion.compareTo(B.min())>0){c.readTime=Us(i,a.snapshotVersion.toTimestamp());const d=fo(i,a.expectedCount);d!==null&&(c.expectedCount=d)}return c}(this.serializer,e);const r=mT(this.serializer,e);r&&(t.labels=r),this.I_(t)}w_(e){const t={};t.database=go(this.serializer),t.removeTarget=e,this.I_(t)}}class sE extends ed{constructor(e,t,r,s,i,a){super(e,"write_stream_connection_backoff","write_stream_idle","health_check_timeout",t,r,s,a),this.serializer=i}get S_(){return this.__>0}start(){this.lastStreamToken=void 0,super.start()}A_(){this.S_&&this.b_([])}f_(e,t){return this.connection.Wo("Write",e,t)}g_(e){return Q(!!e.streamToken),this.lastStreamToken=e.streamToken,Q(!e.writeResults||e.writeResults.length===0),this.listener.D_()}onNext(e){Q(!!e.streamToken),this.lastStreamToken=e.streamToken,this.a_.reset();const t=hT(e.writeResults,e.commitTime),r=Je(e.commitTime);return this.listener.v_(r,t)}C_(){const e={};e.database=go(this.serializer),this.I_(e)}b_(e){const t={streamToken:this.lastStreamToken,writes:e.map(r=>lT(this.serializer,r))};this.I_(t)}}/**
2866
+ */const Gu="PersistentStream";class ad{constructor(e,t,r,s,i,a,c,l){this.xi=e,this.y_=r,this.w_=s,this.connection=i,this.authCredentialsProvider=a,this.appCheckCredentialsProvider=c,this.listener=l,this.state=0,this.S_=0,this.b_=null,this.D_=null,this.stream=null,this.v_=0,this.C_=new od(e,t)}F_(){return this.state===1||this.state===5||this.M_()}M_(){return this.state===2||this.state===3}start(){this.v_=0,this.state!==4?this.auth():this.x_()}async stop(){this.F_()&&await this.close(0)}O_(){this.state=0,this.C_.reset()}N_(){this.M_()&&this.b_===null&&(this.b_=this.xi.enqueueAfterDelay(this.y_,6e4,()=>this.B_()))}L_(e){this.k_(),this.stream.send(e)}async B_(){if(this.M_())return this.close(0)}k_(){this.b_&&(this.b_.cancel(),this.b_=null)}q_(){this.D_&&(this.D_.cancel(),this.D_=null)}async close(e,t){this.k_(),this.q_(),this.C_.cancel(),this.S_++,e!==4?this.C_.reset():t&&t.code===P.RESOURCE_EXHAUSTED?(dt(t.toString()),dt("Using maximum backoff delay to prevent overloading the backend."),this.C_.m_()):t&&t.code===P.UNAUTHENTICATED&&this.state!==3&&(this.authCredentialsProvider.invalidateToken(),this.appCheckCredentialsProvider.invalidateToken()),this.stream!==null&&(this.Q_(),this.stream.close(),this.stream=null),this.state=e,await this.listener.i_(t)}Q_(){}auth(){this.state=1;const e=this.U_(this.S_),t=this.S_;Promise.all([this.authCredentialsProvider.getToken(),this.appCheckCredentialsProvider.getToken()]).then(([r,s])=>{this.S_===t&&this.K_(r,s)},r=>{e(()=>{const s=new V(P.UNKNOWN,"Fetching auth token failed: "+r.message);return this.W_(s)})})}K_(e,t){const r=this.U_(this.S_);this.stream=this.G_(e,t),this.stream.e_(()=>{r(()=>this.listener.e_())}),this.stream.n_(()=>{r(()=>(this.state=2,this.D_=this.xi.enqueueAfterDelay(this.w_,1e4,()=>(this.M_()&&(this.state=3),Promise.resolve())),this.listener.n_()))}),this.stream.i_(s=>{r(()=>this.W_(s))}),this.stream.onMessage(s=>{r(()=>++this.v_==1?this.z_(s):this.onNext(s))})}x_(){this.state=5,this.C_.f_(async()=>{this.state=0,this.start()})}W_(e){return O(Gu,`close with error: ${e}`),this.stream=null,this.close(4,e)}U_(e){return t=>{this.xi.enqueueAndForget(()=>this.S_===e?t():(O(Gu,"stream callback skipped by getCloseGuardedDispatcher."),Promise.resolve()))}}}class dT extends ad{constructor(e,t,r,s,i,a){super(e,"listen_stream_connection_backoff","listen_stream_idle","health_check_timeout",t,r,s,a),this.serializer=i}G_(e,t){return this.connection.T_("Listen",e,t)}z_(e){return this.onNext(e)}onNext(e){this.C_.reset();const t=yE(this.serializer,e),r=function(i){if(!("targetChange"in i))return q.min();const a=i.targetChange;return a.targetIds&&a.targetIds.length?q.min():a.readTime?Ye(a.readTime):q.min()}(e);return this.listener.j_(t,r)}H_(e){const t={};t.database=To(this.serializer),t.addTarget=function(i,a){let c;const l=a.target;if(c=mo(l)?{documents:vE(i,l)}:{query:IE(i,l).gt},c.targetId=a.targetId,a.resumeToken.approximateByteSize()>0){c.resumeToken=Qh(i,a.resumeToken);const d=_o(i,a.expectedCount);d!==null&&(c.expectedCount=d)}else if(a.snapshotVersion.compareTo(q.min())>0){c.readTime=qs(i,a.snapshotVersion.toTimestamp());const d=_o(i,a.expectedCount);d!==null&&(c.expectedCount=d)}return c}(this.serializer,e);const r=AE(this.serializer,e);r&&(t.labels=r),this.L_(t)}J_(e){const t={};t.database=To(this.serializer),t.removeTarget=e,this.L_(t)}}class fT extends ad{constructor(e,t,r,s,i,a){super(e,"write_stream_connection_backoff","write_stream_idle","health_check_timeout",t,r,s,a),this.serializer=i}get Y_(){return this.v_>0}start(){this.lastStreamToken=void 0,super.start()}Q_(){this.Y_&&this.Z_([])}G_(e,t){return this.connection.T_("Write",e,t)}z_(e){return Q(!!e.streamToken,31322),this.lastStreamToken=e.streamToken,Q(!e.writeResults||e.writeResults.length===0,55816),this.listener.X_()}onNext(e){Q(!!e.streamToken,12678),this.lastStreamToken=e.streamToken,this.C_.reset();const t=TE(e.writeResults,e.commitTime),r=Ye(e.commitTime);return this.listener.ea(r,t)}ta(){const e={};e.database=To(this.serializer),this.L_(e)}Z_(e){const t={streamToken:this.lastStreamToken,writes:e.map(r=>EE(this.serializer,r))};this.L_(t)}}/**
2838
2867
  * @license
2839
2868
  * Copyright 2017 Google LLC
2840
2869
  *
@@ -2849,8 +2878,8 @@ Total Duration: ${d-f}ms`),S.resolve({didRun:!0,sequenceNumbersCollected:s,targe
2849
2878
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2850
2879
  * See the License for the specific language governing permissions and
2851
2880
  * limitations under the License.
2852
- */class iE{}class oE extends iE{constructor(e,t,r,s){super(),this.authCredentials=e,this.appCheckCredentials=t,this.connection=r,this.serializer=s,this.F_=!1}M_(){if(this.F_)throw new O(P.FAILED_PRECONDITION,"The client has already been terminated.")}So(e,t,r,s){return this.M_(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then(([i,a])=>this.connection.So(e,po(t,r),s,i,a)).catch(i=>{throw i.name==="FirebaseError"?(i.code===P.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),i):new O(P.UNKNOWN,i.toString())})}Co(e,t,r,s,i){return this.M_(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then(([a,c])=>this.connection.Co(e,po(t,r),s,a,c,i)).catch(a=>{throw a.name==="FirebaseError"?(a.code===P.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),a):new O(P.UNKNOWN,a.toString())})}terminate(){this.F_=!0,this.connection.terminate()}}class aE{constructor(e,t){this.asyncQueue=e,this.onlineStateHandler=t,this.state="Unknown",this.x_=0,this.O_=null,this.N_=!0}B_(){this.x_===0&&(this.L_("Unknown"),this.O_=this.asyncQueue.enqueueAfterDelay("online_state_timeout",1e4,()=>(this.O_=null,this.k_("Backend didn't respond within 10 seconds."),this.L_("Offline"),Promise.resolve())))}q_(e){this.state==="Online"?this.L_("Unknown"):(this.x_++,this.x_>=1&&(this.Q_(),this.k_(`Connection failed 1 times. Most recent error: ${e.toString()}`),this.L_("Offline")))}set(e){this.Q_(),this.x_=0,e==="Online"&&(this.N_=!1),this.L_(e)}L_(e){e!==this.state&&(this.state=e,this.onlineStateHandler(e))}k_(e){const t=`Could not reach Cloud Firestore backend. ${e}
2853
- 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.N_?(dt(t),this.N_=!1):V("OnlineStateTracker",t)}Q_(){this.O_!==null&&(this.O_.cancel(),this.O_=null)}}/**
2881
+ */class pT{}class mT extends pT{constructor(e,t,r,s){super(),this.authCredentials=e,this.appCheckCredentials=t,this.connection=r,this.serializer=s,this.na=!1}ra(){if(this.na)throw new V(P.FAILED_PRECONDITION,"The client has already been terminated.")}zo(e,t,r,s){return this.ra(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then(([i,a])=>this.connection.zo(e,yo(t,r),s,i,a)).catch(i=>{throw i.name==="FirebaseError"?(i.code===P.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),i):new V(P.UNKNOWN,i.toString())})}Yo(e,t,r,s,i){return this.ra(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then(([a,c])=>this.connection.Yo(e,yo(t,r),s,a,c,i)).catch(a=>{throw a.name==="FirebaseError"?(a.code===P.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),a):new V(P.UNKNOWN,a.toString())})}terminate(){this.na=!0,this.connection.terminate()}}class gT{constructor(e,t){this.asyncQueue=e,this.onlineStateHandler=t,this.state="Unknown",this.ia=0,this.sa=null,this.oa=!0}_a(){this.ia===0&&(this.aa("Unknown"),this.sa=this.asyncQueue.enqueueAfterDelay("online_state_timeout",1e4,()=>(this.sa=null,this.ua("Backend didn't respond within 10 seconds."),this.aa("Offline"),Promise.resolve())))}ca(e){this.state==="Online"?this.aa("Unknown"):(this.ia++,this.ia>=1&&(this.la(),this.ua(`Connection failed 1 times. Most recent error: ${e.toString()}`),this.aa("Offline")))}set(e){this.la(),this.ia=0,e==="Online"&&(this.oa=!1),this.aa(e)}aa(e){e!==this.state&&(this.state=e,this.onlineStateHandler(e))}ua(e){const t=`Could not reach Cloud Firestore backend. ${e}
2882
+ 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.oa?(dt(t),this.oa=!1):O("OnlineStateTracker",t)}la(){this.sa!==null&&(this.sa.cancel(),this.sa=null)}}/**
2854
2883
  * @license
2855
2884
  * Copyright 2017 Google LLC
2856
2885
  *
@@ -2865,7 +2894,7 @@ This typically indicates that your device does not have a healthy Internet conne
2865
2894
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2866
2895
  * See the License for the specific language governing permissions and
2867
2896
  * limitations under the License.
2868
- */const Zt="RemoteStore";class cE{constructor(e,t,r,s,i){this.localStore=e,this.datastore=t,this.asyncQueue=r,this.remoteSyncer={},this.U_=[],this.K_=new Map,this.W_=new Set,this.G_=[],this.z_=i,this.z_.To(a=>{r.enqueueAndForget(async()=>{an(this)&&(V(Zt,"Restarting streams for network reachability change."),await async function(l){const d=q(l);d.W_.add(4),await Vr(d),d.j_.set("Unknown"),d.W_.delete(4),await ai(d)}(this))})}),this.j_=new aE(r,s)}}async function ai(n){if(an(n))for(const e of n.G_)await e(!0)}async function Vr(n){for(const e of n.G_)await e(!1)}function td(n,e){const t=q(n);t.K_.has(e.targetId)||(t.K_.set(e.targetId,e),ta(t)?ea(t):xn(t).c_()&&Zo(t,e))}function Yo(n,e){const t=q(n),r=xn(t);t.K_.delete(e),r.c_()&&nd(t,e),t.K_.size===0&&(r.c_()?r.P_():an(t)&&t.j_.set("Unknown"))}function Zo(n,e){if(n.H_.Ne(e.targetId),e.resumeToken.approximateByteSize()>0||e.snapshotVersion.compareTo(B.min())>0){const t=n.remoteSyncer.getRemoteKeysForTarget(e.targetId).size;e=e.withExpectedCount(t)}xn(n).y_(e)}function nd(n,e){n.H_.Ne(e),xn(n).w_(e)}function ea(n){n.H_=new nT({getRemoteKeysForTarget:e=>n.remoteSyncer.getRemoteKeysForTarget(e),lt:e=>n.K_.get(e)||null,it:()=>n.datastore.serializer.databaseId}),xn(n).start(),n.j_.B_()}function ta(n){return an(n)&&!xn(n).u_()&&n.K_.size>0}function an(n){return q(n).W_.size===0}function rd(n){n.H_=void 0}async function uE(n){n.j_.set("Online")}async function lE(n){n.K_.forEach((e,t)=>{Zo(n,e)})}async function hE(n,e){rd(n),ta(n)?(n.j_.q_(e),ea(n)):n.j_.set("Unknown")}async function dE(n,e,t){if(n.j_.set("Online"),e instanceof qh&&e.state===2&&e.cause)try{await async function(s,i){const a=i.cause;for(const c of i.targetIds)s.K_.has(c)&&(await s.remoteSyncer.rejectListen(c,a),s.K_.delete(c),s.H_.removeTarget(c))}(n,e)}catch(r){V(Zt,"Failed to remove targets %s: %s ",e.targetIds.join(","),r),await Bs(n,r)}else if(e instanceof Ts?n.H_.We(e):e instanceof Bh?n.H_.Ze(e):n.H_.je(e),!t.isEqual(B.min()))try{const r=await Yh(n.localStore);t.compareTo(r)>=0&&await function(i,a){const c=i.H_.ot(a);return c.targetChanges.forEach((l,d)=>{if(l.resumeToken.approximateByteSize()>0){const f=i.K_.get(d);f&&i.K_.set(d,f.withResumeToken(l.resumeToken,a))}}),c.targetMismatches.forEach((l,d)=>{const f=i.K_.get(l);if(!f)return;i.K_.set(l,f.withResumeToken(me.EMPTY_BYTE_STRING,f.snapshotVersion)),nd(i,l);const m=new At(f.target,l,d,f.sequenceNumber);Zo(i,m)}),i.remoteSyncer.applyRemoteEvent(c)}(n,t)}catch(r){V(Zt,"Failed to raise snapshot:",r),await Bs(n,r)}}async function Bs(n,e,t){if(!Mn(e))throw e;n.W_.add(1),await Vr(n),n.j_.set("Offline"),t||(t=()=>Yh(n.localStore)),n.asyncQueue.enqueueRetryable(async()=>{V(Zt,"Retrying IndexedDB access"),await t(),n.W_.delete(1),await ai(n)})}function sd(n,e){return e().catch(t=>Bs(n,t,e))}async function ci(n){const e=q(n),t=Ot(e);let r=e.U_.length>0?e.U_[e.U_.length-1].batchId:Uo;for(;fE(e);)try{const s=await KT(e.localStore,r);if(s===null){e.U_.length===0&&t.P_();break}r=s.batchId,pE(e,s)}catch(s){await Bs(e,s)}id(e)&&od(e)}function fE(n){return an(n)&&n.U_.length<10}function pE(n,e){n.U_.push(e);const t=Ot(n);t.c_()&&t.S_&&t.b_(e.mutations)}function id(n){return an(n)&&!Ot(n).u_()&&n.U_.length>0}function od(n){Ot(n).start()}async function mE(n){Ot(n).C_()}async function gE(n){const e=Ot(n);for(const t of n.U_)e.b_(t.mutations)}async function _E(n,e,t){const r=n.U_.shift(),s=zo.from(r,e,t);await sd(n,()=>n.remoteSyncer.applySuccessfulWrite(s)),await ci(n)}async function yE(n,e){e&&Ot(n).S_&&await async function(r,s){if(function(a){return eT(a)&&a!==P.ABORTED}(s.code)){const i=r.U_.shift();Ot(r).h_(),await sd(r,()=>r.remoteSyncer.rejectFailedWrite(i.batchId,s)),await ci(r)}}(n,e),id(n)&&od(n)}async function $u(n,e){const t=q(n);t.asyncQueue.verifyOperationInProgress(),V(Zt,"RemoteStore received new credentials");const r=an(t);t.W_.add(3),await Vr(t),r&&t.j_.set("Unknown"),await t.remoteSyncer.handleCredentialChange(e),t.W_.delete(3),await ai(t)}async function TE(n,e){const t=q(n);e?(t.W_.delete(2),await ai(t)):e||(t.W_.add(2),await Vr(t),t.j_.set("Unknown"))}function xn(n){return n.J_||(n.J_=function(t,r,s){const i=q(t);return i.M_(),new rE(r,i.connection,i.authCredentials,i.appCheckCredentials,i.serializer,s)}(n.datastore,n.asyncQueue,{xo:uE.bind(null,n),No:lE.bind(null,n),Lo:hE.bind(null,n),p_:dE.bind(null,n)}),n.G_.push(async e=>{e?(n.J_.h_(),ta(n)?ea(n):n.j_.set("Unknown")):(await n.J_.stop(),rd(n))})),n.J_}function Ot(n){return n.Y_||(n.Y_=function(t,r,s){const i=q(t);return i.M_(),new sE(r,i.connection,i.authCredentials,i.appCheckCredentials,i.serializer,s)}(n.datastore,n.asyncQueue,{xo:()=>Promise.resolve(),No:mE.bind(null,n),Lo:yE.bind(null,n),D_:gE.bind(null,n),v_:_E.bind(null,n)}),n.G_.push(async e=>{e?(n.Y_.h_(),await ci(n)):(await n.Y_.stop(),n.U_.length>0&&(V(Zt,`Stopping write stream with ${n.U_.length} pending writes`),n.U_=[]))})),n.Y_}/**
2897
+ */const tn="RemoteStore";class _T{constructor(e,t,r,s,i){this.localStore=e,this.datastore=t,this.asyncQueue=r,this.remoteSyncer={},this.ha=[],this.Pa=new Map,this.Ta=new Set,this.Ia=[],this.Ea=i,this.Ea.No(a=>{r.enqueueAndForget(async()=>{un(this)&&(O(tn,"Restarting streams for network reachability change."),await async function(l){const d=j(l);d.Ta.add(4),await Mr(d),d.da.set("Unknown"),d.Ta.delete(4),await hi(d)}(this))})}),this.da=new gT(r,s)}}async function hi(n){if(un(n))for(const e of n.Ia)await e(!0)}async function Mr(n){for(const e of n.Ia)await e(!1)}function cd(n,e){const t=j(n);t.Pa.has(e.targetId)||(t.Pa.set(e.targetId,e),ia(t)?sa(t):Fn(t).M_()&&ra(t,e))}function na(n,e){const t=j(n),r=Fn(t);t.Pa.delete(e),r.M_()&&ud(t,e),t.Pa.size===0&&(r.M_()?r.N_():un(t)&&t.da.set("Unknown"))}function ra(n,e){if(n.Aa.Ke(e.targetId),e.resumeToken.approximateByteSize()>0||e.snapshotVersion.compareTo(q.min())>0){const t=n.remoteSyncer.getRemoteKeysForTarget(e.targetId).size;e=e.withExpectedCount(t)}Fn(n).H_(e)}function ud(n,e){n.Aa.Ke(e),Fn(n).J_(e)}function sa(n){n.Aa=new hE({getRemoteKeysForTarget:e=>n.remoteSyncer.getRemoteKeysForTarget(e),Rt:e=>n.Pa.get(e)||null,Pt:()=>n.datastore.serializer.databaseId}),Fn(n).start(),n.da._a()}function ia(n){return un(n)&&!Fn(n).F_()&&n.Pa.size>0}function un(n){return j(n).Ta.size===0}function ld(n){n.Aa=void 0}async function yT(n){n.da.set("Online")}async function ET(n){n.Pa.forEach((e,t)=>{ra(n,e)})}async function TT(n,e){ld(n),ia(n)?(n.da.ca(e),sa(n)):n.da.set("Unknown")}async function vT(n,e,t){if(n.da.set("Online"),e instanceof Kh&&e.state===2&&e.cause)try{await async function(s,i){const a=i.cause;for(const c of i.targetIds)s.Pa.has(c)&&(await s.remoteSyncer.rejectListen(c,a),s.Pa.delete(c),s.Aa.removeTarget(c))}(n,e)}catch(r){O(tn,"Failed to remove targets %s: %s ",e.targetIds.join(","),r),await $s(n,r)}else if(e instanceof Is?n.Aa.Xe(e):e instanceof Wh?n.Aa.ot(e):n.Aa.nt(e),!t.isEqual(q.min()))try{const r=await id(n.localStore);t.compareTo(r)>=0&&await function(i,a){const c=i.Aa.It(a);return c.targetChanges.forEach((l,d)=>{if(l.resumeToken.approximateByteSize()>0){const f=i.Pa.get(d);f&&i.Pa.set(d,f.withResumeToken(l.resumeToken,a))}}),c.targetMismatches.forEach((l,d)=>{const f=i.Pa.get(l);if(!f)return;i.Pa.set(l,f.withResumeToken(me.EMPTY_BYTE_STRING,f.snapshotVersion)),ud(i,l);const m=new At(f.target,l,d,f.sequenceNumber);ra(i,m)}),i.remoteSyncer.applyRemoteEvent(c)}(n,t)}catch(r){O(tn,"Failed to raise snapshot:",r),await $s(n,r)}}async function $s(n,e,t){if(!Un(e))throw e;n.Ta.add(1),await Mr(n),n.da.set("Offline"),t||(t=()=>id(n.localStore)),n.asyncQueue.enqueueRetryable(async()=>{O(tn,"Retrying IndexedDB access"),await t(),n.Ta.delete(1),await hi(n)})}function hd(n,e){return e().catch(t=>$s(n,t,e))}async function di(n){const e=j(n),t=Vt(e);let r=e.ha.length>0?e.ha[e.ha.length-1].batchId:jo;for(;IT(e);)try{const s=await rT(e.localStore,r);if(s===null){e.ha.length===0&&t.N_();break}r=s.batchId,wT(e,s)}catch(s){await $s(e,s)}dd(e)&&fd(e)}function IT(n){return un(n)&&n.ha.length<10}function wT(n,e){n.ha.push(e);const t=Vt(n);t.M_()&&t.Y_&&t.Z_(e.mutations)}function dd(n){return un(n)&&!Vt(n).F_()&&n.ha.length>0}function fd(n){Vt(n).start()}async function AT(n){Vt(n).ta()}async function RT(n){const e=Vt(n);for(const t of n.ha)e.Z_(t.mutations)}async function bT(n,e,t){const r=n.ha.shift(),s=Qo.from(r,e,t);await hd(n,()=>n.remoteSyncer.applySuccessfulWrite(s)),await di(n)}async function PT(n,e){e&&Vt(n).Y_&&await async function(r,s){if(function(a){return uE(a)&&a!==P.ABORTED}(s.code)){const i=r.ha.shift();Vt(r).O_(),await hd(r,()=>r.remoteSyncer.rejectFailedWrite(i.batchId,s)),await di(r)}}(n,e),dd(n)&&fd(n)}async function Wu(n,e){const t=j(n);t.asyncQueue.verifyOperationInProgress(),O(tn,"RemoteStore received new credentials");const r=un(t);t.Ta.add(3),await Mr(t),r&&t.da.set("Unknown"),await t.remoteSyncer.handleCredentialChange(e),t.Ta.delete(3),await hi(t)}async function ST(n,e){const t=j(n);e?(t.Ta.delete(2),await hi(t)):e||(t.Ta.add(2),await Mr(t),t.da.set("Unknown"))}function Fn(n){return n.Ra||(n.Ra=function(t,r,s){const i=j(t);return i.ra(),new dT(r,i.connection,i.authCredentials,i.appCheckCredentials,i.serializer,s)}(n.datastore,n.asyncQueue,{e_:yT.bind(null,n),n_:ET.bind(null,n),i_:TT.bind(null,n),j_:vT.bind(null,n)}),n.Ia.push(async e=>{e?(n.Ra.O_(),ia(n)?sa(n):n.da.set("Unknown")):(await n.Ra.stop(),ld(n))})),n.Ra}function Vt(n){return n.Va||(n.Va=function(t,r,s){const i=j(t);return i.ra(),new fT(r,i.connection,i.authCredentials,i.appCheckCredentials,i.serializer,s)}(n.datastore,n.asyncQueue,{e_:()=>Promise.resolve(),n_:AT.bind(null,n),i_:PT.bind(null,n),X_:RT.bind(null,n),ea:bT.bind(null,n)}),n.Ia.push(async e=>{e?(n.Va.O_(),await di(n)):(await n.Va.stop(),n.ha.length>0&&(O(tn,`Stopping write stream with ${n.ha.length} pending writes`),n.ha=[]))})),n.Va}/**
2869
2898
  * @license
2870
2899
  * Copyright 2017 Google LLC
2871
2900
  *
@@ -2880,7 +2909,7 @@ This typically indicates that your device does not have a healthy Internet conne
2880
2909
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2881
2910
  * See the License for the specific language governing permissions and
2882
2911
  * limitations under the License.
2883
- */class na{constructor(e,t,r,s,i){this.asyncQueue=e,this.timerId=t,this.targetTimeMs=r,this.op=s,this.removalCallback=i,this.deferred=new at,this.then=this.deferred.promise.then.bind(this.deferred.promise),this.deferred.promise.catch(a=>{})}get promise(){return this.deferred.promise}static createAndSchedule(e,t,r,s,i){const a=Date.now()+r,c=new na(e,t,a,s,i);return c.start(r),c}start(e){this.timerHandle=setTimeout(()=>this.handleDelayElapsed(),e)}skipDelay(){return this.handleDelayElapsed()}cancel(e){this.timerHandle!==null&&(this.clearTimeout(),this.deferred.reject(new O(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 ra(n,e){if(dt("AsyncQueue",`${e}: ${n}`),Mn(n))return new O(P.UNAVAILABLE,`${e}: ${n}`);throw n}/**
2912
+ */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 at,this.then=this.deferred.promise.then.bind(this.deferred.promise),this.deferred.promise.catch(a=>{})}get promise(){return this.deferred.promise}static createAndSchedule(e,t,r,s,i){const a=Date.now()+r,c=new oa(e,t,a,s,i);return c.start(r),c}start(e){this.timerHandle=setTimeout(()=>this.handleDelayElapsed(),e)}skipDelay(){return this.handleDelayElapsed()}cancel(e){this.timerHandle!==null&&(this.clearTimeout(),this.deferred.reject(new V(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(dt("AsyncQueue",`${e}: ${n}`),Un(n))return new V(P.UNAVAILABLE,`${e}: ${n}`);throw n}/**
2884
2913
  * @license
2885
2914
  * Copyright 2017 Google LLC
2886
2915
  *
@@ -2895,10 +2924,10 @@ This typically indicates that your device does not have a healthy Internet conne
2895
2924
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2896
2925
  * See the License for the specific language governing permissions and
2897
2926
  * limitations under the License.
2898
- */class In{static emptySet(e){return new In(e.comparator)}constructor(e){this.comparator=e?(t,r)=>e(t,r)||L.comparator(t.key,r.key):(t,r)=>L.comparator(t.key,r.key),this.keyedMap=ar(),this.sortedSet=new ne(this.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 In)||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 (
2927
+ */class An{static emptySet(e){return new An(e.comparator)}constructor(e){this.comparator=e?(t,r)=>e(t,r)||L.comparator(t.key,r.key):(t,r)=>L.comparator(t.key,r.key),this.keyedMap=ur(),this.sortedSet=new ne(this.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 An)||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 (
2899
2928
  `+e.join(`
2900
2929
  `)+`
2901
- )`}copy(e,t){const r=new In;return r.comparator=this.comparator,r.keyedMap=e,r.sortedSet=t,r}}/**
2930
+ )`}copy(e,t){const r=new An;return r.comparator=this.comparator,r.keyedMap=e,r.sortedSet=t,r}}/**
2902
2931
  * @license
2903
2932
  * Copyright 2017 Google LLC
2904
2933
  *
@@ -2913,7 +2942,7 @@ This typically indicates that your device does not have a healthy Internet conne
2913
2942
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2914
2943
  * See the License for the specific language governing permissions and
2915
2944
  * limitations under the License.
2916
- */class ju{constructor(){this.Z_=new ne(L.comparator)}track(e){const t=e.doc.key,r=this.Z_.get(t);r?e.type!==0&&r.type===3?this.Z_=this.Z_.insert(t,e):e.type===3&&r.type!==1?this.Z_=this.Z_.insert(t,{type:r.type,doc:e.doc}):e.type===2&&r.type===2?this.Z_=this.Z_.insert(t,{type:2,doc:e.doc}):e.type===2&&r.type===0?this.Z_=this.Z_.insert(t,{type:0,doc:e.doc}):e.type===1&&r.type===0?this.Z_=this.Z_.remove(t):e.type===1&&r.type===2?this.Z_=this.Z_.insert(t,{type:1,doc:r.doc}):e.type===0&&r.type===1?this.Z_=this.Z_.insert(t,{type:2,doc:e.doc}):U():this.Z_=this.Z_.insert(t,e)}X_(){const e=[];return this.Z_.inorderTraversal((t,r)=>{e.push(r)}),e}}class Nn{constructor(e,t,r,s,i,a,c,l,d){this.query=e,this.docs=t,this.oldDocs=r,this.docChanges=s,this.mutatedKeys=i,this.fromCache=a,this.syncStateChanged=c,this.excludesMetadataChanges=l,this.hasCachedResults=d}static fromInitialDocuments(e,t,r,s,i){const a=[];return t.forEach(c=>{a.push({type:0,doc:c})}),new Nn(e,t,In.emptySet(t),a,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)&&ti(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}}/**
2945
+ */class Ku{constructor(){this.ma=new ne(L.comparator)}track(e){const t=e.doc.key,r=this.ma.get(t);r?e.type!==0&&r.type===3?this.ma=this.ma.insert(t,e):e.type===3&&r.type!==1?this.ma=this.ma.insert(t,{type:r.type,doc:e.doc}):e.type===2&&r.type===2?this.ma=this.ma.insert(t,{type:2,doc:e.doc}):e.type===2&&r.type===0?this.ma=this.ma.insert(t,{type:0,doc:e.doc}):e.type===1&&r.type===0?this.ma=this.ma.remove(t):e.type===1&&r.type===2?this.ma=this.ma.insert(t,{type:1,doc:r.doc}):e.type===0&&r.type===1?this.ma=this.ma.insert(t,{type:2,doc:e.doc}):F(63341,{Vt:e,fa:r}):this.ma=this.ma.insert(t,e)}ga(){const e=[];return this.ma.inorderTraversal((t,r)=>{e.push(r)}),e}}class Vn{constructor(e,t,r,s,i,a,c,l,d){this.query=e,this.docs=t,this.oldDocs=r,this.docChanges=s,this.mutatedKeys=i,this.fromCache=a,this.syncStateChanged=c,this.excludesMetadataChanges=l,this.hasCachedResults=d}static fromInitialDocuments(e,t,r,s,i){const a=[];return t.forEach(c=>{a.push({type:0,doc:c})}),new Vn(e,t,An.emptySet(t),a,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)&&ii(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}}/**
2917
2946
  * @license
2918
2947
  * Copyright 2017 Google LLC
2919
2948
  *
@@ -2928,7 +2957,7 @@ This typically indicates that your device does not have a healthy Internet conne
2928
2957
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2929
2958
  * See the License for the specific language governing permissions and
2930
2959
  * limitations under the License.
2931
- */class EE{constructor(){this.ea=void 0,this.ta=[]}na(){return this.ta.some(e=>e.ra())}}class vE{constructor(){this.queries=Hu(),this.onlineState="Unknown",this.ia=new Set}terminate(){(function(t,r){const s=q(t),i=s.queries;s.queries=Hu(),i.forEach((a,c)=>{for(const l of c.ta)l.onError(r)})})(this,new O(P.ABORTED,"Firestore shutting down"))}}function Hu(){return new sn(n=>Ph(n),ti)}async function sa(n,e){const t=q(n);let r=3;const s=e.query;let i=t.queries.get(s);i?!i.na()&&e.ra()&&(r=2):(i=new EE,r=e.ra()?0:1);try{switch(r){case 0:i.ea=await t.onListen(s,!0);break;case 1:i.ea=await t.onListen(s,!1);break;case 2:await t.onFirstRemoteStoreListen(s)}}catch(a){const c=ra(a,`Initialization of query '${mn(e.query)}' failed`);return void e.onError(c)}t.queries.set(s,i),i.ta.push(e),e.sa(t.onlineState),i.ea&&e.oa(i.ea)&&oa(t)}async function ia(n,e){const t=q(n),r=e.query;let s=3;const i=t.queries.get(r);if(i){const a=i.ta.indexOf(e);a>=0&&(i.ta.splice(a,1),i.ta.length===0?s=e.ra()?0:1:!i.na()&&e.ra()&&(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 IE(n,e){const t=q(n);let r=!1;for(const s of e){const i=s.query,a=t.queries.get(i);if(a){for(const c of a.ta)c.oa(s)&&(r=!0);a.ea=s}}r&&oa(t)}function wE(n,e,t){const r=q(n),s=r.queries.get(e);if(s)for(const i of s.ta)i.onError(t);r.queries.delete(e)}function oa(n){n.ia.forEach(e=>{e.next()})}var To,zu;(zu=To||(To={}))._a="default",zu.Cache="cache";class aa{constructor(e,t,r){this.query=e,this.aa=t,this.ua=!1,this.ca=null,this.onlineState="Unknown",this.options=r||{}}oa(e){if(!this.options.includeMetadataChanges){const r=[];for(const s of e.docChanges)s.type!==3&&r.push(s);e=new Nn(e.query,e.docs,e.oldDocs,r,e.mutatedKeys,e.fromCache,e.syncStateChanged,!0,e.hasCachedResults)}let t=!1;return this.ua?this.la(e)&&(this.aa.next(e),t=!0):this.ha(e,this.onlineState)&&(this.Pa(e),t=!0),this.ca=e,t}onError(e){this.aa.error(e)}sa(e){this.onlineState=e;let t=!1;return this.ca&&!this.ua&&this.ha(this.ca,e)&&(this.Pa(this.ca),t=!0),t}ha(e,t){if(!e.fromCache||!this.ra())return!0;const r=t!=="Offline";return(!this.options.Ta||!r)&&(!e.docs.isEmpty()||e.hasCachedResults||t==="Offline")}la(e){if(e.docChanges.length>0)return!0;const t=this.ca&&this.ca.hasPendingWrites!==e.hasPendingWrites;return!(!e.syncStateChanged&&!t)&&this.options.includeMetadataChanges===!0}Pa(e){e=Nn.fromInitialDocuments(e.query,e.docs,e.mutatedKeys,e.fromCache,e.hasCachedResults),this.ua=!0,this.aa.next(e)}ra(){return this.options.source!==To.Cache}}/**
2960
+ */class CT{constructor(){this.pa=void 0,this.ya=[]}wa(){return this.ya.some(e=>e.Sa())}}class kT{constructor(){this.queries=Qu(),this.onlineState="Unknown",this.ba=new Set}terminate(){(function(t,r){const s=j(t),i=s.queries;s.queries=Qu(),i.forEach((a,c)=>{for(const l of c.ya)l.onError(r)})})(this,new V(P.ABORTED,"Firestore shutting down"))}}function Qu(){return new an(n=>Oh(n),ii)}async function ca(n,e){const t=j(n);let r=3;const s=e.query;let i=t.queries.get(s);i?!i.wa()&&e.Sa()&&(r=2):(i=new CT,r=e.Sa()?0:1);try{switch(r){case 0:i.pa=await t.onListen(s,!0);break;case 1:i.pa=await t.onListen(s,!1);break;case 2:await t.onFirstRemoteStoreListen(s)}}catch(a){const c=aa(a,`Initialization of query '${_n(e.query)}' failed`);return void e.onError(c)}t.queries.set(s,i),i.ya.push(e),e.Da(t.onlineState),i.pa&&e.va(i.pa)&&la(t)}async function ua(n,e){const t=j(n),r=e.query;let s=3;const i=t.queries.get(r);if(i){const a=i.ya.indexOf(e);a>=0&&(i.ya.splice(a,1),i.ya.length===0?s=e.Sa()?0:1:!i.wa()&&e.Sa()&&(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 NT(n,e){const t=j(n);let r=!1;for(const s of e){const i=s.query,a=t.queries.get(i);if(a){for(const c of a.ya)c.va(s)&&(r=!0);a.pa=s}}r&&la(t)}function DT(n,e,t){const r=j(n),s=r.queries.get(e);if(s)for(const i of s.ya)i.onError(t);r.queries.delete(e)}function la(n){n.ba.forEach(e=>{e.next()})}var wo,Xu;(Xu=wo||(wo={})).Ca="default",Xu.Cache="cache";class ha{constructor(e,t,r){this.query=e,this.Fa=t,this.Ma=!1,this.xa=null,this.onlineState="Unknown",this.options=r||{}}va(e){if(!this.options.includeMetadataChanges){const r=[];for(const s of e.docChanges)s.type!==3&&r.push(s);e=new Vn(e.query,e.docs,e.oldDocs,r,e.mutatedKeys,e.fromCache,e.syncStateChanged,!0,e.hasCachedResults)}let t=!1;return this.Ma?this.Oa(e)&&(this.Fa.next(e),t=!0):this.Na(e,this.onlineState)&&(this.Ba(e),t=!0),this.xa=e,t}onError(e){this.Fa.error(e)}Da(e){this.onlineState=e;let t=!1;return this.xa&&!this.Ma&&this.Na(this.xa,e)&&(this.Ba(this.xa),t=!0),t}Na(e,t){if(!e.fromCache||!this.Sa())return!0;const r=t!=="Offline";return(!this.options.La||!r)&&(!e.docs.isEmpty()||e.hasCachedResults||t==="Offline")}Oa(e){if(e.docChanges.length>0)return!0;const t=this.xa&&this.xa.hasPendingWrites!==e.hasPendingWrites;return!(!e.syncStateChanged&&!t)&&this.options.includeMetadataChanges===!0}Ba(e){e=Vn.fromInitialDocuments(e.query,e.docs,e.mutatedKeys,e.fromCache,e.hasCachedResults),this.Ma=!0,this.Fa.next(e)}Sa(){return this.options.source!==wo.Cache}}/**
2932
2961
  * @license
2933
2962
  * Copyright 2017 Google LLC
2934
2963
  *
@@ -2943,7 +2972,7 @@ This typically indicates that your device does not have a healthy Internet conne
2943
2972
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2944
2973
  * See the License for the specific language governing permissions and
2945
2974
  * limitations under the License.
2946
- */class ad{constructor(e){this.key=e}}class cd{constructor(e){this.key=e}}class AE{constructor(e,t){this.query=e,this.fa=t,this.ga=null,this.hasCachedResults=!1,this.current=!1,this.pa=G(),this.mutatedKeys=G(),this.ya=Sh(e),this.wa=new In(this.ya)}get Sa(){return this.fa}ba(e,t){const r=t?t.Da:new ju,s=t?t.wa:this.wa;let i=t?t.mutatedKeys:this.mutatedKeys,a=s,c=!1;const l=this.query.limitType==="F"&&s.size===this.query.limit?s.last():null,d=this.query.limitType==="L"&&s.size===this.query.limit?s.first():null;if(e.inorderTraversal((f,m)=>{const E=s.get(f),R=ni(this.query,m)?m:null,C=!!E&&this.mutatedKeys.has(E.key),N=!!R&&(R.hasLocalMutations||this.mutatedKeys.has(R.key)&&R.hasCommittedMutations);let k=!1;E&&R?E.data.isEqual(R.data)?C!==N&&(r.track({type:3,doc:R}),k=!0):this.va(E,R)||(r.track({type:2,doc:R}),k=!0,(l&&this.ya(R,l)>0||d&&this.ya(R,d)<0)&&(c=!0)):!E&&R?(r.track({type:0,doc:R}),k=!0):E&&!R&&(r.track({type:1,doc:E}),k=!0,(l||d)&&(c=!0)),k&&(R?(a=a.add(R),i=N?i.add(f):i.delete(f)):(a=a.delete(f),i=i.delete(f)))}),this.query.limit!==null)for(;a.size>this.query.limit;){const f=this.query.limitType==="F"?a.last():a.first();a=a.delete(f.key),i=i.delete(f.key),r.track({type:1,doc:f})}return{wa:a,Da:r,ls:c,mutatedKeys:i}}va(e,t){return e.hasLocalMutations&&t.hasCommittedMutations&&!t.hasLocalMutations}applyChanges(e,t,r,s){const i=this.wa;this.wa=e.wa,this.mutatedKeys=e.mutatedKeys;const a=e.Da.X_();a.sort((f,m)=>function(R,C){const N=k=>{switch(k){case 0:return 1;case 2:case 3:return 2;case 1:return 0;default:return U()}};return N(R)-N(C)}(f.type,m.type)||this.ya(f.doc,m.doc)),this.Ca(r),s=s!=null&&s;const c=t&&!s?this.Fa():[],l=this.pa.size===0&&this.current&&!s?1:0,d=l!==this.ga;return this.ga=l,a.length!==0||d?{snapshot:new Nn(this.query,e.wa,i,a,e.mutatedKeys,l===0,d,!1,!!r&&r.resumeToken.approximateByteSize()>0),Ma:c}:{Ma:c}}sa(e){return this.current&&e==="Offline"?(this.current=!1,this.applyChanges({wa:this.wa,Da:new ju,mutatedKeys:this.mutatedKeys,ls:!1},!1)):{Ma:[]}}xa(e){return!this.fa.has(e)&&!!this.wa.has(e)&&!this.wa.get(e).hasLocalMutations}Ca(e){e&&(e.addedDocuments.forEach(t=>this.fa=this.fa.add(t)),e.modifiedDocuments.forEach(t=>{}),e.removedDocuments.forEach(t=>this.fa=this.fa.delete(t)),this.current=e.current)}Fa(){if(!this.current)return[];const e=this.pa;this.pa=G(),this.wa.forEach(r=>{this.xa(r.key)&&(this.pa=this.pa.add(r.key))});const t=[];return e.forEach(r=>{this.pa.has(r)||t.push(new cd(r))}),this.pa.forEach(r=>{e.has(r)||t.push(new ad(r))}),t}Oa(e){this.fa=e.gs,this.pa=G();const t=this.ba(e.documents);return this.applyChanges(t,!0)}Na(){return Nn.fromInitialDocuments(this.query,this.wa,this.mutatedKeys,this.ga===0,this.hasCachedResults)}}const ca="SyncEngine";class RE{constructor(e,t,r){this.query=e,this.targetId=t,this.view=r}}class bE{constructor(e){this.key=e,this.Ba=!1}}class PE{constructor(e,t,r,s,i,a){this.localStore=e,this.remoteStore=t,this.eventManager=r,this.sharedClientState=s,this.currentUser=i,this.maxConcurrentLimboResolutions=a,this.La={},this.ka=new sn(c=>Ph(c),ti),this.qa=new Map,this.Qa=new Set,this.$a=new ne(L.comparator),this.Ua=new Map,this.Ka=new Ko,this.Wa={},this.Ga=new Map,this.za=kn.Kn(),this.onlineState="Unknown",this.ja=void 0}get isPrimaryClient(){return this.ja===!0}}async function SE(n,e,t=!0){const r=pd(n);let s;const i=r.ka.get(e);return i?(r.sharedClientState.addLocalQueryTarget(i.targetId),s=i.view.Na()):s=await ud(r,e,t,!0),s}async function CE(n,e){const t=pd(n);await ud(t,e,!0,!1)}async function ud(n,e,t,r){const s=await QT(n.localStore,Qe(e)),i=s.targetId,a=n.sharedClientState.addLocalQueryTarget(i,t);let c;return r&&(c=await kE(n,e,i,a==="current",s.resumeToken)),n.isPrimaryClient&&t&&td(n.remoteStore,s),c}async function kE(n,e,t,r,s){n.Ha=(m,E,R)=>async function(N,k,F,$){let M=k.view.ba(F);M.ls&&(M=await xu(N.localStore,k.query,!1).then(({documents:v})=>k.view.ba(v,M)));const j=$&&$.targetChanges.get(k.targetId),ce=$&&$.targetMismatches.get(k.targetId)!=null,X=k.view.applyChanges(M,N.isPrimaryClient,j,ce);return Wu(N,k.targetId,X.Ma),X.snapshot}(n,m,E,R);const i=await xu(n.localStore,e,!0),a=new AE(e,i.gs),c=a.ba(i.documents),l=Or.createSynthesizedTargetChangeForCurrentChange(t,r&&n.onlineState!=="Offline",s),d=a.applyChanges(c,n.isPrimaryClient,l);Wu(n,t,d.Ma);const f=new RE(e,t,a);return n.ka.set(e,f),n.qa.has(t)?n.qa.get(t).push(e):n.qa.set(t,[e]),d.snapshot}async function NE(n,e,t){const r=q(n),s=r.ka.get(e),i=r.qa.get(s.targetId);if(i.length>1)return r.qa.set(s.targetId,i.filter(a=>!ti(a,e))),void r.ka.delete(e);r.isPrimaryClient?(r.sharedClientState.removeLocalQueryTarget(s.targetId),r.sharedClientState.isActiveQueryTarget(s.targetId)||await _o(r.localStore,s.targetId,!1).then(()=>{r.sharedClientState.clearQueryState(s.targetId),t&&Yo(r.remoteStore,s.targetId),Eo(r,s.targetId)}).catch(Ln)):(Eo(r,s.targetId),await _o(r.localStore,s.targetId,!0))}async function DE(n,e){const t=q(n),r=t.ka.get(e),s=t.qa.get(r.targetId);t.isPrimaryClient&&s.length===1&&(t.sharedClientState.removeLocalQueryTarget(r.targetId),Yo(t.remoteStore,r.targetId))}async function OE(n,e,t){const r=BE(n);try{const s=await function(a,c){const l=q(a),d=ue.now(),f=c.reduce((R,C)=>R.add(C.key),G());let m,E;return l.persistence.runTransaction("Locally write mutations","readwrite",R=>{let C=ft(),N=G();return l.ds.getEntries(R,f).next(k=>{C=k,C.forEach((F,$)=>{$.isValidDocument()||(N=N.add(F))})}).next(()=>l.localDocuments.getOverlayedDocuments(R,C)).next(k=>{m=k;const F=[];for(const $ of c){const M=Qy($,m.get($.key).overlayedDocument);M!=null&&F.push(new on($.key,M,Eh(M.value.mapValue),Xe.exists(!0)))}return l.mutationQueue.addMutationBatch(R,d,F,c)}).next(k=>{E=k;const F=k.applyToLocalDocumentSet(m,N);return l.documentOverlayCache.saveOverlays(R,k.batchId,F)})}).then(()=>({batchId:E.batchId,changes:kh(m)}))}(r.localStore,e);r.sharedClientState.addPendingMutation(s.batchId),function(a,c,l){let d=a.Wa[a.currentUser.toKey()];d||(d=new ne(H)),d=d.insert(c,l),a.Wa[a.currentUser.toKey()]=d}(r,s.batchId,t),await Lr(r,s.changes),await ci(r.remoteStore)}catch(s){const i=ra(s,"Failed to persist write");t.reject(i)}}async function ld(n,e){const t=q(n);try{const r=await GT(t.localStore,e);e.targetChanges.forEach((s,i)=>{const a=t.Ua.get(i);a&&(Q(s.addedDocuments.size+s.modifiedDocuments.size+s.removedDocuments.size<=1),s.addedDocuments.size>0?a.Ba=!0:s.modifiedDocuments.size>0?Q(a.Ba):s.removedDocuments.size>0&&(Q(a.Ba),a.Ba=!1))}),await Lr(t,r,e)}catch(r){await Ln(r)}}function Gu(n,e,t){const r=q(n);if(r.isPrimaryClient&&t===0||!r.isPrimaryClient&&t===1){const s=[];r.ka.forEach((i,a)=>{const c=a.view.sa(e);c.snapshot&&s.push(c.snapshot)}),function(a,c){const l=q(a);l.onlineState=c;let d=!1;l.queries.forEach((f,m)=>{for(const E of m.ta)E.sa(c)&&(d=!0)}),d&&oa(l)}(r.eventManager,e),s.length&&r.La.p_(s),r.onlineState=e,r.isPrimaryClient&&r.sharedClientState.setOnlineState(e)}}async function VE(n,e,t){const r=q(n);r.sharedClientState.updateQueryState(e,"rejected",t);const s=r.Ua.get(e),i=s&&s.key;if(i){let a=new ne(L.comparator);a=a.insert(i,Ie.newNoDocument(i,B.min()));const c=G().add(i),l=new ii(B.min(),new Map,new ne(H),a,c);await ld(r,l),r.$a=r.$a.remove(i),r.Ua.delete(e),ua(r)}else await _o(r.localStore,e,!1).then(()=>Eo(r,e,t)).catch(Ln)}async function LE(n,e){const t=q(n),r=e.batch.batchId;try{const s=await zT(t.localStore,e);dd(t,r,null),hd(t,r),t.sharedClientState.updateMutationState(r,"acknowledged"),await Lr(t,s)}catch(s){await Ln(s)}}async function ME(n,e,t){const r=q(n);try{const s=await function(a,c){const l=q(a);return l.persistence.runTransaction("Reject batch","readwrite-primary",d=>{let f;return l.mutationQueue.lookupMutationBatch(d,c).next(m=>(Q(m!==null),f=m.keys(),l.mutationQueue.removeMutationBatch(d,m))).next(()=>l.mutationQueue.performConsistencyCheck(d)).next(()=>l.documentOverlayCache.removeOverlaysForBatchId(d,f,c)).next(()=>l.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(d,f)).next(()=>l.localDocuments.getDocuments(d,f))})}(r.localStore,e);dd(r,e,t),hd(r,e),r.sharedClientState.updateMutationState(e,"rejected",t),await Lr(r,s)}catch(s){await Ln(s)}}function hd(n,e){(n.Ga.get(e)||[]).forEach(t=>{t.resolve()}),n.Ga.delete(e)}function dd(n,e,t){const r=q(n);let s=r.Wa[r.currentUser.toKey()];if(s){const i=s.get(e);i&&(t?i.reject(t):i.resolve(),s=s.remove(e)),r.Wa[r.currentUser.toKey()]=s}}function Eo(n,e,t=null){n.sharedClientState.removeLocalQueryTarget(e);for(const r of n.qa.get(e))n.ka.delete(r),t&&n.La.Ja(r,t);n.qa.delete(e),n.isPrimaryClient&&n.Ka.br(e).forEach(r=>{n.Ka.containsKey(r)||fd(n,r)})}function fd(n,e){n.Qa.delete(e.path.canonicalString());const t=n.$a.get(e);t!==null&&(Yo(n.remoteStore,t),n.$a=n.$a.remove(e),n.Ua.delete(t),ua(n))}function Wu(n,e,t){for(const r of t)r instanceof ad?(n.Ka.addReference(r.key,e),xE(n,r)):r instanceof cd?(V(ca,"Document no longer in limbo: "+r.key),n.Ka.removeReference(r.key,e),n.Ka.containsKey(r.key)||fd(n,r.key)):U()}function xE(n,e){const t=e.key,r=t.path.canonicalString();n.$a.get(t)||n.Qa.has(r)||(V(ca,"New document in limbo: "+t),n.Qa.add(r),ua(n))}function ua(n){for(;n.Qa.size>0&&n.$a.size<n.maxConcurrentLimboResolutions;){const e=n.Qa.values().next().value;n.Qa.delete(e);const t=new L(Y.fromString(e)),r=n.za.next();n.Ua.set(r,new bE(t)),n.$a=n.$a.insert(t,r),td(n.remoteStore,new At(Qe(ei(t.path)),r,"TargetPurposeLimboResolution",Xs.ae))}}async function Lr(n,e,t){const r=q(n),s=[],i=[],a=[];r.ka.isEmpty()||(r.ka.forEach((c,l)=>{a.push(r.Ha(l,e,t).then(d=>{var f;if((d||t)&&r.isPrimaryClient){const m=d?!d.fromCache:(f=t==null?void 0:t.targetChanges.get(l.targetId))===null||f===void 0?void 0:f.current;r.sharedClientState.updateQueryState(l.targetId,m?"current":"not-current")}if(d){s.push(d);const m=Xo.Yi(l.targetId,d);i.push(m)}}))}),await Promise.all(a),r.La.p_(s),await async function(l,d){const f=q(l);try{await f.persistence.runTransaction("notifyLocalViewChanges","readwrite",m=>S.forEach(d,E=>S.forEach(E.Hi,R=>f.persistence.referenceDelegate.addReference(m,E.targetId,R)).next(()=>S.forEach(E.Ji,R=>f.persistence.referenceDelegate.removeReference(m,E.targetId,R)))))}catch(m){if(!Mn(m))throw m;V(Jo,"Failed to update sequence numbers: "+m)}for(const m of d){const E=m.targetId;if(!m.fromCache){const R=f.Ts.get(E),C=R.snapshotVersion,N=R.withLastLimboFreeSnapshotVersion(C);f.Ts=f.Ts.insert(E,N)}}}(r.localStore,i))}async function UE(n,e){const t=q(n);if(!t.currentUser.isEqual(e)){V(ca,"User change. New user:",e.toKey());const r=await Jh(t.localStore,e);t.currentUser=e,function(i,a){i.Ga.forEach(c=>{c.forEach(l=>{l.reject(new O(P.CANCELLED,a))})}),i.Ga.clear()}(t,"'waitForPendingWrites' promise is rejected due to a user change."),t.sharedClientState.handleUserChange(e,r.removedBatchIds,r.addedBatchIds),await Lr(t,r.Rs)}}function FE(n,e){const t=q(n),r=t.Ua.get(e);if(r&&r.Ba)return G().add(r.key);{let s=G();const i=t.qa.get(e);if(!i)return s;for(const a of i){const c=t.ka.get(a);s=s.unionWith(c.view.Sa)}return s}}function pd(n){const e=q(n);return e.remoteStore.remoteSyncer.applyRemoteEvent=ld.bind(null,e),e.remoteStore.remoteSyncer.getRemoteKeysForTarget=FE.bind(null,e),e.remoteStore.remoteSyncer.rejectListen=VE.bind(null,e),e.La.p_=IE.bind(null,e.eventManager),e.La.Ja=wE.bind(null,e.eventManager),e}function BE(n){const e=q(n);return e.remoteStore.remoteSyncer.applySuccessfulWrite=LE.bind(null,e),e.remoteStore.remoteSyncer.rejectFailedWrite=ME.bind(null,e),e}class qs{constructor(){this.kind="memory",this.synchronizeTabs=!1}async initialize(e){this.serializer=oi(e.databaseInfo.databaseId),this.sharedClientState=this.Za(e),this.persistence=this.Xa(e),await this.persistence.start(),this.localStore=this.eu(e),this.gcScheduler=this.tu(e,this.localStore),this.indexBackfillerScheduler=this.nu(e,this.localStore)}tu(e,t){return null}nu(e,t){return null}eu(e){return HT(this.persistence,new qT,e.initialUser,this.serializer)}Xa(e){return new Xh(Qo.ri,this.serializer)}Za(e){return new JT}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()}}qs.provider={build:()=>new qs};class qE extends qs{constructor(e){super(),this.cacheSizeBytes=e}tu(e,t){Q(this.persistence.referenceDelegate instanceof Fs);const r=this.persistence.referenceDelegate.garbageCollector;return new bT(r,e.asyncQueue,t)}Xa(e){const t=this.cacheSizeBytes!==void 0?Ce.withCacheSize(this.cacheSizeBytes):Ce.DEFAULT;return new Xh(r=>Fs.ri(r,t),this.serializer)}}class vo{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=>Gu(this.syncEngine,r,1),this.remoteStore.remoteSyncer.handleCredentialChange=UE.bind(null,this.syncEngine),await TE(this.remoteStore,this.syncEngine.isPrimaryClient))}createEventManager(e){return function(){return new vE}()}createDatastore(e){const t=oi(e.databaseInfo.databaseId),r=function(i){return new nE(i)}(e.databaseInfo);return function(i,a,c,l){return new oE(i,a,c,l)}(e.authCredentials,e.appCheckCredentials,r,t)}createRemoteStore(e){return function(r,s,i,a,c){return new cE(r,s,i,a,c)}(this.localStore,this.datastore,e.asyncQueue,t=>Gu(this.syncEngine,t,0),function(){return Bu.D()?new Bu:new YT}())}createSyncEngine(e,t){return function(s,i,a,c,l,d,f){const m=new PE(s,i,a,c,l,d);return f&&(m.ja=!0),m}(this.localStore,this.remoteStore,this.eventManager,this.sharedClientState,e.initialUser,e.maxConcurrentLimboResolutions,t)}async terminate(){var e,t;await async function(s){const i=q(s);V(Zt,"RemoteStore shutting down."),i.W_.add(5),await Vr(i),i.z_.shutdown(),i.j_.set("Unknown")}(this.remoteStore),(e=this.datastore)===null||e===void 0||e.terminate(),(t=this.eventManager)===null||t===void 0||t.terminate()}}vo.provider={build:()=>new vo};/**
2975
+ */class pd{constructor(e){this.key=e}}class md{constructor(e){this.key=e}}class VT{constructor(e,t){this.query=e,this.Ga=t,this.za=null,this.hasCachedResults=!1,this.current=!1,this.ja=G(),this.mutatedKeys=G(),this.Ha=Lh(e),this.Ja=new An(this.Ha)}get Ya(){return this.Ga}Za(e,t){const r=t?t.Xa:new Ku,s=t?t.Ja:this.Ja;let i=t?t.mutatedKeys:this.mutatedKeys,a=s,c=!1;const l=this.query.limitType==="F"&&s.size===this.query.limit?s.last():null,d=this.query.limitType==="L"&&s.size===this.query.limit?s.first():null;if(e.inorderTraversal((f,m)=>{const _=s.get(f),R=oi(this.query,m)?m:null,S=!!_&&this.mutatedKeys.has(_.key),N=!!R&&(R.hasLocalMutations||this.mutatedKeys.has(R.key)&&R.hasCommittedMutations);let k=!1;_&&R?_.data.isEqual(R.data)?S!==N&&(r.track({type:3,doc:R}),k=!0):this.eu(_,R)||(r.track({type:2,doc:R}),k=!0,(l&&this.Ha(R,l)>0||d&&this.Ha(R,d)<0)&&(c=!0)):!_&&R?(r.track({type:0,doc:R}),k=!0):_&&!R&&(r.track({type:1,doc:_}),k=!0,(l||d)&&(c=!0)),k&&(R?(a=a.add(R),i=N?i.add(f):i.delete(f)):(a=a.delete(f),i=i.delete(f)))}),this.query.limit!==null)for(;a.size>this.query.limit;){const f=this.query.limitType==="F"?a.last():a.first();a=a.delete(f.key),i=i.delete(f.key),r.track({type:1,doc:f})}return{Ja:a,Xa:r,Cs:c,mutatedKeys:i}}eu(e,t){return e.hasLocalMutations&&t.hasCommittedMutations&&!t.hasLocalMutations}applyChanges(e,t,r,s){const i=this.Ja;this.Ja=e.Ja,this.mutatedKeys=e.mutatedKeys;const a=e.Xa.ga();a.sort((f,m)=>function(R,S){const N=k=>{switch(k){case 0:return 1;case 2:case 3:return 2;case 1:return 0;default:return F(20277,{Vt:k})}};return N(R)-N(S)}(f.type,m.type)||this.Ha(f.doc,m.doc)),this.tu(r),s=s!=null&&s;const c=t&&!s?this.nu():[],l=this.ja.size===0&&this.current&&!s?1:0,d=l!==this.za;return this.za=l,a.length!==0||d?{snapshot:new Vn(this.query,e.Ja,i,a,e.mutatedKeys,l===0,d,!1,!!r&&r.resumeToken.approximateByteSize()>0),ru:c}:{ru:c}}Da(e){return this.current&&e==="Offline"?(this.current=!1,this.applyChanges({Ja:this.Ja,Xa:new Ku,mutatedKeys:this.mutatedKeys,Cs:!1},!1)):{ru:[]}}iu(e){return!this.Ga.has(e)&&!!this.Ja.has(e)&&!this.Ja.get(e).hasLocalMutations}tu(e){e&&(e.addedDocuments.forEach(t=>this.Ga=this.Ga.add(t)),e.modifiedDocuments.forEach(t=>{}),e.removedDocuments.forEach(t=>this.Ga=this.Ga.delete(t)),this.current=e.current)}nu(){if(!this.current)return[];const e=this.ja;this.ja=G(),this.Ja.forEach(r=>{this.iu(r.key)&&(this.ja=this.ja.add(r.key))});const t=[];return e.forEach(r=>{this.ja.has(r)||t.push(new md(r))}),this.ja.forEach(r=>{e.has(r)||t.push(new pd(r))}),t}su(e){this.Ga=e.$s,this.ja=G();const t=this.Za(e.documents);return this.applyChanges(t,!0)}ou(){return Vn.fromInitialDocuments(this.query,this.Ja,this.mutatedKeys,this.za===0,this.hasCachedResults)}}const da="SyncEngine";class OT{constructor(e,t,r){this.query=e,this.targetId=t,this.view=r}}class LT{constructor(e){this.key=e,this._u=!1}}class xT{constructor(e,t,r,s,i,a){this.localStore=e,this.remoteStore=t,this.eventManager=r,this.sharedClientState=s,this.currentUser=i,this.maxConcurrentLimboResolutions=a,this.au={},this.uu=new an(c=>Oh(c),ii),this.cu=new Map,this.lu=new Set,this.hu=new ne(L.comparator),this.Pu=new Map,this.Tu=new Jo,this.Iu={},this.Eu=new Map,this.du=Dn.lr(),this.onlineState="Unknown",this.Au=void 0}get isPrimaryClient(){return this.Au===!0}}async function MT(n,e,t=!0){const r=vd(n);let s;const i=r.uu.get(e);return i?(r.sharedClientState.addLocalQueryTarget(i.targetId),s=i.view.ou()):s=await gd(r,e,t,!0),s}async function UT(n,e){const t=vd(n);await gd(t,e,!0,!1)}async function gd(n,e,t,r){const s=await sT(n.localStore,Qe(e)),i=s.targetId,a=n.sharedClientState.addLocalQueryTarget(i,t);let c;return r&&(c=await FT(n,e,i,a==="current",s.resumeToken)),n.isPrimaryClient&&t&&cd(n.remoteStore,s),c}async function FT(n,e,t,r,s){n.Ru=(m,_,R)=>async function(N,k,B,M){let x=k.view.Za(B);x.Cs&&(x=await ju(N.localStore,k.query,!1).then(({documents:v})=>k.view.Za(v,x)));const $=M&&M.targetChanges.get(k.targetId),ce=M&&M.targetMismatches.get(k.targetId)!=null,X=k.view.applyChanges(x,N.isPrimaryClient,$,ce);return Ju(N,k.targetId,X.ru),X.snapshot}(n,m,_,R);const i=await ju(n.localStore,e,!0),a=new VT(e,i.$s),c=a.Za(i.documents),l=xr.createSynthesizedTargetChangeForCurrentChange(t,r&&n.onlineState!=="Offline",s),d=a.applyChanges(c,n.isPrimaryClient,l);Ju(n,t,d.ru);const f=new OT(e,t,a);return n.uu.set(e,f),n.cu.has(t)?n.cu.get(t).push(e):n.cu.set(t,[e]),d.snapshot}async function BT(n,e,t){const r=j(n),s=r.uu.get(e),i=r.cu.get(s.targetId);if(i.length>1)return r.cu.set(s.targetId,i.filter(a=>!ii(a,e))),void r.uu.delete(e);r.isPrimaryClient?(r.sharedClientState.removeLocalQueryTarget(s.targetId),r.sharedClientState.isActiveQueryTarget(s.targetId)||await vo(r.localStore,s.targetId,!1).then(()=>{r.sharedClientState.clearQueryState(s.targetId),t&&na(r.remoteStore,s.targetId),Ao(r,s.targetId)}).catch(Mn)):(Ao(r,s.targetId),await vo(r.localStore,s.targetId,!0))}async function qT(n,e){const t=j(n),r=t.uu.get(e),s=t.cu.get(r.targetId);t.isPrimaryClient&&s.length===1&&(t.sharedClientState.removeLocalQueryTarget(r.targetId),na(t.remoteStore,r.targetId))}async function jT(n,e,t){const r=QT(n);try{const s=await function(a,c){const l=j(a),d=ue.now(),f=c.reduce((R,S)=>R.add(S.key),G());let m,_;return l.persistence.runTransaction("Locally write mutations","readwrite",R=>{let S=ft(),N=G();return l.Bs.getEntries(R,f).next(k=>{S=k,S.forEach((B,M)=>{M.isValidDocument()||(N=N.add(B))})}).next(()=>l.localDocuments.getOverlayedDocuments(R,S)).next(k=>{m=k;const B=[];for(const M of c){const x=sE(M,m.get(M.key).overlayedDocument);x!=null&&B.push(new cn(M.key,x,Ph(x.value.mapValue),Xe.exists(!0)))}return l.mutationQueue.addMutationBatch(R,d,B,c)}).next(k=>{_=k;const B=k.applyToLocalDocumentSet(m,N);return l.documentOverlayCache.saveOverlays(R,k.batchId,B)})}).then(()=>({batchId:_.batchId,changes:Mh(m)}))}(r.localStore,e);r.sharedClientState.addPendingMutation(s.batchId),function(a,c,l){let d=a.Iu[a.currentUser.toKey()];d||(d=new ne(z)),d=d.insert(c,l),a.Iu[a.currentUser.toKey()]=d}(r,s.batchId,t),await Ur(r,s.changes),await di(r.remoteStore)}catch(s){const i=aa(s,"Failed to persist write");t.reject(i)}}async function _d(n,e){const t=j(n);try{const r=await tT(t.localStore,e);e.targetChanges.forEach((s,i)=>{const a=t.Pu.get(i);a&&(Q(s.addedDocuments.size+s.modifiedDocuments.size+s.removedDocuments.size<=1,22616),s.addedDocuments.size>0?a._u=!0:s.modifiedDocuments.size>0?Q(a._u,14607):s.removedDocuments.size>0&&(Q(a._u,42227),a._u=!1))}),await Ur(t,r,e)}catch(r){await Mn(r)}}function Yu(n,e,t){const r=j(n);if(r.isPrimaryClient&&t===0||!r.isPrimaryClient&&t===1){const s=[];r.uu.forEach((i,a)=>{const c=a.view.Da(e);c.snapshot&&s.push(c.snapshot)}),function(a,c){const l=j(a);l.onlineState=c;let d=!1;l.queries.forEach((f,m)=>{for(const _ of m.ya)_.Da(c)&&(d=!0)}),d&&la(l)}(r.eventManager,e),s.length&&r.au.j_(s),r.onlineState=e,r.isPrimaryClient&&r.sharedClientState.setOnlineState(e)}}async function $T(n,e,t){const r=j(n);r.sharedClientState.updateQueryState(e,"rejected",t);const s=r.Pu.get(e),i=s&&s.key;if(i){let a=new ne(L.comparator);a=a.insert(i,Ie.newNoDocument(i,q.min()));const c=G().add(i),l=new ui(q.min(),new Map,new ne(z),a,c);await _d(r,l),r.hu=r.hu.remove(i),r.Pu.delete(e),fa(r)}else await vo(r.localStore,e,!1).then(()=>Ao(r,e,t)).catch(Mn)}async function zT(n,e){const t=j(n),r=e.batch.batchId;try{const s=await eT(t.localStore,e);Ed(t,r,null),yd(t,r),t.sharedClientState.updateMutationState(r,"acknowledged"),await Ur(t,s)}catch(s){await Mn(s)}}async function HT(n,e,t){const r=j(n);try{const s=await function(a,c){const l=j(a);return l.persistence.runTransaction("Reject batch","readwrite-primary",d=>{let f;return l.mutationQueue.lookupMutationBatch(d,c).next(m=>(Q(m!==null,37113),f=m.keys(),l.mutationQueue.removeMutationBatch(d,m))).next(()=>l.mutationQueue.performConsistencyCheck(d)).next(()=>l.documentOverlayCache.removeOverlaysForBatchId(d,f,c)).next(()=>l.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(d,f)).next(()=>l.localDocuments.getDocuments(d,f))})}(r.localStore,e);Ed(r,e,t),yd(r,e),r.sharedClientState.updateMutationState(e,"rejected",t),await Ur(r,s)}catch(s){await Mn(s)}}function yd(n,e){(n.Eu.get(e)||[]).forEach(t=>{t.resolve()}),n.Eu.delete(e)}function Ed(n,e,t){const r=j(n);let s=r.Iu[r.currentUser.toKey()];if(s){const i=s.get(e);i&&(t?i.reject(t):i.resolve(),s=s.remove(e)),r.Iu[r.currentUser.toKey()]=s}}function Ao(n,e,t=null){n.sharedClientState.removeLocalQueryTarget(e);for(const r of n.cu.get(e))n.uu.delete(r),t&&n.au.Vu(r,t);n.cu.delete(e),n.isPrimaryClient&&n.Tu.Hr(e).forEach(r=>{n.Tu.containsKey(r)||Td(n,r)})}function Td(n,e){n.lu.delete(e.path.canonicalString());const t=n.hu.get(e);t!==null&&(na(n.remoteStore,t),n.hu=n.hu.remove(e),n.Pu.delete(t),fa(n))}function Ju(n,e,t){for(const r of t)r instanceof pd?(n.Tu.addReference(r.key,e),GT(n,r)):r instanceof md?(O(da,"Document no longer in limbo: "+r.key),n.Tu.removeReference(r.key,e),n.Tu.containsKey(r.key)||Td(n,r.key)):F(19791,{mu:r})}function GT(n,e){const t=e.key,r=t.path.canonicalString();n.hu.get(t)||n.lu.has(r)||(O(da,"New document in limbo: "+t),n.lu.add(r),fa(n))}function fa(n){for(;n.lu.size>0&&n.hu.size<n.maxConcurrentLimboResolutions;){const e=n.lu.values().next().value;n.lu.delete(e);const t=new L(J.fromString(e)),r=n.du.next();n.Pu.set(r,new LT(t)),n.hu=n.hu.insert(t,r),cd(n.remoteStore,new At(Qe(si(t.path)),r,"TargetPurposeLimboResolution",ei.le))}}async function Ur(n,e,t){const r=j(n),s=[],i=[],a=[];r.uu.isEmpty()||(r.uu.forEach((c,l)=>{a.push(r.Ru(l,e,t).then(d=>{var f;if((d||t)&&r.isPrimaryClient){const m=d?!d.fromCache:(f=t==null?void 0:t.targetChanges.get(l.targetId))===null||f===void 0?void 0:f.current;r.sharedClientState.updateQueryState(l.targetId,m?"current":"not-current")}if(d){s.push(d);const m=ea.Rs(l.targetId,d);i.push(m)}}))}),await Promise.all(a),r.au.j_(s),await async function(l,d){const f=j(l);try{await f.persistence.runTransaction("notifyLocalViewChanges","readwrite",m=>C.forEach(d,_=>C.forEach(_.ds,R=>f.persistence.referenceDelegate.addReference(m,_.targetId,R)).next(()=>C.forEach(_.As,R=>f.persistence.referenceDelegate.removeReference(m,_.targetId,R)))))}catch(m){if(!Un(m))throw m;O(ta,"Failed to update sequence numbers: "+m)}for(const m of d){const _=m.targetId;if(!m.fromCache){const R=f.xs.get(_),S=R.snapshotVersion,N=R.withLastLimboFreeSnapshotVersion(S);f.xs=f.xs.insert(_,N)}}}(r.localStore,i))}async function WT(n,e){const t=j(n);if(!t.currentUser.isEqual(e)){O(da,"User change. New user:",e.toKey());const r=await sd(t.localStore,e);t.currentUser=e,function(i,a){i.Eu.forEach(c=>{c.forEach(l=>{l.reject(new V(P.CANCELLED,a))})}),i.Eu.clear()}(t,"'waitForPendingWrites' promise is rejected due to a user change."),t.sharedClientState.handleUserChange(e,r.removedBatchIds,r.addedBatchIds),await Ur(t,r.ks)}}function KT(n,e){const t=j(n),r=t.Pu.get(e);if(r&&r._u)return G().add(r.key);{let s=G();const i=t.cu.get(e);if(!i)return s;for(const a of i){const c=t.uu.get(a);s=s.unionWith(c.view.Ya)}return s}}function vd(n){const e=j(n);return e.remoteStore.remoteSyncer.applyRemoteEvent=_d.bind(null,e),e.remoteStore.remoteSyncer.getRemoteKeysForTarget=KT.bind(null,e),e.remoteStore.remoteSyncer.rejectListen=$T.bind(null,e),e.au.j_=NT.bind(null,e.eventManager),e.au.Vu=DT.bind(null,e.eventManager),e}function QT(n){const e=j(n);return e.remoteStore.remoteSyncer.applySuccessfulWrite=zT.bind(null,e),e.remoteStore.remoteSyncer.rejectFailedWrite=HT.bind(null,e),e}class zs{constructor(){this.kind="memory",this.synchronizeTabs=!1}async initialize(e){this.serializer=li(e.databaseInfo.databaseId),this.sharedClientState=this.pu(e),this.persistence=this.yu(e),await this.persistence.start(),this.localStore=this.wu(e),this.gcScheduler=this.Su(e,this.localStore),this.indexBackfillerScheduler=this.bu(e,this.localStore)}Su(e,t){return null}bu(e,t){return null}wu(e){return ZE(this.persistence,new XE,e.initialUser,this.serializer)}yu(e){return new rd(Zo.fi,this.serializer)}pu(e){return new oT}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()}}zs.provider={build:()=>new zs};class XT extends zs{constructor(e){super(),this.cacheSizeBytes=e}Su(e,t){Q(this.persistence.referenceDelegate instanceof js,46915);const r=this.persistence.referenceDelegate.garbageCollector;return new LE(r,e.asyncQueue,t)}yu(e){const t=this.cacheSizeBytes!==void 0?Ce.withCacheSize(this.cacheSizeBytes):Ce.DEFAULT;return new rd(r=>js.fi(r,t),this.serializer)}}class Ro{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=>Yu(this.syncEngine,r,1),this.remoteStore.remoteSyncer.handleCredentialChange=WT.bind(null,this.syncEngine),await ST(this.remoteStore,this.syncEngine.isPrimaryClient))}createEventManager(e){return function(){return new kT}()}createDatastore(e){const t=li(e.databaseInfo.databaseId),r=function(i){return new hT(i)}(e.databaseInfo);return function(i,a,c,l){return new mT(i,a,c,l)}(e.authCredentials,e.appCheckCredentials,r,t)}createRemoteStore(e){return function(r,s,i,a,c){return new _T(r,s,i,a,c)}(this.localStore,this.datastore,e.asyncQueue,t=>Yu(this.syncEngine,t,0),function(){return Hu.C()?new Hu:new aT}())}createSyncEngine(e,t){return function(s,i,a,c,l,d,f){const m=new xT(s,i,a,c,l,d);return f&&(m.Au=!0),m}(this.localStore,this.remoteStore,this.eventManager,this.sharedClientState,e.initialUser,e.maxConcurrentLimboResolutions,t)}async terminate(){var e,t;await async function(s){const i=j(s);O(tn,"RemoteStore shutting down."),i.Ta.add(5),await Mr(i),i.Ea.shutdown(),i.da.set("Unknown")}(this.remoteStore),(e=this.datastore)===null||e===void 0||e.terminate(),(t=this.eventManager)===null||t===void 0||t.terminate()}}Ro.provider={build:()=>new Ro};/**
2947
2976
  * @license
2948
2977
  * Copyright 2020 Google LLC
2949
2978
  *
@@ -2973,7 +3002,7 @@ This typically indicates that your device does not have a healthy Internet conne
2973
3002
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2974
3003
  * See the License for the specific language governing permissions and
2975
3004
  * limitations under the License.
2976
- */class la{constructor(e){this.observer=e,this.muted=!1}next(e){this.muted||this.observer.next&&this.iu(this.observer.next,e)}error(e){this.muted||(this.observer.error?this.iu(this.observer.error,e):dt("Uncaught Error in snapshot listener:",e.toString()))}su(){this.muted=!0}iu(e,t){setTimeout(()=>{this.muted||e(t)},0)}}/**
3005
+ */class pa{constructor(e){this.observer=e,this.muted=!1}next(e){this.muted||this.observer.next&&this.vu(this.observer.next,e)}error(e){this.muted||(this.observer.error?this.vu(this.observer.error,e):dt("Uncaught Error in snapshot listener:",e.toString()))}Cu(){this.muted=!0}vu(e,t){setTimeout(()=>{this.muted||e(t)},0)}}/**
2977
3006
  * @license
2978
3007
  * Copyright 2017 Google LLC
2979
3008
  *
@@ -2988,7 +3017,7 @@ This typically indicates that your device does not have a healthy Internet conne
2988
3017
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2989
3018
  * See the License for the specific language governing permissions and
2990
3019
  * limitations under the License.
2991
- */const Vt="FirestoreClient";class $E{constructor(e,t,r,s,i){this.authCredentials=e,this.appCheckCredentials=t,this.asyncQueue=r,this.databaseInfo=s,this.user=ve.UNAUTHENTICATED,this.clientId=lh.newId(),this.authCredentialListener=()=>Promise.resolve(),this.appCheckCredentialListener=()=>Promise.resolve(),this._uninitializedComponentsProvider=i,this.authCredentials.start(r,async a=>{V(Vt,"Received user=",a.uid),await this.authCredentialListener(a),this.user=a}),this.appCheckCredentials.start(r,a=>(V(Vt,"Received new app check token=",a),this.appCheckCredentialListener(a,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}terminate(){this.asyncQueue.enterRestrictedMode();const e=new at;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=ra(t,"Failed to shutdown persistence");e.reject(r)}}),e.promise}}async function Ki(n,e){n.asyncQueue.verifyOperationInProgress(),V(Vt,"Initializing OfflineComponentProvider");const t=n.configuration;await e.initialize(t);let r=t.initialUser;n.setCredentialChangeListener(async s=>{r.isEqual(s)||(await Jh(e.localStore,s),r=s)}),e.persistence.setDatabaseDeletedListener(()=>n.terminate()),n._offlineComponents=e}async function Ku(n,e){n.asyncQueue.verifyOperationInProgress();const t=await jE(n);V(Vt,"Initializing OnlineComponentProvider"),await e.initialize(t,n.configuration),n.setCredentialChangeListener(r=>$u(e.remoteStore,r)),n.setAppCheckTokenChangeListener((r,s)=>$u(e.remoteStore,s)),n._onlineComponents=e}async function jE(n){if(!n._offlineComponents)if(n._uninitializedComponentsProvider){V(Vt,"Using user provided OfflineComponentProvider");try{await Ki(n,n._uninitializedComponentsProvider._offline)}catch(e){const t=e;if(!function(s){return s.name==="FirebaseError"?s.code===P.FAILED_PRECONDITION||s.code===P.UNIMPLEMENTED:!(typeof DOMException<"u"&&s instanceof DOMException)||s.code===22||s.code===20||s.code===11}(t))throw t;Rn("Error using user provided cache. Falling back to memory cache: "+t),await Ki(n,new qs)}}else V(Vt,"Using default OfflineComponentProvider"),await Ki(n,new qE(void 0));return n._offlineComponents}async function md(n){return n._onlineComponents||(n._uninitializedComponentsProvider?(V(Vt,"Using user provided OnlineComponentProvider"),await Ku(n,n._uninitializedComponentsProvider._online)):(V(Vt,"Using default OnlineComponentProvider"),await Ku(n,new vo))),n._onlineComponents}function HE(n){return md(n).then(e=>e.syncEngine)}async function $s(n){const e=await md(n),t=e.eventManager;return t.onListen=SE.bind(null,e.syncEngine),t.onUnlisten=NE.bind(null,e.syncEngine),t.onFirstRemoteStoreListen=CE.bind(null,e.syncEngine),t.onLastRemoteStoreUnlisten=DE.bind(null,e.syncEngine),t}function zE(n,e,t={}){const r=new at;return n.asyncQueue.enqueueAndForget(async()=>function(i,a,c,l,d){const f=new la({next:E=>{f.su(),a.enqueueAndForget(()=>ia(i,m));const R=E.docs.has(c);!R&&E.fromCache?d.reject(new O(P.UNAVAILABLE,"Failed to get document because the client is offline.")):R&&E.fromCache&&l&&l.source==="server"?d.reject(new O(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.)')):d.resolve(E)},error:E=>d.reject(E)}),m=new aa(ei(c.path),f,{includeMetadataChanges:!0,Ta:!0});return sa(i,m)}(await $s(n),n.asyncQueue,e,t,r)),r.promise}function GE(n,e,t={}){const r=new at;return n.asyncQueue.enqueueAndForget(async()=>function(i,a,c,l,d){const f=new la({next:E=>{f.su(),a.enqueueAndForget(()=>ia(i,m)),E.fromCache&&l.source==="server"?d.reject(new O(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.)')):d.resolve(E)},error:E=>d.reject(E)}),m=new aa(c,f,{includeMetadataChanges:!0,Ta:!0});return sa(i,m)}(await $s(n),n.asyncQueue,e,t,r)),r.promise}/**
3020
+ */const Ot="FirestoreClient";class YT{constructor(e,t,r,s,i){this.authCredentials=e,this.appCheckCredentials=t,this.asyncQueue=r,this.databaseInfo=s,this.user=ve.UNAUTHENTICATED,this.clientId=_h.newId(),this.authCredentialListener=()=>Promise.resolve(),this.appCheckCredentialListener=()=>Promise.resolve(),this._uninitializedComponentsProvider=i,this.authCredentials.start(r,async a=>{O(Ot,"Received user=",a.uid),await this.authCredentialListener(a),this.user=a}),this.appCheckCredentials.start(r,a=>(O(Ot,"Received new app check token=",a),this.appCheckCredentialListener(a,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}terminate(){this.asyncQueue.enterRestrictedMode();const e=new at;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 Ji(n,e){n.asyncQueue.verifyOperationInProgress(),O(Ot,"Initializing OfflineComponentProvider");const t=n.configuration;await e.initialize(t);let r=t.initialUser;n.setCredentialChangeListener(async s=>{r.isEqual(s)||(await sd(e.localStore,s),r=s)}),e.persistence.setDatabaseDeletedListener(()=>n.terminate()),n._offlineComponents=e}async function Zu(n,e){n.asyncQueue.verifyOperationInProgress();const t=await JT(n);O(Ot,"Initializing OnlineComponentProvider"),await e.initialize(t,n.configuration),n.setCredentialChangeListener(r=>Wu(e.remoteStore,r)),n.setAppCheckTokenChangeListener((r,s)=>Wu(e.remoteStore,s)),n._onlineComponents=e}async function JT(n){if(!n._offlineComponents)if(n._uninitializedComponentsProvider){O(Ot,"Using user provided OfflineComponentProvider");try{await Ji(n,n._uninitializedComponentsProvider._offline)}catch(e){const t=e;if(!function(s){return s.name==="FirebaseError"?s.code===P.FAILED_PRECONDITION||s.code===P.UNIMPLEMENTED:!(typeof DOMException<"u"&&s instanceof DOMException)||s.code===22||s.code===20||s.code===11}(t))throw t;Pn("Error using user provided cache. Falling back to memory cache: "+t),await Ji(n,new zs)}}else O(Ot,"Using default OfflineComponentProvider"),await Ji(n,new XT(void 0));return n._offlineComponents}async function Id(n){return n._onlineComponents||(n._uninitializedComponentsProvider?(O(Ot,"Using user provided OnlineComponentProvider"),await Zu(n,n._uninitializedComponentsProvider._online)):(O(Ot,"Using default OnlineComponentProvider"),await Zu(n,new Ro))),n._onlineComponents}function ZT(n){return Id(n).then(e=>e.syncEngine)}async function Hs(n){const e=await Id(n),t=e.eventManager;return t.onListen=MT.bind(null,e.syncEngine),t.onUnlisten=BT.bind(null,e.syncEngine),t.onFirstRemoteStoreListen=UT.bind(null,e.syncEngine),t.onLastRemoteStoreUnlisten=qT.bind(null,e.syncEngine),t}function ev(n,e,t={}){const r=new at;return n.asyncQueue.enqueueAndForget(async()=>function(i,a,c,l,d){const f=new pa({next:_=>{f.Cu(),a.enqueueAndForget(()=>ua(i,m));const R=_.docs.has(c);!R&&_.fromCache?d.reject(new V(P.UNAVAILABLE,"Failed to get document because the client is offline.")):R&&_.fromCache&&l&&l.source==="server"?d.reject(new V(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.)')):d.resolve(_)},error:_=>d.reject(_)}),m=new ha(si(c.path),f,{includeMetadataChanges:!0,La:!0});return ca(i,m)}(await Hs(n),n.asyncQueue,e,t,r)),r.promise}function tv(n,e,t={}){const r=new at;return n.asyncQueue.enqueueAndForget(async()=>function(i,a,c,l,d){const f=new pa({next:_=>{f.Cu(),a.enqueueAndForget(()=>ua(i,m)),_.fromCache&&l.source==="server"?d.reject(new V(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.)')):d.resolve(_)},error:_=>d.reject(_)}),m=new ha(c,f,{includeMetadataChanges:!0,La:!0});return ca(i,m)}(await Hs(n),n.asyncQueue,e,t,r)),r.promise}/**
2992
3021
  * @license
2993
3022
  * Copyright 2023 Google LLC
2994
3023
  *
@@ -3003,7 +3032,7 @@ This typically indicates that your device does not have a healthy Internet conne
3003
3032
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3004
3033
  * See the License for the specific language governing permissions and
3005
3034
  * limitations under the License.
3006
- */function gd(n){const e={};return n.timeoutSeconds!==void 0&&(e.timeoutSeconds=n.timeoutSeconds),e}/**
3035
+ */function wd(n){const e={};return n.timeoutSeconds!==void 0&&(e.timeoutSeconds=n.timeoutSeconds),e}/**
3007
3036
  * @license
3008
3037
  * Copyright 2020 Google LLC
3009
3038
  *
@@ -3018,7 +3047,7 @@ This typically indicates that your device does not have a healthy Internet conne
3018
3047
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3019
3048
  * See the License for the specific language governing permissions and
3020
3049
  * limitations under the License.
3021
- */const Qu=new Map;/**
3050
+ */const el=new Map;/**
3022
3051
  * @license
3023
3052
  * Copyright 2017 Google LLC
3024
3053
  *
@@ -3033,7 +3062,7 @@ This typically indicates that your device does not have a healthy Internet conne
3033
3062
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3034
3063
  * See the License for the specific language governing permissions and
3035
3064
  * limitations under the License.
3036
- */function ha(n,e,t){if(!t)throw new O(P.INVALID_ARGUMENT,`Function ${n}() cannot be called with an empty ${e}.`)}function WE(n,e,t,r){if(e===!0&&r===!0)throw new O(P.INVALID_ARGUMENT,`${n} and ${t} cannot be used together.`)}function Xu(n){if(!L.isDocumentKey(n))throw new O(P.INVALID_ARGUMENT,`Invalid document reference. Document references must have an even number of segments, but ${n} has ${n.length}.`)}function Ju(n){if(L.isDocumentKey(n))throw new O(P.INVALID_ARGUMENT,`Invalid collection reference. Collection references must have an odd number of segments, but ${n} has ${n.length}.`)}function ui(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":U()}function Le(n,e){if("_delegate"in n&&(n=n._delegate),!(n instanceof e)){if(e.name===n.constructor.name)throw new O(P.INVALID_ARGUMENT,"Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");{const t=ui(n);throw new O(P.INVALID_ARGUMENT,`Expected type '${e.name}', but it was: ${t}`)}}return n}function _d(n,e){if(e<=0)throw new O(P.INVALID_ARGUMENT,`Function ${n}() requires a positive number, but it was: ${e}.`)}/**
3065
+ */function ma(n,e,t){if(!t)throw new V(P.INVALID_ARGUMENT,`Function ${n}() cannot be called with an empty ${e}.`)}function nv(n,e,t,r){if(e===!0&&r===!0)throw new V(P.INVALID_ARGUMENT,`${n} and ${t} cannot be used together.`)}function tl(n){if(!L.isDocumentKey(n))throw new V(P.INVALID_ARGUMENT,`Invalid document reference. Document references must have an even number of segments, but ${n} has ${n.length}.`)}function nl(n){if(L.isDocumentKey(n))throw new V(P.INVALID_ARGUMENT,`Invalid collection reference. Collection references must have an odd number of segments, but ${n} has ${n.length}.`)}function fi(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":F(12329,{type:typeof n})}function Le(n,e){if("_delegate"in n&&(n=n._delegate),!(n instanceof e)){if(e.name===n.constructor.name)throw new V(P.INVALID_ARGUMENT,"Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");{const t=fi(n);throw new V(P.INVALID_ARGUMENT,`Expected type '${e.name}', but it was: ${t}`)}}return n}function Ad(n,e){if(e<=0)throw new V(P.INVALID_ARGUMENT,`Function ${n}() requires a positive number, but it was: ${e}.`)}/**
3037
3066
  * @license
3038
3067
  * Copyright 2020 Google LLC
3039
3068
  *
@@ -3048,7 +3077,7 @@ This typically indicates that your device does not have a healthy Internet conne
3048
3077
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3049
3078
  * See the License for the specific language governing permissions and
3050
3079
  * limitations under the License.
3051
- */const yd="firestore.googleapis.com",Yu=!0;class Zu{constructor(e){var t,r;if(e.host===void 0){if(e.ssl!==void 0)throw new O(P.INVALID_ARGUMENT,"Can't provide ssl option if host option is not set");this.host=yd,this.ssl=Yu}else this.host=e.host,this.ssl=(t=e.ssl)!==null&&t!==void 0?t:Yu;if(this.credentials=e.credentials,this.ignoreUndefinedProperties=!!e.ignoreUndefinedProperties,this.localCache=e.localCache,e.cacheSizeBytes===void 0)this.cacheSizeBytes=Qh;else{if(e.cacheSizeBytes!==-1&&e.cacheSizeBytes<AT)throw new O(P.INVALID_ARGUMENT,"cacheSizeBytes must be at least 1048576");this.cacheSizeBytes=e.cacheSizeBytes}WE("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=gd((r=e.experimentalLongPollingOptions)!==null&&r!==void 0?r:{}),function(i){if(i.timeoutSeconds!==void 0){if(isNaN(i.timeoutSeconds))throw new O(P.INVALID_ARGUMENT,`invalid long polling timeout: ${i.timeoutSeconds} (must not be NaN)`);if(i.timeoutSeconds<5)throw new O(P.INVALID_ARGUMENT,`invalid long polling timeout: ${i.timeoutSeconds} (minimum allowed value is 5)`);if(i.timeoutSeconds>30)throw new O(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 Mr{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 Zu({}),this._settingsFrozen=!1,this._emulatorOptions={},this._terminateTask="notTerminated"}get app(){if(!this._app)throw new O(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!=="notTerminated"}_setSettings(e){if(this._settingsFrozen)throw new O(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 Zu(e),this._emulatorOptions=e.emulatorOptions||{},e.credentials!==void 0&&(this._authCredentials=function(r){if(!r)return new ty;switch(r.type){case"firstParty":return new iy(r.sessionIndex||"0",r.iamToken||null,r.authTokenFactory||null);case"provider":return r.client;default:throw new O(P.INVALID_ARGUMENT,"makeAuthCredentialsProvider failed due to invalid credential type")}}(e.credentials))}_getSettings(){return this._settings}_getEmulatorOptions(){return this._emulatorOptions}_freezeSettings(){return this._settingsFrozen=!0,this._settings}_delete(){return this._terminateTask==="notTerminated"&&(this._terminateTask=this._terminate()),this._terminateTask}async _restart(){this._terminateTask==="notTerminated"?await this._terminate():this._terminateTask="notTerminated"}toJSON(){return{app:this._app,databaseId:this._databaseId,settings:this._settings}}_terminate(){return function(t){const r=Qu.get(t);r&&(V("ComponentProvider","Removing Datastore"),Qu.delete(t),r.terminate())}(this),Promise.resolve()}}function KE(n,e,t,r={}){var s;const i=(n=Le(n,Mr))._getSettings(),a=Object.assign(Object.assign({},i),{emulatorOptions:n._getEmulatorOptions()}),c=`${e}:${t}`;i.host!==yd&&i.host!==c&&Rn("Host has been set in both settings() and connectFirestoreEmulator(), emulator host will be used.");const l=Object.assign(Object.assign({},i),{host:c,ssl:!1,emulatorOptions:r});if(!Qt(l,a)&&(n._setSettings(l),r.mockUserToken)){let d,f;if(typeof r.mockUserToken=="string")d=r.mockUserToken,f=ve.MOCK_USER;else{d=_l(r.mockUserToken,(s=n._app)===null||s===void 0?void 0:s.options.projectId);const m=r.mockUserToken.sub||r.mockUserToken.user_id;if(!m)throw new O(P.INVALID_ARGUMENT,"mockUserToken must contain 'sub' or 'user_id' field!");f=new ve(m)}n._authCredentials=new ny(new ch(d,f))}}/**
3080
+ */const Rd="firestore.googleapis.com",rl=!0;class sl{constructor(e){var t,r;if(e.host===void 0){if(e.ssl!==void 0)throw new V(P.INVALID_ARGUMENT,"Can't provide ssl option if host option is not set");this.host=Rd,this.ssl=rl}else this.host=e.host,this.ssl=(t=e.ssl)!==null&&t!==void 0?t:rl;if(this.isUsingEmulator=e.emulatorOptions!==void 0,this.credentials=e.credentials,this.ignoreUndefinedProperties=!!e.ignoreUndefinedProperties,this.localCache=e.localCache,e.cacheSizeBytes===void 0)this.cacheSizeBytes=nd;else{if(e.cacheSizeBytes!==-1&&e.cacheSizeBytes<VE)throw new V(P.INVALID_ARGUMENT,"cacheSizeBytes must be at least 1048576");this.cacheSizeBytes=e.cacheSizeBytes}nv("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=wd((r=e.experimentalLongPollingOptions)!==null&&r!==void 0?r:{}),function(i){if(i.timeoutSeconds!==void 0){if(isNaN(i.timeoutSeconds))throw new V(P.INVALID_ARGUMENT,`invalid long polling timeout: ${i.timeoutSeconds} (must not be NaN)`);if(i.timeoutSeconds<5)throw new V(P.INVALID_ARGUMENT,`invalid long polling timeout: ${i.timeoutSeconds} (minimum allowed value is 5)`);if(i.timeoutSeconds>30)throw new V(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 Fr{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 sl({}),this._settingsFrozen=!1,this._emulatorOptions={},this._terminateTask="notTerminated"}get app(){if(!this._app)throw new V(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!=="notTerminated"}_setSettings(e){if(this._settingsFrozen)throw new V(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 sl(e),this._emulatorOptions=e.emulatorOptions||{},e.credentials!==void 0&&(this._authCredentials=function(r){if(!r)return new ly;switch(r.type){case"firstParty":return new py(r.sessionIndex||"0",r.iamToken||null,r.authTokenFactory||null);case"provider":return r.client;default:throw new V(P.INVALID_ARGUMENT,"makeAuthCredentialsProvider failed due to invalid credential type")}}(e.credentials))}_getSettings(){return this._settings}_getEmulatorOptions(){return this._emulatorOptions}_freezeSettings(){return this._settingsFrozen=!0,xt("Firestore",this._settings.isUsingEmulator),this._settings}_delete(){return this._terminateTask==="notTerminated"&&(this._terminateTask=this._terminate()),this._terminateTask}async _restart(){this._terminateTask==="notTerminated"?await this._terminate():this._terminateTask="notTerminated"}toJSON(){return{app:this._app,databaseId:this._databaseId,settings:this._settings}}_terminate(){return function(t){const r=el.get(t);r&&(O("ComponentProvider","Removing Datastore"),el.delete(t),r.terminate())}(this),Promise.resolve()}}function rv(n,e,t,r={}){var s;n=Le(n,Fr);const i=Lt(e),a=n._getSettings(),c=Object.assign(Object.assign({},a),{emulatorOptions:n._getEmulatorOptions()}),l=`${e}:${t}`;a.host!==Rd&&a.host!==l&&Pn("Host has been set in both settings() and connectFirestoreEmulator(), emulator host will be used.");const d=Object.assign(Object.assign({},a),{host:l,ssl:i,emulatorOptions:r});if(!Yt(d,c)&&(n._setSettings(d),i&&(Qs(`https://${l}`),xt("Firestore",!0)),r.mockUserToken)){let f,m;if(typeof r.mockUserToken=="string")f=r.mockUserToken,m=ve.MOCK_USER;else{f=wl(r.mockUserToken,(s=n._app)===null||s===void 0?void 0:s.options.projectId);const _=r.mockUserToken.sub||r.mockUserToken.user_id;if(!_)throw new V(P.INVALID_ARGUMENT,"mockUserToken must contain 'sub' or 'user_id' field!");m=new ve(_)}n._authCredentials=new hy(new mh(f,m))}}/**
3052
3081
  * @license
3053
3082
  * Copyright 2020 Google LLC
3054
3083
  *
@@ -3063,7 +3092,7 @@ This typically indicates that your device does not have a healthy Internet conne
3063
3092
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3064
3093
  * See the License for the specific language governing permissions and
3065
3094
  * limitations under the License.
3066
- */class ze{constructor(e,t,r){this.converter=t,this._query=r,this.type="query",this.firestore=e}withConverter(e){return new ze(this.firestore,e,this._query)}}class Se{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 Pt(this.firestore,this.converter,this._key.path.popLast())}withConverter(e){return new Se(this.firestore,e,this._key)}}class Pt extends ze{constructor(e,t,r){super(e,t,ei(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 Se(this.firestore,null,new L(e))}withConverter(e){return new Pt(this.firestore,e,this._path)}}function Td(n,e,...t){if(n=Z(n),ha("collection","path",e),n instanceof Mr){const r=Y.fromString(e,...t);return Ju(r),new Pt(n,null,r)}{if(!(n instanceof Se||n instanceof Pt))throw new O(P.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const r=n._path.child(Y.fromString(e,...t));return Ju(r),new Pt(n.firestore,null,r)}}function Ed(n,e){if(n=Le(n,Mr),ha("collectionGroup","collection id",e),e.indexOf("/")>=0)throw new O(P.INVALID_ARGUMENT,`Invalid collection ID '${e}' passed to function collectionGroup(). Collection IDs must not contain '/'.`);return new ze(n,null,function(r){return new Ut(Y.emptyPath(),r)}(e))}function Un(n,e,...t){if(n=Z(n),arguments.length===1&&(e=lh.newId()),ha("doc","path",e),n instanceof Mr){const r=Y.fromString(e,...t);return Xu(r),new Se(n,null,new L(r))}{if(!(n instanceof Se||n instanceof Pt))throw new O(P.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const r=n._path.child(Y.fromString(e,...t));return Xu(r),new Se(n.firestore,n instanceof Pt?n.converter:null,new L(r))}}/**
3095
+ */class He{constructor(e,t,r){this.converter=t,this._query=r,this.type="query",this.firestore=e}withConverter(e){return new He(this.firestore,e,this._query)}}class Se{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 Pt(this.firestore,this.converter,this._key.path.popLast())}withConverter(e){return new Se(this.firestore,e,this._key)}}class Pt extends He{constructor(e,t,r){super(e,t,si(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 Se(this.firestore,null,new L(e))}withConverter(e){return new Pt(this.firestore,e,this._path)}}function bd(n,e,...t){if(n=Z(n),ma("collection","path",e),n instanceof Fr){const r=J.fromString(e,...t);return nl(r),new Pt(n,null,r)}{if(!(n instanceof Se||n instanceof Pt))throw new V(P.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const r=n._path.child(J.fromString(e,...t));return nl(r),new Pt(n.firestore,null,r)}}function Pd(n,e){if(n=Le(n,Fr),ma("collectionGroup","collection id",e),e.indexOf("/")>=0)throw new V(P.INVALID_ARGUMENT,`Invalid collection ID '${e}' passed to function collectionGroup(). Collection IDs must not contain '/'.`);return new He(n,null,function(r){return new Bt(J.emptyPath(),r)}(e))}function Bn(n,e,...t){if(n=Z(n),arguments.length===1&&(e=_h.newId()),ma("doc","path",e),n instanceof Fr){const r=J.fromString(e,...t);return tl(r),new Se(n,null,new L(r))}{if(!(n instanceof Se||n instanceof Pt))throw new V(P.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const r=n._path.child(J.fromString(e,...t));return tl(r),new Se(n.firestore,n instanceof Pt?n.converter:null,new L(r))}}/**
3067
3096
  * @license
3068
3097
  * Copyright 2020 Google LLC
3069
3098
  *
@@ -3078,8 +3107,23 @@ This typically indicates that your device does not have a healthy Internet conne
3078
3107
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3079
3108
  * See the License for the specific language governing permissions and
3080
3109
  * limitations under the License.
3081
- */const el="AsyncQueue";class tl{constructor(e=Promise.resolve()){this.Vu=[],this.mu=!1,this.fu=[],this.gu=null,this.pu=!1,this.yu=!1,this.wu=[],this.a_=new Zh(this,"async_queue_retry"),this.Su=()=>{const r=Wi();r&&V(el,"Visibility state changed to "+r.visibilityState),this.a_.t_()},this.bu=e;const t=Wi();t&&typeof t.addEventListener=="function"&&t.addEventListener("visibilitychange",this.Su)}get isShuttingDown(){return this.mu}enqueueAndForget(e){this.enqueue(e)}enqueueAndForgetEvenWhileRestricted(e){this.Du(),this.vu(e)}enterRestrictedMode(e){if(!this.mu){this.mu=!0,this.yu=e||!1;const t=Wi();t&&typeof t.removeEventListener=="function"&&t.removeEventListener("visibilitychange",this.Su)}}enqueue(e){if(this.Du(),this.mu)return new Promise(()=>{});const t=new at;return this.vu(()=>this.mu&&this.yu?Promise.resolve():(e().then(t.resolve,t.reject),t.promise)).then(()=>t.promise)}enqueueRetryable(e){this.enqueueAndForget(()=>(this.Vu.push(e),this.Cu()))}async Cu(){if(this.Vu.length!==0){try{await this.Vu[0](),this.Vu.shift(),this.a_.reset()}catch(e){if(!Mn(e))throw e;V(el,"Operation failed with retryable error: "+e)}this.Vu.length>0&&this.a_.Xo(()=>this.Cu())}}vu(e){const t=this.bu.then(()=>(this.pu=!0,e().catch(r=>{this.gu=r,this.pu=!1;const s=function(a){let c=a.message||"";return a.stack&&(c=a.stack.includes(a.message)?a.stack:a.message+`
3082
- `+a.stack),c}(r);throw dt("INTERNAL UNHANDLED ERROR: ",s),r}).then(r=>(this.pu=!1,r))));return this.bu=t,t}enqueueAfterDelay(e,t,r){this.Du(),this.wu.indexOf(e)>-1&&(t=0);const s=na.createAndSchedule(this,e,t,r,i=>this.Fu(i));return this.fu.push(s),s}Du(){this.gu&&U()}verifyOperationInProgress(){}async Mu(){let e;do e=this.bu,await e;while(e!==this.bu)}xu(e){for(const t of this.fu)if(t.timerId===e)return!0;return!1}Ou(e){return this.Mu().then(()=>{this.fu.sort((t,r)=>t.targetTimeMs-r.targetTimeMs);for(const t of this.fu)if(t.skipDelay(),e!=="all"&&t.timerId===e)break;return this.Mu()})}Nu(e){this.wu.push(e)}Fu(e){const t=this.fu.indexOf(e);this.fu.splice(t,1)}}function nl(n){return function(t,r){if(typeof t!="object"||t===null)return!1;const s=t;for(const i of r)if(i in s&&typeof s[i]=="function")return!0;return!1}(n,["next","error","complete"])}class en extends Mr{constructor(e,t,r,s){super(e,t,r,s),this.type="firestore",this._queue=new tl,this._persistenceKey=(s==null?void 0:s.name)||"[DEFAULT]"}async _terminate(){if(this._firestoreClient){const e=this._firestoreClient.terminate();this._queue=new tl(e),this._firestoreClient=void 0,await e}}}function QE(n,e){const t=typeof n=="object"?n:Gs(),r=typeof n=="string"?n:Ds,s=Pr(t,"firestore").getImmediate({identifier:r});if(!s._initialized){const i=Ao("firestore");i&&KE(s,...i)}return s}function li(n){if(n._terminated)throw new O(P.FAILED_PRECONDITION,"The client has already been terminated.");return n._firestoreClient||XE(n),n._firestoreClient}function XE(n){var e,t,r;const s=n._freezeSettings(),i=function(c,l,d,f){return new Ey(c,l,d,f.host,f.ssl,f.experimentalForceLongPolling,f.experimentalAutoDetectLongPolling,gd(f.experimentalLongPollingOptions),f.useFetchStreams)}(n._databaseId,((e=n._app)===null||e===void 0?void 0:e.options.appId)||"",n._persistenceKey,s);n._componentsProvider||!((t=s.localCache)===null||t===void 0)&&t._offlineComponentProvider&&(!((r=s.localCache)===null||r===void 0)&&r._onlineComponentProvider)&&(n._componentsProvider={_offline:s.localCache._offlineComponentProvider,_online:s.localCache._onlineComponentProvider}),n._firestoreClient=new $E(n._authCredentials,n._appCheckCredentials,n._queue,i,n._componentsProvider&&function(c){const l=c==null?void 0:c._online.build();return{_offline:c==null?void 0:c._offline.build(l),_online:l}}(n._componentsProvider))}/**
3110
+ */const il="AsyncQueue";class ol{constructor(e=Promise.resolve()){this.zu=[],this.ju=!1,this.Hu=[],this.Ju=null,this.Yu=!1,this.Zu=!1,this.Xu=[],this.C_=new od(this,"async_queue_retry"),this.ec=()=>{const r=Yi();r&&O(il,"Visibility state changed to "+r.visibilityState),this.C_.p_()},this.tc=e;const t=Yi();t&&typeof t.addEventListener=="function"&&t.addEventListener("visibilitychange",this.ec)}get isShuttingDown(){return this.ju}enqueueAndForget(e){this.enqueue(e)}enqueueAndForgetEvenWhileRestricted(e){this.nc(),this.rc(e)}enterRestrictedMode(e){if(!this.ju){this.ju=!0,this.Zu=e||!1;const t=Yi();t&&typeof t.removeEventListener=="function"&&t.removeEventListener("visibilitychange",this.ec)}}enqueue(e){if(this.nc(),this.ju)return new Promise(()=>{});const t=new at;return this.rc(()=>this.ju&&this.Zu?Promise.resolve():(e().then(t.resolve,t.reject),t.promise)).then(()=>t.promise)}enqueueRetryable(e){this.enqueueAndForget(()=>(this.zu.push(e),this.sc()))}async sc(){if(this.zu.length!==0){try{await this.zu[0](),this.zu.shift(),this.C_.reset()}catch(e){if(!Un(e))throw e;O(il,"Operation failed with retryable error: "+e)}this.zu.length>0&&this.C_.f_(()=>this.sc())}}rc(e){const t=this.tc.then(()=>(this.Yu=!0,e().catch(r=>{throw this.Ju=r,this.Yu=!1,dt("INTERNAL UNHANDLED ERROR: ",al(r)),r}).then(r=>(this.Yu=!1,r))));return this.tc=t,t}enqueueAfterDelay(e,t,r){this.nc(),this.Xu.indexOf(e)>-1&&(t=0);const s=oa.createAndSchedule(this,e,t,r,i=>this.oc(i));return this.Hu.push(s),s}nc(){this.Ju&&F(47125,{_c:al(this.Ju)})}verifyOperationInProgress(){}async ac(){let e;do e=this.tc,await e;while(e!==this.tc)}uc(e){for(const t of this.Hu)if(t.timerId===e)return!0;return!1}cc(e){return this.ac().then(()=>{this.Hu.sort((t,r)=>t.targetTimeMs-r.targetTimeMs);for(const t of this.Hu)if(t.skipDelay(),e!=="all"&&t.timerId===e)break;return this.ac()})}lc(e){this.Xu.push(e)}oc(e){const t=this.Hu.indexOf(e);this.Hu.splice(t,1)}}function al(n){let e=n.message||"";return n.stack&&(e=n.stack.includes(n.message)?n.stack:n.message+`
3111
+ `+n.stack),e}/**
3112
+ * @license
3113
+ * Copyright 2017 Google LLC
3114
+ *
3115
+ * Licensed under the Apache License, Version 2.0 (the "License");
3116
+ * you may not use this file except in compliance with the License.
3117
+ * You may obtain a copy of the License at
3118
+ *
3119
+ * http://www.apache.org/licenses/LICENSE-2.0
3120
+ *
3121
+ * Unless required by applicable law or agreed to in writing, software
3122
+ * distributed under the License is distributed on an "AS IS" BASIS,
3123
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3124
+ * See the License for the specific language governing permissions and
3125
+ * limitations under the License.
3126
+ */function cl(n){return function(t,r){if(typeof t!="object"||t===null)return!1;const s=t;for(const i of r)if(i in s&&typeof s[i]=="function")return!0;return!1}(n,["next","error","complete"])}class nn extends Fr{constructor(e,t,r,s){super(e,t,r,s),this.type="firestore",this._queue=new ol,this._persistenceKey=(s==null?void 0:s.name)||"[DEFAULT]"}async _terminate(){if(this._firestoreClient){const e=this._firestoreClient.terminate();this._queue=new ol(e),this._firestoreClient=void 0,await e}}}function sv(n,e){const t=typeof n=="object"?n:Xs(),r=typeof n=="string"?n:Ls,s=kr(t,"firestore").getImmediate({identifier:r});if(!s._initialized){const i=So("firestore");i&&rv(s,...i)}return s}function pi(n){if(n._terminated)throw new V(P.FAILED_PRECONDITION,"The client has already been terminated.");return n._firestoreClient||iv(n),n._firestoreClient}function iv(n){var e,t,r;const s=n._freezeSettings(),i=function(c,l,d,f){return new Cy(c,l,d,f.host,f.ssl,f.experimentalForceLongPolling,f.experimentalAutoDetectLongPolling,wd(f.experimentalLongPollingOptions),f.useFetchStreams,f.isUsingEmulator)}(n._databaseId,((e=n._app)===null||e===void 0?void 0:e.options.appId)||"",n._persistenceKey,s);n._componentsProvider||!((t=s.localCache)===null||t===void 0)&&t._offlineComponentProvider&&(!((r=s.localCache)===null||r===void 0)&&r._onlineComponentProvider)&&(n._componentsProvider={_offline:s.localCache._offlineComponentProvider,_online:s.localCache._onlineComponentProvider}),n._firestoreClient=new YT(n._authCredentials,n._appCheckCredentials,n._queue,i,n._componentsProvider&&function(c){const l=c==null?void 0:c._online.build();return{_offline:c==null?void 0:c._offline.build(l),_online:l}}(n._componentsProvider))}/**
3083
3127
  * @license
3084
3128
  * Copyright 2020 Google LLC
3085
3129
  *
@@ -3094,7 +3138,7 @@ This typically indicates that your device does not have a healthy Internet conne
3094
3138
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3095
3139
  * See the License for the specific language governing permissions and
3096
3140
  * limitations under the License.
3097
- */class Dn{constructor(e){this._byteString=e}static fromBase64String(e){try{return new Dn(me.fromBase64String(e))}catch(t){throw new O(P.INVALID_ARGUMENT,"Failed to construct data from Base64 string: "+t)}}static fromUint8Array(e){return new Dn(me.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)}}/**
3141
+ */class On{constructor(e){this._byteString=e}static fromBase64String(e){try{return new On(me.fromBase64String(e))}catch(t){throw new V(P.INVALID_ARGUMENT,"Failed to construct data from Base64 string: "+t)}}static fromUint8Array(e){return new On(me.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)}}/**
3098
3142
  * @license
3099
3143
  * Copyright 2020 Google LLC
3100
3144
  *
@@ -3109,7 +3153,7 @@ This typically indicates that your device does not have a healthy Internet conne
3109
3153
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3110
3154
  * See the License for the specific language governing permissions and
3111
3155
  * limitations under the License.
3112
- */class da{constructor(...e){for(let t=0;t<e.length;++t)if(e[t].length===0)throw new O(P.INVALID_ARGUMENT,"Invalid field name at argument $(i + 1). Field names must not be empty.");this._internalPath=new pe(e)}isEqual(e){return this._internalPath.isEqual(e._internalPath)}}/**
3156
+ */class ga{constructor(...e){for(let t=0;t<e.length;++t)if(e[t].length===0)throw new V(P.INVALID_ARGUMENT,"Invalid field name at argument $(i + 1). Field names must not be empty.");this._internalPath=new pe(e)}isEqual(e){return this._internalPath.isEqual(e._internalPath)}}/**
3113
3157
  * @license
3114
3158
  * Copyright 2020 Google LLC
3115
3159
  *
@@ -3124,7 +3168,7 @@ This typically indicates that your device does not have a healthy Internet conne
3124
3168
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3125
3169
  * See the License for the specific language governing permissions and
3126
3170
  * limitations under the License.
3127
- */class vd{constructor(e){this._methodName=e}}/**
3171
+ */class Sd{constructor(e){this._methodName=e}}/**
3128
3172
  * @license
3129
3173
  * Copyright 2017 Google LLC
3130
3174
  *
@@ -3139,7 +3183,7 @@ This typically indicates that your device does not have a healthy Internet conne
3139
3183
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3140
3184
  * See the License for the specific language governing permissions and
3141
3185
  * limitations under the License.
3142
- */class fa{constructor(e,t){if(!isFinite(e)||e<-90||e>90)throw new O(P.INVALID_ARGUMENT,"Latitude must be a number between -90 and 90, but was: "+e);if(!isFinite(t)||t<-180||t>180)throw new O(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 H(this._lat,e._lat)||H(this._long,e._long)}}/**
3186
+ */class _a{constructor(e,t){if(!isFinite(e)||e<-90||e>90)throw new V(P.INVALID_ARGUMENT,"Latitude must be a number between -90 and 90, but was: "+e);if(!isFinite(t)||t<-180||t>180)throw new V(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 z(this._lat,e._lat)||z(this._long,e._long)}}/**
3143
3187
  * @license
3144
3188
  * Copyright 2024 Google LLC
3145
3189
  *
@@ -3154,7 +3198,7 @@ This typically indicates that your device does not have a healthy Internet conne
3154
3198
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3155
3199
  * See the License for the specific language governing permissions and
3156
3200
  * limitations under the License.
3157
- */class pa{constructor(e){this._values=(e||[]).map(t=>t)}toArray(){return this._values.map(e=>e)}isEqual(e){return function(r,s){if(r.length!==s.length)return!1;for(let i=0;i<r.length;++i)if(r[i]!==s[i])return!1;return!0}(this._values,e._values)}}/**
3201
+ */class ya{constructor(e){this._values=(e||[]).map(t=>t)}toArray(){return this._values.map(e=>e)}isEqual(e){return function(r,s){if(r.length!==s.length)return!1;for(let i=0;i<r.length;++i)if(r[i]!==s[i])return!1;return!0}(this._values,e._values)}}/**
3158
3202
  * @license
3159
3203
  * Copyright 2017 Google LLC
3160
3204
  *
@@ -3169,7 +3213,7 @@ This typically indicates that your device does not have a healthy Internet conne
3169
3213
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3170
3214
  * See the License for the specific language governing permissions and
3171
3215
  * limitations under the License.
3172
- */const JE=/^__.*__$/;class YE{constructor(e,t,r){this.data=e,this.fieldMask=t,this.fieldTransforms=r}toMutation(e,t){return this.fieldMask!==null?new on(e,this.data,this.fieldMask,t,this.fieldTransforms):new Dr(e,this.data,t,this.fieldTransforms)}}function Id(n){switch(n){case 0:case 2:case 1:return!0;case 3:case 4:return!1;default:throw U()}}class ma{constructor(e,t,r,s,i,a){this.settings=e,this.databaseId=t,this.serializer=r,this.ignoreUndefinedProperties=s,i===void 0&&this.Bu(),this.fieldTransforms=i||[],this.fieldMask=a||[]}get path(){return this.settings.path}get Lu(){return this.settings.Lu}ku(e){return new ma(Object.assign(Object.assign({},this.settings),e),this.databaseId,this.serializer,this.ignoreUndefinedProperties,this.fieldTransforms,this.fieldMask)}qu(e){var t;const r=(t=this.path)===null||t===void 0?void 0:t.child(e),s=this.ku({path:r,Qu:!1});return s.$u(e),s}Uu(e){var t;const r=(t=this.path)===null||t===void 0?void 0:t.child(e),s=this.ku({path:r,Qu:!1});return s.Bu(),s}Ku(e){return this.ku({path:void 0,Qu:!0})}Wu(e){return js(e,this.settings.methodName,this.settings.Gu||!1,this.path,this.settings.zu)}contains(e){return this.fieldMask.find(t=>e.isPrefixOf(t))!==void 0||this.fieldTransforms.find(t=>e.isPrefixOf(t.field))!==void 0}Bu(){if(this.path)for(let e=0;e<this.path.length;e++)this.$u(this.path.get(e))}$u(e){if(e.length===0)throw this.Wu("Document fields must not be empty");if(Id(this.Lu)&&JE.test(e))throw this.Wu('Document fields cannot begin and end with "__"')}}class ZE{constructor(e,t,r){this.databaseId=e,this.ignoreUndefinedProperties=t,this.serializer=r||oi(e)}ju(e,t,r,s=!1){return new ma({Lu:e,methodName:t,zu:r,path:pe.emptyPath(),Qu:!1,Gu:s},this.databaseId,this.serializer,this.ignoreUndefinedProperties)}}function ga(n){const e=n._freezeSettings(),t=oi(n._databaseId);return new ZE(n._databaseId,!!e.ignoreUndefinedProperties,t)}function ev(n,e,t,r,s,i={}){const a=n.ju(i.merge||i.mergeFields?2:0,e,t,s);bd("Data must be an object, but it was:",a,r);const c=Ad(r,a);let l,d;if(i.merge)l=new Be(a.fieldMask),d=a.fieldTransforms;else if(i.mergeFields){const f=[];for(const m of i.mergeFields){const E=tv(e,m,t);if(!a.contains(E))throw new O(P.INVALID_ARGUMENT,`Field '${E}' is specified in your field mask but missing from your input data.`);rv(f,E)||f.push(E)}l=new Be(f),d=a.fieldTransforms.filter(m=>l.covers(m.field))}else l=null,d=a.fieldTransforms;return new YE(new Ve(c),l,d)}function wd(n,e,t,r=!1){return _a(t,n.ju(r?4:3,e))}function _a(n,e){if(Rd(n=Z(n)))return bd("Unsupported field value:",e,n),Ad(n,e);if(n instanceof vd)return function(r,s){if(!Id(s.Lu))throw s.Wu(`${r._methodName}() can only be used with update() and set()`);if(!s.path)throw s.Wu(`${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.Qu&&e.Lu!==4)throw e.Wu("Nested arrays are not supported");return function(r,s){const i=[];let a=0;for(const c of r){let l=_a(c,s.Ku(a));l==null&&(l={nullValue:"NULL_VALUE"}),i.push(l),a++}return{arrayValue:{values:i}}}(n,e)}return function(r,s){if((r=Z(r))===null)return{nullValue:"NULL_VALUE"};if(typeof r=="number")return jy(s.serializer,r);if(typeof r=="boolean")return{booleanValue:r};if(typeof r=="string")return{stringValue:r};if(r instanceof Date){const i=ue.fromDate(r);return{timestampValue:Us(s.serializer,i)}}if(r instanceof ue){const i=new ue(r.seconds,1e3*Math.floor(r.nanoseconds/1e3));return{timestampValue:Us(s.serializer,i)}}if(r instanceof fa)return{geoPointValue:{latitude:r.latitude,longitude:r.longitude}};if(r instanceof Dn)return{bytesValue:$h(s.serializer,r._byteString)};if(r instanceof Se){const i=s.databaseId,a=r.firestore._databaseId;if(!a.isEqual(i))throw s.Wu(`Document reference is for database ${a.projectId}/${a.database} but should be for database ${i.projectId}/${i.database}`);return{referenceValue:Wo(r.firestore._databaseId||s.databaseId,r._key.path)}}if(r instanceof pa)return function(a,c){return{mapValue:{fields:{[yh]:{stringValue:Th},[Os]:{arrayValue:{values:a.toArray().map(d=>{if(typeof d!="number")throw c.Wu("VectorValues must only contain numeric values.");return jo(c.serializer,d)})}}}}}}(r,s);throw s.Wu(`Unsupported field value: ${ui(r)}`)}(n,e)}function Ad(n,e){const t={};return dh(n)?e.path&&e.path.length>0&&e.fieldMask.push(e.path):rn(n,(r,s)=>{const i=_a(s,e.qu(r));i!=null&&(t[r]=i)}),{mapValue:{fields:t}}}function Rd(n){return!(typeof n!="object"||n===null||n instanceof Array||n instanceof Date||n instanceof ue||n instanceof fa||n instanceof Dn||n instanceof Se||n instanceof vd||n instanceof pa)}function bd(n,e,t){if(!Rd(t)||!function(s){return typeof s=="object"&&s!==null&&(Object.getPrototypeOf(s)===Object.prototype||Object.getPrototypeOf(s)===null)}(t)){const r=ui(t);throw r==="an object"?e.Wu(n+" a custom object"):e.Wu(n+" "+r)}}function tv(n,e,t){if((e=Z(e))instanceof da)return e._internalPath;if(typeof e=="string")return Pd(n,e);throw js("Field path arguments must be of type string or ",n,!1,void 0,t)}const nv=new RegExp("[~\\*/\\[\\]]");function Pd(n,e,t){if(e.search(nv)>=0)throw js(`Invalid field path (${e}). Paths must not contain '~', '*', '/', '[', or ']'`,n,!1,void 0,t);try{return new da(...e.split("."))._internalPath}catch{throw js(`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`,n,!1,void 0,t)}}function js(n,e,t,r,s){const i=r&&!r.isEmpty(),a=s!==void 0;let c=`Function ${e}() called with invalid data`;t&&(c+=" (via `toFirestore()`)"),c+=". ";let l="";return(i||a)&&(l+=" (found",i&&(l+=` in field ${r}`),a&&(l+=` in document ${s}`),l+=")"),new O(P.INVALID_ARGUMENT,c+n+l)}function rv(n,e){return n.some(t=>t.isEqual(e))}/**
3216
+ */const ov=/^__.*__$/;class av{constructor(e,t,r){this.data=e,this.fieldMask=t,this.fieldTransforms=r}toMutation(e,t){return this.fieldMask!==null?new cn(e,this.data,this.fieldMask,t,this.fieldTransforms):new Lr(e,this.data,t,this.fieldTransforms)}}function Cd(n){switch(n){case 0:case 2:case 1:return!0;case 3:case 4:return!1;default:throw F(40011,{hc:n})}}class Ea{constructor(e,t,r,s,i,a){this.settings=e,this.databaseId=t,this.serializer=r,this.ignoreUndefinedProperties=s,i===void 0&&this.Pc(),this.fieldTransforms=i||[],this.fieldMask=a||[]}get path(){return this.settings.path}get hc(){return this.settings.hc}Tc(e){return new Ea(Object.assign(Object.assign({},this.settings),e),this.databaseId,this.serializer,this.ignoreUndefinedProperties,this.fieldTransforms,this.fieldMask)}Ic(e){var t;const r=(t=this.path)===null||t===void 0?void 0:t.child(e),s=this.Tc({path:r,Ec:!1});return s.dc(e),s}Ac(e){var t;const r=(t=this.path)===null||t===void 0?void 0:t.child(e),s=this.Tc({path:r,Ec:!1});return s.Pc(),s}Rc(e){return this.Tc({path:void 0,Ec:!0})}Vc(e){return Gs(e,this.settings.methodName,this.settings.mc||!1,this.path,this.settings.fc)}contains(e){return this.fieldMask.find(t=>e.isPrefixOf(t))!==void 0||this.fieldTransforms.find(t=>e.isPrefixOf(t.field))!==void 0}Pc(){if(this.path)for(let e=0;e<this.path.length;e++)this.dc(this.path.get(e))}dc(e){if(e.length===0)throw this.Vc("Document fields must not be empty");if(Cd(this.hc)&&ov.test(e))throw this.Vc('Document fields cannot begin and end with "__"')}}class cv{constructor(e,t,r){this.databaseId=e,this.ignoreUndefinedProperties=t,this.serializer=r||li(e)}gc(e,t,r,s=!1){return new Ea({hc:e,methodName:t,fc:r,path:pe.emptyPath(),Ec:!1,mc:s},this.databaseId,this.serializer,this.ignoreUndefinedProperties)}}function Ta(n){const e=n._freezeSettings(),t=li(n._databaseId);return new cv(n._databaseId,!!e.ignoreUndefinedProperties,t)}function uv(n,e,t,r,s,i={}){const a=n.gc(i.merge||i.mergeFields?2:0,e,t,s);Vd("Data must be an object, but it was:",a,r);const c=Nd(r,a);let l,d;if(i.merge)l=new Be(a.fieldMask),d=a.fieldTransforms;else if(i.mergeFields){const f=[];for(const m of i.mergeFields){const _=lv(e,m,t);if(!a.contains(_))throw new V(P.INVALID_ARGUMENT,`Field '${_}' is specified in your field mask but missing from your input data.`);dv(f,_)||f.push(_)}l=new Be(f),d=a.fieldTransforms.filter(m=>l.covers(m.field))}else l=null,d=a.fieldTransforms;return new av(new Oe(c),l,d)}function kd(n,e,t,r=!1){return va(t,n.gc(r?4:3,e))}function va(n,e){if(Dd(n=Z(n)))return Vd("Unsupported field value:",e,n),Nd(n,e);if(n instanceof Sd)return function(r,s){if(!Cd(s.hc))throw s.Vc(`${r._methodName}() can only be used with update() and set()`);if(!s.path)throw s.Vc(`${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.Ec&&e.hc!==4)throw e.Vc("Nested arrays are not supported");return function(r,s){const i=[];let a=0;for(const c of r){let l=va(c,s.Rc(a));l==null&&(l={nullValue:"NULL_VALUE"}),i.push(l),a++}return{arrayValue:{values:i}}}(n,e)}return function(r,s){if((r=Z(r))===null)return{nullValue:"NULL_VALUE"};if(typeof r=="number")return Jy(s.serializer,r);if(typeof r=="boolean")return{booleanValue:r};if(typeof r=="string")return{stringValue:r};if(r instanceof Date){const i=ue.fromDate(r);return{timestampValue:qs(s.serializer,i)}}if(r instanceof ue){const i=new ue(r.seconds,1e3*Math.floor(r.nanoseconds/1e3));return{timestampValue:qs(s.serializer,i)}}if(r instanceof _a)return{geoPointValue:{latitude:r.latitude,longitude:r.longitude}};if(r instanceof On)return{bytesValue:Qh(s.serializer,r._byteString)};if(r instanceof Se){const i=s.databaseId,a=r.firestore._databaseId;if(!a.isEqual(i))throw s.Vc(`Document reference is for database ${a.projectId}/${a.database} but should be for database ${i.projectId}/${i.database}`);return{referenceValue:Yo(r.firestore._databaseId||s.databaseId,r._key.path)}}if(r instanceof ya)return function(a,c){return{mapValue:{fields:{[Rh]:{stringValue:bh},[xs]:{arrayValue:{values:a.toArray().map(d=>{if(typeof d!="number")throw c.Vc("VectorValues must only contain numeric values.");return Wo(c.serializer,d)})}}}}}}(r,s);throw s.Vc(`Unsupported field value: ${fi(r)}`)}(n,e)}function Nd(n,e){const t={};return Eh(n)?e.path&&e.path.length>0&&e.fieldMask.push(e.path):on(n,(r,s)=>{const i=va(s,e.Ic(r));i!=null&&(t[r]=i)}),{mapValue:{fields:t}}}function Dd(n){return!(typeof n!="object"||n===null||n instanceof Array||n instanceof Date||n instanceof ue||n instanceof _a||n instanceof On||n instanceof Se||n instanceof Sd||n instanceof ya)}function Vd(n,e,t){if(!Dd(t)||!function(s){return typeof s=="object"&&s!==null&&(Object.getPrototypeOf(s)===Object.prototype||Object.getPrototypeOf(s)===null)}(t)){const r=fi(t);throw r==="an object"?e.Vc(n+" a custom object"):e.Vc(n+" "+r)}}function lv(n,e,t){if((e=Z(e))instanceof ga)return e._internalPath;if(typeof e=="string")return Od(n,e);throw Gs("Field path arguments must be of type string or ",n,!1,void 0,t)}const hv=new RegExp("[~\\*/\\[\\]]");function Od(n,e,t){if(e.search(hv)>=0)throw Gs(`Invalid field path (${e}). Paths must not contain '~', '*', '/', '[', or ']'`,n,!1,void 0,t);try{return new ga(...e.split("."))._internalPath}catch{throw Gs(`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`,n,!1,void 0,t)}}function Gs(n,e,t,r,s){const i=r&&!r.isEmpty(),a=s!==void 0;let c=`Function ${e}() called with invalid data`;t&&(c+=" (via `toFirestore()`)"),c+=". ";let l="";return(i||a)&&(l+=" (found",i&&(l+=` in field ${r}`),a&&(l+=` in document ${s}`),l+=")"),new V(P.INVALID_ARGUMENT,c+n+l)}function dv(n,e){return n.some(t=>t.isEqual(e))}/**
3173
3217
  * @license
3174
3218
  * Copyright 2020 Google LLC
3175
3219
  *
@@ -3184,7 +3228,7 @@ This typically indicates that your device does not have a healthy Internet conne
3184
3228
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3185
3229
  * See the License for the specific language governing permissions and
3186
3230
  * limitations under the License.
3187
- */class ya{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 Se(this._firestore,this._converter,this._key)}exists(){return this._document!==null}data(){if(this._document){if(this._converter){const e=new sv(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(hi("DocumentSnapshot.get",e));if(t!==null)return this._userDataWriter.convertValue(t)}}}class sv extends ya{data(){return super.data()}}function hi(n,e){return typeof e=="string"?Pd(n,e):e instanceof da?e._internalPath:e._delegate._internalPath}/**
3231
+ */class Ia{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 Se(this._firestore,this._converter,this._key)}exists(){return this._document!==null}data(){if(this._document){if(this._converter){const e=new fv(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(mi("DocumentSnapshot.get",e));if(t!==null)return this._userDataWriter.convertValue(t)}}}class fv extends Ia{data(){return super.data()}}function mi(n,e){return typeof e=="string"?Od(n,e):e instanceof ga?e._internalPath:e._delegate._internalPath}/**
3188
3232
  * @license
3189
3233
  * Copyright 2020 Google LLC
3190
3234
  *
@@ -3199,7 +3243,7 @@ This typically indicates that your device does not have a healthy Internet conne
3199
3243
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3200
3244
  * See the License for the specific language governing permissions and
3201
3245
  * limitations under the License.
3202
- */function Sd(n){if(n.limitType==="L"&&n.explicitOrderBy.length===0)throw new O(P.UNIMPLEMENTED,"limitToLast() queries require specifying at least one orderBy() clause")}class Ta{}class di extends Ta{}function Ue(n,e,...t){let r=[];e instanceof Ta&&r.push(e),r=r.concat(t),function(i){const a=i.filter(l=>l instanceof Ea).length,c=i.filter(l=>l instanceof fi).length;if(a>1||a>0&&c>0)throw new O(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 fi extends di{constructor(e,t,r){super(),this._field=e,this._op=t,this._value=r,this.type="where"}static _create(e,t,r){return new fi(e,t,r)}_apply(e){const t=this._parse(e);return Dd(e._query,t),new ze(e.firestore,e.converter,ho(e._query,t))}_parse(e){const t=ga(e.firestore);return function(i,a,c,l,d,f,m){let E;if(d.isKeyField()){if(f==="array-contains"||f==="array-contains-any")throw new O(P.INVALID_ARGUMENT,`Invalid Query. You can't perform '${f}' queries on documentId().`);if(f==="in"||f==="not-in"){sl(m,f);const C=[];for(const N of m)C.push(rl(l,i,N));E={arrayValue:{values:C}}}else E=rl(l,i,m)}else f!=="in"&&f!=="not-in"&&f!=="array-contains-any"||sl(m,f),E=wd(c,a,m,f==="in"||f==="not-in");return ae.create(d,f,E)}(e._query,"where",t,e.firestore._databaseId,this._field,this._op,this._value)}}function wn(n,e,t){const r=e,s=hi("where",n);return fi._create(s,r,t)}class Ea extends Ta{constructor(e,t){super(),this.type=e,this._queryConstraints=t}static _create(e,t){return new Ea(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]:je.create(t,this._getOperator())}_apply(e){const t=this._parse(e);return t.getFilters().length===0?e:(function(s,i){let a=s;const c=i.getFlattenedFilters();for(const l of c)Dd(a,l),a=ho(a,l)}(e._query,t),new ze(e.firestore,e.converter,ho(e._query,t)))}_getQueryConstraints(){return this._queryConstraints}_getOperator(){return this.type==="and"?"and":"or"}}class va extends di{constructor(e,t){super(),this._field=e,this._direction=t,this.type="orderBy"}static _create(e,t){return new va(e,t)}_apply(e){const t=function(s,i,a){if(s.startAt!==null)throw new O(P.INVALID_ARGUMENT,"Invalid query. You must not call startAt() or startAfter() before calling orderBy().");if(s.endAt!==null)throw new O(P.INVALID_ARGUMENT,"Invalid query. You must not call endAt() or endBefore() before calling orderBy().");return new Ir(i,a)}(e._query,this._field,this._direction);return new ze(e.firestore,e.converter,function(s,i){const a=s.explicitOrderBy.concat([i]);return new Ut(s.path,s.collectionGroup,a,s.filters.slice(),s.limit,s.limitType,s.startAt,s.endAt)}(e._query,t))}}function Cd(n,e="asc"){const t=e,r=hi("orderBy",n);return va._create(r,t)}class pi extends di{constructor(e,t,r){super(),this.type=e,this._limit=t,this._limitType=r}static _create(e,t,r){return new pi(e,t,r)}_apply(e){return new ze(e.firestore,e.converter,Ls(e._query,this._limit,this._limitType))}}function kd(n){return _d("limit",n),pi._create("limit",n,"F")}function iv(n){return _d("limitToLast",n),pi._create("limitToLast",n,"L")}class Ia extends di{constructor(e,t,r){super(),this.type=e,this._docOrFields=t,this._inclusive=r}static _create(e,t,r){return new Ia(e,t,r)}_apply(e){const t=ov(e,this.type,this._docOrFields,this._inclusive);return new ze(e.firestore,e.converter,function(s,i){return new Ut(s.path,s.collectionGroup,s.explicitOrderBy.slice(),s.filters.slice(),s.limit,s.limitType,i,s.endAt)}(e._query,t))}}function Nd(...n){return Ia._create("startAfter",n,!1)}function ov(n,e,t,r){if(t[0]=Z(t[0]),t[0]instanceof ya)return function(i,a,c,l,d){if(!l)throw new O(P.NOT_FOUND,`Can't use a DocumentSnapshot that doesn't exist for ${c}().`);const f=[];for(const m of vn(i))if(m.field.isKeyField())f.push(Vs(a,l.key));else{const E=l.data.field(m.field);if(Ys(E))throw new O(P.INVALID_ARGUMENT,'Invalid query. You are trying to start or end a query using a document for which the field "'+m.field+'" is an uncommitted server timestamp. (Since the value of this field is unknown, you cannot start/end a query with it.)');if(E===null){const R=m.field.canonicalString();throw new O(P.INVALID_ARGUMENT,`Invalid query. You are trying to start or end a query using a document for which the field '${R}' (used as the orderBy) does not exist.`)}f.push(E)}return new Cn(f,d)}(n._query,n.firestore._databaseId,e,t[0]._document,r);{const s=ga(n.firestore);return function(a,c,l,d,f,m){const E=a.explicitOrderBy;if(f.length>E.length)throw new O(P.INVALID_ARGUMENT,`Too many arguments provided to ${d}(). The number of arguments must be less than or equal to the number of orderBy() clauses`);const R=[];for(let C=0;C<f.length;C++){const N=f[C];if(E[C].field.isKeyField()){if(typeof N!="string")throw new O(P.INVALID_ARGUMENT,`Invalid query. Expected a string for document ID in ${d}(), but got a ${typeof N}`);if(!$o(a)&&N.indexOf("/")!==-1)throw new O(P.INVALID_ARGUMENT,`Invalid query. When querying a collection and ordering by documentId(), the value passed to ${d}() must be a plain document ID, but '${N}' contains a slash.`);const k=a.path.child(Y.fromString(N));if(!L.isDocumentKey(k))throw new O(P.INVALID_ARGUMENT,`Invalid query. When querying a collection group and ordering by documentId(), the value passed to ${d}() must result in a valid document path, but '${k}' is not because it contains an odd number of segments.`);const F=new L(k);R.push(Vs(c,F))}else{const k=wd(l,d,N);R.push(k)}}return new Cn(R,m)}(n._query,n.firestore._databaseId,s,e,t,r)}}function rl(n,e,t){if(typeof(t=Z(t))=="string"){if(t==="")throw new O(P.INVALID_ARGUMENT,"Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");if(!$o(e)&&t.indexOf("/")!==-1)throw new O(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(Y.fromString(t));if(!L.isDocumentKey(r))throw new O(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 Vs(n,new L(r))}if(t instanceof Se)return Vs(n,t._key);throw new O(P.INVALID_ARGUMENT,`Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${ui(t)}.`)}function sl(n,e){if(!Array.isArray(n)||n.length===0)throw new O(P.INVALID_ARGUMENT,`Invalid Query. A non-empty array is required for '${e.toString()}' filters.`)}function Dd(n,e){const t=function(s,i){for(const a of s)for(const c of a.getFlattenedFilters())if(i.indexOf(c.op)>=0)return c.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 O(P.INVALID_ARGUMENT,`Invalid query. You cannot use more than one '${e.op.toString()}' filter.`):new O(P.INVALID_ARGUMENT,`Invalid query. You cannot use '${e.op.toString()}' filters with '${t.toString()}' filters.`)}class av{convertValue(e,t="none"){switch(Dt(e)){case 0:return null;case 1:return e.booleanValue;case 2:return ie(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(Nt(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 11:return this.convertObject(e.mapValue,t);case 10:return this.convertVectorValue(e.mapValue);default:throw U()}}convertObject(e,t){return this.convertObjectMap(e.fields,t)}convertObjectMap(e,t="none"){const r={};return rn(e,(s,i)=>{r[s]=this.convertValue(i,t)}),r}convertVectorValue(e){var t,r,s;const i=(s=(r=(t=e.fields)===null||t===void 0?void 0:t[Os].arrayValue)===null||r===void 0?void 0:r.values)===null||s===void 0?void 0:s.map(a=>ie(a.doubleValue));return new pa(i)}convertGeoPoint(e){return new fa(ie(e.latitude),ie(e.longitude))}convertArray(e,t){return(e.values||[]).map(r=>this.convertValue(r,t))}convertServerTimestamp(e,t){switch(t){case"previous":const r=Zs(e);return r==null?null:this.convertValue(r,t);case"estimate":return this.convertTimestamp(Tr(e));default:return null}}convertTimestamp(e){const t=kt(e);return new ue(t.seconds,t.nanos)}convertDocumentKey(e,t){const r=Y.fromString(e);Q(Kh(r));const s=new Er(r.get(1),r.get(3)),i=new L(r.popFirst(5));return s.isEqual(t)||dt(`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}}/**
3246
+ */function Ld(n){if(n.limitType==="L"&&n.explicitOrderBy.length===0)throw new V(P.UNIMPLEMENTED,"limitToLast() queries require specifying at least one orderBy() clause")}class wa{}class gi extends wa{}function Ue(n,e,...t){let r=[];e instanceof wa&&r.push(e),r=r.concat(t),function(i){const a=i.filter(l=>l instanceof Aa).length,c=i.filter(l=>l instanceof _i).length;if(a>1||a>0&&c>0)throw new V(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 _i extends gi{constructor(e,t,r){super(),this._field=e,this._op=t,this._value=r,this.type="where"}static _create(e,t,r){return new _i(e,t,r)}_apply(e){const t=this._parse(e);return Fd(e._query,t),new He(e.firestore,e.converter,go(e._query,t))}_parse(e){const t=Ta(e.firestore);return function(i,a,c,l,d,f,m){let _;if(d.isKeyField()){if(f==="array-contains"||f==="array-contains-any")throw new V(P.INVALID_ARGUMENT,`Invalid Query. You can't perform '${f}' queries on documentId().`);if(f==="in"||f==="not-in"){ll(m,f);const S=[];for(const N of m)S.push(ul(l,i,N));_={arrayValue:{values:S}}}else _=ul(l,i,m)}else f!=="in"&&f!=="not-in"&&f!=="array-contains-any"||ll(m,f),_=kd(c,a,m,f==="in"||f==="not-in");return ae.create(d,f,_)}(e._query,"where",t,e.firestore._databaseId,this._field,this._op,this._value)}}function Rn(n,e,t){const r=e,s=mi("where",n);return _i._create(s,r,t)}class Aa extends wa{constructor(e,t){super(),this.type=e,this._queryConstraints=t}static _create(e,t){return new Aa(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]:$e.create(t,this._getOperator())}_apply(e){const t=this._parse(e);return t.getFilters().length===0?e:(function(s,i){let a=s;const c=i.getFlattenedFilters();for(const l of c)Fd(a,l),a=go(a,l)}(e._query,t),new He(e.firestore,e.converter,go(e._query,t)))}_getQueryConstraints(){return this._queryConstraints}_getOperator(){return this.type==="and"?"and":"or"}}class Ra extends gi{constructor(e,t){super(),this._field=e,this._direction=t,this.type="orderBy"}static _create(e,t){return new Ra(e,t)}_apply(e){const t=function(s,i,a){if(s.startAt!==null)throw new V(P.INVALID_ARGUMENT,"Invalid query. You must not call startAt() or startAfter() before calling orderBy().");if(s.endAt!==null)throw new V(P.INVALID_ARGUMENT,"Invalid query. You must not call endAt() or endBefore() before calling orderBy().");return new Rr(i,a)}(e._query,this._field,this._direction);return new He(e.firestore,e.converter,function(s,i){const a=s.explicitOrderBy.concat([i]);return new Bt(s.path,s.collectionGroup,a,s.filters.slice(),s.limit,s.limitType,s.startAt,s.endAt)}(e._query,t))}}function xd(n,e="asc"){const t=e,r=mi("orderBy",n);return Ra._create(r,t)}class yi extends gi{constructor(e,t,r){super(),this.type=e,this._limit=t,this._limitType=r}static _create(e,t,r){return new yi(e,t,r)}_apply(e){return new He(e.firestore,e.converter,Us(e._query,this._limit,this._limitType))}}function Md(n){return Ad("limit",n),yi._create("limit",n,"F")}function pv(n){return Ad("limitToLast",n),yi._create("limitToLast",n,"L")}class ba extends gi{constructor(e,t,r){super(),this.type=e,this._docOrFields=t,this._inclusive=r}static _create(e,t,r){return new ba(e,t,r)}_apply(e){const t=mv(e,this.type,this._docOrFields,this._inclusive);return new He(e.firestore,e.converter,function(s,i){return new Bt(s.path,s.collectionGroup,s.explicitOrderBy.slice(),s.filters.slice(),s.limit,s.limitType,i,s.endAt)}(e._query,t))}}function Ud(...n){return ba._create("startAfter",n,!1)}function mv(n,e,t,r){if(t[0]=Z(t[0]),t[0]instanceof Ia)return function(i,a,c,l,d){if(!l)throw new V(P.NOT_FOUND,`Can't use a DocumentSnapshot that doesn't exist for ${c}().`);const f=[];for(const m of wn(i))if(m.field.isKeyField())f.push(Ms(a,l.key));else{const _=l.data.field(m.field);if(ni(_))throw new V(P.INVALID_ARGUMENT,'Invalid query. You are trying to start or end a query using a document for which the field "'+m.field+'" is an uncommitted server timestamp. (Since the value of this field is unknown, you cannot start/end a query with it.)');if(_===null){const R=m.field.canonicalString();throw new V(P.INVALID_ARGUMENT,`Invalid query. You are trying to start or end a query using a document for which the field '${R}' (used as the orderBy) does not exist.`)}f.push(_)}return new Nn(f,d)}(n._query,n.firestore._databaseId,e,t[0]._document,r);{const s=Ta(n.firestore);return function(a,c,l,d,f,m){const _=a.explicitOrderBy;if(f.length>_.length)throw new V(P.INVALID_ARGUMENT,`Too many arguments provided to ${d}(). The number of arguments must be less than or equal to the number of orderBy() clauses`);const R=[];for(let S=0;S<f.length;S++){const N=f[S];if(_[S].field.isKeyField()){if(typeof N!="string")throw new V(P.INVALID_ARGUMENT,`Invalid query. Expected a string for document ID in ${d}(), but got a ${typeof N}`);if(!Go(a)&&N.indexOf("/")!==-1)throw new V(P.INVALID_ARGUMENT,`Invalid query. When querying a collection and ordering by documentId(), the value passed to ${d}() must be a plain document ID, but '${N}' contains a slash.`);const k=a.path.child(J.fromString(N));if(!L.isDocumentKey(k))throw new V(P.INVALID_ARGUMENT,`Invalid query. When querying a collection group and ordering by documentId(), the value passed to ${d}() must result in a valid document path, but '${k}' is not because it contains an odd number of segments.`);const B=new L(k);R.push(Ms(c,B))}else{const k=kd(l,d,N);R.push(k)}}return new Nn(R,m)}(n._query,n.firestore._databaseId,s,e,t,r)}}function ul(n,e,t){if(typeof(t=Z(t))=="string"){if(t==="")throw new V(P.INVALID_ARGUMENT,"Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");if(!Go(e)&&t.indexOf("/")!==-1)throw new V(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(J.fromString(t));if(!L.isDocumentKey(r))throw new V(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 Ms(n,new L(r))}if(t instanceof Se)return Ms(n,t._key);throw new V(P.INVALID_ARGUMENT,`Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${fi(t)}.`)}function ll(n,e){if(!Array.isArray(n)||n.length===0)throw new V(P.INVALID_ARGUMENT,`Invalid Query. A non-empty array is required for '${e.toString()}' filters.`)}function Fd(n,e){const t=function(s,i){for(const a of s)for(const c of a.getFlattenedFilters())if(i.indexOf(c.op)>=0)return c.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 V(P.INVALID_ARGUMENT,`Invalid query. You cannot use more than one '${e.op.toString()}' filter.`):new V(P.INVALID_ARGUMENT,`Invalid query. You cannot use '${e.op.toString()}' filters with '${t.toString()}' filters.`)}class gv{convertValue(e,t="none"){switch(Dt(e)){case 0:return null;case 1:return e.booleanValue;case 2:return ie(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(Nt(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 11:return this.convertObject(e.mapValue,t);case 10:return this.convertVectorValue(e.mapValue);default:throw F(62114,{value:e})}}convertObject(e,t){return this.convertObjectMap(e.fields,t)}convertObjectMap(e,t="none"){const r={};return on(e,(s,i)=>{r[s]=this.convertValue(i,t)}),r}convertVectorValue(e){var t,r,s;const i=(s=(r=(t=e.fields)===null||t===void 0?void 0:t[xs].arrayValue)===null||r===void 0?void 0:r.values)===null||s===void 0?void 0:s.map(a=>ie(a.doubleValue));return new ya(i)}convertGeoPoint(e){return new _a(ie(e.latitude),ie(e.longitude))}convertArray(e,t){return(e.values||[]).map(r=>this.convertValue(r,t))}convertServerTimestamp(e,t){switch(t){case"previous":const r=ri(e);return r==null?null:this.convertValue(r,t);case"estimate":return this.convertTimestamp(Ir(e));default:return null}}convertTimestamp(e){const t=kt(e);return new ue(t.seconds,t.nanos)}convertDocumentKey(e,t){const r=J.fromString(e);Q(td(r),9688,{name:e});const s=new wr(r.get(1),r.get(3)),i=new L(r.popFirst(5));return s.isEqual(t)||dt(`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}}/**
3203
3247
  * @license
3204
3248
  * Copyright 2020 Google LLC
3205
3249
  *
@@ -3214,7 +3258,7 @@ This typically indicates that your device does not have a healthy Internet conne
3214
3258
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3215
3259
  * See the License for the specific language governing permissions and
3216
3260
  * limitations under the License.
3217
- */function cv(n,e,t){let r;return r=n?t&&(t.merge||t.mergeFields)?n.toFirestore(e,t):n.toFirestore(e):e,r}/**
3261
+ */function _v(n,e,t){let r;return r=n?t&&(t.merge||t.mergeFields)?n.toFirestore(e,t):n.toFirestore(e):e,r}/**
3218
3262
  * @license
3219
3263
  * Copyright 2020 Google LLC
3220
3264
  *
@@ -3229,7 +3273,7 @@ This typically indicates that your device does not have a healthy Internet conne
3229
3273
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3230
3274
  * See the License for the specific language governing permissions and
3231
3275
  * limitations under the License.
3232
- */class ur{constructor(e,t){this.hasPendingWrites=e,this.fromCache=t}isEqual(e){return this.hasPendingWrites===e.hasPendingWrites&&this.fromCache===e.fromCache}}class Od extends ya{constructor(e,t,r,s,i,a){super(e,t,r,s,a),this._firestore=e,this._firestoreImpl=e,this.metadata=i}exists(){return super.exists()}data(e={}){if(this._document){if(this._converter){const t=new Es(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(hi("DocumentSnapshot.get",e));if(r!==null)return this._userDataWriter.convertValue(r,t.serverTimestamps)}}}class Es extends Od{data(e={}){return super.data(e)}}class Vd{constructor(e,t,r,s){this._firestore=e,this._userDataWriter=t,this._snapshot=s,this.metadata=new ur(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 Es(this._firestore,this._userDataWriter,r.key,r,new ur(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 O(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 a=0;return s._snapshot.docChanges.map(c=>{const l=new Es(s._firestore,s._userDataWriter,c.doc.key,c.doc,new ur(s._snapshot.mutatedKeys.has(c.doc.key),s._snapshot.fromCache),s.query.converter);return c.doc,{type:"added",doc:l,oldIndex:-1,newIndex:a++}})}{let a=s._snapshot.oldDocs;return s._snapshot.docChanges.filter(c=>i||c.type!==3).map(c=>{const l=new Es(s._firestore,s._userDataWriter,c.doc.key,c.doc,new ur(s._snapshot.mutatedKeys.has(c.doc.key),s._snapshot.fromCache),s.query.converter);let d=-1,f=-1;return c.type!==0&&(d=a.indexOf(c.doc.key),a=a.delete(c.doc.key)),c.type!==1&&(a=a.add(c.doc),f=a.indexOf(c.doc.key)),{type:uv(c.type),doc:l,oldIndex:d,newIndex:f}})}}(this,t),this._cachedChangesIncludeMetadataChanges=t),this._cachedChanges}}function uv(n){switch(n){case 0:return"added";case 2:case 3:return"modified";case 1:return"removed";default:return U()}}/**
3276
+ */class hr{constructor(e,t){this.hasPendingWrites=e,this.fromCache=t}isEqual(e){return this.hasPendingWrites===e.hasPendingWrites&&this.fromCache===e.fromCache}}class Bd extends Ia{constructor(e,t,r,s,i,a){super(e,t,r,s,a),this._firestore=e,this._firestoreImpl=e,this.metadata=i}exists(){return super.exists()}data(e={}){if(this._document){if(this._converter){const t=new ws(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(mi("DocumentSnapshot.get",e));if(r!==null)return this._userDataWriter.convertValue(r,t.serverTimestamps)}}}class ws extends Bd{data(e={}){return super.data(e)}}class qd{constructor(e,t,r,s){this._firestore=e,this._userDataWriter=t,this._snapshot=s,this.metadata=new hr(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 ws(this._firestore,this._userDataWriter,r.key,r,new hr(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 V(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 a=0;return s._snapshot.docChanges.map(c=>{const l=new ws(s._firestore,s._userDataWriter,c.doc.key,c.doc,new hr(s._snapshot.mutatedKeys.has(c.doc.key),s._snapshot.fromCache),s.query.converter);return c.doc,{type:"added",doc:l,oldIndex:-1,newIndex:a++}})}{let a=s._snapshot.oldDocs;return s._snapshot.docChanges.filter(c=>i||c.type!==3).map(c=>{const l=new ws(s._firestore,s._userDataWriter,c.doc.key,c.doc,new hr(s._snapshot.mutatedKeys.has(c.doc.key),s._snapshot.fromCache),s.query.converter);let d=-1,f=-1;return c.type!==0&&(d=a.indexOf(c.doc.key),a=a.delete(c.doc.key)),c.type!==1&&(a=a.add(c.doc),f=a.indexOf(c.doc.key)),{type:yv(c.type),doc:l,oldIndex:d,newIndex:f}})}}(this,t),this._cachedChangesIncludeMetadataChanges=t),this._cachedChanges}}function yv(n){switch(n){case 0:return"added";case 2:case 3:return"modified";case 1:return"removed";default:return F(61501,{type:n})}}/**
3233
3277
  * @license
3234
3278
  * Copyright 2020 Google LLC
3235
3279
  *
@@ -3244,7 +3288,7 @@ This typically indicates that your device does not have a healthy Internet conne
3244
3288
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3245
3289
  * See the License for the specific language governing permissions and
3246
3290
  * limitations under the License.
3247
- */function Ld(n){n=Le(n,Se);const e=Le(n.firestore,en);return zE(li(e),n._key).then(t=>Bd(e,n,t))}class wa extends av{constructor(e){super(),this.firestore=e}convertBytes(e){return new Dn(e)}convertReference(e){const t=this.convertDocumentKey(e,this.firestore._databaseId);return new Se(this.firestore,null,t)}}function Md(n){n=Le(n,ze);const e=Le(n.firestore,en),t=li(e),r=new wa(e);return Sd(n._query),GE(t,n._query).then(s=>new Vd(e,r,n,s))}function xd(n,e,t){n=Le(n,Se);const r=Le(n.firestore,en),s=cv(n.converter,e,t);return Fd(r,[ev(ga(r),"setDoc",n._key,s,n.converter!==null,t).toMutation(n._key,Xe.none())])}function lv(n){return Fd(Le(n.firestore,en),[new Ho(n._key,Xe.none())])}function Ud(n,...e){var t,r,s;n=Z(n);let i={includeMetadataChanges:!1,source:"default"},a=0;typeof e[a]!="object"||nl(e[a])||(i=e[a],a++);const c={includeMetadataChanges:i.includeMetadataChanges,source:i.source};if(nl(e[a])){const m=e[a];e[a]=(t=m.next)===null||t===void 0?void 0:t.bind(m),e[a+1]=(r=m.error)===null||r===void 0?void 0:r.bind(m),e[a+2]=(s=m.complete)===null||s===void 0?void 0:s.bind(m)}let l,d,f;if(n instanceof Se)d=Le(n.firestore,en),f=ei(n._key.path),l={next:m=>{e[a]&&e[a](Bd(d,n,m))},error:e[a+1],complete:e[a+2]};else{const m=Le(n,ze);d=Le(m.firestore,en),f=m._query;const E=new wa(d);l={next:R=>{e[a]&&e[a](new Vd(d,E,m,R))},error:e[a+1],complete:e[a+2]},Sd(n._query)}return function(E,R,C,N){const k=new la(N),F=new aa(R,k,C);return E.asyncQueue.enqueueAndForget(async()=>sa(await $s(E),F)),()=>{k.su(),E.asyncQueue.enqueueAndForget(async()=>ia(await $s(E),F))}}(li(d),f,c,l)}function Fd(n,e){return function(r,s){const i=new at;return r.asyncQueue.enqueueAndForget(async()=>OE(await HE(r),s,i)),i.promise}(li(n),e)}function Bd(n,e,t){const r=t.docs.get(e._key),s=new wa(n);return new Od(n,s,e._key,r,new ur(t.hasPendingWrites,t.fromCache),e.converter)}(function(e,t=!0){(function(s){Vn=s})(nn),St(new ut("firestore",(r,{instanceIdentifier:s,options:i})=>{const a=r.getProvider("app").getImmediate(),c=new en(new ry(r.getProvider("auth-internal")),new oy(a,r.getProvider("app-check-internal")),function(d,f){if(!Object.prototype.hasOwnProperty.apply(d.options,["projectId"]))throw new O(P.INVALID_ARGUMENT,'"projectId" not provided in firebase.initializeApp.');return new Er(d.options.projectId,f)}(a,s),a);return i=Object.assign({useFetchStreams:t},i),c._setSettings(i),c},"PUBLIC").setMultipleInstances(!0)),qe(au,cu,e),qe(au,cu,"esm2017")})();/**
3291
+ */function jd(n){n=Le(n,Se);const e=Le(n.firestore,nn);return ev(pi(e),n._key).then(t=>Wd(e,n,t))}class Pa extends gv{constructor(e){super(),this.firestore=e}convertBytes(e){return new On(e)}convertReference(e){const t=this.convertDocumentKey(e,this.firestore._databaseId);return new Se(this.firestore,null,t)}}function $d(n){n=Le(n,He);const e=Le(n.firestore,nn),t=pi(e),r=new Pa(e);return Ld(n._query),tv(t,n._query).then(s=>new qd(e,r,n,s))}function zd(n,e,t){n=Le(n,Se);const r=Le(n.firestore,nn),s=_v(n.converter,e,t);return Gd(r,[uv(Ta(r),"setDoc",n._key,s,n.converter!==null,t).toMutation(n._key,Xe.none())])}function Ev(n){return Gd(Le(n.firestore,nn),[new Ko(n._key,Xe.none())])}function Hd(n,...e){var t,r,s;n=Z(n);let i={includeMetadataChanges:!1,source:"default"},a=0;typeof e[a]!="object"||cl(e[a])||(i=e[a],a++);const c={includeMetadataChanges:i.includeMetadataChanges,source:i.source};if(cl(e[a])){const m=e[a];e[a]=(t=m.next)===null||t===void 0?void 0:t.bind(m),e[a+1]=(r=m.error)===null||r===void 0?void 0:r.bind(m),e[a+2]=(s=m.complete)===null||s===void 0?void 0:s.bind(m)}let l,d,f;if(n instanceof Se)d=Le(n.firestore,nn),f=si(n._key.path),l={next:m=>{e[a]&&e[a](Wd(d,n,m))},error:e[a+1],complete:e[a+2]};else{const m=Le(n,He);d=Le(m.firestore,nn),f=m._query;const _=new Pa(d);l={next:R=>{e[a]&&e[a](new qd(d,_,m,R))},error:e[a+1],complete:e[a+2]},Ld(n._query)}return function(_,R,S,N){const k=new pa(N),B=new ha(R,k,S);return _.asyncQueue.enqueueAndForget(async()=>ca(await Hs(_),B)),()=>{k.Cu(),_.asyncQueue.enqueueAndForget(async()=>ua(await Hs(_),B))}}(pi(d),f,c,l)}function Gd(n,e){return function(r,s){const i=new at;return r.asyncQueue.enqueueAndForget(async()=>jT(await ZT(r),s,i)),i.promise}(pi(n),e)}function Wd(n,e,t){const r=t.docs.get(e._key),s=new Pa(n);return new Bd(n,s,e._key,r,new hr(t.hasPendingWrites,t.fromCache),e.converter)}(function(e,t=!0){(function(s){xn=s})(sn),St(new ut("firestore",(r,{instanceIdentifier:s,options:i})=>{const a=r.getProvider("app").getImmediate(),c=new nn(new dy(r.getProvider("auth-internal")),new my(a,r.getProvider("app-check-internal")),function(d,f){if(!Object.prototype.hasOwnProperty.apply(d.options,["projectId"]))throw new V(P.INVALID_ARGUMENT,'"projectId" not provided in firebase.initializeApp.');return new wr(d.options.projectId,f)}(a,s),a);return i=Object.assign({useFetchStreams:t},i),c._setSettings(i),c},"PUBLIC").setMultipleInstances(!0)),qe(du,fu,e),qe(du,fu,"esm2017")})();/**
3248
3292
  * @license
3249
3293
  * Copyright 2017 Google LLC
3250
3294
  *
@@ -3259,7 +3303,7 @@ This typically indicates that your device does not have a healthy Internet conne
3259
3303
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3260
3304
  * See the License for the specific language governing permissions and
3261
3305
  * limitations under the License.
3262
- */const qd="firebasestorage.googleapis.com",$d="storageBucket",hv=2*60*1e3,dv=10*60*1e3,fv=1e3;/**
3306
+ */const Kd="firebasestorage.googleapis.com",Qd="storageBucket",Tv=2*60*1e3,vv=10*60*1e3,Iv=1e3;/**
3263
3307
  * @license
3264
3308
  * Copyright 2017 Google LLC
3265
3309
  *
@@ -3274,8 +3318,8 @@ This typically indicates that your device does not have a healthy Internet conne
3274
3318
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3275
3319
  * See the License for the specific language governing permissions and
3276
3320
  * limitations under the License.
3277
- */class re extends He{constructor(e,t,r=0){super(Qi(e),`Firebase Storage: ${t} (${Qi(e)})`),this.status_=r,this.customData={serverResponse:null},this._baseMessage=this.message,Object.setPrototypeOf(this,re.prototype)}get status(){return this.status_}set status(e){this.status_=e}_codeEquals(e){return Qi(e)===this.code}get serverResponse(){return this.customData.serverResponse}set serverResponse(e){this.customData.serverResponse=e,this.customData.serverResponse?this.message=`${this._baseMessage}
3278
- ${this.customData.serverResponse}`:this.message=this._baseMessage}}var te;(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"})(te||(te={}));function Qi(n){return"storage/"+n}function Aa(){const n="An unknown error occurred, please check the error payload for server response.";return new re(te.UNKNOWN,n)}function pv(n){return new re(te.OBJECT_NOT_FOUND,"Object '"+n+"' does not exist.")}function mv(n){return new re(te.QUOTA_EXCEEDED,"Quota for bucket '"+n+"' exceeded, please view quota on https://firebase.google.com/pricing/.")}function gv(){const n="User is not authenticated, please authenticate using Firebase Authentication and try again.";return new re(te.UNAUTHENTICATED,n)}function _v(){return new re(te.UNAUTHORIZED_APP,"This app does not have permission to access Firebase Storage on this project.")}function yv(n){return new re(te.UNAUTHORIZED,"User does not have permission to access '"+n+"'.")}function jd(){return new re(te.RETRY_LIMIT_EXCEEDED,"Max retry time for operation exceeded, please try again.")}function Hd(){return new re(te.CANCELED,"User canceled the upload/download.")}function Tv(n){return new re(te.INVALID_URL,"Invalid URL '"+n+"'.")}function Ev(n){return new re(te.INVALID_DEFAULT_BUCKET,"Invalid default bucket '"+n+"'.")}function vv(){return new re(te.NO_DEFAULT_BUCKET,"No default bucket found. Did you set the '"+$d+"' property when initializing the app?")}function zd(){return new re(te.CANNOT_SLICE_BLOB,"Cannot slice blob for upload. Please retry the upload.")}function Iv(){return new re(te.SERVER_FILE_WRONG_SIZE,"Server recorded incorrect upload file size, please retry the upload.")}function wv(){return new re(te.NO_DOWNLOAD_URL,"The given file does not have any download URLs.")}function Av(n){return new re(te.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 Io(n){return new re(te.INVALID_ARGUMENT,n)}function Gd(){return new re(te.APP_DELETED,"The Firebase app was deleted.")}function Rv(n){return new re(te.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 pr(n,e){return new re(te.INVALID_FORMAT,"String does not match format '"+n+"': "+e)}function nr(n){throw new re(te.INTERNAL_ERROR,"Internal error: "+n)}/**
3321
+ */class re extends ze{constructor(e,t,r=0){super(Zi(e),`Firebase Storage: ${t} (${Zi(e)})`),this.status_=r,this.customData={serverResponse:null},this._baseMessage=this.message,Object.setPrototypeOf(this,re.prototype)}get status(){return this.status_}set status(e){this.status_=e}_codeEquals(e){return Zi(e)===this.code}get serverResponse(){return this.customData.serverResponse}set serverResponse(e){this.customData.serverResponse=e,this.customData.serverResponse?this.message=`${this._baseMessage}
3322
+ ${this.customData.serverResponse}`:this.message=this._baseMessage}}var te;(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"})(te||(te={}));function Zi(n){return"storage/"+n}function Sa(){const n="An unknown error occurred, please check the error payload for server response.";return new re(te.UNKNOWN,n)}function wv(n){return new re(te.OBJECT_NOT_FOUND,"Object '"+n+"' does not exist.")}function Av(n){return new re(te.QUOTA_EXCEEDED,"Quota for bucket '"+n+"' exceeded, please view quota on https://firebase.google.com/pricing/.")}function Rv(){const n="User is not authenticated, please authenticate using Firebase Authentication and try again.";return new re(te.UNAUTHENTICATED,n)}function bv(){return new re(te.UNAUTHORIZED_APP,"This app does not have permission to access Firebase Storage on this project.")}function Pv(n){return new re(te.UNAUTHORIZED,"User does not have permission to access '"+n+"'.")}function Xd(){return new re(te.RETRY_LIMIT_EXCEEDED,"Max retry time for operation exceeded, please try again.")}function Yd(){return new re(te.CANCELED,"User canceled the upload/download.")}function Sv(n){return new re(te.INVALID_URL,"Invalid URL '"+n+"'.")}function Cv(n){return new re(te.INVALID_DEFAULT_BUCKET,"Invalid default bucket '"+n+"'.")}function kv(){return new re(te.NO_DEFAULT_BUCKET,"No default bucket found. Did you set the '"+Qd+"' property when initializing the app?")}function Jd(){return new re(te.CANNOT_SLICE_BLOB,"Cannot slice blob for upload. Please retry the upload.")}function Nv(){return new re(te.SERVER_FILE_WRONG_SIZE,"Server recorded incorrect upload file size, please retry the upload.")}function Dv(){return new re(te.NO_DOWNLOAD_URL,"The given file does not have any download URLs.")}function Vv(n){return new re(te.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 bo(n){return new re(te.INVALID_ARGUMENT,n)}function Zd(){return new re(te.APP_DELETED,"The Firebase app was deleted.")}function Ov(n){return new re(te.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 _r(n,e){return new re(te.INVALID_FORMAT,"String does not match format '"+n+"': "+e)}function sr(n){throw new re(te.INTERNAL_ERROR,"Internal error: "+n)}/**
3279
3323
  * @license
3280
3324
  * Copyright 2017 Google LLC
3281
3325
  *
@@ -3290,7 +3334,7 @@ ${this.customData.serverResponse}`:this.message=this._baseMessage}}var te;(funct
3290
3334
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3291
3335
  * See the License for the specific language governing permissions and
3292
3336
  * limitations under the License.
3293
- */class Oe{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=Oe.makeFromUrl(e,t)}catch{return new Oe(e,"")}if(r.path==="")return r;throw Ev(e)}static makeFromUrl(e,t){let r=null;const s="([A-Za-z0-9.\\-_]+)";function i(j){j.path.charAt(j.path.length-1)==="/"&&(j.path_=j.path_.slice(0,-1))}const a="(/(.*))?$",c=new RegExp("^gs://"+s+a,"i"),l={bucket:1,path:3};function d(j){j.path_=decodeURIComponent(j.path)}const f="v[A-Za-z0-9_]+",m=t.replace(/[.]/g,"\\."),E="(/([^?#]*).*)?$",R=new RegExp(`^https?://${m}/${f}/b/${s}/o${E}`,"i"),C={bucket:1,path:3},N=t===qd?"(?:storage.googleapis.com|storage.cloud.google.com)":t,k="([^?#]*)",F=new RegExp(`^https?://${N}/${s}/${k}`,"i"),M=[{regex:c,indices:l,postModify:i},{regex:R,indices:C,postModify:d},{regex:F,indices:{bucket:1,path:2},postModify:d}];for(let j=0;j<M.length;j++){const ce=M[j],X=ce.regex.exec(e);if(X){const v=X[ce.indices.bucket];let g=X[ce.indices.path];g||(g=""),r=new Oe(v,g),ce.postModify(r);break}}if(r==null)throw Tv(e);return r}}class bv{constructor(e){this.promise_=Promise.reject(e)}getPromise(){return this.promise_}cancel(e=!1){}}/**
3337
+ */class Ve{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=Ve.makeFromUrl(e,t)}catch{return new Ve(e,"")}if(r.path==="")return r;throw Cv(e)}static makeFromUrl(e,t){let r=null;const s="([A-Za-z0-9.\\-_]+)";function i($){$.path.charAt($.path.length-1)==="/"&&($.path_=$.path_.slice(0,-1))}const a="(/(.*))?$",c=new RegExp("^gs://"+s+a,"i"),l={bucket:1,path:3};function d($){$.path_=decodeURIComponent($.path)}const f="v[A-Za-z0-9_]+",m=t.replace(/[.]/g,"\\."),_="(/([^?#]*).*)?$",R=new RegExp(`^https?://${m}/${f}/b/${s}/o${_}`,"i"),S={bucket:1,path:3},N=t===Kd?"(?:storage.googleapis.com|storage.cloud.google.com)":t,k="([^?#]*)",B=new RegExp(`^https?://${N}/${s}/${k}`,"i"),x=[{regex:c,indices:l,postModify:i},{regex:R,indices:S,postModify:d},{regex:B,indices:{bucket:1,path:2},postModify:d}];for(let $=0;$<x.length;$++){const ce=x[$],X=ce.regex.exec(e);if(X){const v=X[ce.indices.bucket];let g=X[ce.indices.path];g||(g=""),r=new Ve(v,g),ce.postModify(r);break}}if(r==null)throw Sv(e);return r}}class Lv{constructor(e){this.promise_=Promise.reject(e)}getPromise(){return this.promise_}cancel(e=!1){}}/**
3294
3338
  * @license
3295
3339
  * Copyright 2017 Google LLC
3296
3340
  *
@@ -3305,7 +3349,7 @@ ${this.customData.serverResponse}`:this.message=this._baseMessage}}var te;(funct
3305
3349
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3306
3350
  * See the License for the specific language governing permissions and
3307
3351
  * limitations under the License.
3308
- */function Pv(n,e,t){let r=1,s=null,i=null,a=!1,c=0;function l(){return c===2}let d=!1;function f(...k){d||(d=!0,e.apply(null,k))}function m(k){s=setTimeout(()=>{s=null,n(R,l())},k)}function E(){i&&clearTimeout(i)}function R(k,...F){if(d){E();return}if(k){E(),f.call(null,k,...F);return}if(l()||a){E(),f.call(null,k,...F);return}r<64&&(r*=2);let M;c===1?(c=2,M=0):M=(r+Math.random())*1e3,m(M)}let C=!1;function N(k){C||(C=!0,E(),!d&&(s!==null?(k||(c=2),clearTimeout(s),m(0)):k||(c=1)))}return m(0),i=setTimeout(()=>{a=!0,N(!0)},t),N}function Sv(n){n(!1)}/**
3352
+ */function xv(n,e,t){let r=1,s=null,i=null,a=!1,c=0;function l(){return c===2}let d=!1;function f(...k){d||(d=!0,e.apply(null,k))}function m(k){s=setTimeout(()=>{s=null,n(R,l())},k)}function _(){i&&clearTimeout(i)}function R(k,...B){if(d){_();return}if(k){_(),f.call(null,k,...B);return}if(l()||a){_(),f.call(null,k,...B);return}r<64&&(r*=2);let x;c===1?(c=2,x=0):x=(r+Math.random())*1e3,m(x)}let S=!1;function N(k){S||(S=!0,_(),!d&&(s!==null?(k||(c=2),clearTimeout(s),m(0)):k||(c=1)))}return m(0),i=setTimeout(()=>{a=!0,N(!0)},t),N}function Mv(n){n(!1)}/**
3309
3353
  * @license
3310
3354
  * Copyright 2017 Google LLC
3311
3355
  *
@@ -3320,7 +3364,7 @@ ${this.customData.serverResponse}`:this.message=this._baseMessage}}var te;(funct
3320
3364
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3321
3365
  * See the License for the specific language governing permissions and
3322
3366
  * limitations under the License.
3323
- */function Cv(n){return n!==void 0}function kv(n){return typeof n=="function"}function Nv(n){return typeof n=="object"&&!Array.isArray(n)}function mi(n){return typeof n=="string"||n instanceof String}function il(n){return Ra()&&n instanceof Blob}function Ra(){return typeof Blob<"u"}function ol(n,e,t,r){if(r<e)throw Io(`Invalid value for '${n}'. Expected ${e} or greater.`);if(r>t)throw Io(`Invalid value for '${n}'. Expected ${t} or less.`)}/**
3367
+ */function Uv(n){return n!==void 0}function Fv(n){return typeof n=="function"}function Bv(n){return typeof n=="object"&&!Array.isArray(n)}function Ei(n){return typeof n=="string"||n instanceof String}function hl(n){return Ca()&&n instanceof Blob}function Ca(){return typeof Blob<"u"}function dl(n,e,t,r){if(r<e)throw bo(`Invalid value for '${n}'. Expected ${e} or greater.`);if(r>t)throw bo(`Invalid value for '${n}'. Expected ${t} or less.`)}/**
3324
3368
  * @license
3325
3369
  * Copyright 2017 Google LLC
3326
3370
  *
@@ -3335,7 +3379,7 @@ ${this.customData.serverResponse}`:this.message=this._baseMessage}}var te;(funct
3335
3379
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3336
3380
  * See the License for the specific language governing permissions and
3337
3381
  * limitations under the License.
3338
- */function cn(n,e,t){let r=e;return t==null&&(r=`https://${e}`),`${t}://${r}/v0${n}`}function Wd(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}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={}));/**
3382
+ */function ln(n,e,t){let r=e;return t==null&&(r=`https://${e}`),`${t}://${r}/v0${n}`}function ef(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}var Xt;(function(n){n[n.NO_ERROR=0]="NO_ERROR",n[n.NETWORK_ERROR=1]="NETWORK_ERROR",n[n.ABORT=2]="ABORT"})(Xt||(Xt={}));/**
3339
3383
  * @license
3340
3384
  * Copyright 2022 Google LLC
3341
3385
  *
@@ -3350,7 +3394,7 @@ ${this.customData.serverResponse}`:this.message=this._baseMessage}}var te;(funct
3350
3394
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3351
3395
  * See the License for the specific language governing permissions and
3352
3396
  * limitations under the License.
3353
- */function Kd(n,e){const t=n>=500&&n<600,s=[408,429].indexOf(n)!==-1,i=e.indexOf(n)!==-1;return t||s||i}/**
3397
+ */function tf(n,e){const t=n>=500&&n<600,s=[408,429].indexOf(n)!==-1,i=e.indexOf(n)!==-1;return t||s||i}/**
3354
3398
  * @license
3355
3399
  * Copyright 2017 Google LLC
3356
3400
  *
@@ -3365,7 +3409,7 @@ ${this.customData.serverResponse}`:this.message=this._baseMessage}}var te;(funct
3365
3409
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3366
3410
  * See the License for the specific language governing permissions and
3367
3411
  * limitations under the License.
3368
- */class Dv{constructor(e,t,r,s,i,a,c,l,d,f,m,E=!0){this.url_=e,this.method_=t,this.headers_=r,this.body_=s,this.successCodes_=i,this.additionalRetryCodes_=a,this.callback_=c,this.errorCallback_=l,this.timeout_=d,this.progressCallback_=f,this.connectionFactory_=m,this.retry=E,this.pendingConnection_=null,this.backoffId_=null,this.canceled_=!1,this.appDelete_=!1,this.promise_=new Promise((R,C)=>{this.resolve_=R,this.reject_=C,this.start_()})}start_(){const e=(r,s)=>{if(s){r(!1,new us(!1,null,!0));return}const i=this.connectionFactory_();this.pendingConnection_=i;const a=c=>{const l=c.loaded,d=c.lengthComputable?c.total:-1;this.progressCallback_!==null&&this.progressCallback_(l,d)};this.progressCallback_!==null&&i.addUploadProgressListener(a),i.send(this.url_,this.method_,this.body_,this.headers_).then(()=>{this.progressCallback_!==null&&i.removeUploadProgressListener(a),this.pendingConnection_=null;const c=i.getErrorCode()===Kt.NO_ERROR,l=i.getStatus();if(!c||Kd(l,this.additionalRetryCodes_)&&this.retry){const f=i.getErrorCode()===Kt.ABORT;r(!1,new us(!1,null,f));return}const d=this.successCodes_.indexOf(l)!==-1;r(!0,new us(d,i))})},t=(r,s)=>{const i=this.resolve_,a=this.reject_,c=s.connection;if(s.wasSuccessCode)try{const l=this.callback_(c,c.getResponse());Cv(l)?i(l):i()}catch(l){a(l)}else if(c!==null){const l=Aa();l.serverResponse=c.getErrorText(),this.errorCallback_?a(this.errorCallback_(c,l)):a(l)}else if(s.canceled){const l=this.appDelete_?Gd():Hd();a(l)}else{const l=jd();a(l)}};this.canceled_?t(!1,new us(!1,null,!0)):this.backoffId_=Pv(e,t,this.timeout_)}getPromise(){return this.promise_}cancel(e){this.canceled_=!0,this.appDelete_=e||!1,this.backoffId_!==null&&Sv(this.backoffId_),this.pendingConnection_!==null&&this.pendingConnection_.abort()}}class us{constructor(e,t,r){this.wasSuccessCode=e,this.connection=t,this.canceled=!!r}}function Ov(n,e){e!==null&&e.length>0&&(n.Authorization="Firebase "+e)}function Vv(n,e){n["X-Firebase-Storage-Version"]="webjs/"+(e??"AppManager")}function Lv(n,e){e&&(n["X-Firebase-GMPID"]=e)}function Mv(n,e){e!==null&&(n["X-Firebase-AppCheck"]=e)}function xv(n,e,t,r,s,i,a=!0){const c=Wd(n.urlParams),l=n.url+c,d=Object.assign({},n.headers);return Lv(d,e),Ov(d,t),Vv(d,i),Mv(d,r),new Dv(l,n.method,d,n.body,n.successCodes,n.additionalRetryCodes,n.handler,n.errorHandler,n.timeout,n.progressCallback,s,a)}/**
3412
+ */class qv{constructor(e,t,r,s,i,a,c,l,d,f,m,_=!0,R=!1){this.url_=e,this.method_=t,this.headers_=r,this.body_=s,this.successCodes_=i,this.additionalRetryCodes_=a,this.callback_=c,this.errorCallback_=l,this.timeout_=d,this.progressCallback_=f,this.connectionFactory_=m,this.retry=_,this.isUsingEmulator=R,this.pendingConnection_=null,this.backoffId_=null,this.canceled_=!1,this.appDelete_=!1,this.promise_=new Promise((S,N)=>{this.resolve_=S,this.reject_=N,this.start_()})}start_(){const e=(r,s)=>{if(s){r(!1,new ds(!1,null,!0));return}const i=this.connectionFactory_();this.pendingConnection_=i;const a=c=>{const l=c.loaded,d=c.lengthComputable?c.total:-1;this.progressCallback_!==null&&this.progressCallback_(l,d)};this.progressCallback_!==null&&i.addUploadProgressListener(a),i.send(this.url_,this.method_,this.isUsingEmulator,this.body_,this.headers_).then(()=>{this.progressCallback_!==null&&i.removeUploadProgressListener(a),this.pendingConnection_=null;const c=i.getErrorCode()===Xt.NO_ERROR,l=i.getStatus();if(!c||tf(l,this.additionalRetryCodes_)&&this.retry){const f=i.getErrorCode()===Xt.ABORT;r(!1,new ds(!1,null,f));return}const d=this.successCodes_.indexOf(l)!==-1;r(!0,new ds(d,i))})},t=(r,s)=>{const i=this.resolve_,a=this.reject_,c=s.connection;if(s.wasSuccessCode)try{const l=this.callback_(c,c.getResponse());Uv(l)?i(l):i()}catch(l){a(l)}else if(c!==null){const l=Sa();l.serverResponse=c.getErrorText(),this.errorCallback_?a(this.errorCallback_(c,l)):a(l)}else if(s.canceled){const l=this.appDelete_?Zd():Yd();a(l)}else{const l=Xd();a(l)}};this.canceled_?t(!1,new ds(!1,null,!0)):this.backoffId_=xv(e,t,this.timeout_)}getPromise(){return this.promise_}cancel(e){this.canceled_=!0,this.appDelete_=e||!1,this.backoffId_!==null&&Mv(this.backoffId_),this.pendingConnection_!==null&&this.pendingConnection_.abort()}}class ds{constructor(e,t,r){this.wasSuccessCode=e,this.connection=t,this.canceled=!!r}}function jv(n,e){e!==null&&e.length>0&&(n.Authorization="Firebase "+e)}function $v(n,e){n["X-Firebase-Storage-Version"]="webjs/"+(e??"AppManager")}function zv(n,e){e&&(n["X-Firebase-GMPID"]=e)}function Hv(n,e){e!==null&&(n["X-Firebase-AppCheck"]=e)}function Gv(n,e,t,r,s,i,a=!0,c=!1){const l=ef(n.urlParams),d=n.url+l,f=Object.assign({},n.headers);return zv(f,e),jv(f,t),$v(f,i),Hv(f,r),new qv(d,n.method,f,n.body,n.successCodes,n.additionalRetryCodes,n.handler,n.errorHandler,n.timeout,n.progressCallback,s,a,c)}/**
3369
3413
  * @license
3370
3414
  * Copyright 2017 Google LLC
3371
3415
  *
@@ -3380,7 +3424,7 @@ ${this.customData.serverResponse}`:this.message=this._baseMessage}}var te;(funct
3380
3424
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3381
3425
  * See the License for the specific language governing permissions and
3382
3426
  * limitations under the License.
3383
- */function Uv(){return typeof BlobBuilder<"u"?BlobBuilder:typeof WebKitBlobBuilder<"u"?WebKitBlobBuilder:void 0}function Fv(...n){const e=Uv();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(Ra())return new Blob(n);throw new re(te.UNSUPPORTED_ENVIRONMENT,"This browser doesn't seem to support creating Blobs")}}function Bv(n,e,t){return n.webkitSlice?n.webkitSlice(e,t):n.mozSlice?n.mozSlice(e,t):n.slice?n.slice(e,t):null}/**
3427
+ */function Wv(){return typeof BlobBuilder<"u"?BlobBuilder:typeof WebKitBlobBuilder<"u"?WebKitBlobBuilder:void 0}function Kv(...n){const e=Wv();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(Ca())return new Blob(n);throw new re(te.UNSUPPORTED_ENVIRONMENT,"This browser doesn't seem to support creating Blobs")}}function Qv(n,e,t){return n.webkitSlice?n.webkitSlice(e,t):n.mozSlice?n.mozSlice(e,t):n.slice?n.slice(e,t):null}/**
3384
3428
  * @license
3385
3429
  * Copyright 2021 Google LLC
3386
3430
  *
@@ -3395,7 +3439,7 @@ ${this.customData.serverResponse}`:this.message=this._baseMessage}}var te;(funct
3395
3439
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3396
3440
  * See the License for the specific language governing permissions and
3397
3441
  * limitations under the License.
3398
- */function qv(n){if(typeof atob>"u")throw Av("base-64");return atob(n)}/**
3442
+ */function Xv(n){if(typeof atob>"u")throw Vv("base-64");return atob(n)}/**
3399
3443
  * @license
3400
3444
  * Copyright 2017 Google LLC
3401
3445
  *
@@ -3410,7 +3454,7 @@ ${this.customData.serverResponse}`:this.message=this._baseMessage}}var te;(funct
3410
3454
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3411
3455
  * See the License for the specific language governing permissions and
3412
3456
  * limitations under the License.
3413
- */const We={RAW:"raw",BASE64:"base64",BASE64URL:"base64url",DATA_URL:"data_url"};class Xi{constructor(e,t){this.data=e,this.contentType=t||null}}function $v(n,e){switch(n){case We.RAW:return new Xi(Qd(e));case We.BASE64:case We.BASE64URL:return new Xi(Xd(n,e));case We.DATA_URL:return new Xi(Hv(e),zv(e))}throw Aa()}function Qd(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,a=n.charCodeAt(++t);r=65536|(i&1023)<<10|a&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 jv(n){let e;try{e=decodeURIComponent(n)}catch{throw pr(We.DATA_URL,"Malformed data URL.")}return Qd(e)}function Xd(n,e){switch(n){case We.BASE64:{const s=e.indexOf("-")!==-1,i=e.indexOf("_")!==-1;if(s||i)throw pr(n,"Invalid character '"+(s?"-":"_")+"' found: is it base64url encoded?");break}case We.BASE64URL:{const s=e.indexOf("+")!==-1,i=e.indexOf("/")!==-1;if(s||i)throw pr(n,"Invalid character '"+(s?"+":"/")+"' found: is it base64 encoded?");e=e.replace(/-/g,"+").replace(/_/g,"/");break}}let t;try{t=qv(e)}catch(s){throw s.message.includes("polyfill")?s:pr(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 Jd{constructor(e){this.base64=!1,this.contentType=null;const t=e.match(/^data:([^,]+)?,/);if(t===null)throw pr(We.DATA_URL,"Must be formatted 'data:[<mediatype>][;base64],<data>");const r=t[1]||null;r!=null&&(this.base64=Gv(r,";base64"),this.contentType=this.base64?r.substring(0,r.length-7):r),this.rest=e.substring(e.indexOf(",")+1)}}function Hv(n){const e=new Jd(n);return e.base64?Xd(We.BASE64,e.rest):jv(e.rest)}function zv(n){return new Jd(n).contentType}function Gv(n,e){return n.length>=e.length?n.substring(n.length-e.length)===e:!1}/**
3457
+ */const We={RAW:"raw",BASE64:"base64",BASE64URL:"base64url",DATA_URL:"data_url"};class eo{constructor(e,t){this.data=e,this.contentType=t||null}}function Yv(n,e){switch(n){case We.RAW:return new eo(nf(e));case We.BASE64:case We.BASE64URL:return new eo(rf(n,e));case We.DATA_URL:return new eo(Zv(e),eI(e))}throw Sa()}function nf(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,a=n.charCodeAt(++t);r=65536|(i&1023)<<10|a&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 Jv(n){let e;try{e=decodeURIComponent(n)}catch{throw _r(We.DATA_URL,"Malformed data URL.")}return nf(e)}function rf(n,e){switch(n){case We.BASE64:{const s=e.indexOf("-")!==-1,i=e.indexOf("_")!==-1;if(s||i)throw _r(n,"Invalid character '"+(s?"-":"_")+"' found: is it base64url encoded?");break}case We.BASE64URL:{const s=e.indexOf("+")!==-1,i=e.indexOf("/")!==-1;if(s||i)throw _r(n,"Invalid character '"+(s?"+":"/")+"' found: is it base64 encoded?");e=e.replace(/-/g,"+").replace(/_/g,"/");break}}let t;try{t=Xv(e)}catch(s){throw s.message.includes("polyfill")?s:_r(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 sf{constructor(e){this.base64=!1,this.contentType=null;const t=e.match(/^data:([^,]+)?,/);if(t===null)throw _r(We.DATA_URL,"Must be formatted 'data:[<mediatype>][;base64],<data>");const r=t[1]||null;r!=null&&(this.base64=tI(r,";base64"),this.contentType=this.base64?r.substring(0,r.length-7):r),this.rest=e.substring(e.indexOf(",")+1)}}function Zv(n){const e=new sf(n);return e.base64?rf(We.BASE64,e.rest):Jv(e.rest)}function eI(n){return new sf(n).contentType}function tI(n,e){return n.length>=e.length?n.substring(n.length-e.length)===e:!1}/**
3414
3458
  * @license
3415
3459
  * Copyright 2017 Google LLC
3416
3460
  *
@@ -3425,7 +3469,7 @@ ${this.customData.serverResponse}`:this.message=this._baseMessage}}var te;(funct
3425
3469
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3426
3470
  * See the License for the specific language governing permissions and
3427
3471
  * limitations under the License.
3428
- */class It{constructor(e,t){let r=0,s="";il(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(il(this.data_)){const r=this.data_,s=Bv(r,e,t);return s===null?null:new It(s)}else{const r=new Uint8Array(this.data_.buffer,e,t-e);return new It(r,!0)}}static getBlob(...e){if(Ra()){const t=e.map(r=>r instanceof It?r.data_:r);return new It(Fv.apply(null,t))}else{const t=e.map(a=>mi(a)?$v(We.RAW,a).data:a.data_);let r=0;t.forEach(a=>{r+=a.byteLength});const s=new Uint8Array(r);let i=0;return t.forEach(a=>{for(let c=0;c<a.length;c++)s[i++]=a[c]}),new It(s,!0)}}uploadData(){return this.data_}}/**
3472
+ */class It{constructor(e,t){let r=0,s="";hl(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(hl(this.data_)){const r=this.data_,s=Qv(r,e,t);return s===null?null:new It(s)}else{const r=new Uint8Array(this.data_.buffer,e,t-e);return new It(r,!0)}}static getBlob(...e){if(Ca()){const t=e.map(r=>r instanceof It?r.data_:r);return new It(Kv.apply(null,t))}else{const t=e.map(a=>Ei(a)?Yv(We.RAW,a).data:a.data_);let r=0;t.forEach(a=>{r+=a.byteLength});const s=new Uint8Array(r);let i=0;return t.forEach(a=>{for(let c=0;c<a.length;c++)s[i++]=a[c]}),new It(s,!0)}}uploadData(){return this.data_}}/**
3429
3473
  * @license
3430
3474
  * Copyright 2017 Google LLC
3431
3475
  *
@@ -3440,7 +3484,7 @@ ${this.customData.serverResponse}`:this.message=this._baseMessage}}var te;(funct
3440
3484
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3441
3485
  * See the License for the specific language governing permissions and
3442
3486
  * limitations under the License.
3443
- */function Yd(n){let e;try{e=JSON.parse(n)}catch{return null}return Nv(e)?e:null}/**
3487
+ */function of(n){let e;try{e=JSON.parse(n)}catch{return null}return Bv(e)?e:null}/**
3444
3488
  * @license
3445
3489
  * Copyright 2017 Google LLC
3446
3490
  *
@@ -3455,7 +3499,7 @@ ${this.customData.serverResponse}`:this.message=this._baseMessage}}var te;(funct
3455
3499
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3456
3500
  * See the License for the specific language governing permissions and
3457
3501
  * limitations under the License.
3458
- */function Wv(n){if(n.length===0)return null;const e=n.lastIndexOf("/");return e===-1?"":n.slice(0,e)}function Kv(n,e){const t=e.split("/").filter(r=>r.length>0).join("/");return n.length===0?t:n+"/"+t}function Zd(n){const e=n.lastIndexOf("/",n.length-2);return e===-1?n:n.slice(e+1)}/**
3502
+ */function nI(n){if(n.length===0)return null;const e=n.lastIndexOf("/");return e===-1?"":n.slice(0,e)}function rI(n,e){const t=e.split("/").filter(r=>r.length>0).join("/");return n.length===0?t:n+"/"+t}function af(n){const e=n.lastIndexOf("/",n.length-2);return e===-1?n:n.slice(e+1)}/**
3459
3503
  * @license
3460
3504
  * Copyright 2017 Google LLC
3461
3505
  *
@@ -3470,7 +3514,7 @@ ${this.customData.serverResponse}`:this.message=this._baseMessage}}var te;(funct
3470
3514
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3471
3515
  * See the License for the specific language governing permissions and
3472
3516
  * limitations under the License.
3473
- */function Qv(n,e){return e}class be{constructor(e,t,r,s){this.server=e,this.local=t||e,this.writable=!!r,this.xform=s||Qv}}let ls=null;function Xv(n){return!mi(n)||n.length<2?n:Zd(n)}function ba(){if(ls)return ls;const n=[];n.push(new be("bucket")),n.push(new be("generation")),n.push(new be("metageneration")),n.push(new be("name","fullPath",!0));function e(i,a){return Xv(a)}const t=new be("name");t.xform=e,n.push(t);function r(i,a){return a!==void 0?Number(a):a}const s=new be("size");return s.xform=r,n.push(s),n.push(new be("timeCreated")),n.push(new be("updated")),n.push(new be("md5Hash",null,!0)),n.push(new be("cacheControl",null,!0)),n.push(new be("contentDisposition",null,!0)),n.push(new be("contentEncoding",null,!0)),n.push(new be("contentLanguage",null,!0)),n.push(new be("contentType",null,!0)),n.push(new be("metadata","customMetadata",!0)),ls=n,ls}function Jv(n,e){function t(){const r=n.bucket,s=n.fullPath,i=new Oe(r,s);return e._makeStorageReference(i)}Object.defineProperty(n,"ref",{get:t})}function Yv(n,e,t){const r={};r.type="file";const s=t.length;for(let i=0;i<s;i++){const a=t[i];r[a.local]=a.xform(r,e[a.server])}return Jv(r,n),r}function ef(n,e,t){const r=Yd(e);return r===null?null:Yv(n,r,t)}function Zv(n,e,t,r){const s=Yd(e);if(s===null||!mi(s.downloadTokens))return null;const i=s.downloadTokens;if(i.length===0)return null;const a=encodeURIComponent;return i.split(",").map(d=>{const f=n.bucket,m=n.fullPath,E="/b/"+a(f)+"/o/"+a(m),R=cn(E,t,r),C=Wd({alt:"media",token:d});return R+C})[0]}function tf(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 Ft{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=[]}}/**
3517
+ */function sI(n,e){return e}class be{constructor(e,t,r,s){this.server=e,this.local=t||e,this.writable=!!r,this.xform=s||sI}}let fs=null;function iI(n){return!Ei(n)||n.length<2?n:af(n)}function ka(){if(fs)return fs;const n=[];n.push(new be("bucket")),n.push(new be("generation")),n.push(new be("metageneration")),n.push(new be("name","fullPath",!0));function e(i,a){return iI(a)}const t=new be("name");t.xform=e,n.push(t);function r(i,a){return a!==void 0?Number(a):a}const s=new be("size");return s.xform=r,n.push(s),n.push(new be("timeCreated")),n.push(new be("updated")),n.push(new be("md5Hash",null,!0)),n.push(new be("cacheControl",null,!0)),n.push(new be("contentDisposition",null,!0)),n.push(new be("contentEncoding",null,!0)),n.push(new be("contentLanguage",null,!0)),n.push(new be("contentType",null,!0)),n.push(new be("metadata","customMetadata",!0)),fs=n,fs}function oI(n,e){function t(){const r=n.bucket,s=n.fullPath,i=new Ve(r,s);return e._makeStorageReference(i)}Object.defineProperty(n,"ref",{get:t})}function aI(n,e,t){const r={};r.type="file";const s=t.length;for(let i=0;i<s;i++){const a=t[i];r[a.local]=a.xform(r,e[a.server])}return oI(r,n),r}function cf(n,e,t){const r=of(e);return r===null?null:aI(n,r,t)}function cI(n,e,t,r){const s=of(e);if(s===null||!Ei(s.downloadTokens))return null;const i=s.downloadTokens;if(i.length===0)return null;const a=encodeURIComponent;return i.split(",").map(d=>{const f=n.bucket,m=n.fullPath,_="/b/"+a(f)+"/o/"+a(m),R=ln(_,t,r),S=ef({alt:"media",token:d});return R+S})[0]}function uf(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=[]}}/**
3474
3518
  * @license
3475
3519
  * Copyright 2017 Google LLC
3476
3520
  *
@@ -3485,15 +3529,15 @@ ${this.customData.serverResponse}`:this.message=this._baseMessage}}var te;(funct
3485
3529
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3486
3530
  * See the License for the specific language governing permissions and
3487
3531
  * limitations under the License.
3488
- */function ct(n){if(!n)throw Aa()}function Pa(n,e){function t(r,s){const i=ef(n,s,e);return ct(i!==null),i}return t}function eI(n,e){function t(r,s){const i=ef(n,s,e);return ct(i!==null),Zv(i,s,n.host,n._protocol)}return t}function xr(n){function e(t,r){let s;return t.getStatus()===401?t.getErrorText().includes("Firebase App Check token is invalid")?s=_v():s=gv():t.getStatus()===402?s=mv(n.bucket):t.getStatus()===403?s=yv(n.path):s=r,s.status=t.getStatus(),s.serverResponse=r.serverResponse,s}return e}function gi(n){const e=xr(n);function t(r,s){let i=e(r,s);return r.getStatus()===404&&(i=pv(n.path)),i.serverResponse=s.serverResponse,i}return t}function nf(n,e,t){const r=e.fullServerUrl(),s=cn(r,n.host,n._protocol),i="GET",a=n.maxOperationRetryTime,c=new Ft(s,i,Pa(n,t),a);return c.errorHandler=gi(e),c}function tI(n,e,t){const r=e.fullServerUrl(),s=cn(r,n.host,n._protocol)+"?alt=media",i="GET",a=n.maxOperationRetryTime,c=new Ft(s,i,(l,d)=>d,a);return c.errorHandler=gi(e),c}function nI(n,e,t){const r=e.fullServerUrl(),s=cn(r,n.host,n._protocol),i="GET",a=n.maxOperationRetryTime,c=new Ft(s,i,eI(n,t),a);return c.errorHandler=gi(e),c}function rI(n,e){const t=e.fullServerUrl(),r=cn(t,n.host,n._protocol),s="DELETE",i=n.maxOperationRetryTime;function a(l,d){}const c=new Ft(r,s,a,i);return c.successCodes=[200,204],c.errorHandler=gi(e),c}function sI(n,e){return n&&n.contentType||e&&e.type()||"application/octet-stream"}function rf(n,e,t){const r=Object.assign({},t);return r.fullPath=n.path,r.size=e.size(),r.contentType||(r.contentType=sI(null,e)),r}function iI(n,e,t,r,s){const i=e.bucketOnlyServerUrl(),a={"X-Goog-Upload-Protocol":"multipart"};function c(){let M="";for(let j=0;j<2;j++)M=M+Math.random().toString().slice(2);return M}const l=c();a["Content-Type"]="multipart/related; boundary="+l;const d=rf(e,r,s),f=tf(d,t),m="--"+l+`\r
3532
+ */function ct(n){if(!n)throw Sa()}function Na(n,e){function t(r,s){const i=cf(n,s,e);return ct(i!==null),i}return t}function uI(n,e){function t(r,s){const i=cf(n,s,e);return ct(i!==null),cI(i,s,n.host,n._protocol)}return t}function Br(n){function e(t,r){let s;return t.getStatus()===401?t.getErrorText().includes("Firebase App Check token is invalid")?s=bv():s=Rv():t.getStatus()===402?s=Av(n.bucket):t.getStatus()===403?s=Pv(n.path):s=r,s.status=t.getStatus(),s.serverResponse=r.serverResponse,s}return e}function Ti(n){const e=Br(n);function t(r,s){let i=e(r,s);return r.getStatus()===404&&(i=wv(n.path)),i.serverResponse=s.serverResponse,i}return t}function lf(n,e,t){const r=e.fullServerUrl(),s=ln(r,n.host,n._protocol),i="GET",a=n.maxOperationRetryTime,c=new qt(s,i,Na(n,t),a);return c.errorHandler=Ti(e),c}function lI(n,e,t){const r=e.fullServerUrl(),s=ln(r,n.host,n._protocol)+"?alt=media",i="GET",a=n.maxOperationRetryTime,c=new qt(s,i,(l,d)=>d,a);return c.errorHandler=Ti(e),c}function hI(n,e,t){const r=e.fullServerUrl(),s=ln(r,n.host,n._protocol),i="GET",a=n.maxOperationRetryTime,c=new qt(s,i,uI(n,t),a);return c.errorHandler=Ti(e),c}function dI(n,e){const t=e.fullServerUrl(),r=ln(t,n.host,n._protocol),s="DELETE",i=n.maxOperationRetryTime;function a(l,d){}const c=new qt(r,s,a,i);return c.successCodes=[200,204],c.errorHandler=Ti(e),c}function fI(n,e){return n&&n.contentType||e&&e.type()||"application/octet-stream"}function hf(n,e,t){const r=Object.assign({},t);return r.fullPath=n.path,r.size=e.size(),r.contentType||(r.contentType=fI(null,e)),r}function pI(n,e,t,r,s){const i=e.bucketOnlyServerUrl(),a={"X-Goog-Upload-Protocol":"multipart"};function c(){let x="";for(let $=0;$<2;$++)x=x+Math.random().toString().slice(2);return x}const l=c();a["Content-Type"]="multipart/related; boundary="+l;const d=hf(e,r,s),f=uf(d,t),m="--"+l+`\r
3489
3533
  Content-Type: application/json; charset=utf-8\r
3490
3534
  \r
3491
3535
  `+f+`\r
3492
3536
  --`+l+`\r
3493
3537
  Content-Type: `+d.contentType+`\r
3494
3538
  \r
3495
- `,E=`\r
3496
- --`+l+"--",R=It.getBlob(m,r,E);if(R===null)throw zd();const C={name:d.fullPath},N=cn(i,n.host,n._protocol),k="POST",F=n.maxUploadRetryTime,$=new Ft(N,k,Pa(n,t),F);return $.urlParams=C,$.headers=a,$.body=R.uploadData(),$.errorHandler=xr(e),$}class Hs{constructor(e,t,r,s){this.current=e,this.total=t,this.finalized=!!r,this.metadata=s||null}}function Sa(n,e){let t=null;try{t=n.getResponseHeader("X-Goog-Upload-Status")}catch{ct(!1)}return ct(!!t&&(e||["active"]).indexOf(t)!==-1),t}function oI(n,e,t,r,s){const i=e.bucketOnlyServerUrl(),a=rf(e,r,s),c={name:a.fullPath},l=cn(i,n.host,n._protocol),d="POST",f={"X-Goog-Upload-Protocol":"resumable","X-Goog-Upload-Command":"start","X-Goog-Upload-Header-Content-Length":`${r.size()}`,"X-Goog-Upload-Header-Content-Type":a.contentType,"Content-Type":"application/json; charset=utf-8"},m=tf(a,t),E=n.maxUploadRetryTime;function R(N){Sa(N);let k;try{k=N.getResponseHeader("X-Goog-Upload-URL")}catch{ct(!1)}return ct(mi(k)),k}const C=new Ft(l,d,R,E);return C.urlParams=c,C.headers=f,C.body=m,C.errorHandler=xr(e),C}function aI(n,e,t,r){const s={"X-Goog-Upload-Command":"query"};function i(d){const f=Sa(d,["active","final"]);let m=null;try{m=d.getResponseHeader("X-Goog-Upload-Size-Received")}catch{ct(!1)}m||ct(!1);const E=Number(m);return ct(!isNaN(E)),new Hs(E,r.size(),f==="final")}const a="POST",c=n.maxUploadRetryTime,l=new Ft(t,a,i,c);return l.headers=s,l.errorHandler=xr(e),l}const al=256*1024;function cI(n,e,t,r,s,i,a,c){const l=new Hs(0,0);if(a?(l.current=a.current,l.total=a.total):(l.current=0,l.total=r.size()),r.size()!==l.total)throw Iv();const d=l.total-l.current;let f=d;s>0&&(f=Math.min(f,s));const m=l.current,E=m+f;let R="";f===0?R="finalize":d===f?R="upload, finalize":R="upload";const C={"X-Goog-Upload-Command":R,"X-Goog-Upload-Offset":`${l.current}`},N=r.slice(m,E);if(N===null)throw zd();function k(j,ce){const X=Sa(j,["active","final"]),v=l.current+f,g=r.size();let _;return X==="final"?_=Pa(e,i)(j,ce):_=null,new Hs(v,g,X==="final",_)}const F="POST",$=e.maxUploadRetryTime,M=new Ft(t,F,k,$);return M.headers=C,M.body=N.uploadData(),M.progressCallback=c||null,M.errorHandler=xr(n),M}const ke={RUNNING:"running",PAUSED:"paused",SUCCESS:"success",CANCELED:"canceled",ERROR:"error"};function Ji(n){switch(n){case"running":case"pausing":case"canceling":return ke.RUNNING;case"paused":return ke.PAUSED;case"success":return ke.SUCCESS;case"canceled":return ke.CANCELED;case"error":return ke.ERROR;default:return ke.ERROR}}/**
3539
+ `,_=`\r
3540
+ --`+l+"--",R=It.getBlob(m,r,_);if(R===null)throw Jd();const S={name:d.fullPath},N=ln(i,n.host,n._protocol),k="POST",B=n.maxUploadRetryTime,M=new qt(N,k,Na(n,t),B);return M.urlParams=S,M.headers=a,M.body=R.uploadData(),M.errorHandler=Br(e),M}class Ws{constructor(e,t,r,s){this.current=e,this.total=t,this.finalized=!!r,this.metadata=s||null}}function Da(n,e){let t=null;try{t=n.getResponseHeader("X-Goog-Upload-Status")}catch{ct(!1)}return ct(!!t&&(e||["active"]).indexOf(t)!==-1),t}function mI(n,e,t,r,s){const i=e.bucketOnlyServerUrl(),a=hf(e,r,s),c={name:a.fullPath},l=ln(i,n.host,n._protocol),d="POST",f={"X-Goog-Upload-Protocol":"resumable","X-Goog-Upload-Command":"start","X-Goog-Upload-Header-Content-Length":`${r.size()}`,"X-Goog-Upload-Header-Content-Type":a.contentType,"Content-Type":"application/json; charset=utf-8"},m=uf(a,t),_=n.maxUploadRetryTime;function R(N){Da(N);let k;try{k=N.getResponseHeader("X-Goog-Upload-URL")}catch{ct(!1)}return ct(Ei(k)),k}const S=new qt(l,d,R,_);return S.urlParams=c,S.headers=f,S.body=m,S.errorHandler=Br(e),S}function gI(n,e,t,r){const s={"X-Goog-Upload-Command":"query"};function i(d){const f=Da(d,["active","final"]);let m=null;try{m=d.getResponseHeader("X-Goog-Upload-Size-Received")}catch{ct(!1)}m||ct(!1);const _=Number(m);return ct(!isNaN(_)),new Ws(_,r.size(),f==="final")}const a="POST",c=n.maxUploadRetryTime,l=new qt(t,a,i,c);return l.headers=s,l.errorHandler=Br(e),l}const fl=256*1024;function _I(n,e,t,r,s,i,a,c){const l=new Ws(0,0);if(a?(l.current=a.current,l.total=a.total):(l.current=0,l.total=r.size()),r.size()!==l.total)throw Nv();const d=l.total-l.current;let f=d;s>0&&(f=Math.min(f,s));const m=l.current,_=m+f;let R="";f===0?R="finalize":d===f?R="upload, finalize":R="upload";const S={"X-Goog-Upload-Command":R,"X-Goog-Upload-Offset":`${l.current}`},N=r.slice(m,_);if(N===null)throw Jd();function k($,ce){const X=Da($,["active","final"]),v=l.current+f,g=r.size();let y;return X==="final"?y=Na(e,i)($,ce):y=null,new Ws(v,g,X==="final",y)}const B="POST",M=e.maxUploadRetryTime,x=new qt(t,B,k,M);return x.headers=S,x.body=N.uploadData(),x.progressCallback=c||null,x.errorHandler=Br(n),x}const ke={RUNNING:"running",PAUSED:"paused",SUCCESS:"success",CANCELED:"canceled",ERROR:"error"};function to(n){switch(n){case"running":case"pausing":case"canceling":return ke.RUNNING;case"paused":return ke.PAUSED;case"success":return ke.SUCCESS;case"canceled":return ke.CANCELED;case"error":return ke.ERROR;default:return ke.ERROR}}/**
3497
3541
  * @license
3498
3542
  * Copyright 2017 Google LLC
3499
3543
  *
@@ -3508,7 +3552,7 @@ Content-Type: `+d.contentType+`\r
3508
3552
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3509
3553
  * See the License for the specific language governing permissions and
3510
3554
  * limitations under the License.
3511
- */class uI{constructor(e,t,r){if(kv(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}}}/**
3555
+ */class yI{constructor(e,t,r){if(Fv(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}}}/**
3512
3556
  * @license
3513
3557
  * Copyright 2017 Google LLC
3514
3558
  *
@@ -3523,7 +3567,7 @@ Content-Type: `+d.contentType+`\r
3523
3567
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3524
3568
  * See the License for the specific language governing permissions and
3525
3569
  * limitations under the License.
3526
- */function fn(n){return(...e)=>{Promise.resolve().then(()=>n(...e))}}class sf{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 nr("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 nr("cannot .getErrorCode() before sending");return this.errorCode_}getStatus(){if(!this.sent_)throw nr("cannot .getStatus() before sending");try{return this.xhr_.status}catch{return-1}}getResponse(){if(!this.sent_)throw nr("cannot .getResponse() before sending");return this.xhr_.response}getErrorText(){if(!this.sent_)throw nr("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 lI extends sf{initXhr(){this.xhr_.responseType="text"}}function wt(){return new lI}class hI extends sf{initXhr(){this.xhr_.responseType="blob"}}function dI(){return new hI}/**
3570
+ */function mn(n){return(...e)=>{Promise.resolve().then(()=>n(...e))}}class df{constructor(){this.sent_=!1,this.xhr_=new XMLHttpRequest,this.initXhr(),this.errorCode_=Xt.NO_ERROR,this.sendPromise_=new Promise(e=>{this.xhr_.addEventListener("abort",()=>{this.errorCode_=Xt.ABORT,e()}),this.xhr_.addEventListener("error",()=>{this.errorCode_=Xt.NETWORK_ERROR,e()}),this.xhr_.addEventListener("load",()=>{e()})})}send(e,t,r,s,i){if(this.sent_)throw sr("cannot .send() more than once");if(Lt(e)&&r&&(this.xhr_.withCredentials=!0),this.sent_=!0,this.xhr_.open(t,e,!0),i!==void 0)for(const a in i)i.hasOwnProperty(a)&&this.xhr_.setRequestHeader(a,i[a].toString());return s!==void 0?this.xhr_.send(s):this.xhr_.send(),this.sendPromise_}getErrorCode(){if(!this.sent_)throw sr("cannot .getErrorCode() before sending");return this.errorCode_}getStatus(){if(!this.sent_)throw sr("cannot .getStatus() before sending");try{return this.xhr_.status}catch{return-1}}getResponse(){if(!this.sent_)throw sr("cannot .getResponse() before sending");return this.xhr_.response}getErrorText(){if(!this.sent_)throw sr("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 EI extends df{initXhr(){this.xhr_.responseType="text"}}function wt(){return new EI}class TI extends df{initXhr(){this.xhr_.responseType="blob"}}function vI(){return new TI}/**
3527
3571
  * @license
3528
3572
  * Copyright 2017 Google LLC
3529
3573
  *
@@ -3538,7 +3582,7 @@ Content-Type: `+d.contentType+`\r
3538
3582
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3539
3583
  * See the License for the specific language governing permissions and
3540
3584
  * limitations under the License.
3541
- */class fI{isExponentialBackoffExpired(){return this.sleepTime>this.maxSleepTime}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=ba(),this._resumable=this._shouldDoResumable(this._blob),this._state="running",this._errorHandler=s=>{if(this._request=void 0,this._chunkMultiplier=1,s._codeEquals(te.CANCELED))this._needToFetchStatus=!0,this.completeTransitions_();else{const i=this.isExponentialBackoffExpired();if(Kd(s.status,[]))if(i)s=jd();else{this.sleepTime=Math.max(this.sleepTime*2,fv),this._needToFetchStatus=!0,this.completeTransitions_();return}this._error=s,this._transition("error")}},this._metadataErrorHandler=s=>{this._request=void 0,s._codeEquals(te.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,()=>{})}_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=oI(this._ref.storage,this._ref._location,this._mappings,this._blob,this._metadata),s=this._ref.storage._makeRequest(r,wt,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=aI(this._ref.storage,this._ref._location,e,this._blob),i=this._ref.storage._makeRequest(s,wt,t,r);this._request=i,i.getPromise().then(a=>{a=a,this._request=void 0,this._updateProgress(a.current),this._needToFetchStatus=!1,a.finalized&&(this._needToFetchMetadata=!0),this.completeTransitions_()},this._errorHandler)})}_continueUpload(){const e=al*this._chunkMultiplier,t=new Hs(this._transferred,this._blob.size()),r=this._uploadUrl;this._resolveToken((s,i)=>{let a;try{a=cI(this._ref._location,this._ref.storage,r,this._blob,e,this._mappings,t,this._makeProgressCallback())}catch(l){this._error=l,this._transition("error");return}const c=this._ref.storage._makeRequest(a,wt,s,i,!1);this._request=c,c.getPromise().then(l=>{this._increaseMultiplier(),this._request=void 0,this._updateProgress(l.current),l.finalized?(this._metadata=l.metadata,this._transition("success")):this.completeTransitions_()},this._errorHandler)})}_increaseMultiplier(){al*this._chunkMultiplier*2<32*1024*1024&&(this._chunkMultiplier*=2)}_fetchMetadata(){this._resolveToken((e,t)=>{const r=nf(this._ref.storage,this._ref._location,this._mappings),s=this._ref.storage._makeRequest(r,wt,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=iI(this._ref.storage,this._ref._location,this._mappings,this._blob,this._metadata),s=this._ref.storage._makeRequest(r,wt,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=Hd(),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=Ji(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 uI(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(Ji(this._state)){case ke.SUCCESS:fn(this._resolve.bind(null,this.snapshot))();break;case ke.CANCELED:case ke.ERROR:const t=this._reject;fn(t.bind(null,this._error))();break;default:e=!1;break}e&&(this._resolve=void 0,this._reject=void 0)}}_notifyObserver(e){switch(Ji(this._state)){case ke.RUNNING:case ke.PAUSED:e.next&&fn(e.next.bind(e,this.snapshot))();break;case ke.SUCCESS:e.complete&&fn(e.complete.bind(e))();break;case ke.CANCELED:case ke.ERROR:e.error&&fn(e.error.bind(e,this._error))();break;default:e.error&&fn(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}}/**
3585
+ */class II{isExponentialBackoffExpired(){return this.sleepTime>this.maxSleepTime}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=ka(),this._resumable=this._shouldDoResumable(this._blob),this._state="running",this._errorHandler=s=>{if(this._request=void 0,this._chunkMultiplier=1,s._codeEquals(te.CANCELED))this._needToFetchStatus=!0,this.completeTransitions_();else{const i=this.isExponentialBackoffExpired();if(tf(s.status,[]))if(i)s=Xd();else{this.sleepTime=Math.max(this.sleepTime*2,Iv),this._needToFetchStatus=!0,this.completeTransitions_();return}this._error=s,this._transition("error")}},this._metadataErrorHandler=s=>{this._request=void 0,s._codeEquals(te.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,()=>{})}_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=mI(this._ref.storage,this._ref._location,this._mappings,this._blob,this._metadata),s=this._ref.storage._makeRequest(r,wt,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=gI(this._ref.storage,this._ref._location,e,this._blob),i=this._ref.storage._makeRequest(s,wt,t,r);this._request=i,i.getPromise().then(a=>{a=a,this._request=void 0,this._updateProgress(a.current),this._needToFetchStatus=!1,a.finalized&&(this._needToFetchMetadata=!0),this.completeTransitions_()},this._errorHandler)})}_continueUpload(){const e=fl*this._chunkMultiplier,t=new Ws(this._transferred,this._blob.size()),r=this._uploadUrl;this._resolveToken((s,i)=>{let a;try{a=_I(this._ref._location,this._ref.storage,r,this._blob,e,this._mappings,t,this._makeProgressCallback())}catch(l){this._error=l,this._transition("error");return}const c=this._ref.storage._makeRequest(a,wt,s,i,!1);this._request=c,c.getPromise().then(l=>{this._increaseMultiplier(),this._request=void 0,this._updateProgress(l.current),l.finalized?(this._metadata=l.metadata,this._transition("success")):this.completeTransitions_()},this._errorHandler)})}_increaseMultiplier(){fl*this._chunkMultiplier*2<32*1024*1024&&(this._chunkMultiplier*=2)}_fetchMetadata(){this._resolveToken((e,t)=>{const r=lf(this._ref.storage,this._ref._location,this._mappings),s=this._ref.storage._makeRequest(r,wt,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=pI(this._ref.storage,this._ref._location,this._mappings,this._blob,this._metadata),s=this._ref.storage._makeRequest(r,wt,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=Yd(),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=to(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 yI(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(to(this._state)){case ke.SUCCESS:mn(this._resolve.bind(null,this.snapshot))();break;case ke.CANCELED:case ke.ERROR:const t=this._reject;mn(t.bind(null,this._error))();break;default:e=!1;break}e&&(this._resolve=void 0,this._reject=void 0)}}_notifyObserver(e){switch(to(this._state)){case ke.RUNNING:case ke.PAUSED:e.next&&mn(e.next.bind(e,this.snapshot))();break;case ke.SUCCESS:e.complete&&mn(e.complete.bind(e))();break;case ke.CANCELED:case ke.ERROR:e.error&&mn(e.error.bind(e,this._error))();break;default:e.error&&mn(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}}/**
3542
3586
  * @license
3543
3587
  * Copyright 2019 Google LLC
3544
3588
  *
@@ -3553,7 +3597,7 @@ Content-Type: `+d.contentType+`\r
3553
3597
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3554
3598
  * See the License for the specific language governing permissions and
3555
3599
  * limitations under the License.
3556
- */class tn{constructor(e,t){this._service=e,t instanceof Oe?this._location=t:this._location=Oe.makeFromUrl(t,e.host)}toString(){return"gs://"+this._location.bucket+"/"+this._location.path}_newRef(e,t){return new tn(e,t)}get root(){const e=new Oe(this._location.bucket,"");return this._newRef(this._service,e)}get bucket(){return this._location.bucket}get fullPath(){return this._location.path}get name(){return Zd(this._location.path)}get storage(){return this._service}get parent(){const e=Wv(this._location.path);if(e===null)return null;const t=new Oe(this._location.bucket,e);return new tn(this._service,t)}_throwIfRoot(e){if(this._location.path==="")throw Rv(e)}}function pI(n,e){n._throwIfRoot("getBlob");const t=tI(n.storage,n._location);return n.storage.makeRequestWithTokens(t,dI).then(r=>r)}function mI(n,e,t){return n._throwIfRoot("uploadBytesResumable"),new fI(n,new It(e),t)}function gI(n){n._throwIfRoot("getMetadata");const e=nf(n.storage,n._location,ba());return n.storage.makeRequestWithTokens(e,wt)}function _I(n){n._throwIfRoot("getDownloadURL");const e=nI(n.storage,n._location,ba());return n.storage.makeRequestWithTokens(e,wt).then(t=>{if(t===null)throw wv();return t})}function yI(n){n._throwIfRoot("deleteObject");const e=rI(n.storage,n._location);return n.storage.makeRequestWithTokens(e,wt)}function TI(n,e){const t=Kv(n._location.path,e),r=new Oe(n._location.bucket,t);return new tn(n.storage,r)}/**
3600
+ */class rn{constructor(e,t){this._service=e,t instanceof Ve?this._location=t:this._location=Ve.makeFromUrl(t,e.host)}toString(){return"gs://"+this._location.bucket+"/"+this._location.path}_newRef(e,t){return new rn(e,t)}get root(){const e=new Ve(this._location.bucket,"");return this._newRef(this._service,e)}get bucket(){return this._location.bucket}get fullPath(){return this._location.path}get name(){return af(this._location.path)}get storage(){return this._service}get parent(){const e=nI(this._location.path);if(e===null)return null;const t=new Ve(this._location.bucket,e);return new rn(this._service,t)}_throwIfRoot(e){if(this._location.path==="")throw Ov(e)}}function wI(n,e){n._throwIfRoot("getBlob");const t=lI(n.storage,n._location);return n.storage.makeRequestWithTokens(t,vI).then(r=>r)}function AI(n,e,t){return n._throwIfRoot("uploadBytesResumable"),new II(n,new It(e),t)}function RI(n){n._throwIfRoot("getMetadata");const e=lf(n.storage,n._location,ka());return n.storage.makeRequestWithTokens(e,wt)}function bI(n){n._throwIfRoot("getDownloadURL");const e=hI(n.storage,n._location,ka());return n.storage.makeRequestWithTokens(e,wt).then(t=>{if(t===null)throw Dv();return t})}function PI(n){n._throwIfRoot("deleteObject");const e=dI(n.storage,n._location);return n.storage.makeRequestWithTokens(e,wt)}function SI(n,e){const t=rI(n._location.path,e),r=new Ve(n._location.bucket,t);return new rn(n.storage,r)}/**
3557
3601
  * @license
3558
3602
  * Copyright 2017 Google LLC
3559
3603
  *
@@ -3568,7 +3612,7 @@ Content-Type: `+d.contentType+`\r
3568
3612
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3569
3613
  * See the License for the specific language governing permissions and
3570
3614
  * limitations under the License.
3571
- */function EI(n){return/^[A-Za-z]+:\/\//.test(n)}function vI(n,e){return new tn(n,e)}function of(n,e){if(n instanceof Ca){const t=n;if(t._bucket==null)throw vv();const r=new tn(t,t._bucket);return e!=null?of(r,e):r}else return e!==void 0?TI(n,e):n}function II(n,e){if(e&&EI(e)){if(n instanceof Ca)return vI(n,e);throw Io("To use ref(service, url), the first argument must be a Storage instance.")}else return of(n,e)}function cl(n,e){const t=e==null?void 0:e[$d];return t==null?null:Oe.makeFromBucketSpec(t,n)}function wI(n,e,t,r={}){n.host=`${e}:${t}`,n._protocol="http";const{mockUserToken:s}=r;s&&(n._overrideAuthToken=typeof s=="string"?s:_l(s,n.app.options.projectId))}class Ca{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=qd,this._protocol="https",this._appId=null,this._deleted=!1,this._maxOperationRetryTime=hv,this._maxUploadRetryTime=dv,this._requests=new Set,s!=null?this._bucket=Oe.makeFromBucketSpec(s,this._host):this._bucket=cl(this._host,this.app.options)}get host(){return this._host}set host(e){this._host=e,this._url!=null?this._bucket=Oe.makeFromBucketSpec(this._url,e):this._bucket=cl(e,this.app.options)}get maxUploadRetryTime(){return this._maxUploadRetryTime}set maxUploadRetryTime(e){ol("time",0,Number.POSITIVE_INFINITY,e),this._maxUploadRetryTime=e}get maxOperationRetryTime(){return this._maxOperationRetryTime}set maxOperationRetryTime(e){ol("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(){if(Pe(this.app)&&this.app.settings.appCheckToken)return this.app.settings.appCheckToken;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 tn(this,e)}_makeRequest(e,t,r,s,i=!0){if(this._deleted)return new bv(Gd());{const a=xv(e,this._appId,r,s,t,this._firebaseVersion,i);return this._requests.add(a),a.getPromise().then(()=>this._requests.delete(a),()=>this._requests.delete(a)),a}}async makeRequestWithTokens(e,t){const[r,s]=await Promise.all([this._getAuthToken(),this._getAppCheckToken()]);return this._makeRequest(e,t,r,s).getPromise()}}const ul="@firebase/storage",ll="0.13.7";/**
3615
+ */function CI(n){return/^[A-Za-z]+:\/\//.test(n)}function kI(n,e){return new rn(n,e)}function ff(n,e){if(n instanceof Va){const t=n;if(t._bucket==null)throw kv();const r=new rn(t,t._bucket);return e!=null?ff(r,e):r}else return e!==void 0?SI(n,e):n}function NI(n,e){if(e&&CI(e)){if(n instanceof Va)return kI(n,e);throw bo("To use ref(service, url), the first argument must be a Storage instance.")}else return ff(n,e)}function pl(n,e){const t=e==null?void 0:e[Qd];return t==null?null:Ve.makeFromBucketSpec(t,n)}function DI(n,e,t,r={}){n.host=`${e}:${t}`;const s=Lt(e);s&&(Qs(`https://${n.host}`),xt("Storage",!0)),n._isUsingEmulator=!0,n._protocol=s?"https":"http";const{mockUserToken:i}=r;i&&(n._overrideAuthToken=typeof i=="string"?i:wl(i,n.app.options.projectId))}class Va{constructor(e,t,r,s,i,a=!1){this.app=e,this._authProvider=t,this._appCheckProvider=r,this._url=s,this._firebaseVersion=i,this._isUsingEmulator=a,this._bucket=null,this._host=Kd,this._protocol="https",this._appId=null,this._deleted=!1,this._maxOperationRetryTime=Tv,this._maxUploadRetryTime=vv,this._requests=new Set,s!=null?this._bucket=Ve.makeFromBucketSpec(s,this._host):this._bucket=pl(this._host,this.app.options)}get host(){return this._host}set host(e){this._host=e,this._url!=null?this._bucket=Ve.makeFromBucketSpec(this._url,e):this._bucket=pl(e,this.app.options)}get maxUploadRetryTime(){return this._maxUploadRetryTime}set maxUploadRetryTime(e){dl("time",0,Number.POSITIVE_INFINITY,e),this._maxUploadRetryTime=e}get maxOperationRetryTime(){return this._maxOperationRetryTime}set maxOperationRetryTime(e){dl("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(){if(Pe(this.app)&&this.app.settings.appCheckToken)return this.app.settings.appCheckToken;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 rn(this,e)}_makeRequest(e,t,r,s,i=!0){if(this._deleted)return new Lv(Zd());{const a=Gv(e,this._appId,r,s,t,this._firebaseVersion,i,this._isUsingEmulator);return this._requests.add(a),a.getPromise().then(()=>this._requests.delete(a),()=>this._requests.delete(a)),a}}async makeRequestWithTokens(e,t){const[r,s]=await Promise.all([this._getAuthToken(),this._getAppCheckToken()]);return this._makeRequest(e,t,r,s).getPromise()}}const ml="@firebase/storage",gl="0.13.11";/**
3572
3616
  * @license
3573
3617
  * Copyright 2020 Google LLC
3574
3618
  *
@@ -3583,7 +3627,7 @@ Content-Type: `+d.contentType+`\r
3583
3627
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3584
3628
  * See the License for the specific language governing permissions and
3585
3629
  * limitations under the License.
3586
- */const af="storage";function AI(n,e,t){return n=Z(n),mI(n,e,t)}function RI(n){return n=Z(n),gI(n)}function bI(n){return n=Z(n),_I(n)}function PI(n){return n=Z(n),yI(n)}function rr(n,e){return n=Z(n),II(n,e)}function SI(n=Gs(),e){n=Z(n);const r=Pr(n,af).getImmediate({identifier:e}),s=Ao("storage");return s&&CI(r,...s),r}function CI(n,e,t,r={}){wI(n,e,t,r)}/**
3630
+ */const pf="storage";function VI(n,e,t){return n=Z(n),AI(n,e,t)}function OI(n){return n=Z(n),RI(n)}function LI(n){return n=Z(n),bI(n)}function xI(n){return n=Z(n),PI(n)}function ir(n,e){return n=Z(n),NI(n,e)}function MI(n=Xs(),e){n=Z(n),xt("Storage",!1);const r=kr(n,pf).getImmediate({identifier:e}),s=So("storage");return s&&UI(r,...s),r}function UI(n,e,t,r={}){DI(n,e,t,r)}/**
3587
3631
  * @license
3588
3632
  * Copyright 2021 Google LLC
3589
3633
  *
@@ -3598,4 +3642,4 @@ Content-Type: `+d.contentType+`\r
3598
3642
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3599
3643
  * See the License for the specific language governing permissions and
3600
3644
  * limitations under the License.
3601
- */function kI(n,e){return n=Z(n),pI(n)}function NI(n,{instanceIdentifier:e}){const t=n.getProvider("app").getImmediate(),r=n.getProvider("auth-internal"),s=n.getProvider("app-check-internal");return new Ca(t,r,s,e,nn)}function DI(){St(new ut(af,NI,"PUBLIC").setMultipleInstances(!0)),qe(ul,ll,""),qe(ul,ll,"esm2017")}DI();var OI=new rt,VI=n=>({getCurrentUser:async()=>{let e=n.currentUser;if(!e)return null;let{claims:t}=await e.getIdTokenResult();return{...e,role:t.role}},loginWithPassword:async(e,{email:t,password:r})=>{let s=(await Fg(n,t,r)).user;if(!s)throw new Error("No user found");let{claims:i}=await s.getIdTokenResult();return{...s,role:i.role}},loginWithPopup:async()=>{let e=(await c_(n,OI)).user;if(!e)throw new Error("No user found");let{claims:t}=await e.getIdTokenResult();return{...e,role:t.role}},logout:async()=>{await $g(n)},loginWithToken:async e=>{let t=(await xg(n,e)).user;if(!t)throw new Error("No user found");let{claims:r}=await t.getIdTokenResult();return{...t,role:r.role}},subscribeToUser:e=>Hl(n,t=>{t?t.getIdTokenResult().then(r=>{let{claims:s}=r;e({...t,role:s==null?void 0:s.role})}):e(null)})}),cf=(n,e)=>{var f;let{collection:t,filters:r,limit:s,search:i,sort:a,isCollectionGroup:c,cursor:l}=e,d=c?Ed(n,t):Td(n,t);if(r&&r.forEach(({key:m,operator:E,value:R})=>{d=Ue(d,wn(m,E,R))}),a&&(d=Ue(d,Cd(a.key,a.direction))),l&&(d=Ue(d,Nd(l))),((f=i.paths)==null?void 0:f.length)&&i.query){let m=(i.query||"").trim();m&&(d=Ue(d,wn(i.paths[0].prop,">=",m),wn(i.paths[0].prop,"<=",`${m}`)))}return Ue(d,kd(s))},LI=(n,e,t)=>{var f;let{collection:r,filters:s,sort:i,isCollectionGroup:a,search:c,limit:l}=e,d=a?Ed(n,r):Td(n,r);if(s&&s.forEach(({key:m,operator:E,value:R})=>{d=Ue(d,wn(m,E,R))}),i&&(d=Ue(d,Cd(i.key,i.direction))),((f=c.paths)==null?void 0:f.length)&&c.query){let m=(c.query||"").trim();m&&(d=Ue(d,wn(c.paths[0].prop,">=",m),wn(c.paths[0].prop,"<=",`${m}`)))}return t&&(d=Ue(d,Nd(t))),d=Ue(d,kd(l)),Ue(d,iv(1))},MI=n=>(e,t,r)=>{let s=cf(n,e);return Ud(s,i=>{let a=i.docs.map(c=>c.data());t(a,i.docs[i.docs.length-1])},i=>{r({code:i.code,message:i.name,description:i.message})})},xI=n=>async e=>{let{cursor:t}=e,r=t?await Ld(Un(n,e.collection,t.id)):null,s=LI(n,e,r);return(await Md(s)).docs[0]??null},UI=n=>async e=>{let t=Fm(n,"getQueryCount"),{data:r}=await t(e);return r.count},FI=n=>async e=>{let t=Un(n,e),r=await Ld(t),s=r.data();return s?{...s,_id:r.id}:null},BI=n=>async e=>{let t=cf(n,e);return(await Md(t)).docs.map(r=>({...r.data(),_id:r.id}))},qI=n=>async(e,t)=>{let r=Un(n,e),s=Wf(Ht.getState().user,t,!0);return await xd(r,s,{merge:!0}),r.id},$I=n=>async e=>{let t=Un(n,e);await lv(t)},jI=n=>async(e,t)=>{let r=Un(n,e);await xd(r,t,{merge:!0})},HI=n=>(e,t,r)=>{let s=Un(n,e);return Ud(s,i=>{let a=i.data();t(a?{...a,_id:i.id}:null)},i=>{r({code:i.code,message:i.name,description:i.message})})},zI=(n,e)=>({subscribeToQuery:MI(n),fetchNextCursor:xI(n),fetchCount:UI(e),fetchItem:FI(n),fetchItems:BI(n),createItem:qI(n),deleteItem:$I(n),updateItem:jI(n),subscribeToItem:HI(n)}),GI=n=>({delete:async e=>{await PI(rr(n,e))},fetchObject:async e=>{let t=rr(n,e);return await kI(t)},fetchMetadata:async e=>{let t=rr(n,e);return await RI(t)},getObjectUrl:async e=>{let t=rr(n,e);return await bI(t)},upload:async(e,t,r)=>{let s=rr(n,e),i=AI(s,new Blob([t.dataUrl]));i.on("state_changed",c=>{let l=c.bytesTransferred/c.totalBytes*100;r({loaded:c.bytesTransferred,total:c.totalBytes,percent:l})});let a={filename:t.filename,type:t.type,storagePath:e};return await i.then(),a}}),JI=(n,e,t,r)=>({auth:VI(n),db:zI(e,r),storage:GI(t)}),uf=nt.createContext({app:null,auth:null,db:null,storage:null,functions:null,authProviders:[],signOut:()=>{}}),YI=({children:n,app:e,authProviders:t})=>{let[r]=nt.useState(Z_(e)),[s]=nt.useState(QE(e)),[i]=nt.useState(SI(e)),[a]=nt.useState(xm(e));nt.useEffect(()=>Hl(r,d=>{if(!d){Ht.setState({user:null,loading:!1});return}Ht.setState({loading:!0}),Pl(d).then(f=>{Ht.setState({user:{...d,role:f.claims.admin?"admin":"user"},loading:!1})})}),[r]);let c=nt.useCallback(async()=>{Ht.setState({loading:!0});try{await r.signOut(),Ht.setState({user:null,loading:!1})}catch(d){console.error(d)}finally{Ht.setState({loading:!1})}},[r]),l=nt.useMemo(()=>({app:e,auth:r,authProviders:t,db:s,storage:i,signOut:c,functions:a}),[e,r,s,i,a,c,t]);return Kf.jsx(uf.Provider,{value:l,children:n})},ZI=()=>nt.useContext(uf),ew=()=>Gf();export{YI as E,ew as H,ZI as M,SI as a,QE as b,Z_ as c,xm as g,Fm as h,am as i,qe as r,JI as u};
3645
+ */function FI(n,e){return n=Z(n),wI(n)}function BI(n,{instanceIdentifier:e}){const t=n.getProvider("app").getImmediate(),r=n.getProvider("auth-internal"),s=n.getProvider("app-check-internal");return new Va(t,r,s,e,sn)}function qI(){St(new ut(pf,BI,"PUBLIC").setMultipleInstances(!0)),qe(ml,gl,""),qe(ml,gl,"esm2017")}qI();var jI=new rt,$I=n=>({getCurrentUser:async()=>{let e=n.currentUser;if(!e)return null;let{claims:t}=await e.getIdTokenResult();return{...e,role:t.role}},loginWithPassword:async(e,{email:t,password:r})=>{let s=(await Kg(n,t,r)).user;if(!s)throw new Error("No user found");let{claims:i}=await s.getIdTokenResult();return{...s,role:i.role}},loginWithPopup:async()=>{let e=(await __(n,jI)).user;if(!e)throw new Error("No user found");let{claims:t}=await e.getIdTokenResult();return{...e,role:t.role}},logout:async()=>{await Yg(n)},loginWithToken:async e=>{let t=(await Gg(n,e)).user;if(!t)throw new Error("No user found");let{claims:r}=await t.getIdTokenResult();return{...t,role:r.role}},subscribeToUser:e=>Xl(n,t=>{t?t.getIdTokenResult().then(r=>{let{claims:s}=r;e({...t,role:s==null?void 0:s.role})}):e(null)})}),mf=(n,e)=>{var f;let{collection:t,filters:r,limit:s,search:i,sort:a,isCollectionGroup:c,cursor:l}=e,d=c?Pd(n,t):bd(n,t);if(r&&r.forEach(({key:m,operator:_,value:R})=>{d=Ue(d,Rn(m,_,R))}),a&&(d=Ue(d,xd(a.key,a.direction))),l&&(d=Ue(d,Ud(l))),((f=i.paths)==null?void 0:f.length)&&i.query){let m=(i.query||"").trim();m&&(d=Ue(d,Rn(i.paths[0].prop,">=",m),Rn(i.paths[0].prop,"<=",`${m}`)))}return Ue(d,Md(s))},zI=(n,e,t)=>{var f;let{collection:r,filters:s,sort:i,isCollectionGroup:a,search:c,limit:l}=e,d=a?Pd(n,r):bd(n,r);if(s&&s.forEach(({key:m,operator:_,value:R})=>{d=Ue(d,Rn(m,_,R))}),i&&(d=Ue(d,xd(i.key,i.direction))),((f=c.paths)==null?void 0:f.length)&&c.query){let m=(c.query||"").trim();m&&(d=Ue(d,Rn(c.paths[0].prop,">=",m),Rn(c.paths[0].prop,"<=",`${m}`)))}return t&&(d=Ue(d,Ud(t))),d=Ue(d,Md(l)),Ue(d,pv(1))},HI=n=>(e,t,r)=>{let s=mf(n,e);return Hd(s,i=>{let a=i.docs.map(c=>c.data());t(a,i.docs[i.docs.length-1])},i=>{r({code:i.code,message:i.name,description:i.message})})},GI=n=>async e=>{let{cursor:t}=e,r=t?await jd(Bn(n,e.collection,t.id)):null,s=zI(n,e,r);return(await $d(s)).docs[0]??null},WI=n=>async e=>{let t=Km(n,"getQueryCount"),{data:r}=await t(e);return r.count},KI=n=>async e=>{let t=Bn(n,e),r=await jd(t),s=r.data();return s?{...s,_id:r.id}:null},QI=n=>async e=>{let t=mf(n,e);return(await $d(t)).docs.map(r=>({...r.data(),_id:r.id}))},XI=n=>async(e,t)=>{let r=Bn(n,e),s=ep(Gt.getState().user,t,!0);return await zd(r,s,{merge:!0}),r.id},YI=n=>async e=>{let t=Bn(n,e);await Ev(t)},JI=n=>async(e,t)=>{let r=Bn(n,e);await zd(r,t,{merge:!0})},ZI=n=>(e,t,r)=>{let s=Bn(n,e);return Hd(s,i=>{let a=i.data();t(a?{...a,_id:i.id}:null)},i=>{r({code:i.code,message:i.name,description:i.message})})},ew=(n,e)=>({subscribeToQuery:HI(n),fetchNextCursor:GI(n),fetchCount:WI(e),fetchItem:KI(n),fetchItems:QI(n),createItem:XI(n),deleteItem:YI(n),updateItem:JI(n),subscribeToItem:ZI(n)}),tw=n=>({delete:async e=>{await xI(ir(n,e))},fetchObject:async e=>{let t=ir(n,e);return await FI(t)},fetchMetadata:async e=>{let t=ir(n,e);return await OI(t)},getObjectUrl:async e=>{let t=ir(n,e);return await LI(t)},upload:async(e,t,r)=>{let s=ir(n,e),i=VI(s,new Blob([t.dataUrl]));i.on("state_changed",c=>{let l=c.bytesTransferred/c.totalBytes*100;r({loaded:c.bytesTransferred,total:c.totalBytes,percent:l})});let a={filename:t.filename,type:t.type,storagePath:e};return await i.then(),a}}),ow=(n,e,t,r)=>({auth:$I(n),db:ew(e,r),storage:tw(t)}),gf=nt.createContext({app:null,auth:null,db:null,storage:null,functions:null,authProviders:[],signOut:()=>{}}),aw=({children:n,app:e,authProviders:t})=>{let[r]=nt.useState(cy(e)),[s]=nt.useState(sv(e)),[i]=nt.useState(MI(e)),[a]=nt.useState(Gm(e));nt.useEffect(()=>Xl(r,d=>{if(!d){Gt.setState({user:null,loading:!1});return}Gt.setState({loading:!0}),Vl(d).then(f=>{Gt.setState({user:{...d,role:f.claims.admin?"admin":"user"},loading:!1})})}),[r]);let c=nt.useCallback(async()=>{Gt.setState({loading:!0});try{await r.signOut(),Gt.setState({user:null,loading:!1})}catch(d){console.error(d)}finally{Gt.setState({loading:!1})}},[r]),l=nt.useMemo(()=>({app:e,auth:r,authProviders:t,db:s,storage:i,signOut:c,functions:a}),[e,r,s,i,a,c,t]);return tp.jsx(gf.Provider,{value:l,children:n})},cw=()=>nt.useContext(gf),uw=()=>Zf();export{uw as G,aw as O,cw as S,ow as a,MI as b,sv as c,cy as d,Gm as g,Km as h,gm as i,qe as r};