firebase 9.17.2 → 9.18.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 (41) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/app/dist/esm/index.esm.js +1 -1
  3. package/app/dist/index.cjs.js +1 -1
  4. package/app/dist/index.mjs +1 -1
  5. package/compat/app/dist/esm/index.esm.js +1 -1
  6. package/compat/app/dist/index.cjs.js +1 -1
  7. package/compat/app/dist/index.mjs +1 -1
  8. package/compat/dist/esm/index.esm.js +2 -2
  9. package/compat/dist/index.node.cjs +2 -2
  10. package/compat/dist/index.rn.cjs.js +2 -2
  11. package/firebase-analytics.js +1 -1
  12. package/firebase-app-check.js +1 -1
  13. package/firebase-app-compat.js +2 -2
  14. package/firebase-app.js +5 -5
  15. package/firebase-auth-compat.js +1 -1
  16. package/firebase-auth-compat.js.map +1 -1
  17. package/firebase-auth-cordova.js +1 -1
  18. package/firebase-auth-cordova.js.map +1 -1
  19. package/firebase-auth-react-native.js +1 -1
  20. package/firebase-auth-react-native.js.map +1 -1
  21. package/firebase-auth.js +1 -1
  22. package/firebase-auth.js.map +1 -1
  23. package/firebase-compat.js +4 -4
  24. package/firebase-compat.js.map +1 -1
  25. package/firebase-database.js +1 -1
  26. package/firebase-firestore-compat.js +1 -1
  27. package/firebase-firestore-compat.js.map +1 -1
  28. package/firebase-firestore-lite.js +1 -1
  29. package/firebase-firestore-lite.js.map +1 -1
  30. package/firebase-firestore.js +1 -1
  31. package/firebase-firestore.js.map +1 -1
  32. package/firebase-functions.js +1 -1
  33. package/firebase-installations.js +1 -1
  34. package/firebase-messaging-sw.js +1 -1
  35. package/firebase-messaging.js +1 -1
  36. package/firebase-performance-standalone-compat.es2017.js +5 -5
  37. package/firebase-performance-standalone-compat.js +1 -1
  38. package/firebase-performance.js +1 -1
  39. package/firebase-remote-config.js +1 -1
  40. package/firebase-storage.js +1 -1
  41. package/package.json +7 -7
package/CHANGELOG.md CHANGED
@@ -1,5 +1,25 @@
1
1
  # firebase
2
2
 
3
+ ## 9.18.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`5ba524313`](https://github.com/firebase/firebase-js-sdk/commit/5ba524313bdeddb012c44b1b1161c9229396b195) [#7053](https://github.com/firebase/firebase-js-sdk/pull/7053) - Add support for disjunctions in queries (OR queries).
8
+
9
+ ### Patch Changes
10
+
11
+ - [`e2bf2eca2`](https://github.com/firebase/firebase-js-sdk/commit/e2bf2eca21308670c73d6c642a88c06f0b87d44a) [#7076](https://github.com/firebase/firebase-js-sdk/pull/7076) - Improved debug logging of networking abstractions
12
+
13
+ - [`5099f0f60`](https://github.com/firebase/firebase-js-sdk/commit/5099f0f60a5198b48942e8b2a574505432bdc213) [#6899](https://github.com/firebase/firebase-js-sdk/pull/6899) (fixes [#6509](https://github.com/firebase/firebase-js-sdk/issues/6509)) - Check navigator.userAgent, in addition to navigator.appVersion, when determining whether to work around an IndexedDb bug in Safari.
14
+
15
+ - Updated dependencies [[`e2bf2eca2`](https://github.com/firebase/firebase-js-sdk/commit/e2bf2eca21308670c73d6c642a88c06f0b87d44a), [`5099f0f60`](https://github.com/firebase/firebase-js-sdk/commit/5099f0f60a5198b48942e8b2a574505432bdc213), [`e0b677e70`](https://github.com/firebase/firebase-js-sdk/commit/e0b677e70ed2fd9e488737c77ebe2fc65d3a0822), [`5ba524313`](https://github.com/firebase/firebase-js-sdk/commit/5ba524313bdeddb012c44b1b1161c9229396b195)]:
16
+ - @firebase/firestore@3.9.0
17
+ - @firebase/app@0.9.5
18
+ - @firebase/auth@0.21.5
19
+ - @firebase/firestore-compat@0.3.5
20
+ - @firebase/app-compat@0.2.5
21
+ - @firebase/auth-compat@0.3.5
22
+
3
23
  ## 9.17.2
4
24
 
5
25
  ### Patch Changes
@@ -2,7 +2,7 @@ import { registerVersion } from '@firebase/app';
2
2
  export * from '@firebase/app';
3
3
 
4
4
  var name = "firebase";
5
- var version = "9.17.2";
5
+ var version = "9.18.0";
6
6
 
7
7
  /**
8
8
  * @license
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var app = require('@firebase/app');
6
6
 
7
7
  var name = "firebase";
8
- var version = "9.17.2";
8
+ var version = "9.18.0";
9
9
 
10
10
  /**
11
11
  * @license
@@ -2,7 +2,7 @@ import { registerVersion } from '@firebase/app';
2
2
  export * from '@firebase/app';
3
3
 
4
4
  var name = "firebase";
5
- var version = "9.17.2";
5
+ var version = "9.18.0";
6
6
 
7
7
  /**
8
8
  * @license
@@ -2,7 +2,7 @@ import firebase from '@firebase/app-compat';
2
2
  export { default } from '@firebase/app-compat';
3
3
 
4
4
  var name = "firebase";
5
- var version = "9.17.2";
5
+ var version = "9.18.0";
6
6
 
7
7
  /**
8
8
  * @license
@@ -7,7 +7,7 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
7
7
  var firebase__default = /*#__PURE__*/_interopDefaultLegacy(firebase);
8
8
 
9
9
  var name = "firebase";
10
- var version = "9.17.2";
10
+ var version = "9.18.0";
11
11
 
12
12
  /**
13
13
  * @license
@@ -2,7 +2,7 @@ import firebase from '@firebase/app-compat';
2
2
  export { default } from '@firebase/app-compat';
3
3
 
4
4
  var name = "firebase";
5
- var version = "9.17.2";
5
+ var version = "9.18.0";
6
6
 
7
7
  /**
8
8
  * @license
@@ -12,7 +12,7 @@ import '@firebase/performance-compat';
12
12
  import '@firebase/remote-config-compat';
13
13
 
14
14
  var name$1 = "firebase";
15
- var version$1 = "9.17.2";
15
+ var version$1 = "9.18.0";
16
16
 
17
17
  /**
18
18
  * @license
@@ -33,7 +33,7 @@ var version$1 = "9.17.2";
33
33
  firebase.registerVersion(name$1, version$1, 'app-compat');
34
34
 
35
35
  var name = "firebase";
36
- var version = "9.17.2";
36
+ var version = "9.18.0";
37
37
 
38
38
  /**
39
39
  * @license
@@ -12,7 +12,7 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
12
12
  var firebase__default = /*#__PURE__*/_interopDefaultLegacy(firebase);
13
13
 
14
14
  var name$1 = "firebase";
15
- var version$1 = "9.17.2";
15
+ var version$1 = "9.18.0";
16
16
 
17
17
  /**
18
18
  * @license
@@ -33,7 +33,7 @@ var version$1 = "9.17.2";
33
33
  firebase__default["default"].registerVersion(name$1, version$1, 'app-compat');
34
34
 
35
35
  var name = "firebase";
36
- var version = "9.17.2";
36
+ var version = "9.18.0";
37
37
 
38
38
  /**
39
39
  * @license
@@ -10,7 +10,7 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
10
10
  var firebase__default = /*#__PURE__*/_interopDefaultLegacy(firebase);
11
11
 
12
12
  var name$1 = "firebase";
13
- var version$1 = "9.17.2";
13
+ var version$1 = "9.18.0";
14
14
 
15
15
  /**
16
16
  * @license
@@ -31,7 +31,7 @@ var version$1 = "9.17.2";
31
31
  firebase__default["default"].registerVersion(name$1, version$1, 'app-compat');
32
32
 
33
33
  var name = "firebase";
34
- var version = "9.17.2";
34
+ var version = "9.18.0";
35
35
 
36
36
  /**
37
37
  * @license
@@ -1,3 +1,3 @@
1
- import{registerVersion as e,_registerComponent as t,_getProvider as n,getApp as a}from"https://www.gstatic.com/firebasejs/9.17.2/firebase-app.js";var i;!function(e){e[e.DEBUG=0]="DEBUG",e[e.VERBOSE=1]="VERBOSE",e[e.INFO=2]="INFO",e[e.WARN=3]="WARN",e[e.ERROR=4]="ERROR",e[e.SILENT=5]="SILENT"}(i||(i={}));const r={debug:i.DEBUG,verbose:i.VERBOSE,info:i.INFO,warn:i.WARN,error:i.ERROR,silent:i.SILENT},o=i.INFO,s={[i.DEBUG]:"log",[i.VERBOSE]:"log",[i.INFO]:"info",[i.WARN]:"warn",[i.ERROR]:"error"},c=(e,t,...n)=>{if(t<e.logLevel)return;const a=(new Date).toISOString(),i=s[t];if(!i)throw new Error(`Attempted to log a message with an invalid logType (value: ${t})`);console[i](`[${a}] ${e.name}:`,...n)};function u(){const e="object"==typeof chrome?chrome.runtime:"object"==typeof browser?browser.runtime:void 0;return"object"==typeof e&&void 0!==e.id}function l(){try{return"object"==typeof indexedDB}catch(e){return!1}}function d(){return new Promise(((e,t)=>{try{let n=!0;const a="validate-browser-context-for-indexeddb-analytics-module",i=self.indexedDB.open(a);i.onsuccess=()=>{i.result.close(),n||self.indexedDB.deleteDatabase(a),e(!0)},i.onupgradeneeded=()=>{n=!1},i.onerror=()=>{var e;t((null===(e=i.error)||void 0===e?void 0:e.message)||"")}}catch(e){t(e)}}))}function f(){return!("undefined"==typeof navigator||!navigator.cookieEnabled)}class p extends Error{constructor(e,t,n){super(t),this.code=e,this.customData=n,this.name="FirebaseError",Object.setPrototypeOf(this,p.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,h.prototype.create)}}class h{constructor(e,t,n){this.service=e,this.serviceName=t,this.errors=n}create(e,...t){const n=t[0]||{},a=`${this.service}/${e}`,i=this.errors[e],r=i?function(e,t){return e.replace(g,((e,n)=>{const a=t[n];return null!=a?String(a):`<${n}?>`}))}(i,n):"Error",o=`${this.serviceName}: ${r} (${a}).`;return new p(a,o,n)}}const g=/\{\$([^}]+)}/g;function m(e,t){if(e===t)return!0;const n=Object.keys(e),a=Object.keys(t);for(const i of n){if(!a.includes(i))return!1;const n=e[i],r=t[i];if(w(n)&&w(r)){if(!m(n,r))return!1}else if(n!==r)return!1}for(const e of a)if(!n.includes(e))return!1;return!0}function w(e){return null!==e&&"object"==typeof e}function y(e,t=1e3,n=2){const a=t*Math.pow(n,e),i=Math.round(.5*a*(Math.random()-.5)*2);return Math.min(144e5,a+i)}function v(e){return e&&e._delegate?e._delegate:e}class I{constructor(e,t,n){this.name=e,this.instanceFactory=t,this.type=n,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}}let b,E;const T=new WeakMap,D=new WeakMap,S=new WeakMap,k=new WeakMap,C=new WeakMap;let L={get(e,t,n){if(e instanceof IDBTransaction){if("done"===t)return D.get(e);if("objectStoreNames"===t)return e.objectStoreNames||S.get(e);if("store"===t)return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return $(e[t])},set:(e,t,n)=>(e[t]=n,!0),has:(e,t)=>e instanceof IDBTransaction&&("done"===t||"store"===t)||t in e};function j(e){return e!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(E||(E=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(e)?function(...t){return e.apply(P(this),t),$(T.get(this))}:function(...t){return $(e.apply(P(this),t))}:function(t,...n){const a=e.call(P(this),t,...n);return S.set(a,t.sort?t.sort():[t]),$(a)}}function O(e){return"function"==typeof e?j(e):(e instanceof IDBTransaction&&function(e){if(D.has(e))return;const t=new Promise(((t,n)=>{const a=()=>{e.removeEventListener("complete",i),e.removeEventListener("error",r),e.removeEventListener("abort",r)},i=()=>{t(),a()},r=()=>{n(e.error||new DOMException("AbortError","AbortError")),a()};e.addEventListener("complete",i),e.addEventListener("error",r),e.addEventListener("abort",r)}));D.set(e,t)}(e),t=e,(b||(b=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])).some((e=>t instanceof e))?new Proxy(e,L):e);var t}function $(e){if(e instanceof IDBRequest)return function(e){const t=new Promise(((t,n)=>{const a=()=>{e.removeEventListener("success",i),e.removeEventListener("error",r)},i=()=>{t($(e.result)),a()},r=()=>{n(e.error),a()};e.addEventListener("success",i),e.addEventListener("error",r)}));return t.then((t=>{t instanceof IDBCursor&&T.set(t,e)})).catch((()=>{})),C.set(t,e),t}(e);if(k.has(e))return k.get(e);const t=O(e);return t!==e&&(k.set(e,t),C.set(t,e)),t}const P=e=>C.get(e);const M=["get","getKey","getAll","getAllKeys","count"],_=["put","add","delete","clear"],A=new Map;function B(e,t){if(!(e instanceof IDBDatabase)||t in e||"string"!=typeof t)return;if(A.get(t))return A.get(t);const n=t.replace(/FromIndex$/,""),a=t!==n,i=_.includes(n);if(!(n in(a?IDBIndex:IDBObjectStore).prototype)||!i&&!M.includes(n))return;const r=async function(e,...t){const r=this.transaction(e,i?"readwrite":"readonly");let o=r.store;return a&&(o=o.index(t.shift())),(await Promise.all([o[n](...t),i&&r.done]))[0]};return A.set(t,r),r}L=(e=>({...e,get:(t,n,a)=>B(t,n)||e.get(t,n,a),has:(t,n)=>!!B(t,n)||e.has(t,n)}))(L);const N="@firebase/installations",F=new h("installations","Installations",{"missing-app-config-values":'Missing App configuration value: "{$valueName}"',"not-registered":"Firebase Installation is not registered.","installation-not-found":"Firebase Installation not found.","request-failed":'{$requestName} request failed with error "{$serverCode} {$serverStatus}: {$serverMessage}"',"app-offline":"Could not process request. Application offline.","delete-pending-registration":"Can't delete installation while there is a pending registration request."});function x(e){return e instanceof p&&e.code.includes("request-failed")}function R({projectId:e}){return`https://firebaseinstallations.googleapis.com/v1/projects/${e}/installations`}function H(e){return{token:e.token,requestStatus:2,expiresIn:(t=e.expiresIn,Number(t.replace("s","000"))),creationTime:Date.now()};var t}async function q(e,t){const n=(await t.json()).error;return F.create("request-failed",{requestName:e,serverCode:n.code,serverMessage:n.message,serverStatus:n.status})}function z({apiKey:e}){return new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":e})}function V(e,{refreshToken:t}){const n=z(e);return n.append("Authorization",function(e){return`FIS_v2 ${e}`}(t)),n}async function K(e){const t=await e();return t.status>=500&&t.status<600?e():t}function W(e){return new Promise((t=>{setTimeout(t,e)}))}const G=/^[cdef][\w-]{21}$/;function U(){try{const e=new Uint8Array(17);(self.crypto||self.msCrypto).getRandomValues(e),e[0]=112+e[0]%16;const t=function(e){return(t=e,btoa(String.fromCharCode(...t)).replace(/\+/g,"-").replace(/\//g,"_")).substr(0,22);var t}(e);return G.test(t)?t:""}catch(e){return""}}function J(e){return`${e.appName}!${e.appId}`}const Y=new Map;function Z(e,t){const n=J(e);Q(n,t),function(e,t){const n=function(){!X&&"BroadcastChannel"in self&&(X=new BroadcastChannel("[Firebase] FID Change"),X.onmessage=e=>{Q(e.data.key,e.data.fid)});return X}();n&&n.postMessage({key:e,fid:t});0===Y.size&&X&&(X.close(),X=null)}(n,t)}function Q(e,t){const n=Y.get(e);if(n)for(const e of n)e(t)}let X=null;const ee="firebase-installations-store";let te=null;function ne(){return te||(te=function(e,t,{blocked:n,upgrade:a,blocking:i,terminated:r}={}){const o=indexedDB.open(e,t),s=$(o);return a&&o.addEventListener("upgradeneeded",(e=>{a($(o.result),e.oldVersion,e.newVersion,$(o.transaction))})),n&&o.addEventListener("blocked",(()=>n())),s.then((e=>{r&&e.addEventListener("close",(()=>r())),i&&e.addEventListener("versionchange",(()=>i()))})).catch((()=>{})),s}("firebase-installations-database",1,{upgrade:(e,t)=>{if(0===t)e.createObjectStore(ee)}})),te}async function ae(e,t){const n=J(e),a=(await ne()).transaction(ee,"readwrite"),i=a.objectStore(ee),r=await i.get(n);return await i.put(t,n),await a.done,r&&r.fid===t.fid||Z(e,t.fid),t}async function ie(e){const t=J(e),n=(await ne()).transaction(ee,"readwrite");await n.objectStore(ee).delete(t),await n.done}async function re(e,t){const n=J(e),a=(await ne()).transaction(ee,"readwrite"),i=a.objectStore(ee),r=await i.get(n),o=t(r);return void 0===o?await i.delete(n):await i.put(o,n),await a.done,!o||r&&r.fid===o.fid||Z(e,o.fid),o}async function oe(e){let t;const n=await re(e.appConfig,(n=>{const a=function(e){return ue(e||{fid:U(),registrationStatus:0})}(n),i=function(e,t){if(0===t.registrationStatus){if(!navigator.onLine){return{installationEntry:t,registrationPromise:Promise.reject(F.create("app-offline"))}}const n={fid:t.fid,registrationStatus:1,registrationTime:Date.now()},a=async function(e,t){try{const n=await async function({appConfig:e,heartbeatServiceProvider:t},{fid:n}){const a=R(e),i=z(e),r=t.getImmediate({optional:!0});if(r){const e=await r.getHeartbeatsHeader();e&&i.append("x-firebase-client",e)}const o={fid:n,authVersion:"FIS_v2",appId:e.appId,sdkVersion:"w:0.6.4"},s={method:"POST",headers:i,body:JSON.stringify(o)},c=await K((()=>fetch(a,s)));if(c.ok){const e=await c.json();return{fid:e.fid||n,registrationStatus:2,refreshToken:e.refreshToken,authToken:H(e.authToken)}}throw await q("Create Installation",c)}(e,t);return ae(e.appConfig,n)}catch(n){throw x(n)&&409===n.customData.serverCode?await ie(e.appConfig):await ae(e.appConfig,{fid:t.fid,registrationStatus:0}),n}}(e,n);return{installationEntry:n,registrationPromise:a}}return 1===t.registrationStatus?{installationEntry:t,registrationPromise:se(e)}:{installationEntry:t}}(e,a);return t=i.registrationPromise,i.installationEntry}));return""===n.fid?{installationEntry:await t}:{installationEntry:n,registrationPromise:t}}async function se(e){let t=await ce(e.appConfig);for(;1===t.registrationStatus;)await W(100),t=await ce(e.appConfig);if(0===t.registrationStatus){const{installationEntry:t,registrationPromise:n}=await oe(e);return n||t}return t}function ce(e){return re(e,(e=>{if(!e)throw F.create("installation-not-found");return ue(e)}))}function ue(e){return 1===(t=e).registrationStatus&&t.registrationTime+1e4<Date.now()?{fid:e.fid,registrationStatus:0}:e;var t}async function le({appConfig:e,heartbeatServiceProvider:t},n){const a=function(e,{fid:t}){return`${R(e)}/${t}/authTokens:generate`}(e,n),i=V(e,n),r=t.getImmediate({optional:!0});if(r){const e=await r.getHeartbeatsHeader();e&&i.append("x-firebase-client",e)}const o={installation:{sdkVersion:"w:0.6.4",appId:e.appId}},s={method:"POST",headers:i,body:JSON.stringify(o)},c=await K((()=>fetch(a,s)));if(c.ok){return H(await c.json())}throw await q("Generate Auth Token",c)}async function de(e,t=!1){let n;const a=await re(e.appConfig,(a=>{if(!pe(a))throw F.create("not-registered");const i=a.authToken;if(!t&&function(e){return 2===e.requestStatus&&!function(e){const t=Date.now();return t<e.creationTime||e.creationTime+e.expiresIn<t+36e5}(e)}(i))return a;if(1===i.requestStatus)return n=async function(e,t){let n=await fe(e.appConfig);for(;1===n.authToken.requestStatus;)await W(100),n=await fe(e.appConfig);const a=n.authToken;return 0===a.requestStatus?de(e,t):a}(e,t),a;{if(!navigator.onLine)throw F.create("app-offline");const t=function(e){const t={requestStatus:1,requestTime:Date.now()};return Object.assign(Object.assign({},e),{authToken:t})}(a);return n=async function(e,t){try{const n=await le(e,t),a=Object.assign(Object.assign({},t),{authToken:n});return await ae(e.appConfig,a),n}catch(n){if(!x(n)||401!==n.customData.serverCode&&404!==n.customData.serverCode){const n=Object.assign(Object.assign({},t),{authToken:{requestStatus:0}});await ae(e.appConfig,n)}else await ie(e.appConfig);throw n}}(e,t),t}}));return n?await n:a.authToken}function fe(e){return re(e,(e=>{if(!pe(e))throw F.create("not-registered");const t=e.authToken;return 1===(n=t).requestStatus&&n.requestTime+1e4<Date.now()?Object.assign(Object.assign({},e),{authToken:{requestStatus:0}}):e;var n}))}function pe(e){return void 0!==e&&2===e.registrationStatus}async function he(e,t=!1){const n=e;await async function(e){const{registrationPromise:t}=await oe(e);t&&await t}(n);return(await de(n,t)).token}function ge(e){return F.create("missing-app-config-values",{valueName:e})}const me=e=>{const t=e.getProvider("app").getImmediate(),a=n(t,"installations").getImmediate();return{getId:()=>async function(e){const t=e,{installationEntry:n,registrationPromise:a}=await oe(t);return a?a.catch(console.error):de(t).catch(console.error),n.fid}(a),getToken:e=>he(a,e)}};t(new I("installations",(e=>{const t=e.getProvider("app").getImmediate(),a=function(e){if(!e||!e.options)throw ge("App Configuration");if(!e.name)throw ge("App Name");const t=["projectId","apiKey","appId"];for(const n of t)if(!e.options[n])throw ge(n);return{appName:e.name,projectId:e.options.projectId,apiKey:e.options.apiKey,appId:e.options.appId}}(t);return{app:t,appConfig:a,heartbeatServiceProvider:n(t,"heartbeat"),_delete:()=>Promise.resolve()}}),"PUBLIC")),t(new I("installations-internal",me,"PRIVATE")),e(N,"0.6.4"),e(N,"0.6.4","esm2017");const we="https://www.googletagmanager.com/gtag/js",ye=new class{constructor(e){this.name=e,this._logLevel=o,this._logHandler=c,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in i))throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel="string"==typeof e?r[e]:e}get logHandler(){return this._logHandler}set logHandler(e){if("function"!=typeof e)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,i.DEBUG,...e),this._logHandler(this,i.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,i.VERBOSE,...e),this._logHandler(this,i.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,i.INFO,...e),this._logHandler(this,i.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,i.WARN,...e),this._logHandler(this,i.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,i.ERROR,...e),this._logHandler(this,i.ERROR,...e)}}("@firebase/analytics");function ve(e){return Promise.all(e.map((e=>e.catch((e=>e)))))}function Ie(e,t,n,a){return async function(i,r,o){try{"event"===i?await async function(e,t,n,a,i){try{let r=[];if(i&&i.send_to){let e=i.send_to;Array.isArray(e)||(e=[e]);const a=await ve(n);for(const n of e){const e=a.find((e=>e.measurementId===n)),i=e&&t[e.appId];if(!i){r=[];break}r.push(i)}}0===r.length&&(r=Object.values(t)),await Promise.all(r),e("event",a,i||{})}catch(e){ye.error(e)}}(e,t,n,r,o):"config"===i?await async function(e,t,n,a,i,r){const o=a[i];try{if(o)await t[o];else{const e=(await ve(n)).find((e=>e.measurementId===i));e&&await t[e.appId]}}catch(e){ye.error(e)}e("config",i,r)}(e,t,n,a,r,o):"consent"===i?e("consent","update",o):e("set",r)}catch(e){ye.error(e)}}}const be=new h("analytics","Analytics",{"already-exists":"A Firebase Analytics instance with the appId {$id} already exists. Only one Firebase Analytics instance can be created for each appId.","already-initialized":"initializeAnalytics() cannot be called again with different options than those it was initially called with. It can be called again with the same options to return the existing instance, or getAnalytics() can be used to get a reference to the already-intialized instance.","already-initialized-settings":"Firebase Analytics has already been initialized.settings() must be called before initializing any Analytics instanceor it will have no effect.","interop-component-reg-failed":"Firebase Analytics Interop Component failed to instantiate: {$reason}","invalid-analytics-context":"Firebase Analytics is not supported in this environment. Wrap initialization of analytics in analytics.isSupported() to prevent initialization in unsupported environments. Details: {$errorInfo}","indexeddb-unavailable":"IndexedDB unavailable or restricted in this environment. Wrap initialization of analytics in analytics.isSupported() to prevent initialization in unsupported environments. Details: {$errorInfo}","fetch-throttle":"The config fetch request timed out while in an exponential backoff state. Unix timestamp in milliseconds when fetch request throttling ends: {$throttleEndTimeMillis}.","config-fetch-failed":"Dynamic config fetch failed: [{$httpStatus}] {$responseMessage}","no-api-key":'The "apiKey" field is empty in the local Firebase config. Firebase Analytics requires this field tocontain a valid API key.',"no-app-id":'The "appId" field is empty in the local Firebase config. Firebase Analytics requires this field tocontain a valid app ID.'});const Ee=new class{constructor(e={},t=1e3){this.throttleMetadata=e,this.intervalMillis=t}getThrottleMetadata(e){return this.throttleMetadata[e]}setThrottleMetadata(e,t){this.throttleMetadata[e]=t}deleteThrottleMetadata(e){delete this.throttleMetadata[e]}};function Te(e){return new Headers({Accept:"application/json","x-goog-api-key":e})}async function De(e,t=Ee,n){const{appId:a,apiKey:i,measurementId:r}=e.options;if(!a)throw be.create("no-app-id");if(!i){if(r)return{measurementId:r,appId:a};throw be.create("no-api-key")}const o=t.getThrottleMetadata(a)||{backoffCount:0,throttleEndTimeMillis:Date.now()},s=new ke;return setTimeout((async()=>{s.abort()}),void 0!==n?n:6e4),Se({appId:a,apiKey:i,measurementId:r},o,s,t)}async function Se(e,{throttleEndTimeMillis:t,backoffCount:n},a,i=Ee){var r;const{appId:o,measurementId:s}=e;try{await function(e,t){return new Promise(((n,a)=>{const i=Math.max(t-Date.now(),0),r=setTimeout(n,i);e.addEventListener((()=>{clearTimeout(r),a(be.create("fetch-throttle",{throttleEndTimeMillis:t}))}))}))}(a,t)}catch(e){if(s)return ye.warn(`Timed out fetching this Firebase app's measurement ID from the server. Falling back to the measurement ID ${s} provided in the "measurementId" field in the local Firebase config. [${null==e?void 0:e.message}]`),{appId:o,measurementId:s};throw e}try{const t=await async function(e){var t;const{appId:n,apiKey:a}=e,i={method:"GET",headers:Te(a)},r="https://firebase.googleapis.com/v1alpha/projects/-/apps/{app-id}/webConfig".replace("{app-id}",n),o=await fetch(r,i);if(200!==o.status&&304!==o.status){let e="";try{const n=await o.json();(null===(t=n.error)||void 0===t?void 0:t.message)&&(e=n.error.message)}catch(e){}throw be.create("config-fetch-failed",{httpStatus:o.status,responseMessage:e})}return o.json()}(e);return i.deleteThrottleMetadata(o),t}catch(t){const c=t;if(!function(e){if(!(e instanceof p&&e.customData))return!1;const t=Number(e.customData.httpStatus);return 429===t||500===t||503===t||504===t}(c)){if(i.deleteThrottleMetadata(o),s)return ye.warn(`Failed to fetch this Firebase app's measurement ID from the server. Falling back to the measurement ID ${s} provided in the "measurementId" field in the local Firebase config. [${null==c?void 0:c.message}]`),{appId:o,measurementId:s};throw t}const u=503===Number(null===(r=null==c?void 0:c.customData)||void 0===r?void 0:r.httpStatus)?y(n,i.intervalMillis,30):y(n,i.intervalMillis),l={throttleEndTimeMillis:Date.now()+u,backoffCount:n+1};return i.setThrottleMetadata(o,l),ye.debug(`Calling attemptFetch again in ${u} millis`),Se(e,l,a,i)}}class ke{constructor(){this.listeners=[]}addEventListener(e){this.listeners.push(e)}abort(){this.listeners.forEach((e=>e()))}}let Ce,Le;function je(e){Le=e}function Oe(e){Ce=e}async function $e(e,t,n,a,i,r,o){var s;const c=De(e);c.then((t=>{n[t.measurementId]=t.appId,e.options.measurementId&&t.measurementId!==e.options.measurementId&&ye.warn(`The measurement ID in the local Firebase config (${e.options.measurementId}) does not match the measurement ID fetched from the server (${t.measurementId}). To ensure analytics events are always sent to the correct Analytics property, update the measurement ID field in the local config or remove it from the local config.`)})).catch((e=>ye.error(e))),t.push(c);const u=async function(){if(!l())return ye.warn(be.create("indexeddb-unavailable",{errorInfo:"IndexedDB is not available in this environment."}).message),!1;try{await d()}catch(e){return ye.warn(be.create("indexeddb-unavailable",{errorInfo:null==e?void 0:e.toString()}).message),!1}return!0}().then((e=>e?a.getId():void 0)),[f,p]=await Promise.all([c,u]);(function(e){const t=window.document.getElementsByTagName("script");for(const n of Object.values(t))if(n.src&&n.src.includes(we)&&n.src.includes(e))return n;return null})(r)||function(e,t){const n=document.createElement("script");n.src=`${we}?l=${e}&id=${t}`,n.async=!0,document.head.appendChild(n)}(r,f.measurementId),Le&&(i("consent","default",Le),je(void 0)),i("js",new Date);const h=null!==(s=null==o?void 0:o.config)&&void 0!==s?s:{};return h.origin="firebase",h.update=!0,null!=p&&(h.firebase_id=p),i("config",f.measurementId,h),Ce&&(i("set",Ce),Oe(void 0)),f.measurementId}class Pe{constructor(e){this.app=e}_delete(){return delete Me[this.app.options.appId],Promise.resolve()}}let Me={},_e=[];const Ae={};let Be,Ne,Fe="dataLayer",xe="gtag",Re=!1;function He(e){if(Re)throw be.create("already-initialized");e.dataLayerName&&(Fe=e.dataLayerName),e.gtagName&&(xe=e.gtagName)}function qe(e,t,n){!function(){const e=[];if(u()&&e.push("This is a browser extension environment."),f()||e.push("Cookies are not available."),e.length>0){const t=e.map(((e,t)=>`(${t+1}) ${e}`)).join(" "),n=be.create("invalid-analytics-context",{errorInfo:t});ye.warn(n.message)}}();const a=e.options.appId;if(!a)throw be.create("no-app-id");if(!e.options.apiKey){if(!e.options.measurementId)throw be.create("no-api-key");ye.warn(`The "apiKey" field is empty in the local Firebase config. This is needed to fetch the latest measurement ID for this Firebase app. Falling back to the measurement ID ${e.options.measurementId} provided in the "measurementId" field in the local Firebase config.`)}if(null!=Me[a])throw be.create("already-exists",{id:a});if(!Re){!function(e){let t=[];Array.isArray(window[e])?t=window[e]:window[e]=t}(Fe);const{wrappedGtag:e,gtagCore:t}=function(e,t,n,a,i){let r=function(...e){window[a].push(arguments)};return window[i]&&"function"==typeof window[i]&&(r=window[i]),window[i]=Ie(r,e,t,n),{gtagCore:r,wrappedGtag:window[i]}}(Me,_e,Ae,Fe,xe);Ne=e,Be=t,Re=!0}Me[a]=$e(e,_e,Ae,t,Be,Fe,n);return new Pe(e)}function ze(e=a()){e=v(e);const t=n(e,"analytics");return t.isInitialized()?t.getImmediate():Ve(e)}function Ve(e,t={}){const a=n(e,"analytics");if(a.isInitialized()){const e=a.getImmediate();if(m(t,a.getOptions()))return e;throw be.create("already-initialized")}return a.initialize({options:t})}async function Ke(){if(u())return!1;if(!f())return!1;if(!l())return!1;try{return await d()}catch(e){return!1}}function We(e,t,n){e=v(e),async function(e,t,n,a){if(a&&a.global)return e("set",{screen_name:n}),Promise.resolve();e("config",await t,{update:!0,screen_name:n})}(Ne,Me[e.app.options.appId],t,n).catch((e=>ye.error(e)))}function Ge(e,t,n){e=v(e),async function(e,t,n,a){if(a&&a.global)return e("set",{user_id:n}),Promise.resolve();e("config",await t,{update:!0,user_id:n})}(Ne,Me[e.app.options.appId],t,n).catch((e=>ye.error(e)))}function Ue(e,t,n){e=v(e),async function(e,t,n,a){if(a&&a.global){const t={};for(const e of Object.keys(n))t[`user_properties.${e}`]=n[e];return e("set",t),Promise.resolve()}e("config",await t,{update:!0,user_properties:n})}(Ne,Me[e.app.options.appId],t,n).catch((e=>ye.error(e)))}function Je(e,t){e=v(e),async function(e,t){const n=await e;window[`ga-disable-${n}`]=!t}(Me[e.app.options.appId],t).catch((e=>ye.error(e)))}function Ye(e){Ne?Ne("set",e):Oe(e)}function Ze(e,t,n,a){e=v(e),async function(e,t,n,a,i){if(i&&i.global)e("event",n,a);else{const i=await t;e("event",n,Object.assign(Object.assign({},a),{send_to:i}))}}(Ne,Me[e.app.options.appId],t,n,a).catch((e=>ye.error(e)))}function Qe(e){Ne?Ne("consent","update",e):je(e)}const Xe="@firebase/analytics";t(new I("analytics",((e,{options:t})=>qe(e.getProvider("app").getImmediate(),e.getProvider("installations-internal").getImmediate(),t)),"PUBLIC")),t(new I("analytics-internal",(function(e){try{const t=e.getProvider("analytics").getImmediate();return{logEvent:(e,n,a)=>Ze(t,e,n,a)}}catch(e){throw be.create("interop-component-reg-failed",{reason:e})}}),"PRIVATE")),e(Xe,"0.9.4"),e(Xe,"0.9.4","esm2017");export{ze as getAnalytics,Ve as initializeAnalytics,Ke as isSupported,Ze as logEvent,Je as setAnalyticsCollectionEnabled,Qe as setConsent,We as setCurrentScreen,Ye as setDefaultEventParameters,Ge as setUserId,Ue as setUserProperties,He as settings};
1
+ import{registerVersion as e,_registerComponent as t,_getProvider as n,getApp as a}from"https://www.gstatic.com/firebasejs/9.18.0/firebase-app.js";var i;!function(e){e[e.DEBUG=0]="DEBUG",e[e.VERBOSE=1]="VERBOSE",e[e.INFO=2]="INFO",e[e.WARN=3]="WARN",e[e.ERROR=4]="ERROR",e[e.SILENT=5]="SILENT"}(i||(i={}));const r={debug:i.DEBUG,verbose:i.VERBOSE,info:i.INFO,warn:i.WARN,error:i.ERROR,silent:i.SILENT},o=i.INFO,s={[i.DEBUG]:"log",[i.VERBOSE]:"log",[i.INFO]:"info",[i.WARN]:"warn",[i.ERROR]:"error"},c=(e,t,...n)=>{if(t<e.logLevel)return;const a=(new Date).toISOString(),i=s[t];if(!i)throw new Error(`Attempted to log a message with an invalid logType (value: ${t})`);console[i](`[${a}] ${e.name}:`,...n)};function u(){const e="object"==typeof chrome?chrome.runtime:"object"==typeof browser?browser.runtime:void 0;return"object"==typeof e&&void 0!==e.id}function l(){try{return"object"==typeof indexedDB}catch(e){return!1}}function d(){return new Promise(((e,t)=>{try{let n=!0;const a="validate-browser-context-for-indexeddb-analytics-module",i=self.indexedDB.open(a);i.onsuccess=()=>{i.result.close(),n||self.indexedDB.deleteDatabase(a),e(!0)},i.onupgradeneeded=()=>{n=!1},i.onerror=()=>{var e;t((null===(e=i.error)||void 0===e?void 0:e.message)||"")}}catch(e){t(e)}}))}function f(){return!("undefined"==typeof navigator||!navigator.cookieEnabled)}class p extends Error{constructor(e,t,n){super(t),this.code=e,this.customData=n,this.name="FirebaseError",Object.setPrototypeOf(this,p.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,h.prototype.create)}}class h{constructor(e,t,n){this.service=e,this.serviceName=t,this.errors=n}create(e,...t){const n=t[0]||{},a=`${this.service}/${e}`,i=this.errors[e],r=i?function(e,t){return e.replace(g,((e,n)=>{const a=t[n];return null!=a?String(a):`<${n}?>`}))}(i,n):"Error",o=`${this.serviceName}: ${r} (${a}).`;return new p(a,o,n)}}const g=/\{\$([^}]+)}/g;function m(e,t){if(e===t)return!0;const n=Object.keys(e),a=Object.keys(t);for(const i of n){if(!a.includes(i))return!1;const n=e[i],r=t[i];if(w(n)&&w(r)){if(!m(n,r))return!1}else if(n!==r)return!1}for(const e of a)if(!n.includes(e))return!1;return!0}function w(e){return null!==e&&"object"==typeof e}function y(e,t=1e3,n=2){const a=t*Math.pow(n,e),i=Math.round(.5*a*(Math.random()-.5)*2);return Math.min(144e5,a+i)}function v(e){return e&&e._delegate?e._delegate:e}class I{constructor(e,t,n){this.name=e,this.instanceFactory=t,this.type=n,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}}let b,E;const T=new WeakMap,D=new WeakMap,S=new WeakMap,k=new WeakMap,C=new WeakMap;let L={get(e,t,n){if(e instanceof IDBTransaction){if("done"===t)return D.get(e);if("objectStoreNames"===t)return e.objectStoreNames||S.get(e);if("store"===t)return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return $(e[t])},set:(e,t,n)=>(e[t]=n,!0),has:(e,t)=>e instanceof IDBTransaction&&("done"===t||"store"===t)||t in e};function j(e){return e!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(E||(E=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(e)?function(...t){return e.apply(P(this),t),$(T.get(this))}:function(...t){return $(e.apply(P(this),t))}:function(t,...n){const a=e.call(P(this),t,...n);return S.set(a,t.sort?t.sort():[t]),$(a)}}function O(e){return"function"==typeof e?j(e):(e instanceof IDBTransaction&&function(e){if(D.has(e))return;const t=new Promise(((t,n)=>{const a=()=>{e.removeEventListener("complete",i),e.removeEventListener("error",r),e.removeEventListener("abort",r)},i=()=>{t(),a()},r=()=>{n(e.error||new DOMException("AbortError","AbortError")),a()};e.addEventListener("complete",i),e.addEventListener("error",r),e.addEventListener("abort",r)}));D.set(e,t)}(e),t=e,(b||(b=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])).some((e=>t instanceof e))?new Proxy(e,L):e);var t}function $(e){if(e instanceof IDBRequest)return function(e){const t=new Promise(((t,n)=>{const a=()=>{e.removeEventListener("success",i),e.removeEventListener("error",r)},i=()=>{t($(e.result)),a()},r=()=>{n(e.error),a()};e.addEventListener("success",i),e.addEventListener("error",r)}));return t.then((t=>{t instanceof IDBCursor&&T.set(t,e)})).catch((()=>{})),C.set(t,e),t}(e);if(k.has(e))return k.get(e);const t=O(e);return t!==e&&(k.set(e,t),C.set(t,e)),t}const P=e=>C.get(e);const M=["get","getKey","getAll","getAllKeys","count"],_=["put","add","delete","clear"],A=new Map;function B(e,t){if(!(e instanceof IDBDatabase)||t in e||"string"!=typeof t)return;if(A.get(t))return A.get(t);const n=t.replace(/FromIndex$/,""),a=t!==n,i=_.includes(n);if(!(n in(a?IDBIndex:IDBObjectStore).prototype)||!i&&!M.includes(n))return;const r=async function(e,...t){const r=this.transaction(e,i?"readwrite":"readonly");let o=r.store;return a&&(o=o.index(t.shift())),(await Promise.all([o[n](...t),i&&r.done]))[0]};return A.set(t,r),r}L=(e=>({...e,get:(t,n,a)=>B(t,n)||e.get(t,n,a),has:(t,n)=>!!B(t,n)||e.has(t,n)}))(L);const N="@firebase/installations",F=new h("installations","Installations",{"missing-app-config-values":'Missing App configuration value: "{$valueName}"',"not-registered":"Firebase Installation is not registered.","installation-not-found":"Firebase Installation not found.","request-failed":'{$requestName} request failed with error "{$serverCode} {$serverStatus}: {$serverMessage}"',"app-offline":"Could not process request. Application offline.","delete-pending-registration":"Can't delete installation while there is a pending registration request."});function x(e){return e instanceof p&&e.code.includes("request-failed")}function R({projectId:e}){return`https://firebaseinstallations.googleapis.com/v1/projects/${e}/installations`}function H(e){return{token:e.token,requestStatus:2,expiresIn:(t=e.expiresIn,Number(t.replace("s","000"))),creationTime:Date.now()};var t}async function q(e,t){const n=(await t.json()).error;return F.create("request-failed",{requestName:e,serverCode:n.code,serverMessage:n.message,serverStatus:n.status})}function z({apiKey:e}){return new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":e})}function V(e,{refreshToken:t}){const n=z(e);return n.append("Authorization",function(e){return`FIS_v2 ${e}`}(t)),n}async function K(e){const t=await e();return t.status>=500&&t.status<600?e():t}function W(e){return new Promise((t=>{setTimeout(t,e)}))}const G=/^[cdef][\w-]{21}$/;function U(){try{const e=new Uint8Array(17);(self.crypto||self.msCrypto).getRandomValues(e),e[0]=112+e[0]%16;const t=function(e){return(t=e,btoa(String.fromCharCode(...t)).replace(/\+/g,"-").replace(/\//g,"_")).substr(0,22);var t}(e);return G.test(t)?t:""}catch(e){return""}}function J(e){return`${e.appName}!${e.appId}`}const Y=new Map;function Z(e,t){const n=J(e);Q(n,t),function(e,t){const n=function(){!X&&"BroadcastChannel"in self&&(X=new BroadcastChannel("[Firebase] FID Change"),X.onmessage=e=>{Q(e.data.key,e.data.fid)});return X}();n&&n.postMessage({key:e,fid:t});0===Y.size&&X&&(X.close(),X=null)}(n,t)}function Q(e,t){const n=Y.get(e);if(n)for(const e of n)e(t)}let X=null;const ee="firebase-installations-store";let te=null;function ne(){return te||(te=function(e,t,{blocked:n,upgrade:a,blocking:i,terminated:r}={}){const o=indexedDB.open(e,t),s=$(o);return a&&o.addEventListener("upgradeneeded",(e=>{a($(o.result),e.oldVersion,e.newVersion,$(o.transaction))})),n&&o.addEventListener("blocked",(()=>n())),s.then((e=>{r&&e.addEventListener("close",(()=>r())),i&&e.addEventListener("versionchange",(()=>i()))})).catch((()=>{})),s}("firebase-installations-database",1,{upgrade:(e,t)=>{if(0===t)e.createObjectStore(ee)}})),te}async function ae(e,t){const n=J(e),a=(await ne()).transaction(ee,"readwrite"),i=a.objectStore(ee),r=await i.get(n);return await i.put(t,n),await a.done,r&&r.fid===t.fid||Z(e,t.fid),t}async function ie(e){const t=J(e),n=(await ne()).transaction(ee,"readwrite");await n.objectStore(ee).delete(t),await n.done}async function re(e,t){const n=J(e),a=(await ne()).transaction(ee,"readwrite"),i=a.objectStore(ee),r=await i.get(n),o=t(r);return void 0===o?await i.delete(n):await i.put(o,n),await a.done,!o||r&&r.fid===o.fid||Z(e,o.fid),o}async function oe(e){let t;const n=await re(e.appConfig,(n=>{const a=function(e){return ue(e||{fid:U(),registrationStatus:0})}(n),i=function(e,t){if(0===t.registrationStatus){if(!navigator.onLine){return{installationEntry:t,registrationPromise:Promise.reject(F.create("app-offline"))}}const n={fid:t.fid,registrationStatus:1,registrationTime:Date.now()},a=async function(e,t){try{const n=await async function({appConfig:e,heartbeatServiceProvider:t},{fid:n}){const a=R(e),i=z(e),r=t.getImmediate({optional:!0});if(r){const e=await r.getHeartbeatsHeader();e&&i.append("x-firebase-client",e)}const o={fid:n,authVersion:"FIS_v2",appId:e.appId,sdkVersion:"w:0.6.4"},s={method:"POST",headers:i,body:JSON.stringify(o)},c=await K((()=>fetch(a,s)));if(c.ok){const e=await c.json();return{fid:e.fid||n,registrationStatus:2,refreshToken:e.refreshToken,authToken:H(e.authToken)}}throw await q("Create Installation",c)}(e,t);return ae(e.appConfig,n)}catch(n){throw x(n)&&409===n.customData.serverCode?await ie(e.appConfig):await ae(e.appConfig,{fid:t.fid,registrationStatus:0}),n}}(e,n);return{installationEntry:n,registrationPromise:a}}return 1===t.registrationStatus?{installationEntry:t,registrationPromise:se(e)}:{installationEntry:t}}(e,a);return t=i.registrationPromise,i.installationEntry}));return""===n.fid?{installationEntry:await t}:{installationEntry:n,registrationPromise:t}}async function se(e){let t=await ce(e.appConfig);for(;1===t.registrationStatus;)await W(100),t=await ce(e.appConfig);if(0===t.registrationStatus){const{installationEntry:t,registrationPromise:n}=await oe(e);return n||t}return t}function ce(e){return re(e,(e=>{if(!e)throw F.create("installation-not-found");return ue(e)}))}function ue(e){return 1===(t=e).registrationStatus&&t.registrationTime+1e4<Date.now()?{fid:e.fid,registrationStatus:0}:e;var t}async function le({appConfig:e,heartbeatServiceProvider:t},n){const a=function(e,{fid:t}){return`${R(e)}/${t}/authTokens:generate`}(e,n),i=V(e,n),r=t.getImmediate({optional:!0});if(r){const e=await r.getHeartbeatsHeader();e&&i.append("x-firebase-client",e)}const o={installation:{sdkVersion:"w:0.6.4",appId:e.appId}},s={method:"POST",headers:i,body:JSON.stringify(o)},c=await K((()=>fetch(a,s)));if(c.ok){return H(await c.json())}throw await q("Generate Auth Token",c)}async function de(e,t=!1){let n;const a=await re(e.appConfig,(a=>{if(!pe(a))throw F.create("not-registered");const i=a.authToken;if(!t&&function(e){return 2===e.requestStatus&&!function(e){const t=Date.now();return t<e.creationTime||e.creationTime+e.expiresIn<t+36e5}(e)}(i))return a;if(1===i.requestStatus)return n=async function(e,t){let n=await fe(e.appConfig);for(;1===n.authToken.requestStatus;)await W(100),n=await fe(e.appConfig);const a=n.authToken;return 0===a.requestStatus?de(e,t):a}(e,t),a;{if(!navigator.onLine)throw F.create("app-offline");const t=function(e){const t={requestStatus:1,requestTime:Date.now()};return Object.assign(Object.assign({},e),{authToken:t})}(a);return n=async function(e,t){try{const n=await le(e,t),a=Object.assign(Object.assign({},t),{authToken:n});return await ae(e.appConfig,a),n}catch(n){if(!x(n)||401!==n.customData.serverCode&&404!==n.customData.serverCode){const n=Object.assign(Object.assign({},t),{authToken:{requestStatus:0}});await ae(e.appConfig,n)}else await ie(e.appConfig);throw n}}(e,t),t}}));return n?await n:a.authToken}function fe(e){return re(e,(e=>{if(!pe(e))throw F.create("not-registered");const t=e.authToken;return 1===(n=t).requestStatus&&n.requestTime+1e4<Date.now()?Object.assign(Object.assign({},e),{authToken:{requestStatus:0}}):e;var n}))}function pe(e){return void 0!==e&&2===e.registrationStatus}async function he(e,t=!1){const n=e;await async function(e){const{registrationPromise:t}=await oe(e);t&&await t}(n);return(await de(n,t)).token}function ge(e){return F.create("missing-app-config-values",{valueName:e})}const me=e=>{const t=e.getProvider("app").getImmediate(),a=n(t,"installations").getImmediate();return{getId:()=>async function(e){const t=e,{installationEntry:n,registrationPromise:a}=await oe(t);return a?a.catch(console.error):de(t).catch(console.error),n.fid}(a),getToken:e=>he(a,e)}};t(new I("installations",(e=>{const t=e.getProvider("app").getImmediate(),a=function(e){if(!e||!e.options)throw ge("App Configuration");if(!e.name)throw ge("App Name");const t=["projectId","apiKey","appId"];for(const n of t)if(!e.options[n])throw ge(n);return{appName:e.name,projectId:e.options.projectId,apiKey:e.options.apiKey,appId:e.options.appId}}(t);return{app:t,appConfig:a,heartbeatServiceProvider:n(t,"heartbeat"),_delete:()=>Promise.resolve()}}),"PUBLIC")),t(new I("installations-internal",me,"PRIVATE")),e(N,"0.6.4"),e(N,"0.6.4","esm2017");const we="https://www.googletagmanager.com/gtag/js",ye=new class{constructor(e){this.name=e,this._logLevel=o,this._logHandler=c,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in i))throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel="string"==typeof e?r[e]:e}get logHandler(){return this._logHandler}set logHandler(e){if("function"!=typeof e)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,i.DEBUG,...e),this._logHandler(this,i.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,i.VERBOSE,...e),this._logHandler(this,i.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,i.INFO,...e),this._logHandler(this,i.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,i.WARN,...e),this._logHandler(this,i.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,i.ERROR,...e),this._logHandler(this,i.ERROR,...e)}}("@firebase/analytics");function ve(e){return Promise.all(e.map((e=>e.catch((e=>e)))))}function Ie(e,t,n,a){return async function(i,r,o){try{"event"===i?await async function(e,t,n,a,i){try{let r=[];if(i&&i.send_to){let e=i.send_to;Array.isArray(e)||(e=[e]);const a=await ve(n);for(const n of e){const e=a.find((e=>e.measurementId===n)),i=e&&t[e.appId];if(!i){r=[];break}r.push(i)}}0===r.length&&(r=Object.values(t)),await Promise.all(r),e("event",a,i||{})}catch(e){ye.error(e)}}(e,t,n,r,o):"config"===i?await async function(e,t,n,a,i,r){const o=a[i];try{if(o)await t[o];else{const e=(await ve(n)).find((e=>e.measurementId===i));e&&await t[e.appId]}}catch(e){ye.error(e)}e("config",i,r)}(e,t,n,a,r,o):"consent"===i?e("consent","update",o):e("set",r)}catch(e){ye.error(e)}}}const be=new h("analytics","Analytics",{"already-exists":"A Firebase Analytics instance with the appId {$id} already exists. Only one Firebase Analytics instance can be created for each appId.","already-initialized":"initializeAnalytics() cannot be called again with different options than those it was initially called with. It can be called again with the same options to return the existing instance, or getAnalytics() can be used to get a reference to the already-intialized instance.","already-initialized-settings":"Firebase Analytics has already been initialized.settings() must be called before initializing any Analytics instanceor it will have no effect.","interop-component-reg-failed":"Firebase Analytics Interop Component failed to instantiate: {$reason}","invalid-analytics-context":"Firebase Analytics is not supported in this environment. Wrap initialization of analytics in analytics.isSupported() to prevent initialization in unsupported environments. Details: {$errorInfo}","indexeddb-unavailable":"IndexedDB unavailable or restricted in this environment. Wrap initialization of analytics in analytics.isSupported() to prevent initialization in unsupported environments. Details: {$errorInfo}","fetch-throttle":"The config fetch request timed out while in an exponential backoff state. Unix timestamp in milliseconds when fetch request throttling ends: {$throttleEndTimeMillis}.","config-fetch-failed":"Dynamic config fetch failed: [{$httpStatus}] {$responseMessage}","no-api-key":'The "apiKey" field is empty in the local Firebase config. Firebase Analytics requires this field tocontain a valid API key.',"no-app-id":'The "appId" field is empty in the local Firebase config. Firebase Analytics requires this field tocontain a valid app ID.'});const Ee=new class{constructor(e={},t=1e3){this.throttleMetadata=e,this.intervalMillis=t}getThrottleMetadata(e){return this.throttleMetadata[e]}setThrottleMetadata(e,t){this.throttleMetadata[e]=t}deleteThrottleMetadata(e){delete this.throttleMetadata[e]}};function Te(e){return new Headers({Accept:"application/json","x-goog-api-key":e})}async function De(e,t=Ee,n){const{appId:a,apiKey:i,measurementId:r}=e.options;if(!a)throw be.create("no-app-id");if(!i){if(r)return{measurementId:r,appId:a};throw be.create("no-api-key")}const o=t.getThrottleMetadata(a)||{backoffCount:0,throttleEndTimeMillis:Date.now()},s=new ke;return setTimeout((async()=>{s.abort()}),void 0!==n?n:6e4),Se({appId:a,apiKey:i,measurementId:r},o,s,t)}async function Se(e,{throttleEndTimeMillis:t,backoffCount:n},a,i=Ee){var r;const{appId:o,measurementId:s}=e;try{await function(e,t){return new Promise(((n,a)=>{const i=Math.max(t-Date.now(),0),r=setTimeout(n,i);e.addEventListener((()=>{clearTimeout(r),a(be.create("fetch-throttle",{throttleEndTimeMillis:t}))}))}))}(a,t)}catch(e){if(s)return ye.warn(`Timed out fetching this Firebase app's measurement ID from the server. Falling back to the measurement ID ${s} provided in the "measurementId" field in the local Firebase config. [${null==e?void 0:e.message}]`),{appId:o,measurementId:s};throw e}try{const t=await async function(e){var t;const{appId:n,apiKey:a}=e,i={method:"GET",headers:Te(a)},r="https://firebase.googleapis.com/v1alpha/projects/-/apps/{app-id}/webConfig".replace("{app-id}",n),o=await fetch(r,i);if(200!==o.status&&304!==o.status){let e="";try{const n=await o.json();(null===(t=n.error)||void 0===t?void 0:t.message)&&(e=n.error.message)}catch(e){}throw be.create("config-fetch-failed",{httpStatus:o.status,responseMessage:e})}return o.json()}(e);return i.deleteThrottleMetadata(o),t}catch(t){const c=t;if(!function(e){if(!(e instanceof p&&e.customData))return!1;const t=Number(e.customData.httpStatus);return 429===t||500===t||503===t||504===t}(c)){if(i.deleteThrottleMetadata(o),s)return ye.warn(`Failed to fetch this Firebase app's measurement ID from the server. Falling back to the measurement ID ${s} provided in the "measurementId" field in the local Firebase config. [${null==c?void 0:c.message}]`),{appId:o,measurementId:s};throw t}const u=503===Number(null===(r=null==c?void 0:c.customData)||void 0===r?void 0:r.httpStatus)?y(n,i.intervalMillis,30):y(n,i.intervalMillis),l={throttleEndTimeMillis:Date.now()+u,backoffCount:n+1};return i.setThrottleMetadata(o,l),ye.debug(`Calling attemptFetch again in ${u} millis`),Se(e,l,a,i)}}class ke{constructor(){this.listeners=[]}addEventListener(e){this.listeners.push(e)}abort(){this.listeners.forEach((e=>e()))}}let Ce,Le;function je(e){Le=e}function Oe(e){Ce=e}async function $e(e,t,n,a,i,r,o){var s;const c=De(e);c.then((t=>{n[t.measurementId]=t.appId,e.options.measurementId&&t.measurementId!==e.options.measurementId&&ye.warn(`The measurement ID in the local Firebase config (${e.options.measurementId}) does not match the measurement ID fetched from the server (${t.measurementId}). To ensure analytics events are always sent to the correct Analytics property, update the measurement ID field in the local config or remove it from the local config.`)})).catch((e=>ye.error(e))),t.push(c);const u=async function(){if(!l())return ye.warn(be.create("indexeddb-unavailable",{errorInfo:"IndexedDB is not available in this environment."}).message),!1;try{await d()}catch(e){return ye.warn(be.create("indexeddb-unavailable",{errorInfo:null==e?void 0:e.toString()}).message),!1}return!0}().then((e=>e?a.getId():void 0)),[f,p]=await Promise.all([c,u]);(function(e){const t=window.document.getElementsByTagName("script");for(const n of Object.values(t))if(n.src&&n.src.includes(we)&&n.src.includes(e))return n;return null})(r)||function(e,t){const n=document.createElement("script");n.src=`${we}?l=${e}&id=${t}`,n.async=!0,document.head.appendChild(n)}(r,f.measurementId),Le&&(i("consent","default",Le),je(void 0)),i("js",new Date);const h=null!==(s=null==o?void 0:o.config)&&void 0!==s?s:{};return h.origin="firebase",h.update=!0,null!=p&&(h.firebase_id=p),i("config",f.measurementId,h),Ce&&(i("set",Ce),Oe(void 0)),f.measurementId}class Pe{constructor(e){this.app=e}_delete(){return delete Me[this.app.options.appId],Promise.resolve()}}let Me={},_e=[];const Ae={};let Be,Ne,Fe="dataLayer",xe="gtag",Re=!1;function He(e){if(Re)throw be.create("already-initialized");e.dataLayerName&&(Fe=e.dataLayerName),e.gtagName&&(xe=e.gtagName)}function qe(e,t,n){!function(){const e=[];if(u()&&e.push("This is a browser extension environment."),f()||e.push("Cookies are not available."),e.length>0){const t=e.map(((e,t)=>`(${t+1}) ${e}`)).join(" "),n=be.create("invalid-analytics-context",{errorInfo:t});ye.warn(n.message)}}();const a=e.options.appId;if(!a)throw be.create("no-app-id");if(!e.options.apiKey){if(!e.options.measurementId)throw be.create("no-api-key");ye.warn(`The "apiKey" field is empty in the local Firebase config. This is needed to fetch the latest measurement ID for this Firebase app. Falling back to the measurement ID ${e.options.measurementId} provided in the "measurementId" field in the local Firebase config.`)}if(null!=Me[a])throw be.create("already-exists",{id:a});if(!Re){!function(e){let t=[];Array.isArray(window[e])?t=window[e]:window[e]=t}(Fe);const{wrappedGtag:e,gtagCore:t}=function(e,t,n,a,i){let r=function(...e){window[a].push(arguments)};return window[i]&&"function"==typeof window[i]&&(r=window[i]),window[i]=Ie(r,e,t,n),{gtagCore:r,wrappedGtag:window[i]}}(Me,_e,Ae,Fe,xe);Ne=e,Be=t,Re=!0}Me[a]=$e(e,_e,Ae,t,Be,Fe,n);return new Pe(e)}function ze(e=a()){e=v(e);const t=n(e,"analytics");return t.isInitialized()?t.getImmediate():Ve(e)}function Ve(e,t={}){const a=n(e,"analytics");if(a.isInitialized()){const e=a.getImmediate();if(m(t,a.getOptions()))return e;throw be.create("already-initialized")}return a.initialize({options:t})}async function Ke(){if(u())return!1;if(!f())return!1;if(!l())return!1;try{return await d()}catch(e){return!1}}function We(e,t,n){e=v(e),async function(e,t,n,a){if(a&&a.global)return e("set",{screen_name:n}),Promise.resolve();e("config",await t,{update:!0,screen_name:n})}(Ne,Me[e.app.options.appId],t,n).catch((e=>ye.error(e)))}function Ge(e,t,n){e=v(e),async function(e,t,n,a){if(a&&a.global)return e("set",{user_id:n}),Promise.resolve();e("config",await t,{update:!0,user_id:n})}(Ne,Me[e.app.options.appId],t,n).catch((e=>ye.error(e)))}function Ue(e,t,n){e=v(e),async function(e,t,n,a){if(a&&a.global){const t={};for(const e of Object.keys(n))t[`user_properties.${e}`]=n[e];return e("set",t),Promise.resolve()}e("config",await t,{update:!0,user_properties:n})}(Ne,Me[e.app.options.appId],t,n).catch((e=>ye.error(e)))}function Je(e,t){e=v(e),async function(e,t){const n=await e;window[`ga-disable-${n}`]=!t}(Me[e.app.options.appId],t).catch((e=>ye.error(e)))}function Ye(e){Ne?Ne("set",e):Oe(e)}function Ze(e,t,n,a){e=v(e),async function(e,t,n,a,i){if(i&&i.global)e("event",n,a);else{const i=await t;e("event",n,Object.assign(Object.assign({},a),{send_to:i}))}}(Ne,Me[e.app.options.appId],t,n,a).catch((e=>ye.error(e)))}function Qe(e){Ne?Ne("consent","update",e):je(e)}const Xe="@firebase/analytics";t(new I("analytics",((e,{options:t})=>qe(e.getProvider("app").getImmediate(),e.getProvider("installations-internal").getImmediate(),t)),"PUBLIC")),t(new I("analytics-internal",(function(e){try{const t=e.getProvider("analytics").getImmediate();return{logEvent:(e,n,a)=>Ze(t,e,n,a)}}catch(e){throw be.create("interop-component-reg-failed",{reason:e})}}),"PRIVATE")),e(Xe,"0.9.4"),e(Xe,"0.9.4","esm2017");export{ze as getAnalytics,Ve as initializeAnalytics,Ke as isSupported,Ze as logEvent,Je as setAnalyticsCollectionEnabled,Qe as setConsent,We as setCurrentScreen,Ye as setDefaultEventParameters,Ge as setUserId,Ue as setUserProperties,He as settings};
2
2
 
3
3
  //# sourceMappingURL=firebase-analytics.js.map
@@ -1,3 +1,3 @@
1
- import{_getProvider as e,getApp as t,_registerComponent as r,registerVersion as n}from"https://www.gstatic.com/firebasejs/9.17.2/firebase-app.js";const o={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:"function"==typeof atob,encodeByteArray(e,t){if(!Array.isArray(e))throw Error("encodeByteArray takes an array as a parameter");this.init_();const r=t?this.byteToCharMapWebSafe_:this.byteToCharMap_,n=[];for(let t=0;t<e.length;t+=3){const o=e[t],i=t+1<e.length,a=i?e[t+1]:0,s=t+2<e.length,c=s?e[t+2]:0,h=o>>2,l=(3&o)<<4|a>>4;let u=(15&a)<<2|c>>6,p=63&c;s||(p=64,i||(u=64)),n.push(r[h],r[l],r[u],r[p])}return n.join("")},encodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?btoa(e):this.encodeByteArray(function(e){const t=[];let r=0;for(let n=0;n<e.length;n++){let o=e.charCodeAt(n);o<128?t[r++]=o:o<2048?(t[r++]=o>>6|192,t[r++]=63&o|128):55296==(64512&o)&&n+1<e.length&&56320==(64512&e.charCodeAt(n+1))?(o=65536+((1023&o)<<10)+(1023&e.charCodeAt(++n)),t[r++]=o>>18|240,t[r++]=o>>12&63|128,t[r++]=o>>6&63|128,t[r++]=63&o|128):(t[r++]=o>>12|224,t[r++]=o>>6&63|128,t[r++]=63&o|128)}return t}(e),t)},decodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?atob(e):function(e){const t=[];let r=0,n=0;for(;r<e.length;){const o=e[r++];if(o<128)t[n++]=String.fromCharCode(o);else if(o>191&&o<224){const i=e[r++];t[n++]=String.fromCharCode((31&o)<<6|63&i)}else if(o>239&&o<365){const i=((7&o)<<18|(63&e[r++])<<12|(63&e[r++])<<6|63&e[r++])-65536;t[n++]=String.fromCharCode(55296+(i>>10)),t[n++]=String.fromCharCode(56320+(1023&i))}else{const i=e[r++],a=e[r++];t[n++]=String.fromCharCode((15&o)<<12|(63&i)<<6|63&a)}}return t.join("")}(this.decodeStringToByteArray(e,t))},decodeStringToByteArray(e,t){this.init_();const r=t?this.charToByteMapWebSafe_:this.charToByteMap_,n=[];for(let t=0;t<e.length;){const o=r[e.charAt(t++)],a=t<e.length?r[e.charAt(t)]:0;++t;const s=t<e.length?r[e.charAt(t)]:64;++t;const c=t<e.length?r[e.charAt(t)]:64;if(++t,null==o||null==a||null==s||null==c)throw new i;const h=o<<2|a>>4;if(n.push(h),64!==s){const e=a<<4&240|s>>2;if(n.push(e),64!==c){const e=s<<6&192|c;n.push(e)}}}return n},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let e=0;e<this.ENCODED_VALS.length;e++)this.byteToCharMap_[e]=this.ENCODED_VALS.charAt(e),this.charToByteMap_[this.byteToCharMap_[e]]=e,this.byteToCharMapWebSafe_[e]=this.ENCODED_VALS_WEBSAFE.charAt(e),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[e]]=e,e>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(e)]=e,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(e)]=e)}}};class i extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const a=function(e){try{return o.decodeString(e,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};class s{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise(((e,t)=>{this.resolve=e,this.reject=t}))}wrapCallback(e){return(t,r)=>{t?this.reject(t):this.resolve(r),"function"==typeof e&&(this.promise.catch((()=>{})),1===e.length?e(t):e(t,r))}}}function c(){try{return"object"==typeof indexedDB}catch(e){return!1}}class h extends Error{constructor(e,t,r){super(t),this.code=e,this.customData=r,this.name="FirebaseError",Object.setPrototypeOf(this,h.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,l.prototype.create)}}class l{constructor(e,t,r){this.service=e,this.serviceName=t,this.errors=r}create(e,...t){const r=t[0]||{},n=`${this.service}/${e}`,o=this.errors[e],i=o?function(e,t){return e.replace(u,((e,r)=>{const n=t[r];return null!=n?String(n):`<${r}?>`}))}(o,r):"Error",a=`${this.serviceName}: ${i} (${n}).`;return new h(n,a,r)}}const u=/\{\$([^}]+)}/g;function p(e){return JSON.parse(e)}const d=function(e){const t=function(e){let t={},r={},n={},o="";try{const i=e.split(".");t=p(a(i[0])||""),r=p(a(i[1])||""),o=i[2],n=r.d||{},delete r.d}catch(e){}return{header:t,claims:r,data:n,signature:o}}(e).claims;return"object"==typeof t&&t.hasOwnProperty("iat")?t.iat:null};class g{constructor(e,t,r){this.name=e,this.instanceFactory=t,this.type=r,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(e){return this.instantiationMode=e,this}setMultipleInstances(e){return this.multipleInstances=e,this}setServiceProps(e){return this.serviceProps=e,this}setInstanceCreatedCallback(e){return this.onInstanceCreated=e,this}}var f;!function(e){e[e.DEBUG=0]="DEBUG",e[e.VERBOSE=1]="VERBOSE",e[e.INFO=2]="INFO",e[e.WARN=3]="WARN",e[e.ERROR=4]="ERROR",e[e.SILENT=5]="SILENT"}(f||(f={}));const E={debug:f.DEBUG,verbose:f.VERBOSE,info:f.INFO,warn:f.WARN,error:f.ERROR,silent:f.SILENT},w=f.INFO,_={[f.DEBUG]:"log",[f.VERBOSE]:"log",[f.INFO]:"info",[f.WARN]:"warn",[f.ERROR]:"error"},k=(e,t,...r)=>{if(t<e.logLevel)return;const n=(new Date).toISOString(),o=_[t];if(!o)throw new Error(`Attempted to log a message with an invalid logType (value: ${t})`);console[o](`[${n}] ${e.name}:`,...r)};const y=new Map,m={activated:!1,tokenObservers:[]},v={initialized:!1,enabled:!1};function b(e){return y.get(e)||Object.assign({},m)}function A(){return v}const T="https://content-firebaseappcheck.googleapis.com/v1",S=3e4,C=96e4;class R{constructor(e,t,r,n,o){if(this.operation=e,this.retryPolicy=t,this.getWaitDuration=r,this.lowerBound=n,this.upperBound=o,this.pending=null,this.nextErrorWaitInterval=n,n>o)throw new Error("Proactive refresh lower bound greater than upper bound!")}start(){this.nextErrorWaitInterval=this.lowerBound,this.process(!0).catch((()=>{}))}stop(){this.pending&&(this.pending.reject("cancelled"),this.pending=null)}isRunning(){return!!this.pending}async process(e){this.stop();try{this.pending=new s,await(t=this.getNextRun(e),new Promise((e=>{setTimeout(e,t)}))),this.pending.resolve(),await this.pending.promise,this.pending=new s,await this.operation(),this.pending.resolve(),await this.pending.promise,this.process(!0).catch((()=>{}))}catch(e){this.retryPolicy(e)?this.process(!1).catch((()=>{})):this.stop()}var t}getNextRun(e){if(e)return this.nextErrorWaitInterval=this.lowerBound,this.getWaitDuration();{const e=this.nextErrorWaitInterval;return this.nextErrorWaitInterval*=2,this.nextErrorWaitInterval>this.upperBound&&(this.nextErrorWaitInterval=this.upperBound),e}}}const D=new l("appCheck","AppCheck",{"already-initialized":"You have already called initializeAppCheck() for FirebaseApp {$appName} with different options. To avoid this error, call initializeAppCheck() with the same options as when it was originally called. This will return the already initialized instance.","use-before-activation":"App Check is being used before initializeAppCheck() is called for FirebaseApp {$appName}. Call initializeAppCheck() before instantiating other Firebase services.","fetch-network-error":"Fetch failed to connect to a network. Check Internet connection. Original error: {$originalErrorMessage}.","fetch-parse-error":"Fetch client could not parse response. Original error: {$originalErrorMessage}.","fetch-status-error":"Fetch server returned an HTTP error status. HTTP status: {$httpStatus}.","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}.","recaptcha-error":"ReCAPTCHA error.",throttled:"Requests throttled due to {$httpStatus} error. Attempts allowed again after {$time}"});function x(e=!1){var t;return e?null===(t=self.grecaptcha)||void 0===t?void 0:t.enterprise:self.grecaptcha}function P(e){if(!b(e).activated)throw D.create("use-before-activation",{appName:e.name})}function O(e){const t=Math.round(e/1e3),r=Math.floor(t/86400),n=Math.floor((t-3600*r*24)/3600),o=Math.floor((t-3600*r*24-3600*n)/60),i=t-3600*r*24-3600*n-60*o;let a="";return r&&(a+=I(r)+"d:"),n&&(a+=I(n)+"h:"),a+=I(o)+"m:"+I(i)+"s",a}function I(e){return 0===e?"00":e>=10?e.toString():"0"+e}async function N({url:e,body:t},r){const n={"Content-Type":"application/json"},o=r.getImmediate({optional:!0});if(o){const e=await o.getHeartbeatsHeader();e&&(n["X-Firebase-Client"]=e)}const i={method:"POST",body:JSON.stringify(t),headers:n};let a,s;try{a=await fetch(e,i)}catch(e){throw D.create("fetch-network-error",{originalErrorMessage:null==e?void 0:e.message})}if(200!==a.status)throw D.create("fetch-status-error",{httpStatus:a.status});try{s=await a.json()}catch(e){throw D.create("fetch-parse-error",{originalErrorMessage:null==e?void 0:e.message})}const c=s.ttl.match(/^([\d.]+)(s)$/);if(!c||!c[2]||isNaN(Number(c[1])))throw D.create("fetch-parse-error",{originalErrorMessage:`ttl field (timeToLive) is not in standard Protobuf Duration format: ${s.ttl}`});const h=1e3*Number(c[1]),l=Date.now();return{token:s.token,expireTimeMillis:l+h,issuedAtTimeMillis:l}}const M="firebase-app-check-store";let B=null;function L(){return B||(B=new Promise(((e,t)=>{try{const r=indexedDB.open("firebase-app-check-database",1);r.onsuccess=t=>{e(t.target.result)},r.onerror=e=>{var r;t(D.create("storage-open",{originalErrorMessage:null===(r=e.target.error)||void 0===r?void 0:r.message}))},r.onupgradeneeded=e=>{const t=e.target.result;if(0===e.oldVersion)t.createObjectStore(M,{keyPath:"compositeKey"})}}catch(e){t(D.create("storage-open",{originalErrorMessage:null==e?void 0:e.message}))}})),B)}async function H(e,t){const r=(await L()).transaction(M,"readwrite"),n=r.objectStore(M).put({compositeKey:e,value:t});return new Promise(((e,t)=>{n.onsuccess=t=>{e()},r.onerror=e=>{var r;t(D.create("storage-set",{originalErrorMessage:null===(r=e.target.error)||void 0===r?void 0:r.message}))}}))}async function $(e){const t=(await L()).transaction(M,"readonly"),r=t.objectStore(M).get(e);return new Promise(((e,n)=>{r.onsuccess=t=>{const r=t.target.result;e(r?r.value:void 0)},t.onerror=e=>{var t;n(D.create("storage-get",{originalErrorMessage:null===(t=e.target.error)||void 0===t?void 0:t.message}))}}))}function j(e){return`${e.options.appId}-${e.name}`}const W=new class{constructor(e){this.name=e,this._logLevel=w,this._logHandler=k,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in f))throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel="string"==typeof e?E[e]:e}get logHandler(){return this._logHandler}set logHandler(e){if("function"!=typeof e)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,f.DEBUG,...e),this._logHandler(this,f.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,f.VERBOSE,...e),this._logHandler(this,f.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,f.INFO,...e),this._logHandler(this,f.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,f.WARN,...e),this._logHandler(this,f.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,f.ERROR,...e),this._logHandler(this,f.ERROR,...e)}}("@firebase/app-check");async function F(e){if(c()){let t;try{t=await function(e){return $(j(e))}(e)}catch(e){W.warn(`Failed to read token from IndexedDB. Error: ${e}`)}return t}}function V(e,t){return c()?function(e,t){return H(j(e),t)}(e,t).catch((e=>{W.warn(`Failed to write token to IndexedDB. Error: ${e}`)})):Promise.resolve()}async function K(){let e;try{e=await $("debug-token")}catch(e){}if(e)return e;{const e="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(e=>{const t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}));return(t=e,H("debug-token",t)).catch((e=>W.warn(`Failed to persist debug token to IndexedDB. Error: ${e}`))),e}var t}function z(){return A().enabled}async function U(){const e=A();if(e.enabled&&e.token)return e.token.promise;throw Error("\n Can't get debug token in production mode.\n ")}function q(){const e=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if("undefined"!=typeof global)return global;throw new Error("Unable to locate global object.")}(),t=A();if(t.initialized=!0,"string"!=typeof e.FIREBASE_APPCHECK_DEBUG_TOKEN&&!0!==e.FIREBASE_APPCHECK_DEBUG_TOKEN)return;t.enabled=!0;const r=new s;t.token=r,"string"==typeof e.FIREBASE_APPCHECK_DEBUG_TOKEN?r.resolve(e.FIREBASE_APPCHECK_DEBUG_TOKEN):r.resolve(K())}const G={error:"UNKNOWN_ERROR"};async function X(e,t=!1){const r=e.app;P(r);const n=b(r);let o,i=n.token;if(i&&!ee(i)&&(n.token=void 0,i=void 0),!i){const e=await n.cachedTokenPromise;e&&(ee(e)?i=e:await V(r,void 0))}if(!t&&i&&ee(i))return{token:i.token};let a,s=!1;if(z()){n.exchangeTokenPromise||(n.exchangeTokenPromise=N(function(e,t){const{projectId:r,appId:n,apiKey:o}=e.options;return{url:`${T}/projects/${r}/apps/${n}:exchangeDebugToken?key=${o}`,body:{debug_token:t}}}(r,await U()),e.heartbeatServiceProvider).finally((()=>{n.exchangeTokenPromise=void 0})),s=!0);const t=await n.exchangeTokenPromise;return await V(r,t),n.token=t,{token:t.token}}try{n.exchangeTokenPromise||(n.exchangeTokenPromise=n.provider.getToken().finally((()=>{n.exchangeTokenPromise=void 0})),s=!0),i=await b(r).exchangeTokenPromise}catch(e){"appCheck/throttled"===e.code?W.warn(e.message):W.error(e),o=e}return i?o?a=ee(i)?{token:i.token,internalError:o}:te(o):(a={token:i.token},n.token=i,await V(r,i)):a=te(o),s&&Q(r,a),a}function J(e,t,r,n){const{app:o}=e,i=b(o),a={next:r,error:n,type:t};if(i.tokenObservers=[...i.tokenObservers,a],i.token&&ee(i.token)){const t=i.token;Promise.resolve().then((()=>{r({token:t.token}),Z(e)})).catch((()=>{}))}i.cachedTokenPromise.then((()=>Z(e)))}function Y(e,t){const r=b(e),n=r.tokenObservers.filter((e=>e.next!==t));0===n.length&&r.tokenRefresher&&r.tokenRefresher.isRunning()&&r.tokenRefresher.stop(),r.tokenObservers=n}function Z(e){const{app:t}=e,r=b(t);let n=r.tokenRefresher;n||(n=function(e){const{app:t}=e;return new R((async()=>{let r;if(r=b(t).token?await X(e,!0):await X(e),r.error)throw r.error;if(r.internalError)throw r.internalError}),(()=>!0),(()=>{const e=b(t);if(e.token){let t=e.token.issuedAtTimeMillis+.5*(e.token.expireTimeMillis-e.token.issuedAtTimeMillis)+3e5;const r=e.token.expireTimeMillis-3e5;return t=Math.min(t,r),Math.max(0,t-Date.now())}return 0}),S,C)}(e),r.tokenRefresher=n),!n.isRunning()&&r.isTokenAutoRefreshEnabled&&n.start()}function Q(e,t){const r=b(e).tokenObservers;for(const e of r)try{"EXTERNAL"===e.type&&null!=t.error?e.error(t.error):e.next(t)}catch(e){}}function ee(e){return e.expireTimeMillis-Date.now()>0}function te(e){return{token:(t=G,o.encodeString(JSON.stringify(t),!1)),error:e};var t}class re{constructor(e,t){this.app=e,this.heartbeatServiceProvider=t}_delete(){const{tokenObservers:e}=b(this.app);for(const t of e)Y(this.app,t.next);return Promise.resolve()}}function ne(e,t){const r=new s;b(e).reCAPTCHAState={initialized:r};const n=ae(e),o=x(!1);return o?ie(e,t,o,n,r):function(e){const t=document.createElement("script");t.src="https://www.google.com/recaptcha/api.js",t.onload=e,document.head.appendChild(t)}((()=>{const o=x(!1);if(!o)throw new Error("no recaptcha");ie(e,t,o,n,r)})),r.promise}function oe(e,t){const r=new s;b(e).reCAPTCHAState={initialized:r};const n=ae(e),o=x(!0);return o?ie(e,t,o,n,r):function(e){const t=document.createElement("script");t.src="https://www.google.com/recaptcha/enterprise.js",t.onload=e,document.head.appendChild(t)}((()=>{const o=x(!0);if(!o)throw new Error("no recaptcha");ie(e,t,o,n,r)})),r.promise}function ie(e,t,r,n,o){r.ready((()=>{!function(e,t,r,n){const o=r.render(n,{sitekey:t,size:"invisible"}),i=b(e);i.reCAPTCHAState=Object.assign(Object.assign({},i.reCAPTCHAState),{widgetId:o})}(e,t,r,n),o.resolve(r)}))}function ae(e){const t=`fire_app_check_${e.name}`,r=document.createElement("div");return r.id=t,r.style.display="none",document.body.appendChild(r),t}async function se(e){P(e);const t=b(e).reCAPTCHAState,r=await t.initialized.promise;return new Promise(((t,n)=>{const o=b(e).reCAPTCHAState;r.ready((()=>{t(r.execute(o.widgetId,{action:"fire_app_check"}))}))}))}class ce{constructor(e){this._siteKey=e,this._throttleData=null}async getToken(){var e,t;pe(this._throttleData);const r=await se(this._app).catch((e=>{throw D.create("recaptcha-error")}));let n;try{n=await N(function(e,t){const{projectId:r,appId:n,apiKey:o}=e.options;return{url:`${T}/projects/${r}/apps/${n}:exchangeRecaptchaV3Token?key=${o}`,body:{recaptcha_v3_token:t}}}(this._app,r),this._heartbeatServiceProvider)}catch(r){throw(null===(e=r.code)||void 0===e?void 0:e.includes("fetch-status-error"))?(this._throttleData=ue(Number(null===(t=r.customData)||void 0===t?void 0:t.httpStatus),this._throttleData),D.create("throttled",{time:O(this._throttleData.allowRequestsAfter-Date.now()),httpStatus:this._throttleData.httpStatus})):r}return this._throttleData=null,n}initialize(t){this._app=t,this._heartbeatServiceProvider=e(t,"heartbeat"),ne(t,this._siteKey).catch((()=>{}))}isEqual(e){return e instanceof ce&&this._siteKey===e._siteKey}}class he{constructor(e){this._siteKey=e,this._throttleData=null}async getToken(){var e,t;pe(this._throttleData);const r=await se(this._app).catch((e=>{throw D.create("recaptcha-error")}));let n;try{n=await N(function(e,t){const{projectId:r,appId:n,apiKey:o}=e.options;return{url:`${T}/projects/${r}/apps/${n}:exchangeRecaptchaEnterpriseToken?key=${o}`,body:{recaptcha_enterprise_token:t}}}(this._app,r),this._heartbeatServiceProvider)}catch(r){throw(null===(e=r.code)||void 0===e?void 0:e.includes("fetch-status-error"))?(this._throttleData=ue(Number(null===(t=r.customData)||void 0===t?void 0:t.httpStatus),this._throttleData),D.create("throttled",{time:O(this._throttleData.allowRequestsAfter-Date.now()),httpStatus:this._throttleData.httpStatus})):r}return this._throttleData=null,n}initialize(t){this._app=t,this._heartbeatServiceProvider=e(t,"heartbeat"),oe(t,this._siteKey).catch((()=>{}))}isEqual(e){return e instanceof he&&this._siteKey===e._siteKey}}class le{constructor(e){this._customProviderOptions=e}async getToken(){const e=await this._customProviderOptions.getToken(),t=d(e.token),r=null!==t&&t<Date.now()&&t>0?1e3*t:Date.now();return Object.assign(Object.assign({},e),{issuedAtTimeMillis:r})}initialize(e){this._app=e}isEqual(e){return e instanceof le&&this._customProviderOptions.getToken.toString()===e._customProviderOptions.getToken.toString()}}function ue(e,t){if(404===e||403===e)return{backoffCount:1,allowRequestsAfter:Date.now()+864e5,httpStatus:e};{const r=t?t.backoffCount:0,n=function(e,t=1e3,r=2){const n=t*Math.pow(r,e),o=Math.round(.5*n*(Math.random()-.5)*2);return Math.min(144e5,n+o)}(r,1e3,2);return{backoffCount:r+1,allowRequestsAfter:Date.now()+n,httpStatus:e}}}function pe(e){if(e&&Date.now()-e.allowRequestsAfter<=0)throw D.create("throttled",{time:O(e.allowRequestsAfter-Date.now()),httpStatus:e.httpStatus})}function de(r=t(),n){var o;r=(o=r)&&o._delegate?o._delegate:o;const i=e(r,"app-check");if(A().initialized||q(),z()&&U().then((e=>console.log(`App Check debug token: ${e}. You will need to add it to your app's App Check settings in the Firebase console for it to work.`))),i.isInitialized()){const e=i.getImmediate(),t=i.getOptions();if(t.isTokenAutoRefreshEnabled===n.isTokenAutoRefreshEnabled&&t.provider.isEqual(n.provider))return e;throw D.create("already-initialized",{appName:r.name})}const a=i.initialize({options:n});return function(e,t,r){const n=function(e,t){return y.set(e,t),y.get(e)}(e,Object.assign({},m));n.activated=!0,n.provider=t,n.cachedTokenPromise=F(e).then((t=>(t&&ee(t)&&(n.token=t,Q(e,{token:t.token})),t))),n.isTokenAutoRefreshEnabled=void 0===r?e.automaticDataCollectionEnabled:r,n.provider.initialize(e)}(r,n.provider,n.isTokenAutoRefreshEnabled),b(r).isTokenAutoRefreshEnabled&&J(a,"INTERNAL",(()=>{})),a}function ge(e,t){const r=b(e.app);r.tokenRefresher&&(!0===t?r.tokenRefresher.start():r.tokenRefresher.stop()),r.isTokenAutoRefreshEnabled=t}async function fe(e,t){const r=await X(e,t);if(r.error)throw r.error;return{token:r.token}}function Ee(e,t,r,n){let o=()=>{},i=()=>{};return o=null!=t.next?t.next.bind(t):t,null!=t.error?i=t.error.bind(t):r&&(i=r),J(e,"EXTERNAL",o,i),()=>Y(e.app,o)}r(new g("app-check",(e=>function(e,t){return new re(e,t)}(e.getProvider("app").getImmediate(),e.getProvider("heartbeat"))),"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback(((e,t,r)=>{e.getProvider("app-check-internal").initialize()}))),r(new g("app-check-internal",(e=>function(e){return{getToken:t=>X(e,t),addTokenListener:t=>J(e,"INTERNAL",t),removeTokenListener:t=>Y(e.app,t)}}(e.getProvider("app-check").getImmediate())),"PUBLIC").setInstantiationMode("EXPLICIT")),n("@firebase/app-check","0.6.4");export{le as CustomProvider,he as ReCaptchaEnterpriseProvider,ce as ReCaptchaV3Provider,fe as getToken,de as initializeAppCheck,Ee as onTokenChanged,ge as setTokenAutoRefreshEnabled};
1
+ import{_getProvider as e,getApp as t,_registerComponent as r,registerVersion as n}from"https://www.gstatic.com/firebasejs/9.18.0/firebase-app.js";const o={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:"function"==typeof atob,encodeByteArray(e,t){if(!Array.isArray(e))throw Error("encodeByteArray takes an array as a parameter");this.init_();const r=t?this.byteToCharMapWebSafe_:this.byteToCharMap_,n=[];for(let t=0;t<e.length;t+=3){const o=e[t],i=t+1<e.length,a=i?e[t+1]:0,s=t+2<e.length,c=s?e[t+2]:0,h=o>>2,l=(3&o)<<4|a>>4;let u=(15&a)<<2|c>>6,p=63&c;s||(p=64,i||(u=64)),n.push(r[h],r[l],r[u],r[p])}return n.join("")},encodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?btoa(e):this.encodeByteArray(function(e){const t=[];let r=0;for(let n=0;n<e.length;n++){let o=e.charCodeAt(n);o<128?t[r++]=o:o<2048?(t[r++]=o>>6|192,t[r++]=63&o|128):55296==(64512&o)&&n+1<e.length&&56320==(64512&e.charCodeAt(n+1))?(o=65536+((1023&o)<<10)+(1023&e.charCodeAt(++n)),t[r++]=o>>18|240,t[r++]=o>>12&63|128,t[r++]=o>>6&63|128,t[r++]=63&o|128):(t[r++]=o>>12|224,t[r++]=o>>6&63|128,t[r++]=63&o|128)}return t}(e),t)},decodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?atob(e):function(e){const t=[];let r=0,n=0;for(;r<e.length;){const o=e[r++];if(o<128)t[n++]=String.fromCharCode(o);else if(o>191&&o<224){const i=e[r++];t[n++]=String.fromCharCode((31&o)<<6|63&i)}else if(o>239&&o<365){const i=((7&o)<<18|(63&e[r++])<<12|(63&e[r++])<<6|63&e[r++])-65536;t[n++]=String.fromCharCode(55296+(i>>10)),t[n++]=String.fromCharCode(56320+(1023&i))}else{const i=e[r++],a=e[r++];t[n++]=String.fromCharCode((15&o)<<12|(63&i)<<6|63&a)}}return t.join("")}(this.decodeStringToByteArray(e,t))},decodeStringToByteArray(e,t){this.init_();const r=t?this.charToByteMapWebSafe_:this.charToByteMap_,n=[];for(let t=0;t<e.length;){const o=r[e.charAt(t++)],a=t<e.length?r[e.charAt(t)]:0;++t;const s=t<e.length?r[e.charAt(t)]:64;++t;const c=t<e.length?r[e.charAt(t)]:64;if(++t,null==o||null==a||null==s||null==c)throw new i;const h=o<<2|a>>4;if(n.push(h),64!==s){const e=a<<4&240|s>>2;if(n.push(e),64!==c){const e=s<<6&192|c;n.push(e)}}}return n},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let e=0;e<this.ENCODED_VALS.length;e++)this.byteToCharMap_[e]=this.ENCODED_VALS.charAt(e),this.charToByteMap_[this.byteToCharMap_[e]]=e,this.byteToCharMapWebSafe_[e]=this.ENCODED_VALS_WEBSAFE.charAt(e),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[e]]=e,e>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(e)]=e,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(e)]=e)}}};class i extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const a=function(e){try{return o.decodeString(e,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};class s{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise(((e,t)=>{this.resolve=e,this.reject=t}))}wrapCallback(e){return(t,r)=>{t?this.reject(t):this.resolve(r),"function"==typeof e&&(this.promise.catch((()=>{})),1===e.length?e(t):e(t,r))}}}function c(){try{return"object"==typeof indexedDB}catch(e){return!1}}class h extends Error{constructor(e,t,r){super(t),this.code=e,this.customData=r,this.name="FirebaseError",Object.setPrototypeOf(this,h.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,l.prototype.create)}}class l{constructor(e,t,r){this.service=e,this.serviceName=t,this.errors=r}create(e,...t){const r=t[0]||{},n=`${this.service}/${e}`,o=this.errors[e],i=o?function(e,t){return e.replace(u,((e,r)=>{const n=t[r];return null!=n?String(n):`<${r}?>`}))}(o,r):"Error",a=`${this.serviceName}: ${i} (${n}).`;return new h(n,a,r)}}const u=/\{\$([^}]+)}/g;function p(e){return JSON.parse(e)}const d=function(e){const t=function(e){let t={},r={},n={},o="";try{const i=e.split(".");t=p(a(i[0])||""),r=p(a(i[1])||""),o=i[2],n=r.d||{},delete r.d}catch(e){}return{header:t,claims:r,data:n,signature:o}}(e).claims;return"object"==typeof t&&t.hasOwnProperty("iat")?t.iat:null};class g{constructor(e,t,r){this.name=e,this.instanceFactory=t,this.type=r,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(e){return this.instantiationMode=e,this}setMultipleInstances(e){return this.multipleInstances=e,this}setServiceProps(e){return this.serviceProps=e,this}setInstanceCreatedCallback(e){return this.onInstanceCreated=e,this}}var f;!function(e){e[e.DEBUG=0]="DEBUG",e[e.VERBOSE=1]="VERBOSE",e[e.INFO=2]="INFO",e[e.WARN=3]="WARN",e[e.ERROR=4]="ERROR",e[e.SILENT=5]="SILENT"}(f||(f={}));const E={debug:f.DEBUG,verbose:f.VERBOSE,info:f.INFO,warn:f.WARN,error:f.ERROR,silent:f.SILENT},w=f.INFO,_={[f.DEBUG]:"log",[f.VERBOSE]:"log",[f.INFO]:"info",[f.WARN]:"warn",[f.ERROR]:"error"},k=(e,t,...r)=>{if(t<e.logLevel)return;const n=(new Date).toISOString(),o=_[t];if(!o)throw new Error(`Attempted to log a message with an invalid logType (value: ${t})`);console[o](`[${n}] ${e.name}:`,...r)};const y=new Map,m={activated:!1,tokenObservers:[]},v={initialized:!1,enabled:!1};function b(e){return y.get(e)||Object.assign({},m)}function A(){return v}const T="https://content-firebaseappcheck.googleapis.com/v1",S=3e4,C=96e4;class R{constructor(e,t,r,n,o){if(this.operation=e,this.retryPolicy=t,this.getWaitDuration=r,this.lowerBound=n,this.upperBound=o,this.pending=null,this.nextErrorWaitInterval=n,n>o)throw new Error("Proactive refresh lower bound greater than upper bound!")}start(){this.nextErrorWaitInterval=this.lowerBound,this.process(!0).catch((()=>{}))}stop(){this.pending&&(this.pending.reject("cancelled"),this.pending=null)}isRunning(){return!!this.pending}async process(e){this.stop();try{this.pending=new s,await(t=this.getNextRun(e),new Promise((e=>{setTimeout(e,t)}))),this.pending.resolve(),await this.pending.promise,this.pending=new s,await this.operation(),this.pending.resolve(),await this.pending.promise,this.process(!0).catch((()=>{}))}catch(e){this.retryPolicy(e)?this.process(!1).catch((()=>{})):this.stop()}var t}getNextRun(e){if(e)return this.nextErrorWaitInterval=this.lowerBound,this.getWaitDuration();{const e=this.nextErrorWaitInterval;return this.nextErrorWaitInterval*=2,this.nextErrorWaitInterval>this.upperBound&&(this.nextErrorWaitInterval=this.upperBound),e}}}const D=new l("appCheck","AppCheck",{"already-initialized":"You have already called initializeAppCheck() for FirebaseApp {$appName} with different options. To avoid this error, call initializeAppCheck() with the same options as when it was originally called. This will return the already initialized instance.","use-before-activation":"App Check is being used before initializeAppCheck() is called for FirebaseApp {$appName}. Call initializeAppCheck() before instantiating other Firebase services.","fetch-network-error":"Fetch failed to connect to a network. Check Internet connection. Original error: {$originalErrorMessage}.","fetch-parse-error":"Fetch client could not parse response. Original error: {$originalErrorMessage}.","fetch-status-error":"Fetch server returned an HTTP error status. HTTP status: {$httpStatus}.","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}.","recaptcha-error":"ReCAPTCHA error.",throttled:"Requests throttled due to {$httpStatus} error. Attempts allowed again after {$time}"});function x(e=!1){var t;return e?null===(t=self.grecaptcha)||void 0===t?void 0:t.enterprise:self.grecaptcha}function P(e){if(!b(e).activated)throw D.create("use-before-activation",{appName:e.name})}function O(e){const t=Math.round(e/1e3),r=Math.floor(t/86400),n=Math.floor((t-3600*r*24)/3600),o=Math.floor((t-3600*r*24-3600*n)/60),i=t-3600*r*24-3600*n-60*o;let a="";return r&&(a+=I(r)+"d:"),n&&(a+=I(n)+"h:"),a+=I(o)+"m:"+I(i)+"s",a}function I(e){return 0===e?"00":e>=10?e.toString():"0"+e}async function N({url:e,body:t},r){const n={"Content-Type":"application/json"},o=r.getImmediate({optional:!0});if(o){const e=await o.getHeartbeatsHeader();e&&(n["X-Firebase-Client"]=e)}const i={method:"POST",body:JSON.stringify(t),headers:n};let a,s;try{a=await fetch(e,i)}catch(e){throw D.create("fetch-network-error",{originalErrorMessage:null==e?void 0:e.message})}if(200!==a.status)throw D.create("fetch-status-error",{httpStatus:a.status});try{s=await a.json()}catch(e){throw D.create("fetch-parse-error",{originalErrorMessage:null==e?void 0:e.message})}const c=s.ttl.match(/^([\d.]+)(s)$/);if(!c||!c[2]||isNaN(Number(c[1])))throw D.create("fetch-parse-error",{originalErrorMessage:`ttl field (timeToLive) is not in standard Protobuf Duration format: ${s.ttl}`});const h=1e3*Number(c[1]),l=Date.now();return{token:s.token,expireTimeMillis:l+h,issuedAtTimeMillis:l}}const M="firebase-app-check-store";let B=null;function L(){return B||(B=new Promise(((e,t)=>{try{const r=indexedDB.open("firebase-app-check-database",1);r.onsuccess=t=>{e(t.target.result)},r.onerror=e=>{var r;t(D.create("storage-open",{originalErrorMessage:null===(r=e.target.error)||void 0===r?void 0:r.message}))},r.onupgradeneeded=e=>{const t=e.target.result;if(0===e.oldVersion)t.createObjectStore(M,{keyPath:"compositeKey"})}}catch(e){t(D.create("storage-open",{originalErrorMessage:null==e?void 0:e.message}))}})),B)}async function H(e,t){const r=(await L()).transaction(M,"readwrite"),n=r.objectStore(M).put({compositeKey:e,value:t});return new Promise(((e,t)=>{n.onsuccess=t=>{e()},r.onerror=e=>{var r;t(D.create("storage-set",{originalErrorMessage:null===(r=e.target.error)||void 0===r?void 0:r.message}))}}))}async function $(e){const t=(await L()).transaction(M,"readonly"),r=t.objectStore(M).get(e);return new Promise(((e,n)=>{r.onsuccess=t=>{const r=t.target.result;e(r?r.value:void 0)},t.onerror=e=>{var t;n(D.create("storage-get",{originalErrorMessage:null===(t=e.target.error)||void 0===t?void 0:t.message}))}}))}function j(e){return`${e.options.appId}-${e.name}`}const W=new class{constructor(e){this.name=e,this._logLevel=w,this._logHandler=k,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in f))throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel="string"==typeof e?E[e]:e}get logHandler(){return this._logHandler}set logHandler(e){if("function"!=typeof e)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,f.DEBUG,...e),this._logHandler(this,f.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,f.VERBOSE,...e),this._logHandler(this,f.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,f.INFO,...e),this._logHandler(this,f.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,f.WARN,...e),this._logHandler(this,f.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,f.ERROR,...e),this._logHandler(this,f.ERROR,...e)}}("@firebase/app-check");async function F(e){if(c()){let t;try{t=await function(e){return $(j(e))}(e)}catch(e){W.warn(`Failed to read token from IndexedDB. Error: ${e}`)}return t}}function V(e,t){return c()?function(e,t){return H(j(e),t)}(e,t).catch((e=>{W.warn(`Failed to write token to IndexedDB. Error: ${e}`)})):Promise.resolve()}async function K(){let e;try{e=await $("debug-token")}catch(e){}if(e)return e;{const e="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(e=>{const t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}));return(t=e,H("debug-token",t)).catch((e=>W.warn(`Failed to persist debug token to IndexedDB. Error: ${e}`))),e}var t}function z(){return A().enabled}async function U(){const e=A();if(e.enabled&&e.token)return e.token.promise;throw Error("\n Can't get debug token in production mode.\n ")}function q(){const e=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if("undefined"!=typeof global)return global;throw new Error("Unable to locate global object.")}(),t=A();if(t.initialized=!0,"string"!=typeof e.FIREBASE_APPCHECK_DEBUG_TOKEN&&!0!==e.FIREBASE_APPCHECK_DEBUG_TOKEN)return;t.enabled=!0;const r=new s;t.token=r,"string"==typeof e.FIREBASE_APPCHECK_DEBUG_TOKEN?r.resolve(e.FIREBASE_APPCHECK_DEBUG_TOKEN):r.resolve(K())}const G={error:"UNKNOWN_ERROR"};async function X(e,t=!1){const r=e.app;P(r);const n=b(r);let o,i=n.token;if(i&&!ee(i)&&(n.token=void 0,i=void 0),!i){const e=await n.cachedTokenPromise;e&&(ee(e)?i=e:await V(r,void 0))}if(!t&&i&&ee(i))return{token:i.token};let a,s=!1;if(z()){n.exchangeTokenPromise||(n.exchangeTokenPromise=N(function(e,t){const{projectId:r,appId:n,apiKey:o}=e.options;return{url:`${T}/projects/${r}/apps/${n}:exchangeDebugToken?key=${o}`,body:{debug_token:t}}}(r,await U()),e.heartbeatServiceProvider).finally((()=>{n.exchangeTokenPromise=void 0})),s=!0);const t=await n.exchangeTokenPromise;return await V(r,t),n.token=t,{token:t.token}}try{n.exchangeTokenPromise||(n.exchangeTokenPromise=n.provider.getToken().finally((()=>{n.exchangeTokenPromise=void 0})),s=!0),i=await b(r).exchangeTokenPromise}catch(e){"appCheck/throttled"===e.code?W.warn(e.message):W.error(e),o=e}return i?o?a=ee(i)?{token:i.token,internalError:o}:te(o):(a={token:i.token},n.token=i,await V(r,i)):a=te(o),s&&Q(r,a),a}function J(e,t,r,n){const{app:o}=e,i=b(o),a={next:r,error:n,type:t};if(i.tokenObservers=[...i.tokenObservers,a],i.token&&ee(i.token)){const t=i.token;Promise.resolve().then((()=>{r({token:t.token}),Z(e)})).catch((()=>{}))}i.cachedTokenPromise.then((()=>Z(e)))}function Y(e,t){const r=b(e),n=r.tokenObservers.filter((e=>e.next!==t));0===n.length&&r.tokenRefresher&&r.tokenRefresher.isRunning()&&r.tokenRefresher.stop(),r.tokenObservers=n}function Z(e){const{app:t}=e,r=b(t);let n=r.tokenRefresher;n||(n=function(e){const{app:t}=e;return new R((async()=>{let r;if(r=b(t).token?await X(e,!0):await X(e),r.error)throw r.error;if(r.internalError)throw r.internalError}),(()=>!0),(()=>{const e=b(t);if(e.token){let t=e.token.issuedAtTimeMillis+.5*(e.token.expireTimeMillis-e.token.issuedAtTimeMillis)+3e5;const r=e.token.expireTimeMillis-3e5;return t=Math.min(t,r),Math.max(0,t-Date.now())}return 0}),S,C)}(e),r.tokenRefresher=n),!n.isRunning()&&r.isTokenAutoRefreshEnabled&&n.start()}function Q(e,t){const r=b(e).tokenObservers;for(const e of r)try{"EXTERNAL"===e.type&&null!=t.error?e.error(t.error):e.next(t)}catch(e){}}function ee(e){return e.expireTimeMillis-Date.now()>0}function te(e){return{token:(t=G,o.encodeString(JSON.stringify(t),!1)),error:e};var t}class re{constructor(e,t){this.app=e,this.heartbeatServiceProvider=t}_delete(){const{tokenObservers:e}=b(this.app);for(const t of e)Y(this.app,t.next);return Promise.resolve()}}function ne(e,t){const r=new s;b(e).reCAPTCHAState={initialized:r};const n=ae(e),o=x(!1);return o?ie(e,t,o,n,r):function(e){const t=document.createElement("script");t.src="https://www.google.com/recaptcha/api.js",t.onload=e,document.head.appendChild(t)}((()=>{const o=x(!1);if(!o)throw new Error("no recaptcha");ie(e,t,o,n,r)})),r.promise}function oe(e,t){const r=new s;b(e).reCAPTCHAState={initialized:r};const n=ae(e),o=x(!0);return o?ie(e,t,o,n,r):function(e){const t=document.createElement("script");t.src="https://www.google.com/recaptcha/enterprise.js",t.onload=e,document.head.appendChild(t)}((()=>{const o=x(!0);if(!o)throw new Error("no recaptcha");ie(e,t,o,n,r)})),r.promise}function ie(e,t,r,n,o){r.ready((()=>{!function(e,t,r,n){const o=r.render(n,{sitekey:t,size:"invisible"}),i=b(e);i.reCAPTCHAState=Object.assign(Object.assign({},i.reCAPTCHAState),{widgetId:o})}(e,t,r,n),o.resolve(r)}))}function ae(e){const t=`fire_app_check_${e.name}`,r=document.createElement("div");return r.id=t,r.style.display="none",document.body.appendChild(r),t}async function se(e){P(e);const t=b(e).reCAPTCHAState,r=await t.initialized.promise;return new Promise(((t,n)=>{const o=b(e).reCAPTCHAState;r.ready((()=>{t(r.execute(o.widgetId,{action:"fire_app_check"}))}))}))}class ce{constructor(e){this._siteKey=e,this._throttleData=null}async getToken(){var e,t;pe(this._throttleData);const r=await se(this._app).catch((e=>{throw D.create("recaptcha-error")}));let n;try{n=await N(function(e,t){const{projectId:r,appId:n,apiKey:o}=e.options;return{url:`${T}/projects/${r}/apps/${n}:exchangeRecaptchaV3Token?key=${o}`,body:{recaptcha_v3_token:t}}}(this._app,r),this._heartbeatServiceProvider)}catch(r){throw(null===(e=r.code)||void 0===e?void 0:e.includes("fetch-status-error"))?(this._throttleData=ue(Number(null===(t=r.customData)||void 0===t?void 0:t.httpStatus),this._throttleData),D.create("throttled",{time:O(this._throttleData.allowRequestsAfter-Date.now()),httpStatus:this._throttleData.httpStatus})):r}return this._throttleData=null,n}initialize(t){this._app=t,this._heartbeatServiceProvider=e(t,"heartbeat"),ne(t,this._siteKey).catch((()=>{}))}isEqual(e){return e instanceof ce&&this._siteKey===e._siteKey}}class he{constructor(e){this._siteKey=e,this._throttleData=null}async getToken(){var e,t;pe(this._throttleData);const r=await se(this._app).catch((e=>{throw D.create("recaptcha-error")}));let n;try{n=await N(function(e,t){const{projectId:r,appId:n,apiKey:o}=e.options;return{url:`${T}/projects/${r}/apps/${n}:exchangeRecaptchaEnterpriseToken?key=${o}`,body:{recaptcha_enterprise_token:t}}}(this._app,r),this._heartbeatServiceProvider)}catch(r){throw(null===(e=r.code)||void 0===e?void 0:e.includes("fetch-status-error"))?(this._throttleData=ue(Number(null===(t=r.customData)||void 0===t?void 0:t.httpStatus),this._throttleData),D.create("throttled",{time:O(this._throttleData.allowRequestsAfter-Date.now()),httpStatus:this._throttleData.httpStatus})):r}return this._throttleData=null,n}initialize(t){this._app=t,this._heartbeatServiceProvider=e(t,"heartbeat"),oe(t,this._siteKey).catch((()=>{}))}isEqual(e){return e instanceof he&&this._siteKey===e._siteKey}}class le{constructor(e){this._customProviderOptions=e}async getToken(){const e=await this._customProviderOptions.getToken(),t=d(e.token),r=null!==t&&t<Date.now()&&t>0?1e3*t:Date.now();return Object.assign(Object.assign({},e),{issuedAtTimeMillis:r})}initialize(e){this._app=e}isEqual(e){return e instanceof le&&this._customProviderOptions.getToken.toString()===e._customProviderOptions.getToken.toString()}}function ue(e,t){if(404===e||403===e)return{backoffCount:1,allowRequestsAfter:Date.now()+864e5,httpStatus:e};{const r=t?t.backoffCount:0,n=function(e,t=1e3,r=2){const n=t*Math.pow(r,e),o=Math.round(.5*n*(Math.random()-.5)*2);return Math.min(144e5,n+o)}(r,1e3,2);return{backoffCount:r+1,allowRequestsAfter:Date.now()+n,httpStatus:e}}}function pe(e){if(e&&Date.now()-e.allowRequestsAfter<=0)throw D.create("throttled",{time:O(e.allowRequestsAfter-Date.now()),httpStatus:e.httpStatus})}function de(r=t(),n){var o;r=(o=r)&&o._delegate?o._delegate:o;const i=e(r,"app-check");if(A().initialized||q(),z()&&U().then((e=>console.log(`App Check debug token: ${e}. You will need to add it to your app's App Check settings in the Firebase console for it to work.`))),i.isInitialized()){const e=i.getImmediate(),t=i.getOptions();if(t.isTokenAutoRefreshEnabled===n.isTokenAutoRefreshEnabled&&t.provider.isEqual(n.provider))return e;throw D.create("already-initialized",{appName:r.name})}const a=i.initialize({options:n});return function(e,t,r){const n=function(e,t){return y.set(e,t),y.get(e)}(e,Object.assign({},m));n.activated=!0,n.provider=t,n.cachedTokenPromise=F(e).then((t=>(t&&ee(t)&&(n.token=t,Q(e,{token:t.token})),t))),n.isTokenAutoRefreshEnabled=void 0===r?e.automaticDataCollectionEnabled:r,n.provider.initialize(e)}(r,n.provider,n.isTokenAutoRefreshEnabled),b(r).isTokenAutoRefreshEnabled&&J(a,"INTERNAL",(()=>{})),a}function ge(e,t){const r=b(e.app);r.tokenRefresher&&(!0===t?r.tokenRefresher.start():r.tokenRefresher.stop()),r.isTokenAutoRefreshEnabled=t}async function fe(e,t){const r=await X(e,t);if(r.error)throw r.error;return{token:r.token}}function Ee(e,t,r,n){let o=()=>{},i=()=>{};return o=null!=t.next?t.next.bind(t):t,null!=t.error?i=t.error.bind(t):r&&(i=r),J(e,"EXTERNAL",o,i),()=>Y(e.app,o)}r(new g("app-check",(e=>function(e,t){return new re(e,t)}(e.getProvider("app").getImmediate(),e.getProvider("heartbeat"))),"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback(((e,t,r)=>{e.getProvider("app-check-internal").initialize()}))),r(new g("app-check-internal",(e=>function(e){return{getToken:t=>X(e,t),addTokenListener:t=>J(e,"INTERNAL",t),removeTokenListener:t=>Y(e.app,t)}}(e.getProvider("app-check").getImmediate())),"PUBLIC").setInstantiationMode("EXPLICIT")),n("@firebase/app-check","0.6.4");export{le as CustomProvider,he as ReCaptchaEnterpriseProvider,ce as ReCaptchaV3Provider,fe as getToken,de as initializeAppCheck,Ee as onTokenChanged,ge as setTokenAutoRefreshEnabled};
2
2
 
3
3
  //# sourceMappingURL=firebase-app-check.js.map
@@ -1,8 +1,8 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).firebase=t()}(this,function(){"use strict";const r=function(t){const r=[];let n=0;for(let a=0;a<t.length;a++){let e=t.charCodeAt(a);e<128?r[n++]=e:(e<2048?r[n++]=e>>6|192:(55296==(64512&e)&&a+1<t.length&&56320==(64512&t.charCodeAt(a+1))?(e=65536+((1023&e)<<10)+(1023&t.charCodeAt(++a)),r[n++]=e>>18|240,r[n++]=e>>12&63|128):r[n++]=e>>12|224,r[n++]=e>>6&63|128),r[n++]=63&e|128)}return r},n={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:"function"==typeof atob,encodeByteArray(r,e){if(!Array.isArray(r))throw Error("encodeByteArray takes an array as a parameter");this.init_();var n=e?this.byteToCharMapWebSafe_:this.byteToCharMap_;const a=[];for(let l=0;l<r.length;l+=3){var i=r[l],s=l+1<r.length,o=s?r[l+1]:0,c=l+2<r.length,h=c?r[l+2]:0;let e=(15&o)<<2|h>>6,t=63&h;c||(t=64,s||(e=64)),a.push(n[i>>2],n[(3&i)<<4|o>>4],n[e],n[t])}return a.join("")},encodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?btoa(e):this.encodeByteArray(r(e),t)},decodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?atob(e):function(e){const t=[];let r=0,n=0;for(;r<e.length;){var a,i,s=e[r++];s<128?t[n++]=String.fromCharCode(s):191<s&&s<224?(a=e[r++],t[n++]=String.fromCharCode((31&s)<<6|63&a)):239<s&&s<365?(i=((7&s)<<18|(63&e[r++])<<12|(63&e[r++])<<6|63&e[r++])-65536,t[n++]=String.fromCharCode(55296+(i>>10)),t[n++]=String.fromCharCode(56320+(1023&i))):(a=e[r++],i=e[r++],t[n++]=String.fromCharCode((15&s)<<12|(63&a)<<6|63&i))}return t.join("")}(this.decodeStringToByteArray(e,t))},decodeStringToByteArray(e,t){this.init_();var r=t?this.charToByteMapWebSafe_:this.charToByteMap_;const n=[];for(let c=0;c<e.length;){var a=r[e.charAt(c++)],i=c<e.length?r[e.charAt(c)]:0;++c;var s=c<e.length?r[e.charAt(c)]:64;++c;var o=c<e.length?r[e.charAt(c)]:64;if(++c,null==a||null==i||null==s||null==o)throw new h;n.push(a<<2|i>>4),64!==s&&(n.push(i<<4&240|s>>2),64!==o&&n.push(s<<6&192|o))}return n},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let e=0;e<this.ENCODED_VALS.length;e++)this.byteToCharMap_[e]=this.ENCODED_VALS.charAt(e),this.charToByteMap_[this.byteToCharMap_[e]]=e,this.byteToCharMapWebSafe_[e]=this.ENCODED_VALS_WEBSAFE.charAt(e),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[e]]=e,e>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(e)]=e,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(e)]=e)}}};class h extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const a=function(e){return e=e,t=r(e),n.encodeByteArray(t,!0).replace(/\./g,"");var t};function c(e,t){if(!(t instanceof Object))return t;switch(t.constructor){case Date:const r=t;return new Date(r.getTime());case Object:void 0===e&&(e={});break;case Array:e=[];break;default:return t}for(const n in t)t.hasOwnProperty(n)&&"__proto__"!==n&&(e[n]=c(e[n],t[n]));return e}const e=()=>function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if("undefined"!=typeof global)return global;throw new Error("Unable to locate global object.")}().__FIREBASE_DEFAULTS__,t=()=>{if("undefined"!=typeof document){let e;try{e=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch(e){return}var t=e&&function(e){try{return n.decodeString(e,!0)}catch(e){console.error("base64Decode failed: ",e)}return null}(e[1]);return t&&JSON.parse(t)}},i=()=>{try{return e()||(()=>{if("undefined"!=typeof process&&void 0!==process.env){var e=process.env.__FIREBASE_DEFAULTS__;return e?JSON.parse(e):void 0}})()||t()}catch(e){return void console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${e}`)}},l=()=>{var e;return null===(e=i())||void 0===e?void 0:e.config};class s{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}wrapCallback(r){return(e,t)=>{e?this.reject(e):this.resolve(t),"function"==typeof r&&(this.promise.catch(()=>{}),1===r.length?r(e):r(e,t))}}}class o extends Error{constructor(e,t,r){super(t),this.code=e,this.customData=r,this.name="FirebaseError",Object.setPrototypeOf(this,o.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,d.prototype.create)}}class d{constructor(e,t,r){this.service=e,this.serviceName=t,this.errors=r}create(e,...t){var n,r=t[0]||{},a=`${this.service}/${e}`,i=this.errors[e],i=i?(n=r,i.replace(p,(e,t)=>{var r=n[t];return null!=r?String(r):`<${t}?>`})):"Error",i=`${this.serviceName}: ${i} (${a}).`;return new o(a,i,r)}}const p=/\{\$([^}]+)}/g;function u(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function f(e,t){if(e===t)return 1;const r=Object.keys(e),n=Object.keys(t);for(const s of r){if(!n.includes(s))return;var a=e[s],i=t[s];if(g(a)&&g(i)){if(!f(a,i))return}else if(a!==i)return}for(const o of n)if(!r.includes(o))return;return 1}function g(e){return null!==e&&"object"==typeof e}function m(e,t){const r=new b(e,t);return r.subscribe.bind(r)}class b{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(e=>{this.error(e)})}next(t){this.forEachObserver(e=>{e.next(t)})}error(t){this.forEachObserver(e=>{e.error(t)}),this.close(t)}complete(){this.forEachObserver(e=>{e.complete()}),this.close()}subscribe(e,t,r){let n;if(void 0===e&&void 0===t&&void 0===r)throw new Error("Missing Observer.");n=function(e,t){if("object"!=typeof e||null===e)return!1;for(const r of t)if(r in e&&"function"==typeof e[r])return!0;return!1}(e,["next","error","complete"])?e:{next:e,error:t,complete:r},void 0===n.next&&(n.next=v),void 0===n.error&&(n.error=v),void 0===n.complete&&(n.complete=v);var a=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(()=>{try{this.finalError?n.error(this.finalError):n.complete()}catch(e){}}),this.observers.push(n),a}unsubscribeOne(e){void 0!==this.observers&&void 0!==this.observers[e]&&(delete this.observers[e],--this.observerCount,0===this.observerCount&&void 0!==this.onNoObservers&&this.onNoObservers(this))}forEachObserver(t){if(!this.finalized)for(let e=0;e<this.observers.length;e++)this.sendOne(e,t)}sendOne(e,t){this.task.then(()=>{if(void 0!==this.observers&&void 0!==this.observers[e])try{t(this.observers[e])}catch(e){"undefined"!=typeof console&&console.error&&console.error(e)}})}close(e){this.finalized||(this.finalized=!0,void 0!==e&&(this.finalError=e),this.task.then(()=>{this.observers=void 0,this.onNoObservers=void 0}))}}function v(){}class _{constructor(e,t,r){this.name=e,this.instanceFactory=t,this.type=r,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(e){return this.instantiationMode=e,this}setMultipleInstances(e){return this.multipleInstances=e,this}setServiceProps(e){return this.serviceProps=e,this}setInstanceCreatedCallback(e){return this.onInstanceCreated=e,this}}const E="[DEFAULT]";class y{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){var t=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(t)){const n=new s;if(this.instancesDeferred.set(t,n),this.isInitialized(t)||this.shouldAutoInitialize())try{var r=this.getOrInitializeService({instanceIdentifier:t});r&&n.resolve(r)}catch(e){}}return this.instancesDeferred.get(t).promise}getImmediate(e){var t=this.normalizeInstanceIdentifier(null==e?void 0:e.identifier),r=null!==(r=null==e?void 0:e.optional)&&void 0!==r&&r;if(!this.isInitialized(t)&&!this.shouldAutoInitialize()){if(r)return null;throw Error(`Service ${this.name} is not available`)}try{return this.getOrInitializeService({instanceIdentifier:t})}catch(e){if(r)return null;throw e}}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("EAGER"===e.instantiationMode)try{this.getOrInitializeService({instanceIdentifier:E})}catch(e){}for(var[t,r]of this.instancesDeferred.entries()){t=this.normalizeInstanceIdentifier(t);try{var n=this.getOrInitializeService({instanceIdentifier:t});r.resolve(n)}catch(e){}}}}clearInstance(e=E){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(e=>"INTERNAL"in e).map(e=>e.INTERNAL.delete()),...e.filter(e=>"_delete"in e).map(e=>e._delete())])}isComponentSet(){return null!=this.component}isInitialized(e=E){return this.instances.has(e)}getOptions(e=E){return this.instancesOptions.get(e)||{}}initialize(e={}){var{options:t={}}=e,r=this.normalizeInstanceIdentifier(e.instanceIdentifier);if(this.isInitialized(r))throw Error(`${this.name}(${r}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);var n,a,i=this.getOrInitializeService({instanceIdentifier:r,options:t});for([n,a]of this.instancesDeferred.entries())r===this.normalizeInstanceIdentifier(n)&&a.resolve(i);return i}onInit(e,t){var r=this.normalizeInstanceIdentifier(t);const n=null!==(a=this.onInitCallbacks.get(r))&&void 0!==a?a:new Set;n.add(e),this.onInitCallbacks.set(r,n);var a=this.instances.get(r);return a&&e(a,r),()=>{n.delete(e)}}invokeOnInitCallbacks(e,t){var r=this.onInitCallbacks.get(t);if(r)for(const n of r)try{n(e,t)}catch(e){}}getOrInitializeService({instanceIdentifier:e,options:t={}}){let r=this.instances.get(e);if(!r&&this.component&&(r=this.component.instanceFactory(this.container,{instanceIdentifier:(n=e)===E?void 0:n,options:t}),this.instances.set(e,r),this.instancesOptions.set(e,t),this.invokeOnInitCallbacks(r,e),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,e,r)}catch(e){}var n;return r||null}normalizeInstanceIdentifier(e=E){return!this.component||this.component.multipleInstances?e:E}shouldAutoInitialize(){return!!this.component&&"EXPLICIT"!==this.component.instantiationMode}}class I{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){const t=this.getProvider(e.name);t.isComponentSet()&&this.providers.delete(e.name),this.addComponent(e)}getProvider(e){if(this.providers.has(e))return this.providers.get(e);var t=new y(e,this);return this.providers.set(e,t),t}getProviders(){return Array.from(this.providers.values())}}const w=[];var C,D,S;(D=C=C||{})[D.DEBUG=0]="DEBUG",D[D.VERBOSE=1]="VERBOSE",D[D.INFO=2]="INFO",D[D.WARN=3]="WARN",D[D.ERROR=4]="ERROR",D[D.SILENT=5]="SILENT";const A={debug:C.DEBUG,verbose:C.VERBOSE,info:C.INFO,warn:C.WARN,error:C.ERROR,silent:C.SILENT},O=C.INFO,L={[C.DEBUG]:"log",[C.VERBOSE]:"log",[C.INFO]:"info",[C.WARN]:"warn",[C.ERROR]:"error"},N=(e,t,...r)=>{if(!(t<e.logLevel)){var n=(new Date).toISOString(),a=L[t];if(!a)throw new Error(`Attempted to log a message with an invalid logType (value: ${t})`);console[a](`[${n}] ${e.name}:`,...r)}};class B{constructor(e){this.name=e,this._logLevel=O,this._logHandler=N,this._userLogHandler=null,w.push(this)}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in C))throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel="string"==typeof e?A[e]:e}get logHandler(){return this._logHandler}set logHandler(e){if("function"!=typeof e)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,C.DEBUG,...e),this._logHandler(this,C.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,C.VERBOSE,...e),this._logHandler(this,C.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,C.INFO,...e),this._logHandler(this,C.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,C.WARN,...e),this._logHandler(this,C.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,C.ERROR,...e),this._logHandler(this,C.ERROR,...e)}}const T=(t,e)=>e.some(e=>t instanceof e);let P,M;const R=new WeakMap,k=new WeakMap,F=new WeakMap,$=new WeakMap,j=new WeakMap;let H={get(e,t,r){if(e instanceof IDBTransaction){if("done"===t)return k.get(e);if("objectStoreNames"===t)return e.objectStoreNames||F.get(e);if("store"===t)return r.objectStoreNames[1]?void 0:r.objectStore(r.objectStoreNames[0])}return V(e[t])},set(e,t,r){return e[t]=r,!0},has(e,t){return e instanceof IDBTransaction&&("done"===t||"store"===t)||t in e}};function x(n){return n!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(M=M||[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey]).includes(n)?function(...e){return n.apply(U(this),e),V(R.get(this))}:function(...e){return V(n.apply(U(this),e))}:function(e,...t){var r=n.call(U(this),e,...t);return F.set(r,e.sort?e.sort():[e]),V(r)}}function z(e){return"function"==typeof e?x(e):(e instanceof IDBTransaction&&(i=e,k.has(i)||(t=new Promise((e,t)=>{const r=()=>{i.removeEventListener("complete",n),i.removeEventListener("error",a),i.removeEventListener("abort",a)},n=()=>{e(),r()},a=()=>{t(i.error||new DOMException("AbortError","AbortError")),r()};i.addEventListener("complete",n),i.addEventListener("error",a),i.addEventListener("abort",a)}),k.set(i,t))),T(e,P=P||[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])?new Proxy(e,H):e);var i,t}function V(e){if(e instanceof IDBRequest)return function(i){const e=new Promise((e,t)=>{const r=()=>{i.removeEventListener("success",n),i.removeEventListener("error",a)},n=()=>{e(V(i.result)),r()},a=()=>{t(i.error),r()};i.addEventListener("success",n),i.addEventListener("error",a)});return e.then(e=>{e instanceof IDBCursor&&R.set(e,i)}).catch(()=>{}),j.set(e,i),e}(e);if($.has(e))return $.get(e);var t=z(e);return t!==e&&($.set(e,t),j.set(t,e)),t}const U=e=>j.get(e);const W=["get","getKey","getAll","getAllKeys","count"],G=["put","add","delete","clear"],J=new Map;function K(e,t){if(e instanceof IDBDatabase&&!(t in e)&&"string"==typeof t){if(J.get(t))return J.get(t);const a=t.replace(/FromIndex$/,""),i=t!==a,s=G.includes(a);if(a in(i?IDBIndex:IDBObjectStore).prototype&&(s||W.includes(a))){var r=async function(e,...t){var r=this.transaction(e,s?"readwrite":"readonly");let n=r.store;return i&&(n=n.index(t.shift())),(await Promise.all([n[a](...t),s&&r.done]))[0]};return J.set(t,r),r}}}H={...S=H,get:(e,t,r)=>K(e,t)||S.get(e,t,r),has:(e,t)=>!!K(e,t)||S.has(e,t)};class Y{constructor(e){this.container=e}getPlatformInfoString(){const e=this.container.getProviders();return e.map(e=>{if("VERSION"!==(null==(t=e.getComponent())?void 0:t.type))return null;var t,t=e.getImmediate();return`${t.library}/${t.version}`}).filter(e=>e).join(" ")}}const X="@firebase/app",q=new B("@firebase/app");var Z;const Q="[DEFAULT]",ee={"@firebase/app":"fire-core","@firebase/app-compat":"fire-core-compat","@firebase/analytics":"fire-analytics","@firebase/analytics-compat":"fire-analytics-compat","@firebase/app-check":"fire-app-check","@firebase/app-check-compat":"fire-app-check-compat","@firebase/auth":"fire-auth","@firebase/auth-compat":"fire-auth-compat","@firebase/database":"fire-rtdb","@firebase/database-compat":"fire-rtdb-compat","@firebase/functions":"fire-fn","@firebase/functions-compat":"fire-fn-compat","@firebase/installations":"fire-iid","@firebase/installations-compat":"fire-iid-compat","@firebase/messaging":"fire-fcm","@firebase/messaging-compat":"fire-fcm-compat","@firebase/performance":"fire-perf","@firebase/performance-compat":"fire-perf-compat","@firebase/remote-config":"fire-rc","@firebase/remote-config-compat":"fire-rc-compat","@firebase/storage":"fire-gcs","@firebase/storage-compat":"fire-gcs-compat","@firebase/firestore":"fire-fst","@firebase/firestore-compat":"fire-fst-compat","fire-js":"fire-js",firebase:"fire-js-all"},te=new Map,re=new Map;function ne(t,r){try{t.container.addComponent(r)}catch(e){q.debug(`Component ${r.name} failed to register with FirebaseApp ${t.name}`,e)}}function ae(e,t){e.container.addOrOverwriteComponent(t)}function ie(e){var t=e.name;if(re.has(t))return q.debug(`There were multiple attempts to register component ${t}.`),!1;re.set(t,e);for(const r of te.values())ne(r,e);return!0}function se(e,t){const r=e.container.getProvider("heartbeat").getImmediate({optional:!0});return r&&r.triggerHeartbeat(),e.container.getProvider(t)}const oe=new d("app","Firebase",{"no-app":"No Firebase App '{$appName}' has been created - call Firebase App.initializeApp()","bad-app-name":"Illegal App name: '{$appName}","duplicate-app":"Firebase App named '{$appName}' already exists with different options or config","app-deleted":"Firebase App named '{$appName}' already deleted","no-options":"Need to provide options, when not being deployed to hosting via source.","invalid-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance.","invalid-log-argument":"First argument to `onLog` must be null or a function.","idb-open":"Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.","idb-get":"Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.","idb-set":"Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.","idb-delete":"Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}."});class ce{constructor(e,t,r){this._isDeleted=!1,this._options=Object.assign({},e),this._config=Object.assign({},t),this._name=t.name,this._automaticDataCollectionEnabled=t.automaticDataCollectionEnabled,this._container=r,this.container.addComponent(new _("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 oe.create("app-deleted",{appName:this._name})}}const he="9.17.2";function le(e,t={}){let r=e;if("object"!=typeof t){const a=t;t={name:a}}var n=Object.assign({name:Q,automaticDataCollectionEnabled:!1},t);const a=n.name;if("string"!=typeof a||!a)throw oe.create("bad-app-name",{appName:String(a)});if(r=r||l(),!r)throw oe.create("no-options");var i=te.get(a);if(i){if(f(r,i.options)&&f(n,i.config))return i;throw oe.create("duplicate-app",{appName:a})}const s=new I(a);for(const o of re.values())s.addComponent(o);n=new ce(r,n,s);return te.set(a,n),n}async function de(e){var t=e.name;te.has(t)&&(te.delete(t),await Promise.all(e.container.getProviders().map(e=>e.delete())),e.isDeleted=!0)}function pe(e,t,r){let n=null!==(i=ee[e])&&void 0!==i?i:e;r&&(n+=`-${r}`);var a=n.match(/\s|\//),i=t.match(/\s|\//);if(a||i){const s=[`Unable to register library "${n}" with version "${t}":`];return a&&s.push(`library name "${n}" contains illegal characters (whitespace or "/")`),a&&i&&s.push("and"),i&&s.push(`version name "${t}" contains illegal characters (whitespace or "/")`),void q.warn(s.join(" "))}ie(new _(`${n}-version`,()=>({library:n,version:t}),"VERSION"))}function ue(e,t){if(null!==e&&"function"!=typeof e)throw oe.create("invalid-log-argument");!function(i,e){for(const t of w){let a=null;e&&e.level&&(a=A[e.level]),t.userLogHandler=null===i?null:(e,t,...r)=>{var n=r.map(e=>{if(null==e)return null;if("string"==typeof e)return e;if("number"==typeof e||"boolean"==typeof e)return e.toString();if(e instanceof Error)return e.message;try{return JSON.stringify(e)}catch(e){return null}}).filter(e=>e).join(" ");t>=(null!==a&&void 0!==a?a:e.logLevel)&&i({level:C[t].toLowerCase(),message:n,args:r,type:e.name})}}}(e,t)}function fe(e){var t;t=e,w.forEach(e=>{e.setLogLevel(t)})}const ge="firebase-heartbeat-database",me=1,be="firebase-heartbeat-store";let ve=null;function _e(){return ve=ve||function(e,t,{blocked:r,upgrade:n,blocking:a,terminated:i}){const s=indexedDB.open(e,t),o=V(s);return n&&s.addEventListener("upgradeneeded",e=>{n(V(s.result),e.oldVersion,e.newVersion,V(s.transaction))}),r&&s.addEventListener("blocked",()=>r()),o.then(e=>{i&&e.addEventListener("close",()=>i()),a&&e.addEventListener("versionchange",()=>a())}).catch(()=>{}),o}(ge,me,{upgrade:(e,t)=>{0===t&&e.createObjectStore(be)}}).catch(e=>{throw oe.create("idb-open",{originalErrorMessage:e.message})}),ve}async function Ee(e,t){try{const n=await _e(),a=n.transaction(be,"readwrite"),i=a.objectStore(be);return await i.put(t,ye(e)),a.done}catch(e){var r;e instanceof o?q.warn(e.message):(r=oe.create("idb-set",{originalErrorMessage:null==e?void 0:e.message}),q.warn(r.message))}}function ye(e){return`${e.name}!${e.options.appId}`}class Ie{constructor(e){this.container=e,this._heartbeatsCache=null;var t=this.container.getProvider("app").getImmediate();this._storage=new Ce(t),this._heartbeatsCachePromise=this._storage.read().then(e=>this._heartbeatsCache=e)}async triggerHeartbeat(){const e=this.container.getProvider("platform-logger").getImmediate();var t=e.getPlatformInfoString();const r=we();if(null===this._heartbeatsCache&&(this._heartbeatsCache=await this._heartbeatsCachePromise),this._heartbeatsCache.lastSentHeartbeatDate!==r&&!this._heartbeatsCache.heartbeats.some(e=>e.date===r))return this._heartbeatsCache.heartbeats.push({date:r,agent:t}),this._heartbeatsCache.heartbeats=this._heartbeatsCache.heartbeats.filter(e=>{var t=new Date(e.date).valueOf();return Date.now()-t<=2592e6}),this._storage.overwrite(this._heartbeatsCache)}async getHeartbeatsHeader(){if(null===this._heartbeatsCache&&await this._heartbeatsCachePromise,null===this._heartbeatsCache||0===this._heartbeatsCache.heartbeats.length)return"";var e=we(),{heartbeatsToSend:t,unsentEntries:r}=function(e,t=1024){const r=[];let n=e.slice();for(const a of e){const i=r.find(e=>e.agent===a.agent);if(i){if(i.dates.push(a.date),De(r)>t){i.dates.pop();break}}else if(r.push({agent:a.agent,dates:[a.date]}),De(r)>t){r.pop();break}n=n.slice(1)}return{heartbeatsToSend:r,unsentEntries:n}}(this._heartbeatsCache.heartbeats),t=a(JSON.stringify({version:2,heartbeats:t}));return this._heartbeatsCache.lastSentHeartbeatDate=e,0<r.length?(this._heartbeatsCache.heartbeats=r,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),t}}function we(){const e=new Date;return e.toISOString().substring(0,10)}class Ce{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return!!function(){try{return"object"==typeof indexedDB}catch(e){return}}()&&new Promise((t,r)=>{try{let e=!0;const n="validate-browser-context-for-indexeddb-analytics-module",a=self.indexedDB.open(n);a.onsuccess=()=>{a.result.close(),e||self.indexedDB.deleteDatabase(n),t(!0)},a.onupgradeneeded=()=>{e=!1},a.onerror=()=>{var e;r((null===(e=a.error)||void 0===e?void 0:e.message)||"")}}catch(e){r(e)}}).then(()=>!0).catch(()=>!1)}async read(){return await this._canUseIndexedDBPromise&&await async function(e){try{const r=await _e();return r.transaction(be).objectStore(be).get(ye(e))}catch(e){var t;e instanceof o?q.warn(e.message):(t=oe.create("idb-get",{originalErrorMessage:null==e?void 0:e.message}),q.warn(t.message))}}(this.app)||{heartbeats:[]}}async overwrite(e){var t;if(await this._canUseIndexedDBPromise){var r=await this.read();return Ee(this.app,{lastSentHeartbeatDate:null!==(t=e.lastSentHeartbeatDate)&&void 0!==t?t:r.lastSentHeartbeatDate,heartbeats:e.heartbeats})}}async add(e){var t;if(await this._canUseIndexedDBPromise){var r=await this.read();return Ee(this.app,{lastSentHeartbeatDate:null!==(t=e.lastSentHeartbeatDate)&&void 0!==t?t:r.lastSentHeartbeatDate,heartbeats:[...r.heartbeats,...e.heartbeats]})}}}function De(e){return a(JSON.stringify({version:2,heartbeats:e})).length}Z="",ie(new _("platform-logger",e=>new Y(e),"PRIVATE")),ie(new _("heartbeat",e=>new Ie(e),"PRIVATE")),pe(X,"0.9.4",Z),pe(X,"0.9.4","esm2017"),pe("fire-js","");var Se=Object.freeze({__proto__:null,SDK_VERSION:he,_DEFAULT_ENTRY_NAME:Q,_addComponent:ne,_addOrOverwriteComponent:ae,_apps:te,_clearComponents:function(){re.clear()},_components:re,_getProvider:se,_registerComponent:ie,_removeServiceInstance:function(e,t,r=Q){se(e,t).clearInstance(r)},deleteApp:de,getApp:function(e=Q){var t=te.get(e);if(!t&&e===Q)return le();if(!t)throw oe.create("no-app",{appName:e});return t},getApps:function(){return Array.from(te.values())},initializeApp:le,onLog:ue,registerVersion:pe,setLogLevel:fe,FirebaseError:o});class Ae{constructor(e,t){this._delegate=e,this.firebase=t,ne(e,new _("app-compat",()=>this,"PUBLIC")),this.container=e.container}get automaticDataCollectionEnabled(){return this._delegate.automaticDataCollectionEnabled}set automaticDataCollectionEnabled(e){this._delegate.automaticDataCollectionEnabled=e}get name(){return this._delegate.name}get options(){return this._delegate.options}delete(){return new Promise(e=>{this._delegate.checkDestroyed(),e()}).then(()=>(this.firebase.INTERNAL.removeApp(this.name),de(this._delegate)))}_getService(e,t=Q){var r;this._delegate.checkDestroyed();const n=this._delegate.container.getProvider(e);return n.isInitialized()||"EXPLICIT"!==(null===(r=n.getComponent())||void 0===r?void 0:r.instantiationMode)||n.initialize(),n.getImmediate({identifier:t})}_removeServiceInstance(e,t=Q){this._delegate.container.getProvider(e).clearInstance(t)}_addComponent(e){ne(this._delegate,e)}_addOrOverwriteComponent(e){ae(this._delegate,e)}toJSON(){return{name:this.name,automaticDataCollectionEnabled:this.automaticDataCollectionEnabled,options:this.options}}}const Oe=new d("app-compat","Firebase",{"no-app":"No Firebase App '{$appName}' has been created - call Firebase App.initializeApp()","invalid-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance."});function Le(a){const i={},s={__esModule:!0,initializeApp:function(e,t={}){var r=le(e,t);if(u(i,r.name))return i[r.name];var n=new a(r,s);return i[r.name]=n},app:o,registerVersion:pe,setLogLevel:fe,onLog:ue,apps:null,SDK_VERSION:he,INTERNAL:{registerComponent:function(r){const n=r.name,t=n.replace("-compat","");{var e;ie(r)&&"PUBLIC"===r.type&&(e=(e=o())=>{if("function"!=typeof e[t])throw Oe.create("invalid-app-argument",{appName:n});return e[t]()},void 0!==r.serviceProps&&c(e,r.serviceProps),s[t]=e,a.prototype[t]=function(...e){const t=this._getService.bind(this,n);return t.apply(this,r.multipleInstances?e:[])})}return"PUBLIC"===r.type?s[t]:null},removeApp:function(e){delete i[e]},useAsService:function(e,t){if("serverAuth"===t)return null;var r=t;return r},modularAPIs:Se}};function o(e){if(e=e||Q,!u(i,e))throw Oe.create("no-app",{appName:e});return i[e]}return s.default=s,Object.defineProperty(s,"apps",{get:function(){return Object.keys(i).map(e=>i[e])}}),o.App=a,s}var Ne=function e(){const t=Le(Ae);return t.INTERNAL=Object.assign(Object.assign({},t.INTERNAL),{createFirebaseNamespace:e,extendNamespace:function(e){c(t,e)},createSubscribe:m,ErrorFactory:d,deepExtend:c}),t}();const Be=new B("@firebase/app-compat");if("object"==typeof self&&self.self===self&&void 0!==self.firebase){Be.warn(`
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).firebase=t()}(this,function(){"use strict";const r=function(t){const r=[];let n=0;for(let a=0;a<t.length;a++){let e=t.charCodeAt(a);e<128?r[n++]=e:(e<2048?r[n++]=e>>6|192:(55296==(64512&e)&&a+1<t.length&&56320==(64512&t.charCodeAt(a+1))?(e=65536+((1023&e)<<10)+(1023&t.charCodeAt(++a)),r[n++]=e>>18|240,r[n++]=e>>12&63|128):r[n++]=e>>12|224,r[n++]=e>>6&63|128),r[n++]=63&e|128)}return r},n={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:"function"==typeof atob,encodeByteArray(r,e){if(!Array.isArray(r))throw Error("encodeByteArray takes an array as a parameter");this.init_();var n=e?this.byteToCharMapWebSafe_:this.byteToCharMap_;const a=[];for(let l=0;l<r.length;l+=3){var i=r[l],s=l+1<r.length,o=s?r[l+1]:0,c=l+2<r.length,h=c?r[l+2]:0;let e=(15&o)<<2|h>>6,t=63&h;c||(t=64,s||(e=64)),a.push(n[i>>2],n[(3&i)<<4|o>>4],n[e],n[t])}return a.join("")},encodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?btoa(e):this.encodeByteArray(r(e),t)},decodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?atob(e):function(e){const t=[];let r=0,n=0;for(;r<e.length;){var a,i,s=e[r++];s<128?t[n++]=String.fromCharCode(s):191<s&&s<224?(a=e[r++],t[n++]=String.fromCharCode((31&s)<<6|63&a)):239<s&&s<365?(i=((7&s)<<18|(63&e[r++])<<12|(63&e[r++])<<6|63&e[r++])-65536,t[n++]=String.fromCharCode(55296+(i>>10)),t[n++]=String.fromCharCode(56320+(1023&i))):(a=e[r++],i=e[r++],t[n++]=String.fromCharCode((15&s)<<12|(63&a)<<6|63&i))}return t.join("")}(this.decodeStringToByteArray(e,t))},decodeStringToByteArray(e,t){this.init_();var r=t?this.charToByteMapWebSafe_:this.charToByteMap_;const n=[];for(let c=0;c<e.length;){var a=r[e.charAt(c++)],i=c<e.length?r[e.charAt(c)]:0;++c;var s=c<e.length?r[e.charAt(c)]:64;++c;var o=c<e.length?r[e.charAt(c)]:64;if(++c,null==a||null==i||null==s||null==o)throw new h;n.push(a<<2|i>>4),64!==s&&(n.push(i<<4&240|s>>2),64!==o&&n.push(s<<6&192|o))}return n},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let e=0;e<this.ENCODED_VALS.length;e++)this.byteToCharMap_[e]=this.ENCODED_VALS.charAt(e),this.charToByteMap_[this.byteToCharMap_[e]]=e,this.byteToCharMapWebSafe_[e]=this.ENCODED_VALS_WEBSAFE.charAt(e),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[e]]=e,e>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(e)]=e,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(e)]=e)}}};class h extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const a=function(e){return e=e,t=r(e),n.encodeByteArray(t,!0).replace(/\./g,"");var t};function c(e,t){if(!(t instanceof Object))return t;switch(t.constructor){case Date:const r=t;return new Date(r.getTime());case Object:void 0===e&&(e={});break;case Array:e=[];break;default:return t}for(const n in t)t.hasOwnProperty(n)&&"__proto__"!==n&&(e[n]=c(e[n],t[n]));return e}const e=()=>function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if("undefined"!=typeof global)return global;throw new Error("Unable to locate global object.")}().__FIREBASE_DEFAULTS__,t=()=>{if("undefined"!=typeof document){let e;try{e=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch(e){return}var t=e&&function(e){try{return n.decodeString(e,!0)}catch(e){console.error("base64Decode failed: ",e)}return null}(e[1]);return t&&JSON.parse(t)}},i=()=>{try{return e()||(()=>{if("undefined"!=typeof process&&void 0!==process.env){var e=process.env.__FIREBASE_DEFAULTS__;return e?JSON.parse(e):void 0}})()||t()}catch(e){return void console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${e}`)}},l=()=>{var e;return null===(e=i())||void 0===e?void 0:e.config};class s{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}wrapCallback(r){return(e,t)=>{e?this.reject(e):this.resolve(t),"function"==typeof r&&(this.promise.catch(()=>{}),1===r.length?r(e):r(e,t))}}}class o extends Error{constructor(e,t,r){super(t),this.code=e,this.customData=r,this.name="FirebaseError",Object.setPrototypeOf(this,o.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,d.prototype.create)}}class d{constructor(e,t,r){this.service=e,this.serviceName=t,this.errors=r}create(e,...t){var n,r=t[0]||{},a=`${this.service}/${e}`,i=this.errors[e],i=i?(n=r,i.replace(p,(e,t)=>{var r=n[t];return null!=r?String(r):`<${t}?>`})):"Error",i=`${this.serviceName}: ${i} (${a}).`;return new o(a,i,r)}}const p=/\{\$([^}]+)}/g;function u(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function f(e,t){if(e===t)return 1;const r=Object.keys(e),n=Object.keys(t);for(const s of r){if(!n.includes(s))return;var a=e[s],i=t[s];if(g(a)&&g(i)){if(!f(a,i))return}else if(a!==i)return}for(const o of n)if(!r.includes(o))return;return 1}function g(e){return null!==e&&"object"==typeof e}function m(e,t){const r=new b(e,t);return r.subscribe.bind(r)}class b{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(e=>{this.error(e)})}next(t){this.forEachObserver(e=>{e.next(t)})}error(t){this.forEachObserver(e=>{e.error(t)}),this.close(t)}complete(){this.forEachObserver(e=>{e.complete()}),this.close()}subscribe(e,t,r){let n;if(void 0===e&&void 0===t&&void 0===r)throw new Error("Missing Observer.");n=function(e,t){if("object"!=typeof e||null===e)return!1;for(const r of t)if(r in e&&"function"==typeof e[r])return!0;return!1}(e,["next","error","complete"])?e:{next:e,error:t,complete:r},void 0===n.next&&(n.next=v),void 0===n.error&&(n.error=v),void 0===n.complete&&(n.complete=v);var a=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(()=>{try{this.finalError?n.error(this.finalError):n.complete()}catch(e){}}),this.observers.push(n),a}unsubscribeOne(e){void 0!==this.observers&&void 0!==this.observers[e]&&(delete this.observers[e],--this.observerCount,0===this.observerCount&&void 0!==this.onNoObservers&&this.onNoObservers(this))}forEachObserver(t){if(!this.finalized)for(let e=0;e<this.observers.length;e++)this.sendOne(e,t)}sendOne(e,t){this.task.then(()=>{if(void 0!==this.observers&&void 0!==this.observers[e])try{t(this.observers[e])}catch(e){"undefined"!=typeof console&&console.error&&console.error(e)}})}close(e){this.finalized||(this.finalized=!0,void 0!==e&&(this.finalError=e),this.task.then(()=>{this.observers=void 0,this.onNoObservers=void 0}))}}function v(){}class _{constructor(e,t,r){this.name=e,this.instanceFactory=t,this.type=r,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(e){return this.instantiationMode=e,this}setMultipleInstances(e){return this.multipleInstances=e,this}setServiceProps(e){return this.serviceProps=e,this}setInstanceCreatedCallback(e){return this.onInstanceCreated=e,this}}const E="[DEFAULT]";class y{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){var t=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(t)){const n=new s;if(this.instancesDeferred.set(t,n),this.isInitialized(t)||this.shouldAutoInitialize())try{var r=this.getOrInitializeService({instanceIdentifier:t});r&&n.resolve(r)}catch(e){}}return this.instancesDeferred.get(t).promise}getImmediate(e){var t=this.normalizeInstanceIdentifier(null==e?void 0:e.identifier),r=null!==(r=null==e?void 0:e.optional)&&void 0!==r&&r;if(!this.isInitialized(t)&&!this.shouldAutoInitialize()){if(r)return null;throw Error(`Service ${this.name} is not available`)}try{return this.getOrInitializeService({instanceIdentifier:t})}catch(e){if(r)return null;throw e}}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("EAGER"===e.instantiationMode)try{this.getOrInitializeService({instanceIdentifier:E})}catch(e){}for(var[t,r]of this.instancesDeferred.entries()){t=this.normalizeInstanceIdentifier(t);try{var n=this.getOrInitializeService({instanceIdentifier:t});r.resolve(n)}catch(e){}}}}clearInstance(e=E){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(e=>"INTERNAL"in e).map(e=>e.INTERNAL.delete()),...e.filter(e=>"_delete"in e).map(e=>e._delete())])}isComponentSet(){return null!=this.component}isInitialized(e=E){return this.instances.has(e)}getOptions(e=E){return this.instancesOptions.get(e)||{}}initialize(e={}){var{options:t={}}=e,r=this.normalizeInstanceIdentifier(e.instanceIdentifier);if(this.isInitialized(r))throw Error(`${this.name}(${r}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);var n,a,i=this.getOrInitializeService({instanceIdentifier:r,options:t});for([n,a]of this.instancesDeferred.entries())r===this.normalizeInstanceIdentifier(n)&&a.resolve(i);return i}onInit(e,t){var r=this.normalizeInstanceIdentifier(t);const n=null!==(a=this.onInitCallbacks.get(r))&&void 0!==a?a:new Set;n.add(e),this.onInitCallbacks.set(r,n);var a=this.instances.get(r);return a&&e(a,r),()=>{n.delete(e)}}invokeOnInitCallbacks(e,t){var r=this.onInitCallbacks.get(t);if(r)for(const n of r)try{n(e,t)}catch(e){}}getOrInitializeService({instanceIdentifier:e,options:t={}}){let r=this.instances.get(e);if(!r&&this.component&&(r=this.component.instanceFactory(this.container,{instanceIdentifier:(n=e)===E?void 0:n,options:t}),this.instances.set(e,r),this.instancesOptions.set(e,t),this.invokeOnInitCallbacks(r,e),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,e,r)}catch(e){}var n;return r||null}normalizeInstanceIdentifier(e=E){return!this.component||this.component.multipleInstances?e:E}shouldAutoInitialize(){return!!this.component&&"EXPLICIT"!==this.component.instantiationMode}}class I{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){const t=this.getProvider(e.name);t.isComponentSet()&&this.providers.delete(e.name),this.addComponent(e)}getProvider(e){if(this.providers.has(e))return this.providers.get(e);var t=new y(e,this);return this.providers.set(e,t),t}getProviders(){return Array.from(this.providers.values())}}const w=[];var C,D,S;(D=C=C||{})[D.DEBUG=0]="DEBUG",D[D.VERBOSE=1]="VERBOSE",D[D.INFO=2]="INFO",D[D.WARN=3]="WARN",D[D.ERROR=4]="ERROR",D[D.SILENT=5]="SILENT";const A={debug:C.DEBUG,verbose:C.VERBOSE,info:C.INFO,warn:C.WARN,error:C.ERROR,silent:C.SILENT},O=C.INFO,L={[C.DEBUG]:"log",[C.VERBOSE]:"log",[C.INFO]:"info",[C.WARN]:"warn",[C.ERROR]:"error"},N=(e,t,...r)=>{if(!(t<e.logLevel)){var n=(new Date).toISOString(),a=L[t];if(!a)throw new Error(`Attempted to log a message with an invalid logType (value: ${t})`);console[a](`[${n}] ${e.name}:`,...r)}};class B{constructor(e){this.name=e,this._logLevel=O,this._logHandler=N,this._userLogHandler=null,w.push(this)}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in C))throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel="string"==typeof e?A[e]:e}get logHandler(){return this._logHandler}set logHandler(e){if("function"!=typeof e)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,C.DEBUG,...e),this._logHandler(this,C.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,C.VERBOSE,...e),this._logHandler(this,C.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,C.INFO,...e),this._logHandler(this,C.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,C.WARN,...e),this._logHandler(this,C.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,C.ERROR,...e),this._logHandler(this,C.ERROR,...e)}}const T=(t,e)=>e.some(e=>t instanceof e);let P,M;const R=new WeakMap,k=new WeakMap,F=new WeakMap,$=new WeakMap,j=new WeakMap;let H={get(e,t,r){if(e instanceof IDBTransaction){if("done"===t)return k.get(e);if("objectStoreNames"===t)return e.objectStoreNames||F.get(e);if("store"===t)return r.objectStoreNames[1]?void 0:r.objectStore(r.objectStoreNames[0])}return V(e[t])},set(e,t,r){return e[t]=r,!0},has(e,t){return e instanceof IDBTransaction&&("done"===t||"store"===t)||t in e}};function x(n){return n!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(M=M||[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey]).includes(n)?function(...e){return n.apply(U(this),e),V(R.get(this))}:function(...e){return V(n.apply(U(this),e))}:function(e,...t){var r=n.call(U(this),e,...t);return F.set(r,e.sort?e.sort():[e]),V(r)}}function z(e){return"function"==typeof e?x(e):(e instanceof IDBTransaction&&(i=e,k.has(i)||(t=new Promise((e,t)=>{const r=()=>{i.removeEventListener("complete",n),i.removeEventListener("error",a),i.removeEventListener("abort",a)},n=()=>{e(),r()},a=()=>{t(i.error||new DOMException("AbortError","AbortError")),r()};i.addEventListener("complete",n),i.addEventListener("error",a),i.addEventListener("abort",a)}),k.set(i,t))),T(e,P=P||[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])?new Proxy(e,H):e);var i,t}function V(e){if(e instanceof IDBRequest)return function(i){const e=new Promise((e,t)=>{const r=()=>{i.removeEventListener("success",n),i.removeEventListener("error",a)},n=()=>{e(V(i.result)),r()},a=()=>{t(i.error),r()};i.addEventListener("success",n),i.addEventListener("error",a)});return e.then(e=>{e instanceof IDBCursor&&R.set(e,i)}).catch(()=>{}),j.set(e,i),e}(e);if($.has(e))return $.get(e);var t=z(e);return t!==e&&($.set(e,t),j.set(t,e)),t}const U=e=>j.get(e);const W=["get","getKey","getAll","getAllKeys","count"],G=["put","add","delete","clear"],J=new Map;function K(e,t){if(e instanceof IDBDatabase&&!(t in e)&&"string"==typeof t){if(J.get(t))return J.get(t);const a=t.replace(/FromIndex$/,""),i=t!==a,s=G.includes(a);if(a in(i?IDBIndex:IDBObjectStore).prototype&&(s||W.includes(a))){var r=async function(e,...t){var r=this.transaction(e,s?"readwrite":"readonly");let n=r.store;return i&&(n=n.index(t.shift())),(await Promise.all([n[a](...t),s&&r.done]))[0]};return J.set(t,r),r}}}H={...S=H,get:(e,t,r)=>K(e,t)||S.get(e,t,r),has:(e,t)=>!!K(e,t)||S.has(e,t)};class Y{constructor(e){this.container=e}getPlatformInfoString(){const e=this.container.getProviders();return e.map(e=>{if("VERSION"!==(null==(t=e.getComponent())?void 0:t.type))return null;var t,t=e.getImmediate();return`${t.library}/${t.version}`}).filter(e=>e).join(" ")}}const X="@firebase/app",q=new B("@firebase/app");var Z;const Q="[DEFAULT]",ee={"@firebase/app":"fire-core","@firebase/app-compat":"fire-core-compat","@firebase/analytics":"fire-analytics","@firebase/analytics-compat":"fire-analytics-compat","@firebase/app-check":"fire-app-check","@firebase/app-check-compat":"fire-app-check-compat","@firebase/auth":"fire-auth","@firebase/auth-compat":"fire-auth-compat","@firebase/database":"fire-rtdb","@firebase/database-compat":"fire-rtdb-compat","@firebase/functions":"fire-fn","@firebase/functions-compat":"fire-fn-compat","@firebase/installations":"fire-iid","@firebase/installations-compat":"fire-iid-compat","@firebase/messaging":"fire-fcm","@firebase/messaging-compat":"fire-fcm-compat","@firebase/performance":"fire-perf","@firebase/performance-compat":"fire-perf-compat","@firebase/remote-config":"fire-rc","@firebase/remote-config-compat":"fire-rc-compat","@firebase/storage":"fire-gcs","@firebase/storage-compat":"fire-gcs-compat","@firebase/firestore":"fire-fst","@firebase/firestore-compat":"fire-fst-compat","fire-js":"fire-js",firebase:"fire-js-all"},te=new Map,re=new Map;function ne(t,r){try{t.container.addComponent(r)}catch(e){q.debug(`Component ${r.name} failed to register with FirebaseApp ${t.name}`,e)}}function ae(e,t){e.container.addOrOverwriteComponent(t)}function ie(e){var t=e.name;if(re.has(t))return q.debug(`There were multiple attempts to register component ${t}.`),!1;re.set(t,e);for(const r of te.values())ne(r,e);return!0}function se(e,t){const r=e.container.getProvider("heartbeat").getImmediate({optional:!0});return r&&r.triggerHeartbeat(),e.container.getProvider(t)}const oe=new d("app","Firebase",{"no-app":"No Firebase App '{$appName}' has been created - call Firebase App.initializeApp()","bad-app-name":"Illegal App name: '{$appName}","duplicate-app":"Firebase App named '{$appName}' already exists with different options or config","app-deleted":"Firebase App named '{$appName}' already deleted","no-options":"Need to provide options, when not being deployed to hosting via source.","invalid-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance.","invalid-log-argument":"First argument to `onLog` must be null or a function.","idb-open":"Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.","idb-get":"Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.","idb-set":"Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.","idb-delete":"Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}."});class ce{constructor(e,t,r){this._isDeleted=!1,this._options=Object.assign({},e),this._config=Object.assign({},t),this._name=t.name,this._automaticDataCollectionEnabled=t.automaticDataCollectionEnabled,this._container=r,this.container.addComponent(new _("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 oe.create("app-deleted",{appName:this._name})}}const he="9.18.0";function le(e,t={}){let r=e;if("object"!=typeof t){const a=t;t={name:a}}var n=Object.assign({name:Q,automaticDataCollectionEnabled:!1},t);const a=n.name;if("string"!=typeof a||!a)throw oe.create("bad-app-name",{appName:String(a)});if(r=r||l(),!r)throw oe.create("no-options");var i=te.get(a);if(i){if(f(r,i.options)&&f(n,i.config))return i;throw oe.create("duplicate-app",{appName:a})}const s=new I(a);for(const o of re.values())s.addComponent(o);n=new ce(r,n,s);return te.set(a,n),n}async function de(e){var t=e.name;te.has(t)&&(te.delete(t),await Promise.all(e.container.getProviders().map(e=>e.delete())),e.isDeleted=!0)}function pe(e,t,r){let n=null!==(i=ee[e])&&void 0!==i?i:e;r&&(n+=`-${r}`);var a=n.match(/\s|\//),i=t.match(/\s|\//);if(a||i){const s=[`Unable to register library "${n}" with version "${t}":`];return a&&s.push(`library name "${n}" contains illegal characters (whitespace or "/")`),a&&i&&s.push("and"),i&&s.push(`version name "${t}" contains illegal characters (whitespace or "/")`),void q.warn(s.join(" "))}ie(new _(`${n}-version`,()=>({library:n,version:t}),"VERSION"))}function ue(e,t){if(null!==e&&"function"!=typeof e)throw oe.create("invalid-log-argument");!function(i,e){for(const t of w){let a=null;e&&e.level&&(a=A[e.level]),t.userLogHandler=null===i?null:(e,t,...r)=>{var n=r.map(e=>{if(null==e)return null;if("string"==typeof e)return e;if("number"==typeof e||"boolean"==typeof e)return e.toString();if(e instanceof Error)return e.message;try{return JSON.stringify(e)}catch(e){return null}}).filter(e=>e).join(" ");t>=(null!==a&&void 0!==a?a:e.logLevel)&&i({level:C[t].toLowerCase(),message:n,args:r,type:e.name})}}}(e,t)}function fe(e){var t;t=e,w.forEach(e=>{e.setLogLevel(t)})}const ge="firebase-heartbeat-database",me=1,be="firebase-heartbeat-store";let ve=null;function _e(){return ve=ve||function(e,t,{blocked:r,upgrade:n,blocking:a,terminated:i}){const s=indexedDB.open(e,t),o=V(s);return n&&s.addEventListener("upgradeneeded",e=>{n(V(s.result),e.oldVersion,e.newVersion,V(s.transaction))}),r&&s.addEventListener("blocked",()=>r()),o.then(e=>{i&&e.addEventListener("close",()=>i()),a&&e.addEventListener("versionchange",()=>a())}).catch(()=>{}),o}(ge,me,{upgrade:(e,t)=>{0===t&&e.createObjectStore(be)}}).catch(e=>{throw oe.create("idb-open",{originalErrorMessage:e.message})}),ve}async function Ee(e,t){try{const n=await _e(),a=n.transaction(be,"readwrite"),i=a.objectStore(be);return await i.put(t,ye(e)),a.done}catch(e){var r;e instanceof o?q.warn(e.message):(r=oe.create("idb-set",{originalErrorMessage:null==e?void 0:e.message}),q.warn(r.message))}}function ye(e){return`${e.name}!${e.options.appId}`}class Ie{constructor(e){this.container=e,this._heartbeatsCache=null;var t=this.container.getProvider("app").getImmediate();this._storage=new Ce(t),this._heartbeatsCachePromise=this._storage.read().then(e=>this._heartbeatsCache=e)}async triggerHeartbeat(){const e=this.container.getProvider("platform-logger").getImmediate();var t=e.getPlatformInfoString();const r=we();if(null===this._heartbeatsCache&&(this._heartbeatsCache=await this._heartbeatsCachePromise),this._heartbeatsCache.lastSentHeartbeatDate!==r&&!this._heartbeatsCache.heartbeats.some(e=>e.date===r))return this._heartbeatsCache.heartbeats.push({date:r,agent:t}),this._heartbeatsCache.heartbeats=this._heartbeatsCache.heartbeats.filter(e=>{var t=new Date(e.date).valueOf();return Date.now()-t<=2592e6}),this._storage.overwrite(this._heartbeatsCache)}async getHeartbeatsHeader(){if(null===this._heartbeatsCache&&await this._heartbeatsCachePromise,null===this._heartbeatsCache||0===this._heartbeatsCache.heartbeats.length)return"";var e=we(),{heartbeatsToSend:t,unsentEntries:r}=function(e,t=1024){const r=[];let n=e.slice();for(const a of e){const i=r.find(e=>e.agent===a.agent);if(i){if(i.dates.push(a.date),De(r)>t){i.dates.pop();break}}else if(r.push({agent:a.agent,dates:[a.date]}),De(r)>t){r.pop();break}n=n.slice(1)}return{heartbeatsToSend:r,unsentEntries:n}}(this._heartbeatsCache.heartbeats),t=a(JSON.stringify({version:2,heartbeats:t}));return this._heartbeatsCache.lastSentHeartbeatDate=e,0<r.length?(this._heartbeatsCache.heartbeats=r,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),t}}function we(){const e=new Date;return e.toISOString().substring(0,10)}class Ce{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return!!function(){try{return"object"==typeof indexedDB}catch(e){return}}()&&new Promise((t,r)=>{try{let e=!0;const n="validate-browser-context-for-indexeddb-analytics-module",a=self.indexedDB.open(n);a.onsuccess=()=>{a.result.close(),e||self.indexedDB.deleteDatabase(n),t(!0)},a.onupgradeneeded=()=>{e=!1},a.onerror=()=>{var e;r((null===(e=a.error)||void 0===e?void 0:e.message)||"")}}catch(e){r(e)}}).then(()=>!0).catch(()=>!1)}async read(){return await this._canUseIndexedDBPromise&&await async function(e){try{const r=await _e();return r.transaction(be).objectStore(be).get(ye(e))}catch(e){var t;e instanceof o?q.warn(e.message):(t=oe.create("idb-get",{originalErrorMessage:null==e?void 0:e.message}),q.warn(t.message))}}(this.app)||{heartbeats:[]}}async overwrite(e){var t;if(await this._canUseIndexedDBPromise){var r=await this.read();return Ee(this.app,{lastSentHeartbeatDate:null!==(t=e.lastSentHeartbeatDate)&&void 0!==t?t:r.lastSentHeartbeatDate,heartbeats:e.heartbeats})}}async add(e){var t;if(await this._canUseIndexedDBPromise){var r=await this.read();return Ee(this.app,{lastSentHeartbeatDate:null!==(t=e.lastSentHeartbeatDate)&&void 0!==t?t:r.lastSentHeartbeatDate,heartbeats:[...r.heartbeats,...e.heartbeats]})}}}function De(e){return a(JSON.stringify({version:2,heartbeats:e})).length}Z="",ie(new _("platform-logger",e=>new Y(e),"PRIVATE")),ie(new _("heartbeat",e=>new Ie(e),"PRIVATE")),pe(X,"0.9.5",Z),pe(X,"0.9.5","esm2017"),pe("fire-js","");var Se=Object.freeze({__proto__:null,SDK_VERSION:he,_DEFAULT_ENTRY_NAME:Q,_addComponent:ne,_addOrOverwriteComponent:ae,_apps:te,_clearComponents:function(){re.clear()},_components:re,_getProvider:se,_registerComponent:ie,_removeServiceInstance:function(e,t,r=Q){se(e,t).clearInstance(r)},deleteApp:de,getApp:function(e=Q){var t=te.get(e);if(!t&&e===Q)return le();if(!t)throw oe.create("no-app",{appName:e});return t},getApps:function(){return Array.from(te.values())},initializeApp:le,onLog:ue,registerVersion:pe,setLogLevel:fe,FirebaseError:o});class Ae{constructor(e,t){this._delegate=e,this.firebase=t,ne(e,new _("app-compat",()=>this,"PUBLIC")),this.container=e.container}get automaticDataCollectionEnabled(){return this._delegate.automaticDataCollectionEnabled}set automaticDataCollectionEnabled(e){this._delegate.automaticDataCollectionEnabled=e}get name(){return this._delegate.name}get options(){return this._delegate.options}delete(){return new Promise(e=>{this._delegate.checkDestroyed(),e()}).then(()=>(this.firebase.INTERNAL.removeApp(this.name),de(this._delegate)))}_getService(e,t=Q){var r;this._delegate.checkDestroyed();const n=this._delegate.container.getProvider(e);return n.isInitialized()||"EXPLICIT"!==(null===(r=n.getComponent())||void 0===r?void 0:r.instantiationMode)||n.initialize(),n.getImmediate({identifier:t})}_removeServiceInstance(e,t=Q){this._delegate.container.getProvider(e).clearInstance(t)}_addComponent(e){ne(this._delegate,e)}_addOrOverwriteComponent(e){ae(this._delegate,e)}toJSON(){return{name:this.name,automaticDataCollectionEnabled:this.automaticDataCollectionEnabled,options:this.options}}}const Oe=new d("app-compat","Firebase",{"no-app":"No Firebase App '{$appName}' has been created - call Firebase App.initializeApp()","invalid-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance."});function Le(a){const i={},s={__esModule:!0,initializeApp:function(e,t={}){var r=le(e,t);if(u(i,r.name))return i[r.name];var n=new a(r,s);return i[r.name]=n},app:o,registerVersion:pe,setLogLevel:fe,onLog:ue,apps:null,SDK_VERSION:he,INTERNAL:{registerComponent:function(r){const n=r.name,t=n.replace("-compat","");{var e;ie(r)&&"PUBLIC"===r.type&&(e=(e=o())=>{if("function"!=typeof e[t])throw Oe.create("invalid-app-argument",{appName:n});return e[t]()},void 0!==r.serviceProps&&c(e,r.serviceProps),s[t]=e,a.prototype[t]=function(...e){const t=this._getService.bind(this,n);return t.apply(this,r.multipleInstances?e:[])})}return"PUBLIC"===r.type?s[t]:null},removeApp:function(e){delete i[e]},useAsService:function(e,t){if("serverAuth"===t)return null;var r=t;return r},modularAPIs:Se}};function o(e){if(e=e||Q,!u(i,e))throw Oe.create("no-app",{appName:e});return i[e]}return s.default=s,Object.defineProperty(s,"apps",{get:function(){return Object.keys(i).map(e=>i[e])}}),o.App=a,s}var Ne=function e(){const t=Le(Ae);return t.INTERNAL=Object.assign(Object.assign({},t.INTERNAL),{createFirebaseNamespace:e,extendNamespace:function(e){c(t,e)},createSubscribe:m,ErrorFactory:d,deepExtend:c}),t}();const Be=new B("@firebase/app-compat");if("object"==typeof self&&self.self===self&&void 0!==self.firebase){Be.warn(`
2
2
  Warning: Firebase is already defined in the global scope. Please make sure
3
3
  Firebase library is only loaded once.
4
4
  `);const Pe=self.firebase.SDK_VERSION;Pe&&0<=Pe.indexOf("LITE")&&Be.warn(`
5
5
  Warning: You are trying to load Firebase while using Firebase Performance standalone script.
6
6
  You should load Firebase Performance with this instance of Firebase to avoid loading duplicate code.
7
- `)}const Te=Ne;pe("@firebase/app-compat","0.2.4",void 0);return Te.registerVersion("firebase","9.17.2","app-compat-cdn"),Te});
7
+ `)}const Te=Ne;pe("@firebase/app-compat","0.2.5",void 0);return Te.registerVersion("firebase","9.18.0","app-compat-cdn"),Te});
8
8
  //# sourceMappingURL=firebase-app-compat.js.map
package/firebase-app.js CHANGED
@@ -1619,8 +1619,8 @@ function isVersionServiceProvider(provider) {
1619
1619
  return (component === null || component === void 0 ? void 0 : component.type) === "VERSION" /* ComponentType.VERSION */;
1620
1620
  }
1621
1621
 
1622
- const name$o = "https://www.gstatic.com/firebasejs/9.17.2/firebase-app.js";
1623
- const version$1 = "0.9.4";
1622
+ const name$o = "https://www.gstatic.com/firebasejs/9.18.0/firebase-app.js";
1623
+ const version$1 = "0.9.5";
1624
1624
 
1625
1625
  /**
1626
1626
  * @license
@@ -1638,7 +1638,7 @@ const version$1 = "0.9.4";
1638
1638
  * See the License for the specific language governing permissions and
1639
1639
  * limitations under the License.
1640
1640
  */
1641
- const logger = new Logger('https://www.gstatic.com/firebasejs/9.17.2/firebase-app.js');
1641
+ const logger = new Logger('https://www.gstatic.com/firebasejs/9.18.0/firebase-app.js');
1642
1642
 
1643
1643
  const name$n = "@firebase/app-compat";
1644
1644
 
@@ -1687,7 +1687,7 @@ const name$2 = "@firebase/firestore";
1687
1687
  const name$1 = "@firebase/firestore-compat";
1688
1688
 
1689
1689
  const name$p = "firebase";
1690
- const version$2 = "9.17.2";
1690
+ const version$2 = "9.18.0";
1691
1691
 
1692
1692
  /**
1693
1693
  * @license
@@ -2492,7 +2492,7 @@ function registerCoreComponents(variant) {
2492
2492
  registerCoreComponents('');
2493
2493
 
2494
2494
  var name = "firebase";
2495
- var version = "9.17.2";
2495
+ var version = "9.18.0";
2496
2496
 
2497
2497
  /**
2498
2498
  * @license