/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
class t{constructor(){this.reject=()=>{};this.resolve=()=>{};this.promise=new Promise(((t,e)=>{this.resolve=t;this.reject=e}))}wrapCallback(t){return(e,n)=>{if(e){this.reject(e)}else{this.resolve(n)}if(typeof t==="function"){this.promise.catch((()=>{}));if(t.length===1){t(e)}else{t(e,n)}}}}}class e{constructor(t,e,n){this.name=t;this.instanceFactory=e;this.type=n;this.multipleInstances=false;this.serviceProps={};this.instantiationMode="LAZY";this.onInstanceCreated=null}setInstantiationMode(t){this.instantiationMode=t;return this}setMultipleInstances(t){this.multipleInstances=t;return this}setServiceProps(t){this.serviceProps=t;return this}setInstanceCreatedCallback(t){this.onInstanceCreated=t;return this}}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const n="[DEFAULT]";
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class s{constructor(t,e){this.name=t;this.container=e;this.component=null;this.instances=new Map;this.instancesDeferred=new Map;this.instancesOptions=new Map;this.onInitCallbacks=new Map}get(e){const n=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(n)){const e=new t;this.instancesDeferred.set(n,e);if(this.isInitialized(n)||this.shouldAutoInitialize()){try{const t=this.getOrInitializeService({instanceIdentifier:n});if(t){e.resolve(t)}}catch(t){}}}return this.instancesDeferred.get(n).promise}getImmediate(t){var e;const n=this.normalizeInstanceIdentifier(t===null||t===void 0?void 0:t.identifier);const s=(e=t===null||t===void 0?void 0:t.optional)!==null&&e!==void 0?e:false;if(this.isInitialized(n)||this.shouldAutoInitialize()){try{return this.getOrInitializeService({instanceIdentifier:n})}catch(t){if(s){return null}else{throw t}}}else{if(s){return null}else{throw Error(`Service ${this.name} is not available`)}}}getComponent(){return this.component}setComponent(t){if(t.name!==this.name){throw Error(`Mismatching Component ${t.name} for Provider ${this.name}.`)}if(this.component){throw Error(`Component for ${this.name} has already been provided`)}this.component=t;if(!this.shouldAutoInitialize()){return}if(i(t)){try{this.getOrInitializeService({instanceIdentifier:n})}catch(t){}}for(const[t,e]of this.instancesDeferred.entries()){const n=this.normalizeInstanceIdentifier(t);try{const t=this.getOrInitializeService({instanceIdentifier:n});e.resolve(t)}catch(t){}}}clearInstance(t=n){this.instancesDeferred.delete(t);this.instancesOptions.delete(t);this.instances.delete(t)}async delete(){const t=Array.from(this.instances.values());await Promise.all([...t.filter((t=>"INTERNAL"in t)).map((t=>t.INTERNAL.delete())),...t.filter((t=>"_delete"in t)).map((t=>t._delete()))])}isComponentSet(){return this.component!=null}isInitialized(t=n){return this.instances.has(t)}getOptions(t=n){return this.instancesOptions.get(t)||{}}initialize(t={}){const{options:e={}}=t;const n=this.normalizeInstanceIdentifier(t.instanceIdentifier);if(this.isInitialized(n)){throw Error(`${this.name}(${n}) has already been initialized`)}if(!this.isComponentSet()){throw Error(`Component ${this.name} has not been registered yet`)}const s=this.getOrInitializeService({instanceIdentifier:n,options:e});for(const[t,e]of this.instancesDeferred.entries()){const r=this.normalizeInstanceIdentifier(t);if(n===r){e.resolve(s)}}return s}onInit(t,e){var n;const s=this.normalizeInstanceIdentifier(e);const r=(n=this.onInitCallbacks.get(s))!==null&&n!==void 0?n:new Set;r.add(t);this.onInitCallbacks.set(s,r);const i=this.instances.get(s);if(i){t(i,s)}return()=>{r.delete(t)}}invokeOnInitCallbacks(t,e){const n=this.onInitCallbacks.get(e);if(!n){return}for(const s of n){try{s(t,e)}catch(t){}}}getOrInitializeService({instanceIdentifier:t,options:e={}}){let n=this.instances.get(t);if(!n&&this.component){n=this.component.instanceFactory(this.container,{instanceIdentifier:r(t),options:e});this.instances.set(t,n);this.instancesOptions.set(t,e);this.invokeOnInitCallbacks(n,t);if(this.component.onInstanceCreated){try{this.component.onInstanceCreated(this.container,t,n)}catch(t){}}}return n||null}normalizeInstanceIdentifier(t=n){if(this.component){return this.component.multipleInstances?t:n}else{return t}}shouldAutoInitialize(){return!!this.component&&this.component.instantiationMode!=="EXPLICIT"}}function r(t){return t===n?undefined:t}function i(t){return t.instantiationMode==="EAGER"}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class o{constructor(t){this.name=t;this.providers=new Map}addComponent(t){const e=this.getProvider(t.name);if(e.isComponentSet()){throw new Error(`Component ${t.name} has already been registered with ${this.name}`)}e.setComponent(t)}addOrOverwriteComponent(t){const e=this.getProvider(t.name);if(e.isComponentSet()){this.providers.delete(t.name)}this.addComponent(t)}getProvider(t){if(this.providers.has(t)){return this.providers.get(t)}const e=new s(t,this);this.providers.set(t,e);return e}getProviders(){return Array.from(this.providers.values())}}
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */var a;(function(t){t[t["DEBUG"]=0]="DEBUG";t[t["VERBOSE"]=1]="VERBOSE";t[t["INFO"]=2]="INFO";t[t["WARN"]=3]="WARN";t[t["ERROR"]=4]="ERROR";t[t["SILENT"]=5]="SILENT"})(a||(a={}));const c={debug:a.DEBUG,verbose:a.VERBOSE,info:a.INFO,warn:a.WARN,error:a.ERROR,silent:a.SILENT};const h=a.INFO;const f={[a.DEBUG]:"log",[a.VERBOSE]:"log",[a.INFO]:"info",[a.WARN]:"warn",[a.ERROR]:"error"};const l=(t,e,...n)=>{if(e<t.logLevel){return}const s=(new Date).toISOString();const r=f[e];if(r){console[r](`[${s}]  ${t.name}:`,...n)}else{throw new Error(`Attempted to log a message with an invalid logType (value: ${e})`)}};class u{constructor(t){this.name=t;this._logLevel=h;this._logHandler=l;this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(t){if(!(t in a)){throw new TypeError(`Invalid value "${t}" assigned to \`logLevel\``)}this._logLevel=t}setLogLevel(t){this._logLevel=typeof t==="string"?c[t]:t}get logHandler(){return this._logHandler}set logHandler(t){if(typeof t!=="function"){throw new TypeError("Value assigned to `logHandler` must be a function")}this._logHandler=t}get userLogHandler(){return this._userLogHandler}set userLogHandler(t){this._userLogHandler=t}debug(...t){this._userLogHandler&&this._userLogHandler(this,a.DEBUG,...t);this._logHandler(this,a.DEBUG,...t)}log(...t){this._userLogHandler&&this._userLogHandler(this,a.VERBOSE,...t);this._logHandler(this,a.VERBOSE,...t)}info(...t){this._userLogHandler&&this._userLogHandler(this,a.INFO,...t);this._logHandler(this,a.INFO,...t)}warn(...t){this._userLogHandler&&this._userLogHandler(this,a.WARN,...t);this._logHandler(this,a.WARN,...t)}error(...t){this._userLogHandler&&this._userLogHandler(this,a.ERROR,...t);this._logHandler(this,a.ERROR,...t)}}
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const p=function(t){const e=[];let n=0;for(let s=0;s<t.length;s++){let r=t.charCodeAt(s);if(r<128){e[n++]=r}else if(r<2048){e[n++]=r>>6|192;e[n++]=r&63|128}else if((r&64512)===55296&&s+1<t.length&&(t.charCodeAt(s+1)&64512)===56320){r=65536+((r&1023)<<10)+(t.charCodeAt(++s)&1023);e[n++]=r>>18|240;e[n++]=r>>12&63|128;e[n++]=r>>6&63|128;e[n++]=r&63|128}else{e[n++]=r>>12|224;e[n++]=r>>6&63|128;e[n++]=r&63|128}}return e};const d=function(t){const e=[];let n=0,s=0;while(n<t.length){const r=t[n++];if(r<128){e[s++]=String.fromCharCode(r)}else if(r>191&&r<224){const i=t[n++];e[s++]=String.fromCharCode((r&31)<<6|i&63)}else if(r>239&&r<365){const i=t[n++];const o=t[n++];const a=t[n++];const c=((r&7)<<18|(i&63)<<12|(o&63)<<6|a&63)-65536;e[s++]=String.fromCharCode(55296+(c>>10));e[s++]=String.fromCharCode(56320+(c&1023))}else{const i=t[n++];const o=t[n++];e[s++]=String.fromCharCode((r&15)<<12|(i&63)<<6|o&63)}}return e.join("")};const g={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZ"+"abcdefghijklmnopqrstuvwxyz"+"0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:typeof atob==="function",encodeByteArray(t,e){if(!Array.isArray(t)){throw Error("encodeByteArray takes an array as a parameter")}this.init_();const n=e?this.byteToCharMapWebSafe_:this.byteToCharMap_;const s=[];for(let e=0;e<t.length;e+=3){const r=t[e];const i=e+1<t.length;const o=i?t[e+1]:0;const a=e+2<t.length;const c=a?t[e+2]:0;const h=r>>2;const f=(r&3)<<4|o>>4;let l=(o&15)<<2|c>>6;let u=c&63;if(!a){u=64;if(!i){l=64}}s.push(n[h],n[f],n[l],n[u])}return s.join("")},encodeString(t,e){if(this.HAS_NATIVE_SUPPORT&&!e){return btoa(t)}return this.encodeByteArray(p(t),e)},decodeString(t,e){if(this.HAS_NATIVE_SUPPORT&&!e){return atob(t)}return d(this.decodeStringToByteArray(t,e))},decodeStringToByteArray(t,e){this.init_();const n=e?this.charToByteMapWebSafe_:this.charToByteMap_;const s=[];for(let e=0;e<t.length;){const r=n[t.charAt(e++)];const i=e<t.length;const o=i?n[t.charAt(e)]:0;++e;const a=e<t.length;const c=a?n[t.charAt(e)]:64;++e;const h=e<t.length;const f=h?n[t.charAt(e)]:64;++e;if(r==null||o==null||c==null||f==null){throw Error()}const l=r<<2|o>>4;s.push(l);if(c!==64){const t=o<<4&240|c>>2;s.push(t);if(f!==64){const t=c<<6&192|f;s.push(t)}}}return s},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={};this.charToByteMap_={};this.byteToCharMapWebSafe_={};this.charToByteMapWebSafe_={};for(let t=0;t<this.ENCODED_VALS.length;t++){this.byteToCharMap_[t]=this.ENCODED_VALS.charAt(t);this.charToByteMap_[this.byteToCharMap_[t]]=t;this.byteToCharMapWebSafe_[t]=this.ENCODED_VALS_WEBSAFE.charAt(t);this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[t]]=t;if(t>=this.ENCODED_VALS_BASE.length){this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(t)]=t;this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(t)]=t}}}}};const b=function(t){const e=p(t);return g.encodeByteArray(e,true)};const w=function(t){return b(t).replace(/\./g,"")};function m(){return typeof indexedDB==="object"}function y(){return new Promise(((t,e)=>{try{let n=true;const s="validate-browser-context-for-indexeddb-analytics-module";const r=self.indexedDB.open(s);r.onsuccess=()=>{r.result.close();if(!n){self.indexedDB.deleteDatabase(s)}t(true)};r.onupgradeneeded=()=>{n=false};r.onerror=()=>{var t;e(((t=r.error)===null||t===void 0?void 0:t.message)||"")}}catch(t){e(t)}}))}
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const E="FirebaseError";class v extends Error{constructor(t,e,n){super(e);this.code=t;this.customData=n;this.name=E;Object.setPrototypeOf(this,v.prototype);if(Error.captureStackTrace){Error.captureStackTrace(this,I.prototype.create)}}}class I{constructor(t,e,n){this.service=t;this.serviceName=e;this.errors=n}create(t,...e){const n=e[0]||{};const s=`${this.service}/${t}`;const r=this.errors[t];const i=r?D(r,n):"Error";const o=`${this.serviceName}: ${i} (${s}).`;const a=new v(s,o,n);return a}}function D(t,e){return t.replace($,((t,n)=>{const s=e[n];return s!=null?String(s):`<${n}?>`}))}const $=/\{\$([^}]+)}/g;function S(t,e){if(t===e){return true}const n=Object.keys(t);const s=Object.keys(e);for(const r of n){if(!s.includes(r)){return false}const n=t[r];const i=e[r];if(A(n)&&A(i)){if(!S(n,i)){return false}}else if(n!==i){return false}}for(const t of s){if(!n.includes(t)){return false}}return true}function A(t){return t!==null&&typeof t==="object"}const B=(t,e)=>e.some((e=>t instanceof e));let C;let O;function M(){return C||(C=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function N(){return O||(O=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const T=new WeakMap;const k=new WeakMap;const L=new WeakMap;const P=new WeakMap;const j=new WeakMap;function F(t){const e=new Promise(((e,n)=>{const s=()=>{t.removeEventListener("success",r);t.removeEventListener("error",i)};const r=()=>{e(W(t.result));s()};const i=()=>{n(t.error);s()};t.addEventListener("success",r);t.addEventListener("error",i)}));e.then((e=>{if(e instanceof IDBCursor){T.set(e,t)}})).catch((()=>{}));j.set(e,t);return e}function _(t){if(k.has(t))return;const e=new Promise(((e,n)=>{const s=()=>{t.removeEventListener("complete",r);t.removeEventListener("error",i);t.removeEventListener("abort",i)};const r=()=>{e();s()};const i=()=>{n(t.error||new DOMException("AbortError","AbortError"));s()};t.addEventListener("complete",r);t.addEventListener("error",i);t.addEventListener("abort",i)}));k.set(t,e)}let x={get(t,e,n){if(t instanceof IDBTransaction){if(e==="done")return k.get(t);if(e==="objectStoreNames"){return t.objectStoreNames||L.get(t)}if(e==="store"){return n.objectStoreNames[1]?undefined:n.objectStore(n.objectStoreNames[0])}}return W(t[e])},set(t,e,n){t[e]=n;return true},has(t,e){if(t instanceof IDBTransaction&&(e==="done"||e==="store")){return true}return e in t}};function R(t){x=t(x)}function H(t){if(t===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)){return function(e,...n){const s=t.call(z(this),e,...n);L.set(s,e.sort?e.sort():[e]);return W(s)}}if(N().includes(t)){return function(...e){t.apply(z(this),e);return W(T.get(this))}}return function(...e){return W(t.apply(z(this),e))}}function V(t){if(typeof t==="function")return H(t);if(t instanceof IDBTransaction)_(t);if(B(t,M()))return new Proxy(t,x);return t}function W(t){if(t instanceof IDBRequest)return F(t);if(P.has(t))return P.get(t);const e=V(t);if(e!==t){P.set(t,e);j.set(e,t)}return e}const z=t=>j.get(t);function U(t,e,{blocked:n,upgrade:s,blocking:r,terminated:i}={}){const o=indexedDB.open(t,e);const a=W(o);if(s){o.addEventListener("upgradeneeded",(t=>{s(W(o.result),t.oldVersion,t.newVersion,W(o.transaction))}))}if(n)o.addEventListener("blocked",(()=>n()));a.then((t=>{if(i)t.addEventListener("close",(()=>i()));if(r)t.addEventListener("versionchange",(()=>r()))})).catch((()=>{}));return a}const G=["get","getKey","getAll","getAllKeys","count"];const J=["put","add","delete","clear"];const K=new Map;function q(t,e){if(!(t instanceof IDBDatabase&&!(e in t)&&typeof e==="string")){return}if(K.get(e))return K.get(e);const n=e.replace(/FromIndex$/,"");const s=e!==n;const r=J.includes(n);if(!(n in(s?IDBIndex:IDBObjectStore).prototype)||!(r||G.includes(n))){return}const i=async function(t,...e){const i=this.transaction(t,r?"readwrite":"readonly");let o=i.store;if(s)o=o.index(e.shift());return(await Promise.all([o[n](...e),r&&i.done]))[0]};K.set(e,i);return i}R((t=>({...t,get:(e,n,s)=>q(e,n)||t.get(e,n,s),has:(e,n)=>!!q(e,n)||t.has(e,n)})));
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class X{constructor(t){this.container=t}getPlatformInfoString(){const t=this.container.getProviders();return t.map((t=>{if(Y(t)){const e=t.getImmediate();return`${e.library}/${e.version}`}else{return null}})).filter((t=>t)).join(" ")}}function Y(t){const e=t.getComponent();return(e===null||e===void 0?void 0:e.type)==="VERSION"}const Z="@firebase/app";const Q="0.7.29";
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const tt=new u("@firebase/app");const et="@firebase/app-compat";const nt="@firebase/analytics-compat";const st="@firebase/analytics";const rt="@firebase/app-check-compat";const it="@firebase/app-check";const ot="@firebase/auth";const at="@firebase/auth-compat";const ct="@firebase/database";const ht="@firebase/database-compat";const ft="@firebase/functions";const lt="@firebase/functions-compat";const ut="@firebase/installations";const pt="@firebase/installations-compat";const dt="@firebase/messaging";const gt="@firebase/messaging-compat";const bt="@firebase/performance";const wt="@firebase/performance-compat";const mt="@firebase/remote-config";const yt="@firebase/remote-config-compat";const Et="@firebase/storage";const vt="@firebase/storage-compat";const It="@firebase/firestore";const Dt="@firebase/firestore-compat";const $t="firebase";const St="9.9.1";
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const At="[DEFAULT]";const Bt={[Z]:"fire-core",[et]:"fire-core-compat",[st]:"fire-analytics",[nt]:"fire-analytics-compat",[it]:"fire-app-check",[rt]:"fire-app-check-compat",[ot]:"fire-auth",[at]:"fire-auth-compat",[ct]:"fire-rtdb",[ht]:"fire-rtdb-compat",[ft]:"fire-fn",[lt]:"fire-fn-compat",[ut]:"fire-iid",[pt]:"fire-iid-compat",[dt]:"fire-fcm",[gt]:"fire-fcm-compat",[bt]:"fire-perf",[wt]:"fire-perf-compat",[mt]:"fire-rc",[yt]:"fire-rc-compat",[Et]:"fire-gcs",[vt]:"fire-gcs-compat",[It]:"fire-fst",[Dt]:"fire-fst-compat","fire-js":"fire-js",[$t]:"fire-js-all"};
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const Ct=new Map;const Ot=new Map;function Mt(t,e){try{t.container.addComponent(e)}catch(n){tt.debug(`Component ${e.name} failed to register with FirebaseApp ${t.name}`,n)}}function Nt(t){const e=t.name;if(Ot.has(e)){tt.debug(`There were multiple attempts to register component ${e}.`);return false}Ot.set(e,t);for(const e of Ct.values()){Mt(e,t)}return true}function Tt(t,e){const n=t.container.getProvider("heartbeat").getImmediate({optional:true});if(n){void n.triggerHeartbeat()}return t.container.getProvider(e)}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const kt={["no-app"]:"No Firebase App '{$appName}' has been created - "+"call Firebase App.initializeApp()",["bad-app-name"]:"Illegal App name: '{$appName}",["duplicate-app"]:"Firebase App named '{$appName}' already exists with different options or config",["app-deleted"]:"Firebase App named '{$appName}' already deleted",["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.",["storage-open"]:"Error thrown when opening storage. Original error: {$originalErrorMessage}.",["storage-get"]:"Error thrown when reading from storage. Original error: {$originalErrorMessage}.",["storage-set"]:"Error thrown when writing to storage. Original error: {$originalErrorMessage}.",["storage-delete"]:"Error thrown when deleting from storage. Original error: {$originalErrorMessage}."};const Lt=new I("app","Firebase",kt);
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class Pt{constructor(t,n,s){this._isDeleted=false;this._options=Object.assign({},t);this._config=Object.assign({},n);this._name=n.name;this._automaticDataCollectionEnabled=n.automaticDataCollectionEnabled;this._container=s;this.container.addComponent(new e("app",(()=>this),"PUBLIC"))}get automaticDataCollectionEnabled(){this.checkDestroyed();return this._automaticDataCollectionEnabled}set automaticDataCollectionEnabled(t){this.checkDestroyed();this._automaticDataCollectionEnabled=t}get name(){this.checkDestroyed();return this._name}get options(){this.checkDestroyed();return this._options}get config(){this.checkDestroyed();return this._config}get container(){return this._container}get isDeleted(){return this._isDeleted}set isDeleted(t){this._isDeleted=t}checkDestroyed(){if(this.isDeleted){throw Lt.create("app-deleted",{appName:this._name})}}}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const jt=St;function Ft(t,e={}){if(typeof e!=="object"){const t=e;e={name:t}}const n=Object.assign({name:At,automaticDataCollectionEnabled:false},e);const s=n.name;if(typeof s!=="string"||!s){throw Lt.create("bad-app-name",{appName:String(s)})}const r=Ct.get(s);if(r){if(S(t,r.options)&&S(n,r.config)){return r}else{throw Lt.create("duplicate-app",{appName:s})}}const i=new o(s);for(const t of Ot.values()){i.addComponent(t)}const a=new Pt(t,n,i);Ct.set(s,a);return a}function _t(t=At){const e=Ct.get(t);if(!e){throw Lt.create("no-app",{appName:t})}return e}function xt(t,n,s){var r;let i=(r=Bt[t])!==null&&r!==void 0?r:t;if(s){i+=`-${s}`}const o=i.match(/\s|\//);const a=n.match(/\s|\//);if(o||a){const t=[`Unable to register library "${i}" with version "${n}":`];if(o){t.push(`library name "${i}" contains illegal characters (whitespace or "/")`)}if(o&&a){t.push("and")}if(a){t.push(`version name "${n}" contains illegal characters (whitespace or "/")`)}tt.warn(t.join(" "));return}Nt(new e(`${i}-version`,(()=>({library:i,version:n})),"VERSION"))}
/**
 * @license
 * Copyright 2021 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const Rt="firebase-heartbeat-database";const Ht=1;const Vt="firebase-heartbeat-store";let Wt=null;function zt(){if(!Wt){Wt=U(Rt,Ht,{upgrade:(t,e)=>{switch(e){case 0:t.createObjectStore(Vt)}}}).catch((t=>{throw Lt.create("storage-open",{originalErrorMessage:t.message})}))}return Wt}async function Ut(t){var e;try{const e=await zt();return e.transaction(Vt).objectStore(Vt).get(Jt(t))}catch(t){throw Lt.create("storage-get",{originalErrorMessage:(e=t)===null||e===void 0?void 0:e.message})}}async function Gt(t,e){var n;try{const n=await zt();const s=n.transaction(Vt,"readwrite");const r=s.objectStore(Vt);await r.put(e,Jt(t));return s.done}catch(t){throw Lt.create("storage-set",{originalErrorMessage:(n=t)===null||n===void 0?void 0:n.message})}}function Jt(t){return`${t.name}!${t.options.appId}`}
/**
 * @license
 * Copyright 2021 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const Kt=1024;const qt=30*24*60*60*1e3;class Xt{constructor(t){this.container=t;this._heartbeatsCache=null;const e=this.container.getProvider("app").getImmediate();this._storage=new Qt(e);this._heartbeatsCachePromise=this._storage.read().then((t=>{this._heartbeatsCache=t;return t}))}async triggerHeartbeat(){const t=this.container.getProvider("platform-logger").getImmediate();const e=t.getPlatformInfoString();const n=Yt();if(this._heartbeatsCache===null){this._heartbeatsCache=await this._heartbeatsCachePromise}if(this._heartbeatsCache.lastSentHeartbeatDate===n||this._heartbeatsCache.heartbeats.some((t=>t.date===n))){return}else{this._heartbeatsCache.heartbeats.push({date:n,agent:e})}this._heartbeatsCache.heartbeats=this._heartbeatsCache.heartbeats.filter((t=>{const e=new Date(t.date).valueOf();const n=Date.now();return n-e<=qt}));return this._storage.overwrite(this._heartbeatsCache)}async getHeartbeatsHeader(){if(this._heartbeatsCache===null){await this._heartbeatsCachePromise}if(this._heartbeatsCache===null||this._heartbeatsCache.heartbeats.length===0){return""}const t=Yt();const{heartbeatsToSend:e,unsentEntries:n}=Zt(this._heartbeatsCache.heartbeats);const s=w(JSON.stringify({version:2,heartbeats:e}));this._heartbeatsCache.lastSentHeartbeatDate=t;if(n.length>0){this._heartbeatsCache.heartbeats=n;await this._storage.overwrite(this._heartbeatsCache)}else{this._heartbeatsCache.heartbeats=[];void this._storage.overwrite(this._heartbeatsCache)}return s}}function Yt(){const t=new Date;return t.toISOString().substring(0,10)}function Zt(t,e=Kt){const n=[];let s=t.slice();for(const r of t){const t=n.find((t=>t.agent===r.agent));if(!t){n.push({agent:r.agent,dates:[r.date]});if(te(n)>e){n.pop();break}}else{t.dates.push(r.date);if(te(n)>e){t.dates.pop();break}}s=s.slice(1)}return{heartbeatsToSend:n,unsentEntries:s}}class Qt{constructor(t){this.app=t;this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){if(!m()){return false}else{return y().then((()=>true)).catch((()=>false))}}async read(){const t=await this._canUseIndexedDBPromise;if(!t){return{heartbeats:[]}}else{const t=await Ut(this.app);return t||{heartbeats:[]}}}async overwrite(t){var e;const n=await this._canUseIndexedDBPromise;if(!n){return}else{const n=await this.read();return Gt(this.app,{lastSentHeartbeatDate:(e=t.lastSentHeartbeatDate)!==null&&e!==void 0?e:n.lastSentHeartbeatDate,heartbeats:t.heartbeats})}}async add(t){var e;const n=await this._canUseIndexedDBPromise;if(!n){return}else{const n=await this.read();return Gt(this.app,{lastSentHeartbeatDate:(e=t.lastSentHeartbeatDate)!==null&&e!==void 0?e:n.lastSentHeartbeatDate,heartbeats:[...n.heartbeats,...t.heartbeats]})}}}function te(t){return w(JSON.stringify({version:2,heartbeats:t})).length}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function ee(t){Nt(new e("platform-logger",(t=>new X(t)),"PRIVATE"));Nt(new e("heartbeat",(t=>new Xt(t)),"PRIVATE"));xt(Z,Q,t);xt(Z,Q,"esm2017");xt("fire-js","")}ee("");export{e as C,a as L,jt as S,Nt as _,Tt as a,u as b,_t as g,Ft as i,xt as r};
//# sourceMappingURL=p-38dfe2d0.js.map