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B,IAAyBzD,GA1nB9D,SAAyB1D,GACrB,MAAO,CACHW,SAAUV,GAAgBF,EAAWC,EAAUC,GAC/CyH,mBAAoB,IAAM1G,EAAqBhB,GAC/CiB,iBAAkBE,GAAYF,EAAiBjB,EAAU,WAAwCmB,GACjGO,oBAAqBP,GAAYO,EAAoB1B,EAAS7I,IAAKgK,IAunB5DwG,CADUjE,EAAU2D,YAAY,aAAa/L,iBAErD,UAAqCgM,qBAAqB,cAC7D,QArnBS,sBACG,U,k4BCz/BhB,QAnBW,WACG,UAkBiB","sources":["webpack://_N_E/./node_modules/@firebase/app-check/dist/esm/index.esm2017.js","webpack://_N_E/./node_modules/firebase/app/dist/esm/index.esm.js"],"sourcesContent":["import { _getProvider, getApp, _registerComponent, registerVersion } from '@firebase/app';\nimport { Component } from '@firebase/component';\nimport { Deferred, ErrorFactory, isIndexedDBAvailable, uuidv4, getGlobal, base64, issuedAtTime, calculateBackoffMillis, getModularInstance } from '@firebase/util';\nimport { Logger } from '@firebase/logger';\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nconst APP_CHECK_STATES = new Map();\r\nconst DEFAULT_STATE = {\r\n activated: false,\r\n tokenObservers: []\r\n};\r\nconst DEBUG_STATE = {\r\n initialized: false,\r\n enabled: false\r\n};\r\n/**\r\n * Gets a reference to the state object.\r\n */\r\nfunction getStateReference(app) {\r\n return APP_CHECK_STATES.get(app) || Object.assign({}, DEFAULT_STATE);\r\n}\r\n/**\r\n * Set once on initialization. The map should hold the same reference to the\r\n * same object until this entry is deleted.\r\n */\r\nfunction setInitialState(app, state) {\r\n APP_CHECK_STATES.set(app, state);\r\n return APP_CHECK_STATES.get(app);\r\n}\r\nfunction getDebugState() {\r\n return DEBUG_STATE;\r\n}\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nconst BASE_ENDPOINT = 'https://content-firebaseappcheck.googleapis.com/v1';\r\nconst EXCHANGE_RECAPTCHA_TOKEN_METHOD = 'exchangeRecaptchaV3Token';\r\nconst EXCHANGE_RECAPTCHA_ENTERPRISE_TOKEN_METHOD = 'exchangeRecaptchaEnterpriseToken';\r\nconst EXCHANGE_DEBUG_TOKEN_METHOD = 'exchangeDebugToken';\r\nconst TOKEN_REFRESH_TIME = {\r\n /**\r\n * The offset time before token natural expiration to run the refresh.\r\n * This is currently 5 minutes.\r\n */\r\n OFFSET_DURATION: 5 * 60 * 1000,\r\n /**\r\n * This is the first retrial wait after an error. This is currently\r\n * 30 seconds.\r\n */\r\n RETRIAL_MIN_WAIT: 30 * 1000,\r\n /**\r\n * This is the maximum retrial wait, currently 16 minutes.\r\n */\r\n RETRIAL_MAX_WAIT: 16 * 60 * 1000\r\n};\r\n/**\r\n * One day in millis, for certain error code backoffs.\r\n */\r\nconst ONE_DAY = 24 * 60 * 60 * 1000;\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n/**\r\n * Port from auth proactiverefresh.js\r\n *\r\n */\r\n// TODO: move it to @firebase/util?\r\n// TODO: allow to config whether refresh should happen in the background\r\nclass Refresher {\r\n constructor(operation, retryPolicy, getWaitDuration, lowerBound, upperBound) {\r\n this.operation = operation;\r\n this.retryPolicy = retryPolicy;\r\n this.getWaitDuration = getWaitDuration;\r\n this.lowerBound = lowerBound;\r\n this.upperBound = upperBound;\r\n this.pending = null;\r\n this.nextErrorWaitInterval = lowerBound;\r\n if (lowerBound > upperBound) {\r\n throw new Error('Proactive refresh lower bound greater than upper bound!');\r\n }\r\n }\r\n start() {\r\n this.nextErrorWaitInterval = this.lowerBound;\r\n this.process(true).catch(() => {\r\n /* we don't care about the result */\r\n });\r\n }\r\n stop() {\r\n if (this.pending) {\r\n this.pending.reject('cancelled');\r\n this.pending = null;\r\n }\r\n }\r\n isRunning() {\r\n return !!this.pending;\r\n }\r\n async process(hasSucceeded) {\r\n this.stop();\r\n try {\r\n this.pending = new Deferred();\r\n this.pending.promise.catch(_e => {\r\n /* ignore */\r\n });\r\n await sleep(this.getNextRun(hasSucceeded));\r\n // Why do we resolve a promise, then immediate wait for it?\r\n // We do it to make the promise chain cancellable.\r\n // We can call stop() which rejects the promise before the following line execute, which makes\r\n // the code jump to the catch block.\r\n // TODO: unit test this\r\n this.pending.resolve();\r\n await this.pending.promise;\r\n this.pending = new Deferred();\r\n this.pending.promise.catch(_e => {\r\n /* ignore */\r\n });\r\n await this.operation();\r\n this.pending.resolve();\r\n await this.pending.promise;\r\n this.process(true).catch(() => {\r\n /* we don't care about the result */\r\n });\r\n }\r\n catch (error) {\r\n if (this.retryPolicy(error)) {\r\n this.process(false).catch(() => {\r\n /* we don't care about the result */\r\n });\r\n }\r\n else {\r\n this.stop();\r\n }\r\n }\r\n }\r\n getNextRun(hasSucceeded) {\r\n if (hasSucceeded) {\r\n // If last operation succeeded, reset next error wait interval and return\r\n // the default wait duration.\r\n this.nextErrorWaitInterval = this.lowerBound;\r\n // Return typical wait duration interval after a successful operation.\r\n return this.getWaitDuration();\r\n }\r\n else {\r\n // Get next error wait interval.\r\n const currentErrorWaitInterval = this.nextErrorWaitInterval;\r\n // Double interval for next consecutive error.\r\n this.nextErrorWaitInterval *= 2;\r\n // Make sure next wait interval does not exceed the maximum upper bound.\r\n if (this.nextErrorWaitInterval > this.upperBound) {\r\n this.nextErrorWaitInterval = this.upperBound;\r\n }\r\n return currentErrorWaitInterval;\r\n }\r\n }\r\n}\r\nfunction sleep(ms) {\r\n return new Promise(resolve => {\r\n setTimeout(resolve, ms);\r\n });\r\n}\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nconst ERRORS = {\r\n [\"already-initialized\" /* AppCheckError.ALREADY_INITIALIZED */]: 'You have already called initializeAppCheck() for FirebaseApp {$appName} with ' +\r\n 'different options. To avoid this error, call initializeAppCheck() with the ' +\r\n 'same options as when it was originally called. This will return the ' +\r\n 'already initialized instance.',\r\n [\"use-before-activation\" /* AppCheckError.USE_BEFORE_ACTIVATION */]: 'App Check is being used before initializeAppCheck() is called for FirebaseApp {$appName}. ' +\r\n 'Call initializeAppCheck() before instantiating other Firebase services.',\r\n [\"fetch-network-error\" /* AppCheckError.FETCH_NETWORK_ERROR */]: 'Fetch failed to connect to a network. Check Internet connection. ' +\r\n 'Original error: {$originalErrorMessage}.',\r\n [\"fetch-parse-error\" /* AppCheckError.FETCH_PARSE_ERROR */]: 'Fetch client could not parse response.' +\r\n ' Original error: {$originalErrorMessage}.',\r\n [\"fetch-status-error\" /* AppCheckError.FETCH_STATUS_ERROR */]: 'Fetch server returned an HTTP error status. HTTP status: {$httpStatus}.',\r\n [\"storage-open\" /* AppCheckError.STORAGE_OPEN */]: 'Error thrown when opening storage. Original error: {$originalErrorMessage}.',\r\n [\"storage-get\" /* AppCheckError.STORAGE_GET */]: 'Error thrown when reading from storage. Original error: {$originalErrorMessage}.',\r\n [\"storage-set\" /* AppCheckError.STORAGE_WRITE */]: 'Error thrown when writing to storage. Original error: {$originalErrorMessage}.',\r\n [\"recaptcha-error\" /* AppCheckError.RECAPTCHA_ERROR */]: 'ReCAPTCHA error.',\r\n [\"throttled\" /* AppCheckError.THROTTLED */]: `Requests throttled due to {$httpStatus} error. Attempts allowed again after {$time}`\r\n};\r\nconst ERROR_FACTORY = new ErrorFactory('appCheck', 'AppCheck', ERRORS);\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nfunction getRecaptcha(isEnterprise = false) {\r\n var _a;\r\n if (isEnterprise) {\r\n return (_a = self.grecaptcha) === null || _a === void 0 ? void 0 : _a.enterprise;\r\n }\r\n return self.grecaptcha;\r\n}\r\nfunction ensureActivated(app) {\r\n if (!getStateReference(app).activated) {\r\n throw ERROR_FACTORY.create(\"use-before-activation\" /* AppCheckError.USE_BEFORE_ACTIVATION */, {\r\n appName: app.name\r\n });\r\n }\r\n}\r\nfunction getDurationString(durationInMillis) {\r\n const totalSeconds = Math.round(durationInMillis / 1000);\r\n const days = Math.floor(totalSeconds / (3600 * 24));\r\n const hours = Math.floor((totalSeconds - days * 3600 * 24) / 3600);\r\n const minutes = Math.floor((totalSeconds - days * 3600 * 24 - hours * 3600) / 60);\r\n const seconds = totalSeconds - days * 3600 * 24 - hours * 3600 - minutes * 60;\r\n let result = '';\r\n if (days) {\r\n result += pad(days) + 'd:';\r\n }\r\n if (hours) {\r\n result += pad(hours) + 'h:';\r\n }\r\n result += pad(minutes) + 'm:' + pad(seconds) + 's';\r\n return result;\r\n}\r\nfunction pad(value) {\r\n if (value === 0) {\r\n return '00';\r\n }\r\n return value >= 10 ? value.toString() : '0' + value;\r\n}\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nasync function exchangeToken({ url, body }, heartbeatServiceProvider) {\r\n const headers = {\r\n 'Content-Type': 'application/json'\r\n };\r\n // If heartbeat service exists, add heartbeat header string to the header.\r\n const heartbeatService = heartbeatServiceProvider.getImmediate({\r\n optional: true\r\n });\r\n if (heartbeatService) {\r\n const heartbeatsHeader = await heartbeatService.getHeartbeatsHeader();\r\n if (heartbeatsHeader) {\r\n headers['X-Firebase-Client'] = heartbeatsHeader;\r\n }\r\n }\r\n const options = {\r\n method: 'POST',\r\n body: JSON.stringify(body),\r\n headers\r\n };\r\n let response;\r\n try {\r\n response = await fetch(url, options);\r\n }\r\n catch (originalError) {\r\n throw ERROR_FACTORY.create(\"fetch-network-error\" /* AppCheckError.FETCH_NETWORK_ERROR */, {\r\n originalErrorMessage: originalError === null || originalError === void 0 ? void 0 : originalError.message\r\n });\r\n }\r\n if (response.status !== 200) {\r\n throw ERROR_FACTORY.create(\"fetch-status-error\" /* AppCheckError.FETCH_STATUS_ERROR */, {\r\n httpStatus: response.status\r\n });\r\n }\r\n let responseBody;\r\n try {\r\n // JSON parsing throws SyntaxError if the response body isn't a JSON string.\r\n responseBody = await response.json();\r\n }\r\n catch (originalError) {\r\n throw ERROR_FACTORY.create(\"fetch-parse-error\" /* AppCheckError.FETCH_PARSE_ERROR */, {\r\n originalErrorMessage: originalError === null || originalError === void 0 ? void 0 : originalError.message\r\n });\r\n }\r\n // Protobuf duration format.\r\n // https://developers.google.com/protocol-buffers/docs/reference/java/com/google/protobuf/Duration\r\n const match = responseBody.ttl.match(/^([\\d.]+)(s)$/);\r\n if (!match || !match[2] || isNaN(Number(match[1]))) {\r\n throw ERROR_FACTORY.create(\"fetch-parse-error\" /* AppCheckError.FETCH_PARSE_ERROR */, {\r\n originalErrorMessage: `ttl field (timeToLive) is not in standard Protobuf Duration ` +\r\n `format: ${responseBody.ttl}`\r\n });\r\n }\r\n const timeToLiveAsNumber = Number(match[1]) * 1000;\r\n const now = Date.now();\r\n return {\r\n token: responseBody.token,\r\n expireTimeMillis: now + timeToLiveAsNumber,\r\n issuedAtTimeMillis: now\r\n };\r\n}\r\nfunction getExchangeRecaptchaV3TokenRequest(app, reCAPTCHAToken) {\r\n const { projectId, appId, apiKey } = app.options;\r\n return {\r\n url: `${BASE_ENDPOINT}/projects/${projectId}/apps/${appId}:${EXCHANGE_RECAPTCHA_TOKEN_METHOD}?key=${apiKey}`,\r\n body: {\r\n 'recaptcha_v3_token': reCAPTCHAToken\r\n }\r\n };\r\n}\r\nfunction getExchangeRecaptchaEnterpriseTokenRequest(app, reCAPTCHAToken) {\r\n const { projectId, appId, apiKey } = app.options;\r\n return {\r\n url: `${BASE_ENDPOINT}/projects/${projectId}/apps/${appId}:${EXCHANGE_RECAPTCHA_ENTERPRISE_TOKEN_METHOD}?key=${apiKey}`,\r\n body: {\r\n 'recaptcha_enterprise_token': reCAPTCHAToken\r\n }\r\n };\r\n}\r\nfunction getExchangeDebugTokenRequest(app, debugToken) {\r\n const { projectId, appId, apiKey } = app.options;\r\n return {\r\n url: `${BASE_ENDPOINT}/projects/${projectId}/apps/${appId}:${EXCHANGE_DEBUG_TOKEN_METHOD}?key=${apiKey}`,\r\n body: {\r\n // eslint-disable-next-line\r\n debug_token: debugToken\r\n }\r\n };\r\n}\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nconst DB_NAME = 'firebase-app-check-database';\r\nconst DB_VERSION = 1;\r\nconst STORE_NAME = 'firebase-app-check-store';\r\nconst DEBUG_TOKEN_KEY = 'debug-token';\r\nlet dbPromise = null;\r\nfunction getDBPromise() {\r\n if (dbPromise) {\r\n return dbPromise;\r\n }\r\n dbPromise = new Promise((resolve, reject) => {\r\n try {\r\n const request = indexedDB.open(DB_NAME, DB_VERSION);\r\n request.onsuccess = event => {\r\n resolve(event.target.result);\r\n };\r\n request.onerror = event => {\r\n var _a;\r\n reject(ERROR_FACTORY.create(\"storage-open\" /* AppCheckError.STORAGE_OPEN */, {\r\n originalErrorMessage: (_a = event.target.error) === null || _a === void 0 ? void 0 : _a.message\r\n }));\r\n };\r\n request.onupgradeneeded = event => {\r\n const db = event.target.result;\r\n // We don't use 'break' in this switch statement, the fall-through\r\n // behavior is what we want, because if there are multiple versions between\r\n // the old version and the current version, we want ALL the migrations\r\n // that correspond to those versions to run, not only the last one.\r\n // eslint-disable-next-line default-case\r\n switch (event.oldVersion) {\r\n case 0:\r\n db.createObjectStore(STORE_NAME, {\r\n keyPath: 'compositeKey'\r\n });\r\n }\r\n };\r\n }\r\n catch (e) {\r\n reject(ERROR_FACTORY.create(\"storage-open\" /* AppCheckError.STORAGE_OPEN */, {\r\n originalErrorMessage: e === null || e === void 0 ? void 0 : e.message\r\n }));\r\n }\r\n });\r\n return dbPromise;\r\n}\r\nfunction readTokenFromIndexedDB(app) {\r\n return read(computeKey(app));\r\n}\r\nfunction writeTokenToIndexedDB(app, token) {\r\n return write(computeKey(app), token);\r\n}\r\nfunction writeDebugTokenToIndexedDB(token) {\r\n return write(DEBUG_TOKEN_KEY, token);\r\n}\r\nfunction readDebugTokenFromIndexedDB() {\r\n return read(DEBUG_TOKEN_KEY);\r\n}\r\nasync function write(key, value) {\r\n const db = await getDBPromise();\r\n const transaction = db.transaction(STORE_NAME, 'readwrite');\r\n const store = transaction.objectStore(STORE_NAME);\r\n const request = store.put({\r\n compositeKey: key,\r\n value\r\n });\r\n return new Promise((resolve, reject) => {\r\n request.onsuccess = _event => {\r\n resolve();\r\n };\r\n transaction.onerror = event => {\r\n var _a;\r\n reject(ERROR_FACTORY.create(\"storage-set\" /* AppCheckError.STORAGE_WRITE */, {\r\n originalErrorMessage: (_a = event.target.error) === null || _a === void 0 ? void 0 : _a.message\r\n }));\r\n };\r\n });\r\n}\r\nasync function read(key) {\r\n const db = await getDBPromise();\r\n const transaction = db.transaction(STORE_NAME, 'readonly');\r\n const store = transaction.objectStore(STORE_NAME);\r\n const request = store.get(key);\r\n return new Promise((resolve, reject) => {\r\n request.onsuccess = event => {\r\n const result = event.target.result;\r\n if (result) {\r\n resolve(result.value);\r\n }\r\n else {\r\n resolve(undefined);\r\n }\r\n };\r\n transaction.onerror = event => {\r\n var _a;\r\n reject(ERROR_FACTORY.create(\"storage-get\" /* AppCheckError.STORAGE_GET */, {\r\n originalErrorMessage: (_a = event.target.error) === null || _a === void 0 ? void 0 : _a.message\r\n }));\r\n };\r\n });\r\n}\r\nfunction computeKey(app) {\r\n return `${app.options.appId}-${app.name}`;\r\n}\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nconst logger = new Logger('@firebase/app-check');\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n/**\r\n * Always resolves. In case of an error reading from indexeddb, resolve with undefined\r\n */\r\nasync function readTokenFromStorage(app) {\r\n if (isIndexedDBAvailable()) {\r\n let token = undefined;\r\n try {\r\n token = await readTokenFromIndexedDB(app);\r\n }\r\n catch (e) {\r\n // swallow the error and return undefined\r\n logger.warn(`Failed to read token from IndexedDB. Error: ${e}`);\r\n }\r\n return token;\r\n }\r\n return undefined;\r\n}\r\n/**\r\n * Always resolves. In case of an error writing to indexeddb, print a warning and resolve the promise\r\n */\r\nfunction writeTokenToStorage(app, token) {\r\n if (isIndexedDBAvailable()) {\r\n return writeTokenToIndexedDB(app, token).catch(e => {\r\n // swallow the error and resolve the promise\r\n logger.warn(`Failed to write token to IndexedDB. Error: ${e}`);\r\n });\r\n }\r\n return Promise.resolve();\r\n}\r\nasync function readOrCreateDebugTokenFromStorage() {\r\n /**\r\n * Theoretically race condition can happen if we read, then write in 2 separate transactions.\r\n * But it won't happen here, because this function will be called exactly once.\r\n */\r\n let existingDebugToken = undefined;\r\n try {\r\n existingDebugToken = await readDebugTokenFromIndexedDB();\r\n }\r\n catch (_e) {\r\n // failed to read from indexeddb. We assume there is no existing debug token, and generate a new one.\r\n }\r\n if (!existingDebugToken) {\r\n // create a new debug token\r\n const newToken = uuidv4();\r\n // We don't need to block on writing to indexeddb\r\n // In case persistence failed, a new debug token will be generated everytime the page is refreshed.\r\n // It renders the debug token useless because you have to manually register(whitelist) the new token in the firebase console again and again.\r\n // If you see this error trying to use debug token, it probably means you are using a browser that doesn't support indexeddb.\r\n // You should switch to a different browser that supports indexeddb\r\n writeDebugTokenToIndexedDB(newToken).catch(e => logger.warn(`Failed to persist debug token to IndexedDB. Error: ${e}`));\r\n return newToken;\r\n }\r\n else {\r\n return existingDebugToken;\r\n }\r\n}\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nfunction isDebugMode() {\r\n const debugState = getDebugState();\r\n return debugState.enabled;\r\n}\r\nasync function getDebugToken() {\r\n const state = getDebugState();\r\n if (state.enabled && state.token) {\r\n return state.token.promise;\r\n }\r\n else {\r\n // should not happen!\r\n throw Error(`\n Can't get debug token in production mode.\n `);\r\n }\r\n}\r\nfunction initializeDebugMode() {\r\n const globals = getGlobal();\r\n const debugState = getDebugState();\r\n // Set to true if this function has been called, whether or not\r\n // it enabled debug mode.\r\n debugState.initialized = true;\r\n if (typeof globals.FIREBASE_APPCHECK_DEBUG_TOKEN !== 'string' &&\r\n globals.FIREBASE_APPCHECK_DEBUG_TOKEN !== true) {\r\n return;\r\n }\r\n debugState.enabled = true;\r\n const deferredToken = new Deferred();\r\n debugState.token = deferredToken;\r\n if (typeof globals.FIREBASE_APPCHECK_DEBUG_TOKEN === 'string') {\r\n deferredToken.resolve(globals.FIREBASE_APPCHECK_DEBUG_TOKEN);\r\n }\r\n else {\r\n deferredToken.resolve(readOrCreateDebugTokenFromStorage());\r\n }\r\n}\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n// Initial hardcoded value agreed upon across platforms for initial launch.\r\n// Format left open for possible dynamic error values and other fields in the future.\r\nconst defaultTokenErrorData = { error: 'UNKNOWN_ERROR' };\r\n/**\r\n * Stringify and base64 encode token error data.\r\n *\r\n * @param tokenError Error data, currently hardcoded.\r\n */\r\nfunction formatDummyToken(tokenErrorData) {\r\n return base64.encodeString(JSON.stringify(tokenErrorData), \r\n /* webSafe= */ false);\r\n}\r\n/**\r\n * This function always resolves.\r\n * The result will contain an error field if there is any error.\r\n * In case there is an error, the token field in the result will be populated with a dummy value\r\n */\r\nasync function getToken$2(appCheck, forceRefresh = false) {\r\n const app = appCheck.app;\r\n ensureActivated(app);\r\n const state = getStateReference(app);\r\n /**\r\n * First check if there is a token in memory from a previous `getToken()` call.\r\n */\r\n let token = state.token;\r\n let error = undefined;\r\n /**\r\n * If an invalid token was found in memory, clear token from\r\n * memory and unset the local variable `token`.\r\n */\r\n if (token && !isValid(token)) {\r\n state.token = undefined;\r\n token = undefined;\r\n }\r\n /**\r\n * If there is no valid token in memory, try to load token from indexedDB.\r\n */\r\n if (!token) {\r\n // cachedTokenPromise contains the token found in IndexedDB or undefined if not found.\r\n const cachedToken = await state.cachedTokenPromise;\r\n if (cachedToken) {\r\n if (isValid(cachedToken)) {\r\n token = cachedToken;\r\n }\r\n else {\r\n // If there was an invalid token in the indexedDB cache, clear it.\r\n await writeTokenToStorage(app, undefined);\r\n }\r\n }\r\n }\r\n // Return the cached token (from either memory or indexedDB) if it's valid\r\n if (!forceRefresh && token && isValid(token)) {\r\n return {\r\n token: token.token\r\n };\r\n }\r\n // Only set to true if this `getToken()` call is making the actual\r\n // REST call to the exchange endpoint, versus waiting for an already\r\n // in-flight call (see debug and regular exchange endpoint paths below)\r\n let shouldCallListeners = false;\r\n /**\r\n * DEBUG MODE\r\n * If debug mode is set, and there is no cached token, fetch a new App\r\n * Check token using the debug token, and return it directly.\r\n */\r\n if (isDebugMode()) {\r\n // Avoid making another call to the exchange endpoint if one is in flight.\r\n if (!state.exchangeTokenPromise) {\r\n state.exchangeTokenPromise = exchangeToken(getExchangeDebugTokenRequest(app, await getDebugToken()), appCheck.heartbeatServiceProvider).finally(() => {\r\n // Clear promise when settled - either resolved or rejected.\r\n state.exchangeTokenPromise = undefined;\r\n });\r\n shouldCallListeners = true;\r\n }\r\n const tokenFromDebugExchange = await state.exchangeTokenPromise;\r\n // Write debug token to indexedDB.\r\n await writeTokenToStorage(app, tokenFromDebugExchange);\r\n // Write debug token to state.\r\n state.token = tokenFromDebugExchange;\r\n return { token: tokenFromDebugExchange.token };\r\n }\r\n /**\r\n * There are no valid tokens in memory or indexedDB and we are not in\r\n * debug mode.\r\n * Request a new token from the exchange endpoint.\r\n */\r\n try {\r\n // Avoid making another call to the exchange endpoint if one is in flight.\r\n if (!state.exchangeTokenPromise) {\r\n // state.provider is populated in initializeAppCheck()\r\n // ensureActivated() at the top of this function checks that\r\n // initializeAppCheck() has been called.\r\n state.exchangeTokenPromise = state.provider.getToken().finally(() => {\r\n // Clear promise when settled - either resolved or rejected.\r\n state.exchangeTokenPromise = undefined;\r\n });\r\n shouldCallListeners = true;\r\n }\r\n token = await getStateReference(app).exchangeTokenPromise;\r\n }\r\n catch (e) {\r\n if (e.code === `appCheck/${\"throttled\" /* AppCheckError.THROTTLED */}`) {\r\n // Warn if throttled, but do not treat it as an error.\r\n logger.warn(e.message);\r\n }\r\n else {\r\n // `getToken()` should never throw, but logging error text to console will aid debugging.\r\n logger.error(e);\r\n }\r\n // Always save error to be added to dummy token.\r\n error = e;\r\n }\r\n let interopTokenResult;\r\n if (!token) {\r\n // If token is undefined, there must be an error.\r\n // Return a dummy token along with the error.\r\n interopTokenResult = makeDummyTokenResult(error);\r\n }\r\n else if (error) {\r\n if (isValid(token)) {\r\n // It's also possible a valid token exists, but there's also an error.\r\n // (Such as if the token is almost expired, tries to refresh, and\r\n // the exchange request fails.)\r\n // We add a special error property here so that the refresher will\r\n // count this as a failed attempt and use the backoff instead of\r\n // retrying repeatedly with no delay, but any 3P listeners will not\r\n // be hindered in getting the still-valid token.\r\n interopTokenResult = {\r\n token: token.token,\r\n internalError: error\r\n };\r\n }\r\n else {\r\n // No invalid tokens should make it to this step. Memory and cached tokens\r\n // are checked. Other tokens are from fresh exchanges. But just in case.\r\n interopTokenResult = makeDummyTokenResult(error);\r\n }\r\n }\r\n else {\r\n interopTokenResult = {\r\n token: token.token\r\n };\r\n // write the new token to the memory state as well as the persistent storage.\r\n // Only do it if we got a valid new token\r\n state.token = token;\r\n await writeTokenToStorage(app, token);\r\n }\r\n if (shouldCallListeners) {\r\n notifyTokenListeners(app, interopTokenResult);\r\n }\r\n return interopTokenResult;\r\n}\r\n/**\r\n * Internal API for limited use tokens. Skips all FAC state and simply calls\r\n * the underlying provider.\r\n */\r\nasync function getLimitedUseToken$1(appCheck) {\r\n const app = appCheck.app;\r\n ensureActivated(app);\r\n const { provider } = getStateReference(app);\r\n if (isDebugMode()) {\r\n const debugToken = await getDebugToken();\r\n const { token } = await exchangeToken(getExchangeDebugTokenRequest(app, debugToken), appCheck.heartbeatServiceProvider);\r\n return { token };\r\n }\r\n else {\r\n // provider is definitely valid since we ensure AppCheck was activated\r\n const { token } = await provider.getToken();\r\n return { token };\r\n }\r\n}\r\nfunction addTokenListener(appCheck, type, listener, onError) {\r\n const { app } = appCheck;\r\n const state = getStateReference(app);\r\n const tokenObserver = {\r\n next: listener,\r\n error: onError,\r\n type\r\n };\r\n state.tokenObservers = [...state.tokenObservers, tokenObserver];\r\n // Invoke the listener async immediately if there is a valid token\r\n // in memory.\r\n if (state.token && isValid(state.token)) {\r\n const validToken = state.token;\r\n Promise.resolve()\r\n .then(() => {\r\n listener({ token: validToken.token });\r\n initTokenRefresher(appCheck);\r\n })\r\n .catch(() => {\r\n /* we don't care about exceptions thrown in listeners */\r\n });\r\n }\r\n /**\r\n * Wait for any cached token promise to resolve before starting the token\r\n * refresher. The refresher checks to see if there is an existing token\r\n * in state and calls the exchange endpoint if not. We should first let the\r\n * IndexedDB check have a chance to populate state if it can.\r\n *\r\n * Listener call isn't needed here because cachedTokenPromise will call any\r\n * listeners that exist when it resolves.\r\n */\r\n // state.cachedTokenPromise is always populated in `activate()`.\r\n void state.cachedTokenPromise.then(() => initTokenRefresher(appCheck));\r\n}\r\nfunction removeTokenListener(app, listener) {\r\n const state = getStateReference(app);\r\n const newObservers = state.tokenObservers.filter(tokenObserver => tokenObserver.next !== listener);\r\n if (newObservers.length === 0 &&\r\n state.tokenRefresher &&\r\n state.tokenRefresher.isRunning()) {\r\n state.tokenRefresher.stop();\r\n }\r\n state.tokenObservers = newObservers;\r\n}\r\n/**\r\n * Logic to create and start refresher as needed.\r\n */\r\nfunction initTokenRefresher(appCheck) {\r\n const { app } = appCheck;\r\n const state = getStateReference(app);\r\n // Create the refresher but don't start it if `isTokenAutoRefreshEnabled`\r\n // is not true.\r\n let refresher = state.tokenRefresher;\r\n if (!refresher) {\r\n refresher = createTokenRefresher(appCheck);\r\n state.tokenRefresher = refresher;\r\n }\r\n if (!refresher.isRunning() && state.isTokenAutoRefreshEnabled) {\r\n refresher.start();\r\n }\r\n}\r\nfunction createTokenRefresher(appCheck) {\r\n const { app } = appCheck;\r\n return new Refresher(\r\n // Keep in mind when this fails for any reason other than the ones\r\n // for which we should retry, it will effectively stop the proactive refresh.\r\n async () => {\r\n const state = getStateReference(app);\r\n // If there is no token, we will try to load it from storage and use it\r\n // If there is a token, we force refresh it because we know it's going to expire soon\r\n let result;\r\n if (!state.token) {\r\n result = await getToken$2(appCheck);\r\n }\r\n else {\r\n result = await getToken$2(appCheck, true);\r\n }\r\n /**\r\n * getToken() always resolves. In case the result has an error field defined, it means\r\n * the operation failed, and we should retry.\r\n */\r\n if (result.error) {\r\n throw result.error;\r\n }\r\n /**\r\n * A special `internalError` field reflects that there was an error\r\n * getting a new token from the exchange endpoint, but there's still a\r\n * previous token that's valid for now and this should be passed to 2P/3P\r\n * requests for a token. But we want this callback (`this.operation` in\r\n * `Refresher`) to throw in order to kick off the Refresher's retry\r\n * backoff. (Setting `hasSucceeded` to false.)\r\n */\r\n if (result.internalError) {\r\n throw result.internalError;\r\n }\r\n }, () => {\r\n return true;\r\n }, () => {\r\n const state = getStateReference(app);\r\n if (state.token) {\r\n // issuedAtTime + (50% * total TTL) + 5 minutes\r\n let nextRefreshTimeMillis = state.token.issuedAtTimeMillis +\r\n (state.token.expireTimeMillis - state.token.issuedAtTimeMillis) *\r\n 0.5 +\r\n 5 * 60 * 1000;\r\n // Do not allow refresh time to be past (expireTime - 5 minutes)\r\n const latestAllowableRefresh = state.token.expireTimeMillis - 5 * 60 * 1000;\r\n nextRefreshTimeMillis = Math.min(nextRefreshTimeMillis, latestAllowableRefresh);\r\n return Math.max(0, nextRefreshTimeMillis - Date.now());\r\n }\r\n else {\r\n return 0;\r\n }\r\n }, TOKEN_REFRESH_TIME.RETRIAL_MIN_WAIT, TOKEN_REFRESH_TIME.RETRIAL_MAX_WAIT);\r\n}\r\nfunction notifyTokenListeners(app, token) {\r\n const observers = getStateReference(app).tokenObservers;\r\n for (const observer of observers) {\r\n try {\r\n if (observer.type === \"EXTERNAL\" /* ListenerType.EXTERNAL */ && token.error != null) {\r\n // If this listener was added by a 3P call, send any token error to\r\n // the supplied error handler. A 3P observer always has an error\r\n // handler.\r\n observer.error(token.error);\r\n }\r\n else {\r\n // If the token has no error field, always return the token.\r\n // If this is a 2P listener, return the token, whether or not it\r\n // has an error field.\r\n observer.next(token);\r\n }\r\n }\r\n catch (e) {\r\n // Errors in the listener function itself are always ignored.\r\n }\r\n }\r\n}\r\nfunction isValid(token) {\r\n return token.expireTimeMillis - Date.now() > 0;\r\n}\r\nfunction makeDummyTokenResult(error) {\r\n return {\r\n token: formatDummyToken(defaultTokenErrorData),\r\n error\r\n };\r\n}\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n/**\r\n * AppCheck Service class.\r\n */\r\nclass AppCheckService {\r\n constructor(app, heartbeatServiceProvider) {\r\n this.app = app;\r\n this.heartbeatServiceProvider = heartbeatServiceProvider;\r\n }\r\n _delete() {\r\n const { tokenObservers } = getStateReference(this.app);\r\n for (const tokenObserver of tokenObservers) {\r\n removeTokenListener(this.app, tokenObserver.next);\r\n }\r\n return Promise.resolve();\r\n }\r\n}\r\nfunction factory(app, heartbeatServiceProvider) {\r\n return new AppCheckService(app, heartbeatServiceProvider);\r\n}\r\nfunction internalFactory(appCheck) {\r\n return {\r\n getToken: forceRefresh => getToken$2(appCheck, forceRefresh),\r\n getLimitedUseToken: () => getLimitedUseToken$1(appCheck),\r\n addTokenListener: listener => addTokenListener(appCheck, \"INTERNAL\" /* ListenerType.INTERNAL */, listener),\r\n removeTokenListener: listener => removeTokenListener(appCheck.app, listener)\r\n };\r\n}\n\nconst name = \"@firebase/app-check\";\nconst version = \"0.8.5\";\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nconst RECAPTCHA_URL = 'https://www.google.com/recaptcha/api.js';\r\nconst RECAPTCHA_ENTERPRISE_URL = 'https://www.google.com/recaptcha/enterprise.js';\r\nfunction initializeV3(app, siteKey) {\r\n const initialized = new Deferred();\r\n const state = getStateReference(app);\r\n state.reCAPTCHAState = { initialized };\r\n const divId = makeDiv(app);\r\n const grecaptcha = getRecaptcha(false);\r\n if (!grecaptcha) {\r\n loadReCAPTCHAV3Script(() => {\r\n const grecaptcha = getRecaptcha(false);\r\n if (!grecaptcha) {\r\n // it shouldn't happen.\r\n throw new Error('no recaptcha');\r\n }\r\n queueWidgetRender(app, siteKey, grecaptcha, divId, initialized);\r\n });\r\n }\r\n else {\r\n queueWidgetRender(app, siteKey, grecaptcha, divId, initialized);\r\n }\r\n return initialized.promise;\r\n}\r\nfunction initializeEnterprise(app, siteKey) {\r\n const initialized = new Deferred();\r\n const state = getStateReference(app);\r\n state.reCAPTCHAState = { initialized };\r\n const divId = makeDiv(app);\r\n const grecaptcha = getRecaptcha(true);\r\n if (!grecaptcha) {\r\n loadReCAPTCHAEnterpriseScript(() => {\r\n const grecaptcha = getRecaptcha(true);\r\n if (!grecaptcha) {\r\n // it shouldn't happen.\r\n throw new Error('no recaptcha');\r\n }\r\n queueWidgetRender(app, siteKey, grecaptcha, divId, initialized);\r\n });\r\n }\r\n else {\r\n queueWidgetRender(app, siteKey, grecaptcha, divId, initialized);\r\n }\r\n return initialized.promise;\r\n}\r\n/**\r\n * Add listener to render the widget and resolve the promise when\r\n * the grecaptcha.ready() event fires.\r\n */\r\nfunction queueWidgetRender(app, siteKey, grecaptcha, container, initialized) {\r\n grecaptcha.ready(() => {\r\n // Invisible widgets allow us to set a different siteKey for each widget,\r\n // so we use them to support multiple apps\r\n renderInvisibleWidget(app, siteKey, grecaptcha, container);\r\n initialized.resolve(grecaptcha);\r\n });\r\n}\r\n/**\r\n * Add invisible div to page.\r\n */\r\nfunction makeDiv(app) {\r\n const divId = `fire_app_check_${app.name}`;\r\n const invisibleDiv = document.createElement('div');\r\n invisibleDiv.id = divId;\r\n invisibleDiv.style.display = 'none';\r\n document.body.appendChild(invisibleDiv);\r\n return divId;\r\n}\r\nasync function getToken$1(app) {\r\n ensureActivated(app);\r\n // ensureActivated() guarantees that reCAPTCHAState is set\r\n const reCAPTCHAState = getStateReference(app).reCAPTCHAState;\r\n const recaptcha = await reCAPTCHAState.initialized.promise;\r\n return new Promise((resolve, _reject) => {\r\n // Updated after initialization is complete.\r\n const reCAPTCHAState = getStateReference(app).reCAPTCHAState;\r\n recaptcha.ready(() => {\r\n resolve(\r\n // widgetId is guaranteed to be available if reCAPTCHAState.initialized.promise resolved.\r\n recaptcha.execute(reCAPTCHAState.widgetId, {\r\n action: 'fire_app_check'\r\n }));\r\n });\r\n });\r\n}\r\n/**\r\n *\r\n * @param app\r\n * @param container - Id of a HTML element.\r\n */\r\nfunction renderInvisibleWidget(app, siteKey, grecaptcha, container) {\r\n const widgetId = grecaptcha.render(container, {\r\n sitekey: siteKey,\r\n size: 'invisible',\r\n // Success callback - set state\r\n callback: () => {\r\n getStateReference(app).reCAPTCHAState.succeeded = true;\r\n },\r\n // Failure callback - set state\r\n 'error-callback': () => {\r\n getStateReference(app).reCAPTCHAState.succeeded = false;\r\n }\r\n });\r\n const state = getStateReference(app);\r\n state.reCAPTCHAState = Object.assign(Object.assign({}, state.reCAPTCHAState), { // state.reCAPTCHAState is set in the initialize()\r\n widgetId });\r\n}\r\nfunction loadReCAPTCHAV3Script(onload) {\r\n const script = document.createElement('script');\r\n script.src = RECAPTCHA_URL;\r\n script.onload = onload;\r\n document.head.appendChild(script);\r\n}\r\nfunction loadReCAPTCHAEnterpriseScript(onload) {\r\n const script = document.createElement('script');\r\n script.src = RECAPTCHA_ENTERPRISE_URL;\r\n script.onload = onload;\r\n document.head.appendChild(script);\r\n}\n\n/**\r\n * @license\r\n * Copyright 2021 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n/**\r\n * App Check provider that can obtain a reCAPTCHA V3 token and exchange it\r\n * for an App Check token.\r\n *\r\n * @public\r\n */\r\nclass ReCaptchaV3Provider {\r\n /**\r\n * Create a ReCaptchaV3Provider instance.\r\n * @param siteKey - ReCAPTCHA V3 siteKey.\r\n */\r\n constructor(_siteKey) {\r\n this._siteKey = _siteKey;\r\n /**\r\n * Throttle requests on certain error codes to prevent too many retries\r\n * in a short time.\r\n */\r\n this._throttleData = null;\r\n }\r\n /**\r\n * Returns an App Check token.\r\n * @internal\r\n */\r\n async getToken() {\r\n var _a, _b, _c;\r\n throwIfThrottled(this._throttleData);\r\n // Top-level `getToken()` has already checked that App Check is initialized\r\n // and therefore this._app and this._heartbeatServiceProvider are available.\r\n const attestedClaimsToken = await getToken$1(this._app).catch(_e => {\r\n // reCaptcha.execute() throws null which is not very descriptive.\r\n throw ERROR_FACTORY.create(\"recaptcha-error\" /* AppCheckError.RECAPTCHA_ERROR */);\r\n });\r\n // Check if a failure state was set by the recaptcha \"error-callback\".\r\n if (!((_a = getStateReference(this._app).reCAPTCHAState) === null || _a === void 0 ? void 0 : _a.succeeded)) {\r\n throw ERROR_FACTORY.create(\"recaptcha-error\" /* AppCheckError.RECAPTCHA_ERROR */);\r\n }\r\n let result;\r\n try {\r\n result = await exchangeToken(getExchangeRecaptchaV3TokenRequest(this._app, attestedClaimsToken), this._heartbeatServiceProvider);\r\n }\r\n catch (e) {\r\n if ((_b = e.code) === null || _b === void 0 ? void 0 : _b.includes(\"fetch-status-error\" /* AppCheckError.FETCH_STATUS_ERROR */)) {\r\n this._throttleData = setBackoff(Number((_c = e.customData) === null || _c === void 0 ? void 0 : _c.httpStatus), this._throttleData);\r\n throw ERROR_FACTORY.create(\"throttled\" /* AppCheckError.THROTTLED */, {\r\n time: getDurationString(this._throttleData.allowRequestsAfter - Date.now()),\r\n httpStatus: this._throttleData.httpStatus\r\n });\r\n }\r\n else {\r\n throw e;\r\n }\r\n }\r\n // If successful, clear throttle data.\r\n this._throttleData = null;\r\n return result;\r\n }\r\n /**\r\n * @internal\r\n */\r\n initialize(app) {\r\n this._app = app;\r\n this._heartbeatServiceProvider = _getProvider(app, 'heartbeat');\r\n initializeV3(app, this._siteKey).catch(() => {\r\n /* we don't care about the initialization result */\r\n });\r\n }\r\n /**\r\n * @internal\r\n */\r\n isEqual(otherProvider) {\r\n if (otherProvider instanceof ReCaptchaV3Provider) {\r\n return this._siteKey === otherProvider._siteKey;\r\n }\r\n else {\r\n return false;\r\n }\r\n }\r\n}\r\n/**\r\n * App Check provider that can obtain a reCAPTCHA Enterprise token and exchange it\r\n * for an App Check token.\r\n *\r\n * @public\r\n */\r\nclass ReCaptchaEnterpriseProvider {\r\n /**\r\n * Create a ReCaptchaEnterpriseProvider instance.\r\n * @param siteKey - reCAPTCHA Enterprise score-based site key.\r\n */\r\n constructor(_siteKey) {\r\n this._siteKey = _siteKey;\r\n /**\r\n * Throttle requests on certain error codes to prevent too many retries\r\n * in a short time.\r\n */\r\n this._throttleData = null;\r\n }\r\n /**\r\n * Returns an App Check token.\r\n * @internal\r\n */\r\n async getToken() {\r\n var _a, _b, _c;\r\n throwIfThrottled(this._throttleData);\r\n // Top-level `getToken()` has already checked that App Check is initialized\r\n // and therefore this._app and this._heartbeatServiceProvider are available.\r\n const attestedClaimsToken = await getToken$1(this._app).catch(_e => {\r\n // reCaptcha.execute() throws null which is not very descriptive.\r\n throw ERROR_FACTORY.create(\"recaptcha-error\" /* AppCheckError.RECAPTCHA_ERROR */);\r\n });\r\n // Check if a failure state was set by the recaptcha \"error-callback\".\r\n if (!((_a = getStateReference(this._app).reCAPTCHAState) === null || _a === void 0 ? void 0 : _a.succeeded)) {\r\n throw ERROR_FACTORY.create(\"recaptcha-error\" /* AppCheckError.RECAPTCHA_ERROR */);\r\n }\r\n let result;\r\n try {\r\n result = await exchangeToken(getExchangeRecaptchaEnterpriseTokenRequest(this._app, attestedClaimsToken), this._heartbeatServiceProvider);\r\n }\r\n catch (e) {\r\n if ((_b = e.code) === null || _b === void 0 ? void 0 : _b.includes(\"fetch-status-error\" /* AppCheckError.FETCH_STATUS_ERROR */)) {\r\n this._throttleData = setBackoff(Number((_c = e.customData) === null || _c === void 0 ? void 0 : _c.httpStatus), this._throttleData);\r\n throw ERROR_FACTORY.create(\"throttled\" /* AppCheckError.THROTTLED */, {\r\n time: getDurationString(this._throttleData.allowRequestsAfter - Date.now()),\r\n httpStatus: this._throttleData.httpStatus\r\n });\r\n }\r\n else {\r\n throw e;\r\n }\r\n }\r\n // If successful, clear throttle data.\r\n this._throttleData = null;\r\n return result;\r\n }\r\n /**\r\n * @internal\r\n */\r\n initialize(app) {\r\n this._app = app;\r\n this._heartbeatServiceProvider = _getProvider(app, 'heartbeat');\r\n initializeEnterprise(app, this._siteKey).catch(() => {\r\n /* we don't care about the initialization result */\r\n });\r\n }\r\n /**\r\n * @internal\r\n */\r\n isEqual(otherProvider) {\r\n if (otherProvider instanceof ReCaptchaEnterpriseProvider) {\r\n return this._siteKey === otherProvider._siteKey;\r\n }\r\n else {\r\n return false;\r\n }\r\n }\r\n}\r\n/**\r\n * Custom provider class.\r\n * @public\r\n */\r\nclass CustomProvider {\r\n constructor(_customProviderOptions) {\r\n this._customProviderOptions = _customProviderOptions;\r\n }\r\n /**\r\n * @internal\r\n */\r\n async getToken() {\r\n // custom provider\r\n const customToken = await this._customProviderOptions.getToken();\r\n // Try to extract IAT from custom token, in case this token is not\r\n // being newly issued. JWT timestamps are in seconds since epoch.\r\n const issuedAtTimeSeconds = issuedAtTime(customToken.token);\r\n // Very basic validation, use current timestamp as IAT if JWT\r\n // has no `iat` field or value is out of bounds.\r\n const issuedAtTimeMillis = issuedAtTimeSeconds !== null &&\r\n issuedAtTimeSeconds < Date.now() &&\r\n issuedAtTimeSeconds > 0\r\n ? issuedAtTimeSeconds * 1000\r\n : Date.now();\r\n return Object.assign(Object.assign({}, customToken), { issuedAtTimeMillis });\r\n }\r\n /**\r\n * @internal\r\n */\r\n initialize(app) {\r\n this._app = app;\r\n }\r\n /**\r\n * @internal\r\n */\r\n isEqual(otherProvider) {\r\n if (otherProvider instanceof CustomProvider) {\r\n return (this._customProviderOptions.getToken.toString() ===\r\n otherProvider._customProviderOptions.getToken.toString());\r\n }\r\n else {\r\n return false;\r\n }\r\n }\r\n}\r\n/**\r\n * Set throttle data to block requests until after a certain time\r\n * depending on the failed request's status code.\r\n * @param httpStatus - Status code of failed request.\r\n * @param throttleData - `ThrottleData` object containing previous throttle\r\n * data state.\r\n * @returns Data about current throttle state and expiration time.\r\n */\r\nfunction setBackoff(httpStatus, throttleData) {\r\n /**\r\n * Block retries for 1 day for the following error codes:\r\n *\r\n * 404: Likely malformed URL.\r\n *\r\n * 403:\r\n * - Attestation failed\r\n * - Wrong API key\r\n * - Project deleted\r\n */\r\n if (httpStatus === 404 || httpStatus === 403) {\r\n return {\r\n backoffCount: 1,\r\n allowRequestsAfter: Date.now() + ONE_DAY,\r\n httpStatus\r\n };\r\n }\r\n else {\r\n /**\r\n * For all other error codes, the time when it is ok to retry again\r\n * is based on exponential backoff.\r\n */\r\n const backoffCount = throttleData ? throttleData.backoffCount : 0;\r\n const backoffMillis = calculateBackoffMillis(backoffCount, 1000, 2);\r\n return {\r\n backoffCount: backoffCount + 1,\r\n allowRequestsAfter: Date.now() + backoffMillis,\r\n httpStatus\r\n };\r\n }\r\n}\r\nfunction throwIfThrottled(throttleData) {\r\n if (throttleData) {\r\n if (Date.now() - throttleData.allowRequestsAfter <= 0) {\r\n // If before, throw.\r\n throw ERROR_FACTORY.create(\"throttled\" /* AppCheckError.THROTTLED */, {\r\n time: getDurationString(throttleData.allowRequestsAfter - Date.now()),\r\n httpStatus: throttleData.httpStatus\r\n });\r\n }\r\n }\r\n}\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n/**\r\n * Activate App Check for the given app. Can be called only once per app.\r\n * @param app - the {@link @firebase/app#FirebaseApp} to activate App Check for\r\n * @param options - App Check initialization options\r\n * @public\r\n */\r\nfunction initializeAppCheck(app = getApp(), options) {\r\n app = getModularInstance(app);\r\n const provider = _getProvider(app, 'app-check');\r\n // Ensure initializeDebugMode() is only called once.\r\n if (!getDebugState().initialized) {\r\n initializeDebugMode();\r\n }\r\n // Log a message containing the debug token when `initializeAppCheck()`\r\n // is called in debug mode.\r\n if (isDebugMode()) {\r\n // Do not block initialization to get the token for the message.\r\n void getDebugToken().then(token => \r\n // Not using logger because I don't think we ever want this accidentally hidden.\r\n console.log(`App Check debug token: ${token}. You will need to add it to your app's App Check settings in the Firebase console for it to work.`));\r\n }\r\n if (provider.isInitialized()) {\r\n const existingInstance = provider.getImmediate();\r\n const initialOptions = provider.getOptions();\r\n if (initialOptions.isTokenAutoRefreshEnabled ===\r\n options.isTokenAutoRefreshEnabled &&\r\n initialOptions.provider.isEqual(options.provider)) {\r\n return existingInstance;\r\n }\r\n else {\r\n throw ERROR_FACTORY.create(\"already-initialized\" /* AppCheckError.ALREADY_INITIALIZED */, {\r\n appName: app.name\r\n });\r\n }\r\n }\r\n const appCheck = provider.initialize({ options });\r\n _activate(app, options.provider, options.isTokenAutoRefreshEnabled);\r\n // If isTokenAutoRefreshEnabled is false, do not send any requests to the\r\n // exchange endpoint without an explicit call from the user either directly\r\n // or through another Firebase library (storage, functions, etc.)\r\n if (getStateReference(app).isTokenAutoRefreshEnabled) {\r\n // Adding a listener will start the refresher and fetch a token if needed.\r\n // This gets a token ready and prevents a delay when an internal library\r\n // requests the token.\r\n // Listener function does not need to do anything, its base functionality\r\n // of calling getToken() already fetches token and writes it to memory/storage.\r\n addTokenListener(appCheck, \"INTERNAL\" /* ListenerType.INTERNAL */, () => { });\r\n }\r\n return appCheck;\r\n}\r\n/**\r\n * Activate App Check\r\n * @param app - Firebase app to activate App Check for.\r\n * @param provider - reCAPTCHA v3 provider or\r\n * custom token provider.\r\n * @param isTokenAutoRefreshEnabled - If true, the SDK automatically\r\n * refreshes App Check tokens as needed. If undefined, defaults to the\r\n * value of `app.automaticDataCollectionEnabled`, which defaults to\r\n * false and can be set in the app config.\r\n */\r\nfunction _activate(app, provider, isTokenAutoRefreshEnabled) {\r\n // Create an entry in the APP_CHECK_STATES map. Further changes should\r\n // directly mutate this object.\r\n const state = setInitialState(app, Object.assign({}, DEFAULT_STATE));\r\n state.activated = true;\r\n state.provider = provider; // Read cached token from storage if it exists and store it in memory.\r\n state.cachedTokenPromise = readTokenFromStorage(app).then(cachedToken => {\r\n if (cachedToken && isValid(cachedToken)) {\r\n state.token = cachedToken;\r\n // notify all listeners with the cached token\r\n notifyTokenListeners(app, { token: cachedToken.token });\r\n }\r\n return cachedToken;\r\n });\r\n // Use value of global `automaticDataCollectionEnabled` (which\r\n // itself defaults to false if not specified in config) if\r\n // `isTokenAutoRefreshEnabled` param was not provided by user.\r\n state.isTokenAutoRefreshEnabled =\r\n isTokenAutoRefreshEnabled === undefined\r\n ? app.automaticDataCollectionEnabled\r\n : isTokenAutoRefreshEnabled;\r\n state.provider.initialize(app);\r\n}\r\n/**\r\n * Set whether App Check will automatically refresh tokens as needed.\r\n *\r\n * @param appCheckInstance - The App Check service instance.\r\n * @param isTokenAutoRefreshEnabled - If true, the SDK automatically\r\n * refreshes App Check tokens as needed. This overrides any value set\r\n * during `initializeAppCheck()`.\r\n * @public\r\n */\r\nfunction setTokenAutoRefreshEnabled(appCheckInstance, isTokenAutoRefreshEnabled) {\r\n const app = appCheckInstance.app;\r\n const state = getStateReference(app);\r\n // This will exist if any product libraries have called\r\n // `addTokenListener()`\r\n if (state.tokenRefresher) {\r\n if (isTokenAutoRefreshEnabled === true) {\r\n state.tokenRefresher.start();\r\n }\r\n else {\r\n state.tokenRefresher.stop();\r\n }\r\n }\r\n state.isTokenAutoRefreshEnabled = isTokenAutoRefreshEnabled;\r\n}\r\n/**\r\n * Get the current App Check token. Attaches to the most recent\r\n * in-flight request if one is present. Returns null if no token\r\n * is present and no token requests are in-flight.\r\n *\r\n * @param appCheckInstance - The App Check service instance.\r\n * @param forceRefresh - If true, will always try to fetch a fresh token.\r\n * If false, will use a cached token if found in storage.\r\n * @public\r\n */\r\nasync function getToken(appCheckInstance, forceRefresh) {\r\n const result = await getToken$2(appCheckInstance, forceRefresh);\r\n if (result.error) {\r\n throw result.error;\r\n }\r\n return { token: result.token };\r\n}\r\n/**\r\n * Requests a Firebase App Check token. This method should be used\r\n * only if you need to authorize requests to a non-Firebase backend.\r\n *\r\n * Returns limited-use tokens that are intended for use with your\r\n * non-Firebase backend endpoints that are protected with\r\n * \r\n * Replay Protection. This method\r\n * does not affect the token generation behavior of the\r\n * #getAppCheckToken() method.\r\n *\r\n * @param appCheckInstance - The App Check service instance.\r\n * @returns The limited use token.\r\n * @public\r\n */\r\nfunction getLimitedUseToken(appCheckInstance) {\r\n return getLimitedUseToken$1(appCheckInstance);\r\n}\r\n/**\r\n * Wraps `addTokenListener`/`removeTokenListener` methods in an `Observer`\r\n * pattern for public use.\r\n */\r\nfunction onTokenChanged(appCheckInstance, onNextOrObserver, onError, \r\n/**\r\n * NOTE: Although an `onCompletion` callback can be provided, it will\r\n * never be called because the token stream is never-ending.\r\n * It is added only for API consistency with the observer pattern, which\r\n * we follow in JS APIs.\r\n */\r\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\r\nonCompletion) {\r\n let nextFn = () => { };\r\n let errorFn = () => { };\r\n if (onNextOrObserver.next != null) {\r\n nextFn = onNextOrObserver.next.bind(onNextOrObserver);\r\n }\r\n else {\r\n nextFn = onNextOrObserver;\r\n }\r\n if (onNextOrObserver.error != null) {\r\n errorFn = onNextOrObserver.error.bind(onNextOrObserver);\r\n }\r\n else if (onError) {\r\n errorFn = onError;\r\n }\r\n addTokenListener(appCheckInstance, \"EXTERNAL\" /* ListenerType.EXTERNAL */, nextFn, errorFn);\r\n return () => removeTokenListener(appCheckInstance.app, nextFn);\r\n}\n\n/**\r\n * The Firebase App Check Web SDK.\r\n *\r\n * @remarks\r\n * Firebase App Check does not work in a Node.js environment using `ReCaptchaV3Provider` or\r\n * `ReCaptchaEnterpriseProvider`, but can be used in Node.js if you use\r\n * `CustomProvider` and write your own attestation method.\r\n *\r\n * @packageDocumentation\r\n */\r\nconst APP_CHECK_NAME = 'app-check';\r\nconst APP_CHECK_NAME_INTERNAL = 'app-check-internal';\r\nfunction registerAppCheck() {\r\n // The public interface\r\n _registerComponent(new Component(APP_CHECK_NAME, container => {\r\n // getImmediate for FirebaseApp will always succeed\r\n const app = container.getProvider('app').getImmediate();\r\n const heartbeatServiceProvider = container.getProvider('heartbeat');\r\n return factory(app, heartbeatServiceProvider);\r\n }, \"PUBLIC\" /* ComponentType.PUBLIC */)\r\n .setInstantiationMode(\"EXPLICIT\" /* InstantiationMode.EXPLICIT */)\r\n /**\r\n * Initialize app-check-internal after app-check is initialized to make AppCheck available to\r\n * other Firebase SDKs\r\n */\r\n .setInstanceCreatedCallback((container, _identifier, _appcheckService) => {\r\n container.getProvider(APP_CHECK_NAME_INTERNAL).initialize();\r\n }));\r\n // The internal interface used by other Firebase products\r\n _registerComponent(new Component(APP_CHECK_NAME_INTERNAL, container => {\r\n const appCheck = container.getProvider('app-check').getImmediate();\r\n return internalFactory(appCheck);\r\n }, \"PUBLIC\" /* ComponentType.PUBLIC */).setInstantiationMode(\"EXPLICIT\" /* InstantiationMode.EXPLICIT */));\r\n registerVersion(name, version);\r\n}\r\nregisterAppCheck();\n\nexport { CustomProvider, ReCaptchaEnterpriseProvider, ReCaptchaV3Provider, getLimitedUseToken, getToken, initializeAppCheck, onTokenChanged, setTokenAutoRefreshEnabled };\n//# sourceMappingURL=index.esm2017.js.map\n","import { registerVersion } from '@firebase/app';\nexport * from '@firebase/app';\n\nvar name = \"firebase\";\nvar version = \"10.12.3\";\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nregisterVersion(name, version, 'app');\n//# sourceMappingURL=index.esm.js.map\n"],"names":["APP_CHECK_STATES","Map","DEFAULT_STATE","activated","tokenObservers","DEBUG_STATE","initialized","enabled","getStateReference","app","get","Object","assign","getDebugState","BASE_ENDPOINT","TOKEN_REFRESH_TIME","Refresher","constructor","operation","retryPolicy","getWaitDuration","lowerBound","upperBound","this","pending","nextErrorWaitInterval","Error","start","process","catch","stop","reject","isRunning","async","hasSucceeded","promise","_e","ms","getNextRun","Promise","resolve","setTimeout","error","currentErrorWaitInterval","ERRORS","ERROR_FACTORY","getRecaptcha","isEnterprise","_a","self","grecaptcha","enterprise","ensureActivated","create","appName","name","getDurationString","durationInMillis","totalSeconds","Math","round","days","floor","hours","minutes","seconds","result","pad","value","toString","exchangeToken","url","body","heartbeatServiceProvider","headers","heartbeatService","getImmediate","optional","heartbeatsHeader","getHeartbeatsHeader","options","method","JSON","stringify","response","responseBody","fetch","originalError","originalErrorMessage","message","status","httpStatus","json","match","ttl","isNaN","Number","timeToLiveAsNumber","now","Date","token","expireTimeMillis","issuedAtTimeMillis","getExchangeDebugTokenRequest","debugToken","projectId","appId","apiKey","debug_token","STORE_NAME","DEBUG_TOKEN_KEY","dbPromise","getDBPromise","request","indexedDB","open","onsuccess","event","target","onerror","onupgradeneeded","db","oldVersion","createObjectStore","keyPath","e","write","key","transaction","objectStore","put","compositeKey","_event","read","undefined","computeKey","logger","readTokenFromStorage","readTokenFromIndexedDB","warn","writeTokenToStorage","writeTokenToIndexedDB","readOrCreateDebugTokenFromStorage","existingDebugToken","newToken","isDebugMode","getDebugToken","state","defaultTokenErrorData","getToken$2","appCheck","forceRefresh","isValid","cachedToken","cachedTokenPromise","interopTokenResult","shouldCallListeners","exchangeTokenPromise","finally","tokenFromDebugExchange","provider","getToken","code","internalError","makeDummyTokenResult","notifyTokenListeners","getLimitedUseToken$1","addTokenListener","type","listener","onError","tokenObserver","next","validToken","then","initTokenRefresher","removeTokenListener","newObservers","filter","length","tokenRefresher","refresher","nextRefreshTimeMillis","latestAllowableRefresh","min","max","createTokenRefresher","isTokenAutoRefreshEnabled","observers","observer","tokenErrorData","AppCheckService","_delete","RECAPTCHA_URL","initializeV3","siteKey","reCAPTCHAState","divId","makeDiv","queueWidgetRender","onload","script","document","createElement","src","head","appendChild","loadReCAPTCHAV3Script","container","ready","widgetId","render","sitekey","size","callback","succeeded","renderInvisibleWidget","invisibleDiv","id","style","display","getToken$1","recaptcha","_reject","execute","action","ReCaptchaV3Provider","_siteKey","_throttleData","_b","_c","throwIfThrottled","attestedClaimsToken","_app","reCAPTCHAToken","getExchangeRecaptchaV3TokenRequest","_heartbeatServiceProvider","includes","setBackoff","customData","time","allowRequestsAfter","initialize","isEqual","otherProvider","throttleData","backoffCount","backoffMillis","initializeAppCheck","globals","debugState","FIREBASE_APPCHECK_DEBUG_TOKEN","deferredToken","initializeDebugMode","console","log","isInitialized","existingInstance","initialOptions","getOptions","set","setInitialState","automaticDataCollectionEnabled","_activate","appCheckInstance","APP_CHECK_NAME_INTERNAL","factory","getProvider","setInstantiationMode","setInstanceCreatedCallback","_identifier","_appcheckService","getLimitedUseToken","internalFactory"],"sourceRoot":""}