firebase 9.4.1 → 9.5.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.
- package/CHANGELOG.md +18 -0
- package/app/dist/index.cjs.js +1 -1
- package/app/dist/index.esm.js +1 -1
- package/app/dist/index.mjs +1 -1
- package/compat/app/dist/index.cjs.js +1 -1
- package/compat/app/dist/index.esm.js +1 -1
- package/compat/app/dist/index.mjs +1 -1
- package/compat/dist/index.esm.js +2 -2
- package/compat/dist/index.node.cjs +2 -2
- package/compat/dist/index.rn.cjs.js +2 -2
- package/firebase-analytics.js +3 -3
- package/firebase-app-check-compat.js +2 -2
- package/firebase-app-check-compat.js.map +1 -1
- package/firebase-app-check.js +285 -50
- package/firebase-app-check.js.map +1 -1
- package/firebase-app-compat.js +2 -2
- package/firebase-app-compat.js.map +1 -1
- package/firebase-app.js +9 -9
- package/firebase-auth.js +2 -2
- package/firebase-compat.js +4 -4
- package/firebase-compat.js.map +1 -1
- package/firebase-database.js +4 -4
- package/firebase-firestore-compat.js +1 -1
- package/firebase-firestore-compat.js.map +1 -1
- package/firebase-firestore-lite.js +7 -7
- package/firebase-firestore-lite.js.map +1 -1
- package/firebase-firestore.js +12 -12
- package/firebase-firestore.js.map +1 -1
- package/firebase-functions.js +2 -2
- package/firebase-messaging-sw.js +1 -1
- package/firebase-messaging.js +1 -1
- package/firebase-performance-standalone-compat.es2017.js +5 -5
- package/firebase-performance-standalone-compat.es2017.js.map +1 -1
- package/firebase-performance-standalone-compat.js +1 -1
- package/firebase-performance-standalone-compat.js.map +1 -1
- package/firebase-performance.js +3 -3
- package/firebase-remote-config.js +2 -2
- package/firebase-storage-compat.js +1 -1
- package/firebase-storage-compat.js.map +1 -1
- package/firebase-storage.js +177 -24
- package/firebase-storage.js.map +1 -1
- package/package.json +9 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# firebase
|
|
2
2
|
|
|
3
|
+
## 9.5.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`e34e98e73`](https://github.com/firebase/firebase-js-sdk/commit/e34e98e73a72f77ee87d9005d6728402129deda9) [#5672](https://github.com/firebase/firebase-js-sdk/pull/5672) (fixes [#76](https://github.com/firebase/firebase-js-sdk/issues/76)) - Adds `getBytes()`, `getStream()` and `getBlob()`, which allow direct file downloads from the SDK.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [[`e34e98e73`](https://github.com/firebase/firebase-js-sdk/commit/e34e98e73a72f77ee87d9005d6728402129deda9), [`0394cc97b`](https://github.com/firebase/firebase-js-sdk/commit/0394cc97b98f04dae87b718655eb46174275ebc2), [`6f0049e66`](https://github.com/firebase/firebase-js-sdk/commit/6f0049e66064809ae990a2d9461e28b2d6d08d19), [`7a5bc84bd`](https://github.com/firebase/firebase-js-sdk/commit/7a5bc84bd84a8d1b422204f30a59f06d5b60f1bd), [`ce39a1a07`](https://github.com/firebase/firebase-js-sdk/commit/ce39a1a07e8710e43cc66d9e7db882f185211a9a)]:
|
|
12
|
+
- @firebase/app@0.7.9
|
|
13
|
+
- @firebase/storage@0.9.0
|
|
14
|
+
- @firebase/storage-compat@0.1.8
|
|
15
|
+
- @firebase/app-check@0.5.2
|
|
16
|
+
- @firebase/firestore@3.3.1
|
|
17
|
+
- @firebase/app-compat@0.1.10
|
|
18
|
+
- @firebase/app-check-compat@0.2.2
|
|
19
|
+
- @firebase/firestore-compat@0.1.8
|
|
20
|
+
|
|
3
21
|
## 9.4.1
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
package/app/dist/index.cjs.js
CHANGED
package/app/dist/index.esm.js
CHANGED
package/app/dist/index.mjs
CHANGED
package/compat/dist/index.esm.js
CHANGED
|
@@ -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.
|
|
15
|
+
var version$1 = "9.5.0";
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* @license
|
|
@@ -33,7 +33,7 @@ var version$1 = "9.4.1";
|
|
|
33
33
|
firebase.registerVersion(name$1, version$1, 'app-compat');
|
|
34
34
|
|
|
35
35
|
var name = "firebase";
|
|
36
|
-
var version = "9.
|
|
36
|
+
var version = "9.5.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.
|
|
15
|
+
var version$1 = "9.5.0";
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* @license
|
|
@@ -33,7 +33,7 @@ var version$1 = "9.4.1";
|
|
|
33
33
|
firebase__default["default"].registerVersion(name$1, version$1, 'app-compat');
|
|
34
34
|
|
|
35
35
|
var name = "firebase";
|
|
36
|
-
var version = "9.
|
|
36
|
+
var version = "9.5.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.
|
|
13
|
+
var version$1 = "9.5.0";
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* @license
|
|
@@ -31,7 +31,7 @@ var version$1 = "9.4.1";
|
|
|
31
31
|
firebase__default["default"].registerVersion(name$1, version$1, 'app-compat');
|
|
32
32
|
|
|
33
33
|
var name = "firebase";
|
|
34
|
-
var version = "9.
|
|
34
|
+
var version = "9.5.0";
|
|
35
35
|
|
|
36
36
|
/**
|
|
37
37
|
* @license
|
package/firebase-analytics.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { registerVersion, _registerComponent, _getProvider, getApp } from 'https://www.gstatic.com/firebasejs/9.
|
|
1
|
+
import { registerVersion, _registerComponent, _getProvider, getApp } from 'https://www.gstatic.com/firebasejs/9.5.0/firebase-app.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* @license
|
|
@@ -2699,7 +2699,7 @@ async function setAnalyticsCollectionEnabled$1(initializationPromise, enabled) {
|
|
|
2699
2699
|
*
|
|
2700
2700
|
* @public
|
|
2701
2701
|
*
|
|
2702
|
-
* @param app - The {@link https://www.gstatic.com/firebasejs/9.
|
|
2702
|
+
* @param app - The {@link https://www.gstatic.com/firebasejs/9.5.0/firebase-app.js#FirebaseApp} to use.
|
|
2703
2703
|
*/
|
|
2704
2704
|
function getAnalytics(app = getApp()) {
|
|
2705
2705
|
app = getModularInstance(app);
|
|
@@ -2715,7 +2715,7 @@ function getAnalytics(app = getApp()) {
|
|
|
2715
2715
|
*
|
|
2716
2716
|
* @public
|
|
2717
2717
|
*
|
|
2718
|
-
* @param app - The {@link https://www.gstatic.com/firebasejs/9.
|
|
2718
|
+
* @param app - The {@link https://www.gstatic.com/firebasejs/9.5.0/firebase-app.js#FirebaseApp} to use.
|
|
2719
2719
|
*/
|
|
2720
2720
|
function initializeAnalytics(app, options = {}) {
|
|
2721
2721
|
// Dependencies
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(require("@firebase/app-compat"),require("@firebase/app")):"function"==typeof define&&define.amd?define(["@firebase/app-compat","@firebase/app"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).firebase,e.firebase.INTERNAL.modularAPIs)}(this,function(fe,ve){"use strict";try{!(function(){function e(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var t,r,n=e(fe);const c={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 o=[];for(let l=0;l<r.length;l+=3){var i=r[l],a=l+1<r.length,s=a?r[l+1]:0,c=l+2<r.length,h=c?r[l+2]:0;let e=(15&s)<<2|h>>6,t=63&h;c||(t=64,a||(e=64)),o.push(n[i>>2],n[(3&i)<<4|s>>4],n[e],n[t])}return o.join("")},encodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?btoa(e):this.encodeByteArray(function(t){const r=[];let n=0;for(let o=0;o<t.length;o++){let e=t.charCodeAt(o);e<128?r[n++]=e:(e<2048?r[n++]=e>>6|192:(55296==(64512&e)&&o+1<t.length&&56320==(64512&t.charCodeAt(o+1))?(e=65536+((1023&e)<<10)+(1023&t.charCodeAt(++o)),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}(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 o,i,a=e[r++];a<128?t[n++]=String.fromCharCode(a):191<a&&a<224?(o=e[r++],t[n++]=String.fromCharCode((31&a)<<6|63&o)):239<a&&a<365?(i=((7&a)<<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))):(o=e[r++],i=e[r++],t[n++]=String.fromCharCode((15&a)<<12|(63&o)<<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 o=r[e.charAt(c++)],i=c<e.length?r[e.charAt(c)]:0;++c;var a=c<e.length?r[e.charAt(c)]:64;++c;var s=c<e.length?r[e.charAt(c)]:64;if(++c,null==o||null==i||null==a||null==s)throw Error();n.push(o<<2|i>>4),64!==a&&(n.push(i<<4&240|a>>2),64!==s&&n.push(a<<6&192|s))}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)}}},a=function(e){try{return c.decodeString(e,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};class i{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))}}}function o(){return"object"==typeof indexedDB}class s extends Error{constructor(e,t,r){super(t),this.code=e,this.customData=r,this.name="FirebaseError",Object.setPrototypeOf(this,s.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,h.prototype.create)}}class h{constructor(e,t,r){this.service=e,this.serviceName=t,this.errors=r}create(e,...t){var n,r=t[0]||{},o=`${this.service}/${e}`,i=this.errors[e],i=i?(n=r,i.replace(l,(e,t)=>{var r=n[t];return null!=r?String(r):`<${t}?>`})):"Error",i=`${this.serviceName}: ${i} (${o}).`;return new s(o,i,r)}}const l=/\{\$([^}]+)}/g;function p(e){return JSON.parse(e)}function u(e){const t=function(e){let t={},r={},n={},o="";try{var 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 d{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}}(r=t=t||{})[r.DEBUG=0]="DEBUG",r[r.VERBOSE=1]="VERBOSE",r[r.INFO=2]="INFO",r[r.WARN=3]="WARN",r[r.ERROR=4]="ERROR",r[r.SILENT=5]="SILENT";const g={debug:t.DEBUG,verbose:t.VERBOSE,info:t.INFO,warn:t.WARN,error:t.ERROR,silent:t.SILENT},f=t.INFO,v={[t.DEBUG]:"log",[t.VERBOSE]:"log",[t.INFO]:"info",[t.WARN]:"warn",[t.ERROR]:"error"},E=(e,t,...r)=>{if(!(t<e.logLevel)){var n=(new Date).toISOString(),o=v[t];if(!o)throw new Error(`Attempted to log a message with an invalid logType (value: ${t})`);console[o](`[${n}] ${e.name}:`,...r)}};const b=new Map,_={activated:!1,tokenObservers:[]},m={initialized:!1,enabled:!1};function k(e){return b.get(e)||_}function y(e,t){b.set(e,t)}const w="https://content-firebaseappcheck.googleapis.com/v1beta",A="exchangeDebugToken",T={OFFSET_DURATION:3e5,RETRIAL_MIN_WAIT:3e4,RETRIAL_MAX_WAIT:96e4};class C{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,o<(this.nextErrorWaitInterval=n))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 i,t=this.getNextRun(e),await new Promise(e=>{setTimeout(e,t)}),this.pending.resolve(),await this.pending.promise,this.pending=new i,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();var t=this.nextErrorWaitInterval;return this.nextErrorWaitInterval*=2,this.nextErrorWaitInterval>this.upperBound&&(this.nextErrorWaitInterval=this.upperBound),t}}const O=new h("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."});function S(e=!1){var t;return e?null===(t=self.grecaptcha)||void 0===t?void 0:t.enterprise:self.grecaptcha}function R(e){if(!k(e).activated)throw O.create("use-before-activation",{appName:e.name})}async function I({url:e,body:t},r){const n={"Content-Type":"application/json"},o=r.getImmediate({optional:!0});o&&(n["X-Firebase-Client"]=o.getPlatformInfoString());var i={method:"POST",body:JSON.stringify(t),headers:n};let a;try{a=await fetch(e,i)}catch(e){throw O.create("fetch-network-error",{originalErrorMessage:e.message})}if(200!==a.status)throw O.create("fetch-status-error",{httpStatus:a.status});let s;try{s=await a.json()}catch(e){throw O.create("fetch-parse-error",{originalErrorMessage:e.message})}var c=s.ttl.match(/^([\d.]+)(s)$/);if(!c||!c[2]||isNaN(Number(c[1])))throw O.create("fetch-parse-error",{originalErrorMessage:"ttl field (timeToLive) is not in standard Protobuf Duration "+`format: ${s.ttl}`});i=1e3*Number(c[1]),c=Date.now();return{token:s.attestationToken,expireTimeMillis:c+i,issuedAtTimeMillis:c}}const P="firebase-app-check-database",N=1,x="firebase-app-check-store",L="debug-token";let B=null;function M(){return B||(B=new Promise((t,r)=>{try{const e=indexedDB.open(P,N);e.onsuccess=e=>{t(e.target.result)},e.onerror=e=>{var t;r(O.create("storage-open",{originalErrorMessage:null===(t=e.target.error)||void 0===t?void 0:t.message}))},e.onupgradeneeded=e=>{const t=e.target.result;0===e.oldVersion&&t.createObjectStore(x,{keyPath:"compositeKey"})}}catch(e){r(O.create("storage-open",{originalErrorMessage:e.message}))}}),B)}async function j(e,t){const r=await M(),n=r.transaction(x,"readwrite"),o=n.objectStore(x),i=o.put({compositeKey:e,value:t});return new Promise((t,r)=>{i.onsuccess=e=>{t()},n.onerror=e=>{var t;r(O.create("storage-set",{originalErrorMessage:null===(t=e.target.error)||void 0===t?void 0:t.message}))}})}async function D(e){const t=await M(),o=t.transaction(x,"readonly"),r=o.objectStore(x),i=r.get(e);return new Promise((r,n)=>{i.onsuccess=e=>{var t=e.target.result;r(t?t.value:void 0)},o.onerror=e=>{var t;n(O.create("storage-get",{originalErrorMessage:null===(t=e.target.error)||void 0===t?void 0:t.message}))}})}function H(e){return`${e.options.appId}-${e.name}`}const $=new class{constructor(e){this.name=e,this._logLevel=f,this._logHandler=E,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in t))throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel="string"==typeof e?g[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,t.DEBUG,...e),this._logHandler(this,t.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,t.VERBOSE,...e),this._logHandler(this,t.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,t.INFO,...e),this._logHandler(this,t.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,t.WARN,...e),this._logHandler(this,t.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,t.ERROR,...e),this._logHandler(this,t.ERROR,...e)}}("@firebase/app-check");async function W(t){if(o()){let e=void 0;try{e=await D(H(t))}catch(e){$.warn(`Failed to read token from IndexedDB. Error: ${e}`)}return e}}function F(e,t){return o()?j(H(e),t).catch(e=>{$.warn(`Failed to write token to IndexedDB. Error: ${e}`)}):Promise.resolve()}async function V(){let e=void 0;try{e=await D(L)}catch(e){}if(e)return e;var t,r="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=16*Math.random()|0,r="x"===e?t:3&t|8;return r.toString(16)});return t=r,j(L,t).catch(e=>$.warn(`Failed to persist debug token to IndexedDB. Error: ${e}`)),r}function K(){return m.enabled}async function z(){var e=m;if(e.enabled&&e.token)return e.token.promise;throw Error(`
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(require("@firebase/app-compat"),require("@firebase/app")):"function"==typeof define&&define.amd?define(["@firebase/app-compat","@firebase/app"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).firebase,e.firebase.INTERNAL.modularAPIs)}(this,function(ke,ye){"use strict";try{!(function(){function e(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var t,r,o=e(ke);const h={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 o=e?this.byteToCharMapWebSafe_:this.byteToCharMap_;const n=[];for(let l=0;l<r.length;l+=3){var a=r[l],i=l+1<r.length,s=i?r[l+1]:0,c=l+2<r.length,h=c?r[l+2]:0;let e=(15&s)<<2|h>>6,t=63&h;c||(t=64,i||(e=64)),n.push(o[a>>2],o[(3&a)<<4|s>>4],o[e],o[t])}return n.join("")},encodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?btoa(e):this.encodeByteArray(function(t){const r=[];let o=0;for(let n=0;n<t.length;n++){let e=t.charCodeAt(n);e<128?r[o++]=e:(e<2048?r[o++]=e>>6|192:(55296==(64512&e)&&n+1<t.length&&56320==(64512&t.charCodeAt(n+1))?(e=65536+((1023&e)<<10)+(1023&t.charCodeAt(++n)),r[o++]=e>>18|240,r[o++]=e>>12&63|128):r[o++]=e>>12|224,r[o++]=e>>6&63|128),r[o++]=63&e|128)}return r}(e),t)},decodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?atob(e):function(e){const t=[];let r=0,o=0;for(;r<e.length;){var n,a,i=e[r++];i<128?t[o++]=String.fromCharCode(i):191<i&&i<224?(n=e[r++],t[o++]=String.fromCharCode((31&i)<<6|63&n)):239<i&&i<365?(a=((7&i)<<18|(63&e[r++])<<12|(63&e[r++])<<6|63&e[r++])-65536,t[o++]=String.fromCharCode(55296+(a>>10)),t[o++]=String.fromCharCode(56320+(1023&a))):(n=e[r++],a=e[r++],t[o++]=String.fromCharCode((15&i)<<12|(63&n)<<6|63&a))}return t.join("")}(this.decodeStringToByteArray(e,t))},decodeStringToByteArray(e,t){this.init_();var r=t?this.charToByteMapWebSafe_:this.charToByteMap_;const o=[];for(let c=0;c<e.length;){var n=r[e.charAt(c++)],a=c<e.length?r[e.charAt(c)]:0;++c;var i=c<e.length?r[e.charAt(c)]:64;++c;var s=c<e.length?r[e.charAt(c)]:64;if(++c,null==n||null==a||null==i||null==s)throw Error();o.push(n<<2|a>>4),64!==i&&(o.push(a<<4&240|i>>2),64!==s&&o.push(i<<6&192|s))}return o},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)}}},i=function(e){try{return h.decodeString(e,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};class a{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))}}}function n(){return"object"==typeof indexedDB}class s extends Error{constructor(e,t,r){super(t),this.code=e,this.customData=r,this.name="FirebaseError",Object.setPrototypeOf(this,s.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,c.prototype.create)}}class c{constructor(e,t,r){this.service=e,this.serviceName=t,this.errors=r}create(e,...t){var o,r=t[0]||{},n=`${this.service}/${e}`,a=this.errors[e],a=a?(o=r,a.replace(l,(e,t)=>{var r=o[t];return null!=r?String(r):`<${t}?>`})):"Error",a=`${this.serviceName}: ${a} (${n}).`;return new s(n,a,r)}}const l=/\{\$([^}]+)}/g;function p(e){return JSON.parse(e)}function u(e){const t=function(e){let t={},r={},o={},n="";try{var a=e.split(".");t=p(i(a[0])||""),r=p(i(a[1])||""),n=a[2],o=r.d||{},delete r.d}catch(e){}return{header:t,claims:r,data:o,signature:n}}(e).claims;return"object"==typeof t&&t.hasOwnProperty("iat")?t.iat:null}const d=144e5,g=.5;class f{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}}(r=t=t||{})[r.DEBUG=0]="DEBUG",r[r.VERBOSE=1]="VERBOSE",r[r.INFO=2]="INFO",r[r.WARN=3]="WARN",r[r.ERROR=4]="ERROR",r[r.SILENT=5]="SILENT";const v={debug:t.DEBUG,verbose:t.VERBOSE,info:t.INFO,warn:t.WARN,error:t.ERROR,silent:t.SILENT},E=t.INFO,m={[t.DEBUG]:"log",[t.VERBOSE]:"log",[t.INFO]:"info",[t.WARN]:"warn",[t.ERROR]:"error"},b=(e,t,...r)=>{if(!(t<e.logLevel)){var o=(new Date).toISOString(),n=m[t];if(!n)throw new Error(`Attempted to log a message with an invalid logType (value: ${t})`);console[n](`[${o}] ${e.name}:`,...r)}};const _=new Map,w={activated:!1,tokenObservers:[]},k={initialized:!1,enabled:!1};function y(e){return _.get(e)||w}function A(e,t){_.set(e,t)}const T="https://content-firebaseappcheck.googleapis.com/v1beta",C="exchangeDebugToken",S={OFFSET_DURATION:3e5,RETRIAL_MIN_WAIT:3e4,RETRIAL_MAX_WAIT:96e4};class O{constructor(e,t,r,o,n){if(this.operation=e,this.retryPolicy=t,this.getWaitDuration=r,this.lowerBound=o,this.upperBound=n,this.pending=null,n<(this.nextErrorWaitInterval=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 a,t=this.getNextRun(e),await new Promise(e=>{setTimeout(e,t)}),this.pending.resolve(),await this.pending.promise,this.pending=new a,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();var t=this.nextErrorWaitInterval;return this.nextErrorWaitInterval*=2,this.nextErrorWaitInterval>this.upperBound&&(this.nextErrorWaitInterval=this.upperBound),t}}const R=new c("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 P(e=!1){var t;return e?null===(t=self.grecaptcha)||void 0===t?void 0:t.enterprise:self.grecaptcha}function I(e){if(!y(e).activated)throw R.create("use-before-activation",{appName:e.name})}function D(e){var t=Math.round(e/1e3),r=Math.floor(t/86400),o=Math.floor((t-3600*r*24)/3600),n=Math.floor((t-3600*r*24-3600*o)/60),t=t-3600*r*24-3600*o-60*n;let a="";return r&&(a+=x(r)+"d:"),o&&(a+=x(o)+"h:"),a+=x(n)+"m:"+x(t)+"s",a}function x(e){return 0===e?"00":10<=e?e.toString():"0"+e}async function N({url:e,body:t},r){const o={"Content-Type":"application/json"},n=r.getImmediate({optional:!0});n&&(o["X-Firebase-Client"]=n.getPlatformInfoString());var a={method:"POST",body:JSON.stringify(t),headers:o};let i;try{i=await fetch(e,a)}catch(e){throw R.create("fetch-network-error",{originalErrorMessage:e.message})}if(200!==i.status)throw R.create("fetch-status-error",{httpStatus:i.status});let s;try{s=await i.json()}catch(e){throw R.create("fetch-parse-error",{originalErrorMessage:e.message})}var c=s.ttl.match(/^([\d.]+)(s)$/);if(!c||!c[2]||isNaN(Number(c[1])))throw R.create("fetch-parse-error",{originalErrorMessage:"ttl field (timeToLive) is not in standard Protobuf Duration "+`format: ${s.ttl}`});a=1e3*Number(c[1]),c=Date.now();return{token:s.attestationToken,expireTimeMillis:c+a,issuedAtTimeMillis:c}}const L="firebase-app-check-database",M=1,B="firebase-app-check-store",j="debug-token";let $=null;function H(){return $||($=new Promise((t,r)=>{try{const e=indexedDB.open(L,M);e.onsuccess=e=>{t(e.target.result)},e.onerror=e=>{var t;r(R.create("storage-open",{originalErrorMessage:null===(t=e.target.error)||void 0===t?void 0:t.message}))},e.onupgradeneeded=e=>{const t=e.target.result;0===e.oldVersion&&t.createObjectStore(B,{keyPath:"compositeKey"})}}catch(e){r(R.create("storage-open",{originalErrorMessage:e.message}))}}),$)}async function W(e,t){const r=await H(),o=r.transaction(B,"readwrite"),n=o.objectStore(B),a=n.put({compositeKey:e,value:t});return new Promise((t,r)=>{a.onsuccess=e=>{t()},o.onerror=e=>{var t;r(R.create("storage-set",{originalErrorMessage:null===(t=e.target.error)||void 0===t?void 0:t.message}))}})}async function F(e){const t=await H(),n=t.transaction(B,"readonly"),r=n.objectStore(B),a=r.get(e);return new Promise((r,o)=>{a.onsuccess=e=>{var t=e.target.result;r(t?t.value:void 0)},n.onerror=e=>{var t;o(R.create("storage-get",{originalErrorMessage:null===(t=e.target.error)||void 0===t?void 0:t.message}))}})}function V(e){return`${e.options.appId}-${e.name}`}const K=new class{constructor(e){this.name=e,this._logLevel=E,this._logHandler=b,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in t))throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel="string"==typeof e?v[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,t.DEBUG,...e),this._logHandler(this,t.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,t.VERBOSE,...e),this._logHandler(this,t.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,t.INFO,...e),this._logHandler(this,t.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,t.WARN,...e),this._logHandler(this,t.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,t.ERROR,...e),this._logHandler(this,t.ERROR,...e)}}("@firebase/app-check");async function z(t){if(n()){let e=void 0;try{e=await F(V(t))}catch(e){K.warn(`Failed to read token from IndexedDB. Error: ${e}`)}return e}}function U(e,t){return n()?W(V(e),t).catch(e=>{K.warn(`Failed to write token to IndexedDB. Error: ${e}`)}):Promise.resolve()}async function q(){let e=void 0;try{e=await F(j)}catch(e){}if(e)return e;var t,r="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=16*Math.random()|0,r="x"===e?t:3&t|8;return r.toString(16)});return t=r,W(j,t).catch(e=>K.warn(`Failed to persist debug token to IndexedDB. Error: ${e}`)),r}function G(){return k.enabled}async function X(){var e=k;if(e.enabled&&e.token)return e.token.promise;throw Error(`
|
|
2
2
|
Can't get debug token in production mode.
|
|
3
|
-
`)}function U(){var 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.")}();const t=m;if(t.initialized=!0,"string"==typeof e.FIREBASE_APPCHECK_DEBUG_TOKEN||!0===e.FIREBASE_APPCHECK_DEBUG_TOKEN){t.enabled=!0;const r=new i;t.token=r,"string"==typeof e.FIREBASE_APPCHECK_DEBUG_TOKEN?r.resolve(e.FIREBASE_APPCHECK_DEBUG_TOKEN):r.resolve(V())}}const G={error:"UNKNOWN_ERROR"};async function X(e,t=!1){var r=e.app;R(r);const n=k(r);let o=n.token,i=void 0;if(o||(a=await n.cachedTokenPromise)&&Z(a)&&(o=a,y(r,Object.assign(Object.assign({},n),{token:o})),Y(r,{token:o.token})),!t&&o&&Z(o))return{token:o.token};if(K()){var a=await I(function(e,t){var{projectId:r,appId:n,apiKey:o}=e.options;return{url:`${w}/projects/${r}/apps/${n}:${A}?key=${o}`,body:{debug_token:t}}}(r,await z()),e.platformLoggerProvider);return await F(r,a),y(r,Object.assign(Object.assign({},n),{token:a})),{token:a.token}}try{o=await n.provider.getToken()}catch(e){$.error(e),i=e}let s;return o?(s={token:o.token},y(r,Object.assign(Object.assign({},n),{token:o})),await F(r,o)):s=(e=i,{token:function(e){return c.encodeString(JSON.stringify(e),!1)}(G),error:e}),Y(r,s),s}function q(e,t,r,n){var o=e["app"];const i=k(o);var a={next:r,error:n,type:t};const s=Object.assign(Object.assign({},i),{tokenObservers:[...i.tokenObservers,a]});if(s.tokenRefresher||(a=function(r){const n=r["app"];return new C(async()=>{var e=k(n);let t;if(t=e.token?await X(r,!0):await X(r),t.error)throw t.error},()=>!0,()=>{var e=k(n);if(e.token){var t=e.token.issuedAtTimeMillis+.5*(e.token.expireTimeMillis-e.token.issuedAtTimeMillis)+3e5,e=e.token.expireTimeMillis-3e5,t=Math.min(t,e);return Math.max(0,t-Date.now())}return 0},T.RETRIAL_MIN_WAIT,T.RETRIAL_MAX_WAIT)}(e),s.tokenRefresher=a),!s.tokenRefresher.isRunning()&&i.isTokenAutoRefreshEnabled&&s.tokenRefresher.start(),i.token&&Z(i.token)){const c=i.token;Promise.resolve().then(()=>r({token:c.token})).catch(()=>{})}else null==i.token&&i.cachedTokenPromise.then(e=>{e&&Z(e)&&r({token:e.token})}).catch(()=>{});y(o,s)}function J(e,t){const r=k(e);var n=r.tokenObservers.filter(e=>e.next!==t);0===n.length&&r.tokenRefresher&&r.tokenRefresher.isRunning()&&r.tokenRefresher.stop(),y(e,Object.assign(Object.assign({},r),{tokenObservers:n}))}function Y(e,t){for(const r of k(e).tokenObservers)try{"EXTERNAL"===r.type&&null!=t.error?r.error(t.error):r.next(t)}catch(e){}}function Z(e){return 0<e.expireTimeMillis-Date.now()}class Q{constructor(e,t){this.app=e,this.platformLoggerProvider=t}_delete(){var e=k(this.app)["tokenObservers"];for(const t of e)J(this.app,t.next);return Promise.resolve()}}const ee="https://www.google.com/recaptcha/api.js",te="https://www.google.com/recaptcha/enterprise.js";function re(t,r){var e=k(t);const n=new i;y(t,Object.assign(Object.assign({},e),{reCAPTCHAState:{initialized:n}}));const o=ie(t);e=S(!1);return e?oe(t,r,e,o,n):function(e){const t=document.createElement("script");t.src=ee,t.onload=e,document.head.appendChild(t)}(()=>{var e=S(!1);if(!e)throw new Error("no recaptcha");oe(t,r,e,o,n)}),n.promise}function ne(t,r){var e=k(t);const n=new i;y(t,Object.assign(Object.assign({},e),{reCAPTCHAState:{initialized:n}}));const o=ie(t);e=S(!0);return e?oe(t,r,e,o,n):function(e){const t=document.createElement("script");t.src=te,t.onload=e,document.head.appendChild(t)}(()=>{var e=S(!0);if(!e)throw new Error("no recaptcha");oe(t,r,e,o,n)}),n.promise}function oe(n,o,i,a,s){i.ready(()=>{var e,t,r;e=n,t=i.render(a,{sitekey:o,size:"invisible"}),r=k(e),y(e,Object.assign(Object.assign({},r),{reCAPTCHAState:Object.assign(Object.assign({},r.reCAPTCHAState),{widgetId:t})})),s.resolve(i)})}function ie(e){var t=`fire_app_check_${e.name}`;const r=document.createElement("div");return r.id=t,r.style.display="none",document.body.appendChild(r),t}async function ae(n){R(n);const o=await k(n).reCAPTCHAState.initialized.promise;return new Promise((e,t)=>{const r=k(n).reCAPTCHAState;o.ready(()=>{e(o.execute(r.widgetId,{action:"fire_app_check"}))})})}class se{constructor(e){this._siteKey=e}async getToken(){var e=await ae(this._app).catch(e=>{throw O.create("recaptcha-error")});return I(function(e,t){var{projectId:r,appId:n,apiKey:o}=e.options;return{url:`${w}/projects/${r}/apps/${n}:exchangeRecaptchaToken?key=${o}`,body:{recaptcha_token:t}}}(this._app,e),this._platformLoggerProvider)}initialize(e){this._app=e,this._platformLoggerProvider=ve._getProvider(e,"platform-logger"),re(e,this._siteKey).catch(()=>{})}isEqual(e){return e instanceof se&&this._siteKey===e._siteKey}}class ce{constructor(e){this._siteKey=e}async getToken(){var e=await ae(this._app).catch(e=>{throw O.create("recaptcha-error")});return I(function(e,t){var{projectId:r,appId:n,apiKey:o}=e.options;return{url:`${w}/projects/${r}/apps/${n}:exchangeRecaptchaEnterpriseToken?key=${o}`,body:{recaptcha_enterprise_token:t}}}(this._app,e),this._platformLoggerProvider)}initialize(e){this._app=e,this._platformLoggerProvider=ve._getProvider(e,"platform-logger"),ne(e,this._siteKey).catch(()=>{})}isEqual(e){return e instanceof ce&&this._siteKey===e._siteKey}}class he{constructor(e){this._customProviderOptions=e}async getToken(){var e=await this._customProviderOptions.getToken(),t=u(e.token),t=null!==t&&t<Date.now()&&0<t?1e3*t:Date.now();return Object.assign(Object.assign({},e),{issuedAtTimeMillis:t})}initialize(e){this._app=e}isEqual(e){return e instanceof he&&this._customProviderOptions.getToken.toString()===e._customProviderOptions.getToken.toString()}}function le(e=ve.getApp(),t){var r;e=(r=e)&&r._delegate?r._delegate:r;const n=ve._getProvider(e,"app-check");if(m.initialized||U(),K()&&z().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.`)),n.isInitialized()){var o=n.getImmediate();const i=n.getOptions();if(i.isTokenAutoRefreshEnabled===t.isTokenAutoRefreshEnabled&&i.provider.isEqual(t.provider))return o;throw O.create("already-initialized",{appName:e.name})}o=n.initialize({options:t});return function(t,e,r){const n=k(t),o=Object.assign(Object.assign({},n),{activated:!0});o.provider=e,o.cachedTokenPromise=W(t).then(e=>(e&&Z(e)&&y(t,Object.assign(Object.assign({},k(t)),{token:e})),e)),o.isTokenAutoRefreshEnabled=void 0===r?t.automaticDataCollectionEnabled:r,y(t,o),o.provider.initialize(t)}(e,t.provider,t.isTokenAutoRefreshEnabled),o}const pe="app-check-internal";ve._registerComponent(new d("app-check",e=>{var t,r=e.getProvider("app").getImmediate(),n=e.getProvider("platform-logger");return t=r,e=n,new Q(t,e)},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e,t,r)=>{e.getProvider(pe).initialize()})),ve._registerComponent(new d(pe,e=>{var t,r=e.getProvider("app-check").getImmediate();return t=r,{getToken:e=>X(t,e),addTokenListener:e=>q(t,"INTERNAL",e),removeTokenListener:e=>J(t.app,e)}},"PUBLIC").setInstantiationMode("EXPLICIT")),ve.registerVersion("@firebase/app-check","0.5.1");const ue=new h("appCheck","AppCheck",{"use-before-activation":"App Check is being used before activate() is called for FirebaseApp {$appName}. Call activate() before instantiating other Firebase services."});class de{constructor(e){this.app=e}activate(e,t){let r;r="string"==typeof e?new se(e):e instanceof ce||e instanceof se||e instanceof he?e:new he({getToken:e.getToken}),this._delegate=le(this.app,{provider:r,isTokenAutoRefreshEnabled:t})}setTokenAutoRefreshEnabled(e){if(!this._delegate)throw ue.create("use-before-activation",{appName:this.app.name});!function(e,t){var r=e.app;const n=k(r);n.tokenRefresher&&(!0===t?n.tokenRefresher.start():n.tokenRefresher.stop()),y(r,Object.assign(Object.assign({},n),{isTokenAutoRefreshEnabled:t}))}(this._delegate,e)}getToken(e){if(!this._delegate)throw ue.create("use-before-activation",{appName:this.app.name});return async function(e,t){var r=await X(e,t);if(r.error)throw r.error;return{token:r.token}}(this._delegate,e)}onTokenChanged(e,t,r){if(!this._delegate)throw ue.create("use-before-activation",{appName:this.app.name});return function(e,t,r){let n=()=>{},o=()=>{};return n=null!=t.next?t.next.bind(t):t,null!=t.error?o=t.error.bind(t):r&&(o=r),q(e,"EXTERNAL",n,o),()=>J(e.app,n)}(this._delegate,e,t)}}const ge=e=>{var t=e.getProvider("app-compat").getImmediate();return new de(t)};n.default.INTERNAL.registerComponent(new d("appCheck-compat",ge,"PUBLIC").setServiceProps({ReCaptchaEnterpriseProvider:ce,ReCaptchaV3Provider:se,CustomProvider:he})),n.default.registerVersion("@firebase/app-check-compat","0.2.1")}).apply(this,arguments)}catch(e){throw console.error(e),new Error("Cannot instantiate firebase-app-check-compat.js - be sure to load firebase-app.js first.")}});
|
|
3
|
+
`)}function J(){var 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.")}();const t=k;if(t.initialized=!0,"string"==typeof e.FIREBASE_APPCHECK_DEBUG_TOKEN||!0===e.FIREBASE_APPCHECK_DEBUG_TOKEN){t.enabled=!0;const r=new a;t.token=r,"string"==typeof e.FIREBASE_APPCHECK_DEBUG_TOKEN?r.resolve(e.FIREBASE_APPCHECK_DEBUG_TOKEN):r.resolve(q())}}const Y={error:"UNKNOWN_ERROR"};async function Z(e,t=!1){var r=e.app;I(r);const o=y(r);let n=o.token,a=void 0;if(n||(s=await o.cachedTokenPromise)&&oe(s)&&(n=s),!t&&n&&oe(n))return{token:n.token};let i=!1;if(G()){o.exchangeTokenPromise||(o.exchangeTokenPromise=N(function(e,t){var{projectId:r,appId:o,apiKey:n}=e.options;return{url:`${T}/projects/${r}/apps/${o}:${C}?key=${n}`,body:{debug_token:t}}}(r,await X()),e.platformLoggerProvider).then(e=>(o.exchangeTokenPromise=void 0,e)),i=!0);var s=await o.exchangeTokenPromise;return await U(r,s),A(r,Object.assign(Object.assign({},o),{token:s})),{token:s.token}}try{o.exchangeTokenPromise||(o.exchangeTokenPromise=o.provider.getToken().then(e=>(o.exchangeTokenPromise=void 0,e)),i=!0),n=await o.exchangeTokenPromise}catch(e){"appCheck/throttled"===e.code?K.warn(e.message):K.error(e),a=e}let c;return n?(c={token:n.token},A(r,Object.assign(Object.assign({},o),{token:n})),await U(r,n)):c=(e=a,{token:function(e){return h.encodeString(JSON.stringify(e),!1)}(Y),error:e}),i&&re(r,c),c}function Q(e,t,r,o){var n=e["app"];const a=y(n);var i={next:r,error:o,type:t};if(A(n,Object.assign(Object.assign({},a),{tokenObservers:[...a.tokenObservers,i]})),a.token&&oe(a.token)){const s=a.token;Promise.resolve().then(()=>{r({token:s.token}),te(e)}).catch(()=>{})}a.cachedTokenPromise.then(()=>te(e))}function ee(e,t){const r=y(e);var o=r.tokenObservers.filter(e=>e.next!==t);0===o.length&&r.tokenRefresher&&r.tokenRefresher.isRunning()&&r.tokenRefresher.stop(),A(e,Object.assign(Object.assign({},r),{tokenObservers:o}))}function te(e){var t=e["app"],r=y(t);let o=r.tokenRefresher;o||(o=function(r){const o=r["app"];return new O(async()=>{var e=y(o);let t;if(t=e.token?await Z(r,!0):await Z(r),t.error)throw t.error},()=>!0,()=>{var e=y(o);if(e.token){var t=e.token.issuedAtTimeMillis+.5*(e.token.expireTimeMillis-e.token.issuedAtTimeMillis)+3e5,e=e.token.expireTimeMillis-3e5,t=Math.min(t,e);return Math.max(0,t-Date.now())}return 0},S.RETRIAL_MIN_WAIT,S.RETRIAL_MAX_WAIT)}(e),A(t,Object.assign(Object.assign({},r),{tokenRefresher:o}))),!o.isRunning()&&r.isTokenAutoRefreshEnabled&&o.start()}function re(e,t){for(const r of y(e).tokenObservers)try{"EXTERNAL"===r.type&&null!=t.error?r.error(t.error):r.next(t)}catch(e){}}function oe(e){return 0<e.expireTimeMillis-Date.now()}class ne{constructor(e,t){this.app=e,this.platformLoggerProvider=t}_delete(){var e=y(this.app)["tokenObservers"];for(const t of e)ee(this.app,t.next);return Promise.resolve()}}const ae="https://www.google.com/recaptcha/api.js",ie="https://www.google.com/recaptcha/enterprise.js";function se(t,r){var e=y(t);const o=new a;A(t,Object.assign(Object.assign({},e),{reCAPTCHAState:{initialized:o}}));const n=le(t);e=P(!1);return e?he(t,r,e,n,o):function(e){const t=document.createElement("script");t.src=ae,t.onload=e,document.head.appendChild(t)}(()=>{var e=P(!1);if(!e)throw new Error("no recaptcha");he(t,r,e,n,o)}),o.promise}function ce(t,r){var e=y(t);const o=new a;A(t,Object.assign(Object.assign({},e),{reCAPTCHAState:{initialized:o}}));const n=le(t);e=P(!0);return e?he(t,r,e,n,o):function(e){const t=document.createElement("script");t.src=ie,t.onload=e,document.head.appendChild(t)}(()=>{var e=P(!0);if(!e)throw new Error("no recaptcha");he(t,r,e,n,o)}),o.promise}function he(o,n,a,i,s){a.ready(()=>{var e,t,r;e=o,t=a.render(i,{sitekey:n,size:"invisible"}),r=y(e),A(e,Object.assign(Object.assign({},r),{reCAPTCHAState:Object.assign(Object.assign({},r.reCAPTCHAState),{widgetId:t})})),s.resolve(a)})}function le(e){var t=`fire_app_check_${e.name}`;const r=document.createElement("div");return r.id=t,r.style.display="none",document.body.appendChild(r),t}async function pe(o){I(o);const n=await y(o).reCAPTCHAState.initialized.promise;return new Promise((e,t)=>{const r=y(o).reCAPTCHAState;n.ready(()=>{e(n.execute(r.widgetId,{action:"fire_app_check"}))})})}class ue{constructor(e){this._siteKey=e,this._throttleData=null}async getToken(){ve(this._throttleData);var t=await pe(this._app).catch(e=>{throw R.create("recaptcha-error")});let e;try{e=await N(function(e,t){var{projectId:r,appId:o,apiKey:n}=e.options;return{url:`${T}/projects/${r}/apps/${o}:exchangeRecaptchaToken?key=${n}`,body:{recaptcha_token:t}}}(this._app,t),this._platformLoggerProvider)}catch(e){throw"fetch-status-error"===e.code?(this._throttleData=fe(Number(null===(t=e.customData)||void 0===t?void 0:t.httpStatus),this._throttleData),R.create("throttled",{time:D(this._throttleData.allowRequestsAfter-Date.now()),httpStatus:this._throttleData.httpStatus})):e}return this._throttleData=null,e}initialize(e){this._app=e,this._platformLoggerProvider=ye._getProvider(e,"platform-logger"),se(e,this._siteKey).catch(()=>{})}isEqual(e){return e instanceof ue&&this._siteKey===e._siteKey}}class de{constructor(e){this._siteKey=e,this._throttleData=null}async getToken(){ve(this._throttleData);var t=await pe(this._app).catch(e=>{throw R.create("recaptcha-error")});let e;try{e=await N(function(e,t){var{projectId:r,appId:o,apiKey:n}=e.options;return{url:`${T}/projects/${r}/apps/${o}:exchangeRecaptchaEnterpriseToken?key=${n}`,body:{recaptcha_enterprise_token:t}}}(this._app,t),this._platformLoggerProvider)}catch(e){throw"fetch-status-error"===e.code?(this._throttleData=fe(Number(null===(t=e.customData)||void 0===t?void 0:t.httpStatus),this._throttleData),R.create("throttled",{time:D(this._throttleData.allowRequestsAfter-Date.now()),httpStatus:this._throttleData.httpStatus})):e}return this._throttleData=null,e}initialize(e){this._app=e,this._platformLoggerProvider=ye._getProvider(e,"platform-logger"),ce(e,this._siteKey).catch(()=>{})}isEqual(e){return e instanceof de&&this._siteKey===e._siteKey}}class ge{constructor(e){this._customProviderOptions=e}async getToken(){var e=await this._customProviderOptions.getToken(),t=u(e.token),t=null!==t&&t<Date.now()&&0<t?1e3*t:Date.now();return Object.assign(Object.assign({},e),{issuedAtTimeMillis:t})}initialize(e){this._app=e}isEqual(e){return e instanceof ge&&this._customProviderOptions.getToken.toString()===e._customProviderOptions.getToken.toString()}}function fe(e,t){if(404===e||403===e)return{backoffCount:1,allowRequestsAfter:Date.now()+864e5,httpStatus:e};var r,o,n=t?t.backoffCount:0,o=(t=2,r=1e3*Math.pow(t,n),o=Math.round(g*r*(Math.random()-.5)*2),Math.min(d,r+o));return{backoffCount:n+1,allowRequestsAfter:Date.now()+o,httpStatus:e}}function ve(e){if(e&&Date.now()-e.allowRequestsAfter<=0)throw R.create("throttled",{time:D(e.allowRequestsAfter-Date.now()),httpStatus:e.httpStatus})}function Ee(e=ye.getApp(),t){var r;e=(r=e)&&r._delegate?r._delegate:r;const o=ye._getProvider(e,"app-check");if(k.initialized||J(),G()&&X().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.`)),o.isInitialized()){var n=o.getImmediate();const a=o.getOptions();if(a.isTokenAutoRefreshEnabled===t.isTokenAutoRefreshEnabled&&a.provider.isEqual(t.provider))return n;throw R.create("already-initialized",{appName:e.name})}n=o.initialize({options:t});return function(t,e,r){const o=y(t),n=Object.assign(Object.assign({},o),{activated:!0});n.provider=e,n.cachedTokenPromise=z(t).then(e=>(e&&oe(e)&&(A(t,Object.assign(Object.assign({},y(t)),{token:e})),re(t,{token:e.token})),e)),n.isTokenAutoRefreshEnabled=void 0===r?t.automaticDataCollectionEnabled:r,A(t,n),n.provider.initialize(t)}(e,t.provider,t.isTokenAutoRefreshEnabled),y(e).isTokenAutoRefreshEnabled&&Q(n,"INTERNAL",()=>{}),n}const me="app-check-internal";ye._registerComponent(new f("app-check",e=>{var t,r=e.getProvider("app").getImmediate(),o=e.getProvider("platform-logger");return t=r,e=o,new ne(t,e)},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e,t,r)=>{e.getProvider(me).initialize()})),ye._registerComponent(new f(me,e=>{var t,r=e.getProvider("app-check").getImmediate();return t=r,{getToken:e=>Z(t,e),addTokenListener:e=>Q(t,"INTERNAL",e),removeTokenListener:e=>ee(t.app,e)}},"PUBLIC").setInstantiationMode("EXPLICIT")),ye.registerVersion("@firebase/app-check","0.5.2");const be=new c("appCheck","AppCheck",{"use-before-activation":"App Check is being used before activate() is called for FirebaseApp {$appName}. Call activate() before instantiating other Firebase services."});class _e{constructor(e){this.app=e}activate(e,t){let r;r="string"==typeof e?new ue(e):e instanceof de||e instanceof ue||e instanceof ge?e:new ge({getToken:e.getToken}),this._delegate=Ee(this.app,{provider:r,isTokenAutoRefreshEnabled:t})}setTokenAutoRefreshEnabled(e){if(!this._delegate)throw be.create("use-before-activation",{appName:this.app.name});!function(e,t){var r=e.app;const o=y(r);o.tokenRefresher&&(!0===t?o.tokenRefresher.start():o.tokenRefresher.stop()),A(r,Object.assign(Object.assign({},o),{isTokenAutoRefreshEnabled:t}))}(this._delegate,e)}getToken(e){if(!this._delegate)throw be.create("use-before-activation",{appName:this.app.name});return async function(e,t){var r=await Z(e,t);if(r.error)throw r.error;return{token:r.token}}(this._delegate,e)}onTokenChanged(e,t,r){if(!this._delegate)throw be.create("use-before-activation",{appName:this.app.name});return function(e,t,r){let o=()=>{},n=()=>{};return o=null!=t.next?t.next.bind(t):t,null!=t.error?n=t.error.bind(t):r&&(n=r),Q(e,"EXTERNAL",o,n),()=>ee(e.app,o)}(this._delegate,e,t)}}const we=e=>{var t=e.getProvider("app-compat").getImmediate();return new _e(t)};o.default.INTERNAL.registerComponent(new f("appCheck-compat",we,"PUBLIC").setServiceProps({ReCaptchaEnterpriseProvider:de,ReCaptchaV3Provider:ue,CustomProvider:ge})),o.default.registerVersion("@firebase/app-check-compat","0.2.2")}).apply(this,arguments)}catch(e){throw console.error(e),new Error("Cannot instantiate firebase-app-check-compat.js - be sure to load firebase-app.js first.")}});
|
|
4
4
|
//# sourceMappingURL=firebase-app-check-compat.js.map
|