@isardsat/editorial-admin 6.1.1 → 6.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/build/client/assets/{authSlice-C1VgtCUs.js → authSlice-BWVz4jZT.js} +154 -154
  2. package/build/client/assets/button-DjJX-cbR.js +1 -0
  3. package/build/client/assets/{chevron-down-DTegokyb.js → chevron-down-CYVLN3e-.js} +1 -1
  4. package/build/client/assets/chunk-EF7DTUVF-CZaHNoTs.js +51 -0
  5. package/build/client/assets/{createLucideIcon-CEJSFbyG.js → createLucideIcon-BOhrmKcl.js} +1 -1
  6. package/build/client/assets/dashboard-uK1JUDJC.js +1 -0
  7. package/build/client/assets/{dashboard._collection-BInenL6o.js → dashboard._collection-BNdxRLEC.js} +2 -2
  8. package/build/client/assets/dashboard._collection._document-CZS2Adz-.js +1 -0
  9. package/build/client/assets/dashboard._collection.new-BEBBwujj.js +1 -0
  10. package/build/client/assets/{dashboard._layout-BcFSiUec.js → dashboard._layout-Ce0XSLxb.js} +2 -2
  11. package/build/client/assets/{dashboard.files-DKvKXV6U.js → dashboard.files-D1ph0y7T.js} +4 -4
  12. package/build/client/assets/editorialApi-sCf3FFWc.js +9 -0
  13. package/build/client/assets/entry.client-DxhHtLqO.js +29 -0
  14. package/build/client/assets/{home-C_M0Cqq5.js → home-D_H1PlMw.js} +1 -1
  15. package/build/client/assets/{index-C4BMMXbp.js → index-B0NebLYn.js} +1 -1
  16. package/build/client/assets/{index-CvFp8wi_.js → index-BnyqKVWo.js} +1 -1
  17. package/build/client/assets/{index-ofqdEjlP.js → index-CQvFoK7s.js} +1 -1
  18. package/build/client/assets/{index-DWY8ISpx.js → index-b1VEd5BJ.js} +1 -1
  19. package/build/client/assets/{input-BScD3Ruq.js → input-DA43W1bc.js} +1 -1
  20. package/build/client/assets/{itemForm-BCRilPzX.js → itemForm-DTE9G8eu.js} +1 -1
  21. package/build/client/assets/manifest-62c94c94.js +1 -0
  22. package/build/client/assets/root-5pkwWV_K.js +1 -0
  23. package/build/client/assets/{root-DGV68qoS.css → root-DdgoqUZJ.css} +1 -1
  24. package/build/client/assets/{trash-DN4yNrfZ.js → trash-CYTPibS3.js} +1 -1
  25. package/build/client/index.html +3 -10
  26. package/package.json +5 -3
  27. package/build/client/assets/button-D7P-1kQx.js +0 -1
  28. package/build/client/assets/chunk-QMGIS6GS-BoPxQm7X.js +0 -51
  29. package/build/client/assets/dashboard-z6MevYdb.js +0 -1
  30. package/build/client/assets/dashboard._collection._document-CThHIpx7.js +0 -1
  31. package/build/client/assets/dashboard._collection.new-I4A2SBlr.js +0 -1
  32. package/build/client/assets/editorialApi-Dg2JizYW.js +0 -1
  33. package/build/client/assets/entry.client-B2XAvOmi.js +0 -34
  34. package/build/client/assets/manifest-94cf7c47.js +0 -1
  35. package/build/client/assets/react-redux-CRJHAKt_.js +0 -9
  36. package/build/client/assets/root-CJsg41xt.js +0 -1
@@ -1,4 +1,4 @@
1
- import{a as vi}from"./tslib.es6-De9GV7Vy.js";import{u as Wa,a as Ba,b as Ha,d as Va,e as $a}from"./react-redux-CRJHAKt_.js";/**
1
+ import{a as vi}from"./tslib.es6-De9GV7Vy.js";import{r as Wa,t as Ba,v as Ha,w as Va,e as $a,x as Ga}from"./editorialApi-sCf3FFWc.js";/**
2
2
  * @license
3
3
  * Copyright 2025 Google LLC
4
4
  *
@@ -13,7 +13,7 @@ import{a as vi}from"./tslib.es6-De9GV7Vy.js";import{u as Wa,a as Ba,b as Ha,d as
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 Ga=()=>{};var us={};/**
16
+ */const ja=()=>{};var us={};/**
17
17
  * @license
18
18
  * Copyright 2017 Google LLC
19
19
  *
@@ -58,7 +58,7 @@ import{a as vi}from"./tslib.es6-De9GV7Vy.js";import{u as Wa,a as Ba,b as Ha,d as
58
58
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
59
59
  * See the License for the specific language governing permissions and
60
60
  * limitations under the License.
61
- */const Cr=function(n){const e=[];let t=0;for(let i=0;i<n.length;i++){let s=n.charCodeAt(i);s<128?e[t++]=s:s<2048?(e[t++]=s>>6|192,e[t++]=s&63|128):(s&64512)===55296&&i+1<n.length&&(n.charCodeAt(i+1)&64512)===56320?(s=65536+((s&1023)<<10)+(n.charCodeAt(++i)&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},ja=function(n){const e=[];let t=0,i=0;for(;t<n.length;){const s=n[t++];if(s<128)e[i++]=String.fromCharCode(s);else if(s>191&&s<224){const r=n[t++];e[i++]=String.fromCharCode((s&31)<<6|r&63)}else if(s>239&&s<365){const r=n[t++],o=n[t++],a=n[t++],l=((s&7)<<18|(r&63)<<12|(o&63)<<6|a&63)-65536;e[i++]=String.fromCharCode(55296+(l>>10)),e[i++]=String.fromCharCode(56320+(l&1023))}else{const r=n[t++],o=n[t++];e[i++]=String.fromCharCode((s&15)<<12|(r&63)<<6|o&63)}}return e.join("")},yi={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_,i=[];for(let s=0;s<n.length;s+=3){const r=n[s],o=s+1<n.length,a=o?n[s+1]:0,l=s+2<n.length,c=l?n[s+2]:0,d=r>>2,h=(r&3)<<4|a>>4;let u=(a&15)<<2|c>>6,p=c&63;l||(p=64,o||(u=64)),i.push(t[d],t[h],t[u],t[p])}return i.join("")},encodeString(n,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(n):this.encodeByteArray(Cr(n),e)},decodeString(n,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(n):ja(this.decodeStringToByteArray(n,e))},decodeStringToByteArray(n,e){this.init_();const t=e?this.charToByteMapWebSafe_:this.charToByteMap_,i=[];for(let s=0;s<n.length;){const r=t[n.charAt(s++)],a=s<n.length?t[n.charAt(s)]:0;++s;const c=s<n.length?t[n.charAt(s)]:64;++s;const h=s<n.length?t[n.charAt(s)]:64;if(++s,r==null||a==null||c==null||h==null)throw new za;const u=r<<2|a>>4;if(i.push(u),c!==64){const p=a<<4&240|c>>2;if(i.push(p),h!==64){const _=c<<6&192|h;i.push(_)}}}return i},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 za extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const wr=function(n){const e=Cr(n);return yi.encodeByteArray(e,!0)},Jt=function(n){return wr(n).replace(/\./g,"")},Xt=function(n){try{return yi.decodeString(n,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};/**
61
+ */const Cr=function(n){const e=[];let t=0;for(let i=0;i<n.length;i++){let s=n.charCodeAt(i);s<128?e[t++]=s:s<2048?(e[t++]=s>>6|192,e[t++]=s&63|128):(s&64512)===55296&&i+1<n.length&&(n.charCodeAt(i+1)&64512)===56320?(s=65536+((s&1023)<<10)+(n.charCodeAt(++i)&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},za=function(n){const e=[];let t=0,i=0;for(;t<n.length;){const s=n[t++];if(s<128)e[i++]=String.fromCharCode(s);else if(s>191&&s<224){const r=n[t++];e[i++]=String.fromCharCode((s&31)<<6|r&63)}else if(s>239&&s<365){const r=n[t++],o=n[t++],a=n[t++],l=((s&7)<<18|(r&63)<<12|(o&63)<<6|a&63)-65536;e[i++]=String.fromCharCode(55296+(l>>10)),e[i++]=String.fromCharCode(56320+(l&1023))}else{const r=n[t++],o=n[t++];e[i++]=String.fromCharCode((s&15)<<12|(r&63)<<6|o&63)}}return e.join("")},yi={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_,i=[];for(let s=0;s<n.length;s+=3){const r=n[s],o=s+1<n.length,a=o?n[s+1]:0,l=s+2<n.length,c=l?n[s+2]:0,d=r>>2,h=(r&3)<<4|a>>4;let u=(a&15)<<2|c>>6,p=c&63;l||(p=64,o||(u=64)),i.push(t[d],t[h],t[u],t[p])}return i.join("")},encodeString(n,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(n):this.encodeByteArray(Cr(n),e)},decodeString(n,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(n):za(this.decodeStringToByteArray(n,e))},decodeStringToByteArray(n,e){this.init_();const t=e?this.charToByteMapWebSafe_:this.charToByteMap_,i=[];for(let s=0;s<n.length;){const r=t[n.charAt(s++)],a=s<n.length?t[n.charAt(s)]:0;++s;const c=s<n.length?t[n.charAt(s)]:64;++s;const h=s<n.length?t[n.charAt(s)]:64;if(++s,r==null||a==null||c==null||h==null)throw new qa;const u=r<<2|a>>4;if(i.push(u),c!==64){const p=a<<4&240|c>>2;if(i.push(p),h!==64){const _=c<<6&192|h;i.push(_)}}}return i},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 qa extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const wr=function(n){const e=Cr(n);return yi.encodeByteArray(e,!0)},Jt=function(n){return wr(n).replace(/\./g,"")},Xt=function(n){try{return yi.decodeString(n,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};/**
62
62
  * @license
63
63
  * Copyright 2017 Google LLC
64
64
  *
@@ -73,7 +73,7 @@ import{a as vi}from"./tslib.es6-De9GV7Vy.js";import{u as Wa,a as Ba,b as Ha,d as
73
73
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
74
74
  * See the License for the specific language governing permissions and
75
75
  * limitations under the License.
76
- */function qa(n){return Tr(void 0,n)}function Tr(n,e){if(!(e instanceof Object))return e;switch(e.constructor){case Date:const t=e;return new Date(t.getTime());case Object:n===void 0&&(n={});break;case Array:n=[];break;default:return e}for(const t in e)!e.hasOwnProperty(t)||!Ka(t)||(n[t]=Tr(n[t],e[t]));return n}function Ka(n){return n!=="__proto__"}/**
76
+ */function Ka(n){return Tr(void 0,n)}function Tr(n,e){if(!(e instanceof Object))return e;switch(e.constructor){case Date:const t=e;return new Date(t.getTime());case Object:n===void 0&&(n={});break;case Array:n=[];break;default:return e}for(const t in e)!e.hasOwnProperty(t)||!Ya(t)||(n[t]=Tr(n[t],e[t]));return n}function Ya(n){return n!=="__proto__"}/**
77
77
  * @license
78
78
  * Copyright 2022 Google LLC
79
79
  *
@@ -88,7 +88,7 @@ import{a as vi}from"./tslib.es6-De9GV7Vy.js";import{u as Wa,a as Ba,b as Ha,d as
88
88
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
89
89
  * See the License for the specific language governing permissions and
90
90
  * limitations under the License.
91
- */function Ya(){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.")}/**
91
+ */function Qa(){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.")}/**
92
92
  * @license
93
93
  * Copyright 2022 Google LLC
94
94
  *
@@ -103,7 +103,7 @@ import{a as vi}from"./tslib.es6-De9GV7Vy.js";import{u as Wa,a as Ba,b as Ha,d as
103
103
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
104
104
  * See the License for the specific language governing permissions and
105
105
  * limitations under the License.
106
- */const Qa=()=>Ya().__FIREBASE_DEFAULTS__,Ja=()=>{if(typeof process>"u"||typeof us>"u")return;const n=us.__FIREBASE_DEFAULTS__;if(n)return JSON.parse(n)},Xa=()=>{if(typeof document>"u")return;let n;try{n=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch{return}const e=n&&Xt(n[1]);return e&&JSON.parse(e)},Ei=()=>{try{return Ga()||Qa()||Ja()||Xa()}catch(n){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${n}`);return}},Sr=n=>{var e,t;return(t=(e=Ei())===null||e===void 0?void 0:e.emulatorHosts)===null||t===void 0?void 0:t[n]},Za=n=>{const e=Sr(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 i=parseInt(e.substring(t+1),10);return e[0]==="["?[e.substring(1,t-1),i]:[e.substring(0,t),i]},br=()=>{var n;return(n=Ei())===null||n===void 0?void 0:n.config},Rr=n=>{var e;return(e=Ei())===null||e===void 0?void 0:e[`_${n}`]};/**
106
+ */const Ja=()=>Qa().__FIREBASE_DEFAULTS__,Xa=()=>{if(typeof process>"u"||typeof us>"u")return;const n=us.__FIREBASE_DEFAULTS__;if(n)return JSON.parse(n)},Za=()=>{if(typeof document>"u")return;let n;try{n=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch{return}const e=n&&Xt(n[1]);return e&&JSON.parse(e)},Ei=()=>{try{return ja()||Ja()||Xa()||Za()}catch(n){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${n}`);return}},Sr=n=>{var e,t;return(t=(e=Ei())===null||e===void 0?void 0:e.emulatorHosts)===null||t===void 0?void 0:t[n]},el=n=>{const e=Sr(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 i=parseInt(e.substring(t+1),10);return e[0]==="["?[e.substring(1,t-1),i]:[e.substring(0,t),i]},br=()=>{var n;return(n=Ei())===null||n===void 0?void 0:n.config},Rr=n=>{var e;return(e=Ei())===null||e===void 0?void 0:e[`_${n}`]};/**
107
107
  * @license
108
108
  * Copyright 2017 Google LLC
109
109
  *
@@ -133,7 +133,7 @@ import{a as vi}from"./tslib.es6-De9GV7Vy.js";import{u as Wa,a as Ba,b as Ha,d as
133
133
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
134
134
  * See the License for the specific language governing permissions and
135
135
  * limitations under the License.
136
- */function et(n){try{return(n.startsWith("http://")||n.startsWith("https://")?new URL(n).hostname:n).endsWith(".cloudworkstations.dev")}catch{return!1}}async function Ar(n){return(await fetch(n,{credentials:"include"})).ok}/**
136
+ */function et(n){try{return(n.startsWith("http://")||n.startsWith("https://")?new URL(n).hostname:n).endsWith(".cloudworkstations.dev")}catch{return!1}}async function kr(n){return(await fetch(n,{credentials:"include"})).ok}/**
137
137
  * @license
138
138
  * Copyright 2021 Google LLC
139
139
  *
@@ -148,7 +148,7 @@ import{a as vi}from"./tslib.es6-De9GV7Vy.js";import{u as Wa,a as Ba,b as Ha,d as
148
148
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
149
149
  * See the License for the specific language governing permissions and
150
150
  * limitations under the License.
151
- */function el(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"},i=e||"demo-project",s=n.iat||0,r=n.sub||n.user_id;if(!r)throw new Error("mockUserToken must contain 'sub' or 'user_id' field!");const o=Object.assign({iss:`https://securetoken.google.com/${i}`,aud:i,iat:s,exp:s+3600,auth_time:s,sub:r,user_id:r,firebase:{sign_in_provider:"custom",identities:{}}},n);return[Jt(JSON.stringify(t)),Jt(JSON.stringify(o)),""].join(".")}const ft={};function tl(){const n={prod:[],emulator:[]};for(const e of Object.keys(ft))ft[e]?n.emulator.push(e):n.prod.push(e);return n}function nl(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 ds=!1;function kr(n,e){if(typeof window>"u"||typeof document>"u"||!et(window.location.host)||ft[n]===e||ft[n]||ds)return;ft[n]=e;function t(u){return`__firebase__banner__${u}`}const i="__firebase__banner",r=tl().prod.length>0;function o(){const u=document.getElementById(i);u&&u.remove()}function a(u){u.style.display="flex",u.style.background="#7faaf0",u.style.position="fixed",u.style.bottom="5px",u.style.left="5px",u.style.padding=".5em",u.style.borderRadius="5px",u.style.alignItems="center"}function l(u,p){u.setAttribute("width","24"),u.setAttribute("id",p),u.setAttribute("height","24"),u.setAttribute("viewBox","0 0 24 24"),u.setAttribute("fill","none"),u.style.marginLeft="-6px"}function c(){const u=document.createElement("span");return u.style.cursor="pointer",u.style.marginLeft="16px",u.style.fontSize="24px",u.innerHTML=" &times;",u.onclick=()=>{ds=!0,o()},u}function d(u,p){u.setAttribute("id",p),u.innerText="Learn more",u.href="https://firebase.google.com/docs/studio/preview-apps#preview-backend",u.setAttribute("target","__blank"),u.style.paddingLeft="5px",u.style.textDecoration="underline"}function h(){const u=nl(i),p=t("text"),_=document.getElementById(p)||document.createElement("span"),C=t("learnmore"),R=document.getElementById(C)||document.createElement("a"),H=t("preprendIcon"),V=document.getElementById(H)||document.createElementNS("http://www.w3.org/2000/svg","svg");if(u.created){const $=u.element;a($),d(R,C);const Fe=c();l(V,H),$.append(V,_,R,Fe),document.body.appendChild($)}r?(_.innerText="Preview backend disconnected.",V.innerHTML=`<g clip-path="url(#clip0_6013_33858)">
151
+ */function tl(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"},i=e||"demo-project",s=n.iat||0,r=n.sub||n.user_id;if(!r)throw new Error("mockUserToken must contain 'sub' or 'user_id' field!");const o=Object.assign({iss:`https://securetoken.google.com/${i}`,aud:i,iat:s,exp:s+3600,auth_time:s,sub:r,user_id:r,firebase:{sign_in_provider:"custom",identities:{}}},n);return[Jt(JSON.stringify(t)),Jt(JSON.stringify(o)),""].join(".")}const ft={};function nl(){const n={prod:[],emulator:[]};for(const e of Object.keys(ft))ft[e]?n.emulator.push(e):n.prod.push(e);return n}function il(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 ds=!1;function Ar(n,e){if(typeof window>"u"||typeof document>"u"||!et(window.location.host)||ft[n]===e||ft[n]||ds)return;ft[n]=e;function t(u){return`__firebase__banner__${u}`}const i="__firebase__banner",r=nl().prod.length>0;function o(){const u=document.getElementById(i);u&&u.remove()}function a(u){u.style.display="flex",u.style.background="#7faaf0",u.style.position="fixed",u.style.bottom="5px",u.style.left="5px",u.style.padding=".5em",u.style.borderRadius="5px",u.style.alignItems="center"}function l(u,p){u.setAttribute("width","24"),u.setAttribute("id",p),u.setAttribute("height","24"),u.setAttribute("viewBox","0 0 24 24"),u.setAttribute("fill","none"),u.style.marginLeft="-6px"}function c(){const u=document.createElement("span");return u.style.cursor="pointer",u.style.marginLeft="16px",u.style.fontSize="24px",u.innerHTML=" &times;",u.onclick=()=>{ds=!0,o()},u}function d(u,p){u.setAttribute("id",p),u.innerText="Learn more",u.href="https://firebase.google.com/docs/studio/preview-apps#preview-backend",u.setAttribute("target","__blank"),u.style.paddingLeft="5px",u.style.textDecoration="underline"}function h(){const u=il(i),p=t("text"),_=document.getElementById(p)||document.createElement("span"),C=t("learnmore"),R=document.getElementById(C)||document.createElement("a"),H=t("preprendIcon"),V=document.getElementById(H)||document.createElementNS("http://www.w3.org/2000/svg","svg");if(u.created){const $=u.element;a($),d(R,C);const xe=c();l(V,H),$.append(V,_,R,xe),document.body.appendChild($)}r?(_.innerText="Preview backend disconnected.",V.innerHTML=`<g clip-path="url(#clip0_6013_33858)">
152
152
  <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"/>
153
153
  </g>
154
154
  <defs>
@@ -177,7 +177,7 @@ import{a as vi}from"./tslib.es6-De9GV7Vy.js";import{u as Wa,a as Ba,b as Ha,d as
177
177
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
178
178
  * See the License for the specific language governing permissions and
179
179
  * limitations under the License.
180
- */function x(){return typeof navigator<"u"&&typeof navigator.userAgent=="string"?navigator.userAgent:""}function Ci(){return typeof window<"u"&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(x())}function il(){return typeof navigator<"u"&&navigator.userAgent==="Cloudflare-Workers"}function sl(){const n=typeof chrome=="object"?chrome.runtime:typeof browser=="object"?browser.runtime:void 0;return typeof n=="object"&&n.id!==void 0}function Nr(){return typeof navigator=="object"&&navigator.product==="ReactNative"}function rl(){const n=x();return n.indexOf("MSIE ")>=0||n.indexOf("Trident/")>=0}function ol(){return Ir.NODE_ADMIN===!0}function al(){try{return typeof indexedDB=="object"}catch{return!1}}function ll(){return new Promise((n,e)=>{try{let t=!0;const i="validate-browser-context-for-indexeddb-analytics-module",s=self.indexedDB.open(i);s.onsuccess=()=>{s.result.close(),t||self.indexedDB.deleteDatabase(i),n(!0)},s.onupgradeneeded=()=>{t=!1},s.onerror=()=>{var r;e(((r=s.error)===null||r===void 0?void 0:r.message)||"")}}catch(t){e(t)}})}/**
180
+ */function x(){return typeof navigator<"u"&&typeof navigator.userAgent=="string"?navigator.userAgent:""}function Ci(){return typeof window<"u"&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(x())}function sl(){return typeof navigator<"u"&&navigator.userAgent==="Cloudflare-Workers"}function rl(){const n=typeof chrome=="object"?chrome.runtime:typeof browser=="object"?browser.runtime:void 0;return typeof n=="object"&&n.id!==void 0}function Nr(){return typeof navigator=="object"&&navigator.product==="ReactNative"}function ol(){const n=x();return n.indexOf("MSIE ")>=0||n.indexOf("Trident/")>=0}function al(){return Ir.NODE_ADMIN===!0}function ll(){try{return typeof indexedDB=="object"}catch{return!1}}function cl(){return new Promise((n,e)=>{try{let t=!0;const i="validate-browser-context-for-indexeddb-analytics-module",s=self.indexedDB.open(i);s.onsuccess=()=>{s.result.close(),t||self.indexedDB.deleteDatabase(i),n(!0)},s.onupgradeneeded=()=>{t=!1},s.onerror=()=>{var r;e(((r=s.error)===null||r===void 0?void 0:r.message)||"")}}catch(t){e(t)}})}/**
181
181
  * @license
182
182
  * Copyright 2017 Google LLC
183
183
  *
@@ -192,7 +192,7 @@ import{a as vi}from"./tslib.es6-De9GV7Vy.js";import{u as Wa,a as Ba,b as Ha,d as
192
192
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
193
193
  * See the License for the specific language governing permissions and
194
194
  * limitations under the License.
195
- */const cl="FirebaseError";class Ce extends Error{constructor(e,t,i){super(t),this.code=e,this.customData=i,this.name=cl,Object.setPrototypeOf(this,Ce.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,Ot.prototype.create)}}class Ot{constructor(e,t,i){this.service=e,this.serviceName=t,this.errors=i}create(e,...t){const i=t[0]||{},s=`${this.service}/${e}`,r=this.errors[e],o=r?hl(r,i):"Error",a=`${this.serviceName}: ${o} (${s}).`;return new Ce(s,a,i)}}function hl(n,e){return n.replace(ul,(t,i)=>{const s=e[i];return s!=null?String(s):`<${i}?>`})}const ul=/\{\$([^}]+)}/g;/**
195
+ */const hl="FirebaseError";class Ce extends Error{constructor(e,t,i){super(t),this.code=e,this.customData=i,this.name=hl,Object.setPrototypeOf(this,Ce.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,Ot.prototype.create)}}class Ot{constructor(e,t,i){this.service=e,this.serviceName=t,this.errors=i}create(e,...t){const i=t[0]||{},s=`${this.service}/${e}`,r=this.errors[e],o=r?ul(r,i):"Error",a=`${this.serviceName}: ${o} (${s}).`;return new Ce(s,a,i)}}function ul(n,e){return n.replace(dl,(t,i)=>{const s=e[i];return s!=null?String(s):`<${i}?>`})}const dl=/\{\$([^}]+)}/g;/**
196
196
  * @license
197
197
  * Copyright 2017 Google LLC
198
198
  *
@@ -207,7 +207,7 @@ import{a as vi}from"./tslib.es6-De9GV7Vy.js";import{u as Wa,a as Ba,b as Ha,d as
207
207
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
208
208
  * See the License for the specific language governing permissions and
209
209
  * limitations under the License.
210
- */function Et(n){return JSON.parse(n)}function k(n){return JSON.stringify(n)}/**
210
+ */function Et(n){return JSON.parse(n)}function A(n){return JSON.stringify(n)}/**
211
211
  * @license
212
212
  * Copyright 2017 Google LLC
213
213
  *
@@ -222,7 +222,7 @@ import{a as vi}from"./tslib.es6-De9GV7Vy.js";import{u as Wa,a as Ba,b as Ha,d as
222
222
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
223
223
  * See the License for the specific language governing permissions and
224
224
  * limitations under the License.
225
- */const Pr=function(n){let e={},t={},i={},s="";try{const r=n.split(".");e=Et(Xt(r[0])||""),t=Et(Xt(r[1])||""),s=r[2],i=t.d||{},delete t.d}catch{}return{header:e,claims:t,data:i,signature:s}},dl=function(n){const e=Pr(n),t=e.claims;return!!t&&typeof t=="object"&&t.hasOwnProperty("iat")},fl=function(n){const e=Pr(n).claims;return typeof e=="object"&&e.admin===!0};/**
225
+ */const Pr=function(n){let e={},t={},i={},s="";try{const r=n.split(".");e=Et(Xt(r[0])||""),t=Et(Xt(r[1])||""),s=r[2],i=t.d||{},delete t.d}catch{}return{header:e,claims:t,data:i,signature:s}},fl=function(n){const e=Pr(n),t=e.claims;return!!t&&typeof t=="object"&&t.hasOwnProperty("iat")},pl=function(n){const e=Pr(n).claims;return typeof e=="object"&&e.admin===!0};/**
226
226
  * @license
227
227
  * Copyright 2017 Google LLC
228
228
  *
@@ -267,7 +267,7 @@ import{a as vi}from"./tslib.es6-De9GV7Vy.js";import{u as Wa,a as Ba,b as Ha,d as
267
267
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
268
268
  * See the License for the specific language governing permissions and
269
269
  * limitations under the License.
270
- */class pl{constructor(){this.chain_=[],this.buf_=[],this.W_=[],this.pad_=[],this.inbuf_=0,this.total_=0,this.blockSize=512/8,this.pad_[0]=128;for(let e=1;e<this.blockSize;++e)this.pad_[e]=0;this.reset()}reset(){this.chain_[0]=1732584193,this.chain_[1]=4023233417,this.chain_[2]=2562383102,this.chain_[3]=271733878,this.chain_[4]=3285377520,this.inbuf_=0,this.total_=0}compress_(e,t){t||(t=0);const i=this.W_;if(typeof e=="string")for(let h=0;h<16;h++)i[h]=e.charCodeAt(t)<<24|e.charCodeAt(t+1)<<16|e.charCodeAt(t+2)<<8|e.charCodeAt(t+3),t+=4;else for(let h=0;h<16;h++)i[h]=e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3],t+=4;for(let h=16;h<80;h++){const u=i[h-3]^i[h-8]^i[h-14]^i[h-16];i[h]=(u<<1|u>>>31)&4294967295}let s=this.chain_[0],r=this.chain_[1],o=this.chain_[2],a=this.chain_[3],l=this.chain_[4],c,d;for(let h=0;h<80;h++){h<40?h<20?(c=a^r&(o^a),d=1518500249):(c=r^o^a,d=1859775393):h<60?(c=r&o|a&(r|o),d=2400959708):(c=r^o^a,d=3395469782);const u=(s<<5|s>>>27)+c+l+d+i[h]&4294967295;l=a,a=o,o=(r<<30|r>>>2)&4294967295,r=s,s=u}this.chain_[0]=this.chain_[0]+s&4294967295,this.chain_[1]=this.chain_[1]+r&4294967295,this.chain_[2]=this.chain_[2]+o&4294967295,this.chain_[3]=this.chain_[3]+a&4294967295,this.chain_[4]=this.chain_[4]+l&4294967295}update(e,t){if(e==null)return;t===void 0&&(t=e.length);const i=t-this.blockSize;let s=0;const r=this.buf_;let o=this.inbuf_;for(;s<t;){if(o===0)for(;s<=i;)this.compress_(e,s),s+=this.blockSize;if(typeof e=="string"){for(;s<t;)if(r[o]=e.charCodeAt(s),++o,++s,o===this.blockSize){this.compress_(r),o=0;break}}else for(;s<t;)if(r[o]=e[s],++o,++s,o===this.blockSize){this.compress_(r),o=0;break}}this.inbuf_=o,this.total_+=t}digest(){const e=[];let t=this.total_*8;this.inbuf_<56?this.update(this.pad_,56-this.inbuf_):this.update(this.pad_,this.blockSize-(this.inbuf_-56));for(let s=this.blockSize-1;s>=56;s--)this.buf_[s]=t&255,t/=256;this.compress_(this.buf_);let i=0;for(let s=0;s<5;s++)for(let r=24;r>=0;r-=8)e[i]=this.chain_[s]>>r&255,++i;return e}}function _l(n,e){const t=new gl(n,e);return t.subscribe.bind(t)}class gl{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(i=>{this.error(i)})}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,i){let s;if(e===void 0&&t===void 0&&i===void 0)throw new Error("Missing Observer.");ml(e,["next","error","complete"])?s=e:s={next:e,error:t,complete:i},s.next===void 0&&(s.next=Mn),s.error===void 0&&(s.error=Mn),s.complete===void 0&&(s.complete=Mn);const r=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(()=>{try{this.finalError?s.error(this.finalError):s.complete()}catch{}}),this.observers.push(s),r}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(i){typeof console<"u"&&console.error&&console.error(i)}})}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 ml(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 Mn(){}function Or(n,e){return`${n} failed: ${e} argument `}/**
270
+ */class _l{constructor(){this.chain_=[],this.buf_=[],this.W_=[],this.pad_=[],this.inbuf_=0,this.total_=0,this.blockSize=512/8,this.pad_[0]=128;for(let e=1;e<this.blockSize;++e)this.pad_[e]=0;this.reset()}reset(){this.chain_[0]=1732584193,this.chain_[1]=4023233417,this.chain_[2]=2562383102,this.chain_[3]=271733878,this.chain_[4]=3285377520,this.inbuf_=0,this.total_=0}compress_(e,t){t||(t=0);const i=this.W_;if(typeof e=="string")for(let h=0;h<16;h++)i[h]=e.charCodeAt(t)<<24|e.charCodeAt(t+1)<<16|e.charCodeAt(t+2)<<8|e.charCodeAt(t+3),t+=4;else for(let h=0;h<16;h++)i[h]=e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3],t+=4;for(let h=16;h<80;h++){const u=i[h-3]^i[h-8]^i[h-14]^i[h-16];i[h]=(u<<1|u>>>31)&4294967295}let s=this.chain_[0],r=this.chain_[1],o=this.chain_[2],a=this.chain_[3],l=this.chain_[4],c,d;for(let h=0;h<80;h++){h<40?h<20?(c=a^r&(o^a),d=1518500249):(c=r^o^a,d=1859775393):h<60?(c=r&o|a&(r|o),d=2400959708):(c=r^o^a,d=3395469782);const u=(s<<5|s>>>27)+c+l+d+i[h]&4294967295;l=a,a=o,o=(r<<30|r>>>2)&4294967295,r=s,s=u}this.chain_[0]=this.chain_[0]+s&4294967295,this.chain_[1]=this.chain_[1]+r&4294967295,this.chain_[2]=this.chain_[2]+o&4294967295,this.chain_[3]=this.chain_[3]+a&4294967295,this.chain_[4]=this.chain_[4]+l&4294967295}update(e,t){if(e==null)return;t===void 0&&(t=e.length);const i=t-this.blockSize;let s=0;const r=this.buf_;let o=this.inbuf_;for(;s<t;){if(o===0)for(;s<=i;)this.compress_(e,s),s+=this.blockSize;if(typeof e=="string"){for(;s<t;)if(r[o]=e.charCodeAt(s),++o,++s,o===this.blockSize){this.compress_(r),o=0;break}}else for(;s<t;)if(r[o]=e[s],++o,++s,o===this.blockSize){this.compress_(r),o=0;break}}this.inbuf_=o,this.total_+=t}digest(){const e=[];let t=this.total_*8;this.inbuf_<56?this.update(this.pad_,56-this.inbuf_):this.update(this.pad_,this.blockSize-(this.inbuf_-56));for(let s=this.blockSize-1;s>=56;s--)this.buf_[s]=t&255,t/=256;this.compress_(this.buf_);let i=0;for(let s=0;s<5;s++)for(let r=24;r>=0;r-=8)e[i]=this.chain_[s]>>r&255,++i;return e}}function gl(n,e){const t=new ml(n,e);return t.subscribe.bind(t)}class ml{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(i=>{this.error(i)})}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,i){let s;if(e===void 0&&t===void 0&&i===void 0)throw new Error("Missing Observer.");vl(e,["next","error","complete"])?s=e:s={next:e,error:t,complete:i},s.next===void 0&&(s.next=Mn),s.error===void 0&&(s.error=Mn),s.complete===void 0&&(s.complete=Mn);const r=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(()=>{try{this.finalError?s.error(this.finalError):s.complete()}catch{}}),this.observers.push(s),r}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(i){typeof console<"u"&&console.error&&console.error(i)}})}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 vl(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 Mn(){}function Or(n,e){return`${n} failed: ${e} argument `}/**
271
271
  * @license
272
272
  * Copyright 2017 Google LLC
273
273
  *
@@ -282,7 +282,7 @@ import{a as vi}from"./tslib.es6-De9GV7Vy.js";import{u as Wa,a as Ba,b as Ha,d as
282
282
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
283
283
  * See the License for the specific language governing permissions and
284
284
  * limitations under the License.
285
- */const vl=function(n){const e=[];let t=0;for(let i=0;i<n.length;i++){let s=n.charCodeAt(i);if(s>=55296&&s<=56319){const r=s-55296;i++,f(i<n.length,"Surrogate pair missing trail surrogate.");const o=n.charCodeAt(i)-56320;s=65536+(r<<10)+o}s<128?e[t++]=s:s<2048?(e[t++]=s>>6|192,e[t++]=s&63|128):s<65536?(e[t++]=s>>12|224,e[t++]=s>>6&63|128,e[t++]=s&63|128):(e[t++]=s>>18|240,e[t++]=s>>12&63|128,e[t++]=s>>6&63|128,e[t++]=s&63|128)}return e},En=function(n){let e=0;for(let t=0;t<n.length;t++){const i=n.charCodeAt(t);i<128?e++:i<2048?e+=2:i>=55296&&i<=56319?(e+=4,t++):e+=3}return e};/**
285
+ */const yl=function(n){const e=[];let t=0;for(let i=0;i<n.length;i++){let s=n.charCodeAt(i);if(s>=55296&&s<=56319){const r=s-55296;i++,f(i<n.length,"Surrogate pair missing trail surrogate.");const o=n.charCodeAt(i)-56320;s=65536+(r<<10)+o}s<128?e[t++]=s:s<2048?(e[t++]=s>>6|192,e[t++]=s&63|128):s<65536?(e[t++]=s>>12|224,e[t++]=s>>6&63|128,e[t++]=s&63|128):(e[t++]=s>>18|240,e[t++]=s>>12&63|128,e[t++]=s>>6&63|128,e[t++]=s&63|128)}return e},En=function(n){let e=0;for(let t=0;t<n.length;t++){const i=n.charCodeAt(t);i<128?e++:i<2048?e+=2:i>=55296&&i<=56319?(e+=4,t++):e+=3}return e};/**
286
286
  * @license
287
287
  * Copyright 2021 Google LLC
288
288
  *
@@ -297,7 +297,7 @@ import{a as vi}from"./tslib.es6-De9GV7Vy.js";import{u as Wa,a as Ba,b as Ha,d as
297
297
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
298
298
  * See the License for the specific language governing permissions and
299
299
  * limitations under the License.
300
- */function F(n){return n&&n._delegate?n._delegate:n}class Ne{constructor(e,t,i){this.name=e,this.instanceFactory=t,this.type=i,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(e){return this.instantiationMode=e,this}setMultipleInstances(e){return this.multipleInstances=e,this}setServiceProps(e){return this.serviceProps=e,this}setInstanceCreatedCallback(e){return this.onInstanceCreated=e,this}}/**
300
+ */function F(n){return n&&n._delegate?n._delegate:n}class Ae{constructor(e,t,i){this.name=e,this.instanceFactory=t,this.type=i,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(e){return this.instantiationMode=e,this}setMultipleInstances(e){return this.multipleInstances=e,this}setServiceProps(e){return this.serviceProps=e,this}setInstanceCreatedCallback(e){return this.onInstanceCreated=e,this}}/**
301
301
  * @license
302
302
  * Copyright 2019 Google LLC
303
303
  *
@@ -327,7 +327,7 @@ import{a as vi}from"./tslib.es6-De9GV7Vy.js";import{u as Wa,a as Ba,b as Ha,d as
327
327
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
328
328
  * See the License for the specific language governing permissions and
329
329
  * limitations under the License.
330
- */class yl{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 i=new Ii;if(this.instancesDeferred.set(t,i),this.isInitialized(t)||this.shouldAutoInitialize())try{const s=this.getOrInitializeService({instanceIdentifier:t});s&&i.resolve(s)}catch{}}return this.instancesDeferred.get(t).promise}getImmediate(e){var t;const i=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(i)||this.shouldAutoInitialize())try{return this.getOrInitializeService({instanceIdentifier:i})}catch(r){if(s)return null;throw r}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(Il(e))try{this.getOrInitializeService({instanceIdentifier:Se})}catch{}for(const[t,i]of this.instancesDeferred.entries()){const s=this.normalizeInstanceIdentifier(t);try{const r=this.getOrInitializeService({instanceIdentifier:s});i.resolve(r)}catch{}}}}clearInstance(e=Se){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=Se){return this.instances.has(e)}getOptions(e=Se){return this.instancesOptions.get(e)||{}}initialize(e={}){const{options:t={}}=e,i=this.normalizeInstanceIdentifier(e.instanceIdentifier);if(this.isInitialized(i))throw Error(`${this.name}(${i}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);const s=this.getOrInitializeService({instanceIdentifier:i,options:t});for(const[r,o]of this.instancesDeferred.entries()){const a=this.normalizeInstanceIdentifier(r);i===a&&o.resolve(s)}return s}onInit(e,t){var i;const s=this.normalizeInstanceIdentifier(t),r=(i=this.onInitCallbacks.get(s))!==null&&i!==void 0?i:new Set;r.add(e),this.onInitCallbacks.set(s,r);const o=this.instances.get(s);return o&&e(o,s),()=>{r.delete(e)}}invokeOnInitCallbacks(e,t){const i=this.onInitCallbacks.get(t);if(i)for(const s of i)try{s(e,t)}catch{}}getOrInitializeService({instanceIdentifier:e,options:t={}}){let i=this.instances.get(e);if(!i&&this.component&&(i=this.component.instanceFactory(this.container,{instanceIdentifier:El(e),options:t}),this.instances.set(e,i),this.instancesOptions.set(e,t),this.invokeOnInitCallbacks(i,e),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,e,i)}catch{}return i||null}normalizeInstanceIdentifier(e=Se){return this.component?this.component.multipleInstances?e:Se:e}shouldAutoInitialize(){return!!this.component&&this.component.instantiationMode!=="EXPLICIT"}}function El(n){return n===Se?void 0:n}function Il(n){return n.instantiationMode==="EAGER"}/**
330
+ */class El{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 i=new Ii;if(this.instancesDeferred.set(t,i),this.isInitialized(t)||this.shouldAutoInitialize())try{const s=this.getOrInitializeService({instanceIdentifier:t});s&&i.resolve(s)}catch{}}return this.instancesDeferred.get(t).promise}getImmediate(e){var t;const i=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(i)||this.shouldAutoInitialize())try{return this.getOrInitializeService({instanceIdentifier:i})}catch(r){if(s)return null;throw r}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(Cl(e))try{this.getOrInitializeService({instanceIdentifier:Se})}catch{}for(const[t,i]of this.instancesDeferred.entries()){const s=this.normalizeInstanceIdentifier(t);try{const r=this.getOrInitializeService({instanceIdentifier:s});i.resolve(r)}catch{}}}}clearInstance(e=Se){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=Se){return this.instances.has(e)}getOptions(e=Se){return this.instancesOptions.get(e)||{}}initialize(e={}){const{options:t={}}=e,i=this.normalizeInstanceIdentifier(e.instanceIdentifier);if(this.isInitialized(i))throw Error(`${this.name}(${i}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);const s=this.getOrInitializeService({instanceIdentifier:i,options:t});for(const[r,o]of this.instancesDeferred.entries()){const a=this.normalizeInstanceIdentifier(r);i===a&&o.resolve(s)}return s}onInit(e,t){var i;const s=this.normalizeInstanceIdentifier(t),r=(i=this.onInitCallbacks.get(s))!==null&&i!==void 0?i:new Set;r.add(e),this.onInitCallbacks.set(s,r);const o=this.instances.get(s);return o&&e(o,s),()=>{r.delete(e)}}invokeOnInitCallbacks(e,t){const i=this.onInitCallbacks.get(t);if(i)for(const s of i)try{s(e,t)}catch{}}getOrInitializeService({instanceIdentifier:e,options:t={}}){let i=this.instances.get(e);if(!i&&this.component&&(i=this.component.instanceFactory(this.container,{instanceIdentifier:Il(e),options:t}),this.instances.set(e,i),this.instancesOptions.set(e,t),this.invokeOnInitCallbacks(i,e),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,e,i)}catch{}return i||null}normalizeInstanceIdentifier(e=Se){return this.component?this.component.multipleInstances?e:Se:e}shouldAutoInitialize(){return!!this.component&&this.component.instantiationMode!=="EXPLICIT"}}function Il(n){return n===Se?void 0:n}function Cl(n){return n.instantiationMode==="EAGER"}/**
331
331
  * @license
332
332
  * Copyright 2019 Google LLC
333
333
  *
@@ -342,7 +342,7 @@ import{a as vi}from"./tslib.es6-De9GV7Vy.js";import{u as Wa,a as Ba,b as Ha,d as
342
342
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
343
343
  * See the License for the specific language governing permissions and
344
344
  * limitations under the License.
345
- */class Cl{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 yl(e,this);return this.providers.set(e,t),t}getProviders(){return Array.from(this.providers.values())}}/**
345
+ */class wl{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 El(e,this);return this.providers.set(e,t),t}getProviders(){return Array.from(this.providers.values())}}/**
346
346
  * @license
347
347
  * Copyright 2017 Google LLC
348
348
  *
@@ -357,7 +357,7 @@ import{a as vi}from"./tslib.es6-De9GV7Vy.js";import{u as Wa,a as Ba,b as Ha,d as
357
357
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
358
358
  * See the License for the specific language governing permissions and
359
359
  * limitations under the License.
360
- */var w;(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"})(w||(w={}));const wl={debug:w.DEBUG,verbose:w.VERBOSE,info:w.INFO,warn:w.WARN,error:w.ERROR,silent:w.SILENT},Tl=w.INFO,Sl={[w.DEBUG]:"log",[w.VERBOSE]:"log",[w.INFO]:"info",[w.WARN]:"warn",[w.ERROR]:"error"},bl=(n,e,...t)=>{if(e<n.logLevel)return;const i=new Date().toISOString(),s=Sl[e];if(s)console[s](`[${i}] ${n.name}:`,...t);else throw new Error(`Attempted to log a message with an invalid logType (value: ${e})`)};class wi{constructor(e){this.name=e,this._logLevel=Tl,this._logHandler=bl,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in w))throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel=typeof e=="string"?wl[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,w.DEBUG,...e),this._logHandler(this,w.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,w.VERBOSE,...e),this._logHandler(this,w.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,w.INFO,...e),this._logHandler(this,w.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,w.WARN,...e),this._logHandler(this,w.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,w.ERROR,...e),this._logHandler(this,w.ERROR,...e)}}const Rl=(n,e)=>e.some(t=>n instanceof t);let ps,_s;function Al(){return ps||(ps=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function kl(){return _s||(_s=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const Dr=new WeakMap,Jn=new WeakMap,Mr=new WeakMap,Ln=new WeakMap,Ti=new WeakMap;function Nl(n){const e=new Promise((t,i)=>{const s=()=>{n.removeEventListener("success",r),n.removeEventListener("error",o)},r=()=>{t(fe(n.result)),s()},o=()=>{i(n.error),s()};n.addEventListener("success",r),n.addEventListener("error",o)});return e.then(t=>{t instanceof IDBCursor&&Dr.set(t,n)}).catch(()=>{}),Ti.set(e,n),e}function Pl(n){if(Jn.has(n))return;const e=new Promise((t,i)=>{const s=()=>{n.removeEventListener("complete",r),n.removeEventListener("error",o),n.removeEventListener("abort",o)},r=()=>{t(),s()},o=()=>{i(n.error||new DOMException("AbortError","AbortError")),s()};n.addEventListener("complete",r),n.addEventListener("error",o),n.addEventListener("abort",o)});Jn.set(n,e)}let Xn={get(n,e,t){if(n instanceof IDBTransaction){if(e==="done")return Jn.get(n);if(e==="objectStoreNames")return n.objectStoreNames||Mr.get(n);if(e==="store")return t.objectStoreNames[1]?void 0:t.objectStore(t.objectStoreNames[0])}return fe(n[e])},set(n,e,t){return n[e]=t,!0},has(n,e){return n instanceof IDBTransaction&&(e==="done"||e==="store")?!0:e in n}};function Ol(n){Xn=n(Xn)}function Dl(n){return n===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(e,...t){const i=n.call(xn(this),e,...t);return Mr.set(i,e.sort?e.sort():[e]),fe(i)}:kl().includes(n)?function(...e){return n.apply(xn(this),e),fe(Dr.get(this))}:function(...e){return fe(n.apply(xn(this),e))}}function Ml(n){return typeof n=="function"?Dl(n):(n instanceof IDBTransaction&&Pl(n),Rl(n,Al())?new Proxy(n,Xn):n)}function fe(n){if(n instanceof IDBRequest)return Nl(n);if(Ln.has(n))return Ln.get(n);const e=Ml(n);return e!==n&&(Ln.set(n,e),Ti.set(e,n)),e}const xn=n=>Ti.get(n);function Ll(n,e,{blocked:t,upgrade:i,blocking:s,terminated:r}={}){const o=indexedDB.open(n,e),a=fe(o);return i&&o.addEventListener("upgradeneeded",l=>{i(fe(o.result),l.oldVersion,l.newVersion,fe(o.transaction),l)}),t&&o.addEventListener("blocked",l=>t(l.oldVersion,l.newVersion,l)),a.then(l=>{r&&l.addEventListener("close",()=>r()),s&&l.addEventListener("versionchange",c=>s(c.oldVersion,c.newVersion,c))}).catch(()=>{}),a}const xl=["get","getKey","getAll","getAllKeys","count"],Fl=["put","add","delete","clear"],Fn=new Map;function gs(n,e){if(!(n instanceof IDBDatabase&&!(e in n)&&typeof e=="string"))return;if(Fn.get(e))return Fn.get(e);const t=e.replace(/FromIndex$/,""),i=e!==t,s=Fl.includes(t);if(!(t in(i?IDBIndex:IDBObjectStore).prototype)||!(s||xl.includes(t)))return;const r=async function(o,...a){const l=this.transaction(o,s?"readwrite":"readonly");let c=l.store;return i&&(c=c.index(a.shift())),(await Promise.all([c[t](...a),s&&l.done]))[0]};return Fn.set(e,r),r}Ol(n=>({...n,get:(e,t,i)=>gs(e,t)||n.get(e,t,i),has:(e,t)=>!!gs(e,t)||n.has(e,t)}));/**
360
+ */var w;(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"})(w||(w={}));const Tl={debug:w.DEBUG,verbose:w.VERBOSE,info:w.INFO,warn:w.WARN,error:w.ERROR,silent:w.SILENT},Sl=w.INFO,bl={[w.DEBUG]:"log",[w.VERBOSE]:"log",[w.INFO]:"info",[w.WARN]:"warn",[w.ERROR]:"error"},Rl=(n,e,...t)=>{if(e<n.logLevel)return;const i=new Date().toISOString(),s=bl[e];if(s)console[s](`[${i}] ${n.name}:`,...t);else throw new Error(`Attempted to log a message with an invalid logType (value: ${e})`)};class wi{constructor(e){this.name=e,this._logLevel=Sl,this._logHandler=Rl,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in w))throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel=typeof e=="string"?Tl[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,w.DEBUG,...e),this._logHandler(this,w.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,w.VERBOSE,...e),this._logHandler(this,w.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,w.INFO,...e),this._logHandler(this,w.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,w.WARN,...e),this._logHandler(this,w.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,w.ERROR,...e),this._logHandler(this,w.ERROR,...e)}}const kl=(n,e)=>e.some(t=>n instanceof t);let ps,_s;function Al(){return ps||(ps=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function Nl(){return _s||(_s=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const Dr=new WeakMap,Jn=new WeakMap,Mr=new WeakMap,Ln=new WeakMap,Ti=new WeakMap;function Pl(n){const e=new Promise((t,i)=>{const s=()=>{n.removeEventListener("success",r),n.removeEventListener("error",o)},r=()=>{t(fe(n.result)),s()},o=()=>{i(n.error),s()};n.addEventListener("success",r),n.addEventListener("error",o)});return e.then(t=>{t instanceof IDBCursor&&Dr.set(t,n)}).catch(()=>{}),Ti.set(e,n),e}function Ol(n){if(Jn.has(n))return;const e=new Promise((t,i)=>{const s=()=>{n.removeEventListener("complete",r),n.removeEventListener("error",o),n.removeEventListener("abort",o)},r=()=>{t(),s()},o=()=>{i(n.error||new DOMException("AbortError","AbortError")),s()};n.addEventListener("complete",r),n.addEventListener("error",o),n.addEventListener("abort",o)});Jn.set(n,e)}let Xn={get(n,e,t){if(n instanceof IDBTransaction){if(e==="done")return Jn.get(n);if(e==="objectStoreNames")return n.objectStoreNames||Mr.get(n);if(e==="store")return t.objectStoreNames[1]?void 0:t.objectStore(t.objectStoreNames[0])}return fe(n[e])},set(n,e,t){return n[e]=t,!0},has(n,e){return n instanceof IDBTransaction&&(e==="done"||e==="store")?!0:e in n}};function Dl(n){Xn=n(Xn)}function Ml(n){return n===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(e,...t){const i=n.call(xn(this),e,...t);return Mr.set(i,e.sort?e.sort():[e]),fe(i)}:Nl().includes(n)?function(...e){return n.apply(xn(this),e),fe(Dr.get(this))}:function(...e){return fe(n.apply(xn(this),e))}}function Ll(n){return typeof n=="function"?Ml(n):(n instanceof IDBTransaction&&Ol(n),kl(n,Al())?new Proxy(n,Xn):n)}function fe(n){if(n instanceof IDBRequest)return Pl(n);if(Ln.has(n))return Ln.get(n);const e=Ll(n);return e!==n&&(Ln.set(n,e),Ti.set(e,n)),e}const xn=n=>Ti.get(n);function xl(n,e,{blocked:t,upgrade:i,blocking:s,terminated:r}={}){const o=indexedDB.open(n,e),a=fe(o);return i&&o.addEventListener("upgradeneeded",l=>{i(fe(o.result),l.oldVersion,l.newVersion,fe(o.transaction),l)}),t&&o.addEventListener("blocked",l=>t(l.oldVersion,l.newVersion,l)),a.then(l=>{r&&l.addEventListener("close",()=>r()),s&&l.addEventListener("versionchange",c=>s(c.oldVersion,c.newVersion,c))}).catch(()=>{}),a}const Fl=["get","getKey","getAll","getAllKeys","count"],Ul=["put","add","delete","clear"],Fn=new Map;function gs(n,e){if(!(n instanceof IDBDatabase&&!(e in n)&&typeof e=="string"))return;if(Fn.get(e))return Fn.get(e);const t=e.replace(/FromIndex$/,""),i=e!==t,s=Ul.includes(t);if(!(t in(i?IDBIndex:IDBObjectStore).prototype)||!(s||Fl.includes(t)))return;const r=async function(o,...a){const l=this.transaction(o,s?"readwrite":"readonly");let c=l.store;return i&&(c=c.index(a.shift())),(await Promise.all([c[t](...a),s&&l.done]))[0]};return Fn.set(e,r),r}Dl(n=>({...n,get:(e,t,i)=>gs(e,t)||n.get(e,t,i),has:(e,t)=>!!gs(e,t)||n.has(e,t)}));/**
361
361
  * @license
362
362
  * Copyright 2019 Google LLC
363
363
  *
@@ -372,7 +372,7 @@ import{a as vi}from"./tslib.es6-De9GV7Vy.js";import{u as Wa,a as Ba,b as Ha,d as
372
372
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
373
373
  * See the License for the specific language governing permissions and
374
374
  * limitations under the License.
375
- */class Ul{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(t=>{if(Wl(t)){const i=t.getImmediate();return`${i.library}/${i.version}`}else return null}).filter(t=>t).join(" ")}}function Wl(n){const e=n.getComponent();return(e==null?void 0:e.type)==="VERSION"}const Zn="@firebase/app",ms="0.13.2";/**
375
+ */class Wl{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(t=>{if(Bl(t)){const i=t.getImmediate();return`${i.library}/${i.version}`}else return null}).filter(t=>t).join(" ")}}function Bl(n){const e=n.getComponent();return(e==null?void 0:e.type)==="VERSION"}const Zn="@firebase/app",ms="0.13.2";/**
376
376
  * @license
377
377
  * Copyright 2019 Google LLC
378
378
  *
@@ -387,7 +387,7 @@ import{a as vi}from"./tslib.es6-De9GV7Vy.js";import{u as Wa,a as Ba,b as Ha,d as
387
387
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
388
388
  * See the License for the specific language governing permissions and
389
389
  * limitations under the License.
390
- */const ie=new wi("@firebase/app"),Bl="@firebase/app-compat",Hl="@firebase/analytics-compat",Vl="@firebase/analytics",$l="@firebase/app-check-compat",Gl="@firebase/app-check",jl="@firebase/auth",zl="@firebase/auth-compat",ql="@firebase/database",Kl="@firebase/data-connect",Yl="@firebase/database-compat",Ql="@firebase/functions",Jl="@firebase/functions-compat",Xl="@firebase/installations",Zl="@firebase/installations-compat",ec="@firebase/messaging",tc="@firebase/messaging-compat",nc="@firebase/performance",ic="@firebase/performance-compat",sc="@firebase/remote-config",rc="@firebase/remote-config-compat",oc="@firebase/storage",ac="@firebase/storage-compat",lc="@firebase/firestore",cc="@firebase/ai",hc="@firebase/firestore-compat",uc="firebase",dc="11.10.0";/**
390
+ */const ie=new wi("@firebase/app"),Hl="@firebase/app-compat",Vl="@firebase/analytics-compat",$l="@firebase/analytics",Gl="@firebase/app-check-compat",jl="@firebase/app-check",zl="@firebase/auth",ql="@firebase/auth-compat",Kl="@firebase/database",Yl="@firebase/data-connect",Ql="@firebase/database-compat",Jl="@firebase/functions",Xl="@firebase/functions-compat",Zl="@firebase/installations",ec="@firebase/installations-compat",tc="@firebase/messaging",nc="@firebase/messaging-compat",ic="@firebase/performance",sc="@firebase/performance-compat",rc="@firebase/remote-config",oc="@firebase/remote-config-compat",ac="@firebase/storage",lc="@firebase/storage-compat",cc="@firebase/firestore",hc="@firebase/ai",uc="@firebase/firestore-compat",dc="firebase",fc="11.10.0";/**
391
391
  * @license
392
392
  * Copyright 2019 Google LLC
393
393
  *
@@ -402,7 +402,7 @@ import{a as vi}from"./tslib.es6-De9GV7Vy.js";import{u as Wa,a as Ba,b as Ha,d as
402
402
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
403
403
  * See the License for the specific language governing permissions and
404
404
  * limitations under the License.
405
- */const ei="[DEFAULT]",fc={[Zn]:"fire-core",[Bl]:"fire-core-compat",[Vl]:"fire-analytics",[Hl]:"fire-analytics-compat",[Gl]:"fire-app-check",[$l]:"fire-app-check-compat",[jl]:"fire-auth",[zl]:"fire-auth-compat",[ql]:"fire-rtdb",[Kl]:"fire-data-connect",[Yl]:"fire-rtdb-compat",[Ql]:"fire-fn",[Jl]:"fire-fn-compat",[Xl]:"fire-iid",[Zl]:"fire-iid-compat",[ec]:"fire-fcm",[tc]:"fire-fcm-compat",[nc]:"fire-perf",[ic]:"fire-perf-compat",[sc]:"fire-rc",[rc]:"fire-rc-compat",[oc]:"fire-gcs",[ac]:"fire-gcs-compat",[lc]:"fire-fst",[hc]:"fire-fst-compat",[cc]:"fire-vertex","fire-js":"fire-js",[uc]:"fire-js-all"};/**
405
+ */const ei="[DEFAULT]",pc={[Zn]:"fire-core",[Hl]:"fire-core-compat",[$l]:"fire-analytics",[Vl]:"fire-analytics-compat",[jl]:"fire-app-check",[Gl]:"fire-app-check-compat",[zl]:"fire-auth",[ql]:"fire-auth-compat",[Kl]:"fire-rtdb",[Yl]:"fire-data-connect",[Ql]:"fire-rtdb-compat",[Jl]:"fire-fn",[Xl]:"fire-fn-compat",[Zl]:"fire-iid",[ec]:"fire-iid-compat",[tc]:"fire-fcm",[nc]:"fire-fcm-compat",[ic]:"fire-perf",[sc]:"fire-perf-compat",[rc]:"fire-rc",[oc]:"fire-rc-compat",[ac]:"fire-gcs",[lc]:"fire-gcs-compat",[cc]:"fire-fst",[uc]:"fire-fst-compat",[hc]:"fire-vertex","fire-js":"fire-js",[dc]:"fire-js-all"};/**
406
406
  * @license
407
407
  * Copyright 2019 Google LLC
408
408
  *
@@ -417,7 +417,7 @@ import{a as vi}from"./tslib.es6-De9GV7Vy.js";import{u as Wa,a as Ba,b as Ha,d as
417
417
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
418
418
  * See the License for the specific language governing permissions and
419
419
  * limitations under the License.
420
- */const en=new Map,pc=new Map,ti=new Map;function vs(n,e){try{n.container.addComponent(e)}catch(t){ie.debug(`Component ${e.name} failed to register with FirebaseApp ${n.name}`,t)}}function Ke(n){const e=n.name;if(ti.has(e))return ie.debug(`There were multiple attempts to register component ${e}.`),!1;ti.set(e,n);for(const t of en.values())vs(t,n);for(const t of pc.values())vs(t,n);return!0}function Si(n,e){const t=n.container.getProvider("heartbeat").getImmediate({optional:!0});return t&&t.triggerHeartbeat(),n.container.getProvider(e)}function G(n){return n==null?!1:n.settings!==void 0}/**
420
+ */const en=new Map,_c=new Map,ti=new Map;function vs(n,e){try{n.container.addComponent(e)}catch(t){ie.debug(`Component ${e.name} failed to register with FirebaseApp ${n.name}`,t)}}function Ke(n){const e=n.name;if(ti.has(e))return ie.debug(`There were multiple attempts to register component ${e}.`),!1;ti.set(e,n);for(const t of en.values())vs(t,n);for(const t of _c.values())vs(t,n);return!0}function Si(n,e){const t=n.container.getProvider("heartbeat").getImmediate({optional:!0});return t&&t.triggerHeartbeat(),n.container.getProvider(e)}function G(n){return n==null?!1:n.settings!==void 0}/**
421
421
  * @license
422
422
  * Copyright 2019 Google LLC
423
423
  *
@@ -432,7 +432,7 @@ import{a as vi}from"./tslib.es6-De9GV7Vy.js";import{u as Wa,a as Ba,b as Ha,d as
432
432
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
433
433
  * See the License for the specific language governing permissions and
434
434
  * limitations under the License.
435
- */const _c={"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."},pe=new Ot("app","Firebase",_c);/**
435
+ */const gc={"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."},pe=new Ot("app","Firebase",gc);/**
436
436
  * @license
437
437
  * Copyright 2019 Google LLC
438
438
  *
@@ -447,7 +447,7 @@ import{a as vi}from"./tslib.es6-De9GV7Vy.js";import{u as Wa,a as Ba,b as Ha,d as
447
447
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
448
448
  * See the License for the specific language governing permissions and
449
449
  * limitations under the License.
450
- */class gc{constructor(e,t,i){this._isDeleted=!1,this._options=Object.assign({},e),this._config=Object.assign({},t),this._name=t.name,this._automaticDataCollectionEnabled=t.automaticDataCollectionEnabled,this._container=i,this.container.addComponent(new Ne("app",()=>this,"PUBLIC"))}get automaticDataCollectionEnabled(){return this.checkDestroyed(),this._automaticDataCollectionEnabled}set automaticDataCollectionEnabled(e){this.checkDestroyed(),this._automaticDataCollectionEnabled=e}get name(){return this.checkDestroyed(),this._name}get options(){return this.checkDestroyed(),this._options}get config(){return this.checkDestroyed(),this._config}get container(){return this._container}get isDeleted(){return this._isDeleted}set isDeleted(e){this._isDeleted=e}checkDestroyed(){if(this.isDeleted)throw pe.create("app-deleted",{appName:this._name})}}/**
450
+ */class mc{constructor(e,t,i){this._isDeleted=!1,this._options=Object.assign({},e),this._config=Object.assign({},t),this._name=t.name,this._automaticDataCollectionEnabled=t.automaticDataCollectionEnabled,this._container=i,this.container.addComponent(new Ae("app",()=>this,"PUBLIC"))}get automaticDataCollectionEnabled(){return this.checkDestroyed(),this._automaticDataCollectionEnabled}set automaticDataCollectionEnabled(e){this.checkDestroyed(),this._automaticDataCollectionEnabled=e}get name(){return this.checkDestroyed(),this._name}get options(){return this.checkDestroyed(),this._options}get config(){return this.checkDestroyed(),this._config}get container(){return this._container}get isDeleted(){return this._isDeleted}set isDeleted(e){this._isDeleted=e}checkDestroyed(){if(this.isDeleted)throw pe.create("app-deleted",{appName:this._name})}}/**
451
451
  * @license
452
452
  * Copyright 2019 Google LLC
453
453
  *
@@ -462,7 +462,7 @@ import{a as vi}from"./tslib.es6-De9GV7Vy.js";import{u as Wa,a as Ba,b as Ha,d as
462
462
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
463
463
  * See the License for the specific language governing permissions and
464
464
  * limitations under the License.
465
- */const nt=dc;function Lr(n,e={}){let t=n;typeof e!="object"&&(e={name:e});const i=Object.assign({name:ei,automaticDataCollectionEnabled:!0},e),s=i.name;if(typeof s!="string"||!s)throw pe.create("bad-app-name",{appName:String(s)});if(t||(t=br()),!t)throw pe.create("no-options");const r=en.get(s);if(r){if(ke(t,r.options)&&ke(i,r.config))return r;throw pe.create("duplicate-app",{appName:s})}const o=new Cl(s);for(const l of ti.values())o.addComponent(l);const a=new gc(t,i,o);return en.set(s,a),a}function xr(n=ei){const e=en.get(n);if(!e&&n===ei&&br())return Lr();if(!e)throw pe.create("no-app",{appName:n});return e}function _e(n,e,t){var i;let s=(i=fc[n])!==null&&i!==void 0?i:n;t&&(s+=`-${t}`);const r=s.match(/\s|\//),o=e.match(/\s|\//);if(r||o){const a=[`Unable to register library "${s}" with version "${e}":`];r&&a.push(`library name "${s}" contains illegal characters (whitespace or "/")`),r&&o&&a.push("and"),o&&a.push(`version name "${e}" contains illegal characters (whitespace or "/")`),ie.warn(a.join(" "));return}Ke(new Ne(`${s}-version`,()=>({library:s,version:e}),"VERSION"))}/**
465
+ */const nt=fc;function Lr(n,e={}){let t=n;typeof e!="object"&&(e={name:e});const i=Object.assign({name:ei,automaticDataCollectionEnabled:!0},e),s=i.name;if(typeof s!="string"||!s)throw pe.create("bad-app-name",{appName:String(s)});if(t||(t=br()),!t)throw pe.create("no-options");const r=en.get(s);if(r){if(ke(t,r.options)&&ke(i,r.config))return r;throw pe.create("duplicate-app",{appName:s})}const o=new wl(s);for(const l of ti.values())o.addComponent(l);const a=new mc(t,i,o);return en.set(s,a),a}function xr(n=ei){const e=en.get(n);if(!e&&n===ei&&br())return Lr();if(!e)throw pe.create("no-app",{appName:n});return e}function _e(n,e,t){var i;let s=(i=pc[n])!==null&&i!==void 0?i:n;t&&(s+=`-${t}`);const r=s.match(/\s|\//),o=e.match(/\s|\//);if(r||o){const a=[`Unable to register library "${s}" with version "${e}":`];r&&a.push(`library name "${s}" contains illegal characters (whitespace or "/")`),r&&o&&a.push("and"),o&&a.push(`version name "${e}" contains illegal characters (whitespace or "/")`),ie.warn(a.join(" "));return}Ke(new Ae(`${s}-version`,()=>({library:s,version:e}),"VERSION"))}/**
466
466
  * @license
467
467
  * Copyright 2021 Google LLC
468
468
  *
@@ -477,7 +477,7 @@ import{a as vi}from"./tslib.es6-De9GV7Vy.js";import{u as Wa,a as Ba,b as Ha,d as
477
477
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
478
478
  * See the License for the specific language governing permissions and
479
479
  * limitations under the License.
480
- */const mc="firebase-heartbeat-database",vc=1,It="firebase-heartbeat-store";let Un=null;function Fr(){return Un||(Un=Ll(mc,vc,{upgrade:(n,e)=>{switch(e){case 0:try{n.createObjectStore(It)}catch(t){console.warn(t)}}}}).catch(n=>{throw pe.create("idb-open",{originalErrorMessage:n.message})})),Un}async function yc(n){try{const t=(await Fr()).transaction(It),i=await t.objectStore(It).get(Ur(n));return await t.done,i}catch(e){if(e instanceof Ce)ie.warn(e.message);else{const t=pe.create("idb-get",{originalErrorMessage:e==null?void 0:e.message});ie.warn(t.message)}}}async function ys(n,e){try{const i=(await Fr()).transaction(It,"readwrite");await i.objectStore(It).put(e,Ur(n)),await i.done}catch(t){if(t instanceof Ce)ie.warn(t.message);else{const i=pe.create("idb-set",{originalErrorMessage:t==null?void 0:t.message});ie.warn(i.message)}}}function Ur(n){return`${n.name}!${n.options.appId}`}/**
480
+ */const vc="firebase-heartbeat-database",yc=1,It="firebase-heartbeat-store";let Un=null;function Fr(){return Un||(Un=xl(vc,yc,{upgrade:(n,e)=>{switch(e){case 0:try{n.createObjectStore(It)}catch(t){console.warn(t)}}}}).catch(n=>{throw pe.create("idb-open",{originalErrorMessage:n.message})})),Un}async function Ec(n){try{const t=(await Fr()).transaction(It),i=await t.objectStore(It).get(Ur(n));return await t.done,i}catch(e){if(e instanceof Ce)ie.warn(e.message);else{const t=pe.create("idb-get",{originalErrorMessage:e==null?void 0:e.message});ie.warn(t.message)}}}async function ys(n,e){try{const i=(await Fr()).transaction(It,"readwrite");await i.objectStore(It).put(e,Ur(n)),await i.done}catch(t){if(t instanceof Ce)ie.warn(t.message);else{const i=pe.create("idb-set",{originalErrorMessage:t==null?void 0:t.message});ie.warn(i.message)}}}function Ur(n){return`${n.name}!${n.options.appId}`}/**
481
481
  * @license
482
482
  * Copyright 2021 Google LLC
483
483
  *
@@ -492,7 +492,7 @@ import{a as vi}from"./tslib.es6-De9GV7Vy.js";import{u as Wa,a as Ba,b as Ha,d as
492
492
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
493
493
  * See the License for the specific language governing permissions and
494
494
  * limitations under the License.
495
- */const Ec=1024,Ic=30;class Cc{constructor(e){this.container=e,this._heartbeatsCache=null;const t=this.container.getProvider("app").getImmediate();this._storage=new Tc(t),this._heartbeatsCachePromise=this._storage.read().then(i=>(this._heartbeatsCache=i,i))}async triggerHeartbeat(){var e,t;try{const s=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),r=Es();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===r||this._heartbeatsCache.heartbeats.some(o=>o.date===r))return;if(this._heartbeatsCache.heartbeats.push({date:r,agent:s}),this._heartbeatsCache.heartbeats.length>Ic){const o=Sc(this._heartbeatsCache.heartbeats);this._heartbeatsCache.heartbeats.splice(o,1)}return this._storage.overwrite(this._heartbeatsCache)}catch(i){ie.warn(i)}}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=Es(),{heartbeatsToSend:i,unsentEntries:s}=wc(this._heartbeatsCache.heartbeats),r=Jt(JSON.stringify({version:2,heartbeats:i}));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)),r}catch(t){return ie.warn(t),""}}}function Es(){return new Date().toISOString().substring(0,10)}function wc(n,e=Ec){const t=[];let i=n.slice();for(const s of n){const r=t.find(o=>o.agent===s.agent);if(r){if(r.dates.push(s.date),Is(t)>e){r.dates.pop();break}}else if(t.push({agent:s.agent,dates:[s.date]}),Is(t)>e){t.pop();break}i=i.slice(1)}return{heartbeatsToSend:t,unsentEntries:i}}class Tc{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return al()?ll().then(()=>!0).catch(()=>!1):!1}async read(){if(await this._canUseIndexedDBPromise){const t=await yc(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 ys(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 ys(this.app,{lastSentHeartbeatDate:(t=e.lastSentHeartbeatDate)!==null&&t!==void 0?t:s.lastSentHeartbeatDate,heartbeats:[...s.heartbeats,...e.heartbeats]})}else return}}function Is(n){return Jt(JSON.stringify({version:2,heartbeats:n})).length}function Sc(n){if(n.length===0)return-1;let e=0,t=n[0].date;for(let i=1;i<n.length;i++)n[i].date<t&&(t=n[i].date,e=i);return e}/**
495
+ */const Ic=1024,Cc=30;class wc{constructor(e){this.container=e,this._heartbeatsCache=null;const t=this.container.getProvider("app").getImmediate();this._storage=new Sc(t),this._heartbeatsCachePromise=this._storage.read().then(i=>(this._heartbeatsCache=i,i))}async triggerHeartbeat(){var e,t;try{const s=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),r=Es();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===r||this._heartbeatsCache.heartbeats.some(o=>o.date===r))return;if(this._heartbeatsCache.heartbeats.push({date:r,agent:s}),this._heartbeatsCache.heartbeats.length>Cc){const o=bc(this._heartbeatsCache.heartbeats);this._heartbeatsCache.heartbeats.splice(o,1)}return this._storage.overwrite(this._heartbeatsCache)}catch(i){ie.warn(i)}}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=Es(),{heartbeatsToSend:i,unsentEntries:s}=Tc(this._heartbeatsCache.heartbeats),r=Jt(JSON.stringify({version:2,heartbeats:i}));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)),r}catch(t){return ie.warn(t),""}}}function Es(){return new Date().toISOString().substring(0,10)}function Tc(n,e=Ic){const t=[];let i=n.slice();for(const s of n){const r=t.find(o=>o.agent===s.agent);if(r){if(r.dates.push(s.date),Is(t)>e){r.dates.pop();break}}else if(t.push({agent:s.agent,dates:[s.date]}),Is(t)>e){t.pop();break}i=i.slice(1)}return{heartbeatsToSend:t,unsentEntries:i}}class Sc{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return ll()?cl().then(()=>!0).catch(()=>!1):!1}async read(){if(await this._canUseIndexedDBPromise){const t=await Ec(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 ys(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 ys(this.app,{lastSentHeartbeatDate:(t=e.lastSentHeartbeatDate)!==null&&t!==void 0?t:s.lastSentHeartbeatDate,heartbeats:[...s.heartbeats,...e.heartbeats]})}else return}}function Is(n){return Jt(JSON.stringify({version:2,heartbeats:n})).length}function bc(n){if(n.length===0)return-1;let e=0,t=n[0].date;for(let i=1;i<n.length;i++)n[i].date<t&&(t=n[i].date,e=i);return e}/**
496
496
  * @license
497
497
  * Copyright 2019 Google LLC
498
498
  *
@@ -507,7 +507,7 @@ import{a as vi}from"./tslib.es6-De9GV7Vy.js";import{u as Wa,a as Ba,b as Ha,d as
507
507
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
508
508
  * See the License for the specific language governing permissions and
509
509
  * limitations under the License.
510
- */function bc(n){Ke(new Ne("platform-logger",e=>new Ul(e),"PRIVATE")),Ke(new Ne("heartbeat",e=>new Cc(e),"PRIVATE")),_e(Zn,ms,n),_e(Zn,ms,"esm2017"),_e("fire-js","")}bc("");var Rc="firebase",Ac="11.10.0";/**
510
+ */function Rc(n){Ke(new Ae("platform-logger",e=>new Wl(e),"PRIVATE")),Ke(new Ae("heartbeat",e=>new wc(e),"PRIVATE")),_e(Zn,ms,n),_e(Zn,ms,"esm2017"),_e("fire-js","")}Rc("");var kc="firebase",Ac="11.10.0";/**
511
511
  * @license
512
512
  * Copyright 2020 Google LLC
513
513
  *
@@ -522,7 +522,7 @@ import{a as vi}from"./tslib.es6-De9GV7Vy.js";import{u as Wa,a as Ba,b as Ha,d as
522
522
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
523
523
  * See the License for the specific language governing permissions and
524
524
  * limitations under the License.
525
- */_e(Rc,Ac,"app");function Wr(){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 kc=Wr,Br=new Ot("auth","Firebase",Wr());/**
525
+ */_e(kc,Ac,"app");function Wr(){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 Nc=Wr,Br=new Ot("auth","Firebase",Wr());/**
526
526
  * @license
527
527
  * Copyright 2020 Google LLC
528
528
  *
@@ -537,7 +537,7 @@ import{a as vi}from"./tslib.es6-De9GV7Vy.js";import{u as Wa,a as Ba,b as Ha,d as
537
537
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
538
538
  * See the License for the specific language governing permissions and
539
539
  * limitations under the License.
540
- */const tn=new wi("@firebase/auth");function Nc(n,...e){tn.logLevel<=w.WARN&&tn.warn(`Auth (${nt}): ${n}`,...e)}function zt(n,...e){tn.logLevel<=w.ERROR&&tn.error(`Auth (${nt}): ${n}`,...e)}/**
540
+ */const tn=new wi("@firebase/auth");function Pc(n,...e){tn.logLevel<=w.WARN&&tn.warn(`Auth (${nt}): ${n}`,...e)}function zt(n,...e){tn.logLevel<=w.ERROR&&tn.error(`Auth (${nt}): ${n}`,...e)}/**
541
541
  * @license
542
542
  * Copyright 2020 Google LLC
543
543
  *
@@ -552,7 +552,7 @@ import{a as vi}from"./tslib.es6-De9GV7Vy.js";import{u as Wa,a as Ba,b as Ha,d as
552
552
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
553
553
  * See the License for the specific language governing permissions and
554
554
  * limitations under the License.
555
- */function Q(n,...e){throw bi(n,...e)}function J(n,...e){return bi(n,...e)}function Hr(n,e,t){const i=Object.assign(Object.assign({},kc()),{[e]:t});return new Ot("auth","Firebase",i).create(e,{appName:n.name})}function ge(n){return Hr(n,"operation-not-supported-in-this-environment","Operations that alter the current user are not supported in conjunction with FirebaseServerApp")}function bi(n,...e){if(typeof n!="string"){const t=e[0],i=[...e.slice(1)];return i[0]&&(i[0].appName=n.name),n._errorFactory.create(t,...i)}return Br.create(n,...e)}function g(n,e,...t){if(!n)throw bi(e,...t)}function Z(n){const e="INTERNAL ASSERTION FAILED: "+n;throw zt(e),new Error(e)}function se(n,e){n||Z(e)}/**
555
+ */function Q(n,...e){throw bi(n,...e)}function J(n,...e){return bi(n,...e)}function Hr(n,e,t){const i=Object.assign(Object.assign({},Nc()),{[e]:t});return new Ot("auth","Firebase",i).create(e,{appName:n.name})}function ge(n){return Hr(n,"operation-not-supported-in-this-environment","Operations that alter the current user are not supported in conjunction with FirebaseServerApp")}function bi(n,...e){if(typeof n!="string"){const t=e[0],i=[...e.slice(1)];return i[0]&&(i[0].appName=n.name),n._errorFactory.create(t,...i)}return Br.create(n,...e)}function g(n,e,...t){if(!n)throw bi(e,...t)}function Z(n){const e="INTERNAL ASSERTION FAILED: "+n;throw zt(e),new Error(e)}function se(n,e){n||Z(e)}/**
556
556
  * @license
557
557
  * Copyright 2020 Google LLC
558
558
  *
@@ -567,7 +567,7 @@ import{a as vi}from"./tslib.es6-De9GV7Vy.js";import{u as Wa,a as Ba,b as Ha,d as
567
567
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
568
568
  * See the License for the specific language governing permissions and
569
569
  * limitations under the License.
570
- */function ni(){var n;return typeof self<"u"&&((n=self.location)===null||n===void 0?void 0:n.href)||""}function Pc(){return Cs()==="http:"||Cs()==="https:"}function Cs(){var n;return typeof self<"u"&&((n=self.location)===null||n===void 0?void 0:n.protocol)||null}/**
570
+ */function ni(){var n;return typeof self<"u"&&((n=self.location)===null||n===void 0?void 0:n.href)||""}function Oc(){return Cs()==="http:"||Cs()==="https:"}function Cs(){var n;return typeof self<"u"&&((n=self.location)===null||n===void 0?void 0:n.protocol)||null}/**
571
571
  * @license
572
572
  * Copyright 2020 Google LLC
573
573
  *
@@ -582,7 +582,7 @@ import{a as vi}from"./tslib.es6-De9GV7Vy.js";import{u as Wa,a as Ba,b as Ha,d as
582
582
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
583
583
  * See the License for the specific language governing permissions and
584
584
  * limitations under the License.
585
- */function Oc(){return typeof navigator<"u"&&navigator&&"onLine"in navigator&&typeof navigator.onLine=="boolean"&&(Pc()||sl()||"connection"in navigator)?navigator.onLine:!0}function Dc(){if(typeof navigator>"u")return null;const n=navigator;return n.languages&&n.languages[0]||n.language||null}/**
585
+ */function Dc(){return typeof navigator<"u"&&navigator&&"onLine"in navigator&&typeof navigator.onLine=="boolean"&&(Oc()||rl()||"connection"in navigator)?navigator.onLine:!0}function Mc(){if(typeof navigator>"u")return null;const n=navigator;return n.languages&&n.languages[0]||n.language||null}/**
586
586
  * @license
587
587
  * Copyright 2020 Google LLC
588
588
  *
@@ -597,7 +597,7 @@ import{a as vi}from"./tslib.es6-De9GV7Vy.js";import{u as Wa,a as Ba,b as Ha,d as
597
597
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
598
598
  * See the License for the specific language governing permissions and
599
599
  * limitations under the License.
600
- */class Dt{constructor(e,t){this.shortDelay=e,this.longDelay=t,se(t>e,"Short delay should be less than long delay!"),this.isMobile=Ci()||Nr()}get(){return Oc()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}}/**
600
+ */class Dt{constructor(e,t){this.shortDelay=e,this.longDelay=t,se(t>e,"Short delay should be less than long delay!"),this.isMobile=Ci()||Nr()}get(){return Dc()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}}/**
601
601
  * @license
602
602
  * Copyright 2020 Google LLC
603
603
  *
@@ -642,7 +642,7 @@ import{a as vi}from"./tslib.es6-De9GV7Vy.js";import{u as Wa,a as Ba,b as Ha,d as
642
642
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
643
643
  * See the License for the specific language governing permissions and
644
644
  * limitations under the License.
645
- */const Mc={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"};/**
645
+ */const Lc={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"};/**
646
646
  * @license
647
647
  * Copyright 2020 Google LLC
648
648
  *
@@ -657,7 +657,7 @@ import{a as vi}from"./tslib.es6-De9GV7Vy.js";import{u as Wa,a as Ba,b as Ha,d as
657
657
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
658
658
  * See the License for the specific language governing permissions and
659
659
  * limitations under the License.
660
- */const Lc=["/v1/accounts:signInWithCustomToken","/v1/accounts:signInWithEmailLink","/v1/accounts:signInWithIdp","/v1/accounts:signInWithPassword","/v1/accounts:signInWithPhoneNumber","/v1/token"],xc=new Dt(3e4,6e4);function Le(n,e){return n.tenantId&&!e.tenantId?Object.assign(Object.assign({},e),{tenantId:n.tenantId}):e}async function we(n,e,t,i,s={}){return $r(n,s,async()=>{let r={},o={};i&&(e==="GET"?o=i:r={body:JSON.stringify(i)});const a=tt(Object.assign({key:n.config.apiKey},o)).slice(1),l=await n._getAdditionalHeaders();l["Content-Type"]="application/json",n.languageCode&&(l["X-Firebase-Locale"]=n.languageCode);const c=Object.assign({method:e,headers:l},r);return il()||(c.referrerPolicy="no-referrer"),n.emulatorConfig&&et(n.emulatorConfig.host)&&(c.credentials="include"),Vr.fetch()(await Gr(n,n.config.apiHost,t,a),c)})}async function $r(n,e,t){n._canInitEmulator=!1;const i=Object.assign(Object.assign({},Mc),e);try{const s=new Uc(n),r=await Promise.race([t(),s.promise]);s.clearNetworkTimeout();const o=await r.json();if("needConfirmation"in o)throw $t(n,"account-exists-with-different-credential",o);if(r.ok&&!("errorMessage"in o))return o;{const a=r.ok?o.errorMessage:o.error.message,[l,c]=a.split(" : ");if(l==="FEDERATED_USER_ID_ALREADY_LINKED")throw $t(n,"credential-already-in-use",o);if(l==="EMAIL_EXISTS")throw $t(n,"email-already-in-use",o);if(l==="USER_DISABLED")throw $t(n,"user-disabled",o);const d=i[l]||l.toLowerCase().replace(/[_\s]+/g,"-");if(c)throw Hr(n,d,c);Q(n,d)}}catch(s){if(s instanceof Ce)throw s;Q(n,"network-request-failed",{message:String(s)})}}async function In(n,e,t,i,s={}){const r=await we(n,e,t,i,s);return"mfaPendingCredential"in r&&Q(n,"multi-factor-auth-required",{_serverResponse:r}),r}async function Gr(n,e,t,i){const s=`${e}${t}?${i}`,r=n,o=r.config.emulator?Ri(n.config,s):`${n.config.apiScheme}://${s}`;return Lc.includes(t)&&(await r._persistenceManagerAvailable,r._getPersistenceType()==="COOKIE")?r._getPersistence()._getFinalTarget(o).toString():o}function Fc(n){switch(n){case"ENFORCE":return"ENFORCE";case"AUDIT":return"AUDIT";case"OFF":return"OFF";default:return"ENFORCEMENT_STATE_UNSPECIFIED"}}class Uc{clearNetworkTimeout(){clearTimeout(this.timer)}constructor(e){this.auth=e,this.timer=null,this.promise=new Promise((t,i)=>{this.timer=setTimeout(()=>i(J(this.auth,"network-request-failed")),xc.get())})}}function $t(n,e,t){const i={appName:n.name};t.email&&(i.email=t.email),t.phoneNumber&&(i.phoneNumber=t.phoneNumber);const s=J(n,e,i);return s.customData._tokenResponse=t,s}function ws(n){return n!==void 0&&n.enterprise!==void 0}class Wc{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 Fc(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 Bc(n,e){return we(n,"GET","/v2/recaptchaConfig",Le(n,e))}/**
660
+ */const xc=["/v1/accounts:signInWithCustomToken","/v1/accounts:signInWithEmailLink","/v1/accounts:signInWithIdp","/v1/accounts:signInWithPassword","/v1/accounts:signInWithPhoneNumber","/v1/token"],Fc=new Dt(3e4,6e4);function Me(n,e){return n.tenantId&&!e.tenantId?Object.assign(Object.assign({},e),{tenantId:n.tenantId}):e}async function we(n,e,t,i,s={}){return $r(n,s,async()=>{let r={},o={};i&&(e==="GET"?o=i:r={body:JSON.stringify(i)});const a=tt(Object.assign({key:n.config.apiKey},o)).slice(1),l=await n._getAdditionalHeaders();l["Content-Type"]="application/json",n.languageCode&&(l["X-Firebase-Locale"]=n.languageCode);const c=Object.assign({method:e,headers:l},r);return sl()||(c.referrerPolicy="no-referrer"),n.emulatorConfig&&et(n.emulatorConfig.host)&&(c.credentials="include"),Vr.fetch()(await Gr(n,n.config.apiHost,t,a),c)})}async function $r(n,e,t){n._canInitEmulator=!1;const i=Object.assign(Object.assign({},Lc),e);try{const s=new Wc(n),r=await Promise.race([t(),s.promise]);s.clearNetworkTimeout();const o=await r.json();if("needConfirmation"in o)throw $t(n,"account-exists-with-different-credential",o);if(r.ok&&!("errorMessage"in o))return o;{const a=r.ok?o.errorMessage:o.error.message,[l,c]=a.split(" : ");if(l==="FEDERATED_USER_ID_ALREADY_LINKED")throw $t(n,"credential-already-in-use",o);if(l==="EMAIL_EXISTS")throw $t(n,"email-already-in-use",o);if(l==="USER_DISABLED")throw $t(n,"user-disabled",o);const d=i[l]||l.toLowerCase().replace(/[_\s]+/g,"-");if(c)throw Hr(n,d,c);Q(n,d)}}catch(s){if(s instanceof Ce)throw s;Q(n,"network-request-failed",{message:String(s)})}}async function In(n,e,t,i,s={}){const r=await we(n,e,t,i,s);return"mfaPendingCredential"in r&&Q(n,"multi-factor-auth-required",{_serverResponse:r}),r}async function Gr(n,e,t,i){const s=`${e}${t}?${i}`,r=n,o=r.config.emulator?Ri(n.config,s):`${n.config.apiScheme}://${s}`;return xc.includes(t)&&(await r._persistenceManagerAvailable,r._getPersistenceType()==="COOKIE")?r._getPersistence()._getFinalTarget(o).toString():o}function Uc(n){switch(n){case"ENFORCE":return"ENFORCE";case"AUDIT":return"AUDIT";case"OFF":return"OFF";default:return"ENFORCEMENT_STATE_UNSPECIFIED"}}class Wc{clearNetworkTimeout(){clearTimeout(this.timer)}constructor(e){this.auth=e,this.timer=null,this.promise=new Promise((t,i)=>{this.timer=setTimeout(()=>i(J(this.auth,"network-request-failed")),Fc.get())})}}function $t(n,e,t){const i={appName:n.name};t.email&&(i.email=t.email),t.phoneNumber&&(i.phoneNumber=t.phoneNumber);const s=J(n,e,i);return s.customData._tokenResponse=t,s}function ws(n){return n!==void 0&&n.enterprise!==void 0}class Bc{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 Uc(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 Hc(n,e){return we(n,"GET","/v2/recaptchaConfig",Me(n,e))}/**
661
661
  * @license
662
662
  * Copyright 2020 Google LLC
663
663
  *
@@ -672,7 +672,7 @@ import{a as vi}from"./tslib.es6-De9GV7Vy.js";import{u as Wa,a as Ba,b as Ha,d as
672
672
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
673
673
  * See the License for the specific language governing permissions and
674
674
  * limitations under the License.
675
- */async function Hc(n,e){return we(n,"POST","/v1/accounts:delete",e)}async function nn(n,e){return we(n,"POST","/v1/accounts:lookup",e)}/**
675
+ */async function Vc(n,e){return we(n,"POST","/v1/accounts:delete",e)}async function nn(n,e){return we(n,"POST","/v1/accounts:lookup",e)}/**
676
676
  * @license
677
677
  * Copyright 2020 Google LLC
678
678
  *
@@ -687,7 +687,7 @@ import{a as vi}from"./tslib.es6-De9GV7Vy.js";import{u as Wa,a as Ba,b as Ha,d as
687
687
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
688
688
  * See the License for the specific language governing permissions and
689
689
  * limitations under the License.
690
- */function pt(n){if(n)try{const e=new Date(Number(n));if(!isNaN(e.getTime()))return e.toUTCString()}catch{}}async function Vc(n,e=!1){const t=F(n),i=await t.getIdToken(e),s=Ai(i);g(s&&s.exp&&s.auth_time&&s.iat,t.auth,"internal-error");const r=typeof s.firebase=="object"?s.firebase:void 0,o=r==null?void 0:r.sign_in_provider;return{claims:s,token:i,authTime:pt(Wn(s.auth_time)),issuedAtTime:pt(Wn(s.iat)),expirationTime:pt(Wn(s.exp)),signInProvider:o||null,signInSecondFactor:(r==null?void 0:r.sign_in_second_factor)||null}}function Wn(n){return Number(n)*1e3}function Ai(n){const[e,t,i]=n.split(".");if(e===void 0||t===void 0||i===void 0)return zt("JWT malformed, contained fewer than 3 sections"),null;try{const s=Xt(t);return s?JSON.parse(s):(zt("Failed to decode base64 JWT payload"),null)}catch(s){return zt("Caught error parsing JWT payload as JSON",s==null?void 0:s.toString()),null}}function Ts(n){const e=Ai(n);return g(e,"internal-error"),g(typeof e.exp<"u","internal-error"),g(typeof e.iat<"u","internal-error"),Number(e.exp)-Number(e.iat)}/**
690
+ */function pt(n){if(n)try{const e=new Date(Number(n));if(!isNaN(e.getTime()))return e.toUTCString()}catch{}}async function $c(n,e=!1){const t=F(n),i=await t.getIdToken(e),s=ki(i);g(s&&s.exp&&s.auth_time&&s.iat,t.auth,"internal-error");const r=typeof s.firebase=="object"?s.firebase:void 0,o=r==null?void 0:r.sign_in_provider;return{claims:s,token:i,authTime:pt(Wn(s.auth_time)),issuedAtTime:pt(Wn(s.iat)),expirationTime:pt(Wn(s.exp)),signInProvider:o||null,signInSecondFactor:(r==null?void 0:r.sign_in_second_factor)||null}}function Wn(n){return Number(n)*1e3}function ki(n){const[e,t,i]=n.split(".");if(e===void 0||t===void 0||i===void 0)return zt("JWT malformed, contained fewer than 3 sections"),null;try{const s=Xt(t);return s?JSON.parse(s):(zt("Failed to decode base64 JWT payload"),null)}catch(s){return zt("Caught error parsing JWT payload as JSON",s==null?void 0:s.toString()),null}}function Ts(n){const e=ki(n);return g(e,"internal-error"),g(typeof e.exp<"u","internal-error"),g(typeof e.iat<"u","internal-error"),Number(e.exp)-Number(e.iat)}/**
691
691
  * @license
692
692
  * Copyright 2020 Google LLC
693
693
  *
@@ -702,7 +702,7 @@ import{a as vi}from"./tslib.es6-De9GV7Vy.js";import{u as Wa,a as Ba,b as Ha,d as
702
702
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
703
703
  * See the License for the specific language governing permissions and
704
704
  * limitations under the License.
705
- */async function Ct(n,e,t=!1){if(t)return e;try{return await e}catch(i){throw i instanceof Ce&&$c(i)&&n.auth.currentUser===n&&await n.auth.signOut(),i}}function $c({code:n}){return n==="auth/user-disabled"||n==="auth/user-token-expired"}/**
705
+ */async function Ct(n,e,t=!1){if(t)return e;try{return await e}catch(i){throw i instanceof Ce&&Gc(i)&&n.auth.currentUser===n&&await n.auth.signOut(),i}}function Gc({code:n}){return n==="auth/user-disabled"||n==="auth/user-token-expired"}/**
706
706
  * @license
707
707
  * Copyright 2020 Google LLC
708
708
  *
@@ -717,7 +717,7 @@ import{a as vi}from"./tslib.es6-De9GV7Vy.js";import{u as Wa,a as Ba,b as Ha,d as
717
717
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
718
718
  * See the License for the specific language governing permissions and
719
719
  * limitations under the License.
720
- */class Gc{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 i=this.errorBackoff;return this.errorBackoff=Math.min(this.errorBackoff*2,96e4),i}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()}}/**
720
+ */class jc{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 i=this.errorBackoff;return this.errorBackoff=Math.min(this.errorBackoff*2,96e4),i}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()}}/**
721
721
  * @license
722
722
  * Copyright 2020 Google LLC
723
723
  *
@@ -747,7 +747,7 @@ import{a as vi}from"./tslib.es6-De9GV7Vy.js";import{u as Wa,a as Ba,b as Ha,d as
747
747
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
748
748
  * See the License for the specific language governing permissions and
749
749
  * limitations under the License.
750
- */async function sn(n){var e;const t=n.auth,i=await n.getIdToken(),s=await Ct(n,nn(t,{idToken:i}));g(s==null?void 0:s.users.length,t,"internal-error");const r=s.users[0];n._notifyReloadListener(r);const o=!((e=r.providerUserInfo)===null||e===void 0)&&e.length?jr(r.providerUserInfo):[],a=zc(n.providerData,o),l=n.isAnonymous,c=!(n.email&&r.passwordHash)&&!(a!=null&&a.length),d=l?c:!1,h={uid:r.localId,displayName:r.displayName||null,photoURL:r.photoUrl||null,email:r.email||null,emailVerified:r.emailVerified||!1,phoneNumber:r.phoneNumber||null,tenantId:r.tenantId||null,providerData:a,metadata:new ii(r.createdAt,r.lastLoginAt),isAnonymous:d};Object.assign(n,h)}async function jc(n){const e=F(n);await sn(e),await e.auth._persistUserIfCurrent(e),e.auth._notifyListenersIfCurrent(e)}function zc(n,e){return[...n.filter(i=>!e.some(s=>s.providerId===i.providerId)),...e]}function jr(n){return n.map(e=>{var{providerId:t}=e,i=vi(e,["providerId"]);return{providerId:t,uid:i.rawId||"",displayName:i.displayName||null,email:i.email||null,phoneNumber:i.phoneNumber||null,photoURL:i.photoUrl||null}})}/**
750
+ */async function sn(n){var e;const t=n.auth,i=await n.getIdToken(),s=await Ct(n,nn(t,{idToken:i}));g(s==null?void 0:s.users.length,t,"internal-error");const r=s.users[0];n._notifyReloadListener(r);const o=!((e=r.providerUserInfo)===null||e===void 0)&&e.length?jr(r.providerUserInfo):[],a=qc(n.providerData,o),l=n.isAnonymous,c=!(n.email&&r.passwordHash)&&!(a!=null&&a.length),d=l?c:!1,h={uid:r.localId,displayName:r.displayName||null,photoURL:r.photoUrl||null,email:r.email||null,emailVerified:r.emailVerified||!1,phoneNumber:r.phoneNumber||null,tenantId:r.tenantId||null,providerData:a,metadata:new ii(r.createdAt,r.lastLoginAt),isAnonymous:d};Object.assign(n,h)}async function zc(n){const e=F(n);await sn(e),await e.auth._persistUserIfCurrent(e),e.auth._notifyListenersIfCurrent(e)}function qc(n,e){return[...n.filter(i=>!e.some(s=>s.providerId===i.providerId)),...e]}function jr(n){return n.map(e=>{var{providerId:t}=e,i=vi(e,["providerId"]);return{providerId:t,uid:i.rawId||"",displayName:i.displayName||null,email:i.email||null,phoneNumber:i.phoneNumber||null,photoURL:i.photoUrl||null}})}/**
751
751
  * @license
752
752
  * Copyright 2020 Google LLC
753
753
  *
@@ -762,7 +762,7 @@ import{a as vi}from"./tslib.es6-De9GV7Vy.js";import{u as Wa,a as Ba,b as Ha,d as
762
762
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
763
763
  * See the License for the specific language governing permissions and
764
764
  * limitations under the License.
765
- */async function qc(n,e){const t=await $r(n,{},async()=>{const i=tt({grant_type:"refresh_token",refresh_token:e}).slice(1),{tokenApiHost:s,apiKey:r}=n.config,o=await Gr(n,s,"/v1/token",`key=${r}`),a=await n._getAdditionalHeaders();a["Content-Type"]="application/x-www-form-urlencoded";const l={method:"POST",headers:a,body:i};return n.emulatorConfig&&et(n.emulatorConfig.host)&&(l.credentials="include"),Vr.fetch()(o,l)});return{accessToken:t.access_token,expiresIn:t.expires_in,refreshToken:t.refresh_token}}async function Kc(n,e){return we(n,"POST","/v2/accounts:revokeToken",Le(n,e))}/**
765
+ */async function Kc(n,e){const t=await $r(n,{},async()=>{const i=tt({grant_type:"refresh_token",refresh_token:e}).slice(1),{tokenApiHost:s,apiKey:r}=n.config,o=await Gr(n,s,"/v1/token",`key=${r}`),a=await n._getAdditionalHeaders();a["Content-Type"]="application/x-www-form-urlencoded";const l={method:"POST",headers:a,body:i};return n.emulatorConfig&&et(n.emulatorConfig.host)&&(l.credentials="include"),Vr.fetch()(o,l)});return{accessToken:t.access_token,expiresIn:t.expires_in,refreshToken:t.refresh_token}}async function Yc(n,e){return we(n,"POST","/v2/accounts:revokeToken",Me(n,e))}/**
766
766
  * @license
767
767
  * Copyright 2020 Google LLC
768
768
  *
@@ -777,7 +777,7 @@ import{a as vi}from"./tslib.es6-De9GV7Vy.js";import{u as Wa,a as Ba,b as Ha,d as
777
777
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
778
778
  * See the License for the specific language governing permissions and
779
779
  * limitations under the License.
780
- */class Ve{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(e){g(e.idToken,"internal-error"),g(typeof e.idToken<"u","internal-error"),g(typeof e.refreshToken<"u","internal-error");const t="expiresIn"in e&&typeof e.expiresIn<"u"?Number(e.expiresIn):Ts(e.idToken);this.updateTokensAndExpiration(e.idToken,e.refreshToken,t)}updateFromIdToken(e){g(e.length!==0,"internal-error");const t=Ts(e);this.updateTokensAndExpiration(e,null,t)}async getToken(e,t=!1){return!t&&this.accessToken&&!this.isExpired?this.accessToken:(g(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:i,refreshToken:s,expiresIn:r}=await qc(e,t);this.updateTokensAndExpiration(i,s,Number(r))}updateTokensAndExpiration(e,t,i){this.refreshToken=t||null,this.accessToken=e||null,this.expirationTime=Date.now()+i*1e3}static fromJSON(e,t){const{refreshToken:i,accessToken:s,expirationTime:r}=t,o=new Ve;return i&&(g(typeof i=="string","internal-error",{appName:e}),o.refreshToken=i),s&&(g(typeof s=="string","internal-error",{appName:e}),o.accessToken=s),r&&(g(typeof r=="number","internal-error",{appName:e}),o.expirationTime=r),o}toJSON(){return{refreshToken:this.refreshToken,accessToken:this.accessToken,expirationTime:this.expirationTime}}_assign(e){this.accessToken=e.accessToken,this.refreshToken=e.refreshToken,this.expirationTime=e.expirationTime}_clone(){return Object.assign(new Ve,this.toJSON())}_performRefresh(){return Z("not implemented")}}/**
780
+ */class Ve{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(e){g(e.idToken,"internal-error"),g(typeof e.idToken<"u","internal-error"),g(typeof e.refreshToken<"u","internal-error");const t="expiresIn"in e&&typeof e.expiresIn<"u"?Number(e.expiresIn):Ts(e.idToken);this.updateTokensAndExpiration(e.idToken,e.refreshToken,t)}updateFromIdToken(e){g(e.length!==0,"internal-error");const t=Ts(e);this.updateTokensAndExpiration(e,null,t)}async getToken(e,t=!1){return!t&&this.accessToken&&!this.isExpired?this.accessToken:(g(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:i,refreshToken:s,expiresIn:r}=await Kc(e,t);this.updateTokensAndExpiration(i,s,Number(r))}updateTokensAndExpiration(e,t,i){this.refreshToken=t||null,this.accessToken=e||null,this.expirationTime=Date.now()+i*1e3}static fromJSON(e,t){const{refreshToken:i,accessToken:s,expirationTime:r}=t,o=new Ve;return i&&(g(typeof i=="string","internal-error",{appName:e}),o.refreshToken=i),s&&(g(typeof s=="string","internal-error",{appName:e}),o.accessToken=s),r&&(g(typeof r=="number","internal-error",{appName:e}),o.expirationTime=r),o}toJSON(){return{refreshToken:this.refreshToken,accessToken:this.accessToken,expirationTime:this.expirationTime}}_assign(e){this.accessToken=e.accessToken,this.refreshToken=e.refreshToken,this.expirationTime=e.expirationTime}_clone(){return Object.assign(new Ve,this.toJSON())}_performRefresh(){return Z("not implemented")}}/**
781
781
  * @license
782
782
  * Copyright 2020 Google LLC
783
783
  *
@@ -792,7 +792,7 @@ import{a as vi}from"./tslib.es6-De9GV7Vy.js";import{u as Wa,a as Ba,b as Ha,d as
792
792
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
793
793
  * See the License for the specific language governing permissions and
794
794
  * limitations under the License.
795
- */function le(n,e){g(typeof n=="string"||typeof n>"u","internal-error",{appName:e})}class z{constructor(e){var{uid:t,auth:i,stsTokenManager:s}=e,r=vi(e,["uid","auth","stsTokenManager"]);this.providerId="firebase",this.proactiveRefresh=new Gc(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=t,this.auth=i,this.stsTokenManager=s,this.accessToken=s.accessToken,this.displayName=r.displayName||null,this.email=r.email||null,this.emailVerified=r.emailVerified||!1,this.phoneNumber=r.phoneNumber||null,this.photoURL=r.photoURL||null,this.isAnonymous=r.isAnonymous||!1,this.tenantId=r.tenantId||null,this.providerData=r.providerData?[...r.providerData]:[],this.metadata=new ii(r.createdAt||void 0,r.lastLoginAt||void 0)}async getIdToken(e){const t=await Ct(this,this.stsTokenManager.getToken(this.auth,e));return g(t,this.auth,"internal-error"),this.accessToken!==t&&(this.accessToken=t,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),t}getIdTokenResult(e){return Vc(this,e)}reload(){return jc(this)}_assign(e){this!==e&&(g(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 z(Object.assign(Object.assign({},this),{auth:e,stsTokenManager:this.stsTokenManager._clone()}));return t.metadata._copy(this.metadata),t}_onReload(e){g(!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 i=!1;e.idToken&&e.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(e),i=!0),t&&await sn(this),await this.auth._persistUserIfCurrent(this),i&&this.auth._notifyListenersIfCurrent(this)}async delete(){if(G(this.auth.app))return Promise.reject(ge(this.auth));const e=await this.getIdToken();return await Ct(this,Hc(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 i,s,r,o,a,l,c,d;const h=(i=t.displayName)!==null&&i!==void 0?i:void 0,u=(s=t.email)!==null&&s!==void 0?s:void 0,p=(r=t.phoneNumber)!==null&&r!==void 0?r:void 0,_=(o=t.photoURL)!==null&&o!==void 0?o:void 0,C=(a=t.tenantId)!==null&&a!==void 0?a:void 0,R=(l=t._redirectEventId)!==null&&l!==void 0?l:void 0,H=(c=t.createdAt)!==null&&c!==void 0?c:void 0,V=(d=t.lastLoginAt)!==null&&d!==void 0?d:void 0,{uid:$,emailVerified:Fe,isAnonymous:cs,providerData:On,stsTokenManager:hs}=t;g($&&hs,e,"internal-error");const Fa=Ve.fromJSON(this.name,hs);g(typeof $=="string",e,"internal-error"),le(h,e.name),le(u,e.name),g(typeof Fe=="boolean",e,"internal-error"),g(typeof cs=="boolean",e,"internal-error"),le(p,e.name),le(_,e.name),le(C,e.name),le(R,e.name),le(H,e.name),le(V,e.name);const Dn=new z({uid:$,auth:e,email:u,emailVerified:Fe,displayName:h,isAnonymous:cs,photoURL:_,phoneNumber:p,tenantId:C,stsTokenManager:Fa,createdAt:H,lastLoginAt:V});return On&&Array.isArray(On)&&(Dn.providerData=On.map(Ua=>Object.assign({},Ua))),R&&(Dn._redirectEventId=R),Dn}static async _fromIdTokenResponse(e,t,i=!1){const s=new Ve;s.updateFromServerResponse(t);const r=new z({uid:t.localId,auth:e,stsTokenManager:s,isAnonymous:i});return await sn(r),r}static async _fromGetAccountInfoResponse(e,t,i){const s=t.users[0];g(s.localId!==void 0,"internal-error");const r=s.providerUserInfo!==void 0?jr(s.providerUserInfo):[],o=!(s.email&&s.passwordHash)&&!(r!=null&&r.length),a=new Ve;a.updateFromIdToken(i);const l=new z({uid:s.localId,auth:e,stsTokenManager:a,isAnonymous:o}),c={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:r,metadata:new ii(s.createdAt,s.lastLoginAt),isAnonymous:!(s.email&&s.passwordHash)&&!(r!=null&&r.length)};return Object.assign(l,c),l}}/**
795
+ */function le(n,e){g(typeof n=="string"||typeof n>"u","internal-error",{appName:e})}class z{constructor(e){var{uid:t,auth:i,stsTokenManager:s}=e,r=vi(e,["uid","auth","stsTokenManager"]);this.providerId="firebase",this.proactiveRefresh=new jc(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=t,this.auth=i,this.stsTokenManager=s,this.accessToken=s.accessToken,this.displayName=r.displayName||null,this.email=r.email||null,this.emailVerified=r.emailVerified||!1,this.phoneNumber=r.phoneNumber||null,this.photoURL=r.photoURL||null,this.isAnonymous=r.isAnonymous||!1,this.tenantId=r.tenantId||null,this.providerData=r.providerData?[...r.providerData]:[],this.metadata=new ii(r.createdAt||void 0,r.lastLoginAt||void 0)}async getIdToken(e){const t=await Ct(this,this.stsTokenManager.getToken(this.auth,e));return g(t,this.auth,"internal-error"),this.accessToken!==t&&(this.accessToken=t,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),t}getIdTokenResult(e){return $c(this,e)}reload(){return zc(this)}_assign(e){this!==e&&(g(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 z(Object.assign(Object.assign({},this),{auth:e,stsTokenManager:this.stsTokenManager._clone()}));return t.metadata._copy(this.metadata),t}_onReload(e){g(!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 i=!1;e.idToken&&e.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(e),i=!0),t&&await sn(this),await this.auth._persistUserIfCurrent(this),i&&this.auth._notifyListenersIfCurrent(this)}async delete(){if(G(this.auth.app))return Promise.reject(ge(this.auth));const e=await this.getIdToken();return await Ct(this,Vc(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 i,s,r,o,a,l,c,d;const h=(i=t.displayName)!==null&&i!==void 0?i:void 0,u=(s=t.email)!==null&&s!==void 0?s:void 0,p=(r=t.phoneNumber)!==null&&r!==void 0?r:void 0,_=(o=t.photoURL)!==null&&o!==void 0?o:void 0,C=(a=t.tenantId)!==null&&a!==void 0?a:void 0,R=(l=t._redirectEventId)!==null&&l!==void 0?l:void 0,H=(c=t.createdAt)!==null&&c!==void 0?c:void 0,V=(d=t.lastLoginAt)!==null&&d!==void 0?d:void 0,{uid:$,emailVerified:xe,isAnonymous:cs,providerData:On,stsTokenManager:hs}=t;g($&&hs,e,"internal-error");const Fa=Ve.fromJSON(this.name,hs);g(typeof $=="string",e,"internal-error"),le(h,e.name),le(u,e.name),g(typeof xe=="boolean",e,"internal-error"),g(typeof cs=="boolean",e,"internal-error"),le(p,e.name),le(_,e.name),le(C,e.name),le(R,e.name),le(H,e.name),le(V,e.name);const Dn=new z({uid:$,auth:e,email:u,emailVerified:xe,displayName:h,isAnonymous:cs,photoURL:_,phoneNumber:p,tenantId:C,stsTokenManager:Fa,createdAt:H,lastLoginAt:V});return On&&Array.isArray(On)&&(Dn.providerData=On.map(Ua=>Object.assign({},Ua))),R&&(Dn._redirectEventId=R),Dn}static async _fromIdTokenResponse(e,t,i=!1){const s=new Ve;s.updateFromServerResponse(t);const r=new z({uid:t.localId,auth:e,stsTokenManager:s,isAnonymous:i});return await sn(r),r}static async _fromGetAccountInfoResponse(e,t,i){const s=t.users[0];g(s.localId!==void 0,"internal-error");const r=s.providerUserInfo!==void 0?jr(s.providerUserInfo):[],o=!(s.email&&s.passwordHash)&&!(r!=null&&r.length),a=new Ve;a.updateFromIdToken(i);const l=new z({uid:s.localId,auth:e,stsTokenManager:a,isAnonymous:o}),c={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:r,metadata:new ii(s.createdAt,s.lastLoginAt),isAnonymous:!(s.email&&s.passwordHash)&&!(r!=null&&r.length)};return Object.assign(l,c),l}}/**
796
796
  * @license
797
797
  * Copyright 2020 Google LLC
798
798
  *
@@ -852,7 +852,7 @@ import{a as vi}from"./tslib.es6-De9GV7Vy.js";import{u as Wa,a as Ba,b as Ha,d as
852
852
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
853
853
  * See the License for the specific language governing permissions and
854
854
  * limitations under the License.
855
- */function bs(n){const e=n.toLowerCase();if(e.includes("opera/")||e.includes("opr/")||e.includes("opios/"))return"Opera";if(Qr(e))return"IEMobile";if(e.includes("msie")||e.includes("trident/"))return"IE";if(e.includes("edge/"))return"Edge";if(qr(e))return"Firefox";if(e.includes("silk/"))return"Silk";if(Xr(e))return"Blackberry";if(Zr(e))return"Webos";if(Kr(e))return"Safari";if((e.includes("chrome/")||Yr(e))&&!e.includes("edge/"))return"Chrome";if(Jr(e))return"Android";{const t=/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/,i=n.match(t);if((i==null?void 0:i.length)===2)return i[1]}return"Other"}function qr(n=x()){return/firefox\//i.test(n)}function Kr(n=x()){const e=n.toLowerCase();return e.includes("safari/")&&!e.includes("chrome/")&&!e.includes("crios/")&&!e.includes("android")}function Yr(n=x()){return/crios\//i.test(n)}function Qr(n=x()){return/iemobile/i.test(n)}function Jr(n=x()){return/android/i.test(n)}function Xr(n=x()){return/blackberry/i.test(n)}function Zr(n=x()){return/webos/i.test(n)}function ki(n=x()){return/iphone|ipad|ipod/i.test(n)||/macintosh/i.test(n)&&/mobile/i.test(n)}function Yc(n=x()){var e;return ki(n)&&!!(!((e=window.navigator)===null||e===void 0)&&e.standalone)}function Qc(){return rl()&&document.documentMode===10}function eo(n=x()){return ki(n)||Jr(n)||Zr(n)||Xr(n)||/windows phone/i.test(n)||Qr(n)}/**
855
+ */function bs(n){const e=n.toLowerCase();if(e.includes("opera/")||e.includes("opr/")||e.includes("opios/"))return"Opera";if(Qr(e))return"IEMobile";if(e.includes("msie")||e.includes("trident/"))return"IE";if(e.includes("edge/"))return"Edge";if(qr(e))return"Firefox";if(e.includes("silk/"))return"Silk";if(Xr(e))return"Blackberry";if(Zr(e))return"Webos";if(Kr(e))return"Safari";if((e.includes("chrome/")||Yr(e))&&!e.includes("edge/"))return"Chrome";if(Jr(e))return"Android";{const t=/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/,i=n.match(t);if((i==null?void 0:i.length)===2)return i[1]}return"Other"}function qr(n=x()){return/firefox\//i.test(n)}function Kr(n=x()){const e=n.toLowerCase();return e.includes("safari/")&&!e.includes("chrome/")&&!e.includes("crios/")&&!e.includes("android")}function Yr(n=x()){return/crios\//i.test(n)}function Qr(n=x()){return/iemobile/i.test(n)}function Jr(n=x()){return/android/i.test(n)}function Xr(n=x()){return/blackberry/i.test(n)}function Zr(n=x()){return/webos/i.test(n)}function Ai(n=x()){return/iphone|ipad|ipod/i.test(n)||/macintosh/i.test(n)&&/mobile/i.test(n)}function Qc(n=x()){var e;return Ai(n)&&!!(!((e=window.navigator)===null||e===void 0)&&e.standalone)}function Jc(){return ol()&&document.documentMode===10}function eo(n=x()){return Ai(n)||Jr(n)||Zr(n)||Xr(n)||/windows phone/i.test(n)||Qr(n)}/**
856
856
  * @license
857
857
  * Copyright 2020 Google LLC
858
858
  *
@@ -882,7 +882,7 @@ import{a as vi}from"./tslib.es6-De9GV7Vy.js";import{u as Wa,a as Ba,b as Ha,d as
882
882
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
883
883
  * See the License for the specific language governing permissions and
884
884
  * limitations under the License.
885
- */class Jc{constructor(e){this.auth=e,this.queue=[]}pushCallback(e,t){const i=r=>new Promise((o,a)=>{try{const l=e(r);o(l)}catch(l){a(l)}});i.onAbort=t,this.queue.push(i);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 i of this.queue)await i(e),i.onAbort&&t.push(i.onAbort)}catch(i){t.reverse();for(const s of t)try{s()}catch{}throw this.auth._errorFactory.create("login-blocked",{originalMessage:i==null?void 0:i.message})}}}/**
885
+ */class Xc{constructor(e){this.auth=e,this.queue=[]}pushCallback(e,t){const i=r=>new Promise((o,a)=>{try{const l=e(r);o(l)}catch(l){a(l)}});i.onAbort=t,this.queue.push(i);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 i of this.queue)await i(e),i.onAbort&&t.push(i.onAbort)}catch(i){t.reverse();for(const s of t)try{s()}catch{}throw this.auth._errorFactory.create("login-blocked",{originalMessage:i==null?void 0:i.message})}}}/**
886
886
  * @license
887
887
  * Copyright 2023 Google LLC
888
888
  *
@@ -897,7 +897,7 @@ import{a as vi}from"./tslib.es6-De9GV7Vy.js";import{u as Wa,a as Ba,b as Ha,d as
897
897
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
898
898
  * See the License for the specific language governing permissions and
899
899
  * limitations under the License.
900
- */async function Xc(n,e={}){return we(n,"GET","/v2/passwordPolicy",Le(n,e))}/**
900
+ */async function Zc(n,e={}){return we(n,"GET","/v2/passwordPolicy",Me(n,e))}/**
901
901
  * @license
902
902
  * Copyright 2023 Google LLC
903
903
  *
@@ -912,7 +912,7 @@ import{a as vi}from"./tslib.es6-De9GV7Vy.js";import{u as Wa,a as Ba,b as Ha,d as
912
912
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
913
913
  * See the License for the specific language governing permissions and
914
914
  * limitations under the License.
915
- */const Zc=6;class eh{constructor(e){var t,i,s,r;const o=e.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=(t=o.minPasswordLength)!==null&&t!==void 0?t:Zc,o.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=o.maxPasswordLength),o.containsLowercaseCharacter!==void 0&&(this.customStrengthOptions.containsLowercaseLetter=o.containsLowercaseCharacter),o.containsUppercaseCharacter!==void 0&&(this.customStrengthOptions.containsUppercaseLetter=o.containsUppercaseCharacter),o.containsNumericCharacter!==void 0&&(this.customStrengthOptions.containsNumericCharacter=o.containsNumericCharacter),o.containsNonAlphanumericCharacter!==void 0&&(this.customStrengthOptions.containsNonAlphanumericCharacter=o.containsNonAlphanumericCharacter),this.enforcementState=e.enforcementState,this.enforcementState==="ENFORCEMENT_STATE_UNSPECIFIED"&&(this.enforcementState="OFF"),this.allowedNonAlphanumericCharacters=(s=(i=e.allowedNonAlphanumericCharacters)===null||i===void 0?void 0:i.join(""))!==null&&s!==void 0?s:"",this.forceUpgradeOnSignin=(r=e.forceUpgradeOnSignin)!==null&&r!==void 0?r:!1,this.schemaVersion=e.schemaVersion}validatePassword(e){var t,i,s,r,o,a;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=(i=l.meetsMaxPasswordLength)!==null&&i!==void 0?i:!0),l.isValid&&(l.isValid=(s=l.containsLowercaseLetter)!==null&&s!==void 0?s:!0),l.isValid&&(l.isValid=(r=l.containsUppercaseLetter)!==null&&r!==void 0?r:!0),l.isValid&&(l.isValid=(o=l.containsNumericCharacter)!==null&&o!==void 0?o:!0),l.isValid&&(l.isValid=(a=l.containsNonAlphanumericCharacter)!==null&&a!==void 0?a:!0),l}validatePasswordLengthOptions(e,t){const i=this.customStrengthOptions.minPasswordLength,s=this.customStrengthOptions.maxPasswordLength;i&&(t.meetsMinPasswordLength=e.length>=i),s&&(t.meetsMaxPasswordLength=e.length<=s)}validatePasswordCharacterOptions(e,t){this.updatePasswordCharacterOptionsStatuses(t,!1,!1,!1,!1);let i;for(let s=0;s<e.length;s++)i=e.charAt(s),this.updatePasswordCharacterOptionsStatuses(t,i>="a"&&i<="z",i>="A"&&i<="Z",i>="0"&&i<="9",this.allowedNonAlphanumericCharacters.includes(i))}updatePasswordCharacterOptionsStatuses(e,t,i,s,r){this.customStrengthOptions.containsLowercaseLetter&&(e.containsLowercaseLetter||(e.containsLowercaseLetter=t)),this.customStrengthOptions.containsUppercaseLetter&&(e.containsUppercaseLetter||(e.containsUppercaseLetter=i)),this.customStrengthOptions.containsNumericCharacter&&(e.containsNumericCharacter||(e.containsNumericCharacter=s)),this.customStrengthOptions.containsNonAlphanumericCharacter&&(e.containsNonAlphanumericCharacter||(e.containsNonAlphanumericCharacter=r))}}/**
915
+ */const eh=6;class th{constructor(e){var t,i,s,r;const o=e.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=(t=o.minPasswordLength)!==null&&t!==void 0?t:eh,o.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=o.maxPasswordLength),o.containsLowercaseCharacter!==void 0&&(this.customStrengthOptions.containsLowercaseLetter=o.containsLowercaseCharacter),o.containsUppercaseCharacter!==void 0&&(this.customStrengthOptions.containsUppercaseLetter=o.containsUppercaseCharacter),o.containsNumericCharacter!==void 0&&(this.customStrengthOptions.containsNumericCharacter=o.containsNumericCharacter),o.containsNonAlphanumericCharacter!==void 0&&(this.customStrengthOptions.containsNonAlphanumericCharacter=o.containsNonAlphanumericCharacter),this.enforcementState=e.enforcementState,this.enforcementState==="ENFORCEMENT_STATE_UNSPECIFIED"&&(this.enforcementState="OFF"),this.allowedNonAlphanumericCharacters=(s=(i=e.allowedNonAlphanumericCharacters)===null||i===void 0?void 0:i.join(""))!==null&&s!==void 0?s:"",this.forceUpgradeOnSignin=(r=e.forceUpgradeOnSignin)!==null&&r!==void 0?r:!1,this.schemaVersion=e.schemaVersion}validatePassword(e){var t,i,s,r,o,a;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=(i=l.meetsMaxPasswordLength)!==null&&i!==void 0?i:!0),l.isValid&&(l.isValid=(s=l.containsLowercaseLetter)!==null&&s!==void 0?s:!0),l.isValid&&(l.isValid=(r=l.containsUppercaseLetter)!==null&&r!==void 0?r:!0),l.isValid&&(l.isValid=(o=l.containsNumericCharacter)!==null&&o!==void 0?o:!0),l.isValid&&(l.isValid=(a=l.containsNonAlphanumericCharacter)!==null&&a!==void 0?a:!0),l}validatePasswordLengthOptions(e,t){const i=this.customStrengthOptions.minPasswordLength,s=this.customStrengthOptions.maxPasswordLength;i&&(t.meetsMinPasswordLength=e.length>=i),s&&(t.meetsMaxPasswordLength=e.length<=s)}validatePasswordCharacterOptions(e,t){this.updatePasswordCharacterOptionsStatuses(t,!1,!1,!1,!1);let i;for(let s=0;s<e.length;s++)i=e.charAt(s),this.updatePasswordCharacterOptionsStatuses(t,i>="a"&&i<="z",i>="A"&&i<="Z",i>="0"&&i<="9",this.allowedNonAlphanumericCharacters.includes(i))}updatePasswordCharacterOptionsStatuses(e,t,i,s,r){this.customStrengthOptions.containsLowercaseLetter&&(e.containsLowercaseLetter||(e.containsLowercaseLetter=t)),this.customStrengthOptions.containsUppercaseLetter&&(e.containsUppercaseLetter||(e.containsUppercaseLetter=i)),this.customStrengthOptions.containsNumericCharacter&&(e.containsNumericCharacter||(e.containsNumericCharacter=s)),this.customStrengthOptions.containsNonAlphanumericCharacter&&(e.containsNonAlphanumericCharacter||(e.containsNonAlphanumericCharacter=r))}}/**
916
916
  * @license
917
917
  * Copyright 2020 Google LLC
918
918
  *
@@ -927,7 +927,7 @@ import{a as vi}from"./tslib.es6-De9GV7Vy.js";import{u as Wa,a as Ba,b as Ha,d as
927
927
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
928
928
  * See the License for the specific language governing permissions and
929
929
  * limitations under the License.
930
- */class th{constructor(e,t,i,s){this.app=e,this.heartbeatServiceProvider=t,this.appCheckServiceProvider=i,this.config=s,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new Rs(this),this.idTokenSubscription=new Rs(this),this.beforeStateQueue=new Jc(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=Br,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(r=>this._resolvePersistenceManagerAvailable=r)}_initializeWithPersistence(e,t){return t&&(this._popupRedirectResolver=ee(t)),this._initializationPromise=this.queue(async()=>{var i,s,r;if(!this._deleted&&(this.persistenceManager=await $e.create(this,e),(i=this._resolvePersistenceManagerAvailable)===null||i===void 0||i.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=((r=this.currentUser)===null||r===void 0?void 0:r.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 nn(this,{idToken:e}),i=await z._fromGetAccountInfoResponse(this,t,e);await this.directlySetCurrentUser(i)}catch(t){console.warn("FirebaseServerApp could not login user with provided authIdToken: ",t),await this.directlySetCurrentUser(null)}}async initializeCurrentUser(e){var t;if(G(this.app)){const o=this.app.settings.authIdToken;return o?new Promise(a=>{setTimeout(()=>this.initializeCurrentUserFromIdToken(o).then(a,a))}):this.directlySetCurrentUser(null)}const i=await this.assertedPersistence.getCurrentUser();let s=i,r=!1;if(e&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();const o=(t=this.redirectUser)===null||t===void 0?void 0:t._redirectEventId,a=s==null?void 0:s._redirectEventId,l=await this.tryRedirectSignIn(e);(!o||o===a)&&(l!=null&&l.user)&&(s=l.user,r=!0)}if(!s)return this.directlySetCurrentUser(null);if(!s._redirectEventId){if(r)try{await this.beforeStateQueue.runMiddleware(s)}catch(o){s=i,this._popupRedirectResolver._overrideRedirectResult(this,()=>Promise.reject(o))}return s?this.reloadAndSetCurrentUserOrClear(s):this.directlySetCurrentUser(null)}return g(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 sn(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=Dc()}async _delete(){this._deleted=!0}async updateCurrentUser(e){if(G(this.app))return Promise.reject(ge(this));const t=e?F(e):null;return t&&g(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&&g(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 G(this.app)?Promise.reject(ge(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(e){return G(this.app)?Promise.reject(ge(this)):this.queue(async()=>{await this.assertedPersistence.setPersistence(ee(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 Xc(this),t=new eh(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 Ot("auth","Firebase",e())}onAuthStateChanged(e,t,i){return this.registerStateListener(this.authStateSubscription,e,t,i)}beforeAuthStateChanged(e,t){return this.beforeStateQueue.pushCallback(e,t)}onIdTokenChanged(e,t,i){return this.registerStateListener(this.idTokenSubscription,e,t,i)}authStateReady(){return new Promise((e,t)=>{if(this.currentUser)e();else{const i=this.onAuthStateChanged(()=>{i(),e()},t)}})}async revokeAccessToken(e){if(this.currentUser){const t=await this.currentUser.getIdToken(),i={providerId:"apple.com",tokenType:"ACCESS_TOKEN",token:e,idToken:t};this.tenantId!=null&&(i.tenantId=this.tenantId),await Kc(this,i)}}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 i=await this.getOrInitRedirectPersistenceManager(t);return e===null?i.removeCurrentUser():i.setCurrentUser(e)}async getOrInitRedirectPersistenceManager(e){if(!this.redirectPersistenceManager){const t=e&&ee(e)||this._popupRedirectResolver;g(t,this,"argument-error"),this.redirectPersistenceManager=await $e.create(this,[ee(t._redirectPersistence)],"redirectUser"),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager}async _redirectUserForId(e){var t,i;return this._isInitialized&&await this.queue(async()=>{}),((t=this._currentUser)===null||t===void 0?void 0:t._redirectEventId)===e?this._currentUser:((i=this.redirectUser)===null||i===void 0?void 0:i._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 i=(t=(e=this.currentUser)===null||e===void 0?void 0:e.uid)!==null&&t!==void 0?t:null;this.lastNotifiedUid!==i&&(this.lastNotifiedUid=i,this.authStateSubscription.next(this.currentUser))}registerStateListener(e,t,i,s){if(this._deleted)return()=>{};const r=typeof t=="function"?t:t.next.bind(t);let o=!1;const a=this._isInitialized?Promise.resolve():this._initializationPromise;if(g(a,this,"internal-error"),a.then(()=>{o||r(this.currentUser)}),typeof t=="function"){const l=e.addObserver(t,i,s);return()=>{o=!0,l()}}else{const l=e.addObserver(t);return()=>{o=!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 g(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(e){!e||this.frameworks.includes(e)||(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=to(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 i=await((e=this.heartbeatServiceProvider.getImmediate({optional:!0}))===null||e===void 0?void 0:e.getHeartbeatsHeader());i&&(t["X-Firebase-Client"]=i);const s=await this._getAppCheckToken();return s&&(t["X-Firebase-AppCheck"]=s),t}async _getAppCheckToken(){var e;if(G(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&&Nc(`Error while retrieving App Check token: ${t.error}`),t==null?void 0:t.token}}function it(n){return F(n)}class Rs{constructor(e){this.auth=e,this.observer=null,this.addObserver=_l(t=>this.observer=t)}get next(){return g(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}/**
930
+ */class nh{constructor(e,t,i,s){this.app=e,this.heartbeatServiceProvider=t,this.appCheckServiceProvider=i,this.config=s,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new Rs(this),this.idTokenSubscription=new Rs(this),this.beforeStateQueue=new Xc(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=Br,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(r=>this._resolvePersistenceManagerAvailable=r)}_initializeWithPersistence(e,t){return t&&(this._popupRedirectResolver=ee(t)),this._initializationPromise=this.queue(async()=>{var i,s,r;if(!this._deleted&&(this.persistenceManager=await $e.create(this,e),(i=this._resolvePersistenceManagerAvailable)===null||i===void 0||i.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=((r=this.currentUser)===null||r===void 0?void 0:r.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 nn(this,{idToken:e}),i=await z._fromGetAccountInfoResponse(this,t,e);await this.directlySetCurrentUser(i)}catch(t){console.warn("FirebaseServerApp could not login user with provided authIdToken: ",t),await this.directlySetCurrentUser(null)}}async initializeCurrentUser(e){var t;if(G(this.app)){const o=this.app.settings.authIdToken;return o?new Promise(a=>{setTimeout(()=>this.initializeCurrentUserFromIdToken(o).then(a,a))}):this.directlySetCurrentUser(null)}const i=await this.assertedPersistence.getCurrentUser();let s=i,r=!1;if(e&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();const o=(t=this.redirectUser)===null||t===void 0?void 0:t._redirectEventId,a=s==null?void 0:s._redirectEventId,l=await this.tryRedirectSignIn(e);(!o||o===a)&&(l!=null&&l.user)&&(s=l.user,r=!0)}if(!s)return this.directlySetCurrentUser(null);if(!s._redirectEventId){if(r)try{await this.beforeStateQueue.runMiddleware(s)}catch(o){s=i,this._popupRedirectResolver._overrideRedirectResult(this,()=>Promise.reject(o))}return s?this.reloadAndSetCurrentUserOrClear(s):this.directlySetCurrentUser(null)}return g(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 sn(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=Mc()}async _delete(){this._deleted=!0}async updateCurrentUser(e){if(G(this.app))return Promise.reject(ge(this));const t=e?F(e):null;return t&&g(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&&g(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 G(this.app)?Promise.reject(ge(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(e){return G(this.app)?Promise.reject(ge(this)):this.queue(async()=>{await this.assertedPersistence.setPersistence(ee(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 Zc(this),t=new th(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 Ot("auth","Firebase",e())}onAuthStateChanged(e,t,i){return this.registerStateListener(this.authStateSubscription,e,t,i)}beforeAuthStateChanged(e,t){return this.beforeStateQueue.pushCallback(e,t)}onIdTokenChanged(e,t,i){return this.registerStateListener(this.idTokenSubscription,e,t,i)}authStateReady(){return new Promise((e,t)=>{if(this.currentUser)e();else{const i=this.onAuthStateChanged(()=>{i(),e()},t)}})}async revokeAccessToken(e){if(this.currentUser){const t=await this.currentUser.getIdToken(),i={providerId:"apple.com",tokenType:"ACCESS_TOKEN",token:e,idToken:t};this.tenantId!=null&&(i.tenantId=this.tenantId),await Yc(this,i)}}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 i=await this.getOrInitRedirectPersistenceManager(t);return e===null?i.removeCurrentUser():i.setCurrentUser(e)}async getOrInitRedirectPersistenceManager(e){if(!this.redirectPersistenceManager){const t=e&&ee(e)||this._popupRedirectResolver;g(t,this,"argument-error"),this.redirectPersistenceManager=await $e.create(this,[ee(t._redirectPersistence)],"redirectUser"),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager}async _redirectUserForId(e){var t,i;return this._isInitialized&&await this.queue(async()=>{}),((t=this._currentUser)===null||t===void 0?void 0:t._redirectEventId)===e?this._currentUser:((i=this.redirectUser)===null||i===void 0?void 0:i._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 i=(t=(e=this.currentUser)===null||e===void 0?void 0:e.uid)!==null&&t!==void 0?t:null;this.lastNotifiedUid!==i&&(this.lastNotifiedUid=i,this.authStateSubscription.next(this.currentUser))}registerStateListener(e,t,i,s){if(this._deleted)return()=>{};const r=typeof t=="function"?t:t.next.bind(t);let o=!1;const a=this._isInitialized?Promise.resolve():this._initializationPromise;if(g(a,this,"internal-error"),a.then(()=>{o||r(this.currentUser)}),typeof t=="function"){const l=e.addObserver(t,i,s);return()=>{o=!0,l()}}else{const l=e.addObserver(t);return()=>{o=!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 g(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(e){!e||this.frameworks.includes(e)||(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=to(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 i=await((e=this.heartbeatServiceProvider.getImmediate({optional:!0}))===null||e===void 0?void 0:e.getHeartbeatsHeader());i&&(t["X-Firebase-Client"]=i);const s=await this._getAppCheckToken();return s&&(t["X-Firebase-AppCheck"]=s),t}async _getAppCheckToken(){var e;if(G(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&&Pc(`Error while retrieving App Check token: ${t.error}`),t==null?void 0:t.token}}function it(n){return F(n)}class Rs{constructor(e){this.auth=e,this.observer=null,this.addObserver=gl(t=>this.observer=t)}get next(){return g(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}/**
931
931
  * @license
932
932
  * Copyright 2020 Google LLC
933
933
  *
@@ -942,7 +942,7 @@ import{a as vi}from"./tslib.es6-De9GV7Vy.js";import{u as Wa,a as Ba,b as Ha,d as
942
942
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
943
943
  * See the License for the specific language governing permissions and
944
944
  * limitations under the License.
945
- */let Cn={async loadJS(){throw new Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function nh(n){Cn=n}function no(n){return Cn.loadJS(n)}function ih(){return Cn.recaptchaEnterpriseScript}function sh(){return Cn.gapiScript}function rh(n){return`__${n}${Math.floor(Math.random()*1e6)}`}class oh{constructor(){this.enterprise=new ah}ready(e){e()}execute(e,t){return Promise.resolve("token")}render(e,t){return""}}class ah{ready(e){e()}execute(e,t){return Promise.resolve("token")}render(e,t){return""}}const lh="recaptcha-enterprise",io="NO_RECAPTCHA";class ch{constructor(e){this.type=lh,this.auth=it(e)}async verify(e="verify",t=!1){async function i(r){if(!t){if(r.tenantId==null&&r._agentRecaptchaConfig!=null)return r._agentRecaptchaConfig.siteKey;if(r.tenantId!=null&&r._tenantRecaptchaConfigs[r.tenantId]!==void 0)return r._tenantRecaptchaConfigs[r.tenantId].siteKey}return new Promise(async(o,a)=>{Bc(r,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}).then(l=>{if(l.recaptchaKey===void 0)a(new Error("recaptcha Enterprise site key undefined"));else{const c=new Wc(l);return r.tenantId==null?r._agentRecaptchaConfig=c:r._tenantRecaptchaConfigs[r.tenantId]=c,o(c.siteKey)}}).catch(l=>{a(l)})})}function s(r,o,a){const l=window.grecaptcha;ws(l)?l.enterprise.ready(()=>{l.enterprise.execute(r,{action:e}).then(c=>{o(c)}).catch(()=>{o(io)})}):a(Error("No reCAPTCHA enterprise script loaded."))}return this.auth.settings.appVerificationDisabledForTesting?new oh().execute("siteKey",{action:"verify"}):new Promise((r,o)=>{i(this.auth).then(a=>{if(!t&&ws(window.grecaptcha))s(a,r,o);else{if(typeof window>"u"){o(new Error("RecaptchaVerifier is only supported in browser"));return}let l=ih();l.length!==0&&(l+=a),no(l).then(()=>{s(a,r,o)}).catch(c=>{o(c)})}}).catch(a=>{o(a)})})}}async function As(n,e,t,i=!1,s=!1){const r=new ch(n);let o;if(s)o=io;else try{o=await r.verify(t)}catch{o=await r.verify(t,!0)}const a=Object.assign({},e);if(t==="mfaSmsEnrollment"||t==="mfaSmsSignIn"){if("phoneEnrollmentInfo"in a){const l=a.phoneEnrollmentInfo.phoneNumber,c=a.phoneEnrollmentInfo.recaptchaToken;Object.assign(a,{phoneEnrollmentInfo:{phoneNumber:l,recaptchaToken:c,captchaResponse:o,clientType:"CLIENT_TYPE_WEB",recaptchaVersion:"RECAPTCHA_ENTERPRISE"}})}else if("phoneSignInInfo"in a){const l=a.phoneSignInInfo.recaptchaToken;Object.assign(a,{phoneSignInInfo:{recaptchaToken:l,captchaResponse:o,clientType:"CLIENT_TYPE_WEB",recaptchaVersion:"RECAPTCHA_ENTERPRISE"}})}return a}return i?Object.assign(a,{captchaResp:o}):Object.assign(a,{captchaResponse:o}),Object.assign(a,{clientType:"CLIENT_TYPE_WEB"}),Object.assign(a,{recaptchaVersion:"RECAPTCHA_ENTERPRISE"}),a}async function ks(n,e,t,i,s){var r;if(!((r=n._getRecaptchaConfig())===null||r===void 0)&&r.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")){const o=await As(n,e,t,t==="getOobCode");return i(n,o)}else return i(n,e).catch(async o=>{if(o.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 a=await As(n,e,t,t==="getOobCode");return i(n,a)}else return Promise.reject(o)})}/**
945
+ */let Cn={async loadJS(){throw new Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function ih(n){Cn=n}function no(n){return Cn.loadJS(n)}function sh(){return Cn.recaptchaEnterpriseScript}function rh(){return Cn.gapiScript}function oh(n){return`__${n}${Math.floor(Math.random()*1e6)}`}class ah{constructor(){this.enterprise=new lh}ready(e){e()}execute(e,t){return Promise.resolve("token")}render(e,t){return""}}class lh{ready(e){e()}execute(e,t){return Promise.resolve("token")}render(e,t){return""}}const ch="recaptcha-enterprise",io="NO_RECAPTCHA";class hh{constructor(e){this.type=ch,this.auth=it(e)}async verify(e="verify",t=!1){async function i(r){if(!t){if(r.tenantId==null&&r._agentRecaptchaConfig!=null)return r._agentRecaptchaConfig.siteKey;if(r.tenantId!=null&&r._tenantRecaptchaConfigs[r.tenantId]!==void 0)return r._tenantRecaptchaConfigs[r.tenantId].siteKey}return new Promise(async(o,a)=>{Hc(r,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}).then(l=>{if(l.recaptchaKey===void 0)a(new Error("recaptcha Enterprise site key undefined"));else{const c=new Bc(l);return r.tenantId==null?r._agentRecaptchaConfig=c:r._tenantRecaptchaConfigs[r.tenantId]=c,o(c.siteKey)}}).catch(l=>{a(l)})})}function s(r,o,a){const l=window.grecaptcha;ws(l)?l.enterprise.ready(()=>{l.enterprise.execute(r,{action:e}).then(c=>{o(c)}).catch(()=>{o(io)})}):a(Error("No reCAPTCHA enterprise script loaded."))}return this.auth.settings.appVerificationDisabledForTesting?new ah().execute("siteKey",{action:"verify"}):new Promise((r,o)=>{i(this.auth).then(a=>{if(!t&&ws(window.grecaptcha))s(a,r,o);else{if(typeof window>"u"){o(new Error("RecaptchaVerifier is only supported in browser"));return}let l=sh();l.length!==0&&(l+=a),no(l).then(()=>{s(a,r,o)}).catch(c=>{o(c)})}}).catch(a=>{o(a)})})}}async function ks(n,e,t,i=!1,s=!1){const r=new hh(n);let o;if(s)o=io;else try{o=await r.verify(t)}catch{o=await r.verify(t,!0)}const a=Object.assign({},e);if(t==="mfaSmsEnrollment"||t==="mfaSmsSignIn"){if("phoneEnrollmentInfo"in a){const l=a.phoneEnrollmentInfo.phoneNumber,c=a.phoneEnrollmentInfo.recaptchaToken;Object.assign(a,{phoneEnrollmentInfo:{phoneNumber:l,recaptchaToken:c,captchaResponse:o,clientType:"CLIENT_TYPE_WEB",recaptchaVersion:"RECAPTCHA_ENTERPRISE"}})}else if("phoneSignInInfo"in a){const l=a.phoneSignInInfo.recaptchaToken;Object.assign(a,{phoneSignInInfo:{recaptchaToken:l,captchaResponse:o,clientType:"CLIENT_TYPE_WEB",recaptchaVersion:"RECAPTCHA_ENTERPRISE"}})}return a}return i?Object.assign(a,{captchaResp:o}):Object.assign(a,{captchaResponse:o}),Object.assign(a,{clientType:"CLIENT_TYPE_WEB"}),Object.assign(a,{recaptchaVersion:"RECAPTCHA_ENTERPRISE"}),a}async function As(n,e,t,i,s){var r;if(!((r=n._getRecaptchaConfig())===null||r===void 0)&&r.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")){const o=await ks(n,e,t,t==="getOobCode");return i(n,o)}else return i(n,e).catch(async o=>{if(o.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 a=await ks(n,e,t,t==="getOobCode");return i(n,a)}else return Promise.reject(o)})}/**
946
946
  * @license
947
947
  * Copyright 2020 Google LLC
948
948
  *
@@ -957,7 +957,7 @@ import{a as vi}from"./tslib.es6-De9GV7Vy.js";import{u as Wa,a as Ba,b as Ha,d as
957
957
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
958
958
  * See the License for the specific language governing permissions and
959
959
  * limitations under the License.
960
- */function hh(n,e){const t=Si(n,"auth");if(t.isInitialized()){const s=t.getImmediate(),r=t.getOptions();if(ke(r,e??{}))return s;Q(s,"already-initialized")}return t.initialize({options:e})}function uh(n,e){const t=(e==null?void 0:e.persistence)||[],i=(Array.isArray(t)?t:[t]).map(ee);e!=null&&e.errorMap&&n._updateErrorMap(e.errorMap),n._initializeWithPersistence(i,e==null?void 0:e.popupRedirectResolver)}function dh(n,e,t){const i=it(n);g(/^https?:\/\//.test(e),i,"invalid-emulator-scheme");const s=!1,r=so(e),{host:o,port:a}=fh(e),l=a===null?"":`:${a}`,c={url:`${r}//${o}${l}/`},d=Object.freeze({host:o,port:a,protocol:r.replace(":",""),options:Object.freeze({disableWarnings:s})});if(!i._canInitEmulator){g(i.config.emulator&&i.emulatorConfig,i,"emulator-config-failed"),g(ke(c,i.config.emulator)&&ke(d,i.emulatorConfig),i,"emulator-config-failed");return}i.config.emulator=c,i.emulatorConfig=d,i.settings.appVerificationDisabledForTesting=!0,et(o)?(Ar(`${r}//${o}${l}`),kr("Auth",!0)):ph()}function so(n){const e=n.indexOf(":");return e<0?"":n.substr(0,e+1)}function fh(n){const e=so(n),t=/(\/\/)?([^?#/]+)/.exec(n.substr(e.length));if(!t)return{host:"",port:null};const i=t[2].split("@").pop()||"",s=/^(\[[^\]]+\])(:|$)/.exec(i);if(s){const r=s[1];return{host:r,port:Ns(i.substr(r.length+1))}}else{const[r,o]=i.split(":");return{host:r,port:Ns(o)}}}function Ns(n){if(!n)return null;const e=Number(n);return isNaN(e)?null:e}function ph(){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())}/**
960
+ */function uh(n,e){const t=Si(n,"auth");if(t.isInitialized()){const s=t.getImmediate(),r=t.getOptions();if(ke(r,e??{}))return s;Q(s,"already-initialized")}return t.initialize({options:e})}function dh(n,e){const t=(e==null?void 0:e.persistence)||[],i=(Array.isArray(t)?t:[t]).map(ee);e!=null&&e.errorMap&&n._updateErrorMap(e.errorMap),n._initializeWithPersistence(i,e==null?void 0:e.popupRedirectResolver)}function fh(n,e,t){const i=it(n);g(/^https?:\/\//.test(e),i,"invalid-emulator-scheme");const s=!1,r=so(e),{host:o,port:a}=ph(e),l=a===null?"":`:${a}`,c={url:`${r}//${o}${l}/`},d=Object.freeze({host:o,port:a,protocol:r.replace(":",""),options:Object.freeze({disableWarnings:s})});if(!i._canInitEmulator){g(i.config.emulator&&i.emulatorConfig,i,"emulator-config-failed"),g(ke(c,i.config.emulator)&&ke(d,i.emulatorConfig),i,"emulator-config-failed");return}i.config.emulator=c,i.emulatorConfig=d,i.settings.appVerificationDisabledForTesting=!0,et(o)?(kr(`${r}//${o}${l}`),Ar("Auth",!0)):_h()}function so(n){const e=n.indexOf(":");return e<0?"":n.substr(0,e+1)}function ph(n){const e=so(n),t=/(\/\/)?([^?#/]+)/.exec(n.substr(e.length));if(!t)return{host:"",port:null};const i=t[2].split("@").pop()||"",s=/^(\[[^\]]+\])(:|$)/.exec(i);if(s){const r=s[1];return{host:r,port:Ns(i.substr(r.length+1))}}else{const[r,o]=i.split(":");return{host:r,port:Ns(o)}}}function Ns(n){if(!n)return null;const e=Number(n);return isNaN(e)?null:e}function _h(){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())}/**
961
961
  * @license
962
962
  * Copyright 2020 Google LLC
963
963
  *
@@ -972,7 +972,7 @@ import{a as vi}from"./tslib.es6-De9GV7Vy.js";import{u as Wa,a as Ba,b as Ha,d as
972
972
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
973
973
  * See the License for the specific language governing permissions and
974
974
  * limitations under the License.
975
- */class Ni{constructor(e,t){this.providerId=e,this.signInMethod=t}toJSON(){return Z("not implemented")}_getIdTokenResponse(e){return Z("not implemented")}_linkToIdToken(e,t){return Z("not implemented")}_getReauthenticationResolver(e){return Z("not implemented")}}async function _h(n,e){return we(n,"POST","/v1/accounts:signUp",e)}/**
975
+ */class Ni{constructor(e,t){this.providerId=e,this.signInMethod=t}toJSON(){return Z("not implemented")}_getIdTokenResponse(e){return Z("not implemented")}_linkToIdToken(e,t){return Z("not implemented")}_getReauthenticationResolver(e){return Z("not implemented")}}async function gh(n,e){return we(n,"POST","/v1/accounts:signUp",e)}/**
976
976
  * @license
977
977
  * Copyright 2020 Google LLC
978
978
  *
@@ -987,7 +987,7 @@ import{a as vi}from"./tslib.es6-De9GV7Vy.js";import{u as Wa,a as Ba,b as Ha,d as
987
987
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
988
988
  * See the License for the specific language governing permissions and
989
989
  * limitations under the License.
990
- */async function gh(n,e){return In(n,"POST","/v1/accounts:signInWithPassword",Le(n,e))}/**
990
+ */async function mh(n,e){return In(n,"POST","/v1/accounts:signInWithPassword",Me(n,e))}/**
991
991
  * @license
992
992
  * Copyright 2020 Google LLC
993
993
  *
@@ -1002,7 +1002,7 @@ import{a as vi}from"./tslib.es6-De9GV7Vy.js";import{u as Wa,a as Ba,b as Ha,d as
1002
1002
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1003
1003
  * See the License for the specific language governing permissions and
1004
1004
  * limitations under the License.
1005
- */async function mh(n,e){return In(n,"POST","/v1/accounts:signInWithEmailLink",Le(n,e))}async function vh(n,e){return In(n,"POST","/v1/accounts:signInWithEmailLink",Le(n,e))}/**
1005
+ */async function vh(n,e){return In(n,"POST","/v1/accounts:signInWithEmailLink",Me(n,e))}async function yh(n,e){return In(n,"POST","/v1/accounts:signInWithEmailLink",Me(n,e))}/**
1006
1006
  * @license
1007
1007
  * Copyright 2020 Google LLC
1008
1008
  *
@@ -1017,7 +1017,7 @@ import{a as vi}from"./tslib.es6-De9GV7Vy.js";import{u as Wa,a as Ba,b as Ha,d as
1017
1017
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1018
1018
  * See the License for the specific language governing permissions and
1019
1019
  * limitations under the License.
1020
- */class wt extends Ni{constructor(e,t,i,s=null){super("password",i),this._email=e,this._password=t,this._tenantId=s}static _fromEmailAndPassword(e,t){return new wt(e,t,"password")}static _fromEmailAndCode(e,t,i=null){return new wt(e,t,"emailLink",i)}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 ks(e,t,"signInWithPassword",gh);case"emailLink":return mh(e,{email:this._email,oobCode:this._password});default:Q(e,"internal-error")}}async _linkToIdToken(e,t){switch(this.signInMethod){case"password":const i={idToken:t,returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"};return ks(e,i,"signUpPassword",_h);case"emailLink":return vh(e,{idToken:t,email:this._email,oobCode:this._password});default:Q(e,"internal-error")}}_getReauthenticationResolver(e){return this._getIdTokenResponse(e)}}/**
1020
+ */class wt extends Ni{constructor(e,t,i,s=null){super("password",i),this._email=e,this._password=t,this._tenantId=s}static _fromEmailAndPassword(e,t){return new wt(e,t,"password")}static _fromEmailAndCode(e,t,i=null){return new wt(e,t,"emailLink",i)}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 As(e,t,"signInWithPassword",mh);case"emailLink":return vh(e,{email:this._email,oobCode:this._password});default:Q(e,"internal-error")}}async _linkToIdToken(e,t){switch(this.signInMethod){case"password":const i={idToken:t,returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"};return As(e,i,"signUpPassword",gh);case"emailLink":return yh(e,{idToken:t,email:this._email,oobCode:this._password});default:Q(e,"internal-error")}}_getReauthenticationResolver(e){return this._getIdTokenResponse(e)}}/**
1021
1021
  * @license
1022
1022
  * Copyright 2020 Google LLC
1023
1023
  *
@@ -1032,7 +1032,7 @@ import{a as vi}from"./tslib.es6-De9GV7Vy.js";import{u as Wa,a as Ba,b as Ha,d as
1032
1032
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1033
1033
  * See the License for the specific language governing permissions and
1034
1034
  * limitations under the License.
1035
- */async function Ge(n,e){return In(n,"POST","/v1/accounts:signInWithIdp",Le(n,e))}/**
1035
+ */async function Ge(n,e){return In(n,"POST","/v1/accounts:signInWithIdp",Me(n,e))}/**
1036
1036
  * @license
1037
1037
  * Copyright 2020 Google LLC
1038
1038
  *
@@ -1047,7 +1047,7 @@ import{a as vi}from"./tslib.es6-De9GV7Vy.js";import{u as Wa,a as Ba,b as Ha,d as
1047
1047
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1048
1048
  * See the License for the specific language governing permissions and
1049
1049
  * limitations under the License.
1050
- */const yh="http://localhost";class Pe extends Ni{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(e){const t=new Pe(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):Q("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:i,signInMethod:s}=t,r=vi(t,["providerId","signInMethod"]);if(!i||!s)return null;const o=new Pe(i,s);return o.idToken=r.idToken||void 0,o.accessToken=r.accessToken||void 0,o.secret=r.secret,o.nonce=r.nonce,o.pendingToken=r.pendingToken||null,o}_getIdTokenResponse(e){const t=this.buildRequest();return Ge(e,t)}_linkToIdToken(e,t){const i=this.buildRequest();return i.idToken=t,Ge(e,i)}_getReauthenticationResolver(e){const t=this.buildRequest();return t.autoCreate=!1,Ge(e,t)}buildRequest(){const e={requestUri:yh,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=tt(t)}return e}}/**
1050
+ */const Eh="http://localhost";class Ne extends Ni{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(e){const t=new Ne(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):Q("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:i,signInMethod:s}=t,r=vi(t,["providerId","signInMethod"]);if(!i||!s)return null;const o=new Ne(i,s);return o.idToken=r.idToken||void 0,o.accessToken=r.accessToken||void 0,o.secret=r.secret,o.nonce=r.nonce,o.pendingToken=r.pendingToken||null,o}_getIdTokenResponse(e){const t=this.buildRequest();return Ge(e,t)}_linkToIdToken(e,t){const i=this.buildRequest();return i.idToken=t,Ge(e,i)}_getReauthenticationResolver(e){const t=this.buildRequest();return t.autoCreate=!1,Ge(e,t)}buildRequest(){const e={requestUri:Eh,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=tt(t)}return e}}/**
1051
1051
  * @license
1052
1052
  * Copyright 2020 Google LLC
1053
1053
  *
@@ -1062,7 +1062,7 @@ import{a as vi}from"./tslib.es6-De9GV7Vy.js";import{u as Wa,a as Ba,b as Ha,d as
1062
1062
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1063
1063
  * See the License for the specific language governing permissions and
1064
1064
  * limitations under the License.
1065
- */function Eh(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 Ih(n){const e=ut(dt(n)).link,t=e?ut(dt(e)).deep_link_id:null,i=ut(dt(n)).deep_link_id;return(i?ut(dt(i)).link:null)||i||t||e||n}class Pi{constructor(e){var t,i,s,r,o,a;const l=ut(dt(e)),c=(t=l.apiKey)!==null&&t!==void 0?t:null,d=(i=l.oobCode)!==null&&i!==void 0?i:null,h=Eh((s=l.mode)!==null&&s!==void 0?s:null);g(c&&d&&h,"argument-error"),this.apiKey=c,this.operation=h,this.code=d,this.continueUrl=(r=l.continueUrl)!==null&&r!==void 0?r:null,this.languageCode=(o=l.lang)!==null&&o!==void 0?o:null,this.tenantId=(a=l.tenantId)!==null&&a!==void 0?a:null}static parseLink(e){const t=Ih(e);try{return new Pi(t)}catch{return null}}}/**
1065
+ */function Ih(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 Ch(n){const e=ut(dt(n)).link,t=e?ut(dt(e)).deep_link_id:null,i=ut(dt(n)).deep_link_id;return(i?ut(dt(i)).link:null)||i||t||e||n}class Pi{constructor(e){var t,i,s,r,o,a;const l=ut(dt(e)),c=(t=l.apiKey)!==null&&t!==void 0?t:null,d=(i=l.oobCode)!==null&&i!==void 0?i:null,h=Ih((s=l.mode)!==null&&s!==void 0?s:null);g(c&&d&&h,"argument-error"),this.apiKey=c,this.operation=h,this.code=d,this.continueUrl=(r=l.continueUrl)!==null&&r!==void 0?r:null,this.languageCode=(o=l.lang)!==null&&o!==void 0?o:null,this.tenantId=(a=l.tenantId)!==null&&a!==void 0?a:null}static parseLink(e){const t=Ch(e);try{return new Pi(t)}catch{return null}}}/**
1066
1066
  * @license
1067
1067
  * Copyright 2020 Google LLC
1068
1068
  *
@@ -1122,7 +1122,7 @@ import{a as vi}from"./tslib.es6-De9GV7Vy.js";import{u as Wa,a as Ba,b as Ha,d as
1122
1122
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1123
1123
  * See the License for the specific language governing permissions and
1124
1124
  * limitations under the License.
1125
- */class ce extends Mt{constructor(){super("facebook.com")}static credential(e){return Pe._fromParams({providerId:ce.PROVIDER_ID,signInMethod:ce.FACEBOOK_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return ce.credentialFromTaggedObject(e)}static credentialFromError(e){return ce.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return ce.credential(e.oauthAccessToken)}catch{return null}}}ce.FACEBOOK_SIGN_IN_METHOD="facebook.com";ce.PROVIDER_ID="facebook.com";/**
1125
+ */class ce extends Mt{constructor(){super("facebook.com")}static credential(e){return Ne._fromParams({providerId:ce.PROVIDER_ID,signInMethod:ce.FACEBOOK_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return ce.credentialFromTaggedObject(e)}static credentialFromError(e){return ce.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return ce.credential(e.oauthAccessToken)}catch{return null}}}ce.FACEBOOK_SIGN_IN_METHOD="facebook.com";ce.PROVIDER_ID="facebook.com";/**
1126
1126
  * @license
1127
1127
  * Copyright 2020 Google LLC
1128
1128
  *
@@ -1137,7 +1137,7 @@ import{a as vi}from"./tslib.es6-De9GV7Vy.js";import{u as Wa,a as Ba,b as Ha,d as
1137
1137
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1138
1138
  * See the License for the specific language governing permissions and
1139
1139
  * limitations under the License.
1140
- */class he extends Mt{constructor(){super("google.com"),this.addScope("profile")}static credential(e,t){return Pe._fromParams({providerId:he.PROVIDER_ID,signInMethod:he.GOOGLE_SIGN_IN_METHOD,idToken:e,accessToken:t})}static credentialFromResult(e){return he.credentialFromTaggedObject(e)}static credentialFromError(e){return he.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthIdToken:t,oauthAccessToken:i}=e;if(!t&&!i)return null;try{return he.credential(t,i)}catch{return null}}}he.GOOGLE_SIGN_IN_METHOD="google.com";he.PROVIDER_ID="google.com";/**
1140
+ */class he extends Mt{constructor(){super("google.com"),this.addScope("profile")}static credential(e,t){return Ne._fromParams({providerId:he.PROVIDER_ID,signInMethod:he.GOOGLE_SIGN_IN_METHOD,idToken:e,accessToken:t})}static credentialFromResult(e){return he.credentialFromTaggedObject(e)}static credentialFromError(e){return he.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthIdToken:t,oauthAccessToken:i}=e;if(!t&&!i)return null;try{return he.credential(t,i)}catch{return null}}}he.GOOGLE_SIGN_IN_METHOD="google.com";he.PROVIDER_ID="google.com";/**
1141
1141
  * @license
1142
1142
  * Copyright 2020 Google LLC
1143
1143
  *
@@ -1152,7 +1152,7 @@ import{a as vi}from"./tslib.es6-De9GV7Vy.js";import{u as Wa,a as Ba,b as Ha,d as
1152
1152
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1153
1153
  * See the License for the specific language governing permissions and
1154
1154
  * limitations under the License.
1155
- */class ue extends Mt{constructor(){super("github.com")}static credential(e){return Pe._fromParams({providerId:ue.PROVIDER_ID,signInMethod:ue.GITHUB_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return ue.credentialFromTaggedObject(e)}static credentialFromError(e){return ue.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return ue.credential(e.oauthAccessToken)}catch{return null}}}ue.GITHUB_SIGN_IN_METHOD="github.com";ue.PROVIDER_ID="github.com";/**
1155
+ */class ue extends Mt{constructor(){super("github.com")}static credential(e){return Ne._fromParams({providerId:ue.PROVIDER_ID,signInMethod:ue.GITHUB_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return ue.credentialFromTaggedObject(e)}static credentialFromError(e){return ue.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return ue.credential(e.oauthAccessToken)}catch{return null}}}ue.GITHUB_SIGN_IN_METHOD="github.com";ue.PROVIDER_ID="github.com";/**
1156
1156
  * @license
1157
1157
  * Copyright 2020 Google LLC
1158
1158
  *
@@ -1167,7 +1167,7 @@ import{a as vi}from"./tslib.es6-De9GV7Vy.js";import{u as Wa,a as Ba,b as Ha,d as
1167
1167
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1168
1168
  * See the License for the specific language governing permissions and
1169
1169
  * limitations under the License.
1170
- */class de extends Mt{constructor(){super("twitter.com")}static credential(e,t){return Pe._fromParams({providerId:de.PROVIDER_ID,signInMethod:de.TWITTER_SIGN_IN_METHOD,oauthToken:e,oauthTokenSecret:t})}static credentialFromResult(e){return de.credentialFromTaggedObject(e)}static credentialFromError(e){return de.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthAccessToken:t,oauthTokenSecret:i}=e;if(!t||!i)return null;try{return de.credential(t,i)}catch{return null}}}de.TWITTER_SIGN_IN_METHOD="twitter.com";de.PROVIDER_ID="twitter.com";/**
1170
+ */class de extends Mt{constructor(){super("twitter.com")}static credential(e,t){return Ne._fromParams({providerId:de.PROVIDER_ID,signInMethod:de.TWITTER_SIGN_IN_METHOD,oauthToken:e,oauthTokenSecret:t})}static credentialFromResult(e){return de.credentialFromTaggedObject(e)}static credentialFromError(e){return de.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthAccessToken:t,oauthTokenSecret:i}=e;if(!t||!i)return null;try{return de.credential(t,i)}catch{return null}}}de.TWITTER_SIGN_IN_METHOD="twitter.com";de.PROVIDER_ID="twitter.com";/**
1171
1171
  * @license
1172
1172
  * Copyright 2020 Google LLC
1173
1173
  *
@@ -1197,7 +1197,7 @@ import{a as vi}from"./tslib.es6-De9GV7Vy.js";import{u as Wa,a as Ba,b as Ha,d as
1197
1197
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1198
1198
  * See the License for the specific language governing permissions and
1199
1199
  * limitations under the License.
1200
- */class rn extends Ce{constructor(e,t,i,s){var r;super(t.code,t.message),this.operationType=i,this.user=s,Object.setPrototypeOf(this,rn.prototype),this.customData={appName:e.name,tenantId:(r=e.tenantId)!==null&&r!==void 0?r:void 0,_serverResponse:t.customData._serverResponse,operationType:i}}static _fromErrorAndOperation(e,t,i,s){return new rn(e,t,i,s)}}function oo(n,e,t,i){return(e==="reauthenticate"?t._getReauthenticationResolver(n):t._getIdTokenResponse(n)).catch(r=>{throw r.code==="auth/multi-factor-auth-required"?rn._fromErrorAndOperation(n,r,e,i):r})}async function Ch(n,e,t=!1){const i=await Ct(n,e._linkToIdToken(n.auth,await n.getIdToken()),t);return Ye._forOperation(n,"link",i)}/**
1200
+ */class rn extends Ce{constructor(e,t,i,s){var r;super(t.code,t.message),this.operationType=i,this.user=s,Object.setPrototypeOf(this,rn.prototype),this.customData={appName:e.name,tenantId:(r=e.tenantId)!==null&&r!==void 0?r:void 0,_serverResponse:t.customData._serverResponse,operationType:i}}static _fromErrorAndOperation(e,t,i,s){return new rn(e,t,i,s)}}function oo(n,e,t,i){return(e==="reauthenticate"?t._getReauthenticationResolver(n):t._getIdTokenResponse(n)).catch(r=>{throw r.code==="auth/multi-factor-auth-required"?rn._fromErrorAndOperation(n,r,e,i):r})}async function wh(n,e,t=!1){const i=await Ct(n,e._linkToIdToken(n.auth,await n.getIdToken()),t);return Ye._forOperation(n,"link",i)}/**
1201
1201
  * @license
1202
1202
  * Copyright 2019 Google LLC
1203
1203
  *
@@ -1212,7 +1212,7 @@ import{a as vi}from"./tslib.es6-De9GV7Vy.js";import{u as Wa,a as Ba,b as Ha,d as
1212
1212
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1213
1213
  * See the License for the specific language governing permissions and
1214
1214
  * limitations under the License.
1215
- */async function wh(n,e,t=!1){const{auth:i}=n;if(G(i.app))return Promise.reject(ge(i));const s="reauthenticate";try{const r=await Ct(n,oo(i,s,e,n),t);g(r.idToken,i,"internal-error");const o=Ai(r.idToken);g(o,i,"internal-error");const{sub:a}=o;return g(n.uid===a,i,"user-mismatch"),Ye._forOperation(n,s,r)}catch(r){throw(r==null?void 0:r.code)==="auth/user-not-found"&&Q(i,"user-mismatch"),r}}/**
1215
+ */async function Th(n,e,t=!1){const{auth:i}=n;if(G(i.app))return Promise.reject(ge(i));const s="reauthenticate";try{const r=await Ct(n,oo(i,s,e,n),t);g(r.idToken,i,"internal-error");const o=ki(r.idToken);g(o,i,"internal-error");const{sub:a}=o;return g(n.uid===a,i,"user-mismatch"),Ye._forOperation(n,s,r)}catch(r){throw(r==null?void 0:r.code)==="auth/user-not-found"&&Q(i,"user-mismatch"),r}}/**
1216
1216
  * @license
1217
1217
  * Copyright 2020 Google LLC
1218
1218
  *
@@ -1227,7 +1227,7 @@ import{a as vi}from"./tslib.es6-De9GV7Vy.js";import{u as Wa,a as Ba,b as Ha,d as
1227
1227
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1228
1228
  * See the License for the specific language governing permissions and
1229
1229
  * limitations under the License.
1230
- */async function ao(n,e,t=!1){if(G(n.app))return Promise.reject(ge(n));const i="signIn",s=await oo(n,i,e),r=await Ye._fromIdTokenResponse(n,i,s);return t||await n._updateCurrentUser(r.user),r}async function Th(n,e){return ao(it(n),e)}/**
1230
+ */async function ao(n,e,t=!1){if(G(n.app))return Promise.reject(ge(n));const i="signIn",s=await oo(n,i,e),r=await Ye._fromIdTokenResponse(n,i,s);return t||await n._updateCurrentUser(r.user),r}async function Sh(n,e){return ao(it(n),e)}/**
1231
1231
  * @license
1232
1232
  * Copyright 2020 Google LLC
1233
1233
  *
@@ -1242,7 +1242,7 @@ import{a as vi}from"./tslib.es6-De9GV7Vy.js";import{u as Wa,a as Ba,b as Ha,d as
1242
1242
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1243
1243
  * See the License for the specific language governing permissions and
1244
1244
  * limitations under the License.
1245
- */async function Sh(n){const e=it(n);e._getPasswordPolicyInternal()&&await e._updatePasswordPolicy()}function bh(n,e,t){return G(n.app)?Promise.reject(ge(n)):Th(F(n),st.credential(e,t)).catch(async i=>{throw i.code==="auth/password-does-not-meet-requirements"&&Sh(n),i})}/**
1245
+ */async function bh(n){const e=it(n);e._getPasswordPolicyInternal()&&await e._updatePasswordPolicy()}function Rh(n,e,t){return G(n.app)?Promise.reject(ge(n)):Sh(F(n),st.credential(e,t)).catch(async i=>{throw i.code==="auth/password-does-not-meet-requirements"&&bh(n),i})}/**
1246
1246
  * @license
1247
1247
  * Copyright 2020 Google LLC
1248
1248
  *
@@ -1257,7 +1257,7 @@ import{a as vi}from"./tslib.es6-De9GV7Vy.js";import{u as Wa,a as Ba,b as Ha,d as
1257
1257
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1258
1258
  * See the License for the specific language governing permissions and
1259
1259
  * limitations under the License.
1260
- */function Rh(n,e){return F(n).setPersistence(e)}function Ah(n,e,t,i){return F(n).onIdTokenChanged(e,t,i)}function kh(n,e,t){return F(n).beforeAuthStateChanged(e,t)}function o_(n,e,t,i){return F(n).onAuthStateChanged(e,t,i)}function Nh(n){return F(n).signOut()}const on="__sak";/**
1260
+ */function kh(n,e){return F(n).setPersistence(e)}function Ah(n,e,t,i){return F(n).onIdTokenChanged(e,t,i)}function Nh(n,e,t){return F(n).beforeAuthStateChanged(e,t)}function a_(n,e,t,i){return F(n).onAuthStateChanged(e,t,i)}function Ph(n){return F(n).signOut()}const on="__sak";/**
1261
1261
  * @license
1262
1262
  * Copyright 2019 Google LLC
1263
1263
  *
@@ -1287,7 +1287,7 @@ import{a as vi}from"./tslib.es6-De9GV7Vy.js";import{u as Wa,a as Ba,b as Ha,d as
1287
1287
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1288
1288
  * See the License for the specific language governing permissions and
1289
1289
  * limitations under the License.
1290
- */const Ph=1e3,Oh=10;class co extends lo{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(e,t)=>this.onStorageEvent(e,t),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=eo(),this._shouldAllowMigration=!0}forAllChangedKeys(e){for(const t of Object.keys(this.listeners)){const i=this.storage.getItem(t),s=this.localCache[t];i!==s&&e(t,s,i)}}onStorageEvent(e,t=!1){if(!e.key){this.forAllChangedKeys((o,a,l)=>{this.notifyListeners(o,l)});return}const i=e.key;t?this.detachListener():this.stopPolling();const s=()=>{const o=this.storage.getItem(i);!t&&this.localCache[i]===o||this.notifyListeners(i,o)},r=this.storage.getItem(i);Qc()&&r!==e.newValue&&e.newValue!==e.oldValue?setTimeout(s,Oh):s()}notifyListeners(e,t){this.localCache[e]=t;const i=this.listeners[e];if(i)for(const s of Array.from(i))s(t&&JSON.parse(t))}startPolling(){this.stopPolling(),this.pollTimer=setInterval(()=>{this.forAllChangedKeys((e,t,i)=>{this.onStorageEvent(new StorageEvent("storage",{key:e,oldValue:t,newValue:i}),!0)})},Ph)}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]}}co.type="LOCAL";const ho=co;/**
1290
+ */const Oh=1e3,Dh=10;class co extends lo{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(e,t)=>this.onStorageEvent(e,t),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=eo(),this._shouldAllowMigration=!0}forAllChangedKeys(e){for(const t of Object.keys(this.listeners)){const i=this.storage.getItem(t),s=this.localCache[t];i!==s&&e(t,s,i)}}onStorageEvent(e,t=!1){if(!e.key){this.forAllChangedKeys((o,a,l)=>{this.notifyListeners(o,l)});return}const i=e.key;t?this.detachListener():this.stopPolling();const s=()=>{const o=this.storage.getItem(i);!t&&this.localCache[i]===o||this.notifyListeners(i,o)},r=this.storage.getItem(i);Jc()&&r!==e.newValue&&e.newValue!==e.oldValue?setTimeout(s,Dh):s()}notifyListeners(e,t){this.localCache[e]=t;const i=this.listeners[e];if(i)for(const s of Array.from(i))s(t&&JSON.parse(t))}startPolling(){this.stopPolling(),this.pollTimer=setInterval(()=>{this.forAllChangedKeys((e,t,i)=>{this.onStorageEvent(new StorageEvent("storage",{key:e,oldValue:t,newValue:i}),!0)})},Oh)}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]}}co.type="LOCAL";const ho=co;/**
1291
1291
  * @license
1292
1292
  * Copyright 2020 Google LLC
1293
1293
  *
@@ -1317,7 +1317,7 @@ import{a as vi}from"./tslib.es6-De9GV7Vy.js";import{u as Wa,a as Ba,b as Ha,d as
1317
1317
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1318
1318
  * See the License for the specific language governing permissions and
1319
1319
  * limitations under the License.
1320
- */function Dh(n){return Promise.all(n.map(async e=>{try{return{fulfilled:!0,value:await e}}catch(t){return{fulfilled:!1,reason:t}}}))}/**
1320
+ */function Mh(n){return Promise.all(n.map(async e=>{try{return{fulfilled:!0,value:await e}}catch(t){return{fulfilled:!1,reason:t}}}))}/**
1321
1321
  * @license
1322
1322
  * Copyright 2019 Google LLC
1323
1323
  *
@@ -1332,7 +1332,7 @@ import{a as vi}from"./tslib.es6-De9GV7Vy.js";import{u as Wa,a as Ba,b as Ha,d as
1332
1332
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1333
1333
  * See the License for the specific language governing permissions and
1334
1334
  * limitations under the License.
1335
- */class wn{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 i=new wn(e);return this.receivers.push(i),i}isListeningto(e){return this.eventTarget===e}async handleEvent(e){const t=e,{eventId:i,eventType:s,data:r}=t.data,o=this.handlersMap[s];if(!(o!=null&&o.size))return;t.ports[0].postMessage({status:"ack",eventId:i,eventType:s});const a=Array.from(o).map(async c=>c(t.origin,r)),l=await Dh(a);t.ports[0].postMessage({status:"done",eventId:i,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)}}wn.receivers=[];/**
1335
+ */class wn{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 i=new wn(e);return this.receivers.push(i),i}isListeningto(e){return this.eventTarget===e}async handleEvent(e){const t=e,{eventId:i,eventType:s,data:r}=t.data,o=this.handlersMap[s];if(!(o!=null&&o.size))return;t.ports[0].postMessage({status:"ack",eventId:i,eventType:s});const a=Array.from(o).map(async c=>c(t.origin,r)),l=await Mh(a);t.ports[0].postMessage({status:"done",eventId:i,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)}}wn.receivers=[];/**
1336
1336
  * @license
1337
1337
  * Copyright 2020 Google LLC
1338
1338
  *
@@ -1362,7 +1362,7 @@ import{a as vi}from"./tslib.es6-De9GV7Vy.js";import{u as Wa,a as Ba,b as Ha,d as
1362
1362
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1363
1363
  * See the License for the specific language governing permissions and
1364
1364
  * limitations under the License.
1365
- */class Mh{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,i=50){const s=typeof MessageChannel<"u"?new MessageChannel:null;if(!s)throw new Error("connection_unavailable");let r,o;return new Promise((a,l)=>{const c=Oi("",20);s.port1.start();const d=setTimeout(()=>{l(new Error("unsupported_event"))},i);o={messageChannel:s,onMessage(h){const u=h;if(u.data.eventId===c)switch(u.data.status){case"ack":clearTimeout(d),r=setTimeout(()=>{l(new Error("timeout"))},3e3);break;case"done":clearTimeout(r),a(u.data.response);break;default:clearTimeout(d),clearTimeout(r),l(new Error("invalid_response"));break}}},this.handlers.add(o),s.port1.addEventListener("message",o.onMessage),this.target.postMessage({eventType:e,eventId:c,data:t},[s.port2])}).finally(()=>{o&&this.removeMessageHandler(o)})}}/**
1365
+ */class Lh{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,i=50){const s=typeof MessageChannel<"u"?new MessageChannel:null;if(!s)throw new Error("connection_unavailable");let r,o;return new Promise((a,l)=>{const c=Oi("",20);s.port1.start();const d=setTimeout(()=>{l(new Error("unsupported_event"))},i);o={messageChannel:s,onMessage(h){const u=h;if(u.data.eventId===c)switch(u.data.status){case"ack":clearTimeout(d),r=setTimeout(()=>{l(new Error("timeout"))},3e3);break;case"done":clearTimeout(r),a(u.data.response);break;default:clearTimeout(d),clearTimeout(r),l(new Error("invalid_response"));break}}},this.handlers.add(o),s.port1.addEventListener("message",o.onMessage),this.target.postMessage({eventType:e,eventId:c,data:t},[s.port2])}).finally(()=>{o&&this.removeMessageHandler(o)})}}/**
1366
1366
  * @license
1367
1367
  * Copyright 2020 Google LLC
1368
1368
  *
@@ -1377,7 +1377,7 @@ import{a as vi}from"./tslib.es6-De9GV7Vy.js";import{u as Wa,a as Ba,b as Ha,d as
1377
1377
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1378
1378
  * See the License for the specific language governing permissions and
1379
1379
  * limitations under the License.
1380
- */function X(){return window}function Lh(n){X().location.href=n}/**
1380
+ */function X(){return window}function xh(n){X().location.href=n}/**
1381
1381
  * @license
1382
1382
  * Copyright 2020 Google LLC.
1383
1383
  *
@@ -1392,7 +1392,7 @@ import{a as vi}from"./tslib.es6-De9GV7Vy.js";import{u as Wa,a as Ba,b as Ha,d as
1392
1392
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1393
1393
  * See the License for the specific language governing permissions and
1394
1394
  * limitations under the License.
1395
- */function po(){return typeof X().WorkerGlobalScope<"u"&&typeof X().importScripts=="function"}async function xh(){if(!(navigator!=null&&navigator.serviceWorker))return null;try{return(await navigator.serviceWorker.ready).active}catch{return null}}function Fh(){var n;return((n=navigator==null?void 0:navigator.serviceWorker)===null||n===void 0?void 0:n.controller)||null}function Uh(){return po()?self:null}/**
1395
+ */function po(){return typeof X().WorkerGlobalScope<"u"&&typeof X().importScripts=="function"}async function Fh(){if(!(navigator!=null&&navigator.serviceWorker))return null;try{return(await navigator.serviceWorker.ready).active}catch{return null}}function Uh(){var n;return((n=navigator==null?void 0:navigator.serviceWorker)===null||n===void 0?void 0:n.controller)||null}function Wh(){return po()?self:null}/**
1396
1396
  * @license
1397
1397
  * Copyright 2019 Google LLC
1398
1398
  *
@@ -1407,7 +1407,7 @@ import{a as vi}from"./tslib.es6-De9GV7Vy.js";import{u as Wa,a as Ba,b as Ha,d as
1407
1407
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1408
1408
  * See the License for the specific language governing permissions and
1409
1409
  * limitations under the License.
1410
- */const _o="firebaseLocalStorageDb",Wh=1,an="firebaseLocalStorage",go="fbase_key";class Lt{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 Tn(n,e){return n.transaction([an],e?"readwrite":"readonly").objectStore(an)}function Bh(){const n=indexedDB.deleteDatabase(_o);return new Lt(n).toPromise()}function ri(){const n=indexedDB.open(_o,Wh);return new Promise((e,t)=>{n.addEventListener("error",()=>{t(n.error)}),n.addEventListener("upgradeneeded",()=>{const i=n.result;try{i.createObjectStore(an,{keyPath:go})}catch(s){t(s)}}),n.addEventListener("success",async()=>{const i=n.result;i.objectStoreNames.contains(an)?e(i):(i.close(),await Bh(),e(await ri()))})})}async function Os(n,e,t){const i=Tn(n,!0).put({[go]:e,value:t});return new Lt(i).toPromise()}async function Hh(n,e){const t=Tn(n,!1).get(e),i=await new Lt(t).toPromise();return i===void 0?null:i.value}function Ds(n,e){const t=Tn(n,!0).delete(e);return new Lt(t).toPromise()}const Vh=800,$h=3;class mo{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 ri(),this.db)}async _withRetries(e){let t=0;for(;;)try{const i=await this._openDb();return await e(i)}catch(i){if(t++>$h)throw i;this.db&&(this.db.close(),this.db=void 0)}}async initializeServiceWorkerMessaging(){return po()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=wn._getInstance(Uh()),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 xh(),!this.activeServiceWorker)return;this.sender=new Mh(this.activeServiceWorker);const i=await this.sender._send("ping",{},800);i&&!((e=i[0])===null||e===void 0)&&e.fulfilled&&!((t=i[0])===null||t===void 0)&&t.value.includes("keyChanged")&&(this.serviceWorkerReceiverAvailable=!0)}async notifyServiceWorker(e){if(!(!this.sender||!this.activeServiceWorker||Fh()!==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 ri();return await Os(e,on,"1"),await Ds(e,on),!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(i=>Os(i,e,t)),this.localCache[e]=t,this.notifyServiceWorker(e)))}async _get(e){const t=await this._withRetries(i=>Hh(i,e));return this.localCache[e]=t,t}async _remove(e){return this._withPendingWrite(async()=>(await this._withRetries(t=>Ds(t,e)),delete this.localCache[e],this.notifyServiceWorker(e)))}async _poll(){const e=await this._withRetries(s=>{const r=Tn(s,!1).getAll();return new Lt(r).toPromise()});if(!e)return[];if(this.pendingWrites!==0)return[];const t=[],i=new Set;if(e.length!==0)for(const{fbase_key:s,value:r}of e)i.add(s),JSON.stringify(this.localCache[s])!==JSON.stringify(r)&&(this.notifyListeners(s,r),t.push(s));for(const s of Object.keys(this.localCache))this.localCache[s]&&!i.has(s)&&(this.notifyListeners(s,null),t.push(s));return t}notifyListeners(e,t){this.localCache[e]=t;const i=this.listeners[e];if(i)for(const s of Array.from(i))s(t)}startPolling(){this.stopPolling(),this.pollTimer=setInterval(async()=>this._poll(),Vh)}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()}}mo.type="LOCAL";const Gh=mo;new Dt(3e4,6e4);/**
1410
+ */const _o="firebaseLocalStorageDb",Bh=1,an="firebaseLocalStorage",go="fbase_key";class Lt{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 Tn(n,e){return n.transaction([an],e?"readwrite":"readonly").objectStore(an)}function Hh(){const n=indexedDB.deleteDatabase(_o);return new Lt(n).toPromise()}function ri(){const n=indexedDB.open(_o,Bh);return new Promise((e,t)=>{n.addEventListener("error",()=>{t(n.error)}),n.addEventListener("upgradeneeded",()=>{const i=n.result;try{i.createObjectStore(an,{keyPath:go})}catch(s){t(s)}}),n.addEventListener("success",async()=>{const i=n.result;i.objectStoreNames.contains(an)?e(i):(i.close(),await Hh(),e(await ri()))})})}async function Os(n,e,t){const i=Tn(n,!0).put({[go]:e,value:t});return new Lt(i).toPromise()}async function Vh(n,e){const t=Tn(n,!1).get(e),i=await new Lt(t).toPromise();return i===void 0?null:i.value}function Ds(n,e){const t=Tn(n,!0).delete(e);return new Lt(t).toPromise()}const $h=800,Gh=3;class mo{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 ri(),this.db)}async _withRetries(e){let t=0;for(;;)try{const i=await this._openDb();return await e(i)}catch(i){if(t++>Gh)throw i;this.db&&(this.db.close(),this.db=void 0)}}async initializeServiceWorkerMessaging(){return po()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=wn._getInstance(Wh()),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 Fh(),!this.activeServiceWorker)return;this.sender=new Lh(this.activeServiceWorker);const i=await this.sender._send("ping",{},800);i&&!((e=i[0])===null||e===void 0)&&e.fulfilled&&!((t=i[0])===null||t===void 0)&&t.value.includes("keyChanged")&&(this.serviceWorkerReceiverAvailable=!0)}async notifyServiceWorker(e){if(!(!this.sender||!this.activeServiceWorker||Uh()!==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 ri();return await Os(e,on,"1"),await Ds(e,on),!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(i=>Os(i,e,t)),this.localCache[e]=t,this.notifyServiceWorker(e)))}async _get(e){const t=await this._withRetries(i=>Vh(i,e));return this.localCache[e]=t,t}async _remove(e){return this._withPendingWrite(async()=>(await this._withRetries(t=>Ds(t,e)),delete this.localCache[e],this.notifyServiceWorker(e)))}async _poll(){const e=await this._withRetries(s=>{const r=Tn(s,!1).getAll();return new Lt(r).toPromise()});if(!e)return[];if(this.pendingWrites!==0)return[];const t=[],i=new Set;if(e.length!==0)for(const{fbase_key:s,value:r}of e)i.add(s),JSON.stringify(this.localCache[s])!==JSON.stringify(r)&&(this.notifyListeners(s,r),t.push(s));for(const s of Object.keys(this.localCache))this.localCache[s]&&!i.has(s)&&(this.notifyListeners(s,null),t.push(s));return t}notifyListeners(e,t){this.localCache[e]=t;const i=this.listeners[e];if(i)for(const s of Array.from(i))s(t)}startPolling(){this.stopPolling(),this.pollTimer=setInterval(async()=>this._poll(),$h)}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()}}mo.type="LOCAL";const jh=mo;new Dt(3e4,6e4);/**
1411
1411
  * @license
1412
1412
  * Copyright 2021 Google LLC
1413
1413
  *
@@ -1422,7 +1422,7 @@ import{a as vi}from"./tslib.es6-De9GV7Vy.js";import{u as Wa,a as Ba,b as Ha,d as
1422
1422
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1423
1423
  * See the License for the specific language governing permissions and
1424
1424
  * limitations under the License.
1425
- */function jh(n,e){return e?ee(e):(g(n._popupRedirectResolver,n,"argument-error"),n._popupRedirectResolver)}/**
1425
+ */function zh(n,e){return e?ee(e):(g(n._popupRedirectResolver,n,"argument-error"),n._popupRedirectResolver)}/**
1426
1426
  * @license
1427
1427
  * Copyright 2019 Google LLC
1428
1428
  *
@@ -1437,7 +1437,7 @@ import{a as vi}from"./tslib.es6-De9GV7Vy.js";import{u as Wa,a as Ba,b as Ha,d as
1437
1437
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1438
1438
  * See the License for the specific language governing permissions and
1439
1439
  * limitations under the License.
1440
- */class Di extends Ni{constructor(e){super("custom","custom"),this.params=e}_getIdTokenResponse(e){return Ge(e,this._buildIdpRequest())}_linkToIdToken(e,t){return Ge(e,this._buildIdpRequest(t))}_getReauthenticationResolver(e){return Ge(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 zh(n){return ao(n.auth,new Di(n),n.bypassAuthState)}function qh(n){const{auth:e,user:t}=n;return g(t,e,"internal-error"),wh(t,new Di(n),n.bypassAuthState)}async function Kh(n){const{auth:e,user:t}=n;return g(t,e,"internal-error"),Ch(t,new Di(n),n.bypassAuthState)}/**
1440
+ */class Di extends Ni{constructor(e){super("custom","custom"),this.params=e}_getIdTokenResponse(e){return Ge(e,this._buildIdpRequest())}_linkToIdToken(e,t){return Ge(e,this._buildIdpRequest(t))}_getReauthenticationResolver(e){return Ge(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 qh(n){return ao(n.auth,new Di(n),n.bypassAuthState)}function Kh(n){const{auth:e,user:t}=n;return g(t,e,"internal-error"),Th(t,new Di(n),n.bypassAuthState)}async function Yh(n){const{auth:e,user:t}=n;return g(t,e,"internal-error"),wh(t,new Di(n),n.bypassAuthState)}/**
1441
1441
  * @license
1442
1442
  * Copyright 2020 Google LLC
1443
1443
  *
@@ -1452,7 +1452,7 @@ import{a as vi}from"./tslib.es6-De9GV7Vy.js";import{u as Wa,a as Ba,b as Ha,d as
1452
1452
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1453
1453
  * See the License for the specific language governing permissions and
1454
1454
  * limitations under the License.
1455
- */class vo{constructor(e,t,i,s,r=!1){this.auth=e,this.resolver=i,this.user=s,this.bypassAuthState=r,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(i){this.reject(i)}})}async onAuthEvent(e){const{urlResponse:t,sessionId:i,postBody:s,tenantId:r,error:o,type:a}=e;if(o){this.reject(o);return}const l={auth:this.auth,requestUri:t,sessionId:i,tenantId:r||void 0,postBody:s||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(a)(l))}catch(c){this.reject(c)}}onError(e){this.reject(e)}getIdpTask(e){switch(e){case"signInViaPopup":case"signInViaRedirect":return zh;case"linkViaPopup":case"linkViaRedirect":return Kh;case"reauthViaPopup":case"reauthViaRedirect":return qh;default:Q(this.auth,"internal-error")}}resolve(e){se(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(e),this.unregisterAndCleanUp()}reject(e){se(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()}}/**
1455
+ */class vo{constructor(e,t,i,s,r=!1){this.auth=e,this.resolver=i,this.user=s,this.bypassAuthState=r,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(i){this.reject(i)}})}async onAuthEvent(e){const{urlResponse:t,sessionId:i,postBody:s,tenantId:r,error:o,type:a}=e;if(o){this.reject(o);return}const l={auth:this.auth,requestUri:t,sessionId:i,tenantId:r||void 0,postBody:s||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(a)(l))}catch(c){this.reject(c)}}onError(e){this.reject(e)}getIdpTask(e){switch(e){case"signInViaPopup":case"signInViaRedirect":return qh;case"linkViaPopup":case"linkViaRedirect":return Yh;case"reauthViaPopup":case"reauthViaRedirect":return Kh;default:Q(this.auth,"internal-error")}}resolve(e){se(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(e),this.unregisterAndCleanUp()}reject(e){se(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()}}/**
1456
1456
  * @license
1457
1457
  * Copyright 2020 Google LLC
1458
1458
  *
@@ -1467,7 +1467,7 @@ import{a as vi}from"./tslib.es6-De9GV7Vy.js";import{u as Wa,a as Ba,b as Ha,d as
1467
1467
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1468
1468
  * See the License for the specific language governing permissions and
1469
1469
  * limitations under the License.
1470
- */const Yh=new Dt(2e3,1e4);class We extends vo{constructor(e,t,i,s,r){super(e,t,s,r),this.provider=i,this.authWindow=null,this.pollId=null,We.currentPopupAction&&We.currentPopupAction.cancel(),We.currentPopupAction=this}async executeNotNull(){const e=await this.execute();return g(e,this.auth,"internal-error"),e}async onExecution(){se(this.filter.length===1,"Popup operations only handle one event");const e=Oi();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(J(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(J(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,We.currentPopupAction=null}pollUserCancellation(){const e=()=>{var t,i;if(!((i=(t=this.authWindow)===null||t===void 0?void 0:t.window)===null||i===void 0)&&i.closed){this.pollId=window.setTimeout(()=>{this.pollId=null,this.reject(J(this.auth,"popup-closed-by-user"))},8e3);return}this.pollId=window.setTimeout(e,Yh.get())};e()}}We.currentPopupAction=null;/**
1470
+ */const Qh=new Dt(2e3,1e4);class Ue extends vo{constructor(e,t,i,s,r){super(e,t,s,r),this.provider=i,this.authWindow=null,this.pollId=null,Ue.currentPopupAction&&Ue.currentPopupAction.cancel(),Ue.currentPopupAction=this}async executeNotNull(){const e=await this.execute();return g(e,this.auth,"internal-error"),e}async onExecution(){se(this.filter.length===1,"Popup operations only handle one event");const e=Oi();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(J(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(J(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,Ue.currentPopupAction=null}pollUserCancellation(){const e=()=>{var t,i;if(!((i=(t=this.authWindow)===null||t===void 0?void 0:t.window)===null||i===void 0)&&i.closed){this.pollId=window.setTimeout(()=>{this.pollId=null,this.reject(J(this.auth,"popup-closed-by-user"))},8e3);return}this.pollId=window.setTimeout(e,Qh.get())};e()}}Ue.currentPopupAction=null;/**
1471
1471
  * @license
1472
1472
  * Copyright 2020 Google LLC
1473
1473
  *
@@ -1482,7 +1482,7 @@ import{a as vi}from"./tslib.es6-De9GV7Vy.js";import{u as Wa,a as Ba,b as Ha,d as
1482
1482
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1483
1483
  * See the License for the specific language governing permissions and
1484
1484
  * limitations under the License.
1485
- */const Qh="pendingRedirect",Kt=new Map;class Jh extends vo{constructor(e,t,i=!1){super(e,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],t,void 0,i),this.eventId=null}async execute(){let e=Kt.get(this.auth._key());if(!e){try{const i=await Xh(this.resolver,this.auth)?await super.execute():null;e=()=>Promise.resolve(i)}catch(t){e=()=>Promise.reject(t)}Kt.set(this.auth._key(),e)}return this.bypassAuthState||Kt.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 Xh(n,e){const t=tu(e),i=eu(n);if(!await i._isAvailable())return!1;const s=await i._get(t)==="true";return await i._remove(t),s}function Zh(n,e){Kt.set(n._key(),e)}function eu(n){return ee(n._redirectPersistence)}function tu(n){return qt(Qh,n.config.apiKey,n.name)}async function nu(n,e,t=!1){if(G(n.app))return Promise.reject(ge(n));const i=it(n),s=jh(i,e),o=await new Jh(i,s,t).execute();return o&&!t&&(delete o.user._redirectEventId,await i._persistUserIfCurrent(o.user),await i._setRedirectUser(null,e)),o}/**
1485
+ */const Jh="pendingRedirect",Kt=new Map;class Xh extends vo{constructor(e,t,i=!1){super(e,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],t,void 0,i),this.eventId=null}async execute(){let e=Kt.get(this.auth._key());if(!e){try{const i=await Zh(this.resolver,this.auth)?await super.execute():null;e=()=>Promise.resolve(i)}catch(t){e=()=>Promise.reject(t)}Kt.set(this.auth._key(),e)}return this.bypassAuthState||Kt.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 Zh(n,e){const t=nu(e),i=tu(n);if(!await i._isAvailable())return!1;const s=await i._get(t)==="true";return await i._remove(t),s}function eu(n,e){Kt.set(n._key(),e)}function tu(n){return ee(n._redirectPersistence)}function nu(n){return qt(Jh,n.config.apiKey,n.name)}async function iu(n,e,t=!1){if(G(n.app))return Promise.reject(ge(n));const i=it(n),s=zh(i,e),o=await new Xh(i,s,t).execute();return o&&!t&&(delete o.user._redirectEventId,await i._persistUserIfCurrent(o.user),await i._setRedirectUser(null,e)),o}/**
1486
1486
  * @license
1487
1487
  * Copyright 2020 Google LLC
1488
1488
  *
@@ -1497,7 +1497,7 @@ import{a as vi}from"./tslib.es6-De9GV7Vy.js";import{u as Wa,a as Ba,b as Ha,d as
1497
1497
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1498
1498
  * See the License for the specific language governing permissions and
1499
1499
  * limitations under the License.
1500
- */const iu=10*60*1e3;class su{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(i=>{this.isEventForConsumer(e,i)&&(t=!0,this.sendToConsumer(e,i),this.saveEventToCache(e))}),this.hasHandledPotentialRedirect||!ru(e)||(this.hasHandledPotentialRedirect=!0,t||(this.queuedRedirectEvent=e,t=!0)),t}sendToConsumer(e,t){var i;if(e.error&&!yo(e)){const s=((i=e.error.code)===null||i===void 0?void 0:i.split("auth/")[1])||"internal-error";t.onError(J(this.auth,s))}else t.onAuthEvent(e)}isEventForConsumer(e,t){const i=t.eventId===null||!!e.eventId&&e.eventId===t.eventId;return t.filter.includes(e.type)&&i}hasEventBeenHandled(e){return Date.now()-this.lastProcessedEventTime>=iu&&this.cachedEventUids.clear(),this.cachedEventUids.has(Ms(e))}saveEventToCache(e){this.cachedEventUids.add(Ms(e)),this.lastProcessedEventTime=Date.now()}}function Ms(n){return[n.type,n.eventId,n.sessionId,n.tenantId].filter(e=>e).join("-")}function yo({type:n,error:e}){return n==="unknown"&&(e==null?void 0:e.code)==="auth/no-auth-event"}function ru(n){switch(n.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return yo(n);default:return!1}}/**
1500
+ */const su=10*60*1e3;class ru{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(i=>{this.isEventForConsumer(e,i)&&(t=!0,this.sendToConsumer(e,i),this.saveEventToCache(e))}),this.hasHandledPotentialRedirect||!ou(e)||(this.hasHandledPotentialRedirect=!0,t||(this.queuedRedirectEvent=e,t=!0)),t}sendToConsumer(e,t){var i;if(e.error&&!yo(e)){const s=((i=e.error.code)===null||i===void 0?void 0:i.split("auth/")[1])||"internal-error";t.onError(J(this.auth,s))}else t.onAuthEvent(e)}isEventForConsumer(e,t){const i=t.eventId===null||!!e.eventId&&e.eventId===t.eventId;return t.filter.includes(e.type)&&i}hasEventBeenHandled(e){return Date.now()-this.lastProcessedEventTime>=su&&this.cachedEventUids.clear(),this.cachedEventUids.has(Ms(e))}saveEventToCache(e){this.cachedEventUids.add(Ms(e)),this.lastProcessedEventTime=Date.now()}}function Ms(n){return[n.type,n.eventId,n.sessionId,n.tenantId].filter(e=>e).join("-")}function yo({type:n,error:e}){return n==="unknown"&&(e==null?void 0:e.code)==="auth/no-auth-event"}function ou(n){switch(n.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return yo(n);default:return!1}}/**
1501
1501
  * @license
1502
1502
  * Copyright 2020 Google LLC
1503
1503
  *
@@ -1512,7 +1512,7 @@ import{a as vi}from"./tslib.es6-De9GV7Vy.js";import{u as Wa,a as Ba,b as Ha,d as
1512
1512
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1513
1513
  * See the License for the specific language governing permissions and
1514
1514
  * limitations under the License.
1515
- */async function ou(n,e={}){return we(n,"GET","/v1/projects",e)}/**
1515
+ */async function au(n,e={}){return we(n,"GET","/v1/projects",e)}/**
1516
1516
  * @license
1517
1517
  * Copyright 2020 Google LLC
1518
1518
  *
@@ -1527,7 +1527,7 @@ import{a as vi}from"./tslib.es6-De9GV7Vy.js";import{u as Wa,a as Ba,b as Ha,d as
1527
1527
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1528
1528
  * See the License for the specific language governing permissions and
1529
1529
  * limitations under the License.
1530
- */const au=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,lu=/^https?/;async function cu(n){if(n.config.emulator)return;const{authorizedDomains:e}=await ou(n);for(const t of e)try{if(hu(t))return}catch{}Q(n,"unauthorized-domain")}function hu(n){const e=ni(),{protocol:t,hostname:i}=new URL(e);if(n.startsWith("chrome-extension://")){const o=new URL(n);return o.hostname===""&&i===""?t==="chrome-extension:"&&n.replace("chrome-extension://","")===e.replace("chrome-extension://",""):t==="chrome-extension:"&&o.hostname===i}if(!lu.test(t))return!1;if(au.test(n))return i===n;const s=n.replace(/\./g,"\\.");return new RegExp("^(.+\\."+s+"|"+s+")$","i").test(i)}/**
1530
+ */const lu=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,cu=/^https?/;async function hu(n){if(n.config.emulator)return;const{authorizedDomains:e}=await au(n);for(const t of e)try{if(uu(t))return}catch{}Q(n,"unauthorized-domain")}function uu(n){const e=ni(),{protocol:t,hostname:i}=new URL(e);if(n.startsWith("chrome-extension://")){const o=new URL(n);return o.hostname===""&&i===""?t==="chrome-extension:"&&n.replace("chrome-extension://","")===e.replace("chrome-extension://",""):t==="chrome-extension:"&&o.hostname===i}if(!cu.test(t))return!1;if(lu.test(n))return i===n;const s=n.replace(/\./g,"\\.");return new RegExp("^(.+\\."+s+"|"+s+")$","i").test(i)}/**
1531
1531
  * @license
1532
1532
  * Copyright 2020 Google LLC.
1533
1533
  *
@@ -1542,7 +1542,7 @@ import{a as vi}from"./tslib.es6-De9GV7Vy.js";import{u as Wa,a as Ba,b as Ha,d as
1542
1542
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1543
1543
  * See the License for the specific language governing permissions and
1544
1544
  * limitations under the License.
1545
- */const uu=new Dt(3e4,6e4);function Ls(){const n=X().___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 du(n){return new Promise((e,t)=>{var i,s,r;function o(){Ls(),gapi.load("gapi.iframes",{callback:()=>{e(gapi.iframes.getContext())},ontimeout:()=>{Ls(),t(J(n,"network-request-failed"))},timeout:uu.get()})}if(!((s=(i=X().gapi)===null||i===void 0?void 0:i.iframes)===null||s===void 0)&&s.Iframe)e(gapi.iframes.getContext());else if(!((r=X().gapi)===null||r===void 0)&&r.load)o();else{const a=rh("iframefcb");return X()[a]=()=>{gapi.load?o():t(J(n,"network-request-failed"))},no(`${sh()}?onload=${a}`).catch(l=>t(l))}}).catch(e=>{throw Yt=null,e})}let Yt=null;function fu(n){return Yt=Yt||du(n),Yt}/**
1545
+ */const du=new Dt(3e4,6e4);function Ls(){const n=X().___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 fu(n){return new Promise((e,t)=>{var i,s,r;function o(){Ls(),gapi.load("gapi.iframes",{callback:()=>{e(gapi.iframes.getContext())},ontimeout:()=>{Ls(),t(J(n,"network-request-failed"))},timeout:du.get()})}if(!((s=(i=X().gapi)===null||i===void 0?void 0:i.iframes)===null||s===void 0)&&s.Iframe)e(gapi.iframes.getContext());else if(!((r=X().gapi)===null||r===void 0)&&r.load)o();else{const a=oh("iframefcb");return X()[a]=()=>{gapi.load?o():t(J(n,"network-request-failed"))},no(`${rh()}?onload=${a}`).catch(l=>t(l))}}).catch(e=>{throw Yt=null,e})}let Yt=null;function pu(n){return Yt=Yt||fu(n),Yt}/**
1546
1546
  * @license
1547
1547
  * Copyright 2020 Google LLC.
1548
1548
  *
@@ -1557,7 +1557,7 @@ import{a as vi}from"./tslib.es6-De9GV7Vy.js";import{u as Wa,a as Ba,b as Ha,d as
1557
1557
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1558
1558
  * See the License for the specific language governing permissions and
1559
1559
  * limitations under the License.
1560
- */const pu=new Dt(5e3,15e3),_u="__/auth/iframe",gu="emulator/auth/iframe",mu={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},vu=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function yu(n){const e=n.config;g(e.authDomain,n,"auth-domain-config-required");const t=e.emulator?Ri(e,gu):`https://${n.config.authDomain}/${_u}`,i={apiKey:e.apiKey,appName:n.name,v:nt},s=vu.get(n.config.apiHost);s&&(i.eid=s);const r=n._getFrameworks();return r.length&&(i.fw=r.join(",")),`${t}?${tt(i).slice(1)}`}async function Eu(n){const e=await fu(n),t=X().gapi;return g(t,n,"internal-error"),e.open({where:document.body,url:yu(n),messageHandlersFilter:t.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:mu,dontclear:!0},i=>new Promise(async(s,r)=>{await i.restyle({setHideOnLeave:!1});const o=J(n,"network-request-failed"),a=X().setTimeout(()=>{r(o)},pu.get());function l(){X().clearTimeout(a),s(i)}i.ping(l).then(l,()=>{r(o)})}))}/**
1560
+ */const _u=new Dt(5e3,15e3),gu="__/auth/iframe",mu="emulator/auth/iframe",vu={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},yu=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function Eu(n){const e=n.config;g(e.authDomain,n,"auth-domain-config-required");const t=e.emulator?Ri(e,mu):`https://${n.config.authDomain}/${gu}`,i={apiKey:e.apiKey,appName:n.name,v:nt},s=yu.get(n.config.apiHost);s&&(i.eid=s);const r=n._getFrameworks();return r.length&&(i.fw=r.join(",")),`${t}?${tt(i).slice(1)}`}async function Iu(n){const e=await pu(n),t=X().gapi;return g(t,n,"internal-error"),e.open({where:document.body,url:Eu(n),messageHandlersFilter:t.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:vu,dontclear:!0},i=>new Promise(async(s,r)=>{await i.restyle({setHideOnLeave:!1});const o=J(n,"network-request-failed"),a=X().setTimeout(()=>{r(o)},_u.get());function l(){X().clearTimeout(a),s(i)}i.ping(l).then(l,()=>{r(o)})}))}/**
1561
1561
  * @license
1562
1562
  * Copyright 2020 Google LLC.
1563
1563
  *
@@ -1572,7 +1572,7 @@ import{a as vi}from"./tslib.es6-De9GV7Vy.js";import{u as Wa,a as Ba,b as Ha,d as
1572
1572
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1573
1573
  * See the License for the specific language governing permissions and
1574
1574
  * limitations under the License.
1575
- */const Iu={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"},Cu=500,wu=600,Tu="_blank",Su="http://localhost";class xs{constructor(e){this.window=e,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch{}}}function bu(n,e,t,i=Cu,s=wu){const r=Math.max((window.screen.availHeight-s)/2,0).toString(),o=Math.max((window.screen.availWidth-i)/2,0).toString();let a="";const l=Object.assign(Object.assign({},Iu),{width:i.toString(),height:s.toString(),top:r,left:o}),c=x().toLowerCase();t&&(a=Yr(c)?Tu:t),qr(c)&&(e=e||Su,l.scrollbars="yes");const d=Object.entries(l).reduce((u,[p,_])=>`${u}${p}=${_},`,"");if(Yc(c)&&a!=="_self")return Ru(e||"",a),new xs(null);const h=window.open(e||"",a,d);g(h,n,"popup-blocked");try{h.focus()}catch{}return new xs(h)}function Ru(n,e){const t=document.createElement("a");t.href=n,t.target=e;const i=document.createEvent("MouseEvent");i.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),t.dispatchEvent(i)}/**
1575
+ */const Cu={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"},wu=500,Tu=600,Su="_blank",bu="http://localhost";class xs{constructor(e){this.window=e,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch{}}}function Ru(n,e,t,i=wu,s=Tu){const r=Math.max((window.screen.availHeight-s)/2,0).toString(),o=Math.max((window.screen.availWidth-i)/2,0).toString();let a="";const l=Object.assign(Object.assign({},Cu),{width:i.toString(),height:s.toString(),top:r,left:o}),c=x().toLowerCase();t&&(a=Yr(c)?Su:t),qr(c)&&(e=e||bu,l.scrollbars="yes");const d=Object.entries(l).reduce((u,[p,_])=>`${u}${p}=${_},`,"");if(Qc(c)&&a!=="_self")return ku(e||"",a),new xs(null);const h=window.open(e||"",a,d);g(h,n,"popup-blocked");try{h.focus()}catch{}return new xs(h)}function ku(n,e){const t=document.createElement("a");t.href=n,t.target=e;const i=document.createEvent("MouseEvent");i.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),t.dispatchEvent(i)}/**
1576
1576
  * @license
1577
1577
  * Copyright 2021 Google LLC
1578
1578
  *
@@ -1587,7 +1587,7 @@ import{a as vi}from"./tslib.es6-De9GV7Vy.js";import{u as Wa,a as Ba,b as Ha,d as
1587
1587
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1588
1588
  * See the License for the specific language governing permissions and
1589
1589
  * limitations under the License.
1590
- */const Au="__/auth/handler",ku="emulator/auth/handler",Nu=encodeURIComponent("fac");async function Fs(n,e,t,i,s,r){g(n.config.authDomain,n,"auth-domain-config-required"),g(n.config.apiKey,n,"invalid-api-key");const o={apiKey:n.config.apiKey,appName:n.name,authType:t,redirectUrl:i,v:nt,eventId:s};if(e instanceof ro){e.setDefaultLanguage(n.languageCode),o.providerId=e.providerId||"",Qn(e.getCustomParameters())||(o.customParameters=JSON.stringify(e.getCustomParameters()));for(const[d,h]of Object.entries({}))o[d]=h}if(e instanceof Mt){const d=e.getScopes().filter(h=>h!=="");d.length>0&&(o.scopes=d.join(","))}n.tenantId&&(o.tid=n.tenantId);const a=o;for(const d of Object.keys(a))a[d]===void 0&&delete a[d];const l=await n._getAppCheckToken(),c=l?`#${Nu}=${encodeURIComponent(l)}`:"";return`${Pu(n)}?${tt(a).slice(1)}${c}`}function Pu({config:n}){return n.emulator?Ri(n,ku):`https://${n.authDomain}/${Au}`}/**
1590
+ */const Au="__/auth/handler",Nu="emulator/auth/handler",Pu=encodeURIComponent("fac");async function Fs(n,e,t,i,s,r){g(n.config.authDomain,n,"auth-domain-config-required"),g(n.config.apiKey,n,"invalid-api-key");const o={apiKey:n.config.apiKey,appName:n.name,authType:t,redirectUrl:i,v:nt,eventId:s};if(e instanceof ro){e.setDefaultLanguage(n.languageCode),o.providerId=e.providerId||"",Qn(e.getCustomParameters())||(o.customParameters=JSON.stringify(e.getCustomParameters()));for(const[d,h]of Object.entries({}))o[d]=h}if(e instanceof Mt){const d=e.getScopes().filter(h=>h!=="");d.length>0&&(o.scopes=d.join(","))}n.tenantId&&(o.tid=n.tenantId);const a=o;for(const d of Object.keys(a))a[d]===void 0&&delete a[d];const l=await n._getAppCheckToken(),c=l?`#${Pu}=${encodeURIComponent(l)}`:"";return`${Ou(n)}?${tt(a).slice(1)}${c}`}function Ou({config:n}){return n.emulator?Ri(n,Nu):`https://${n.authDomain}/${Au}`}/**
1591
1591
  * @license
1592
1592
  * Copyright 2020 Google LLC
1593
1593
  *
@@ -1602,7 +1602,7 @@ import{a as vi}from"./tslib.es6-De9GV7Vy.js";import{u as Wa,a as Ba,b as Ha,d as
1602
1602
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1603
1603
  * See the License for the specific language governing permissions and
1604
1604
  * limitations under the License.
1605
- */const Bn="webStorageSupport";class Ou{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=fo,this._completeRedirectFn=nu,this._overrideRedirectResult=Zh}async _openPopup(e,t,i,s){var r;se((r=this.eventManagers[e._key()])===null||r===void 0?void 0:r.manager,"_initialize() not called before _openPopup()");const o=await Fs(e,t,i,ni(),s);return bu(e,o,Oi())}async _openRedirect(e,t,i,s){await this._originValidation(e);const r=await Fs(e,t,i,ni(),s);return Lh(r),new Promise(()=>{})}_initialize(e){const t=e._key();if(this.eventManagers[t]){const{manager:s,promise:r}=this.eventManagers[t];return s?Promise.resolve(s):(se(r,"If manager is not set, promise should be"),r)}const i=this.initAndGetManager(e);return this.eventManagers[t]={promise:i},i.catch(()=>{delete this.eventManagers[t]}),i}async initAndGetManager(e){const t=await Eu(e),i=new su(e);return t.register("authEvent",s=>(g(s==null?void 0:s.authEvent,e,"invalid-auth-event"),{status:i.onEvent(s.authEvent)?"ACK":"ERROR"}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[e._key()]={manager:i},this.iframes[e._key()]=t,i}_isIframeWebStorageSupported(e,t){this.iframes[e._key()].send(Bn,{type:Bn},s=>{var r;const o=(r=s==null?void 0:s[0])===null||r===void 0?void 0:r[Bn];o!==void 0&&t(!!o),Q(e,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(e){const t=e._key();return this.originValidationPromises[t]||(this.originValidationPromises[t]=cu(e)),this.originValidationPromises[t]}get _shouldInitProactively(){return eo()||Kr()||ki()}}const Du=Ou;var Us="@firebase/auth",Ws="1.10.8";/**
1605
+ */const Bn="webStorageSupport";class Du{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=fo,this._completeRedirectFn=iu,this._overrideRedirectResult=eu}async _openPopup(e,t,i,s){var r;se((r=this.eventManagers[e._key()])===null||r===void 0?void 0:r.manager,"_initialize() not called before _openPopup()");const o=await Fs(e,t,i,ni(),s);return Ru(e,o,Oi())}async _openRedirect(e,t,i,s){await this._originValidation(e);const r=await Fs(e,t,i,ni(),s);return xh(r),new Promise(()=>{})}_initialize(e){const t=e._key();if(this.eventManagers[t]){const{manager:s,promise:r}=this.eventManagers[t];return s?Promise.resolve(s):(se(r,"If manager is not set, promise should be"),r)}const i=this.initAndGetManager(e);return this.eventManagers[t]={promise:i},i.catch(()=>{delete this.eventManagers[t]}),i}async initAndGetManager(e){const t=await Iu(e),i=new ru(e);return t.register("authEvent",s=>(g(s==null?void 0:s.authEvent,e,"invalid-auth-event"),{status:i.onEvent(s.authEvent)?"ACK":"ERROR"}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[e._key()]={manager:i},this.iframes[e._key()]=t,i}_isIframeWebStorageSupported(e,t){this.iframes[e._key()].send(Bn,{type:Bn},s=>{var r;const o=(r=s==null?void 0:s[0])===null||r===void 0?void 0:r[Bn];o!==void 0&&t(!!o),Q(e,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(e){const t=e._key();return this.originValidationPromises[t]||(this.originValidationPromises[t]=hu(e)),this.originValidationPromises[t]}get _shouldInitProactively(){return eo()||Kr()||Ai()}}const Mu=Du;var Us="@firebase/auth",Ws="1.10.8";/**
1606
1606
  * @license
1607
1607
  * Copyright 2020 Google LLC
1608
1608
  *
@@ -1617,7 +1617,7 @@ import{a as vi}from"./tslib.es6-De9GV7Vy.js";import{u as Wa,a as Ba,b as Ha,d as
1617
1617
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1618
1618
  * See the License for the specific language governing permissions and
1619
1619
  * limitations under the License.
1620
- */class Mu{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(i=>{e((i==null?void 0:i.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(){g(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}}/**
1620
+ */class Lu{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(i=>{e((i==null?void 0:i.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(){g(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}}/**
1621
1621
  * @license
1622
1622
  * Copyright 2020 Google LLC
1623
1623
  *
@@ -1632,7 +1632,7 @@ import{a as vi}from"./tslib.es6-De9GV7Vy.js";import{u as Wa,a as Ba,b as Ha,d as
1632
1632
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1633
1633
  * See the License for the specific language governing permissions and
1634
1634
  * limitations under the License.
1635
- */function Lu(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 xu(n){Ke(new Ne("auth",(e,{options:t})=>{const i=e.getProvider("app").getImmediate(),s=e.getProvider("heartbeat"),r=e.getProvider("app-check-internal"),{apiKey:o,authDomain:a}=i.options;g(o&&!o.includes(":"),"invalid-api-key",{appName:i.name});const l={apiKey:o,authDomain:a,clientPlatform:n,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:to(n)},c=new th(i,s,r,l);return uh(c,t),c},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e,t,i)=>{e.getProvider("auth-internal").initialize()})),Ke(new Ne("auth-internal",e=>{const t=it(e.getProvider("auth").getImmediate());return(i=>new Mu(i))(t)},"PRIVATE").setInstantiationMode("EXPLICIT")),_e(Us,Ws,Lu(n)),_e(Us,Ws,"esm2017")}/**
1635
+ */function xu(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 Fu(n){Ke(new Ae("auth",(e,{options:t})=>{const i=e.getProvider("app").getImmediate(),s=e.getProvider("heartbeat"),r=e.getProvider("app-check-internal"),{apiKey:o,authDomain:a}=i.options;g(o&&!o.includes(":"),"invalid-api-key",{appName:i.name});const l={apiKey:o,authDomain:a,clientPlatform:n,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:to(n)},c=new nh(i,s,r,l);return dh(c,t),c},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e,t,i)=>{e.getProvider("auth-internal").initialize()})),Ke(new Ae("auth-internal",e=>{const t=it(e.getProvider("auth").getImmediate());return(i=>new Lu(i))(t)},"PRIVATE").setInstantiationMode("EXPLICIT")),_e(Us,Ws,xu(n)),_e(Us,Ws,"esm2017")}/**
1636
1636
  * @license
1637
1637
  * Copyright 2021 Google LLC
1638
1638
  *
@@ -1647,7 +1647,7 @@ import{a as vi}from"./tslib.es6-De9GV7Vy.js";import{u as Wa,a as Ba,b as Ha,d as
1647
1647
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1648
1648
  * See the License for the specific language governing permissions and
1649
1649
  * limitations under the License.
1650
- */const Fu=5*60,Uu=Rr("authIdTokenMaxAge")||Fu;let Bs=null;const Wu=n=>async e=>{const t=e&&await e.getIdTokenResult(),i=t&&(new Date().getTime()-Date.parse(t.issuedAtTime))/1e3;if(i&&i>Uu)return;const s=t==null?void 0:t.token;Bs!==s&&(Bs=s,await fetch(n,{method:s?"POST":"DELETE",headers:s?{Authorization:`Bearer ${s}`}:{}}))};function Bu(n=xr()){const e=Si(n,"auth");if(e.isInitialized())return e.getImmediate();const t=hh(n,{popupRedirectResolver:Du,persistence:[Gh,ho,fo]}),i=Rr("authTokenSyncURL");if(i&&typeof isSecureContext=="boolean"&&isSecureContext){const r=new URL(i,location.origin);if(location.origin===r.origin){const o=Wu(r.toString());kh(t,o,()=>o(t.currentUser)),Ah(t,a=>o(a))}}const s=Sr("auth");return s&&dh(t,`http://${s}`),t}function Hu(){var n,e;return(e=(n=document.getElementsByTagName("head"))===null||n===void 0?void 0:n[0])!==null&&e!==void 0?e:document}nh({loadJS(n){return new Promise((e,t)=>{const i=document.createElement("script");i.setAttribute("src",n),i.onload=e,i.onerror=s=>{const r=J("internal-error");r.customData=s,t(r)},i.type="text/javascript",i.charset="UTF-8",Hu().appendChild(i)})},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="});xu("Browser");var Hs={};const Vs="@firebase/database",$s="1.0.20";/**
1650
+ */const Uu=5*60,Wu=Rr("authIdTokenMaxAge")||Uu;let Bs=null;const Bu=n=>async e=>{const t=e&&await e.getIdTokenResult(),i=t&&(new Date().getTime()-Date.parse(t.issuedAtTime))/1e3;if(i&&i>Wu)return;const s=t==null?void 0:t.token;Bs!==s&&(Bs=s,await fetch(n,{method:s?"POST":"DELETE",headers:s?{Authorization:`Bearer ${s}`}:{}}))};function Hu(n=xr()){const e=Si(n,"auth");if(e.isInitialized())return e.getImmediate();const t=uh(n,{popupRedirectResolver:Mu,persistence:[jh,ho,fo]}),i=Rr("authTokenSyncURL");if(i&&typeof isSecureContext=="boolean"&&isSecureContext){const r=new URL(i,location.origin);if(location.origin===r.origin){const o=Bu(r.toString());Nh(t,o,()=>o(t.currentUser)),Ah(t,a=>o(a))}}const s=Sr("auth");return s&&fh(t,`http://${s}`),t}function Vu(){var n,e;return(e=(n=document.getElementsByTagName("head"))===null||n===void 0?void 0:n[0])!==null&&e!==void 0?e:document}ih({loadJS(n){return new Promise((e,t)=>{const i=document.createElement("script");i.setAttribute("src",n),i.onload=e,i.onerror=s=>{const r=J("internal-error");r.customData=s,t(r)},i.type="text/javascript",i.charset="UTF-8",Vu().appendChild(i)})},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="});Fu("Browser");var Hs={};const Vs="@firebase/database",$s="1.0.20";/**
1651
1651
  * @license
1652
1652
  * Copyright 2019 Google LLC
1653
1653
  *
@@ -1662,7 +1662,7 @@ import{a as vi}from"./tslib.es6-De9GV7Vy.js";import{u as Wa,a as Ba,b as Ha,d as
1662
1662
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1663
1663
  * See the License for the specific language governing permissions and
1664
1664
  * limitations under the License.
1665
- */let Eo="";function Vu(n){Eo=n}/**
1665
+ */let Eo="";function $u(n){Eo=n}/**
1666
1666
  * @license
1667
1667
  * Copyright 2017 Google LLC
1668
1668
  *
@@ -1677,7 +1677,7 @@ import{a as vi}from"./tslib.es6-De9GV7Vy.js";import{u as Wa,a as Ba,b as Ha,d as
1677
1677
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1678
1678
  * See the License for the specific language governing permissions and
1679
1679
  * limitations under the License.
1680
- */class $u{constructor(e){this.domStorage_=e,this.prefix_="firebase:"}set(e,t){t==null?this.domStorage_.removeItem(this.prefixedName_(e)):this.domStorage_.setItem(this.prefixedName_(e),k(t))}get(e){const t=this.domStorage_.getItem(this.prefixedName_(e));return t==null?null:Et(t)}remove(e){this.domStorage_.removeItem(this.prefixedName_(e))}prefixedName_(e){return this.prefix_+e}toString(){return this.domStorage_.toString()}}/**
1680
+ */class Gu{constructor(e){this.domStorage_=e,this.prefix_="firebase:"}set(e,t){t==null?this.domStorage_.removeItem(this.prefixedName_(e)):this.domStorage_.setItem(this.prefixedName_(e),A(t))}get(e){const t=this.domStorage_.getItem(this.prefixedName_(e));return t==null?null:Et(t)}remove(e){this.domStorage_.removeItem(this.prefixedName_(e))}prefixedName_(e){return this.prefix_+e}toString(){return this.domStorage_.toString()}}/**
1681
1681
  * @license
1682
1682
  * Copyright 2017 Google LLC
1683
1683
  *
@@ -1692,7 +1692,7 @@ import{a as vi}from"./tslib.es6-De9GV7Vy.js";import{u as Wa,a as Ba,b as Ha,d as
1692
1692
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1693
1693
  * See the License for the specific language governing permissions and
1694
1694
  * limitations under the License.
1695
- */class Gu{constructor(){this.cache_={},this.isInMemoryStorage=!0}set(e,t){t==null?delete this.cache_[e]:this.cache_[e]=t}get(e){return oe(this.cache_,e)?this.cache_[e]:null}remove(e){delete this.cache_[e]}}/**
1695
+ */class ju{constructor(){this.cache_={},this.isInMemoryStorage=!0}set(e,t){t==null?delete this.cache_[e]:this.cache_[e]=t}get(e){return oe(this.cache_,e)?this.cache_[e]:null}remove(e){delete this.cache_[e]}}/**
1696
1696
  * @license
1697
1697
  * Copyright 2017 Google LLC
1698
1698
  *
@@ -1707,7 +1707,7 @@ import{a as vi}from"./tslib.es6-De9GV7Vy.js";import{u as Wa,a as Ba,b as Ha,d as
1707
1707
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1708
1708
  * See the License for the specific language governing permissions and
1709
1709
  * limitations under the License.
1710
- */const Io=function(n){try{if(typeof window<"u"&&typeof window[n]<"u"){const e=window[n];return e.setItem("firebase:sentinel","cache"),e.removeItem("firebase:sentinel"),new $u(e)}}catch{}return new Gu},Ae=Io("localStorage"),ju=Io("sessionStorage");/**
1710
+ */const Io=function(n){try{if(typeof window<"u"&&typeof window[n]<"u"){const e=window[n];return e.setItem("firebase:sentinel","cache"),e.removeItem("firebase:sentinel"),new Gu(e)}}catch{}return new ju},Re=Io("localStorage"),zu=Io("sessionStorage");/**
1711
1711
  * @license
1712
1712
  * Copyright 2017 Google LLC
1713
1713
  *
@@ -1722,7 +1722,7 @@ import{a as vi}from"./tslib.es6-De9GV7Vy.js";import{u as Wa,a as Ba,b as Ha,d as
1722
1722
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1723
1723
  * See the License for the specific language governing permissions and
1724
1724
  * limitations under the License.
1725
- */const je=new wi("@firebase/database"),zu=function(){let n=1;return function(){return n++}}(),Co=function(n){const e=vl(n),t=new pl;t.update(e);const i=t.digest();return yi.encodeByteArray(i)},xt=function(...n){let e="";for(let t=0;t<n.length;t++){const i=n[t];Array.isArray(i)||i&&typeof i=="object"&&typeof i.length=="number"?e+=xt.apply(null,i):typeof i=="object"?e+=k(i):e+=i,e+=" "}return e};let _t=null,Gs=!0;const qu=function(n,e){f(!0,"Can't turn on custom loggers persistently."),je.logLevel=w.VERBOSE,_t=je.log.bind(je)},M=function(...n){if(Gs===!0&&(Gs=!1,_t===null&&ju.get("logging_enabled")===!0&&qu()),_t){const e=xt.apply(null,n);_t(e)}},Ft=function(n){return function(...e){M(n,...e)}},oi=function(...n){const e="FIREBASE INTERNAL ERROR: "+xt(...n);je.error(e)},re=function(...n){const e=`FIREBASE FATAL ERROR: ${xt(...n)}`;throw je.error(e),new Error(e)},B=function(...n){const e="FIREBASE WARNING: "+xt(...n);je.warn(e)},Ku=function(){typeof window<"u"&&window.location&&window.location.protocol&&window.location.protocol.indexOf("https:")!==-1&&B("Insecure Firebase access from a secure page. Please use https in calls to new Firebase().")},wo=function(n){return typeof n=="number"&&(n!==n||n===Number.POSITIVE_INFINITY||n===Number.NEGATIVE_INFINITY)},Yu=function(n){if(document.readyState==="complete")n();else{let e=!1;const t=function(){if(!document.body){setTimeout(t,Math.floor(10));return}e||(e=!0,n())};document.addEventListener?(document.addEventListener("DOMContentLoaded",t,!1),window.addEventListener("load",t,!1)):document.attachEvent&&(document.attachEvent("onreadystatechange",()=>{document.readyState==="complete"&&t()}),window.attachEvent("onload",t))}},Qe="[MIN_NAME]",Oe="[MAX_NAME]",rt=function(n,e){if(n===e)return 0;if(n===Qe||e===Oe)return-1;if(e===Qe||n===Oe)return 1;{const t=js(n),i=js(e);return t!==null?i!==null?t-i===0?n.length-e.length:t-i:-1:i!==null?1:n<e?-1:1}},Qu=function(n,e){return n===e?0:n<e?-1:1},at=function(n,e){if(e&&n in e)return e[n];throw new Error("Missing required key ("+n+") in object: "+k(e))},Mi=function(n){if(typeof n!="object"||n===null)return k(n);const e=[];for(const i in n)e.push(i);e.sort();let t="{";for(let i=0;i<e.length;i++)i!==0&&(t+=","),t+=k(e[i]),t+=":",t+=Mi(n[e[i]]);return t+="}",t},To=function(n,e){const t=n.length;if(t<=e)return[n];const i=[];for(let s=0;s<t;s+=e)s+e>t?i.push(n.substring(s,t)):i.push(n.substring(s,s+e));return i};function W(n,e){for(const t in n)n.hasOwnProperty(t)&&e(t,n[t])}const So=function(n){f(!wo(n),"Invalid JSON number");const e=11,t=52,i=(1<<e-1)-1;let s,r,o,a,l;n===0?(r=0,o=0,s=1/n===-1/0?1:0):(s=n<0,n=Math.abs(n),n>=Math.pow(2,1-i)?(a=Math.min(Math.floor(Math.log(n)/Math.LN2),i),r=a+i,o=Math.round(n*Math.pow(2,t-a)-Math.pow(2,t))):(r=0,o=Math.round(n/Math.pow(2,1-i-t))));const c=[];for(l=t;l;l-=1)c.push(o%2?1:0),o=Math.floor(o/2);for(l=e;l;l-=1)c.push(r%2?1:0),r=Math.floor(r/2);c.push(s?1:0),c.reverse();const d=c.join("");let h="";for(l=0;l<64;l+=8){let u=parseInt(d.substr(l,8),2).toString(16);u.length===1&&(u="0"+u),h=h+u}return h.toLowerCase()},Ju=function(){return!!(typeof window=="object"&&window.chrome&&window.chrome.extension&&!/^chrome/.test(window.location.href))},Xu=function(){return typeof Windows=="object"&&typeof Windows.UI=="object"};function Zu(n,e){let t="Unknown Error";n==="too_big"?t="The data requested exceeds the maximum size that can be accessed with a single request.":n==="permission_denied"?t="Client doesn't have permission to access the desired data.":n==="unavailable"&&(t="The service is unavailable");const i=new Error(n+" at "+e._path.toString()+": "+t);return i.code=n.toUpperCase(),i}const ed=new RegExp("^-?(0*)\\d{1,10}$"),td=-2147483648,nd=2147483647,js=function(n){if(ed.test(n)){const e=Number(n);if(e>=td&&e<=nd)return e}return null},Ut=function(n){try{n()}catch(e){setTimeout(()=>{const t=e.stack||"";throw B("Exception was thrown by user callback.",t),e},Math.floor(0))}},id=function(){return(typeof window=="object"&&window.navigator&&window.navigator.userAgent||"").search(/googlebot|google webmaster tools|bingbot|yahoo! slurp|baiduspider|yandexbot|duckduckbot/i)>=0},gt=function(n,e){const t=setTimeout(n,e);return typeof t=="number"&&typeof Deno<"u"&&Deno.unrefTimer?Deno.unrefTimer(t):typeof t=="object"&&t.unref&&t.unref(),t};/**
1725
+ */const je=new wi("@firebase/database"),qu=function(){let n=1;return function(){return n++}}(),Co=function(n){const e=yl(n),t=new _l;t.update(e);const i=t.digest();return yi.encodeByteArray(i)},xt=function(...n){let e="";for(let t=0;t<n.length;t++){const i=n[t];Array.isArray(i)||i&&typeof i=="object"&&typeof i.length=="number"?e+=xt.apply(null,i):typeof i=="object"?e+=A(i):e+=i,e+=" "}return e};let _t=null,Gs=!0;const Ku=function(n,e){f(!0,"Can't turn on custom loggers persistently."),je.logLevel=w.VERBOSE,_t=je.log.bind(je)},M=function(...n){if(Gs===!0&&(Gs=!1,_t===null&&zu.get("logging_enabled")===!0&&Ku()),_t){const e=xt.apply(null,n);_t(e)}},Ft=function(n){return function(...e){M(n,...e)}},oi=function(...n){const e="FIREBASE INTERNAL ERROR: "+xt(...n);je.error(e)},re=function(...n){const e=`FIREBASE FATAL ERROR: ${xt(...n)}`;throw je.error(e),new Error(e)},B=function(...n){const e="FIREBASE WARNING: "+xt(...n);je.warn(e)},Yu=function(){typeof window<"u"&&window.location&&window.location.protocol&&window.location.protocol.indexOf("https:")!==-1&&B("Insecure Firebase access from a secure page. Please use https in calls to new Firebase().")},wo=function(n){return typeof n=="number"&&(n!==n||n===Number.POSITIVE_INFINITY||n===Number.NEGATIVE_INFINITY)},Qu=function(n){if(document.readyState==="complete")n();else{let e=!1;const t=function(){if(!document.body){setTimeout(t,Math.floor(10));return}e||(e=!0,n())};document.addEventListener?(document.addEventListener("DOMContentLoaded",t,!1),window.addEventListener("load",t,!1)):document.attachEvent&&(document.attachEvent("onreadystatechange",()=>{document.readyState==="complete"&&t()}),window.attachEvent("onload",t))}},Qe="[MIN_NAME]",Pe="[MAX_NAME]",rt=function(n,e){if(n===e)return 0;if(n===Qe||e===Pe)return-1;if(e===Qe||n===Pe)return 1;{const t=js(n),i=js(e);return t!==null?i!==null?t-i===0?n.length-e.length:t-i:-1:i!==null?1:n<e?-1:1}},Ju=function(n,e){return n===e?0:n<e?-1:1},at=function(n,e){if(e&&n in e)return e[n];throw new Error("Missing required key ("+n+") in object: "+A(e))},Mi=function(n){if(typeof n!="object"||n===null)return A(n);const e=[];for(const i in n)e.push(i);e.sort();let t="{";for(let i=0;i<e.length;i++)i!==0&&(t+=","),t+=A(e[i]),t+=":",t+=Mi(n[e[i]]);return t+="}",t},To=function(n,e){const t=n.length;if(t<=e)return[n];const i=[];for(let s=0;s<t;s+=e)s+e>t?i.push(n.substring(s,t)):i.push(n.substring(s,s+e));return i};function W(n,e){for(const t in n)n.hasOwnProperty(t)&&e(t,n[t])}const So=function(n){f(!wo(n),"Invalid JSON number");const e=11,t=52,i=(1<<e-1)-1;let s,r,o,a,l;n===0?(r=0,o=0,s=1/n===-1/0?1:0):(s=n<0,n=Math.abs(n),n>=Math.pow(2,1-i)?(a=Math.min(Math.floor(Math.log(n)/Math.LN2),i),r=a+i,o=Math.round(n*Math.pow(2,t-a)-Math.pow(2,t))):(r=0,o=Math.round(n/Math.pow(2,1-i-t))));const c=[];for(l=t;l;l-=1)c.push(o%2?1:0),o=Math.floor(o/2);for(l=e;l;l-=1)c.push(r%2?1:0),r=Math.floor(r/2);c.push(s?1:0),c.reverse();const d=c.join("");let h="";for(l=0;l<64;l+=8){let u=parseInt(d.substr(l,8),2).toString(16);u.length===1&&(u="0"+u),h=h+u}return h.toLowerCase()},Xu=function(){return!!(typeof window=="object"&&window.chrome&&window.chrome.extension&&!/^chrome/.test(window.location.href))},Zu=function(){return typeof Windows=="object"&&typeof Windows.UI=="object"};function ed(n,e){let t="Unknown Error";n==="too_big"?t="The data requested exceeds the maximum size that can be accessed with a single request.":n==="permission_denied"?t="Client doesn't have permission to access the desired data.":n==="unavailable"&&(t="The service is unavailable");const i=new Error(n+" at "+e._path.toString()+": "+t);return i.code=n.toUpperCase(),i}const td=new RegExp("^-?(0*)\\d{1,10}$"),nd=-2147483648,id=2147483647,js=function(n){if(td.test(n)){const e=Number(n);if(e>=nd&&e<=id)return e}return null},Ut=function(n){try{n()}catch(e){setTimeout(()=>{const t=e.stack||"";throw B("Exception was thrown by user callback.",t),e},Math.floor(0))}},sd=function(){return(typeof window=="object"&&window.navigator&&window.navigator.userAgent||"").search(/googlebot|google webmaster tools|bingbot|yahoo! slurp|baiduspider|yandexbot|duckduckbot/i)>=0},gt=function(n,e){const t=setTimeout(n,e);return typeof t=="number"&&typeof Deno<"u"&&Deno.unrefTimer?Deno.unrefTimer(t):typeof t=="object"&&t.unref&&t.unref(),t};/**
1726
1726
  * @license
1727
1727
  * Copyright 2021 Google LLC
1728
1728
  *
@@ -1737,7 +1737,7 @@ import{a as vi}from"./tslib.es6-De9GV7Vy.js";import{u as Wa,a as Ba,b as Ha,d as
1737
1737
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1738
1738
  * See the License for the specific language governing permissions and
1739
1739
  * limitations under the License.
1740
- */class sd{constructor(e,t){this.appCheckProvider=t,this.appName=e.name,G(e)&&e.settings.appCheckToken&&(this.serverAppAppCheckToken=e.settings.appCheckToken),this.appCheck=t==null?void 0:t.getImmediate({optional:!0}),this.appCheck||t==null||t.get().then(i=>this.appCheck=i)}getToken(e){if(this.serverAppAppCheckToken){if(e)throw new Error("Attempted reuse of `FirebaseServerApp.appCheckToken` after previous usage failed.");return Promise.resolve({token:this.serverAppAppCheckToken})}return this.appCheck?this.appCheck.getToken(e):new Promise((t,i)=>{setTimeout(()=>{this.appCheck?this.getToken(e).then(t,i):t(null)},0)})}addTokenChangeListener(e){var t;(t=this.appCheckProvider)===null||t===void 0||t.get().then(i=>i.addTokenListener(e))}notifyForInvalidToken(){B(`Provided AppCheck credentials for the app named "${this.appName}" are invalid. This usually indicates your app was not initialized correctly.`)}}/**
1740
+ */class rd{constructor(e,t){this.appCheckProvider=t,this.appName=e.name,G(e)&&e.settings.appCheckToken&&(this.serverAppAppCheckToken=e.settings.appCheckToken),this.appCheck=t==null?void 0:t.getImmediate({optional:!0}),this.appCheck||t==null||t.get().then(i=>this.appCheck=i)}getToken(e){if(this.serverAppAppCheckToken){if(e)throw new Error("Attempted reuse of `FirebaseServerApp.appCheckToken` after previous usage failed.");return Promise.resolve({token:this.serverAppAppCheckToken})}return this.appCheck?this.appCheck.getToken(e):new Promise((t,i)=>{setTimeout(()=>{this.appCheck?this.getToken(e).then(t,i):t(null)},0)})}addTokenChangeListener(e){var t;(t=this.appCheckProvider)===null||t===void 0||t.get().then(i=>i.addTokenListener(e))}notifyForInvalidToken(){B(`Provided AppCheck credentials for the app named "${this.appName}" are invalid. This usually indicates your app was not initialized correctly.`)}}/**
1741
1741
  * @license
1742
1742
  * Copyright 2017 Google LLC
1743
1743
  *
@@ -1752,7 +1752,7 @@ import{a as vi}from"./tslib.es6-De9GV7Vy.js";import{u as Wa,a as Ba,b as Ha,d as
1752
1752
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1753
1753
  * See the License for the specific language governing permissions and
1754
1754
  * limitations under the License.
1755
- */class rd{constructor(e,t,i){this.appName_=e,this.firebaseOptions_=t,this.authProvider_=i,this.auth_=null,this.auth_=i.getImmediate({optional:!0}),this.auth_||i.onInit(s=>this.auth_=s)}getToken(e){return this.auth_?this.auth_.getToken(e).catch(t=>t&&t.code==="auth/token-not-initialized"?(M("Got auth/token-not-initialized error. Treating as null token."),null):Promise.reject(t)):new Promise((t,i)=>{setTimeout(()=>{this.auth_?this.getToken(e).then(t,i):t(null)},0)})}addTokenChangeListener(e){this.auth_?this.auth_.addAuthTokenListener(e):this.authProvider_.get().then(t=>t.addAuthTokenListener(e))}removeTokenChangeListener(e){this.authProvider_.get().then(t=>t.removeAuthTokenListener(e))}notifyForInvalidToken(){let e='Provided authentication credentials for the app named "'+this.appName_+'" are invalid. This usually indicates your app was not initialized correctly. ';"credential"in this.firebaseOptions_?e+='Make sure the "credential" property provided to initializeApp() is authorized to access the specified "databaseURL" and is from the correct project.':"serviceAccount"in this.firebaseOptions_?e+='Make sure the "serviceAccount" property provided to initializeApp() is authorized to access the specified "databaseURL" and is from the correct project.':e+='Make sure the "apiKey" and "databaseURL" properties provided to initializeApp() match the values provided for your app at https://console.firebase.google.com/.',B(e)}}class Qt{constructor(e){this.accessToken=e}getToken(e){return Promise.resolve({accessToken:this.accessToken})}addTokenChangeListener(e){e(this.accessToken)}removeTokenChangeListener(e){}notifyForInvalidToken(){}}Qt.OWNER="owner";/**
1755
+ */class od{constructor(e,t,i){this.appName_=e,this.firebaseOptions_=t,this.authProvider_=i,this.auth_=null,this.auth_=i.getImmediate({optional:!0}),this.auth_||i.onInit(s=>this.auth_=s)}getToken(e){return this.auth_?this.auth_.getToken(e).catch(t=>t&&t.code==="auth/token-not-initialized"?(M("Got auth/token-not-initialized error. Treating as null token."),null):Promise.reject(t)):new Promise((t,i)=>{setTimeout(()=>{this.auth_?this.getToken(e).then(t,i):t(null)},0)})}addTokenChangeListener(e){this.auth_?this.auth_.addAuthTokenListener(e):this.authProvider_.get().then(t=>t.addAuthTokenListener(e))}removeTokenChangeListener(e){this.authProvider_.get().then(t=>t.removeAuthTokenListener(e))}notifyForInvalidToken(){let e='Provided authentication credentials for the app named "'+this.appName_+'" are invalid. This usually indicates your app was not initialized correctly. ';"credential"in this.firebaseOptions_?e+='Make sure the "credential" property provided to initializeApp() is authorized to access the specified "databaseURL" and is from the correct project.':"serviceAccount"in this.firebaseOptions_?e+='Make sure the "serviceAccount" property provided to initializeApp() is authorized to access the specified "databaseURL" and is from the correct project.':e+='Make sure the "apiKey" and "databaseURL" properties provided to initializeApp() match the values provided for your app at https://console.firebase.google.com/.',B(e)}}class Qt{constructor(e){this.accessToken=e}getToken(e){return Promise.resolve({accessToken:this.accessToken})}addTokenChangeListener(e){e(this.accessToken)}removeTokenChangeListener(e){}notifyForInvalidToken(){}}Qt.OWNER="owner";/**
1756
1756
  * @license
1757
1757
  * Copyright 2017 Google LLC
1758
1758
  *
@@ -1767,7 +1767,7 @@ import{a as vi}from"./tslib.es6-De9GV7Vy.js";import{u as Wa,a as Ba,b as Ha,d as
1767
1767
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1768
1768
  * See the License for the specific language governing permissions and
1769
1769
  * limitations under the License.
1770
- */const Li="5",bo="v",Ro="s",Ao="r",ko="f",No=/(console\.firebase|firebase-console-\w+\.corp|firebase\.corp)\.google\.com/,Po="ls",Oo="p",ai="ac",Do="websocket",Mo="long_polling";/**
1770
+ */const Li="5",bo="v",Ro="s",ko="r",Ao="f",No=/(console\.firebase|firebase-console-\w+\.corp|firebase\.corp)\.google\.com/,Po="ls",Oo="p",ai="ac",Do="websocket",Mo="long_polling";/**
1771
1771
  * @license
1772
1772
  * Copyright 2017 Google LLC
1773
1773
  *
@@ -1782,7 +1782,7 @@ import{a as vi}from"./tslib.es6-De9GV7Vy.js";import{u as Wa,a as Ba,b as Ha,d as
1782
1782
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1783
1783
  * See the License for the specific language governing permissions and
1784
1784
  * limitations under the License.
1785
- */class Lo{constructor(e,t,i,s,r=!1,o="",a=!1,l=!1,c=null){this.secure=t,this.namespace=i,this.webSocketOnly=s,this.nodeAdmin=r,this.persistenceKey=o,this.includeNamespaceInQueryParams=a,this.isUsingEmulator=l,this.emulatorOptions=c,this._host=e.toLowerCase(),this._domain=this._host.substr(this._host.indexOf(".")+1),this.internalHost=Ae.get("host:"+e)||this._host}isCacheableHost(){return this.internalHost.substr(0,2)==="s-"}isCustomHost(){return this._domain!=="firebaseio.com"&&this._domain!=="firebaseio-demo.com"}get host(){return this._host}set host(e){e!==this.internalHost&&(this.internalHost=e,this.isCacheableHost()&&Ae.set("host:"+this._host,this.internalHost))}toString(){let e=this.toURLString();return this.persistenceKey&&(e+="<"+this.persistenceKey+">"),e}toURLString(){const e=this.secure?"https://":"http://",t=this.includeNamespaceInQueryParams?`?ns=${this.namespace}`:"";return`${e}${this.host}/${t}`}}function od(n){return n.host!==n.internalHost||n.isCustomHost()||n.includeNamespaceInQueryParams}function xo(n,e,t){f(typeof e=="string","typeof type must == string"),f(typeof t=="object","typeof params must == object");let i;if(e===Do)i=(n.secure?"wss://":"ws://")+n.internalHost+"/.ws?";else if(e===Mo)i=(n.secure?"https://":"http://")+n.internalHost+"/.lp?";else throw new Error("Unknown connection type: "+e);od(n)&&(t.ns=n.namespace);const s=[];return W(t,(r,o)=>{s.push(r+"="+o)}),i+s.join("&")}/**
1785
+ */class Lo{constructor(e,t,i,s,r=!1,o="",a=!1,l=!1,c=null){this.secure=t,this.namespace=i,this.webSocketOnly=s,this.nodeAdmin=r,this.persistenceKey=o,this.includeNamespaceInQueryParams=a,this.isUsingEmulator=l,this.emulatorOptions=c,this._host=e.toLowerCase(),this._domain=this._host.substr(this._host.indexOf(".")+1),this.internalHost=Re.get("host:"+e)||this._host}isCacheableHost(){return this.internalHost.substr(0,2)==="s-"}isCustomHost(){return this._domain!=="firebaseio.com"&&this._domain!=="firebaseio-demo.com"}get host(){return this._host}set host(e){e!==this.internalHost&&(this.internalHost=e,this.isCacheableHost()&&Re.set("host:"+this._host,this.internalHost))}toString(){let e=this.toURLString();return this.persistenceKey&&(e+="<"+this.persistenceKey+">"),e}toURLString(){const e=this.secure?"https://":"http://",t=this.includeNamespaceInQueryParams?`?ns=${this.namespace}`:"";return`${e}${this.host}/${t}`}}function ad(n){return n.host!==n.internalHost||n.isCustomHost()||n.includeNamespaceInQueryParams}function xo(n,e,t){f(typeof e=="string","typeof type must == string"),f(typeof t=="object","typeof params must == object");let i;if(e===Do)i=(n.secure?"wss://":"ws://")+n.internalHost+"/.ws?";else if(e===Mo)i=(n.secure?"https://":"http://")+n.internalHost+"/.lp?";else throw new Error("Unknown connection type: "+e);ad(n)&&(t.ns=n.namespace);const s=[];return W(t,(r,o)=>{s.push(r+"="+o)}),i+s.join("&")}/**
1786
1786
  * @license
1787
1787
  * Copyright 2017 Google LLC
1788
1788
  *
@@ -1797,7 +1797,7 @@ import{a as vi}from"./tslib.es6-De9GV7Vy.js";import{u as Wa,a as Ba,b as Ha,d as
1797
1797
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1798
1798
  * See the License for the specific language governing permissions and
1799
1799
  * limitations under the License.
1800
- */class ad{constructor(){this.counters_={}}incrementCounter(e,t=1){oe(this.counters_,e)||(this.counters_[e]=0),this.counters_[e]+=t}get(){return qa(this.counters_)}}/**
1800
+ */class ld{constructor(){this.counters_={}}incrementCounter(e,t=1){oe(this.counters_,e)||(this.counters_[e]=0),this.counters_[e]+=t}get(){return Ka(this.counters_)}}/**
1801
1801
  * @license
1802
1802
  * Copyright 2017 Google LLC
1803
1803
  *
@@ -1812,7 +1812,7 @@ import{a as vi}from"./tslib.es6-De9GV7Vy.js";import{u as Wa,a as Ba,b as Ha,d as
1812
1812
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1813
1813
  * See the License for the specific language governing permissions and
1814
1814
  * limitations under the License.
1815
- */const Hn={},Vn={};function xi(n){const e=n.toString();return Hn[e]||(Hn[e]=new ad),Hn[e]}function ld(n,e){const t=n.toString();return Vn[t]||(Vn[t]=e()),Vn[t]}/**
1815
+ */const Hn={},Vn={};function xi(n){const e=n.toString();return Hn[e]||(Hn[e]=new ld),Hn[e]}function cd(n,e){const t=n.toString();return Vn[t]||(Vn[t]=e()),Vn[t]}/**
1816
1816
  * @license
1817
1817
  * Copyright 2017 Google LLC
1818
1818
  *
@@ -1827,7 +1827,7 @@ import{a as vi}from"./tslib.es6-De9GV7Vy.js";import{u as Wa,a as Ba,b as Ha,d as
1827
1827
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1828
1828
  * See the License for the specific language governing permissions and
1829
1829
  * limitations under the License.
1830
- */class cd{constructor(e){this.onMessage_=e,this.pendingResponses=[],this.currentResponseNum=0,this.closeAfterResponse=-1,this.onClose=null}closeAfter(e,t){this.closeAfterResponse=e,this.onClose=t,this.closeAfterResponse<this.currentResponseNum&&(this.onClose(),this.onClose=null)}handleResponse(e,t){for(this.pendingResponses[e]=t;this.pendingResponses[this.currentResponseNum];){const i=this.pendingResponses[this.currentResponseNum];delete this.pendingResponses[this.currentResponseNum];for(let s=0;s<i.length;++s)i[s]&&Ut(()=>{this.onMessage_(i[s])});if(this.currentResponseNum===this.closeAfterResponse){this.onClose&&(this.onClose(),this.onClose=null);break}this.currentResponseNum++}}}/**
1830
+ */class hd{constructor(e){this.onMessage_=e,this.pendingResponses=[],this.currentResponseNum=0,this.closeAfterResponse=-1,this.onClose=null}closeAfter(e,t){this.closeAfterResponse=e,this.onClose=t,this.closeAfterResponse<this.currentResponseNum&&(this.onClose(),this.onClose=null)}handleResponse(e,t){for(this.pendingResponses[e]=t;this.pendingResponses[this.currentResponseNum];){const i=this.pendingResponses[this.currentResponseNum];delete this.pendingResponses[this.currentResponseNum];for(let s=0;s<i.length;++s)i[s]&&Ut(()=>{this.onMessage_(i[s])});if(this.currentResponseNum===this.closeAfterResponse){this.onClose&&(this.onClose(),this.onClose=null);break}this.currentResponseNum++}}}/**
1831
1831
  * @license
1832
1832
  * Copyright 2017 Google LLC
1833
1833
  *
@@ -1842,7 +1842,7 @@ import{a as vi}from"./tslib.es6-De9GV7Vy.js";import{u as Wa,a as Ba,b as Ha,d as
1842
1842
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1843
1843
  * See the License for the specific language governing permissions and
1844
1844
  * limitations under the License.
1845
- */const zs="start",hd="close",ud="pLPCommand",dd="pRTLPCB",Fo="id",Uo="pw",Wo="ser",fd="cb",pd="seg",_d="ts",gd="d",md="dframe",Bo=1870,Ho=30,vd=Bo-Ho,yd=25e3,Ed=3e4;class Be{constructor(e,t,i,s,r,o,a){this.connId=e,this.repoInfo=t,this.applicationId=i,this.appCheckToken=s,this.authToken=r,this.transportSessionId=o,this.lastSessionId=a,this.bytesSent=0,this.bytesReceived=0,this.everConnected_=!1,this.log_=Ft(e),this.stats_=xi(t),this.urlFn=l=>(this.appCheckToken&&(l[ai]=this.appCheckToken),xo(t,Mo,l))}open(e,t){this.curSegmentNum=0,this.onDisconnect_=t,this.myPacketOrderer=new cd(e),this.isClosed_=!1,this.connectTimeoutTimer_=setTimeout(()=>{this.log_("Timed out trying to connect."),this.onClosed_(),this.connectTimeoutTimer_=null},Math.floor(Ed)),Yu(()=>{if(this.isClosed_)return;this.scriptTagHolder=new Fi((...r)=>{const[o,a,l,c,d]=r;if(this.incrementIncomingBytes_(r),!!this.scriptTagHolder)if(this.connectTimeoutTimer_&&(clearTimeout(this.connectTimeoutTimer_),this.connectTimeoutTimer_=null),this.everConnected_=!0,o===zs)this.id=a,this.password=l;else if(o===hd)a?(this.scriptTagHolder.sendNewPolls=!1,this.myPacketOrderer.closeAfter(a,()=>{this.onClosed_()})):this.onClosed_();else throw new Error("Unrecognized command received: "+o)},(...r)=>{const[o,a]=r;this.incrementIncomingBytes_(r),this.myPacketOrderer.handleResponse(o,a)},()=>{this.onClosed_()},this.urlFn);const i={};i[zs]="t",i[Wo]=Math.floor(Math.random()*1e8),this.scriptTagHolder.uniqueCallbackIdentifier&&(i[fd]=this.scriptTagHolder.uniqueCallbackIdentifier),i[bo]=Li,this.transportSessionId&&(i[Ro]=this.transportSessionId),this.lastSessionId&&(i[Po]=this.lastSessionId),this.applicationId&&(i[Oo]=this.applicationId),this.appCheckToken&&(i[ai]=this.appCheckToken),typeof location<"u"&&location.hostname&&No.test(location.hostname)&&(i[Ao]=ko);const s=this.urlFn(i);this.log_("Connecting via long-poll to "+s),this.scriptTagHolder.addTag(s,()=>{})})}start(){this.scriptTagHolder.startLongPoll(this.id,this.password),this.addDisconnectPingFrame(this.id,this.password)}static forceAllow(){Be.forceAllow_=!0}static forceDisallow(){Be.forceDisallow_=!0}static isAvailable(){return Be.forceAllow_?!0:!Be.forceDisallow_&&typeof document<"u"&&document.createElement!=null&&!Ju()&&!Xu()}markConnectionHealthy(){}shutdown_(){this.isClosed_=!0,this.scriptTagHolder&&(this.scriptTagHolder.close(),this.scriptTagHolder=null),this.myDisconnFrame&&(document.body.removeChild(this.myDisconnFrame),this.myDisconnFrame=null),this.connectTimeoutTimer_&&(clearTimeout(this.connectTimeoutTimer_),this.connectTimeoutTimer_=null)}onClosed_(){this.isClosed_||(this.log_("Longpoll is closing itself"),this.shutdown_(),this.onDisconnect_&&(this.onDisconnect_(this.everConnected_),this.onDisconnect_=null))}close(){this.isClosed_||(this.log_("Longpoll is being closed."),this.shutdown_())}send(e){const t=k(e);this.bytesSent+=t.length,this.stats_.incrementCounter("bytes_sent",t.length);const i=wr(t),s=To(i,vd);for(let r=0;r<s.length;r++)this.scriptTagHolder.enqueueSegment(this.curSegmentNum,s.length,s[r]),this.curSegmentNum++}addDisconnectPingFrame(e,t){this.myDisconnFrame=document.createElement("iframe");const i={};i[md]="t",i[Fo]=e,i[Uo]=t,this.myDisconnFrame.src=this.urlFn(i),this.myDisconnFrame.style.display="none",document.body.appendChild(this.myDisconnFrame)}incrementIncomingBytes_(e){const t=k(e).length;this.bytesReceived+=t,this.stats_.incrementCounter("bytes_received",t)}}class Fi{constructor(e,t,i,s){this.onDisconnect=i,this.urlFn=s,this.outstandingRequests=new Set,this.pendingSegs=[],this.currentSerial=Math.floor(Math.random()*1e8),this.sendNewPolls=!0;{this.uniqueCallbackIdentifier=zu(),window[ud+this.uniqueCallbackIdentifier]=e,window[dd+this.uniqueCallbackIdentifier]=t,this.myIFrame=Fi.createIFrame_();let r="";this.myIFrame.src&&this.myIFrame.src.substr(0,11)==="javascript:"&&(r='<script>document.domain="'+document.domain+'";<\/script>');const o="<html><body>"+r+"</body></html>";try{this.myIFrame.doc.open(),this.myIFrame.doc.write(o),this.myIFrame.doc.close()}catch(a){M("frame writing exception"),a.stack&&M(a.stack),M(a)}}}static createIFrame_(){const e=document.createElement("iframe");if(e.style.display="none",document.body){document.body.appendChild(e);try{e.contentWindow.document||M("No IE domain setting required")}catch{const i=document.domain;e.src="javascript:void((function(){document.open();document.domain='"+i+"';document.close();})())"}}else throw"Document body has not initialized. Wait to initialize Firebase until after the document is ready.";return e.contentDocument?e.doc=e.contentDocument:e.contentWindow?e.doc=e.contentWindow.document:e.document&&(e.doc=e.document),e}close(){this.alive=!1,this.myIFrame&&(this.myIFrame.doc.body.textContent="",setTimeout(()=>{this.myIFrame!==null&&(document.body.removeChild(this.myIFrame),this.myIFrame=null)},Math.floor(0)));const e=this.onDisconnect;e&&(this.onDisconnect=null,e())}startLongPoll(e,t){for(this.myID=e,this.myPW=t,this.alive=!0;this.newRequest_(););}newRequest_(){if(this.alive&&this.sendNewPolls&&this.outstandingRequests.size<(this.pendingSegs.length>0?2:1)){this.currentSerial++;const e={};e[Fo]=this.myID,e[Uo]=this.myPW,e[Wo]=this.currentSerial;let t=this.urlFn(e),i="",s=0;for(;this.pendingSegs.length>0&&this.pendingSegs[0].d.length+Ho+i.length<=Bo;){const o=this.pendingSegs.shift();i=i+"&"+pd+s+"="+o.seg+"&"+_d+s+"="+o.ts+"&"+gd+s+"="+o.d,s++}return t=t+i,this.addLongPollTag_(t,this.currentSerial),!0}else return!1}enqueueSegment(e,t,i){this.pendingSegs.push({seg:e,ts:t,d:i}),this.alive&&this.newRequest_()}addLongPollTag_(e,t){this.outstandingRequests.add(t);const i=()=>{this.outstandingRequests.delete(t),this.newRequest_()},s=setTimeout(i,Math.floor(yd)),r=()=>{clearTimeout(s),i()};this.addTag(e,r)}addTag(e,t){setTimeout(()=>{try{if(!this.sendNewPolls)return;const i=this.myIFrame.doc.createElement("script");i.type="text/javascript",i.async=!0,i.src=e,i.onload=i.onreadystatechange=function(){const s=i.readyState;(!s||s==="loaded"||s==="complete")&&(i.onload=i.onreadystatechange=null,i.parentNode&&i.parentNode.removeChild(i),t())},i.onerror=()=>{M("Long-poll script failed to load: "+e),this.sendNewPolls=!1,this.close()},this.myIFrame.doc.body.appendChild(i)}catch{}},Math.floor(1))}}/**
1845
+ */const zs="start",ud="close",dd="pLPCommand",fd="pRTLPCB",Fo="id",Uo="pw",Wo="ser",pd="cb",_d="seg",gd="ts",md="d",vd="dframe",Bo=1870,Ho=30,yd=Bo-Ho,Ed=25e3,Id=3e4;class We{constructor(e,t,i,s,r,o,a){this.connId=e,this.repoInfo=t,this.applicationId=i,this.appCheckToken=s,this.authToken=r,this.transportSessionId=o,this.lastSessionId=a,this.bytesSent=0,this.bytesReceived=0,this.everConnected_=!1,this.log_=Ft(e),this.stats_=xi(t),this.urlFn=l=>(this.appCheckToken&&(l[ai]=this.appCheckToken),xo(t,Mo,l))}open(e,t){this.curSegmentNum=0,this.onDisconnect_=t,this.myPacketOrderer=new hd(e),this.isClosed_=!1,this.connectTimeoutTimer_=setTimeout(()=>{this.log_("Timed out trying to connect."),this.onClosed_(),this.connectTimeoutTimer_=null},Math.floor(Id)),Qu(()=>{if(this.isClosed_)return;this.scriptTagHolder=new Fi((...r)=>{const[o,a,l,c,d]=r;if(this.incrementIncomingBytes_(r),!!this.scriptTagHolder)if(this.connectTimeoutTimer_&&(clearTimeout(this.connectTimeoutTimer_),this.connectTimeoutTimer_=null),this.everConnected_=!0,o===zs)this.id=a,this.password=l;else if(o===ud)a?(this.scriptTagHolder.sendNewPolls=!1,this.myPacketOrderer.closeAfter(a,()=>{this.onClosed_()})):this.onClosed_();else throw new Error("Unrecognized command received: "+o)},(...r)=>{const[o,a]=r;this.incrementIncomingBytes_(r),this.myPacketOrderer.handleResponse(o,a)},()=>{this.onClosed_()},this.urlFn);const i={};i[zs]="t",i[Wo]=Math.floor(Math.random()*1e8),this.scriptTagHolder.uniqueCallbackIdentifier&&(i[pd]=this.scriptTagHolder.uniqueCallbackIdentifier),i[bo]=Li,this.transportSessionId&&(i[Ro]=this.transportSessionId),this.lastSessionId&&(i[Po]=this.lastSessionId),this.applicationId&&(i[Oo]=this.applicationId),this.appCheckToken&&(i[ai]=this.appCheckToken),typeof location<"u"&&location.hostname&&No.test(location.hostname)&&(i[ko]=Ao);const s=this.urlFn(i);this.log_("Connecting via long-poll to "+s),this.scriptTagHolder.addTag(s,()=>{})})}start(){this.scriptTagHolder.startLongPoll(this.id,this.password),this.addDisconnectPingFrame(this.id,this.password)}static forceAllow(){We.forceAllow_=!0}static forceDisallow(){We.forceDisallow_=!0}static isAvailable(){return We.forceAllow_?!0:!We.forceDisallow_&&typeof document<"u"&&document.createElement!=null&&!Xu()&&!Zu()}markConnectionHealthy(){}shutdown_(){this.isClosed_=!0,this.scriptTagHolder&&(this.scriptTagHolder.close(),this.scriptTagHolder=null),this.myDisconnFrame&&(document.body.removeChild(this.myDisconnFrame),this.myDisconnFrame=null),this.connectTimeoutTimer_&&(clearTimeout(this.connectTimeoutTimer_),this.connectTimeoutTimer_=null)}onClosed_(){this.isClosed_||(this.log_("Longpoll is closing itself"),this.shutdown_(),this.onDisconnect_&&(this.onDisconnect_(this.everConnected_),this.onDisconnect_=null))}close(){this.isClosed_||(this.log_("Longpoll is being closed."),this.shutdown_())}send(e){const t=A(e);this.bytesSent+=t.length,this.stats_.incrementCounter("bytes_sent",t.length);const i=wr(t),s=To(i,yd);for(let r=0;r<s.length;r++)this.scriptTagHolder.enqueueSegment(this.curSegmentNum,s.length,s[r]),this.curSegmentNum++}addDisconnectPingFrame(e,t){this.myDisconnFrame=document.createElement("iframe");const i={};i[vd]="t",i[Fo]=e,i[Uo]=t,this.myDisconnFrame.src=this.urlFn(i),this.myDisconnFrame.style.display="none",document.body.appendChild(this.myDisconnFrame)}incrementIncomingBytes_(e){const t=A(e).length;this.bytesReceived+=t,this.stats_.incrementCounter("bytes_received",t)}}class Fi{constructor(e,t,i,s){this.onDisconnect=i,this.urlFn=s,this.outstandingRequests=new Set,this.pendingSegs=[],this.currentSerial=Math.floor(Math.random()*1e8),this.sendNewPolls=!0;{this.uniqueCallbackIdentifier=qu(),window[dd+this.uniqueCallbackIdentifier]=e,window[fd+this.uniqueCallbackIdentifier]=t,this.myIFrame=Fi.createIFrame_();let r="";this.myIFrame.src&&this.myIFrame.src.substr(0,11)==="javascript:"&&(r='<script>document.domain="'+document.domain+'";<\/script>');const o="<html><body>"+r+"</body></html>";try{this.myIFrame.doc.open(),this.myIFrame.doc.write(o),this.myIFrame.doc.close()}catch(a){M("frame writing exception"),a.stack&&M(a.stack),M(a)}}}static createIFrame_(){const e=document.createElement("iframe");if(e.style.display="none",document.body){document.body.appendChild(e);try{e.contentWindow.document||M("No IE domain setting required")}catch{const i=document.domain;e.src="javascript:void((function(){document.open();document.domain='"+i+"';document.close();})())"}}else throw"Document body has not initialized. Wait to initialize Firebase until after the document is ready.";return e.contentDocument?e.doc=e.contentDocument:e.contentWindow?e.doc=e.contentWindow.document:e.document&&(e.doc=e.document),e}close(){this.alive=!1,this.myIFrame&&(this.myIFrame.doc.body.textContent="",setTimeout(()=>{this.myIFrame!==null&&(document.body.removeChild(this.myIFrame),this.myIFrame=null)},Math.floor(0)));const e=this.onDisconnect;e&&(this.onDisconnect=null,e())}startLongPoll(e,t){for(this.myID=e,this.myPW=t,this.alive=!0;this.newRequest_(););}newRequest_(){if(this.alive&&this.sendNewPolls&&this.outstandingRequests.size<(this.pendingSegs.length>0?2:1)){this.currentSerial++;const e={};e[Fo]=this.myID,e[Uo]=this.myPW,e[Wo]=this.currentSerial;let t=this.urlFn(e),i="",s=0;for(;this.pendingSegs.length>0&&this.pendingSegs[0].d.length+Ho+i.length<=Bo;){const o=this.pendingSegs.shift();i=i+"&"+_d+s+"="+o.seg+"&"+gd+s+"="+o.ts+"&"+md+s+"="+o.d,s++}return t=t+i,this.addLongPollTag_(t,this.currentSerial),!0}else return!1}enqueueSegment(e,t,i){this.pendingSegs.push({seg:e,ts:t,d:i}),this.alive&&this.newRequest_()}addLongPollTag_(e,t){this.outstandingRequests.add(t);const i=()=>{this.outstandingRequests.delete(t),this.newRequest_()},s=setTimeout(i,Math.floor(Ed)),r=()=>{clearTimeout(s),i()};this.addTag(e,r)}addTag(e,t){setTimeout(()=>{try{if(!this.sendNewPolls)return;const i=this.myIFrame.doc.createElement("script");i.type="text/javascript",i.async=!0,i.src=e,i.onload=i.onreadystatechange=function(){const s=i.readyState;(!s||s==="loaded"||s==="complete")&&(i.onload=i.onreadystatechange=null,i.parentNode&&i.parentNode.removeChild(i),t())},i.onerror=()=>{M("Long-poll script failed to load: "+e),this.sendNewPolls=!1,this.close()},this.myIFrame.doc.body.appendChild(i)}catch{}},Math.floor(1))}}/**
1846
1846
  * @license
1847
1847
  * Copyright 2017 Google LLC
1848
1848
  *
@@ -1857,7 +1857,7 @@ import{a as vi}from"./tslib.es6-De9GV7Vy.js";import{u as Wa,a as Ba,b as Ha,d as
1857
1857
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1858
1858
  * See the License for the specific language governing permissions and
1859
1859
  * limitations under the License.
1860
- */const Id=16384,Cd=45e3;let ln=null;typeof MozWebSocket<"u"?ln=MozWebSocket:typeof WebSocket<"u"&&(ln=WebSocket);class j{constructor(e,t,i,s,r,o,a){this.connId=e,this.applicationId=i,this.appCheckToken=s,this.authToken=r,this.keepaliveTimer=null,this.frames=null,this.totalFrames=0,this.bytesSent=0,this.bytesReceived=0,this.log_=Ft(this.connId),this.stats_=xi(t),this.connURL=j.connectionURL_(t,o,a,s,i),this.nodeAdmin=t.nodeAdmin}static connectionURL_(e,t,i,s,r){const o={};return o[bo]=Li,typeof location<"u"&&location.hostname&&No.test(location.hostname)&&(o[Ao]=ko),t&&(o[Ro]=t),i&&(o[Po]=i),s&&(o[ai]=s),r&&(o[Oo]=r),xo(e,Do,o)}open(e,t){this.onDisconnect=t,this.onMessage=e,this.log_("Websocket connecting to "+this.connURL),this.everConnected_=!1,Ae.set("previous_websocket_failure",!0);try{let i;ol(),this.mySock=new ln(this.connURL,[],i)}catch(i){this.log_("Error instantiating WebSocket.");const s=i.message||i.data;s&&this.log_(s),this.onClosed_();return}this.mySock.onopen=()=>{this.log_("Websocket connected."),this.everConnected_=!0},this.mySock.onclose=()=>{this.log_("Websocket connection was disconnected."),this.mySock=null,this.onClosed_()},this.mySock.onmessage=i=>{this.handleIncomingFrame(i)},this.mySock.onerror=i=>{this.log_("WebSocket error. Closing connection.");const s=i.message||i.data;s&&this.log_(s),this.onClosed_()}}start(){}static forceDisallow(){j.forceDisallow_=!0}static isAvailable(){let e=!1;if(typeof navigator<"u"&&navigator.userAgent){const t=/Android ([0-9]{0,}\.[0-9]{0,})/,i=navigator.userAgent.match(t);i&&i.length>1&&parseFloat(i[1])<4.4&&(e=!0)}return!e&&ln!==null&&!j.forceDisallow_}static previouslyFailed(){return Ae.isInMemoryStorage||Ae.get("previous_websocket_failure")===!0}markConnectionHealthy(){Ae.remove("previous_websocket_failure")}appendFrame_(e){if(this.frames.push(e),this.frames.length===this.totalFrames){const t=this.frames.join("");this.frames=null;const i=Et(t);this.onMessage(i)}}handleNewFrameCount_(e){this.totalFrames=e,this.frames=[]}extractFrameCount_(e){if(f(this.frames===null,"We already have a frame buffer"),e.length<=6){const t=Number(e);if(!isNaN(t))return this.handleNewFrameCount_(t),null}return this.handleNewFrameCount_(1),e}handleIncomingFrame(e){if(this.mySock===null)return;const t=e.data;if(this.bytesReceived+=t.length,this.stats_.incrementCounter("bytes_received",t.length),this.resetKeepAlive(),this.frames!==null)this.appendFrame_(t);else{const i=this.extractFrameCount_(t);i!==null&&this.appendFrame_(i)}}send(e){this.resetKeepAlive();const t=k(e);this.bytesSent+=t.length,this.stats_.incrementCounter("bytes_sent",t.length);const i=To(t,Id);i.length>1&&this.sendString_(String(i.length));for(let s=0;s<i.length;s++)this.sendString_(i[s])}shutdown_(){this.isClosed_=!0,this.keepaliveTimer&&(clearInterval(this.keepaliveTimer),this.keepaliveTimer=null),this.mySock&&(this.mySock.close(),this.mySock=null)}onClosed_(){this.isClosed_||(this.log_("WebSocket is closing itself"),this.shutdown_(),this.onDisconnect&&(this.onDisconnect(this.everConnected_),this.onDisconnect=null))}close(){this.isClosed_||(this.log_("WebSocket is being closed"),this.shutdown_())}resetKeepAlive(){clearInterval(this.keepaliveTimer),this.keepaliveTimer=setInterval(()=>{this.mySock&&this.sendString_("0"),this.resetKeepAlive()},Math.floor(Cd))}sendString_(e){try{this.mySock.send(e)}catch(t){this.log_("Exception thrown from WebSocket.send():",t.message||t.data,"Closing connection."),setTimeout(this.onClosed_.bind(this),0)}}}j.responsesRequiredToBeHealthy=2;j.healthyTimeout=3e4;/**
1860
+ */const Cd=16384,wd=45e3;let ln=null;typeof MozWebSocket<"u"?ln=MozWebSocket:typeof WebSocket<"u"&&(ln=WebSocket);class j{constructor(e,t,i,s,r,o,a){this.connId=e,this.applicationId=i,this.appCheckToken=s,this.authToken=r,this.keepaliveTimer=null,this.frames=null,this.totalFrames=0,this.bytesSent=0,this.bytesReceived=0,this.log_=Ft(this.connId),this.stats_=xi(t),this.connURL=j.connectionURL_(t,o,a,s,i),this.nodeAdmin=t.nodeAdmin}static connectionURL_(e,t,i,s,r){const o={};return o[bo]=Li,typeof location<"u"&&location.hostname&&No.test(location.hostname)&&(o[ko]=Ao),t&&(o[Ro]=t),i&&(o[Po]=i),s&&(o[ai]=s),r&&(o[Oo]=r),xo(e,Do,o)}open(e,t){this.onDisconnect=t,this.onMessage=e,this.log_("Websocket connecting to "+this.connURL),this.everConnected_=!1,Re.set("previous_websocket_failure",!0);try{let i;al(),this.mySock=new ln(this.connURL,[],i)}catch(i){this.log_("Error instantiating WebSocket.");const s=i.message||i.data;s&&this.log_(s),this.onClosed_();return}this.mySock.onopen=()=>{this.log_("Websocket connected."),this.everConnected_=!0},this.mySock.onclose=()=>{this.log_("Websocket connection was disconnected."),this.mySock=null,this.onClosed_()},this.mySock.onmessage=i=>{this.handleIncomingFrame(i)},this.mySock.onerror=i=>{this.log_("WebSocket error. Closing connection.");const s=i.message||i.data;s&&this.log_(s),this.onClosed_()}}start(){}static forceDisallow(){j.forceDisallow_=!0}static isAvailable(){let e=!1;if(typeof navigator<"u"&&navigator.userAgent){const t=/Android ([0-9]{0,}\.[0-9]{0,})/,i=navigator.userAgent.match(t);i&&i.length>1&&parseFloat(i[1])<4.4&&(e=!0)}return!e&&ln!==null&&!j.forceDisallow_}static previouslyFailed(){return Re.isInMemoryStorage||Re.get("previous_websocket_failure")===!0}markConnectionHealthy(){Re.remove("previous_websocket_failure")}appendFrame_(e){if(this.frames.push(e),this.frames.length===this.totalFrames){const t=this.frames.join("");this.frames=null;const i=Et(t);this.onMessage(i)}}handleNewFrameCount_(e){this.totalFrames=e,this.frames=[]}extractFrameCount_(e){if(f(this.frames===null,"We already have a frame buffer"),e.length<=6){const t=Number(e);if(!isNaN(t))return this.handleNewFrameCount_(t),null}return this.handleNewFrameCount_(1),e}handleIncomingFrame(e){if(this.mySock===null)return;const t=e.data;if(this.bytesReceived+=t.length,this.stats_.incrementCounter("bytes_received",t.length),this.resetKeepAlive(),this.frames!==null)this.appendFrame_(t);else{const i=this.extractFrameCount_(t);i!==null&&this.appendFrame_(i)}}send(e){this.resetKeepAlive();const t=A(e);this.bytesSent+=t.length,this.stats_.incrementCounter("bytes_sent",t.length);const i=To(t,Cd);i.length>1&&this.sendString_(String(i.length));for(let s=0;s<i.length;s++)this.sendString_(i[s])}shutdown_(){this.isClosed_=!0,this.keepaliveTimer&&(clearInterval(this.keepaliveTimer),this.keepaliveTimer=null),this.mySock&&(this.mySock.close(),this.mySock=null)}onClosed_(){this.isClosed_||(this.log_("WebSocket is closing itself"),this.shutdown_(),this.onDisconnect&&(this.onDisconnect(this.everConnected_),this.onDisconnect=null))}close(){this.isClosed_||(this.log_("WebSocket is being closed"),this.shutdown_())}resetKeepAlive(){clearInterval(this.keepaliveTimer),this.keepaliveTimer=setInterval(()=>{this.mySock&&this.sendString_("0"),this.resetKeepAlive()},Math.floor(wd))}sendString_(e){try{this.mySock.send(e)}catch(t){this.log_("Exception thrown from WebSocket.send():",t.message||t.data,"Closing connection."),setTimeout(this.onClosed_.bind(this),0)}}}j.responsesRequiredToBeHealthy=2;j.healthyTimeout=3e4;/**
1861
1861
  * @license
1862
1862
  * Copyright 2017 Google LLC
1863
1863
  *
@@ -1872,7 +1872,7 @@ import{a as vi}from"./tslib.es6-De9GV7Vy.js";import{u as Wa,a as Ba,b as Ha,d as
1872
1872
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1873
1873
  * See the License for the specific language governing permissions and
1874
1874
  * limitations under the License.
1875
- */class Tt{static get ALL_TRANSPORTS(){return[Be,j]}static get IS_TRANSPORT_INITIALIZED(){return this.globalTransportInitialized_}constructor(e){this.initTransports_(e)}initTransports_(e){const t=j&&j.isAvailable();let i=t&&!j.previouslyFailed();if(e.webSocketOnly&&(t||B("wss:// URL used, but browser isn't known to support websockets. Trying anyway."),i=!0),i)this.transports_=[j];else{const s=this.transports_=[];for(const r of Tt.ALL_TRANSPORTS)r&&r.isAvailable()&&s.push(r);Tt.globalTransportInitialized_=!0}}initialTransport(){if(this.transports_.length>0)return this.transports_[0];throw new Error("No transports available")}upgradeTransport(){return this.transports_.length>1?this.transports_[1]:null}}Tt.globalTransportInitialized_=!1;/**
1875
+ */class Tt{static get ALL_TRANSPORTS(){return[We,j]}static get IS_TRANSPORT_INITIALIZED(){return this.globalTransportInitialized_}constructor(e){this.initTransports_(e)}initTransports_(e){const t=j&&j.isAvailable();let i=t&&!j.previouslyFailed();if(e.webSocketOnly&&(t||B("wss:// URL used, but browser isn't known to support websockets. Trying anyway."),i=!0),i)this.transports_=[j];else{const s=this.transports_=[];for(const r of Tt.ALL_TRANSPORTS)r&&r.isAvailable()&&s.push(r);Tt.globalTransportInitialized_=!0}}initialTransport(){if(this.transports_.length>0)return this.transports_[0];throw new Error("No transports available")}upgradeTransport(){return this.transports_.length>1?this.transports_[1]:null}}Tt.globalTransportInitialized_=!1;/**
1876
1876
  * @license
1877
1877
  * Copyright 2017 Google LLC
1878
1878
  *
@@ -1887,7 +1887,7 @@ import{a as vi}from"./tslib.es6-De9GV7Vy.js";import{u as Wa,a as Ba,b as Ha,d as
1887
1887
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1888
1888
  * See the License for the specific language governing permissions and
1889
1889
  * limitations under the License.
1890
- */const wd=6e4,Td=5e3,Sd=10*1024,bd=100*1024,$n="t",qs="d",Rd="s",Ks="r",Ad="e",Ys="o",Qs="a",Js="n",Xs="p",kd="h";class Nd{constructor(e,t,i,s,r,o,a,l,c,d){this.id=e,this.repoInfo_=t,this.applicationId_=i,this.appCheckToken_=s,this.authToken_=r,this.onMessage_=o,this.onReady_=a,this.onDisconnect_=l,this.onKill_=c,this.lastSessionId=d,this.connectionCount=0,this.pendingDataMessages=[],this.state_=0,this.log_=Ft("c:"+this.id+":"),this.transportManager_=new Tt(t),this.log_("Connection created"),this.start_()}start_(){const e=this.transportManager_.initialTransport();this.conn_=new e(this.nextTransportId_(),this.repoInfo_,this.applicationId_,this.appCheckToken_,this.authToken_,null,this.lastSessionId),this.primaryResponsesRequired_=e.responsesRequiredToBeHealthy||0;const t=this.connReceiver_(this.conn_),i=this.disconnReceiver_(this.conn_);this.tx_=this.conn_,this.rx_=this.conn_,this.secondaryConn_=null,this.isHealthy_=!1,setTimeout(()=>{this.conn_&&this.conn_.open(t,i)},Math.floor(0));const s=e.healthyTimeout||0;s>0&&(this.healthyTimeout_=gt(()=>{this.healthyTimeout_=null,this.isHealthy_||(this.conn_&&this.conn_.bytesReceived>bd?(this.log_("Connection exceeded healthy timeout but has received "+this.conn_.bytesReceived+" bytes. Marking connection healthy."),this.isHealthy_=!0,this.conn_.markConnectionHealthy()):this.conn_&&this.conn_.bytesSent>Sd?this.log_("Connection exceeded healthy timeout but has sent "+this.conn_.bytesSent+" bytes. Leaving connection alive."):(this.log_("Closing unhealthy connection after timeout."),this.close()))},Math.floor(s)))}nextTransportId_(){return"c:"+this.id+":"+this.connectionCount++}disconnReceiver_(e){return t=>{e===this.conn_?this.onConnectionLost_(t):e===this.secondaryConn_?(this.log_("Secondary connection lost."),this.onSecondaryConnectionLost_()):this.log_("closing an old connection")}}connReceiver_(e){return t=>{this.state_!==2&&(e===this.rx_?this.onPrimaryMessageReceived_(t):e===this.secondaryConn_?this.onSecondaryMessageReceived_(t):this.log_("message on old connection"))}}sendRequest(e){const t={t:"d",d:e};this.sendData_(t)}tryCleanupConnection(){this.tx_===this.secondaryConn_&&this.rx_===this.secondaryConn_&&(this.log_("cleaning up and promoting a connection: "+this.secondaryConn_.connId),this.conn_=this.secondaryConn_,this.secondaryConn_=null)}onSecondaryControl_(e){if($n in e){const t=e[$n];t===Qs?this.upgradeIfSecondaryHealthy_():t===Ks?(this.log_("Got a reset on secondary, closing it"),this.secondaryConn_.close(),(this.tx_===this.secondaryConn_||this.rx_===this.secondaryConn_)&&this.close()):t===Ys&&(this.log_("got pong on secondary."),this.secondaryResponsesRequired_--,this.upgradeIfSecondaryHealthy_())}}onSecondaryMessageReceived_(e){const t=at("t",e),i=at("d",e);if(t==="c")this.onSecondaryControl_(i);else if(t==="d")this.pendingDataMessages.push(i);else throw new Error("Unknown protocol layer: "+t)}upgradeIfSecondaryHealthy_(){this.secondaryResponsesRequired_<=0?(this.log_("Secondary connection is healthy."),this.isHealthy_=!0,this.secondaryConn_.markConnectionHealthy(),this.proceedWithUpgrade_()):(this.log_("sending ping on secondary."),this.secondaryConn_.send({t:"c",d:{t:Xs,d:{}}}))}proceedWithUpgrade_(){this.secondaryConn_.start(),this.log_("sending client ack on secondary"),this.secondaryConn_.send({t:"c",d:{t:Qs,d:{}}}),this.log_("Ending transmission on primary"),this.conn_.send({t:"c",d:{t:Js,d:{}}}),this.tx_=this.secondaryConn_,this.tryCleanupConnection()}onPrimaryMessageReceived_(e){const t=at("t",e),i=at("d",e);t==="c"?this.onControl_(i):t==="d"&&this.onDataMessage_(i)}onDataMessage_(e){this.onPrimaryResponse_(),this.onMessage_(e)}onPrimaryResponse_(){this.isHealthy_||(this.primaryResponsesRequired_--,this.primaryResponsesRequired_<=0&&(this.log_("Primary connection is healthy."),this.isHealthy_=!0,this.conn_.markConnectionHealthy()))}onControl_(e){const t=at($n,e);if(qs in e){const i=e[qs];if(t===kd){const s=Object.assign({},i);this.repoInfo_.isUsingEmulator&&(s.h=this.repoInfo_.host),this.onHandshake_(s)}else if(t===Js){this.log_("recvd end transmission on primary"),this.rx_=this.secondaryConn_;for(let s=0;s<this.pendingDataMessages.length;++s)this.onDataMessage_(this.pendingDataMessages[s]);this.pendingDataMessages=[],this.tryCleanupConnection()}else t===Rd?this.onConnectionShutdown_(i):t===Ks?this.onReset_(i):t===Ad?oi("Server Error: "+i):t===Ys?(this.log_("got pong on primary."),this.onPrimaryResponse_(),this.sendPingOnPrimaryIfNecessary_()):oi("Unknown control packet command: "+t)}}onHandshake_(e){const t=e.ts,i=e.v,s=e.h;this.sessionId=e.s,this.repoInfo_.host=s,this.state_===0&&(this.conn_.start(),this.onConnectionEstablished_(this.conn_,t),Li!==i&&B("Protocol version mismatch detected"),this.tryStartUpgrade_())}tryStartUpgrade_(){const e=this.transportManager_.upgradeTransport();e&&this.startUpgrade_(e)}startUpgrade_(e){this.secondaryConn_=new e(this.nextTransportId_(),this.repoInfo_,this.applicationId_,this.appCheckToken_,this.authToken_,this.sessionId),this.secondaryResponsesRequired_=e.responsesRequiredToBeHealthy||0;const t=this.connReceiver_(this.secondaryConn_),i=this.disconnReceiver_(this.secondaryConn_);this.secondaryConn_.open(t,i),gt(()=>{this.secondaryConn_&&(this.log_("Timed out trying to upgrade."),this.secondaryConn_.close())},Math.floor(wd))}onReset_(e){this.log_("Reset packet received. New host: "+e),this.repoInfo_.host=e,this.state_===1?this.close():(this.closeConnections_(),this.start_())}onConnectionEstablished_(e,t){this.log_("Realtime connection established."),this.conn_=e,this.state_=1,this.onReady_&&(this.onReady_(t,this.sessionId),this.onReady_=null),this.primaryResponsesRequired_===0?(this.log_("Primary connection is healthy."),this.isHealthy_=!0):gt(()=>{this.sendPingOnPrimaryIfNecessary_()},Math.floor(Td))}sendPingOnPrimaryIfNecessary_(){!this.isHealthy_&&this.state_===1&&(this.log_("sending ping on primary."),this.sendData_({t:"c",d:{t:Xs,d:{}}}))}onSecondaryConnectionLost_(){const e=this.secondaryConn_;this.secondaryConn_=null,(this.tx_===e||this.rx_===e)&&this.close()}onConnectionLost_(e){this.conn_=null,!e&&this.state_===0?(this.log_("Realtime connection failed."),this.repoInfo_.isCacheableHost()&&(Ae.remove("host:"+this.repoInfo_.host),this.repoInfo_.internalHost=this.repoInfo_.host)):this.state_===1&&this.log_("Realtime connection lost."),this.close()}onConnectionShutdown_(e){this.log_("Connection shutdown command received. Shutting down..."),this.onKill_&&(this.onKill_(e),this.onKill_=null),this.onDisconnect_=null,this.close()}sendData_(e){if(this.state_!==1)throw"Connection is not connected";this.tx_.send(e)}close(){this.state_!==2&&(this.log_("Closing realtime connection."),this.state_=2,this.closeConnections_(),this.onDisconnect_&&(this.onDisconnect_(),this.onDisconnect_=null))}closeConnections_(){this.log_("Shutting down all connections"),this.conn_&&(this.conn_.close(),this.conn_=null),this.secondaryConn_&&(this.secondaryConn_.close(),this.secondaryConn_=null),this.healthyTimeout_&&(clearTimeout(this.healthyTimeout_),this.healthyTimeout_=null)}}/**
1890
+ */const Td=6e4,Sd=5e3,bd=10*1024,Rd=100*1024,$n="t",qs="d",kd="s",Ks="r",Ad="e",Ys="o",Qs="a",Js="n",Xs="p",Nd="h";class Pd{constructor(e,t,i,s,r,o,a,l,c,d){this.id=e,this.repoInfo_=t,this.applicationId_=i,this.appCheckToken_=s,this.authToken_=r,this.onMessage_=o,this.onReady_=a,this.onDisconnect_=l,this.onKill_=c,this.lastSessionId=d,this.connectionCount=0,this.pendingDataMessages=[],this.state_=0,this.log_=Ft("c:"+this.id+":"),this.transportManager_=new Tt(t),this.log_("Connection created"),this.start_()}start_(){const e=this.transportManager_.initialTransport();this.conn_=new e(this.nextTransportId_(),this.repoInfo_,this.applicationId_,this.appCheckToken_,this.authToken_,null,this.lastSessionId),this.primaryResponsesRequired_=e.responsesRequiredToBeHealthy||0;const t=this.connReceiver_(this.conn_),i=this.disconnReceiver_(this.conn_);this.tx_=this.conn_,this.rx_=this.conn_,this.secondaryConn_=null,this.isHealthy_=!1,setTimeout(()=>{this.conn_&&this.conn_.open(t,i)},Math.floor(0));const s=e.healthyTimeout||0;s>0&&(this.healthyTimeout_=gt(()=>{this.healthyTimeout_=null,this.isHealthy_||(this.conn_&&this.conn_.bytesReceived>Rd?(this.log_("Connection exceeded healthy timeout but has received "+this.conn_.bytesReceived+" bytes. Marking connection healthy."),this.isHealthy_=!0,this.conn_.markConnectionHealthy()):this.conn_&&this.conn_.bytesSent>bd?this.log_("Connection exceeded healthy timeout but has sent "+this.conn_.bytesSent+" bytes. Leaving connection alive."):(this.log_("Closing unhealthy connection after timeout."),this.close()))},Math.floor(s)))}nextTransportId_(){return"c:"+this.id+":"+this.connectionCount++}disconnReceiver_(e){return t=>{e===this.conn_?this.onConnectionLost_(t):e===this.secondaryConn_?(this.log_("Secondary connection lost."),this.onSecondaryConnectionLost_()):this.log_("closing an old connection")}}connReceiver_(e){return t=>{this.state_!==2&&(e===this.rx_?this.onPrimaryMessageReceived_(t):e===this.secondaryConn_?this.onSecondaryMessageReceived_(t):this.log_("message on old connection"))}}sendRequest(e){const t={t:"d",d:e};this.sendData_(t)}tryCleanupConnection(){this.tx_===this.secondaryConn_&&this.rx_===this.secondaryConn_&&(this.log_("cleaning up and promoting a connection: "+this.secondaryConn_.connId),this.conn_=this.secondaryConn_,this.secondaryConn_=null)}onSecondaryControl_(e){if($n in e){const t=e[$n];t===Qs?this.upgradeIfSecondaryHealthy_():t===Ks?(this.log_("Got a reset on secondary, closing it"),this.secondaryConn_.close(),(this.tx_===this.secondaryConn_||this.rx_===this.secondaryConn_)&&this.close()):t===Ys&&(this.log_("got pong on secondary."),this.secondaryResponsesRequired_--,this.upgradeIfSecondaryHealthy_())}}onSecondaryMessageReceived_(e){const t=at("t",e),i=at("d",e);if(t==="c")this.onSecondaryControl_(i);else if(t==="d")this.pendingDataMessages.push(i);else throw new Error("Unknown protocol layer: "+t)}upgradeIfSecondaryHealthy_(){this.secondaryResponsesRequired_<=0?(this.log_("Secondary connection is healthy."),this.isHealthy_=!0,this.secondaryConn_.markConnectionHealthy(),this.proceedWithUpgrade_()):(this.log_("sending ping on secondary."),this.secondaryConn_.send({t:"c",d:{t:Xs,d:{}}}))}proceedWithUpgrade_(){this.secondaryConn_.start(),this.log_("sending client ack on secondary"),this.secondaryConn_.send({t:"c",d:{t:Qs,d:{}}}),this.log_("Ending transmission on primary"),this.conn_.send({t:"c",d:{t:Js,d:{}}}),this.tx_=this.secondaryConn_,this.tryCleanupConnection()}onPrimaryMessageReceived_(e){const t=at("t",e),i=at("d",e);t==="c"?this.onControl_(i):t==="d"&&this.onDataMessage_(i)}onDataMessage_(e){this.onPrimaryResponse_(),this.onMessage_(e)}onPrimaryResponse_(){this.isHealthy_||(this.primaryResponsesRequired_--,this.primaryResponsesRequired_<=0&&(this.log_("Primary connection is healthy."),this.isHealthy_=!0,this.conn_.markConnectionHealthy()))}onControl_(e){const t=at($n,e);if(qs in e){const i=e[qs];if(t===Nd){const s=Object.assign({},i);this.repoInfo_.isUsingEmulator&&(s.h=this.repoInfo_.host),this.onHandshake_(s)}else if(t===Js){this.log_("recvd end transmission on primary"),this.rx_=this.secondaryConn_;for(let s=0;s<this.pendingDataMessages.length;++s)this.onDataMessage_(this.pendingDataMessages[s]);this.pendingDataMessages=[],this.tryCleanupConnection()}else t===kd?this.onConnectionShutdown_(i):t===Ks?this.onReset_(i):t===Ad?oi("Server Error: "+i):t===Ys?(this.log_("got pong on primary."),this.onPrimaryResponse_(),this.sendPingOnPrimaryIfNecessary_()):oi("Unknown control packet command: "+t)}}onHandshake_(e){const t=e.ts,i=e.v,s=e.h;this.sessionId=e.s,this.repoInfo_.host=s,this.state_===0&&(this.conn_.start(),this.onConnectionEstablished_(this.conn_,t),Li!==i&&B("Protocol version mismatch detected"),this.tryStartUpgrade_())}tryStartUpgrade_(){const e=this.transportManager_.upgradeTransport();e&&this.startUpgrade_(e)}startUpgrade_(e){this.secondaryConn_=new e(this.nextTransportId_(),this.repoInfo_,this.applicationId_,this.appCheckToken_,this.authToken_,this.sessionId),this.secondaryResponsesRequired_=e.responsesRequiredToBeHealthy||0;const t=this.connReceiver_(this.secondaryConn_),i=this.disconnReceiver_(this.secondaryConn_);this.secondaryConn_.open(t,i),gt(()=>{this.secondaryConn_&&(this.log_("Timed out trying to upgrade."),this.secondaryConn_.close())},Math.floor(Td))}onReset_(e){this.log_("Reset packet received. New host: "+e),this.repoInfo_.host=e,this.state_===1?this.close():(this.closeConnections_(),this.start_())}onConnectionEstablished_(e,t){this.log_("Realtime connection established."),this.conn_=e,this.state_=1,this.onReady_&&(this.onReady_(t,this.sessionId),this.onReady_=null),this.primaryResponsesRequired_===0?(this.log_("Primary connection is healthy."),this.isHealthy_=!0):gt(()=>{this.sendPingOnPrimaryIfNecessary_()},Math.floor(Sd))}sendPingOnPrimaryIfNecessary_(){!this.isHealthy_&&this.state_===1&&(this.log_("sending ping on primary."),this.sendData_({t:"c",d:{t:Xs,d:{}}}))}onSecondaryConnectionLost_(){const e=this.secondaryConn_;this.secondaryConn_=null,(this.tx_===e||this.rx_===e)&&this.close()}onConnectionLost_(e){this.conn_=null,!e&&this.state_===0?(this.log_("Realtime connection failed."),this.repoInfo_.isCacheableHost()&&(Re.remove("host:"+this.repoInfo_.host),this.repoInfo_.internalHost=this.repoInfo_.host)):this.state_===1&&this.log_("Realtime connection lost."),this.close()}onConnectionShutdown_(e){this.log_("Connection shutdown command received. Shutting down..."),this.onKill_&&(this.onKill_(e),this.onKill_=null),this.onDisconnect_=null,this.close()}sendData_(e){if(this.state_!==1)throw"Connection is not connected";this.tx_.send(e)}close(){this.state_!==2&&(this.log_("Closing realtime connection."),this.state_=2,this.closeConnections_(),this.onDisconnect_&&(this.onDisconnect_(),this.onDisconnect_=null))}closeConnections_(){this.log_("Shutting down all connections"),this.conn_&&(this.conn_.close(),this.conn_=null),this.secondaryConn_&&(this.secondaryConn_.close(),this.secondaryConn_=null),this.healthyTimeout_&&(clearTimeout(this.healthyTimeout_),this.healthyTimeout_=null)}}/**
1891
1891
  * @license
1892
1892
  * Copyright 2017 Google LLC
1893
1893
  *
@@ -1947,7 +1947,7 @@ import{a as vi}from"./tslib.es6-De9GV7Vy.js";import{u as Wa,a as Ba,b as Ha,d as
1947
1947
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1948
1948
  * See the License for the specific language governing permissions and
1949
1949
  * limitations under the License.
1950
- */const Zs=32,er=768;class T{constructor(e,t){if(t===void 0){this.pieces_=e.split("/");let i=0;for(let s=0;s<this.pieces_.length;s++)this.pieces_[s].length>0&&(this.pieces_[i]=this.pieces_[s],i++);this.pieces_.length=i,this.pieceNum_=0}else this.pieces_=e,this.pieceNum_=t}toString(){let e="";for(let t=this.pieceNum_;t<this.pieces_.length;t++)this.pieces_[t]!==""&&(e+="/"+this.pieces_[t]);return e||"/"}}function I(){return new T("")}function E(n){return n.pieceNum_>=n.pieces_.length?null:n.pieces_[n.pieceNum_]}function ye(n){return n.pieces_.length-n.pieceNum_}function S(n){let e=n.pieceNum_;return e<n.pieces_.length&&e++,new T(n.pieces_,e)}function Go(n){return n.pieceNum_<n.pieces_.length?n.pieces_[n.pieces_.length-1]:null}function Pd(n){let e="";for(let t=n.pieceNum_;t<n.pieces_.length;t++)n.pieces_[t]!==""&&(e+="/"+encodeURIComponent(String(n.pieces_[t])));return e||"/"}function jo(n,e=0){return n.pieces_.slice(n.pieceNum_+e)}function zo(n){if(n.pieceNum_>=n.pieces_.length)return null;const e=[];for(let t=n.pieceNum_;t<n.pieces_.length-1;t++)e.push(n.pieces_[t]);return new T(e,0)}function N(n,e){const t=[];for(let i=n.pieceNum_;i<n.pieces_.length;i++)t.push(n.pieces_[i]);if(e instanceof T)for(let i=e.pieceNum_;i<e.pieces_.length;i++)t.push(e.pieces_[i]);else{const i=e.split("/");for(let s=0;s<i.length;s++)i[s].length>0&&t.push(i[s])}return new T(t,0)}function y(n){return n.pieceNum_>=n.pieces_.length}function L(n,e){const t=E(n),i=E(e);if(t===null)return e;if(t===i)return L(S(n),S(e));throw new Error("INTERNAL ERROR: innerPath ("+e+") is not within outerPath ("+n+")")}function qo(n,e){if(ye(n)!==ye(e))return!1;for(let t=n.pieceNum_,i=e.pieceNum_;t<=n.pieces_.length;t++,i++)if(n.pieces_[t]!==e.pieces_[i])return!1;return!0}function q(n,e){let t=n.pieceNum_,i=e.pieceNum_;if(ye(n)>ye(e))return!1;for(;t<n.pieces_.length;){if(n.pieces_[t]!==e.pieces_[i])return!1;++t,++i}return!0}class Od{constructor(e,t){this.errorPrefix_=t,this.parts_=jo(e,0),this.byteLength_=Math.max(1,this.parts_.length);for(let i=0;i<this.parts_.length;i++)this.byteLength_+=En(this.parts_[i]);Ko(this)}}function Dd(n,e){n.parts_.length>0&&(n.byteLength_+=1),n.parts_.push(e),n.byteLength_+=En(e),Ko(n)}function Md(n){const e=n.parts_.pop();n.byteLength_-=En(e),n.parts_.length>0&&(n.byteLength_-=1)}function Ko(n){if(n.byteLength_>er)throw new Error(n.errorPrefix_+"has a key path longer than "+er+" bytes ("+n.byteLength_+").");if(n.parts_.length>Zs)throw new Error(n.errorPrefix_+"path specified exceeds the maximum depth that can be written ("+Zs+") or object contains a cycle "+be(n))}function be(n){return n.parts_.length===0?"":"in property '"+n.parts_.join(".")+"'"}/**
1950
+ */const Zs=32,er=768;class T{constructor(e,t){if(t===void 0){this.pieces_=e.split("/");let i=0;for(let s=0;s<this.pieces_.length;s++)this.pieces_[s].length>0&&(this.pieces_[i]=this.pieces_[s],i++);this.pieces_.length=i,this.pieceNum_=0}else this.pieces_=e,this.pieceNum_=t}toString(){let e="";for(let t=this.pieceNum_;t<this.pieces_.length;t++)this.pieces_[t]!==""&&(e+="/"+this.pieces_[t]);return e||"/"}}function I(){return new T("")}function E(n){return n.pieceNum_>=n.pieces_.length?null:n.pieces_[n.pieceNum_]}function ye(n){return n.pieces_.length-n.pieceNum_}function S(n){let e=n.pieceNum_;return e<n.pieces_.length&&e++,new T(n.pieces_,e)}function Go(n){return n.pieceNum_<n.pieces_.length?n.pieces_[n.pieces_.length-1]:null}function Od(n){let e="";for(let t=n.pieceNum_;t<n.pieces_.length;t++)n.pieces_[t]!==""&&(e+="/"+encodeURIComponent(String(n.pieces_[t])));return e||"/"}function jo(n,e=0){return n.pieces_.slice(n.pieceNum_+e)}function zo(n){if(n.pieceNum_>=n.pieces_.length)return null;const e=[];for(let t=n.pieceNum_;t<n.pieces_.length-1;t++)e.push(n.pieces_[t]);return new T(e,0)}function N(n,e){const t=[];for(let i=n.pieceNum_;i<n.pieces_.length;i++)t.push(n.pieces_[i]);if(e instanceof T)for(let i=e.pieceNum_;i<e.pieces_.length;i++)t.push(e.pieces_[i]);else{const i=e.split("/");for(let s=0;s<i.length;s++)i[s].length>0&&t.push(i[s])}return new T(t,0)}function y(n){return n.pieceNum_>=n.pieces_.length}function L(n,e){const t=E(n),i=E(e);if(t===null)return e;if(t===i)return L(S(n),S(e));throw new Error("INTERNAL ERROR: innerPath ("+e+") is not within outerPath ("+n+")")}function qo(n,e){if(ye(n)!==ye(e))return!1;for(let t=n.pieceNum_,i=e.pieceNum_;t<=n.pieces_.length;t++,i++)if(n.pieces_[t]!==e.pieces_[i])return!1;return!0}function q(n,e){let t=n.pieceNum_,i=e.pieceNum_;if(ye(n)>ye(e))return!1;for(;t<n.pieces_.length;){if(n.pieces_[t]!==e.pieces_[i])return!1;++t,++i}return!0}class Dd{constructor(e,t){this.errorPrefix_=t,this.parts_=jo(e,0),this.byteLength_=Math.max(1,this.parts_.length);for(let i=0;i<this.parts_.length;i++)this.byteLength_+=En(this.parts_[i]);Ko(this)}}function Md(n,e){n.parts_.length>0&&(n.byteLength_+=1),n.parts_.push(e),n.byteLength_+=En(e),Ko(n)}function Ld(n){const e=n.parts_.pop();n.byteLength_-=En(e),n.parts_.length>0&&(n.byteLength_-=1)}function Ko(n){if(n.byteLength_>er)throw new Error(n.errorPrefix_+"has a key path longer than "+er+" bytes ("+n.byteLength_+").");if(n.parts_.length>Zs)throw new Error(n.errorPrefix_+"path specified exceeds the maximum depth that can be written ("+Zs+") or object contains a cycle "+be(n))}function be(n){return n.parts_.length===0?"":"in property '"+n.parts_.join(".")+"'"}/**
1951
1951
  * @license
1952
1952
  * Copyright 2017 Google LLC
1953
1953
  *
@@ -1977,8 +1977,8 @@ import{a as vi}from"./tslib.es6-De9GV7Vy.js";import{u as Wa,a as Ba,b as Ha,d as
1977
1977
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1978
1978
  * See the License for the specific language governing permissions and
1979
1979
  * limitations under the License.
1980
- */const lt=1e3,Ld=60*5*1e3,tr=30*1e3,xd=1.3,Fd=3e4,Ud="server_kill",nr=3;class ne extends Vo{constructor(e,t,i,s,r,o,a,l){if(super(),this.repoInfo_=e,this.applicationId_=t,this.onDataUpdate_=i,this.onConnectStatus_=s,this.onServerInfoUpdate_=r,this.authTokenProvider_=o,this.appCheckTokenProvider_=a,this.authOverride_=l,this.id=ne.nextPersistentConnectionId_++,this.log_=Ft("p:"+this.id+":"),this.interruptReasons_={},this.listens=new Map,this.outstandingPuts_=[],this.outstandingGets_=[],this.outstandingPutCount_=0,this.outstandingGetCount_=0,this.onDisconnectRequestQueue_=[],this.connected_=!1,this.reconnectDelay_=lt,this.maxReconnectDelay_=Ld,this.securityDebugCallback_=null,this.lastSessionId=null,this.establishConnectionTimer_=null,this.visible_=!1,this.requestCBHash_={},this.requestNumber_=0,this.realtime_=null,this.authToken_=null,this.appCheckToken_=null,this.forceTokenRefresh_=!1,this.invalidAuthTokenCount_=0,this.invalidAppCheckTokenCount_=0,this.firstConnection_=!0,this.lastConnectionAttemptTime_=null,this.lastConnectionEstablishedTime_=null,l)throw new Error("Auth override specified in options, but not supported on non Node.js platforms");Ui.getInstance().on("visible",this.onVisible_,this),e.host.indexOf("fblocal")===-1&&cn.getInstance().on("online",this.onOnline_,this)}sendRequest(e,t,i){const s=++this.requestNumber_,r={r:s,a:e,b:t};this.log_(k(r)),f(this.connected_,"sendRequest call when we're not connected not allowed."),this.realtime_.sendRequest(r),i&&(this.requestCBHash_[s]=i)}get(e){this.initConnection_();const t=new Ii,s={action:"g",request:{p:e._path.toString(),q:e._queryObject},onComplete:o=>{const a=o.d;o.s==="ok"?t.resolve(a):t.reject(a)}};this.outstandingGets_.push(s),this.outstandingGetCount_++;const r=this.outstandingGets_.length-1;return this.connected_&&this.sendGet_(r),t.promise}listen(e,t,i,s){this.initConnection_();const r=e._queryIdentifier,o=e._path.toString();this.log_("Listen called for "+o+" "+r),this.listens.has(o)||this.listens.set(o,new Map),f(e._queryParams.isDefault()||!e._queryParams.loadsAllData(),"listen() called for non-default but complete query"),f(!this.listens.get(o).has(r),"listen() called twice for same path/queryId.");const a={onComplete:s,hashFn:t,query:e,tag:i};this.listens.get(o).set(r,a),this.connected_&&this.sendListen_(a)}sendGet_(e){const t=this.outstandingGets_[e];this.sendRequest("g",t.request,i=>{delete this.outstandingGets_[e],this.outstandingGetCount_--,this.outstandingGetCount_===0&&(this.outstandingGets_=[]),t.onComplete&&t.onComplete(i)})}sendListen_(e){const t=e.query,i=t._path.toString(),s=t._queryIdentifier;this.log_("Listen on "+i+" for "+s);const r={p:i},o="q";e.tag&&(r.q=t._queryObject,r.t=e.tag),r.h=e.hashFn(),this.sendRequest(o,r,a=>{const l=a.d,c=a.s;ne.warnOnListenWarnings_(l,t),(this.listens.get(i)&&this.listens.get(i).get(s))===e&&(this.log_("listen response",a),c!=="ok"&&this.removeListen_(i,s),e.onComplete&&e.onComplete(c,l))})}static warnOnListenWarnings_(e,t){if(e&&typeof e=="object"&&oe(e,"w")){const i=qe(e,"w");if(Array.isArray(i)&&~i.indexOf("no_index")){const s='".indexOn": "'+t._queryParams.getIndex().toString()+'"',r=t._path.toString();B(`Using an unspecified index. Your data will be downloaded and filtered on the client. Consider adding ${s} at ${r} to your security rules for better performance.`)}}}refreshAuthToken(e){this.authToken_=e,this.log_("Auth token refreshed"),this.authToken_?this.tryAuth():this.connected_&&this.sendRequest("unauth",{},()=>{}),this.reduceReconnectDelayIfAdminCredential_(e)}reduceReconnectDelayIfAdminCredential_(e){(e&&e.length===40||fl(e))&&(this.log_("Admin auth credential detected. Reducing max reconnect time."),this.maxReconnectDelay_=tr)}refreshAppCheckToken(e){this.appCheckToken_=e,this.log_("App check token refreshed"),this.appCheckToken_?this.tryAppCheck():this.connected_&&this.sendRequest("unappeck",{},()=>{})}tryAuth(){if(this.connected_&&this.authToken_){const e=this.authToken_,t=dl(e)?"auth":"gauth",i={cred:e};this.authOverride_===null?i.noauth=!0:typeof this.authOverride_=="object"&&(i.authvar=this.authOverride_),this.sendRequest(t,i,s=>{const r=s.s,o=s.d||"error";this.authToken_===e&&(r==="ok"?this.invalidAuthTokenCount_=0:this.onAuthRevoked_(r,o))})}}tryAppCheck(){this.connected_&&this.appCheckToken_&&this.sendRequest("appcheck",{token:this.appCheckToken_},e=>{const t=e.s,i=e.d||"error";t==="ok"?this.invalidAppCheckTokenCount_=0:this.onAppCheckRevoked_(t,i)})}unlisten(e,t){const i=e._path.toString(),s=e._queryIdentifier;this.log_("Unlisten called for "+i+" "+s),f(e._queryParams.isDefault()||!e._queryParams.loadsAllData(),"unlisten() called for non-default but complete query"),this.removeListen_(i,s)&&this.connected_&&this.sendUnlisten_(i,s,e._queryObject,t)}sendUnlisten_(e,t,i,s){this.log_("Unlisten on "+e+" for "+t);const r={p:e},o="n";s&&(r.q=i,r.t=s),this.sendRequest(o,r)}onDisconnectPut(e,t,i){this.initConnection_(),this.connected_?this.sendOnDisconnect_("o",e,t,i):this.onDisconnectRequestQueue_.push({pathString:e,action:"o",data:t,onComplete:i})}onDisconnectMerge(e,t,i){this.initConnection_(),this.connected_?this.sendOnDisconnect_("om",e,t,i):this.onDisconnectRequestQueue_.push({pathString:e,action:"om",data:t,onComplete:i})}onDisconnectCancel(e,t){this.initConnection_(),this.connected_?this.sendOnDisconnect_("oc",e,null,t):this.onDisconnectRequestQueue_.push({pathString:e,action:"oc",data:null,onComplete:t})}sendOnDisconnect_(e,t,i,s){const r={p:t,d:i};this.log_("onDisconnect "+e,r),this.sendRequest(e,r,o=>{s&&setTimeout(()=>{s(o.s,o.d)},Math.floor(0))})}put(e,t,i,s){this.putInternal("p",e,t,i,s)}merge(e,t,i,s){this.putInternal("m",e,t,i,s)}putInternal(e,t,i,s,r){this.initConnection_();const o={p:t,d:i};r!==void 0&&(o.h=r),this.outstandingPuts_.push({action:e,request:o,onComplete:s}),this.outstandingPutCount_++;const a=this.outstandingPuts_.length-1;this.connected_?this.sendPut_(a):this.log_("Buffering put: "+t)}sendPut_(e){const t=this.outstandingPuts_[e].action,i=this.outstandingPuts_[e].request,s=this.outstandingPuts_[e].onComplete;this.outstandingPuts_[e].queued=this.connected_,this.sendRequest(t,i,r=>{this.log_(t+" response",r),delete this.outstandingPuts_[e],this.outstandingPutCount_--,this.outstandingPutCount_===0&&(this.outstandingPuts_=[]),s&&s(r.s,r.d)})}reportStats(e){if(this.connected_){const t={c:e};this.log_("reportStats",t),this.sendRequest("s",t,i=>{if(i.s!=="ok"){const r=i.d;this.log_("reportStats","Error sending stats: "+r)}})}}onDataMessage_(e){if("r"in e){this.log_("from server: "+k(e));const t=e.r,i=this.requestCBHash_[t];i&&(delete this.requestCBHash_[t],i(e.b))}else{if("error"in e)throw"A server-side error has occurred: "+e.error;"a"in e&&this.onDataPush_(e.a,e.b)}}onDataPush_(e,t){this.log_("handleServerMessage",e,t),e==="d"?this.onDataUpdate_(t.p,t.d,!1,t.t):e==="m"?this.onDataUpdate_(t.p,t.d,!0,t.t):e==="c"?this.onListenRevoked_(t.p,t.q):e==="ac"?this.onAuthRevoked_(t.s,t.d):e==="apc"?this.onAppCheckRevoked_(t.s,t.d):e==="sd"?this.onSecurityDebugPacket_(t):oi("Unrecognized action received from server: "+k(e)+`
1981
- Are you using the latest client?`)}onReady_(e,t){this.log_("connection ready"),this.connected_=!0,this.lastConnectionEstablishedTime_=new Date().getTime(),this.handleTimestamp_(e),this.lastSessionId=t,this.firstConnection_&&this.sendConnectStats_(),this.restoreState_(),this.firstConnection_=!1,this.onConnectStatus_(!0)}scheduleConnect_(e){f(!this.realtime_,"Scheduling a connect when we're already connected/ing?"),this.establishConnectionTimer_&&clearTimeout(this.establishConnectionTimer_),this.establishConnectionTimer_=setTimeout(()=>{this.establishConnectionTimer_=null,this.establishConnection_()},Math.floor(e))}initConnection_(){!this.realtime_&&this.firstConnection_&&this.scheduleConnect_(0)}onVisible_(e){e&&!this.visible_&&this.reconnectDelay_===this.maxReconnectDelay_&&(this.log_("Window became visible. Reducing delay."),this.reconnectDelay_=lt,this.realtime_||this.scheduleConnect_(0)),this.visible_=e}onOnline_(e){e?(this.log_("Browser went online."),this.reconnectDelay_=lt,this.realtime_||this.scheduleConnect_(0)):(this.log_("Browser went offline. Killing connection."),this.realtime_&&this.realtime_.close())}onRealtimeDisconnect_(){if(this.log_("data client disconnected"),this.connected_=!1,this.realtime_=null,this.cancelSentTransactions_(),this.requestCBHash_={},this.shouldReconnect_()){this.visible_?this.lastConnectionEstablishedTime_&&(new Date().getTime()-this.lastConnectionEstablishedTime_>Fd&&(this.reconnectDelay_=lt),this.lastConnectionEstablishedTime_=null):(this.log_("Window isn't visible. Delaying reconnect."),this.reconnectDelay_=this.maxReconnectDelay_,this.lastConnectionAttemptTime_=new Date().getTime());const e=Math.max(0,new Date().getTime()-this.lastConnectionAttemptTime_);let t=Math.max(0,this.reconnectDelay_-e);t=Math.random()*t,this.log_("Trying to reconnect in "+t+"ms"),this.scheduleConnect_(t),this.reconnectDelay_=Math.min(this.maxReconnectDelay_,this.reconnectDelay_*xd)}this.onConnectStatus_(!1)}async establishConnection_(){if(this.shouldReconnect_()){this.log_("Making a connection attempt"),this.lastConnectionAttemptTime_=new Date().getTime(),this.lastConnectionEstablishedTime_=null;const e=this.onDataMessage_.bind(this),t=this.onReady_.bind(this),i=this.onRealtimeDisconnect_.bind(this),s=this.id+":"+ne.nextConnectionId_++,r=this.lastSessionId;let o=!1,a=null;const l=function(){a?a.close():(o=!0,i())},c=function(h){f(a,"sendRequest call when we're not connected not allowed."),a.sendRequest(h)};this.realtime_={close:l,sendRequest:c};const d=this.forceTokenRefresh_;this.forceTokenRefresh_=!1;try{const[h,u]=await Promise.all([this.authTokenProvider_.getToken(d),this.appCheckTokenProvider_.getToken(d)]);o?M("getToken() completed but was canceled"):(M("getToken() completed. Creating connection."),this.authToken_=h&&h.accessToken,this.appCheckToken_=u&&u.token,a=new Nd(s,this.repoInfo_,this.applicationId_,this.appCheckToken_,this.authToken_,e,t,i,p=>{B(p+" ("+this.repoInfo_.toString()+")"),this.interrupt(Ud)},r))}catch(h){this.log_("Failed to get token: "+h),o||(this.repoInfo_.nodeAdmin&&B(h),l())}}}interrupt(e){M("Interrupting connection for reason: "+e),this.interruptReasons_[e]=!0,this.realtime_?this.realtime_.close():(this.establishConnectionTimer_&&(clearTimeout(this.establishConnectionTimer_),this.establishConnectionTimer_=null),this.connected_&&this.onRealtimeDisconnect_())}resume(e){M("Resuming connection for reason: "+e),delete this.interruptReasons_[e],Qn(this.interruptReasons_)&&(this.reconnectDelay_=lt,this.realtime_||this.scheduleConnect_(0))}handleTimestamp_(e){const t=e-new Date().getTime();this.onServerInfoUpdate_({serverTimeOffset:t})}cancelSentTransactions_(){for(let e=0;e<this.outstandingPuts_.length;e++){const t=this.outstandingPuts_[e];t&&"h"in t.request&&t.queued&&(t.onComplete&&t.onComplete("disconnect"),delete this.outstandingPuts_[e],this.outstandingPutCount_--)}this.outstandingPutCount_===0&&(this.outstandingPuts_=[])}onListenRevoked_(e,t){let i;t?i=t.map(r=>Mi(r)).join("$"):i="default";const s=this.removeListen_(e,i);s&&s.onComplete&&s.onComplete("permission_denied")}removeListen_(e,t){const i=new T(e).toString();let s;if(this.listens.has(i)){const r=this.listens.get(i);s=r.get(t),r.delete(t),r.size===0&&this.listens.delete(i)}else s=void 0;return s}onAuthRevoked_(e,t){M("Auth token revoked: "+e+"/"+t),this.authToken_=null,this.forceTokenRefresh_=!0,this.realtime_.close(),(e==="invalid_token"||e==="permission_denied")&&(this.invalidAuthTokenCount_++,this.invalidAuthTokenCount_>=nr&&(this.reconnectDelay_=tr,this.authTokenProvider_.notifyForInvalidToken()))}onAppCheckRevoked_(e,t){M("App check token revoked: "+e+"/"+t),this.appCheckToken_=null,this.forceTokenRefresh_=!0,(e==="invalid_token"||e==="permission_denied")&&(this.invalidAppCheckTokenCount_++,this.invalidAppCheckTokenCount_>=nr&&this.appCheckTokenProvider_.notifyForInvalidToken())}onSecurityDebugPacket_(e){this.securityDebugCallback_?this.securityDebugCallback_(e):"msg"in e&&console.log("FIREBASE: "+e.msg.replace(`
1980
+ */const lt=1e3,xd=60*5*1e3,tr=30*1e3,Fd=1.3,Ud=3e4,Wd="server_kill",nr=3;class ne extends Vo{constructor(e,t,i,s,r,o,a,l){if(super(),this.repoInfo_=e,this.applicationId_=t,this.onDataUpdate_=i,this.onConnectStatus_=s,this.onServerInfoUpdate_=r,this.authTokenProvider_=o,this.appCheckTokenProvider_=a,this.authOverride_=l,this.id=ne.nextPersistentConnectionId_++,this.log_=Ft("p:"+this.id+":"),this.interruptReasons_={},this.listens=new Map,this.outstandingPuts_=[],this.outstandingGets_=[],this.outstandingPutCount_=0,this.outstandingGetCount_=0,this.onDisconnectRequestQueue_=[],this.connected_=!1,this.reconnectDelay_=lt,this.maxReconnectDelay_=xd,this.securityDebugCallback_=null,this.lastSessionId=null,this.establishConnectionTimer_=null,this.visible_=!1,this.requestCBHash_={},this.requestNumber_=0,this.realtime_=null,this.authToken_=null,this.appCheckToken_=null,this.forceTokenRefresh_=!1,this.invalidAuthTokenCount_=0,this.invalidAppCheckTokenCount_=0,this.firstConnection_=!0,this.lastConnectionAttemptTime_=null,this.lastConnectionEstablishedTime_=null,l)throw new Error("Auth override specified in options, but not supported on non Node.js platforms");Ui.getInstance().on("visible",this.onVisible_,this),e.host.indexOf("fblocal")===-1&&cn.getInstance().on("online",this.onOnline_,this)}sendRequest(e,t,i){const s=++this.requestNumber_,r={r:s,a:e,b:t};this.log_(A(r)),f(this.connected_,"sendRequest call when we're not connected not allowed."),this.realtime_.sendRequest(r),i&&(this.requestCBHash_[s]=i)}get(e){this.initConnection_();const t=new Ii,s={action:"g",request:{p:e._path.toString(),q:e._queryObject},onComplete:o=>{const a=o.d;o.s==="ok"?t.resolve(a):t.reject(a)}};this.outstandingGets_.push(s),this.outstandingGetCount_++;const r=this.outstandingGets_.length-1;return this.connected_&&this.sendGet_(r),t.promise}listen(e,t,i,s){this.initConnection_();const r=e._queryIdentifier,o=e._path.toString();this.log_("Listen called for "+o+" "+r),this.listens.has(o)||this.listens.set(o,new Map),f(e._queryParams.isDefault()||!e._queryParams.loadsAllData(),"listen() called for non-default but complete query"),f(!this.listens.get(o).has(r),"listen() called twice for same path/queryId.");const a={onComplete:s,hashFn:t,query:e,tag:i};this.listens.get(o).set(r,a),this.connected_&&this.sendListen_(a)}sendGet_(e){const t=this.outstandingGets_[e];this.sendRequest("g",t.request,i=>{delete this.outstandingGets_[e],this.outstandingGetCount_--,this.outstandingGetCount_===0&&(this.outstandingGets_=[]),t.onComplete&&t.onComplete(i)})}sendListen_(e){const t=e.query,i=t._path.toString(),s=t._queryIdentifier;this.log_("Listen on "+i+" for "+s);const r={p:i},o="q";e.tag&&(r.q=t._queryObject,r.t=e.tag),r.h=e.hashFn(),this.sendRequest(o,r,a=>{const l=a.d,c=a.s;ne.warnOnListenWarnings_(l,t),(this.listens.get(i)&&this.listens.get(i).get(s))===e&&(this.log_("listen response",a),c!=="ok"&&this.removeListen_(i,s),e.onComplete&&e.onComplete(c,l))})}static warnOnListenWarnings_(e,t){if(e&&typeof e=="object"&&oe(e,"w")){const i=qe(e,"w");if(Array.isArray(i)&&~i.indexOf("no_index")){const s='".indexOn": "'+t._queryParams.getIndex().toString()+'"',r=t._path.toString();B(`Using an unspecified index. Your data will be downloaded and filtered on the client. Consider adding ${s} at ${r} to your security rules for better performance.`)}}}refreshAuthToken(e){this.authToken_=e,this.log_("Auth token refreshed"),this.authToken_?this.tryAuth():this.connected_&&this.sendRequest("unauth",{},()=>{}),this.reduceReconnectDelayIfAdminCredential_(e)}reduceReconnectDelayIfAdminCredential_(e){(e&&e.length===40||pl(e))&&(this.log_("Admin auth credential detected. Reducing max reconnect time."),this.maxReconnectDelay_=tr)}refreshAppCheckToken(e){this.appCheckToken_=e,this.log_("App check token refreshed"),this.appCheckToken_?this.tryAppCheck():this.connected_&&this.sendRequest("unappeck",{},()=>{})}tryAuth(){if(this.connected_&&this.authToken_){const e=this.authToken_,t=fl(e)?"auth":"gauth",i={cred:e};this.authOverride_===null?i.noauth=!0:typeof this.authOverride_=="object"&&(i.authvar=this.authOverride_),this.sendRequest(t,i,s=>{const r=s.s,o=s.d||"error";this.authToken_===e&&(r==="ok"?this.invalidAuthTokenCount_=0:this.onAuthRevoked_(r,o))})}}tryAppCheck(){this.connected_&&this.appCheckToken_&&this.sendRequest("appcheck",{token:this.appCheckToken_},e=>{const t=e.s,i=e.d||"error";t==="ok"?this.invalidAppCheckTokenCount_=0:this.onAppCheckRevoked_(t,i)})}unlisten(e,t){const i=e._path.toString(),s=e._queryIdentifier;this.log_("Unlisten called for "+i+" "+s),f(e._queryParams.isDefault()||!e._queryParams.loadsAllData(),"unlisten() called for non-default but complete query"),this.removeListen_(i,s)&&this.connected_&&this.sendUnlisten_(i,s,e._queryObject,t)}sendUnlisten_(e,t,i,s){this.log_("Unlisten on "+e+" for "+t);const r={p:e},o="n";s&&(r.q=i,r.t=s),this.sendRequest(o,r)}onDisconnectPut(e,t,i){this.initConnection_(),this.connected_?this.sendOnDisconnect_("o",e,t,i):this.onDisconnectRequestQueue_.push({pathString:e,action:"o",data:t,onComplete:i})}onDisconnectMerge(e,t,i){this.initConnection_(),this.connected_?this.sendOnDisconnect_("om",e,t,i):this.onDisconnectRequestQueue_.push({pathString:e,action:"om",data:t,onComplete:i})}onDisconnectCancel(e,t){this.initConnection_(),this.connected_?this.sendOnDisconnect_("oc",e,null,t):this.onDisconnectRequestQueue_.push({pathString:e,action:"oc",data:null,onComplete:t})}sendOnDisconnect_(e,t,i,s){const r={p:t,d:i};this.log_("onDisconnect "+e,r),this.sendRequest(e,r,o=>{s&&setTimeout(()=>{s(o.s,o.d)},Math.floor(0))})}put(e,t,i,s){this.putInternal("p",e,t,i,s)}merge(e,t,i,s){this.putInternal("m",e,t,i,s)}putInternal(e,t,i,s,r){this.initConnection_();const o={p:t,d:i};r!==void 0&&(o.h=r),this.outstandingPuts_.push({action:e,request:o,onComplete:s}),this.outstandingPutCount_++;const a=this.outstandingPuts_.length-1;this.connected_?this.sendPut_(a):this.log_("Buffering put: "+t)}sendPut_(e){const t=this.outstandingPuts_[e].action,i=this.outstandingPuts_[e].request,s=this.outstandingPuts_[e].onComplete;this.outstandingPuts_[e].queued=this.connected_,this.sendRequest(t,i,r=>{this.log_(t+" response",r),delete this.outstandingPuts_[e],this.outstandingPutCount_--,this.outstandingPutCount_===0&&(this.outstandingPuts_=[]),s&&s(r.s,r.d)})}reportStats(e){if(this.connected_){const t={c:e};this.log_("reportStats",t),this.sendRequest("s",t,i=>{if(i.s!=="ok"){const r=i.d;this.log_("reportStats","Error sending stats: "+r)}})}}onDataMessage_(e){if("r"in e){this.log_("from server: "+A(e));const t=e.r,i=this.requestCBHash_[t];i&&(delete this.requestCBHash_[t],i(e.b))}else{if("error"in e)throw"A server-side error has occurred: "+e.error;"a"in e&&this.onDataPush_(e.a,e.b)}}onDataPush_(e,t){this.log_("handleServerMessage",e,t),e==="d"?this.onDataUpdate_(t.p,t.d,!1,t.t):e==="m"?this.onDataUpdate_(t.p,t.d,!0,t.t):e==="c"?this.onListenRevoked_(t.p,t.q):e==="ac"?this.onAuthRevoked_(t.s,t.d):e==="apc"?this.onAppCheckRevoked_(t.s,t.d):e==="sd"?this.onSecurityDebugPacket_(t):oi("Unrecognized action received from server: "+A(e)+`
1981
+ Are you using the latest client?`)}onReady_(e,t){this.log_("connection ready"),this.connected_=!0,this.lastConnectionEstablishedTime_=new Date().getTime(),this.handleTimestamp_(e),this.lastSessionId=t,this.firstConnection_&&this.sendConnectStats_(),this.restoreState_(),this.firstConnection_=!1,this.onConnectStatus_(!0)}scheduleConnect_(e){f(!this.realtime_,"Scheduling a connect when we're already connected/ing?"),this.establishConnectionTimer_&&clearTimeout(this.establishConnectionTimer_),this.establishConnectionTimer_=setTimeout(()=>{this.establishConnectionTimer_=null,this.establishConnection_()},Math.floor(e))}initConnection_(){!this.realtime_&&this.firstConnection_&&this.scheduleConnect_(0)}onVisible_(e){e&&!this.visible_&&this.reconnectDelay_===this.maxReconnectDelay_&&(this.log_("Window became visible. Reducing delay."),this.reconnectDelay_=lt,this.realtime_||this.scheduleConnect_(0)),this.visible_=e}onOnline_(e){e?(this.log_("Browser went online."),this.reconnectDelay_=lt,this.realtime_||this.scheduleConnect_(0)):(this.log_("Browser went offline. Killing connection."),this.realtime_&&this.realtime_.close())}onRealtimeDisconnect_(){if(this.log_("data client disconnected"),this.connected_=!1,this.realtime_=null,this.cancelSentTransactions_(),this.requestCBHash_={},this.shouldReconnect_()){this.visible_?this.lastConnectionEstablishedTime_&&(new Date().getTime()-this.lastConnectionEstablishedTime_>Ud&&(this.reconnectDelay_=lt),this.lastConnectionEstablishedTime_=null):(this.log_("Window isn't visible. Delaying reconnect."),this.reconnectDelay_=this.maxReconnectDelay_,this.lastConnectionAttemptTime_=new Date().getTime());const e=Math.max(0,new Date().getTime()-this.lastConnectionAttemptTime_);let t=Math.max(0,this.reconnectDelay_-e);t=Math.random()*t,this.log_("Trying to reconnect in "+t+"ms"),this.scheduleConnect_(t),this.reconnectDelay_=Math.min(this.maxReconnectDelay_,this.reconnectDelay_*Fd)}this.onConnectStatus_(!1)}async establishConnection_(){if(this.shouldReconnect_()){this.log_("Making a connection attempt"),this.lastConnectionAttemptTime_=new Date().getTime(),this.lastConnectionEstablishedTime_=null;const e=this.onDataMessage_.bind(this),t=this.onReady_.bind(this),i=this.onRealtimeDisconnect_.bind(this),s=this.id+":"+ne.nextConnectionId_++,r=this.lastSessionId;let o=!1,a=null;const l=function(){a?a.close():(o=!0,i())},c=function(h){f(a,"sendRequest call when we're not connected not allowed."),a.sendRequest(h)};this.realtime_={close:l,sendRequest:c};const d=this.forceTokenRefresh_;this.forceTokenRefresh_=!1;try{const[h,u]=await Promise.all([this.authTokenProvider_.getToken(d),this.appCheckTokenProvider_.getToken(d)]);o?M("getToken() completed but was canceled"):(M("getToken() completed. Creating connection."),this.authToken_=h&&h.accessToken,this.appCheckToken_=u&&u.token,a=new Pd(s,this.repoInfo_,this.applicationId_,this.appCheckToken_,this.authToken_,e,t,i,p=>{B(p+" ("+this.repoInfo_.toString()+")"),this.interrupt(Wd)},r))}catch(h){this.log_("Failed to get token: "+h),o||(this.repoInfo_.nodeAdmin&&B(h),l())}}}interrupt(e){M("Interrupting connection for reason: "+e),this.interruptReasons_[e]=!0,this.realtime_?this.realtime_.close():(this.establishConnectionTimer_&&(clearTimeout(this.establishConnectionTimer_),this.establishConnectionTimer_=null),this.connected_&&this.onRealtimeDisconnect_())}resume(e){M("Resuming connection for reason: "+e),delete this.interruptReasons_[e],Qn(this.interruptReasons_)&&(this.reconnectDelay_=lt,this.realtime_||this.scheduleConnect_(0))}handleTimestamp_(e){const t=e-new Date().getTime();this.onServerInfoUpdate_({serverTimeOffset:t})}cancelSentTransactions_(){for(let e=0;e<this.outstandingPuts_.length;e++){const t=this.outstandingPuts_[e];t&&"h"in t.request&&t.queued&&(t.onComplete&&t.onComplete("disconnect"),delete this.outstandingPuts_[e],this.outstandingPutCount_--)}this.outstandingPutCount_===0&&(this.outstandingPuts_=[])}onListenRevoked_(e,t){let i;t?i=t.map(r=>Mi(r)).join("$"):i="default";const s=this.removeListen_(e,i);s&&s.onComplete&&s.onComplete("permission_denied")}removeListen_(e,t){const i=new T(e).toString();let s;if(this.listens.has(i)){const r=this.listens.get(i);s=r.get(t),r.delete(t),r.size===0&&this.listens.delete(i)}else s=void 0;return s}onAuthRevoked_(e,t){M("Auth token revoked: "+e+"/"+t),this.authToken_=null,this.forceTokenRefresh_=!0,this.realtime_.close(),(e==="invalid_token"||e==="permission_denied")&&(this.invalidAuthTokenCount_++,this.invalidAuthTokenCount_>=nr&&(this.reconnectDelay_=tr,this.authTokenProvider_.notifyForInvalidToken()))}onAppCheckRevoked_(e,t){M("App check token revoked: "+e+"/"+t),this.appCheckToken_=null,this.forceTokenRefresh_=!0,(e==="invalid_token"||e==="permission_denied")&&(this.invalidAppCheckTokenCount_++,this.invalidAppCheckTokenCount_>=nr&&this.appCheckTokenProvider_.notifyForInvalidToken())}onSecurityDebugPacket_(e){this.securityDebugCallback_?this.securityDebugCallback_(e):"msg"in e&&console.log("FIREBASE: "+e.msg.replace(`
1982
1982
  `,`
1983
1983
  FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const e of this.listens.values())for(const t of e.values())this.sendListen_(t);for(let e=0;e<this.outstandingPuts_.length;e++)this.outstandingPuts_[e]&&this.sendPut_(e);for(;this.onDisconnectRequestQueue_.length;){const e=this.onDisconnectRequestQueue_.shift();this.sendOnDisconnect_(e.action,e.pathString,e.data,e.onComplete)}for(let e=0;e<this.outstandingGets_.length;e++)this.outstandingGets_[e]&&this.sendGet_(e)}sendConnectStats_(){const e={};let t="js";e["sdk."+t+"."+Eo.replace(/\./g,"-")]=1,Ci()?e["framework.cordova"]=1:Nr()&&(e["framework.reactnative"]=1),this.reportStats(e)}shouldReconnect_(){const e=cn.getInstance().currentlyOnline();return Qn(this.interruptReasons_)&&e}}ne.nextPersistentConnectionId_=0;ne.nextConnectionId_=0;/**
1984
1984
  * @license
@@ -2025,7 +2025,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const e of t
2025
2025
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2026
2026
  * See the License for the specific language governing permissions and
2027
2027
  * limitations under the License.
2028
- */let Gt;class Yo extends Sn{static get __EMPTY_NODE(){return Gt}static set __EMPTY_NODE(e){Gt=e}compare(e,t){return rt(e.name,t.name)}isDefinedOn(e){throw Ze("KeyIndex.isDefinedOn not expected to be called.")}indexedValueChanged(e,t){return!1}minPost(){return v.MIN}maxPost(){return new v(Oe,Gt)}makePost(e,t){return f(typeof e=="string","KeyIndex indexValue must always be a string."),new v(e,Gt)}toString(){return".key"}}const ze=new Yo;/**
2028
+ */let Gt;class Yo extends Sn{static get __EMPTY_NODE(){return Gt}static set __EMPTY_NODE(e){Gt=e}compare(e,t){return rt(e.name,t.name)}isDefinedOn(e){throw Ze("KeyIndex.isDefinedOn not expected to be called.")}indexedValueChanged(e,t){return!1}minPost(){return v.MIN}maxPost(){return new v(Pe,Gt)}makePost(e,t){return f(typeof e=="string","KeyIndex indexValue must always be a string."),new v(e,Gt)}toString(){return".key"}}const ze=new Yo;/**
2029
2029
  * @license
2030
2030
  * Copyright 2017 Google LLC
2031
2031
  *
@@ -2040,7 +2040,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const e of t
2040
2040
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2041
2041
  * See the License for the specific language governing permissions and
2042
2042
  * limitations under the License.
2043
- */class jt{constructor(e,t,i,s,r=null){this.isReverse_=s,this.resultGenerator_=r,this.nodeStack_=[];let o=1;for(;!e.isEmpty();)if(e=e,o=t?i(e.key,t):1,s&&(o*=-1),o<0)this.isReverse_?e=e.left:e=e.right;else if(o===0){this.nodeStack_.push(e);break}else this.nodeStack_.push(e),this.isReverse_?e=e.right:e=e.left}getNext(){if(this.nodeStack_.length===0)return null;let e=this.nodeStack_.pop(),t;if(this.resultGenerator_?t=this.resultGenerator_(e.key,e.value):t={key:e.key,value:e.value},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 this.resultGenerator_?this.resultGenerator_(e.key,e.value):{key:e.key,value:e.value}}}class O{constructor(e,t,i,s,r){this.key=e,this.value=t,this.color=i??O.RED,this.left=s??U.EMPTY_NODE,this.right=r??U.EMPTY_NODE}copy(e,t,i,s,r){return new O(e??this.key,t??this.value,i??this.color,s??this.left,r??this.right)}count(){return this.left.count()+1+this.right.count()}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,i){let s=this;const r=i(e,s.key);return r<0?s=s.copy(null,null,null,s.left.insert(e,t,i),null):r===0?s=s.copy(null,t,null,null,null):s=s.copy(null,null,null,null,s.right.insert(e,t,i)),s.fixUp_()}removeMin_(){if(this.left.isEmpty())return U.EMPTY_NODE;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 i,s;if(i=this,t(e,i.key)<0)!i.left.isEmpty()&&!i.left.isRed_()&&!i.left.left.isRed_()&&(i=i.moveRedLeft_()),i=i.copy(null,null,null,i.left.remove(e,t),null);else{if(i.left.isRed_()&&(i=i.rotateRight_()),!i.right.isEmpty()&&!i.right.isRed_()&&!i.right.left.isRed_()&&(i=i.moveRedRight_()),t(e,i.key)===0){if(i.right.isEmpty())return U.EMPTY_NODE;s=i.right.min_(),i=i.copy(s.key,s.value,null,null,i.right.removeMin_())}i=i.copy(null,null,null,null,i.right.remove(e,t))}return i.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,O.RED,null,this.right.left);return this.right.copy(null,null,this.color,e,null)}rotateRight_(){const e=this.copy(null,null,O.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.count()+1}check_(){if(this.isRed_()&&this.left.isRed_())throw new Error("Red node has red child("+this.key+","+this.value+")");if(this.right.isRed_())throw new Error("Right child of ("+this.key+","+this.value+") is red");const e=this.left.check_();if(e!==this.right.check_())throw new Error("Black depths differ");return e+(this.isRed_()?0:1)}}O.RED=!0;O.BLACK=!1;class Wd{copy(e,t,i,s,r){return this}insert(e,t,i){return new O(e,t,null)}remove(e,t){return this}count(){return 0}isEmpty(){return!0}inorderTraversal(e){return!1}reverseTraversal(e){return!1}minKey(){return null}maxKey(){return null}check_(){return 0}isRed_(){return!1}}class U{constructor(e,t=U.EMPTY_NODE){this.comparator_=e,this.root_=t}insert(e,t){return new U(this.comparator_,this.root_.insert(e,t,this.comparator_).copy(null,null,O.BLACK,null,null))}remove(e){return new U(this.comparator_,this.root_.remove(e,this.comparator_).copy(null,null,O.BLACK,null,null))}get(e){let t,i=this.root_;for(;!i.isEmpty();){if(t=this.comparator_(e,i.key),t===0)return i.value;t<0?i=i.left:t>0&&(i=i.right)}return null}getPredecessorKey(e){let t,i=this.root_,s=null;for(;!i.isEmpty();)if(t=this.comparator_(e,i.key),t===0){if(i.left.isEmpty())return s?s.key:null;for(i=i.left;!i.right.isEmpty();)i=i.right;return i.key}else t<0?i=i.left:t>0&&(s=i,i=i.right);throw new Error("Attempted to find predecessor key for a nonexistent key. What gives?")}isEmpty(){return this.root_.isEmpty()}count(){return this.root_.count()}minKey(){return this.root_.minKey()}maxKey(){return this.root_.maxKey()}inorderTraversal(e){return this.root_.inorderTraversal(e)}reverseTraversal(e){return this.root_.reverseTraversal(e)}getIterator(e){return new jt(this.root_,null,this.comparator_,!1,e)}getIteratorFrom(e,t){return new jt(this.root_,e,this.comparator_,!1,t)}getReverseIteratorFrom(e,t){return new jt(this.root_,e,this.comparator_,!0,t)}getReverseIterator(e){return new jt(this.root_,null,this.comparator_,!0,e)}}U.EMPTY_NODE=new Wd;/**
2043
+ */class jt{constructor(e,t,i,s,r=null){this.isReverse_=s,this.resultGenerator_=r,this.nodeStack_=[];let o=1;for(;!e.isEmpty();)if(e=e,o=t?i(e.key,t):1,s&&(o*=-1),o<0)this.isReverse_?e=e.left:e=e.right;else if(o===0){this.nodeStack_.push(e);break}else this.nodeStack_.push(e),this.isReverse_?e=e.right:e=e.left}getNext(){if(this.nodeStack_.length===0)return null;let e=this.nodeStack_.pop(),t;if(this.resultGenerator_?t=this.resultGenerator_(e.key,e.value):t={key:e.key,value:e.value},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 this.resultGenerator_?this.resultGenerator_(e.key,e.value):{key:e.key,value:e.value}}}class O{constructor(e,t,i,s,r){this.key=e,this.value=t,this.color=i??O.RED,this.left=s??U.EMPTY_NODE,this.right=r??U.EMPTY_NODE}copy(e,t,i,s,r){return new O(e??this.key,t??this.value,i??this.color,s??this.left,r??this.right)}count(){return this.left.count()+1+this.right.count()}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,i){let s=this;const r=i(e,s.key);return r<0?s=s.copy(null,null,null,s.left.insert(e,t,i),null):r===0?s=s.copy(null,t,null,null,null):s=s.copy(null,null,null,null,s.right.insert(e,t,i)),s.fixUp_()}removeMin_(){if(this.left.isEmpty())return U.EMPTY_NODE;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 i,s;if(i=this,t(e,i.key)<0)!i.left.isEmpty()&&!i.left.isRed_()&&!i.left.left.isRed_()&&(i=i.moveRedLeft_()),i=i.copy(null,null,null,i.left.remove(e,t),null);else{if(i.left.isRed_()&&(i=i.rotateRight_()),!i.right.isEmpty()&&!i.right.isRed_()&&!i.right.left.isRed_()&&(i=i.moveRedRight_()),t(e,i.key)===0){if(i.right.isEmpty())return U.EMPTY_NODE;s=i.right.min_(),i=i.copy(s.key,s.value,null,null,i.right.removeMin_())}i=i.copy(null,null,null,null,i.right.remove(e,t))}return i.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,O.RED,null,this.right.left);return this.right.copy(null,null,this.color,e,null)}rotateRight_(){const e=this.copy(null,null,O.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.count()+1}check_(){if(this.isRed_()&&this.left.isRed_())throw new Error("Red node has red child("+this.key+","+this.value+")");if(this.right.isRed_())throw new Error("Right child of ("+this.key+","+this.value+") is red");const e=this.left.check_();if(e!==this.right.check_())throw new Error("Black depths differ");return e+(this.isRed_()?0:1)}}O.RED=!0;O.BLACK=!1;class Bd{copy(e,t,i,s,r){return this}insert(e,t,i){return new O(e,t,null)}remove(e,t){return this}count(){return 0}isEmpty(){return!0}inorderTraversal(e){return!1}reverseTraversal(e){return!1}minKey(){return null}maxKey(){return null}check_(){return 0}isRed_(){return!1}}class U{constructor(e,t=U.EMPTY_NODE){this.comparator_=e,this.root_=t}insert(e,t){return new U(this.comparator_,this.root_.insert(e,t,this.comparator_).copy(null,null,O.BLACK,null,null))}remove(e){return new U(this.comparator_,this.root_.remove(e,this.comparator_).copy(null,null,O.BLACK,null,null))}get(e){let t,i=this.root_;for(;!i.isEmpty();){if(t=this.comparator_(e,i.key),t===0)return i.value;t<0?i=i.left:t>0&&(i=i.right)}return null}getPredecessorKey(e){let t,i=this.root_,s=null;for(;!i.isEmpty();)if(t=this.comparator_(e,i.key),t===0){if(i.left.isEmpty())return s?s.key:null;for(i=i.left;!i.right.isEmpty();)i=i.right;return i.key}else t<0?i=i.left:t>0&&(s=i,i=i.right);throw new Error("Attempted to find predecessor key for a nonexistent key. What gives?")}isEmpty(){return this.root_.isEmpty()}count(){return this.root_.count()}minKey(){return this.root_.minKey()}maxKey(){return this.root_.maxKey()}inorderTraversal(e){return this.root_.inorderTraversal(e)}reverseTraversal(e){return this.root_.reverseTraversal(e)}getIterator(e){return new jt(this.root_,null,this.comparator_,!1,e)}getIteratorFrom(e,t){return new jt(this.root_,e,this.comparator_,!1,t)}getReverseIteratorFrom(e,t){return new jt(this.root_,e,this.comparator_,!0,t)}getReverseIterator(e){return new jt(this.root_,null,this.comparator_,!0,e)}}U.EMPTY_NODE=new Bd;/**
2044
2044
  * @license
2045
2045
  * Copyright 2017 Google LLC
2046
2046
  *
@@ -2055,7 +2055,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const e of t
2055
2055
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2056
2056
  * See the License for the specific language governing permissions and
2057
2057
  * limitations under the License.
2058
- */function Bd(n,e){return rt(n.name,e.name)}function Wi(n,e){return rt(n,e)}/**
2058
+ */function Hd(n,e){return rt(n.name,e.name)}function Wi(n,e){return rt(n,e)}/**
2059
2059
  * @license
2060
2060
  * Copyright 2017 Google LLC
2061
2061
  *
@@ -2070,7 +2070,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const e of t
2070
2070
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2071
2071
  * See the License for the specific language governing permissions and
2072
2072
  * limitations under the License.
2073
- */let li;function Hd(n){li=n}const Qo=function(n){return typeof n=="number"?"number:"+So(n):"string:"+n},Jo=function(n){if(n.isLeafNode()){const e=n.val();f(typeof e=="string"||typeof e=="number"||typeof e=="object"&&oe(e,".sv"),"Priority must be a string or number.")}else f(n===li||n.isEmpty(),"priority of unexpected type.");f(n===li||n.getPriority().isEmpty(),"Priority nodes can't have a priority of their own.")};/**
2073
+ */let li;function Vd(n){li=n}const Qo=function(n){return typeof n=="number"?"number:"+So(n):"string:"+n},Jo=function(n){if(n.isLeafNode()){const e=n.val();f(typeof e=="string"||typeof e=="number"||typeof e=="object"&&oe(e,".sv"),"Priority must be a string or number.")}else f(n===li||n.isEmpty(),"priority of unexpected type.");f(n===li||n.getPriority().isEmpty(),"Priority nodes can't have a priority of their own.")};/**
2074
2074
  * @license
2075
2075
  * Copyright 2017 Google LLC
2076
2076
  *
@@ -2100,7 +2100,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const e of t
2100
2100
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2101
2101
  * See the License for the specific language governing permissions and
2102
2102
  * limitations under the License.
2103
- */let Xo,Zo;function Vd(n){Xo=n}function $d(n){Zo=n}class Gd extends Sn{compare(e,t){const i=e.node.getPriority(),s=t.node.getPriority(),r=i.compareTo(s);return r===0?rt(e.name,t.name):r}isDefinedOn(e){return!e.getPriority().isEmpty()}indexedValueChanged(e,t){return!e.getPriority().equals(t.getPriority())}minPost(){return v.MIN}maxPost(){return new v(Oe,new P("[PRIORITY-POST]",Zo))}makePost(e,t){const i=Xo(e);return new v(t,new P("[PRIORITY-POST]",i))}toString(){return".priority"}}const A=new Gd;/**
2103
+ */let Xo,Zo;function $d(n){Xo=n}function Gd(n){Zo=n}class jd extends Sn{compare(e,t){const i=e.node.getPriority(),s=t.node.getPriority(),r=i.compareTo(s);return r===0?rt(e.name,t.name):r}isDefinedOn(e){return!e.getPriority().isEmpty()}indexedValueChanged(e,t){return!e.getPriority().equals(t.getPriority())}minPost(){return v.MIN}maxPost(){return new v(Pe,new P("[PRIORITY-POST]",Zo))}makePost(e,t){const i=Xo(e);return new v(t,new P("[PRIORITY-POST]",i))}toString(){return".priority"}}const k=new jd;/**
2104
2104
  * @license
2105
2105
  * Copyright 2017 Google LLC
2106
2106
  *
@@ -2115,7 +2115,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const e of t
2115
2115
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2116
2116
  * See the License for the specific language governing permissions and
2117
2117
  * limitations under the License.
2118
- */const jd=Math.log(2);class zd{constructor(e){const t=r=>parseInt(Math.log(r)/jd,10),i=r=>parseInt(Array(r+1).join("1"),2);this.count=t(e+1),this.current_=this.count-1;const s=i(this.count);this.bits_=e+1&s}nextBitIsOne(){const e=!(this.bits_&1<<this.current_);return this.current_--,e}}const hn=function(n,e,t,i){n.sort(e);const s=function(l,c){const d=c-l;let h,u;if(d===0)return null;if(d===1)return h=n[l],u=t?t(h):h,new O(u,h.node,O.BLACK,null,null);{const p=parseInt(d/2,10)+l,_=s(l,p),C=s(p+1,c);return h=n[p],u=t?t(h):h,new O(u,h.node,O.BLACK,_,C)}},r=function(l){let c=null,d=null,h=n.length;const u=function(_,C){const R=h-_,H=h;h-=_;const V=s(R+1,H),$=n[R],Fe=t?t($):$;p(new O(Fe,$.node,C,null,V))},p=function(_){c?(c.left=_,c=_):(d=_,c=_)};for(let _=0;_<l.count;++_){const C=l.nextBitIsOne(),R=Math.pow(2,l.count-(_+1));C?u(R,O.BLACK):(u(R,O.BLACK),u(R,O.RED))}return d},o=new zd(n.length),a=r(o);return new U(i||e,a)};/**
2118
+ */const zd=Math.log(2);class qd{constructor(e){const t=r=>parseInt(Math.log(r)/zd,10),i=r=>parseInt(Array(r+1).join("1"),2);this.count=t(e+1),this.current_=this.count-1;const s=i(this.count);this.bits_=e+1&s}nextBitIsOne(){const e=!(this.bits_&1<<this.current_);return this.current_--,e}}const hn=function(n,e,t,i){n.sort(e);const s=function(l,c){const d=c-l;let h,u;if(d===0)return null;if(d===1)return h=n[l],u=t?t(h):h,new O(u,h.node,O.BLACK,null,null);{const p=parseInt(d/2,10)+l,_=s(l,p),C=s(p+1,c);return h=n[p],u=t?t(h):h,new O(u,h.node,O.BLACK,_,C)}},r=function(l){let c=null,d=null,h=n.length;const u=function(_,C){const R=h-_,H=h;h-=_;const V=s(R+1,H),$=n[R],xe=t?t($):$;p(new O(xe,$.node,C,null,V))},p=function(_){c?(c.left=_,c=_):(d=_,c=_)};for(let _=0;_<l.count;++_){const C=l.nextBitIsOne(),R=Math.pow(2,l.count-(_+1));C?u(R,O.BLACK):(u(R,O.BLACK),u(R,O.RED))}return d},o=new qd(n.length),a=r(o);return new U(i||e,a)};/**
2119
2119
  * @license
2120
2120
  * Copyright 2017 Google LLC
2121
2121
  *
@@ -2130,7 +2130,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const e of t
2130
2130
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2131
2131
  * See the License for the specific language governing permissions and
2132
2132
  * limitations under the License.
2133
- */let Gn;const Ue={};class te{static get Default(){return f(Ue&&A,"ChildrenNode.ts has not been loaded"),Gn=Gn||new te({".priority":Ue},{".priority":A}),Gn}constructor(e,t){this.indexes_=e,this.indexSet_=t}get(e){const t=qe(this.indexes_,e);if(!t)throw new Error("No index defined for "+e);return t instanceof U?t:null}hasIndex(e){return oe(this.indexSet_,e.toString())}addIndex(e,t){f(e!==ze,"KeyIndex always exists and isn't meant to be added to the IndexMap.");const i=[];let s=!1;const r=t.getIterator(v.Wrap);let o=r.getNext();for(;o;)s=s||e.isDefinedOn(o.node),i.push(o),o=r.getNext();let a;s?a=hn(i,e.getCompare()):a=Ue;const l=e.toString(),c=Object.assign({},this.indexSet_);c[l]=e;const d=Object.assign({},this.indexes_);return d[l]=a,new te(d,c)}addToIndexes(e,t){const i=Zt(this.indexes_,(s,r)=>{const o=qe(this.indexSet_,r);if(f(o,"Missing index implementation for "+r),s===Ue)if(o.isDefinedOn(e.node)){const a=[],l=t.getIterator(v.Wrap);let c=l.getNext();for(;c;)c.name!==e.name&&a.push(c),c=l.getNext();return a.push(e),hn(a,o.getCompare())}else return Ue;else{const a=t.get(e.name);let l=s;return a&&(l=l.remove(new v(e.name,a))),l.insert(e,e.node)}});return new te(i,this.indexSet_)}removeFromIndexes(e,t){const i=Zt(this.indexes_,s=>{if(s===Ue)return s;{const r=t.get(e.name);return r?s.remove(new v(e.name,r)):s}});return new te(i,this.indexSet_)}}/**
2133
+ */let Gn;const Fe={};class te{static get Default(){return f(Fe&&k,"ChildrenNode.ts has not been loaded"),Gn=Gn||new te({".priority":Fe},{".priority":k}),Gn}constructor(e,t){this.indexes_=e,this.indexSet_=t}get(e){const t=qe(this.indexes_,e);if(!t)throw new Error("No index defined for "+e);return t instanceof U?t:null}hasIndex(e){return oe(this.indexSet_,e.toString())}addIndex(e,t){f(e!==ze,"KeyIndex always exists and isn't meant to be added to the IndexMap.");const i=[];let s=!1;const r=t.getIterator(v.Wrap);let o=r.getNext();for(;o;)s=s||e.isDefinedOn(o.node),i.push(o),o=r.getNext();let a;s?a=hn(i,e.getCompare()):a=Fe;const l=e.toString(),c=Object.assign({},this.indexSet_);c[l]=e;const d=Object.assign({},this.indexes_);return d[l]=a,new te(d,c)}addToIndexes(e,t){const i=Zt(this.indexes_,(s,r)=>{const o=qe(this.indexSet_,r);if(f(o,"Missing index implementation for "+r),s===Fe)if(o.isDefinedOn(e.node)){const a=[],l=t.getIterator(v.Wrap);let c=l.getNext();for(;c;)c.name!==e.name&&a.push(c),c=l.getNext();return a.push(e),hn(a,o.getCompare())}else return Fe;else{const a=t.get(e.name);let l=s;return a&&(l=l.remove(new v(e.name,a))),l.insert(e,e.node)}});return new te(i,this.indexSet_)}removeFromIndexes(e,t){const i=Zt(this.indexes_,s=>{if(s===Fe)return s;{const r=t.get(e.name);return r?s.remove(new v(e.name,r)):s}});return new te(i,this.indexSet_)}}/**
2134
2134
  * @license
2135
2135
  * Copyright 2017 Google LLC
2136
2136
  *
@@ -2145,7 +2145,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const e of t
2145
2145
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2146
2146
  * See the License for the specific language governing permissions and
2147
2147
  * limitations under the License.
2148
- */let ct;class m{static get EMPTY_NODE(){return ct||(ct=new m(new U(Wi),null,te.Default))}constructor(e,t,i){this.children_=e,this.priorityNode_=t,this.indexMap_=i,this.lazyHash_=null,this.priorityNode_&&Jo(this.priorityNode_),this.children_.isEmpty()&&f(!this.priorityNode_||this.priorityNode_.isEmpty(),"An empty node cannot have a priority")}isLeafNode(){return!1}getPriority(){return this.priorityNode_||ct}updatePriority(e){return this.children_.isEmpty()?this:new m(this.children_,e,this.indexMap_)}getImmediateChild(e){if(e===".priority")return this.getPriority();{const t=this.children_.get(e);return t===null?ct:t}}getChild(e){const t=E(e);return t===null?this:this.getImmediateChild(t).getChild(S(e))}hasChild(e){return this.children_.get(e)!==null}updateImmediateChild(e,t){if(f(t,"We should always be passing snapshot nodes"),e===".priority")return this.updatePriority(t);{const i=new v(e,t);let s,r;t.isEmpty()?(s=this.children_.remove(e),r=this.indexMap_.removeFromIndexes(i,this.children_)):(s=this.children_.insert(e,t),r=this.indexMap_.addToIndexes(i,this.children_));const o=s.isEmpty()?ct:this.priorityNode_;return new m(s,o,r)}}updateChild(e,t){const i=E(e);if(i===null)return t;{f(E(e)!==".priority"||ye(e)===1,".priority must be the last token in a path");const s=this.getImmediateChild(i).updateChild(S(e),t);return this.updateImmediateChild(i,s)}}isEmpty(){return this.children_.isEmpty()}numChildren(){return this.children_.count()}val(e){if(this.isEmpty())return null;const t={};let i=0,s=0,r=!0;if(this.forEachChild(A,(o,a)=>{t[o]=a.val(e),i++,r&&m.INTEGER_REGEXP_.test(o)?s=Math.max(s,Number(o)):r=!1}),!e&&r&&s<2*i){const o=[];for(const a in t)o[a]=t[a];return o}else return e&&!this.getPriority().isEmpty()&&(t[".priority"]=this.getPriority().val()),t}hash(){if(this.lazyHash_===null){let e="";this.getPriority().isEmpty()||(e+="priority:"+Qo(this.getPriority().val())+":"),this.forEachChild(A,(t,i)=>{const s=i.hash();s!==""&&(e+=":"+t+":"+s)}),this.lazyHash_=e===""?"":Co(e)}return this.lazyHash_}getPredecessorChildName(e,t,i){const s=this.resolveIndex_(i);if(s){const r=s.getPredecessorKey(new v(e,t));return r?r.name:null}else return this.children_.getPredecessorKey(e)}getFirstChildName(e){const t=this.resolveIndex_(e);if(t){const i=t.minKey();return i&&i.name}else return this.children_.minKey()}getFirstChild(e){const t=this.getFirstChildName(e);return t?new v(t,this.children_.get(t)):null}getLastChildName(e){const t=this.resolveIndex_(e);if(t){const i=t.maxKey();return i&&i.name}else return this.children_.maxKey()}getLastChild(e){const t=this.getLastChildName(e);return t?new v(t,this.children_.get(t)):null}forEachChild(e,t){const i=this.resolveIndex_(e);return i?i.inorderTraversal(s=>t(s.name,s.node)):this.children_.inorderTraversal(t)}getIterator(e){return this.getIteratorFrom(e.minPost(),e)}getIteratorFrom(e,t){const i=this.resolveIndex_(t);if(i)return i.getIteratorFrom(e,s=>s);{const s=this.children_.getIteratorFrom(e.name,v.Wrap);let r=s.peek();for(;r!=null&&t.compare(r,e)<0;)s.getNext(),r=s.peek();return s}}getReverseIterator(e){return this.getReverseIteratorFrom(e.maxPost(),e)}getReverseIteratorFrom(e,t){const i=this.resolveIndex_(t);if(i)return i.getReverseIteratorFrom(e,s=>s);{const s=this.children_.getReverseIteratorFrom(e.name,v.Wrap);let r=s.peek();for(;r!=null&&t.compare(r,e)>0;)s.getNext(),r=s.peek();return s}}compareTo(e){return this.isEmpty()?e.isEmpty()?0:-1:e.isLeafNode()||e.isEmpty()?1:e===Wt?-1:0}withIndex(e){if(e===ze||this.indexMap_.hasIndex(e))return this;{const t=this.indexMap_.addIndex(e,this.children_);return new m(this.children_,this.priorityNode_,t)}}isIndexed(e){return e===ze||this.indexMap_.hasIndex(e)}equals(e){if(e===this)return!0;if(e.isLeafNode())return!1;{const t=e;if(this.getPriority().equals(t.getPriority()))if(this.children_.count()===t.children_.count()){const i=this.getIterator(A),s=t.getIterator(A);let r=i.getNext(),o=s.getNext();for(;r&&o;){if(r.name!==o.name||!r.node.equals(o.node))return!1;r=i.getNext(),o=s.getNext()}return r===null&&o===null}else return!1;else return!1}}resolveIndex_(e){return e===ze?null:this.indexMap_.get(e.toString())}}m.INTEGER_REGEXP_=/^(0|[1-9]\d*)$/;class qd extends m{constructor(){super(new U(Wi),m.EMPTY_NODE,te.Default)}compareTo(e){return e===this?0:1}equals(e){return e===this}getPriority(){return this}getImmediateChild(e){return m.EMPTY_NODE}isEmpty(){return!1}}const Wt=new qd;Object.defineProperties(v,{MIN:{value:new v(Qe,m.EMPTY_NODE)},MAX:{value:new v(Oe,Wt)}});Yo.__EMPTY_NODE=m.EMPTY_NODE;P.__childrenNodeConstructor=m;Hd(Wt);$d(Wt);/**
2148
+ */let ct;class m{static get EMPTY_NODE(){return ct||(ct=new m(new U(Wi),null,te.Default))}constructor(e,t,i){this.children_=e,this.priorityNode_=t,this.indexMap_=i,this.lazyHash_=null,this.priorityNode_&&Jo(this.priorityNode_),this.children_.isEmpty()&&f(!this.priorityNode_||this.priorityNode_.isEmpty(),"An empty node cannot have a priority")}isLeafNode(){return!1}getPriority(){return this.priorityNode_||ct}updatePriority(e){return this.children_.isEmpty()?this:new m(this.children_,e,this.indexMap_)}getImmediateChild(e){if(e===".priority")return this.getPriority();{const t=this.children_.get(e);return t===null?ct:t}}getChild(e){const t=E(e);return t===null?this:this.getImmediateChild(t).getChild(S(e))}hasChild(e){return this.children_.get(e)!==null}updateImmediateChild(e,t){if(f(t,"We should always be passing snapshot nodes"),e===".priority")return this.updatePriority(t);{const i=new v(e,t);let s,r;t.isEmpty()?(s=this.children_.remove(e),r=this.indexMap_.removeFromIndexes(i,this.children_)):(s=this.children_.insert(e,t),r=this.indexMap_.addToIndexes(i,this.children_));const o=s.isEmpty()?ct:this.priorityNode_;return new m(s,o,r)}}updateChild(e,t){const i=E(e);if(i===null)return t;{f(E(e)!==".priority"||ye(e)===1,".priority must be the last token in a path");const s=this.getImmediateChild(i).updateChild(S(e),t);return this.updateImmediateChild(i,s)}}isEmpty(){return this.children_.isEmpty()}numChildren(){return this.children_.count()}val(e){if(this.isEmpty())return null;const t={};let i=0,s=0,r=!0;if(this.forEachChild(k,(o,a)=>{t[o]=a.val(e),i++,r&&m.INTEGER_REGEXP_.test(o)?s=Math.max(s,Number(o)):r=!1}),!e&&r&&s<2*i){const o=[];for(const a in t)o[a]=t[a];return o}else return e&&!this.getPriority().isEmpty()&&(t[".priority"]=this.getPriority().val()),t}hash(){if(this.lazyHash_===null){let e="";this.getPriority().isEmpty()||(e+="priority:"+Qo(this.getPriority().val())+":"),this.forEachChild(k,(t,i)=>{const s=i.hash();s!==""&&(e+=":"+t+":"+s)}),this.lazyHash_=e===""?"":Co(e)}return this.lazyHash_}getPredecessorChildName(e,t,i){const s=this.resolveIndex_(i);if(s){const r=s.getPredecessorKey(new v(e,t));return r?r.name:null}else return this.children_.getPredecessorKey(e)}getFirstChildName(e){const t=this.resolveIndex_(e);if(t){const i=t.minKey();return i&&i.name}else return this.children_.minKey()}getFirstChild(e){const t=this.getFirstChildName(e);return t?new v(t,this.children_.get(t)):null}getLastChildName(e){const t=this.resolveIndex_(e);if(t){const i=t.maxKey();return i&&i.name}else return this.children_.maxKey()}getLastChild(e){const t=this.getLastChildName(e);return t?new v(t,this.children_.get(t)):null}forEachChild(e,t){const i=this.resolveIndex_(e);return i?i.inorderTraversal(s=>t(s.name,s.node)):this.children_.inorderTraversal(t)}getIterator(e){return this.getIteratorFrom(e.minPost(),e)}getIteratorFrom(e,t){const i=this.resolveIndex_(t);if(i)return i.getIteratorFrom(e,s=>s);{const s=this.children_.getIteratorFrom(e.name,v.Wrap);let r=s.peek();for(;r!=null&&t.compare(r,e)<0;)s.getNext(),r=s.peek();return s}}getReverseIterator(e){return this.getReverseIteratorFrom(e.maxPost(),e)}getReverseIteratorFrom(e,t){const i=this.resolveIndex_(t);if(i)return i.getReverseIteratorFrom(e,s=>s);{const s=this.children_.getReverseIteratorFrom(e.name,v.Wrap);let r=s.peek();for(;r!=null&&t.compare(r,e)>0;)s.getNext(),r=s.peek();return s}}compareTo(e){return this.isEmpty()?e.isEmpty()?0:-1:e.isLeafNode()||e.isEmpty()?1:e===Wt?-1:0}withIndex(e){if(e===ze||this.indexMap_.hasIndex(e))return this;{const t=this.indexMap_.addIndex(e,this.children_);return new m(this.children_,this.priorityNode_,t)}}isIndexed(e){return e===ze||this.indexMap_.hasIndex(e)}equals(e){if(e===this)return!0;if(e.isLeafNode())return!1;{const t=e;if(this.getPriority().equals(t.getPriority()))if(this.children_.count()===t.children_.count()){const i=this.getIterator(k),s=t.getIterator(k);let r=i.getNext(),o=s.getNext();for(;r&&o;){if(r.name!==o.name||!r.node.equals(o.node))return!1;r=i.getNext(),o=s.getNext()}return r===null&&o===null}else return!1;else return!1}}resolveIndex_(e){return e===ze?null:this.indexMap_.get(e.toString())}}m.INTEGER_REGEXP_=/^(0|[1-9]\d*)$/;class Kd extends m{constructor(){super(new U(Wi),m.EMPTY_NODE,te.Default)}compareTo(e){return e===this?0:1}equals(e){return e===this}getPriority(){return this}getImmediateChild(e){return m.EMPTY_NODE}isEmpty(){return!1}}const Wt=new Kd;Object.defineProperties(v,{MIN:{value:new v(Qe,m.EMPTY_NODE)},MAX:{value:new v(Pe,Wt)}});Yo.__EMPTY_NODE=m.EMPTY_NODE;P.__childrenNodeConstructor=m;Vd(Wt);Gd(Wt);/**
2149
2149
  * @license
2150
2150
  * Copyright 2017 Google LLC
2151
2151
  *
@@ -2160,7 +2160,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const e of t
2160
2160
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2161
2161
  * See the License for the specific language governing permissions and
2162
2162
  * limitations under the License.
2163
- */const Kd=!0;function D(n,e=null){if(n===null)return m.EMPTY_NODE;if(typeof n=="object"&&".priority"in n&&(e=n[".priority"]),f(e===null||typeof e=="string"||typeof e=="number"||typeof e=="object"&&".sv"in e,"Invalid priority type found: "+typeof e),typeof n=="object"&&".value"in n&&n[".value"]!==null&&(n=n[".value"]),typeof n!="object"||".sv"in n){const t=n;return new P(t,D(e))}if(!(n instanceof Array)&&Kd){const t=[];let i=!1;if(W(n,(o,a)=>{if(o.substring(0,1)!=="."){const l=D(a);l.isEmpty()||(i=i||!l.getPriority().isEmpty(),t.push(new v(o,l)))}}),t.length===0)return m.EMPTY_NODE;const r=hn(t,Bd,o=>o.name,Wi);if(i){const o=hn(t,A.getCompare());return new m(r,D(e),new te({".priority":o},{".priority":A}))}else return new m(r,D(e),te.Default)}else{let t=m.EMPTY_NODE;return W(n,(i,s)=>{if(oe(n,i)&&i.substring(0,1)!=="."){const r=D(s);(r.isLeafNode()||!r.isEmpty())&&(t=t.updateImmediateChild(i,r))}}),t.updatePriority(D(e))}}Vd(D);/**
2163
+ */const Yd=!0;function D(n,e=null){if(n===null)return m.EMPTY_NODE;if(typeof n=="object"&&".priority"in n&&(e=n[".priority"]),f(e===null||typeof e=="string"||typeof e=="number"||typeof e=="object"&&".sv"in e,"Invalid priority type found: "+typeof e),typeof n=="object"&&".value"in n&&n[".value"]!==null&&(n=n[".value"]),typeof n!="object"||".sv"in n){const t=n;return new P(t,D(e))}if(!(n instanceof Array)&&Yd){const t=[];let i=!1;if(W(n,(o,a)=>{if(o.substring(0,1)!=="."){const l=D(a);l.isEmpty()||(i=i||!l.getPriority().isEmpty(),t.push(new v(o,l)))}}),t.length===0)return m.EMPTY_NODE;const r=hn(t,Hd,o=>o.name,Wi);if(i){const o=hn(t,k.getCompare());return new m(r,D(e),new te({".priority":o},{".priority":k}))}else return new m(r,D(e),te.Default)}else{let t=m.EMPTY_NODE;return W(n,(i,s)=>{if(oe(n,i)&&i.substring(0,1)!=="."){const r=D(s);(r.isLeafNode()||!r.isEmpty())&&(t=t.updateImmediateChild(i,r))}}),t.updatePriority(D(e))}}$d(D);/**
2164
2164
  * @license
2165
2165
  * Copyright 2017 Google LLC
2166
2166
  *
@@ -2175,7 +2175,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const e of t
2175
2175
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2176
2176
  * See the License for the specific language governing permissions and
2177
2177
  * limitations under the License.
2178
- */class Yd extends Sn{constructor(e){super(),this.indexPath_=e,f(!y(e)&&E(e)!==".priority","Can't create PathIndex with empty path or .priority key")}extractChild(e){return e.getChild(this.indexPath_)}isDefinedOn(e){return!e.getChild(this.indexPath_).isEmpty()}compare(e,t){const i=this.extractChild(e.node),s=this.extractChild(t.node),r=i.compareTo(s);return r===0?rt(e.name,t.name):r}makePost(e,t){const i=D(e),s=m.EMPTY_NODE.updateChild(this.indexPath_,i);return new v(t,s)}maxPost(){const e=m.EMPTY_NODE.updateChild(this.indexPath_,Wt);return new v(Oe,e)}toString(){return jo(this.indexPath_,0).join("/")}}/**
2178
+ */class Qd extends Sn{constructor(e){super(),this.indexPath_=e,f(!y(e)&&E(e)!==".priority","Can't create PathIndex with empty path or .priority key")}extractChild(e){return e.getChild(this.indexPath_)}isDefinedOn(e){return!e.getChild(this.indexPath_).isEmpty()}compare(e,t){const i=this.extractChild(e.node),s=this.extractChild(t.node),r=i.compareTo(s);return r===0?rt(e.name,t.name):r}makePost(e,t){const i=D(e),s=m.EMPTY_NODE.updateChild(this.indexPath_,i);return new v(t,s)}maxPost(){const e=m.EMPTY_NODE.updateChild(this.indexPath_,Wt);return new v(Pe,e)}toString(){return jo(this.indexPath_,0).join("/")}}/**
2179
2179
  * @license
2180
2180
  * Copyright 2017 Google LLC
2181
2181
  *
@@ -2190,7 +2190,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const e of t
2190
2190
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2191
2191
  * See the License for the specific language governing permissions and
2192
2192
  * limitations under the License.
2193
- */class Qd extends Sn{compare(e,t){const i=e.node.compareTo(t.node);return i===0?rt(e.name,t.name):i}isDefinedOn(e){return!0}indexedValueChanged(e,t){return!e.equals(t)}minPost(){return v.MIN}maxPost(){return v.MAX}makePost(e,t){const i=D(e);return new v(t,i)}toString(){return".value"}}const Jd=new Qd;/**
2193
+ */class Jd extends Sn{compare(e,t){const i=e.node.compareTo(t.node);return i===0?rt(e.name,t.name):i}isDefinedOn(e){return!0}indexedValueChanged(e,t){return!e.equals(t)}minPost(){return v.MIN}maxPost(){return v.MAX}makePost(e,t){const i=D(e);return new v(t,i)}toString(){return".value"}}const Xd=new Jd;/**
2194
2194
  * @license
2195
2195
  * Copyright 2017 Google LLC
2196
2196
  *
@@ -2205,7 +2205,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const e of t
2205
2205
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2206
2206
  * See the License for the specific language governing permissions and
2207
2207
  * limitations under the License.
2208
- */function ea(n){return{type:"value",snapshotNode:n}}function Je(n,e){return{type:"child_added",snapshotNode:e,childName:n}}function St(n,e){return{type:"child_removed",snapshotNode:e,childName:n}}function bt(n,e,t){return{type:"child_changed",snapshotNode:e,childName:n,oldSnap:t}}function Xd(n,e){return{type:"child_moved",snapshotNode:e,childName:n}}/**
2208
+ */function ea(n){return{type:"value",snapshotNode:n}}function Je(n,e){return{type:"child_added",snapshotNode:e,childName:n}}function St(n,e){return{type:"child_removed",snapshotNode:e,childName:n}}function bt(n,e,t){return{type:"child_changed",snapshotNode:e,childName:n,oldSnap:t}}function Zd(n,e){return{type:"child_moved",snapshotNode:e,childName:n}}/**
2209
2209
  * @license
2210
2210
  * Copyright 2017 Google LLC
2211
2211
  *
@@ -2220,7 +2220,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const e of t
2220
2220
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2221
2221
  * See the License for the specific language governing permissions and
2222
2222
  * limitations under the License.
2223
- */class Bi{constructor(e){this.index_=e}updateChild(e,t,i,s,r,o){f(e.isIndexed(this.index_),"A node must be indexed if only a child is updated");const a=e.getImmediateChild(t);return a.getChild(s).equals(i.getChild(s))&&a.isEmpty()===i.isEmpty()||(o!=null&&(i.isEmpty()?e.hasChild(t)?o.trackChildChange(St(t,a)):f(e.isLeafNode(),"A child remove without an old child only makes sense on a leaf node"):a.isEmpty()?o.trackChildChange(Je(t,i)):o.trackChildChange(bt(t,i,a))),e.isLeafNode()&&i.isEmpty())?e:e.updateImmediateChild(t,i).withIndex(this.index_)}updateFullNode(e,t,i){return i!=null&&(e.isLeafNode()||e.forEachChild(A,(s,r)=>{t.hasChild(s)||i.trackChildChange(St(s,r))}),t.isLeafNode()||t.forEachChild(A,(s,r)=>{if(e.hasChild(s)){const o=e.getImmediateChild(s);o.equals(r)||i.trackChildChange(bt(s,r,o))}else i.trackChildChange(Je(s,r))})),t.withIndex(this.index_)}updatePriority(e,t){return e.isEmpty()?m.EMPTY_NODE:e.updatePriority(t)}filtersNodes(){return!1}getIndexedFilter(){return this}getIndex(){return this.index_}}/**
2223
+ */class Bi{constructor(e){this.index_=e}updateChild(e,t,i,s,r,o){f(e.isIndexed(this.index_),"A node must be indexed if only a child is updated");const a=e.getImmediateChild(t);return a.getChild(s).equals(i.getChild(s))&&a.isEmpty()===i.isEmpty()||(o!=null&&(i.isEmpty()?e.hasChild(t)?o.trackChildChange(St(t,a)):f(e.isLeafNode(),"A child remove without an old child only makes sense on a leaf node"):a.isEmpty()?o.trackChildChange(Je(t,i)):o.trackChildChange(bt(t,i,a))),e.isLeafNode()&&i.isEmpty())?e:e.updateImmediateChild(t,i).withIndex(this.index_)}updateFullNode(e,t,i){return i!=null&&(e.isLeafNode()||e.forEachChild(k,(s,r)=>{t.hasChild(s)||i.trackChildChange(St(s,r))}),t.isLeafNode()||t.forEachChild(k,(s,r)=>{if(e.hasChild(s)){const o=e.getImmediateChild(s);o.equals(r)||i.trackChildChange(bt(s,r,o))}else i.trackChildChange(Je(s,r))})),t.withIndex(this.index_)}updatePriority(e,t){return e.isEmpty()?m.EMPTY_NODE:e.updatePriority(t)}filtersNodes(){return!1}getIndexedFilter(){return this}getIndex(){return this.index_}}/**
2224
2224
  * @license
2225
2225
  * Copyright 2017 Google LLC
2226
2226
  *
@@ -2235,7 +2235,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const e of t
2235
2235
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2236
2236
  * See the License for the specific language governing permissions and
2237
2237
  * limitations under the License.
2238
- */class Rt{constructor(e){this.indexedFilter_=new Bi(e.getIndex()),this.index_=e.getIndex(),this.startPost_=Rt.getStartPost_(e),this.endPost_=Rt.getEndPost_(e),this.startIsInclusive_=!e.startAfterSet_,this.endIsInclusive_=!e.endBeforeSet_}getStartPost(){return this.startPost_}getEndPost(){return this.endPost_}matches(e){const t=this.startIsInclusive_?this.index_.compare(this.getStartPost(),e)<=0:this.index_.compare(this.getStartPost(),e)<0,i=this.endIsInclusive_?this.index_.compare(e,this.getEndPost())<=0:this.index_.compare(e,this.getEndPost())<0;return t&&i}updateChild(e,t,i,s,r,o){return this.matches(new v(t,i))||(i=m.EMPTY_NODE),this.indexedFilter_.updateChild(e,t,i,s,r,o)}updateFullNode(e,t,i){t.isLeafNode()&&(t=m.EMPTY_NODE);let s=t.withIndex(this.index_);s=s.updatePriority(m.EMPTY_NODE);const r=this;return t.forEachChild(A,(o,a)=>{r.matches(new v(o,a))||(s=s.updateImmediateChild(o,m.EMPTY_NODE))}),this.indexedFilter_.updateFullNode(e,s,i)}updatePriority(e,t){return e}filtersNodes(){return!0}getIndexedFilter(){return this.indexedFilter_}getIndex(){return this.index_}static getStartPost_(e){if(e.hasStart()){const t=e.getIndexStartName();return e.getIndex().makePost(e.getIndexStartValue(),t)}else return e.getIndex().minPost()}static getEndPost_(e){if(e.hasEnd()){const t=e.getIndexEndName();return e.getIndex().makePost(e.getIndexEndValue(),t)}else return e.getIndex().maxPost()}}/**
2238
+ */class Rt{constructor(e){this.indexedFilter_=new Bi(e.getIndex()),this.index_=e.getIndex(),this.startPost_=Rt.getStartPost_(e),this.endPost_=Rt.getEndPost_(e),this.startIsInclusive_=!e.startAfterSet_,this.endIsInclusive_=!e.endBeforeSet_}getStartPost(){return this.startPost_}getEndPost(){return this.endPost_}matches(e){const t=this.startIsInclusive_?this.index_.compare(this.getStartPost(),e)<=0:this.index_.compare(this.getStartPost(),e)<0,i=this.endIsInclusive_?this.index_.compare(e,this.getEndPost())<=0:this.index_.compare(e,this.getEndPost())<0;return t&&i}updateChild(e,t,i,s,r,o){return this.matches(new v(t,i))||(i=m.EMPTY_NODE),this.indexedFilter_.updateChild(e,t,i,s,r,o)}updateFullNode(e,t,i){t.isLeafNode()&&(t=m.EMPTY_NODE);let s=t.withIndex(this.index_);s=s.updatePriority(m.EMPTY_NODE);const r=this;return t.forEachChild(k,(o,a)=>{r.matches(new v(o,a))||(s=s.updateImmediateChild(o,m.EMPTY_NODE))}),this.indexedFilter_.updateFullNode(e,s,i)}updatePriority(e,t){return e}filtersNodes(){return!0}getIndexedFilter(){return this.indexedFilter_}getIndex(){return this.index_}static getStartPost_(e){if(e.hasStart()){const t=e.getIndexStartName();return e.getIndex().makePost(e.getIndexStartValue(),t)}else return e.getIndex().minPost()}static getEndPost_(e){if(e.hasEnd()){const t=e.getIndexEndName();return e.getIndex().makePost(e.getIndexEndValue(),t)}else return e.getIndex().maxPost()}}/**
2239
2239
  * @license
2240
2240
  * Copyright 2017 Google LLC
2241
2241
  *
@@ -2250,7 +2250,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const e of t
2250
2250
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2251
2251
  * See the License for the specific language governing permissions and
2252
2252
  * limitations under the License.
2253
- */class Zd{constructor(e){this.withinDirectionalStart=t=>this.reverse_?this.withinEndPost(t):this.withinStartPost(t),this.withinDirectionalEnd=t=>this.reverse_?this.withinStartPost(t):this.withinEndPost(t),this.withinStartPost=t=>{const i=this.index_.compare(this.rangedFilter_.getStartPost(),t);return this.startIsInclusive_?i<=0:i<0},this.withinEndPost=t=>{const i=this.index_.compare(t,this.rangedFilter_.getEndPost());return this.endIsInclusive_?i<=0:i<0},this.rangedFilter_=new Rt(e),this.index_=e.getIndex(),this.limit_=e.getLimit(),this.reverse_=!e.isViewFromLeft(),this.startIsInclusive_=!e.startAfterSet_,this.endIsInclusive_=!e.endBeforeSet_}updateChild(e,t,i,s,r,o){return this.rangedFilter_.matches(new v(t,i))||(i=m.EMPTY_NODE),e.getImmediateChild(t).equals(i)?e:e.numChildren()<this.limit_?this.rangedFilter_.getIndexedFilter().updateChild(e,t,i,s,r,o):this.fullLimitUpdateChild_(e,t,i,r,o)}updateFullNode(e,t,i){let s;if(t.isLeafNode()||t.isEmpty())s=m.EMPTY_NODE.withIndex(this.index_);else if(this.limit_*2<t.numChildren()&&t.isIndexed(this.index_)){s=m.EMPTY_NODE.withIndex(this.index_);let r;this.reverse_?r=t.getReverseIteratorFrom(this.rangedFilter_.getEndPost(),this.index_):r=t.getIteratorFrom(this.rangedFilter_.getStartPost(),this.index_);let o=0;for(;r.hasNext()&&o<this.limit_;){const a=r.getNext();if(this.withinDirectionalStart(a))if(this.withinDirectionalEnd(a))s=s.updateImmediateChild(a.name,a.node),o++;else break;else continue}}else{s=t.withIndex(this.index_),s=s.updatePriority(m.EMPTY_NODE);let r;this.reverse_?r=s.getReverseIterator(this.index_):r=s.getIterator(this.index_);let o=0;for(;r.hasNext();){const a=r.getNext();o<this.limit_&&this.withinDirectionalStart(a)&&this.withinDirectionalEnd(a)?o++:s=s.updateImmediateChild(a.name,m.EMPTY_NODE)}}return this.rangedFilter_.getIndexedFilter().updateFullNode(e,s,i)}updatePriority(e,t){return e}filtersNodes(){return!0}getIndexedFilter(){return this.rangedFilter_.getIndexedFilter()}getIndex(){return this.index_}fullLimitUpdateChild_(e,t,i,s,r){let o;if(this.reverse_){const h=this.index_.getCompare();o=(u,p)=>h(p,u)}else o=this.index_.getCompare();const a=e;f(a.numChildren()===this.limit_,"");const l=new v(t,i),c=this.reverse_?a.getFirstChild(this.index_):a.getLastChild(this.index_),d=this.rangedFilter_.matches(l);if(a.hasChild(t)){const h=a.getImmediateChild(t);let u=s.getChildAfterChild(this.index_,c,this.reverse_);for(;u!=null&&(u.name===t||a.hasChild(u.name));)u=s.getChildAfterChild(this.index_,u,this.reverse_);const p=u==null?1:o(u,l);if(d&&!i.isEmpty()&&p>=0)return r!=null&&r.trackChildChange(bt(t,i,h)),a.updateImmediateChild(t,i);{r!=null&&r.trackChildChange(St(t,h));const C=a.updateImmediateChild(t,m.EMPTY_NODE);return u!=null&&this.rangedFilter_.matches(u)?(r!=null&&r.trackChildChange(Je(u.name,u.node)),C.updateImmediateChild(u.name,u.node)):C}}else return i.isEmpty()?e:d&&o(c,l)>=0?(r!=null&&(r.trackChildChange(St(c.name,c.node)),r.trackChildChange(Je(t,i))),a.updateImmediateChild(t,i).updateImmediateChild(c.name,m.EMPTY_NODE)):e}}/**
2253
+ */class ef{constructor(e){this.withinDirectionalStart=t=>this.reverse_?this.withinEndPost(t):this.withinStartPost(t),this.withinDirectionalEnd=t=>this.reverse_?this.withinStartPost(t):this.withinEndPost(t),this.withinStartPost=t=>{const i=this.index_.compare(this.rangedFilter_.getStartPost(),t);return this.startIsInclusive_?i<=0:i<0},this.withinEndPost=t=>{const i=this.index_.compare(t,this.rangedFilter_.getEndPost());return this.endIsInclusive_?i<=0:i<0},this.rangedFilter_=new Rt(e),this.index_=e.getIndex(),this.limit_=e.getLimit(),this.reverse_=!e.isViewFromLeft(),this.startIsInclusive_=!e.startAfterSet_,this.endIsInclusive_=!e.endBeforeSet_}updateChild(e,t,i,s,r,o){return this.rangedFilter_.matches(new v(t,i))||(i=m.EMPTY_NODE),e.getImmediateChild(t).equals(i)?e:e.numChildren()<this.limit_?this.rangedFilter_.getIndexedFilter().updateChild(e,t,i,s,r,o):this.fullLimitUpdateChild_(e,t,i,r,o)}updateFullNode(e,t,i){let s;if(t.isLeafNode()||t.isEmpty())s=m.EMPTY_NODE.withIndex(this.index_);else if(this.limit_*2<t.numChildren()&&t.isIndexed(this.index_)){s=m.EMPTY_NODE.withIndex(this.index_);let r;this.reverse_?r=t.getReverseIteratorFrom(this.rangedFilter_.getEndPost(),this.index_):r=t.getIteratorFrom(this.rangedFilter_.getStartPost(),this.index_);let o=0;for(;r.hasNext()&&o<this.limit_;){const a=r.getNext();if(this.withinDirectionalStart(a))if(this.withinDirectionalEnd(a))s=s.updateImmediateChild(a.name,a.node),o++;else break;else continue}}else{s=t.withIndex(this.index_),s=s.updatePriority(m.EMPTY_NODE);let r;this.reverse_?r=s.getReverseIterator(this.index_):r=s.getIterator(this.index_);let o=0;for(;r.hasNext();){const a=r.getNext();o<this.limit_&&this.withinDirectionalStart(a)&&this.withinDirectionalEnd(a)?o++:s=s.updateImmediateChild(a.name,m.EMPTY_NODE)}}return this.rangedFilter_.getIndexedFilter().updateFullNode(e,s,i)}updatePriority(e,t){return e}filtersNodes(){return!0}getIndexedFilter(){return this.rangedFilter_.getIndexedFilter()}getIndex(){return this.index_}fullLimitUpdateChild_(e,t,i,s,r){let o;if(this.reverse_){const h=this.index_.getCompare();o=(u,p)=>h(p,u)}else o=this.index_.getCompare();const a=e;f(a.numChildren()===this.limit_,"");const l=new v(t,i),c=this.reverse_?a.getFirstChild(this.index_):a.getLastChild(this.index_),d=this.rangedFilter_.matches(l);if(a.hasChild(t)){const h=a.getImmediateChild(t);let u=s.getChildAfterChild(this.index_,c,this.reverse_);for(;u!=null&&(u.name===t||a.hasChild(u.name));)u=s.getChildAfterChild(this.index_,u,this.reverse_);const p=u==null?1:o(u,l);if(d&&!i.isEmpty()&&p>=0)return r!=null&&r.trackChildChange(bt(t,i,h)),a.updateImmediateChild(t,i);{r!=null&&r.trackChildChange(St(t,h));const C=a.updateImmediateChild(t,m.EMPTY_NODE);return u!=null&&this.rangedFilter_.matches(u)?(r!=null&&r.trackChildChange(Je(u.name,u.node)),C.updateImmediateChild(u.name,u.node)):C}}else return i.isEmpty()?e:d&&o(c,l)>=0?(r!=null&&(r.trackChildChange(St(c.name,c.node)),r.trackChildChange(Je(t,i))),a.updateImmediateChild(t,i).updateImmediateChild(c.name,m.EMPTY_NODE)):e}}/**
2254
2254
  * @license
2255
2255
  * Copyright 2017 Google LLC
2256
2256
  *
@@ -2265,7 +2265,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const e of t
2265
2265
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2266
2266
  * See the License for the specific language governing permissions and
2267
2267
  * limitations under the License.
2268
- */class Hi{constructor(){this.limitSet_=!1,this.startSet_=!1,this.startNameSet_=!1,this.startAfterSet_=!1,this.endSet_=!1,this.endNameSet_=!1,this.endBeforeSet_=!1,this.limit_=0,this.viewFrom_="",this.indexStartValue_=null,this.indexStartName_="",this.indexEndValue_=null,this.indexEndName_="",this.index_=A}hasStart(){return this.startSet_}isViewFromLeft(){return this.viewFrom_===""?this.startSet_:this.viewFrom_==="l"}getIndexStartValue(){return f(this.startSet_,"Only valid if start has been set"),this.indexStartValue_}getIndexStartName(){return f(this.startSet_,"Only valid if start has been set"),this.startNameSet_?this.indexStartName_:Qe}hasEnd(){return this.endSet_}getIndexEndValue(){return f(this.endSet_,"Only valid if end has been set"),this.indexEndValue_}getIndexEndName(){return f(this.endSet_,"Only valid if end has been set"),this.endNameSet_?this.indexEndName_:Oe}hasLimit(){return this.limitSet_}hasAnchoredLimit(){return this.limitSet_&&this.viewFrom_!==""}getLimit(){return f(this.limitSet_,"Only valid if limit has been set"),this.limit_}getIndex(){return this.index_}loadsAllData(){return!(this.startSet_||this.endSet_||this.limitSet_)}isDefault(){return this.loadsAllData()&&this.index_===A}copy(){const e=new Hi;return e.limitSet_=this.limitSet_,e.limit_=this.limit_,e.startSet_=this.startSet_,e.startAfterSet_=this.startAfterSet_,e.indexStartValue_=this.indexStartValue_,e.startNameSet_=this.startNameSet_,e.indexStartName_=this.indexStartName_,e.endSet_=this.endSet_,e.endBeforeSet_=this.endBeforeSet_,e.indexEndValue_=this.indexEndValue_,e.endNameSet_=this.endNameSet_,e.indexEndName_=this.indexEndName_,e.index_=this.index_,e.viewFrom_=this.viewFrom_,e}}function ef(n){return n.loadsAllData()?new Bi(n.getIndex()):n.hasLimit()?new Zd(n):new Rt(n)}function sr(n){const e={};if(n.isDefault())return e;let t;if(n.index_===A?t="$priority":n.index_===Jd?t="$value":n.index_===ze?t="$key":(f(n.index_ instanceof Yd,"Unrecognized index type!"),t=n.index_.toString()),e.orderBy=k(t),n.startSet_){const i=n.startAfterSet_?"startAfter":"startAt";e[i]=k(n.indexStartValue_),n.startNameSet_&&(e[i]+=","+k(n.indexStartName_))}if(n.endSet_){const i=n.endBeforeSet_?"endBefore":"endAt";e[i]=k(n.indexEndValue_),n.endNameSet_&&(e[i]+=","+k(n.indexEndName_))}return n.limitSet_&&(n.isViewFromLeft()?e.limitToFirst=n.limit_:e.limitToLast=n.limit_),e}function rr(n){const e={};if(n.startSet_&&(e.sp=n.indexStartValue_,n.startNameSet_&&(e.sn=n.indexStartName_),e.sin=!n.startAfterSet_),n.endSet_&&(e.ep=n.indexEndValue_,n.endNameSet_&&(e.en=n.indexEndName_),e.ein=!n.endBeforeSet_),n.limitSet_){e.l=n.limit_;let t=n.viewFrom_;t===""&&(n.isViewFromLeft()?t="l":t="r"),e.vf=t}return n.index_!==A&&(e.i=n.index_.toString()),e}/**
2268
+ */class Hi{constructor(){this.limitSet_=!1,this.startSet_=!1,this.startNameSet_=!1,this.startAfterSet_=!1,this.endSet_=!1,this.endNameSet_=!1,this.endBeforeSet_=!1,this.limit_=0,this.viewFrom_="",this.indexStartValue_=null,this.indexStartName_="",this.indexEndValue_=null,this.indexEndName_="",this.index_=k}hasStart(){return this.startSet_}isViewFromLeft(){return this.viewFrom_===""?this.startSet_:this.viewFrom_==="l"}getIndexStartValue(){return f(this.startSet_,"Only valid if start has been set"),this.indexStartValue_}getIndexStartName(){return f(this.startSet_,"Only valid if start has been set"),this.startNameSet_?this.indexStartName_:Qe}hasEnd(){return this.endSet_}getIndexEndValue(){return f(this.endSet_,"Only valid if end has been set"),this.indexEndValue_}getIndexEndName(){return f(this.endSet_,"Only valid if end has been set"),this.endNameSet_?this.indexEndName_:Pe}hasLimit(){return this.limitSet_}hasAnchoredLimit(){return this.limitSet_&&this.viewFrom_!==""}getLimit(){return f(this.limitSet_,"Only valid if limit has been set"),this.limit_}getIndex(){return this.index_}loadsAllData(){return!(this.startSet_||this.endSet_||this.limitSet_)}isDefault(){return this.loadsAllData()&&this.index_===k}copy(){const e=new Hi;return e.limitSet_=this.limitSet_,e.limit_=this.limit_,e.startSet_=this.startSet_,e.startAfterSet_=this.startAfterSet_,e.indexStartValue_=this.indexStartValue_,e.startNameSet_=this.startNameSet_,e.indexStartName_=this.indexStartName_,e.endSet_=this.endSet_,e.endBeforeSet_=this.endBeforeSet_,e.indexEndValue_=this.indexEndValue_,e.endNameSet_=this.endNameSet_,e.indexEndName_=this.indexEndName_,e.index_=this.index_,e.viewFrom_=this.viewFrom_,e}}function tf(n){return n.loadsAllData()?new Bi(n.getIndex()):n.hasLimit()?new ef(n):new Rt(n)}function sr(n){const e={};if(n.isDefault())return e;let t;if(n.index_===k?t="$priority":n.index_===Xd?t="$value":n.index_===ze?t="$key":(f(n.index_ instanceof Qd,"Unrecognized index type!"),t=n.index_.toString()),e.orderBy=A(t),n.startSet_){const i=n.startAfterSet_?"startAfter":"startAt";e[i]=A(n.indexStartValue_),n.startNameSet_&&(e[i]+=","+A(n.indexStartName_))}if(n.endSet_){const i=n.endBeforeSet_?"endBefore":"endAt";e[i]=A(n.indexEndValue_),n.endNameSet_&&(e[i]+=","+A(n.indexEndName_))}return n.limitSet_&&(n.isViewFromLeft()?e.limitToFirst=n.limit_:e.limitToLast=n.limit_),e}function rr(n){const e={};if(n.startSet_&&(e.sp=n.indexStartValue_,n.startNameSet_&&(e.sn=n.indexStartName_),e.sin=!n.startAfterSet_),n.endSet_&&(e.ep=n.indexEndValue_,n.endNameSet_&&(e.en=n.indexEndName_),e.ein=!n.endBeforeSet_),n.limitSet_){e.l=n.limit_;let t=n.viewFrom_;t===""&&(n.isViewFromLeft()?t="l":t="r"),e.vf=t}return n.index_!==k&&(e.i=n.index_.toString()),e}/**
2269
2269
  * @license
2270
2270
  * Copyright 2017 Google LLC
2271
2271
  *
@@ -2295,7 +2295,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const e of t
2295
2295
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2296
2296
  * See the License for the specific language governing permissions and
2297
2297
  * limitations under the License.
2298
- */class tf{constructor(){this.rootNode_=m.EMPTY_NODE}getNode(e){return this.rootNode_.getChild(e)}updateSnapshot(e,t){this.rootNode_=this.rootNode_.updateChild(e,t)}}/**
2298
+ */class nf{constructor(){this.rootNode_=m.EMPTY_NODE}getNode(e){return this.rootNode_.getChild(e)}updateSnapshot(e,t){this.rootNode_=this.rootNode_.updateChild(e,t)}}/**
2299
2299
  * @license
2300
2300
  * Copyright 2017 Google LLC
2301
2301
  *
@@ -2310,7 +2310,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const e of t
2310
2310
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2311
2311
  * See the License for the specific language governing permissions and
2312
2312
  * limitations under the License.
2313
- */function dn(){return{value:null,children:new Map}}function ta(n,e,t){if(y(e))n.value=t,n.children.clear();else if(n.value!==null)n.value=n.value.updateChild(e,t);else{const i=E(e);n.children.has(i)||n.children.set(i,dn());const s=n.children.get(i);e=S(e),ta(s,e,t)}}function ci(n,e,t){n.value!==null?t(e,n.value):nf(n,(i,s)=>{const r=new T(e.toString()+"/"+i);ci(s,r,t)})}function nf(n,e){n.children.forEach((t,i)=>{e(i,t)})}/**
2313
+ */function dn(){return{value:null,children:new Map}}function ta(n,e,t){if(y(e))n.value=t,n.children.clear();else if(n.value!==null)n.value=n.value.updateChild(e,t);else{const i=E(e);n.children.has(i)||n.children.set(i,dn());const s=n.children.get(i);e=S(e),ta(s,e,t)}}function ci(n,e,t){n.value!==null?t(e,n.value):sf(n,(i,s)=>{const r=new T(e.toString()+"/"+i);ci(s,r,t)})}function sf(n,e){n.children.forEach((t,i)=>{e(i,t)})}/**
2314
2314
  * @license
2315
2315
  * Copyright 2017 Google LLC
2316
2316
  *
@@ -2325,7 +2325,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const e of t
2325
2325
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2326
2326
  * See the License for the specific language governing permissions and
2327
2327
  * limitations under the License.
2328
- */class sf{constructor(e){this.collection_=e,this.last_=null}get(){const e=this.collection_.get(),t=Object.assign({},e);return this.last_&&W(this.last_,(i,s)=>{t[i]=t[i]-s}),this.last_=e,t}}/**
2328
+ */class rf{constructor(e){this.collection_=e,this.last_=null}get(){const e=this.collection_.get(),t=Object.assign({},e);return this.last_&&W(this.last_,(i,s)=>{t[i]=t[i]-s}),this.last_=e,t}}/**
2329
2329
  * @license
2330
2330
  * Copyright 2017 Google LLC
2331
2331
  *
@@ -2340,7 +2340,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const e of t
2340
2340
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2341
2341
  * See the License for the specific language governing permissions and
2342
2342
  * limitations under the License.
2343
- */const or=10*1e3,rf=30*1e3,of=5*60*1e3;class af{constructor(e,t){this.server_=t,this.statsToReport_={},this.statsListener_=new sf(e);const i=or+(rf-or)*Math.random();gt(this.reportStats_.bind(this),Math.floor(i))}reportStats_(){const e=this.statsListener_.get(),t={};let i=!1;W(e,(s,r)=>{r>0&&oe(this.statsToReport_,s)&&(t[s]=r,i=!0)}),i&&this.server_.reportStats(t),gt(this.reportStats_.bind(this),Math.floor(Math.random()*2*of))}}/**
2343
+ */const or=10*1e3,of=30*1e3,af=5*60*1e3;class lf{constructor(e,t){this.server_=t,this.statsToReport_={},this.statsListener_=new rf(e);const i=or+(of-or)*Math.random();gt(this.reportStats_.bind(this),Math.floor(i))}reportStats_(){const e=this.statsListener_.get(),t={};let i=!1;W(e,(s,r)=>{r>0&&oe(this.statsToReport_,s)&&(t[s]=r,i=!0)}),i&&this.server_.reportStats(t),gt(this.reportStats_.bind(this),Math.floor(Math.random()*2*af))}}/**
2344
2344
  * @license
2345
2345
  * Copyright 2017 Google LLC
2346
2346
  *
@@ -2385,7 +2385,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const e of t
2385
2385
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2386
2386
  * See the License for the specific language governing permissions and
2387
2387
  * limitations under the License.
2388
- */class At{constructor(e,t){this.source=e,this.path=t,this.type=K.LISTEN_COMPLETE}operationForChild(e){return y(this.path)?new At(this.source,I()):new At(this.source,S(this.path))}}/**
2388
+ */class kt{constructor(e,t){this.source=e,this.path=t,this.type=K.LISTEN_COMPLETE}operationForChild(e){return y(this.path)?new kt(this.source,I()):new kt(this.source,S(this.path))}}/**
2389
2389
  * @license
2390
2390
  * Copyright 2017 Google LLC
2391
2391
  *
@@ -2400,7 +2400,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const e of t
2400
2400
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2401
2401
  * See the License for the specific language governing permissions and
2402
2402
  * limitations under the License.
2403
- */class De{constructor(e,t,i){this.source=e,this.path=t,this.snap=i,this.type=K.OVERWRITE}operationForChild(e){return y(this.path)?new De(this.source,I(),this.snap.getImmediateChild(e)):new De(this.source,S(this.path),this.snap)}}/**
2403
+ */class Oe{constructor(e,t,i){this.source=e,this.path=t,this.snap=i,this.type=K.OVERWRITE}operationForChild(e){return y(this.path)?new Oe(this.source,I(),this.snap.getImmediateChild(e)):new Oe(this.source,S(this.path),this.snap)}}/**
2404
2404
  * @license
2405
2405
  * Copyright 2017 Google LLC
2406
2406
  *
@@ -2415,7 +2415,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const e of t
2415
2415
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2416
2416
  * See the License for the specific language governing permissions and
2417
2417
  * limitations under the License.
2418
- */class kt{constructor(e,t,i){this.source=e,this.path=t,this.children=i,this.type=K.MERGE}operationForChild(e){if(y(this.path)){const t=this.children.subtree(new T(e));return t.isEmpty()?null:t.value?new De(this.source,I(),t.value):new kt(this.source,I(),t)}else return f(E(this.path)===e,"Can't get a merge for a child not on the path of the operation"),new kt(this.source,S(this.path),this.children)}toString(){return"Operation("+this.path+": "+this.source.toString()+" merge: "+this.children.toString()+")"}}/**
2418
+ */class At{constructor(e,t,i){this.source=e,this.path=t,this.children=i,this.type=K.MERGE}operationForChild(e){if(y(this.path)){const t=this.children.subtree(new T(e));return t.isEmpty()?null:t.value?new Oe(this.source,I(),t.value):new At(this.source,I(),t)}else return f(E(this.path)===e,"Can't get a merge for a child not on the path of the operation"),new At(this.source,S(this.path),this.children)}toString(){return"Operation("+this.path+": "+this.source.toString()+" merge: "+this.children.toString()+")"}}/**
2419
2419
  * @license
2420
2420
  * Copyright 2017 Google LLC
2421
2421
  *
@@ -2445,7 +2445,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const e of t
2445
2445
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2446
2446
  * See the License for the specific language governing permissions and
2447
2447
  * limitations under the License.
2448
- */class lf{constructor(e){this.query_=e,this.index_=this.query_._queryParams.getIndex()}}function cf(n,e,t,i){const s=[],r=[];return e.forEach(o=>{o.type==="child_changed"&&n.index_.indexedValueChanged(o.oldSnap,o.snapshotNode)&&r.push(Xd(o.childName,o.snapshotNode))}),ht(n,s,"child_removed",e,i,t),ht(n,s,"child_added",e,i,t),ht(n,s,"child_moved",r,i,t),ht(n,s,"child_changed",e,i,t),ht(n,s,"value",e,i,t),s}function ht(n,e,t,i,s,r){const o=i.filter(a=>a.type===t);o.sort((a,l)=>uf(n,a,l)),o.forEach(a=>{const l=hf(n,a,r);s.forEach(c=>{c.respondsTo(a.type)&&e.push(c.createEvent(l,n.query_))})})}function hf(n,e,t){return e.type==="value"||e.type==="child_removed"||(e.prevName=t.getPredecessorChildName(e.childName,e.snapshotNode,n.index_)),e}function uf(n,e,t){if(e.childName==null||t.childName==null)throw Ze("Should only compare child_ events.");const i=new v(e.childName,e.snapshotNode),s=new v(t.childName,t.snapshotNode);return n.index_.compare(i,s)}/**
2448
+ */class cf{constructor(e){this.query_=e,this.index_=this.query_._queryParams.getIndex()}}function hf(n,e,t,i){const s=[],r=[];return e.forEach(o=>{o.type==="child_changed"&&n.index_.indexedValueChanged(o.oldSnap,o.snapshotNode)&&r.push(Zd(o.childName,o.snapshotNode))}),ht(n,s,"child_removed",e,i,t),ht(n,s,"child_added",e,i,t),ht(n,s,"child_moved",r,i,t),ht(n,s,"child_changed",e,i,t),ht(n,s,"value",e,i,t),s}function ht(n,e,t,i,s,r){const o=i.filter(a=>a.type===t);o.sort((a,l)=>df(n,a,l)),o.forEach(a=>{const l=uf(n,a,r);s.forEach(c=>{c.respondsTo(a.type)&&e.push(c.createEvent(l,n.query_))})})}function uf(n,e,t){return e.type==="value"||e.type==="child_removed"||(e.prevName=t.getPredecessorChildName(e.childName,e.snapshotNode,n.index_)),e}function df(n,e,t){if(e.childName==null||t.childName==null)throw Ze("Should only compare child_ events.");const i=new v(e.childName,e.snapshotNode),s=new v(t.childName,t.snapshotNode);return n.index_.compare(i,s)}/**
2449
2449
  * @license
2450
2450
  * Copyright 2017 Google LLC
2451
2451
  *
@@ -2460,7 +2460,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const e of t
2460
2460
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2461
2461
  * See the License for the specific language governing permissions and
2462
2462
  * limitations under the License.
2463
- */function bn(n,e){return{eventCache:n,serverCache:e}}function mt(n,e,t,i){return bn(new Ee(e,t,i),n.serverCache)}function ia(n,e,t,i){return bn(n.eventCache,new Ee(e,t,i))}function pn(n){return n.eventCache.isFullyInitialized()?n.eventCache.getNode():null}function Me(n){return n.serverCache.isFullyInitialized()?n.serverCache.getNode():null}/**
2463
+ */function bn(n,e){return{eventCache:n,serverCache:e}}function mt(n,e,t,i){return bn(new Ee(e,t,i),n.serverCache)}function ia(n,e,t,i){return bn(n.eventCache,new Ee(e,t,i))}function pn(n){return n.eventCache.isFullyInitialized()?n.eventCache.getNode():null}function De(n){return n.serverCache.isFullyInitialized()?n.serverCache.getNode():null}/**
2464
2464
  * @license
2465
2465
  * Copyright 2017 Google LLC
2466
2466
  *
@@ -2475,7 +2475,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const e of t
2475
2475
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2476
2476
  * See the License for the specific language governing permissions and
2477
2477
  * limitations under the License.
2478
- */let jn;const df=()=>(jn||(jn=new U(Qu)),jn);class b{static fromObject(e){let t=new b(null);return W(e,(i,s)=>{t=t.set(new T(i),s)}),t}constructor(e,t=df()){this.value=e,this.children=t}isEmpty(){return this.value===null&&this.children.isEmpty()}findRootMostMatchingPathAndValue(e,t){if(this.value!=null&&t(this.value))return{path:I(),value:this.value};if(y(e))return null;{const i=E(e),s=this.children.get(i);if(s!==null){const r=s.findRootMostMatchingPathAndValue(S(e),t);return r!=null?{path:N(new T(i),r.path),value:r.value}:null}else return null}}findRootMostValueAndPath(e){return this.findRootMostMatchingPathAndValue(e,()=>!0)}subtree(e){if(y(e))return this;{const t=E(e),i=this.children.get(t);return i!==null?i.subtree(S(e)):new b(null)}}set(e,t){if(y(e))return new b(t,this.children);{const i=E(e),r=(this.children.get(i)||new b(null)).set(S(e),t),o=this.children.insert(i,r);return new b(this.value,o)}}remove(e){if(y(e))return this.children.isEmpty()?new b(null):new b(null,this.children);{const t=E(e),i=this.children.get(t);if(i){const s=i.remove(S(e));let r;return s.isEmpty()?r=this.children.remove(t):r=this.children.insert(t,s),this.value===null&&r.isEmpty()?new b(null):new b(this.value,r)}else return this}}get(e){if(y(e))return this.value;{const t=E(e),i=this.children.get(t);return i?i.get(S(e)):null}}setTree(e,t){if(y(e))return t;{const i=E(e),r=(this.children.get(i)||new b(null)).setTree(S(e),t);let o;return r.isEmpty()?o=this.children.remove(i):o=this.children.insert(i,r),new b(this.value,o)}}fold(e){return this.fold_(I(),e)}fold_(e,t){const i={};return this.children.inorderTraversal((s,r)=>{i[s]=r.fold_(N(e,s),t)}),t(e,this.value,i)}findOnPath(e,t){return this.findOnPath_(e,I(),t)}findOnPath_(e,t,i){const s=this.value?i(t,this.value):!1;if(s)return s;if(y(e))return null;{const r=E(e),o=this.children.get(r);return o?o.findOnPath_(S(e),N(t,r),i):null}}foreachOnPath(e,t){return this.foreachOnPath_(e,I(),t)}foreachOnPath_(e,t,i){if(y(e))return this;{this.value&&i(t,this.value);const s=E(e),r=this.children.get(s);return r?r.foreachOnPath_(S(e),N(t,s),i):new b(null)}}foreach(e){this.foreach_(I(),e)}foreach_(e,t){this.children.inorderTraversal((i,s)=>{s.foreach_(N(e,i),t)}),this.value&&t(e,this.value)}foreachChild(e){this.children.inorderTraversal((t,i)=>{i.value&&e(t,i.value)})}}/**
2478
+ */let jn;const ff=()=>(jn||(jn=new U(Ju)),jn);class b{static fromObject(e){let t=new b(null);return W(e,(i,s)=>{t=t.set(new T(i),s)}),t}constructor(e,t=ff()){this.value=e,this.children=t}isEmpty(){return this.value===null&&this.children.isEmpty()}findRootMostMatchingPathAndValue(e,t){if(this.value!=null&&t(this.value))return{path:I(),value:this.value};if(y(e))return null;{const i=E(e),s=this.children.get(i);if(s!==null){const r=s.findRootMostMatchingPathAndValue(S(e),t);return r!=null?{path:N(new T(i),r.path),value:r.value}:null}else return null}}findRootMostValueAndPath(e){return this.findRootMostMatchingPathAndValue(e,()=>!0)}subtree(e){if(y(e))return this;{const t=E(e),i=this.children.get(t);return i!==null?i.subtree(S(e)):new b(null)}}set(e,t){if(y(e))return new b(t,this.children);{const i=E(e),r=(this.children.get(i)||new b(null)).set(S(e),t),o=this.children.insert(i,r);return new b(this.value,o)}}remove(e){if(y(e))return this.children.isEmpty()?new b(null):new b(null,this.children);{const t=E(e),i=this.children.get(t);if(i){const s=i.remove(S(e));let r;return s.isEmpty()?r=this.children.remove(t):r=this.children.insert(t,s),this.value===null&&r.isEmpty()?new b(null):new b(this.value,r)}else return this}}get(e){if(y(e))return this.value;{const t=E(e),i=this.children.get(t);return i?i.get(S(e)):null}}setTree(e,t){if(y(e))return t;{const i=E(e),r=(this.children.get(i)||new b(null)).setTree(S(e),t);let o;return r.isEmpty()?o=this.children.remove(i):o=this.children.insert(i,r),new b(this.value,o)}}fold(e){return this.fold_(I(),e)}fold_(e,t){const i={};return this.children.inorderTraversal((s,r)=>{i[s]=r.fold_(N(e,s),t)}),t(e,this.value,i)}findOnPath(e,t){return this.findOnPath_(e,I(),t)}findOnPath_(e,t,i){const s=this.value?i(t,this.value):!1;if(s)return s;if(y(e))return null;{const r=E(e),o=this.children.get(r);return o?o.findOnPath_(S(e),N(t,r),i):null}}foreachOnPath(e,t){return this.foreachOnPath_(e,I(),t)}foreachOnPath_(e,t,i){if(y(e))return this;{this.value&&i(t,this.value);const s=E(e),r=this.children.get(s);return r?r.foreachOnPath_(S(e),N(t,s),i):new b(null)}}foreach(e){this.foreach_(I(),e)}foreach_(e,t){this.children.inorderTraversal((i,s)=>{s.foreach_(N(e,i),t)}),this.value&&t(e,this.value)}foreachChild(e){this.children.inorderTraversal((t,i)=>{i.value&&e(t,i.value)})}}/**
2479
2479
  * @license
2480
2480
  * Copyright 2017 Google LLC
2481
2481
  *
@@ -2490,7 +2490,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const e of t
2490
2490
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2491
2491
  * See the License for the specific language governing permissions and
2492
2492
  * limitations under the License.
2493
- */class Y{constructor(e){this.writeTree_=e}static empty(){return new Y(new b(null))}}function vt(n,e,t){if(y(e))return new Y(new b(t));{const i=n.writeTree_.findRootMostValueAndPath(e);if(i!=null){const s=i.path;let r=i.value;const o=L(s,e);return r=r.updateChild(o,t),new Y(n.writeTree_.set(s,r))}else{const s=new b(t),r=n.writeTree_.setTree(e,s);return new Y(r)}}}function ar(n,e,t){let i=n;return W(t,(s,r)=>{i=vt(i,N(e,s),r)}),i}function lr(n,e){if(y(e))return Y.empty();{const t=n.writeTree_.setTree(e,new b(null));return new Y(t)}}function hi(n,e){return xe(n,e)!=null}function xe(n,e){const t=n.writeTree_.findRootMostValueAndPath(e);return t!=null?n.writeTree_.get(t.path).getChild(L(t.path,e)):null}function cr(n){const e=[],t=n.writeTree_.value;return t!=null?t.isLeafNode()||t.forEachChild(A,(i,s)=>{e.push(new v(i,s))}):n.writeTree_.children.inorderTraversal((i,s)=>{s.value!=null&&e.push(new v(i,s.value))}),e}function me(n,e){if(y(e))return n;{const t=xe(n,e);return t!=null?new Y(new b(t)):new Y(n.writeTree_.subtree(e))}}function ui(n){return n.writeTree_.isEmpty()}function Xe(n,e){return sa(I(),n.writeTree_,e)}function sa(n,e,t){if(e.value!=null)return t.updateChild(n,e.value);{let i=null;return e.children.inorderTraversal((s,r)=>{s===".priority"?(f(r.value!==null,"Priority writes must always be leaf nodes"),i=r.value):t=sa(N(n,s),r,t)}),!t.getChild(n).isEmpty()&&i!==null&&(t=t.updateChild(N(n,".priority"),i)),t}}/**
2493
+ */class Y{constructor(e){this.writeTree_=e}static empty(){return new Y(new b(null))}}function vt(n,e,t){if(y(e))return new Y(new b(t));{const i=n.writeTree_.findRootMostValueAndPath(e);if(i!=null){const s=i.path;let r=i.value;const o=L(s,e);return r=r.updateChild(o,t),new Y(n.writeTree_.set(s,r))}else{const s=new b(t),r=n.writeTree_.setTree(e,s);return new Y(r)}}}function ar(n,e,t){let i=n;return W(t,(s,r)=>{i=vt(i,N(e,s),r)}),i}function lr(n,e){if(y(e))return Y.empty();{const t=n.writeTree_.setTree(e,new b(null));return new Y(t)}}function hi(n,e){return Le(n,e)!=null}function Le(n,e){const t=n.writeTree_.findRootMostValueAndPath(e);return t!=null?n.writeTree_.get(t.path).getChild(L(t.path,e)):null}function cr(n){const e=[],t=n.writeTree_.value;return t!=null?t.isLeafNode()||t.forEachChild(k,(i,s)=>{e.push(new v(i,s))}):n.writeTree_.children.inorderTraversal((i,s)=>{s.value!=null&&e.push(new v(i,s.value))}),e}function me(n,e){if(y(e))return n;{const t=Le(n,e);return t!=null?new Y(new b(t)):new Y(n.writeTree_.subtree(e))}}function ui(n){return n.writeTree_.isEmpty()}function Xe(n,e){return sa(I(),n.writeTree_,e)}function sa(n,e,t){if(e.value!=null)return t.updateChild(n,e.value);{let i=null;return e.children.inorderTraversal((s,r)=>{s===".priority"?(f(r.value!==null,"Priority writes must always be leaf nodes"),i=r.value):t=sa(N(n,s),r,t)}),!t.getChild(n).isEmpty()&&i!==null&&(t=t.updateChild(N(n,".priority"),i)),t}}/**
2494
2494
  * @license
2495
2495
  * Copyright 2017 Google LLC
2496
2496
  *
@@ -2505,7 +2505,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const e of t
2505
2505
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2506
2506
  * See the License for the specific language governing permissions and
2507
2507
  * limitations under the License.
2508
- */function Rn(n,e){return la(e,n)}function ff(n,e,t,i,s){f(i>n.lastWriteId,"Stacking an older write on top of newer ones"),s===void 0&&(s=!0),n.allWrites.push({path:e,snap:t,writeId:i,visible:s}),s&&(n.visibleWrites=vt(n.visibleWrites,e,t)),n.lastWriteId=i}function pf(n,e){for(let t=0;t<n.allWrites.length;t++){const i=n.allWrites[t];if(i.writeId===e)return i}return null}function _f(n,e){const t=n.allWrites.findIndex(a=>a.writeId===e);f(t>=0,"removeWrite called with nonexistent writeId.");const i=n.allWrites[t];n.allWrites.splice(t,1);let s=i.visible,r=!1,o=n.allWrites.length-1;for(;s&&o>=0;){const a=n.allWrites[o];a.visible&&(o>=t&&gf(a,i.path)?s=!1:q(i.path,a.path)&&(r=!0)),o--}if(s){if(r)return mf(n),!0;if(i.snap)n.visibleWrites=lr(n.visibleWrites,i.path);else{const a=i.children;W(a,l=>{n.visibleWrites=lr(n.visibleWrites,N(i.path,l))})}return!0}else return!1}function gf(n,e){if(n.snap)return q(n.path,e);for(const t in n.children)if(n.children.hasOwnProperty(t)&&q(N(n.path,t),e))return!0;return!1}function mf(n){n.visibleWrites=ra(n.allWrites,vf,I()),n.allWrites.length>0?n.lastWriteId=n.allWrites[n.allWrites.length-1].writeId:n.lastWriteId=-1}function vf(n){return n.visible}function ra(n,e,t){let i=Y.empty();for(let s=0;s<n.length;++s){const r=n[s];if(e(r)){const o=r.path;let a;if(r.snap)q(t,o)?(a=L(t,o),i=vt(i,a,r.snap)):q(o,t)&&(a=L(o,t),i=vt(i,I(),r.snap.getChild(a)));else if(r.children){if(q(t,o))a=L(t,o),i=ar(i,a,r.children);else if(q(o,t))if(a=L(o,t),y(a))i=ar(i,I(),r.children);else{const l=qe(r.children,E(a));if(l){const c=l.getChild(S(a));i=vt(i,I(),c)}}}else throw Ze("WriteRecord should have .snap or .children")}}return i}function oa(n,e,t,i,s){if(!i&&!s){const r=xe(n.visibleWrites,e);if(r!=null)return r;{const o=me(n.visibleWrites,e);if(ui(o))return t;if(t==null&&!hi(o,I()))return null;{const a=t||m.EMPTY_NODE;return Xe(o,a)}}}else{const r=me(n.visibleWrites,e);if(!s&&ui(r))return t;if(!s&&t==null&&!hi(r,I()))return null;{const o=function(c){return(c.visible||s)&&(!i||!~i.indexOf(c.writeId))&&(q(c.path,e)||q(e,c.path))},a=ra(n.allWrites,o,e),l=t||m.EMPTY_NODE;return Xe(a,l)}}}function yf(n,e,t){let i=m.EMPTY_NODE;const s=xe(n.visibleWrites,e);if(s)return s.isLeafNode()||s.forEachChild(A,(r,o)=>{i=i.updateImmediateChild(r,o)}),i;if(t){const r=me(n.visibleWrites,e);return t.forEachChild(A,(o,a)=>{const l=Xe(me(r,new T(o)),a);i=i.updateImmediateChild(o,l)}),cr(r).forEach(o=>{i=i.updateImmediateChild(o.name,o.node)}),i}else{const r=me(n.visibleWrites,e);return cr(r).forEach(o=>{i=i.updateImmediateChild(o.name,o.node)}),i}}function Ef(n,e,t,i,s){f(i||s,"Either existingEventSnap or existingServerSnap must exist");const r=N(e,t);if(hi(n.visibleWrites,r))return null;{const o=me(n.visibleWrites,r);return ui(o)?s.getChild(t):Xe(o,s.getChild(t))}}function If(n,e,t,i){const s=N(e,t),r=xe(n.visibleWrites,s);if(r!=null)return r;if(i.isCompleteForChild(t)){const o=me(n.visibleWrites,s);return Xe(o,i.getNode().getImmediateChild(t))}else return null}function Cf(n,e){return xe(n.visibleWrites,e)}function wf(n,e,t,i,s,r,o){let a;const l=me(n.visibleWrites,e),c=xe(l,I());if(c!=null)a=c;else if(t!=null)a=Xe(l,t);else return[];if(a=a.withIndex(o),!a.isEmpty()&&!a.isLeafNode()){const d=[],h=o.getCompare(),u=r?a.getReverseIteratorFrom(i,o):a.getIteratorFrom(i,o);let p=u.getNext();for(;p&&d.length<s;)h(p,i)!==0&&d.push(p),p=u.getNext();return d}else return[]}function Tf(){return{visibleWrites:Y.empty(),allWrites:[],lastWriteId:-1}}function _n(n,e,t,i){return oa(n.writeTree,n.treePath,e,t,i)}function Gi(n,e){return yf(n.writeTree,n.treePath,e)}function hr(n,e,t,i){return Ef(n.writeTree,n.treePath,e,t,i)}function gn(n,e){return Cf(n.writeTree,N(n.treePath,e))}function Sf(n,e,t,i,s,r){return wf(n.writeTree,n.treePath,e,t,i,s,r)}function ji(n,e,t){return If(n.writeTree,n.treePath,e,t)}function aa(n,e){return la(N(n.treePath,e),n.writeTree)}function la(n,e){return{treePath:n,writeTree:e}}/**
2508
+ */function Rn(n,e){return la(e,n)}function pf(n,e,t,i,s){f(i>n.lastWriteId,"Stacking an older write on top of newer ones"),s===void 0&&(s=!0),n.allWrites.push({path:e,snap:t,writeId:i,visible:s}),s&&(n.visibleWrites=vt(n.visibleWrites,e,t)),n.lastWriteId=i}function _f(n,e){for(let t=0;t<n.allWrites.length;t++){const i=n.allWrites[t];if(i.writeId===e)return i}return null}function gf(n,e){const t=n.allWrites.findIndex(a=>a.writeId===e);f(t>=0,"removeWrite called with nonexistent writeId.");const i=n.allWrites[t];n.allWrites.splice(t,1);let s=i.visible,r=!1,o=n.allWrites.length-1;for(;s&&o>=0;){const a=n.allWrites[o];a.visible&&(o>=t&&mf(a,i.path)?s=!1:q(i.path,a.path)&&(r=!0)),o--}if(s){if(r)return vf(n),!0;if(i.snap)n.visibleWrites=lr(n.visibleWrites,i.path);else{const a=i.children;W(a,l=>{n.visibleWrites=lr(n.visibleWrites,N(i.path,l))})}return!0}else return!1}function mf(n,e){if(n.snap)return q(n.path,e);for(const t in n.children)if(n.children.hasOwnProperty(t)&&q(N(n.path,t),e))return!0;return!1}function vf(n){n.visibleWrites=ra(n.allWrites,yf,I()),n.allWrites.length>0?n.lastWriteId=n.allWrites[n.allWrites.length-1].writeId:n.lastWriteId=-1}function yf(n){return n.visible}function ra(n,e,t){let i=Y.empty();for(let s=0;s<n.length;++s){const r=n[s];if(e(r)){const o=r.path;let a;if(r.snap)q(t,o)?(a=L(t,o),i=vt(i,a,r.snap)):q(o,t)&&(a=L(o,t),i=vt(i,I(),r.snap.getChild(a)));else if(r.children){if(q(t,o))a=L(t,o),i=ar(i,a,r.children);else if(q(o,t))if(a=L(o,t),y(a))i=ar(i,I(),r.children);else{const l=qe(r.children,E(a));if(l){const c=l.getChild(S(a));i=vt(i,I(),c)}}}else throw Ze("WriteRecord should have .snap or .children")}}return i}function oa(n,e,t,i,s){if(!i&&!s){const r=Le(n.visibleWrites,e);if(r!=null)return r;{const o=me(n.visibleWrites,e);if(ui(o))return t;if(t==null&&!hi(o,I()))return null;{const a=t||m.EMPTY_NODE;return Xe(o,a)}}}else{const r=me(n.visibleWrites,e);if(!s&&ui(r))return t;if(!s&&t==null&&!hi(r,I()))return null;{const o=function(c){return(c.visible||s)&&(!i||!~i.indexOf(c.writeId))&&(q(c.path,e)||q(e,c.path))},a=ra(n.allWrites,o,e),l=t||m.EMPTY_NODE;return Xe(a,l)}}}function Ef(n,e,t){let i=m.EMPTY_NODE;const s=Le(n.visibleWrites,e);if(s)return s.isLeafNode()||s.forEachChild(k,(r,o)=>{i=i.updateImmediateChild(r,o)}),i;if(t){const r=me(n.visibleWrites,e);return t.forEachChild(k,(o,a)=>{const l=Xe(me(r,new T(o)),a);i=i.updateImmediateChild(o,l)}),cr(r).forEach(o=>{i=i.updateImmediateChild(o.name,o.node)}),i}else{const r=me(n.visibleWrites,e);return cr(r).forEach(o=>{i=i.updateImmediateChild(o.name,o.node)}),i}}function If(n,e,t,i,s){f(i||s,"Either existingEventSnap or existingServerSnap must exist");const r=N(e,t);if(hi(n.visibleWrites,r))return null;{const o=me(n.visibleWrites,r);return ui(o)?s.getChild(t):Xe(o,s.getChild(t))}}function Cf(n,e,t,i){const s=N(e,t),r=Le(n.visibleWrites,s);if(r!=null)return r;if(i.isCompleteForChild(t)){const o=me(n.visibleWrites,s);return Xe(o,i.getNode().getImmediateChild(t))}else return null}function wf(n,e){return Le(n.visibleWrites,e)}function Tf(n,e,t,i,s,r,o){let a;const l=me(n.visibleWrites,e),c=Le(l,I());if(c!=null)a=c;else if(t!=null)a=Xe(l,t);else return[];if(a=a.withIndex(o),!a.isEmpty()&&!a.isLeafNode()){const d=[],h=o.getCompare(),u=r?a.getReverseIteratorFrom(i,o):a.getIteratorFrom(i,o);let p=u.getNext();for(;p&&d.length<s;)h(p,i)!==0&&d.push(p),p=u.getNext();return d}else return[]}function Sf(){return{visibleWrites:Y.empty(),allWrites:[],lastWriteId:-1}}function _n(n,e,t,i){return oa(n.writeTree,n.treePath,e,t,i)}function Gi(n,e){return Ef(n.writeTree,n.treePath,e)}function hr(n,e,t,i){return If(n.writeTree,n.treePath,e,t,i)}function gn(n,e){return wf(n.writeTree,N(n.treePath,e))}function bf(n,e,t,i,s,r){return Tf(n.writeTree,n.treePath,e,t,i,s,r)}function ji(n,e,t){return Cf(n.writeTree,n.treePath,e,t)}function aa(n,e){return la(N(n.treePath,e),n.writeTree)}function la(n,e){return{treePath:n,writeTree:e}}/**
2509
2509
  * @license
2510
2510
  * Copyright 2017 Google LLC
2511
2511
  *
@@ -2520,7 +2520,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const e of t
2520
2520
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2521
2521
  * See the License for the specific language governing permissions and
2522
2522
  * limitations under the License.
2523
- */class bf{constructor(){this.changeMap=new Map}trackChildChange(e){const t=e.type,i=e.childName;f(t==="child_added"||t==="child_changed"||t==="child_removed","Only child changes supported for tracking"),f(i!==".priority","Only non-priority child changes can be tracked.");const s=this.changeMap.get(i);if(s){const r=s.type;if(t==="child_added"&&r==="child_removed")this.changeMap.set(i,bt(i,e.snapshotNode,s.snapshotNode));else if(t==="child_removed"&&r==="child_added")this.changeMap.delete(i);else if(t==="child_removed"&&r==="child_changed")this.changeMap.set(i,St(i,s.oldSnap));else if(t==="child_changed"&&r==="child_added")this.changeMap.set(i,Je(i,e.snapshotNode));else if(t==="child_changed"&&r==="child_changed")this.changeMap.set(i,bt(i,e.snapshotNode,s.oldSnap));else throw Ze("Illegal combination of changes: "+e+" occurred after "+s)}else this.changeMap.set(i,e)}getChanges(){return Array.from(this.changeMap.values())}}/**
2523
+ */class Rf{constructor(){this.changeMap=new Map}trackChildChange(e){const t=e.type,i=e.childName;f(t==="child_added"||t==="child_changed"||t==="child_removed","Only child changes supported for tracking"),f(i!==".priority","Only non-priority child changes can be tracked.");const s=this.changeMap.get(i);if(s){const r=s.type;if(t==="child_added"&&r==="child_removed")this.changeMap.set(i,bt(i,e.snapshotNode,s.snapshotNode));else if(t==="child_removed"&&r==="child_added")this.changeMap.delete(i);else if(t==="child_removed"&&r==="child_changed")this.changeMap.set(i,St(i,s.oldSnap));else if(t==="child_changed"&&r==="child_added")this.changeMap.set(i,Je(i,e.snapshotNode));else if(t==="child_changed"&&r==="child_changed")this.changeMap.set(i,bt(i,e.snapshotNode,s.oldSnap));else throw Ze("Illegal combination of changes: "+e+" occurred after "+s)}else this.changeMap.set(i,e)}getChanges(){return Array.from(this.changeMap.values())}}/**
2524
2524
  * @license
2525
2525
  * Copyright 2017 Google LLC
2526
2526
  *
@@ -2535,7 +2535,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const e of t
2535
2535
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2536
2536
  * See the License for the specific language governing permissions and
2537
2537
  * limitations under the License.
2538
- */class Rf{getCompleteChild(e){return null}getChildAfterChild(e,t,i){return null}}const ca=new Rf;class zi{constructor(e,t,i=null){this.writes_=e,this.viewCache_=t,this.optCompleteServerCache_=i}getCompleteChild(e){const t=this.viewCache_.eventCache;if(t.isCompleteForChild(e))return t.getNode().getImmediateChild(e);{const i=this.optCompleteServerCache_!=null?new Ee(this.optCompleteServerCache_,!0,!1):this.viewCache_.serverCache;return ji(this.writes_,e,i)}}getChildAfterChild(e,t,i){const s=this.optCompleteServerCache_!=null?this.optCompleteServerCache_:Me(this.viewCache_),r=Sf(this.writes_,s,t,1,i,e);return r.length===0?null:r[0]}}/**
2538
+ */class kf{getCompleteChild(e){return null}getChildAfterChild(e,t,i){return null}}const ca=new kf;class zi{constructor(e,t,i=null){this.writes_=e,this.viewCache_=t,this.optCompleteServerCache_=i}getCompleteChild(e){const t=this.viewCache_.eventCache;if(t.isCompleteForChild(e))return t.getNode().getImmediateChild(e);{const i=this.optCompleteServerCache_!=null?new Ee(this.optCompleteServerCache_,!0,!1):this.viewCache_.serverCache;return ji(this.writes_,e,i)}}getChildAfterChild(e,t,i){const s=this.optCompleteServerCache_!=null?this.optCompleteServerCache_:De(this.viewCache_),r=bf(this.writes_,s,t,1,i,e);return r.length===0?null:r[0]}}/**
2539
2539
  * @license
2540
2540
  * Copyright 2017 Google LLC
2541
2541
  *
@@ -2550,7 +2550,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const e of t
2550
2550
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2551
2551
  * See the License for the specific language governing permissions and
2552
2552
  * limitations under the License.
2553
- */function Af(n){return{filter:n}}function kf(n,e){f(e.eventCache.getNode().isIndexed(n.filter.getIndex()),"Event snap not indexed"),f(e.serverCache.getNode().isIndexed(n.filter.getIndex()),"Server snap not indexed")}function Nf(n,e,t,i,s){const r=new bf;let o,a;if(t.type===K.OVERWRITE){const c=t;c.source.fromUser?o=di(n,e,c.path,c.snap,i,s,r):(f(c.source.fromServer,"Unknown source."),a=c.source.tagged||e.serverCache.isFiltered()&&!y(c.path),o=mn(n,e,c.path,c.snap,i,s,a,r))}else if(t.type===K.MERGE){const c=t;c.source.fromUser?o=Of(n,e,c.path,c.children,i,s,r):(f(c.source.fromServer,"Unknown source."),a=c.source.tagged||e.serverCache.isFiltered(),o=fi(n,e,c.path,c.children,i,s,a,r))}else if(t.type===K.ACK_USER_WRITE){const c=t;c.revert?o=Lf(n,e,c.path,i,s,r):o=Df(n,e,c.path,c.affectedTree,i,s,r)}else if(t.type===K.LISTEN_COMPLETE)o=Mf(n,e,t.path,i,r);else throw Ze("Unknown operation type: "+t.type);const l=r.getChanges();return Pf(e,o,l),{viewCache:o,changes:l}}function Pf(n,e,t){const i=e.eventCache;if(i.isFullyInitialized()){const s=i.getNode().isLeafNode()||i.getNode().isEmpty(),r=pn(n);(t.length>0||!n.eventCache.isFullyInitialized()||s&&!i.getNode().equals(r)||!i.getNode().getPriority().equals(r.getPriority()))&&t.push(ea(pn(e)))}}function ha(n,e,t,i,s,r){const o=e.eventCache;if(gn(i,t)!=null)return e;{let a,l;if(y(t))if(f(e.serverCache.isFullyInitialized(),"If change path is empty, we must have complete server data"),e.serverCache.isFiltered()){const c=Me(e),d=c instanceof m?c:m.EMPTY_NODE,h=Gi(i,d);a=n.filter.updateFullNode(e.eventCache.getNode(),h,r)}else{const c=_n(i,Me(e));a=n.filter.updateFullNode(e.eventCache.getNode(),c,r)}else{const c=E(t);if(c===".priority"){f(ye(t)===1,"Can't have a priority with additional path components");const d=o.getNode();l=e.serverCache.getNode();const h=hr(i,t,d,l);h!=null?a=n.filter.updatePriority(d,h):a=o.getNode()}else{const d=S(t);let h;if(o.isCompleteForChild(c)){l=e.serverCache.getNode();const u=hr(i,t,o.getNode(),l);u!=null?h=o.getNode().getImmediateChild(c).updateChild(d,u):h=o.getNode().getImmediateChild(c)}else h=ji(i,c,e.serverCache);h!=null?a=n.filter.updateChild(o.getNode(),c,h,d,s,r):a=o.getNode()}}return mt(e,a,o.isFullyInitialized()||y(t),n.filter.filtersNodes())}}function mn(n,e,t,i,s,r,o,a){const l=e.serverCache;let c;const d=o?n.filter:n.filter.getIndexedFilter();if(y(t))c=d.updateFullNode(l.getNode(),i,null);else if(d.filtersNodes()&&!l.isFiltered()){const p=l.getNode().updateChild(t,i);c=d.updateFullNode(l.getNode(),p,null)}else{const p=E(t);if(!l.isCompleteForPath(t)&&ye(t)>1)return e;const _=S(t),R=l.getNode().getImmediateChild(p).updateChild(_,i);p===".priority"?c=d.updatePriority(l.getNode(),R):c=d.updateChild(l.getNode(),p,R,_,ca,null)}const h=ia(e,c,l.isFullyInitialized()||y(t),d.filtersNodes()),u=new zi(s,h,r);return ha(n,h,t,s,u,a)}function di(n,e,t,i,s,r,o){const a=e.eventCache;let l,c;const d=new zi(s,e,r);if(y(t))c=n.filter.updateFullNode(e.eventCache.getNode(),i,o),l=mt(e,c,!0,n.filter.filtersNodes());else{const h=E(t);if(h===".priority")c=n.filter.updatePriority(e.eventCache.getNode(),i),l=mt(e,c,a.isFullyInitialized(),a.isFiltered());else{const u=S(t),p=a.getNode().getImmediateChild(h);let _;if(y(u))_=i;else{const C=d.getCompleteChild(h);C!=null?Go(u)===".priority"&&C.getChild(zo(u)).isEmpty()?_=C:_=C.updateChild(u,i):_=m.EMPTY_NODE}if(p.equals(_))l=e;else{const C=n.filter.updateChild(a.getNode(),h,_,u,d,o);l=mt(e,C,a.isFullyInitialized(),n.filter.filtersNodes())}}}return l}function ur(n,e){return n.eventCache.isCompleteForChild(e)}function Of(n,e,t,i,s,r,o){let a=e;return i.foreach((l,c)=>{const d=N(t,l);ur(e,E(d))&&(a=di(n,a,d,c,s,r,o))}),i.foreach((l,c)=>{const d=N(t,l);ur(e,E(d))||(a=di(n,a,d,c,s,r,o))}),a}function dr(n,e,t){return t.foreach((i,s)=>{e=e.updateChild(i,s)}),e}function fi(n,e,t,i,s,r,o,a){if(e.serverCache.getNode().isEmpty()&&!e.serverCache.isFullyInitialized())return e;let l=e,c;y(t)?c=i:c=new b(null).setTree(t,i);const d=e.serverCache.getNode();return c.children.inorderTraversal((h,u)=>{if(d.hasChild(h)){const p=e.serverCache.getNode().getImmediateChild(h),_=dr(n,p,u);l=mn(n,l,new T(h),_,s,r,o,a)}}),c.children.inorderTraversal((h,u)=>{const p=!e.serverCache.isCompleteForChild(h)&&u.value===null;if(!d.hasChild(h)&&!p){const _=e.serverCache.getNode().getImmediateChild(h),C=dr(n,_,u);l=mn(n,l,new T(h),C,s,r,o,a)}}),l}function Df(n,e,t,i,s,r,o){if(gn(s,t)!=null)return e;const a=e.serverCache.isFiltered(),l=e.serverCache;if(i.value!=null){if(y(t)&&l.isFullyInitialized()||l.isCompleteForPath(t))return mn(n,e,t,l.getNode().getChild(t),s,r,a,o);if(y(t)){let c=new b(null);return l.getNode().forEachChild(ze,(d,h)=>{c=c.set(new T(d),h)}),fi(n,e,t,c,s,r,a,o)}else return e}else{let c=new b(null);return i.foreach((d,h)=>{const u=N(t,d);l.isCompleteForPath(u)&&(c=c.set(d,l.getNode().getChild(u)))}),fi(n,e,t,c,s,r,a,o)}}function Mf(n,e,t,i,s){const r=e.serverCache,o=ia(e,r.getNode(),r.isFullyInitialized()||y(t),r.isFiltered());return ha(n,o,t,i,ca,s)}function Lf(n,e,t,i,s,r){let o;if(gn(i,t)!=null)return e;{const a=new zi(i,e,s),l=e.eventCache.getNode();let c;if(y(t)||E(t)===".priority"){let d;if(e.serverCache.isFullyInitialized())d=_n(i,Me(e));else{const h=e.serverCache.getNode();f(h instanceof m,"serverChildren would be complete if leaf node"),d=Gi(i,h)}d=d,c=n.filter.updateFullNode(l,d,r)}else{const d=E(t);let h=ji(i,d,e.serverCache);h==null&&e.serverCache.isCompleteForChild(d)&&(h=l.getImmediateChild(d)),h!=null?c=n.filter.updateChild(l,d,h,S(t),a,r):e.eventCache.getNode().hasChild(d)?c=n.filter.updateChild(l,d,m.EMPTY_NODE,S(t),a,r):c=l,c.isEmpty()&&e.serverCache.isFullyInitialized()&&(o=_n(i,Me(e)),o.isLeafNode()&&(c=n.filter.updateFullNode(c,o,r)))}return o=e.serverCache.isFullyInitialized()||gn(i,I())!=null,mt(e,c,o,n.filter.filtersNodes())}}/**
2553
+ */function Af(n){return{filter:n}}function Nf(n,e){f(e.eventCache.getNode().isIndexed(n.filter.getIndex()),"Event snap not indexed"),f(e.serverCache.getNode().isIndexed(n.filter.getIndex()),"Server snap not indexed")}function Pf(n,e,t,i,s){const r=new Rf;let o,a;if(t.type===K.OVERWRITE){const c=t;c.source.fromUser?o=di(n,e,c.path,c.snap,i,s,r):(f(c.source.fromServer,"Unknown source."),a=c.source.tagged||e.serverCache.isFiltered()&&!y(c.path),o=mn(n,e,c.path,c.snap,i,s,a,r))}else if(t.type===K.MERGE){const c=t;c.source.fromUser?o=Df(n,e,c.path,c.children,i,s,r):(f(c.source.fromServer,"Unknown source."),a=c.source.tagged||e.serverCache.isFiltered(),o=fi(n,e,c.path,c.children,i,s,a,r))}else if(t.type===K.ACK_USER_WRITE){const c=t;c.revert?o=xf(n,e,c.path,i,s,r):o=Mf(n,e,c.path,c.affectedTree,i,s,r)}else if(t.type===K.LISTEN_COMPLETE)o=Lf(n,e,t.path,i,r);else throw Ze("Unknown operation type: "+t.type);const l=r.getChanges();return Of(e,o,l),{viewCache:o,changes:l}}function Of(n,e,t){const i=e.eventCache;if(i.isFullyInitialized()){const s=i.getNode().isLeafNode()||i.getNode().isEmpty(),r=pn(n);(t.length>0||!n.eventCache.isFullyInitialized()||s&&!i.getNode().equals(r)||!i.getNode().getPriority().equals(r.getPriority()))&&t.push(ea(pn(e)))}}function ha(n,e,t,i,s,r){const o=e.eventCache;if(gn(i,t)!=null)return e;{let a,l;if(y(t))if(f(e.serverCache.isFullyInitialized(),"If change path is empty, we must have complete server data"),e.serverCache.isFiltered()){const c=De(e),d=c instanceof m?c:m.EMPTY_NODE,h=Gi(i,d);a=n.filter.updateFullNode(e.eventCache.getNode(),h,r)}else{const c=_n(i,De(e));a=n.filter.updateFullNode(e.eventCache.getNode(),c,r)}else{const c=E(t);if(c===".priority"){f(ye(t)===1,"Can't have a priority with additional path components");const d=o.getNode();l=e.serverCache.getNode();const h=hr(i,t,d,l);h!=null?a=n.filter.updatePriority(d,h):a=o.getNode()}else{const d=S(t);let h;if(o.isCompleteForChild(c)){l=e.serverCache.getNode();const u=hr(i,t,o.getNode(),l);u!=null?h=o.getNode().getImmediateChild(c).updateChild(d,u):h=o.getNode().getImmediateChild(c)}else h=ji(i,c,e.serverCache);h!=null?a=n.filter.updateChild(o.getNode(),c,h,d,s,r):a=o.getNode()}}return mt(e,a,o.isFullyInitialized()||y(t),n.filter.filtersNodes())}}function mn(n,e,t,i,s,r,o,a){const l=e.serverCache;let c;const d=o?n.filter:n.filter.getIndexedFilter();if(y(t))c=d.updateFullNode(l.getNode(),i,null);else if(d.filtersNodes()&&!l.isFiltered()){const p=l.getNode().updateChild(t,i);c=d.updateFullNode(l.getNode(),p,null)}else{const p=E(t);if(!l.isCompleteForPath(t)&&ye(t)>1)return e;const _=S(t),R=l.getNode().getImmediateChild(p).updateChild(_,i);p===".priority"?c=d.updatePriority(l.getNode(),R):c=d.updateChild(l.getNode(),p,R,_,ca,null)}const h=ia(e,c,l.isFullyInitialized()||y(t),d.filtersNodes()),u=new zi(s,h,r);return ha(n,h,t,s,u,a)}function di(n,e,t,i,s,r,o){const a=e.eventCache;let l,c;const d=new zi(s,e,r);if(y(t))c=n.filter.updateFullNode(e.eventCache.getNode(),i,o),l=mt(e,c,!0,n.filter.filtersNodes());else{const h=E(t);if(h===".priority")c=n.filter.updatePriority(e.eventCache.getNode(),i),l=mt(e,c,a.isFullyInitialized(),a.isFiltered());else{const u=S(t),p=a.getNode().getImmediateChild(h);let _;if(y(u))_=i;else{const C=d.getCompleteChild(h);C!=null?Go(u)===".priority"&&C.getChild(zo(u)).isEmpty()?_=C:_=C.updateChild(u,i):_=m.EMPTY_NODE}if(p.equals(_))l=e;else{const C=n.filter.updateChild(a.getNode(),h,_,u,d,o);l=mt(e,C,a.isFullyInitialized(),n.filter.filtersNodes())}}}return l}function ur(n,e){return n.eventCache.isCompleteForChild(e)}function Df(n,e,t,i,s,r,o){let a=e;return i.foreach((l,c)=>{const d=N(t,l);ur(e,E(d))&&(a=di(n,a,d,c,s,r,o))}),i.foreach((l,c)=>{const d=N(t,l);ur(e,E(d))||(a=di(n,a,d,c,s,r,o))}),a}function dr(n,e,t){return t.foreach((i,s)=>{e=e.updateChild(i,s)}),e}function fi(n,e,t,i,s,r,o,a){if(e.serverCache.getNode().isEmpty()&&!e.serverCache.isFullyInitialized())return e;let l=e,c;y(t)?c=i:c=new b(null).setTree(t,i);const d=e.serverCache.getNode();return c.children.inorderTraversal((h,u)=>{if(d.hasChild(h)){const p=e.serverCache.getNode().getImmediateChild(h),_=dr(n,p,u);l=mn(n,l,new T(h),_,s,r,o,a)}}),c.children.inorderTraversal((h,u)=>{const p=!e.serverCache.isCompleteForChild(h)&&u.value===null;if(!d.hasChild(h)&&!p){const _=e.serverCache.getNode().getImmediateChild(h),C=dr(n,_,u);l=mn(n,l,new T(h),C,s,r,o,a)}}),l}function Mf(n,e,t,i,s,r,o){if(gn(s,t)!=null)return e;const a=e.serverCache.isFiltered(),l=e.serverCache;if(i.value!=null){if(y(t)&&l.isFullyInitialized()||l.isCompleteForPath(t))return mn(n,e,t,l.getNode().getChild(t),s,r,a,o);if(y(t)){let c=new b(null);return l.getNode().forEachChild(ze,(d,h)=>{c=c.set(new T(d),h)}),fi(n,e,t,c,s,r,a,o)}else return e}else{let c=new b(null);return i.foreach((d,h)=>{const u=N(t,d);l.isCompleteForPath(u)&&(c=c.set(d,l.getNode().getChild(u)))}),fi(n,e,t,c,s,r,a,o)}}function Lf(n,e,t,i,s){const r=e.serverCache,o=ia(e,r.getNode(),r.isFullyInitialized()||y(t),r.isFiltered());return ha(n,o,t,i,ca,s)}function xf(n,e,t,i,s,r){let o;if(gn(i,t)!=null)return e;{const a=new zi(i,e,s),l=e.eventCache.getNode();let c;if(y(t)||E(t)===".priority"){let d;if(e.serverCache.isFullyInitialized())d=_n(i,De(e));else{const h=e.serverCache.getNode();f(h instanceof m,"serverChildren would be complete if leaf node"),d=Gi(i,h)}d=d,c=n.filter.updateFullNode(l,d,r)}else{const d=E(t);let h=ji(i,d,e.serverCache);h==null&&e.serverCache.isCompleteForChild(d)&&(h=l.getImmediateChild(d)),h!=null?c=n.filter.updateChild(l,d,h,S(t),a,r):e.eventCache.getNode().hasChild(d)?c=n.filter.updateChild(l,d,m.EMPTY_NODE,S(t),a,r):c=l,c.isEmpty()&&e.serverCache.isFullyInitialized()&&(o=_n(i,De(e)),o.isLeafNode()&&(c=n.filter.updateFullNode(c,o,r)))}return o=e.serverCache.isFullyInitialized()||gn(i,I())!=null,mt(e,c,o,n.filter.filtersNodes())}}/**
2554
2554
  * @license
2555
2555
  * Copyright 2017 Google LLC
2556
2556
  *
@@ -2565,7 +2565,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const e of t
2565
2565
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2566
2566
  * See the License for the specific language governing permissions and
2567
2567
  * limitations under the License.
2568
- */class xf{constructor(e,t){this.query_=e,this.eventRegistrations_=[];const i=this.query_._queryParams,s=new Bi(i.getIndex()),r=ef(i);this.processor_=Af(r);const o=t.serverCache,a=t.eventCache,l=s.updateFullNode(m.EMPTY_NODE,o.getNode(),null),c=r.updateFullNode(m.EMPTY_NODE,a.getNode(),null),d=new Ee(l,o.isFullyInitialized(),s.filtersNodes()),h=new Ee(c,a.isFullyInitialized(),r.filtersNodes());this.viewCache_=bn(h,d),this.eventGenerator_=new lf(this.query_)}get query(){return this.query_}}function Ff(n){return n.viewCache_.serverCache.getNode()}function Uf(n){return pn(n.viewCache_)}function Wf(n,e){const t=Me(n.viewCache_);return t&&(n.query._queryParams.loadsAllData()||!y(e)&&!t.getImmediateChild(E(e)).isEmpty())?t.getChild(e):null}function fr(n){return n.eventRegistrations_.length===0}function Bf(n,e){n.eventRegistrations_.push(e)}function pr(n,e,t){const i=[];if(t){f(e==null,"A cancel should cancel all event registrations.");const s=n.query._path;n.eventRegistrations_.forEach(r=>{const o=r.createCancelEvent(t,s);o&&i.push(o)})}if(e){let s=[];for(let r=0;r<n.eventRegistrations_.length;++r){const o=n.eventRegistrations_[r];if(!o.matches(e))s.push(o);else if(e.hasAnyCallback()){s=s.concat(n.eventRegistrations_.slice(r+1));break}}n.eventRegistrations_=s}else n.eventRegistrations_=[];return i}function _r(n,e,t,i){e.type===K.MERGE&&e.source.queryId!==null&&(f(Me(n.viewCache_),"We should always have a full cache before handling merges"),f(pn(n.viewCache_),"Missing event cache, even though we have a server cache"));const s=n.viewCache_,r=Nf(n.processor_,s,e,t,i);return kf(n.processor_,r.viewCache),f(r.viewCache.serverCache.isFullyInitialized()||!s.serverCache.isFullyInitialized(),"Once a server snap is complete, it should never go back"),n.viewCache_=r.viewCache,ua(n,r.changes,r.viewCache.eventCache.getNode(),null)}function Hf(n,e){const t=n.viewCache_.eventCache,i=[];return t.getNode().isLeafNode()||t.getNode().forEachChild(A,(r,o)=>{i.push(Je(r,o))}),t.isFullyInitialized()&&i.push(ea(t.getNode())),ua(n,i,t.getNode(),e)}function ua(n,e,t,i){const s=i?[i]:n.eventRegistrations_;return cf(n.eventGenerator_,e,t,s)}/**
2568
+ */class Ff{constructor(e,t){this.query_=e,this.eventRegistrations_=[];const i=this.query_._queryParams,s=new Bi(i.getIndex()),r=tf(i);this.processor_=Af(r);const o=t.serverCache,a=t.eventCache,l=s.updateFullNode(m.EMPTY_NODE,o.getNode(),null),c=r.updateFullNode(m.EMPTY_NODE,a.getNode(),null),d=new Ee(l,o.isFullyInitialized(),s.filtersNodes()),h=new Ee(c,a.isFullyInitialized(),r.filtersNodes());this.viewCache_=bn(h,d),this.eventGenerator_=new cf(this.query_)}get query(){return this.query_}}function Uf(n){return n.viewCache_.serverCache.getNode()}function Wf(n){return pn(n.viewCache_)}function Bf(n,e){const t=De(n.viewCache_);return t&&(n.query._queryParams.loadsAllData()||!y(e)&&!t.getImmediateChild(E(e)).isEmpty())?t.getChild(e):null}function fr(n){return n.eventRegistrations_.length===0}function Hf(n,e){n.eventRegistrations_.push(e)}function pr(n,e,t){const i=[];if(t){f(e==null,"A cancel should cancel all event registrations.");const s=n.query._path;n.eventRegistrations_.forEach(r=>{const o=r.createCancelEvent(t,s);o&&i.push(o)})}if(e){let s=[];for(let r=0;r<n.eventRegistrations_.length;++r){const o=n.eventRegistrations_[r];if(!o.matches(e))s.push(o);else if(e.hasAnyCallback()){s=s.concat(n.eventRegistrations_.slice(r+1));break}}n.eventRegistrations_=s}else n.eventRegistrations_=[];return i}function _r(n,e,t,i){e.type===K.MERGE&&e.source.queryId!==null&&(f(De(n.viewCache_),"We should always have a full cache before handling merges"),f(pn(n.viewCache_),"Missing event cache, even though we have a server cache"));const s=n.viewCache_,r=Pf(n.processor_,s,e,t,i);return Nf(n.processor_,r.viewCache),f(r.viewCache.serverCache.isFullyInitialized()||!s.serverCache.isFullyInitialized(),"Once a server snap is complete, it should never go back"),n.viewCache_=r.viewCache,ua(n,r.changes,r.viewCache.eventCache.getNode(),null)}function Vf(n,e){const t=n.viewCache_.eventCache,i=[];return t.getNode().isLeafNode()||t.getNode().forEachChild(k,(r,o)=>{i.push(Je(r,o))}),t.isFullyInitialized()&&i.push(ea(t.getNode())),ua(n,i,t.getNode(),e)}function ua(n,e,t,i){const s=i?[i]:n.eventRegistrations_;return hf(n.eventGenerator_,e,t,s)}/**
2569
2569
  * @license
2570
2570
  * Copyright 2017 Google LLC
2571
2571
  *
@@ -2580,7 +2580,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const e of t
2580
2580
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2581
2581
  * See the License for the specific language governing permissions and
2582
2582
  * limitations under the License.
2583
- */let vn;class da{constructor(){this.views=new Map}}function Vf(n){f(!vn,"__referenceConstructor has already been defined"),vn=n}function $f(){return f(vn,"Reference.ts has not been loaded"),vn}function Gf(n){return n.views.size===0}function qi(n,e,t,i){const s=e.source.queryId;if(s!==null){const r=n.views.get(s);return f(r!=null,"SyncTree gave us an op for an invalid query."),_r(r,e,t,i)}else{let r=[];for(const o of n.views.values())r=r.concat(_r(o,e,t,i));return r}}function fa(n,e,t,i,s){const r=e._queryIdentifier,o=n.views.get(r);if(!o){let a=_n(t,s?i:null),l=!1;a?l=!0:i instanceof m?(a=Gi(t,i),l=!1):(a=m.EMPTY_NODE,l=!1);const c=bn(new Ee(a,l,!1),new Ee(i,s,!1));return new xf(e,c)}return o}function jf(n,e,t,i,s,r){const o=fa(n,e,i,s,r);return n.views.has(e._queryIdentifier)||n.views.set(e._queryIdentifier,o),Bf(o,t),Hf(o,t)}function zf(n,e,t,i){const s=e._queryIdentifier,r=[];let o=[];const a=Ie(n);if(s==="default")for(const[l,c]of n.views.entries())o=o.concat(pr(c,t,i)),fr(c)&&(n.views.delete(l),c.query._queryParams.loadsAllData()||r.push(c.query));else{const l=n.views.get(s);l&&(o=o.concat(pr(l,t,i)),fr(l)&&(n.views.delete(s),l.query._queryParams.loadsAllData()||r.push(l.query)))}return a&&!Ie(n)&&r.push(new($f())(e._repo,e._path)),{removed:r,events:o}}function pa(n){const e=[];for(const t of n.views.values())t.query._queryParams.loadsAllData()||e.push(t);return e}function ve(n,e){let t=null;for(const i of n.views.values())t=t||Wf(i,e);return t}function _a(n,e){if(e._queryParams.loadsAllData())return An(n);{const i=e._queryIdentifier;return n.views.get(i)}}function ga(n,e){return _a(n,e)!=null}function Ie(n){return An(n)!=null}function An(n){for(const e of n.views.values())if(e.query._queryParams.loadsAllData())return e;return null}/**
2583
+ */let vn;class da{constructor(){this.views=new Map}}function $f(n){f(!vn,"__referenceConstructor has already been defined"),vn=n}function Gf(){return f(vn,"Reference.ts has not been loaded"),vn}function jf(n){return n.views.size===0}function qi(n,e,t,i){const s=e.source.queryId;if(s!==null){const r=n.views.get(s);return f(r!=null,"SyncTree gave us an op for an invalid query."),_r(r,e,t,i)}else{let r=[];for(const o of n.views.values())r=r.concat(_r(o,e,t,i));return r}}function fa(n,e,t,i,s){const r=e._queryIdentifier,o=n.views.get(r);if(!o){let a=_n(t,s?i:null),l=!1;a?l=!0:i instanceof m?(a=Gi(t,i),l=!1):(a=m.EMPTY_NODE,l=!1);const c=bn(new Ee(a,l,!1),new Ee(i,s,!1));return new Ff(e,c)}return o}function zf(n,e,t,i,s,r){const o=fa(n,e,i,s,r);return n.views.has(e._queryIdentifier)||n.views.set(e._queryIdentifier,o),Hf(o,t),Vf(o,t)}function qf(n,e,t,i){const s=e._queryIdentifier,r=[];let o=[];const a=Ie(n);if(s==="default")for(const[l,c]of n.views.entries())o=o.concat(pr(c,t,i)),fr(c)&&(n.views.delete(l),c.query._queryParams.loadsAllData()||r.push(c.query));else{const l=n.views.get(s);l&&(o=o.concat(pr(l,t,i)),fr(l)&&(n.views.delete(s),l.query._queryParams.loadsAllData()||r.push(l.query)))}return a&&!Ie(n)&&r.push(new(Gf())(e._repo,e._path)),{removed:r,events:o}}function pa(n){const e=[];for(const t of n.views.values())t.query._queryParams.loadsAllData()||e.push(t);return e}function ve(n,e){let t=null;for(const i of n.views.values())t=t||Bf(i,e);return t}function _a(n,e){if(e._queryParams.loadsAllData())return kn(n);{const i=e._queryIdentifier;return n.views.get(i)}}function ga(n,e){return _a(n,e)!=null}function Ie(n){return kn(n)!=null}function kn(n){for(const e of n.views.values())if(e.query._queryParams.loadsAllData())return e;return null}/**
2584
2584
  * @license
2585
2585
  * Copyright 2017 Google LLC
2586
2586
  *
@@ -2595,7 +2595,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const e of t
2595
2595
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2596
2596
  * See the License for the specific language governing permissions and
2597
2597
  * limitations under the License.
2598
- */let yn;function qf(n){f(!yn,"__referenceConstructor has already been defined"),yn=n}function Kf(){return f(yn,"Reference.ts has not been loaded"),yn}let Yf=1;class gr{constructor(e){this.listenProvider_=e,this.syncPointTree_=new b(null),this.pendingWriteTree_=Tf(),this.tagToQueryMap=new Map,this.queryToTagMap=new Map}}function Qf(n,e,t,i,s){return ff(n.pendingWriteTree_,e,t,i,s),s?Ht(n,new De(na(),e,t)):[]}function He(n,e,t=!1){const i=pf(n.pendingWriteTree_,e);if(_f(n.pendingWriteTree_,e)){let r=new b(null);return i.snap!=null?r=r.set(I(),!0):W(i.children,o=>{r=r.set(new T(o),!0)}),Ht(n,new fn(i.path,r,t))}else return[]}function Bt(n,e,t){return Ht(n,new De(Vi(),e,t))}function Jf(n,e,t){const i=b.fromObject(t);return Ht(n,new kt(Vi(),e,i))}function Xf(n,e){return Ht(n,new At(Vi(),e))}function Zf(n,e,t){const i=Ki(n,t);if(i){const s=Yi(i),r=s.path,o=s.queryId,a=L(r,e),l=new At($i(o),a);return Qi(n,r,l)}else return[]}function ma(n,e,t,i,s=!1){const r=e._path,o=n.syncPointTree_.get(r);let a=[];if(o&&(e._queryIdentifier==="default"||ga(o,e))){const l=zf(o,e,t,i);Gf(o)&&(n.syncPointTree_=n.syncPointTree_.remove(r));const c=l.removed;if(a=l.events,!s){const d=c.findIndex(u=>u._queryParams.loadsAllData())!==-1,h=n.syncPointTree_.findOnPath(r,(u,p)=>Ie(p));if(d&&!h){const u=n.syncPointTree_.subtree(r);if(!u.isEmpty()){const p=ip(u);for(let _=0;_<p.length;++_){const C=p[_],R=C.query,H=Ca(n,C);n.listenProvider_.startListening(yt(R),Nt(n,R),H.hashFn,H.onComplete)}}}!h&&c.length>0&&!i&&(d?n.listenProvider_.stopListening(yt(e),null):c.forEach(u=>{const p=n.queryToTagMap.get(kn(u));n.listenProvider_.stopListening(yt(u),p)}))}sp(n,c)}return a}function va(n,e,t,i){const s=Ki(n,i);if(s!=null){const r=Yi(s),o=r.path,a=r.queryId,l=L(o,e),c=new De($i(a),l,t);return Qi(n,o,c)}else return[]}function ep(n,e,t,i){const s=Ki(n,i);if(s){const r=Yi(s),o=r.path,a=r.queryId,l=L(o,e),c=b.fromObject(t),d=new kt($i(a),l,c);return Qi(n,o,d)}else return[]}function tp(n,e,t,i=!1){const s=e._path;let r=null,o=!1;n.syncPointTree_.foreachOnPath(s,(u,p)=>{const _=L(u,s);r=r||ve(p,_),o=o||Ie(p)});let a=n.syncPointTree_.get(s);a?(o=o||Ie(a),r=r||ve(a,I())):(a=new da,n.syncPointTree_=n.syncPointTree_.set(s,a));let l;r!=null?l=!0:(l=!1,r=m.EMPTY_NODE,n.syncPointTree_.subtree(s).foreachChild((p,_)=>{const C=ve(_,I());C&&(r=r.updateImmediateChild(p,C))}));const c=ga(a,e);if(!c&&!e._queryParams.loadsAllData()){const u=kn(e);f(!n.queryToTagMap.has(u),"View does not exist, but we have a tag");const p=rp();n.queryToTagMap.set(u,p),n.tagToQueryMap.set(p,u)}const d=Rn(n.pendingWriteTree_,s);let h=jf(a,e,t,d,r,l);if(!c&&!o&&!i){const u=_a(a,e);h=h.concat(op(n,e,u))}return h}function ya(n,e,t){const s=n.pendingWriteTree_,r=n.syncPointTree_.findOnPath(e,(o,a)=>{const l=L(o,e),c=ve(a,l);if(c)return c});return oa(s,e,r,t,!0)}function np(n,e){const t=e._path;let i=null;n.syncPointTree_.foreachOnPath(t,(c,d)=>{const h=L(c,t);i=i||ve(d,h)});let s=n.syncPointTree_.get(t);s?i=i||ve(s,I()):(s=new da,n.syncPointTree_=n.syncPointTree_.set(t,s));const r=i!=null,o=r?new Ee(i,!0,!1):null,a=Rn(n.pendingWriteTree_,e._path),l=fa(s,e,a,r?o.getNode():m.EMPTY_NODE,r);return Uf(l)}function Ht(n,e){return Ea(e,n.syncPointTree_,null,Rn(n.pendingWriteTree_,I()))}function Ea(n,e,t,i){if(y(n.path))return Ia(n,e,t,i);{const s=e.get(I());t==null&&s!=null&&(t=ve(s,I()));let r=[];const o=E(n.path),a=n.operationForChild(o),l=e.children.get(o);if(l&&a){const c=t?t.getImmediateChild(o):null,d=aa(i,o);r=r.concat(Ea(a,l,c,d))}return s&&(r=r.concat(qi(s,n,i,t))),r}}function Ia(n,e,t,i){const s=e.get(I());t==null&&s!=null&&(t=ve(s,I()));let r=[];return e.children.inorderTraversal((o,a)=>{const l=t?t.getImmediateChild(o):null,c=aa(i,o),d=n.operationForChild(o);d&&(r=r.concat(Ia(d,a,l,c)))}),s&&(r=r.concat(qi(s,n,i,t))),r}function Ca(n,e){const t=e.query,i=Nt(n,t);return{hashFn:()=>(Ff(e)||m.EMPTY_NODE).hash(),onComplete:s=>{if(s==="ok")return i?Zf(n,t._path,i):Xf(n,t._path);{const r=Zu(s,t);return ma(n,t,null,r)}}}}function Nt(n,e){const t=kn(e);return n.queryToTagMap.get(t)}function kn(n){return n._path.toString()+"$"+n._queryIdentifier}function Ki(n,e){return n.tagToQueryMap.get(e)}function Yi(n){const e=n.indexOf("$");return f(e!==-1&&e<n.length-1,"Bad queryKey."),{queryId:n.substr(e+1),path:new T(n.substr(0,e))}}function Qi(n,e,t){const i=n.syncPointTree_.get(e);f(i,"Missing sync point for query tag that we're tracking");const s=Rn(n.pendingWriteTree_,e);return qi(i,t,s,null)}function ip(n){return n.fold((e,t,i)=>{if(t&&Ie(t))return[An(t)];{let s=[];return t&&(s=pa(t)),W(i,(r,o)=>{s=s.concat(o)}),s}})}function yt(n){return n._queryParams.loadsAllData()&&!n._queryParams.isDefault()?new(Kf())(n._repo,n._path):n}function sp(n,e){for(let t=0;t<e.length;++t){const i=e[t];if(!i._queryParams.loadsAllData()){const s=kn(i),r=n.queryToTagMap.get(s);n.queryToTagMap.delete(s),n.tagToQueryMap.delete(r)}}}function rp(){return Yf++}function op(n,e,t){const i=e._path,s=Nt(n,e),r=Ca(n,t),o=n.listenProvider_.startListening(yt(e),s,r.hashFn,r.onComplete),a=n.syncPointTree_.subtree(i);if(s)f(!Ie(a.value),"If we're adding a query, it shouldn't be shadowed");else{const l=a.fold((c,d,h)=>{if(!y(c)&&d&&Ie(d))return[An(d).query];{let u=[];return d&&(u=u.concat(pa(d).map(p=>p.query))),W(h,(p,_)=>{u=u.concat(_)}),u}});for(let c=0;c<l.length;++c){const d=l[c];n.listenProvider_.stopListening(yt(d),Nt(n,d))}}return o}/**
2598
+ */let yn;function Kf(n){f(!yn,"__referenceConstructor has already been defined"),yn=n}function Yf(){return f(yn,"Reference.ts has not been loaded"),yn}let Qf=1;class gr{constructor(e){this.listenProvider_=e,this.syncPointTree_=new b(null),this.pendingWriteTree_=Sf(),this.tagToQueryMap=new Map,this.queryToTagMap=new Map}}function Jf(n,e,t,i,s){return pf(n.pendingWriteTree_,e,t,i,s),s?Ht(n,new Oe(na(),e,t)):[]}function Be(n,e,t=!1){const i=_f(n.pendingWriteTree_,e);if(gf(n.pendingWriteTree_,e)){let r=new b(null);return i.snap!=null?r=r.set(I(),!0):W(i.children,o=>{r=r.set(new T(o),!0)}),Ht(n,new fn(i.path,r,t))}else return[]}function Bt(n,e,t){return Ht(n,new Oe(Vi(),e,t))}function Xf(n,e,t){const i=b.fromObject(t);return Ht(n,new At(Vi(),e,i))}function Zf(n,e){return Ht(n,new kt(Vi(),e))}function ep(n,e,t){const i=Ki(n,t);if(i){const s=Yi(i),r=s.path,o=s.queryId,a=L(r,e),l=new kt($i(o),a);return Qi(n,r,l)}else return[]}function ma(n,e,t,i,s=!1){const r=e._path,o=n.syncPointTree_.get(r);let a=[];if(o&&(e._queryIdentifier==="default"||ga(o,e))){const l=qf(o,e,t,i);jf(o)&&(n.syncPointTree_=n.syncPointTree_.remove(r));const c=l.removed;if(a=l.events,!s){const d=c.findIndex(u=>u._queryParams.loadsAllData())!==-1,h=n.syncPointTree_.findOnPath(r,(u,p)=>Ie(p));if(d&&!h){const u=n.syncPointTree_.subtree(r);if(!u.isEmpty()){const p=sp(u);for(let _=0;_<p.length;++_){const C=p[_],R=C.query,H=Ca(n,C);n.listenProvider_.startListening(yt(R),Nt(n,R),H.hashFn,H.onComplete)}}}!h&&c.length>0&&!i&&(d?n.listenProvider_.stopListening(yt(e),null):c.forEach(u=>{const p=n.queryToTagMap.get(An(u));n.listenProvider_.stopListening(yt(u),p)}))}rp(n,c)}return a}function va(n,e,t,i){const s=Ki(n,i);if(s!=null){const r=Yi(s),o=r.path,a=r.queryId,l=L(o,e),c=new Oe($i(a),l,t);return Qi(n,o,c)}else return[]}function tp(n,e,t,i){const s=Ki(n,i);if(s){const r=Yi(s),o=r.path,a=r.queryId,l=L(o,e),c=b.fromObject(t),d=new At($i(a),l,c);return Qi(n,o,d)}else return[]}function np(n,e,t,i=!1){const s=e._path;let r=null,o=!1;n.syncPointTree_.foreachOnPath(s,(u,p)=>{const _=L(u,s);r=r||ve(p,_),o=o||Ie(p)});let a=n.syncPointTree_.get(s);a?(o=o||Ie(a),r=r||ve(a,I())):(a=new da,n.syncPointTree_=n.syncPointTree_.set(s,a));let l;r!=null?l=!0:(l=!1,r=m.EMPTY_NODE,n.syncPointTree_.subtree(s).foreachChild((p,_)=>{const C=ve(_,I());C&&(r=r.updateImmediateChild(p,C))}));const c=ga(a,e);if(!c&&!e._queryParams.loadsAllData()){const u=An(e);f(!n.queryToTagMap.has(u),"View does not exist, but we have a tag");const p=op();n.queryToTagMap.set(u,p),n.tagToQueryMap.set(p,u)}const d=Rn(n.pendingWriteTree_,s);let h=zf(a,e,t,d,r,l);if(!c&&!o&&!i){const u=_a(a,e);h=h.concat(ap(n,e,u))}return h}function ya(n,e,t){const s=n.pendingWriteTree_,r=n.syncPointTree_.findOnPath(e,(o,a)=>{const l=L(o,e),c=ve(a,l);if(c)return c});return oa(s,e,r,t,!0)}function ip(n,e){const t=e._path;let i=null;n.syncPointTree_.foreachOnPath(t,(c,d)=>{const h=L(c,t);i=i||ve(d,h)});let s=n.syncPointTree_.get(t);s?i=i||ve(s,I()):(s=new da,n.syncPointTree_=n.syncPointTree_.set(t,s));const r=i!=null,o=r?new Ee(i,!0,!1):null,a=Rn(n.pendingWriteTree_,e._path),l=fa(s,e,a,r?o.getNode():m.EMPTY_NODE,r);return Wf(l)}function Ht(n,e){return Ea(e,n.syncPointTree_,null,Rn(n.pendingWriteTree_,I()))}function Ea(n,e,t,i){if(y(n.path))return Ia(n,e,t,i);{const s=e.get(I());t==null&&s!=null&&(t=ve(s,I()));let r=[];const o=E(n.path),a=n.operationForChild(o),l=e.children.get(o);if(l&&a){const c=t?t.getImmediateChild(o):null,d=aa(i,o);r=r.concat(Ea(a,l,c,d))}return s&&(r=r.concat(qi(s,n,i,t))),r}}function Ia(n,e,t,i){const s=e.get(I());t==null&&s!=null&&(t=ve(s,I()));let r=[];return e.children.inorderTraversal((o,a)=>{const l=t?t.getImmediateChild(o):null,c=aa(i,o),d=n.operationForChild(o);d&&(r=r.concat(Ia(d,a,l,c)))}),s&&(r=r.concat(qi(s,n,i,t))),r}function Ca(n,e){const t=e.query,i=Nt(n,t);return{hashFn:()=>(Uf(e)||m.EMPTY_NODE).hash(),onComplete:s=>{if(s==="ok")return i?ep(n,t._path,i):Zf(n,t._path);{const r=ed(s,t);return ma(n,t,null,r)}}}}function Nt(n,e){const t=An(e);return n.queryToTagMap.get(t)}function An(n){return n._path.toString()+"$"+n._queryIdentifier}function Ki(n,e){return n.tagToQueryMap.get(e)}function Yi(n){const e=n.indexOf("$");return f(e!==-1&&e<n.length-1,"Bad queryKey."),{queryId:n.substr(e+1),path:new T(n.substr(0,e))}}function Qi(n,e,t){const i=n.syncPointTree_.get(e);f(i,"Missing sync point for query tag that we're tracking");const s=Rn(n.pendingWriteTree_,e);return qi(i,t,s,null)}function sp(n){return n.fold((e,t,i)=>{if(t&&Ie(t))return[kn(t)];{let s=[];return t&&(s=pa(t)),W(i,(r,o)=>{s=s.concat(o)}),s}})}function yt(n){return n._queryParams.loadsAllData()&&!n._queryParams.isDefault()?new(Yf())(n._repo,n._path):n}function rp(n,e){for(let t=0;t<e.length;++t){const i=e[t];if(!i._queryParams.loadsAllData()){const s=An(i),r=n.queryToTagMap.get(s);n.queryToTagMap.delete(s),n.tagToQueryMap.delete(r)}}}function op(){return Qf++}function ap(n,e,t){const i=e._path,s=Nt(n,e),r=Ca(n,t),o=n.listenProvider_.startListening(yt(e),s,r.hashFn,r.onComplete),a=n.syncPointTree_.subtree(i);if(s)f(!Ie(a.value),"If we're adding a query, it shouldn't be shadowed");else{const l=a.fold((c,d,h)=>{if(!y(c)&&d&&Ie(d))return[kn(d).query];{let u=[];return d&&(u=u.concat(pa(d).map(p=>p.query))),W(h,(p,_)=>{u=u.concat(_)}),u}});for(let c=0;c<l.length;++c){const d=l[c];n.listenProvider_.stopListening(yt(d),Nt(n,d))}}return o}/**
2599
2599
  * @license
2600
2600
  * Copyright 2017 Google LLC
2601
2601
  *
@@ -2610,7 +2610,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const e of t
2610
2610
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2611
2611
  * See the License for the specific language governing permissions and
2612
2612
  * limitations under the License.
2613
- */class Ji{constructor(e){this.node_=e}getImmediateChild(e){const t=this.node_.getImmediateChild(e);return new Ji(t)}node(){return this.node_}}class Xi{constructor(e,t){this.syncTree_=e,this.path_=t}getImmediateChild(e){const t=N(this.path_,e);return new Xi(this.syncTree_,t)}node(){return ya(this.syncTree_,this.path_)}}const ap=function(n){return n=n||{},n.timestamp=n.timestamp||new Date().getTime(),n},mr=function(n,e,t){if(!n||typeof n!="object")return n;if(f(".sv"in n,"Unexpected leaf node or priority contents"),typeof n[".sv"]=="string")return lp(n[".sv"],e,t);if(typeof n[".sv"]=="object")return cp(n[".sv"],e);f(!1,"Unexpected server value: "+JSON.stringify(n,null,2))},lp=function(n,e,t){switch(n){case"timestamp":return t.timestamp;default:f(!1,"Unexpected server value: "+n)}},cp=function(n,e,t){n.hasOwnProperty("increment")||f(!1,"Unexpected server value: "+JSON.stringify(n,null,2));const i=n.increment;typeof i!="number"&&f(!1,"Unexpected increment value: "+i);const s=e.node();if(f(s!==null&&typeof s<"u","Expected ChildrenNode.EMPTY_NODE for nulls"),!s.isLeafNode())return i;const o=s.getValue();return typeof o!="number"?i:o+i},hp=function(n,e,t,i){return Zi(e,new Xi(t,n),i)},up=function(n,e,t){return Zi(n,new Ji(e),t)};function Zi(n,e,t){const i=n.getPriority().val(),s=mr(i,e.getImmediateChild(".priority"),t);let r;if(n.isLeafNode()){const o=n,a=mr(o.getValue(),e,t);return a!==o.getValue()||s!==o.getPriority().val()?new P(a,D(s)):n}else{const o=n;return r=o,s!==o.getPriority().val()&&(r=r.updatePriority(new P(s))),o.forEachChild(A,(a,l)=>{const c=Zi(l,e.getImmediateChild(a),t);c!==l&&(r=r.updateImmediateChild(a,c))}),r}}/**
2613
+ */class Ji{constructor(e){this.node_=e}getImmediateChild(e){const t=this.node_.getImmediateChild(e);return new Ji(t)}node(){return this.node_}}class Xi{constructor(e,t){this.syncTree_=e,this.path_=t}getImmediateChild(e){const t=N(this.path_,e);return new Xi(this.syncTree_,t)}node(){return ya(this.syncTree_,this.path_)}}const lp=function(n){return n=n||{},n.timestamp=n.timestamp||new Date().getTime(),n},mr=function(n,e,t){if(!n||typeof n!="object")return n;if(f(".sv"in n,"Unexpected leaf node or priority contents"),typeof n[".sv"]=="string")return cp(n[".sv"],e,t);if(typeof n[".sv"]=="object")return hp(n[".sv"],e);f(!1,"Unexpected server value: "+JSON.stringify(n,null,2))},cp=function(n,e,t){switch(n){case"timestamp":return t.timestamp;default:f(!1,"Unexpected server value: "+n)}},hp=function(n,e,t){n.hasOwnProperty("increment")||f(!1,"Unexpected server value: "+JSON.stringify(n,null,2));const i=n.increment;typeof i!="number"&&f(!1,"Unexpected increment value: "+i);const s=e.node();if(f(s!==null&&typeof s<"u","Expected ChildrenNode.EMPTY_NODE for nulls"),!s.isLeafNode())return i;const o=s.getValue();return typeof o!="number"?i:o+i},up=function(n,e,t,i){return Zi(e,new Xi(t,n),i)},dp=function(n,e,t){return Zi(n,new Ji(e),t)};function Zi(n,e,t){const i=n.getPriority().val(),s=mr(i,e.getImmediateChild(".priority"),t);let r;if(n.isLeafNode()){const o=n,a=mr(o.getValue(),e,t);return a!==o.getValue()||s!==o.getPriority().val()?new P(a,D(s)):n}else{const o=n;return r=o,s!==o.getPriority().val()&&(r=r.updatePriority(new P(s))),o.forEachChild(k,(a,l)=>{const c=Zi(l,e.getImmediateChild(a),t);c!==l&&(r=r.updateImmediateChild(a,c))}),r}}/**
2614
2614
  * @license
2615
2615
  * Copyright 2017 Google LLC
2616
2616
  *
@@ -2625,7 +2625,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const e of t
2625
2625
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2626
2626
  * See the License for the specific language governing permissions and
2627
2627
  * limitations under the License.
2628
- */class es{constructor(e="",t=null,i={children:{},childCount:0}){this.name=e,this.parent=t,this.node=i}}function ts(n,e){let t=e instanceof T?e:new T(e),i=n,s=E(t);for(;s!==null;){const r=qe(i.node.children,s)||{children:{},childCount:0};i=new es(s,i,r),t=S(t),s=E(t)}return i}function ot(n){return n.node.value}function wa(n,e){n.node.value=e,pi(n)}function Ta(n){return n.node.childCount>0}function dp(n){return ot(n)===void 0&&!Ta(n)}function Nn(n,e){W(n.node.children,(t,i)=>{e(new es(t,n,i))})}function Sa(n,e,t,i){t&&e(n),Nn(n,s=>{Sa(s,e,!0)})}function fp(n,e,t){let i=n.parent;for(;i!==null;){if(e(i))return!0;i=i.parent}return!1}function Vt(n){return new T(n.parent===null?n.name:Vt(n.parent)+"/"+n.name)}function pi(n){n.parent!==null&&pp(n.parent,n.name,n)}function pp(n,e,t){const i=dp(t),s=oe(n.node.children,e);i&&s?(delete n.node.children[e],n.node.childCount--,pi(n)):!i&&!s&&(n.node.children[e]=t.node,n.node.childCount++,pi(n))}/**
2628
+ */class es{constructor(e="",t=null,i={children:{},childCount:0}){this.name=e,this.parent=t,this.node=i}}function ts(n,e){let t=e instanceof T?e:new T(e),i=n,s=E(t);for(;s!==null;){const r=qe(i.node.children,s)||{children:{},childCount:0};i=new es(s,i,r),t=S(t),s=E(t)}return i}function ot(n){return n.node.value}function wa(n,e){n.node.value=e,pi(n)}function Ta(n){return n.node.childCount>0}function fp(n){return ot(n)===void 0&&!Ta(n)}function Nn(n,e){W(n.node.children,(t,i)=>{e(new es(t,n,i))})}function Sa(n,e,t,i){t&&e(n),Nn(n,s=>{Sa(s,e,!0)})}function pp(n,e,t){let i=n.parent;for(;i!==null;){if(e(i))return!0;i=i.parent}return!1}function Vt(n){return new T(n.parent===null?n.name:Vt(n.parent)+"/"+n.name)}function pi(n){n.parent!==null&&_p(n.parent,n.name,n)}function _p(n,e,t){const i=fp(t),s=oe(n.node.children,e);i&&s?(delete n.node.children[e],n.node.childCount--,pi(n)):!i&&!s&&(n.node.children[e]=t.node,n.node.childCount++,pi(n))}/**
2629
2629
  * @license
2630
2630
  * Copyright 2017 Google LLC
2631
2631
  *
@@ -2640,7 +2640,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const e of t
2640
2640
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2641
2641
  * See the License for the specific language governing permissions and
2642
2642
  * limitations under the License.
2643
- */const _p=/[\[\].#$\/\u0000-\u001F\u007F]/,gp=/[\[\].#$\u0000-\u001F\u007F]/,zn=10*1024*1024,ba=function(n){return typeof n=="string"&&n.length!==0&&!_p.test(n)},Ra=function(n){return typeof n=="string"&&n.length!==0&&!gp.test(n)},mp=function(n){return n&&(n=n.replace(/^\/*\.info(\/|$)/,"/")),Ra(n)},Aa=function(n,e,t){const i=t instanceof T?new Od(t,n):t;if(e===void 0)throw new Error(n+"contains undefined "+be(i));if(typeof e=="function")throw new Error(n+"contains a function "+be(i)+" with contents = "+e.toString());if(wo(e))throw new Error(n+"contains "+e.toString()+" "+be(i));if(typeof e=="string"&&e.length>zn/3&&En(e)>zn)throw new Error(n+"contains a string greater than "+zn+" utf8 bytes "+be(i)+" ('"+e.substring(0,50)+"...')");if(e&&typeof e=="object"){let s=!1,r=!1;if(W(e,(o,a)=>{if(o===".value")s=!0;else if(o!==".priority"&&o!==".sv"&&(r=!0,!ba(o)))throw new Error(n+" contains an invalid key ("+o+") "+be(i)+`. Keys must be non-empty strings and can't contain ".", "#", "$", "/", "[", or "]"`);Dd(i,o),Aa(n,a,i),Md(i)}),s&&r)throw new Error(n+' contains ".value" child '+be(i)+" in addition to actual children.")}},ka=function(n,e,t,i){if(!Ra(t))throw new Error(Or(n,e)+'was an invalid path = "'+t+`". Paths must be non-empty strings and can't contain ".", "#", "$", "[", or "]"`)},vp=function(n,e,t,i){t&&(t=t.replace(/^\/*\.info(\/|$)/,"/")),ka(n,e,t)},yp=function(n,e){const t=e.path.toString();if(typeof e.repoInfo.host!="string"||e.repoInfo.host.length===0||!ba(e.repoInfo.namespace)&&e.repoInfo.host.split(":")[0]!=="localhost"||t.length!==0&&!mp(t))throw new Error(Or(n,"url")+`must be a valid firebase URL and the path can't contain ".", "#", "$", "[", or "]".`)};/**
2643
+ */const gp=/[\[\].#$\/\u0000-\u001F\u007F]/,mp=/[\[\].#$\u0000-\u001F\u007F]/,zn=10*1024*1024,ba=function(n){return typeof n=="string"&&n.length!==0&&!gp.test(n)},Ra=function(n){return typeof n=="string"&&n.length!==0&&!mp.test(n)},vp=function(n){return n&&(n=n.replace(/^\/*\.info(\/|$)/,"/")),Ra(n)},ka=function(n,e,t){const i=t instanceof T?new Dd(t,n):t;if(e===void 0)throw new Error(n+"contains undefined "+be(i));if(typeof e=="function")throw new Error(n+"contains a function "+be(i)+" with contents = "+e.toString());if(wo(e))throw new Error(n+"contains "+e.toString()+" "+be(i));if(typeof e=="string"&&e.length>zn/3&&En(e)>zn)throw new Error(n+"contains a string greater than "+zn+" utf8 bytes "+be(i)+" ('"+e.substring(0,50)+"...')");if(e&&typeof e=="object"){let s=!1,r=!1;if(W(e,(o,a)=>{if(o===".value")s=!0;else if(o!==".priority"&&o!==".sv"&&(r=!0,!ba(o)))throw new Error(n+" contains an invalid key ("+o+") "+be(i)+`. Keys must be non-empty strings and can't contain ".", "#", "$", "/", "[", or "]"`);Md(i,o),ka(n,a,i),Ld(i)}),s&&r)throw new Error(n+' contains ".value" child '+be(i)+" in addition to actual children.")}},Aa=function(n,e,t,i){if(!Ra(t))throw new Error(Or(n,e)+'was an invalid path = "'+t+`". Paths must be non-empty strings and can't contain ".", "#", "$", "[", or "]"`)},yp=function(n,e,t,i){t&&(t=t.replace(/^\/*\.info(\/|$)/,"/")),Aa(n,e,t)},Ep=function(n,e){const t=e.path.toString();if(typeof e.repoInfo.host!="string"||e.repoInfo.host.length===0||!ba(e.repoInfo.namespace)&&e.repoInfo.host.split(":")[0]!=="localhost"||t.length!==0&&!vp(t))throw new Error(Or(n,"url")+`must be a valid firebase URL and the path can't contain ".", "#", "$", "[", or "]".`)};/**
2644
2644
  * @license
2645
2645
  * Copyright 2017 Google LLC
2646
2646
  *
@@ -2655,7 +2655,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const e of t
2655
2655
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2656
2656
  * See the License for the specific language governing permissions and
2657
2657
  * limitations under the License.
2658
- */class Ep{constructor(){this.eventLists_=[],this.recursionDepth_=0}}function Ip(n,e){let t=null;for(let i=0;i<e.length;i++){const s=e[i],r=s.getPath();t!==null&&!qo(r,t.path)&&(n.eventLists_.push(t),t=null),t===null&&(t={events:[],path:r}),t.events.push(s)}t&&n.eventLists_.push(t)}function Te(n,e,t){Ip(n,t),Cp(n,i=>q(i,e)||q(e,i))}function Cp(n,e){n.recursionDepth_++;let t=!0;for(let i=0;i<n.eventLists_.length;i++){const s=n.eventLists_[i];if(s){const r=s.path;e(r)?(wp(n.eventLists_[i]),n.eventLists_[i]=null):t=!1}}t&&(n.eventLists_=[]),n.recursionDepth_--}function wp(n){for(let e=0;e<n.events.length;e++){const t=n.events[e];if(t!==null){n.events[e]=null;const i=t.getEventRunner();_t&&M("event: "+t.toString()),Ut(i)}}}/**
2658
+ */class Ip{constructor(){this.eventLists_=[],this.recursionDepth_=0}}function Cp(n,e){let t=null;for(let i=0;i<e.length;i++){const s=e[i],r=s.getPath();t!==null&&!qo(r,t.path)&&(n.eventLists_.push(t),t=null),t===null&&(t={events:[],path:r}),t.events.push(s)}t&&n.eventLists_.push(t)}function Te(n,e,t){Cp(n,t),wp(n,i=>q(i,e)||q(e,i))}function wp(n,e){n.recursionDepth_++;let t=!0;for(let i=0;i<n.eventLists_.length;i++){const s=n.eventLists_[i];if(s){const r=s.path;e(r)?(Tp(n.eventLists_[i]),n.eventLists_[i]=null):t=!1}}t&&(n.eventLists_=[]),n.recursionDepth_--}function Tp(n){for(let e=0;e<n.events.length;e++){const t=n.events[e];if(t!==null){n.events[e]=null;const i=t.getEventRunner();_t&&M("event: "+t.toString()),Ut(i)}}}/**
2659
2659
  * @license
2660
2660
  * Copyright 2017 Google LLC
2661
2661
  *
@@ -2670,7 +2670,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const e of t
2670
2670
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2671
2671
  * See the License for the specific language governing permissions and
2672
2672
  * limitations under the License.
2673
- */const Tp="repo_interrupt",Sp=25;class bp{constructor(e,t,i,s){this.repoInfo_=e,this.forceRestClient_=t,this.authTokenProvider_=i,this.appCheckProvider_=s,this.dataUpdateCount=0,this.statsListener_=null,this.eventQueue_=new Ep,this.nextWriteId_=1,this.interceptServerDataCallback_=null,this.onDisconnect_=dn(),this.transactionQueueTree_=new es,this.persistentConnection_=null,this.key=this.repoInfo_.toURLString()}toString(){return(this.repoInfo_.secure?"https://":"http://")+this.repoInfo_.host}}function Rp(n,e,t){if(n.stats_=xi(n.repoInfo_),n.forceRestClient_||id())n.server_=new un(n.repoInfo_,(i,s,r,o)=>{vr(n,i,s,r,o)},n.authTokenProvider_,n.appCheckProvider_),setTimeout(()=>yr(n,!0),0);else{if(typeof t<"u"&&t!==null){if(typeof t!="object")throw new Error("Only objects are supported for option databaseAuthVariableOverride");try{k(t)}catch(i){throw new Error("Invalid authOverride provided: "+i)}}n.persistentConnection_=new ne(n.repoInfo_,e,(i,s,r,o)=>{vr(n,i,s,r,o)},i=>{yr(n,i)},i=>{kp(n,i)},n.authTokenProvider_,n.appCheckProvider_,t),n.server_=n.persistentConnection_}n.authTokenProvider_.addTokenChangeListener(i=>{n.server_.refreshAuthToken(i)}),n.appCheckProvider_.addTokenChangeListener(i=>{n.server_.refreshAppCheckToken(i.token)}),n.statsReporter_=ld(n.repoInfo_,()=>new af(n.stats_,n.server_)),n.infoData_=new tf,n.infoSyncTree_=new gr({startListening:(i,s,r,o)=>{let a=[];const l=n.infoData_.getNode(i._path);return l.isEmpty()||(a=Bt(n.infoSyncTree_,i._path,l),setTimeout(()=>{o("ok")},0)),a},stopListening:()=>{}}),ns(n,"connected",!1),n.serverSyncTree_=new gr({startListening:(i,s,r,o)=>(n.server_.listen(i,r,s,(a,l)=>{const c=o(a,l);Te(n.eventQueue_,i._path,c)}),[]),stopListening:(i,s)=>{n.server_.unlisten(i,s)}})}function Ap(n){const t=n.infoData_.getNode(new T(".info/serverTimeOffset")).val()||0;return new Date().getTime()+t}function Na(n){return ap({timestamp:Ap(n)})}function vr(n,e,t,i,s){n.dataUpdateCount++;const r=new T(e);t=n.interceptServerDataCallback_?n.interceptServerDataCallback_(e,t):t;let o=[];if(s)if(i){const l=Zt(t,c=>D(c));o=ep(n.serverSyncTree_,r,l,s)}else{const l=D(t);o=va(n.serverSyncTree_,r,l,s)}else if(i){const l=Zt(t,c=>D(c));o=Jf(n.serverSyncTree_,r,l)}else{const l=D(t);o=Bt(n.serverSyncTree_,r,l)}let a=r;o.length>0&&(a=rs(n,r)),Te(n.eventQueue_,a,o)}function yr(n,e){ns(n,"connected",e),e===!1&&Op(n)}function kp(n,e){W(e,(t,i)=>{ns(n,t,i)})}function ns(n,e,t){const i=new T("/.info/"+e),s=D(t);n.infoData_.updateSnapshot(i,s);const r=Bt(n.infoSyncTree_,i,s);Te(n.eventQueue_,i,r)}function Np(n){return n.nextWriteId_++}function Pp(n,e,t){const i=np(n.serverSyncTree_,e);return i!=null?Promise.resolve(i):n.server_.get(e).then(s=>{const r=D(s).withIndex(e._queryParams.getIndex());tp(n.serverSyncTree_,e,t,!0);let o;if(e._queryParams.loadsAllData())o=Bt(n.serverSyncTree_,e._path,r);else{const a=Nt(n.serverSyncTree_,e);o=va(n.serverSyncTree_,e._path,r,a)}return Te(n.eventQueue_,e._path,o),ma(n.serverSyncTree_,e,t,null,!0),r},s=>(is(n,"get for query "+k(e)+" failed: "+s),Promise.reject(new Error(s))))}function Op(n){is(n,"onDisconnectEvents");const e=Na(n),t=dn();ci(n.onDisconnect_,I(),(s,r)=>{const o=hp(s,r,n.serverSyncTree_,e);ta(t,s,o)});let i=[];ci(t,I(),(s,r)=>{i=i.concat(Bt(n.serverSyncTree_,s,r));const o=xp(n,s);rs(n,o)}),n.onDisconnect_=dn(),Te(n.eventQueue_,I(),i)}function Dp(n){n.persistentConnection_&&n.persistentConnection_.interrupt(Tp)}function is(n,...e){let t="";n.persistentConnection_&&(t=n.persistentConnection_.id+":"),M(t,...e)}function Pa(n,e,t){return ya(n.serverSyncTree_,e,t)||m.EMPTY_NODE}function ss(n,e=n.transactionQueueTree_){if(e||Pn(n,e),ot(e)){const t=Da(n,e);f(t.length>0,"Sending zero length transaction queue"),t.every(s=>s.status===0)&&Mp(n,Vt(e),t)}else Ta(e)&&Nn(e,t=>{ss(n,t)})}function Mp(n,e,t){const i=t.map(c=>c.currentWriteId),s=Pa(n,e,i);let r=s;const o=s.hash();for(let c=0;c<t.length;c++){const d=t[c];f(d.status===0,"tryToSendTransactionQueue_: items in queue should all be run."),d.status=1,d.retryCount++;const h=L(e,d.path);r=r.updateChild(h,d.currentOutputSnapshotRaw)}const a=r.val(!0),l=e;n.server_.put(l.toString(),a,c=>{is(n,"transaction put response",{path:l.toString(),status:c});let d=[];if(c==="ok"){const h=[];for(let u=0;u<t.length;u++)t[u].status=2,d=d.concat(He(n.serverSyncTree_,t[u].currentWriteId)),t[u].onComplete&&h.push(()=>t[u].onComplete(null,!0,t[u].currentOutputSnapshotResolved)),t[u].unwatcher();Pn(n,ts(n.transactionQueueTree_,e)),ss(n,n.transactionQueueTree_),Te(n.eventQueue_,e,d);for(let u=0;u<h.length;u++)Ut(h[u])}else{if(c==="datastale")for(let h=0;h<t.length;h++)t[h].status===3?t[h].status=4:t[h].status=0;else{B("transaction at "+l.toString()+" failed: "+c);for(let h=0;h<t.length;h++)t[h].status=4,t[h].abortReason=c}rs(n,e)}},o)}function rs(n,e){const t=Oa(n,e),i=Vt(t),s=Da(n,t);return Lp(n,s,i),i}function Lp(n,e,t){if(e.length===0)return;const i=[];let s=[];const o=e.filter(a=>a.status===0).map(a=>a.currentWriteId);for(let a=0;a<e.length;a++){const l=e[a],c=L(t,l.path);let d=!1,h;if(f(c!==null,"rerunTransactionsUnderNode_: relativePath should not be null."),l.status===4)d=!0,h=l.abortReason,s=s.concat(He(n.serverSyncTree_,l.currentWriteId,!0));else if(l.status===0)if(l.retryCount>=Sp)d=!0,h="maxretry",s=s.concat(He(n.serverSyncTree_,l.currentWriteId,!0));else{const u=Pa(n,l.path,o);l.currentInputSnapshot=u;const p=e[a].update(u.val());if(p!==void 0){Aa("transaction failed: Data returned ",p,l.path);let _=D(p);typeof p=="object"&&p!=null&&oe(p,".priority")||(_=_.updatePriority(u.getPriority()));const R=l.currentWriteId,H=Na(n),V=up(_,u,H);l.currentOutputSnapshotRaw=_,l.currentOutputSnapshotResolved=V,l.currentWriteId=Np(n),o.splice(o.indexOf(R),1),s=s.concat(Qf(n.serverSyncTree_,l.path,V,l.currentWriteId,l.applyLocally)),s=s.concat(He(n.serverSyncTree_,R,!0))}else d=!0,h="nodata",s=s.concat(He(n.serverSyncTree_,l.currentWriteId,!0))}Te(n.eventQueue_,t,s),s=[],d&&(e[a].status=2,function(u){setTimeout(u,Math.floor(0))}(e[a].unwatcher),e[a].onComplete&&(h==="nodata"?i.push(()=>e[a].onComplete(null,!1,e[a].currentInputSnapshot)):i.push(()=>e[a].onComplete(new Error(h),!1,null))))}Pn(n,n.transactionQueueTree_);for(let a=0;a<i.length;a++)Ut(i[a]);ss(n,n.transactionQueueTree_)}function Oa(n,e){let t,i=n.transactionQueueTree_;for(t=E(e);t!==null&&ot(i)===void 0;)i=ts(i,t),e=S(e),t=E(e);return i}function Da(n,e){const t=[];return Ma(n,e,t),t.sort((i,s)=>i.order-s.order),t}function Ma(n,e,t){const i=ot(e);if(i)for(let s=0;s<i.length;s++)t.push(i[s]);Nn(e,s=>{Ma(n,s,t)})}function Pn(n,e){const t=ot(e);if(t){let i=0;for(let s=0;s<t.length;s++)t[s].status!==2&&(t[i]=t[s],i++);t.length=i,wa(e,t.length>0?t:void 0)}Nn(e,i=>{Pn(n,i)})}function xp(n,e){const t=Vt(Oa(n,e)),i=ts(n.transactionQueueTree_,e);return fp(i,s=>{qn(n,s)}),qn(n,i),Sa(i,s=>{qn(n,s)}),t}function qn(n,e){const t=ot(e);if(t){const i=[];let s=[],r=-1;for(let o=0;o<t.length;o++)t[o].status===3||(t[o].status===1?(f(r===o-1,"All SENT items should be at beginning of queue."),r=o,t[o].status=3,t[o].abortReason="set"):(f(t[o].status===0,"Unexpected transaction status in abort"),t[o].unwatcher(),s=s.concat(He(n.serverSyncTree_,t[o].currentWriteId,!0)),t[o].onComplete&&i.push(t[o].onComplete.bind(null,new Error("set"),!1,null))));r===-1?wa(e,void 0):t.length=r+1,Te(n.eventQueue_,Vt(e),s);for(let o=0;o<i.length;o++)Ut(i[o])}}/**
2673
+ */const Sp="repo_interrupt",bp=25;class Rp{constructor(e,t,i,s){this.repoInfo_=e,this.forceRestClient_=t,this.authTokenProvider_=i,this.appCheckProvider_=s,this.dataUpdateCount=0,this.statsListener_=null,this.eventQueue_=new Ip,this.nextWriteId_=1,this.interceptServerDataCallback_=null,this.onDisconnect_=dn(),this.transactionQueueTree_=new es,this.persistentConnection_=null,this.key=this.repoInfo_.toURLString()}toString(){return(this.repoInfo_.secure?"https://":"http://")+this.repoInfo_.host}}function kp(n,e,t){if(n.stats_=xi(n.repoInfo_),n.forceRestClient_||sd())n.server_=new un(n.repoInfo_,(i,s,r,o)=>{vr(n,i,s,r,o)},n.authTokenProvider_,n.appCheckProvider_),setTimeout(()=>yr(n,!0),0);else{if(typeof t<"u"&&t!==null){if(typeof t!="object")throw new Error("Only objects are supported for option databaseAuthVariableOverride");try{A(t)}catch(i){throw new Error("Invalid authOverride provided: "+i)}}n.persistentConnection_=new ne(n.repoInfo_,e,(i,s,r,o)=>{vr(n,i,s,r,o)},i=>{yr(n,i)},i=>{Np(n,i)},n.authTokenProvider_,n.appCheckProvider_,t),n.server_=n.persistentConnection_}n.authTokenProvider_.addTokenChangeListener(i=>{n.server_.refreshAuthToken(i)}),n.appCheckProvider_.addTokenChangeListener(i=>{n.server_.refreshAppCheckToken(i.token)}),n.statsReporter_=cd(n.repoInfo_,()=>new lf(n.stats_,n.server_)),n.infoData_=new nf,n.infoSyncTree_=new gr({startListening:(i,s,r,o)=>{let a=[];const l=n.infoData_.getNode(i._path);return l.isEmpty()||(a=Bt(n.infoSyncTree_,i._path,l),setTimeout(()=>{o("ok")},0)),a},stopListening:()=>{}}),ns(n,"connected",!1),n.serverSyncTree_=new gr({startListening:(i,s,r,o)=>(n.server_.listen(i,r,s,(a,l)=>{const c=o(a,l);Te(n.eventQueue_,i._path,c)}),[]),stopListening:(i,s)=>{n.server_.unlisten(i,s)}})}function Ap(n){const t=n.infoData_.getNode(new T(".info/serverTimeOffset")).val()||0;return new Date().getTime()+t}function Na(n){return lp({timestamp:Ap(n)})}function vr(n,e,t,i,s){n.dataUpdateCount++;const r=new T(e);t=n.interceptServerDataCallback_?n.interceptServerDataCallback_(e,t):t;let o=[];if(s)if(i){const l=Zt(t,c=>D(c));o=tp(n.serverSyncTree_,r,l,s)}else{const l=D(t);o=va(n.serverSyncTree_,r,l,s)}else if(i){const l=Zt(t,c=>D(c));o=Xf(n.serverSyncTree_,r,l)}else{const l=D(t);o=Bt(n.serverSyncTree_,r,l)}let a=r;o.length>0&&(a=rs(n,r)),Te(n.eventQueue_,a,o)}function yr(n,e){ns(n,"connected",e),e===!1&&Dp(n)}function Np(n,e){W(e,(t,i)=>{ns(n,t,i)})}function ns(n,e,t){const i=new T("/.info/"+e),s=D(t);n.infoData_.updateSnapshot(i,s);const r=Bt(n.infoSyncTree_,i,s);Te(n.eventQueue_,i,r)}function Pp(n){return n.nextWriteId_++}function Op(n,e,t){const i=ip(n.serverSyncTree_,e);return i!=null?Promise.resolve(i):n.server_.get(e).then(s=>{const r=D(s).withIndex(e._queryParams.getIndex());np(n.serverSyncTree_,e,t,!0);let o;if(e._queryParams.loadsAllData())o=Bt(n.serverSyncTree_,e._path,r);else{const a=Nt(n.serverSyncTree_,e);o=va(n.serverSyncTree_,e._path,r,a)}return Te(n.eventQueue_,e._path,o),ma(n.serverSyncTree_,e,t,null,!0),r},s=>(is(n,"get for query "+A(e)+" failed: "+s),Promise.reject(new Error(s))))}function Dp(n){is(n,"onDisconnectEvents");const e=Na(n),t=dn();ci(n.onDisconnect_,I(),(s,r)=>{const o=up(s,r,n.serverSyncTree_,e);ta(t,s,o)});let i=[];ci(t,I(),(s,r)=>{i=i.concat(Bt(n.serverSyncTree_,s,r));const o=Fp(n,s);rs(n,o)}),n.onDisconnect_=dn(),Te(n.eventQueue_,I(),i)}function Mp(n){n.persistentConnection_&&n.persistentConnection_.interrupt(Sp)}function is(n,...e){let t="";n.persistentConnection_&&(t=n.persistentConnection_.id+":"),M(t,...e)}function Pa(n,e,t){return ya(n.serverSyncTree_,e,t)||m.EMPTY_NODE}function ss(n,e=n.transactionQueueTree_){if(e||Pn(n,e),ot(e)){const t=Da(n,e);f(t.length>0,"Sending zero length transaction queue"),t.every(s=>s.status===0)&&Lp(n,Vt(e),t)}else Ta(e)&&Nn(e,t=>{ss(n,t)})}function Lp(n,e,t){const i=t.map(c=>c.currentWriteId),s=Pa(n,e,i);let r=s;const o=s.hash();for(let c=0;c<t.length;c++){const d=t[c];f(d.status===0,"tryToSendTransactionQueue_: items in queue should all be run."),d.status=1,d.retryCount++;const h=L(e,d.path);r=r.updateChild(h,d.currentOutputSnapshotRaw)}const a=r.val(!0),l=e;n.server_.put(l.toString(),a,c=>{is(n,"transaction put response",{path:l.toString(),status:c});let d=[];if(c==="ok"){const h=[];for(let u=0;u<t.length;u++)t[u].status=2,d=d.concat(Be(n.serverSyncTree_,t[u].currentWriteId)),t[u].onComplete&&h.push(()=>t[u].onComplete(null,!0,t[u].currentOutputSnapshotResolved)),t[u].unwatcher();Pn(n,ts(n.transactionQueueTree_,e)),ss(n,n.transactionQueueTree_),Te(n.eventQueue_,e,d);for(let u=0;u<h.length;u++)Ut(h[u])}else{if(c==="datastale")for(let h=0;h<t.length;h++)t[h].status===3?t[h].status=4:t[h].status=0;else{B("transaction at "+l.toString()+" failed: "+c);for(let h=0;h<t.length;h++)t[h].status=4,t[h].abortReason=c}rs(n,e)}},o)}function rs(n,e){const t=Oa(n,e),i=Vt(t),s=Da(n,t);return xp(n,s,i),i}function xp(n,e,t){if(e.length===0)return;const i=[];let s=[];const o=e.filter(a=>a.status===0).map(a=>a.currentWriteId);for(let a=0;a<e.length;a++){const l=e[a],c=L(t,l.path);let d=!1,h;if(f(c!==null,"rerunTransactionsUnderNode_: relativePath should not be null."),l.status===4)d=!0,h=l.abortReason,s=s.concat(Be(n.serverSyncTree_,l.currentWriteId,!0));else if(l.status===0)if(l.retryCount>=bp)d=!0,h="maxretry",s=s.concat(Be(n.serverSyncTree_,l.currentWriteId,!0));else{const u=Pa(n,l.path,o);l.currentInputSnapshot=u;const p=e[a].update(u.val());if(p!==void 0){ka("transaction failed: Data returned ",p,l.path);let _=D(p);typeof p=="object"&&p!=null&&oe(p,".priority")||(_=_.updatePriority(u.getPriority()));const R=l.currentWriteId,H=Na(n),V=dp(_,u,H);l.currentOutputSnapshotRaw=_,l.currentOutputSnapshotResolved=V,l.currentWriteId=Pp(n),o.splice(o.indexOf(R),1),s=s.concat(Jf(n.serverSyncTree_,l.path,V,l.currentWriteId,l.applyLocally)),s=s.concat(Be(n.serverSyncTree_,R,!0))}else d=!0,h="nodata",s=s.concat(Be(n.serverSyncTree_,l.currentWriteId,!0))}Te(n.eventQueue_,t,s),s=[],d&&(e[a].status=2,function(u){setTimeout(u,Math.floor(0))}(e[a].unwatcher),e[a].onComplete&&(h==="nodata"?i.push(()=>e[a].onComplete(null,!1,e[a].currentInputSnapshot)):i.push(()=>e[a].onComplete(new Error(h),!1,null))))}Pn(n,n.transactionQueueTree_);for(let a=0;a<i.length;a++)Ut(i[a]);ss(n,n.transactionQueueTree_)}function Oa(n,e){let t,i=n.transactionQueueTree_;for(t=E(e);t!==null&&ot(i)===void 0;)i=ts(i,t),e=S(e),t=E(e);return i}function Da(n,e){const t=[];return Ma(n,e,t),t.sort((i,s)=>i.order-s.order),t}function Ma(n,e,t){const i=ot(e);if(i)for(let s=0;s<i.length;s++)t.push(i[s]);Nn(e,s=>{Ma(n,s,t)})}function Pn(n,e){const t=ot(e);if(t){let i=0;for(let s=0;s<t.length;s++)t[s].status!==2&&(t[i]=t[s],i++);t.length=i,wa(e,t.length>0?t:void 0)}Nn(e,i=>{Pn(n,i)})}function Fp(n,e){const t=Vt(Oa(n,e)),i=ts(n.transactionQueueTree_,e);return pp(i,s=>{qn(n,s)}),qn(n,i),Sa(i,s=>{qn(n,s)}),t}function qn(n,e){const t=ot(e);if(t){const i=[];let s=[],r=-1;for(let o=0;o<t.length;o++)t[o].status===3||(t[o].status===1?(f(r===o-1,"All SENT items should be at beginning of queue."),r=o,t[o].status=3,t[o].abortReason="set"):(f(t[o].status===0,"Unexpected transaction status in abort"),t[o].unwatcher(),s=s.concat(Be(n.serverSyncTree_,t[o].currentWriteId,!0)),t[o].onComplete&&i.push(t[o].onComplete.bind(null,new Error("set"),!1,null))));r===-1?wa(e,void 0):t.length=r+1,Te(n.eventQueue_,Vt(e),s);for(let o=0;o<i.length;o++)Ut(i[o])}}/**
2674
2674
  * @license
2675
2675
  * Copyright 2017 Google LLC
2676
2676
  *
@@ -2685,7 +2685,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const e of t
2685
2685
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2686
2686
  * See the License for the specific language governing permissions and
2687
2687
  * limitations under the License.
2688
- */function Fp(n){let e="";const t=n.split("/");for(let i=0;i<t.length;i++)if(t[i].length>0){let s=t[i];try{s=decodeURIComponent(s.replace(/\+/g," "))}catch{}e+="/"+s}return e}function Up(n){const e={};n.charAt(0)==="?"&&(n=n.substring(1));for(const t of n.split("&")){if(t.length===0)continue;const i=t.split("=");i.length===2?e[decodeURIComponent(i[0])]=decodeURIComponent(i[1]):B(`Invalid query segment '${t}' in query '${n}'`)}return e}const Er=function(n,e){const t=Wp(n),i=t.namespace;t.domain==="firebase.com"&&re(t.host+" is no longer supported. Please use <YOUR FIREBASE>.firebaseio.com instead"),(!i||i==="undefined")&&t.domain!=="localhost"&&re("Cannot parse Firebase url. Please use https://<YOUR FIREBASE>.firebaseio.com"),t.secure||Ku();const s=t.scheme==="ws"||t.scheme==="wss";return{repoInfo:new Lo(t.host,t.secure,i,s,e,"",i!==t.subdomain),path:new T(t.pathString)}},Wp=function(n){let e="",t="",i="",s="",r="",o=!0,a="https",l=443;if(typeof n=="string"){let c=n.indexOf("//");c>=0&&(a=n.substring(0,c-1),n=n.substring(c+2));let d=n.indexOf("/");d===-1&&(d=n.length);let h=n.indexOf("?");h===-1&&(h=n.length),e=n.substring(0,Math.min(d,h)),d<h&&(s=Fp(n.substring(d,h)));const u=Up(n.substring(Math.min(n.length,h)));c=e.indexOf(":"),c>=0?(o=a==="https"||a==="wss",l=parseInt(e.substring(c+1),10)):c=e.length;const p=e.slice(0,c);if(p.toLowerCase()==="localhost")t="localhost";else if(p.split(".").length<=2)t=p;else{const _=e.indexOf(".");i=e.substring(0,_).toLowerCase(),t=e.substring(_+1),r=i}"ns"in u&&(r=u.ns)}return{host:e,port:l,domain:t,subdomain:i,secure:o,scheme:a,pathString:s,namespace:r}};/**
2688
+ */function Up(n){let e="";const t=n.split("/");for(let i=0;i<t.length;i++)if(t[i].length>0){let s=t[i];try{s=decodeURIComponent(s.replace(/\+/g," "))}catch{}e+="/"+s}return e}function Wp(n){const e={};n.charAt(0)==="?"&&(n=n.substring(1));for(const t of n.split("&")){if(t.length===0)continue;const i=t.split("=");i.length===2?e[decodeURIComponent(i[0])]=decodeURIComponent(i[1]):B(`Invalid query segment '${t}' in query '${n}'`)}return e}const Er=function(n,e){const t=Bp(n),i=t.namespace;t.domain==="firebase.com"&&re(t.host+" is no longer supported. Please use <YOUR FIREBASE>.firebaseio.com instead"),(!i||i==="undefined")&&t.domain!=="localhost"&&re("Cannot parse Firebase url. Please use https://<YOUR FIREBASE>.firebaseio.com"),t.secure||Yu();const s=t.scheme==="ws"||t.scheme==="wss";return{repoInfo:new Lo(t.host,t.secure,i,s,e,"",i!==t.subdomain),path:new T(t.pathString)}},Bp=function(n){let e="",t="",i="",s="",r="",o=!0,a="https",l=443;if(typeof n=="string"){let c=n.indexOf("//");c>=0&&(a=n.substring(0,c-1),n=n.substring(c+2));let d=n.indexOf("/");d===-1&&(d=n.length);let h=n.indexOf("?");h===-1&&(h=n.length),e=n.substring(0,Math.min(d,h)),d<h&&(s=Up(n.substring(d,h)));const u=Wp(n.substring(Math.min(n.length,h)));c=e.indexOf(":"),c>=0?(o=a==="https"||a==="wss",l=parseInt(e.substring(c+1),10)):c=e.length;const p=e.slice(0,c);if(p.toLowerCase()==="localhost")t="localhost";else if(p.split(".").length<=2)t=p;else{const _=e.indexOf(".");i=e.substring(0,_).toLowerCase(),t=e.substring(_+1),r=i}"ns"in u&&(r=u.ns)}return{host:e,port:l,domain:t,subdomain:i,secure:o,scheme:a,pathString:s,namespace:r}};/**
2689
2689
  * @license
2690
2690
  * Copyright 2017 Google LLC
2691
2691
  *
@@ -2700,7 +2700,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const e of t
2700
2700
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2701
2701
  * See the License for the specific language governing permissions and
2702
2702
  * limitations under the License.
2703
- */class Bp{constructor(e,t,i,s){this.eventType=e,this.eventRegistration=t,this.snapshot=i,this.prevName=s}getPath(){const e=this.snapshot.ref;return this.eventType==="value"?e._path:e.parent._path}getEventType(){return this.eventType}getEventRunner(){return this.eventRegistration.getEventRunner(this)}toString(){return this.getPath().toString()+":"+this.eventType+":"+k(this.snapshot.exportVal())}}class Hp{constructor(e,t,i){this.eventRegistration=e,this.error=t,this.path=i}getPath(){return this.path}getEventType(){return"cancel"}getEventRunner(){return this.eventRegistration.getEventRunner(this)}toString(){return this.path.toString()+":cancel"}}/**
2703
+ */class Hp{constructor(e,t,i,s){this.eventType=e,this.eventRegistration=t,this.snapshot=i,this.prevName=s}getPath(){const e=this.snapshot.ref;return this.eventType==="value"?e._path:e.parent._path}getEventType(){return this.eventType}getEventRunner(){return this.eventRegistration.getEventRunner(this)}toString(){return this.getPath().toString()+":"+this.eventType+":"+A(this.snapshot.exportVal())}}class Vp{constructor(e,t,i){this.eventRegistration=e,this.error=t,this.path=i}getPath(){return this.path}getEventType(){return"cancel"}getEventRunner(){return this.eventRegistration.getEventRunner(this)}toString(){return this.path.toString()+":cancel"}}/**
2704
2704
  * @license
2705
2705
  * Copyright 2017 Google LLC
2706
2706
  *
@@ -2715,7 +2715,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const e of t
2715
2715
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2716
2716
  * See the License for the specific language governing permissions and
2717
2717
  * limitations under the License.
2718
- */class Vp{constructor(e,t){this.snapshotCallback=e,this.cancelCallback=t}onValue(e,t){this.snapshotCallback.call(null,e,t)}onCancel(e){return f(this.hasCancelCallback,"Raising a cancel event on a listener with no cancel callback"),this.cancelCallback.call(null,e)}get hasCancelCallback(){return!!this.cancelCallback}matches(e){return this.snapshotCallback===e.snapshotCallback||this.snapshotCallback.userCallback!==void 0&&this.snapshotCallback.userCallback===e.snapshotCallback.userCallback&&this.snapshotCallback.context===e.snapshotCallback.context}}/**
2718
+ */class $p{constructor(e,t){this.snapshotCallback=e,this.cancelCallback=t}onValue(e,t){this.snapshotCallback.call(null,e,t)}onCancel(e){return f(this.hasCancelCallback,"Raising a cancel event on a listener with no cancel callback"),this.cancelCallback.call(null,e)}get hasCancelCallback(){return!!this.cancelCallback}matches(e){return this.snapshotCallback===e.snapshotCallback||this.snapshotCallback.userCallback!==void 0&&this.snapshotCallback.userCallback===e.snapshotCallback.userCallback&&this.snapshotCallback.context===e.snapshotCallback.context}}/**
2719
2719
  * @license
2720
2720
  * Copyright 2020 Google LLC
2721
2721
  *
@@ -2730,7 +2730,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const e of t
2730
2730
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2731
2731
  * See the License for the specific language governing permissions and
2732
2732
  * limitations under the License.
2733
- */class os{constructor(e,t,i,s){this._repo=e,this._path=t,this._queryParams=i,this._orderByCalled=s}get key(){return y(this._path)?null:Go(this._path)}get ref(){return new ae(this._repo,this._path)}get _queryIdentifier(){const e=rr(this._queryParams),t=Mi(e);return t==="{}"?"default":t}get _queryObject(){return rr(this._queryParams)}isEqual(e){if(e=F(e),!(e instanceof os))return!1;const t=this._repo===e._repo,i=qo(this._path,e._path),s=this._queryIdentifier===e._queryIdentifier;return t&&i&&s}toJSON(){return this.toString()}toString(){return this._repo.toString()+Pd(this._path)}}class ae extends os{constructor(e,t){super(e,t,new Hi,!1)}get parent(){const e=zo(this._path);return e===null?null:new ae(this._repo,e)}get root(){let e=this;for(;e.parent!==null;)e=e.parent;return e}}class Pt{constructor(e,t,i){this._node=e,this.ref=t,this._index=i}get priority(){return this._node.getPriority().val()}get key(){return this.ref.key}get size(){return this._node.numChildren()}child(e){const t=new T(e),i=_i(this.ref,e);return new Pt(this._node.getChild(t),i,A)}exists(){return!this._node.isEmpty()}exportVal(){return this._node.val(!0)}forEach(e){return this._node.isLeafNode()?!1:!!this._node.forEachChild(this._index,(i,s)=>e(new Pt(s,_i(this.ref,i),A)))}hasChild(e){const t=new T(e);return!this._node.getChild(t).isEmpty()}hasChildren(){return this._node.isLeafNode()?!1:!this._node.isEmpty()}toJSON(){return this.exportVal()}val(){return this._node.val()}}function $p(n,e){return n=F(n),n._checkNotDeleted("ref"),e!==void 0?_i(n._root,e):n._root}function _i(n,e){return n=F(n),E(n._path)===null?vp("child","path",e):ka("child","path",e),new ae(n._repo,N(n._path,e))}function Gp(n){n=F(n);const e=new Vp(()=>{}),t=new as(e);return Pp(n._repo,n,t).then(i=>new Pt(i,new ae(n._repo,n._path),n._queryParams.getIndex()))}class as{constructor(e){this.callbackContext=e}respondsTo(e){return e==="value"}createEvent(e,t){const i=t._queryParams.getIndex();return new Bp("value",this,new Pt(e.snapshotNode,new ae(t._repo,t._path),i))}getEventRunner(e){return e.getEventType()==="cancel"?()=>this.callbackContext.onCancel(e.error):()=>this.callbackContext.onValue(e.snapshot,null)}createCancelEvent(e,t){return this.callbackContext.hasCancelCallback?new Hp(this,e,t):null}matches(e){return e instanceof as?!e.callbackContext||!this.callbackContext?!0:e.callbackContext.matches(this.callbackContext):!1}hasAnyCallback(){return this.callbackContext!==null}}Vf(ae);qf(ae);/**
2733
+ */class os{constructor(e,t,i,s){this._repo=e,this._path=t,this._queryParams=i,this._orderByCalled=s}get key(){return y(this._path)?null:Go(this._path)}get ref(){return new ae(this._repo,this._path)}get _queryIdentifier(){const e=rr(this._queryParams),t=Mi(e);return t==="{}"?"default":t}get _queryObject(){return rr(this._queryParams)}isEqual(e){if(e=F(e),!(e instanceof os))return!1;const t=this._repo===e._repo,i=qo(this._path,e._path),s=this._queryIdentifier===e._queryIdentifier;return t&&i&&s}toJSON(){return this.toString()}toString(){return this._repo.toString()+Od(this._path)}}class ae extends os{constructor(e,t){super(e,t,new Hi,!1)}get parent(){const e=zo(this._path);return e===null?null:new ae(this._repo,e)}get root(){let e=this;for(;e.parent!==null;)e=e.parent;return e}}class Pt{constructor(e,t,i){this._node=e,this.ref=t,this._index=i}get priority(){return this._node.getPriority().val()}get key(){return this.ref.key}get size(){return this._node.numChildren()}child(e){const t=new T(e),i=_i(this.ref,e);return new Pt(this._node.getChild(t),i,k)}exists(){return!this._node.isEmpty()}exportVal(){return this._node.val(!0)}forEach(e){return this._node.isLeafNode()?!1:!!this._node.forEachChild(this._index,(i,s)=>e(new Pt(s,_i(this.ref,i),k)))}hasChild(e){const t=new T(e);return!this._node.getChild(t).isEmpty()}hasChildren(){return this._node.isLeafNode()?!1:!this._node.isEmpty()}toJSON(){return this.exportVal()}val(){return this._node.val()}}function Gp(n,e){return n=F(n),n._checkNotDeleted("ref"),e!==void 0?_i(n._root,e):n._root}function _i(n,e){return n=F(n),E(n._path)===null?yp("child","path",e):Aa("child","path",e),new ae(n._repo,N(n._path,e))}function jp(n){n=F(n);const e=new $p(()=>{}),t=new as(e);return Op(n._repo,n,t).then(i=>new Pt(i,new ae(n._repo,n._path),n._queryParams.getIndex()))}class as{constructor(e){this.callbackContext=e}respondsTo(e){return e==="value"}createEvent(e,t){const i=t._queryParams.getIndex();return new Hp("value",this,new Pt(e.snapshotNode,new ae(t._repo,t._path),i))}getEventRunner(e){return e.getEventType()==="cancel"?()=>this.callbackContext.onCancel(e.error):()=>this.callbackContext.onValue(e.snapshot,null)}createCancelEvent(e,t){return this.callbackContext.hasCancelCallback?new Vp(this,e,t):null}matches(e){return e instanceof as?!e.callbackContext||!this.callbackContext?!0:e.callbackContext.matches(this.callbackContext):!1}hasAnyCallback(){return this.callbackContext!==null}}$f(ae);Kf(ae);/**
2734
2734
  * @license
2735
2735
  * Copyright 2020 Google LLC
2736
2736
  *
@@ -2745,7 +2745,7 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const e of t
2745
2745
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2746
2746
  * See the License for the specific language governing permissions and
2747
2747
  * limitations under the License.
2748
- */const jp="FIREBASE_DATABASE_EMULATOR_HOST",gi={};let zp=!1;function qp(n,e,t,i){const s=e.lastIndexOf(":"),r=e.substring(0,s),o=et(r);n.repoInfo_=new Lo(e,o,n.repoInfo_.namespace,n.repoInfo_.webSocketOnly,n.repoInfo_.nodeAdmin,n.repoInfo_.persistenceKey,n.repoInfo_.includeNamespaceInQueryParams,!0,t),i&&(n.authTokenProvider_=i)}function Kp(n,e,t,i,s){let r=i||n.options.databaseURL;r===void 0&&(n.options.projectId||re("Can't determine Firebase Database URL. Be sure to include a Project ID when calling firebase.initializeApp()."),M("Using default host for project ",n.options.projectId),r=`${n.options.projectId}-default-rtdb.firebaseio.com`);let o=Er(r,s),a=o.repoInfo,l;typeof process<"u"&&Hs&&(l=Hs[jp]),l?(r=`http://${l}?ns=${a.namespace}`,o=Er(r,s),a=o.repoInfo):o.repoInfo.secure;const c=new rd(n.name,n.options,e);yp("Invalid Firebase Database URL",o),y(o.path)||re("Database URL must point to the root of a Firebase Database (not including a child path).");const d=Qp(a,n,c,new sd(n,t));return new Jp(d,n)}function Yp(n,e){const t=gi[e];(!t||t[n.key]!==n)&&re(`Database ${e}(${n.repoInfo_}) has already been deleted.`),Dp(n),delete t[n.key]}function Qp(n,e,t,i){let s=gi[e.name];s||(s={},gi[e.name]=s);let r=s[n.toURLString()];return r&&re("Database initialized multiple times. Please make sure the format of the database URL matches with each database() call."),r=new bp(n,zp,t,i),s[n.toURLString()]=r,r}class Jp{constructor(e,t){this._repoInternal=e,this.app=t,this.type="database",this._instanceStarted=!1}get _repo(){return this._instanceStarted||(Rp(this._repoInternal,this.app.options.appId,this.app.options.databaseAuthVariableOverride),this._instanceStarted=!0),this._repoInternal}get _root(){return this._rootInternal||(this._rootInternal=new ae(this._repo,I())),this._rootInternal}_delete(){return this._rootInternal!==null&&(Yp(this._repo,this.app.name),this._repoInternal=null,this._rootInternal=null),Promise.resolve()}_checkNotDeleted(e){this._rootInternal===null&&re("Cannot call "+e+" on a deleted database.")}}function Xp(n=xr(),e){const t=Si(n,"database").getImmediate({identifier:e});if(!t._instanceStarted){const i=Za("database");i&&Zp(t,...i)}return t}function Zp(n,e,t,i={}){n=F(n),n._checkNotDeleted("useEmulator");const s=`${e}:${t}`,r=n._repoInternal;if(n._instanceStarted){if(s===n._repoInternal.repoInfo_.host&&ke(i,r.repoInfo_.emulatorOptions))return;re("connectDatabaseEmulator() cannot initialize or alter the emulator configuration after the database instance has started.")}let o;if(r.repoInfo_.nodeAdmin)i.mockUserToken&&re('mockUserToken is not supported by the Admin SDK. For client access with mock users, please use the "firebase" package instead of "firebase-admin".'),o=new Qt(Qt.OWNER);else if(i.mockUserToken){const a=typeof i.mockUserToken=="string"?i.mockUserToken:el(i.mockUserToken,n.app.options.projectId);o=new Qt(a)}et(e)&&(Ar(e),kr("Database",!0)),qp(r,s,i,o)}/**
2748
+ */const zp="FIREBASE_DATABASE_EMULATOR_HOST",gi={};let qp=!1;function Kp(n,e,t,i){const s=e.lastIndexOf(":"),r=e.substring(0,s),o=et(r);n.repoInfo_=new Lo(e,o,n.repoInfo_.namespace,n.repoInfo_.webSocketOnly,n.repoInfo_.nodeAdmin,n.repoInfo_.persistenceKey,n.repoInfo_.includeNamespaceInQueryParams,!0,t),i&&(n.authTokenProvider_=i)}function Yp(n,e,t,i,s){let r=i||n.options.databaseURL;r===void 0&&(n.options.projectId||re("Can't determine Firebase Database URL. Be sure to include a Project ID when calling firebase.initializeApp()."),M("Using default host for project ",n.options.projectId),r=`${n.options.projectId}-default-rtdb.firebaseio.com`);let o=Er(r,s),a=o.repoInfo,l;typeof process<"u"&&Hs&&(l=Hs[zp]),l?(r=`http://${l}?ns=${a.namespace}`,o=Er(r,s),a=o.repoInfo):o.repoInfo.secure;const c=new od(n.name,n.options,e);Ep("Invalid Firebase Database URL",o),y(o.path)||re("Database URL must point to the root of a Firebase Database (not including a child path).");const d=Jp(a,n,c,new rd(n,t));return new Xp(d,n)}function Qp(n,e){const t=gi[e];(!t||t[n.key]!==n)&&re(`Database ${e}(${n.repoInfo_}) has already been deleted.`),Mp(n),delete t[n.key]}function Jp(n,e,t,i){let s=gi[e.name];s||(s={},gi[e.name]=s);let r=s[n.toURLString()];return r&&re("Database initialized multiple times. Please make sure the format of the database URL matches with each database() call."),r=new Rp(n,qp,t,i),s[n.toURLString()]=r,r}class Xp{constructor(e,t){this._repoInternal=e,this.app=t,this.type="database",this._instanceStarted=!1}get _repo(){return this._instanceStarted||(kp(this._repoInternal,this.app.options.appId,this.app.options.databaseAuthVariableOverride),this._instanceStarted=!0),this._repoInternal}get _root(){return this._rootInternal||(this._rootInternal=new ae(this._repo,I())),this._rootInternal}_delete(){return this._rootInternal!==null&&(Qp(this._repo,this.app.name),this._repoInternal=null,this._rootInternal=null),Promise.resolve()}_checkNotDeleted(e){this._rootInternal===null&&re("Cannot call "+e+" on a deleted database.")}}function Zp(n=xr(),e){const t=Si(n,"database").getImmediate({identifier:e});if(!t._instanceStarted){const i=el("database");i&&e_(t,...i)}return t}function e_(n,e,t,i={}){n=F(n),n._checkNotDeleted("useEmulator");const s=`${e}:${t}`,r=n._repoInternal;if(n._instanceStarted){if(s===n._repoInternal.repoInfo_.host&&ke(i,r.repoInfo_.emulatorOptions))return;re("connectDatabaseEmulator() cannot initialize or alter the emulator configuration after the database instance has started.")}let o;if(r.repoInfo_.nodeAdmin)i.mockUserToken&&re('mockUserToken is not supported by the Admin SDK. For client access with mock users, please use the "firebase" package instead of "firebase-admin".'),o=new Qt(Qt.OWNER);else if(i.mockUserToken){const a=typeof i.mockUserToken=="string"?i.mockUserToken:tl(i.mockUserToken,n.app.options.projectId);o=new Qt(a)}et(e)&&(kr(e),Ar("Database",!0)),Kp(r,s,i,o)}/**
2749
2749
  * @license
2750
2750
  * Copyright 2021 Google LLC
2751
2751
  *
@@ -2760,4 +2760,4 @@ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const e of t
2760
2760
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2761
2761
  * See the License for the specific language governing permissions and
2762
2762
  * limitations under the License.
2763
- */function e_(n){Vu(nt),Ke(new Ne("database",(e,{instanceIdentifier:t})=>{const i=e.getProvider("app").getImmediate(),s=e.getProvider("auth-internal"),r=e.getProvider("app-check-internal");return Kp(i,s,r,t)},"PUBLIC").setMultipleInstances(!0)),_e(Vs,$s,n),_e(Vs,$s,"esm2017")}ne.prototype.simpleListen=function(n,e){this.sendRequest("q",{p:n},e)};ne.prototype.echo=function(n,e){this.sendRequest("echo",{d:n},e)};e_();const Re={EDITORIAL_API_URL:"/",FIREBASE_API_KEY:"AIzaSyBQd7499dQyNqLNHuykDsUhSL9z5Lu4dwg",FIREBASE_AUTH_DOMAIN:"editorial-development-82fd4.firebaseapp.com",FIREBASE_DATABASE_URL:"https://editorial-development-82fd4-default-rtdb.europe-west1.firebasedatabase.app",FIREBASE_PROJECT_ID:"editorial-development-82fd4",FIREBASE_STORAGE_BUCKET:"editorial-development-82fd4.firebasestorage.app",FIREBASE_MESSAGING_SENDER_ID:"1004877515053",FIREBASE_DB_USERS_PATH:"editors/wekeo"},t_={apiKey:Re.FIREBASE_API_KEY,authDomain:Re.FIREBASE_AUTH_DOMAIN,databaseURL:Re.FIREBASE_DATABASE_URL,projectId:Re.FIREBASE_PROJECT_ID,storageBucket:Re.FIREBASE_STORAGE_BUCKET,messagingSenderId:Re.FIREBASE_MESSAGING_SENDER_ID},La=Lr(t_),mi=Bu(La),n_=Xp(La),a_=Wa.withTypes(),l_=Ba.withTypes();Ha.withTypes();const xa=Va.withTypes(),i_={isLoading:!0},Kn=xa("auth/login",async({email:n,password:e,remember:t},{rejectWithValue:i})=>{var s;try{const r=await Rh(mi,t?ho:si).then(()=>bh(mi,n,e)),o=(s=r.user.email)==null?void 0:s.replace(/[.@]/g,"_"),a=$p(n_,`${Re.FIREBASE_DB_USERS_PATH}/${o}`),c=(await Gp(a)).val();return{user:{uid:r.user.uid,email:r.user.email??n},role:c}}catch(r){return r instanceof Error?i(r.message):i("Unknown error occured")}}),Yn=xa("auth/signOut",async(n,{rejectWithValue:e})=>{try{return await Nh(mi),null}catch(t){return t instanceof Error?e(t.message):e("Unknown error occured")}}),ls=$a({name:"auth",initialState:i_,reducers:{setUser:(n,e)=>{n.isLoading=!1,n.user=e.payload},setRole:(n,e)=>{n.role=e.payload},setLoading:(n,e)=>{n.isLoading=e.payload},clearError:n=>{n.error=void 0}},extraReducers:n=>{n.addCase(Kn.pending,e=>{e.isLoading=!0,e.error=void 0}).addCase(Kn.fulfilled,(e,t)=>{e.isLoading=!1,e.user=t.payload.user,e.role=t.payload.role}).addCase(Kn.rejected,(e,t)=>{e.isLoading=!1,e.error=t.payload}).addCase(Yn.pending,e=>{e.isLoading=!0}).addCase(Yn.fulfilled,e=>{e.isLoading=!1,e.user=void 0,e.role=void 0}).addCase(Yn.rejected,(e,t)=>{e.isLoading=!1,e.error=t.payload})},selectors:{selectUser:n=>n.user,selectRole:n=>n.role}}),{setUser:c_,setRole:h_,setLoading:u_,clearError:d_}=ls.actions,{selectUser:f_,selectRole:p_}=ls.selectors,__=ls.reducer;export{h_ as a,u_ as b,Re as c,mi as d,__ as e,n_ as f,Gp as g,l_ as h,Yn as i,p_ as j,Kn as l,o_ as o,$p as r,c_ as s,a_ as u};
2763
+ */function t_(n){$u(nt),Ke(new Ae("database",(e,{instanceIdentifier:t})=>{const i=e.getProvider("app").getImmediate(),s=e.getProvider("auth-internal"),r=e.getProvider("app-check-internal");return Yp(i,s,r,t)},"PUBLIC").setMultipleInstances(!0)),_e(Vs,$s,n),_e(Vs,$s,"esm2017")}ne.prototype.simpleListen=function(n,e){this.sendRequest("q",{p:n},e)};ne.prototype.echo=function(n,e){this.sendRequest("echo",{d:n},e)};t_();function n_(n){const e=Lr(n),t=Hu(e),i=Zp(e);return{app:e,auth:t,firebaseDb:i}}let He=null;function l_(n){if(He)return He;const e={apiKey:n.apiKey,authDomain:n.authDomain,databaseURL:n.databaseURL,projectId:n.projectId,storageBucket:n.storageBucket,messagingSenderId:n.messagingSenderId};return He=n_(e),He}function La(){if(!He)throw new Error("Firebase not initialized. Call initializeFirebase() first.");return He}const mi=new Proxy({},{get(n,e){return La().auth[e]}}),i_=new Proxy({},{get(n,e){return La().firebaseDb[e]}}),c_=Wa.withTypes(),h_=Ba.withTypes();Ha.withTypes();const xa=Va.withTypes(),s_={isLoading:!0},Kn=xa("auth/login",async({email:n,password:e,remember:t},{rejectWithValue:i,dispatch:s})=>{var r,o;try{const a=await kh(mi,t?ho:si).then(()=>Rh(mi,n,e)),l=await s($a.endpoints.getConfig.initiate(void 0)).unwrap(),c=(r=a.user.email)==null?void 0:r.replace(/[.@]/g,"_"),d=Gp(i_,`${(o=l.firebase)==null?void 0:o.dbUsersPath}/${c}`),u=(await jp(d)).val();return{user:{uid:a.user.uid,email:a.user.email??n},role:u}}catch(a){return a instanceof Error?i(a.message):i("Unknown error occured")}}),Yn=xa("auth/signOut",async(n,{rejectWithValue:e})=>{try{return await Ph(mi),null}catch(t){return t instanceof Error?e(t.message):e("Unknown error occured")}}),ls=Ga({name:"auth",initialState:s_,reducers:{setUser:(n,e)=>{n.isLoading=!1,n.user=e.payload},setRole:(n,e)=>{n.role=e.payload},setLoading:(n,e)=>{n.isLoading=e.payload},clearError:n=>{n.error=void 0}},extraReducers:n=>{n.addCase(Kn.pending,e=>{e.isLoading=!0,e.error=void 0}).addCase(Kn.fulfilled,(e,t)=>{e.isLoading=!1,e.user=t.payload.user,e.role=t.payload.role}).addCase(Kn.rejected,(e,t)=>{e.isLoading=!1,e.error=t.payload}).addCase(Yn.pending,e=>{e.isLoading=!0}).addCase(Yn.fulfilled,e=>{e.isLoading=!1,e.user=void 0,e.role=void 0}).addCase(Yn.rejected,(e,t)=>{e.isLoading=!1,e.error=t.payload})},selectors:{selectUser:n=>n.user,selectRole:n=>n.role}}),{setUser:u_,setRole:d_,setLoading:f_,clearError:p_}=ls.actions,{selectUser:__,selectRole:g_}=ls.selectors,m_=ls.reducer;export{d_ as a,f_ as b,mi as c,m_ as d,h_ as e,i_ as f,jp as g,Yn as h,l_ as i,g_ as j,Kn as l,a_ as o,Gp as r,u_ as s,c_ as u};