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,iBAE/B,SAAUb,GAKV,OAAO,SAAUp7C,GACf,OAAO,IAAIm6C,GAAYn6C,GADlB,CAJIgtB,GAAUouB,EAAUG,YAAY,QAEzC9uB,mBAKD,WAEDovB,qBAAqB,cAIvB,QAAgB9+C,GAAMsyB,GA7GxB,SAA+BhR,GAC7B,OAAQA,GACN,IAAK,OAGH,MAAO,OAET,IAAK,cAGH,MAAO,KAET,IAAK,SAGH,MAAO,YAET,IAAK,UAGH,MAAO,UAET,IAAK,eAGH,MAAO,gBAET,QACE,QAiF2B69B,CAAsB79B,MAErD,QAAgBthB,GAAMsyB,GAAS","sources":["webpack://berrylanding/./node_modules/@firebase/auth/dist/esm2017/index-bea2a320.js"],"sourcesContent":["import _get3 from \"F:/Work/Abo soltan/accounting-lp/node_modules/@babel/runtime/helpers/esm/get.js\";\nimport _assertThisInitialized from \"F:/Work/Abo soltan/accounting-lp/node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js\";\nimport _inherits from \"F:/Work/Abo soltan/accounting-lp/node_modules/@babel/runtime/helpers/esm/inherits.js\";\nimport _possibleConstructorReturn from \"F:/Work/Abo soltan/accounting-lp/node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js\";\nimport _getPrototypeOf from \"F:/Work/Abo soltan/accounting-lp/node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js\";\nimport _slicedToArray from \"F:/Work/Abo soltan/accounting-lp/node_modules/@babel/runtime/helpers/esm/slicedToArray.js\";\nimport _asyncToGenerator from \"F:/Work/Abo soltan/accounting-lp/node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js\";\nimport _classCallCheck from \"F:/Work/Abo soltan/accounting-lp/node_modules/@babel/runtime/helpers/esm/classCallCheck.js\";\nimport _createClass from \"F:/Work/Abo soltan/accounting-lp/node_modules/@babel/runtime/helpers/esm/createClass.js\";\nimport _toConsumableArray from \"F:/Work/Abo soltan/accounting-lp/node_modules/@babel/runtime/helpers/esm/toConsumableArray.js\";\nimport _defineProperty from \"F:/Work/Abo soltan/accounting-lp/node_modules/@babel/runtime/helpers/esm/defineProperty.js\";\n\nvar _SERVER_ERROR_MAP;\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nimport _regeneratorRuntime from \"F:\\\\Work\\\\Abo soltan\\\\accounting-lp\\\\node_modules\\\\@babel\\\\runtime\\\\regenerator\\\\index.js\";\n\nfunction _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== \"undefined\" && o[Symbol.iterator] || o[\"@@iterator\"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === \"number\") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }\n\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\n\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }\n\nimport \"core-js/modules/esnext.global-this.js\";\nimport \"core-js/modules/es.promise.finally.js\";\nimport { ErrorFactory, isBrowserExtension, isMobileCordova, isReactNative, FirebaseError, querystring, getModularInstance, base64Decode, getUA, isIE, createSubscribe, deepEqual, querystringDecode, extractQuerystring, isEmpty, getExperimentalSetting, getDefaultEmulatorHost } from '@firebase/util';\nimport { SDK_VERSION, _getProvider, _registerComponent, registerVersion, getApp } from '@firebase/app';\nimport { Logger, LogLevel } from '@firebase/logger';\nimport { __rest } from 'tslib';\nimport { Component } from '@firebase/component';\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 */\n\n/**\r\n * An enum of factors that may be used for multifactor authentication.\r\n *\r\n * @public\r\n */\n\nvar FactorId = {\n /** Phone as second factor */\n PHONE: 'phone',\n TOTP: 'totp'\n};\n/**\r\n * Enumeration of supported providers.\r\n *\r\n * @public\r\n */\n\nvar ProviderId = {\n /** Facebook provider ID */\n FACEBOOK: 'facebook.com',\n\n /** GitHub provider ID */\n GITHUB: 'github.com',\n\n /** Google provider ID */\n GOOGLE: 'google.com',\n\n /** Password provider */\n PASSWORD: 'password',\n\n /** Phone provider */\n PHONE: 'phone',\n\n /** Twitter provider ID */\n TWITTER: 'twitter.com'\n};\n/**\r\n * Enumeration of supported sign-in methods.\r\n *\r\n * @public\r\n */\n\nvar SignInMethod = {\n /** Email link sign in method */\n EMAIL_LINK: 'emailLink',\n\n /** Email/password sign in method */\n EMAIL_PASSWORD: 'password',\n\n /** Facebook sign in method */\n FACEBOOK: 'facebook.com',\n\n /** GitHub sign in method */\n GITHUB: 'github.com',\n\n /** Google sign in method */\n GOOGLE: 'google.com',\n\n /** Phone sign in method */\n PHONE: 'phone',\n\n /** Twitter sign in method */\n TWITTER: 'twitter.com'\n};\n/**\r\n * Enumeration of supported operation types.\r\n *\r\n * @public\r\n */\n\nvar OperationType = {\n /** Operation involving linking an additional provider to an already signed-in user. */\n LINK: 'link',\n\n /** Operation involving using a provider to reauthenticate an already signed-in user. */\n REAUTHENTICATE: 'reauthenticate',\n\n /** Operation involving signing in a user. */\n SIGN_IN: 'signIn'\n};\n/**\r\n * An enumeration of the possible email action types.\r\n *\r\n * @public\r\n */\n\nvar ActionCodeOperation = {\n /** The email link sign-in action. */\n EMAIL_SIGNIN: 'EMAIL_SIGNIN',\n\n /** The password reset action. */\n PASSWORD_RESET: 'PASSWORD_RESET',\n\n /** The email revocation action. */\n RECOVER_EMAIL: 'RECOVER_EMAIL',\n\n /** The revert second factor addition email action. */\n REVERT_SECOND_FACTOR_ADDITION: 'REVERT_SECOND_FACTOR_ADDITION',\n\n /** The revert second factor addition email action. */\n VERIFY_AND_CHANGE_EMAIL: 'VERIFY_AND_CHANGE_EMAIL',\n\n /** The email verification action. */\n VERIFY_EMAIL: 'VERIFY_EMAIL'\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 */\n\nfunction _debugErrorMap() {\n var _ref;\n\n return _ref = {}, _defineProperty(_ref, \"admin-restricted-operation\"\n /* AuthErrorCode.ADMIN_ONLY_OPERATION */\n , 'This operation is restricted to administrators only.'), _defineProperty(_ref, \"argument-error\"\n /* AuthErrorCode.ARGUMENT_ERROR */\n , ''), _defineProperty(_ref, \"app-not-authorized\"\n /* AuthErrorCode.APP_NOT_AUTHORIZED */\n , \"This app, identified by the domain where it's hosted, is not \" + 'authorized to use Firebase Authentication with the provided API key. ' + 'Review your key configuration in the Google API console.'), _defineProperty(_ref, \"app-not-installed\"\n /* AuthErrorCode.APP_NOT_INSTALLED */\n , 'The requested mobile application corresponding to the identifier (' + 'Android package name or iOS bundle ID) provided is not installed on ' + 'this device.'), _defineProperty(_ref, \"captcha-check-failed\"\n /* AuthErrorCode.CAPTCHA_CHECK_FAILED */\n , 'The reCAPTCHA response token provided is either invalid, expired, ' + 'already used or the domain associated with it does not match the list ' + 'of whitelisted domains.'), _defineProperty(_ref, \"code-expired\"\n /* AuthErrorCode.CODE_EXPIRED */\n , 'The SMS code has expired. Please re-send the verification code to try ' + 'again.'), _defineProperty(_ref, \"cordova-not-ready\"\n /* AuthErrorCode.CORDOVA_NOT_READY */\n , 'Cordova framework is not ready.'), _defineProperty(_ref, \"cors-unsupported\"\n /* AuthErrorCode.CORS_UNSUPPORTED */\n , 'This browser is not supported.'), _defineProperty(_ref, \"credential-already-in-use\"\n /* AuthErrorCode.CREDENTIAL_ALREADY_IN_USE */\n , 'This credential is already associated with a different user account.'), _defineProperty(_ref, \"custom-token-mismatch\"\n /* AuthErrorCode.CREDENTIAL_MISMATCH */\n , 'The custom token corresponds to a different audience.'), _defineProperty(_ref, \"requires-recent-login\"\n /* AuthErrorCode.CREDENTIAL_TOO_OLD_LOGIN_AGAIN */\n , 'This operation is sensitive and requires recent authentication. Log in ' + 'again before retrying this request.'), _defineProperty(_ref, \"dependent-sdk-initialized-before-auth\"\n /* AuthErrorCode.DEPENDENT_SDK_INIT_BEFORE_AUTH */\n , 'Another Firebase SDK was initialized and is trying to use Auth before Auth is ' + 'initialized. Please be sure to call `initializeAuth` or `getAuth` before ' + 'starting any other Firebase SDK.'), _defineProperty(_ref, \"dynamic-link-not-activated\"\n /* AuthErrorCode.DYNAMIC_LINK_NOT_ACTIVATED */\n , 'Please activate Dynamic Links in the Firebase Console and agree to the terms and ' + 'conditions.'), _defineProperty(_ref, \"email-change-needs-verification\"\n /* AuthErrorCode.EMAIL_CHANGE_NEEDS_VERIFICATION */\n , 'Multi-factor users must always have a verified email.'), _defineProperty(_ref, \"email-already-in-use\"\n /* AuthErrorCode.EMAIL_EXISTS */\n , 'The email address is already in use by another account.'), _defineProperty(_ref, \"emulator-config-failed\"\n /* AuthErrorCode.EMULATOR_CONFIG_FAILED */\n , 'Auth instance has already been used to make a network call. Auth can ' + 'no longer be configured to use the emulator. Try calling ' + '\"connectAuthEmulator()\" sooner.'), _defineProperty(_ref, \"expired-action-code\"\n /* AuthErrorCode.EXPIRED_OOB_CODE */\n , 'The action code has expired.'), _defineProperty(_ref, \"cancelled-popup-request\"\n /* AuthErrorCode.EXPIRED_POPUP_REQUEST */\n , 'This operation has been cancelled due to another conflicting popup being opened.'), _defineProperty(_ref, \"internal-error\"\n /* AuthErrorCode.INTERNAL_ERROR */\n , 'An internal AuthError has occurred.'), _defineProperty(_ref, \"invalid-app-credential\"\n /* AuthErrorCode.INVALID_APP_CREDENTIAL */\n , 'The phone verification request contains an invalid application verifier.' + ' The reCAPTCHA token response is either invalid or expired.'), _defineProperty(_ref, \"invalid-app-id\"\n /* AuthErrorCode.INVALID_APP_ID */\n , 'The mobile app identifier is not registed for the current project.'), _defineProperty(_ref, \"invalid-user-token\"\n /* AuthErrorCode.INVALID_AUTH */\n , \"This user's credential isn't valid for this project. This can happen \" + \"if the user's token has been tampered with, or if the user isn't for \" + 'the project associated with this API key.'), _defineProperty(_ref, \"invalid-auth-event\"\n /* AuthErrorCode.INVALID_AUTH_EVENT */\n , 'An internal AuthError has occurred.'), _defineProperty(_ref, \"invalid-verification-code\"\n /* AuthErrorCode.INVALID_CODE */\n , 'The SMS verification code used to create the phone auth credential is ' + 'invalid. Please resend the verification code sms and be sure to use the ' + 'verification code provided by the user.'), _defineProperty(_ref, \"invalid-continue-uri\"\n /* AuthErrorCode.INVALID_CONTINUE_URI */\n , 'The continue URL provided in the request is invalid.'), _defineProperty(_ref, \"invalid-cordova-configuration\"\n /* AuthErrorCode.INVALID_CORDOVA_CONFIGURATION */\n , 'The following Cordova plugins must be installed to enable OAuth sign-in: ' + 'cordova-plugin-buildinfo, cordova-universal-links-plugin, ' + 'cordova-plugin-browsertab, cordova-plugin-inappbrowser and ' + 'cordova-plugin-customurlscheme.'), _defineProperty(_ref, \"invalid-custom-token\"\n /* AuthErrorCode.INVALID_CUSTOM_TOKEN */\n , 'The custom token format is incorrect. Please check the documentation.'), _defineProperty(_ref, \"invalid-dynamic-link-domain\"\n /* AuthErrorCode.INVALID_DYNAMIC_LINK_DOMAIN */\n , 'The provided dynamic link domain is not configured or authorized for the current project.'), _defineProperty(_ref, \"invalid-email\"\n /* AuthErrorCode.INVALID_EMAIL */\n , 'The email address is badly formatted.'), _defineProperty(_ref, \"invalid-emulator-scheme\"\n /* AuthErrorCode.INVALID_EMULATOR_SCHEME */\n , 'Emulator URL must start with a valid scheme (http:// or https://).'), _defineProperty(_ref, \"invalid-api-key\"\n /* AuthErrorCode.INVALID_API_KEY */\n , 'Your API key is invalid, please check you have copied it correctly.'), _defineProperty(_ref, \"invalid-cert-hash\"\n /* AuthErrorCode.INVALID_CERT_HASH */\n , 'The SHA-1 certificate hash provided is invalid.'), _defineProperty(_ref, \"invalid-credential\"\n /* AuthErrorCode.INVALID_CREDENTIAL */\n , 'The supplied auth credential is incorrect, malformed or has expired.'), _defineProperty(_ref, \"invalid-message-payload\"\n /* AuthErrorCode.INVALID_MESSAGE_PAYLOAD */\n , 'The email template corresponding to this action contains invalid characters in its message. ' + 'Please fix by going to the Auth email templates section in the Firebase Console.'), _defineProperty(_ref, \"invalid-multi-factor-session\"\n /* AuthErrorCode.INVALID_MFA_SESSION */\n , 'The request does not contain a valid proof of first factor successful sign-in.'), _defineProperty(_ref, \"invalid-oauth-provider\"\n /* AuthErrorCode.INVALID_OAUTH_PROVIDER */\n , 'EmailAuthProvider is not supported for this operation. This operation ' + 'only supports OAuth providers.'), _defineProperty(_ref, \"invalid-oauth-client-id\"\n /* AuthErrorCode.INVALID_OAUTH_CLIENT_ID */\n , 'The OAuth client ID provided is either invalid or does not match the ' + 'specified API key.'), _defineProperty(_ref, \"unauthorized-domain\"\n /* AuthErrorCode.INVALID_ORIGIN */\n , 'This domain is not authorized for OAuth operations for your Firebase ' + 'project. Edit the list of authorized domains from the Firebase console.'), _defineProperty(_ref, \"invalid-action-code\"\n /* AuthErrorCode.INVALID_OOB_CODE */\n , 'The action code is invalid. This can happen if the code is malformed, ' + 'expired, or has already been used.'), _defineProperty(_ref, \"wrong-password\"\n /* AuthErrorCode.INVALID_PASSWORD */\n , 'The password is invalid or the user does not have a password.'), _defineProperty(_ref, \"invalid-persistence-type\"\n /* AuthErrorCode.INVALID_PERSISTENCE */\n , 'The specified persistence type is invalid. It can only be local, session or none.'), _defineProperty(_ref, \"invalid-phone-number\"\n /* AuthErrorCode.INVALID_PHONE_NUMBER */\n , 'The format of the phone number provided is incorrect. Please enter the ' + 'phone number in a format that can be parsed into E.164 format. E.164 ' + 'phone numbers are written in the format [+][country code][subscriber ' + 'number including area code].'), _defineProperty(_ref, \"invalid-provider-id\"\n /* AuthErrorCode.INVALID_PROVIDER_ID */\n , 'The specified provider ID is invalid.'), _defineProperty(_ref, \"invalid-recipient-email\"\n /* AuthErrorCode.INVALID_RECIPIENT_EMAIL */\n , 'The email corresponding to this action failed to send as the provided ' + 'recipient email address is invalid.'), _defineProperty(_ref, \"invalid-sender\"\n /* AuthErrorCode.INVALID_SENDER */\n , 'The email template corresponding to this action contains an invalid sender email or name. ' + 'Please fix by going to the Auth email templates section in the Firebase Console.'), _defineProperty(_ref, \"invalid-verification-id\"\n /* AuthErrorCode.INVALID_SESSION_INFO */\n , 'The verification ID used to create the phone auth credential is invalid.'), _defineProperty(_ref, \"invalid-tenant-id\"\n /* AuthErrorCode.INVALID_TENANT_ID */\n , \"The Auth instance's tenant ID is invalid.\"), _defineProperty(_ref, \"login-blocked\"\n /* AuthErrorCode.LOGIN_BLOCKED */\n , 'Login blocked by user-provided method: {$originalMessage}'), _defineProperty(_ref, \"missing-android-pkg-name\"\n /* AuthErrorCode.MISSING_ANDROID_PACKAGE_NAME */\n , 'An Android Package Name must be provided if the Android App is required to be installed.'), _defineProperty(_ref, \"auth-domain-config-required\"\n /* AuthErrorCode.MISSING_AUTH_DOMAIN */\n , 'Be sure to include authDomain when calling firebase.initializeApp(), ' + 'by following the instructions in the Firebase console.'), _defineProperty(_ref, \"missing-app-credential\"\n /* AuthErrorCode.MISSING_APP_CREDENTIAL */\n , 'The phone verification request is missing an application verifier ' + 'assertion. A reCAPTCHA response token needs to be provided.'), _defineProperty(_ref, \"missing-verification-code\"\n /* AuthErrorCode.MISSING_CODE */\n , 'The phone auth credential was created with an empty SMS verification code.'), _defineProperty(_ref, \"missing-continue-uri\"\n /* AuthErrorCode.MISSING_CONTINUE_URI */\n , 'A continue URL must be provided in the request.'), _defineProperty(_ref, \"missing-iframe-start\"\n /* AuthErrorCode.MISSING_IFRAME_START */\n , 'An internal AuthError has occurred.'), _defineProperty(_ref, \"missing-ios-bundle-id\"\n /* AuthErrorCode.MISSING_IOS_BUNDLE_ID */\n , 'An iOS Bundle ID must be provided if an App Store ID is provided.'), _defineProperty(_ref, \"missing-or-invalid-nonce\"\n /* AuthErrorCode.MISSING_OR_INVALID_NONCE */\n , 'The request does not contain a valid nonce. This can occur if the ' + 'SHA-256 hash of the provided raw nonce does not match the hashed nonce ' + 'in the ID token payload.'), _defineProperty(_ref, \"missing-password\"\n /* AuthErrorCode.MISSING_PASSWORD */\n , 'A non-empty password must be provided'), _defineProperty(_ref, \"missing-multi-factor-info\"\n /* AuthErrorCode.MISSING_MFA_INFO */\n , 'No second factor identifier is provided.'), _defineProperty(_ref, \"missing-multi-factor-session\"\n /* AuthErrorCode.MISSING_MFA_SESSION */\n , 'The request is missing proof of first factor successful sign-in.'), _defineProperty(_ref, \"missing-phone-number\"\n /* AuthErrorCode.MISSING_PHONE_NUMBER */\n , 'To send verification codes, provide a phone number for the recipient.'), _defineProperty(_ref, \"missing-verification-id\"\n /* AuthErrorCode.MISSING_SESSION_INFO */\n , 'The phone auth credential was created with an empty verification ID.'), _defineProperty(_ref, \"app-deleted\"\n /* AuthErrorCode.MODULE_DESTROYED */\n , 'This instance of FirebaseApp has been deleted.'), _defineProperty(_ref, \"multi-factor-info-not-found\"\n /* AuthErrorCode.MFA_INFO_NOT_FOUND */\n , 'The user does not have a second factor matching the identifier provided.'), _defineProperty(_ref, \"multi-factor-auth-required\"\n /* AuthErrorCode.MFA_REQUIRED */\n , 'Proof of ownership of a second factor is required to complete sign-in.'), _defineProperty(_ref, \"account-exists-with-different-credential\"\n /* AuthErrorCode.NEED_CONFIRMATION */\n , 'An account already exists with the same email address but different ' + 'sign-in credentials. Sign in using a provider associated with this ' + 'email address.'), _defineProperty(_ref, \"network-request-failed\"\n /* AuthErrorCode.NETWORK_REQUEST_FAILED */\n , 'A network AuthError (such as timeout, interrupted connection or unreachable host) has occurred.'), _defineProperty(_ref, \"no-auth-event\"\n /* AuthErrorCode.NO_AUTH_EVENT */\n , 'An internal AuthError has occurred.'), _defineProperty(_ref, \"no-such-provider\"\n /* AuthErrorCode.NO_SUCH_PROVIDER */\n , 'User was not linked to an account with the given provider.'), _defineProperty(_ref, \"null-user\"\n /* AuthErrorCode.NULL_USER */\n , 'A null user object was provided as the argument for an operation which ' + 'requires a non-null user object.'), _defineProperty(_ref, \"operation-not-allowed\"\n /* AuthErrorCode.OPERATION_NOT_ALLOWED */\n , 'The given sign-in provider is disabled for this Firebase project. ' + 'Enable it in the Firebase console, under the sign-in method tab of the ' + 'Auth section.'), _defineProperty(_ref, \"operation-not-supported-in-this-environment\"\n /* AuthErrorCode.OPERATION_NOT_SUPPORTED */\n , 'This operation is not supported in the environment this application is ' + 'running on. \"location.protocol\" must be http, https or chrome-extension' + ' and web storage must be enabled.'), _defineProperty(_ref, \"popup-blocked\"\n /* AuthErrorCode.POPUP_BLOCKED */\n , 'Unable to establish a connection with the popup. It may have been blocked by the browser.'), _defineProperty(_ref, \"popup-closed-by-user\"\n /* AuthErrorCode.POPUP_CLOSED_BY_USER */\n , 'The popup has been closed by the user before finalizing the operation.'), _defineProperty(_ref, \"provider-already-linked\"\n /* AuthErrorCode.PROVIDER_ALREADY_LINKED */\n , 'User can only be linked to one identity for the given provider.'), _defineProperty(_ref, \"quota-exceeded\"\n /* AuthErrorCode.QUOTA_EXCEEDED */\n , \"The project's quota for this operation has been exceeded.\"), _defineProperty(_ref, \"redirect-cancelled-by-user\"\n /* AuthErrorCode.REDIRECT_CANCELLED_BY_USER */\n , 'The redirect operation has been cancelled by the user before finalizing.'), _defineProperty(_ref, \"redirect-operation-pending\"\n /* AuthErrorCode.REDIRECT_OPERATION_PENDING */\n , 'A redirect sign-in operation is already pending.'), _defineProperty(_ref, \"rejected-credential\"\n /* AuthErrorCode.REJECTED_CREDENTIAL */\n , 'The request contains malformed or mismatching credentials.'), _defineProperty(_ref, \"second-factor-already-in-use\"\n /* AuthErrorCode.SECOND_FACTOR_ALREADY_ENROLLED */\n , 'The second factor is already enrolled on this account.'), _defineProperty(_ref, \"maximum-second-factor-count-exceeded\"\n /* AuthErrorCode.SECOND_FACTOR_LIMIT_EXCEEDED */\n , 'The maximum allowed number of second factors on a user has been exceeded.'), _defineProperty(_ref, \"tenant-id-mismatch\"\n /* AuthErrorCode.TENANT_ID_MISMATCH */\n , \"The provided tenant ID does not match the Auth instance's tenant ID\"), _defineProperty(_ref, \"timeout\"\n /* AuthErrorCode.TIMEOUT */\n , 'The operation has timed out.'), _defineProperty(_ref, \"user-token-expired\"\n /* AuthErrorCode.TOKEN_EXPIRED */\n , \"The user's credential is no longer valid. The user must sign in again.\"), _defineProperty(_ref, \"too-many-requests\"\n /* AuthErrorCode.TOO_MANY_ATTEMPTS_TRY_LATER */\n , 'We have blocked all requests from this device due to unusual activity. ' + 'Try again later.'), _defineProperty(_ref, \"unauthorized-continue-uri\"\n /* AuthErrorCode.UNAUTHORIZED_DOMAIN */\n , 'The domain of the continue URL is not whitelisted. Please whitelist ' + 'the domain in the Firebase console.'), _defineProperty(_ref, \"unsupported-first-factor\"\n /* AuthErrorCode.UNSUPPORTED_FIRST_FACTOR */\n , 'Enrolling a second factor or signing in with a multi-factor account requires sign-in with a supported first factor.'), _defineProperty(_ref, \"unsupported-persistence-type\"\n /* AuthErrorCode.UNSUPPORTED_PERSISTENCE */\n , 'The current environment does not support the specified persistence type.'), _defineProperty(_ref, \"unsupported-tenant-operation\"\n /* AuthErrorCode.UNSUPPORTED_TENANT_OPERATION */\n , 'This operation is not supported in a multi-tenant context.'), _defineProperty(_ref, \"unverified-email\"\n /* AuthErrorCode.UNVERIFIED_EMAIL */\n , 'The operation requires a verified email.'), _defineProperty(_ref, \"user-cancelled\"\n /* AuthErrorCode.USER_CANCELLED */\n , 'The user did not grant your application the permissions it requested.'), _defineProperty(_ref, \"user-not-found\"\n /* AuthErrorCode.USER_DELETED */\n , 'There is no user record corresponding to this identifier. The user may ' + 'have been deleted.'), _defineProperty(_ref, \"user-disabled\"\n /* AuthErrorCode.USER_DISABLED */\n , 'The user account has been disabled by an administrator.'), _defineProperty(_ref, \"user-mismatch\"\n /* AuthErrorCode.USER_MISMATCH */\n , 'The supplied credentials do not correspond to the previously signed in user.'), _defineProperty(_ref, \"user-signed-out\"\n /* AuthErrorCode.USER_SIGNED_OUT */\n , ''), _defineProperty(_ref, \"weak-password\"\n /* AuthErrorCode.WEAK_PASSWORD */\n , 'The password must be 6 characters long or more.'), _defineProperty(_ref, \"web-storage-unsupported\"\n /* AuthErrorCode.WEB_STORAGE_UNSUPPORTED */\n , 'This browser is not supported or 3rd party cookies and data may be disabled.'), _defineProperty(_ref, \"already-initialized\"\n /* AuthErrorCode.ALREADY_INITIALIZED */\n , 'initializeAuth() has already been called with ' + 'different options. To avoid this error, call initializeAuth() with the ' + 'same options as when it was originally called, or call getAuth() to return the' + ' already initialized instance.'), _defineProperty(_ref, \"missing-recaptcha-token\"\n /* AuthErrorCode.MISSING_RECAPTCHA_TOKEN */\n , 'The reCAPTCHA token is missing when sending request to the backend.'), _defineProperty(_ref, \"invalid-recaptcha-token\"\n /* AuthErrorCode.INVALID_RECAPTCHA_TOKEN */\n , 'The reCAPTCHA token is invalid when sending request to the backend.'), _defineProperty(_ref, \"invalid-recaptcha-action\"\n /* AuthErrorCode.INVALID_RECAPTCHA_ACTION */\n , 'The reCAPTCHA action is invalid when sending request to the backend.'), _defineProperty(_ref, \"recaptcha-not-enabled\"\n /* AuthErrorCode.RECAPTCHA_NOT_ENABLED */\n , 'reCAPTCHA Enterprise integration is not enabled for this project.'), _defineProperty(_ref, \"missing-client-type\"\n /* AuthErrorCode.MISSING_CLIENT_TYPE */\n , 'The reCAPTCHA client type is missing when sending request to the backend.'), _defineProperty(_ref, \"missing-recaptcha-version\"\n /* AuthErrorCode.MISSING_RECAPTCHA_VERSION */\n , 'The reCAPTCHA version is missing when sending request to the backend.'), _defineProperty(_ref, \"invalid-req-type\"\n /* AuthErrorCode.INVALID_REQ_TYPE */\n , 'Invalid request parameters.'), _defineProperty(_ref, \"invalid-recaptcha-version\"\n /* AuthErrorCode.INVALID_RECAPTCHA_VERSION */\n , 'The reCAPTCHA version is invalid when sending request to the backend.'), _defineProperty(_ref, \"unsupported-password-policy-schema-version\"\n /* AuthErrorCode.UNSUPPORTED_PASSWORD_POLICY_SCHEMA_VERSION */\n , 'The password policy received from the backend uses a schema version that is not supported by this version of the Firebase SDK.'), _defineProperty(_ref, \"password-does-not-meet-requirements\"\n /* AuthErrorCode.PASSWORD_DOES_NOT_MEET_REQUIREMENTS */\n , 'The password does not meet the requirements.'), _ref;\n}\n\nfunction _prodErrorMap() {\n // We will include this one message in the prod error map since by the very\n // nature of this error, developers will never be able to see the message\n // using the debugErrorMap (which is installed during auth initialization).\n return _defineProperty({}, \"dependent-sdk-initialized-before-auth\"\n /* AuthErrorCode.DEPENDENT_SDK_INIT_BEFORE_AUTH */\n , 'Another Firebase SDK was initialized and is trying to use Auth before Auth is ' + 'initialized. Please be sure to call `initializeAuth` or `getAuth` before ' + 'starting any other Firebase SDK.');\n}\n/**\r\n * A verbose error map with detailed descriptions for most error codes.\r\n *\r\n * See discussion at {@link AuthErrorMap}\r\n *\r\n * @public\r\n */\n\n\nvar debugErrorMap = _debugErrorMap;\n/**\r\n * A minimal error map with all verbose error messages stripped.\r\n *\r\n * See discussion at {@link AuthErrorMap}\r\n *\r\n * @public\r\n */\n\nvar prodErrorMap = _prodErrorMap;\n\nvar _DEFAULT_AUTH_ERROR_FACTORY = new ErrorFactory('auth', 'Firebase', _prodErrorMap());\n/**\r\n * A map of potential `Auth` error codes, for easier comparison with errors\r\n * thrown by the SDK.\r\n *\r\n * @remarks\r\n * Note that you can't tree-shake individual keys\r\n * in the map, so by using the map you might substantially increase your\r\n * bundle size.\r\n *\r\n * @public\r\n */\n\n\nvar AUTH_ERROR_CODES_MAP_DO_NOT_USE_INTERNALLY = {\n ADMIN_ONLY_OPERATION: 'auth/admin-restricted-operation',\n ARGUMENT_ERROR: 'auth/argument-error',\n APP_NOT_AUTHORIZED: 'auth/app-not-authorized',\n APP_NOT_INSTALLED: 'auth/app-not-installed',\n CAPTCHA_CHECK_FAILED: 'auth/captcha-check-failed',\n CODE_EXPIRED: 'auth/code-expired',\n CORDOVA_NOT_READY: 'auth/cordova-not-ready',\n CORS_UNSUPPORTED: 'auth/cors-unsupported',\n CREDENTIAL_ALREADY_IN_USE: 'auth/credential-already-in-use',\n CREDENTIAL_MISMATCH: 'auth/custom-token-mismatch',\n CREDENTIAL_TOO_OLD_LOGIN_AGAIN: 'auth/requires-recent-login',\n DEPENDENT_SDK_INIT_BEFORE_AUTH: 'auth/dependent-sdk-initialized-before-auth',\n DYNAMIC_LINK_NOT_ACTIVATED: 'auth/dynamic-link-not-activated',\n EMAIL_CHANGE_NEEDS_VERIFICATION: 'auth/email-change-needs-verification',\n EMAIL_EXISTS: 'auth/email-already-in-use',\n EMULATOR_CONFIG_FAILED: 'auth/emulator-config-failed',\n EXPIRED_OOB_CODE: 'auth/expired-action-code',\n EXPIRED_POPUP_REQUEST: 'auth/cancelled-popup-request',\n INTERNAL_ERROR: 'auth/internal-error',\n INVALID_API_KEY: 'auth/invalid-api-key',\n INVALID_APP_CREDENTIAL: 'auth/invalid-app-credential',\n INVALID_APP_ID: 'auth/invalid-app-id',\n INVALID_AUTH: 'auth/invalid-user-token',\n INVALID_AUTH_EVENT: 'auth/invalid-auth-event',\n INVALID_CERT_HASH: 'auth/invalid-cert-hash',\n INVALID_CODE: 'auth/invalid-verification-code',\n INVALID_CONTINUE_URI: 'auth/invalid-continue-uri',\n INVALID_CORDOVA_CONFIGURATION: 'auth/invalid-cordova-configuration',\n INVALID_CUSTOM_TOKEN: 'auth/invalid-custom-token',\n INVALID_DYNAMIC_LINK_DOMAIN: 'auth/invalid-dynamic-link-domain',\n INVALID_EMAIL: 'auth/invalid-email',\n INVALID_EMULATOR_SCHEME: 'auth/invalid-emulator-scheme',\n INVALID_IDP_RESPONSE: 'auth/invalid-credential',\n INVALID_LOGIN_CREDENTIALS: 'auth/invalid-credential',\n INVALID_MESSAGE_PAYLOAD: 'auth/invalid-message-payload',\n INVALID_MFA_SESSION: 'auth/invalid-multi-factor-session',\n INVALID_OAUTH_CLIENT_ID: 'auth/invalid-oauth-client-id',\n INVALID_OAUTH_PROVIDER: 'auth/invalid-oauth-provider',\n INVALID_OOB_CODE: 'auth/invalid-action-code',\n INVALID_ORIGIN: 'auth/unauthorized-domain',\n INVALID_PASSWORD: 'auth/wrong-password',\n INVALID_PERSISTENCE: 'auth/invalid-persistence-type',\n INVALID_PHONE_NUMBER: 'auth/invalid-phone-number',\n INVALID_PROVIDER_ID: 'auth/invalid-provider-id',\n INVALID_RECIPIENT_EMAIL: 'auth/invalid-recipient-email',\n INVALID_SENDER: 'auth/invalid-sender',\n INVALID_SESSION_INFO: 'auth/invalid-verification-id',\n INVALID_TENANT_ID: 'auth/invalid-tenant-id',\n MFA_INFO_NOT_FOUND: 'auth/multi-factor-info-not-found',\n MFA_REQUIRED: 'auth/multi-factor-auth-required',\n MISSING_ANDROID_PACKAGE_NAME: 'auth/missing-android-pkg-name',\n MISSING_APP_CREDENTIAL: 'auth/missing-app-credential',\n MISSING_AUTH_DOMAIN: 'auth/auth-domain-config-required',\n MISSING_CODE: 'auth/missing-verification-code',\n MISSING_CONTINUE_URI: 'auth/missing-continue-uri',\n MISSING_IFRAME_START: 'auth/missing-iframe-start',\n MISSING_IOS_BUNDLE_ID: 'auth/missing-ios-bundle-id',\n MISSING_OR_INVALID_NONCE: 'auth/missing-or-invalid-nonce',\n MISSING_MFA_INFO: 'auth/missing-multi-factor-info',\n MISSING_MFA_SESSION: 'auth/missing-multi-factor-session',\n MISSING_PHONE_NUMBER: 'auth/missing-phone-number',\n MISSING_SESSION_INFO: 'auth/missing-verification-id',\n MODULE_DESTROYED: 'auth/app-deleted',\n NEED_CONFIRMATION: 'auth/account-exists-with-different-credential',\n NETWORK_REQUEST_FAILED: 'auth/network-request-failed',\n NULL_USER: 'auth/null-user',\n NO_AUTH_EVENT: 'auth/no-auth-event',\n NO_SUCH_PROVIDER: 'auth/no-such-provider',\n OPERATION_NOT_ALLOWED: 'auth/operation-not-allowed',\n OPERATION_NOT_SUPPORTED: 'auth/operation-not-supported-in-this-environment',\n POPUP_BLOCKED: 'auth/popup-blocked',\n POPUP_CLOSED_BY_USER: 'auth/popup-closed-by-user',\n PROVIDER_ALREADY_LINKED: 'auth/provider-already-linked',\n QUOTA_EXCEEDED: 'auth/quota-exceeded',\n REDIRECT_CANCELLED_BY_USER: 'auth/redirect-cancelled-by-user',\n REDIRECT_OPERATION_PENDING: 'auth/redirect-operation-pending',\n REJECTED_CREDENTIAL: 'auth/rejected-credential',\n SECOND_FACTOR_ALREADY_ENROLLED: 'auth/second-factor-already-in-use',\n SECOND_FACTOR_LIMIT_EXCEEDED: 'auth/maximum-second-factor-count-exceeded',\n TENANT_ID_MISMATCH: 'auth/tenant-id-mismatch',\n TIMEOUT: 'auth/timeout',\n TOKEN_EXPIRED: 'auth/user-token-expired',\n TOO_MANY_ATTEMPTS_TRY_LATER: 'auth/too-many-requests',\n UNAUTHORIZED_DOMAIN: 'auth/unauthorized-continue-uri',\n UNSUPPORTED_FIRST_FACTOR: 'auth/unsupported-first-factor',\n UNSUPPORTED_PERSISTENCE: 'auth/unsupported-persistence-type',\n UNSUPPORTED_TENANT_OPERATION: 'auth/unsupported-tenant-operation',\n UNVERIFIED_EMAIL: 'auth/unverified-email',\n USER_CANCELLED: 'auth/user-cancelled',\n USER_DELETED: 'auth/user-not-found',\n USER_DISABLED: 'auth/user-disabled',\n USER_MISMATCH: 'auth/user-mismatch',\n USER_SIGNED_OUT: 'auth/user-signed-out',\n WEAK_PASSWORD: 'auth/weak-password',\n WEB_STORAGE_UNSUPPORTED: 'auth/web-storage-unsupported',\n ALREADY_INITIALIZED: 'auth/already-initialized',\n RECAPTCHA_NOT_ENABLED: 'auth/recaptcha-not-enabled',\n MISSING_RECAPTCHA_TOKEN: 'auth/missing-recaptcha-token',\n INVALID_RECAPTCHA_TOKEN: 'auth/invalid-recaptcha-token',\n INVALID_RECAPTCHA_ACTION: 'auth/invalid-recaptcha-action',\n MISSING_CLIENT_TYPE: 'auth/missing-client-type',\n MISSING_RECAPTCHA_VERSION: 'auth/missing-recaptcha-version',\n INVALID_RECAPTCHA_VERSION: 'auth/invalid-recaptcha-version',\n INVALID_REQ_TYPE: 'auth/invalid-req-type'\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 */\n\nvar logClient = new Logger('@firebase/auth');\n\nfunction _logWarn(msg) {\n if (logClient.logLevel <= LogLevel.WARN) {\n for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key2 = 1; _key2 < _len; _key2++) {\n args[_key2 - 1] = arguments[_key2];\n }\n\n logClient.warn.apply(logClient, [\"Auth (\".concat(SDK_VERSION, \"): \").concat(msg)].concat(args));\n }\n}\n\nfunction _logError(msg) {\n if (logClient.logLevel <= LogLevel.ERROR) {\n for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key3 = 1; _key3 < _len2; _key3++) {\n args[_key3 - 1] = arguments[_key3];\n }\n\n logClient.error.apply(logClient, [\"Auth (\".concat(SDK_VERSION, \"): \").concat(msg)].concat(args));\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 */\n\n\nfunction _fail(authOrCode) {\n for (var _len3 = arguments.length, rest = new Array(_len3 > 1 ? _len3 - 1 : 0), _key4 = 1; _key4 < _len3; _key4++) {\n rest[_key4 - 1] = arguments[_key4];\n }\n\n throw createErrorInternal.apply(void 0, [authOrCode].concat(rest));\n}\n\nfunction _createError(authOrCode) {\n for (var _len4 = arguments.length, rest = new Array(_len4 > 1 ? _len4 - 1 : 0), _key5 = 1; _key5 < _len4; _key5++) {\n rest[_key5 - 1] = arguments[_key5];\n }\n\n return createErrorInternal.apply(void 0, [authOrCode].concat(rest));\n}\n\nfunction _errorWithCustomMessage(auth, code, message) {\n var errorMap = Object.assign(Object.assign({}, prodErrorMap()), _defineProperty({}, code, message));\n var factory = new ErrorFactory('auth', 'Firebase', errorMap);\n return factory.create(code, {\n appName: auth.name\n });\n}\n\nfunction _assertInstanceOf(auth, object, instance) {\n var constructorInstance = instance;\n\n if (!(object instanceof constructorInstance)) {\n if (constructorInstance.name !== object.constructor.name) {\n _fail(auth, \"argument-error\"\n /* AuthErrorCode.ARGUMENT_ERROR */\n );\n }\n\n throw _errorWithCustomMessage(auth, \"argument-error\"\n /* AuthErrorCode.ARGUMENT_ERROR */\n , \"Type of \".concat(object.constructor.name, \" does not match expected instance.\") + \"Did you pass a reference from a different Auth SDK?\");\n }\n}\n\nfunction createErrorInternal(authOrCode) {\n for (var _len5 = arguments.length, rest = new Array(_len5 > 1 ? _len5 - 1 : 0), _key6 = 1; _key6 < _len5; _key6++) {\n rest[_key6 - 1] = arguments[_key6];\n }\n\n if (typeof authOrCode !== 'string') {\n var _authOrCode$_errorFac;\n\n var code = rest[0];\n\n var fullParams = _toConsumableArray(rest.slice(1));\n\n if (fullParams[0]) {\n fullParams[0].appName = authOrCode.name;\n }\n\n return (_authOrCode$_errorFac = authOrCode._errorFactory).create.apply(_authOrCode$_errorFac, [code].concat(_toConsumableArray(fullParams)));\n }\n\n return _DEFAULT_AUTH_ERROR_FACTORY.create.apply(_DEFAULT_AUTH_ERROR_FACTORY, [authOrCode].concat(rest));\n}\n\nfunction _assert(assertion, authOrCode) {\n if (!assertion) {\n for (var _len6 = arguments.length, rest = new Array(_len6 > 2 ? _len6 - 2 : 0), _key7 = 2; _key7 < _len6; _key7++) {\n rest[_key7 - 2] = arguments[_key7];\n }\n\n throw createErrorInternal.apply(void 0, [authOrCode].concat(rest));\n }\n}\n/**\r\n * Unconditionally fails, throwing an internal error with the given message.\r\n *\r\n * @param failure type of failure encountered\r\n * @throws Error\r\n */\n\n\nfunction debugFail(failure) {\n // Log the failure in addition to throw an exception, just in case the\n // exception is swallowed.\n var message = \"INTERNAL ASSERTION FAILED: \" + failure;\n\n _logError(message); // NOTE: We don't use FirebaseError here because these are internal failures\n // that cannot be handled by the user. (Also it would create a circular\n // dependency between the error and assert modules which doesn't work.)\n\n\n throw new Error(message);\n}\n/**\r\n * Fails if the given assertion condition is false, throwing an Error with the\r\n * given message if it did.\r\n *\r\n * @param assertion\r\n * @param message\r\n */\n\n\nfunction debugAssert(assertion, message) {\n if (!assertion) {\n debugFail(message);\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 */\n\n\nfunction _getCurrentUrl() {\n var _a;\n\n return typeof self !== 'undefined' && ((_a = self.location) === null || _a === void 0 ? void 0 : _a.href) || '';\n}\n\nfunction _isHttpOrHttps() {\n return _getCurrentScheme() === 'http:' || _getCurrentScheme() === 'https:';\n}\n\nfunction _getCurrentScheme() {\n var _a;\n\n return typeof self !== 'undefined' && ((_a = self.location) === null || _a === void 0 ? void 0 : _a.protocol) || null;\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 */\n\n/**\r\n * Determine whether the browser is working online\r\n */\n\n\nfunction _isOnline() {\n if (typeof navigator !== 'undefined' && navigator && 'onLine' in navigator && typeof navigator.onLine === 'boolean' && ( // Apply only for traditional web apps and Chrome extensions.\n // This is especially true for Cordova apps which have unreliable\n // navigator.onLine behavior unless cordova-plugin-network-information is\n // installed which overwrites the native navigator.onLine value and\n // defines navigator.connection.\n _isHttpOrHttps() || isBrowserExtension() || 'connection' in navigator)) {\n return navigator.onLine;\n } // If we can't determine the state, assume it is online.\n\n\n return true;\n}\n\nfunction _getUserLanguage() {\n if (typeof navigator === 'undefined') {\n return null;\n }\n\n var navigatorLanguage = navigator;\n return (// Most reliable, but only supported in Chrome/Firefox.\n navigatorLanguage.languages && navigatorLanguage.languages[0] || // Supported in most browsers, but returns the language of the browser\n // UI, not the language set in browser settings.\n navigatorLanguage.language || // Couldn't determine language.\n null\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 */\n\n/**\r\n * A structure to help pick between a range of long and short delay durations\r\n * depending on the current environment. In general, the long delay is used for\r\n * mobile environments whereas short delays are used for desktop environments.\r\n */\n\n\nvar Delay = /*#__PURE__*/function () {\n function Delay(shortDelay, longDelay) {\n _classCallCheck(this, Delay);\n\n this.shortDelay = shortDelay;\n this.longDelay = longDelay; // Internal error when improperly initialized.\n\n debugAssert(longDelay > shortDelay, 'Short delay should be less than long delay!');\n this.isMobile = isMobileCordova() || isReactNative();\n }\n\n _createClass(Delay, [{\n key: \"get\",\n value: function get() {\n if (!_isOnline()) {\n // Pick the shorter timeout.\n return Math.min(5000\n /* DelayMin.OFFLINE */\n , this.shortDelay);\n } // If running in a mobile environment, return the long delay, otherwise\n // return the short delay.\n // This could be improved in the future to dynamically change based on other\n // variables instead of just reading the current environment.\n\n\n return this.isMobile ? this.longDelay : this.shortDelay;\n }\n }]);\n\n return Delay;\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 */\n\n\nfunction _emulatorUrl(config, path) {\n debugAssert(config.emulator, 'Emulator should always be set here');\n var url = config.emulator.url;\n\n if (!path) {\n return url;\n }\n\n return \"\".concat(url).concat(path.startsWith('/') ? path.slice(1) : path);\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 */\n\n\nvar FetchProvider = /*#__PURE__*/function () {\n function FetchProvider() {\n _classCallCheck(this, FetchProvider);\n }\n\n _createClass(FetchProvider, null, [{\n key: \"initialize\",\n value: function initialize(fetchImpl, headersImpl, responseImpl) {\n this.fetchImpl = fetchImpl;\n\n if (headersImpl) {\n this.headersImpl = headersImpl;\n }\n\n if (responseImpl) {\n this.responseImpl = responseImpl;\n }\n }\n }, {\n key: \"fetch\",\n value: function (_fetch) {\n function fetch() {\n return _fetch.apply(this, arguments);\n }\n\n fetch.toString = function () {\n return _fetch.toString();\n };\n\n return fetch;\n }(function () {\n if (this.fetchImpl) {\n return this.fetchImpl;\n }\n\n if (typeof self !== 'undefined' && 'fetch' in self) {\n return self.fetch;\n }\n\n if (typeof globalThis !== 'undefined' && globalThis.fetch) {\n return globalThis.fetch;\n }\n\n if (typeof fetch !== 'undefined') {\n return fetch;\n }\n\n debugFail('Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill');\n })\n }, {\n key: \"headers\",\n value: function headers() {\n if (this.headersImpl) {\n return this.headersImpl;\n }\n\n if (typeof self !== 'undefined' && 'Headers' in self) {\n return self.Headers;\n }\n\n if (typeof globalThis !== 'undefined' && globalThis.Headers) {\n return globalThis.Headers;\n }\n\n if (typeof Headers !== 'undefined') {\n return Headers;\n }\n\n debugFail('Could not find Headers implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill');\n }\n }, {\n key: \"response\",\n value: function response() {\n if (this.responseImpl) {\n return this.responseImpl;\n }\n\n if (typeof self !== 'undefined' && 'Response' in self) {\n return self.Response;\n }\n\n if (typeof globalThis !== 'undefined' && globalThis.Response) {\n return globalThis.Response;\n }\n\n if (typeof Response !== 'undefined') {\n return Response;\n }\n\n debugFail('Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill');\n }\n }]);\n\n return FetchProvider;\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 */\n\n/**\r\n * Map from errors returned by the server to errors to developer visible errors\r\n */\n\n\nvar SERVER_ERROR_MAP = (_SERVER_ERROR_MAP = {}, _defineProperty(_SERVER_ERROR_MAP, \"CREDENTIAL_MISMATCH\"\n/* ServerError.CREDENTIAL_MISMATCH */\n, \"custom-token-mismatch\"), _defineProperty(_SERVER_ERROR_MAP, \"MISSING_CUSTOM_TOKEN\"\n/* ServerError.MISSING_CUSTOM_TOKEN */\n, \"internal-error\"), _defineProperty(_SERVER_ERROR_MAP, \"INVALID_IDENTIFIER\"\n/* ServerError.INVALID_IDENTIFIER */\n, \"invalid-email\"), _defineProperty(_SERVER_ERROR_MAP, \"MISSING_CONTINUE_URI\"\n/* ServerError.MISSING_CONTINUE_URI */\n, \"internal-error\"), _defineProperty(_SERVER_ERROR_MAP, \"INVALID_PASSWORD\"\n/* ServerError.INVALID_PASSWORD */\n, \"wrong-password\"), _defineProperty(_SERVER_ERROR_MAP, \"MISSING_PASSWORD\"\n/* ServerError.MISSING_PASSWORD */\n, \"missing-password\"), _defineProperty(_SERVER_ERROR_MAP, \"INVALID_LOGIN_CREDENTIALS\"\n/* ServerError.INVALID_LOGIN_CREDENTIALS */\n, \"invalid-credential\"), _defineProperty(_SERVER_ERROR_MAP, \"EMAIL_EXISTS\"\n/* ServerError.EMAIL_EXISTS */\n, \"email-already-in-use\"), _defineProperty(_SERVER_ERROR_MAP, \"PASSWORD_LOGIN_DISABLED\"\n/* ServerError.PASSWORD_LOGIN_DISABLED */\n, \"operation-not-allowed\"), _defineProperty(_SERVER_ERROR_MAP, \"INVALID_IDP_RESPONSE\"\n/* ServerError.INVALID_IDP_RESPONSE */\n, \"invalid-credential\"), _defineProperty(_SERVER_ERROR_MAP, \"INVALID_PENDING_TOKEN\"\n/* ServerError.INVALID_PENDING_TOKEN */\n, \"invalid-credential\"), _defineProperty(_SERVER_ERROR_MAP, \"FEDERATED_USER_ID_ALREADY_LINKED\"\n/* ServerError.FEDERATED_USER_ID_ALREADY_LINKED */\n, \"credential-already-in-use\"), _defineProperty(_SERVER_ERROR_MAP, \"MISSING_REQ_TYPE\"\n/* ServerError.MISSING_REQ_TYPE */\n, \"internal-error\"), _defineProperty(_SERVER_ERROR_MAP, \"EMAIL_NOT_FOUND\"\n/* ServerError.EMAIL_NOT_FOUND */\n, \"user-not-found\"), _defineProperty(_SERVER_ERROR_MAP, \"RESET_PASSWORD_EXCEED_LIMIT\"\n/* ServerError.RESET_PASSWORD_EXCEED_LIMIT */\n, \"too-many-requests\"), _defineProperty(_SERVER_ERROR_MAP, \"EXPIRED_OOB_CODE\"\n/* ServerError.EXPIRED_OOB_CODE */\n, \"expired-action-code\"), _defineProperty(_SERVER_ERROR_MAP, \"INVALID_OOB_CODE\"\n/* ServerError.INVALID_OOB_CODE */\n, \"invalid-action-code\"), _defineProperty(_SERVER_ERROR_MAP, \"MISSING_OOB_CODE\"\n/* ServerError.MISSING_OOB_CODE */\n, \"internal-error\"), _defineProperty(_SERVER_ERROR_MAP, \"CREDENTIAL_TOO_OLD_LOGIN_AGAIN\"\n/* ServerError.CREDENTIAL_TOO_OLD_LOGIN_AGAIN */\n, \"requires-recent-login\"), _defineProperty(_SERVER_ERROR_MAP, \"INVALID_ID_TOKEN\"\n/* ServerError.INVALID_ID_TOKEN */\n, \"invalid-user-token\"), _defineProperty(_SERVER_ERROR_MAP, \"TOKEN_EXPIRED\"\n/* ServerError.TOKEN_EXPIRED */\n, \"user-token-expired\"), _defineProperty(_SERVER_ERROR_MAP, \"USER_NOT_FOUND\"\n/* ServerError.USER_NOT_FOUND */\n, \"user-token-expired\"), _defineProperty(_SERVER_ERROR_MAP, \"TOO_MANY_ATTEMPTS_TRY_LATER\"\n/* ServerError.TOO_MANY_ATTEMPTS_TRY_LATER */\n, \"too-many-requests\"), _defineProperty(_SERVER_ERROR_MAP, \"PASSWORD_DOES_NOT_MEET_REQUIREMENTS\"\n/* ServerError.PASSWORD_DOES_NOT_MEET_REQUIREMENTS */\n, \"password-does-not-meet-requirements\"), _defineProperty(_SERVER_ERROR_MAP, \"INVALID_CODE\"\n/* ServerError.INVALID_CODE */\n, \"invalid-verification-code\"), _defineProperty(_SERVER_ERROR_MAP, \"INVALID_SESSION_INFO\"\n/* ServerError.INVALID_SESSION_INFO */\n, \"invalid-verification-id\"), _defineProperty(_SERVER_ERROR_MAP, \"INVALID_TEMPORARY_PROOF\"\n/* ServerError.INVALID_TEMPORARY_PROOF */\n, \"invalid-credential\"), _defineProperty(_SERVER_ERROR_MAP, \"MISSING_SESSION_INFO\"\n/* ServerError.MISSING_SESSION_INFO */\n, \"missing-verification-id\"), _defineProperty(_SERVER_ERROR_MAP, \"SESSION_EXPIRED\"\n/* ServerError.SESSION_EXPIRED */\n, \"code-expired\"), _defineProperty(_SERVER_ERROR_MAP, \"MISSING_ANDROID_PACKAGE_NAME\"\n/* ServerError.MISSING_ANDROID_PACKAGE_NAME */\n, \"missing-android-pkg-name\"), _defineProperty(_SERVER_ERROR_MAP, \"UNAUTHORIZED_DOMAIN\"\n/* ServerError.UNAUTHORIZED_DOMAIN */\n, \"unauthorized-continue-uri\"), _defineProperty(_SERVER_ERROR_MAP, \"INVALID_OAUTH_CLIENT_ID\"\n/* ServerError.INVALID_OAUTH_CLIENT_ID */\n, \"invalid-oauth-client-id\"), _defineProperty(_SERVER_ERROR_MAP, \"ADMIN_ONLY_OPERATION\"\n/* ServerError.ADMIN_ONLY_OPERATION */\n, \"admin-restricted-operation\"), _defineProperty(_SERVER_ERROR_MAP, \"INVALID_MFA_PENDING_CREDENTIAL\"\n/* ServerError.INVALID_MFA_PENDING_CREDENTIAL */\n, \"invalid-multi-factor-session\"), _defineProperty(_SERVER_ERROR_MAP, \"MFA_ENROLLMENT_NOT_FOUND\"\n/* ServerError.MFA_ENROLLMENT_NOT_FOUND */\n, \"multi-factor-info-not-found\"), _defineProperty(_SERVER_ERROR_MAP, \"MISSING_MFA_ENROLLMENT_ID\"\n/* ServerError.MISSING_MFA_ENROLLMENT_ID */\n, \"missing-multi-factor-info\"), _defineProperty(_SERVER_ERROR_MAP, \"MISSING_MFA_PENDING_CREDENTIAL\"\n/* ServerError.MISSING_MFA_PENDING_CREDENTIAL */\n, \"missing-multi-factor-session\"), _defineProperty(_SERVER_ERROR_MAP, \"SECOND_FACTOR_EXISTS\"\n/* ServerError.SECOND_FACTOR_EXISTS */\n, \"second-factor-already-in-use\"), _defineProperty(_SERVER_ERROR_MAP, \"SECOND_FACTOR_LIMIT_EXCEEDED\"\n/* ServerError.SECOND_FACTOR_LIMIT_EXCEEDED */\n, \"maximum-second-factor-count-exceeded\"), _defineProperty(_SERVER_ERROR_MAP, \"BLOCKING_FUNCTION_ERROR_RESPONSE\"\n/* ServerError.BLOCKING_FUNCTION_ERROR_RESPONSE */\n, \"internal-error\"), _defineProperty(_SERVER_ERROR_MAP, \"RECAPTCHA_NOT_ENABLED\"\n/* ServerError.RECAPTCHA_NOT_ENABLED */\n, \"recaptcha-not-enabled\"), _defineProperty(_SERVER_ERROR_MAP, \"MISSING_RECAPTCHA_TOKEN\"\n/* ServerError.MISSING_RECAPTCHA_TOKEN */\n, \"missing-recaptcha-token\"), _defineProperty(_SERVER_ERROR_MAP, \"INVALID_RECAPTCHA_TOKEN\"\n/* ServerError.INVALID_RECAPTCHA_TOKEN */\n, \"invalid-recaptcha-token\"), _defineProperty(_SERVER_ERROR_MAP, \"INVALID_RECAPTCHA_ACTION\"\n/* ServerError.INVALID_RECAPTCHA_ACTION */\n, \"invalid-recaptcha-action\"), _defineProperty(_SERVER_ERROR_MAP, \"MISSING_CLIENT_TYPE\"\n/* ServerError.MISSING_CLIENT_TYPE */\n, \"missing-client-type\"), _defineProperty(_SERVER_ERROR_MAP, \"MISSING_RECAPTCHA_VERSION\"\n/* ServerError.MISSING_RECAPTCHA_VERSION */\n, \"missing-recaptcha-version\"), _defineProperty(_SERVER_ERROR_MAP, \"INVALID_RECAPTCHA_VERSION\"\n/* ServerError.INVALID_RECAPTCHA_VERSION */\n, \"invalid-recaptcha-version\"), _defineProperty(_SERVER_ERROR_MAP, \"INVALID_REQ_TYPE\"\n/* ServerError.INVALID_REQ_TYPE */\n, \"invalid-req-type\"), _SERVER_ERROR_MAP);\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 */\n\nvar DEFAULT_API_TIMEOUT_MS = new Delay(30000, 60000);\n\nfunction _addTidIfNecessary(auth, request) {\n if (auth.tenantId && !request.tenantId) {\n return Object.assign(Object.assign({}, request), {\n tenantId: auth.tenantId\n });\n }\n\n return request;\n}\n\nfunction _performApiRequest(_x, _x2, _x3, _x4) {\n return _performApiRequest2.apply(this, arguments);\n}\n\nfunction _performApiRequest2() {\n _performApiRequest2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee102(auth, method, path, request) {\n var customErrorMap,\n _args102 = arguments;\n return _regeneratorRuntime.wrap(function _callee102$(_context102) {\n while (1) {\n switch (_context102.prev = _context102.next) {\n case 0:\n customErrorMap = _args102.length > 4 && _args102[4] !== undefined ? _args102[4] : {};\n return _context102.abrupt(\"return\", _performFetchWithErrorHandling(auth, customErrorMap, /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee101() {\n var body, params, query, headers;\n return _regeneratorRuntime.wrap(function _callee101$(_context101) {\n while (1) {\n switch (_context101.prev = _context101.next) {\n case 0:\n body = {};\n params = {};\n\n if (request) {\n if (method === \"GET\"\n /* HttpMethod.GET */\n ) {\n params = request;\n } else {\n body = {\n body: JSON.stringify(request)\n };\n }\n }\n\n query = querystring(Object.assign({\n key: auth.config.apiKey\n }, params)).slice(1);\n _context101.next = 6;\n return auth._getAdditionalHeaders();\n\n case 6:\n headers = _context101.sent;\n headers[\"Content-Type\"\n /* HttpHeader.CONTENT_TYPE */\n ] = 'application/json';\n\n if (auth.languageCode) {\n headers[\"X-Firebase-Locale\"\n /* HttpHeader.X_FIREBASE_LOCALE */\n ] = auth.languageCode;\n }\n\n return _context101.abrupt(\"return\", FetchProvider.fetch()(_getFinalTarget(auth, auth.config.apiHost, path, query), Object.assign({\n method: method,\n headers: headers,\n referrerPolicy: 'no-referrer'\n }, body)));\n\n case 10:\n case \"end\":\n return _context101.stop();\n }\n }\n }, _callee101);\n }))));\n\n case 2:\n case \"end\":\n return _context102.stop();\n }\n }\n }, _callee102);\n }));\n return _performApiRequest2.apply(this, arguments);\n}\n\nfunction _performFetchWithErrorHandling(_x5, _x6, _x7) {\n return _performFetchWithErrorHandling2.apply(this, arguments);\n}\n\nfunction _performFetchWithErrorHandling2() {\n _performFetchWithErrorHandling2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee103(auth, customErrorMap, fetchFn) {\n var errorMap, networkTimeout, response, json, errorMessage, _errorMessage$split, _errorMessage$split2, serverErrorCode, serverErrorMessage, authError;\n\n return _regeneratorRuntime.wrap(function _callee103$(_context103) {\n while (1) {\n switch (_context103.prev = _context103.next) {\n case 0:\n auth._canInitEmulator = false;\n errorMap = Object.assign(Object.assign({}, SERVER_ERROR_MAP), customErrorMap);\n _context103.prev = 2;\n networkTimeout = new NetworkTimeout(auth);\n _context103.next = 6;\n return Promise.race([fetchFn(), networkTimeout.promise]);\n\n case 6:\n response = _context103.sent;\n // If we've reached this point, the fetch succeeded and the networkTimeout\n // didn't throw; clear the network timeout delay so that Node won't hang\n networkTimeout.clearNetworkTimeout();\n _context103.next = 10;\n return response.json();\n\n case 10:\n json = _context103.sent;\n\n if (!('needConfirmation' in json)) {\n _context103.next = 13;\n break;\n }\n\n throw _makeTaggedError(auth, \"account-exists-with-different-credential\"\n /* AuthErrorCode.NEED_CONFIRMATION */\n , json);\n\n case 13:\n if (!(response.ok && !('errorMessage' in json))) {\n _context103.next = 17;\n break;\n }\n\n return _context103.abrupt(\"return\", json);\n\n case 17:\n errorMessage = response.ok ? json.errorMessage : json.error.message;\n _errorMessage$split = errorMessage.split(' : '), _errorMessage$split2 = _slicedToArray(_errorMessage$split, 2), serverErrorCode = _errorMessage$split2[0], serverErrorMessage = _errorMessage$split2[1];\n\n if (!(serverErrorCode === \"FEDERATED_USER_ID_ALREADY_LINKED\"\n /* ServerError.FEDERATED_USER_ID_ALREADY_LINKED */\n )) {\n _context103.next = 23;\n break;\n }\n\n throw _makeTaggedError(auth, \"credential-already-in-use\"\n /* AuthErrorCode.CREDENTIAL_ALREADY_IN_USE */\n , json);\n\n case 23:\n if (!(serverErrorCode === \"EMAIL_EXISTS\"\n /* ServerError.EMAIL_EXISTS */\n )) {\n _context103.next = 27;\n break;\n }\n\n throw _makeTaggedError(auth, \"email-already-in-use\"\n /* AuthErrorCode.EMAIL_EXISTS */\n , json);\n\n case 27:\n if (!(serverErrorCode === \"USER_DISABLED\"\n /* ServerError.USER_DISABLED */\n )) {\n _context103.next = 29;\n break;\n }\n\n throw _makeTaggedError(auth, \"user-disabled\"\n /* AuthErrorCode.USER_DISABLED */\n , json);\n\n case 29:\n authError = errorMap[serverErrorCode] || serverErrorCode.toLowerCase().replace(/[_\\s]+/g, '-');\n\n if (!serverErrorMessage) {\n _context103.next = 34;\n break;\n }\n\n throw _errorWithCustomMessage(auth, authError, serverErrorMessage);\n\n case 34:\n _fail(auth, authError);\n\n case 35:\n _context103.next = 42;\n break;\n\n case 37:\n _context103.prev = 37;\n _context103.t0 = _context103[\"catch\"](2);\n\n if (!(_context103.t0 instanceof FirebaseError)) {\n _context103.next = 41;\n break;\n }\n\n throw _context103.t0;\n\n case 41:\n // Changing this to a different error code will log user out when there is a network error\n // because we treat any error other than NETWORK_REQUEST_FAILED as token is invalid.\n // https://github.com/firebase/firebase-js-sdk/blob/4fbc73610d70be4e0852e7de63a39cb7897e8546/packages/auth/src/core/auth/auth_impl.ts#L309-L316\n _fail(auth, \"network-request-failed\"\n /* AuthErrorCode.NETWORK_REQUEST_FAILED */\n , {\n 'message': String(_context103.t0)\n });\n\n case 42:\n case \"end\":\n return _context103.stop();\n }\n }\n }, _callee103, null, [[2, 37]]);\n }));\n return _performFetchWithErrorHandling2.apply(this, arguments);\n}\n\nfunction _performSignInRequest(_x8, _x9, _x10, _x11) {\n return _performSignInRequest2.apply(this, arguments);\n}\n\nfunction _performSignInRequest2() {\n _performSignInRequest2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee104(auth, method, path, request) {\n var customErrorMap,\n serverResponse,\n _args104 = arguments;\n return _regeneratorRuntime.wrap(function _callee104$(_context104) {\n while (1) {\n switch (_context104.prev = _context104.next) {\n case 0:\n customErrorMap = _args104.length > 4 && _args104[4] !== undefined ? _args104[4] : {};\n _context104.next = 3;\n return _performApiRequest(auth, method, path, request, customErrorMap);\n\n case 3:\n serverResponse = _context104.sent;\n\n if ('mfaPendingCredential' in serverResponse) {\n _fail(auth, \"multi-factor-auth-required\"\n /* AuthErrorCode.MFA_REQUIRED */\n , {\n _serverResponse: serverResponse\n });\n }\n\n return _context104.abrupt(\"return\", serverResponse);\n\n case 6:\n case \"end\":\n return _context104.stop();\n }\n }\n }, _callee104);\n }));\n return _performSignInRequest2.apply(this, arguments);\n}\n\nfunction _getFinalTarget(auth, host, path, query) {\n var base = \"\".concat(host).concat(path, \"?\").concat(query);\n\n if (!auth.config.emulator) {\n return \"\".concat(auth.config.apiScheme, \"://\").concat(base);\n }\n\n return _emulatorUrl(auth.config, base);\n}\n\nfunction _parseEnforcementState(enforcementStateStr) {\n switch (enforcementStateStr) {\n case 'ENFORCE':\n return \"ENFORCE\"\n /* EnforcementState.ENFORCE */\n ;\n\n case 'AUDIT':\n return \"AUDIT\"\n /* EnforcementState.AUDIT */\n ;\n\n case 'OFF':\n return \"OFF\"\n /* EnforcementState.OFF */\n ;\n\n default:\n return \"ENFORCEMENT_STATE_UNSPECIFIED\"\n /* EnforcementState.ENFORCEMENT_STATE_UNSPECIFIED */\n ;\n }\n}\n\nvar NetworkTimeout = /*#__PURE__*/function () {\n function NetworkTimeout(auth) {\n var _this = this;\n\n _classCallCheck(this, NetworkTimeout);\n\n this.auth = auth; // Node timers and browser timers are fundamentally incompatible, but we\n // don't care about the value here\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n\n this.timer = null;\n this.promise = new Promise(function (_, reject) {\n _this.timer = setTimeout(function () {\n return reject(_createError(_this.auth, \"network-request-failed\"\n /* AuthErrorCode.NETWORK_REQUEST_FAILED */\n ));\n }, DEFAULT_API_TIMEOUT_MS.get());\n });\n }\n\n _createClass(NetworkTimeout, [{\n key: \"clearNetworkTimeout\",\n value: function clearNetworkTimeout() {\n clearTimeout(this.timer);\n }\n }]);\n\n return NetworkTimeout;\n}();\n\nfunction _makeTaggedError(auth, code, response) {\n var errorParams = {\n appName: auth.name\n };\n\n if (response.email) {\n errorParams.email = response.email;\n }\n\n if (response.phoneNumber) {\n errorParams.phoneNumber = response.phoneNumber;\n }\n\n var error = _createError(auth, code, errorParams); // We know customData is defined on error because errorParams is defined\n\n\n error.customData._tokenResponse = response;\n return error;\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 */\n\n\nfunction isV2(grecaptcha) {\n return grecaptcha !== undefined && grecaptcha.getResponse !== undefined;\n}\n\nfunction isEnterprise(grecaptcha) {\n return grecaptcha !== undefined && grecaptcha.enterprise !== undefined;\n}\n\nvar RecaptchaConfig = /*#__PURE__*/function () {\n function RecaptchaConfig(response) {\n _classCallCheck(this, RecaptchaConfig);\n\n /**\r\n * The reCAPTCHA site key.\r\n */\n this.siteKey = '';\n /**\r\n * The list of providers and their enablement status for reCAPTCHA Enterprise.\r\n */\n\n this.recaptchaEnforcementState = [];\n\n if (response.recaptchaKey === undefined) {\n throw new Error('recaptchaKey undefined');\n } // Example response.recaptchaKey: \"projects/proj123/keys/sitekey123\"\n\n\n this.siteKey = response.recaptchaKey.split('/')[3];\n this.recaptchaEnforcementState = response.recaptchaEnforcementState;\n }\n /**\r\n * Returns the reCAPTCHA Enterprise enforcement state for the given provider.\r\n *\r\n * @param providerStr - The provider whose enforcement state is to be returned.\r\n * @returns The reCAPTCHA Enterprise enforcement state for the given provider.\r\n */\n\n\n _createClass(RecaptchaConfig, [{\n key: \"getProviderEnforcementState\",\n value: function getProviderEnforcementState(providerStr) {\n if (!this.recaptchaEnforcementState || this.recaptchaEnforcementState.length === 0) {\n return null;\n }\n\n var _iterator = _createForOfIteratorHelper(this.recaptchaEnforcementState),\n _step;\n\n try {\n for (_iterator.s(); !(_step = _iterator.n()).done;) {\n var recaptchaEnforcementState = _step.value;\n\n if (recaptchaEnforcementState.provider && recaptchaEnforcementState.provider === providerStr) {\n return _parseEnforcementState(recaptchaEnforcementState.enforcementState);\n }\n }\n } catch (err) {\n _iterator.e(err);\n } finally {\n _iterator.f();\n }\n\n return null;\n }\n /**\r\n * Returns true if the reCAPTCHA Enterprise enforcement state for the provider is set to ENFORCE or AUDIT.\r\n *\r\n * @param providerStr - The provider whose enablement state is to be returned.\r\n * @returns Whether or not reCAPTCHA Enterprise protection is enabled for the given provider.\r\n */\n\n }, {\n key: \"isProviderEnabled\",\n value: function isProviderEnabled(providerStr) {\n return this.getProviderEnforcementState(providerStr) === \"ENFORCE\"\n /* EnforcementState.ENFORCE */\n || this.getProviderEnforcementState(providerStr) === \"AUDIT\"\n /* EnforcementState.AUDIT */\n ;\n }\n }]);\n\n return RecaptchaConfig;\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 */\n\n\nfunction getRecaptchaParams(_x12) {\n return _getRecaptchaParams.apply(this, arguments);\n}\n\nfunction _getRecaptchaParams() {\n _getRecaptchaParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee105(auth) {\n return _regeneratorRuntime.wrap(function _callee105$(_context105) {\n while (1) {\n switch (_context105.prev = _context105.next) {\n case 0:\n _context105.next = 2;\n return _performApiRequest(auth, \"GET\"\n /* HttpMethod.GET */\n , \"/v1/recaptchaParams\"\n /* Endpoint.GET_RECAPTCHA_PARAM */\n );\n\n case 2:\n _context105.t0 = _context105.sent.recaptchaSiteKey;\n\n if (_context105.t0) {\n _context105.next = 5;\n break;\n }\n\n _context105.t0 = '';\n\n case 5:\n return _context105.abrupt(\"return\", _context105.t0);\n\n case 6:\n case \"end\":\n return _context105.stop();\n }\n }\n }, _callee105);\n }));\n return _getRecaptchaParams.apply(this, arguments);\n}\n\nfunction getRecaptchaConfig(_x13, _x14) {\n return _getRecaptchaConfig.apply(this, arguments);\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 */\n\n\nfunction _getRecaptchaConfig() {\n _getRecaptchaConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee106(auth, request) {\n return _regeneratorRuntime.wrap(function _callee106$(_context106) {\n while (1) {\n switch (_context106.prev = _context106.next) {\n case 0:\n return _context106.abrupt(\"return\", _performApiRequest(auth, \"GET\"\n /* HttpMethod.GET */\n , \"/v2/recaptchaConfig\"\n /* Endpoint.GET_RECAPTCHA_CONFIG */\n , _addTidIfNecessary(auth, request)));\n\n case 1:\n case \"end\":\n return _context106.stop();\n }\n }\n }, _callee106);\n }));\n return _getRecaptchaConfig.apply(this, arguments);\n}\n\nfunction deleteAccount(_x15, _x16) {\n return _deleteAccount.apply(this, arguments);\n}\n\nfunction _deleteAccount() {\n _deleteAccount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee107(auth, request) {\n return _regeneratorRuntime.wrap(function _callee107$(_context107) {\n while (1) {\n switch (_context107.prev = _context107.next) {\n case 0:\n return _context107.abrupt(\"return\", _performApiRequest(auth, \"POST\"\n /* HttpMethod.POST */\n , \"/v1/accounts:delete\"\n /* Endpoint.DELETE_ACCOUNT */\n , request));\n\n case 1:\n case \"end\":\n return _context107.stop();\n }\n }\n }, _callee107);\n }));\n return _deleteAccount.apply(this, arguments);\n}\n\nfunction deleteLinkedAccounts(_x17, _x18) {\n return _deleteLinkedAccounts.apply(this, arguments);\n}\n\nfunction _deleteLinkedAccounts() {\n _deleteLinkedAccounts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee108(auth, request) {\n return _regeneratorRuntime.wrap(function _callee108$(_context108) {\n while (1) {\n switch (_context108.prev = _context108.next) {\n case 0:\n return _context108.abrupt(\"return\", _performApiRequest(auth, \"POST\"\n /* HttpMethod.POST */\n , \"/v1/accounts:update\"\n /* Endpoint.SET_ACCOUNT_INFO */\n , request));\n\n case 1:\n case \"end\":\n return _context108.stop();\n }\n }\n }, _callee108);\n }));\n return _deleteLinkedAccounts.apply(this, arguments);\n}\n\nfunction getAccountInfo(_x19, _x20) {\n return _getAccountInfo.apply(this, arguments);\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 */\n\n\nfunction _getAccountInfo() {\n _getAccountInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee109(auth, request) {\n return _regeneratorRuntime.wrap(function _callee109$(_context109) {\n while (1) {\n switch (_context109.prev = _context109.next) {\n case 0:\n return _context109.abrupt(\"return\", _performApiRequest(auth, \"POST\"\n /* HttpMethod.POST */\n , \"/v1/accounts:lookup\"\n /* Endpoint.GET_ACCOUNT_INFO */\n , request));\n\n case 1:\n case \"end\":\n return _context109.stop();\n }\n }\n }, _callee109);\n }));\n return _getAccountInfo.apply(this, arguments);\n}\n\nfunction utcTimestampToDateString(utcTimestamp) {\n if (!utcTimestamp) {\n return undefined;\n }\n\n try {\n // Convert to date object.\n var date = new Date(Number(utcTimestamp)); // Test date is valid.\n\n if (!isNaN(date.getTime())) {\n // Convert to UTC date string.\n return date.toUTCString();\n }\n } catch (e) {// Do nothing. undefined will be returned.\n }\n\n return undefined;\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 */\n\n/**\r\n * Returns a JSON Web Token (JWT) used to identify the user to a Firebase service.\r\n *\r\n * @remarks\r\n * Returns the current token if it has not expired or if it will not expire in the next five\r\n * minutes. Otherwise, this will refresh the token and return a new one.\r\n *\r\n * @param user - The user.\r\n * @param forceRefresh - Force refresh regardless of token expiration.\r\n *\r\n * @public\r\n */\n\n\nfunction getIdToken(user) {\n var forceRefresh = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n return getModularInstance(user).getIdToken(forceRefresh);\n}\n/**\r\n * Returns a deserialized JSON Web Token (JWT) used to identify the user to a Firebase service.\r\n *\r\n * @remarks\r\n * Returns the current token if it has not expired or if it will not expire in the next five\r\n * minutes. Otherwise, this will refresh the token and return a new one.\r\n *\r\n * @param user - The user.\r\n * @param forceRefresh - Force refresh regardless of token expiration.\r\n *\r\n * @public\r\n */\n\n\nfunction _getIdTokenResult2(_x21) {\n return _getIdTokenResult.apply(this, arguments);\n}\n\nfunction _getIdTokenResult() {\n _getIdTokenResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee110(user) {\n var forceRefresh,\n userInternal,\n token,\n claims,\n firebase,\n signInProvider,\n _args110 = arguments;\n return _regeneratorRuntime.wrap(function _callee110$(_context110) {\n while (1) {\n switch (_context110.prev = _context110.next) {\n case 0:\n forceRefresh = _args110.length > 1 && _args110[1] !== undefined ? _args110[1] : false;\n userInternal = getModularInstance(user);\n _context110.next = 4;\n return userInternal.getIdToken(forceRefresh);\n\n case 4:\n token = _context110.sent;\n claims = _parseToken(token);\n\n _assert(claims && claims.exp && claims.auth_time && claims.iat, userInternal.auth, \"internal-error\"\n /* AuthErrorCode.INTERNAL_ERROR */\n );\n\n firebase = typeof claims.firebase === 'object' ? claims.firebase : undefined;\n signInProvider = firebase === null || firebase === void 0 ? void 0 : firebase['sign_in_provider'];\n return _context110.abrupt(\"return\", {\n claims: claims,\n token: token,\n authTime: utcTimestampToDateString(secondsStringToMilliseconds(claims.auth_time)),\n issuedAtTime: utcTimestampToDateString(secondsStringToMilliseconds(claims.iat)),\n expirationTime: utcTimestampToDateString(secondsStringToMilliseconds(claims.exp)),\n signInProvider: signInProvider || null,\n signInSecondFactor: (firebase === null || firebase === void 0 ? void 0 : firebase['sign_in_second_factor']) || null\n });\n\n case 10:\n case \"end\":\n return _context110.stop();\n }\n }\n }, _callee110);\n }));\n return _getIdTokenResult.apply(this, arguments);\n}\n\nfunction secondsStringToMilliseconds(seconds) {\n return Number(seconds) * 1000;\n}\n\nfunction _parseToken(token) {\n var _token$split = token.split('.'),\n _token$split2 = _slicedToArray(_token$split, 3),\n algorithm = _token$split2[0],\n payload = _token$split2[1],\n signature = _token$split2[2];\n\n if (algorithm === undefined || payload === undefined || signature === undefined) {\n _logError('JWT malformed, contained fewer than 3 sections');\n\n return null;\n }\n\n try {\n var decoded = base64Decode(payload);\n\n if (!decoded) {\n _logError('Failed to decode base64 JWT payload');\n\n return null;\n }\n\n return JSON.parse(decoded);\n } catch (e) {\n _logError('Caught error parsing JWT payload as JSON', e === null || e === void 0 ? void 0 : e.toString());\n\n return null;\n }\n}\n/**\r\n * Extract expiresIn TTL from a token by subtracting the expiration from the issuance.\r\n */\n\n\nfunction _tokenExpiresIn(token) {\n var parsedToken = _parseToken(token);\n\n _assert(parsedToken, \"internal-error\"\n /* AuthErrorCode.INTERNAL_ERROR */\n );\n\n _assert(typeof parsedToken.exp !== 'undefined', \"internal-error\"\n /* AuthErrorCode.INTERNAL_ERROR */\n );\n\n _assert(typeof parsedToken.iat !== 'undefined', \"internal-error\"\n /* AuthErrorCode.INTERNAL_ERROR */\n );\n\n return Number(parsedToken.exp) - Number(parsedToken.iat);\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 */\n\n\nfunction _logoutIfInvalidated(_x22, _x23) {\n return _logoutIfInvalidated2.apply(this, arguments);\n}\n\nfunction _logoutIfInvalidated2() {\n _logoutIfInvalidated2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee111(user, promise) {\n var bypassAuthState,\n _args111 = arguments;\n return _regeneratorRuntime.wrap(function _callee111$(_context111) {\n while (1) {\n switch (_context111.prev = _context111.next) {\n case 0:\n bypassAuthState = _args111.length > 2 && _args111[2] !== undefined ? _args111[2] : false;\n\n if (!bypassAuthState) {\n _context111.next = 3;\n break;\n }\n\n return _context111.abrupt(\"return\", promise);\n\n case 3:\n _context111.prev = 3;\n _context111.next = 6;\n return promise;\n\n case 6:\n return _context111.abrupt(\"return\", _context111.sent);\n\n case 9:\n _context111.prev = 9;\n _context111.t0 = _context111[\"catch\"](3);\n\n if (!(_context111.t0 instanceof FirebaseError && isUserInvalidated(_context111.t0))) {\n _context111.next = 15;\n break;\n }\n\n if (!(user.auth.currentUser === user)) {\n _context111.next = 15;\n break;\n }\n\n _context111.next = 15;\n return user.auth.signOut();\n\n case 15:\n throw _context111.t0;\n\n case 16:\n case \"end\":\n return _context111.stop();\n }\n }\n }, _callee111, null, [[3, 9]]);\n }));\n return _logoutIfInvalidated2.apply(this, arguments);\n}\n\nfunction isUserInvalidated(_ref3) {\n var code = _ref3.code;\n return code === \"auth/\".concat(\"user-disabled\"\n /* AuthErrorCode.USER_DISABLED */\n ) || code === \"auth/\".concat(\"user-token-expired\"\n /* AuthErrorCode.TOKEN_EXPIRED */\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 */\n\n\nvar ProactiveRefresh = /*#__PURE__*/function () {\n function ProactiveRefresh(user) {\n _classCallCheck(this, ProactiveRefresh);\n\n this.user = user;\n this.isRunning = false; // Node timers and browser timers return fundamentally different types.\n // We don't actually care what the value is but TS won't accept unknown and\n // we can't cast properly in both environments.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n\n this.timerId = null;\n this.errorBackoff = 30000\n /* Duration.RETRY_BACKOFF_MIN */\n ;\n }\n\n _createClass(ProactiveRefresh, [{\n key: \"_start\",\n value: function _start() {\n if (this.isRunning) {\n return;\n }\n\n this.isRunning = true;\n this.schedule();\n }\n }, {\n key: \"_stop\",\n value: function _stop() {\n if (!this.isRunning) {\n return;\n }\n\n this.isRunning = false;\n\n if (this.timerId !== null) {\n clearTimeout(this.timerId);\n }\n }\n }, {\n key: \"getInterval\",\n value: function getInterval(wasError) {\n var _a;\n\n if (wasError) {\n var interval = this.errorBackoff;\n this.errorBackoff = Math.min(this.errorBackoff * 2, 960000\n /* Duration.RETRY_BACKOFF_MAX */\n );\n return interval;\n } else {\n // Reset the error backoff\n this.errorBackoff = 30000\n /* Duration.RETRY_BACKOFF_MIN */\n ;\n var expTime = (_a = this.user.stsTokenManager.expirationTime) !== null && _a !== void 0 ? _a : 0;\n\n var _interval = expTime - Date.now() - 300000\n /* Duration.OFFSET */\n ;\n\n return Math.max(0, _interval);\n }\n }\n }, {\n key: \"schedule\",\n value: function schedule() {\n var _this2 = this;\n\n var wasError = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;\n\n if (!this.isRunning) {\n // Just in case...\n return;\n }\n\n var interval = this.getInterval(wasError);\n this.timerId = setTimeout( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {\n return _regeneratorRuntime.wrap(function _callee$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n _context.next = 2;\n return _this2.iteration();\n\n case 2:\n case \"end\":\n return _context.stop();\n }\n }\n }, _callee);\n })), interval);\n }\n }, {\n key: \"iteration\",\n value: function () {\n var _iteration = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {\n return _regeneratorRuntime.wrap(function _callee2$(_context2) {\n while (1) {\n switch (_context2.prev = _context2.next) {\n case 0:\n _context2.prev = 0;\n _context2.next = 3;\n return this.user.getIdToken(true);\n\n case 3:\n _context2.next = 9;\n break;\n\n case 5:\n _context2.prev = 5;\n _context2.t0 = _context2[\"catch\"](0);\n\n // Only retry on network errors\n if ((_context2.t0 === null || _context2.t0 === void 0 ? void 0 : _context2.t0.code) === \"auth/\".concat(\"network-request-failed\"\n /* AuthErrorCode.NETWORK_REQUEST_FAILED */\n )) {\n this.schedule(\n /* wasError */\n true);\n }\n\n return _context2.abrupt(\"return\");\n\n case 9:\n this.schedule();\n\n case 10:\n case \"end\":\n return _context2.stop();\n }\n }\n }, _callee2, this, [[0, 5]]);\n }));\n\n function iteration() {\n return _iteration.apply(this, arguments);\n }\n\n return iteration;\n }()\n }]);\n\n return ProactiveRefresh;\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 */\n\n\nvar UserMetadata = /*#__PURE__*/function () {\n function UserMetadata(createdAt, lastLoginAt) {\n _classCallCheck(this, UserMetadata);\n\n this.createdAt = createdAt;\n this.lastLoginAt = lastLoginAt;\n\n this._initializeTime();\n }\n\n _createClass(UserMetadata, [{\n key: \"_initializeTime\",\n value: function _initializeTime() {\n this.lastSignInTime = utcTimestampToDateString(this.lastLoginAt);\n this.creationTime = utcTimestampToDateString(this.createdAt);\n }\n }, {\n key: \"_copy\",\n value: function _copy(metadata) {\n this.createdAt = metadata.createdAt;\n this.lastLoginAt = metadata.lastLoginAt;\n\n this._initializeTime();\n }\n }, {\n key: \"toJSON\",\n value: function toJSON() {\n return {\n createdAt: this.createdAt,\n lastLoginAt: this.lastLoginAt\n };\n }\n }]);\n\n return UserMetadata;\n}();\n/**\r\n * @license\r\n * Copyright 2019 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 */\n\n\nfunction _reloadWithoutSaving(_x24) {\n return _reloadWithoutSaving2.apply(this, arguments);\n}\n/**\r\n * Reloads user account data, if signed in.\r\n *\r\n * @param user - The user.\r\n *\r\n * @public\r\n */\n\n\nfunction _reloadWithoutSaving2() {\n _reloadWithoutSaving2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee112(user) {\n var _a, auth, idToken, response, coreAccount, newProviderData, providerData, oldIsAnonymous, newIsAnonymous, isAnonymous, updates;\n\n return _regeneratorRuntime.wrap(function _callee112$(_context112) {\n while (1) {\n switch (_context112.prev = _context112.next) {\n case 0:\n auth = user.auth;\n _context112.next = 3;\n return user.getIdToken();\n\n case 3:\n idToken = _context112.sent;\n _context112.next = 6;\n return _logoutIfInvalidated(user, getAccountInfo(auth, {\n idToken: idToken\n }));\n\n case 6:\n response = _context112.sent;\n\n _assert(response === null || response === void 0 ? void 0 : response.users.length, auth, \"internal-error\"\n /* AuthErrorCode.INTERNAL_ERROR */\n );\n\n coreAccount = response.users[0];\n\n user._notifyReloadListener(coreAccount);\n\n newProviderData = ((_a = coreAccount.providerUserInfo) === null || _a === void 0 ? void 0 : _a.length) ? extractProviderData(coreAccount.providerUserInfo) : [];\n providerData = mergeProviderData(user.providerData, newProviderData); // Preserves the non-nonymous status of the stored user, even if no more\n // credentials (federated or email/password) are linked to the user. If\n // the user was previously anonymous, then use provider data to update.\n // On the other hand, if it was not anonymous before, it should never be\n // considered anonymous now.\n\n oldIsAnonymous = user.isAnonymous;\n newIsAnonymous = !(user.email && coreAccount.passwordHash) && !(providerData === null || providerData === void 0 ? void 0 : providerData.length);\n isAnonymous = !oldIsAnonymous ? false : newIsAnonymous;\n updates = {\n uid: coreAccount.localId,\n displayName: coreAccount.displayName || null,\n photoURL: coreAccount.photoUrl || null,\n email: coreAccount.email || null,\n emailVerified: coreAccount.emailVerified || false,\n phoneNumber: coreAccount.phoneNumber || null,\n tenantId: coreAccount.tenantId || null,\n providerData: providerData,\n metadata: new UserMetadata(coreAccount.createdAt, coreAccount.lastLoginAt),\n isAnonymous: isAnonymous\n };\n Object.assign(user, updates);\n\n case 17:\n case \"end\":\n return _context112.stop();\n }\n }\n }, _callee112);\n }));\n return _reloadWithoutSaving2.apply(this, arguments);\n}\n\nfunction _reload2(_x25) {\n return _reload.apply(this, arguments);\n}\n\nfunction _reload() {\n _reload = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee113(user) {\n var userInternal;\n return _regeneratorRuntime.wrap(function _callee113$(_context113) {\n while (1) {\n switch (_context113.prev = _context113.next) {\n case 0:\n userInternal = getModularInstance(user);\n _context113.next = 3;\n return _reloadWithoutSaving(userInternal);\n\n case 3:\n _context113.next = 5;\n return userInternal.auth._persistUserIfCurrent(userInternal);\n\n case 5:\n userInternal.auth._notifyListenersIfCurrent(userInternal);\n\n case 6:\n case \"end\":\n return _context113.stop();\n }\n }\n }, _callee113);\n }));\n return _reload.apply(this, arguments);\n}\n\nfunction mergeProviderData(original, newData) {\n var deduped = original.filter(function (o) {\n return !newData.some(function (n) {\n return n.providerId === o.providerId;\n });\n });\n return [].concat(_toConsumableArray(deduped), _toConsumableArray(newData));\n}\n\nfunction extractProviderData(providers) {\n return providers.map(function (_a) {\n var providerId = _a.providerId,\n provider = __rest(_a, [\"providerId\"]);\n\n return {\n providerId: providerId,\n uid: provider.rawId || '',\n displayName: provider.displayName || null,\n email: provider.email || null,\n phoneNumber: provider.phoneNumber || null,\n photoURL: provider.photoUrl || null\n };\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 */\n\n\nfunction requestStsToken(_x26, _x27) {\n return _requestStsToken.apply(this, arguments);\n}\n\nfunction _requestStsToken() {\n _requestStsToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee115(auth, refreshToken) {\n var response;\n return _regeneratorRuntime.wrap(function _callee115$(_context115) {\n while (1) {\n switch (_context115.prev = _context115.next) {\n case 0:\n _context115.next = 2;\n return _performFetchWithErrorHandling(auth, {}, /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee114() {\n var body, _auth$config, tokenApiHost, apiKey, url, headers;\n\n return _regeneratorRuntime.wrap(function _callee114$(_context114) {\n while (1) {\n switch (_context114.prev = _context114.next) {\n case 0:\n body = querystring({\n 'grant_type': 'refresh_token',\n 'refresh_token': refreshToken\n }).slice(1);\n _auth$config = auth.config, tokenApiHost = _auth$config.tokenApiHost, apiKey = _auth$config.apiKey;\n url = _getFinalTarget(auth, tokenApiHost, \"/v1/token\"\n /* Endpoint.TOKEN */\n , \"key=\".concat(apiKey));\n _context114.next = 5;\n return auth._getAdditionalHeaders();\n\n case 5:\n headers = _context114.sent;\n headers[\"Content-Type\"\n /* HttpHeader.CONTENT_TYPE */\n ] = 'application/x-www-form-urlencoded';\n return _context114.abrupt(\"return\", FetchProvider.fetch()(url, {\n method: \"POST\"\n /* HttpMethod.POST */\n ,\n headers: headers,\n body: body\n }));\n\n case 8:\n case \"end\":\n return _context114.stop();\n }\n }\n }, _callee114);\n })));\n\n case 2:\n response = _context115.sent;\n return _context115.abrupt(\"return\", {\n accessToken: response.access_token,\n expiresIn: response.expires_in,\n refreshToken: response.refresh_token\n });\n\n case 4:\n case \"end\":\n return _context115.stop();\n }\n }\n }, _callee115);\n }));\n return _requestStsToken.apply(this, arguments);\n}\n\nfunction revokeToken(_x28, _x29) {\n return _revokeToken.apply(this, arguments);\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 */\n\n/**\r\n * We need to mark this class as internal explicitly to exclude it in the public typings, because\r\n * it references AuthInternal which has a circular dependency with UserInternal.\r\n *\r\n * @internal\r\n */\n\n\nfunction _revokeToken() {\n _revokeToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee116(auth, request) {\n return _regeneratorRuntime.wrap(function _callee116$(_context116) {\n while (1) {\n switch (_context116.prev = _context116.next) {\n case 0:\n return _context116.abrupt(\"return\", _performApiRequest(auth, \"POST\"\n /* HttpMethod.POST */\n , \"/v2/accounts:revokeToken\"\n /* Endpoint.REVOKE_TOKEN */\n , _addTidIfNecessary(auth, request)));\n\n case 1:\n case \"end\":\n return _context116.stop();\n }\n }\n }, _callee116);\n }));\n return _revokeToken.apply(this, arguments);\n}\n\nvar StsTokenManager = /*#__PURE__*/function () {\n function StsTokenManager() {\n _classCallCheck(this, StsTokenManager);\n\n this.refreshToken = null;\n this.accessToken = null;\n this.expirationTime = null;\n }\n\n _createClass(StsTokenManager, [{\n key: \"isExpired\",\n get: function get() {\n return !this.expirationTime || Date.now() > this.expirationTime - 30000\n /* Buffer.TOKEN_REFRESH */\n ;\n }\n }, {\n key: \"updateFromServerResponse\",\n value: function updateFromServerResponse(response) {\n _assert(response.idToken, \"internal-error\"\n /* AuthErrorCode.INTERNAL_ERROR */\n );\n\n _assert(typeof response.idToken !== 'undefined', \"internal-error\"\n /* AuthErrorCode.INTERNAL_ERROR */\n );\n\n _assert(typeof response.refreshToken !== 'undefined', \"internal-error\"\n /* AuthErrorCode.INTERNAL_ERROR */\n );\n\n var expiresIn = 'expiresIn' in response && typeof response.expiresIn !== 'undefined' ? Number(response.expiresIn) : _tokenExpiresIn(response.idToken);\n this.updateTokensAndExpiration(response.idToken, response.refreshToken, expiresIn);\n }\n }, {\n key: \"getToken\",\n value: function () {\n var _getToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(auth) {\n var forceRefresh,\n _args3 = arguments;\n return _regeneratorRuntime.wrap(function _callee3$(_context3) {\n while (1) {\n switch (_context3.prev = _context3.next) {\n case 0:\n forceRefresh = _args3.length > 1 && _args3[1] !== undefined ? _args3[1] : false;\n\n _assert(!this.accessToken || this.refreshToken, auth, \"user-token-expired\"\n /* AuthErrorCode.TOKEN_EXPIRED */\n );\n\n if (!(!forceRefresh && this.accessToken && !this.isExpired)) {\n _context3.next = 4;\n break;\n }\n\n return _context3.abrupt(\"return\", this.accessToken);\n\n case 4:\n if (!this.refreshToken) {\n _context3.next = 8;\n break;\n }\n\n _context3.next = 7;\n return this.refresh(auth, this.refreshToken);\n\n case 7:\n return _context3.abrupt(\"return\", this.accessToken);\n\n case 8:\n return _context3.abrupt(\"return\", null);\n\n case 9:\n case \"end\":\n return _context3.stop();\n }\n }\n }, _callee3, this);\n }));\n\n function getToken(_x30) {\n return _getToken.apply(this, arguments);\n }\n\n return getToken;\n }()\n }, {\n key: \"clearRefreshToken\",\n value: function clearRefreshToken() {\n this.refreshToken = null;\n }\n }, {\n key: \"refresh\",\n value: function () {\n var _refresh = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(auth, oldToken) {\n var _yield$requestStsToke, accessToken, refreshToken, expiresIn;\n\n return _regeneratorRuntime.wrap(function _callee4$(_context4) {\n while (1) {\n switch (_context4.prev = _context4.next) {\n case 0:\n _context4.next = 2;\n return requestStsToken(auth, oldToken);\n\n case 2:\n _yield$requestStsToke = _context4.sent;\n accessToken = _yield$requestStsToke.accessToken;\n refreshToken = _yield$requestStsToke.refreshToken;\n expiresIn = _yield$requestStsToke.expiresIn;\n this.updateTokensAndExpiration(accessToken, refreshToken, Number(expiresIn));\n\n case 7:\n case \"end\":\n return _context4.stop();\n }\n }\n }, _callee4, this);\n }));\n\n function refresh(_x31, _x32) {\n return _refresh.apply(this, arguments);\n }\n\n return refresh;\n }()\n }, {\n key: \"updateTokensAndExpiration\",\n value: function updateTokensAndExpiration(accessToken, refreshToken, expiresInSec) {\n this.refreshToken = refreshToken || null;\n this.accessToken = accessToken || null;\n this.expirationTime = Date.now() + expiresInSec * 1000;\n }\n }, {\n key: \"toJSON\",\n value: function toJSON() {\n return {\n refreshToken: this.refreshToken,\n accessToken: this.accessToken,\n expirationTime: this.expirationTime\n };\n }\n }, {\n key: \"_assign\",\n value: function _assign(stsTokenManager) {\n this.accessToken = stsTokenManager.accessToken;\n this.refreshToken = stsTokenManager.refreshToken;\n this.expirationTime = stsTokenManager.expirationTime;\n }\n }, {\n key: \"_clone\",\n value: function _clone() {\n return Object.assign(new StsTokenManager(), this.toJSON());\n }\n }, {\n key: \"_performRefresh\",\n value: function _performRefresh() {\n return debugFail('not implemented');\n }\n }], [{\n key: \"fromJSON\",\n value: function fromJSON(appName, object) {\n var refreshToken = object.refreshToken,\n accessToken = object.accessToken,\n expirationTime = object.expirationTime;\n var manager = new StsTokenManager();\n\n if (refreshToken) {\n _assert(typeof refreshToken === 'string', \"internal-error\"\n /* AuthErrorCode.INTERNAL_ERROR */\n , {\n appName: appName\n });\n\n manager.refreshToken = refreshToken;\n }\n\n if (accessToken) {\n _assert(typeof accessToken === 'string', \"internal-error\"\n /* AuthErrorCode.INTERNAL_ERROR */\n , {\n appName: appName\n });\n\n manager.accessToken = accessToken;\n }\n\n if (expirationTime) {\n _assert(typeof expirationTime === 'number', \"internal-error\"\n /* AuthErrorCode.INTERNAL_ERROR */\n , {\n appName: appName\n });\n\n manager.expirationTime = expirationTime;\n }\n\n return manager;\n }\n }]);\n\n return StsTokenManager;\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 */\n\n\nfunction assertStringOrUndefined(assertion, appName) {\n _assert(typeof assertion === 'string' || typeof assertion === 'undefined', \"internal-error\"\n /* AuthErrorCode.INTERNAL_ERROR */\n , {\n appName: appName\n });\n}\n\nvar UserImpl = /*#__PURE__*/function () {\n function UserImpl(_a) {\n _classCallCheck(this, UserImpl);\n\n var uid = _a.uid,\n auth = _a.auth,\n stsTokenManager = _a.stsTokenManager,\n opt = __rest(_a, [\"uid\", \"auth\", \"stsTokenManager\"]); // For the user object, provider is always Firebase.\n\n\n this.providerId = \"firebase\"\n /* ProviderId.FIREBASE */\n ;\n this.proactiveRefresh = new ProactiveRefresh(this);\n this.reloadUserInfo = null;\n this.reloadListener = null;\n this.uid = uid;\n this.auth = auth;\n this.stsTokenManager = stsTokenManager;\n this.accessToken = stsTokenManager.accessToken;\n this.displayName = opt.displayName || null;\n this.email = opt.email || null;\n this.emailVerified = opt.emailVerified || false;\n this.phoneNumber = opt.phoneNumber || null;\n this.photoURL = opt.photoURL || null;\n this.isAnonymous = opt.isAnonymous || false;\n this.tenantId = opt.tenantId || null;\n this.providerData = opt.providerData ? _toConsumableArray(opt.providerData) : [];\n this.metadata = new UserMetadata(opt.createdAt || undefined, opt.lastLoginAt || undefined);\n }\n\n _createClass(UserImpl, [{\n key: \"getIdToken\",\n value: function () {\n var _getIdToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(forceRefresh) {\n var accessToken;\n return _regeneratorRuntime.wrap(function _callee5$(_context5) {\n while (1) {\n switch (_context5.prev = _context5.next) {\n case 0:\n _context5.next = 2;\n return _logoutIfInvalidated(this, this.stsTokenManager.getToken(this.auth, forceRefresh));\n\n case 2:\n accessToken = _context5.sent;\n\n _assert(accessToken, this.auth, \"internal-error\"\n /* AuthErrorCode.INTERNAL_ERROR */\n );\n\n if (!(this.accessToken !== accessToken)) {\n _context5.next = 9;\n break;\n }\n\n this.accessToken = accessToken;\n _context5.next = 8;\n return this.auth._persistUserIfCurrent(this);\n\n case 8:\n this.auth._notifyListenersIfCurrent(this);\n\n case 9:\n return _context5.abrupt(\"return\", accessToken);\n\n case 10:\n case \"end\":\n return _context5.stop();\n }\n }\n }, _callee5, this);\n }));\n\n function getIdToken(_x33) {\n return _getIdToken.apply(this, arguments);\n }\n\n return getIdToken;\n }()\n }, {\n key: \"getIdTokenResult\",\n value: function getIdTokenResult(forceRefresh) {\n return _getIdTokenResult2(this, forceRefresh);\n }\n }, {\n key: \"reload\",\n value: function reload() {\n return _reload2(this);\n }\n }, {\n key: \"_assign\",\n value: function _assign(user) {\n if (this === user) {\n return;\n }\n\n _assert(this.uid === user.uid, this.auth, \"internal-error\"\n /* AuthErrorCode.INTERNAL_ERROR */\n );\n\n this.displayName = user.displayName;\n this.photoURL = user.photoURL;\n this.email = user.email;\n this.emailVerified = user.emailVerified;\n this.phoneNumber = user.phoneNumber;\n this.isAnonymous = user.isAnonymous;\n this.tenantId = user.tenantId;\n this.providerData = user.providerData.map(function (userInfo) {\n return Object.assign({}, userInfo);\n });\n\n this.metadata._copy(user.metadata);\n\n this.stsTokenManager._assign(user.stsTokenManager);\n }\n }, {\n key: \"_clone\",\n value: function _clone(auth) {\n var newUser = new UserImpl(Object.assign(Object.assign({}, this), {\n auth: auth,\n stsTokenManager: this.stsTokenManager._clone()\n }));\n\n newUser.metadata._copy(this.metadata);\n\n return newUser;\n }\n }, {\n key: \"_onReload\",\n value: function _onReload(callback) {\n // There should only ever be one listener, and that is a single instance of MultiFactorUser\n _assert(!this.reloadListener, this.auth, \"internal-error\"\n /* AuthErrorCode.INTERNAL_ERROR */\n );\n\n this.reloadListener = callback;\n\n if (this.reloadUserInfo) {\n this._notifyReloadListener(this.reloadUserInfo);\n\n this.reloadUserInfo = null;\n }\n }\n }, {\n key: \"_notifyReloadListener\",\n value: function _notifyReloadListener(userInfo) {\n if (this.reloadListener) {\n this.reloadListener(userInfo);\n } else {\n // If no listener is subscribed yet, save the result so it's available when they do subscribe\n this.reloadUserInfo = userInfo;\n }\n }\n }, {\n key: \"_startProactiveRefresh\",\n value: function _startProactiveRefresh() {\n this.proactiveRefresh._start();\n }\n }, {\n key: \"_stopProactiveRefresh\",\n value: function _stopProactiveRefresh() {\n this.proactiveRefresh._stop();\n }\n }, {\n key: \"_updateTokensIfNecessary\",\n value: function () {\n var _updateTokensIfNecessary2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(response) {\n var reload,\n tokensRefreshed,\n _args6 = arguments;\n return _regeneratorRuntime.wrap(function _callee6$(_context6) {\n while (1) {\n switch (_context6.prev = _context6.next) {\n case 0:\n reload = _args6.length > 1 && _args6[1] !== undefined ? _args6[1] : false;\n tokensRefreshed = false;\n\n if (response.idToken && response.idToken !== this.stsTokenManager.accessToken) {\n this.stsTokenManager.updateFromServerResponse(response);\n tokensRefreshed = true;\n }\n\n if (!reload) {\n _context6.next = 6;\n break;\n }\n\n _context6.next = 6;\n return _reloadWithoutSaving(this);\n\n case 6:\n _context6.next = 8;\n return this.auth._persistUserIfCurrent(this);\n\n case 8:\n if (tokensRefreshed) {\n this.auth._notifyListenersIfCurrent(this);\n }\n\n case 9:\n case \"end\":\n return _context6.stop();\n }\n }\n }, _callee6, this);\n }));\n\n function _updateTokensIfNecessary(_x34) {\n return _updateTokensIfNecessary2.apply(this, arguments);\n }\n\n return _updateTokensIfNecessary;\n }()\n }, {\n key: \"delete\",\n value: function () {\n var _delete2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7() {\n var idToken;\n return _regeneratorRuntime.wrap(function _callee7$(_context7) {\n while (1) {\n switch (_context7.prev = _context7.next) {\n case 0:\n _context7.next = 2;\n return this.getIdToken();\n\n case 2:\n idToken = _context7.sent;\n _context7.next = 5;\n return _logoutIfInvalidated(this, deleteAccount(this.auth, {\n idToken: idToken\n }));\n\n case 5:\n this.stsTokenManager.clearRefreshToken(); // TODO: Determine if cancellable-promises are necessary to use in this class so that delete()\n // cancels pending actions...\n\n return _context7.abrupt(\"return\", this.auth.signOut());\n\n case 7:\n case \"end\":\n return _context7.stop();\n }\n }\n }, _callee7, this);\n }));\n\n function _delete() {\n return _delete2.apply(this, arguments);\n }\n\n return _delete;\n }()\n }, {\n key: \"toJSON\",\n value: function toJSON() {\n return Object.assign(Object.assign({\n uid: this.uid,\n email: this.email || undefined,\n emailVerified: this.emailVerified,\n displayName: this.displayName || undefined,\n isAnonymous: this.isAnonymous,\n photoURL: this.photoURL || undefined,\n phoneNumber: this.phoneNumber || undefined,\n tenantId: this.tenantId || undefined,\n providerData: this.providerData.map(function (userInfo) {\n return Object.assign({}, userInfo);\n }),\n stsTokenManager: this.stsTokenManager.toJSON(),\n // Redirect event ID must be maintained in case there is a pending\n // redirect event.\n _redirectEventId: this._redirectEventId\n }, this.metadata.toJSON()), {\n // Required for compatibility with the legacy SDK (go/firebase-auth-sdk-persistence-parsing):\n apiKey: this.auth.config.apiKey,\n appName: this.auth.name\n });\n }\n }, {\n key: \"refreshToken\",\n get: function get() {\n return this.stsTokenManager.refreshToken || '';\n }\n }], [{\n key: \"_fromJSON\",\n value: function _fromJSON(auth, object) {\n var _a, _b, _c, _d, _e, _f, _g, _h;\n\n var displayName = (_a = object.displayName) !== null && _a !== void 0 ? _a : undefined;\n var email = (_b = object.email) !== null && _b !== void 0 ? _b : undefined;\n var phoneNumber = (_c = object.phoneNumber) !== null && _c !== void 0 ? _c : undefined;\n var photoURL = (_d = object.photoURL) !== null && _d !== void 0 ? _d : undefined;\n var tenantId = (_e = object.tenantId) !== null && _e !== void 0 ? _e : undefined;\n\n var _redirectEventId = (_f = object._redirectEventId) !== null && _f !== void 0 ? _f : undefined;\n\n var createdAt = (_g = object.createdAt) !== null && _g !== void 0 ? _g : undefined;\n var lastLoginAt = (_h = object.lastLoginAt) !== null && _h !== void 0 ? _h : undefined;\n var uid = object.uid,\n emailVerified = object.emailVerified,\n isAnonymous = object.isAnonymous,\n providerData = object.providerData,\n plainObjectTokenManager = object.stsTokenManager;\n\n _assert(uid && plainObjectTokenManager, auth, \"internal-error\"\n /* AuthErrorCode.INTERNAL_ERROR */\n );\n\n var stsTokenManager = StsTokenManager.fromJSON(this.name, plainObjectTokenManager);\n\n _assert(typeof uid === 'string', auth, \"internal-error\"\n /* AuthErrorCode.INTERNAL_ERROR */\n );\n\n assertStringOrUndefined(displayName, auth.name);\n assertStringOrUndefined(email, auth.name);\n\n _assert(typeof emailVerified === 'boolean', auth, \"internal-error\"\n /* AuthErrorCode.INTERNAL_ERROR */\n );\n\n _assert(typeof isAnonymous === 'boolean', auth, \"internal-error\"\n /* AuthErrorCode.INTERNAL_ERROR */\n );\n\n assertStringOrUndefined(phoneNumber, auth.name);\n assertStringOrUndefined(photoURL, auth.name);\n assertStringOrUndefined(tenantId, auth.name);\n assertStringOrUndefined(_redirectEventId, auth.name);\n assertStringOrUndefined(createdAt, auth.name);\n assertStringOrUndefined(lastLoginAt, auth.name);\n var user = new UserImpl({\n uid: uid,\n auth: auth,\n email: email,\n emailVerified: emailVerified,\n displayName: displayName,\n isAnonymous: isAnonymous,\n photoURL: photoURL,\n phoneNumber: phoneNumber,\n tenantId: tenantId,\n stsTokenManager: stsTokenManager,\n createdAt: createdAt,\n lastLoginAt: lastLoginAt\n });\n\n if (providerData && Array.isArray(providerData)) {\n user.providerData = providerData.map(function (userInfo) {\n return Object.assign({}, userInfo);\n });\n }\n\n if (_redirectEventId) {\n user._redirectEventId = _redirectEventId;\n }\n\n return user;\n }\n /**\r\n * Initialize a User from an idToken server response\r\n * @param auth\r\n * @param idTokenResponse\r\n */\n\n }, {\n key: \"_fromIdTokenResponse\",\n value: function () {\n var _fromIdTokenResponse2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(auth, idTokenResponse) {\n var isAnonymous,\n stsTokenManager,\n user,\n _args8 = arguments;\n return _regeneratorRuntime.wrap(function _callee8$(_context8) {\n while (1) {\n switch (_context8.prev = _context8.next) {\n case 0:\n isAnonymous = _args8.length > 2 && _args8[2] !== undefined ? _args8[2] : false;\n stsTokenManager = new StsTokenManager();\n stsTokenManager.updateFromServerResponse(idTokenResponse); // Initialize the Firebase Auth user.\n\n user = new UserImpl({\n uid: idTokenResponse.localId,\n auth: auth,\n stsTokenManager: stsTokenManager,\n isAnonymous: isAnonymous\n }); // Updates the user info and data and resolves with a user instance.\n\n _context8.next = 6;\n return _reloadWithoutSaving(user);\n\n case 6:\n return _context8.abrupt(\"return\", user);\n\n case 7:\n case \"end\":\n return _context8.stop();\n }\n }\n }, _callee8);\n }));\n\n function _fromIdTokenResponse(_x35, _x36) {\n return _fromIdTokenResponse2.apply(this, arguments);\n }\n\n return _fromIdTokenResponse;\n }()\n }]);\n\n return UserImpl;\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 */\n\n\nvar instanceCache = new Map();\n\nfunction _getInstance(cls) {\n debugAssert(cls instanceof Function, 'Expected a class definition');\n var instance = instanceCache.get(cls);\n\n if (instance) {\n debugAssert(instance instanceof cls, 'Instance stored in cache mismatched with class');\n return instance;\n }\n\n instance = new cls();\n instanceCache.set(cls, instance);\n return instance;\n}\n/**\r\n * @license\r\n * Copyright 2019 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 */\n\n\nvar InMemoryPersistence = /*#__PURE__*/function () {\n function InMemoryPersistence() {\n _classCallCheck(this, InMemoryPersistence);\n\n this.type = \"NONE\"\n /* PersistenceType.NONE */\n ;\n this.storage = {};\n }\n\n _createClass(InMemoryPersistence, [{\n key: \"_isAvailable\",\n value: function () {\n var _isAvailable2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9() {\n return _regeneratorRuntime.wrap(function _callee9$(_context9) {\n while (1) {\n switch (_context9.prev = _context9.next) {\n case 0:\n return _context9.abrupt(\"return\", true);\n\n case 1:\n case \"end\":\n return _context9.stop();\n }\n }\n }, _callee9);\n }));\n\n function _isAvailable() {\n return _isAvailable2.apply(this, arguments);\n }\n\n return _isAvailable;\n }()\n }, {\n key: \"_set\",\n value: function () {\n var _set2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10(key, value) {\n return _regeneratorRuntime.wrap(function _callee10$(_context10) {\n while (1) {\n switch (_context10.prev = _context10.next) {\n case 0:\n this.storage[key] = value;\n\n case 1:\n case \"end\":\n return _context10.stop();\n }\n }\n }, _callee10, this);\n }));\n\n function _set(_x37, _x38) {\n return _set2.apply(this, arguments);\n }\n\n return _set;\n }()\n }, {\n key: \"_get\",\n value: function () {\n var _get2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11(key) {\n var value;\n return _regeneratorRuntime.wrap(function _callee11$(_context11) {\n while (1) {\n switch (_context11.prev = _context11.next) {\n case 0:\n value = this.storage[key];\n return _context11.abrupt(\"return\", value === undefined ? null : value);\n\n case 2:\n case \"end\":\n return _context11.stop();\n }\n }\n }, _callee11, this);\n }));\n\n function _get(_x39) {\n return _get2.apply(this, arguments);\n }\n\n return _get;\n }()\n }, {\n key: \"_remove\",\n value: function () {\n var _remove2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee12(key) {\n return _regeneratorRuntime.wrap(function _callee12$(_context12) {\n while (1) {\n switch (_context12.prev = _context12.next) {\n case 0:\n delete this.storage[key];\n\n case 1:\n case \"end\":\n return _context12.stop();\n }\n }\n }, _callee12, this);\n }));\n\n function _remove(_x40) {\n return _remove2.apply(this, arguments);\n }\n\n return _remove;\n }()\n }, {\n key: \"_addListener\",\n value: function _addListener(_key, _listener) {\n // Listeners are not supported for in-memory storage since it cannot be shared across windows/workers\n return;\n }\n }, {\n key: \"_removeListener\",\n value: function _removeListener(_key, _listener) {\n // Listeners are not supported for in-memory storage since it cannot be shared across windows/workers\n return;\n }\n }]);\n\n return InMemoryPersistence;\n}();\n\nInMemoryPersistence.type = 'NONE';\n/**\r\n * An implementation of {@link Persistence} of type 'NONE'.\r\n *\r\n * @public\r\n */\n\nvar inMemoryPersistence = InMemoryPersistence;\n/**\r\n * @license\r\n * Copyright 2019 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 */\n\nfunction _persistenceKeyName(key, apiKey, appName) {\n return \"firebase\"\n /* Namespace.PERSISTENCE */\n .concat(\":\", key, \":\").concat(apiKey, \":\").concat(appName);\n}\n\nvar PersistenceUserManager = /*#__PURE__*/function () {\n function PersistenceUserManager(persistence, auth, userKey) {\n _classCallCheck(this, PersistenceUserManager);\n\n this.persistence = persistence;\n this.auth = auth;\n this.userKey = userKey;\n var _this$auth = this.auth,\n config = _this$auth.config,\n name = _this$auth.name;\n this.fullUserKey = _persistenceKeyName(this.userKey, config.apiKey, name);\n this.fullPersistenceKey = _persistenceKeyName(\"persistence\"\n /* KeyName.PERSISTENCE_USER */\n , config.apiKey, name);\n this.boundEventHandler = auth._onStorageEvent.bind(auth);\n\n this.persistence._addListener(this.fullUserKey, this.boundEventHandler);\n }\n\n _createClass(PersistenceUserManager, [{\n key: \"setCurrentUser\",\n value: function setCurrentUser(user) {\n return this.persistence._set(this.fullUserKey, user.toJSON());\n }\n }, {\n key: \"getCurrentUser\",\n value: function () {\n var _getCurrentUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee13() {\n var blob;\n return _regeneratorRuntime.wrap(function _callee13$(_context13) {\n while (1) {\n switch (_context13.prev = _context13.next) {\n case 0:\n _context13.next = 2;\n return this.persistence._get(this.fullUserKey);\n\n case 2:\n blob = _context13.sent;\n return _context13.abrupt(\"return\", blob ? UserImpl._fromJSON(this.auth, blob) : null);\n\n case 4:\n case \"end\":\n return _context13.stop();\n }\n }\n }, _callee13, this);\n }));\n\n function getCurrentUser() {\n return _getCurrentUser.apply(this, arguments);\n }\n\n return getCurrentUser;\n }()\n }, {\n key: \"removeCurrentUser\",\n value: function removeCurrentUser() {\n return this.persistence._remove(this.fullUserKey);\n }\n }, {\n key: \"savePersistenceForRedirect\",\n value: function savePersistenceForRedirect() {\n return this.persistence._set(this.fullPersistenceKey, this.persistence.type);\n }\n }, {\n key: \"setPersistence\",\n value: function () {\n var _setPersistence = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee14(newPersistence) {\n var currentUser;\n return _regeneratorRuntime.wrap(function _callee14$(_context14) {\n while (1) {\n switch (_context14.prev = _context14.next) {\n case 0:\n if (!(this.persistence === newPersistence)) {\n _context14.next = 2;\n break;\n }\n\n return _context14.abrupt(\"return\");\n\n case 2:\n _context14.next = 4;\n return this.getCurrentUser();\n\n case 4:\n currentUser = _context14.sent;\n _context14.next = 7;\n return this.removeCurrentUser();\n\n case 7:\n this.persistence = newPersistence;\n\n if (!currentUser) {\n _context14.next = 10;\n break;\n }\n\n return _context14.abrupt(\"return\", this.setCurrentUser(currentUser));\n\n case 10:\n case \"end\":\n return _context14.stop();\n }\n }\n }, _callee14, this);\n }));\n\n function setPersistence(_x41) {\n return _setPersistence.apply(this, arguments);\n }\n\n return setPersistence;\n }()\n }, {\n key: \"delete\",\n value: function _delete() {\n this.persistence._removeListener(this.fullUserKey, this.boundEventHandler);\n }\n }], [{\n key: \"create\",\n value: function () {\n var _create = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee17(auth, persistenceHierarchy) {\n var userKey,\n availablePersistences,\n selectedPersistence,\n key,\n userToMigrate,\n _iterator2,\n _step2,\n persistence,\n blob,\n user,\n migrationHierarchy,\n _args17 = arguments;\n\n return _regeneratorRuntime.wrap(function _callee17$(_context17) {\n while (1) {\n switch (_context17.prev = _context17.next) {\n case 0:\n userKey = _args17.length > 2 && _args17[2] !== undefined ? _args17[2] : \"authUser\";\n\n if (persistenceHierarchy.length) {\n _context17.next = 3;\n break;\n }\n\n return _context17.abrupt(\"return\", new PersistenceUserManager(_getInstance(inMemoryPersistence), auth, userKey));\n\n case 3:\n _context17.next = 5;\n return Promise.all(persistenceHierarchy.map( /*#__PURE__*/function () {\n var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee15(persistence) {\n return _regeneratorRuntime.wrap(function _callee15$(_context15) {\n while (1) {\n switch (_context15.prev = _context15.next) {\n case 0:\n _context15.next = 2;\n return persistence._isAvailable();\n\n case 2:\n if (!_context15.sent) {\n _context15.next = 4;\n break;\n }\n\n return _context15.abrupt(\"return\", persistence);\n\n case 4:\n return _context15.abrupt(\"return\", undefined);\n\n case 5:\n case \"end\":\n return _context15.stop();\n }\n }\n }, _callee15);\n }));\n\n return function (_x44) {\n return _ref5.apply(this, arguments);\n };\n }()));\n\n case 5:\n availablePersistences = _context17.sent.filter(function (persistence) {\n return persistence;\n });\n // Fall back to the first persistence listed, or in memory if none available\n selectedPersistence = availablePersistences[0] || _getInstance(inMemoryPersistence);\n key = _persistenceKeyName(userKey, auth.config.apiKey, auth.name); // Pull out the existing user, setting the chosen persistence to that\n // persistence if the user exists.\n\n userToMigrate = null; // Note, here we check for a user in _all_ persistences, not just the\n // ones deemed available. If we can migrate a user out of a broken\n // persistence, we will (but only if that persistence supports migration).\n\n _iterator2 = _createForOfIteratorHelper(persistenceHierarchy);\n _context17.prev = 10;\n\n _iterator2.s();\n\n case 12:\n if ((_step2 = _iterator2.n()).done) {\n _context17.next = 29;\n break;\n }\n\n persistence = _step2.value;\n _context17.prev = 14;\n _context17.next = 17;\n return persistence._get(key);\n\n case 17:\n blob = _context17.sent;\n\n if (!blob) {\n _context17.next = 23;\n break;\n }\n\n user = UserImpl._fromJSON(auth, blob); // throws for unparsable blob (wrong format)\n\n if (persistence !== selectedPersistence) {\n userToMigrate = user;\n }\n\n selectedPersistence = persistence;\n return _context17.abrupt(\"break\", 29);\n\n case 23:\n _context17.next = 27;\n break;\n\n case 25:\n _context17.prev = 25;\n _context17.t0 = _context17[\"catch\"](14);\n\n case 27:\n _context17.next = 12;\n break;\n\n case 29:\n _context17.next = 34;\n break;\n\n case 31:\n _context17.prev = 31;\n _context17.t1 = _context17[\"catch\"](10);\n\n _iterator2.e(_context17.t1);\n\n case 34:\n _context17.prev = 34;\n\n _iterator2.f();\n\n return _context17.finish(34);\n\n case 37:\n // If we find the user in a persistence that does support migration, use\n // that migration path (of only persistences that support migration)\n migrationHierarchy = availablePersistences.filter(function (p) {\n return p._shouldAllowMigration;\n }); // If the persistence does _not_ allow migration, just finish off here\n\n if (!(!selectedPersistence._shouldAllowMigration || !migrationHierarchy.length)) {\n _context17.next = 40;\n break;\n }\n\n return _context17.abrupt(\"return\", new PersistenceUserManager(selectedPersistence, auth, userKey));\n\n case 40:\n selectedPersistence = migrationHierarchy[0];\n\n if (!userToMigrate) {\n _context17.next = 44;\n break;\n }\n\n _context17.next = 44;\n return selectedPersistence._set(key, userToMigrate.toJSON());\n\n case 44:\n _context17.next = 46;\n return Promise.all(persistenceHierarchy.map( /*#__PURE__*/function () {\n var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee16(persistence) {\n return _regeneratorRuntime.wrap(function _callee16$(_context16) {\n while (1) {\n switch (_context16.prev = _context16.next) {\n case 0:\n if (!(persistence !== selectedPersistence)) {\n _context16.next = 8;\n break;\n }\n\n _context16.prev = 1;\n _context16.next = 4;\n return persistence._remove(key);\n\n case 4:\n _context16.next = 8;\n break;\n\n case 6:\n _context16.prev = 6;\n _context16.t0 = _context16[\"catch\"](1);\n\n case 8:\n case \"end\":\n return _context16.stop();\n }\n }\n }, _callee16, null, [[1, 6]]);\n }));\n\n return function (_x45) {\n return _ref6.apply(this, arguments);\n };\n }()));\n\n case 46:\n return _context17.abrupt(\"return\", new PersistenceUserManager(selectedPersistence, auth, userKey));\n\n case 47:\n case \"end\":\n return _context17.stop();\n }\n }\n }, _callee17, null, [[10, 31, 34, 37], [14, 25]]);\n }));\n\n function create(_x42, _x43) {\n return _create.apply(this, arguments);\n }\n\n return create;\n }()\n }]);\n\n return PersistenceUserManager;\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 */\n\n/**\r\n * Determine the browser for the purposes of reporting usage to the API\r\n */\n\n\nfunction _getBrowserName(userAgent) {\n var ua = userAgent.toLowerCase();\n\n if (ua.includes('opera/') || ua.includes('opr/') || ua.includes('opios/')) {\n return \"Opera\"\n /* BrowserName.OPERA */\n ;\n } else if (_isIEMobile(ua)) {\n // Windows phone IEMobile browser.\n return \"IEMobile\"\n /* BrowserName.IEMOBILE */\n ;\n } else if (ua.includes('msie') || ua.includes('trident/')) {\n return \"IE\"\n /* BrowserName.IE */\n ;\n } else if (ua.includes('edge/')) {\n return \"Edge\"\n /* BrowserName.EDGE */\n ;\n } else if (_isFirefox(ua)) {\n return \"Firefox\"\n /* BrowserName.FIREFOX */\n ;\n } else if (ua.includes('silk/')) {\n return \"Silk\"\n /* BrowserName.SILK */\n ;\n } else if (_isBlackBerry(ua)) {\n // Blackberry browser.\n return \"Blackberry\"\n /* BrowserName.BLACKBERRY */\n ;\n } else if (_isWebOS(ua)) {\n // WebOS default browser.\n return \"Webos\"\n /* BrowserName.WEBOS */\n ;\n } else if (_isSafari(ua)) {\n return \"Safari\"\n /* BrowserName.SAFARI */\n ;\n } else if ((ua.includes('chrome/') || _isChromeIOS(ua)) && !ua.includes('edge/')) {\n return \"Chrome\"\n /* BrowserName.CHROME */\n ;\n } else if (_isAndroid(ua)) {\n // Android stock browser.\n return \"Android\"\n /* BrowserName.ANDROID */\n ;\n } else {\n // Most modern browsers have name/version at end of user agent string.\n var re = /([a-zA-Z\\d\\.]+)\\/[a-zA-Z\\d\\.]*$/;\n var matches = userAgent.match(re);\n\n if ((matches === null || matches === void 0 ? void 0 : matches.length) === 2) {\n return matches[1];\n }\n }\n\n return \"Other\"\n /* BrowserName.OTHER */\n ;\n}\n\nfunction _isFirefox() {\n var ua = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getUA();\n return /firefox\\//i.test(ua);\n}\n\nfunction _isSafari() {\n var userAgent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getUA();\n var ua = userAgent.toLowerCase();\n return ua.includes('safari/') && !ua.includes('chrome/') && !ua.includes('crios/') && !ua.includes('android');\n}\n\nfunction _isChromeIOS() {\n var ua = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getUA();\n return /crios\\//i.test(ua);\n}\n\nfunction _isIEMobile() {\n var ua = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getUA();\n return /iemobile/i.test(ua);\n}\n\nfunction _isAndroid() {\n var ua = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getUA();\n return /android/i.test(ua);\n}\n\nfunction _isBlackBerry() {\n var ua = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getUA();\n return /blackberry/i.test(ua);\n}\n\nfunction _isWebOS() {\n var ua = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getUA();\n return /webos/i.test(ua);\n}\n\nfunction _isIOS() {\n var ua = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getUA();\n return /iphone|ipad|ipod/i.test(ua) || /macintosh/i.test(ua) && /mobile/i.test(ua);\n}\n\nfunction _isIOS7Or8() {\n var ua = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getUA();\n return /(iPad|iPhone|iPod).*OS 7_\\d/i.test(ua) || /(iPad|iPhone|iPod).*OS 8_\\d/i.test(ua);\n}\n\nfunction _isIOSStandalone() {\n var ua = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getUA();\n\n var _a;\n\n return _isIOS(ua) && !!((_a = window.navigator) === null || _a === void 0 ? void 0 : _a.standalone);\n}\n\nfunction _isIE10() {\n return isIE() && document.documentMode === 10;\n}\n\nfunction _isMobileBrowser() {\n var ua = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getUA();\n // TODO: implement getBrowserName equivalent for OS.\n return _isIOS(ua) || _isAndroid(ua) || _isWebOS(ua) || _isBlackBerry(ua) || /windows phone/i.test(ua) || _isIEMobile(ua);\n}\n\nfunction _isIframe() {\n try {\n // Check that the current window is not the top window.\n // If so, return true.\n return !!(window && window !== window.top);\n } catch (e) {\n return false;\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 */\n\n/*\r\n * Determine the SDK version string\r\n */\n\n\nfunction _getClientVersion(clientPlatform) {\n var frameworks = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];\n var reportedPlatform;\n\n switch (clientPlatform) {\n case \"Browser\"\n /* ClientPlatform.BROWSER */\n :\n // In a browser environment, report the browser name.\n reportedPlatform = _getBrowserName(getUA());\n break;\n\n case \"Worker\"\n /* ClientPlatform.WORKER */\n :\n // Technically a worker runs from a browser but we need to differentiate a\n // worker from a browser.\n // For example: Chrome-Worker/JsCore/4.9.1/FirebaseCore-web.\n reportedPlatform = \"\".concat(_getBrowserName(getUA()), \"-\").concat(clientPlatform);\n break;\n\n default:\n reportedPlatform = clientPlatform;\n }\n\n var reportedFrameworks = frameworks.length ? frameworks.join(',') : 'FirebaseCore-web';\n /* default value if no other framework is used */\n\n return \"\".concat(reportedPlatform, \"/\", \"JsCore\"\n /* ClientImplementation.CORE */\n , \"/\").concat(SDK_VERSION, \"/\").concat(reportedFrameworks);\n}\n/**\r\n * @license\r\n * Copyright 2022 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 */\n\n\nvar AuthMiddlewareQueue = /*#__PURE__*/function () {\n function AuthMiddlewareQueue(auth) {\n _classCallCheck(this, AuthMiddlewareQueue);\n\n this.auth = auth;\n this.queue = [];\n }\n\n _createClass(AuthMiddlewareQueue, [{\n key: \"pushCallback\",\n value: function pushCallback(callback, onAbort) {\n var _this3 = this;\n\n // The callback could be sync or async. Wrap it into a\n // function that is always async.\n var wrappedCallback = function wrappedCallback(user) {\n return new Promise(function (resolve, reject) {\n try {\n var result = callback(user); // Either resolve with existing promise or wrap a non-promise\n // return value into a promise.\n\n resolve(result);\n } catch (e) {\n // Sync callback throws.\n reject(e);\n }\n });\n }; // Attach the onAbort if present\n\n\n wrappedCallback.onAbort = onAbort;\n this.queue.push(wrappedCallback);\n var index = this.queue.length - 1;\n return function () {\n // Unsubscribe. Replace with no-op. Do not remove from array, or it will disturb\n // indexing of other elements.\n _this3.queue[index] = function () {\n return Promise.resolve();\n };\n };\n }\n }, {\n key: \"runMiddleware\",\n value: function () {\n var _runMiddleware = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee18(nextUser) {\n var onAbortStack, _iterator3, _step3, beforeStateCallback, _iterator4, _step4, onAbort;\n\n return _regeneratorRuntime.wrap(function _callee18$(_context18) {\n while (1) {\n switch (_context18.prev = _context18.next) {\n case 0:\n if (!(this.auth.currentUser === nextUser)) {\n _context18.next = 2;\n break;\n }\n\n return _context18.abrupt(\"return\");\n\n case 2:\n // While running the middleware, build a temporary stack of onAbort\n // callbacks to call if one middleware callback rejects.\n onAbortStack = [];\n _context18.prev = 3;\n _iterator3 = _createForOfIteratorHelper(this.queue);\n _context18.prev = 5;\n\n _iterator3.s();\n\n case 7:\n if ((_step3 = _iterator3.n()).done) {\n _context18.next = 14;\n break;\n }\n\n beforeStateCallback = _step3.value;\n _context18.next = 11;\n return beforeStateCallback(nextUser);\n\n case 11:\n // Only push the onAbort if the callback succeeds\n if (beforeStateCallback.onAbort) {\n onAbortStack.push(beforeStateCallback.onAbort);\n }\n\n case 12:\n _context18.next = 7;\n break;\n\n case 14:\n _context18.next = 19;\n break;\n\n case 16:\n _context18.prev = 16;\n _context18.t0 = _context18[\"catch\"](5);\n\n _iterator3.e(_context18.t0);\n\n case 19:\n _context18.prev = 19;\n\n _iterator3.f();\n\n return _context18.finish(19);\n\n case 22:\n _context18.next = 30;\n break;\n\n case 24:\n _context18.prev = 24;\n _context18.t1 = _context18[\"catch\"](3);\n // Run all onAbort, with separate try/catch to ignore any errors and\n // continue\n onAbortStack.reverse();\n _iterator4 = _createForOfIteratorHelper(onAbortStack);\n\n try {\n for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {\n onAbort = _step4.value;\n\n try {\n onAbort();\n } catch (_) {\n /* swallow error */\n }\n }\n } catch (err) {\n _iterator4.e(err);\n } finally {\n _iterator4.f();\n }\n\n throw this.auth._errorFactory.create(\"login-blocked\"\n /* AuthErrorCode.LOGIN_BLOCKED */\n , {\n originalMessage: _context18.t1 === null || _context18.t1 === void 0 ? void 0 : _context18.t1.message\n });\n\n case 30:\n case \"end\":\n return _context18.stop();\n }\n }\n }, _callee18, this, [[3, 24], [5, 16, 19, 22]]);\n }));\n\n function runMiddleware(_x46) {\n return _runMiddleware.apply(this, arguments);\n }\n\n return runMiddleware;\n }()\n }]);\n\n return AuthMiddlewareQueue;\n}();\n/**\r\n * @license\r\n * Copyright 2023 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 */\n\n/**\r\n * Fetches the password policy for the currently set tenant or the project if no tenant is set.\r\n *\r\n * @param auth Auth object.\r\n * @param request Password policy request.\r\n * @returns Password policy response.\r\n */\n\n\nfunction _getPasswordPolicy(_x47) {\n return _getPasswordPolicy2.apply(this, arguments);\n}\n/**\r\n * @license\r\n * Copyright 2023 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 */\n// Minimum min password length enforced by the backend, even if no minimum length is set.\n\n\nfunction _getPasswordPolicy2() {\n _getPasswordPolicy2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee117(auth) {\n var request,\n _args117 = arguments;\n return _regeneratorRuntime.wrap(function _callee117$(_context117) {\n while (1) {\n switch (_context117.prev = _context117.next) {\n case 0:\n request = _args117.length > 1 && _args117[1] !== undefined ? _args117[1] : {};\n return _context117.abrupt(\"return\", _performApiRequest(auth, \"GET\"\n /* HttpMethod.GET */\n , \"/v2/passwordPolicy\"\n /* Endpoint.GET_PASSWORD_POLICY */\n , _addTidIfNecessary(auth, request)));\n\n case 2:\n case \"end\":\n return _context117.stop();\n }\n }\n }, _callee117);\n }));\n return _getPasswordPolicy2.apply(this, arguments);\n}\n\nvar MINIMUM_MIN_PASSWORD_LENGTH = 6;\n/**\r\n * Stores password policy requirements and provides password validation against the policy.\r\n *\r\n * @internal\r\n */\n\nvar PasswordPolicyImpl = /*#__PURE__*/function () {\n function PasswordPolicyImpl(response) {\n _classCallCheck(this, PasswordPolicyImpl);\n\n var _a, _b, _c, _d; // Only include custom strength options defined in the response.\n\n\n var responseOptions = response.customStrengthOptions;\n this.customStrengthOptions = {}; // TODO: Remove once the backend is updated to include the minimum min password length instead of undefined when there is no minimum length set.\n\n this.customStrengthOptions.minPasswordLength = (_a = responseOptions.minPasswordLength) !== null && _a !== void 0 ? _a : MINIMUM_MIN_PASSWORD_LENGTH;\n\n if (responseOptions.maxPasswordLength) {\n this.customStrengthOptions.maxPasswordLength = responseOptions.maxPasswordLength;\n }\n\n if (responseOptions.containsLowercaseCharacter !== undefined) {\n this.customStrengthOptions.containsLowercaseLetter = responseOptions.containsLowercaseCharacter;\n }\n\n if (responseOptions.containsUppercaseCharacter !== undefined) {\n this.customStrengthOptions.containsUppercaseLetter = responseOptions.containsUppercaseCharacter;\n }\n\n if (responseOptions.containsNumericCharacter !== undefined) {\n this.customStrengthOptions.containsNumericCharacter = responseOptions.containsNumericCharacter;\n }\n\n if (responseOptions.containsNonAlphanumericCharacter !== undefined) {\n this.customStrengthOptions.containsNonAlphanumericCharacter = responseOptions.containsNonAlphanumericCharacter;\n }\n\n this.enforcementState = response.enforcementState;\n\n if (this.enforcementState === 'ENFORCEMENT_STATE_UNSPECIFIED') {\n this.enforcementState = 'OFF';\n } // Use an empty string if no non-alphanumeric characters are specified in the response.\n\n\n this.allowedNonAlphanumericCharacters = (_c = (_b = response.allowedNonAlphanumericCharacters) === null || _b === void 0 ? void 0 : _b.join('')) !== null && _c !== void 0 ? _c : '';\n this.forceUpgradeOnSignin = (_d = response.forceUpgradeOnSignin) !== null && _d !== void 0 ? _d : false;\n this.schemaVersion = response.schemaVersion;\n }\n\n _createClass(PasswordPolicyImpl, [{\n key: \"validatePassword\",\n value: function validatePassword(password) {\n var _a, _b, _c, _d, _e, _f;\n\n var status = {\n isValid: true,\n passwordPolicy: this\n }; // Check the password length and character options.\n\n this.validatePasswordLengthOptions(password, status);\n this.validatePasswordCharacterOptions(password, status); // Combine the status into single isValid property.\n\n status.isValid && (status.isValid = (_a = status.meetsMinPasswordLength) !== null && _a !== void 0 ? _a : true);\n status.isValid && (status.isValid = (_b = status.meetsMaxPasswordLength) !== null && _b !== void 0 ? _b : true);\n status.isValid && (status.isValid = (_c = status.containsLowercaseLetter) !== null && _c !== void 0 ? _c : true);\n status.isValid && (status.isValid = (_d = status.containsUppercaseLetter) !== null && _d !== void 0 ? _d : true);\n status.isValid && (status.isValid = (_e = status.containsNumericCharacter) !== null && _e !== void 0 ? _e : true);\n status.isValid && (status.isValid = (_f = status.containsNonAlphanumericCharacter) !== null && _f !== void 0 ? _f : true);\n return status;\n }\n /**\r\n * Validates that the password meets the length options for the policy.\r\n *\r\n * @param password Password to validate.\r\n * @param status Validation status.\r\n */\n\n }, {\n key: \"validatePasswordLengthOptions\",\n value: function validatePasswordLengthOptions(password, status) {\n var minPasswordLength = this.customStrengthOptions.minPasswordLength;\n var maxPasswordLength = this.customStrengthOptions.maxPasswordLength;\n\n if (minPasswordLength) {\n status.meetsMinPasswordLength = password.length >= minPasswordLength;\n }\n\n if (maxPasswordLength) {\n status.meetsMaxPasswordLength = password.length <= maxPasswordLength;\n }\n }\n /**\r\n * Validates that the password meets the character options for the policy.\r\n *\r\n * @param password Password to validate.\r\n * @param status Validation status.\r\n */\n\n }, {\n key: \"validatePasswordCharacterOptions\",\n value: function validatePasswordCharacterOptions(password, status) {\n // Assign statuses for requirements even if the password is an empty string.\n this.updatePasswordCharacterOptionsStatuses(status,\n /* containsLowercaseCharacter= */\n false,\n /* containsUppercaseCharacter= */\n false,\n /* containsNumericCharacter= */\n false,\n /* containsNonAlphanumericCharacter= */\n false);\n var passwordChar;\n\n for (var i = 0; i < password.length; i++) {\n passwordChar = password.charAt(i);\n this.updatePasswordCharacterOptionsStatuses(status,\n /* containsLowercaseCharacter= */\n passwordChar >= 'a' && passwordChar <= 'z',\n /* containsUppercaseCharacter= */\n passwordChar >= 'A' && passwordChar <= 'Z',\n /* containsNumericCharacter= */\n passwordChar >= '0' && passwordChar <= '9',\n /* containsNonAlphanumericCharacter= */\n this.allowedNonAlphanumericCharacters.includes(passwordChar));\n }\n }\n /**\r\n * Updates the running validation status with the statuses for the character options.\r\n * Expected to be called each time a character is processed to update each option status\r\n * based on the current character.\r\n *\r\n * @param status Validation status.\r\n * @param containsLowercaseCharacter Whether the character is a lowercase letter.\r\n * @param containsUppercaseCharacter Whether the character is an uppercase letter.\r\n * @param containsNumericCharacter Whether the character is a numeric character.\r\n * @param containsNonAlphanumericCharacter Whether the character is a non-alphanumeric character.\r\n */\n\n }, {\n key: \"updatePasswordCharacterOptionsStatuses\",\n value: function updatePasswordCharacterOptionsStatuses(status, containsLowercaseCharacter, containsUppercaseCharacter, containsNumericCharacter, containsNonAlphanumericCharacter) {\n if (this.customStrengthOptions.containsLowercaseLetter) {\n status.containsLowercaseLetter || (status.containsLowercaseLetter = containsLowercaseCharacter);\n }\n\n if (this.customStrengthOptions.containsUppercaseLetter) {\n status.containsUppercaseLetter || (status.containsUppercaseLetter = containsUppercaseCharacter);\n }\n\n if (this.customStrengthOptions.containsNumericCharacter) {\n status.containsNumericCharacter || (status.containsNumericCharacter = containsNumericCharacter);\n }\n\n if (this.customStrengthOptions.containsNonAlphanumericCharacter) {\n status.containsNonAlphanumericCharacter || (status.containsNonAlphanumericCharacter = containsNonAlphanumericCharacter);\n }\n }\n }]);\n\n return PasswordPolicyImpl;\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 */\n\n\nvar AuthImpl = /*#__PURE__*/function () {\n function AuthImpl(app, heartbeatServiceProvider, appCheckServiceProvider, config) {\n _classCallCheck(this, AuthImpl);\n\n this.app = app;\n this.heartbeatServiceProvider = heartbeatServiceProvider;\n this.appCheckServiceProvider = appCheckServiceProvider;\n this.config = config;\n this.currentUser = null;\n this.emulatorConfig = null;\n this.operations = Promise.resolve();\n this.authStateSubscription = new Subscription(this);\n this.idTokenSubscription = new Subscription(this);\n this.beforeStateQueue = new AuthMiddlewareQueue(this);\n this.redirectUser = null;\n this.isProactiveRefreshEnabled = false;\n this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION = 1; // Any network calls will set this to true and prevent subsequent emulator\n // initialization\n\n this._canInitEmulator = true;\n this._isInitialized = false;\n this._deleted = false;\n this._initializationPromise = null;\n this._popupRedirectResolver = null;\n this._errorFactory = _DEFAULT_AUTH_ERROR_FACTORY;\n this._agentRecaptchaConfig = null;\n this._tenantRecaptchaConfigs = {};\n this._projectPasswordPolicy = null;\n this._tenantPasswordPolicies = {}; // Tracks the last notified UID for state change listeners to prevent\n // repeated calls to the callbacks. Undefined means it's never been\n // called, whereas null means it's been called with a signed out user\n\n this.lastNotifiedUid = undefined;\n this.languageCode = null;\n this.tenantId = null;\n this.settings = {\n appVerificationDisabledForTesting: false\n };\n this.frameworks = [];\n this.name = app.name;\n this.clientVersion = config.sdkClientVersion;\n }\n\n _createClass(AuthImpl, [{\n key: \"_initializeWithPersistence\",\n value: function _initializeWithPersistence(persistenceHierarchy, popupRedirectResolver) {\n var _this4 = this;\n\n if (popupRedirectResolver) {\n this._popupRedirectResolver = _getInstance(popupRedirectResolver);\n } // Have to check for app deletion throughout initialization (after each\n // promise resolution)\n\n\n this._initializationPromise = this.queue( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee19() {\n var _a, _b;\n\n return _regeneratorRuntime.wrap(function _callee19$(_context19) {\n while (1) {\n switch (_context19.prev = _context19.next) {\n case 0:\n if (!_this4._deleted) {\n _context19.next = 2;\n break;\n }\n\n return _context19.abrupt(\"return\");\n\n case 2:\n _context19.next = 4;\n return PersistenceUserManager.create(_this4, persistenceHierarchy);\n\n case 4:\n _this4.persistenceManager = _context19.sent;\n\n if (!_this4._deleted) {\n _context19.next = 7;\n break;\n }\n\n return _context19.abrupt(\"return\");\n\n case 7:\n if (!((_a = _this4._popupRedirectResolver) === null || _a === void 0 ? void 0 : _a._shouldInitProactively)) {\n _context19.next = 15;\n break;\n }\n\n _context19.prev = 8;\n _context19.next = 11;\n return _this4._popupRedirectResolver._initialize(_this4);\n\n case 11:\n _context19.next = 15;\n break;\n\n case 13:\n _context19.prev = 13;\n _context19.t0 = _context19[\"catch\"](8);\n\n case 15:\n _context19.next = 17;\n return _this4.initializeCurrentUser(popupRedirectResolver);\n\n case 17:\n _this4.lastNotifiedUid = ((_b = _this4.currentUser) === null || _b === void 0 ? void 0 : _b.uid) || null;\n\n if (!_this4._deleted) {\n _context19.next = 20;\n break;\n }\n\n return _context19.abrupt(\"return\");\n\n case 20:\n _this4._isInitialized = true;\n\n case 21:\n case \"end\":\n return _context19.stop();\n }\n }\n }, _callee19, null, [[8, 13]]);\n })));\n return this._initializationPromise;\n }\n /**\r\n * If the persistence is changed in another window, the user manager will let us know\r\n */\n\n }, {\n key: \"_onStorageEvent\",\n value: function () {\n var _onStorageEvent2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee20() {\n var user;\n return _regeneratorRuntime.wrap(function _callee20$(_context20) {\n while (1) {\n switch (_context20.prev = _context20.next) {\n case 0:\n if (!this._deleted) {\n _context20.next = 2;\n break;\n }\n\n return _context20.abrupt(\"return\");\n\n case 2:\n _context20.next = 4;\n return this.assertedPersistence.getCurrentUser();\n\n case 4:\n user = _context20.sent;\n\n if (!(!this.currentUser && !user)) {\n _context20.next = 7;\n break;\n }\n\n return _context20.abrupt(\"return\");\n\n case 7:\n if (!(this.currentUser && user && this.currentUser.uid === user.uid)) {\n _context20.next = 12;\n break;\n }\n\n // Data update, simply copy data changes.\n this._currentUser._assign(user); // If tokens changed from previous user tokens, this will trigger\n // notifyAuthListeners_.\n\n\n _context20.next = 11;\n return this.currentUser.getIdToken();\n\n case 11:\n return _context20.abrupt(\"return\");\n\n case 12:\n _context20.next = 14;\n return this._updateCurrentUser(user,\n /* skipBeforeStateCallbacks */\n true);\n\n case 14:\n case \"end\":\n return _context20.stop();\n }\n }\n }, _callee20, this);\n }));\n\n function _onStorageEvent() {\n return _onStorageEvent2.apply(this, arguments);\n }\n\n return _onStorageEvent;\n }()\n }, {\n key: \"initializeCurrentUser\",\n value: function () {\n var _initializeCurrentUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee21(popupRedirectResolver) {\n var _a, previouslyStoredUser, futureCurrentUser, needsTocheckMiddleware, redirectUserEventId, storedUserEventId, result;\n\n return _regeneratorRuntime.wrap(function _callee21$(_context21) {\n while (1) {\n switch (_context21.prev = _context21.next) {\n case 0:\n _context21.next = 2;\n return this.assertedPersistence.getCurrentUser();\n\n case 2:\n previouslyStoredUser = _context21.sent;\n futureCurrentUser = previouslyStoredUser;\n needsTocheckMiddleware = false;\n\n if (!(popupRedirectResolver && this.config.authDomain)) {\n _context21.next = 14;\n break;\n }\n\n _context21.next = 8;\n return this.getOrInitRedirectPersistenceManager();\n\n case 8:\n redirectUserEventId = (_a = this.redirectUser) === null || _a === void 0 ? void 0 : _a._redirectEventId;\n storedUserEventId = futureCurrentUser === null || futureCurrentUser === void 0 ? void 0 : futureCurrentUser._redirectEventId;\n _context21.next = 12;\n return this.tryRedirectSignIn(popupRedirectResolver);\n\n case 12:\n result = _context21.sent;\n\n // If the stored user (i.e. the old \"currentUser\") has a redirectId that\n // matches the redirect user, then we want to initially sign in with the\n // new user object from result.\n // TODO(samgho): More thoroughly test all of this\n if ((!redirectUserEventId || redirectUserEventId === storedUserEventId) && (result === null || result === void 0 ? void 0 : result.user)) {\n futureCurrentUser = result.user;\n needsTocheckMiddleware = true;\n }\n\n case 14:\n if (futureCurrentUser) {\n _context21.next = 16;\n break;\n }\n\n return _context21.abrupt(\"return\", this.directlySetCurrentUser(null));\n\n case 16:\n if (futureCurrentUser._redirectEventId) {\n _context21.next = 32;\n break;\n }\n\n if (!needsTocheckMiddleware) {\n _context21.next = 27;\n break;\n }\n\n _context21.prev = 18;\n _context21.next = 21;\n return this.beforeStateQueue.runMiddleware(futureCurrentUser);\n\n case 21:\n _context21.next = 27;\n break;\n\n case 23:\n _context21.prev = 23;\n _context21.t0 = _context21[\"catch\"](18);\n futureCurrentUser = previouslyStoredUser; // We know this is available since the bit is only set when the\n // resolver is available\n\n this._popupRedirectResolver._overrideRedirectResult(this, function () {\n return Promise.reject(_context21.t0);\n });\n\n case 27:\n if (!futureCurrentUser) {\n _context21.next = 31;\n break;\n }\n\n return _context21.abrupt(\"return\", this.reloadAndSetCurrentUserOrClear(futureCurrentUser));\n\n case 31:\n return _context21.abrupt(\"return\", this.directlySetCurrentUser(null));\n\n case 32:\n _assert(this._popupRedirectResolver, this, \"argument-error\"\n /* AuthErrorCode.ARGUMENT_ERROR */\n );\n\n _context21.next = 35;\n return this.getOrInitRedirectPersistenceManager();\n\n case 35:\n if (!(this.redirectUser && this.redirectUser._redirectEventId === futureCurrentUser._redirectEventId)) {\n _context21.next = 37;\n break;\n }\n\n return _context21.abrupt(\"return\", this.directlySetCurrentUser(futureCurrentUser));\n\n case 37:\n return _context21.abrupt(\"return\", this.reloadAndSetCurrentUserOrClear(futureCurrentUser));\n\n case 38:\n case \"end\":\n return _context21.stop();\n }\n }\n }, _callee21, this, [[18, 23]]);\n }));\n\n function initializeCurrentUser(_x48) {\n return _initializeCurrentUser.apply(this, arguments);\n }\n\n return initializeCurrentUser;\n }()\n }, {\n key: \"tryRedirectSignIn\",\n value: function () {\n var _tryRedirectSignIn = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee22(redirectResolver) {\n var result;\n return _regeneratorRuntime.wrap(function _callee22$(_context22) {\n while (1) {\n switch (_context22.prev = _context22.next) {\n case 0:\n // The redirect user needs to be checked (and signed in if available)\n // during auth initialization. All of the normal sign in and link/reauth\n // flows call back into auth and push things onto the promise queue. We\n // need to await the result of the redirect sign in *inside the promise\n // queue*. This presents a problem: we run into deadlock. See:\n // ┌> [Initialization] ─────┐\n // ┌> [] │\n // └─ [getRedirectResult] <─┘\n // where [] are tasks on the queue and arrows denote awaits\n // Initialization will never complete because it's waiting on something\n // that's waiting for initialization to complete!\n //\n // Instead, this method calls getRedirectResult() (stored in\n // _completeRedirectFn) with an optional parameter that instructs all of\n // the underlying auth operations to skip anything that mutates auth state.\n result = null;\n _context22.prev = 1;\n _context22.next = 4;\n return this._popupRedirectResolver._completeRedirectFn(this, redirectResolver, true);\n\n case 4:\n result = _context22.sent;\n _context22.next = 11;\n break;\n\n case 7:\n _context22.prev = 7;\n _context22.t0 = _context22[\"catch\"](1);\n _context22.next = 11;\n return this._setRedirectUser(null);\n\n case 11:\n return _context22.abrupt(\"return\", result);\n\n case 12:\n case \"end\":\n return _context22.stop();\n }\n }\n }, _callee22, this, [[1, 7]]);\n }));\n\n function tryRedirectSignIn(_x49) {\n return _tryRedirectSignIn.apply(this, arguments);\n }\n\n return tryRedirectSignIn;\n }()\n }, {\n key: \"reloadAndSetCurrentUserOrClear\",\n value: function () {\n var _reloadAndSetCurrentUserOrClear = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee23(user) {\n return _regeneratorRuntime.wrap(function _callee23$(_context23) {\n while (1) {\n switch (_context23.prev = _context23.next) {\n case 0:\n _context23.prev = 0;\n _context23.next = 3;\n return _reloadWithoutSaving(user);\n\n case 3:\n _context23.next = 9;\n break;\n\n case 5:\n _context23.prev = 5;\n _context23.t0 = _context23[\"catch\"](0);\n\n if (!((_context23.t0 === null || _context23.t0 === void 0 ? void 0 : _context23.t0.code) !== \"auth/\".concat(\"network-request-failed\"\n /* AuthErrorCode.NETWORK_REQUEST_FAILED */\n ))) {\n _context23.next = 9;\n break;\n }\n\n return _context23.abrupt(\"return\", this.directlySetCurrentUser(null));\n\n case 9:\n return _context23.abrupt(\"return\", this.directlySetCurrentUser(user));\n\n case 10:\n case \"end\":\n return _context23.stop();\n }\n }\n }, _callee23, this, [[0, 5]]);\n }));\n\n function reloadAndSetCurrentUserOrClear(_x50) {\n return _reloadAndSetCurrentUserOrClear.apply(this, arguments);\n }\n\n return reloadAndSetCurrentUserOrClear;\n }()\n }, {\n key: \"useDeviceLanguage\",\n value: function useDeviceLanguage() {\n this.languageCode = _getUserLanguage();\n }\n }, {\n key: \"_delete\",\n value: function () {\n var _delete3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee24() {\n return _regeneratorRuntime.wrap(function _callee24$(_context24) {\n while (1) {\n switch (_context24.prev = _context24.next) {\n case 0:\n this._deleted = true;\n\n case 1:\n case \"end\":\n return _context24.stop();\n }\n }\n }, _callee24, this);\n }));\n\n function _delete() {\n return _delete3.apply(this, arguments);\n }\n\n return _delete;\n }()\n }, {\n key: \"updateCurrentUser\",\n value: function () {\n var _updateCurrentUser2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee25(userExtern) {\n var user;\n return _regeneratorRuntime.wrap(function _callee25$(_context25) {\n while (1) {\n switch (_context25.prev = _context25.next) {\n case 0:\n // The public updateCurrentUser method needs to make a copy of the user,\n // and also check that the project matches\n user = userExtern ? getModularInstance(userExtern) : null;\n\n if (user) {\n _assert(user.auth.config.apiKey === this.config.apiKey, this, \"invalid-user-token\"\n /* AuthErrorCode.INVALID_AUTH */\n );\n }\n\n return _context25.abrupt(\"return\", this._updateCurrentUser(user && user._clone(this)));\n\n case 3:\n case \"end\":\n return _context25.stop();\n }\n }\n }, _callee25, this);\n }));\n\n function updateCurrentUser(_x51) {\n return _updateCurrentUser2.apply(this, arguments);\n }\n\n return updateCurrentUser;\n }()\n }, {\n key: \"_updateCurrentUser\",\n value: function () {\n var _updateCurrentUser3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee27(user) {\n var _this5 = this;\n\n var skipBeforeStateCallbacks,\n _args27 = arguments;\n return _regeneratorRuntime.wrap(function _callee27$(_context27) {\n while (1) {\n switch (_context27.prev = _context27.next) {\n case 0:\n skipBeforeStateCallbacks = _args27.length > 1 && _args27[1] !== undefined ? _args27[1] : false;\n\n if (!this._deleted) {\n _context27.next = 3;\n break;\n }\n\n return _context27.abrupt(\"return\");\n\n case 3:\n if (user) {\n _assert(this.tenantId === user.tenantId, this, \"tenant-id-mismatch\"\n /* AuthErrorCode.TENANT_ID_MISMATCH */\n );\n }\n\n if (skipBeforeStateCallbacks) {\n _context27.next = 7;\n break;\n }\n\n _context27.next = 7;\n return this.beforeStateQueue.runMiddleware(user);\n\n case 7:\n return _context27.abrupt(\"return\", this.queue( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee26() {\n return _regeneratorRuntime.wrap(function _callee26$(_context26) {\n while (1) {\n switch (_context26.prev = _context26.next) {\n case 0:\n _context26.next = 2;\n return _this5.directlySetCurrentUser(user);\n\n case 2:\n _this5.notifyAuthListeners();\n\n case 3:\n case \"end\":\n return _context26.stop();\n }\n }\n }, _callee26);\n }))));\n\n case 8:\n case \"end\":\n return _context27.stop();\n }\n }\n }, _callee27, this);\n }));\n\n function _updateCurrentUser(_x52) {\n return _updateCurrentUser3.apply(this, arguments);\n }\n\n return _updateCurrentUser;\n }()\n }, {\n key: \"signOut\",\n value: function () {\n var _signOut = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee28() {\n return _regeneratorRuntime.wrap(function _callee28$(_context28) {\n while (1) {\n switch (_context28.prev = _context28.next) {\n case 0:\n _context28.next = 2;\n return this.beforeStateQueue.runMiddleware(null);\n\n case 2:\n if (!(this.redirectPersistenceManager || this._popupRedirectResolver)) {\n _context28.next = 5;\n break;\n }\n\n _context28.next = 5;\n return this._setRedirectUser(null);\n\n case 5:\n return _context28.abrupt(\"return\", this._updateCurrentUser(null,\n /* skipBeforeStateCallbacks */\n true));\n\n case 6:\n case \"end\":\n return _context28.stop();\n }\n }\n }, _callee28, this);\n }));\n\n function signOut() {\n return _signOut.apply(this, arguments);\n }\n\n return signOut;\n }()\n }, {\n key: \"setPersistence\",\n value: function setPersistence(persistence) {\n var _this6 = this;\n\n return this.queue( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee29() {\n return _regeneratorRuntime.wrap(function _callee29$(_context29) {\n while (1) {\n switch (_context29.prev = _context29.next) {\n case 0:\n _context29.next = 2;\n return _this6.assertedPersistence.setPersistence(_getInstance(persistence));\n\n case 2:\n case \"end\":\n return _context29.stop();\n }\n }\n }, _callee29);\n })));\n }\n }, {\n key: \"_getRecaptchaConfig\",\n value: function _getRecaptchaConfig() {\n if (this.tenantId == null) {\n return this._agentRecaptchaConfig;\n } else {\n return this._tenantRecaptchaConfigs[this.tenantId];\n }\n }\n }, {\n key: \"validatePassword\",\n value: function () {\n var _validatePassword = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee30(password) {\n var passwordPolicy;\n return _regeneratorRuntime.wrap(function _callee30$(_context30) {\n while (1) {\n switch (_context30.prev = _context30.next) {\n case 0:\n if (this._getPasswordPolicyInternal()) {\n _context30.next = 3;\n break;\n }\n\n _context30.next = 3;\n return this._updatePasswordPolicy();\n\n case 3:\n // Password policy will be defined after fetching.\n passwordPolicy = this._getPasswordPolicyInternal(); // Check that the policy schema version is supported by the SDK.\n // TODO: Update this logic to use a max supported policy schema version once we have multiple schema versions.\n\n if (!(passwordPolicy.schemaVersion !== this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION)) {\n _context30.next = 6;\n break;\n }\n\n return _context30.abrupt(\"return\", Promise.reject(this._errorFactory.create(\"unsupported-password-policy-schema-version\"\n /* AuthErrorCode.UNSUPPORTED_PASSWORD_POLICY_SCHEMA_VERSION */\n , {})));\n\n case 6:\n return _context30.abrupt(\"return\", passwordPolicy.validatePassword(password));\n\n case 7:\n case \"end\":\n return _context30.stop();\n }\n }\n }, _callee30, this);\n }));\n\n function validatePassword(_x53) {\n return _validatePassword.apply(this, arguments);\n }\n\n return validatePassword;\n }()\n }, {\n key: \"_getPasswordPolicyInternal\",\n value: function _getPasswordPolicyInternal() {\n if (this.tenantId === null) {\n return this._projectPasswordPolicy;\n } else {\n return this._tenantPasswordPolicies[this.tenantId];\n }\n }\n }, {\n key: \"_updatePasswordPolicy\",\n value: function () {\n var _updatePasswordPolicy2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee31() {\n var response, passwordPolicy;\n return _regeneratorRuntime.wrap(function _callee31$(_context31) {\n while (1) {\n switch (_context31.prev = _context31.next) {\n case 0:\n _context31.next = 2;\n return _getPasswordPolicy(this);\n\n case 2:\n response = _context31.sent;\n passwordPolicy = new PasswordPolicyImpl(response);\n\n if (this.tenantId === null) {\n this._projectPasswordPolicy = passwordPolicy;\n } else {\n this._tenantPasswordPolicies[this.tenantId] = passwordPolicy;\n }\n\n case 5:\n case \"end\":\n return _context31.stop();\n }\n }\n }, _callee31, this);\n }));\n\n function _updatePasswordPolicy() {\n return _updatePasswordPolicy2.apply(this, arguments);\n }\n\n return _updatePasswordPolicy;\n }()\n }, {\n key: \"_getPersistence\",\n value: function _getPersistence() {\n return this.assertedPersistence.persistence.type;\n }\n }, {\n key: \"_updateErrorMap\",\n value: function _updateErrorMap(errorMap) {\n this._errorFactory = new ErrorFactory('auth', 'Firebase', errorMap());\n }\n }, {\n key: \"onAuthStateChanged\",\n value: function onAuthStateChanged(nextOrObserver, error, completed) {\n return this.registerStateListener(this.authStateSubscription, nextOrObserver, error, completed);\n }\n }, {\n key: \"beforeAuthStateChanged\",\n value: function beforeAuthStateChanged(callback, onAbort) {\n return this.beforeStateQueue.pushCallback(callback, onAbort);\n }\n }, {\n key: \"onIdTokenChanged\",\n value: function onIdTokenChanged(nextOrObserver, error, completed) {\n return this.registerStateListener(this.idTokenSubscription, nextOrObserver, error, completed);\n }\n }, {\n key: \"authStateReady\",\n value: function authStateReady() {\n var _this7 = this;\n\n return new Promise(function (resolve, reject) {\n if (_this7.currentUser) {\n resolve();\n } else {\n var unsubscribe = _this7.onAuthStateChanged(function () {\n unsubscribe();\n resolve();\n }, reject);\n }\n });\n }\n /**\r\n * Revokes the given access token. Currently only supports Apple OAuth access tokens.\r\n */\n\n }, {\n key: \"revokeAccessToken\",\n value: function () {\n var _revokeAccessToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee32(token) {\n var idToken, request;\n return _regeneratorRuntime.wrap(function _callee32$(_context32) {\n while (1) {\n switch (_context32.prev = _context32.next) {\n case 0:\n if (!this.currentUser) {\n _context32.next = 8;\n break;\n }\n\n _context32.next = 3;\n return this.currentUser.getIdToken();\n\n case 3:\n idToken = _context32.sent;\n // Generalize this to accept other providers once supported.\n request = {\n providerId: 'apple.com',\n tokenType: \"ACCESS_TOKEN\"\n /* TokenType.ACCESS_TOKEN */\n ,\n token: token,\n idToken: idToken\n };\n\n if (this.tenantId != null) {\n request.tenantId = this.tenantId;\n }\n\n _context32.next = 8;\n return revokeToken(this, request);\n\n case 8:\n case \"end\":\n return _context32.stop();\n }\n }\n }, _callee32, this);\n }));\n\n function revokeAccessToken(_x54) {\n return _revokeAccessToken.apply(this, arguments);\n }\n\n return revokeAccessToken;\n }()\n }, {\n key: \"toJSON\",\n value: function toJSON() {\n var _a;\n\n return {\n apiKey: this.config.apiKey,\n authDomain: this.config.authDomain,\n appName: this.name,\n currentUser: (_a = this._currentUser) === null || _a === void 0 ? void 0 : _a.toJSON()\n };\n }\n }, {\n key: \"_setRedirectUser\",\n value: function () {\n var _setRedirectUser2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee33(user, popupRedirectResolver) {\n var redirectManager;\n return _regeneratorRuntime.wrap(function _callee33$(_context33) {\n while (1) {\n switch (_context33.prev = _context33.next) {\n case 0:\n _context33.next = 2;\n return this.getOrInitRedirectPersistenceManager(popupRedirectResolver);\n\n case 2:\n redirectManager = _context33.sent;\n return _context33.abrupt(\"return\", user === null ? redirectManager.removeCurrentUser() : redirectManager.setCurrentUser(user));\n\n case 4:\n case \"end\":\n return _context33.stop();\n }\n }\n }, _callee33, this);\n }));\n\n function _setRedirectUser(_x55, _x56) {\n return _setRedirectUser2.apply(this, arguments);\n }\n\n return _setRedirectUser;\n }()\n }, {\n key: \"getOrInitRedirectPersistenceManager\",\n value: function () {\n var _getOrInitRedirectPersistenceManager = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee34(popupRedirectResolver) {\n var resolver;\n return _regeneratorRuntime.wrap(function _callee34$(_context34) {\n while (1) {\n switch (_context34.prev = _context34.next) {\n case 0:\n if (this.redirectPersistenceManager) {\n _context34.next = 9;\n break;\n }\n\n resolver = popupRedirectResolver && _getInstance(popupRedirectResolver) || this._popupRedirectResolver;\n\n _assert(resolver, this, \"argument-error\"\n /* AuthErrorCode.ARGUMENT_ERROR */\n );\n\n _context34.next = 5;\n return PersistenceUserManager.create(this, [_getInstance(resolver._redirectPersistence)], \"redirectUser\"\n /* KeyName.REDIRECT_USER */\n );\n\n case 5:\n this.redirectPersistenceManager = _context34.sent;\n _context34.next = 8;\n return this.redirectPersistenceManager.getCurrentUser();\n\n case 8:\n this.redirectUser = _context34.sent;\n\n case 9:\n return _context34.abrupt(\"return\", this.redirectPersistenceManager);\n\n case 10:\n case \"end\":\n return _context34.stop();\n }\n }\n }, _callee34, this);\n }));\n\n function getOrInitRedirectPersistenceManager(_x57) {\n return _getOrInitRedirectPersistenceManager.apply(this, arguments);\n }\n\n return getOrInitRedirectPersistenceManager;\n }()\n }, {\n key: \"_redirectUserForId\",\n value: function () {\n var _redirectUserForId2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee36(id) {\n var _a, _b;\n\n return _regeneratorRuntime.wrap(function _callee36$(_context36) {\n while (1) {\n switch (_context36.prev = _context36.next) {\n case 0:\n if (!this._isInitialized) {\n _context36.next = 3;\n break;\n }\n\n _context36.next = 3;\n return this.queue( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee35() {\n return _regeneratorRuntime.wrap(function _callee35$(_context35) {\n while (1) {\n switch (_context35.prev = _context35.next) {\n case 0:\n case \"end\":\n return _context35.stop();\n }\n }\n }, _callee35);\n })));\n\n case 3:\n if (!(((_a = this._currentUser) === null || _a === void 0 ? void 0 : _a._redirectEventId) === id)) {\n _context36.next = 5;\n break;\n }\n\n return _context36.abrupt(\"return\", this._currentUser);\n\n case 5:\n if (!(((_b = this.redirectUser) === null || _b === void 0 ? void 0 : _b._redirectEventId) === id)) {\n _context36.next = 7;\n break;\n }\n\n return _context36.abrupt(\"return\", this.redirectUser);\n\n case 7:\n return _context36.abrupt(\"return\", null);\n\n case 8:\n case \"end\":\n return _context36.stop();\n }\n }\n }, _callee36, this);\n }));\n\n function _redirectUserForId(_x58) {\n return _redirectUserForId2.apply(this, arguments);\n }\n\n return _redirectUserForId;\n }()\n }, {\n key: \"_persistUserIfCurrent\",\n value: function () {\n var _persistUserIfCurrent2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee38(user) {\n var _this8 = this;\n\n return _regeneratorRuntime.wrap(function _callee38$(_context38) {\n while (1) {\n switch (_context38.prev = _context38.next) {\n case 0:\n if (!(user === this.currentUser)) {\n _context38.next = 2;\n break;\n }\n\n return _context38.abrupt(\"return\", this.queue( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee37() {\n return _regeneratorRuntime.wrap(function _callee37$(_context37) {\n while (1) {\n switch (_context37.prev = _context37.next) {\n case 0:\n return _context37.abrupt(\"return\", _this8.directlySetCurrentUser(user));\n\n case 1:\n case \"end\":\n return _context37.stop();\n }\n }\n }, _callee37);\n }))));\n\n case 2:\n case \"end\":\n return _context38.stop();\n }\n }\n }, _callee38, this);\n }));\n\n function _persistUserIfCurrent(_x59) {\n return _persistUserIfCurrent2.apply(this, arguments);\n }\n\n return _persistUserIfCurrent;\n }()\n /** Notifies listeners only if the user is current */\n\n }, {\n key: \"_notifyListenersIfCurrent\",\n value: function _notifyListenersIfCurrent(user) {\n if (user === this.currentUser) {\n this.notifyAuthListeners();\n }\n }\n }, {\n key: \"_key\",\n value: function _key() {\n return \"\".concat(this.config.authDomain, \":\").concat(this.config.apiKey, \":\").concat(this.name);\n }\n }, {\n key: \"_startProactiveRefresh\",\n value: function _startProactiveRefresh() {\n this.isProactiveRefreshEnabled = true;\n\n if (this.currentUser) {\n this._currentUser._startProactiveRefresh();\n }\n }\n }, {\n key: \"_stopProactiveRefresh\",\n value: function _stopProactiveRefresh() {\n this.isProactiveRefreshEnabled = false;\n\n if (this.currentUser) {\n this._currentUser._stopProactiveRefresh();\n }\n }\n /** Returns the current user cast as the internal type */\n\n }, {\n key: \"_currentUser\",\n get: function get() {\n return this.currentUser;\n }\n }, {\n key: \"notifyAuthListeners\",\n value: function notifyAuthListeners() {\n var _a, _b;\n\n if (!this._isInitialized) {\n return;\n }\n\n this.idTokenSubscription.next(this.currentUser);\n var currentUid = (_b = (_a = this.currentUser) === null || _a === void 0 ? void 0 : _a.uid) !== null && _b !== void 0 ? _b : null;\n\n if (this.lastNotifiedUid !== currentUid) {\n this.lastNotifiedUid = currentUid;\n this.authStateSubscription.next(this.currentUser);\n }\n }\n }, {\n key: \"registerStateListener\",\n value: function registerStateListener(subscription, nextOrObserver, error, completed) {\n var _this9 = this;\n\n if (this._deleted) {\n return function () {};\n }\n\n var cb = typeof nextOrObserver === 'function' ? nextOrObserver : nextOrObserver.next.bind(nextOrObserver);\n var isUnsubscribed = false;\n var promise = this._isInitialized ? Promise.resolve() : this._initializationPromise;\n\n _assert(promise, this, \"internal-error\"\n /* AuthErrorCode.INTERNAL_ERROR */\n ); // The callback needs to be called asynchronously per the spec.\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n\n\n promise.then(function () {\n if (isUnsubscribed) {\n return;\n }\n\n cb(_this9.currentUser);\n });\n\n if (typeof nextOrObserver === 'function') {\n var unsubscribe = subscription.addObserver(nextOrObserver, error, completed);\n return function () {\n isUnsubscribed = true;\n unsubscribe();\n };\n } else {\n var _unsubscribe = subscription.addObserver(nextOrObserver);\n\n return function () {\n isUnsubscribed = true;\n\n _unsubscribe();\n };\n }\n }\n /**\r\n * Unprotected (from race conditions) method to set the current user. This\r\n * should only be called from within a queued callback. This is necessary\r\n * because the queue shouldn't rely on another queued callback.\r\n */\n\n }, {\n key: \"directlySetCurrentUser\",\n value: function () {\n var _directlySetCurrentUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee39(user) {\n return _regeneratorRuntime.wrap(function _callee39$(_context39) {\n while (1) {\n switch (_context39.prev = _context39.next) {\n case 0:\n if (this.currentUser && this.currentUser !== user) {\n this._currentUser._stopProactiveRefresh();\n }\n\n if (user && this.isProactiveRefreshEnabled) {\n user._startProactiveRefresh();\n }\n\n this.currentUser = user;\n\n if (!user) {\n _context39.next = 8;\n break;\n }\n\n _context39.next = 6;\n return this.assertedPersistence.setCurrentUser(user);\n\n case 6:\n _context39.next = 10;\n break;\n\n case 8:\n _context39.next = 10;\n return this.assertedPersistence.removeCurrentUser();\n\n case 10:\n case \"end\":\n return _context39.stop();\n }\n }\n }, _callee39, this);\n }));\n\n function directlySetCurrentUser(_x60) {\n return _directlySetCurrentUser.apply(this, arguments);\n }\n\n return directlySetCurrentUser;\n }()\n }, {\n key: \"queue\",\n value: function queue(action) {\n // In case something errors, the callback still should be called in order\n // to keep the promise chain alive\n this.operations = this.operations.then(action, action);\n return this.operations;\n }\n }, {\n key: \"assertedPersistence\",\n get: function get() {\n _assert(this.persistenceManager, this, \"internal-error\"\n /* AuthErrorCode.INTERNAL_ERROR */\n );\n\n return this.persistenceManager;\n }\n }, {\n key: \"_logFramework\",\n value: function _logFramework(framework) {\n if (!framework || this.frameworks.includes(framework)) {\n return;\n }\n\n this.frameworks.push(framework); // Sort alphabetically so that \"FirebaseCore-web,FirebaseUI-web\" and\n // \"FirebaseUI-web,FirebaseCore-web\" aren't viewed as different.\n\n this.frameworks.sort();\n this.clientVersion = _getClientVersion(this.config.clientPlatform, this._getFrameworks());\n }\n }, {\n key: \"_getFrameworks\",\n value: function _getFrameworks() {\n return this.frameworks;\n }\n }, {\n key: \"_getAdditionalHeaders\",\n value: function () {\n var _getAdditionalHeaders2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee40() {\n var _a, headers, heartbeatsHeader, appCheckToken;\n\n return _regeneratorRuntime.wrap(function _callee40$(_context40) {\n while (1) {\n switch (_context40.prev = _context40.next) {\n case 0:\n // Additional headers on every request\n headers = _defineProperty({}, \"X-Client-Version\"\n /* HttpHeader.X_CLIENT_VERSION */\n , this.clientVersion);\n\n if (this.app.options.appId) {\n headers[\"X-Firebase-gmpid\"\n /* HttpHeader.X_FIREBASE_GMPID */\n ] = this.app.options.appId;\n } // If the heartbeat service exists, add the heartbeat string\n\n\n _context40.next = 4;\n return (_a = this.heartbeatServiceProvider.getImmediate({\n optional: true\n })) === null || _a === void 0 ? void 0 : _a.getHeartbeatsHeader();\n\n case 4:\n heartbeatsHeader = _context40.sent;\n\n if (heartbeatsHeader) {\n headers[\"X-Firebase-Client\"\n /* HttpHeader.X_FIREBASE_CLIENT */\n ] = heartbeatsHeader;\n } // If the App Check service exists, add the App Check token in the headers\n\n\n _context40.next = 8;\n return this._getAppCheckToken();\n\n case 8:\n appCheckToken = _context40.sent;\n\n if (appCheckToken) {\n headers[\"X-Firebase-AppCheck\"\n /* HttpHeader.X_FIREBASE_APP_CHECK */\n ] = appCheckToken;\n }\n\n return _context40.abrupt(\"return\", headers);\n\n case 11:\n case \"end\":\n return _context40.stop();\n }\n }\n }, _callee40, this);\n }));\n\n function _getAdditionalHeaders() {\n return _getAdditionalHeaders2.apply(this, arguments);\n }\n\n return _getAdditionalHeaders;\n }()\n }, {\n key: \"_getAppCheckToken\",\n value: function () {\n var _getAppCheckToken2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee41() {\n var _a, appCheckTokenResult;\n\n return _regeneratorRuntime.wrap(function _callee41$(_context41) {\n while (1) {\n switch (_context41.prev = _context41.next) {\n case 0:\n _context41.next = 2;\n return (_a = this.appCheckServiceProvider.getImmediate({\n optional: true\n })) === null || _a === void 0 ? void 0 : _a.getToken();\n\n case 2:\n appCheckTokenResult = _context41.sent;\n\n if (appCheckTokenResult === null || appCheckTokenResult === void 0 ? void 0 : appCheckTokenResult.error) {\n // Context: appCheck.getToken() will never throw even if an error happened.\n // In the error case, a dummy token will be returned along with an error field describing\n // the error. In general, we shouldn't care about the error condition and just use\n // the token (actual or dummy) to send requests.\n _logWarn(\"Error while retrieving App Check token: \".concat(appCheckTokenResult.error));\n }\n\n return _context41.abrupt(\"return\", appCheckTokenResult === null || appCheckTokenResult === void 0 ? void 0 : appCheckTokenResult.token);\n\n case 5:\n case \"end\":\n return _context41.stop();\n }\n }\n }, _callee41, this);\n }));\n\n function _getAppCheckToken() {\n return _getAppCheckToken2.apply(this, arguments);\n }\n\n return _getAppCheckToken;\n }()\n }]);\n\n return AuthImpl;\n}();\n/**\r\n * Method to be used to cast down to our private implmentation of Auth.\r\n * It will also handle unwrapping from the compat type if necessary\r\n *\r\n * @param auth Auth object passed in from developer\r\n */\n\n\nfunction _castAuth(auth) {\n return getModularInstance(auth);\n}\n/** Helper class to wrap subscriber logic */\n\n\nvar Subscription = /*#__PURE__*/function () {\n function Subscription(auth) {\n var _this10 = this;\n\n _classCallCheck(this, Subscription);\n\n this.auth = auth;\n this.observer = null;\n this.addObserver = createSubscribe(function (observer) {\n return _this10.observer = observer;\n });\n }\n\n _createClass(Subscription, [{\n key: \"next\",\n get: function get() {\n _assert(this.observer, this.auth, \"internal-error\"\n /* AuthErrorCode.INTERNAL_ERROR */\n );\n\n return this.observer.next.bind(this.observer);\n }\n }]);\n\n return Subscription;\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 */\n\n\nvar externalJSProvider = {\n loadJS: function loadJS() {\n return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee42() {\n return _regeneratorRuntime.wrap(function _callee42$(_context42) {\n while (1) {\n switch (_context42.prev = _context42.next) {\n case 0:\n throw new Error('Unable to load external scripts');\n\n case 1:\n case \"end\":\n return _context42.stop();\n }\n }\n }, _callee42);\n }))();\n },\n recaptchaV2Script: '',\n recaptchaEnterpriseScript: '',\n gapiScript: ''\n};\n\nfunction _setExternalJSProvider(p) {\n externalJSProvider = p;\n}\n\nfunction _loadJS(url) {\n return externalJSProvider.loadJS(url);\n}\n\nfunction _recaptchaV2ScriptUrl() {\n return externalJSProvider.recaptchaV2Script;\n}\n\nfunction _recaptchaEnterpriseScriptUrl() {\n return externalJSProvider.recaptchaEnterpriseScript;\n}\n\nfunction _gapiScriptUrl() {\n return externalJSProvider.gapiScript;\n}\n\nfunction _generateCallbackName(prefix) {\n return \"__\".concat(prefix).concat(Math.floor(Math.random() * 1000000));\n}\n/* eslint-disable @typescript-eslint/no-require-imports */\n\n\nvar RECAPTCHA_ENTERPRISE_VERIFIER_TYPE = 'recaptcha-enterprise';\nvar FAKE_TOKEN = 'NO_RECAPTCHA';\n\nvar RecaptchaEnterpriseVerifier = /*#__PURE__*/function () {\n /**\r\n *\r\n * @param authExtern - The corresponding Firebase {@link Auth} instance.\r\n *\r\n */\n function RecaptchaEnterpriseVerifier(authExtern) {\n _classCallCheck(this, RecaptchaEnterpriseVerifier);\n\n /**\r\n * Identifies the type of application verifier (e.g. \"recaptcha-enterprise\").\r\n */\n this.type = RECAPTCHA_ENTERPRISE_VERIFIER_TYPE;\n this.auth = _castAuth(authExtern);\n }\n /**\r\n * Executes the verification process.\r\n *\r\n * @returns A Promise for a token that can be used to assert the validity of a request.\r\n */\n\n\n _createClass(RecaptchaEnterpriseVerifier, [{\n key: \"verify\",\n value: function () {\n var _verify = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee45() {\n var _this11 = this;\n\n var action,\n forceRefresh,\n retrieveSiteKey,\n _retrieveSiteKey,\n retrieveRecaptchaToken,\n _args45 = arguments;\n\n return _regeneratorRuntime.wrap(function _callee45$(_context45) {\n while (1) {\n switch (_context45.prev = _context45.next) {\n case 0:\n retrieveRecaptchaToken = function _retrieveRecaptchaTok(siteKey, resolve, reject) {\n var grecaptcha = window.grecaptcha;\n\n if (isEnterprise(grecaptcha)) {\n grecaptcha.enterprise.ready(function () {\n grecaptcha.enterprise.execute(siteKey, {\n action: action\n }).then(function (token) {\n resolve(token);\n }).catch(function () {\n resolve(FAKE_TOKEN);\n });\n });\n } else {\n reject(Error('No reCAPTCHA enterprise script loaded.'));\n }\n };\n\n _retrieveSiteKey = function _retrieveSiteKey3() {\n _retrieveSiteKey = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee44(auth) {\n return _regeneratorRuntime.wrap(function _callee44$(_context44) {\n while (1) {\n switch (_context44.prev = _context44.next) {\n case 0:\n if (forceRefresh) {\n _context44.next = 5;\n break;\n }\n\n if (!(auth.tenantId == null && auth._agentRecaptchaConfig != null)) {\n _context44.next = 3;\n break;\n }\n\n return _context44.abrupt(\"return\", auth._agentRecaptchaConfig.siteKey);\n\n case 3:\n if (!(auth.tenantId != null && auth._tenantRecaptchaConfigs[auth.tenantId] !== undefined)) {\n _context44.next = 5;\n break;\n }\n\n return _context44.abrupt(\"return\", auth._tenantRecaptchaConfigs[auth.tenantId].siteKey);\n\n case 5:\n return _context44.abrupt(\"return\", new Promise( /*#__PURE__*/function () {\n var _ref12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee43(resolve, reject) {\n return _regeneratorRuntime.wrap(function _callee43$(_context43) {\n while (1) {\n switch (_context43.prev = _context43.next) {\n case 0:\n getRecaptchaConfig(auth, {\n clientType: \"CLIENT_TYPE_WEB\"\n /* RecaptchaClientType.WEB */\n ,\n version: \"RECAPTCHA_ENTERPRISE\"\n /* RecaptchaVersion.ENTERPRISE */\n\n }).then(function (response) {\n if (response.recaptchaKey === undefined) {\n reject(new Error('recaptcha Enterprise site key undefined'));\n } else {\n var config = new RecaptchaConfig(response);\n\n if (auth.tenantId == null) {\n auth._agentRecaptchaConfig = config;\n } else {\n auth._tenantRecaptchaConfigs[auth.tenantId] = config;\n }\n\n return resolve(config.siteKey);\n }\n }).catch(function (error) {\n reject(error);\n });\n\n case 1:\n case \"end\":\n return _context43.stop();\n }\n }\n }, _callee43);\n }));\n\n return function (_x62, _x63) {\n return _ref12.apply(this, arguments);\n };\n }()));\n\n case 6:\n case \"end\":\n return _context44.stop();\n }\n }\n }, _callee44);\n }));\n return _retrieveSiteKey.apply(this, arguments);\n };\n\n retrieveSiteKey = function _retrieveSiteKey2(_x61) {\n return _retrieveSiteKey.apply(this, arguments);\n };\n\n action = _args45.length > 0 && _args45[0] !== undefined ? _args45[0] : 'verify';\n forceRefresh = _args45.length > 1 && _args45[1] !== undefined ? _args45[1] : false;\n return _context45.abrupt(\"return\", new Promise(function (resolve, reject) {\n retrieveSiteKey(_this11.auth).then(function (siteKey) {\n if (!forceRefresh && isEnterprise(window.grecaptcha)) {\n retrieveRecaptchaToken(siteKey, resolve, reject);\n } else {\n if (typeof window === 'undefined') {\n reject(new Error('RecaptchaVerifier is only supported in browser'));\n return;\n }\n\n var url = _recaptchaEnterpriseScriptUrl();\n\n if (url.length !== 0) {\n url += siteKey;\n }\n\n _loadJS(url).then(function () {\n retrieveRecaptchaToken(siteKey, resolve, reject);\n }).catch(function (error) {\n reject(error);\n });\n }\n }).catch(function (error) {\n reject(error);\n });\n }));\n\n case 6:\n case \"end\":\n return _context45.stop();\n }\n }\n }, _callee45);\n }));\n\n function verify() {\n return _verify.apply(this, arguments);\n }\n\n return verify;\n }()\n }]);\n\n return RecaptchaEnterpriseVerifier;\n}();\n\nfunction injectRecaptchaFields(_x64, _x65, _x66) {\n return _injectRecaptchaFields.apply(this, arguments);\n}\n\nfunction _injectRecaptchaFields() {\n _injectRecaptchaFields = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee118(auth, request, action) {\n var captchaResp,\n verifier,\n captchaResponse,\n newRequest,\n _args118 = arguments;\n return _regeneratorRuntime.wrap(function _callee118$(_context118) {\n while (1) {\n switch (_context118.prev = _context118.next) {\n case 0:\n captchaResp = _args118.length > 3 && _args118[3] !== undefined ? _args118[3] : false;\n verifier = new RecaptchaEnterpriseVerifier(auth);\n _context118.prev = 2;\n _context118.next = 5;\n return verifier.verify(action);\n\n case 5:\n captchaResponse = _context118.sent;\n _context118.next = 13;\n break;\n\n case 8:\n _context118.prev = 8;\n _context118.t0 = _context118[\"catch\"](2);\n _context118.next = 12;\n return verifier.verify(action, true);\n\n case 12:\n captchaResponse = _context118.sent;\n\n case 13:\n newRequest = Object.assign({}, request);\n\n if (!captchaResp) {\n Object.assign(newRequest, {\n captchaResponse: captchaResponse\n });\n } else {\n Object.assign(newRequest, {\n 'captchaResp': captchaResponse\n });\n }\n\n Object.assign(newRequest, {\n 'clientType': \"CLIENT_TYPE_WEB\"\n /* RecaptchaClientType.WEB */\n\n });\n Object.assign(newRequest, {\n 'recaptchaVersion': \"RECAPTCHA_ENTERPRISE\"\n /* RecaptchaVersion.ENTERPRISE */\n\n });\n return _context118.abrupt(\"return\", newRequest);\n\n case 18:\n case \"end\":\n return _context118.stop();\n }\n }\n }, _callee118, null, [[2, 8]]);\n }));\n return _injectRecaptchaFields.apply(this, arguments);\n}\n\nfunction handleRecaptchaFlow(_x67, _x68, _x69, _x70) {\n return _handleRecaptchaFlow.apply(this, arguments);\n}\n\nfunction _handleRecaptchaFlow() {\n _handleRecaptchaFlow = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee120(authInstance, request, actionName, actionMethod) {\n var _a, requestWithRecaptcha;\n\n return _regeneratorRuntime.wrap(function _callee120$(_context120) {\n while (1) {\n switch (_context120.prev = _context120.next) {\n case 0:\n if (!((_a = authInstance._getRecaptchaConfig()) === null || _a === void 0 ? void 0 : _a.isProviderEnabled(\"EMAIL_PASSWORD_PROVIDER\"\n /* RecaptchaProvider.EMAIL_PASSWORD_PROVIDER */\n ))) {\n _context120.next = 7;\n break;\n }\n\n _context120.next = 3;\n return injectRecaptchaFields(authInstance, request, actionName, actionName === \"getOobCode\"\n /* RecaptchaActionName.GET_OOB_CODE */\n );\n\n case 3:\n requestWithRecaptcha = _context120.sent;\n return _context120.abrupt(\"return\", actionMethod(authInstance, requestWithRecaptcha));\n\n case 7:\n return _context120.abrupt(\"return\", actionMethod(authInstance, request).catch( /*#__PURE__*/function () {\n var _ref42 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee119(error) {\n var _requestWithRecaptcha;\n\n return _regeneratorRuntime.wrap(function _callee119$(_context119) {\n while (1) {\n switch (_context119.prev = _context119.next) {\n case 0:\n if (!(error.code === \"auth/\".concat(\"missing-recaptcha-token\"\n /* AuthErrorCode.MISSING_RECAPTCHA_TOKEN */\n ))) {\n _context119.next = 8;\n break;\n }\n\n console.log(\"\".concat(actionName, \" is protected by reCAPTCHA Enterprise for this project. Automatically triggering the reCAPTCHA flow and restarting the flow.\"));\n _context119.next = 4;\n return injectRecaptchaFields(authInstance, request, actionName, actionName === \"getOobCode\"\n /* RecaptchaActionName.GET_OOB_CODE */\n );\n\n case 4:\n _requestWithRecaptcha = _context119.sent;\n return _context119.abrupt(\"return\", actionMethod(authInstance, _requestWithRecaptcha));\n\n case 8:\n return _context119.abrupt(\"return\", Promise.reject(error));\n\n case 9:\n case \"end\":\n return _context119.stop();\n }\n }\n }, _callee119);\n }));\n\n return function (_x285) {\n return _ref42.apply(this, arguments);\n };\n }()));\n\n case 8:\n case \"end\":\n return _context120.stop();\n }\n }\n }, _callee120);\n }));\n return _handleRecaptchaFlow.apply(this, arguments);\n}\n\nfunction _initializeRecaptchaConfig(_x71) {\n return _initializeRecaptchaConfig2.apply(this, arguments);\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 */\n\n/**\r\n * Initializes an {@link Auth} instance with fine-grained control over\r\n * {@link Dependencies}.\r\n *\r\n * @remarks\r\n *\r\n * This function allows more control over the {@link Auth} instance than\r\n * {@link getAuth}. `getAuth` uses platform-specific defaults to supply\r\n * the {@link Dependencies}. In general, `getAuth` is the easiest way to\r\n * initialize Auth and works for most use cases. Use `initializeAuth` if you\r\n * need control over which persistence layer is used, or to minimize bundle\r\n * size if you're not using either `signInWithPopup` or `signInWithRedirect`.\r\n *\r\n * For example, if your app only uses anonymous accounts and you only want\r\n * accounts saved for the current session, initialize `Auth` with:\r\n *\r\n * ```js\r\n * const auth = initializeAuth(app, {\r\n * persistence: browserSessionPersistence,\r\n * popupRedirectResolver: undefined,\r\n * });\r\n * ```\r\n *\r\n * @public\r\n */\n\n\nfunction _initializeRecaptchaConfig2() {\n _initializeRecaptchaConfig2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee121(auth) {\n var authInternal, response, config, verifier;\n return _regeneratorRuntime.wrap(function _callee121$(_context121) {\n while (1) {\n switch (_context121.prev = _context121.next) {\n case 0:\n authInternal = _castAuth(auth);\n _context121.next = 3;\n return getRecaptchaConfig(authInternal, {\n clientType: \"CLIENT_TYPE_WEB\"\n /* RecaptchaClientType.WEB */\n ,\n version: \"RECAPTCHA_ENTERPRISE\"\n /* RecaptchaVersion.ENTERPRISE */\n\n });\n\n case 3:\n response = _context121.sent;\n config = new RecaptchaConfig(response);\n\n if (authInternal.tenantId == null) {\n authInternal._agentRecaptchaConfig = config;\n } else {\n authInternal._tenantRecaptchaConfigs[authInternal.tenantId] = config;\n }\n\n if (config.isProviderEnabled(\"EMAIL_PASSWORD_PROVIDER\"\n /* RecaptchaProvider.EMAIL_PASSWORD_PROVIDER */\n )) {\n verifier = new RecaptchaEnterpriseVerifier(authInternal);\n void verifier.verify();\n }\n\n case 7:\n case \"end\":\n return _context121.stop();\n }\n }\n }, _callee121);\n }));\n return _initializeRecaptchaConfig2.apply(this, arguments);\n}\n\nfunction initializeAuth(app, deps) {\n var provider = _getProvider(app, 'auth');\n\n if (provider.isInitialized()) {\n var _auth2 = provider.getImmediate();\n\n var initialOptions = provider.getOptions();\n\n if (deepEqual(initialOptions, deps !== null && deps !== void 0 ? deps : {})) {\n return _auth2;\n } else {\n _fail(_auth2, \"already-initialized\"\n /* AuthErrorCode.ALREADY_INITIALIZED */\n );\n }\n }\n\n var auth = provider.initialize({\n options: deps\n });\n return auth;\n}\n\nfunction _initializeAuthInstance(auth, deps) {\n var persistence = (deps === null || deps === void 0 ? void 0 : deps.persistence) || [];\n var hierarchy = (Array.isArray(persistence) ? persistence : [persistence]).map(_getInstance);\n\n if (deps === null || deps === void 0 ? void 0 : deps.errorMap) {\n auth._updateErrorMap(deps.errorMap);\n } // This promise is intended to float; auth initialization happens in the\n // background, meanwhile the auth object may be used by the app.\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n\n\n auth._initializeWithPersistence(hierarchy, deps === null || deps === void 0 ? void 0 : deps.popupRedirectResolver);\n}\n/**\r\n * Changes the {@link Auth} instance to communicate with the Firebase Auth Emulator, instead of production\r\n * Firebase Auth services.\r\n *\r\n * @remarks\r\n * This must be called synchronously immediately following the first call to\r\n * {@link initializeAuth}. Do not use with production credentials as emulator\r\n * traffic is not encrypted.\r\n *\r\n *\r\n * @example\r\n * ```javascript\r\n * connectAuthEmulator(auth, 'http://127.0.0.1:9099', { disableWarnings: true });\r\n * ```\r\n *\r\n * @param auth - The {@link Auth} instance.\r\n * @param url - The URL at which the emulator is running (eg, 'http://localhost:9099').\r\n * @param options - Optional. `options.disableWarnings` defaults to `false`. Set it to\r\n * `true` to disable the warning banner attached to the DOM.\r\n *\r\n * @public\r\n */\n\n\nfunction connectAuthEmulator(auth, url, options) {\n var authInternal = _castAuth(auth);\n\n _assert(authInternal._canInitEmulator, authInternal, \"emulator-config-failed\"\n /* AuthErrorCode.EMULATOR_CONFIG_FAILED */\n );\n\n _assert(/^https?:\\/\\//.test(url), authInternal, \"invalid-emulator-scheme\"\n /* AuthErrorCode.INVALID_EMULATOR_SCHEME */\n );\n\n var disableWarnings = !!(options === null || options === void 0 ? void 0 : options.disableWarnings);\n var protocol = extractProtocol(url);\n\n var _extractHostAndPort = extractHostAndPort(url),\n host = _extractHostAndPort.host,\n port = _extractHostAndPort.port;\n\n var portStr = port === null ? '' : \":\".concat(port); // Always replace path with \"/\" (even if input url had no path at all, or had a different one).\n\n authInternal.config.emulator = {\n url: \"\".concat(protocol, \"//\").concat(host).concat(portStr, \"/\")\n };\n authInternal.settings.appVerificationDisabledForTesting = true;\n authInternal.emulatorConfig = Object.freeze({\n host: host,\n port: port,\n protocol: protocol.replace(':', ''),\n options: Object.freeze({\n disableWarnings: disableWarnings\n })\n });\n\n if (!disableWarnings) {\n emitEmulatorWarning();\n }\n}\n\nfunction extractProtocol(url) {\n var protocolEnd = url.indexOf(':');\n return protocolEnd < 0 ? '' : url.substr(0, protocolEnd + 1);\n}\n\nfunction extractHostAndPort(url) {\n var protocol = extractProtocol(url);\n var authority = /(\\/\\/)?([^?#/]+)/.exec(url.substr(protocol.length)); // Between // and /, ? or #.\n\n if (!authority) {\n return {\n host: '',\n port: null\n };\n }\n\n var hostAndPort = authority[2].split('@').pop() || ''; // Strip out \"username:password@\".\n\n var bracketedIPv6 = /^(\\[[^\\]]+\\])(:|$)/.exec(hostAndPort);\n\n if (bracketedIPv6) {\n var host = bracketedIPv6[1];\n return {\n host: host,\n port: parsePort(hostAndPort.substr(host.length + 1))\n };\n } else {\n var _hostAndPort$split = hostAndPort.split(':'),\n _hostAndPort$split2 = _slicedToArray(_hostAndPort$split, 2),\n _host = _hostAndPort$split2[0],\n port = _hostAndPort$split2[1];\n\n return {\n host: _host,\n port: parsePort(port)\n };\n }\n}\n\nfunction parsePort(portStr) {\n if (!portStr) {\n return null;\n }\n\n var port = Number(portStr);\n\n if (isNaN(port)) {\n return null;\n }\n\n return port;\n}\n\nfunction emitEmulatorWarning() {\n function attachBanner() {\n var el = document.createElement('p');\n var sty = el.style;\n el.innerText = 'Running in emulator mode. Do not use with production credentials.';\n sty.position = 'fixed';\n sty.width = '100%';\n sty.backgroundColor = '#ffffff';\n sty.border = '.1em solid #000000';\n sty.color = '#b50000';\n sty.bottom = '0px';\n sty.left = '0px';\n sty.margin = '0px';\n sty.zIndex = '10000';\n sty.textAlign = 'center';\n el.classList.add('firebase-emulator-warning');\n document.body.appendChild(el);\n }\n\n if (typeof console !== 'undefined' && typeof console.info === 'function') {\n console.info('WARNING: You are using the Auth Emulator,' + ' which is intended for local testing only. Do not use with' + ' production credentials.');\n }\n\n if (typeof window !== 'undefined' && typeof document !== 'undefined') {\n if (document.readyState === 'loading') {\n window.addEventListener('DOMContentLoaded', attachBanner);\n } else {\n attachBanner();\n }\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 */\n\n/**\r\n * Interface that represents the credentials returned by an {@link AuthProvider}.\r\n *\r\n * @remarks\r\n * Implementations specify the details about each auth provider's credential requirements.\r\n *\r\n * @public\r\n */\n\n\nvar AuthCredential = /*#__PURE__*/function () {\n /** @internal */\n function AuthCredential(\n /**\r\n * The authentication provider ID for the credential.\r\n *\r\n * @remarks\r\n * For example, 'facebook.com', or 'google.com'.\r\n */\n providerId,\n /**\r\n * The authentication sign in method for the credential.\r\n *\r\n * @remarks\r\n * For example, {@link SignInMethod}.EMAIL_PASSWORD, or\r\n * {@link SignInMethod}.EMAIL_LINK. This corresponds to the sign-in method\r\n * identifier as returned in {@link fetchSignInMethodsForEmail}.\r\n */\n signInMethod) {\n _classCallCheck(this, AuthCredential);\n\n this.providerId = providerId;\n this.signInMethod = signInMethod;\n }\n /**\r\n * Returns a JSON-serializable representation of this object.\r\n *\r\n * @returns a JSON-serializable representation of this object.\r\n */\n\n\n _createClass(AuthCredential, [{\n key: \"toJSON\",\n value: function toJSON() {\n return debugFail('not implemented');\n }\n /** @internal */\n\n }, {\n key: \"_getIdTokenResponse\",\n value: function _getIdTokenResponse(_auth) {\n return debugFail('not implemented');\n }\n /** @internal */\n\n }, {\n key: \"_linkToIdToken\",\n value: function _linkToIdToken(_auth, _idToken) {\n return debugFail('not implemented');\n }\n /** @internal */\n\n }, {\n key: \"_getReauthenticationResolver\",\n value: function _getReauthenticationResolver(_auth) {\n return debugFail('not implemented');\n }\n }]);\n\n return AuthCredential;\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 */\n\n\nfunction resetPassword(_x72, _x73) {\n return _resetPassword.apply(this, arguments);\n}\n\nfunction _resetPassword() {\n _resetPassword = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee122(auth, request) {\n return _regeneratorRuntime.wrap(function _callee122$(_context122) {\n while (1) {\n switch (_context122.prev = _context122.next) {\n case 0:\n return _context122.abrupt(\"return\", _performApiRequest(auth, \"POST\"\n /* HttpMethod.POST */\n , \"/v1/accounts:resetPassword\"\n /* Endpoint.RESET_PASSWORD */\n , _addTidIfNecessary(auth, request)));\n\n case 1:\n case \"end\":\n return _context122.stop();\n }\n }\n }, _callee122);\n }));\n return _resetPassword.apply(this, arguments);\n}\n\nfunction updateEmailPassword(_x74, _x75) {\n return _updateEmailPassword.apply(this, arguments);\n} // Used for linking an email/password account to an existing idToken. Uses the same request/response\n// format as updateEmailPassword.\n\n\nfunction _updateEmailPassword() {\n _updateEmailPassword = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee123(auth, request) {\n return _regeneratorRuntime.wrap(function _callee123$(_context123) {\n while (1) {\n switch (_context123.prev = _context123.next) {\n case 0:\n return _context123.abrupt(\"return\", _performApiRequest(auth, \"POST\"\n /* HttpMethod.POST */\n , \"/v1/accounts:update\"\n /* Endpoint.SET_ACCOUNT_INFO */\n , request));\n\n case 1:\n case \"end\":\n return _context123.stop();\n }\n }\n }, _callee123);\n }));\n return _updateEmailPassword.apply(this, arguments);\n}\n\nfunction linkEmailPassword(_x76, _x77) {\n return _linkEmailPassword.apply(this, arguments);\n}\n\nfunction _linkEmailPassword() {\n _linkEmailPassword = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee124(auth, request) {\n return _regeneratorRuntime.wrap(function _callee124$(_context124) {\n while (1) {\n switch (_context124.prev = _context124.next) {\n case 0:\n return _context124.abrupt(\"return\", _performApiRequest(auth, \"POST\"\n /* HttpMethod.POST */\n , \"/v1/accounts:signUp\"\n /* Endpoint.SIGN_UP */\n , request));\n\n case 1:\n case \"end\":\n return _context124.stop();\n }\n }\n }, _callee124);\n }));\n return _linkEmailPassword.apply(this, arguments);\n}\n\nfunction applyActionCode$1(_x78, _x79) {\n return _applyActionCode$.apply(this, arguments);\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 */\n\n\nfunction _applyActionCode$() {\n _applyActionCode$ = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee125(auth, request) {\n return _regeneratorRuntime.wrap(function _callee125$(_context125) {\n while (1) {\n switch (_context125.prev = _context125.next) {\n case 0:\n return _context125.abrupt(\"return\", _performApiRequest(auth, \"POST\"\n /* HttpMethod.POST */\n , \"/v1/accounts:update\"\n /* Endpoint.SET_ACCOUNT_INFO */\n , _addTidIfNecessary(auth, request)));\n\n case 1:\n case \"end\":\n return _context125.stop();\n }\n }\n }, _callee125);\n }));\n return _applyActionCode$.apply(this, arguments);\n}\n\nfunction signInWithPassword(_x80, _x81) {\n return _signInWithPassword.apply(this, arguments);\n}\n\nfunction _signInWithPassword() {\n _signInWithPassword = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee126(auth, request) {\n return _regeneratorRuntime.wrap(function _callee126$(_context126) {\n while (1) {\n switch (_context126.prev = _context126.next) {\n case 0:\n return _context126.abrupt(\"return\", _performSignInRequest(auth, \"POST\"\n /* HttpMethod.POST */\n , \"/v1/accounts:signInWithPassword\"\n /* Endpoint.SIGN_IN_WITH_PASSWORD */\n , _addTidIfNecessary(auth, request)));\n\n case 1:\n case \"end\":\n return _context126.stop();\n }\n }\n }, _callee126);\n }));\n return _signInWithPassword.apply(this, arguments);\n}\n\nfunction sendOobCode(_x82, _x83) {\n return _sendOobCode.apply(this, arguments);\n}\n\nfunction _sendOobCode() {\n _sendOobCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee127(auth, request) {\n return _regeneratorRuntime.wrap(function _callee127$(_context127) {\n while (1) {\n switch (_context127.prev = _context127.next) {\n case 0:\n return _context127.abrupt(\"return\", _performApiRequest(auth, \"POST\"\n /* HttpMethod.POST */\n , \"/v1/accounts:sendOobCode\"\n /* Endpoint.SEND_OOB_CODE */\n , _addTidIfNecessary(auth, request)));\n\n case 1:\n case \"end\":\n return _context127.stop();\n }\n }\n }, _callee127);\n }));\n return _sendOobCode.apply(this, arguments);\n}\n\nfunction sendEmailVerification$1(_x84, _x85) {\n return _sendEmailVerification$.apply(this, arguments);\n}\n\nfunction _sendEmailVerification$() {\n _sendEmailVerification$ = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee128(auth, request) {\n return _regeneratorRuntime.wrap(function _callee128$(_context128) {\n while (1) {\n switch (_context128.prev = _context128.next) {\n case 0:\n return _context128.abrupt(\"return\", sendOobCode(auth, request));\n\n case 1:\n case \"end\":\n return _context128.stop();\n }\n }\n }, _callee128);\n }));\n return _sendEmailVerification$.apply(this, arguments);\n}\n\nfunction sendPasswordResetEmail$1(_x86, _x87) {\n return _sendPasswordResetEmail$.apply(this, arguments);\n}\n\nfunction _sendPasswordResetEmail$() {\n _sendPasswordResetEmail$ = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee129(auth, request) {\n return _regeneratorRuntime.wrap(function _callee129$(_context129) {\n while (1) {\n switch (_context129.prev = _context129.next) {\n case 0:\n return _context129.abrupt(\"return\", sendOobCode(auth, request));\n\n case 1:\n case \"end\":\n return _context129.stop();\n }\n }\n }, _callee129);\n }));\n return _sendPasswordResetEmail$.apply(this, arguments);\n}\n\nfunction sendSignInLinkToEmail$1(_x88, _x89) {\n return _sendSignInLinkToEmail$.apply(this, arguments);\n}\n\nfunction _sendSignInLinkToEmail$() {\n _sendSignInLinkToEmail$ = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee130(auth, request) {\n return _regeneratorRuntime.wrap(function _callee130$(_context130) {\n while (1) {\n switch (_context130.prev = _context130.next) {\n case 0:\n return _context130.abrupt(\"return\", sendOobCode(auth, request));\n\n case 1:\n case \"end\":\n return _context130.stop();\n }\n }\n }, _callee130);\n }));\n return _sendSignInLinkToEmail$.apply(this, arguments);\n}\n\nfunction verifyAndChangeEmail(_x90, _x91) {\n return _verifyAndChangeEmail.apply(this, arguments);\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 */\n\n\nfunction _verifyAndChangeEmail() {\n _verifyAndChangeEmail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee131(auth, request) {\n return _regeneratorRuntime.wrap(function _callee131$(_context131) {\n while (1) {\n switch (_context131.prev = _context131.next) {\n case 0:\n return _context131.abrupt(\"return\", sendOobCode(auth, request));\n\n case 1:\n case \"end\":\n return _context131.stop();\n }\n }\n }, _callee131);\n }));\n return _verifyAndChangeEmail.apply(this, arguments);\n}\n\nfunction signInWithEmailLink$1(_x92, _x93) {\n return _signInWithEmailLink$.apply(this, arguments);\n}\n\nfunction _signInWithEmailLink$() {\n _signInWithEmailLink$ = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee132(auth, request) {\n return _regeneratorRuntime.wrap(function _callee132$(_context132) {\n while (1) {\n switch (_context132.prev = _context132.next) {\n case 0:\n return _context132.abrupt(\"return\", _performSignInRequest(auth, \"POST\"\n /* HttpMethod.POST */\n , \"/v1/accounts:signInWithEmailLink\"\n /* Endpoint.SIGN_IN_WITH_EMAIL_LINK */\n , _addTidIfNecessary(auth, request)));\n\n case 1:\n case \"end\":\n return _context132.stop();\n }\n }\n }, _callee132);\n }));\n return _signInWithEmailLink$.apply(this, arguments);\n}\n\nfunction signInWithEmailLinkForLinking(_x94, _x95) {\n return _signInWithEmailLinkForLinking.apply(this, arguments);\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 */\n\n/**\r\n * Interface that represents the credentials returned by {@link EmailAuthProvider} for\r\n * {@link ProviderId}.PASSWORD\r\n *\r\n * @remarks\r\n * Covers both {@link SignInMethod}.EMAIL_PASSWORD and\r\n * {@link SignInMethod}.EMAIL_LINK.\r\n *\r\n * @public\r\n */\n\n\nfunction _signInWithEmailLinkForLinking() {\n _signInWithEmailLinkForLinking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee133(auth, request) {\n return _regeneratorRuntime.wrap(function _callee133$(_context133) {\n while (1) {\n switch (_context133.prev = _context133.next) {\n case 0:\n return _context133.abrupt(\"return\", _performSignInRequest(auth, \"POST\"\n /* HttpMethod.POST */\n , \"/v1/accounts:signInWithEmailLink\"\n /* Endpoint.SIGN_IN_WITH_EMAIL_LINK */\n , _addTidIfNecessary(auth, request)));\n\n case 1:\n case \"end\":\n return _context133.stop();\n }\n }\n }, _callee133);\n }));\n return _signInWithEmailLinkForLinking.apply(this, arguments);\n}\n\nvar EmailAuthCredential = /*#__PURE__*/function (_AuthCredential) {\n _inherits(EmailAuthCredential, _AuthCredential);\n\n var _super = _createSuper(EmailAuthCredential);\n\n /** @internal */\n function EmailAuthCredential(\n /** @internal */\n _email,\n /** @internal */\n _password, signInMethod) {\n var _this12;\n\n var _tenantId = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;\n\n _classCallCheck(this, EmailAuthCredential);\n\n _this12 = _super.call(this, \"password\"\n /* ProviderId.PASSWORD */\n , signInMethod);\n _this12._email = _email;\n _this12._password = _password;\n _this12._tenantId = _tenantId;\n return _this12;\n }\n /** @internal */\n\n\n _createClass(EmailAuthCredential, [{\n key: \"toJSON\",\n value:\n /** {@inheritdoc AuthCredential.toJSON} */\n function toJSON() {\n return {\n email: this._email,\n password: this._password,\n signInMethod: this.signInMethod,\n tenantId: this._tenantId\n };\n }\n /**\r\n * Static method to deserialize a JSON representation of an object into an {@link AuthCredential}.\r\n *\r\n * @param json - Either `object` or the stringified representation of the object. When string is\r\n * provided, `JSON.parse` would be called first.\r\n *\r\n * @returns If the JSON input does not represent an {@link AuthCredential}, null is returned.\r\n */\n\n }, {\n key: \"_getIdTokenResponse\",\n value:\n /** @internal */\n function () {\n var _getIdTokenResponse2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee46(auth) {\n var request;\n return _regeneratorRuntime.wrap(function _callee46$(_context46) {\n while (1) {\n switch (_context46.prev = _context46.next) {\n case 0:\n _context46.t0 = this.signInMethod;\n _context46.next = _context46.t0 === \"password\"\n /* SignInMethod.EMAIL_PASSWORD */\n ? 3 : _context46.t0 === \"emailLink\"\n /* SignInMethod.EMAIL_LINK */\n ? 5 : 6;\n break;\n\n case 3:\n request = {\n returnSecureToken: true,\n email: this._email,\n password: this._password,\n clientType: \"CLIENT_TYPE_WEB\"\n /* RecaptchaClientType.WEB */\n\n };\n return _context46.abrupt(\"return\", handleRecaptchaFlow(auth, request, \"signInWithPassword\"\n /* RecaptchaActionName.SIGN_IN_WITH_PASSWORD */\n , signInWithPassword));\n\n case 5:\n return _context46.abrupt(\"return\", signInWithEmailLink$1(auth, {\n email: this._email,\n oobCode: this._password\n }));\n\n case 6:\n _fail(auth, \"internal-error\"\n /* AuthErrorCode.INTERNAL_ERROR */\n );\n\n case 7:\n case \"end\":\n return _context46.stop();\n }\n }\n }, _callee46, this);\n }));\n\n function _getIdTokenResponse(_x96) {\n return _getIdTokenResponse2.apply(this, arguments);\n }\n\n return _getIdTokenResponse;\n }()\n /** @internal */\n\n }, {\n key: \"_linkToIdToken\",\n value: function () {\n var _linkToIdToken2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee47(auth, idToken) {\n var request;\n return _regeneratorRuntime.wrap(function _callee47$(_context47) {\n while (1) {\n switch (_context47.prev = _context47.next) {\n case 0:\n _context47.t0 = this.signInMethod;\n _context47.next = _context47.t0 === \"password\"\n /* SignInMethod.EMAIL_PASSWORD */\n ? 3 : _context47.t0 === \"emailLink\"\n /* SignInMethod.EMAIL_LINK */\n ? 5 : 6;\n break;\n\n case 3:\n request = {\n idToken: idToken,\n returnSecureToken: true,\n email: this._email,\n password: this._password,\n clientType: \"CLIENT_TYPE_WEB\"\n /* RecaptchaClientType.WEB */\n\n };\n return _context47.abrupt(\"return\", handleRecaptchaFlow(auth, request, \"signUpPassword\"\n /* RecaptchaActionName.SIGN_UP_PASSWORD */\n , linkEmailPassword));\n\n case 5:\n return _context47.abrupt(\"return\", signInWithEmailLinkForLinking(auth, {\n idToken: idToken,\n email: this._email,\n oobCode: this._password\n }));\n\n case 6:\n _fail(auth, \"internal-error\"\n /* AuthErrorCode.INTERNAL_ERROR */\n );\n\n case 7:\n case \"end\":\n return _context47.stop();\n }\n }\n }, _callee47, this);\n }));\n\n function _linkToIdToken(_x97, _x98) {\n return _linkToIdToken2.apply(this, arguments);\n }\n\n return _linkToIdToken;\n }()\n /** @internal */\n\n }, {\n key: \"_getReauthenticationResolver\",\n value: function _getReauthenticationResolver(auth) {\n return this._getIdTokenResponse(auth);\n }\n }], [{\n key: \"_fromEmailAndPassword\",\n value: function _fromEmailAndPassword(email, password) {\n return new EmailAuthCredential(email, password, \"password\"\n /* SignInMethod.EMAIL_PASSWORD */\n );\n }\n /** @internal */\n\n }, {\n key: \"_fromEmailAndCode\",\n value: function _fromEmailAndCode(email, oobCode) {\n var tenantId = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;\n return new EmailAuthCredential(email, oobCode, \"emailLink\"\n /* SignInMethod.EMAIL_LINK */\n , tenantId);\n }\n }, {\n key: \"fromJSON\",\n value: function fromJSON(json) {\n var obj = typeof json === 'string' ? JSON.parse(json) : json;\n\n if ((obj === null || obj === void 0 ? void 0 : obj.email) && (obj === null || obj === void 0 ? void 0 : obj.password)) {\n if (obj.signInMethod === \"password\"\n /* SignInMethod.EMAIL_PASSWORD */\n ) {\n return this._fromEmailAndPassword(obj.email, obj.password);\n } else if (obj.signInMethod === \"emailLink\"\n /* SignInMethod.EMAIL_LINK */\n ) {\n return this._fromEmailAndCode(obj.email, obj.password, obj.tenantId);\n }\n }\n\n return null;\n }\n }]);\n\n return EmailAuthCredential;\n}(AuthCredential);\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 */\n\n\nfunction signInWithIdp(_x99, _x100) {\n return _signInWithIdp.apply(this, arguments);\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 */\n\n\nfunction _signInWithIdp() {\n _signInWithIdp = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee134(auth, request) {\n return _regeneratorRuntime.wrap(function _callee134$(_context134) {\n while (1) {\n switch (_context134.prev = _context134.next) {\n case 0:\n return _context134.abrupt(\"return\", _performSignInRequest(auth, \"POST\"\n /* HttpMethod.POST */\n , \"/v1/accounts:signInWithIdp\"\n /* Endpoint.SIGN_IN_WITH_IDP */\n , _addTidIfNecessary(auth, request)));\n\n case 1:\n case \"end\":\n return _context134.stop();\n }\n }\n }, _callee134);\n }));\n return _signInWithIdp.apply(this, arguments);\n}\n\nvar IDP_REQUEST_URI$1 = 'http://localhost';\n/**\r\n * Represents the OAuth credentials returned by an {@link OAuthProvider}.\r\n *\r\n * @remarks\r\n * Implementations specify the details about each auth provider's credential requirements.\r\n *\r\n * @public\r\n */\n\nvar OAuthCredential = /*#__PURE__*/function (_AuthCredential2) {\n _inherits(OAuthCredential, _AuthCredential2);\n\n var _super2 = _createSuper(OAuthCredential);\n\n function OAuthCredential() {\n var _this13;\n\n _classCallCheck(this, OAuthCredential);\n\n _this13 = _super2.apply(this, arguments);\n _this13.pendingToken = null;\n return _this13;\n }\n /** @internal */\n\n\n _createClass(OAuthCredential, [{\n key: \"toJSON\",\n value:\n /** {@inheritdoc AuthCredential.toJSON} */\n function toJSON() {\n return {\n idToken: this.idToken,\n accessToken: this.accessToken,\n secret: this.secret,\n nonce: this.nonce,\n pendingToken: this.pendingToken,\n providerId: this.providerId,\n signInMethod: this.signInMethod\n };\n }\n /**\r\n * Static method to deserialize a JSON representation of an object into an\r\n * {@link AuthCredential}.\r\n *\r\n * @param json - Input can be either Object or the stringified representation of the object.\r\n * When string is provided, JSON.parse would be called first.\r\n *\r\n * @returns If the JSON input does not represent an {@link AuthCredential}, null is returned.\r\n */\n\n }, {\n key: \"_getIdTokenResponse\",\n value:\n /** @internal */\n function _getIdTokenResponse(auth) {\n var request = this.buildRequest();\n return signInWithIdp(auth, request);\n }\n /** @internal */\n\n }, {\n key: \"_linkToIdToken\",\n value: function _linkToIdToken(auth, idToken) {\n var request = this.buildRequest();\n request.idToken = idToken;\n return signInWithIdp(auth, request);\n }\n /** @internal */\n\n }, {\n key: \"_getReauthenticationResolver\",\n value: function _getReauthenticationResolver(auth) {\n var request = this.buildRequest();\n request.autoCreate = false;\n return signInWithIdp(auth, request);\n }\n }, {\n key: \"buildRequest\",\n value: function buildRequest() {\n var request = {\n requestUri: IDP_REQUEST_URI$1,\n returnSecureToken: true\n };\n\n if (this.pendingToken) {\n request.pendingToken = this.pendingToken;\n } else {\n var postBody = {};\n\n if (this.idToken) {\n postBody['id_token'] = this.idToken;\n }\n\n if (this.accessToken) {\n postBody['access_token'] = this.accessToken;\n }\n\n if (this.secret) {\n postBody['oauth_token_secret'] = this.secret;\n }\n\n postBody['providerId'] = this.providerId;\n\n if (this.nonce && !this.pendingToken) {\n postBody['nonce'] = this.nonce;\n }\n\n request.postBody = querystring(postBody);\n }\n\n return request;\n }\n }], [{\n key: \"_fromParams\",\n value: function _fromParams(params) {\n var cred = new OAuthCredential(params.providerId, params.signInMethod);\n\n if (params.idToken || params.accessToken) {\n // OAuth 2 and either ID token or access token.\n if (params.idToken) {\n cred.idToken = params.idToken;\n }\n\n if (params.accessToken) {\n cred.accessToken = params.accessToken;\n } // Add nonce if available and no pendingToken is present.\n\n\n if (params.nonce && !params.pendingToken) {\n cred.nonce = params.nonce;\n }\n\n if (params.pendingToken) {\n cred.pendingToken = params.pendingToken;\n }\n } else if (params.oauthToken && params.oauthTokenSecret) {\n // OAuth 1 and OAuth token with token secret\n cred.accessToken = params.oauthToken;\n cred.secret = params.oauthTokenSecret;\n } else {\n _fail(\"argument-error\"\n /* AuthErrorCode.ARGUMENT_ERROR */\n );\n }\n\n return cred;\n }\n }, {\n key: \"fromJSON\",\n value: function fromJSON(json) {\n var obj = typeof json === 'string' ? JSON.parse(json) : json;\n\n var providerId = obj.providerId,\n signInMethod = obj.signInMethod,\n rest = __rest(obj, [\"providerId\", \"signInMethod\"]);\n\n if (!providerId || !signInMethod) {\n return null;\n }\n\n var cred = new OAuthCredential(providerId, signInMethod);\n cred.idToken = rest.idToken || undefined;\n cred.accessToken = rest.accessToken || undefined;\n cred.secret = rest.secret;\n cred.nonce = rest.nonce;\n cred.pendingToken = rest.pendingToken || null;\n return cred;\n }\n }]);\n\n return OAuthCredential;\n}(AuthCredential);\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 */\n\n\nfunction sendPhoneVerificationCode(_x101, _x102) {\n return _sendPhoneVerificationCode.apply(this, arguments);\n}\n\nfunction _sendPhoneVerificationCode() {\n _sendPhoneVerificationCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee135(auth, request) {\n return _regeneratorRuntime.wrap(function _callee135$(_context135) {\n while (1) {\n switch (_context135.prev = _context135.next) {\n case 0:\n return _context135.abrupt(\"return\", _performApiRequest(auth, \"POST\"\n /* HttpMethod.POST */\n , \"/v1/accounts:sendVerificationCode\"\n /* Endpoint.SEND_VERIFICATION_CODE */\n , _addTidIfNecessary(auth, request)));\n\n case 1:\n case \"end\":\n return _context135.stop();\n }\n }\n }, _callee135);\n }));\n return _sendPhoneVerificationCode.apply(this, arguments);\n}\n\nfunction signInWithPhoneNumber$1(_x103, _x104) {\n return _signInWithPhoneNumber$.apply(this, arguments);\n}\n\nfunction _signInWithPhoneNumber$() {\n _signInWithPhoneNumber$ = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee136(auth, request) {\n return _regeneratorRuntime.wrap(function _callee136$(_context136) {\n while (1) {\n switch (_context136.prev = _context136.next) {\n case 0:\n return _context136.abrupt(\"return\", _performSignInRequest(auth, \"POST\"\n /* HttpMethod.POST */\n , \"/v1/accounts:signInWithPhoneNumber\"\n /* Endpoint.SIGN_IN_WITH_PHONE_NUMBER */\n , _addTidIfNecessary(auth, request)));\n\n case 1:\n case \"end\":\n return _context136.stop();\n }\n }\n }, _callee136);\n }));\n return _signInWithPhoneNumber$.apply(this, arguments);\n}\n\nfunction linkWithPhoneNumber$1(_x105, _x106) {\n return _linkWithPhoneNumber$.apply(this, arguments);\n}\n\nfunction _linkWithPhoneNumber$() {\n _linkWithPhoneNumber$ = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee137(auth, request) {\n var response;\n return _regeneratorRuntime.wrap(function _callee137$(_context137) {\n while (1) {\n switch (_context137.prev = _context137.next) {\n case 0:\n _context137.next = 2;\n return _performSignInRequest(auth, \"POST\"\n /* HttpMethod.POST */\n , \"/v1/accounts:signInWithPhoneNumber\"\n /* Endpoint.SIGN_IN_WITH_PHONE_NUMBER */\n , _addTidIfNecessary(auth, request));\n\n case 2:\n response = _context137.sent;\n\n if (!response.temporaryProof) {\n _context137.next = 5;\n break;\n }\n\n throw _makeTaggedError(auth, \"account-exists-with-different-credential\"\n /* AuthErrorCode.NEED_CONFIRMATION */\n , response);\n\n case 5:\n return _context137.abrupt(\"return\", response);\n\n case 6:\n case \"end\":\n return _context137.stop();\n }\n }\n }, _callee137);\n }));\n return _linkWithPhoneNumber$.apply(this, arguments);\n}\n\nvar VERIFY_PHONE_NUMBER_FOR_EXISTING_ERROR_MAP_ = _defineProperty({}, \"USER_NOT_FOUND\"\n/* ServerError.USER_NOT_FOUND */\n, \"user-not-found\");\n\nfunction verifyPhoneNumberForExisting(_x107, _x108) {\n return _verifyPhoneNumberForExisting.apply(this, arguments);\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 */\n\n/**\r\n * Represents the credentials returned by {@link PhoneAuthProvider}.\r\n *\r\n * @public\r\n */\n\n\nfunction _verifyPhoneNumberForExisting() {\n _verifyPhoneNumberForExisting = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee138(auth, request) {\n var apiRequest;\n return _regeneratorRuntime.wrap(function _callee138$(_context138) {\n while (1) {\n switch (_context138.prev = _context138.next) {\n case 0:\n apiRequest = Object.assign(Object.assign({}, request), {\n operation: 'REAUTH'\n });\n return _context138.abrupt(\"return\", _performSignInRequest(auth, \"POST\"\n /* HttpMethod.POST */\n , \"/v1/accounts:signInWithPhoneNumber\"\n /* Endpoint.SIGN_IN_WITH_PHONE_NUMBER */\n , _addTidIfNecessary(auth, apiRequest), VERIFY_PHONE_NUMBER_FOR_EXISTING_ERROR_MAP_));\n\n case 2:\n case \"end\":\n return _context138.stop();\n }\n }\n }, _callee138);\n }));\n return _verifyPhoneNumberForExisting.apply(this, arguments);\n}\n\nvar PhoneAuthCredential = /*#__PURE__*/function (_AuthCredential3) {\n _inherits(PhoneAuthCredential, _AuthCredential3);\n\n var _super3 = _createSuper(PhoneAuthCredential);\n\n function PhoneAuthCredential(params) {\n var _this14;\n\n _classCallCheck(this, PhoneAuthCredential);\n\n _this14 = _super3.call(this, \"phone\"\n /* ProviderId.PHONE */\n , \"phone\"\n /* SignInMethod.PHONE */\n );\n _this14.params = params;\n return _this14;\n }\n /** @internal */\n\n\n _createClass(PhoneAuthCredential, [{\n key: \"_getIdTokenResponse\",\n value:\n /** @internal */\n function _getIdTokenResponse(auth) {\n return signInWithPhoneNumber$1(auth, this._makeVerificationRequest());\n }\n /** @internal */\n\n }, {\n key: \"_linkToIdToken\",\n value: function _linkToIdToken(auth, idToken) {\n return linkWithPhoneNumber$1(auth, Object.assign({\n idToken: idToken\n }, this._makeVerificationRequest()));\n }\n /** @internal */\n\n }, {\n key: \"_getReauthenticationResolver\",\n value: function _getReauthenticationResolver(auth) {\n return verifyPhoneNumberForExisting(auth, this._makeVerificationRequest());\n }\n /** @internal */\n\n }, {\n key: \"_makeVerificationRequest\",\n value: function _makeVerificationRequest() {\n var _this$params = this.params,\n temporaryProof = _this$params.temporaryProof,\n phoneNumber = _this$params.phoneNumber,\n verificationId = _this$params.verificationId,\n verificationCode = _this$params.verificationCode;\n\n if (temporaryProof && phoneNumber) {\n return {\n temporaryProof: temporaryProof,\n phoneNumber: phoneNumber\n };\n }\n\n return {\n sessionInfo: verificationId,\n code: verificationCode\n };\n }\n /** {@inheritdoc AuthCredential.toJSON} */\n\n }, {\n key: \"toJSON\",\n value: function toJSON() {\n var obj = {\n providerId: this.providerId\n };\n\n if (this.params.phoneNumber) {\n obj.phoneNumber = this.params.phoneNumber;\n }\n\n if (this.params.temporaryProof) {\n obj.temporaryProof = this.params.temporaryProof;\n }\n\n if (this.params.verificationCode) {\n obj.verificationCode = this.params.verificationCode;\n }\n\n if (this.params.verificationId) {\n obj.verificationId = this.params.verificationId;\n }\n\n return obj;\n }\n /** Generates a phone credential based on a plain object or a JSON string. */\n\n }], [{\n key: \"_fromVerification\",\n value: function _fromVerification(verificationId, verificationCode) {\n return new PhoneAuthCredential({\n verificationId: verificationId,\n verificationCode: verificationCode\n });\n }\n /** @internal */\n\n }, {\n key: \"_fromTokenResponse\",\n value: function _fromTokenResponse(phoneNumber, temporaryProof) {\n return new PhoneAuthCredential({\n phoneNumber: phoneNumber,\n temporaryProof: temporaryProof\n });\n }\n }, {\n key: \"fromJSON\",\n value: function fromJSON(json) {\n if (typeof json === 'string') {\n json = JSON.parse(json);\n }\n\n var _json = json,\n verificationId = _json.verificationId,\n verificationCode = _json.verificationCode,\n phoneNumber = _json.phoneNumber,\n temporaryProof = _json.temporaryProof;\n\n if (!verificationCode && !verificationId && !phoneNumber && !temporaryProof) {\n return null;\n }\n\n return new PhoneAuthCredential({\n verificationId: verificationId,\n verificationCode: verificationCode,\n phoneNumber: phoneNumber,\n temporaryProof: temporaryProof\n });\n }\n }]);\n\n return PhoneAuthCredential;\n}(AuthCredential);\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 */\n\n/**\r\n * Maps the mode string in action code URL to Action Code Info operation.\r\n *\r\n * @param mode\r\n */\n\n\nfunction parseMode(mode) {\n switch (mode) {\n case 'recoverEmail':\n return \"RECOVER_EMAIL\"\n /* ActionCodeOperation.RECOVER_EMAIL */\n ;\n\n case 'resetPassword':\n return \"PASSWORD_RESET\"\n /* ActionCodeOperation.PASSWORD_RESET */\n ;\n\n case 'signIn':\n return \"EMAIL_SIGNIN\"\n /* ActionCodeOperation.EMAIL_SIGNIN */\n ;\n\n case 'verifyEmail':\n return \"VERIFY_EMAIL\"\n /* ActionCodeOperation.VERIFY_EMAIL */\n ;\n\n case 'verifyAndChangeEmail':\n return \"VERIFY_AND_CHANGE_EMAIL\"\n /* ActionCodeOperation.VERIFY_AND_CHANGE_EMAIL */\n ;\n\n case 'revertSecondFactorAddition':\n return \"REVERT_SECOND_FACTOR_ADDITION\"\n /* ActionCodeOperation.REVERT_SECOND_FACTOR_ADDITION */\n ;\n\n default:\n return null;\n }\n}\n/**\r\n * Helper to parse FDL links\r\n *\r\n * @param url\r\n */\n\n\nfunction parseDeepLink(url) {\n var link = querystringDecode(extractQuerystring(url))['link']; // Double link case (automatic redirect).\n\n var doubleDeepLink = link ? querystringDecode(extractQuerystring(link))['deep_link_id'] : null; // iOS custom scheme links.\n\n var iOSDeepLink = querystringDecode(extractQuerystring(url))['deep_link_id'];\n var iOSDoubleDeepLink = iOSDeepLink ? querystringDecode(extractQuerystring(iOSDeepLink))['link'] : null;\n return iOSDoubleDeepLink || iOSDeepLink || doubleDeepLink || link || url;\n}\n/**\r\n * A utility class to parse email action URLs such as password reset, email verification,\r\n * email link sign in, etc.\r\n *\r\n * @public\r\n */\n\n\nvar ActionCodeURL = /*#__PURE__*/function () {\n /**\r\n * @param actionLink - The link from which to extract the URL.\r\n * @returns The {@link ActionCodeURL} object, or null if the link is invalid.\r\n *\r\n * @internal\r\n */\n function ActionCodeURL(actionLink) {\n _classCallCheck(this, ActionCodeURL);\n\n var _a, _b, _c, _d, _e, _f;\n\n var searchParams = querystringDecode(extractQuerystring(actionLink));\n var apiKey = (_a = searchParams[\"apiKey\"\n /* QueryField.API_KEY */\n ]) !== null && _a !== void 0 ? _a : null;\n var code = (_b = searchParams[\"oobCode\"\n /* QueryField.CODE */\n ]) !== null && _b !== void 0 ? _b : null;\n var operation = parseMode((_c = searchParams[\"mode\"\n /* QueryField.MODE */\n ]) !== null && _c !== void 0 ? _c : null); // Validate API key, code and mode.\n\n _assert(apiKey && code && operation, \"argument-error\"\n /* AuthErrorCode.ARGUMENT_ERROR */\n );\n\n this.apiKey = apiKey;\n this.operation = operation;\n this.code = code;\n this.continueUrl = (_d = searchParams[\"continueUrl\"\n /* QueryField.CONTINUE_URL */\n ]) !== null && _d !== void 0 ? _d : null;\n this.languageCode = (_e = searchParams[\"languageCode\"\n /* QueryField.LANGUAGE_CODE */\n ]) !== null && _e !== void 0 ? _e : null;\n this.tenantId = (_f = searchParams[\"tenantId\"\n /* QueryField.TENANT_ID */\n ]) !== null && _f !== void 0 ? _f : null;\n }\n /**\r\n * Parses the email action link string and returns an {@link ActionCodeURL} if the link is valid,\r\n * otherwise returns null.\r\n *\r\n * @param link - The email action link string.\r\n * @returns The {@link ActionCodeURL} object, or null if the link is invalid.\r\n *\r\n * @public\r\n */\n\n\n _createClass(ActionCodeURL, null, [{\n key: \"parseLink\",\n value: function parseLink(link) {\n var actionLink = parseDeepLink(link);\n\n try {\n return new ActionCodeURL(actionLink);\n } catch (_a) {\n return null;\n }\n }\n }]);\n\n return ActionCodeURL;\n}();\n/**\r\n * Parses the email action link string and returns an {@link ActionCodeURL} if\r\n * the link is valid, otherwise returns null.\r\n *\r\n * @public\r\n */\n\n\nfunction parseActionCodeURL(link) {\n return ActionCodeURL.parseLink(link);\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 */\n\n/**\r\n * Provider for generating {@link EmailAuthCredential}.\r\n *\r\n * @public\r\n */\n\n\nvar EmailAuthProvider = /*#__PURE__*/function () {\n function EmailAuthProvider() {\n _classCallCheck(this, EmailAuthProvider);\n\n /**\r\n * Always set to {@link ProviderId}.PASSWORD, even for email link.\r\n */\n this.providerId = EmailAuthProvider.PROVIDER_ID;\n }\n /**\r\n * Initialize an {@link AuthCredential} using an email and password.\r\n *\r\n * @example\r\n * ```javascript\r\n * const authCredential = EmailAuthProvider.credential(email, password);\r\n * const userCredential = await signInWithCredential(auth, authCredential);\r\n * ```\r\n *\r\n * @example\r\n * ```javascript\r\n * const userCredential = await signInWithEmailAndPassword(auth, email, password);\r\n * ```\r\n *\r\n * @param email - Email address.\r\n * @param password - User account password.\r\n * @returns The auth provider credential.\r\n */\n\n\n _createClass(EmailAuthProvider, null, [{\n key: \"credential\",\n value: function credential(email, password) {\n return EmailAuthCredential._fromEmailAndPassword(email, password);\n }\n /**\r\n * Initialize an {@link AuthCredential} using an email and an email link after a sign in with\r\n * email link operation.\r\n *\r\n * @example\r\n * ```javascript\r\n * const authCredential = EmailAuthProvider.credentialWithLink(auth, email, emailLink);\r\n * const userCredential = await signInWithCredential(auth, authCredential);\r\n * ```\r\n *\r\n * @example\r\n * ```javascript\r\n * await sendSignInLinkToEmail(auth, email);\r\n * // Obtain emailLink from user.\r\n * const userCredential = await signInWithEmailLink(auth, email, emailLink);\r\n * ```\r\n *\r\n * @param auth - The {@link Auth} instance used to verify the link.\r\n * @param email - Email address.\r\n * @param emailLink - Sign-in email link.\r\n * @returns - The auth provider credential.\r\n */\n\n }, {\n key: \"credentialWithLink\",\n value: function credentialWithLink(email, emailLink) {\n var actionCodeUrl = ActionCodeURL.parseLink(emailLink);\n\n _assert(actionCodeUrl, \"argument-error\"\n /* AuthErrorCode.ARGUMENT_ERROR */\n );\n\n return EmailAuthCredential._fromEmailAndCode(email, actionCodeUrl.code, actionCodeUrl.tenantId);\n }\n }]);\n\n return EmailAuthProvider;\n}();\n/**\r\n * Always set to {@link ProviderId}.PASSWORD, even for email link.\r\n */\n\n\nEmailAuthProvider.PROVIDER_ID = \"password\"\n/* ProviderId.PASSWORD */\n;\n/**\r\n * Always set to {@link SignInMethod}.EMAIL_PASSWORD.\r\n */\n\nEmailAuthProvider.EMAIL_PASSWORD_SIGN_IN_METHOD = \"password\"\n/* SignInMethod.EMAIL_PASSWORD */\n;\n/**\r\n * Always set to {@link SignInMethod}.EMAIL_LINK.\r\n */\n\nEmailAuthProvider.EMAIL_LINK_SIGN_IN_METHOD = \"emailLink\"\n/* SignInMethod.EMAIL_LINK */\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 */\n\n/**\r\n * The base class for all Federated providers (OAuth (including OIDC), SAML).\r\n *\r\n * This class is not meant to be instantiated directly.\r\n *\r\n * @public\r\n */\n\nvar FederatedAuthProvider = /*#__PURE__*/function () {\n /**\r\n * Constructor for generic OAuth providers.\r\n *\r\n * @param providerId - Provider for which credentials should be generated.\r\n */\n function FederatedAuthProvider(providerId) {\n _classCallCheck(this, FederatedAuthProvider);\n\n this.providerId = providerId;\n /** @internal */\n\n this.defaultLanguageCode = null;\n /** @internal */\n\n this.customParameters = {};\n }\n /**\r\n * Set the language gode.\r\n *\r\n * @param languageCode - language code\r\n */\n\n\n _createClass(FederatedAuthProvider, [{\n key: \"setDefaultLanguage\",\n value: function setDefaultLanguage(languageCode) {\n this.defaultLanguageCode = languageCode;\n }\n /**\r\n * Sets the OAuth custom parameters to pass in an OAuth request for popup and redirect sign-in\r\n * operations.\r\n *\r\n * @remarks\r\n * For a detailed list, check the reserved required OAuth 2.0 parameters such as `client_id`,\r\n * `redirect_uri`, `scope`, `response_type`, and `state` are not allowed and will be ignored.\r\n *\r\n * @param customOAuthParameters - The custom OAuth parameters to pass in the OAuth request.\r\n */\n\n }, {\n key: \"setCustomParameters\",\n value: function setCustomParameters(customOAuthParameters) {\n this.customParameters = customOAuthParameters;\n return this;\n }\n /**\r\n * Retrieve the current list of {@link CustomParameters}.\r\n */\n\n }, {\n key: \"getCustomParameters\",\n value: function getCustomParameters() {\n return this.customParameters;\n }\n }]);\n\n return FederatedAuthProvider;\n}();\n/**\r\n * @license\r\n * Copyright 2019 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 */\n\n/**\r\n * Common code to all OAuth providers. This is separate from the\r\n * {@link OAuthProvider} so that child providers (like\r\n * {@link GoogleAuthProvider}) don't inherit the `credential` instance method.\r\n * Instead, they rely on a static `credential` method.\r\n */\n\n\nvar BaseOAuthProvider = /*#__PURE__*/function (_FederatedAuthProvide) {\n _inherits(BaseOAuthProvider, _FederatedAuthProvide);\n\n var _super4 = _createSuper(BaseOAuthProvider);\n\n function BaseOAuthProvider() {\n var _this15;\n\n _classCallCheck(this, BaseOAuthProvider);\n\n _this15 = _super4.apply(this, arguments);\n /** @internal */\n\n _this15.scopes = [];\n return _this15;\n }\n /**\r\n * Add an OAuth scope to the credential.\r\n *\r\n * @param scope - Provider OAuth scope to add.\r\n */\n\n\n _createClass(BaseOAuthProvider, [{\n key: \"addScope\",\n value: function addScope(scope) {\n // If not already added, add scope to list.\n if (!this.scopes.includes(scope)) {\n this.scopes.push(scope);\n }\n\n return this;\n }\n /**\r\n * Retrieve the current list of OAuth scopes.\r\n */\n\n }, {\n key: \"getScopes\",\n value: function getScopes() {\n return _toConsumableArray(this.scopes);\n }\n }]);\n\n return BaseOAuthProvider;\n}(FederatedAuthProvider);\n/**\r\n * Provider for generating generic {@link OAuthCredential}.\r\n *\r\n * @example\r\n * ```javascript\r\n * // Sign in using a redirect.\r\n * const provider = new OAuthProvider('google.com');\r\n * // Start a sign in process for an unauthenticated user.\r\n * provider.addScope('profile');\r\n * provider.addScope('email');\r\n * await signInWithRedirect(auth, provider);\r\n * // This will trigger a full page redirect away from your app\r\n *\r\n * // After returning from the redirect when your app initializes you can obtain the result\r\n * const result = await getRedirectResult(auth);\r\n * if (result) {\r\n * // This is the signed-in user\r\n * const user = result.user;\r\n * // This gives you a OAuth Access Token for the provider.\r\n * const credential = provider.credentialFromResult(auth, result);\r\n * const token = credential.accessToken;\r\n * }\r\n * ```\r\n *\r\n * @example\r\n * ```javascript\r\n * // Sign in using a popup.\r\n * const provider = new OAuthProvider('google.com');\r\n * provider.addScope('profile');\r\n * provider.addScope('email');\r\n * const result = await signInWithPopup(auth, provider);\r\n *\r\n * // The signed-in user info.\r\n * const user = result.user;\r\n * // This gives you a OAuth Access Token for the provider.\r\n * const credential = provider.credentialFromResult(auth, result);\r\n * const token = credential.accessToken;\r\n * ```\r\n * @public\r\n */\n\n\nvar OAuthProvider = /*#__PURE__*/function (_BaseOAuthProvider) {\n _inherits(OAuthProvider, _BaseOAuthProvider);\n\n var _super5 = _createSuper(OAuthProvider);\n\n function OAuthProvider() {\n _classCallCheck(this, OAuthProvider);\n\n return _super5.apply(this, arguments);\n }\n\n _createClass(OAuthProvider, [{\n key: \"credential\",\n value:\n /**\r\n * Creates a {@link OAuthCredential} from a generic OAuth provider's access token or ID token.\r\n *\r\n * @remarks\r\n * The raw nonce is required when an ID token with a nonce field is provided. The SHA-256 hash of\r\n * the raw nonce must match the nonce field in the ID token.\r\n *\r\n * @example\r\n * ```javascript\r\n * // `googleUser` from the onsuccess Google Sign In callback.\r\n * // Initialize a generate OAuth provider with a `google.com` providerId.\r\n * const provider = new OAuthProvider('google.com');\r\n * const credential = provider.credential({\r\n * idToken: googleUser.getAuthResponse().id_token,\r\n * });\r\n * const result = await signInWithCredential(credential);\r\n * ```\r\n *\r\n * @param params - Either the options object containing the ID token, access token and raw nonce\r\n * or the ID token string.\r\n */\n function credential(params) {\n return this._credential(Object.assign(Object.assign({}, params), {\n nonce: params.rawNonce\n }));\n }\n /** An internal credential method that accepts more permissive options */\n\n }, {\n key: \"_credential\",\n value: function _credential(params) {\n _assert(params.idToken || params.accessToken, \"argument-error\"\n /* AuthErrorCode.ARGUMENT_ERROR */\n ); // For OAuthCredential, sign in method is same as providerId.\n\n\n return OAuthCredential._fromParams(Object.assign(Object.assign({}, params), {\n providerId: this.providerId,\n signInMethod: this.providerId\n }));\n }\n /**\r\n * Used to extract the underlying {@link OAuthCredential} from a {@link UserCredential}.\r\n *\r\n * @param userCredential - The user credential.\r\n */\n\n }], [{\n key: \"credentialFromJSON\",\n value:\n /**\r\n * Creates an {@link OAuthCredential} from a JSON string or a plain object.\r\n * @param json - A plain object or a JSON string\r\n */\n function credentialFromJSON(json) {\n var obj = typeof json === 'string' ? JSON.parse(json) : json;\n\n _assert('providerId' in obj && 'signInMethod' in obj, \"argument-error\"\n /* AuthErrorCode.ARGUMENT_ERROR */\n );\n\n return OAuthCredential._fromParams(obj);\n }\n }, {\n key: \"credentialFromResult\",\n value: function credentialFromResult(userCredential) {\n return OAuthProvider.oauthCredentialFromTaggedObject(userCredential);\n }\n /**\r\n * Used to extract the underlying {@link OAuthCredential} from a {@link AuthError} which was\r\n * thrown during a sign-in, link, or reauthenticate operation.\r\n *\r\n * @param userCredential - The user credential.\r\n */\n\n }, {\n key: \"credentialFromError\",\n value: function credentialFromError(error) {\n return OAuthProvider.oauthCredentialFromTaggedObject(error.customData || {});\n }\n }, {\n key: \"oauthCredentialFromTaggedObject\",\n value: function oauthCredentialFromTaggedObject(_ref13) {\n var tokenResponse = _ref13._tokenResponse;\n\n if (!tokenResponse) {\n return null;\n }\n\n var oauthIdToken = tokenResponse.oauthIdToken,\n oauthAccessToken = tokenResponse.oauthAccessToken,\n oauthTokenSecret = tokenResponse.oauthTokenSecret,\n pendingToken = tokenResponse.pendingToken,\n nonce = tokenResponse.nonce,\n providerId = tokenResponse.providerId;\n\n if (!oauthAccessToken && !oauthTokenSecret && !oauthIdToken && !pendingToken) {\n return null;\n }\n\n if (!providerId) {\n return null;\n }\n\n try {\n return new OAuthProvider(providerId)._credential({\n idToken: oauthIdToken,\n accessToken: oauthAccessToken,\n nonce: nonce,\n pendingToken: pendingToken\n });\n } catch (e) {\n return null;\n }\n }\n }]);\n\n return OAuthProvider;\n}(BaseOAuthProvider);\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 */\n\n/**\r\n * Provider for generating an {@link OAuthCredential} for {@link ProviderId}.FACEBOOK.\r\n *\r\n * @example\r\n * ```javascript\r\n * // Sign in using a redirect.\r\n * const provider = new FacebookAuthProvider();\r\n * // Start a sign in process for an unauthenticated user.\r\n * provider.addScope('user_birthday');\r\n * await signInWithRedirect(auth, provider);\r\n * // This will trigger a full page redirect away from your app\r\n *\r\n * // After returning from the redirect when your app initializes you can obtain the result\r\n * const result = await getRedirectResult(auth);\r\n * if (result) {\r\n * // This is the signed-in user\r\n * const user = result.user;\r\n * // This gives you a Facebook Access Token.\r\n * const credential = FacebookAuthProvider.credentialFromResult(result);\r\n * const token = credential.accessToken;\r\n * }\r\n * ```\r\n *\r\n * @example\r\n * ```javascript\r\n * // Sign in using a popup.\r\n * const provider = new FacebookAuthProvider();\r\n * provider.addScope('user_birthday');\r\n * const result = await signInWithPopup(auth, provider);\r\n *\r\n * // The signed-in user info.\r\n * const user = result.user;\r\n * // This gives you a Facebook Access Token.\r\n * const credential = FacebookAuthProvider.credentialFromResult(result);\r\n * const token = credential.accessToken;\r\n * ```\r\n *\r\n * @public\r\n */\n\n\nvar FacebookAuthProvider = /*#__PURE__*/function (_BaseOAuthProvider2) {\n _inherits(FacebookAuthProvider, _BaseOAuthProvider2);\n\n var _super6 = _createSuper(FacebookAuthProvider);\n\n function FacebookAuthProvider() {\n _classCallCheck(this, FacebookAuthProvider);\n\n return _super6.call(this, \"facebook.com\"\n /* ProviderId.FACEBOOK */\n );\n }\n /**\r\n * Creates a credential for Facebook.\r\n *\r\n * @example\r\n * ```javascript\r\n * // `event` from the Facebook auth.authResponseChange callback.\r\n * const credential = FacebookAuthProvider.credential(event.authResponse.accessToken);\r\n * const result = await signInWithCredential(credential);\r\n * ```\r\n *\r\n * @param accessToken - Facebook access token.\r\n */\n\n\n _createClass(FacebookAuthProvider, null, [{\n key: \"credential\",\n value: function credential(accessToken) {\n return OAuthCredential._fromParams({\n providerId: FacebookAuthProvider.PROVIDER_ID,\n signInMethod: FacebookAuthProvider.FACEBOOK_SIGN_IN_METHOD,\n accessToken: accessToken\n });\n }\n /**\r\n * Used to extract the underlying {@link OAuthCredential} from a {@link UserCredential}.\r\n *\r\n * @param userCredential - The user credential.\r\n */\n\n }, {\n key: \"credentialFromResult\",\n value: function credentialFromResult(userCredential) {\n return FacebookAuthProvider.credentialFromTaggedObject(userCredential);\n }\n /**\r\n * Used to extract the underlying {@link OAuthCredential} from a {@link AuthError} which was\r\n * thrown during a sign-in, link, or reauthenticate operation.\r\n *\r\n * @param userCredential - The user credential.\r\n */\n\n }, {\n key: \"credentialFromError\",\n value: function credentialFromError(error) {\n return FacebookAuthProvider.credentialFromTaggedObject(error.customData || {});\n }\n }, {\n key: \"credentialFromTaggedObject\",\n value: function credentialFromTaggedObject(_ref14) {\n var tokenResponse = _ref14._tokenResponse;\n\n if (!tokenResponse || !('oauthAccessToken' in tokenResponse)) {\n return null;\n }\n\n if (!tokenResponse.oauthAccessToken) {\n return null;\n }\n\n try {\n return FacebookAuthProvider.credential(tokenResponse.oauthAccessToken);\n } catch (_a) {\n return null;\n }\n }\n }]);\n\n return FacebookAuthProvider;\n}(BaseOAuthProvider);\n/** Always set to {@link SignInMethod}.FACEBOOK. */\n\n\nFacebookAuthProvider.FACEBOOK_SIGN_IN_METHOD = \"facebook.com\"\n/* SignInMethod.FACEBOOK */\n;\n/** Always set to {@link ProviderId}.FACEBOOK. */\n\nFacebookAuthProvider.PROVIDER_ID = \"facebook.com\"\n/* ProviderId.FACEBOOK */\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 */\n\n/**\r\n * Provider for generating an {@link OAuthCredential} for {@link ProviderId}.GOOGLE.\r\n *\r\n * @example\r\n * ```javascript\r\n * // Sign in using a redirect.\r\n * const provider = new GoogleAuthProvider();\r\n * // Start a sign in process for an unauthenticated user.\r\n * provider.addScope('profile');\r\n * provider.addScope('email');\r\n * await signInWithRedirect(auth, provider);\r\n * // This will trigger a full page redirect away from your app\r\n *\r\n * // After returning from the redirect when your app initializes you can obtain the result\r\n * const result = await getRedirectResult(auth);\r\n * if (result) {\r\n * // This is the signed-in user\r\n * const user = result.user;\r\n * // This gives you a Google Access Token.\r\n * const credential = GoogleAuthProvider.credentialFromResult(result);\r\n * const token = credential.accessToken;\r\n * }\r\n * ```\r\n *\r\n * @example\r\n * ```javascript\r\n * // Sign in using a popup.\r\n * const provider = new GoogleAuthProvider();\r\n * provider.addScope('profile');\r\n * provider.addScope('email');\r\n * const result = await signInWithPopup(auth, provider);\r\n *\r\n * // The signed-in user info.\r\n * const user = result.user;\r\n * // This gives you a Google Access Token.\r\n * const credential = GoogleAuthProvider.credentialFromResult(result);\r\n * const token = credential.accessToken;\r\n * ```\r\n *\r\n * @public\r\n */\n\nvar GoogleAuthProvider = /*#__PURE__*/function (_BaseOAuthProvider3) {\n _inherits(GoogleAuthProvider, _BaseOAuthProvider3);\n\n var _super7 = _createSuper(GoogleAuthProvider);\n\n function GoogleAuthProvider() {\n var _this16;\n\n _classCallCheck(this, GoogleAuthProvider);\n\n _this16 = _super7.call(this, \"google.com\"\n /* ProviderId.GOOGLE */\n );\n\n _this16.addScope('profile');\n\n return _this16;\n }\n /**\r\n * Creates a credential for Google. At least one of ID token and access token is required.\r\n *\r\n * @example\r\n * ```javascript\r\n * // \\`googleUser\\` from the onsuccess Google Sign In callback.\r\n * const credential = GoogleAuthProvider.credential(googleUser.getAuthResponse().id_token);\r\n * const result = await signInWithCredential(credential);\r\n * ```\r\n *\r\n * @param idToken - Google ID token.\r\n * @param accessToken - Google access token.\r\n */\n\n\n _createClass(GoogleAuthProvider, null, [{\n key: \"credential\",\n value: function credential(idToken, accessToken) {\n return OAuthCredential._fromParams({\n providerId: GoogleAuthProvider.PROVIDER_ID,\n signInMethod: GoogleAuthProvider.GOOGLE_SIGN_IN_METHOD,\n idToken: idToken,\n accessToken: accessToken\n });\n }\n /**\r\n * Used to extract the underlying {@link OAuthCredential} from a {@link UserCredential}.\r\n *\r\n * @param userCredential - The user credential.\r\n */\n\n }, {\n key: \"credentialFromResult\",\n value: function credentialFromResult(userCredential) {\n return GoogleAuthProvider.credentialFromTaggedObject(userCredential);\n }\n /**\r\n * Used to extract the underlying {@link OAuthCredential} from a {@link AuthError} which was\r\n * thrown during a sign-in, link, or reauthenticate operation.\r\n *\r\n * @param userCredential - The user credential.\r\n */\n\n }, {\n key: \"credentialFromError\",\n value: function credentialFromError(error) {\n return GoogleAuthProvider.credentialFromTaggedObject(error.customData || {});\n }\n }, {\n key: \"credentialFromTaggedObject\",\n value: function credentialFromTaggedObject(_ref15) {\n var tokenResponse = _ref15._tokenResponse;\n\n if (!tokenResponse) {\n return null;\n }\n\n var oauthIdToken = tokenResponse.oauthIdToken,\n oauthAccessToken = tokenResponse.oauthAccessToken;\n\n if (!oauthIdToken && !oauthAccessToken) {\n // This could be an oauth 1 credential or a phone credential\n return null;\n }\n\n try {\n return GoogleAuthProvider.credential(oauthIdToken, oauthAccessToken);\n } catch (_a) {\n return null;\n }\n }\n }]);\n\n return GoogleAuthProvider;\n}(BaseOAuthProvider);\n/** Always set to {@link SignInMethod}.GOOGLE. */\n\n\nGoogleAuthProvider.GOOGLE_SIGN_IN_METHOD = \"google.com\"\n/* SignInMethod.GOOGLE */\n;\n/** Always set to {@link ProviderId}.GOOGLE. */\n\nGoogleAuthProvider.PROVIDER_ID = \"google.com\"\n/* ProviderId.GOOGLE */\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 */\n\n/**\r\n * Provider for generating an {@link OAuthCredential} for {@link ProviderId}.GITHUB.\r\n *\r\n * @remarks\r\n * GitHub requires an OAuth 2.0 redirect, so you can either handle the redirect directly, or use\r\n * the {@link signInWithPopup} handler:\r\n *\r\n * @example\r\n * ```javascript\r\n * // Sign in using a redirect.\r\n * const provider = new GithubAuthProvider();\r\n * // Start a sign in process for an unauthenticated user.\r\n * provider.addScope('repo');\r\n * await signInWithRedirect(auth, provider);\r\n * // This will trigger a full page redirect away from your app\r\n *\r\n * // After returning from the redirect when your app initializes you can obtain the result\r\n * const result = await getRedirectResult(auth);\r\n * if (result) {\r\n * // This is the signed-in user\r\n * const user = result.user;\r\n * // This gives you a Github Access Token.\r\n * const credential = GithubAuthProvider.credentialFromResult(result);\r\n * const token = credential.accessToken;\r\n * }\r\n * ```\r\n *\r\n * @example\r\n * ```javascript\r\n * // Sign in using a popup.\r\n * const provider = new GithubAuthProvider();\r\n * provider.addScope('repo');\r\n * const result = await signInWithPopup(auth, provider);\r\n *\r\n * // The signed-in user info.\r\n * const user = result.user;\r\n * // This gives you a Github Access Token.\r\n * const credential = GithubAuthProvider.credentialFromResult(result);\r\n * const token = credential.accessToken;\r\n * ```\r\n * @public\r\n */\n\nvar GithubAuthProvider = /*#__PURE__*/function (_BaseOAuthProvider4) {\n _inherits(GithubAuthProvider, _BaseOAuthProvider4);\n\n var _super8 = _createSuper(GithubAuthProvider);\n\n function GithubAuthProvider() {\n _classCallCheck(this, GithubAuthProvider);\n\n return _super8.call(this, \"github.com\"\n /* ProviderId.GITHUB */\n );\n }\n /**\r\n * Creates a credential for Github.\r\n *\r\n * @param accessToken - Github access token.\r\n */\n\n\n _createClass(GithubAuthProvider, null, [{\n key: \"credential\",\n value: function credential(accessToken) {\n return OAuthCredential._fromParams({\n providerId: GithubAuthProvider.PROVIDER_ID,\n signInMethod: GithubAuthProvider.GITHUB_SIGN_IN_METHOD,\n accessToken: accessToken\n });\n }\n /**\r\n * Used to extract the underlying {@link OAuthCredential} from a {@link UserCredential}.\r\n *\r\n * @param userCredential - The user credential.\r\n */\n\n }, {\n key: \"credentialFromResult\",\n value: function credentialFromResult(userCredential) {\n return GithubAuthProvider.credentialFromTaggedObject(userCredential);\n }\n /**\r\n * Used to extract the underlying {@link OAuthCredential} from a {@link AuthError} which was\r\n * thrown during a sign-in, link, or reauthenticate operation.\r\n *\r\n * @param userCredential - The user credential.\r\n */\n\n }, {\n key: \"credentialFromError\",\n value: function credentialFromError(error) {\n return GithubAuthProvider.credentialFromTaggedObject(error.customData || {});\n }\n }, {\n key: \"credentialFromTaggedObject\",\n value: function credentialFromTaggedObject(_ref16) {\n var tokenResponse = _ref16._tokenResponse;\n\n if (!tokenResponse || !('oauthAccessToken' in tokenResponse)) {\n return null;\n }\n\n if (!tokenResponse.oauthAccessToken) {\n return null;\n }\n\n try {\n return GithubAuthProvider.credential(tokenResponse.oauthAccessToken);\n } catch (_a) {\n return null;\n }\n }\n }]);\n\n return GithubAuthProvider;\n}(BaseOAuthProvider);\n/** Always set to {@link SignInMethod}.GITHUB. */\n\n\nGithubAuthProvider.GITHUB_SIGN_IN_METHOD = \"github.com\"\n/* SignInMethod.GITHUB */\n;\n/** Always set to {@link ProviderId}.GITHUB. */\n\nGithubAuthProvider.PROVIDER_ID = \"github.com\"\n/* ProviderId.GITHUB */\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 */\n\nvar IDP_REQUEST_URI = 'http://localhost';\n/**\r\n * @public\r\n */\n\nvar SAMLAuthCredential = /*#__PURE__*/function (_AuthCredential4) {\n _inherits(SAMLAuthCredential, _AuthCredential4);\n\n var _super9 = _createSuper(SAMLAuthCredential);\n\n /** @internal */\n function SAMLAuthCredential(providerId, pendingToken) {\n var _this17;\n\n _classCallCheck(this, SAMLAuthCredential);\n\n _this17 = _super9.call(this, providerId, providerId);\n _this17.pendingToken = pendingToken;\n return _this17;\n }\n /** @internal */\n\n\n _createClass(SAMLAuthCredential, [{\n key: \"_getIdTokenResponse\",\n value: function _getIdTokenResponse(auth) {\n var request = this.buildRequest();\n return signInWithIdp(auth, request);\n }\n /** @internal */\n\n }, {\n key: \"_linkToIdToken\",\n value: function _linkToIdToken(auth, idToken) {\n var request = this.buildRequest();\n request.idToken = idToken;\n return signInWithIdp(auth, request);\n }\n /** @internal */\n\n }, {\n key: \"_getReauthenticationResolver\",\n value: function _getReauthenticationResolver(auth) {\n var request = this.buildRequest();\n request.autoCreate = false;\n return signInWithIdp(auth, request);\n }\n /** {@inheritdoc AuthCredential.toJSON} */\n\n }, {\n key: \"toJSON\",\n value: function toJSON() {\n return {\n signInMethod: this.signInMethod,\n providerId: this.providerId,\n pendingToken: this.pendingToken\n };\n }\n /**\r\n * Static method to deserialize a JSON representation of an object into an\r\n * {@link AuthCredential}.\r\n *\r\n * @param json - Input can be either Object or the stringified representation of the object.\r\n * When string is provided, JSON.parse would be called first.\r\n *\r\n * @returns If the JSON input does not represent an {@link AuthCredential}, null is returned.\r\n */\n\n }, {\n key: \"buildRequest\",\n value: function buildRequest() {\n return {\n requestUri: IDP_REQUEST_URI,\n returnSecureToken: true,\n pendingToken: this.pendingToken\n };\n }\n }], [{\n key: \"fromJSON\",\n value: function fromJSON(json) {\n var obj = typeof json === 'string' ? JSON.parse(json) : json;\n var providerId = obj.providerId,\n signInMethod = obj.signInMethod,\n pendingToken = obj.pendingToken;\n\n if (!providerId || !signInMethod || !pendingToken || providerId !== signInMethod) {\n return null;\n }\n\n return new SAMLAuthCredential(providerId, pendingToken);\n }\n /**\r\n * Helper static method to avoid exposing the constructor to end users.\r\n *\r\n * @internal\r\n */\n\n }, {\n key: \"_create\",\n value: function _create(providerId, pendingToken) {\n return new SAMLAuthCredential(providerId, pendingToken);\n }\n }]);\n\n return SAMLAuthCredential;\n}(AuthCredential);\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 */\n\n\nvar SAML_PROVIDER_PREFIX = 'saml.';\n/**\r\n * An {@link AuthProvider} for SAML.\r\n *\r\n * @public\r\n */\n\nvar SAMLAuthProvider = /*#__PURE__*/function (_FederatedAuthProvide2) {\n _inherits(SAMLAuthProvider, _FederatedAuthProvide2);\n\n var _super10 = _createSuper(SAMLAuthProvider);\n\n /**\r\n * Constructor. The providerId must start with \"saml.\"\r\n * @param providerId - SAML provider ID.\r\n */\n function SAMLAuthProvider(providerId) {\n _classCallCheck(this, SAMLAuthProvider);\n\n _assert(providerId.startsWith(SAML_PROVIDER_PREFIX), \"argument-error\"\n /* AuthErrorCode.ARGUMENT_ERROR */\n );\n\n return _super10.call(this, providerId);\n }\n /**\r\n * Generates an {@link AuthCredential} from a {@link UserCredential} after a\r\n * successful SAML flow completes.\r\n *\r\n * @remarks\r\n *\r\n * For example, to get an {@link AuthCredential}, you could write the\r\n * following code:\r\n *\r\n * ```js\r\n * const userCredential = await signInWithPopup(auth, samlProvider);\r\n * const credential = SAMLAuthProvider.credentialFromResult(userCredential);\r\n * ```\r\n *\r\n * @param userCredential - The user credential.\r\n */\n\n\n _createClass(SAMLAuthProvider, null, [{\n key: \"credentialFromResult\",\n value: function credentialFromResult(userCredential) {\n return SAMLAuthProvider.samlCredentialFromTaggedObject(userCredential);\n }\n /**\r\n * Used to extract the underlying {@link OAuthCredential} from a {@link AuthError} which was\r\n * thrown during a sign-in, link, or reauthenticate operation.\r\n *\r\n * @param userCredential - The user credential.\r\n */\n\n }, {\n key: \"credentialFromError\",\n value: function credentialFromError(error) {\n return SAMLAuthProvider.samlCredentialFromTaggedObject(error.customData || {});\n }\n /**\r\n * Creates an {@link AuthCredential} from a JSON string or a plain object.\r\n * @param json - A plain object or a JSON string\r\n */\n\n }, {\n key: \"credentialFromJSON\",\n value: function credentialFromJSON(json) {\n var credential = SAMLAuthCredential.fromJSON(json);\n\n _assert(credential, \"argument-error\"\n /* AuthErrorCode.ARGUMENT_ERROR */\n );\n\n return credential;\n }\n }, {\n key: \"samlCredentialFromTaggedObject\",\n value: function samlCredentialFromTaggedObject(_ref17) {\n var tokenResponse = _ref17._tokenResponse;\n\n if (!tokenResponse) {\n return null;\n }\n\n var pendingToken = tokenResponse.pendingToken,\n providerId = tokenResponse.providerId;\n\n if (!pendingToken || !providerId) {\n return null;\n }\n\n try {\n return SAMLAuthCredential._create(providerId, pendingToken);\n } catch (e) {\n return null;\n }\n }\n }]);\n\n return SAMLAuthProvider;\n}(FederatedAuthProvider);\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 */\n\n/**\r\n * Provider for generating an {@link OAuthCredential} for {@link ProviderId}.TWITTER.\r\n *\r\n * @example\r\n * ```javascript\r\n * // Sign in using a redirect.\r\n * const provider = new TwitterAuthProvider();\r\n * // Start a sign in process for an unauthenticated user.\r\n * await signInWithRedirect(auth, provider);\r\n * // This will trigger a full page redirect away from your app\r\n *\r\n * // After returning from the redirect when your app initializes you can obtain the result\r\n * const result = await getRedirectResult(auth);\r\n * if (result) {\r\n * // This is the signed-in user\r\n * const user = result.user;\r\n * // This gives you a Twitter Access Token and Secret.\r\n * const credential = TwitterAuthProvider.credentialFromResult(result);\r\n * const token = credential.accessToken;\r\n * const secret = credential.secret;\r\n * }\r\n * ```\r\n *\r\n * @example\r\n * ```javascript\r\n * // Sign in using a popup.\r\n * const provider = new TwitterAuthProvider();\r\n * const result = await signInWithPopup(auth, provider);\r\n *\r\n * // The signed-in user info.\r\n * const user = result.user;\r\n * // This gives you a Twitter Access Token and Secret.\r\n * const credential = TwitterAuthProvider.credentialFromResult(result);\r\n * const token = credential.accessToken;\r\n * const secret = credential.secret;\r\n * ```\r\n *\r\n * @public\r\n */\n\n\nvar TwitterAuthProvider = /*#__PURE__*/function (_BaseOAuthProvider5) {\n _inherits(TwitterAuthProvider, _BaseOAuthProvider5);\n\n var _super11 = _createSuper(TwitterAuthProvider);\n\n function TwitterAuthProvider() {\n _classCallCheck(this, TwitterAuthProvider);\n\n return _super11.call(this, \"twitter.com\"\n /* ProviderId.TWITTER */\n );\n }\n /**\r\n * Creates a credential for Twitter.\r\n *\r\n * @param token - Twitter access token.\r\n * @param secret - Twitter secret.\r\n */\n\n\n _createClass(TwitterAuthProvider, null, [{\n key: \"credential\",\n value: function credential(token, secret) {\n return OAuthCredential._fromParams({\n providerId: TwitterAuthProvider.PROVIDER_ID,\n signInMethod: TwitterAuthProvider.TWITTER_SIGN_IN_METHOD,\n oauthToken: token,\n oauthTokenSecret: secret\n });\n }\n /**\r\n * Used to extract the underlying {@link OAuthCredential} from a {@link UserCredential}.\r\n *\r\n * @param userCredential - The user credential.\r\n */\n\n }, {\n key: \"credentialFromResult\",\n value: function credentialFromResult(userCredential) {\n return TwitterAuthProvider.credentialFromTaggedObject(userCredential);\n }\n /**\r\n * Used to extract the underlying {@link OAuthCredential} from a {@link AuthError} which was\r\n * thrown during a sign-in, link, or reauthenticate operation.\r\n *\r\n * @param userCredential - The user credential.\r\n */\n\n }, {\n key: \"credentialFromError\",\n value: function credentialFromError(error) {\n return TwitterAuthProvider.credentialFromTaggedObject(error.customData || {});\n }\n }, {\n key: \"credentialFromTaggedObject\",\n value: function credentialFromTaggedObject(_ref18) {\n var tokenResponse = _ref18._tokenResponse;\n\n if (!tokenResponse) {\n return null;\n }\n\n var oauthAccessToken = tokenResponse.oauthAccessToken,\n oauthTokenSecret = tokenResponse.oauthTokenSecret;\n\n if (!oauthAccessToken || !oauthTokenSecret) {\n return null;\n }\n\n try {\n return TwitterAuthProvider.credential(oauthAccessToken, oauthTokenSecret);\n } catch (_a) {\n return null;\n }\n }\n }]);\n\n return TwitterAuthProvider;\n}(BaseOAuthProvider);\n/** Always set to {@link SignInMethod}.TWITTER. */\n\n\nTwitterAuthProvider.TWITTER_SIGN_IN_METHOD = \"twitter.com\"\n/* SignInMethod.TWITTER */\n;\n/** Always set to {@link ProviderId}.TWITTER. */\n\nTwitterAuthProvider.PROVIDER_ID = \"twitter.com\"\n/* ProviderId.TWITTER */\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 */\n\nfunction signUp(_x109, _x110) {\n return _signUp.apply(this, arguments);\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 */\n\n\nfunction _signUp() {\n _signUp = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee139(auth, request) {\n return _regeneratorRuntime.wrap(function _callee139$(_context139) {\n while (1) {\n switch (_context139.prev = _context139.next) {\n case 0:\n return _context139.abrupt(\"return\", _performSignInRequest(auth, \"POST\"\n /* HttpMethod.POST */\n , \"/v1/accounts:signUp\"\n /* Endpoint.SIGN_UP */\n , _addTidIfNecessary(auth, request)));\n\n case 1:\n case \"end\":\n return _context139.stop();\n }\n }\n }, _callee139);\n }));\n return _signUp.apply(this, arguments);\n}\n\nvar UserCredentialImpl = /*#__PURE__*/function () {\n function UserCredentialImpl(params) {\n _classCallCheck(this, UserCredentialImpl);\n\n this.user = params.user;\n this.providerId = params.providerId;\n this._tokenResponse = params._tokenResponse;\n this.operationType = params.operationType;\n }\n\n _createClass(UserCredentialImpl, null, [{\n key: \"_fromIdTokenResponse\",\n value: function () {\n var _fromIdTokenResponse3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee48(auth, operationType, idTokenResponse) {\n var isAnonymous,\n user,\n providerId,\n userCred,\n _args48 = arguments;\n return _regeneratorRuntime.wrap(function _callee48$(_context48) {\n while (1) {\n switch (_context48.prev = _context48.next) {\n case 0:\n isAnonymous = _args48.length > 3 && _args48[3] !== undefined ? _args48[3] : false;\n _context48.next = 3;\n return UserImpl._fromIdTokenResponse(auth, idTokenResponse, isAnonymous);\n\n case 3:\n user = _context48.sent;\n providerId = providerIdForResponse(idTokenResponse);\n userCred = new UserCredentialImpl({\n user: user,\n providerId: providerId,\n _tokenResponse: idTokenResponse,\n operationType: operationType\n });\n return _context48.abrupt(\"return\", userCred);\n\n case 7:\n case \"end\":\n return _context48.stop();\n }\n }\n }, _callee48);\n }));\n\n function _fromIdTokenResponse(_x111, _x112, _x113) {\n return _fromIdTokenResponse3.apply(this, arguments);\n }\n\n return _fromIdTokenResponse;\n }()\n }, {\n key: \"_forOperation\",\n value: function () {\n var _forOperation2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee49(user, operationType, response) {\n var providerId;\n return _regeneratorRuntime.wrap(function _callee49$(_context49) {\n while (1) {\n switch (_context49.prev = _context49.next) {\n case 0:\n _context49.next = 2;\n return user._updateTokensIfNecessary(response,\n /* reload */\n true);\n\n case 2:\n providerId = providerIdForResponse(response);\n return _context49.abrupt(\"return\", new UserCredentialImpl({\n user: user,\n providerId: providerId,\n _tokenResponse: response,\n operationType: operationType\n }));\n\n case 4:\n case \"end\":\n return _context49.stop();\n }\n }\n }, _callee49);\n }));\n\n function _forOperation(_x114, _x115, _x116) {\n return _forOperation2.apply(this, arguments);\n }\n\n return _forOperation;\n }()\n }]);\n\n return UserCredentialImpl;\n}();\n\nfunction providerIdForResponse(response) {\n if (response.providerId) {\n return response.providerId;\n }\n\n if ('phoneNumber' in response) {\n return \"phone\"\n /* ProviderId.PHONE */\n ;\n }\n\n return null;\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 */\n\n/**\r\n * Asynchronously signs in as an anonymous user.\r\n *\r\n * @remarks\r\n * If there is already an anonymous user signed in, that user will be returned; otherwise, a\r\n * new anonymous user identity will be created and returned.\r\n *\r\n * @param auth - The {@link Auth} instance.\r\n *\r\n * @public\r\n */\n\n\nfunction signInAnonymously(_x117) {\n return _signInAnonymously.apply(this, arguments);\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 */\n\n\nfunction _signInAnonymously() {\n _signInAnonymously = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee140(auth) {\n var _a, authInternal, response, userCredential;\n\n return _regeneratorRuntime.wrap(function _callee140$(_context140) {\n while (1) {\n switch (_context140.prev = _context140.next) {\n case 0:\n authInternal = _castAuth(auth);\n _context140.next = 3;\n return authInternal._initializationPromise;\n\n case 3:\n if (!((_a = authInternal.currentUser) === null || _a === void 0 ? void 0 : _a.isAnonymous)) {\n _context140.next = 5;\n break;\n }\n\n return _context140.abrupt(\"return\", new UserCredentialImpl({\n user: authInternal.currentUser,\n providerId: null,\n operationType: \"signIn\"\n /* OperationType.SIGN_IN */\n\n }));\n\n case 5:\n _context140.next = 7;\n return signUp(authInternal, {\n returnSecureToken: true\n });\n\n case 7:\n response = _context140.sent;\n _context140.next = 10;\n return UserCredentialImpl._fromIdTokenResponse(authInternal, \"signIn\"\n /* OperationType.SIGN_IN */\n , response, true);\n\n case 10:\n userCredential = _context140.sent;\n _context140.next = 13;\n return authInternal._updateCurrentUser(userCredential.user);\n\n case 13:\n return _context140.abrupt(\"return\", userCredential);\n\n case 14:\n case \"end\":\n return _context140.stop();\n }\n }\n }, _callee140);\n }));\n return _signInAnonymously.apply(this, arguments);\n}\n\nvar MultiFactorError = /*#__PURE__*/function (_FirebaseError) {\n _inherits(MultiFactorError, _FirebaseError);\n\n var _super12 = _createSuper(MultiFactorError);\n\n function MultiFactorError(auth, error, operationType, user) {\n var _this18;\n\n _classCallCheck(this, MultiFactorError);\n\n var _a;\n\n _this18 = _super12.call(this, error.code, error.message);\n _this18.operationType = operationType;\n _this18.user = user; // https://github.com/Microsoft/TypeScript-wiki/blob/master/Breaking-Changes.md#extending-built-ins-like-error-array-and-map-may-no-longer-work\n\n Object.setPrototypeOf(_assertThisInitialized(_this18), MultiFactorError.prototype);\n _this18.customData = {\n appName: auth.name,\n tenantId: (_a = auth.tenantId) !== null && _a !== void 0 ? _a : undefined,\n _serverResponse: error.customData._serverResponse,\n operationType: operationType\n };\n return _this18;\n }\n\n _createClass(MultiFactorError, null, [{\n key: \"_fromErrorAndOperation\",\n value: function _fromErrorAndOperation(auth, error, operationType, user) {\n return new MultiFactorError(auth, error, operationType, user);\n }\n }]);\n\n return MultiFactorError;\n}(FirebaseError);\n\nfunction _processCredentialSavingMfaContextIfNecessary(auth, operationType, credential, user) {\n var idTokenProvider = operationType === \"reauthenticate\"\n /* OperationType.REAUTHENTICATE */\n ? credential._getReauthenticationResolver(auth) : credential._getIdTokenResponse(auth);\n return idTokenProvider.catch(function (error) {\n if (error.code === \"auth/\".concat(\"multi-factor-auth-required\"\n /* AuthErrorCode.MFA_REQUIRED */\n )) {\n throw MultiFactorError._fromErrorAndOperation(auth, error, operationType, user);\n }\n\n throw error;\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 */\n\n/**\r\n * Takes a set of UserInfo provider data and converts it to a set of names\r\n */\n\n\nfunction providerDataAsNames(providerData) {\n return new Set(providerData.map(function (_ref19) {\n var providerId = _ref19.providerId;\n return providerId;\n }).filter(function (pid) {\n return !!pid;\n }));\n}\n/**\r\n * @license\r\n * Copyright 2019 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 */\n\n/**\r\n * Unlinks a provider from a user account.\r\n *\r\n * @param user - The user.\r\n * @param providerId - The provider to unlink.\r\n *\r\n * @public\r\n */\n\n\nfunction unlink(_x118, _x119) {\n return _unlink.apply(this, arguments);\n}\n\nfunction _unlink() {\n _unlink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee141(user, providerId) {\n var userInternal, _yield$deleteLinkedAc, providerUserInfo, providersLeft;\n\n return _regeneratorRuntime.wrap(function _callee141$(_context141) {\n while (1) {\n switch (_context141.prev = _context141.next) {\n case 0:\n userInternal = getModularInstance(user);\n _context141.next = 3;\n return _assertLinkedStatus(true, userInternal, providerId);\n\n case 3:\n _context141.t0 = deleteLinkedAccounts;\n _context141.t1 = userInternal.auth;\n _context141.next = 7;\n return userInternal.getIdToken();\n\n case 7:\n _context141.t2 = _context141.sent;\n _context141.t3 = [providerId];\n _context141.t4 = {\n idToken: _context141.t2,\n deleteProvider: _context141.t3\n };\n _context141.next = 12;\n return (0, _context141.t0)(_context141.t1, _context141.t4);\n\n case 12:\n _yield$deleteLinkedAc = _context141.sent;\n providerUserInfo = _yield$deleteLinkedAc.providerUserInfo;\n providersLeft = providerDataAsNames(providerUserInfo || []);\n userInternal.providerData = userInternal.providerData.filter(function (pd) {\n return providersLeft.has(pd.providerId);\n });\n\n if (!providersLeft.has(\"phone\"\n /* ProviderId.PHONE */\n )) {\n userInternal.phoneNumber = null;\n }\n\n _context141.next = 19;\n return userInternal.auth._persistUserIfCurrent(userInternal);\n\n case 19:\n return _context141.abrupt(\"return\", userInternal);\n\n case 20:\n case \"end\":\n return _context141.stop();\n }\n }\n }, _callee141);\n }));\n return _unlink.apply(this, arguments);\n}\n\nfunction _link$1(_x120, _x121) {\n return _link$.apply(this, arguments);\n}\n\nfunction _link$() {\n _link$ = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee142(user, credential) {\n var bypassAuthState,\n response,\n _args142 = arguments;\n return _regeneratorRuntime.wrap(function _callee142$(_context142) {\n while (1) {\n switch (_context142.prev = _context142.next) {\n case 0:\n bypassAuthState = _args142.length > 2 && _args142[2] !== undefined ? _args142[2] : false;\n _context142.t0 = _logoutIfInvalidated;\n _context142.t1 = user;\n _context142.t2 = credential;\n _context142.t3 = user.auth;\n _context142.next = 7;\n return user.getIdToken();\n\n case 7:\n _context142.t4 = _context142.sent;\n _context142.t5 = _context142.t2._linkToIdToken.call(_context142.t2, _context142.t3, _context142.t4);\n _context142.t6 = bypassAuthState;\n _context142.next = 12;\n return (0, _context142.t0)(_context142.t1, _context142.t5, _context142.t6);\n\n case 12:\n response = _context142.sent;\n return _context142.abrupt(\"return\", UserCredentialImpl._forOperation(user, \"link\"\n /* OperationType.LINK */\n , response));\n\n case 14:\n case \"end\":\n return _context142.stop();\n }\n }\n }, _callee142);\n }));\n return _link$.apply(this, arguments);\n}\n\nfunction _assertLinkedStatus(_x122, _x123, _x124) {\n return _assertLinkedStatus2.apply(this, arguments);\n}\n/**\r\n * @license\r\n * Copyright 2019 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 */\n\n\nfunction _assertLinkedStatus2() {\n _assertLinkedStatus2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee143(expected, user, provider) {\n var providerIds, code;\n return _regeneratorRuntime.wrap(function _callee143$(_context143) {\n while (1) {\n switch (_context143.prev = _context143.next) {\n case 0:\n _context143.next = 2;\n return _reloadWithoutSaving(user);\n\n case 2:\n providerIds = providerDataAsNames(user.providerData);\n code = expected === false ? \"provider-already-linked\"\n /* AuthErrorCode.PROVIDER_ALREADY_LINKED */\n : \"no-such-provider\";\n\n _assert(providerIds.has(provider) === expected, user.auth, code);\n\n case 5:\n case \"end\":\n return _context143.stop();\n }\n }\n }, _callee143);\n }));\n return _assertLinkedStatus2.apply(this, arguments);\n}\n\nfunction _reauthenticate(_x125, _x126) {\n return _reauthenticate2.apply(this, arguments);\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 */\n\n\nfunction _reauthenticate2() {\n _reauthenticate2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee144(user, credential) {\n var bypassAuthState,\n auth,\n operationType,\n response,\n parsed,\n localId,\n _args144 = arguments;\n return _regeneratorRuntime.wrap(function _callee144$(_context144) {\n while (1) {\n switch (_context144.prev = _context144.next) {\n case 0:\n bypassAuthState = _args144.length > 2 && _args144[2] !== undefined ? _args144[2] : false;\n auth = user.auth;\n operationType = \"reauthenticate\";\n _context144.prev = 3;\n _context144.next = 6;\n return _logoutIfInvalidated(user, _processCredentialSavingMfaContextIfNecessary(auth, operationType, credential, user), bypassAuthState);\n\n case 6:\n response = _context144.sent;\n\n _assert(response.idToken, auth, \"internal-error\"\n /* AuthErrorCode.INTERNAL_ERROR */\n );\n\n parsed = _parseToken(response.idToken);\n\n _assert(parsed, auth, \"internal-error\"\n /* AuthErrorCode.INTERNAL_ERROR */\n );\n\n localId = parsed.sub;\n\n _assert(user.uid === localId, auth, \"user-mismatch\"\n /* AuthErrorCode.USER_MISMATCH */\n );\n\n return _context144.abrupt(\"return\", UserCredentialImpl._forOperation(user, operationType, response));\n\n case 15:\n _context144.prev = 15;\n _context144.t0 = _context144[\"catch\"](3);\n\n // Convert user deleted error into user mismatch\n if ((_context144.t0 === null || _context144.t0 === void 0 ? void 0 : _context144.t0.code) === \"auth/\".concat(\"user-not-found\"\n /* AuthErrorCode.USER_DELETED */\n )) {\n _fail(auth, \"user-mismatch\"\n /* AuthErrorCode.USER_MISMATCH */\n );\n }\n\n throw _context144.t0;\n\n case 19:\n case \"end\":\n return _context144.stop();\n }\n }\n }, _callee144, null, [[3, 15]]);\n }));\n return _reauthenticate2.apply(this, arguments);\n}\n\nfunction _signInWithCredential(_x127, _x128) {\n return _signInWithCredential2.apply(this, arguments);\n}\n/**\r\n * Asynchronously signs in with the given credentials.\r\n *\r\n * @remarks\r\n * An {@link AuthProvider} can be used to generate the credential.\r\n *\r\n * @param auth - The {@link Auth} instance.\r\n * @param credential - The auth credential.\r\n *\r\n * @public\r\n */\n\n\nfunction _signInWithCredential2() {\n _signInWithCredential2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee145(auth, credential) {\n var bypassAuthState,\n operationType,\n response,\n userCredential,\n _args145 = arguments;\n return _regeneratorRuntime.wrap(function _callee145$(_context145) {\n while (1) {\n switch (_context145.prev = _context145.next) {\n case 0:\n bypassAuthState = _args145.length > 2 && _args145[2] !== undefined ? _args145[2] : false;\n operationType = \"signIn\";\n _context145.next = 4;\n return _processCredentialSavingMfaContextIfNecessary(auth, operationType, credential);\n\n case 4:\n response = _context145.sent;\n _context145.next = 7;\n return UserCredentialImpl._fromIdTokenResponse(auth, operationType, response);\n\n case 7:\n userCredential = _context145.sent;\n\n if (bypassAuthState) {\n _context145.next = 11;\n break;\n }\n\n _context145.next = 11;\n return auth._updateCurrentUser(userCredential.user);\n\n case 11:\n return _context145.abrupt(\"return\", userCredential);\n\n case 12:\n case \"end\":\n return _context145.stop();\n }\n }\n }, _callee145);\n }));\n return _signInWithCredential2.apply(this, arguments);\n}\n\nfunction signInWithCredential(_x129, _x130) {\n return _signInWithCredential3.apply(this, arguments);\n}\n/**\r\n * Links the user account with the given credentials.\r\n *\r\n * @remarks\r\n * An {@link AuthProvider} can be used to generate the credential.\r\n *\r\n * @param user - The user.\r\n * @param credential - The auth credential.\r\n *\r\n * @public\r\n */\n\n\nfunction _signInWithCredential3() {\n _signInWithCredential3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee146(auth, credential) {\n return _regeneratorRuntime.wrap(function _callee146$(_context146) {\n while (1) {\n switch (_context146.prev = _context146.next) {\n case 0:\n return _context146.abrupt(\"return\", _signInWithCredential(_castAuth(auth), credential));\n\n case 1:\n case \"end\":\n return _context146.stop();\n }\n }\n }, _callee146);\n }));\n return _signInWithCredential3.apply(this, arguments);\n}\n\nfunction linkWithCredential(_x131, _x132) {\n return _linkWithCredential.apply(this, arguments);\n}\n/**\r\n * Re-authenticates a user using a fresh credential.\r\n *\r\n * @remarks\r\n * Use before operations such as {@link updatePassword} that require tokens from recent sign-in\r\n * attempts. This method can be used to recover from a `CREDENTIAL_TOO_OLD_LOGIN_AGAIN` error\r\n * or a `TOKEN_EXPIRED` error.\r\n *\r\n * @param user - The user.\r\n * @param credential - The auth credential.\r\n *\r\n * @public\r\n */\n\n\nfunction _linkWithCredential() {\n _linkWithCredential = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee147(user, credential) {\n var userInternal;\n return _regeneratorRuntime.wrap(function _callee147$(_context147) {\n while (1) {\n switch (_context147.prev = _context147.next) {\n case 0:\n userInternal = getModularInstance(user);\n _context147.next = 3;\n return _assertLinkedStatus(false, userInternal, credential.providerId);\n\n case 3:\n return _context147.abrupt(\"return\", _link$1(userInternal, credential));\n\n case 4:\n case \"end\":\n return _context147.stop();\n }\n }\n }, _callee147);\n }));\n return _linkWithCredential.apply(this, arguments);\n}\n\nfunction reauthenticateWithCredential(_x133, _x134) {\n return _reauthenticateWithCredential.apply(this, arguments);\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 */\n\n\nfunction _reauthenticateWithCredential() {\n _reauthenticateWithCredential = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee148(user, credential) {\n return _regeneratorRuntime.wrap(function _callee148$(_context148) {\n while (1) {\n switch (_context148.prev = _context148.next) {\n case 0:\n return _context148.abrupt(\"return\", _reauthenticate(getModularInstance(user), credential));\n\n case 1:\n case \"end\":\n return _context148.stop();\n }\n }\n }, _callee148);\n }));\n return _reauthenticateWithCredential.apply(this, arguments);\n}\n\nfunction signInWithCustomToken$1(_x135, _x136) {\n return _signInWithCustomToken$.apply(this, arguments);\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 */\n\n/**\r\n * Asynchronously signs in using a custom token.\r\n *\r\n * @remarks\r\n * Custom tokens are used to integrate Firebase Auth with existing auth systems, and must\r\n * be generated by an auth backend using the\r\n * {@link https://firebase.google.com/docs/reference/admin/node/admin.auth.Auth#createcustomtoken | createCustomToken}\r\n * method in the {@link https://firebase.google.com/docs/auth/admin | Admin SDK} .\r\n *\r\n * Fails with an error if the token is invalid, expired, or not accepted by the Firebase Auth service.\r\n *\r\n * @param auth - The {@link Auth} instance.\r\n * @param customToken - The custom token to sign in with.\r\n *\r\n * @public\r\n */\n\n\nfunction _signInWithCustomToken$() {\n _signInWithCustomToken$ = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee149(auth, request) {\n return _regeneratorRuntime.wrap(function _callee149$(_context149) {\n while (1) {\n switch (_context149.prev = _context149.next) {\n case 0:\n return _context149.abrupt(\"return\", _performSignInRequest(auth, \"POST\"\n /* HttpMethod.POST */\n , \"/v1/accounts:signInWithCustomToken\"\n /* Endpoint.SIGN_IN_WITH_CUSTOM_TOKEN */\n , _addTidIfNecessary(auth, request)));\n\n case 1:\n case \"end\":\n return _context149.stop();\n }\n }\n }, _callee149);\n }));\n return _signInWithCustomToken$.apply(this, arguments);\n}\n\nfunction signInWithCustomToken(_x137, _x138) {\n return _signInWithCustomToken.apply(this, arguments);\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 */\n\n\nfunction _signInWithCustomToken() {\n _signInWithCustomToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee150(auth, customToken) {\n var authInternal, response, cred;\n return _regeneratorRuntime.wrap(function _callee150$(_context150) {\n while (1) {\n switch (_context150.prev = _context150.next) {\n case 0:\n authInternal = _castAuth(auth);\n _context150.next = 3;\n return signInWithCustomToken$1(authInternal, {\n token: customToken,\n returnSecureToken: true\n });\n\n case 3:\n response = _context150.sent;\n _context150.next = 6;\n return UserCredentialImpl._fromIdTokenResponse(authInternal, \"signIn\"\n /* OperationType.SIGN_IN */\n , response);\n\n case 6:\n cred = _context150.sent;\n _context150.next = 9;\n return authInternal._updateCurrentUser(cred.user);\n\n case 9:\n return _context150.abrupt(\"return\", cred);\n\n case 10:\n case \"end\":\n return _context150.stop();\n }\n }\n }, _callee150);\n }));\n return _signInWithCustomToken.apply(this, arguments);\n}\n\nvar MultiFactorInfoImpl = /*#__PURE__*/function () {\n function MultiFactorInfoImpl(factorId, response) {\n _classCallCheck(this, MultiFactorInfoImpl);\n\n this.factorId = factorId;\n this.uid = response.mfaEnrollmentId;\n this.enrollmentTime = new Date(response.enrolledAt).toUTCString();\n this.displayName = response.displayName;\n }\n\n _createClass(MultiFactorInfoImpl, null, [{\n key: \"_fromServerResponse\",\n value: function _fromServerResponse(auth, enrollment) {\n if ('phoneInfo' in enrollment) {\n return PhoneMultiFactorInfoImpl._fromServerResponse(auth, enrollment);\n } else if ('totpInfo' in enrollment) {\n return TotpMultiFactorInfoImpl._fromServerResponse(auth, enrollment);\n }\n\n return _fail(auth, \"internal-error\"\n /* AuthErrorCode.INTERNAL_ERROR */\n );\n }\n }]);\n\n return MultiFactorInfoImpl;\n}();\n\nvar PhoneMultiFactorInfoImpl = /*#__PURE__*/function (_MultiFactorInfoImpl) {\n _inherits(PhoneMultiFactorInfoImpl, _MultiFactorInfoImpl);\n\n var _super13 = _createSuper(PhoneMultiFactorInfoImpl);\n\n function PhoneMultiFactorInfoImpl(response) {\n var _this19;\n\n _classCallCheck(this, PhoneMultiFactorInfoImpl);\n\n _this19 = _super13.call(this, \"phone\"\n /* FactorId.PHONE */\n , response);\n _this19.phoneNumber = response.phoneInfo;\n return _this19;\n }\n\n _createClass(PhoneMultiFactorInfoImpl, null, [{\n key: \"_fromServerResponse\",\n value: function _fromServerResponse(_auth, enrollment) {\n return new PhoneMultiFactorInfoImpl(enrollment);\n }\n }]);\n\n return PhoneMultiFactorInfoImpl;\n}(MultiFactorInfoImpl);\n\nvar TotpMultiFactorInfoImpl = /*#__PURE__*/function (_MultiFactorInfoImpl2) {\n _inherits(TotpMultiFactorInfoImpl, _MultiFactorInfoImpl2);\n\n var _super14 = _createSuper(TotpMultiFactorInfoImpl);\n\n function TotpMultiFactorInfoImpl(response) {\n _classCallCheck(this, TotpMultiFactorInfoImpl);\n\n return _super14.call(this, \"totp\"\n /* FactorId.TOTP */\n , response);\n }\n\n _createClass(TotpMultiFactorInfoImpl, null, [{\n key: \"_fromServerResponse\",\n value: function _fromServerResponse(_auth, enrollment) {\n return new TotpMultiFactorInfoImpl(enrollment);\n }\n }]);\n\n return TotpMultiFactorInfoImpl;\n}(MultiFactorInfoImpl);\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 */\n\n\nfunction _setActionCodeSettingsOnRequest(auth, request, actionCodeSettings) {\n var _a;\n\n _assert(((_a = actionCodeSettings.url) === null || _a === void 0 ? void 0 : _a.length) > 0, auth, \"invalid-continue-uri\"\n /* AuthErrorCode.INVALID_CONTINUE_URI */\n );\n\n _assert(typeof actionCodeSettings.dynamicLinkDomain === 'undefined' || actionCodeSettings.dynamicLinkDomain.length > 0, auth, \"invalid-dynamic-link-domain\"\n /* AuthErrorCode.INVALID_DYNAMIC_LINK_DOMAIN */\n );\n\n request.continueUrl = actionCodeSettings.url;\n request.dynamicLinkDomain = actionCodeSettings.dynamicLinkDomain;\n request.canHandleCodeInApp = actionCodeSettings.handleCodeInApp;\n\n if (actionCodeSettings.iOS) {\n _assert(actionCodeSettings.iOS.bundleId.length > 0, auth, \"missing-ios-bundle-id\"\n /* AuthErrorCode.MISSING_IOS_BUNDLE_ID */\n );\n\n request.iOSBundleId = actionCodeSettings.iOS.bundleId;\n }\n\n if (actionCodeSettings.android) {\n _assert(actionCodeSettings.android.packageName.length > 0, auth, \"missing-android-pkg-name\"\n /* AuthErrorCode.MISSING_ANDROID_PACKAGE_NAME */\n );\n\n request.androidInstallApp = actionCodeSettings.android.installApp;\n request.androidMinimumVersionCode = actionCodeSettings.android.minimumVersion;\n request.androidPackageName = actionCodeSettings.android.packageName;\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 */\n\n/**\r\n * Updates the password policy cached in the {@link Auth} instance if a policy is already\r\n * cached for the project or tenant.\r\n *\r\n * @remarks\r\n * We only fetch the password policy if the password did not meet policy requirements and\r\n * there is an existing policy cached. A developer must call validatePassword at least\r\n * once for the cache to be automatically updated.\r\n *\r\n * @param auth - The {@link Auth} instance.\r\n *\r\n * @private\r\n */\n\n\nfunction recachePasswordPolicy(_x139) {\n return _recachePasswordPolicy.apply(this, arguments);\n}\n/**\r\n * Sends a password reset email to the given email address. This method does not throw an error when\r\n * there's no user account with the given email address and\r\n * [Email Enumeration Protection](https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection) is enabled.\r\n *\r\n * @remarks\r\n * To complete the password reset, call {@link confirmPasswordReset} with the code supplied in\r\n * the email sent to the user, along with the new password specified by the user.\r\n *\r\n * @example\r\n * ```javascript\r\n * const actionCodeSettings = {\r\n * url: 'https://www.example.com/?email=user@example.com',\r\n * iOS: {\r\n * bundleId: 'com.example.ios'\r\n * },\r\n * android: {\r\n * packageName: 'com.example.android',\r\n * installApp: true,\r\n * minimumVersion: '12'\r\n * },\r\n * handleCodeInApp: true\r\n * };\r\n * await sendPasswordResetEmail(auth, 'user@example.com', actionCodeSettings);\r\n * // Obtain code from user.\r\n * await confirmPasswordReset('user@example.com', code);\r\n * ```\r\n *\r\n * @param auth - The {@link Auth} instance.\r\n * @param email - The user's email address.\r\n * @param actionCodeSettings - The {@link ActionCodeSettings}.\r\n *\r\n * @public\r\n */\n\n\nfunction _recachePasswordPolicy() {\n _recachePasswordPolicy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee151(auth) {\n var authInternal;\n return _regeneratorRuntime.wrap(function _callee151$(_context151) {\n while (1) {\n switch (_context151.prev = _context151.next) {\n case 0:\n authInternal = _castAuth(auth);\n\n if (!authInternal._getPasswordPolicyInternal()) {\n _context151.next = 4;\n break;\n }\n\n _context151.next = 4;\n return authInternal._updatePasswordPolicy();\n\n case 4:\n case \"end\":\n return _context151.stop();\n }\n }\n }, _callee151);\n }));\n return _recachePasswordPolicy.apply(this, arguments);\n}\n\nfunction sendPasswordResetEmail(_x140, _x141, _x142) {\n return _sendPasswordResetEmail.apply(this, arguments);\n}\n/**\r\n * Completes the password reset process, given a confirmation code and new password.\r\n *\r\n * @param auth - The {@link Auth} instance.\r\n * @param oobCode - A confirmation code sent to the user.\r\n * @param newPassword - The new password.\r\n *\r\n * @public\r\n */\n\n\nfunction _sendPasswordResetEmail() {\n _sendPasswordResetEmail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee152(auth, email, actionCodeSettings) {\n var authInternal, request;\n return _regeneratorRuntime.wrap(function _callee152$(_context152) {\n while (1) {\n switch (_context152.prev = _context152.next) {\n case 0:\n authInternal = _castAuth(auth);\n request = {\n requestType: \"PASSWORD_RESET\"\n /* ActionCodeOperation.PASSWORD_RESET */\n ,\n email: email,\n clientType: \"CLIENT_TYPE_WEB\"\n /* RecaptchaClientType.WEB */\n\n };\n\n if (actionCodeSettings) {\n _setActionCodeSettingsOnRequest(authInternal, request, actionCodeSettings);\n }\n\n _context152.next = 5;\n return handleRecaptchaFlow(authInternal, request, \"getOobCode\"\n /* RecaptchaActionName.GET_OOB_CODE */\n , sendPasswordResetEmail$1);\n\n case 5:\n case \"end\":\n return _context152.stop();\n }\n }\n }, _callee152);\n }));\n return _sendPasswordResetEmail.apply(this, arguments);\n}\n\nfunction confirmPasswordReset(_x143, _x144, _x145) {\n return _confirmPasswordReset.apply(this, arguments);\n}\n/**\r\n * Applies a verification code sent to the user by email or other out-of-band mechanism.\r\n *\r\n * @param auth - The {@link Auth} instance.\r\n * @param oobCode - A verification code sent to the user.\r\n *\r\n * @public\r\n */\n\n\nfunction _confirmPasswordReset() {\n _confirmPasswordReset = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee154(auth, oobCode, newPassword) {\n return _regeneratorRuntime.wrap(function _callee154$(_context154) {\n while (1) {\n switch (_context154.prev = _context154.next) {\n case 0:\n _context154.next = 2;\n return resetPassword(getModularInstance(auth), {\n oobCode: oobCode,\n newPassword: newPassword\n }).catch( /*#__PURE__*/function () {\n var _ref43 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee153(error) {\n return _regeneratorRuntime.wrap(function _callee153$(_context153) {\n while (1) {\n switch (_context153.prev = _context153.next) {\n case 0:\n if (error.code === \"auth/\".concat(\"password-does-not-meet-requirements\"\n /* AuthErrorCode.PASSWORD_DOES_NOT_MEET_REQUIREMENTS */\n )) {\n void recachePasswordPolicy(auth);\n }\n\n throw error;\n\n case 2:\n case \"end\":\n return _context153.stop();\n }\n }\n }, _callee153);\n }));\n\n return function (_x286) {\n return _ref43.apply(this, arguments);\n };\n }());\n\n case 2:\n case \"end\":\n return _context154.stop();\n }\n }\n }, _callee154);\n }));\n return _confirmPasswordReset.apply(this, arguments);\n}\n\nfunction applyActionCode(_x146, _x147) {\n return _applyActionCode.apply(this, arguments);\n}\n/**\r\n * Checks a verification code sent to the user by email or other out-of-band mechanism.\r\n *\r\n * @returns metadata about the code.\r\n *\r\n * @param auth - The {@link Auth} instance.\r\n * @param oobCode - A verification code sent to the user.\r\n *\r\n * @public\r\n */\n\n\nfunction _applyActionCode() {\n _applyActionCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee155(auth, oobCode) {\n return _regeneratorRuntime.wrap(function _callee155$(_context155) {\n while (1) {\n switch (_context155.prev = _context155.next) {\n case 0:\n _context155.next = 2;\n return applyActionCode$1(getModularInstance(auth), {\n oobCode: oobCode\n });\n\n case 2:\n case \"end\":\n return _context155.stop();\n }\n }\n }, _callee155);\n }));\n return _applyActionCode.apply(this, arguments);\n}\n\nfunction checkActionCode(_x148, _x149) {\n return _checkActionCode.apply(this, arguments);\n}\n/**\r\n * Checks a password reset code sent to the user by email or other out-of-band mechanism.\r\n *\r\n * @returns the user's email address if valid.\r\n *\r\n * @param auth - The {@link Auth} instance.\r\n * @param code - A verification code sent to the user.\r\n *\r\n * @public\r\n */\n\n\nfunction _checkActionCode() {\n _checkActionCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee156(auth, oobCode) {\n var authModular, response, operation, multiFactorInfo;\n return _regeneratorRuntime.wrap(function _callee156$(_context156) {\n while (1) {\n switch (_context156.prev = _context156.next) {\n case 0:\n authModular = getModularInstance(auth);\n _context156.next = 3;\n return resetPassword(authModular, {\n oobCode: oobCode\n });\n\n case 3:\n response = _context156.sent;\n // Email could be empty only if the request type is EMAIL_SIGNIN or\n // VERIFY_AND_CHANGE_EMAIL.\n // New email should not be empty if the request type is\n // VERIFY_AND_CHANGE_EMAIL.\n // Multi-factor info could not be empty if the request type is\n // REVERT_SECOND_FACTOR_ADDITION.\n operation = response.requestType;\n\n _assert(operation, authModular, \"internal-error\"\n /* AuthErrorCode.INTERNAL_ERROR */\n );\n\n _context156.t0 = operation;\n _context156.next = _context156.t0 === \"EMAIL_SIGNIN\"\n /* ActionCodeOperation.EMAIL_SIGNIN */\n ? 9 : _context156.t0 === \"VERIFY_AND_CHANGE_EMAIL\"\n /* ActionCodeOperation.VERIFY_AND_CHANGE_EMAIL */\n ? 10 : _context156.t0 === \"REVERT_SECOND_FACTOR_ADDITION\"\n /* ActionCodeOperation.REVERT_SECOND_FACTOR_ADDITION */\n ? 12 : 13;\n break;\n\n case 9:\n return _context156.abrupt(\"break\", 14);\n\n case 10:\n _assert(response.newEmail, authModular, \"internal-error\"\n /* AuthErrorCode.INTERNAL_ERROR */\n );\n\n return _context156.abrupt(\"break\", 14);\n\n case 12:\n _assert(response.mfaInfo, authModular, \"internal-error\"\n /* AuthErrorCode.INTERNAL_ERROR */\n );\n\n case 13:\n _assert(response.email, authModular, \"internal-error\"\n /* AuthErrorCode.INTERNAL_ERROR */\n );\n\n case 14:\n // The multi-factor info for revert second factor addition\n multiFactorInfo = null;\n\n if (response.mfaInfo) {\n multiFactorInfo = MultiFactorInfoImpl._fromServerResponse(_castAuth(authModular), response.mfaInfo);\n }\n\n return _context156.abrupt(\"return\", {\n data: {\n email: (response.requestType === \"VERIFY_AND_CHANGE_EMAIL\"\n /* ActionCodeOperation.VERIFY_AND_CHANGE_EMAIL */\n ? response.newEmail : response.email) || null,\n previousEmail: (response.requestType === \"VERIFY_AND_CHANGE_EMAIL\"\n /* ActionCodeOperation.VERIFY_AND_CHANGE_EMAIL */\n ? response.email : response.newEmail) || null,\n multiFactorInfo: multiFactorInfo\n },\n operation: operation\n });\n\n case 17:\n case \"end\":\n return _context156.stop();\n }\n }\n }, _callee156);\n }));\n return _checkActionCode.apply(this, arguments);\n}\n\nfunction verifyPasswordResetCode(_x150, _x151) {\n return _verifyPasswordResetCode.apply(this, arguments);\n}\n/**\r\n * Creates a new user account associated with the specified email address and password.\r\n *\r\n * @remarks\r\n * On successful creation of the user account, this user will also be signed in to your application.\r\n *\r\n * User account creation can fail if the account already exists or the password is invalid.\r\n *\r\n * Note: The email address acts as a unique identifier for the user and enables an email-based\r\n * password reset. This function will create a new user account and set the initial user password.\r\n *\r\n * @param auth - The {@link Auth} instance.\r\n * @param email - The user's email address.\r\n * @param password - The user's chosen password.\r\n *\r\n * @public\r\n */\n\n\nfunction _verifyPasswordResetCode() {\n _verifyPasswordResetCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee157(auth, code) {\n var _yield$checkActionCod, data;\n\n return _regeneratorRuntime.wrap(function _callee157$(_context157) {\n while (1) {\n switch (_context157.prev = _context157.next) {\n case 0:\n _context157.next = 2;\n return checkActionCode(getModularInstance(auth), code);\n\n case 2:\n _yield$checkActionCod = _context157.sent;\n data = _yield$checkActionCod.data;\n return _context157.abrupt(\"return\", data.email);\n\n case 5:\n case \"end\":\n return _context157.stop();\n }\n }\n }, _callee157);\n }));\n return _verifyPasswordResetCode.apply(this, arguments);\n}\n\nfunction createUserWithEmailAndPassword(_x152, _x153, _x154) {\n return _createUserWithEmailAndPassword.apply(this, arguments);\n}\n/**\r\n * Asynchronously signs in using an email and password.\r\n *\r\n * @remarks\r\n * Fails with an error if the email address and password do not match.\r\n * When [Email Enumeration Protection](https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection) is enabled,\r\n * this method fails with \"auth/invalid-credential\" in case of an invalid email/password.\r\n *\r\n * Note: The user's password is NOT the password used to access the user's email account. The\r\n * email address serves as a unique identifier for the user, and the password is used to access\r\n * the user's account in your Firebase project. See also: {@link createUserWithEmailAndPassword}.\r\n *\r\n * @param auth - The {@link Auth} instance.\r\n * @param email - The users email address.\r\n * @param password - The users password.\r\n *\r\n * @public\r\n */\n\n\nfunction _createUserWithEmailAndPassword() {\n _createUserWithEmailAndPassword = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee158(auth, email, password) {\n var authInternal, request, signUpResponse, response, userCredential;\n return _regeneratorRuntime.wrap(function _callee158$(_context158) {\n while (1) {\n switch (_context158.prev = _context158.next) {\n case 0:\n authInternal = _castAuth(auth);\n request = {\n returnSecureToken: true,\n email: email,\n password: password,\n clientType: \"CLIENT_TYPE_WEB\"\n /* RecaptchaClientType.WEB */\n\n };\n signUpResponse = handleRecaptchaFlow(authInternal, request, \"signUpPassword\"\n /* RecaptchaActionName.SIGN_UP_PASSWORD */\n , signUp);\n _context158.next = 5;\n return signUpResponse.catch(function (error) {\n if (error.code === \"auth/\".concat(\"password-does-not-meet-requirements\"\n /* AuthErrorCode.PASSWORD_DOES_NOT_MEET_REQUIREMENTS */\n )) {\n void recachePasswordPolicy(auth);\n }\n\n throw error;\n });\n\n case 5:\n response = _context158.sent;\n _context158.next = 8;\n return UserCredentialImpl._fromIdTokenResponse(authInternal, \"signIn\"\n /* OperationType.SIGN_IN */\n , response);\n\n case 8:\n userCredential = _context158.sent;\n _context158.next = 11;\n return authInternal._updateCurrentUser(userCredential.user);\n\n case 11:\n return _context158.abrupt(\"return\", userCredential);\n\n case 12:\n case \"end\":\n return _context158.stop();\n }\n }\n }, _callee158);\n }));\n return _createUserWithEmailAndPassword.apply(this, arguments);\n}\n\nfunction signInWithEmailAndPassword(auth, email, password) {\n return signInWithCredential(getModularInstance(auth), EmailAuthProvider.credential(email, password)).catch( /*#__PURE__*/function () {\n var _ref20 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee50(error) {\n return _regeneratorRuntime.wrap(function _callee50$(_context50) {\n while (1) {\n switch (_context50.prev = _context50.next) {\n case 0:\n if (error.code === \"auth/\".concat(\"password-does-not-meet-requirements\"\n /* AuthErrorCode.PASSWORD_DOES_NOT_MEET_REQUIREMENTS */\n )) {\n void recachePasswordPolicy(auth);\n }\n\n throw error;\n\n case 2:\n case \"end\":\n return _context50.stop();\n }\n }\n }, _callee50);\n }));\n\n return function (_x155) {\n return _ref20.apply(this, arguments);\n };\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 */\n\n/**\r\n * Sends a sign-in email link to the user with the specified email.\r\n *\r\n * @remarks\r\n * The sign-in operation has to always be completed in the app unlike other out of band email\r\n * actions (password reset and email verifications). This is because, at the end of the flow,\r\n * the user is expected to be signed in and their Auth state persisted within the app.\r\n *\r\n * To complete sign in with the email link, call {@link signInWithEmailLink} with the email\r\n * address and the email link supplied in the email sent to the user.\r\n *\r\n * @example\r\n * ```javascript\r\n * const actionCodeSettings = {\r\n * url: 'https://www.example.com/?email=user@example.com',\r\n * iOS: {\r\n * bundleId: 'com.example.ios'\r\n * },\r\n * android: {\r\n * packageName: 'com.example.android',\r\n * installApp: true,\r\n * minimumVersion: '12'\r\n * },\r\n * handleCodeInApp: true\r\n * };\r\n * await sendSignInLinkToEmail(auth, 'user@example.com', actionCodeSettings);\r\n * // Obtain emailLink from the user.\r\n * if(isSignInWithEmailLink(auth, emailLink)) {\r\n * await signInWithEmailLink(auth, 'user@example.com', emailLink);\r\n * }\r\n * ```\r\n *\r\n * @param authInternal - The {@link Auth} instance.\r\n * @param email - The user's email address.\r\n * @param actionCodeSettings - The {@link ActionCodeSettings}.\r\n *\r\n * @public\r\n */\n\n\nfunction sendSignInLinkToEmail(_x156, _x157, _x158) {\n return _sendSignInLinkToEmail.apply(this, arguments);\n}\n/**\r\n * Checks if an incoming link is a sign-in with email link suitable for {@link signInWithEmailLink}.\r\n *\r\n * @param auth - The {@link Auth} instance.\r\n * @param emailLink - The link sent to the user's email address.\r\n *\r\n * @public\r\n */\n\n\nfunction _sendSignInLinkToEmail() {\n _sendSignInLinkToEmail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee159(auth, email, actionCodeSettings) {\n var authInternal, request, setActionCodeSettings;\n return _regeneratorRuntime.wrap(function _callee159$(_context159) {\n while (1) {\n switch (_context159.prev = _context159.next) {\n case 0:\n setActionCodeSettings = function _setActionCodeSetting(request, actionCodeSettings) {\n _assert(actionCodeSettings.handleCodeInApp, authInternal, \"argument-error\"\n /* AuthErrorCode.ARGUMENT_ERROR */\n );\n\n if (actionCodeSettings) {\n _setActionCodeSettingsOnRequest(authInternal, request, actionCodeSettings);\n }\n };\n\n authInternal = _castAuth(auth);\n request = {\n requestType: \"EMAIL_SIGNIN\"\n /* ActionCodeOperation.EMAIL_SIGNIN */\n ,\n email: email,\n clientType: \"CLIENT_TYPE_WEB\"\n /* RecaptchaClientType.WEB */\n\n };\n setActionCodeSettings(request, actionCodeSettings);\n _context159.next = 6;\n return handleRecaptchaFlow(authInternal, request, \"getOobCode\"\n /* RecaptchaActionName.GET_OOB_CODE */\n , sendSignInLinkToEmail$1);\n\n case 6:\n case \"end\":\n return _context159.stop();\n }\n }\n }, _callee159);\n }));\n return _sendSignInLinkToEmail.apply(this, arguments);\n}\n\nfunction isSignInWithEmailLink(auth, emailLink) {\n var actionCodeUrl = ActionCodeURL.parseLink(emailLink);\n return (actionCodeUrl === null || actionCodeUrl === void 0 ? void 0 : actionCodeUrl.operation) === \"EMAIL_SIGNIN\"\n /* ActionCodeOperation.EMAIL_SIGNIN */\n ;\n}\n/**\r\n * Asynchronously signs in using an email and sign-in email link.\r\n *\r\n * @remarks\r\n * If no link is passed, the link is inferred from the current URL.\r\n *\r\n * Fails with an error if the email address is invalid or OTP in email link expires.\r\n *\r\n * Note: Confirm the link is a sign-in email link before calling this method firebase.auth.Auth.isSignInWithEmailLink.\r\n *\r\n * @example\r\n * ```javascript\r\n * const actionCodeSettings = {\r\n * url: 'https://www.example.com/?email=user@example.com',\r\n * iOS: {\r\n * bundleId: 'com.example.ios'\r\n * },\r\n * android: {\r\n * packageName: 'com.example.android',\r\n * installApp: true,\r\n * minimumVersion: '12'\r\n * },\r\n * handleCodeInApp: true\r\n * };\r\n * await sendSignInLinkToEmail(auth, 'user@example.com', actionCodeSettings);\r\n * // Obtain emailLink from the user.\r\n * if(isSignInWithEmailLink(auth, emailLink)) {\r\n * await signInWithEmailLink(auth, 'user@example.com', emailLink);\r\n * }\r\n * ```\r\n *\r\n * @param auth - The {@link Auth} instance.\r\n * @param email - The user's email address.\r\n * @param emailLink - The link sent to the user's email address.\r\n *\r\n * @public\r\n */\n\n\nfunction signInWithEmailLink(_x159, _x160, _x161) {\n return _signInWithEmailLink.apply(this, arguments);\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 */\n\n\nfunction _signInWithEmailLink() {\n _signInWithEmailLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee160(auth, email, emailLink) {\n var authModular, credential;\n return _regeneratorRuntime.wrap(function _callee160$(_context160) {\n while (1) {\n switch (_context160.prev = _context160.next) {\n case 0:\n authModular = getModularInstance(auth);\n credential = EmailAuthProvider.credentialWithLink(email, emailLink || _getCurrentUrl()); // Check if the tenant ID in the email link matches the tenant ID on Auth\n // instance.\n\n _assert(credential._tenantId === (authModular.tenantId || null), authModular, \"tenant-id-mismatch\"\n /* AuthErrorCode.TENANT_ID_MISMATCH */\n );\n\n return _context160.abrupt(\"return\", signInWithCredential(authModular, credential));\n\n case 4:\n case \"end\":\n return _context160.stop();\n }\n }\n }, _callee160);\n }));\n return _signInWithEmailLink.apply(this, arguments);\n}\n\nfunction createAuthUri(_x162, _x163) {\n return _createAuthUri.apply(this, arguments);\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 */\n\n/**\r\n * Gets the list of possible sign in methods for the given email address. This method returns an\r\n * empty list when [Email Enumeration Protection](https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection) is enabled, irrespective of the number of\r\n * authentication methods available for the given email.\r\n *\r\n * @remarks\r\n * This is useful to differentiate methods of sign-in for the same provider, eg.\r\n * {@link EmailAuthProvider} which has 2 methods of sign-in,\r\n * {@link SignInMethod}.EMAIL_PASSWORD and\r\n * {@link SignInMethod}.EMAIL_LINK.\r\n *\r\n * @param auth - The {@link Auth} instance.\r\n * @param email - The user's email address.\r\n *\r\n * Deprecated. Migrating off of this method is recommended as a security best-practice.\r\n * Learn more in the Identity Platform documentation for [Email Enumeration Protection](https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection).\r\n * @public\r\n */\n\n\nfunction _createAuthUri() {\n _createAuthUri = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee161(auth, request) {\n return _regeneratorRuntime.wrap(function _callee161$(_context161) {\n while (1) {\n switch (_context161.prev = _context161.next) {\n case 0:\n return _context161.abrupt(\"return\", _performApiRequest(auth, \"POST\"\n /* HttpMethod.POST */\n , \"/v1/accounts:createAuthUri\"\n /* Endpoint.CREATE_AUTH_URI */\n , _addTidIfNecessary(auth, request)));\n\n case 1:\n case \"end\":\n return _context161.stop();\n }\n }\n }, _callee161);\n }));\n return _createAuthUri.apply(this, arguments);\n}\n\nfunction fetchSignInMethodsForEmail(_x164, _x165) {\n return _fetchSignInMethodsForEmail.apply(this, arguments);\n}\n/**\r\n * Sends a verification email to a user.\r\n *\r\n * @remarks\r\n * The verification process is completed by calling {@link applyActionCode}.\r\n *\r\n * @example\r\n * ```javascript\r\n * const actionCodeSettings = {\r\n * url: 'https://www.example.com/?email=user@example.com',\r\n * iOS: {\r\n * bundleId: 'com.example.ios'\r\n * },\r\n * android: {\r\n * packageName: 'com.example.android',\r\n * installApp: true,\r\n * minimumVersion: '12'\r\n * },\r\n * handleCodeInApp: true\r\n * };\r\n * await sendEmailVerification(user, actionCodeSettings);\r\n * // Obtain code from the user.\r\n * await applyActionCode(auth, code);\r\n * ```\r\n *\r\n * @param user - The user.\r\n * @param actionCodeSettings - The {@link ActionCodeSettings}.\r\n *\r\n * @public\r\n */\n\n\nfunction _fetchSignInMethodsForEmail() {\n _fetchSignInMethodsForEmail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee162(auth, email) {\n var continueUri, request, _yield$createAuthUri, signinMethods;\n\n return _regeneratorRuntime.wrap(function _callee162$(_context162) {\n while (1) {\n switch (_context162.prev = _context162.next) {\n case 0:\n // createAuthUri returns an error if continue URI is not http or https.\n // For environments like Cordova, Chrome extensions, native frameworks, file\n // systems, etc, use http://localhost as continue URL.\n continueUri = _isHttpOrHttps() ? _getCurrentUrl() : 'http://localhost';\n request = {\n identifier: email,\n continueUri: continueUri\n };\n _context162.next = 4;\n return createAuthUri(getModularInstance(auth), request);\n\n case 4:\n _yield$createAuthUri = _context162.sent;\n signinMethods = _yield$createAuthUri.signinMethods;\n return _context162.abrupt(\"return\", signinMethods || []);\n\n case 7:\n case \"end\":\n return _context162.stop();\n }\n }\n }, _callee162);\n }));\n return _fetchSignInMethodsForEmail.apply(this, arguments);\n}\n\nfunction sendEmailVerification(_x166, _x167) {\n return _sendEmailVerification.apply(this, arguments);\n}\n/**\r\n * Sends a verification email to a new email address.\r\n *\r\n * @remarks\r\n * The user's email will be updated to the new one after being verified.\r\n *\r\n * If you have a custom email action handler, you can complete the verification process by calling\r\n * {@link applyActionCode}.\r\n *\r\n * @example\r\n * ```javascript\r\n * const actionCodeSettings = {\r\n * url: 'https://www.example.com/?email=user@example.com',\r\n * iOS: {\r\n * bundleId: 'com.example.ios'\r\n * },\r\n * android: {\r\n * packageName: 'com.example.android',\r\n * installApp: true,\r\n * minimumVersion: '12'\r\n * },\r\n * handleCodeInApp: true\r\n * };\r\n * await verifyBeforeUpdateEmail(user, 'newemail@example.com', actionCodeSettings);\r\n * // Obtain code from the user.\r\n * await applyActionCode(auth, code);\r\n * ```\r\n *\r\n * @param user - The user.\r\n * @param newEmail - The new email address to be verified before update.\r\n * @param actionCodeSettings - The {@link ActionCodeSettings}.\r\n *\r\n * @public\r\n */\n\n\nfunction _sendEmailVerification() {\n _sendEmailVerification = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee163(user, actionCodeSettings) {\n var userInternal, idToken, request, _yield$sendEmailVerif, email;\n\n return _regeneratorRuntime.wrap(function _callee163$(_context163) {\n while (1) {\n switch (_context163.prev = _context163.next) {\n case 0:\n userInternal = getModularInstance(user);\n _context163.next = 3;\n return user.getIdToken();\n\n case 3:\n idToken = _context163.sent;\n request = {\n requestType: \"VERIFY_EMAIL\"\n /* ActionCodeOperation.VERIFY_EMAIL */\n ,\n idToken: idToken\n };\n\n if (actionCodeSettings) {\n _setActionCodeSettingsOnRequest(userInternal.auth, request, actionCodeSettings);\n }\n\n _context163.next = 8;\n return sendEmailVerification$1(userInternal.auth, request);\n\n case 8:\n _yield$sendEmailVerif = _context163.sent;\n email = _yield$sendEmailVerif.email;\n\n if (!(email !== user.email)) {\n _context163.next = 13;\n break;\n }\n\n _context163.next = 13;\n return user.reload();\n\n case 13:\n case \"end\":\n return _context163.stop();\n }\n }\n }, _callee163);\n }));\n return _sendEmailVerification.apply(this, arguments);\n}\n\nfunction verifyBeforeUpdateEmail(_x168, _x169, _x170) {\n return _verifyBeforeUpdateEmail.apply(this, arguments);\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 */\n\n\nfunction _verifyBeforeUpdateEmail() {\n _verifyBeforeUpdateEmail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee164(user, newEmail, actionCodeSettings) {\n var userInternal, idToken, request, _yield$verifyAndChang, email;\n\n return _regeneratorRuntime.wrap(function _callee164$(_context164) {\n while (1) {\n switch (_context164.prev = _context164.next) {\n case 0:\n userInternal = getModularInstance(user);\n _context164.next = 3;\n return user.getIdToken();\n\n case 3:\n idToken = _context164.sent;\n request = {\n requestType: \"VERIFY_AND_CHANGE_EMAIL\"\n /* ActionCodeOperation.VERIFY_AND_CHANGE_EMAIL */\n ,\n idToken: idToken,\n newEmail: newEmail\n };\n\n if (actionCodeSettings) {\n _setActionCodeSettingsOnRequest(userInternal.auth, request, actionCodeSettings);\n }\n\n _context164.next = 8;\n return verifyAndChangeEmail(userInternal.auth, request);\n\n case 8:\n _yield$verifyAndChang = _context164.sent;\n email = _yield$verifyAndChang.email;\n\n if (!(email !== user.email)) {\n _context164.next = 13;\n break;\n }\n\n _context164.next = 13;\n return user.reload();\n\n case 13:\n case \"end\":\n return _context164.stop();\n }\n }\n }, _callee164);\n }));\n return _verifyBeforeUpdateEmail.apply(this, arguments);\n}\n\nfunction updateProfile$1(_x171, _x172) {\n return _updateProfile$.apply(this, arguments);\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 */\n\n/**\r\n * Updates a user's profile data.\r\n *\r\n * @param user - The user.\r\n * @param profile - The profile's `displayName` and `photoURL` to update.\r\n *\r\n * @public\r\n */\n\n\nfunction _updateProfile$() {\n _updateProfile$ = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee165(auth, request) {\n return _regeneratorRuntime.wrap(function _callee165$(_context165) {\n while (1) {\n switch (_context165.prev = _context165.next) {\n case 0:\n return _context165.abrupt(\"return\", _performApiRequest(auth, \"POST\"\n /* HttpMethod.POST */\n , \"/v1/accounts:update\"\n /* Endpoint.SET_ACCOUNT_INFO */\n , request));\n\n case 1:\n case \"end\":\n return _context165.stop();\n }\n }\n }, _callee165);\n }));\n return _updateProfile$.apply(this, arguments);\n}\n\nfunction updateProfile(_x173, _x174) {\n return _updateProfile.apply(this, arguments);\n}\n/**\r\n * Updates the user's email address.\r\n *\r\n * @remarks\r\n * An email will be sent to the original email address (if it was set) that allows to revoke the\r\n * email address change, in order to protect them from account hijacking.\r\n *\r\n * Important: this is a security sensitive operation that requires the user to have recently signed\r\n * in. If this requirement isn't met, ask the user to authenticate again and then call\r\n * {@link reauthenticateWithCredential}.\r\n *\r\n * @param user - The user.\r\n * @param newEmail - The new email address.\r\n *\r\n * Throws \"auth/operation-not-allowed\" error when [Email Enumeration Protection](https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection) is enabled.\r\n * Deprecated - Use {@link verifyBeforeUpdateEmail} instead.\r\n *\r\n * @public\r\n */\n\n\nfunction _updateProfile() {\n _updateProfile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee166(user, _ref21) {\n var displayName, photoUrl, userInternal, idToken, profileRequest, response, passwordProvider;\n return _regeneratorRuntime.wrap(function _callee166$(_context166) {\n while (1) {\n switch (_context166.prev = _context166.next) {\n case 0:\n displayName = _ref21.displayName, photoUrl = _ref21.photoURL;\n\n if (!(displayName === undefined && photoUrl === undefined)) {\n _context166.next = 3;\n break;\n }\n\n return _context166.abrupt(\"return\");\n\n case 3:\n userInternal = getModularInstance(user);\n _context166.next = 6;\n return userInternal.getIdToken();\n\n case 6:\n idToken = _context166.sent;\n profileRequest = {\n idToken: idToken,\n displayName: displayName,\n photoUrl: photoUrl,\n returnSecureToken: true\n };\n _context166.next = 10;\n return _logoutIfInvalidated(userInternal, updateProfile$1(userInternal.auth, profileRequest));\n\n case 10:\n response = _context166.sent;\n userInternal.displayName = response.displayName || null;\n userInternal.photoURL = response.photoUrl || null; // Update the password provider as well\n\n passwordProvider = userInternal.providerData.find(function (_ref44) {\n var providerId = _ref44.providerId;\n return providerId === \"password\";\n }\n /* ProviderId.PASSWORD */\n );\n\n if (passwordProvider) {\n passwordProvider.displayName = userInternal.displayName;\n passwordProvider.photoURL = userInternal.photoURL;\n }\n\n _context166.next = 17;\n return userInternal._updateTokensIfNecessary(response);\n\n case 17:\n case \"end\":\n return _context166.stop();\n }\n }\n }, _callee166);\n }));\n return _updateProfile.apply(this, arguments);\n}\n\nfunction updateEmail(user, newEmail) {\n return updateEmailOrPassword(getModularInstance(user), newEmail, null);\n}\n/**\r\n * Updates the user's password.\r\n *\r\n * @remarks\r\n * Important: this is a security sensitive operation that requires the user to have recently signed\r\n * in. If this requirement isn't met, ask the user to authenticate again and then call\r\n * {@link reauthenticateWithCredential}.\r\n *\r\n * @param user - The user.\r\n * @param newPassword - The new password.\r\n *\r\n * @public\r\n */\n\n\nfunction updatePassword(user, newPassword) {\n return updateEmailOrPassword(getModularInstance(user), null, newPassword);\n}\n\nfunction updateEmailOrPassword(_x175, _x176, _x177) {\n return _updateEmailOrPassword.apply(this, arguments);\n}\n/**\r\n * @license\r\n * Copyright 2019 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 */\n\n/**\r\n * Parse the `AdditionalUserInfo` from the ID token response.\r\n *\r\n */\n\n\nfunction _updateEmailOrPassword() {\n _updateEmailOrPassword = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee167(user, email, password) {\n var auth, idToken, request, response;\n return _regeneratorRuntime.wrap(function _callee167$(_context167) {\n while (1) {\n switch (_context167.prev = _context167.next) {\n case 0:\n auth = user.auth;\n _context167.next = 3;\n return user.getIdToken();\n\n case 3:\n idToken = _context167.sent;\n request = {\n idToken: idToken,\n returnSecureToken: true\n };\n\n if (email) {\n request.email = email;\n }\n\n if (password) {\n request.password = password;\n }\n\n _context167.next = 9;\n return _logoutIfInvalidated(user, updateEmailPassword(auth, request));\n\n case 9:\n response = _context167.sent;\n _context167.next = 12;\n return user._updateTokensIfNecessary(response,\n /* reload */\n true);\n\n case 12:\n case \"end\":\n return _context167.stop();\n }\n }\n }, _callee167);\n }));\n return _updateEmailOrPassword.apply(this, arguments);\n}\n\nfunction _fromIdTokenResponse(idTokenResponse) {\n var _a, _b;\n\n if (!idTokenResponse) {\n return null;\n }\n\n var providerId = idTokenResponse.providerId;\n var profile = idTokenResponse.rawUserInfo ? JSON.parse(idTokenResponse.rawUserInfo) : {};\n var isNewUser = idTokenResponse.isNewUser || idTokenResponse.kind === \"identitytoolkit#SignupNewUserResponse\"\n /* IdTokenResponseKind.SignupNewUser */\n ;\n\n if (!providerId && (idTokenResponse === null || idTokenResponse === void 0 ? void 0 : idTokenResponse.idToken)) {\n var signInProvider = (_b = (_a = _parseToken(idTokenResponse.idToken)) === null || _a === void 0 ? void 0 : _a.firebase) === null || _b === void 0 ? void 0 : _b['sign_in_provider'];\n\n if (signInProvider) {\n var filteredProviderId = signInProvider !== \"anonymous\"\n /* ProviderId.ANONYMOUS */\n && signInProvider !== \"custom\"\n /* ProviderId.CUSTOM */\n ? signInProvider : null; // Uses generic class in accordance with the legacy SDK.\n\n return new GenericAdditionalUserInfo(isNewUser, filteredProviderId);\n }\n }\n\n if (!providerId) {\n return null;\n }\n\n switch (providerId) {\n case \"facebook.com\"\n /* ProviderId.FACEBOOK */\n :\n return new FacebookAdditionalUserInfo(isNewUser, profile);\n\n case \"github.com\"\n /* ProviderId.GITHUB */\n :\n return new GithubAdditionalUserInfo(isNewUser, profile);\n\n case \"google.com\"\n /* ProviderId.GOOGLE */\n :\n return new GoogleAdditionalUserInfo(isNewUser, profile);\n\n case \"twitter.com\"\n /* ProviderId.TWITTER */\n :\n return new TwitterAdditionalUserInfo(isNewUser, profile, idTokenResponse.screenName || null);\n\n case \"custom\"\n /* ProviderId.CUSTOM */\n :\n case \"anonymous\"\n /* ProviderId.ANONYMOUS */\n :\n return new GenericAdditionalUserInfo(isNewUser, null);\n\n default:\n return new GenericAdditionalUserInfo(isNewUser, providerId, profile);\n }\n}\n\nvar GenericAdditionalUserInfo = /*#__PURE__*/_createClass(function GenericAdditionalUserInfo(isNewUser, providerId) {\n var profile = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n\n _classCallCheck(this, GenericAdditionalUserInfo);\n\n this.isNewUser = isNewUser;\n this.providerId = providerId;\n this.profile = profile;\n});\n\nvar FederatedAdditionalUserInfoWithUsername = /*#__PURE__*/function (_GenericAdditionalUse) {\n _inherits(FederatedAdditionalUserInfoWithUsername, _GenericAdditionalUse);\n\n var _super15 = _createSuper(FederatedAdditionalUserInfoWithUsername);\n\n function FederatedAdditionalUserInfoWithUsername(isNewUser, providerId, profile, username) {\n var _this20;\n\n _classCallCheck(this, FederatedAdditionalUserInfoWithUsername);\n\n _this20 = _super15.call(this, isNewUser, providerId, profile);\n _this20.username = username;\n return _this20;\n }\n\n return _createClass(FederatedAdditionalUserInfoWithUsername);\n}(GenericAdditionalUserInfo);\n\nvar FacebookAdditionalUserInfo = /*#__PURE__*/function (_GenericAdditionalUse2) {\n _inherits(FacebookAdditionalUserInfo, _GenericAdditionalUse2);\n\n var _super16 = _createSuper(FacebookAdditionalUserInfo);\n\n function FacebookAdditionalUserInfo(isNewUser, profile) {\n _classCallCheck(this, FacebookAdditionalUserInfo);\n\n return _super16.call(this, isNewUser, \"facebook.com\"\n /* ProviderId.FACEBOOK */\n , profile);\n }\n\n return _createClass(FacebookAdditionalUserInfo);\n}(GenericAdditionalUserInfo);\n\nvar GithubAdditionalUserInfo = /*#__PURE__*/function (_FederatedAdditionalU) {\n _inherits(GithubAdditionalUserInfo, _FederatedAdditionalU);\n\n var _super17 = _createSuper(GithubAdditionalUserInfo);\n\n function GithubAdditionalUserInfo(isNewUser, profile) {\n _classCallCheck(this, GithubAdditionalUserInfo);\n\n return _super17.call(this, isNewUser, \"github.com\"\n /* ProviderId.GITHUB */\n , profile, typeof (profile === null || profile === void 0 ? void 0 : profile.login) === 'string' ? profile === null || profile === void 0 ? void 0 : profile.login : null);\n }\n\n return _createClass(GithubAdditionalUserInfo);\n}(FederatedAdditionalUserInfoWithUsername);\n\nvar GoogleAdditionalUserInfo = /*#__PURE__*/function (_GenericAdditionalUse3) {\n _inherits(GoogleAdditionalUserInfo, _GenericAdditionalUse3);\n\n var _super18 = _createSuper(GoogleAdditionalUserInfo);\n\n function GoogleAdditionalUserInfo(isNewUser, profile) {\n _classCallCheck(this, GoogleAdditionalUserInfo);\n\n return _super18.call(this, isNewUser, \"google.com\"\n /* ProviderId.GOOGLE */\n , profile);\n }\n\n return _createClass(GoogleAdditionalUserInfo);\n}(GenericAdditionalUserInfo);\n\nvar TwitterAdditionalUserInfo = /*#__PURE__*/function (_FederatedAdditionalU2) {\n _inherits(TwitterAdditionalUserInfo, _FederatedAdditionalU2);\n\n var _super19 = _createSuper(TwitterAdditionalUserInfo);\n\n function TwitterAdditionalUserInfo(isNewUser, profile, screenName) {\n _classCallCheck(this, TwitterAdditionalUserInfo);\n\n return _super19.call(this, isNewUser, \"twitter.com\"\n /* ProviderId.TWITTER */\n , profile, screenName);\n }\n\n return _createClass(TwitterAdditionalUserInfo);\n}(FederatedAdditionalUserInfoWithUsername);\n/**\r\n * Extracts provider specific {@link AdditionalUserInfo} for the given credential.\r\n *\r\n * @param userCredential - The user credential.\r\n *\r\n * @public\r\n */\n\n\nfunction getAdditionalUserInfo(userCredential) {\n var user = userCredential.user,\n _tokenResponse = userCredential._tokenResponse;\n\n if (user.isAnonymous && !_tokenResponse) {\n // Handle the special case where signInAnonymously() gets called twice.\n // No network call is made so there's nothing to actually fill this in\n return {\n providerId: null,\n isNewUser: false,\n profile: null\n };\n }\n\n return _fromIdTokenResponse(_tokenResponse);\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 */\n// Non-optional auth methods.\n\n/**\r\n * Changes the type of persistence on the {@link Auth} instance for the currently saved\r\n * `Auth` session and applies this type of persistence for future sign-in requests, including\r\n * sign-in with redirect requests.\r\n *\r\n * @remarks\r\n * This makes it easy for a user signing in to specify whether their session should be\r\n * remembered or not. It also makes it easier to never persist the `Auth` state for applications\r\n * that are shared by other users or have sensitive data.\r\n *\r\n * This method does not work in a Node.js environment.\r\n *\r\n * @example\r\n * ```javascript\r\n * setPersistence(auth, browserSessionPersistence);\r\n * ```\r\n *\r\n * @param auth - The {@link Auth} instance.\r\n * @param persistence - The {@link Persistence} to use.\r\n * @returns A `Promise` that resolves once the persistence change has completed\r\n *\r\n * @public\r\n */\n\n\nfunction setPersistence(auth, persistence) {\n return getModularInstance(auth).setPersistence(persistence);\n}\n/**\r\n * Loads the reCAPTCHA configuration into the `Auth` instance.\r\n *\r\n * @remarks\r\n * This will load the reCAPTCHA config, which indicates whether the reCAPTCHA\r\n * verification flow should be triggered for each auth provider, into the\r\n * current Auth session.\r\n *\r\n * If initializeRecaptchaConfig() is not invoked, the auth flow will always start\r\n * without reCAPTCHA verification. If the provider is configured to require reCAPTCHA\r\n * verification, the SDK will transparently load the reCAPTCHA config and restart the\r\n * auth flows.\r\n *\r\n * Thus, by calling this optional method, you will reduce the latency of future auth flows.\r\n * Loading the reCAPTCHA config early will also enhance the signal collected by reCAPTCHA.\r\n *\r\n * This method does not work in a Node.js environment.\r\n *\r\n * @example\r\n * ```javascript\r\n * initializeRecaptchaConfig(auth);\r\n * ```\r\n *\r\n * @param auth - The {@link Auth} instance.\r\n *\r\n * @public\r\n */\n\n\nfunction initializeRecaptchaConfig(auth) {\n return _initializeRecaptchaConfig(auth);\n}\n/**\r\n * Validates the password against the password policy configured for the project or tenant.\r\n *\r\n * @remarks\r\n * If no tenant ID is set on the `Auth` instance, then this method will use the password\r\n * policy configured for the project. Otherwise, this method will use the policy configured\r\n * for the tenant. If a password policy has not been configured, then the default policy\r\n * configured for all projects will be used.\r\n *\r\n * If an auth flow fails because a submitted password does not meet the password policy\r\n * requirements and this method has previously been called, then this method will use the\r\n * most recent policy available when called again.\r\n *\r\n * @example\r\n * ```javascript\r\n * validatePassword(auth, 'some-password');\r\n * ```\r\n *\r\n * @param auth The {@link Auth} instance.\r\n * @param password The password to validate.\r\n *\r\n * @public\r\n */\n\n\nfunction validatePassword(_x178, _x179) {\n return _validatePassword2.apply(this, arguments);\n}\n/**\r\n * Adds an observer for changes to the signed-in user's ID token.\r\n *\r\n * @remarks\r\n * This includes sign-in, sign-out, and token refresh events.\r\n * This will not be triggered automatically upon ID token expiration. Use {@link User.getIdToken} to refresh the ID token.\r\n *\r\n * @param auth - The {@link Auth} instance.\r\n * @param nextOrObserver - callback triggered on change.\r\n * @param error - Deprecated. This callback is never triggered. Errors\r\n * on signing in/out can be caught in promises returned from\r\n * sign-in/sign-out functions.\r\n * @param completed - Deprecated. This callback is never triggered.\r\n *\r\n * @public\r\n */\n\n\nfunction _validatePassword2() {\n _validatePassword2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee168(auth, password) {\n var authInternal;\n return _regeneratorRuntime.wrap(function _callee168$(_context168) {\n while (1) {\n switch (_context168.prev = _context168.next) {\n case 0:\n authInternal = _castAuth(auth);\n return _context168.abrupt(\"return\", authInternal.validatePassword(password));\n\n case 2:\n case \"end\":\n return _context168.stop();\n }\n }\n }, _callee168);\n }));\n return _validatePassword2.apply(this, arguments);\n}\n\nfunction onIdTokenChanged(auth, nextOrObserver, error, completed) {\n return getModularInstance(auth).onIdTokenChanged(nextOrObserver, error, completed);\n}\n/**\r\n * Adds a blocking callback that runs before an auth state change\r\n * sets a new user.\r\n *\r\n * @param auth - The {@link Auth} instance.\r\n * @param callback - callback triggered before new user value is set.\r\n * If this throws, it blocks the user from being set.\r\n * @param onAbort - callback triggered if a later `beforeAuthStateChanged()`\r\n * callback throws, allowing you to undo any side effects.\r\n */\n\n\nfunction beforeAuthStateChanged(auth, callback, onAbort) {\n return getModularInstance(auth).beforeAuthStateChanged(callback, onAbort);\n}\n/**\r\n * Adds an observer for changes to the user's sign-in state.\r\n *\r\n * @remarks\r\n * To keep the old behavior, see {@link onIdTokenChanged}.\r\n *\r\n * @param auth - The {@link Auth} instance.\r\n * @param nextOrObserver - callback triggered on change.\r\n * @param error - Deprecated. This callback is never triggered. Errors\r\n * on signing in/out can be caught in promises returned from\r\n * sign-in/sign-out functions.\r\n * @param completed - Deprecated. This callback is never triggered.\r\n *\r\n * @public\r\n */\n\n\nfunction onAuthStateChanged(auth, nextOrObserver, error, completed) {\n return getModularInstance(auth).onAuthStateChanged(nextOrObserver, error, completed);\n}\n/**\r\n * Sets the current language to the default device/browser preference.\r\n *\r\n * @param auth - The {@link Auth} instance.\r\n *\r\n * @public\r\n */\n\n\nfunction useDeviceLanguage(auth) {\n getModularInstance(auth).useDeviceLanguage();\n}\n/**\r\n * Asynchronously sets the provided user as {@link Auth.currentUser} on the\r\n * {@link Auth} instance.\r\n *\r\n * @remarks\r\n * A new instance copy of the user provided will be made and set as currentUser.\r\n *\r\n * This will trigger {@link onAuthStateChanged} and {@link onIdTokenChanged} listeners\r\n * like other sign in methods.\r\n *\r\n * The operation fails with an error if the user to be updated belongs to a different Firebase\r\n * project.\r\n *\r\n * @param auth - The {@link Auth} instance.\r\n * @param user - The new {@link User}.\r\n *\r\n * @public\r\n */\n\n\nfunction updateCurrentUser(auth, user) {\n return getModularInstance(auth).updateCurrentUser(user);\n}\n/**\r\n * Signs out the current user.\r\n *\r\n * @param auth - The {@link Auth} instance.\r\n *\r\n * @public\r\n */\n\n\nfunction signOut(auth) {\n return getModularInstance(auth).signOut();\n}\n/**\r\n * Revokes the given access token. Currently only supports Apple OAuth access tokens.\r\n *\r\n * @param auth - The {@link Auth} instance.\r\n * @param token - The Apple OAuth access token.\r\n *\r\n * @public\r\n */\n\n\nfunction revokeAccessToken(auth, token) {\n var authInternal = _castAuth(auth);\n\n return authInternal.revokeAccessToken(token);\n}\n/**\r\n * Deletes and signs out the user.\r\n *\r\n * @remarks\r\n * Important: this is a security-sensitive operation that requires the user to have recently\r\n * signed in. If this requirement isn't met, ask the user to authenticate again and then call\r\n * {@link reauthenticateWithCredential}.\r\n *\r\n * @param user - The user.\r\n *\r\n * @public\r\n */\n\n\nfunction deleteUser(_x180) {\n return _deleteUser.apply(this, arguments);\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 */\n\n\nfunction _deleteUser() {\n _deleteUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee169(user) {\n return _regeneratorRuntime.wrap(function _callee169$(_context169) {\n while (1) {\n switch (_context169.prev = _context169.next) {\n case 0:\n return _context169.abrupt(\"return\", getModularInstance(user).delete());\n\n case 1:\n case \"end\":\n return _context169.stop();\n }\n }\n }, _callee169);\n }));\n return _deleteUser.apply(this, arguments);\n}\n\nvar MultiFactorSessionImpl = /*#__PURE__*/function () {\n function MultiFactorSessionImpl(type, credential, user) {\n _classCallCheck(this, MultiFactorSessionImpl);\n\n this.type = type;\n this.credential = credential;\n this.user = user;\n }\n\n _createClass(MultiFactorSessionImpl, [{\n key: \"toJSON\",\n value: function toJSON() {\n var key = this.type === \"enroll\"\n /* MultiFactorSessionType.ENROLL */\n ? 'idToken' : 'pendingCredential';\n return {\n multiFactorSession: _defineProperty({}, key, this.credential)\n };\n }\n }], [{\n key: \"_fromIdtoken\",\n value: function _fromIdtoken(idToken, user) {\n return new MultiFactorSessionImpl(\"enroll\"\n /* MultiFactorSessionType.ENROLL */\n , idToken, user);\n }\n }, {\n key: \"_fromMfaPendingCredential\",\n value: function _fromMfaPendingCredential(mfaPendingCredential) {\n return new MultiFactorSessionImpl(\"signin\"\n /* MultiFactorSessionType.SIGN_IN */\n , mfaPendingCredential);\n }\n }, {\n key: \"fromJSON\",\n value: function fromJSON(obj) {\n var _a, _b;\n\n if (obj === null || obj === void 0 ? void 0 : obj.multiFactorSession) {\n if ((_a = obj.multiFactorSession) === null || _a === void 0 ? void 0 : _a.pendingCredential) {\n return MultiFactorSessionImpl._fromMfaPendingCredential(obj.multiFactorSession.pendingCredential);\n } else if ((_b = obj.multiFactorSession) === null || _b === void 0 ? void 0 : _b.idToken) {\n return MultiFactorSessionImpl._fromIdtoken(obj.multiFactorSession.idToken);\n }\n }\n\n return null;\n }\n }]);\n\n return MultiFactorSessionImpl;\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 */\n\n\nvar MultiFactorResolverImpl = /*#__PURE__*/function () {\n function MultiFactorResolverImpl(session, hints, signInResolver) {\n _classCallCheck(this, MultiFactorResolverImpl);\n\n this.session = session;\n this.hints = hints;\n this.signInResolver = signInResolver;\n }\n /** @internal */\n\n\n _createClass(MultiFactorResolverImpl, [{\n key: \"resolveSignIn\",\n value: function () {\n var _resolveSignIn = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee51(assertionExtern) {\n var assertion;\n return _regeneratorRuntime.wrap(function _callee51$(_context51) {\n while (1) {\n switch (_context51.prev = _context51.next) {\n case 0:\n assertion = assertionExtern;\n return _context51.abrupt(\"return\", this.signInResolver(assertion));\n\n case 2:\n case \"end\":\n return _context51.stop();\n }\n }\n }, _callee51, this);\n }));\n\n function resolveSignIn(_x181) {\n return _resolveSignIn.apply(this, arguments);\n }\n\n return resolveSignIn;\n }()\n }], [{\n key: \"_fromError\",\n value: function _fromError(authExtern, error) {\n var auth = _castAuth(authExtern);\n\n var serverResponse = error.customData._serverResponse;\n var hints = (serverResponse.mfaInfo || []).map(function (enrollment) {\n return MultiFactorInfoImpl._fromServerResponse(auth, enrollment);\n });\n\n _assert(serverResponse.mfaPendingCredential, auth, \"internal-error\"\n /* AuthErrorCode.INTERNAL_ERROR */\n );\n\n var session = MultiFactorSessionImpl._fromMfaPendingCredential(serverResponse.mfaPendingCredential);\n\n return new MultiFactorResolverImpl(session, hints, /*#__PURE__*/function () {\n var _ref22 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee52(assertion) {\n var mfaResponse, idTokenResponse, userCredential;\n return _regeneratorRuntime.wrap(function _callee52$(_context52) {\n while (1) {\n switch (_context52.prev = _context52.next) {\n case 0:\n _context52.next = 2;\n return assertion._process(auth, session);\n\n case 2:\n mfaResponse = _context52.sent;\n // Clear out the unneeded fields from the old login response\n delete serverResponse.mfaInfo;\n delete serverResponse.mfaPendingCredential; // Use in the new token & refresh token in the old response\n\n idTokenResponse = Object.assign(Object.assign({}, serverResponse), {\n idToken: mfaResponse.idToken,\n refreshToken: mfaResponse.refreshToken\n }); // TODO: we should collapse this switch statement into UserCredentialImpl._forOperation and have it support the SIGN_IN case\n\n _context52.t0 = error.operationType;\n _context52.next = _context52.t0 === \"signIn\"\n /* OperationType.SIGN_IN */\n ? 9 : _context52.t0 === \"reauthenticate\"\n /* OperationType.REAUTHENTICATE */\n ? 15 : 17;\n break;\n\n case 9:\n _context52.next = 11;\n return UserCredentialImpl._fromIdTokenResponse(auth, error.operationType, idTokenResponse);\n\n case 11:\n userCredential = _context52.sent;\n _context52.next = 14;\n return auth._updateCurrentUser(userCredential.user);\n\n case 14:\n return _context52.abrupt(\"return\", userCredential);\n\n case 15:\n _assert(error.user, auth, \"internal-error\"\n /* AuthErrorCode.INTERNAL_ERROR */\n );\n\n return _context52.abrupt(\"return\", UserCredentialImpl._forOperation(error.user, error.operationType, idTokenResponse));\n\n case 17:\n _fail(auth, \"internal-error\"\n /* AuthErrorCode.INTERNAL_ERROR */\n );\n\n case 18:\n case \"end\":\n return _context52.stop();\n }\n }\n }, _callee52);\n }));\n\n return function (_x182) {\n return _ref22.apply(this, arguments);\n };\n }());\n }\n }]);\n\n return MultiFactorResolverImpl;\n}();\n/**\r\n * Provides a {@link MultiFactorResolver} suitable for completion of a\r\n * multi-factor flow.\r\n *\r\n * @param auth - The {@link Auth} instance.\r\n * @param error - The {@link MultiFactorError} raised during a sign-in, or\r\n * reauthentication operation.\r\n *\r\n * @public\r\n */\n\n\nfunction getMultiFactorResolver(auth, error) {\n var _a;\n\n var authModular = getModularInstance(auth);\n var errorInternal = error;\n\n _assert(error.customData.operationType, authModular, \"argument-error\"\n /* AuthErrorCode.ARGUMENT_ERROR */\n );\n\n _assert((_a = errorInternal.customData._serverResponse) === null || _a === void 0 ? void 0 : _a.mfaPendingCredential, authModular, \"argument-error\"\n /* AuthErrorCode.ARGUMENT_ERROR */\n );\n\n return MultiFactorResolverImpl._fromError(authModular, errorInternal);\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 */\n\n\nfunction startEnrollPhoneMfa(auth, request) {\n return _performApiRequest(auth, \"POST\"\n /* HttpMethod.POST */\n , \"/v2/accounts/mfaEnrollment:start\"\n /* Endpoint.START_MFA_ENROLLMENT */\n , _addTidIfNecessary(auth, request));\n}\n\nfunction finalizeEnrollPhoneMfa(auth, request) {\n return _performApiRequest(auth, \"POST\"\n /* HttpMethod.POST */\n , \"/v2/accounts/mfaEnrollment:finalize\"\n /* Endpoint.FINALIZE_MFA_ENROLLMENT */\n , _addTidIfNecessary(auth, request));\n}\n\nfunction startEnrollTotpMfa(auth, request) {\n return _performApiRequest(auth, \"POST\"\n /* HttpMethod.POST */\n , \"/v2/accounts/mfaEnrollment:start\"\n /* Endpoint.START_MFA_ENROLLMENT */\n , _addTidIfNecessary(auth, request));\n}\n\nfunction finalizeEnrollTotpMfa(auth, request) {\n return _performApiRequest(auth, \"POST\"\n /* HttpMethod.POST */\n , \"/v2/accounts/mfaEnrollment:finalize\"\n /* Endpoint.FINALIZE_MFA_ENROLLMENT */\n , _addTidIfNecessary(auth, request));\n}\n\nfunction withdrawMfa(auth, request) {\n return _performApiRequest(auth, \"POST\"\n /* HttpMethod.POST */\n , \"/v2/accounts/mfaEnrollment:withdraw\"\n /* Endpoint.WITHDRAW_MFA */\n , _addTidIfNecessary(auth, request));\n}\n\nvar MultiFactorUserImpl = /*#__PURE__*/function () {\n function MultiFactorUserImpl(user) {\n var _this21 = this;\n\n _classCallCheck(this, MultiFactorUserImpl);\n\n this.user = user;\n this.enrolledFactors = [];\n\n user._onReload(function (userInfo) {\n if (userInfo.mfaInfo) {\n _this21.enrolledFactors = userInfo.mfaInfo.map(function (enrollment) {\n return MultiFactorInfoImpl._fromServerResponse(user.auth, enrollment);\n });\n }\n });\n }\n\n _createClass(MultiFactorUserImpl, [{\n key: \"getSession\",\n value: function () {\n var _getSession = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee53() {\n return _regeneratorRuntime.wrap(function _callee53$(_context53) {\n while (1) {\n switch (_context53.prev = _context53.next) {\n case 0:\n _context53.t0 = MultiFactorSessionImpl;\n _context53.next = 3;\n return this.user.getIdToken();\n\n case 3:\n _context53.t1 = _context53.sent;\n _context53.t2 = this.user;\n return _context53.abrupt(\"return\", _context53.t0._fromIdtoken.call(_context53.t0, _context53.t1, _context53.t2));\n\n case 6:\n case \"end\":\n return _context53.stop();\n }\n }\n }, _callee53, this);\n }));\n\n function getSession() {\n return _getSession.apply(this, arguments);\n }\n\n return getSession;\n }()\n }, {\n key: \"enroll\",\n value: function () {\n var _enroll = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee54(assertionExtern, displayName) {\n var assertion, session, finalizeMfaResponse;\n return _regeneratorRuntime.wrap(function _callee54$(_context54) {\n while (1) {\n switch (_context54.prev = _context54.next) {\n case 0:\n assertion = assertionExtern;\n _context54.next = 3;\n return this.getSession();\n\n case 3:\n session = _context54.sent;\n _context54.next = 6;\n return _logoutIfInvalidated(this.user, assertion._process(this.user.auth, session, displayName));\n\n case 6:\n finalizeMfaResponse = _context54.sent;\n _context54.next = 9;\n return this.user._updateTokensIfNecessary(finalizeMfaResponse);\n\n case 9:\n return _context54.abrupt(\"return\", this.user.reload());\n\n case 10:\n case \"end\":\n return _context54.stop();\n }\n }\n }, _callee54, this);\n }));\n\n function enroll(_x183, _x184) {\n return _enroll.apply(this, arguments);\n }\n\n return enroll;\n }()\n }, {\n key: \"unenroll\",\n value: function () {\n var _unenroll = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee55(infoOrUid) {\n var mfaEnrollmentId, idToken, idTokenResponse;\n return _regeneratorRuntime.wrap(function _callee55$(_context55) {\n while (1) {\n switch (_context55.prev = _context55.next) {\n case 0:\n mfaEnrollmentId = typeof infoOrUid === 'string' ? infoOrUid : infoOrUid.uid;\n _context55.next = 3;\n return this.user.getIdToken();\n\n case 3:\n idToken = _context55.sent;\n _context55.prev = 4;\n _context55.next = 7;\n return _logoutIfInvalidated(this.user, withdrawMfa(this.user.auth, {\n idToken: idToken,\n mfaEnrollmentId: mfaEnrollmentId\n }));\n\n case 7:\n idTokenResponse = _context55.sent;\n // Remove the second factor from the user's list.\n this.enrolledFactors = this.enrolledFactors.filter(function (_ref23) {\n var uid = _ref23.uid;\n return uid !== mfaEnrollmentId;\n }); // Depending on whether the backend decided to revoke the user's session,\n // the tokenResponse may be empty. If the tokens were not updated (and they\n // are now invalid), reloading the user will discover this and invalidate\n // the user's state accordingly.\n\n _context55.next = 11;\n return this.user._updateTokensIfNecessary(idTokenResponse);\n\n case 11:\n _context55.next = 13;\n return this.user.reload();\n\n case 13:\n _context55.next = 18;\n break;\n\n case 15:\n _context55.prev = 15;\n _context55.t0 = _context55[\"catch\"](4);\n throw _context55.t0;\n\n case 18:\n case \"end\":\n return _context55.stop();\n }\n }\n }, _callee55, this, [[4, 15]]);\n }));\n\n function unenroll(_x185) {\n return _unenroll.apply(this, arguments);\n }\n\n return unenroll;\n }()\n }], [{\n key: \"_fromUser\",\n value: function _fromUser(user) {\n return new MultiFactorUserImpl(user);\n }\n }]);\n\n return MultiFactorUserImpl;\n}();\n\nvar multiFactorUserCache = new WeakMap();\n/**\r\n * The {@link MultiFactorUser} corresponding to the user.\r\n *\r\n * @remarks\r\n * This is used to access all multi-factor properties and operations related to the user.\r\n *\r\n * @param user - The user.\r\n *\r\n * @public\r\n */\n\nfunction multiFactor(user) {\n var userModular = getModularInstance(user);\n\n if (!multiFactorUserCache.has(userModular)) {\n multiFactorUserCache.set(userModular, MultiFactorUserImpl._fromUser(userModular));\n }\n\n return multiFactorUserCache.get(userModular);\n}\n\nvar STORAGE_AVAILABLE_KEY = '__sak';\n/**\r\n * @license\r\n * Copyright 2019 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 */\n// There are two different browser persistence types: local and session.\n// Both have the same implementation but use a different underlying storage\n// object.\n\nvar BrowserPersistenceClass = /*#__PURE__*/function () {\n function BrowserPersistenceClass(storageRetriever, type) {\n _classCallCheck(this, BrowserPersistenceClass);\n\n this.storageRetriever = storageRetriever;\n this.type = type;\n }\n\n _createClass(BrowserPersistenceClass, [{\n key: \"_isAvailable\",\n value: function _isAvailable() {\n try {\n if (!this.storage) {\n return Promise.resolve(false);\n }\n\n this.storage.setItem(STORAGE_AVAILABLE_KEY, '1');\n this.storage.removeItem(STORAGE_AVAILABLE_KEY);\n return Promise.resolve(true);\n } catch (_a) {\n return Promise.resolve(false);\n }\n }\n }, {\n key: \"_set\",\n value: function _set(key, value) {\n this.storage.setItem(key, JSON.stringify(value));\n return Promise.resolve();\n }\n }, {\n key: \"_get\",\n value: function _get(key) {\n var json = this.storage.getItem(key);\n return Promise.resolve(json ? JSON.parse(json) : null);\n }\n }, {\n key: \"_remove\",\n value: function _remove(key) {\n this.storage.removeItem(key);\n return Promise.resolve();\n }\n }, {\n key: \"storage\",\n get: function get() {\n return this.storageRetriever();\n }\n }]);\n\n return BrowserPersistenceClass;\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 */\n\n\nfunction _iframeCannotSyncWebStorage() {\n var ua = getUA();\n return _isSafari(ua) || _isIOS(ua);\n} // The polling period in case events are not supported\n\n\nvar _POLLING_INTERVAL_MS$1 = 1000; // The IE 10 localStorage cross tab synchronization delay in milliseconds\n\nvar IE10_LOCAL_STORAGE_SYNC_DELAY = 10;\n\nvar BrowserLocalPersistence = /*#__PURE__*/function (_BrowserPersistenceCl) {\n _inherits(BrowserLocalPersistence, _BrowserPersistenceCl);\n\n var _super20 = _createSuper(BrowserLocalPersistence);\n\n function BrowserLocalPersistence() {\n var _this22;\n\n _classCallCheck(this, BrowserLocalPersistence);\n\n _this22 = _super20.call(this, function () {\n return window.localStorage;\n }, \"LOCAL\"\n /* PersistenceType.LOCAL */\n );\n\n _this22.boundEventHandler = function (event, poll) {\n return _this22.onStorageEvent(event, poll);\n };\n\n _this22.listeners = {};\n _this22.localCache = {}; // setTimeout return value is platform specific\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n\n _this22.pollTimer = null; // Safari or iOS browser and embedded in an iframe.\n\n _this22.safariLocalStorageNotSynced = _iframeCannotSyncWebStorage() && _isIframe(); // Whether to use polling instead of depending on window events\n\n _this22.fallbackToPolling = _isMobileBrowser();\n _this22._shouldAllowMigration = true;\n return _this22;\n }\n\n _createClass(BrowserLocalPersistence, [{\n key: \"forAllChangedKeys\",\n value: function forAllChangedKeys(cb) {\n // Check all keys with listeners on them.\n for (var _i = 0, _Object$keys = Object.keys(this.listeners); _i < _Object$keys.length; _i++) {\n var key = _Object$keys[_i];\n // Get value from localStorage.\n var newValue = this.storage.getItem(key);\n var oldValue = this.localCache[key]; // If local map value does not match, trigger listener with storage event.\n // Differentiate this simulated event from the real storage event.\n\n if (newValue !== oldValue) {\n cb(key, oldValue, newValue);\n }\n }\n }\n }, {\n key: \"onStorageEvent\",\n value: function onStorageEvent(event) {\n var _this23 = this;\n\n var poll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n\n // Key would be null in some situations, like when localStorage is cleared\n if (!event.key) {\n this.forAllChangedKeys(function (key, _oldValue, newValue) {\n _this23.notifyListeners(key, newValue);\n });\n return;\n }\n\n var key = event.key; // Check the mechanism how this event was detected.\n // The first event will dictate the mechanism to be used.\n\n if (poll) {\n // Environment detects storage changes via polling.\n // Remove storage event listener to prevent possible event duplication.\n this.detachListener();\n } else {\n // Environment detects storage changes via storage event listener.\n // Remove polling listener to prevent possible event duplication.\n this.stopPolling();\n } // Safari embedded iframe. Storage event will trigger with the delta\n // changes but no changes will be applied to the iframe localStorage.\n\n\n if (this.safariLocalStorageNotSynced) {\n // Get current iframe page value.\n var _storedValue = this.storage.getItem(key); // Value not synchronized, synchronize manually.\n\n\n if (event.newValue !== _storedValue) {\n if (event.newValue !== null) {\n // Value changed from current value.\n this.storage.setItem(key, event.newValue);\n } else {\n // Current value deleted.\n this.storage.removeItem(key);\n }\n } else if (this.localCache[key] === event.newValue && !poll) {\n // Already detected and processed, do not trigger listeners again.\n return;\n }\n }\n\n var triggerListeners = function triggerListeners() {\n // Keep local map up to date in case storage event is triggered before\n // poll.\n var storedValue = _this23.storage.getItem(key);\n\n if (!poll && _this23.localCache[key] === storedValue) {\n // Real storage event which has already been detected, do nothing.\n // This seems to trigger in some IE browsers for some reason.\n return;\n }\n\n _this23.notifyListeners(key, storedValue);\n };\n\n var storedValue = this.storage.getItem(key);\n\n if (_isIE10() && storedValue !== event.newValue && event.newValue !== event.oldValue) {\n // IE 10 has this weird bug where a storage event would trigger with the\n // correct key, oldValue and newValue but localStorage.getItem(key) does\n // not yield the updated value until a few milliseconds. This ensures\n // this recovers from that situation.\n setTimeout(triggerListeners, IE10_LOCAL_STORAGE_SYNC_DELAY);\n } else {\n triggerListeners();\n }\n }\n }, {\n key: \"notifyListeners\",\n value: function notifyListeners(key, value) {\n this.localCache[key] = value;\n var listeners = this.listeners[key];\n\n if (listeners) {\n for (var _i2 = 0, _Array$from = Array.from(listeners); _i2 < _Array$from.length; _i2++) {\n var listener = _Array$from[_i2];\n listener(value ? JSON.parse(value) : value);\n }\n }\n }\n }, {\n key: \"startPolling\",\n value: function startPolling() {\n var _this24 = this;\n\n this.stopPolling();\n this.pollTimer = setInterval(function () {\n _this24.forAllChangedKeys(function (key, oldValue, newValue) {\n _this24.onStorageEvent(new StorageEvent('storage', {\n key: key,\n oldValue: oldValue,\n newValue: newValue\n }),\n /* poll */\n true);\n });\n }, _POLLING_INTERVAL_MS$1);\n }\n }, {\n key: \"stopPolling\",\n value: function stopPolling() {\n if (this.pollTimer) {\n clearInterval(this.pollTimer);\n this.pollTimer = null;\n }\n }\n }, {\n key: \"attachListener\",\n value: function attachListener() {\n window.addEventListener('storage', this.boundEventHandler);\n }\n }, {\n key: \"detachListener\",\n value: function detachListener() {\n window.removeEventListener('storage', this.boundEventHandler);\n }\n }, {\n key: \"_addListener\",\n value: function _addListener(key, listener) {\n if (Object.keys(this.listeners).length === 0) {\n // Whether browser can detect storage event when it had already been pushed to the background.\n // This may happen in some mobile browsers. A localStorage change in the foreground window\n // will not be detected in the background window via the storage event.\n // This was detected in iOS 7.x mobile browsers\n if (this.fallbackToPolling) {\n this.startPolling();\n } else {\n this.attachListener();\n }\n }\n\n if (!this.listeners[key]) {\n this.listeners[key] = new Set(); // Populate the cache to avoid spuriously triggering on first poll.\n\n this.localCache[key] = this.storage.getItem(key);\n }\n\n this.listeners[key].add(listener);\n }\n }, {\n key: \"_removeListener\",\n value: function _removeListener(key, listener) {\n if (this.listeners[key]) {\n this.listeners[key].delete(listener);\n\n if (this.listeners[key].size === 0) {\n delete this.listeners[key];\n }\n }\n\n if (Object.keys(this.listeners).length === 0) {\n this.detachListener();\n this.stopPolling();\n }\n } // Update local cache on base operations:\n\n }, {\n key: \"_set\",\n value: function () {\n var _set3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee56(key, value) {\n return _regeneratorRuntime.wrap(function _callee56$(_context56) {\n while (1) {\n switch (_context56.prev = _context56.next) {\n case 0:\n _context56.next = 2;\n return _get3(_getPrototypeOf(BrowserLocalPersistence.prototype), \"_set\", this).call(this, key, value);\n\n case 2:\n this.localCache[key] = JSON.stringify(value);\n\n case 3:\n case \"end\":\n return _context56.stop();\n }\n }\n }, _callee56, this);\n }));\n\n function _set(_x186, _x187) {\n return _set3.apply(this, arguments);\n }\n\n return _set;\n }()\n }, {\n key: \"_get\",\n value: function () {\n var _get4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee57(key) {\n var value;\n return _regeneratorRuntime.wrap(function _callee57$(_context57) {\n while (1) {\n switch (_context57.prev = _context57.next) {\n case 0:\n _context57.next = 2;\n return _get3(_getPrototypeOf(BrowserLocalPersistence.prototype), \"_get\", this).call(this, key);\n\n case 2:\n value = _context57.sent;\n this.localCache[key] = JSON.stringify(value);\n return _context57.abrupt(\"return\", value);\n\n case 5:\n case \"end\":\n return _context57.stop();\n }\n }\n }, _callee57, this);\n }));\n\n function _get(_x188) {\n return _get4.apply(this, arguments);\n }\n\n return _get;\n }()\n }, {\n key: \"_remove\",\n value: function () {\n var _remove3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee58(key) {\n return _regeneratorRuntime.wrap(function _callee58$(_context58) {\n while (1) {\n switch (_context58.prev = _context58.next) {\n case 0:\n _context58.next = 2;\n return _get3(_getPrototypeOf(BrowserLocalPersistence.prototype), \"_remove\", this).call(this, key);\n\n case 2:\n delete this.localCache[key];\n\n case 3:\n case \"end\":\n return _context58.stop();\n }\n }\n }, _callee58, this);\n }));\n\n function _remove(_x189) {\n return _remove3.apply(this, arguments);\n }\n\n return _remove;\n }()\n }]);\n\n return BrowserLocalPersistence;\n}(BrowserPersistenceClass);\n\nBrowserLocalPersistence.type = 'LOCAL';\n/**\r\n * An implementation of {@link Persistence} of type `LOCAL` using `localStorage`\r\n * for the underlying storage.\r\n *\r\n * @public\r\n */\n\nvar browserLocalPersistence = BrowserLocalPersistence;\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 */\n\nvar BrowserSessionPersistence = /*#__PURE__*/function (_BrowserPersistenceCl2) {\n _inherits(BrowserSessionPersistence, _BrowserPersistenceCl2);\n\n var _super21 = _createSuper(BrowserSessionPersistence);\n\n function BrowserSessionPersistence() {\n _classCallCheck(this, BrowserSessionPersistence);\n\n return _super21.call(this, function () {\n return window.sessionStorage;\n }, \"SESSION\"\n /* PersistenceType.SESSION */\n );\n }\n\n _createClass(BrowserSessionPersistence, [{\n key: \"_addListener\",\n value: function _addListener(_key, _listener) {\n // Listeners are not supported for session storage since it cannot be shared across windows\n return;\n }\n }, {\n key: \"_removeListener\",\n value: function _removeListener(_key, _listener) {\n // Listeners are not supported for session storage since it cannot be shared across windows\n return;\n }\n }]);\n\n return BrowserSessionPersistence;\n}(BrowserPersistenceClass);\n\nBrowserSessionPersistence.type = 'SESSION';\n/**\r\n * An implementation of {@link Persistence} of `SESSION` using `sessionStorage`\r\n * for the underlying storage.\r\n *\r\n * @public\r\n */\n\nvar browserSessionPersistence = BrowserSessionPersistence;\n/**\r\n * @license\r\n * Copyright 2019 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 */\n\n/**\r\n * Shim for Promise.allSettled, note the slightly different format of `fulfilled` vs `status`.\r\n *\r\n * @param promises - Array of promises to wait on.\r\n */\n\nfunction _allSettled(promises) {\n return Promise.all(promises.map( /*#__PURE__*/function () {\n var _ref24 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee59(promise) {\n var value;\n return _regeneratorRuntime.wrap(function _callee59$(_context59) {\n while (1) {\n switch (_context59.prev = _context59.next) {\n case 0:\n _context59.prev = 0;\n _context59.next = 3;\n return promise;\n\n case 3:\n value = _context59.sent;\n return _context59.abrupt(\"return\", {\n fulfilled: true,\n value: value\n });\n\n case 7:\n _context59.prev = 7;\n _context59.t0 = _context59[\"catch\"](0);\n return _context59.abrupt(\"return\", {\n fulfilled: false,\n reason: _context59.t0\n });\n\n case 10:\n case \"end\":\n return _context59.stop();\n }\n }\n }, _callee59, null, [[0, 7]]);\n }));\n\n return function (_x190) {\n return _ref24.apply(this, arguments);\n };\n }()));\n}\n/**\r\n * @license\r\n * Copyright 2019 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 */\n\n/**\r\n * Interface class for receiving messages.\r\n *\r\n */\n\n\nvar Receiver = /*#__PURE__*/function () {\n function Receiver(eventTarget) {\n _classCallCheck(this, Receiver);\n\n this.eventTarget = eventTarget;\n this.handlersMap = {};\n this.boundEventHandler = this.handleEvent.bind(this);\n }\n /**\r\n * Obtain an instance of a Receiver for a given event target, if none exists it will be created.\r\n *\r\n * @param eventTarget - An event target (such as window or self) through which the underlying\r\n * messages will be received.\r\n */\n\n\n _createClass(Receiver, [{\n key: \"isListeningto\",\n value: function isListeningto(eventTarget) {\n return this.eventTarget === eventTarget;\n }\n /**\r\n * Fans out a MessageEvent to the appropriate listeners.\r\n *\r\n * @remarks\r\n * Sends an {@link Status.ACK} upon receipt and a {@link Status.DONE} once all handlers have\r\n * finished processing.\r\n *\r\n * @param event - The MessageEvent.\r\n *\r\n */\n\n }, {\n key: \"handleEvent\",\n value: function () {\n var _handleEvent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee61(event) {\n var messageEvent, _messageEvent$data, eventId, eventType, data, handlers, promises, response;\n\n return _regeneratorRuntime.wrap(function _callee61$(_context61) {\n while (1) {\n switch (_context61.prev = _context61.next) {\n case 0:\n messageEvent = event;\n _messageEvent$data = messageEvent.data, eventId = _messageEvent$data.eventId, eventType = _messageEvent$data.eventType, data = _messageEvent$data.data;\n handlers = this.handlersMap[eventType];\n\n if (handlers === null || handlers === void 0 ? void 0 : handlers.size) {\n _context61.next = 5;\n break;\n }\n\n return _context61.abrupt(\"return\");\n\n case 5:\n messageEvent.ports[0].postMessage({\n status: \"ack\"\n /* _Status.ACK */\n ,\n eventId: eventId,\n eventType: eventType\n });\n promises = Array.from(handlers).map( /*#__PURE__*/function () {\n var _ref25 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee60(handler) {\n return _regeneratorRuntime.wrap(function _callee60$(_context60) {\n while (1) {\n switch (_context60.prev = _context60.next) {\n case 0:\n return _context60.abrupt(\"return\", handler(messageEvent.origin, data));\n\n case 1:\n case \"end\":\n return _context60.stop();\n }\n }\n }, _callee60);\n }));\n\n return function (_x192) {\n return _ref25.apply(this, arguments);\n };\n }());\n _context61.next = 9;\n return _allSettled(promises);\n\n case 9:\n response = _context61.sent;\n messageEvent.ports[0].postMessage({\n status: \"done\"\n /* _Status.DONE */\n ,\n eventId: eventId,\n eventType: eventType,\n response: response\n });\n\n case 11:\n case \"end\":\n return _context61.stop();\n }\n }\n }, _callee61, this);\n }));\n\n function handleEvent(_x191) {\n return _handleEvent.apply(this, arguments);\n }\n\n return handleEvent;\n }()\n /**\r\n * Subscribe an event handler for a particular event.\r\n *\r\n * @param eventType - Event name to subscribe to.\r\n * @param eventHandler - The event handler which should receive the events.\r\n *\r\n */\n\n }, {\n key: \"_subscribe\",\n value: function _subscribe(eventType, eventHandler) {\n if (Object.keys(this.handlersMap).length === 0) {\n this.eventTarget.addEventListener('message', this.boundEventHandler);\n }\n\n if (!this.handlersMap[eventType]) {\n this.handlersMap[eventType] = new Set();\n }\n\n this.handlersMap[eventType].add(eventHandler);\n }\n /**\r\n * Unsubscribe an event handler from a particular event.\r\n *\r\n * @param eventType - Event name to unsubscribe from.\r\n * @param eventHandler - Optinoal event handler, if none provided, unsubscribe all handlers on this event.\r\n *\r\n */\n\n }, {\n key: \"_unsubscribe\",\n value: function _unsubscribe(eventType, eventHandler) {\n if (this.handlersMap[eventType] && eventHandler) {\n this.handlersMap[eventType].delete(eventHandler);\n }\n\n if (!eventHandler || this.handlersMap[eventType].size === 0) {\n delete this.handlersMap[eventType];\n }\n\n if (Object.keys(this.handlersMap).length === 0) {\n this.eventTarget.removeEventListener('message', this.boundEventHandler);\n }\n }\n }], [{\n key: \"_getInstance\",\n value: function _getInstance(eventTarget) {\n // The results are stored in an array since objects can't be keys for other\n // objects. In addition, setting a unique property on an event target as a\n // hash map key may not be allowed due to CORS restrictions.\n var existingInstance = this.receivers.find(function (receiver) {\n return receiver.isListeningto(eventTarget);\n });\n\n if (existingInstance) {\n return existingInstance;\n }\n\n var newInstance = new Receiver(eventTarget);\n this.receivers.push(newInstance);\n return newInstance;\n }\n }]);\n\n return Receiver;\n}();\n\nReceiver.receivers = [];\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 */\n\nfunction _generateEventId() {\n var prefix = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';\n var digits = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 10;\n var random = '';\n\n for (var i = 0; i < digits; i++) {\n random += Math.floor(Math.random() * 10);\n }\n\n return prefix + random;\n}\n/**\r\n * @license\r\n * Copyright 2019 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 */\n\n/**\r\n * Interface for sending messages and waiting for a completion response.\r\n *\r\n */\n\n\nvar Sender = /*#__PURE__*/function () {\n function Sender(target) {\n _classCallCheck(this, Sender);\n\n this.target = target;\n this.handlers = new Set();\n }\n /**\r\n * Unsubscribe the handler and remove it from our tracking Set.\r\n *\r\n * @param handler - The handler to unsubscribe.\r\n */\n\n\n _createClass(Sender, [{\n key: \"removeMessageHandler\",\n value: function removeMessageHandler(handler) {\n if (handler.messageChannel) {\n handler.messageChannel.port1.removeEventListener('message', handler.onMessage);\n handler.messageChannel.port1.close();\n }\n\n this.handlers.delete(handler);\n }\n /**\r\n * Send a message to the Receiver located at {@link target}.\r\n *\r\n * @remarks\r\n * We'll first wait a bit for an ACK , if we get one we will wait significantly longer until the\r\n * receiver has had a chance to fully process the event.\r\n *\r\n * @param eventType - Type of event to send.\r\n * @param data - The payload of the event.\r\n * @param timeout - Timeout for waiting on an ACK from the receiver.\r\n *\r\n * @returns An array of settled promises from all the handlers that were listening on the receiver.\r\n */\n\n }, {\n key: \"_send\",\n value: function () {\n var _send2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee62(eventType, data) {\n var _this25 = this;\n\n var timeout,\n messageChannel,\n completionTimer,\n handler,\n _args62 = arguments;\n return _regeneratorRuntime.wrap(function _callee62$(_context62) {\n while (1) {\n switch (_context62.prev = _context62.next) {\n case 0:\n timeout = _args62.length > 2 && _args62[2] !== undefined ? _args62[2] : 50;\n messageChannel = typeof MessageChannel !== 'undefined' ? new MessageChannel() : null;\n\n if (messageChannel) {\n _context62.next = 4;\n break;\n }\n\n throw new Error(\"connection_unavailable\"\n /* _MessageError.CONNECTION_UNAVAILABLE */\n );\n\n case 4:\n return _context62.abrupt(\"return\", new Promise(function (resolve, reject) {\n var eventId = _generateEventId('', 20);\n\n messageChannel.port1.start();\n var ackTimer = setTimeout(function () {\n reject(new Error(\"unsupported_event\"\n /* _MessageError.UNSUPPORTED_EVENT */\n ));\n }, timeout);\n handler = {\n messageChannel: messageChannel,\n onMessage: function onMessage(event) {\n var messageEvent = event;\n\n if (messageEvent.data.eventId !== eventId) {\n return;\n }\n\n switch (messageEvent.data.status) {\n case \"ack\"\n /* _Status.ACK */\n :\n // The receiver should ACK first.\n clearTimeout(ackTimer);\n completionTimer = setTimeout(function () {\n reject(new Error(\"timeout\"\n /* _MessageError.TIMEOUT */\n ));\n }, 3000\n /* _TimeoutDuration.COMPLETION */\n );\n break;\n\n case \"done\"\n /* _Status.DONE */\n :\n // Once the receiver's handlers are finished we will get the results.\n clearTimeout(completionTimer);\n resolve(messageEvent.data.response);\n break;\n\n default:\n clearTimeout(ackTimer);\n clearTimeout(completionTimer);\n reject(new Error(\"invalid_response\"\n /* _MessageError.INVALID_RESPONSE */\n ));\n break;\n }\n }\n };\n\n _this25.handlers.add(handler);\n\n messageChannel.port1.addEventListener('message', handler.onMessage);\n\n _this25.target.postMessage({\n eventType: eventType,\n eventId: eventId,\n data: data\n }, [messageChannel.port2]);\n }).finally(function () {\n if (handler) {\n _this25.removeMessageHandler(handler);\n }\n }));\n\n case 5:\n case \"end\":\n return _context62.stop();\n }\n }\n }, _callee62);\n }));\n\n function _send(_x193, _x194) {\n return _send2.apply(this, arguments);\n }\n\n return _send;\n }()\n }]);\n\n return Sender;\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 */\n\n/**\r\n * Lazy accessor for window, since the compat layer won't tree shake this out,\r\n * we need to make sure not to mess with window unless we have to\r\n */\n\n\nfunction _window() {\n return window;\n}\n\nfunction _setWindowLocation(url) {\n _window().location.href = url;\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 */\n\n\nfunction _isWorker() {\n return typeof _window()['WorkerGlobalScope'] !== 'undefined' && typeof _window()['importScripts'] === 'function';\n}\n\nfunction _getActiveServiceWorker() {\n return _getActiveServiceWorker2.apply(this, arguments);\n}\n\nfunction _getActiveServiceWorker2() {\n _getActiveServiceWorker2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee170() {\n var registration;\n return _regeneratorRuntime.wrap(function _callee170$(_context170) {\n while (1) {\n switch (_context170.prev = _context170.next) {\n case 0:\n if (navigator === null || navigator === void 0 ? void 0 : navigator.serviceWorker) {\n _context170.next = 2;\n break;\n }\n\n return _context170.abrupt(\"return\", null);\n\n case 2:\n _context170.prev = 2;\n _context170.next = 5;\n return navigator.serviceWorker.ready;\n\n case 5:\n registration = _context170.sent;\n return _context170.abrupt(\"return\", registration.active);\n\n case 9:\n _context170.prev = 9;\n _context170.t0 = _context170[\"catch\"](2);\n return _context170.abrupt(\"return\", null);\n\n case 12:\n case \"end\":\n return _context170.stop();\n }\n }\n }, _callee170, null, [[2, 9]]);\n }));\n return _getActiveServiceWorker2.apply(this, arguments);\n}\n\nfunction _getServiceWorkerController() {\n var _a;\n\n return ((_a = navigator === null || navigator === void 0 ? void 0 : navigator.serviceWorker) === null || _a === void 0 ? void 0 : _a.controller) || null;\n}\n\nfunction _getWorkerGlobalScope() {\n return _isWorker() ? self : null;\n}\n/**\r\n * @license\r\n * Copyright 2019 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 */\n\n\nvar DB_NAME = 'firebaseLocalStorageDb';\nvar DB_VERSION = 1;\nvar DB_OBJECTSTORE_NAME = 'firebaseLocalStorage';\nvar DB_DATA_KEYPATH = 'fbase_key';\n/**\r\n * Promise wrapper for IDBRequest\r\n *\r\n * Unfortunately we can't cleanly extend Promise since promises are not callable in ES6\r\n *\r\n */\n\nvar DBPromise = /*#__PURE__*/function () {\n function DBPromise(request) {\n _classCallCheck(this, DBPromise);\n\n this.request = request;\n }\n\n _createClass(DBPromise, [{\n key: \"toPromise\",\n value: function toPromise() {\n var _this26 = this;\n\n return new Promise(function (resolve, reject) {\n _this26.request.addEventListener('success', function () {\n resolve(_this26.request.result);\n });\n\n _this26.request.addEventListener('error', function () {\n reject(_this26.request.error);\n });\n });\n }\n }]);\n\n return DBPromise;\n}();\n\nfunction getObjectStore(db, isReadWrite) {\n return db.transaction([DB_OBJECTSTORE_NAME], isReadWrite ? 'readwrite' : 'readonly').objectStore(DB_OBJECTSTORE_NAME);\n}\n\nfunction _deleteDatabase() {\n var request = indexedDB.deleteDatabase(DB_NAME);\n return new DBPromise(request).toPromise();\n}\n\nfunction _openDatabase() {\n var request = indexedDB.open(DB_NAME, DB_VERSION);\n return new Promise(function (resolve, reject) {\n request.addEventListener('error', function () {\n reject(request.error);\n });\n request.addEventListener('upgradeneeded', function () {\n var db = request.result;\n\n try {\n db.createObjectStore(DB_OBJECTSTORE_NAME, {\n keyPath: DB_DATA_KEYPATH\n });\n } catch (e) {\n reject(e);\n }\n });\n request.addEventListener('success', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee63() {\n var db;\n return _regeneratorRuntime.wrap(function _callee63$(_context63) {\n while (1) {\n switch (_context63.prev = _context63.next) {\n case 0:\n db = request.result; // Strange bug that occurs in Firefox when multiple tabs are opened at the\n // same time. The only way to recover seems to be deleting the database\n // and re-initializing it.\n // https://github.com/firebase/firebase-js-sdk/issues/634\n\n if (db.objectStoreNames.contains(DB_OBJECTSTORE_NAME)) {\n _context63.next = 12;\n break;\n }\n\n // Need to close the database or else you get a `blocked` event\n db.close();\n _context63.next = 5;\n return _deleteDatabase();\n\n case 5:\n _context63.t0 = resolve;\n _context63.next = 8;\n return _openDatabase();\n\n case 8:\n _context63.t1 = _context63.sent;\n (0, _context63.t0)(_context63.t1);\n _context63.next = 13;\n break;\n\n case 12:\n resolve(db);\n\n case 13:\n case \"end\":\n return _context63.stop();\n }\n }\n }, _callee63);\n })));\n });\n}\n\nfunction _putObject(_x195, _x196, _x197) {\n return _putObject2.apply(this, arguments);\n}\n\nfunction _putObject2() {\n _putObject2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee171(db, key, value) {\n var _getObjectStore$put;\n\n var request;\n return _regeneratorRuntime.wrap(function _callee171$(_context171) {\n while (1) {\n switch (_context171.prev = _context171.next) {\n case 0:\n request = getObjectStore(db, true).put((_getObjectStore$put = {}, _defineProperty(_getObjectStore$put, DB_DATA_KEYPATH, key), _defineProperty(_getObjectStore$put, \"value\", value), _getObjectStore$put));\n return _context171.abrupt(\"return\", new DBPromise(request).toPromise());\n\n case 2:\n case \"end\":\n return _context171.stop();\n }\n }\n }, _callee171);\n }));\n return _putObject2.apply(this, arguments);\n}\n\nfunction getObject(_x198, _x199) {\n return _getObject.apply(this, arguments);\n}\n\nfunction _getObject() {\n _getObject = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee172(db, key) {\n var request, data;\n return _regeneratorRuntime.wrap(function _callee172$(_context172) {\n while (1) {\n switch (_context172.prev = _context172.next) {\n case 0:\n request = getObjectStore(db, false).get(key);\n _context172.next = 3;\n return new DBPromise(request).toPromise();\n\n case 3:\n data = _context172.sent;\n return _context172.abrupt(\"return\", data === undefined ? null : data.value);\n\n case 5:\n case \"end\":\n return _context172.stop();\n }\n }\n }, _callee172);\n }));\n return _getObject.apply(this, arguments);\n}\n\nfunction _deleteObject(db, key) {\n var request = getObjectStore(db, true).delete(key);\n return new DBPromise(request).toPromise();\n}\n\nvar _POLLING_INTERVAL_MS = 800;\nvar _TRANSACTION_RETRY_COUNT = 3;\n\nvar IndexedDBLocalPersistence = /*#__PURE__*/function () {\n function IndexedDBLocalPersistence() {\n _classCallCheck(this, IndexedDBLocalPersistence);\n\n this.type = \"LOCAL\"\n /* PersistenceType.LOCAL */\n ;\n this._shouldAllowMigration = true;\n this.listeners = {};\n this.localCache = {}; // setTimeout return value is platform specific\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n\n this.pollTimer = null;\n this.pendingWrites = 0;\n this.receiver = null;\n this.sender = null;\n this.serviceWorkerReceiverAvailable = false;\n this.activeServiceWorker = null; // Fire & forget the service worker registration as it may never resolve\n\n this._workerInitializationPromise = this.initializeServiceWorkerMessaging().then(function () {}, function () {});\n }\n\n _createClass(IndexedDBLocalPersistence, [{\n key: \"_openDb\",\n value: function () {\n var _openDb2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee64() {\n return _regeneratorRuntime.wrap(function _callee64$(_context64) {\n while (1) {\n switch (_context64.prev = _context64.next) {\n case 0:\n if (!this.db) {\n _context64.next = 2;\n break;\n }\n\n return _context64.abrupt(\"return\", this.db);\n\n case 2:\n _context64.next = 4;\n return _openDatabase();\n\n case 4:\n this.db = _context64.sent;\n return _context64.abrupt(\"return\", this.db);\n\n case 6:\n case \"end\":\n return _context64.stop();\n }\n }\n }, _callee64, this);\n }));\n\n function _openDb() {\n return _openDb2.apply(this, arguments);\n }\n\n return _openDb;\n }()\n }, {\n key: \"_withRetries\",\n value: function () {\n var _withRetries2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee65(op) {\n var numAttempts, db;\n return _regeneratorRuntime.wrap(function _callee65$(_context65) {\n while (1) {\n switch (_context65.prev = _context65.next) {\n case 0:\n numAttempts = 0;\n\n case 1:\n if (!true) {\n _context65.next = 18;\n break;\n }\n\n _context65.prev = 2;\n _context65.next = 5;\n return this._openDb();\n\n case 5:\n db = _context65.sent;\n _context65.next = 8;\n return op(db);\n\n case 8:\n return _context65.abrupt(\"return\", _context65.sent);\n\n case 11:\n _context65.prev = 11;\n _context65.t0 = _context65[\"catch\"](2);\n\n if (!(numAttempts++ > _TRANSACTION_RETRY_COUNT)) {\n _context65.next = 15;\n break;\n }\n\n throw _context65.t0;\n\n case 15:\n if (this.db) {\n this.db.close();\n this.db = undefined;\n } // TODO: consider adding exponential backoff\n\n\n case 16:\n _context65.next = 1;\n break;\n\n case 18:\n case \"end\":\n return _context65.stop();\n }\n }\n }, _callee65, this, [[2, 11]]);\n }));\n\n function _withRetries(_x200) {\n return _withRetries2.apply(this, arguments);\n }\n\n return _withRetries;\n }()\n /**\r\n * IndexedDB events do not propagate from the main window to the worker context. We rely on a\r\n * postMessage interface to send these events to the worker ourselves.\r\n */\n\n }, {\n key: \"initializeServiceWorkerMessaging\",\n value: function () {\n var _initializeServiceWorkerMessaging = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee66() {\n return _regeneratorRuntime.wrap(function _callee66$(_context66) {\n while (1) {\n switch (_context66.prev = _context66.next) {\n case 0:\n return _context66.abrupt(\"return\", _isWorker() ? this.initializeReceiver() : this.initializeSender());\n\n case 1:\n case \"end\":\n return _context66.stop();\n }\n }\n }, _callee66, this);\n }));\n\n function initializeServiceWorkerMessaging() {\n return _initializeServiceWorkerMessaging.apply(this, arguments);\n }\n\n return initializeServiceWorkerMessaging;\n }()\n /**\r\n * As the worker we should listen to events from the main window.\r\n */\n\n }, {\n key: \"initializeReceiver\",\n value: function () {\n var _initializeReceiver = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee69() {\n var _this27 = this;\n\n return _regeneratorRuntime.wrap(function _callee69$(_context69) {\n while (1) {\n switch (_context69.prev = _context69.next) {\n case 0:\n this.receiver = Receiver._getInstance(_getWorkerGlobalScope()); // Refresh from persistence if we receive a KeyChanged message.\n\n this.receiver._subscribe(\"keyChanged\"\n /* _EventType.KEY_CHANGED */\n , /*#__PURE__*/function () {\n var _ref27 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee67(_origin, data) {\n var keys;\n return _regeneratorRuntime.wrap(function _callee67$(_context67) {\n while (1) {\n switch (_context67.prev = _context67.next) {\n case 0:\n _context67.next = 2;\n return _this27._poll();\n\n case 2:\n keys = _context67.sent;\n return _context67.abrupt(\"return\", {\n keyProcessed: keys.includes(data.key)\n });\n\n case 4:\n case \"end\":\n return _context67.stop();\n }\n }\n }, _callee67);\n }));\n\n return function (_x201, _x202) {\n return _ref27.apply(this, arguments);\n };\n }()); // Let the sender know that we are listening so they give us more timeout.\n\n\n this.receiver._subscribe(\"ping\"\n /* _EventType.PING */\n , /*#__PURE__*/function () {\n var _ref28 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee68(_origin, _data) {\n return _regeneratorRuntime.wrap(function _callee68$(_context68) {\n while (1) {\n switch (_context68.prev = _context68.next) {\n case 0:\n return _context68.abrupt(\"return\", [\"keyChanged\"\n /* _EventType.KEY_CHANGED */\n ]);\n\n case 1:\n case \"end\":\n return _context68.stop();\n }\n }\n }, _callee68);\n }));\n\n return function (_x203, _x204) {\n return _ref28.apply(this, arguments);\n };\n }());\n\n case 3:\n case \"end\":\n return _context69.stop();\n }\n }\n }, _callee69, this);\n }));\n\n function initializeReceiver() {\n return _initializeReceiver.apply(this, arguments);\n }\n\n return initializeReceiver;\n }()\n /**\r\n * As the main window, we should let the worker know when keys change (set and remove).\r\n *\r\n * @remarks\r\n * {@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/ready | ServiceWorkerContainer.ready}\r\n * may not resolve.\r\n */\n\n }, {\n key: \"initializeSender\",\n value: function () {\n var _initializeSender = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee70() {\n var _a, _b, results;\n\n return _regeneratorRuntime.wrap(function _callee70$(_context70) {\n while (1) {\n switch (_context70.prev = _context70.next) {\n case 0:\n _context70.next = 2;\n return _getActiveServiceWorker();\n\n case 2:\n this.activeServiceWorker = _context70.sent;\n\n if (this.activeServiceWorker) {\n _context70.next = 5;\n break;\n }\n\n return _context70.abrupt(\"return\");\n\n case 5:\n this.sender = new Sender(this.activeServiceWorker); // Ping the service worker to check what events they can handle.\n\n _context70.next = 8;\n return this.sender._send(\"ping\"\n /* _EventType.PING */\n , {}, 800\n /* _TimeoutDuration.LONG_ACK */\n );\n\n case 8:\n results = _context70.sent;\n\n if (results) {\n _context70.next = 11;\n break;\n }\n\n return _context70.abrupt(\"return\");\n\n case 11:\n if (((_a = results[0]) === null || _a === void 0 ? void 0 : _a.fulfilled) && ((_b = results[0]) === null || _b === void 0 ? void 0 : _b.value.includes(\"keyChanged\"\n /* _EventType.KEY_CHANGED */\n ))) {\n this.serviceWorkerReceiverAvailable = true;\n }\n\n case 12:\n case \"end\":\n return _context70.stop();\n }\n }\n }, _callee70, this);\n }));\n\n function initializeSender() {\n return _initializeSender.apply(this, arguments);\n }\n\n return initializeSender;\n }()\n /**\r\n * Let the worker know about a changed key, the exact key doesn't technically matter since the\r\n * worker will just trigger a full sync anyway.\r\n *\r\n * @remarks\r\n * For now, we only support one service worker per page.\r\n *\r\n * @param key - Storage key which changed.\r\n */\n\n }, {\n key: \"notifyServiceWorker\",\n value: function () {\n var _notifyServiceWorker = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee71(key) {\n return _regeneratorRuntime.wrap(function _callee71$(_context71) {\n while (1) {\n switch (_context71.prev = _context71.next) {\n case 0:\n if (!(!this.sender || !this.activeServiceWorker || _getServiceWorkerController() !== this.activeServiceWorker)) {\n _context71.next = 2;\n break;\n }\n\n return _context71.abrupt(\"return\");\n\n case 2:\n _context71.prev = 2;\n _context71.next = 5;\n return this.sender._send(\"keyChanged\"\n /* _EventType.KEY_CHANGED */\n , {\n key: key\n }, // Use long timeout if receiver has previously responded to a ping from us.\n this.serviceWorkerReceiverAvailable ? 800\n /* _TimeoutDuration.LONG_ACK */\n : 50\n /* _TimeoutDuration.ACK */\n );\n\n case 5:\n _context71.next = 9;\n break;\n\n case 7:\n _context71.prev = 7;\n _context71.t0 = _context71[\"catch\"](2);\n\n case 9:\n case \"end\":\n return _context71.stop();\n }\n }\n }, _callee71, this, [[2, 7]]);\n }));\n\n function notifyServiceWorker(_x205) {\n return _notifyServiceWorker.apply(this, arguments);\n }\n\n return notifyServiceWorker;\n }()\n }, {\n key: \"_isAvailable\",\n value: function () {\n var _isAvailable3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee72() {\n var db;\n return _regeneratorRuntime.wrap(function _callee72$(_context72) {\n while (1) {\n switch (_context72.prev = _context72.next) {\n case 0:\n _context72.prev = 0;\n\n if (indexedDB) {\n _context72.next = 3;\n break;\n }\n\n return _context72.abrupt(\"return\", false);\n\n case 3:\n _context72.next = 5;\n return _openDatabase();\n\n case 5:\n db = _context72.sent;\n _context72.next = 8;\n return _putObject(db, STORAGE_AVAILABLE_KEY, '1');\n\n case 8:\n _context72.next = 10;\n return _deleteObject(db, STORAGE_AVAILABLE_KEY);\n\n case 10:\n return _context72.abrupt(\"return\", true);\n\n case 13:\n _context72.prev = 13;\n _context72.t0 = _context72[\"catch\"](0);\n\n case 15:\n return _context72.abrupt(\"return\", false);\n\n case 16:\n case \"end\":\n return _context72.stop();\n }\n }\n }, _callee72, null, [[0, 13]]);\n }));\n\n function _isAvailable() {\n return _isAvailable3.apply(this, arguments);\n }\n\n return _isAvailable;\n }()\n }, {\n key: \"_withPendingWrite\",\n value: function () {\n var _withPendingWrite2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee73(write) {\n return _regeneratorRuntime.wrap(function _callee73$(_context73) {\n while (1) {\n switch (_context73.prev = _context73.next) {\n case 0:\n this.pendingWrites++;\n _context73.prev = 1;\n _context73.next = 4;\n return write();\n\n case 4:\n _context73.prev = 4;\n this.pendingWrites--;\n return _context73.finish(4);\n\n case 7:\n case \"end\":\n return _context73.stop();\n }\n }\n }, _callee73, this, [[1,, 4, 7]]);\n }));\n\n function _withPendingWrite(_x206) {\n return _withPendingWrite2.apply(this, arguments);\n }\n\n return _withPendingWrite;\n }()\n }, {\n key: \"_set\",\n value: function () {\n var _set4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee75(key, value) {\n var _this28 = this;\n\n return _regeneratorRuntime.wrap(function _callee75$(_context75) {\n while (1) {\n switch (_context75.prev = _context75.next) {\n case 0:\n return _context75.abrupt(\"return\", this._withPendingWrite( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee74() {\n return _regeneratorRuntime.wrap(function _callee74$(_context74) {\n while (1) {\n switch (_context74.prev = _context74.next) {\n case 0:\n _context74.next = 2;\n return _this28._withRetries(function (db) {\n return _putObject(db, key, value);\n });\n\n case 2:\n _this28.localCache[key] = value;\n return _context74.abrupt(\"return\", _this28.notifyServiceWorker(key));\n\n case 4:\n case \"end\":\n return _context74.stop();\n }\n }\n }, _callee74);\n }))));\n\n case 1:\n case \"end\":\n return _context75.stop();\n }\n }\n }, _callee75, this);\n }));\n\n function _set(_x207, _x208) {\n return _set4.apply(this, arguments);\n }\n\n return _set;\n }()\n }, {\n key: \"_get\",\n value: function () {\n var _get5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee76(key) {\n var obj;\n return _regeneratorRuntime.wrap(function _callee76$(_context76) {\n while (1) {\n switch (_context76.prev = _context76.next) {\n case 0:\n _context76.next = 2;\n return this._withRetries(function (db) {\n return getObject(db, key);\n });\n\n case 2:\n obj = _context76.sent;\n this.localCache[key] = obj;\n return _context76.abrupt(\"return\", obj);\n\n case 5:\n case \"end\":\n return _context76.stop();\n }\n }\n }, _callee76, this);\n }));\n\n function _get(_x209) {\n return _get5.apply(this, arguments);\n }\n\n return _get;\n }()\n }, {\n key: \"_remove\",\n value: function () {\n var _remove4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee78(key) {\n var _this29 = this;\n\n return _regeneratorRuntime.wrap(function _callee78$(_context78) {\n while (1) {\n switch (_context78.prev = _context78.next) {\n case 0:\n return _context78.abrupt(\"return\", this._withPendingWrite( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee77() {\n return _regeneratorRuntime.wrap(function _callee77$(_context77) {\n while (1) {\n switch (_context77.prev = _context77.next) {\n case 0:\n _context77.next = 2;\n return _this29._withRetries(function (db) {\n return _deleteObject(db, key);\n });\n\n case 2:\n delete _this29.localCache[key];\n return _context77.abrupt(\"return\", _this29.notifyServiceWorker(key));\n\n case 4:\n case \"end\":\n return _context77.stop();\n }\n }\n }, _callee77);\n }))));\n\n case 1:\n case \"end\":\n return _context78.stop();\n }\n }\n }, _callee78, this);\n }));\n\n function _remove(_x210) {\n return _remove4.apply(this, arguments);\n }\n\n return _remove;\n }()\n }, {\n key: \"_poll\",\n value: function () {\n var _poll2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee79() {\n var result, keys, keysInResult, _iterator5, _step5, _step5$value, key, value, _i3, _Object$keys2, localKey;\n\n return _regeneratorRuntime.wrap(function _callee79$(_context79) {\n while (1) {\n switch (_context79.prev = _context79.next) {\n case 0:\n _context79.next = 2;\n return this._withRetries(function (db) {\n var getAllRequest = getObjectStore(db, false).getAll();\n return new DBPromise(getAllRequest).toPromise();\n });\n\n case 2:\n result = _context79.sent;\n\n if (result) {\n _context79.next = 5;\n break;\n }\n\n return _context79.abrupt(\"return\", []);\n\n case 5:\n if (!(this.pendingWrites !== 0)) {\n _context79.next = 7;\n break;\n }\n\n return _context79.abrupt(\"return\", []);\n\n case 7:\n keys = [];\n keysInResult = new Set();\n\n if (result.length !== 0) {\n _iterator5 = _createForOfIteratorHelper(result);\n\n try {\n for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {\n _step5$value = _step5.value, key = _step5$value.fbase_key, value = _step5$value.value;\n keysInResult.add(key);\n\n if (JSON.stringify(this.localCache[key]) !== JSON.stringify(value)) {\n this.notifyListeners(key, value);\n keys.push(key);\n }\n }\n } catch (err) {\n _iterator5.e(err);\n } finally {\n _iterator5.f();\n }\n }\n\n for (_i3 = 0, _Object$keys2 = Object.keys(this.localCache); _i3 < _Object$keys2.length; _i3++) {\n localKey = _Object$keys2[_i3];\n\n if (this.localCache[localKey] && !keysInResult.has(localKey)) {\n // Deleted\n this.notifyListeners(localKey, null);\n keys.push(localKey);\n }\n }\n\n return _context79.abrupt(\"return\", keys);\n\n case 12:\n case \"end\":\n return _context79.stop();\n }\n }\n }, _callee79, this);\n }));\n\n function _poll() {\n return _poll2.apply(this, arguments);\n }\n\n return _poll;\n }()\n }, {\n key: \"notifyListeners\",\n value: function notifyListeners(key, newValue) {\n this.localCache[key] = newValue;\n var listeners = this.listeners[key];\n\n if (listeners) {\n for (var _i4 = 0, _Array$from2 = Array.from(listeners); _i4 < _Array$from2.length; _i4++) {\n var listener = _Array$from2[_i4];\n listener(newValue);\n }\n }\n }\n }, {\n key: \"startPolling\",\n value: function startPolling() {\n var _this30 = this;\n\n this.stopPolling();\n this.pollTimer = setInterval( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee80() {\n return _regeneratorRuntime.wrap(function _callee80$(_context80) {\n while (1) {\n switch (_context80.prev = _context80.next) {\n case 0:\n return _context80.abrupt(\"return\", _this30._poll());\n\n case 1:\n case \"end\":\n return _context80.stop();\n }\n }\n }, _callee80);\n })), _POLLING_INTERVAL_MS);\n }\n }, {\n key: \"stopPolling\",\n value: function stopPolling() {\n if (this.pollTimer) {\n clearInterval(this.pollTimer);\n this.pollTimer = null;\n }\n }\n }, {\n key: \"_addListener\",\n value: function _addListener(key, listener) {\n if (Object.keys(this.listeners).length === 0) {\n this.startPolling();\n }\n\n if (!this.listeners[key]) {\n this.listeners[key] = new Set(); // Populate the cache to avoid spuriously triggering on first poll.\n\n void this._get(key); // This can happen in the background async and we can return immediately.\n }\n\n this.listeners[key].add(listener);\n }\n }, {\n key: \"_removeListener\",\n value: function _removeListener(key, listener) {\n if (this.listeners[key]) {\n this.listeners[key].delete(listener);\n\n if (this.listeners[key].size === 0) {\n delete this.listeners[key];\n }\n }\n\n if (Object.keys(this.listeners).length === 0) {\n this.stopPolling();\n }\n }\n }]);\n\n return IndexedDBLocalPersistence;\n}();\n\nIndexedDBLocalPersistence.type = 'LOCAL';\n/**\r\n * An implementation of {@link Persistence} of type `LOCAL` using `indexedDB`\r\n * for the underlying storage.\r\n *\r\n * @public\r\n */\n\nvar indexedDBLocalPersistence = IndexedDBLocalPersistence;\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 */\n\nfunction startSignInPhoneMfa(auth, request) {\n return _performApiRequest(auth, \"POST\"\n /* HttpMethod.POST */\n , \"/v2/accounts/mfaSignIn:start\"\n /* Endpoint.START_MFA_SIGN_IN */\n , _addTidIfNecessary(auth, request));\n}\n\nfunction finalizeSignInPhoneMfa(auth, request) {\n return _performApiRequest(auth, \"POST\"\n /* HttpMethod.POST */\n , \"/v2/accounts/mfaSignIn:finalize\"\n /* Endpoint.FINALIZE_MFA_SIGN_IN */\n , _addTidIfNecessary(auth, request));\n}\n\nfunction finalizeSignInTotpMfa(auth, request) {\n return _performApiRequest(auth, \"POST\"\n /* HttpMethod.POST */\n , \"/v2/accounts/mfaSignIn:finalize\"\n /* Endpoint.FINALIZE_MFA_SIGN_IN */\n , _addTidIfNecessary(auth, request));\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 */\n\n\nvar _SOLVE_TIME_MS = 500;\nvar _EXPIRATION_TIME_MS = 60000;\nvar _WIDGET_ID_START = 1000000000000;\n\nvar MockReCaptcha = /*#__PURE__*/function () {\n function MockReCaptcha(auth) {\n _classCallCheck(this, MockReCaptcha);\n\n this.auth = auth;\n this.counter = _WIDGET_ID_START;\n this._widgets = new Map();\n }\n\n _createClass(MockReCaptcha, [{\n key: \"render\",\n value: function render(container, parameters) {\n var id = this.counter;\n\n this._widgets.set(id, new MockWidget(container, this.auth.name, parameters || {}));\n\n this.counter++;\n return id;\n }\n }, {\n key: \"reset\",\n value: function reset(optWidgetId) {\n var _a;\n\n var id = optWidgetId || _WIDGET_ID_START;\n void ((_a = this._widgets.get(id)) === null || _a === void 0 ? void 0 : _a.delete());\n\n this._widgets.delete(id);\n }\n }, {\n key: \"getResponse\",\n value: function getResponse(optWidgetId) {\n var _a;\n\n var id = optWidgetId || _WIDGET_ID_START;\n return ((_a = this._widgets.get(id)) === null || _a === void 0 ? void 0 : _a.getResponse()) || '';\n }\n }, {\n key: \"execute\",\n value: function () {\n var _execute = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee81(optWidgetId) {\n var _a, id;\n\n return _regeneratorRuntime.wrap(function _callee81$(_context81) {\n while (1) {\n switch (_context81.prev = _context81.next) {\n case 0:\n id = optWidgetId || _WIDGET_ID_START;\n void ((_a = this._widgets.get(id)) === null || _a === void 0 ? void 0 : _a.execute());\n return _context81.abrupt(\"return\", '');\n\n case 3:\n case \"end\":\n return _context81.stop();\n }\n }\n }, _callee81, this);\n }));\n\n function execute(_x211) {\n return _execute.apply(this, arguments);\n }\n\n return execute;\n }()\n }]);\n\n return MockReCaptcha;\n}();\n\nvar MockWidget = /*#__PURE__*/function () {\n function MockWidget(containerOrId, appName, params) {\n var _this31 = this;\n\n _classCallCheck(this, MockWidget);\n\n this.params = params;\n this.timerId = null;\n this.deleted = false;\n this.responseToken = null;\n\n this.clickHandler = function () {\n _this31.execute();\n };\n\n var container = typeof containerOrId === 'string' ? document.getElementById(containerOrId) : containerOrId;\n\n _assert(container, \"argument-error\"\n /* AuthErrorCode.ARGUMENT_ERROR */\n , {\n appName: appName\n });\n\n this.container = container;\n this.isVisible = this.params.size !== 'invisible';\n\n if (this.isVisible) {\n this.execute();\n } else {\n this.container.addEventListener('click', this.clickHandler);\n }\n }\n\n _createClass(MockWidget, [{\n key: \"getResponse\",\n value: function getResponse() {\n this.checkIfDeleted();\n return this.responseToken;\n }\n }, {\n key: \"delete\",\n value: function _delete() {\n this.checkIfDeleted();\n this.deleted = true;\n\n if (this.timerId) {\n clearTimeout(this.timerId);\n this.timerId = null;\n }\n\n this.container.removeEventListener('click', this.clickHandler);\n }\n }, {\n key: \"execute\",\n value: function execute() {\n var _this32 = this;\n\n this.checkIfDeleted();\n\n if (this.timerId) {\n return;\n }\n\n this.timerId = window.setTimeout(function () {\n _this32.responseToken = generateRandomAlphaNumericString(50);\n var _this32$params = _this32.params,\n callback = _this32$params.callback,\n expiredCallback = _this32$params['expired-callback'];\n\n if (callback) {\n try {\n callback(_this32.responseToken);\n } catch (e) {}\n }\n\n _this32.timerId = window.setTimeout(function () {\n _this32.timerId = null;\n _this32.responseToken = null;\n\n if (expiredCallback) {\n try {\n expiredCallback();\n } catch (e) {}\n }\n\n if (_this32.isVisible) {\n _this32.execute();\n }\n }, _EXPIRATION_TIME_MS);\n }, _SOLVE_TIME_MS);\n }\n }, {\n key: \"checkIfDeleted\",\n value: function checkIfDeleted() {\n if (this.deleted) {\n throw new Error('reCAPTCHA mock was already deleted!');\n }\n }\n }]);\n\n return MockWidget;\n}();\n\nfunction generateRandomAlphaNumericString(len) {\n var chars = [];\n var allowedChars = '1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';\n\n for (var i = 0; i < len; i++) {\n chars.push(allowedChars.charAt(Math.floor(Math.random() * allowedChars.length)));\n }\n\n return chars.join('');\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 */\n// ReCaptcha will load using the same callback, so the callback function needs\n// to be kept around\n\n\nvar _JSLOAD_CALLBACK = _generateCallbackName('rcb');\n\nvar NETWORK_TIMEOUT_DELAY = new Delay(30000, 60000);\n/**\r\n * Loader for the GReCaptcha library. There should only ever be one of this.\r\n */\n\nvar ReCaptchaLoaderImpl = /*#__PURE__*/function () {\n function ReCaptchaLoaderImpl() {\n _classCallCheck(this, ReCaptchaLoaderImpl);\n\n var _a;\n\n this.hostLanguage = '';\n this.counter = 0;\n /**\r\n * Check for `render()` method. `window.grecaptcha` will exist if the Enterprise\r\n * version of the ReCAPTCHA script was loaded by someone else (e.g. App Check) but\r\n * `window.grecaptcha.render()` will not. Another load will add it.\r\n */\n\n this.librarySeparatelyLoaded = !!((_a = _window().grecaptcha) === null || _a === void 0 ? void 0 : _a.render);\n }\n\n _createClass(ReCaptchaLoaderImpl, [{\n key: \"load\",\n value: function load(auth) {\n var _this33 = this;\n\n var hl = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';\n\n _assert(isHostLanguageValid(hl), auth, \"argument-error\"\n /* AuthErrorCode.ARGUMENT_ERROR */\n );\n\n if (this.shouldResolveImmediately(hl) && isV2(_window().grecaptcha)) {\n return Promise.resolve(_window().grecaptcha);\n }\n\n return new Promise(function (resolve, reject) {\n var networkTimeout = _window().setTimeout(function () {\n reject(_createError(auth, \"network-request-failed\"\n /* AuthErrorCode.NETWORK_REQUEST_FAILED */\n ));\n }, NETWORK_TIMEOUT_DELAY.get());\n\n _window()[_JSLOAD_CALLBACK] = function () {\n _window().clearTimeout(networkTimeout);\n\n delete _window()[_JSLOAD_CALLBACK];\n\n var recaptcha = _window().grecaptcha;\n\n if (!recaptcha || !isV2(recaptcha)) {\n reject(_createError(auth, \"internal-error\"\n /* AuthErrorCode.INTERNAL_ERROR */\n ));\n return;\n } // Wrap the greptcha render function so that we know if the developer has\n // called it separately\n\n\n var render = recaptcha.render;\n\n recaptcha.render = function (container, params) {\n var widgetId = render(container, params);\n _this33.counter++;\n return widgetId;\n };\n\n _this33.hostLanguage = hl;\n resolve(recaptcha);\n };\n\n var url = \"\".concat(_recaptchaV2ScriptUrl(), \"?\").concat(querystring({\n onload: _JSLOAD_CALLBACK,\n render: 'explicit',\n hl: hl\n }));\n\n _loadJS(url).catch(function () {\n clearTimeout(networkTimeout);\n reject(_createError(auth, \"internal-error\"\n /* AuthErrorCode.INTERNAL_ERROR */\n ));\n });\n });\n }\n }, {\n key: \"clearedOneInstance\",\n value: function clearedOneInstance() {\n this.counter--;\n }\n }, {\n key: \"shouldResolveImmediately\",\n value: function shouldResolveImmediately(hl) {\n var _a; // We can resolve immediately if:\n // • grecaptcha is already defined AND (\n // 1. the requested language codes are the same OR\n // 2. there exists already a ReCaptcha on the page\n // 3. the library was already loaded by the app\n // In cases (2) and (3), we _can't_ reload as it would break the recaptchas\n // that are already in the page\n\n\n return !!((_a = _window().grecaptcha) === null || _a === void 0 ? void 0 : _a.render) && (hl === this.hostLanguage || this.counter > 0 || this.librarySeparatelyLoaded);\n }\n }]);\n\n return ReCaptchaLoaderImpl;\n}();\n\nfunction isHostLanguageValid(hl) {\n return hl.length <= 6 && /^\\s*[a-zA-Z0-9\\-]*\\s*$/.test(hl);\n}\n\nvar MockReCaptchaLoaderImpl = /*#__PURE__*/function () {\n function MockReCaptchaLoaderImpl() {\n _classCallCheck(this, MockReCaptchaLoaderImpl);\n }\n\n _createClass(MockReCaptchaLoaderImpl, [{\n key: \"load\",\n value: function () {\n var _load = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee82(auth) {\n return _regeneratorRuntime.wrap(function _callee82$(_context82) {\n while (1) {\n switch (_context82.prev = _context82.next) {\n case 0:\n return _context82.abrupt(\"return\", new MockReCaptcha(auth));\n\n case 1:\n case \"end\":\n return _context82.stop();\n }\n }\n }, _callee82);\n }));\n\n function load(_x212) {\n return _load.apply(this, arguments);\n }\n\n return load;\n }()\n }, {\n key: \"clearedOneInstance\",\n value: function clearedOneInstance() {}\n }]);\n\n return MockReCaptchaLoaderImpl;\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 */\n\n\nvar RECAPTCHA_VERIFIER_TYPE = 'recaptcha';\nvar DEFAULT_PARAMS = {\n theme: 'light',\n type: 'image'\n};\n/**\r\n * An {@link https://www.google.com/recaptcha/ | reCAPTCHA}-based application verifier.\r\n *\r\n * @remarks\r\n * `RecaptchaVerifier` does not work in a Node.js environment.\r\n *\r\n * @public\r\n */\n\nvar RecaptchaVerifier = /*#__PURE__*/function () {\n /**\r\n * @param authExtern - The corresponding Firebase {@link Auth} instance.\r\n *\r\n * @param containerOrId - The reCAPTCHA container parameter.\r\n *\r\n * @remarks\r\n * This has different meaning depending on whether the reCAPTCHA is hidden or visible. For a\r\n * visible reCAPTCHA the container must be empty. If a string is used, it has to correspond to\r\n * an element ID. The corresponding element must also must be in the DOM at the time of\r\n * initialization.\r\n *\r\n * @param parameters - The optional reCAPTCHA parameters.\r\n *\r\n * @remarks\r\n * Check the reCAPTCHA docs for a comprehensive list. All parameters are accepted except for\r\n * the sitekey. Firebase Auth backend provisions a reCAPTCHA for each project and will\r\n * configure this upon rendering. For an invisible reCAPTCHA, a size key must have the value\r\n * 'invisible'.\r\n */\n function RecaptchaVerifier(authExtern, containerOrId) {\n var parameters = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : Object.assign({}, DEFAULT_PARAMS);\n\n _classCallCheck(this, RecaptchaVerifier);\n\n this.parameters = parameters;\n /**\r\n * The application verifier type.\r\n *\r\n * @remarks\r\n * For a reCAPTCHA verifier, this is 'recaptcha'.\r\n */\n\n this.type = RECAPTCHA_VERIFIER_TYPE;\n this.destroyed = false;\n this.widgetId = null;\n this.tokenChangeListeners = new Set();\n this.renderPromise = null;\n this.recaptcha = null;\n this.auth = _castAuth(authExtern);\n this.isInvisible = this.parameters.size === 'invisible';\n\n _assert(typeof document !== 'undefined', this.auth, \"operation-not-supported-in-this-environment\"\n /* AuthErrorCode.OPERATION_NOT_SUPPORTED */\n );\n\n var container = typeof containerOrId === 'string' ? document.getElementById(containerOrId) : containerOrId;\n\n _assert(container, this.auth, \"argument-error\"\n /* AuthErrorCode.ARGUMENT_ERROR */\n );\n\n this.container = container;\n this.parameters.callback = this.makeTokenCallback(this.parameters.callback);\n this._recaptchaLoader = this.auth.settings.appVerificationDisabledForTesting ? new MockReCaptchaLoaderImpl() : new ReCaptchaLoaderImpl();\n this.validateStartingState(); // TODO: Figure out if sdk version is needed\n }\n /**\r\n * Waits for the user to solve the reCAPTCHA and resolves with the reCAPTCHA token.\r\n *\r\n * @returns A Promise for the reCAPTCHA token.\r\n */\n\n\n _createClass(RecaptchaVerifier, [{\n key: \"verify\",\n value: function () {\n var _verify2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee83() {\n var _this34 = this;\n\n var id, recaptcha, response;\n return _regeneratorRuntime.wrap(function _callee83$(_context83) {\n while (1) {\n switch (_context83.prev = _context83.next) {\n case 0:\n this.assertNotDestroyed();\n _context83.next = 3;\n return this.render();\n\n case 3:\n id = _context83.sent;\n recaptcha = this.getAssertedRecaptcha();\n response = recaptcha.getResponse(id);\n\n if (!response) {\n _context83.next = 8;\n break;\n }\n\n return _context83.abrupt(\"return\", response);\n\n case 8:\n return _context83.abrupt(\"return\", new Promise(function (resolve) {\n var tokenChange = function tokenChange(token) {\n if (!token) {\n return; // Ignore token expirations.\n }\n\n _this34.tokenChangeListeners.delete(tokenChange);\n\n resolve(token);\n };\n\n _this34.tokenChangeListeners.add(tokenChange);\n\n if (_this34.isInvisible) {\n recaptcha.execute(id);\n }\n }));\n\n case 9:\n case \"end\":\n return _context83.stop();\n }\n }\n }, _callee83, this);\n }));\n\n function verify() {\n return _verify2.apply(this, arguments);\n }\n\n return verify;\n }()\n /**\r\n * Renders the reCAPTCHA widget on the page.\r\n *\r\n * @returns A Promise that resolves with the reCAPTCHA widget ID.\r\n */\n\n }, {\n key: \"render\",\n value: function render() {\n var _this35 = this;\n\n try {\n this.assertNotDestroyed();\n } catch (e) {\n // This method returns a promise. Since it's not async (we want to return the\n // _same_ promise if rendering is still occurring), the API surface should\n // reject with the error rather than just throw\n return Promise.reject(e);\n }\n\n if (this.renderPromise) {\n return this.renderPromise;\n }\n\n this.renderPromise = this.makeRenderPromise().catch(function (e) {\n _this35.renderPromise = null;\n throw e;\n });\n return this.renderPromise;\n }\n /** @internal */\n\n }, {\n key: \"_reset\",\n value: function _reset() {\n this.assertNotDestroyed();\n\n if (this.widgetId !== null) {\n this.getAssertedRecaptcha().reset(this.widgetId);\n }\n }\n /**\r\n * Clears the reCAPTCHA widget from the page and destroys the instance.\r\n */\n\n }, {\n key: \"clear\",\n value: function clear() {\n var _this36 = this;\n\n this.assertNotDestroyed();\n this.destroyed = true;\n\n this._recaptchaLoader.clearedOneInstance();\n\n if (!this.isInvisible) {\n this.container.childNodes.forEach(function (node) {\n _this36.container.removeChild(node);\n });\n }\n }\n }, {\n key: \"validateStartingState\",\n value: function validateStartingState() {\n _assert(!this.parameters.sitekey, this.auth, \"argument-error\"\n /* AuthErrorCode.ARGUMENT_ERROR */\n );\n\n _assert(this.isInvisible || !this.container.hasChildNodes(), this.auth, \"argument-error\"\n /* AuthErrorCode.ARGUMENT_ERROR */\n );\n\n _assert(typeof document !== 'undefined', this.auth, \"operation-not-supported-in-this-environment\"\n /* AuthErrorCode.OPERATION_NOT_SUPPORTED */\n );\n }\n }, {\n key: \"makeTokenCallback\",\n value: function makeTokenCallback(existing) {\n var _this37 = this;\n\n return function (token) {\n _this37.tokenChangeListeners.forEach(function (listener) {\n return listener(token);\n });\n\n if (typeof existing === 'function') {\n existing(token);\n } else if (typeof existing === 'string') {\n var globalFunc = _window()[existing];\n\n if (typeof globalFunc === 'function') {\n globalFunc(token);\n }\n }\n };\n }\n }, {\n key: \"assertNotDestroyed\",\n value: function assertNotDestroyed() {\n _assert(!this.destroyed, this.auth, \"internal-error\"\n /* AuthErrorCode.INTERNAL_ERROR */\n );\n }\n }, {\n key: \"makeRenderPromise\",\n value: function () {\n var _makeRenderPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee84() {\n var container, guaranteedEmpty;\n return _regeneratorRuntime.wrap(function _callee84$(_context84) {\n while (1) {\n switch (_context84.prev = _context84.next) {\n case 0:\n _context84.next = 2;\n return this.init();\n\n case 2:\n if (!this.widgetId) {\n container = this.container;\n\n if (!this.isInvisible) {\n guaranteedEmpty = document.createElement('div');\n container.appendChild(guaranteedEmpty);\n container = guaranteedEmpty;\n }\n\n this.widgetId = this.getAssertedRecaptcha().render(container, this.parameters);\n }\n\n return _context84.abrupt(\"return\", this.widgetId);\n\n case 4:\n case \"end\":\n return _context84.stop();\n }\n }\n }, _callee84, this);\n }));\n\n function makeRenderPromise() {\n return _makeRenderPromise.apply(this, arguments);\n }\n\n return makeRenderPromise;\n }()\n }, {\n key: \"init\",\n value: function () {\n var _init = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee85() {\n var siteKey;\n return _regeneratorRuntime.wrap(function _callee85$(_context85) {\n while (1) {\n switch (_context85.prev = _context85.next) {\n case 0:\n _assert(_isHttpOrHttps() && !_isWorker(), this.auth, \"internal-error\"\n /* AuthErrorCode.INTERNAL_ERROR */\n );\n\n _context85.next = 3;\n return domReady();\n\n case 3:\n _context85.next = 5;\n return this._recaptchaLoader.load(this.auth, this.auth.languageCode || undefined);\n\n case 5:\n this.recaptcha = _context85.sent;\n _context85.next = 8;\n return getRecaptchaParams(this.auth);\n\n case 8:\n siteKey = _context85.sent;\n\n _assert(siteKey, this.auth, \"internal-error\"\n /* AuthErrorCode.INTERNAL_ERROR */\n );\n\n this.parameters.sitekey = siteKey;\n\n case 11:\n case \"end\":\n return _context85.stop();\n }\n }\n }, _callee85, this);\n }));\n\n function init() {\n return _init.apply(this, arguments);\n }\n\n return init;\n }()\n }, {\n key: \"getAssertedRecaptcha\",\n value: function getAssertedRecaptcha() {\n _assert(this.recaptcha, this.auth, \"internal-error\"\n /* AuthErrorCode.INTERNAL_ERROR */\n );\n\n return this.recaptcha;\n }\n }]);\n\n return RecaptchaVerifier;\n}();\n\nfunction domReady() {\n var resolver = null;\n return new Promise(function (resolve) {\n if (document.readyState === 'complete') {\n resolve();\n return;\n } // Document not ready, wait for load before resolving.\n // Save resolver, so we can remove listener in case it was externally\n // cancelled.\n\n\n resolver = function resolver() {\n return resolve();\n };\n\n window.addEventListener('load', resolver);\n }).catch(function (e) {\n if (resolver) {\n window.removeEventListener('load', resolver);\n }\n\n throw e;\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 */\n\n\nvar ConfirmationResultImpl = /*#__PURE__*/function () {\n function ConfirmationResultImpl(verificationId, onConfirmation) {\n _classCallCheck(this, ConfirmationResultImpl);\n\n this.verificationId = verificationId;\n this.onConfirmation = onConfirmation;\n }\n\n _createClass(ConfirmationResultImpl, [{\n key: \"confirm\",\n value: function confirm(verificationCode) {\n var authCredential = PhoneAuthCredential._fromVerification(this.verificationId, verificationCode);\n\n return this.onConfirmation(authCredential);\n }\n }]);\n\n return ConfirmationResultImpl;\n}();\n/**\r\n * Asynchronously signs in using a phone number.\r\n *\r\n * @remarks\r\n * This method sends a code via SMS to the given\r\n * phone number, and returns a {@link ConfirmationResult}. After the user\r\n * provides the code sent to their phone, call {@link ConfirmationResult.confirm}\r\n * with the code to sign the user in.\r\n *\r\n * For abuse prevention, this method also requires a {@link ApplicationVerifier}.\r\n * This SDK includes a reCAPTCHA-based implementation, {@link RecaptchaVerifier}.\r\n * This function can work on other platforms that do not support the\r\n * {@link RecaptchaVerifier} (like React Native), but you need to use a\r\n * third-party {@link ApplicationVerifier} implementation.\r\n *\r\n * This method does not work in a Node.js environment.\r\n *\r\n * @example\r\n * ```javascript\r\n * // 'recaptcha-container' is the ID of an element in the DOM.\r\n * const applicationVerifier = new firebase.auth.RecaptchaVerifier('recaptcha-container');\r\n * const confirmationResult = await signInWithPhoneNumber(auth, phoneNumber, applicationVerifier);\r\n * // Obtain a verificationCode from the user.\r\n * const credential = await confirmationResult.confirm(verificationCode);\r\n * ```\r\n *\r\n * @param auth - The {@link Auth} instance.\r\n * @param phoneNumber - The user's phone number in E.164 format (e.g. +16505550101).\r\n * @param appVerifier - The {@link ApplicationVerifier}.\r\n *\r\n * @public\r\n */\n\n\nfunction signInWithPhoneNumber(_x213, _x214, _x215) {\n return _signInWithPhoneNumber.apply(this, arguments);\n}\n/**\r\n * Links the user account with the given phone number.\r\n *\r\n * @remarks\r\n * This method does not work in a Node.js environment.\r\n *\r\n * @param user - The user.\r\n * @param phoneNumber - The user's phone number in E.164 format (e.g. +16505550101).\r\n * @param appVerifier - The {@link ApplicationVerifier}.\r\n *\r\n * @public\r\n */\n\n\nfunction _signInWithPhoneNumber() {\n _signInWithPhoneNumber = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee173(auth, phoneNumber, appVerifier) {\n var authInternal, verificationId;\n return _regeneratorRuntime.wrap(function _callee173$(_context173) {\n while (1) {\n switch (_context173.prev = _context173.next) {\n case 0:\n authInternal = _castAuth(auth);\n _context173.next = 3;\n return _verifyPhoneNumber(authInternal, phoneNumber, getModularInstance(appVerifier));\n\n case 3:\n verificationId = _context173.sent;\n return _context173.abrupt(\"return\", new ConfirmationResultImpl(verificationId, function (cred) {\n return signInWithCredential(authInternal, cred);\n }));\n\n case 5:\n case \"end\":\n return _context173.stop();\n }\n }\n }, _callee173);\n }));\n return _signInWithPhoneNumber.apply(this, arguments);\n}\n\nfunction linkWithPhoneNumber(_x216, _x217, _x218) {\n return _linkWithPhoneNumber.apply(this, arguments);\n}\n/**\r\n * Re-authenticates a user using a fresh phone credential.\r\n *\r\n * @remarks\r\n * Use before operations such as {@link updatePassword} that require tokens from recent sign-in attempts.\r\n *\r\n * This method does not work in a Node.js environment.\r\n *\r\n * @param user - The user.\r\n * @param phoneNumber - The user's phone number in E.164 format (e.g. +16505550101).\r\n * @param appVerifier - The {@link ApplicationVerifier}.\r\n *\r\n * @public\r\n */\n\n\nfunction _linkWithPhoneNumber() {\n _linkWithPhoneNumber = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee174(user, phoneNumber, appVerifier) {\n var userInternal, verificationId;\n return _regeneratorRuntime.wrap(function _callee174$(_context174) {\n while (1) {\n switch (_context174.prev = _context174.next) {\n case 0:\n userInternal = getModularInstance(user);\n _context174.next = 3;\n return _assertLinkedStatus(false, userInternal, \"phone\"\n /* ProviderId.PHONE */\n );\n\n case 3:\n _context174.next = 5;\n return _verifyPhoneNumber(userInternal.auth, phoneNumber, getModularInstance(appVerifier));\n\n case 5:\n verificationId = _context174.sent;\n return _context174.abrupt(\"return\", new ConfirmationResultImpl(verificationId, function (cred) {\n return linkWithCredential(userInternal, cred);\n }));\n\n case 7:\n case \"end\":\n return _context174.stop();\n }\n }\n }, _callee174);\n }));\n return _linkWithPhoneNumber.apply(this, arguments);\n}\n\nfunction reauthenticateWithPhoneNumber(_x219, _x220, _x221) {\n return _reauthenticateWithPhoneNumber.apply(this, arguments);\n}\n/**\r\n * Returns a verification ID to be used in conjunction with the SMS code that is sent.\r\n *\r\n */\n\n\nfunction _reauthenticateWithPhoneNumber() {\n _reauthenticateWithPhoneNumber = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee175(user, phoneNumber, appVerifier) {\n var userInternal, verificationId;\n return _regeneratorRuntime.wrap(function _callee175$(_context175) {\n while (1) {\n switch (_context175.prev = _context175.next) {\n case 0:\n userInternal = getModularInstance(user);\n _context175.next = 3;\n return _verifyPhoneNumber(userInternal.auth, phoneNumber, getModularInstance(appVerifier));\n\n case 3:\n verificationId = _context175.sent;\n return _context175.abrupt(\"return\", new ConfirmationResultImpl(verificationId, function (cred) {\n return reauthenticateWithCredential(userInternal, cred);\n }));\n\n case 5:\n case \"end\":\n return _context175.stop();\n }\n }\n }, _callee175);\n }));\n return _reauthenticateWithPhoneNumber.apply(this, arguments);\n}\n\nfunction _verifyPhoneNumber(_x222, _x223, _x224) {\n return _verifyPhoneNumber2.apply(this, arguments);\n}\n/**\r\n * Updates the user's phone number.\r\n *\r\n * @remarks\r\n * This method does not work in a Node.js environment.\r\n *\r\n * @example\r\n * ```\r\n * // 'recaptcha-container' is the ID of an element in the DOM.\r\n * const applicationVerifier = new RecaptchaVerifier('recaptcha-container');\r\n * const provider = new PhoneAuthProvider(auth);\r\n * const verificationId = await provider.verifyPhoneNumber('+16505550101', applicationVerifier);\r\n * // Obtain the verificationCode from the user.\r\n * const phoneCredential = PhoneAuthProvider.credential(verificationId, verificationCode);\r\n * await updatePhoneNumber(user, phoneCredential);\r\n * ```\r\n *\r\n * @param user - The user.\r\n * @param credential - A credential authenticating the new phone number.\r\n *\r\n * @public\r\n */\n\n\nfunction _verifyPhoneNumber2() {\n _verifyPhoneNumber2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee176(auth, options, verifier) {\n var _a, recaptchaToken, phoneInfoOptions, session, response, mfaEnrollmentId, _response, _yield$sendPhoneVerif, sessionInfo;\n\n return _regeneratorRuntime.wrap(function _callee176$(_context176) {\n while (1) {\n switch (_context176.prev = _context176.next) {\n case 0:\n _context176.next = 2;\n return verifier.verify();\n\n case 2:\n recaptchaToken = _context176.sent;\n _context176.prev = 3;\n\n _assert(typeof recaptchaToken === 'string', auth, \"argument-error\"\n /* AuthErrorCode.ARGUMENT_ERROR */\n );\n\n _assert(verifier.type === RECAPTCHA_VERIFIER_TYPE, auth, \"argument-error\"\n /* AuthErrorCode.ARGUMENT_ERROR */\n );\n\n if (typeof options === 'string') {\n phoneInfoOptions = {\n phoneNumber: options\n };\n } else {\n phoneInfoOptions = options;\n }\n\n if (!('session' in phoneInfoOptions)) {\n _context176.next = 26;\n break;\n }\n\n session = phoneInfoOptions.session;\n\n if (!('phoneNumber' in phoneInfoOptions)) {\n _context176.next = 17;\n break;\n }\n\n _assert(session.type === \"enroll\"\n /* MultiFactorSessionType.ENROLL */\n , auth, \"internal-error\"\n /* AuthErrorCode.INTERNAL_ERROR */\n );\n\n _context176.next = 13;\n return startEnrollPhoneMfa(auth, {\n idToken: session.credential,\n phoneEnrollmentInfo: {\n phoneNumber: phoneInfoOptions.phoneNumber,\n recaptchaToken: recaptchaToken\n }\n });\n\n case 13:\n response = _context176.sent;\n return _context176.abrupt(\"return\", response.phoneSessionInfo.sessionInfo);\n\n case 17:\n _assert(session.type === \"signin\"\n /* MultiFactorSessionType.SIGN_IN */\n , auth, \"internal-error\"\n /* AuthErrorCode.INTERNAL_ERROR */\n );\n\n mfaEnrollmentId = ((_a = phoneInfoOptions.multiFactorHint) === null || _a === void 0 ? void 0 : _a.uid) || phoneInfoOptions.multiFactorUid;\n\n _assert(mfaEnrollmentId, auth, \"missing-multi-factor-info\"\n /* AuthErrorCode.MISSING_MFA_INFO */\n );\n\n _context176.next = 22;\n return startSignInPhoneMfa(auth, {\n mfaPendingCredential: session.credential,\n mfaEnrollmentId: mfaEnrollmentId,\n phoneSignInInfo: {\n recaptchaToken: recaptchaToken\n }\n });\n\n case 22:\n _response = _context176.sent;\n return _context176.abrupt(\"return\", _response.phoneResponseInfo.sessionInfo);\n\n case 24:\n _context176.next = 31;\n break;\n\n case 26:\n _context176.next = 28;\n return sendPhoneVerificationCode(auth, {\n phoneNumber: phoneInfoOptions.phoneNumber,\n recaptchaToken: recaptchaToken\n });\n\n case 28:\n _yield$sendPhoneVerif = _context176.sent;\n sessionInfo = _yield$sendPhoneVerif.sessionInfo;\n return _context176.abrupt(\"return\", sessionInfo);\n\n case 31:\n _context176.prev = 31;\n\n verifier._reset();\n\n return _context176.finish(31);\n\n case 34:\n case \"end\":\n return _context176.stop();\n }\n }\n }, _callee176, null, [[3,, 31, 34]]);\n }));\n return _verifyPhoneNumber2.apply(this, arguments);\n}\n\nfunction updatePhoneNumber(_x225, _x226) {\n return _updatePhoneNumber.apply(this, arguments);\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 */\n\n/**\r\n * Provider for generating an {@link PhoneAuthCredential}.\r\n *\r\n * @remarks\r\n * `PhoneAuthProvider` does not work in a Node.js environment.\r\n *\r\n * @example\r\n * ```javascript\r\n * // 'recaptcha-container' is the ID of an element in the DOM.\r\n * const applicationVerifier = new RecaptchaVerifier('recaptcha-container');\r\n * const provider = new PhoneAuthProvider(auth);\r\n * const verificationId = await provider.verifyPhoneNumber('+16505550101', applicationVerifier);\r\n * // Obtain the verificationCode from the user.\r\n * const phoneCredential = PhoneAuthProvider.credential(verificationId, verificationCode);\r\n * const userCredential = await signInWithCredential(auth, phoneCredential);\r\n * ```\r\n *\r\n * @public\r\n */\n\n\nfunction _updatePhoneNumber() {\n _updatePhoneNumber = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee177(user, credential) {\n return _regeneratorRuntime.wrap(function _callee177$(_context177) {\n while (1) {\n switch (_context177.prev = _context177.next) {\n case 0:\n _context177.next = 2;\n return _link$1(getModularInstance(user), credential);\n\n case 2:\n case \"end\":\n return _context177.stop();\n }\n }\n }, _callee177);\n }));\n return _updatePhoneNumber.apply(this, arguments);\n}\n\nvar PhoneAuthProvider = /*#__PURE__*/function () {\n /**\r\n * @param auth - The Firebase {@link Auth} instance in which sign-ins should occur.\r\n *\r\n */\n function PhoneAuthProvider(auth) {\n _classCallCheck(this, PhoneAuthProvider);\n\n /** Always set to {@link ProviderId}.PHONE. */\n this.providerId = PhoneAuthProvider.PROVIDER_ID;\n this.auth = _castAuth(auth);\n }\n /**\r\n *\r\n * Starts a phone number authentication flow by sending a verification code to the given phone\r\n * number.\r\n *\r\n * @example\r\n * ```javascript\r\n * const provider = new PhoneAuthProvider(auth);\r\n * const verificationId = await provider.verifyPhoneNumber(phoneNumber, applicationVerifier);\r\n * // Obtain verificationCode from the user.\r\n * const authCredential = PhoneAuthProvider.credential(verificationId, verificationCode);\r\n * const userCredential = await signInWithCredential(auth, authCredential);\r\n * ```\r\n *\r\n * @example\r\n * An alternative flow is provided using the `signInWithPhoneNumber` method.\r\n * ```javascript\r\n * const confirmationResult = signInWithPhoneNumber(auth, phoneNumber, applicationVerifier);\r\n * // Obtain verificationCode from the user.\r\n * const userCredential = confirmationResult.confirm(verificationCode);\r\n * ```\r\n *\r\n * @param phoneInfoOptions - The user's {@link PhoneInfoOptions}. The phone number should be in\r\n * E.164 format (e.g. +16505550101).\r\n * @param applicationVerifier - For abuse prevention, this method also requires a\r\n * {@link ApplicationVerifier}. This SDK includes a reCAPTCHA-based implementation,\r\n * {@link RecaptchaVerifier}.\r\n *\r\n * @returns A Promise for a verification ID that can be passed to\r\n * {@link PhoneAuthProvider.credential} to identify this flow..\r\n */\n\n\n _createClass(PhoneAuthProvider, [{\n key: \"verifyPhoneNumber\",\n value: function verifyPhoneNumber(phoneOptions, applicationVerifier) {\n return _verifyPhoneNumber(this.auth, phoneOptions, getModularInstance(applicationVerifier));\n }\n /**\r\n * Creates a phone auth credential, given the verification ID from\r\n * {@link PhoneAuthProvider.verifyPhoneNumber} and the code that was sent to the user's\r\n * mobile device.\r\n *\r\n * @example\r\n * ```javascript\r\n * const provider = new PhoneAuthProvider(auth);\r\n * const verificationId = provider.verifyPhoneNumber(phoneNumber, applicationVerifier);\r\n * // Obtain verificationCode from the user.\r\n * const authCredential = PhoneAuthProvider.credential(verificationId, verificationCode);\r\n * const userCredential = signInWithCredential(auth, authCredential);\r\n * ```\r\n *\r\n * @example\r\n * An alternative flow is provided using the `signInWithPhoneNumber` method.\r\n * ```javascript\r\n * const confirmationResult = await signInWithPhoneNumber(auth, phoneNumber, applicationVerifier);\r\n * // Obtain verificationCode from the user.\r\n * const userCredential = await confirmationResult.confirm(verificationCode);\r\n * ```\r\n *\r\n * @param verificationId - The verification ID returned from {@link PhoneAuthProvider.verifyPhoneNumber}.\r\n * @param verificationCode - The verification code sent to the user's mobile device.\r\n *\r\n * @returns The auth provider credential.\r\n */\n\n }], [{\n key: \"credential\",\n value: function credential(verificationId, verificationCode) {\n return PhoneAuthCredential._fromVerification(verificationId, verificationCode);\n }\n /**\r\n * Generates an {@link AuthCredential} from a {@link UserCredential}.\r\n * @param userCredential - The user credential.\r\n */\n\n }, {\n key: \"credentialFromResult\",\n value: function credentialFromResult(userCredential) {\n var credential = userCredential;\n return PhoneAuthProvider.credentialFromTaggedObject(credential);\n }\n /**\r\n * Returns an {@link AuthCredential} when passed an error.\r\n *\r\n * @remarks\r\n *\r\n * This method works for errors like\r\n * `auth/account-exists-with-different-credentials`. This is useful for\r\n * recovering when attempting to set a user's phone number but the number\r\n * in question is already tied to another account. For example, the following\r\n * code tries to update the current user's phone number, and if that\r\n * fails, links the user with the account associated with that number:\r\n *\r\n * ```js\r\n * const provider = new PhoneAuthProvider(auth);\r\n * const verificationId = await provider.verifyPhoneNumber(number, verifier);\r\n * try {\r\n * const code = ''; // Prompt the user for the verification code\r\n * await updatePhoneNumber(\r\n * auth.currentUser,\r\n * PhoneAuthProvider.credential(verificationId, code));\r\n * } catch (e) {\r\n * if ((e as FirebaseError)?.code === 'auth/account-exists-with-different-credential') {\r\n * const cred = PhoneAuthProvider.credentialFromError(e);\r\n * await linkWithCredential(auth.currentUser, cred);\r\n * }\r\n * }\r\n *\r\n * // At this point, auth.currentUser.phoneNumber === number.\r\n * ```\r\n *\r\n * @param error - The error to generate a credential from.\r\n */\n\n }, {\n key: \"credentialFromError\",\n value: function credentialFromError(error) {\n return PhoneAuthProvider.credentialFromTaggedObject(error.customData || {});\n }\n }, {\n key: \"credentialFromTaggedObject\",\n value: function credentialFromTaggedObject(_ref32) {\n var tokenResponse = _ref32._tokenResponse;\n\n if (!tokenResponse) {\n return null;\n }\n\n var phoneNumber = tokenResponse.phoneNumber,\n temporaryProof = tokenResponse.temporaryProof;\n\n if (phoneNumber && temporaryProof) {\n return PhoneAuthCredential._fromTokenResponse(phoneNumber, temporaryProof);\n }\n\n return null;\n }\n }]);\n\n return PhoneAuthProvider;\n}();\n/** Always set to {@link ProviderId}.PHONE. */\n\n\nPhoneAuthProvider.PROVIDER_ID = \"phone\"\n/* ProviderId.PHONE */\n;\n/** Always set to {@link SignInMethod}.PHONE. */\n\nPhoneAuthProvider.PHONE_SIGN_IN_METHOD = \"phone\"\n/* SignInMethod.PHONE */\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 */\n\n/**\r\n * Chooses a popup/redirect resolver to use. This prefers the override (which\r\n * is directly passed in), and falls back to the property set on the auth\r\n * object. If neither are available, this function errors w/ an argument error.\r\n */\n\nfunction _withDefaultResolver(auth, resolverOverride) {\n if (resolverOverride) {\n return _getInstance(resolverOverride);\n }\n\n _assert(auth._popupRedirectResolver, auth, \"argument-error\"\n /* AuthErrorCode.ARGUMENT_ERROR */\n );\n\n return auth._popupRedirectResolver;\n}\n/**\r\n * @license\r\n * Copyright 2019 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 */\n\n\nvar IdpCredential = /*#__PURE__*/function (_AuthCredential5) {\n _inherits(IdpCredential, _AuthCredential5);\n\n var _super22 = _createSuper(IdpCredential);\n\n function IdpCredential(params) {\n var _this38;\n\n _classCallCheck(this, IdpCredential);\n\n _this38 = _super22.call(this, \"custom\"\n /* ProviderId.CUSTOM */\n , \"custom\"\n /* ProviderId.CUSTOM */\n );\n _this38.params = params;\n return _this38;\n }\n\n _createClass(IdpCredential, [{\n key: \"_getIdTokenResponse\",\n value: function _getIdTokenResponse(auth) {\n return signInWithIdp(auth, this._buildIdpRequest());\n }\n }, {\n key: \"_linkToIdToken\",\n value: function _linkToIdToken(auth, idToken) {\n return signInWithIdp(auth, this._buildIdpRequest(idToken));\n }\n }, {\n key: \"_getReauthenticationResolver\",\n value: function _getReauthenticationResolver(auth) {\n return signInWithIdp(auth, this._buildIdpRequest());\n }\n }, {\n key: \"_buildIdpRequest\",\n value: function _buildIdpRequest(idToken) {\n var request = {\n requestUri: this.params.requestUri,\n sessionId: this.params.sessionId,\n postBody: this.params.postBody,\n tenantId: this.params.tenantId,\n pendingToken: this.params.pendingToken,\n returnSecureToken: true,\n returnIdpCredential: true\n };\n\n if (idToken) {\n request.idToken = idToken;\n }\n\n return request;\n }\n }]);\n\n return IdpCredential;\n}(AuthCredential);\n\nfunction _signIn(params) {\n return _signInWithCredential(params.auth, new IdpCredential(params), params.bypassAuthState);\n}\n\nfunction _reauth(params) {\n var auth = params.auth,\n user = params.user;\n\n _assert(user, auth, \"internal-error\"\n /* AuthErrorCode.INTERNAL_ERROR */\n );\n\n return _reauthenticate(user, new IdpCredential(params), params.bypassAuthState);\n}\n\nfunction _link(_x227) {\n return _link2.apply(this, arguments);\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 */\n\n/**\r\n * Popup event manager. Handles the popup's entire lifecycle; listens to auth\r\n * events\r\n */\n\n\nfunction _link2() {\n _link2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee178(params) {\n var auth, user;\n return _regeneratorRuntime.wrap(function _callee178$(_context178) {\n while (1) {\n switch (_context178.prev = _context178.next) {\n case 0:\n auth = params.auth, user = params.user;\n\n _assert(user, auth, \"internal-error\"\n /* AuthErrorCode.INTERNAL_ERROR */\n );\n\n return _context178.abrupt(\"return\", _link$1(user, new IdpCredential(params), params.bypassAuthState));\n\n case 3:\n case \"end\":\n return _context178.stop();\n }\n }\n }, _callee178);\n }));\n return _link2.apply(this, arguments);\n}\n\nvar AbstractPopupRedirectOperation = /*#__PURE__*/function () {\n function AbstractPopupRedirectOperation(auth, filter, resolver, user) {\n var bypassAuthState = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;\n\n _classCallCheck(this, AbstractPopupRedirectOperation);\n\n this.auth = auth;\n this.resolver = resolver;\n this.user = user;\n this.bypassAuthState = bypassAuthState;\n this.pendingPromise = null;\n this.eventManager = null;\n this.filter = Array.isArray(filter) ? filter : [filter];\n }\n\n _createClass(AbstractPopupRedirectOperation, [{\n key: \"execute\",\n value: function execute() {\n var _this39 = this;\n\n return new Promise( /*#__PURE__*/function () {\n var _ref33 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee86(resolve, reject) {\n return _regeneratorRuntime.wrap(function _callee86$(_context86) {\n while (1) {\n switch (_context86.prev = _context86.next) {\n case 0:\n _this39.pendingPromise = {\n resolve: resolve,\n reject: reject\n };\n _context86.prev = 1;\n _context86.next = 4;\n return _this39.resolver._initialize(_this39.auth);\n\n case 4:\n _this39.eventManager = _context86.sent;\n _context86.next = 7;\n return _this39.onExecution();\n\n case 7:\n _this39.eventManager.registerConsumer(_this39);\n\n _context86.next = 13;\n break;\n\n case 10:\n _context86.prev = 10;\n _context86.t0 = _context86[\"catch\"](1);\n\n _this39.reject(_context86.t0);\n\n case 13:\n case \"end\":\n return _context86.stop();\n }\n }\n }, _callee86, null, [[1, 10]]);\n }));\n\n return function (_x228, _x229) {\n return _ref33.apply(this, arguments);\n };\n }());\n }\n }, {\n key: \"onAuthEvent\",\n value: function () {\n var _onAuthEvent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee87(event) {\n var urlResponse, sessionId, postBody, tenantId, error, type, params;\n return _regeneratorRuntime.wrap(function _callee87$(_context87) {\n while (1) {\n switch (_context87.prev = _context87.next) {\n case 0:\n urlResponse = event.urlResponse, sessionId = event.sessionId, postBody = event.postBody, tenantId = event.tenantId, error = event.error, type = event.type;\n\n if (!error) {\n _context87.next = 4;\n break;\n }\n\n this.reject(error);\n return _context87.abrupt(\"return\");\n\n case 4:\n params = {\n auth: this.auth,\n requestUri: urlResponse,\n sessionId: sessionId,\n tenantId: tenantId || undefined,\n postBody: postBody || undefined,\n user: this.user,\n bypassAuthState: this.bypassAuthState\n };\n _context87.prev = 5;\n _context87.t0 = this;\n _context87.next = 9;\n return this.getIdpTask(type)(params);\n\n case 9:\n _context87.t1 = _context87.sent;\n\n _context87.t0.resolve.call(_context87.t0, _context87.t1);\n\n _context87.next = 16;\n break;\n\n case 13:\n _context87.prev = 13;\n _context87.t2 = _context87[\"catch\"](5);\n this.reject(_context87.t2);\n\n case 16:\n case \"end\":\n return _context87.stop();\n }\n }\n }, _callee87, this, [[5, 13]]);\n }));\n\n function onAuthEvent(_x230) {\n return _onAuthEvent.apply(this, arguments);\n }\n\n return onAuthEvent;\n }()\n }, {\n key: \"onError\",\n value: function onError(error) {\n this.reject(error);\n }\n }, {\n key: \"getIdpTask\",\n value: function getIdpTask(type) {\n switch (type) {\n case \"signInViaPopup\"\n /* AuthEventType.SIGN_IN_VIA_POPUP */\n :\n case \"signInViaRedirect\"\n /* AuthEventType.SIGN_IN_VIA_REDIRECT */\n :\n return _signIn;\n\n case \"linkViaPopup\"\n /* AuthEventType.LINK_VIA_POPUP */\n :\n case \"linkViaRedirect\"\n /* AuthEventType.LINK_VIA_REDIRECT */\n :\n return _link;\n\n case \"reauthViaPopup\"\n /* AuthEventType.REAUTH_VIA_POPUP */\n :\n case \"reauthViaRedirect\"\n /* AuthEventType.REAUTH_VIA_REDIRECT */\n :\n return _reauth;\n\n default:\n _fail(this.auth, \"internal-error\"\n /* AuthErrorCode.INTERNAL_ERROR */\n );\n\n }\n }\n }, {\n key: \"resolve\",\n value: function resolve(cred) {\n debugAssert(this.pendingPromise, 'Pending promise was never set');\n this.pendingPromise.resolve(cred);\n this.unregisterAndCleanUp();\n }\n }, {\n key: \"reject\",\n value: function reject(error) {\n debugAssert(this.pendingPromise, 'Pending promise was never set');\n this.pendingPromise.reject(error);\n this.unregisterAndCleanUp();\n }\n }, {\n key: \"unregisterAndCleanUp\",\n value: function unregisterAndCleanUp() {\n if (this.eventManager) {\n this.eventManager.unregisterConsumer(this);\n }\n\n this.pendingPromise = null;\n this.cleanUp();\n }\n }]);\n\n return AbstractPopupRedirectOperation;\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 */\n\n\nvar _POLL_WINDOW_CLOSE_TIMEOUT = new Delay(2000, 10000);\n/**\r\n * Authenticates a Firebase client using a popup-based OAuth authentication flow.\r\n *\r\n * @remarks\r\n * If succeeds, returns the signed in user along with the provider's credential. If sign in was\r\n * unsuccessful, returns an error object containing additional information about the error.\r\n *\r\n * This method does not work in a Node.js environment.\r\n *\r\n * @example\r\n * ```javascript\r\n * // Sign in using a popup.\r\n * const provider = new FacebookAuthProvider();\r\n * const result = await signInWithPopup(auth, provider);\r\n *\r\n * // The signed-in user info.\r\n * const user = result.user;\r\n * // This gives you a Facebook Access Token.\r\n * const credential = provider.credentialFromResult(auth, result);\r\n * const token = credential.accessToken;\r\n * ```\r\n *\r\n * @param auth - The {@link Auth} instance.\r\n * @param provider - The provider to authenticate. The provider has to be an {@link OAuthProvider}.\r\n * Non-OAuth providers like {@link EmailAuthProvider} will throw an error.\r\n * @param resolver - An instance of {@link PopupRedirectResolver}, optional\r\n * if already supplied to {@link initializeAuth} or provided by {@link getAuth}.\r\n *\r\n * @public\r\n */\n\n\nfunction signInWithPopup(_x231, _x232, _x233) {\n return _signInWithPopup.apply(this, arguments);\n}\n/**\r\n * Reauthenticates the current user with the specified {@link OAuthProvider} using a pop-up based\r\n * OAuth flow.\r\n *\r\n * @remarks\r\n * If the reauthentication is successful, the returned result will contain the user and the\r\n * provider's credential.\r\n *\r\n * This method does not work in a Node.js environment.\r\n *\r\n * @example\r\n * ```javascript\r\n * // Sign in using a popup.\r\n * const provider = new FacebookAuthProvider();\r\n * const result = await signInWithPopup(auth, provider);\r\n * // Reauthenticate using a popup.\r\n * await reauthenticateWithPopup(result.user, provider);\r\n * ```\r\n *\r\n * @param user - The user.\r\n * @param provider - The provider to authenticate. The provider has to be an {@link OAuthProvider}.\r\n * Non-OAuth providers like {@link EmailAuthProvider} will throw an error.\r\n * @param resolver - An instance of {@link PopupRedirectResolver}, optional\r\n * if already supplied to {@link initializeAuth} or provided by {@link getAuth}.\r\n *\r\n * @public\r\n */\n\n\nfunction _signInWithPopup() {\n _signInWithPopup = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee179(auth, provider, resolver) {\n var authInternal, resolverInternal, action;\n return _regeneratorRuntime.wrap(function _callee179$(_context179) {\n while (1) {\n switch (_context179.prev = _context179.next) {\n case 0:\n authInternal = _castAuth(auth);\n\n _assertInstanceOf(auth, provider, FederatedAuthProvider);\n\n resolverInternal = _withDefaultResolver(authInternal, resolver);\n action = new PopupOperation(authInternal, \"signInViaPopup\"\n /* AuthEventType.SIGN_IN_VIA_POPUP */\n , provider, resolverInternal);\n return _context179.abrupt(\"return\", action.executeNotNull());\n\n case 5:\n case \"end\":\n return _context179.stop();\n }\n }\n }, _callee179);\n }));\n return _signInWithPopup.apply(this, arguments);\n}\n\nfunction reauthenticateWithPopup(_x234, _x235, _x236) {\n return _reauthenticateWithPopup.apply(this, arguments);\n}\n/**\r\n * Links the authenticated provider to the user account using a pop-up based OAuth flow.\r\n *\r\n * @remarks\r\n * If the linking is successful, the returned result will contain the user and the provider's credential.\r\n *\r\n * This method does not work in a Node.js environment.\r\n *\r\n * @example\r\n * ```javascript\r\n * // Sign in using some other provider.\r\n * const result = await signInWithEmailAndPassword(auth, email, password);\r\n * // Link using a popup.\r\n * const provider = new FacebookAuthProvider();\r\n * await linkWithPopup(result.user, provider);\r\n * ```\r\n *\r\n * @param user - The user.\r\n * @param provider - The provider to authenticate. The provider has to be an {@link OAuthProvider}.\r\n * Non-OAuth providers like {@link EmailAuthProvider} will throw an error.\r\n * @param resolver - An instance of {@link PopupRedirectResolver}, optional\r\n * if already supplied to {@link initializeAuth} or provided by {@link getAuth}.\r\n *\r\n * @public\r\n */\n\n\nfunction _reauthenticateWithPopup() {\n _reauthenticateWithPopup = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee180(user, provider, resolver) {\n var userInternal, resolverInternal, action;\n return _regeneratorRuntime.wrap(function _callee180$(_context180) {\n while (1) {\n switch (_context180.prev = _context180.next) {\n case 0:\n userInternal = getModularInstance(user);\n\n _assertInstanceOf(userInternal.auth, provider, FederatedAuthProvider);\n\n resolverInternal = _withDefaultResolver(userInternal.auth, resolver);\n action = new PopupOperation(userInternal.auth, \"reauthViaPopup\"\n /* AuthEventType.REAUTH_VIA_POPUP */\n , provider, resolverInternal, userInternal);\n return _context180.abrupt(\"return\", action.executeNotNull());\n\n case 5:\n case \"end\":\n return _context180.stop();\n }\n }\n }, _callee180);\n }));\n return _reauthenticateWithPopup.apply(this, arguments);\n}\n\nfunction linkWithPopup(_x237, _x238, _x239) {\n return _linkWithPopup.apply(this, arguments);\n}\n/**\r\n * Popup event manager. Handles the popup's entire lifecycle; listens to auth\r\n * events\r\n *\r\n */\n\n\nfunction _linkWithPopup() {\n _linkWithPopup = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee181(user, provider, resolver) {\n var userInternal, resolverInternal, action;\n return _regeneratorRuntime.wrap(function _callee181$(_context181) {\n while (1) {\n switch (_context181.prev = _context181.next) {\n case 0:\n userInternal = getModularInstance(user);\n\n _assertInstanceOf(userInternal.auth, provider, FederatedAuthProvider);\n\n resolverInternal = _withDefaultResolver(userInternal.auth, resolver);\n action = new PopupOperation(userInternal.auth, \"linkViaPopup\"\n /* AuthEventType.LINK_VIA_POPUP */\n , provider, resolverInternal, userInternal);\n return _context181.abrupt(\"return\", action.executeNotNull());\n\n case 5:\n case \"end\":\n return _context181.stop();\n }\n }\n }, _callee181);\n }));\n return _linkWithPopup.apply(this, arguments);\n}\n\nvar PopupOperation = /*#__PURE__*/function (_AbstractPopupRedirec) {\n _inherits(PopupOperation, _AbstractPopupRedirec);\n\n var _super23 = _createSuper(PopupOperation);\n\n function PopupOperation(auth, filter, provider, resolver, user) {\n var _this40;\n\n _classCallCheck(this, PopupOperation);\n\n _this40 = _super23.call(this, auth, filter, resolver, user);\n _this40.provider = provider;\n _this40.authWindow = null;\n _this40.pollId = null;\n\n if (PopupOperation.currentPopupAction) {\n PopupOperation.currentPopupAction.cancel();\n }\n\n PopupOperation.currentPopupAction = _assertThisInitialized(_this40);\n return _this40;\n }\n\n _createClass(PopupOperation, [{\n key: \"executeNotNull\",\n value: function () {\n var _executeNotNull = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee88() {\n var result;\n return _regeneratorRuntime.wrap(function _callee88$(_context88) {\n while (1) {\n switch (_context88.prev = _context88.next) {\n case 0:\n _context88.next = 2;\n return this.execute();\n\n case 2:\n result = _context88.sent;\n\n _assert(result, this.auth, \"internal-error\"\n /* AuthErrorCode.INTERNAL_ERROR */\n );\n\n return _context88.abrupt(\"return\", result);\n\n case 5:\n case \"end\":\n return _context88.stop();\n }\n }\n }, _callee88, this);\n }));\n\n function executeNotNull() {\n return _executeNotNull.apply(this, arguments);\n }\n\n return executeNotNull;\n }()\n }, {\n key: \"onExecution\",\n value: function () {\n var _onExecution = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee89() {\n var _this41 = this;\n\n var eventId;\n return _regeneratorRuntime.wrap(function _callee89$(_context89) {\n while (1) {\n switch (_context89.prev = _context89.next) {\n case 0:\n debugAssert(this.filter.length === 1, 'Popup operations only handle one event');\n eventId = _generateEventId();\n _context89.next = 4;\n return this.resolver._openPopup(this.auth, this.provider, this.filter[0], // There's always one, see constructor\n eventId);\n\n case 4:\n this.authWindow = _context89.sent;\n this.authWindow.associatedEvent = eventId; // Check for web storage support and origin validation _after_ the popup is\n // loaded. These operations are slow (~1 second or so) Rather than\n // waiting on them before opening the window, optimistically open the popup\n // and check for storage support at the same time. If storage support is\n // not available, this will cause the whole thing to reject properly. It\n // will also close the popup, but since the promise has already rejected,\n // the popup closed by user poll will reject into the void.\n\n this.resolver._originValidation(this.auth).catch(function (e) {\n _this41.reject(e);\n });\n\n this.resolver._isIframeWebStorageSupported(this.auth, function (isSupported) {\n if (!isSupported) {\n _this41.reject(_createError(_this41.auth, \"web-storage-unsupported\"\n /* AuthErrorCode.WEB_STORAGE_UNSUPPORTED */\n ));\n }\n }); // Handle user closure. Notice this does *not* use await\n\n\n this.pollUserCancellation();\n\n case 9:\n case \"end\":\n return _context89.stop();\n }\n }\n }, _callee89, this);\n }));\n\n function onExecution() {\n return _onExecution.apply(this, arguments);\n }\n\n return onExecution;\n }()\n }, {\n key: \"eventId\",\n get: function get() {\n var _a;\n\n return ((_a = this.authWindow) === null || _a === void 0 ? void 0 : _a.associatedEvent) || null;\n }\n }, {\n key: \"cancel\",\n value: function cancel() {\n this.reject(_createError(this.auth, \"cancelled-popup-request\"\n /* AuthErrorCode.EXPIRED_POPUP_REQUEST */\n ));\n }\n }, {\n key: \"cleanUp\",\n value: function cleanUp() {\n if (this.authWindow) {\n this.authWindow.close();\n }\n\n if (this.pollId) {\n window.clearTimeout(this.pollId);\n }\n\n this.authWindow = null;\n this.pollId = null;\n PopupOperation.currentPopupAction = null;\n }\n }, {\n key: \"pollUserCancellation\",\n value: function pollUserCancellation() {\n var _this42 = this;\n\n var poll = function poll() {\n var _a, _b;\n\n if ((_b = (_a = _this42.authWindow) === null || _a === void 0 ? void 0 : _a.window) === null || _b === void 0 ? void 0 : _b.closed) {\n // Make sure that there is sufficient time for whatever action to\n // complete. The window could have closed but the sign in network\n // call could still be in flight. This is specifically true for\n // Firefox or if the opener is in an iframe, in which case the oauth\n // helper closes the popup.\n _this42.pollId = window.setTimeout(function () {\n _this42.pollId = null;\n\n _this42.reject(_createError(_this42.auth, \"popup-closed-by-user\"\n /* AuthErrorCode.POPUP_CLOSED_BY_USER */\n ));\n }, 8000\n /* _Timeout.AUTH_EVENT */\n );\n return;\n }\n\n _this42.pollId = window.setTimeout(poll, _POLL_WINDOW_CLOSE_TIMEOUT.get());\n };\n\n poll();\n }\n }]);\n\n return PopupOperation;\n}(AbstractPopupRedirectOperation); // Only one popup is ever shown at once. The lifecycle of the current popup\n// can be managed / cancelled by the constructor.\n\n\nPopupOperation.currentPopupAction = null;\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 */\n\nvar PENDING_REDIRECT_KEY = 'pendingRedirect'; // We only get one redirect outcome for any one auth, so just store it\n// in here.\n\nvar redirectOutcomeMap = new Map();\n\nvar RedirectAction = /*#__PURE__*/function (_AbstractPopupRedirec2) {\n _inherits(RedirectAction, _AbstractPopupRedirec2);\n\n var _super24 = _createSuper(RedirectAction);\n\n function RedirectAction(auth, resolver) {\n var _this43;\n\n var bypassAuthState = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;\n\n _classCallCheck(this, RedirectAction);\n\n _this43 = _super24.call(this, auth, [\"signInViaRedirect\"\n /* AuthEventType.SIGN_IN_VIA_REDIRECT */\n , \"linkViaRedirect\"\n /* AuthEventType.LINK_VIA_REDIRECT */\n , \"reauthViaRedirect\"\n /* AuthEventType.REAUTH_VIA_REDIRECT */\n , \"unknown\"\n /* AuthEventType.UNKNOWN */\n ], resolver, undefined, bypassAuthState);\n _this43.eventId = null;\n return _this43;\n }\n /**\r\n * Override the execute function; if we already have a redirect result, then\r\n * just return it.\r\n */\n\n\n _createClass(RedirectAction, [{\n key: \"execute\",\n value: function () {\n var _execute2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee90() {\n var readyOutcome, hasPendingRedirect, result;\n return _regeneratorRuntime.wrap(function _callee90$(_context90) {\n while (1) {\n switch (_context90.prev = _context90.next) {\n case 0:\n readyOutcome = redirectOutcomeMap.get(this.auth._key());\n\n if (readyOutcome) {\n _context90.next = 21;\n break;\n }\n\n _context90.prev = 2;\n _context90.next = 5;\n return _getAndClearPendingRedirectStatus(this.resolver, this.auth);\n\n case 5:\n hasPendingRedirect = _context90.sent;\n\n if (!hasPendingRedirect) {\n _context90.next = 12;\n break;\n }\n\n _context90.next = 9;\n return _get3(_getPrototypeOf(RedirectAction.prototype), \"execute\", this).call(this);\n\n case 9:\n _context90.t0 = _context90.sent;\n _context90.next = 13;\n break;\n\n case 12:\n _context90.t0 = null;\n\n case 13:\n result = _context90.t0;\n\n readyOutcome = function readyOutcome() {\n return Promise.resolve(result);\n };\n\n _context90.next = 20;\n break;\n\n case 17:\n _context90.prev = 17;\n _context90.t1 = _context90[\"catch\"](2);\n\n readyOutcome = function readyOutcome() {\n return Promise.reject(_context90.t1);\n };\n\n case 20:\n redirectOutcomeMap.set(this.auth._key(), readyOutcome);\n\n case 21:\n // If we're not bypassing auth state, the ready outcome should be set to\n // null.\n if (!this.bypassAuthState) {\n redirectOutcomeMap.set(this.auth._key(), function () {\n return Promise.resolve(null);\n });\n }\n\n return _context90.abrupt(\"return\", readyOutcome());\n\n case 23:\n case \"end\":\n return _context90.stop();\n }\n }\n }, _callee90, this, [[2, 17]]);\n }));\n\n function execute() {\n return _execute2.apply(this, arguments);\n }\n\n return execute;\n }()\n }, {\n key: \"onAuthEvent\",\n value: function () {\n var _onAuthEvent2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee91(event) {\n var user;\n return _regeneratorRuntime.wrap(function _callee91$(_context91) {\n while (1) {\n switch (_context91.prev = _context91.next) {\n case 0:\n if (!(event.type === \"signInViaRedirect\"\n /* AuthEventType.SIGN_IN_VIA_REDIRECT */\n )) {\n _context91.next = 4;\n break;\n }\n\n return _context91.abrupt(\"return\", _get3(_getPrototypeOf(RedirectAction.prototype), \"onAuthEvent\", this).call(this, event));\n\n case 4:\n if (!(event.type === \"unknown\"\n /* AuthEventType.UNKNOWN */\n )) {\n _context91.next = 7;\n break;\n }\n\n // This is a sentinel value indicating there's no pending redirect\n this.resolve(null);\n return _context91.abrupt(\"return\");\n\n case 7:\n if (!event.eventId) {\n _context91.next = 17;\n break;\n }\n\n _context91.next = 10;\n return this.auth._redirectUserForId(event.eventId);\n\n case 10:\n user = _context91.sent;\n\n if (!user) {\n _context91.next = 16;\n break;\n }\n\n this.user = user;\n return _context91.abrupt(\"return\", _get3(_getPrototypeOf(RedirectAction.prototype), \"onAuthEvent\", this).call(this, event));\n\n case 16:\n this.resolve(null);\n\n case 17:\n case \"end\":\n return _context91.stop();\n }\n }\n }, _callee91, this);\n }));\n\n function onAuthEvent(_x240) {\n return _onAuthEvent2.apply(this, arguments);\n }\n\n return onAuthEvent;\n }()\n }, {\n key: \"onExecution\",\n value: function () {\n var _onExecution2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee92() {\n return _regeneratorRuntime.wrap(function _callee92$(_context92) {\n while (1) {\n switch (_context92.prev = _context92.next) {\n case 0:\n case \"end\":\n return _context92.stop();\n }\n }\n }, _callee92);\n }));\n\n function onExecution() {\n return _onExecution2.apply(this, arguments);\n }\n\n return onExecution;\n }()\n }, {\n key: \"cleanUp\",\n value: function cleanUp() {}\n }]);\n\n return RedirectAction;\n}(AbstractPopupRedirectOperation);\n\nfunction _getAndClearPendingRedirectStatus(_x241, _x242) {\n return _getAndClearPendingRedirectStatus2.apply(this, arguments);\n}\n\nfunction _getAndClearPendingRedirectStatus2() {\n _getAndClearPendingRedirectStatus2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee182(resolver, auth) {\n var key, persistence, hasPendingRedirect;\n return _regeneratorRuntime.wrap(function _callee182$(_context182) {\n while (1) {\n switch (_context182.prev = _context182.next) {\n case 0:\n key = pendingRedirectKey(auth);\n persistence = resolverPersistence(resolver);\n _context182.next = 4;\n return persistence._isAvailable();\n\n case 4:\n if (_context182.sent) {\n _context182.next = 6;\n break;\n }\n\n return _context182.abrupt(\"return\", false);\n\n case 6:\n _context182.next = 8;\n return persistence._get(key);\n\n case 8:\n _context182.t0 = _context182.sent;\n hasPendingRedirect = _context182.t0 === 'true';\n _context182.next = 12;\n return persistence._remove(key);\n\n case 12:\n return _context182.abrupt(\"return\", hasPendingRedirect);\n\n case 13:\n case \"end\":\n return _context182.stop();\n }\n }\n }, _callee182);\n }));\n return _getAndClearPendingRedirectStatus2.apply(this, arguments);\n}\n\nfunction _setPendingRedirectStatus(_x243, _x244) {\n return _setPendingRedirectStatus2.apply(this, arguments);\n}\n\nfunction _setPendingRedirectStatus2() {\n _setPendingRedirectStatus2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee183(resolver, auth) {\n return _regeneratorRuntime.wrap(function _callee183$(_context183) {\n while (1) {\n switch (_context183.prev = _context183.next) {\n case 0:\n return _context183.abrupt(\"return\", resolverPersistence(resolver)._set(pendingRedirectKey(auth), 'true'));\n\n case 1:\n case \"end\":\n return _context183.stop();\n }\n }\n }, _callee183);\n }));\n return _setPendingRedirectStatus2.apply(this, arguments);\n}\n\nfunction _clearRedirectOutcomes() {\n redirectOutcomeMap.clear();\n}\n\nfunction _overrideRedirectResult(auth, result) {\n redirectOutcomeMap.set(auth._key(), result);\n}\n\nfunction resolverPersistence(resolver) {\n return _getInstance(resolver._redirectPersistence);\n}\n\nfunction pendingRedirectKey(auth) {\n return _persistenceKeyName(PENDING_REDIRECT_KEY, auth.config.apiKey, auth.name);\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 */\n\n/**\r\n * Authenticates a Firebase client using a full-page redirect flow.\r\n *\r\n * @remarks\r\n * To handle the results and errors for this operation, refer to {@link getRedirectResult}.\r\n * Follow the {@link https://firebase.google.com/docs/auth/web/redirect-best-practices\r\n * | best practices} when using {@link signInWithRedirect}.\r\n *\r\n * This method does not work in a Node.js environment.\r\n *\r\n * @example\r\n * ```javascript\r\n * // Sign in using a redirect.\r\n * const provider = new FacebookAuthProvider();\r\n * // You can add additional scopes to the provider:\r\n * provider.addScope('user_birthday');\r\n * // Start a sign in process for an unauthenticated user.\r\n * await signInWithRedirect(auth, provider);\r\n * // This will trigger a full page redirect away from your app\r\n *\r\n * // After returning from the redirect when your app initializes you can obtain the result\r\n * const result = await getRedirectResult(auth);\r\n * if (result) {\r\n * // This is the signed-in user\r\n * const user = result.user;\r\n * // This gives you a Facebook Access Token.\r\n * const credential = provider.credentialFromResult(auth, result);\r\n * const token = credential.accessToken;\r\n * }\r\n * // As this API can be used for sign-in, linking and reauthentication,\r\n * // check the operationType to determine what triggered this redirect\r\n * // operation.\r\n * const operationType = result.operationType;\r\n * ```\r\n *\r\n * @param auth - The {@link Auth} instance.\r\n * @param provider - The provider to authenticate. The provider has to be an {@link OAuthProvider}.\r\n * Non-OAuth providers like {@link EmailAuthProvider} will throw an error.\r\n * @param resolver - An instance of {@link PopupRedirectResolver}, optional\r\n * if already supplied to {@link initializeAuth} or provided by {@link getAuth}.\r\n *\r\n * @public\r\n */\n\n\nfunction signInWithRedirect(auth, provider, resolver) {\n return _signInWithRedirect(auth, provider, resolver);\n}\n\nfunction _signInWithRedirect(_x245, _x246, _x247) {\n return _signInWithRedirect2.apply(this, arguments);\n}\n/**\r\n * Reauthenticates the current user with the specified {@link OAuthProvider} using a full-page redirect flow.\r\n * @remarks\r\n * To handle the results and errors for this operation, refer to {@link getRedirectResult}.\r\n * Follow the {@link https://firebase.google.com/docs/auth/web/redirect-best-practices\r\n * | best practices} when using {@link reauthenticateWithRedirect}.\r\n *\r\n * This method does not work in a Node.js environment.\r\n *\r\n * @example\r\n * ```javascript\r\n * // Sign in using a redirect.\r\n * const provider = new FacebookAuthProvider();\r\n * const result = await signInWithRedirect(auth, provider);\r\n * // This will trigger a full page redirect away from your app\r\n *\r\n * // After returning from the redirect when your app initializes you can obtain the result\r\n * const result = await getRedirectResult(auth);\r\n * // Reauthenticate using a redirect.\r\n * await reauthenticateWithRedirect(result.user, provider);\r\n * // This will again trigger a full page redirect away from your app\r\n *\r\n * // After returning from the redirect when your app initializes you can obtain the result\r\n * const result = await getRedirectResult(auth);\r\n * ```\r\n *\r\n * @param user - The user.\r\n * @param provider - The provider to authenticate. The provider has to be an {@link OAuthProvider}.\r\n * Non-OAuth providers like {@link EmailAuthProvider} will throw an error.\r\n * @param resolver - An instance of {@link PopupRedirectResolver}, optional\r\n * if already supplied to {@link initializeAuth} or provided by {@link getAuth}.\r\n *\r\n * @public\r\n */\n\n\nfunction _signInWithRedirect2() {\n _signInWithRedirect2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee184(auth, provider, resolver) {\n var authInternal, resolverInternal;\n return _regeneratorRuntime.wrap(function _callee184$(_context184) {\n while (1) {\n switch (_context184.prev = _context184.next) {\n case 0:\n authInternal = _castAuth(auth);\n\n _assertInstanceOf(auth, provider, FederatedAuthProvider); // Wait for auth initialization to complete, this will process pending redirects and clear the\n // PENDING_REDIRECT_KEY in persistence. This should be completed before starting a new\n // redirect and creating a PENDING_REDIRECT_KEY entry.\n\n\n _context184.next = 4;\n return authInternal._initializationPromise;\n\n case 4:\n resolverInternal = _withDefaultResolver(authInternal, resolver);\n _context184.next = 7;\n return _setPendingRedirectStatus(resolverInternal, authInternal);\n\n case 7:\n return _context184.abrupt(\"return\", resolverInternal._openRedirect(authInternal, provider, \"signInViaRedirect\"\n /* AuthEventType.SIGN_IN_VIA_REDIRECT */\n ));\n\n case 8:\n case \"end\":\n return _context184.stop();\n }\n }\n }, _callee184);\n }));\n return _signInWithRedirect2.apply(this, arguments);\n}\n\nfunction reauthenticateWithRedirect(user, provider, resolver) {\n return _reauthenticateWithRedirect(user, provider, resolver);\n}\n\nfunction _reauthenticateWithRedirect(_x248, _x249, _x250) {\n return _reauthenticateWithRedirect2.apply(this, arguments);\n}\n/**\r\n * Links the {@link OAuthProvider} to the user account using a full-page redirect flow.\r\n * @remarks\r\n * To handle the results and errors for this operation, refer to {@link getRedirectResult}.\r\n * Follow the {@link https://firebase.google.com/docs/auth/web/redirect-best-practices\r\n * | best practices} when using {@link linkWithRedirect}.\r\n *\r\n * This method does not work in a Node.js environment.\r\n *\r\n * @example\r\n * ```javascript\r\n * // Sign in using some other provider.\r\n * const result = await signInWithEmailAndPassword(auth, email, password);\r\n * // Link using a redirect.\r\n * const provider = new FacebookAuthProvider();\r\n * await linkWithRedirect(result.user, provider);\r\n * // This will trigger a full page redirect away from your app\r\n *\r\n * // After returning from the redirect when your app initializes you can obtain the result\r\n * const result = await getRedirectResult(auth);\r\n * ```\r\n *\r\n * @param user - The user.\r\n * @param provider - The provider to authenticate. The provider has to be an {@link OAuthProvider}.\r\n * Non-OAuth providers like {@link EmailAuthProvider} will throw an error.\r\n * @param resolver - An instance of {@link PopupRedirectResolver}, optional\r\n * if already supplied to {@link initializeAuth} or provided by {@link getAuth}.\r\n *\r\n * @public\r\n */\n\n\nfunction _reauthenticateWithRedirect2() {\n _reauthenticateWithRedirect2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee185(user, provider, resolver) {\n var userInternal, resolverInternal, eventId;\n return _regeneratorRuntime.wrap(function _callee185$(_context185) {\n while (1) {\n switch (_context185.prev = _context185.next) {\n case 0:\n userInternal = getModularInstance(user);\n\n _assertInstanceOf(userInternal.auth, provider, FederatedAuthProvider); // Wait for auth initialization to complete, this will process pending redirects and clear the\n // PENDING_REDIRECT_KEY in persistence. This should be completed before starting a new\n // redirect and creating a PENDING_REDIRECT_KEY entry.\n\n\n _context185.next = 4;\n return userInternal.auth._initializationPromise;\n\n case 4:\n // Allow the resolver to error before persisting the redirect user\n resolverInternal = _withDefaultResolver(userInternal.auth, resolver);\n _context185.next = 7;\n return _setPendingRedirectStatus(resolverInternal, userInternal.auth);\n\n case 7:\n _context185.next = 9;\n return prepareUserForRedirect(userInternal);\n\n case 9:\n eventId = _context185.sent;\n return _context185.abrupt(\"return\", resolverInternal._openRedirect(userInternal.auth, provider, \"reauthViaRedirect\"\n /* AuthEventType.REAUTH_VIA_REDIRECT */\n , eventId));\n\n case 11:\n case \"end\":\n return _context185.stop();\n }\n }\n }, _callee185);\n }));\n return _reauthenticateWithRedirect2.apply(this, arguments);\n}\n\nfunction linkWithRedirect(user, provider, resolver) {\n return _linkWithRedirect(user, provider, resolver);\n}\n\nfunction _linkWithRedirect(_x251, _x252, _x253) {\n return _linkWithRedirect2.apply(this, arguments);\n}\n/**\r\n * Returns a {@link UserCredential} from the redirect-based sign-in flow.\r\n *\r\n * @remarks\r\n * If sign-in succeeded, returns the signed in user. If sign-in was unsuccessful, fails with an\r\n * error. If no redirect operation was called, returns `null`.\r\n *\r\n * This method does not work in a Node.js environment.\r\n *\r\n * @example\r\n * ```javascript\r\n * // Sign in using a redirect.\r\n * const provider = new FacebookAuthProvider();\r\n * // You can add additional scopes to the provider:\r\n * provider.addScope('user_birthday');\r\n * // Start a sign in process for an unauthenticated user.\r\n * await signInWithRedirect(auth, provider);\r\n * // This will trigger a full page redirect away from your app\r\n *\r\n * // After returning from the redirect when your app initializes you can obtain the result\r\n * const result = await getRedirectResult(auth);\r\n * if (result) {\r\n * // This is the signed-in user\r\n * const user = result.user;\r\n * // This gives you a Facebook Access Token.\r\n * const credential = provider.credentialFromResult(auth, result);\r\n * const token = credential.accessToken;\r\n * }\r\n * // As this API can be used for sign-in, linking and reauthentication,\r\n * // check the operationType to determine what triggered this redirect\r\n * // operation.\r\n * const operationType = result.operationType;\r\n * ```\r\n *\r\n * @param auth - The {@link Auth} instance.\r\n * @param resolver - An instance of {@link PopupRedirectResolver}, optional\r\n * if already supplied to {@link initializeAuth} or provided by {@link getAuth}.\r\n *\r\n * @public\r\n */\n\n\nfunction _linkWithRedirect2() {\n _linkWithRedirect2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee186(user, provider, resolver) {\n var userInternal, resolverInternal, eventId;\n return _regeneratorRuntime.wrap(function _callee186$(_context186) {\n while (1) {\n switch (_context186.prev = _context186.next) {\n case 0:\n userInternal = getModularInstance(user);\n\n _assertInstanceOf(userInternal.auth, provider, FederatedAuthProvider); // Wait for auth initialization to complete, this will process pending redirects and clear the\n // PENDING_REDIRECT_KEY in persistence. This should be completed before starting a new\n // redirect and creating a PENDING_REDIRECT_KEY entry.\n\n\n _context186.next = 4;\n return userInternal.auth._initializationPromise;\n\n case 4:\n // Allow the resolver to error before persisting the redirect user\n resolverInternal = _withDefaultResolver(userInternal.auth, resolver);\n _context186.next = 7;\n return _assertLinkedStatus(false, userInternal, provider.providerId);\n\n case 7:\n _context186.next = 9;\n return _setPendingRedirectStatus(resolverInternal, userInternal.auth);\n\n case 9:\n _context186.next = 11;\n return prepareUserForRedirect(userInternal);\n\n case 11:\n eventId = _context186.sent;\n return _context186.abrupt(\"return\", resolverInternal._openRedirect(userInternal.auth, provider, \"linkViaRedirect\"\n /* AuthEventType.LINK_VIA_REDIRECT */\n , eventId));\n\n case 13:\n case \"end\":\n return _context186.stop();\n }\n }\n }, _callee186);\n }));\n return _linkWithRedirect2.apply(this, arguments);\n}\n\nfunction getRedirectResult(_x254, _x255) {\n return _getRedirectResult2.apply(this, arguments);\n}\n\nfunction _getRedirectResult2() {\n _getRedirectResult2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee187(auth, resolver) {\n return _regeneratorRuntime.wrap(function _callee187$(_context187) {\n while (1) {\n switch (_context187.prev = _context187.next) {\n case 0:\n _context187.next = 2;\n return _castAuth(auth)._initializationPromise;\n\n case 2:\n return _context187.abrupt(\"return\", _getRedirectResult(auth, resolver, false));\n\n case 3:\n case \"end\":\n return _context187.stop();\n }\n }\n }, _callee187);\n }));\n return _getRedirectResult2.apply(this, arguments);\n}\n\nfunction _getRedirectResult(_x256, _x257) {\n return _getRedirectResult3.apply(this, arguments);\n}\n\nfunction _getRedirectResult3() {\n _getRedirectResult3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee188(auth, resolverExtern) {\n var bypassAuthState,\n authInternal,\n resolver,\n action,\n result,\n _args188 = arguments;\n return _regeneratorRuntime.wrap(function _callee188$(_context188) {\n while (1) {\n switch (_context188.prev = _context188.next) {\n case 0:\n bypassAuthState = _args188.length > 2 && _args188[2] !== undefined ? _args188[2] : false;\n authInternal = _castAuth(auth);\n resolver = _withDefaultResolver(authInternal, resolverExtern);\n action = new RedirectAction(authInternal, resolver, bypassAuthState);\n _context188.next = 6;\n return action.execute();\n\n case 6:\n result = _context188.sent;\n\n if (!(result && !bypassAuthState)) {\n _context188.next = 13;\n break;\n }\n\n delete result.user._redirectEventId;\n _context188.next = 11;\n return authInternal._persistUserIfCurrent(result.user);\n\n case 11:\n _context188.next = 13;\n return authInternal._setRedirectUser(null, resolverExtern);\n\n case 13:\n return _context188.abrupt(\"return\", result);\n\n case 14:\n case \"end\":\n return _context188.stop();\n }\n }\n }, _callee188);\n }));\n return _getRedirectResult3.apply(this, arguments);\n}\n\nfunction prepareUserForRedirect(_x258) {\n return _prepareUserForRedirect.apply(this, arguments);\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 */\n// The amount of time to store the UIDs of seen events; this is\n// set to 10 min by default\n\n\nfunction _prepareUserForRedirect() {\n _prepareUserForRedirect = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee189(user) {\n var eventId;\n return _regeneratorRuntime.wrap(function _callee189$(_context189) {\n while (1) {\n switch (_context189.prev = _context189.next) {\n case 0:\n eventId = _generateEventId(\"\".concat(user.uid, \":::\"));\n user._redirectEventId = eventId;\n _context189.next = 4;\n return user.auth._setRedirectUser(user);\n\n case 4:\n _context189.next = 6;\n return user.auth._persistUserIfCurrent(user);\n\n case 6:\n return _context189.abrupt(\"return\", eventId);\n\n case 7:\n case \"end\":\n return _context189.stop();\n }\n }\n }, _callee189);\n }));\n return _prepareUserForRedirect.apply(this, arguments);\n}\n\nvar EVENT_DUPLICATION_CACHE_DURATION_MS = 10 * 60 * 1000;\n\nvar AuthEventManager = /*#__PURE__*/function () {\n function AuthEventManager(auth) {\n _classCallCheck(this, AuthEventManager);\n\n this.auth = auth;\n this.cachedEventUids = new Set();\n this.consumers = new Set();\n this.queuedRedirectEvent = null;\n this.hasHandledPotentialRedirect = false;\n this.lastProcessedEventTime = Date.now();\n }\n\n _createClass(AuthEventManager, [{\n key: \"registerConsumer\",\n value: function registerConsumer(authEventConsumer) {\n this.consumers.add(authEventConsumer);\n\n if (this.queuedRedirectEvent && this.isEventForConsumer(this.queuedRedirectEvent, authEventConsumer)) {\n this.sendToConsumer(this.queuedRedirectEvent, authEventConsumer);\n this.saveEventToCache(this.queuedRedirectEvent);\n this.queuedRedirectEvent = null;\n }\n }\n }, {\n key: \"unregisterConsumer\",\n value: function unregisterConsumer(authEventConsumer) {\n this.consumers.delete(authEventConsumer);\n }\n }, {\n key: \"onEvent\",\n value: function onEvent(event) {\n var _this44 = this;\n\n // Check if the event has already been handled\n if (this.hasEventBeenHandled(event)) {\n return false;\n }\n\n var handled = false;\n this.consumers.forEach(function (consumer) {\n if (_this44.isEventForConsumer(event, consumer)) {\n handled = true;\n\n _this44.sendToConsumer(event, consumer);\n\n _this44.saveEventToCache(event);\n }\n });\n\n if (this.hasHandledPotentialRedirect || !isRedirectEvent(event)) {\n // If we've already seen a redirect before, or this is a popup event,\n // bail now\n return handled;\n }\n\n this.hasHandledPotentialRedirect = true; // If the redirect wasn't handled, hang on to it\n\n if (!handled) {\n this.queuedRedirectEvent = event;\n handled = true;\n }\n\n return handled;\n }\n }, {\n key: \"sendToConsumer\",\n value: function sendToConsumer(event, consumer) {\n var _a;\n\n if (event.error && !isNullRedirectEvent(event)) {\n var code = ((_a = event.error.code) === null || _a === void 0 ? void 0 : _a.split('auth/')[1]) || \"internal-error\"\n /* AuthErrorCode.INTERNAL_ERROR */\n ;\n consumer.onError(_createError(this.auth, code));\n } else {\n consumer.onAuthEvent(event);\n }\n }\n }, {\n key: \"isEventForConsumer\",\n value: function isEventForConsumer(event, consumer) {\n var eventIdMatches = consumer.eventId === null || !!event.eventId && event.eventId === consumer.eventId;\n return consumer.filter.includes(event.type) && eventIdMatches;\n }\n }, {\n key: \"hasEventBeenHandled\",\n value: function hasEventBeenHandled(event) {\n if (Date.now() - this.lastProcessedEventTime >= EVENT_DUPLICATION_CACHE_DURATION_MS) {\n this.cachedEventUids.clear();\n }\n\n return this.cachedEventUids.has(eventUid(event));\n }\n }, {\n key: \"saveEventToCache\",\n value: function saveEventToCache(event) {\n this.cachedEventUids.add(eventUid(event));\n this.lastProcessedEventTime = Date.now();\n }\n }]);\n\n return AuthEventManager;\n}();\n\nfunction eventUid(e) {\n return [e.type, e.eventId, e.sessionId, e.tenantId].filter(function (v) {\n return v;\n }).join('-');\n}\n\nfunction isNullRedirectEvent(_ref34) {\n var type = _ref34.type,\n error = _ref34.error;\n return type === \"unknown\"\n /* AuthEventType.UNKNOWN */\n && (error === null || error === void 0 ? void 0 : error.code) === \"auth/\".concat(\"no-auth-event\"\n /* AuthErrorCode.NO_AUTH_EVENT */\n );\n}\n\nfunction isRedirectEvent(event) {\n switch (event.type) {\n case \"signInViaRedirect\"\n /* AuthEventType.SIGN_IN_VIA_REDIRECT */\n :\n case \"linkViaRedirect\"\n /* AuthEventType.LINK_VIA_REDIRECT */\n :\n case \"reauthViaRedirect\"\n /* AuthEventType.REAUTH_VIA_REDIRECT */\n :\n return true;\n\n case \"unknown\"\n /* AuthEventType.UNKNOWN */\n :\n return isNullRedirectEvent(event);\n\n default:\n return false;\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 */\n\n\nfunction _getProjectConfig(_x259) {\n return _getProjectConfig2.apply(this, arguments);\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 */\n\n\nfunction _getProjectConfig2() {\n _getProjectConfig2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee190(auth) {\n var request,\n _args190 = arguments;\n return _regeneratorRuntime.wrap(function _callee190$(_context190) {\n while (1) {\n switch (_context190.prev = _context190.next) {\n case 0:\n request = _args190.length > 1 && _args190[1] !== undefined ? _args190[1] : {};\n return _context190.abrupt(\"return\", _performApiRequest(auth, \"GET\"\n /* HttpMethod.GET */\n , \"/v1/projects\"\n /* Endpoint.GET_PROJECT_CONFIG */\n , request));\n\n case 2:\n case \"end\":\n return _context190.stop();\n }\n }\n }, _callee190);\n }));\n return _getProjectConfig2.apply(this, arguments);\n}\n\nvar IP_ADDRESS_REGEX = /^\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}$/;\nvar HTTP_REGEX = /^https?/;\n\nfunction _validateOrigin(_x260) {\n return _validateOrigin2.apply(this, arguments);\n}\n\nfunction _validateOrigin2() {\n _validateOrigin2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee191(auth) {\n var _yield$_getProjectCon, authorizedDomains, _iterator6, _step6, domain;\n\n return _regeneratorRuntime.wrap(function _callee191$(_context191) {\n while (1) {\n switch (_context191.prev = _context191.next) {\n case 0:\n if (!auth.config.emulator) {\n _context191.next = 2;\n break;\n }\n\n return _context191.abrupt(\"return\");\n\n case 2:\n _context191.next = 4;\n return _getProjectConfig(auth);\n\n case 4:\n _yield$_getProjectCon = _context191.sent;\n authorizedDomains = _yield$_getProjectCon.authorizedDomains;\n _iterator6 = _createForOfIteratorHelper(authorizedDomains);\n _context191.prev = 7;\n\n _iterator6.s();\n\n case 9:\n if ((_step6 = _iterator6.n()).done) {\n _context191.next = 20;\n break;\n }\n\n domain = _step6.value;\n _context191.prev = 11;\n\n if (!matchDomain(domain)) {\n _context191.next = 14;\n break;\n }\n\n return _context191.abrupt(\"return\");\n\n case 14:\n _context191.next = 18;\n break;\n\n case 16:\n _context191.prev = 16;\n _context191.t0 = _context191[\"catch\"](11);\n\n case 18:\n _context191.next = 9;\n break;\n\n case 20:\n _context191.next = 25;\n break;\n\n case 22:\n _context191.prev = 22;\n _context191.t1 = _context191[\"catch\"](7);\n\n _iterator6.e(_context191.t1);\n\n case 25:\n _context191.prev = 25;\n\n _iterator6.f();\n\n return _context191.finish(25);\n\n case 28:\n // In the old SDK, this error also provides helpful messages.\n _fail(auth, \"unauthorized-domain\"\n /* AuthErrorCode.INVALID_ORIGIN */\n );\n\n case 29:\n case \"end\":\n return _context191.stop();\n }\n }\n }, _callee191, null, [[7, 22, 25, 28], [11, 16]]);\n }));\n return _validateOrigin2.apply(this, arguments);\n}\n\nfunction matchDomain(expected) {\n var currentUrl = _getCurrentUrl();\n\n var _URL = new URL(currentUrl),\n protocol = _URL.protocol,\n hostname = _URL.hostname;\n\n if (expected.startsWith('chrome-extension://')) {\n var ceUrl = new URL(expected);\n\n if (ceUrl.hostname === '' && hostname === '') {\n // For some reason we're not parsing chrome URLs properly\n return protocol === 'chrome-extension:' && expected.replace('chrome-extension://', '') === currentUrl.replace('chrome-extension://', '');\n }\n\n return protocol === 'chrome-extension:' && ceUrl.hostname === hostname;\n }\n\n if (!HTTP_REGEX.test(protocol)) {\n return false;\n }\n\n if (IP_ADDRESS_REGEX.test(expected)) {\n // The domain has to be exactly equal to the pattern, as an IP domain will\n // only contain the IP, no extra character.\n return hostname === expected;\n } // Dots in pattern should be escaped.\n\n\n var escapedDomainPattern = expected.replace(/\\./g, '\\\\.'); // Non ip address domains.\n // domain.com = *.domain.com OR domain.com\n\n var re = new RegExp('^(.+\\\\.' + escapedDomainPattern + '|' + escapedDomainPattern + ')$', 'i');\n return re.test(hostname);\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 */\n\n\nvar NETWORK_TIMEOUT = new Delay(30000, 60000);\n/**\r\n * Reset unlaoded GApi modules. If gapi.load fails due to a network error,\r\n * it will stop working after a retrial. This is a hack to fix this issue.\r\n */\n\nfunction resetUnloadedGapiModules() {\n // Clear last failed gapi.load state to force next gapi.load to first\n // load the failed gapi.iframes module.\n // Get gapix.beacon context.\n var beacon = _window().___jsl; // Get current hint.\n\n\n if (beacon === null || beacon === void 0 ? void 0 : beacon.H) {\n // Get gapi hint.\n for (var _i5 = 0, _Object$keys3 = Object.keys(beacon.H); _i5 < _Object$keys3.length; _i5++) {\n var hint = _Object$keys3[_i5];\n // Requested modules.\n beacon.H[hint].r = beacon.H[hint].r || []; // Loaded modules.\n\n beacon.H[hint].L = beacon.H[hint].L || []; // Set requested modules to a copy of the loaded modules.\n\n beacon.H[hint].r = _toConsumableArray(beacon.H[hint].L); // Clear pending callbacks.\n\n if (beacon.CP) {\n for (var i = 0; i < beacon.CP.length; i++) {\n // Remove all failed pending callbacks.\n beacon.CP[i] = null;\n }\n }\n }\n }\n}\n\nfunction loadGapi(auth) {\n return new Promise(function (resolve, reject) {\n var _a, _b, _c; // Function to run when gapi.load is ready.\n\n\n function loadGapiIframe() {\n // The developer may have tried to previously run gapi.load and failed.\n // Run this to fix that.\n resetUnloadedGapiModules();\n gapi.load('gapi.iframes', {\n callback: function callback() {\n resolve(gapi.iframes.getContext());\n },\n ontimeout: function ontimeout() {\n // The above reset may be sufficient, but having this reset after\n // failure ensures that if the developer calls gapi.load after the\n // connection is re-established and before another attempt to embed\n // the iframe, it would work and would not be broken because of our\n // failed attempt.\n // Timeout when gapi.iframes.Iframe not loaded.\n resetUnloadedGapiModules();\n reject(_createError(auth, \"network-request-failed\"\n /* AuthErrorCode.NETWORK_REQUEST_FAILED */\n ));\n },\n timeout: NETWORK_TIMEOUT.get()\n });\n }\n\n if ((_b = (_a = _window().gapi) === null || _a === void 0 ? void 0 : _a.iframes) === null || _b === void 0 ? void 0 : _b.Iframe) {\n // If gapi.iframes.Iframe available, resolve.\n resolve(gapi.iframes.getContext());\n } else if (!!((_c = _window().gapi) === null || _c === void 0 ? void 0 : _c.load)) {\n // Gapi loader ready, load gapi.iframes.\n loadGapiIframe();\n } else {\n // Create a new iframe callback when this is called so as not to overwrite\n // any previous defined callback. This happens if this method is called\n // multiple times in parallel and could result in the later callback\n // overwriting the previous one. This would end up with a iframe\n // timeout.\n var cbName = _generateCallbackName('iframefcb'); // GApi loader not available, dynamically load platform.js.\n\n\n _window()[cbName] = function () {\n // GApi loader should be ready.\n if (!!gapi.load) {\n loadGapiIframe();\n } else {\n // Gapi loader failed, throw error.\n reject(_createError(auth, \"network-request-failed\"\n /* AuthErrorCode.NETWORK_REQUEST_FAILED */\n ));\n }\n }; // Load GApi loader.\n\n\n return _loadJS(\"\".concat(_gapiScriptUrl(), \"?onload=\").concat(cbName)).catch(function (e) {\n return reject(e);\n });\n }\n }).catch(function (error) {\n // Reset cached promise to allow for retrial.\n cachedGApiLoader = null;\n throw error;\n });\n}\n\nvar cachedGApiLoader = null;\n\nfunction _loadGapi(auth) {\n cachedGApiLoader = cachedGApiLoader || loadGapi(auth);\n return cachedGApiLoader;\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 */\n\n\nvar PING_TIMEOUT = new Delay(5000, 15000);\nvar IFRAME_PATH = '__/auth/iframe';\nvar EMULATED_IFRAME_PATH = 'emulator/auth/iframe';\nvar IFRAME_ATTRIBUTES = {\n style: {\n position: 'absolute',\n top: '-100px',\n width: '1px',\n height: '1px'\n },\n 'aria-hidden': 'true',\n tabindex: '-1'\n}; // Map from apiHost to endpoint ID for passing into iframe. In current SDK, apiHost can be set to\n// anything (not from a list of endpoints with IDs as in legacy), so this is the closest we can get.\n\nvar EID_FROM_APIHOST = new Map([[\"identitytoolkit.googleapis.com\"\n/* DefaultConfig.API_HOST */\n, 'p'], ['staging-identitytoolkit.sandbox.googleapis.com', 's'], ['test-identitytoolkit.sandbox.googleapis.com', 't'] // test\n]);\n\nfunction getIframeUrl(auth) {\n var config = auth.config;\n\n _assert(config.authDomain, auth, \"auth-domain-config-required\"\n /* AuthErrorCode.MISSING_AUTH_DOMAIN */\n );\n\n var url = config.emulator ? _emulatorUrl(config, EMULATED_IFRAME_PATH) : \"https://\".concat(auth.config.authDomain, \"/\").concat(IFRAME_PATH);\n var params = {\n apiKey: config.apiKey,\n appName: auth.name,\n v: SDK_VERSION\n };\n var eid = EID_FROM_APIHOST.get(auth.config.apiHost);\n\n if (eid) {\n params.eid = eid;\n }\n\n var frameworks = auth._getFrameworks();\n\n if (frameworks.length) {\n params.fw = frameworks.join(',');\n }\n\n return \"\".concat(url, \"?\").concat(querystring(params).slice(1));\n}\n\nfunction _openIframe(_x261) {\n return _openIframe2.apply(this, arguments);\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 */\n\n\nfunction _openIframe2() {\n _openIframe2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee193(auth) {\n var context, gapi;\n return _regeneratorRuntime.wrap(function _callee193$(_context193) {\n while (1) {\n switch (_context193.prev = _context193.next) {\n case 0:\n _context193.next = 2;\n return _loadGapi(auth);\n\n case 2:\n context = _context193.sent;\n gapi = _window().gapi;\n\n _assert(gapi, auth, \"internal-error\"\n /* AuthErrorCode.INTERNAL_ERROR */\n );\n\n return _context193.abrupt(\"return\", context.open({\n where: document.body,\n url: getIframeUrl(auth),\n messageHandlersFilter: gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER,\n attributes: IFRAME_ATTRIBUTES,\n dontclear: true\n }, function (iframe) {\n return new Promise( /*#__PURE__*/function () {\n var _ref45 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee192(resolve, reject) {\n var networkError, networkErrorTimer, clearTimerAndResolve;\n return _regeneratorRuntime.wrap(function _callee192$(_context192) {\n while (1) {\n switch (_context192.prev = _context192.next) {\n case 0:\n clearTimerAndResolve = function _clearTimerAndResolve() {\n _window().clearTimeout(networkErrorTimer);\n\n resolve(iframe);\n };\n\n _context192.next = 3;\n return iframe.restyle({\n // Prevent iframe from closing on mouse out.\n setHideOnLeave: false\n });\n\n case 3:\n networkError = _createError(auth, \"network-request-failed\"\n /* AuthErrorCode.NETWORK_REQUEST_FAILED */\n ); // Confirm iframe is correctly loaded.\n // To fallback on failure, set a timeout.\n\n // Confirm iframe is correctly loaded.\n // To fallback on failure, set a timeout.\n networkErrorTimer = _window().setTimeout(function () {\n reject(networkError);\n }, PING_TIMEOUT.get()); // Clear timer and resolve pending iframe ready promise.\n\n // This returns an IThenable. However the reject part does not call\n // when the iframe is not loaded.\n iframe.ping(clearTimerAndResolve).then(clearTimerAndResolve, function () {\n reject(networkError);\n });\n\n case 6:\n case \"end\":\n return _context192.stop();\n }\n }\n }, _callee192);\n }));\n\n return function (_x287, _x288) {\n return _ref45.apply(this, arguments);\n };\n }());\n }));\n\n case 6:\n case \"end\":\n return _context193.stop();\n }\n }\n }, _callee193);\n }));\n return _openIframe2.apply(this, arguments);\n}\n\nvar BASE_POPUP_OPTIONS = {\n location: 'yes',\n resizable: 'yes',\n statusbar: 'yes',\n toolbar: 'no'\n};\nvar DEFAULT_WIDTH = 500;\nvar DEFAULT_HEIGHT = 600;\nvar TARGET_BLANK = '_blank';\nvar FIREFOX_EMPTY_URL = 'http://localhost';\n\nvar AuthPopup = /*#__PURE__*/function () {\n function AuthPopup(window) {\n _classCallCheck(this, AuthPopup);\n\n this.window = window;\n this.associatedEvent = null;\n }\n\n _createClass(AuthPopup, [{\n key: \"close\",\n value: function close() {\n if (this.window) {\n try {\n this.window.close();\n } catch (e) {}\n }\n }\n }]);\n\n return AuthPopup;\n}();\n\nfunction _open(auth, url, name) {\n var width = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : DEFAULT_WIDTH;\n var height = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : DEFAULT_HEIGHT;\n var top = Math.max((window.screen.availHeight - height) / 2, 0).toString();\n var left = Math.max((window.screen.availWidth - width) / 2, 0).toString();\n var target = '';\n var options = Object.assign(Object.assign({}, BASE_POPUP_OPTIONS), {\n width: width.toString(),\n height: height.toString(),\n top: top,\n left: left\n }); // Chrome iOS 7 and 8 is returning an undefined popup win when target is\n // specified, even though the popup is not necessarily blocked.\n\n var ua = getUA().toLowerCase();\n\n if (name) {\n target = _isChromeIOS(ua) ? TARGET_BLANK : name;\n }\n\n if (_isFirefox(ua)) {\n // Firefox complains when invalid URLs are popped out. Hacky way to bypass.\n url = url || FIREFOX_EMPTY_URL; // Firefox disables by default scrolling on popup windows, which can create\n // issues when the user has many Google accounts, for instance.\n\n options.scrollbars = 'yes';\n }\n\n var optionsString = Object.entries(options).reduce(function (accum, _ref35) {\n var _ref36 = _slicedToArray(_ref35, 2),\n key = _ref36[0],\n value = _ref36[1];\n\n return \"\".concat(accum).concat(key, \"=\").concat(value, \",\");\n }, '');\n\n if (_isIOSStandalone(ua) && target !== '_self') {\n openAsNewWindowIOS(url || '', target);\n return new AuthPopup(null);\n } // about:blank getting sanitized causing browsers like IE/Edge to display\n // brief error message before redirecting to handler.\n\n\n var newWin = window.open(url || '', target, optionsString);\n\n _assert(newWin, auth, \"popup-blocked\"\n /* AuthErrorCode.POPUP_BLOCKED */\n ); // Flaky on IE edge, encapsulate with a try and catch.\n\n\n try {\n newWin.focus();\n } catch (e) {}\n\n return new AuthPopup(newWin);\n}\n\nfunction openAsNewWindowIOS(url, target) {\n var el = document.createElement('a');\n el.href = url;\n el.target = target;\n var click = document.createEvent('MouseEvent');\n click.initMouseEvent('click', true, true, window, 1, 0, 0, 0, 0, false, false, false, false, 1, null);\n el.dispatchEvent(click);\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 */\n\n/**\r\n * URL for Authentication widget which will initiate the OAuth handshake\r\n *\r\n * @internal\r\n */\n\n\nvar WIDGET_PATH = '__/auth/handler';\n/**\r\n * URL for emulated environment\r\n *\r\n * @internal\r\n */\n\nvar EMULATOR_WIDGET_PATH = 'emulator/auth/handler';\n/**\r\n * Fragment name for the App Check token that gets passed to the widget\r\n *\r\n * @internal\r\n */\n\nvar FIREBASE_APP_CHECK_FRAGMENT_ID = encodeURIComponent('fac');\n\nfunction _getRedirectUrl(_x262, _x263, _x264, _x265, _x266, _x267) {\n return _getRedirectUrl2.apply(this, arguments);\n}\n\nfunction _getRedirectUrl2() {\n _getRedirectUrl2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee194(auth, provider, authType, redirectUrl, eventId, additionalParams) {\n var params, _i6, _Object$entries, _Object$entries$_i, key, value, scopes, paramsDict, _i7, _Object$keys4, _key8, appCheckToken, appCheckTokenFragment;\n\n return _regeneratorRuntime.wrap(function _callee194$(_context194) {\n while (1) {\n switch (_context194.prev = _context194.next) {\n case 0:\n _assert(auth.config.authDomain, auth, \"auth-domain-config-required\"\n /* AuthErrorCode.MISSING_AUTH_DOMAIN */\n );\n\n _assert(auth.config.apiKey, auth, \"invalid-api-key\"\n /* AuthErrorCode.INVALID_API_KEY */\n );\n\n params = {\n apiKey: auth.config.apiKey,\n appName: auth.name,\n authType: authType,\n redirectUrl: redirectUrl,\n v: SDK_VERSION,\n eventId: eventId\n };\n\n if (provider instanceof FederatedAuthProvider) {\n provider.setDefaultLanguage(auth.languageCode);\n params.providerId = provider.providerId || '';\n\n if (!isEmpty(provider.getCustomParameters())) {\n params.customParameters = JSON.stringify(provider.getCustomParameters());\n } // TODO set additionalParams from the provider as well?\n\n\n for (_i6 = 0, _Object$entries = Object.entries(additionalParams || {}); _i6 < _Object$entries.length; _i6++) {\n _Object$entries$_i = _slicedToArray(_Object$entries[_i6], 2), key = _Object$entries$_i[0], value = _Object$entries$_i[1];\n params[key] = value;\n }\n }\n\n if (provider instanceof BaseOAuthProvider) {\n scopes = provider.getScopes().filter(function (scope) {\n return scope !== '';\n });\n\n if (scopes.length > 0) {\n params.scopes = scopes.join(',');\n }\n }\n\n if (auth.tenantId) {\n params.tid = auth.tenantId;\n } // TODO: maybe set eid as endipointId\n // TODO: maybe set fw as Frameworks.join(\",\")\n\n\n paramsDict = params;\n\n for (_i7 = 0, _Object$keys4 = Object.keys(paramsDict); _i7 < _Object$keys4.length; _i7++) {\n _key8 = _Object$keys4[_i7];\n\n if (paramsDict[_key8] === undefined) {\n delete paramsDict[_key8];\n }\n } // Sets the App Check token to pass to the widget\n\n\n _context194.next = 10;\n return auth._getAppCheckToken();\n\n case 10:\n appCheckToken = _context194.sent;\n appCheckTokenFragment = appCheckToken ? \"#\".concat(FIREBASE_APP_CHECK_FRAGMENT_ID, \"=\").concat(encodeURIComponent(appCheckToken)) : ''; // Start at index 1 to skip the leading '&' in the query string\n\n return _context194.abrupt(\"return\", \"\".concat(getHandlerBase(auth), \"?\").concat(querystring(paramsDict).slice(1)).concat(appCheckTokenFragment));\n\n case 13:\n case \"end\":\n return _context194.stop();\n }\n }\n }, _callee194);\n }));\n return _getRedirectUrl2.apply(this, arguments);\n}\n\nfunction getHandlerBase(_ref37) {\n var config = _ref37.config;\n\n if (!config.emulator) {\n return \"https://\".concat(config.authDomain, \"/\").concat(WIDGET_PATH);\n }\n\n return _emulatorUrl(config, EMULATOR_WIDGET_PATH);\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 */\n\n/**\r\n * The special web storage event\r\n *\r\n */\n\n\nvar WEB_STORAGE_SUPPORT_KEY = 'webStorageSupport';\n\nvar BrowserPopupRedirectResolver = /*#__PURE__*/function () {\n function BrowserPopupRedirectResolver() {\n _classCallCheck(this, BrowserPopupRedirectResolver);\n\n this.eventManagers = {};\n this.iframes = {};\n this.originValidationPromises = {};\n this._redirectPersistence = browserSessionPersistence;\n this._completeRedirectFn = _getRedirectResult;\n this._overrideRedirectResult = _overrideRedirectResult;\n } // Wrapping in async even though we don't await anywhere in order\n // to make sure errors are raised as promise rejections\n\n\n _createClass(BrowserPopupRedirectResolver, [{\n key: \"_openPopup\",\n value: function () {\n var _openPopup2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee93(auth, provider, authType, eventId) {\n var _a, url;\n\n return _regeneratorRuntime.wrap(function _callee93$(_context93) {\n while (1) {\n switch (_context93.prev = _context93.next) {\n case 0:\n debugAssert((_a = this.eventManagers[auth._key()]) === null || _a === void 0 ? void 0 : _a.manager, '_initialize() not called before _openPopup()');\n _context93.next = 3;\n return _getRedirectUrl(auth, provider, authType, _getCurrentUrl(), eventId);\n\n case 3:\n url = _context93.sent;\n return _context93.abrupt(\"return\", _open(auth, url, _generateEventId()));\n\n case 5:\n case \"end\":\n return _context93.stop();\n }\n }\n }, _callee93, this);\n }));\n\n function _openPopup(_x268, _x269, _x270, _x271) {\n return _openPopup2.apply(this, arguments);\n }\n\n return _openPopup;\n }()\n }, {\n key: \"_openRedirect\",\n value: function () {\n var _openRedirect2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee94(auth, provider, authType, eventId) {\n var url;\n return _regeneratorRuntime.wrap(function _callee94$(_context94) {\n while (1) {\n switch (_context94.prev = _context94.next) {\n case 0:\n _context94.next = 2;\n return this._originValidation(auth);\n\n case 2:\n _context94.next = 4;\n return _getRedirectUrl(auth, provider, authType, _getCurrentUrl(), eventId);\n\n case 4:\n url = _context94.sent;\n\n _setWindowLocation(url);\n\n return _context94.abrupt(\"return\", new Promise(function () {}));\n\n case 7:\n case \"end\":\n return _context94.stop();\n }\n }\n }, _callee94, this);\n }));\n\n function _openRedirect(_x272, _x273, _x274, _x275) {\n return _openRedirect2.apply(this, arguments);\n }\n\n return _openRedirect;\n }()\n }, {\n key: \"_initialize\",\n value: function _initialize(auth) {\n var _this45 = this;\n\n var key = auth._key();\n\n if (this.eventManagers[key]) {\n var _this$eventManagers$k = this.eventManagers[key],\n manager = _this$eventManagers$k.manager,\n _promise = _this$eventManagers$k.promise;\n\n if (manager) {\n return Promise.resolve(manager);\n } else {\n debugAssert(_promise, 'If manager is not set, promise should be');\n return _promise;\n }\n }\n\n var promise = this.initAndGetManager(auth);\n this.eventManagers[key] = {\n promise: promise\n }; // If the promise is rejected, the key should be removed so that the\n // operation can be retried later.\n\n promise.catch(function () {\n delete _this45.eventManagers[key];\n });\n return promise;\n }\n }, {\n key: \"initAndGetManager\",\n value: function () {\n var _initAndGetManager = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee95(auth) {\n var iframe, manager;\n return _regeneratorRuntime.wrap(function _callee95$(_context95) {\n while (1) {\n switch (_context95.prev = _context95.next) {\n case 0:\n _context95.next = 2;\n return _openIframe(auth);\n\n case 2:\n iframe = _context95.sent;\n manager = new AuthEventManager(auth);\n iframe.register('authEvent', function (iframeEvent) {\n _assert(iframeEvent === null || iframeEvent === void 0 ? void 0 : iframeEvent.authEvent, auth, \"invalid-auth-event\"\n /* AuthErrorCode.INVALID_AUTH_EVENT */\n ); // TODO: Consider splitting redirect and popup events earlier on\n\n\n var handled = manager.onEvent(iframeEvent.authEvent);\n return {\n status: handled ? \"ACK\"\n /* GapiOutcome.ACK */\n : \"ERROR\"\n /* GapiOutcome.ERROR */\n\n };\n }, gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER);\n this.eventManagers[auth._key()] = {\n manager: manager\n };\n this.iframes[auth._key()] = iframe;\n return _context95.abrupt(\"return\", manager);\n\n case 8:\n case \"end\":\n return _context95.stop();\n }\n }\n }, _callee95, this);\n }));\n\n function initAndGetManager(_x276) {\n return _initAndGetManager.apply(this, arguments);\n }\n\n return initAndGetManager;\n }()\n }, {\n key: \"_isIframeWebStorageSupported\",\n value: function _isIframeWebStorageSupported(auth, cb) {\n var iframe = this.iframes[auth._key()];\n\n iframe.send(WEB_STORAGE_SUPPORT_KEY, {\n type: WEB_STORAGE_SUPPORT_KEY\n }, function (result) {\n var _a;\n\n var isSupported = (_a = result === null || result === void 0 ? void 0 : result[0]) === null || _a === void 0 ? void 0 : _a[WEB_STORAGE_SUPPORT_KEY];\n\n if (isSupported !== undefined) {\n cb(!!isSupported);\n }\n\n _fail(auth, \"internal-error\"\n /* AuthErrorCode.INTERNAL_ERROR */\n );\n }, gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER);\n }\n }, {\n key: \"_originValidation\",\n value: function _originValidation(auth) {\n var key = auth._key();\n\n if (!this.originValidationPromises[key]) {\n this.originValidationPromises[key] = _validateOrigin(auth);\n }\n\n return this.originValidationPromises[key];\n }\n }, {\n key: \"_shouldInitProactively\",\n get: function get() {\n // Mobile browsers and Safari need to optimistically initialize\n return _isMobileBrowser() || _isSafari() || _isIOS();\n }\n }]);\n\n return BrowserPopupRedirectResolver;\n}();\n/**\r\n * An implementation of {@link PopupRedirectResolver} suitable for browser\r\n * based applications.\r\n *\r\n * @remarks\r\n * This method does not work in a Node.js environment.\r\n *\r\n * @public\r\n */\n\n\nvar browserPopupRedirectResolver = BrowserPopupRedirectResolver;\n\nvar MultiFactorAssertionImpl = /*#__PURE__*/function () {\n function MultiFactorAssertionImpl(factorId) {\n _classCallCheck(this, MultiFactorAssertionImpl);\n\n this.factorId = factorId;\n }\n\n _createClass(MultiFactorAssertionImpl, [{\n key: \"_process\",\n value: function _process(auth, session, displayName) {\n switch (session.type) {\n case \"enroll\"\n /* MultiFactorSessionType.ENROLL */\n :\n return this._finalizeEnroll(auth, session.credential, displayName);\n\n case \"signin\"\n /* MultiFactorSessionType.SIGN_IN */\n :\n return this._finalizeSignIn(auth, session.credential);\n\n default:\n return debugFail('unexpected MultiFactorSessionType');\n }\n }\n }]);\n\n return MultiFactorAssertionImpl;\n}();\n/**\r\n * {@inheritdoc PhoneMultiFactorAssertion}\r\n *\r\n * @public\r\n */\n\n\nvar PhoneMultiFactorAssertionImpl = /*#__PURE__*/function (_MultiFactorAssertion) {\n _inherits(PhoneMultiFactorAssertionImpl, _MultiFactorAssertion);\n\n var _super25 = _createSuper(PhoneMultiFactorAssertionImpl);\n\n function PhoneMultiFactorAssertionImpl(credential) {\n var _this46;\n\n _classCallCheck(this, PhoneMultiFactorAssertionImpl);\n\n _this46 = _super25.call(this, \"phone\"\n /* FactorId.PHONE */\n );\n _this46.credential = credential;\n return _this46;\n }\n /** @internal */\n\n\n _createClass(PhoneMultiFactorAssertionImpl, [{\n key: \"_finalizeEnroll\",\n value:\n /** @internal */\n function _finalizeEnroll(auth, idToken, displayName) {\n return finalizeEnrollPhoneMfa(auth, {\n idToken: idToken,\n displayName: displayName,\n phoneVerificationInfo: this.credential._makeVerificationRequest()\n });\n }\n /** @internal */\n\n }, {\n key: \"_finalizeSignIn\",\n value: function _finalizeSignIn(auth, mfaPendingCredential) {\n return finalizeSignInPhoneMfa(auth, {\n mfaPendingCredential: mfaPendingCredential,\n phoneVerificationInfo: this.credential._makeVerificationRequest()\n });\n }\n }], [{\n key: \"_fromCredential\",\n value: function _fromCredential(credential) {\n return new PhoneMultiFactorAssertionImpl(credential);\n }\n }]);\n\n return PhoneMultiFactorAssertionImpl;\n}(MultiFactorAssertionImpl);\n/**\r\n * Provider for generating a {@link PhoneMultiFactorAssertion}.\r\n *\r\n * @public\r\n */\n\n\nvar PhoneMultiFactorGenerator = /*#__PURE__*/function () {\n function PhoneMultiFactorGenerator() {\n _classCallCheck(this, PhoneMultiFactorGenerator);\n }\n /**\r\n * Provides a {@link PhoneMultiFactorAssertion} to confirm ownership of the phone second factor.\r\n *\r\n * @remarks\r\n * This method does not work in a Node.js environment.\r\n *\r\n * @param phoneAuthCredential - A credential provided by {@link PhoneAuthProvider.credential}.\r\n * @returns A {@link PhoneMultiFactorAssertion} which can be used with\r\n * {@link MultiFactorResolver.resolveSignIn}\r\n */\n\n\n _createClass(PhoneMultiFactorGenerator, null, [{\n key: \"assertion\",\n value: function assertion(credential) {\n return PhoneMultiFactorAssertionImpl._fromCredential(credential);\n }\n }]);\n\n return PhoneMultiFactorGenerator;\n}();\n/**\r\n * The identifier of the phone second factor: `phone`.\r\n */\n\n\nPhoneMultiFactorGenerator.FACTOR_ID = 'phone';\n/**\r\n * Provider for generating a {@link TotpMultiFactorAssertion}.\r\n *\r\n * @public\r\n */\n\nvar TotpMultiFactorGenerator = /*#__PURE__*/function () {\n function TotpMultiFactorGenerator() {\n _classCallCheck(this, TotpMultiFactorGenerator);\n }\n\n _createClass(TotpMultiFactorGenerator, null, [{\n key: \"assertionForEnrollment\",\n value:\n /**\r\n * Provides a {@link TotpMultiFactorAssertion} to confirm ownership of\r\n * the TOTP (time-based one-time password) second factor.\r\n * This assertion is used to complete enrollment in TOTP second factor.\r\n *\r\n * @param secret A {@link TotpSecret} containing the shared secret key and other TOTP parameters.\r\n * @param oneTimePassword One-time password from TOTP App.\r\n * @returns A {@link TotpMultiFactorAssertion} which can be used with\r\n * {@link MultiFactorUser.enroll}.\r\n */\n function assertionForEnrollment(secret, oneTimePassword) {\n return TotpMultiFactorAssertionImpl._fromSecret(secret, oneTimePassword);\n }\n /**\r\n * Provides a {@link TotpMultiFactorAssertion} to confirm ownership of the TOTP second factor.\r\n * This assertion is used to complete signIn with TOTP as the second factor.\r\n *\r\n * @param enrollmentId identifies the enrolled TOTP second factor.\r\n * @param oneTimePassword One-time password from TOTP App.\r\n * @returns A {@link TotpMultiFactorAssertion} which can be used with\r\n * {@link MultiFactorResolver.resolveSignIn}.\r\n */\n\n }, {\n key: \"assertionForSignIn\",\n value: function assertionForSignIn(enrollmentId, oneTimePassword) {\n return TotpMultiFactorAssertionImpl._fromEnrollmentId(enrollmentId, oneTimePassword);\n }\n /**\r\n * Returns a promise to {@link TotpSecret} which contains the TOTP shared secret key and other parameters.\r\n * Creates a TOTP secret as part of enrolling a TOTP second factor.\r\n * Used for generating a QR code URL or inputting into a TOTP app.\r\n * This method uses the auth instance corresponding to the user in the multiFactorSession.\r\n *\r\n * @param session The {@link MultiFactorSession} that the user is part of.\r\n * @returns A promise to {@link TotpSecret}.\r\n */\n\n }, {\n key: \"generateSecret\",\n value: function () {\n var _generateSecret = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee96(session) {\n var _a, mfaSession, response;\n\n return _regeneratorRuntime.wrap(function _callee96$(_context96) {\n while (1) {\n switch (_context96.prev = _context96.next) {\n case 0:\n mfaSession = session;\n\n _assert(typeof ((_a = mfaSession.user) === null || _a === void 0 ? void 0 : _a.auth) !== 'undefined', \"internal-error\"\n /* AuthErrorCode.INTERNAL_ERROR */\n );\n\n _context96.next = 4;\n return startEnrollTotpMfa(mfaSession.user.auth, {\n idToken: mfaSession.credential,\n totpEnrollmentInfo: {}\n });\n\n case 4:\n response = _context96.sent;\n return _context96.abrupt(\"return\", TotpSecret._fromStartTotpMfaEnrollmentResponse(response, mfaSession.user.auth));\n\n case 6:\n case \"end\":\n return _context96.stop();\n }\n }\n }, _callee96);\n }));\n\n function generateSecret(_x277) {\n return _generateSecret.apply(this, arguments);\n }\n\n return generateSecret;\n }()\n }]);\n\n return TotpMultiFactorGenerator;\n}();\n/**\r\n * The identifier of the TOTP second factor: `totp`.\r\n */\n\n\nTotpMultiFactorGenerator.FACTOR_ID = \"totp\"\n/* FactorId.TOTP */\n;\n\nvar TotpMultiFactorAssertionImpl = /*#__PURE__*/function (_MultiFactorAssertion2) {\n _inherits(TotpMultiFactorAssertionImpl, _MultiFactorAssertion2);\n\n var _super26 = _createSuper(TotpMultiFactorAssertionImpl);\n\n function TotpMultiFactorAssertionImpl(otp, enrollmentId, secret) {\n var _this47;\n\n _classCallCheck(this, TotpMultiFactorAssertionImpl);\n\n _this47 = _super26.call(this, \"totp\"\n /* FactorId.TOTP */\n );\n _this47.otp = otp;\n _this47.enrollmentId = enrollmentId;\n _this47.secret = secret;\n return _this47;\n }\n /** @internal */\n\n\n _createClass(TotpMultiFactorAssertionImpl, [{\n key: \"_finalizeEnroll\",\n value:\n /** @internal */\n function () {\n var _finalizeEnroll2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee97(auth, idToken, displayName) {\n return _regeneratorRuntime.wrap(function _callee97$(_context97) {\n while (1) {\n switch (_context97.prev = _context97.next) {\n case 0:\n _assert(typeof this.secret !== 'undefined', auth, \"argument-error\"\n /* AuthErrorCode.ARGUMENT_ERROR */\n );\n\n return _context97.abrupt(\"return\", finalizeEnrollTotpMfa(auth, {\n idToken: idToken,\n displayName: displayName,\n totpVerificationInfo: this.secret._makeTotpVerificationInfo(this.otp)\n }));\n\n case 2:\n case \"end\":\n return _context97.stop();\n }\n }\n }, _callee97, this);\n }));\n\n function _finalizeEnroll(_x278, _x279, _x280) {\n return _finalizeEnroll2.apply(this, arguments);\n }\n\n return _finalizeEnroll;\n }()\n /** @internal */\n\n }, {\n key: \"_finalizeSignIn\",\n value: function () {\n var _finalizeSignIn2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee98(auth, mfaPendingCredential) {\n var totpVerificationInfo;\n return _regeneratorRuntime.wrap(function _callee98$(_context98) {\n while (1) {\n switch (_context98.prev = _context98.next) {\n case 0:\n _assert(this.enrollmentId !== undefined && this.otp !== undefined, auth, \"argument-error\"\n /* AuthErrorCode.ARGUMENT_ERROR */\n );\n\n totpVerificationInfo = {\n verificationCode: this.otp\n };\n return _context98.abrupt(\"return\", finalizeSignInTotpMfa(auth, {\n mfaPendingCredential: mfaPendingCredential,\n mfaEnrollmentId: this.enrollmentId,\n totpVerificationInfo: totpVerificationInfo\n }));\n\n case 3:\n case \"end\":\n return _context98.stop();\n }\n }\n }, _callee98, this);\n }));\n\n function _finalizeSignIn(_x281, _x282) {\n return _finalizeSignIn2.apply(this, arguments);\n }\n\n return _finalizeSignIn;\n }()\n }], [{\n key: \"_fromSecret\",\n value: function _fromSecret(secret, otp) {\n return new TotpMultiFactorAssertionImpl(otp, undefined, secret);\n }\n /** @internal */\n\n }, {\n key: \"_fromEnrollmentId\",\n value: function _fromEnrollmentId(enrollmentId, otp) {\n return new TotpMultiFactorAssertionImpl(otp, enrollmentId);\n }\n }]);\n\n return TotpMultiFactorAssertionImpl;\n}(MultiFactorAssertionImpl);\n/**\r\n * Provider for generating a {@link TotpMultiFactorAssertion}.\r\n *\r\n * Stores the shared secret key and other parameters to generate time-based OTPs.\r\n * Implements methods to retrieve the shared secret key and generate a QR code URL.\r\n * @public\r\n */\n\n\nvar TotpSecret = /*#__PURE__*/function () {\n // The public members are declared outside the constructor so the docs can be generated.\n function TotpSecret(secretKey, hashingAlgorithm, codeLength, codeIntervalSeconds, enrollmentCompletionDeadline, sessionInfo, auth) {\n _classCallCheck(this, TotpSecret);\n\n this.sessionInfo = sessionInfo;\n this.auth = auth;\n this.secretKey = secretKey;\n this.hashingAlgorithm = hashingAlgorithm;\n this.codeLength = codeLength;\n this.codeIntervalSeconds = codeIntervalSeconds;\n this.enrollmentCompletionDeadline = enrollmentCompletionDeadline;\n }\n /** @internal */\n\n\n _createClass(TotpSecret, [{\n key: \"_makeTotpVerificationInfo\",\n value:\n /** @internal */\n function _makeTotpVerificationInfo(otp) {\n return {\n sessionInfo: this.sessionInfo,\n verificationCode: otp\n };\n }\n /**\r\n * Returns a QR code URL as described in\r\n * https://github.com/google/google-authenticator/wiki/Key-Uri-Format\r\n * This can be displayed to the user as a QR code to be scanned into a TOTP app like Google Authenticator.\r\n * If the optional parameters are unspecified, an accountName of and issuer of are used.\r\n *\r\n * @param accountName the name of the account/app along with a user identifier.\r\n * @param issuer issuer of the TOTP (likely the app name).\r\n * @returns A QR code URL string.\r\n */\n\n }, {\n key: \"generateQrCodeUrl\",\n value: function generateQrCodeUrl(accountName, issuer) {\n var _a;\n\n var useDefaults = false;\n\n if (_isEmptyString(accountName) || _isEmptyString(issuer)) {\n useDefaults = true;\n }\n\n if (useDefaults) {\n if (_isEmptyString(accountName)) {\n accountName = ((_a = this.auth.currentUser) === null || _a === void 0 ? void 0 : _a.email) || 'unknownuser';\n }\n\n if (_isEmptyString(issuer)) {\n issuer = this.auth.name;\n }\n }\n\n return \"otpauth://totp/\".concat(issuer, \":\").concat(accountName, \"?secret=\").concat(this.secretKey, \"&issuer=\").concat(issuer, \"&algorithm=\").concat(this.hashingAlgorithm, \"&digits=\").concat(this.codeLength);\n }\n }], [{\n key: \"_fromStartTotpMfaEnrollmentResponse\",\n value: function _fromStartTotpMfaEnrollmentResponse(response, auth) {\n return new TotpSecret(response.totpSessionInfo.sharedSecretKey, response.totpSessionInfo.hashingAlgorithm, response.totpSessionInfo.verificationCodeLength, response.totpSessionInfo.periodSec, new Date(response.totpSessionInfo.finalizeEnrollmentTime).toUTCString(), response.totpSessionInfo.sessionInfo, auth);\n }\n }]);\n\n return TotpSecret;\n}();\n/** @internal */\n\n\nfunction _isEmptyString(input) {\n return typeof input === 'undefined' || (input === null || input === void 0 ? void 0 : input.length) === 0;\n}\n\nvar name = \"@firebase/auth\";\nvar version = \"1.6.0\";\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 */\n\nvar AuthInterop = /*#__PURE__*/function () {\n function AuthInterop(auth) {\n _classCallCheck(this, AuthInterop);\n\n this.auth = auth;\n this.internalListeners = new Map();\n }\n\n _createClass(AuthInterop, [{\n key: \"getUid\",\n value: function getUid() {\n var _a;\n\n this.assertAuthConfigured();\n return ((_a = this.auth.currentUser) === null || _a === void 0 ? void 0 : _a.uid) || null;\n }\n }, {\n key: \"getToken\",\n value: function () {\n var _getToken2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee99(forceRefresh) {\n var accessToken;\n return _regeneratorRuntime.wrap(function _callee99$(_context99) {\n while (1) {\n switch (_context99.prev = _context99.next) {\n case 0:\n this.assertAuthConfigured();\n _context99.next = 3;\n return this.auth._initializationPromise;\n\n case 3:\n if (this.auth.currentUser) {\n _context99.next = 5;\n break;\n }\n\n return _context99.abrupt(\"return\", null);\n\n case 5:\n _context99.next = 7;\n return this.auth.currentUser.getIdToken(forceRefresh);\n\n case 7:\n accessToken = _context99.sent;\n return _context99.abrupt(\"return\", {\n accessToken: accessToken\n });\n\n case 9:\n case \"end\":\n return _context99.stop();\n }\n }\n }, _callee99, this);\n }));\n\n function getToken(_x283) {\n return _getToken2.apply(this, arguments);\n }\n\n return getToken;\n }()\n }, {\n key: \"addAuthTokenListener\",\n value: function addAuthTokenListener(listener) {\n this.assertAuthConfigured();\n\n if (this.internalListeners.has(listener)) {\n return;\n }\n\n var unsubscribe = this.auth.onIdTokenChanged(function (user) {\n listener((user === null || user === void 0 ? void 0 : user.stsTokenManager.accessToken) || null);\n });\n this.internalListeners.set(listener, unsubscribe);\n this.updateProactiveRefresh();\n }\n }, {\n key: \"removeAuthTokenListener\",\n value: function removeAuthTokenListener(listener) {\n this.assertAuthConfigured();\n var unsubscribe = this.internalListeners.get(listener);\n\n if (!unsubscribe) {\n return;\n }\n\n this.internalListeners.delete(listener);\n unsubscribe();\n this.updateProactiveRefresh();\n }\n }, {\n key: \"assertAuthConfigured\",\n value: function assertAuthConfigured() {\n _assert(this.auth._initializationPromise, \"dependent-sdk-initialized-before-auth\"\n /* AuthErrorCode.DEPENDENT_SDK_INIT_BEFORE_AUTH */\n );\n }\n }, {\n key: \"updateProactiveRefresh\",\n value: function updateProactiveRefresh() {\n if (this.internalListeners.size > 0) {\n this.auth._startProactiveRefresh();\n } else {\n this.auth._stopProactiveRefresh();\n }\n }\n }]);\n\n return AuthInterop;\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 */\n\n\nfunction getVersionForPlatform(clientPlatform) {\n switch (clientPlatform) {\n case \"Node\"\n /* ClientPlatform.NODE */\n :\n return 'node';\n\n case \"ReactNative\"\n /* ClientPlatform.REACT_NATIVE */\n :\n return 'rn';\n\n case \"Worker\"\n /* ClientPlatform.WORKER */\n :\n return 'webworker';\n\n case \"Cordova\"\n /* ClientPlatform.CORDOVA */\n :\n return 'cordova';\n\n case \"WebExtension\"\n /* ClientPlatform.WEB_EXTENSION */\n :\n return 'web-extension';\n\n default:\n return undefined;\n }\n}\n/** @internal */\n\n\nfunction registerAuth(clientPlatform) {\n _registerComponent(new Component(\"auth\"\n /* _ComponentName.AUTH */\n , function (container, _ref38) {\n var deps = _ref38.options;\n var app = container.getProvider('app').getImmediate();\n var heartbeatServiceProvider = container.getProvider('heartbeat');\n var appCheckServiceProvider = container.getProvider('app-check-internal');\n var _app$options = app.options,\n apiKey = _app$options.apiKey,\n authDomain = _app$options.authDomain;\n\n _assert(apiKey && !apiKey.includes(':'), \"invalid-api-key\"\n /* AuthErrorCode.INVALID_API_KEY */\n , {\n appName: app.name\n });\n\n var config = {\n apiKey: apiKey,\n authDomain: authDomain,\n clientPlatform: clientPlatform,\n apiHost: \"identitytoolkit.googleapis.com\"\n /* DefaultConfig.API_HOST */\n ,\n tokenApiHost: \"securetoken.googleapis.com\"\n /* DefaultConfig.TOKEN_API_HOST */\n ,\n apiScheme: \"https\"\n /* DefaultConfig.API_SCHEME */\n ,\n sdkClientVersion: _getClientVersion(clientPlatform)\n };\n var authInstance = new AuthImpl(app, heartbeatServiceProvider, appCheckServiceProvider, config);\n\n _initializeAuthInstance(authInstance, deps);\n\n return authInstance;\n }, \"PUBLIC\"\n /* ComponentType.PUBLIC */\n )\n /**\r\n * Auth can only be initialized by explicitly calling getAuth() or initializeAuth()\r\n * For why we do this, See go/firebase-next-auth-init\r\n */\n .setInstantiationMode(\"EXPLICIT\"\n /* InstantiationMode.EXPLICIT */\n )\n /**\r\n * Because all firebase products that depend on auth depend on auth-internal directly,\r\n * we need to initialize auth-internal after auth is initialized to make it available to other firebase products.\r\n */\n .setInstanceCreatedCallback(function (container, _instanceIdentifier, _instance) {\n var authInternalProvider = container.getProvider(\"auth-internal\"\n /* _ComponentName.AUTH_INTERNAL */\n );\n authInternalProvider.initialize();\n }));\n\n _registerComponent(new Component(\"auth-internal\"\n /* _ComponentName.AUTH_INTERNAL */\n , function (container) {\n var auth = _castAuth(container.getProvider(\"auth\"\n /* _ComponentName.AUTH */\n ).getImmediate());\n\n return function (auth) {\n return new AuthInterop(auth);\n }(auth);\n }, \"PRIVATE\"\n /* ComponentType.PRIVATE */\n ).setInstantiationMode(\"EXPLICIT\"\n /* InstantiationMode.EXPLICIT */\n ));\n\n registerVersion(name, version, getVersionForPlatform(clientPlatform)); // BUILD_TARGET will be replaced by values like esm5, esm2017, cjs5, etc during the compilation\n\n registerVersion(name, version, 'esm2017');\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 */\n\n\nvar DEFAULT_ID_TOKEN_MAX_AGE = 5 * 60;\nvar authIdTokenMaxAge = getExperimentalSetting('authIdTokenMaxAge') || DEFAULT_ID_TOKEN_MAX_AGE;\nvar lastPostedIdToken = null;\n\nvar mintCookieFactory = function mintCookieFactory(url) {\n return /*#__PURE__*/function () {\n var _ref39 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee100(user) {\n var idTokenResult, idTokenAge, idToken;\n return _regeneratorRuntime.wrap(function _callee100$(_context100) {\n while (1) {\n switch (_context100.prev = _context100.next) {\n case 0:\n _context100.t0 = user;\n\n if (!_context100.t0) {\n _context100.next = 5;\n break;\n }\n\n _context100.next = 4;\n return user.getIdTokenResult();\n\n case 4:\n _context100.t0 = _context100.sent;\n\n case 5:\n idTokenResult = _context100.t0;\n idTokenAge = idTokenResult && (new Date().getTime() - Date.parse(idTokenResult.issuedAtTime)) / 1000;\n\n if (!(idTokenAge && idTokenAge > authIdTokenMaxAge)) {\n _context100.next = 9;\n break;\n }\n\n return _context100.abrupt(\"return\");\n\n case 9:\n // Specifically trip null => undefined when logged out, to delete any existing cookie\n idToken = idTokenResult === null || idTokenResult === void 0 ? void 0 : idTokenResult.token;\n\n if (!(lastPostedIdToken === idToken)) {\n _context100.next = 12;\n break;\n }\n\n return _context100.abrupt(\"return\");\n\n case 12:\n lastPostedIdToken = idToken;\n _context100.next = 15;\n return fetch(url, {\n method: idToken ? 'POST' : 'DELETE',\n headers: idToken ? {\n 'Authorization': \"Bearer \".concat(idToken)\n } : {}\n });\n\n case 15:\n case \"end\":\n return _context100.stop();\n }\n }\n }, _callee100);\n }));\n\n return function (_x284) {\n return _ref39.apply(this, arguments);\n };\n }();\n};\n/**\r\n * Returns the Auth instance associated with the provided {@link @firebase/app#FirebaseApp}.\r\n * If no instance exists, initializes an Auth instance with platform-specific default dependencies.\r\n *\r\n * @param app - The Firebase App.\r\n *\r\n * @public\r\n */\n\n\nfunction getAuth() {\n var app = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getApp();\n\n var provider = _getProvider(app, 'auth');\n\n if (provider.isInitialized()) {\n return provider.getImmediate();\n }\n\n var auth = initializeAuth(app, {\n popupRedirectResolver: browserPopupRedirectResolver,\n persistence: [indexedDBLocalPersistence, browserLocalPersistence, browserSessionPersistence]\n });\n var authTokenSyncUrl = getExperimentalSetting('authTokenSyncURL');\n\n if (authTokenSyncUrl) {\n var mintCookie = mintCookieFactory(authTokenSyncUrl);\n beforeAuthStateChanged(auth, mintCookie, function () {\n return mintCookie(auth.currentUser);\n });\n onIdTokenChanged(auth, function (user) {\n return mintCookie(user);\n });\n }\n\n var authEmulatorHost = getDefaultEmulatorHost('auth');\n\n if (authEmulatorHost) {\n connectAuthEmulator(auth, \"http://\".concat(authEmulatorHost));\n }\n\n return auth;\n}\n\nfunction getScriptParentElement() {\n var _a, _b;\n\n return (_b = (_a = document.getElementsByTagName('head')) === null || _a === void 0 ? void 0 : _a[0]) !== null && _b !== void 0 ? _b : document;\n}\n\n_setExternalJSProvider({\n loadJS: function loadJS(url) {\n // TODO: consider adding timeout support & cancellation\n return new Promise(function (resolve, reject) {\n var el = document.createElement('script');\n el.setAttribute('src', url);\n el.onload = resolve;\n\n el.onerror = function (e) {\n var error = _createError(\"internal-error\"\n /* AuthErrorCode.INTERNAL_ERROR */\n );\n\n error.customData = e;\n reject(error);\n };\n\n el.type = 'text/javascript';\n el.charset = 'UTF-8';\n getScriptParentElement().appendChild(el);\n });\n },\n gapiScript: 'https://apis.google.com/js/api.js',\n recaptchaV2Script: 'https://www.google.com/recaptcha/api.js',\n recaptchaEnterpriseScript: 'https://www.google.com/recaptcha/enterprise.js?render='\n});\n\nregisterAuth(\"Browser\"\n/* ClientPlatform.BROWSER */\n);\nexport { TwitterAuthProvider as $, ActionCodeOperation as A, updateCurrentUser as B, signOut as C, revokeAccessToken as D, deleteUser as E, FactorId as F, debugErrorMap as G, prodErrorMap as H, AUTH_ERROR_CODES_MAP_DO_NOT_USE_INTERNALLY as I, initializeAuth as J, connectAuthEmulator as K, AuthCredential as L, EmailAuthCredential as M, OAuthCredential as N, OperationType as O, PhoneAuthProvider as P, PhoneAuthCredential as Q, RecaptchaVerifier as R, SignInMethod as S, TotpMultiFactorGenerator as T, inMemoryPersistence as U, EmailAuthProvider as V, FacebookAuthProvider as W, GoogleAuthProvider as X, GithubAuthProvider as Y, OAuthProvider as Z, SAMLAuthProvider as _, browserSessionPersistence as a, signInAnonymously as a0, signInWithCredential as a1, linkWithCredential as a2, reauthenticateWithCredential as a3, signInWithCustomToken as a4, sendPasswordResetEmail as a5, confirmPasswordReset as a6, applyActionCode as a7, checkActionCode as a8, verifyPasswordResetCode as a9, _isIOS7Or8 as aA, _createError as aB, _assert as aC, AuthEventManager as aD, _getInstance as aE, _persistenceKeyName as aF, _getRedirectResult as aG, _overrideRedirectResult as aH, _clearRedirectOutcomes as aI, _castAuth as aJ, UserImpl as aK, AuthImpl as aL, _getClientVersion as aM, _generateEventId as aN, AuthPopup as aO, FetchProvider as aP, SAMLAuthCredential as aQ, createUserWithEmailAndPassword as aa, signInWithEmailAndPassword as ab, sendSignInLinkToEmail as ac, isSignInWithEmailLink as ad, signInWithEmailLink as ae, fetchSignInMethodsForEmail as af, sendEmailVerification as ag, verifyBeforeUpdateEmail as ah, ActionCodeURL as ai, parseActionCodeURL as aj, updateProfile as ak, updateEmail as al, updatePassword as am, getIdToken as an, _getIdTokenResult2 as ao, unlink as ap, getAdditionalUserInfo as aq, _reload2 as ar, getMultiFactorResolver as as, multiFactor as at, debugAssert as au, _isIOS as av, _isAndroid as aw, _fail as ax, _getRedirectUrl as ay, _getProjectConfig as az, browserLocalPersistence as b, signInWithPopup as c, linkWithPopup as d, reauthenticateWithPopup as e, signInWithRedirect as f, linkWithRedirect as g, reauthenticateWithRedirect as h, indexedDBLocalPersistence as i, getRedirectResult as j, browserPopupRedirectResolver as k, linkWithPhoneNumber as l, PhoneMultiFactorGenerator as m, TotpSecret as n, getAuth as o, ProviderId as p, setPersistence as q, reauthenticateWithPhoneNumber as r, signInWithPhoneNumber as s, initializeRecaptchaConfig as t, updatePhoneNumber as u, validatePassword as v, onIdTokenChanged as w, beforeAuthStateChanged as x, onAuthStateChanged as y, useDeviceLanguage as z };"],"names":["_SERVER_ERROR_MAP","_createSuper","Derived","hasNativeReflectConstruct","Reflect","construct","sham","Proxy","Boolean","prototype","valueOf","call","e","_isNativeReflectConstruct","result","Super","NewTarget","this","constructor","arguments","apply","_createForOfIteratorHelper","o","allowArrayLike","it","Symbol","iterator","Array","isArray","minLen","_arrayLikeToArray","n","Object","toString","slice","name","from","test","_unsupportedIterableToArray","length","i","F","s","done","value","_e2","f","TypeError","err","normalCompletion","didErr","step","next","_e3","return","arr","len","arr2","_prodErrorMap","prodErrorMap","_DEFAULT_AUTH_ERROR_FACTORY","logClient","_logWarn","msg","logLevel","_len","args","_key2","warn","concat","_logError","_len2","_key3","error","_fail","authOrCode","_len3","rest","_key4","createErrorInternal","_createError","_len4","_key5","_errorWithCustomMessage","auth","code","message","errorMap","assign","create","appName","_len5","_key6","_authOrCode$_errorFac","fullParams","_errorFactory","_assert","assertion","_len6","_key7","debugFail","failure","Error","debugAssert","_isHttpOrHttps","_getCurrentScheme","_a","self","location","protocol","Delay","shortDelay","longDelay","isMobile","key","navigator","onLine","Math","min","_emulatorUrl","config","path","emulator","url","startsWith","FetchProvider","fetchImpl","headersImpl","responseImpl","_fetch","fetch","globalThis","Headers","Response","SERVER_ERROR_MAP","DEFAULT_API_TIMEOUT_MS","_addTidIfNecessary","request","tenantId","_performApiRequest","_x","_x2","_x3","_x4","_performApiRequest2","_callee102","method","customErrorMap","_args102","_context102","prev","undefined","abrupt","_performFetchWithErrorHandling","_callee101","body","params","query","headers","_context101","JSON","stringify","apiKey","_getAdditionalHeaders","sent","languageCode","_getFinalTarget","apiHost","referrerPolicy","stop","_x5","_x6","_x7","_performFetchWithErrorHandling2","_callee103","fetchFn","networkTimeout","response","json","errorMessage","_errorMessage$split","_errorMessage$split2","serverErrorCode","serverErrorMessage","authError","_context103","_canInitEmulator","NetworkTimeout","Promise","race","promise","clearNetworkTimeout","_makeTaggedError","ok","split","toLowerCase","replace","t0","String","_performSignInRequest","_x8","_x9","_x10","_x11","_performSignInRequest2","_callee104","serverResponse","_args104","_context104","_serverResponse","host","base","apiScheme","_parseEnforcementState","enforcementStateStr","_this","timer","_","reject","setTimeout","get","clearTimeout","errorParams","email","phoneNumber","customData","_tokenResponse","isEnterprise","grecaptcha","enterprise","RecaptchaConfig","siteKey","recaptchaEnforcementState","recaptchaKey","providerStr","_step","_iterator","provider","enforcementState","getProviderEnforcementState","getRecaptchaConfig","_x13","_x14","_getRecaptchaConfig","_callee106","_context106","deleteAccount","_x15","_x16","_deleteAccount","_callee107","_context107","getAccountInfo","_x19","_x20","_getAccountInfo","_callee109","_context109","utcTimestampToDateString","utcTimestamp","date","Date","Number","isNaN","getTime","toUTCString","_getIdTokenResult","_callee110","user","forceRefresh","userInternal","token","claims","firebase","signInProvider","_args110","_context110","getIdToken","_parseToken","exp","auth_time","iat","authTime","secondsStringToMilliseconds","issuedAtTime","expirationTime","signInSecondFactor","seconds","_token$split","_token$split2","algorithm","payload","signature","decoded","parse","_logoutIfInvalidated","_x22","_x23","_logoutIfInvalidated2","_callee111","_args111","_context111","isUserInvalidated","currentUser","signOut","_ref3","ProactiveRefresh","isRunning","timerId","errorBackoff","_iteration","schedule","wasError","interval","_interval","stsTokenManager","now","max","_this2","getInterval","_callee","_context","iteration","_callee2","_context2","UserMetadata","createdAt","lastLoginAt","_initializeTime","lastSignInTime","creationTime","metadata","_reloadWithoutSaving","_x24","_reloadWithoutSaving2","_callee112","idToken","coreAccount","newProviderData","providerData","oldIsAnonymous","newIsAnonymous","isAnonymous","updates","_context112","users","_notifyReloadListener","providerUserInfo","extractProviderData","mergeProviderData","passwordHash","uid","localId","displayName","photoURL","photoUrl","emailVerified","_reload","_callee113","_context113","_persistUserIfCurrent","_notifyListenersIfCurrent","original","newData","deduped","filter","some","providerId","providers","map","rawId","requestStsToken","_x26","_x27","_requestStsToken","_callee115","refreshToken","_context115","_callee114","_auth$config","tokenApiHost","_context114","accessToken","access_token","expiresIn","expires_in","refresh_token","revokeToken","_x28","_x29","_revokeToken","_callee116","_context116","StsTokenManager","_refresh","_getToken","parsedToken","updateTokensAndExpiration","_callee3","_args3","_context3","isExpired","refresh","_x30","_callee4","oldToken","_yield$requestStsToke","_context4","_x31","_x32","expiresInSec","toJSON","object","manager","assertStringOrUndefined","UserImpl","opt","proactiveRefresh","reloadUserInfo","reloadListener","_fromIdTokenResponse2","_delete2","_updateTokensIfNecessary2","_getIdToken","_callee5","_context5","getToken","_x33","_x21","_getIdTokenResult2","_x25","_reload2","userInfo","_copy","_assign","newUser","_clone","callback","_start","_stop","_callee6","reload","tokensRefreshed","_args6","_context6","updateFromServerResponse","_x34","_callee7","_context7","clearRefreshToken","_redirectEventId","_b","_c","_d","_e","_f","_g","_h","plainObjectTokenManager","fromJSON","_callee8","idTokenResponse","_args8","_context8","_x35","_x36","instanceCache","Map","_getInstance","cls","Function","instance","set","InMemoryPersistence","type","storage","_remove2","_get2","_set2","_isAvailable2","_callee9","_context9","_callee10","_context10","_x37","_x38","_callee11","_context11","_x39","_callee12","_context12","_x40","_key","_listener","inMemoryPersistence","_persistenceKeyName","PersistenceUserManager","persistence","userKey","_this$auth","fullUserKey","fullPersistenceKey","boundEventHandler","_onStorageEvent","bind","_addListener","_create","_setPersistence","_getCurrentUser","_set","_callee13","blob","_context13","_get","_fromJSON","_remove","_callee14","newPersistence","_context14","getCurrentUser","removeCurrentUser","setCurrentUser","_x41","_removeListener","_callee17","persistenceHierarchy","availablePersistences","selectedPersistence","userToMigrate","_iterator2","_step2","migrationHierarchy","_args17","_context17","all","_ref5","_callee15","_context15","_isAvailable","_x44","t1","finish","p","_shouldAllowMigration","_ref6","_callee16","_context16","_x45","_x42","_x43","_getBrowserName","userAgent","ua","includes","_isIEMobile","_isFirefox","_isBlackBerry","_isWebOS","_isSafari","_isChromeIOS","_isAndroid","matches","match","_isIOS","_isIE10","document","documentMode","_isMobileBrowser","_getClientVersion","clientPlatform","reportedPlatform","frameworks","reportedFrameworks","join","AuthMiddlewareQueue","queue","_runMiddleware","onAbort","_this3","wrappedCallback","resolve","push","index","_callee18","nextUser","onAbortStack","_iterator3","_step3","beforeStateCallback","_iterator4","_step4","_context18","reverse","originalMessage","_x46","_getPasswordPolicy","_x47","_getPasswordPolicy2","_callee117","_args117","_context117","PasswordPolicyImpl","responseOptions","customStrengthOptions","minPasswordLength","maxPasswordLength","containsLowercaseCharacter","containsLowercaseLetter","containsUppercaseCharacter","containsUppercaseLetter","containsNumericCharacter","containsNonAlphanumericCharacter","allowedNonAlphanumericCharacters","forceUpgradeOnSignin","schemaVersion","password","status","isValid","passwordPolicy","validatePasswordLengthOptions","validatePasswordCharacterOptions","meetsMinPasswordLength","meetsMaxPasswordLength","passwordChar","updatePasswordCharacterOptionsStatuses","charAt","AuthImpl","app","heartbeatServiceProvider","appCheckServiceProvider","emulatorConfig","operations","authStateSubscription","Subscription","idTokenSubscription","beforeStateQueue","redirectUser","isProactiveRefreshEnabled","EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION","_isInitialized","_deleted","_initializationPromise","_popupRedirectResolver","_agentRecaptchaConfig","_tenantRecaptchaConfigs","_projectPasswordPolicy","_tenantPasswordPolicies","lastNotifiedUid","settings","appVerificationDisabledForTesting","clientVersion","sdkClientVersion","_getAppCheckToken2","_getAdditionalHeaders2","_directlySetCurrentUser","_persistUserIfCurrent2","_redirectUserForId2","_getOrInitRedirectPersistenceManager","_setRedirectUser2","_revokeAccessToken","_updatePasswordPolicy2","_validatePassword","_signOut","_updateCurrentUser3","_updateCurrentUser2","_delete3","_reloadAndSetCurrentUserOrClear","_tryRedirectSignIn","_initializeCurrentUser","_onStorageEvent2","popupRedirectResolver","_this4","_callee19","_context19","persistenceManager","_shouldInitProactively","_initialize","initializeCurrentUser","_callee20","_context20","assertedPersistence","_currentUser","_updateCurrentUser","_callee21","previouslyStoredUser","futureCurrentUser","needsTocheckMiddleware","redirectUserEventId","storedUserEventId","_context21","authDomain","getOrInitRedirectPersistenceManager","tryRedirectSignIn","directlySetCurrentUser","runMiddleware","_overrideRedirectResult","reloadAndSetCurrentUserOrClear","_x48","_callee22","redirectResolver","_context22","_completeRedirectFn","_setRedirectUser","_x49","_callee23","_context23","_x50","navigatorLanguage","languages","language","_getUserLanguage","_callee24","_context24","_callee25","userExtern","_context25","_x51","_callee27","skipBeforeStateCallbacks","_this5","_args27","_context27","_callee26","_context26","notifyAuthListeners","_x52","_callee28","_context28","redirectPersistenceManager","_this6","_callee29","_context29","setPersistence","_callee30","_context30","_getPasswordPolicyInternal","_updatePasswordPolicy","validatePassword","_x53","_callee31","_context31","nextOrObserver","completed","registerStateListener","pushCallback","_this7","unsubscribe","onAuthStateChanged","_callee32","_context32","tokenType","_x54","_callee33","redirectManager","_context33","_x55","_x56","_callee34","resolver","_context34","_redirectPersistence","_x57","_callee36","id","_context36","_callee35","_context35","_x58","_callee38","_this8","_context38","_callee37","_context37","_x59","_startProactiveRefresh","_stopProactiveRefresh","currentUid","subscription","_this9","cb","isUnsubscribed","then","addObserver","_unsubscribe","_callee39","_context39","_x60","action","framework","sort","_getFrameworks","_callee40","heartbeatsHeader","appCheckToken","_context40","options","appId","getImmediate","optional","getHeartbeatsHeader","_getAppCheckToken","_callee41","appCheckTokenResult","_context41","_castAuth","_this10","observer","externalJSProvider","loadJS","_callee42","_context42","recaptchaV2Script","recaptchaEnterpriseScript","gapiScript","_loadJS","_recaptchaEnterpriseScriptUrl","_generateCallbackName","prefix","floor","random","FAKE_TOKEN","RecaptchaEnterpriseVerifier","authExtern","_verify","_callee45","retrieveSiteKey","_retrieveSiteKey","retrieveRecaptchaToken","_this11","_args45","_context45","window","ready","execute","catch","_callee44","_context44","_ref12","_callee43","_context43","clientType","version","_x62","_x63","_x61","injectRecaptchaFields","_x64","_x65","_x66","_injectRecaptchaFields","_callee118","captchaResp","verifier","captchaResponse","newRequest","_args118","_context118","verify","handleRecaptchaFlow","_x67","_x68","_x69","_x70","_handleRecaptchaFlow","_callee120","authInstance","actionName","actionMethod","requestWithRecaptcha","_context120","isProviderEnabled","_ref42","_callee119","_requestWithRecaptcha","_context119","console","log","_x285","AuthCredential","signInMethod","_auth","_idToken","linkEmailPassword","_x76","_x77","_linkEmailPassword","_callee124","_context124","signInWithPassword","_x80","_x81","_signInWithPassword","_callee126","_context126","signInWithEmailLink$1","_x92","_x93","_signInWithEmailLink$","_callee132","_context132","signInWithEmailLinkForLinking","_x94","_x95","_signInWithEmailLinkForLinking","_callee133","_context133","EmailAuthCredential","_AuthCredential","_linkToIdToken2","_getIdTokenResponse2","_super","_email","_password","_this12","_tenantId","_callee46","_context46","returnSecureToken","oobCode","_x96","_callee47","_context47","_x97","_x98","_getIdTokenResponse","obj","_fromEmailAndPassword","_fromEmailAndCode","signInWithIdp","_x99","_x100","_signInWithIdp","_callee134","_context134","OAuthCredential","_AuthCredential2","_super2","_this13","pendingToken","secret","nonce","buildRequest","autoCreate","requestUri","postBody","cred","oauthToken","oauthTokenSecret","sendPhoneVerificationCode","_x101","_x102","_sendPhoneVerificationCode","_callee135","_context135","_signInWithPhoneNumber$","_callee136","_context136","_linkWithPhoneNumber$","_callee137","_context137","temporaryProof","VERIFY_PHONE_NUMBER_FOR_EXISTING_ERROR_MAP_","_verifyPhoneNumberForExisting","_callee138","apiRequest","_context138","operation","PhoneAuthCredential","_AuthCredential3","_super3","_this14","_x103","_x104","signInWithPhoneNumber$1","_makeVerificationRequest","_x105","_x106","linkWithPhoneNumber$1","_x107","_x108","verifyPhoneNumberForExisting","_this$params","verificationId","verificationCode","sessionInfo","_json","ActionCodeURL","actionLink","searchParams","mode","parseMode","continueUrl","link","doubleDeepLink","iOSDeepLink","parseDeepLink","EmailAuthProvider","PROVIDER_ID","emailLink","actionCodeUrl","parseLink","EMAIL_PASSWORD_SIGN_IN_METHOD","EMAIL_LINK_SIGN_IN_METHOD","FederatedAuthProvider","defaultLanguageCode","customParameters","customOAuthParameters","BaseOAuthProvider","_FederatedAuthProvide","_super4","_this15","scopes","scope","FacebookAuthProvider","_BaseOAuthProvider2","_super6","_fromParams","FACEBOOK_SIGN_IN_METHOD","userCredential","credentialFromTaggedObject","_ref14","tokenResponse","oauthAccessToken","credential","GoogleAuthProvider","_BaseOAuthProvider3","_super7","_this16","addScope","GOOGLE_SIGN_IN_METHOD","_ref15","oauthIdToken","GithubAuthProvider","_BaseOAuthProvider4","_super8","GITHUB_SIGN_IN_METHOD","_ref16","TwitterAuthProvider","_BaseOAuthProvider5","_super11","TWITTER_SIGN_IN_METHOD","_ref18","UserCredentialImpl","operationType","_forOperation2","_fromIdTokenResponse3","_callee48","userCred","_args48","_context48","_fromIdTokenResponse","providerIdForResponse","_x111","_x112","_x113","_callee49","_context49","_updateTokensIfNecessary","_x114","_x115","_x116","MultiFactorError","_FirebaseError","_super12","_this18","setPrototypeOf","_processCredentialSavingMfaContextIfNecessary","_getReauthenticationResolver","_fromErrorAndOperation","_link$1","_x120","_x121","_link$","_callee142","bypassAuthState","_args142","_context142","t2","t3","t4","t5","_linkToIdToken","t6","_forOperation","_reauthenticate","_x125","_x126","_reauthenticate2","_callee144","parsed","_args144","_context144","sub","_signInWithCredential","_x127","_x128","_signInWithCredential2","_callee145","_args145","_context145","startEnrollPhoneMfa","finalizeEnrollTotpMfa","WeakMap","STORAGE_AVAILABLE_KEY","BrowserPersistenceClass","storageRetriever","setItem","removeItem","getItem","BrowserLocalPersistence","_BrowserPersistenceCl","_remove3","_get4","_set3","_super20","_this22","localStorage","event","poll","onStorageEvent","listeners","localCache","pollTimer","safariLocalStorageNotSynced","top","_isIframe","fallbackToPolling","_i","_Object$keys","keys","newValue","oldValue","_this23","detachListener","stopPolling","_storedValue","triggerListeners","storedValue","notifyListeners","forAllChangedKeys","_oldValue","_i2","_Array$from","listener","_this24","setInterval","StorageEvent","clearInterval","addEventListener","removeEventListener","startPolling","attachListener","Set","add","delete","size","_callee56","_context56","_x186","_x187","_callee57","_context57","_x188","_callee58","_context58","_x189","BrowserSessionPersistence","_BrowserPersistenceCl2","_super21","sessionStorage","_allSettled","promises","_ref24","_callee59","_context59","fulfilled","reason","_x190","Receiver","eventTarget","handlersMap","handleEvent","_handleEvent","_callee61","messageEvent","_messageEvent$data","eventId","eventType","data","handlers","_context61","ports","postMessage","_ref25","_callee60","handler","_context60","origin","_x192","_x191","eventHandler","existingInstance","receivers","find","receiver","isListeningto","newInstance","_generateEventId","digits","Sender","target","_send2","messageChannel","port1","onMessage","close","_callee62","timeout","completionTimer","_this25","_args62","_context62","MessageChannel","start","ackTimer","port2","finally","removeMessageHandler","_x193","_x194","_window","_isWorker","_getActiveServiceWorker","_getActiveServiceWorker2","_callee170","registration","_context170","serviceWorker","active","DB_NAME","DB_OBJECTSTORE_NAME","DB_DATA_KEYPATH","DBPromise","_this26","getObjectStore","db","isReadWrite","transaction","objectStore","_deleteDatabase","indexedDB","deleteDatabase","toPromise","_openDatabase","open","createObjectStore","keyPath","_callee63","_context63","objectStoreNames","contains","_putObject","_x195","_x196","_x197","_putObject2","_callee171","_getObjectStore$put","_context171","put","getObject","_x198","_x199","_getObject","_callee172","_context172","_deleteObject","IndexedDBLocalPersistence","pendingWrites","sender","serviceWorkerReceiverAvailable","activeServiceWorker","_workerInitializationPromise","initializeServiceWorkerMessaging","_poll2","_remove4","_get5","_set4","_withPendingWrite2","_isAvailable3","_notifyServiceWorker","_initializeSender","_initializeReceiver","_initializeServiceWorkerMessaging","_withRetries2","_openDb2","_callee64","_context64","_callee65","op","numAttempts","_context65","_openDb","_x200","_callee66","_context66","initializeReceiver","initializeSender","_callee69","_this27","_context69","_subscribe","_ref27","_callee67","_origin","_context67","_poll","keyProcessed","_x201","_x202","_ref28","_callee68","_data","_context68","_x203","_x204","_callee70","results","_context70","_send","_callee71","_context71","controller","_x205","_callee72","_context72","_callee73","write","_context73","_x206","_callee75","_this28","_context75","_withPendingWrite","_callee74","_context74","_withRetries","notifyServiceWorker","_x207","_x208","_callee76","_context76","_x209","_callee78","_this29","_context78","_callee77","_context77","_x210","_callee79","keysInResult","_iterator5","_step5","_step5$value","_i3","_Object$keys2","localKey","_context79","getAllRequest","getAll","fbase_key","has","_i4","_Array$from2","_this30","_callee80","_context80","startSignInPhoneMfa","finalizeSignInTotpMfa","RECAPTCHA_VERIFIER_TYPE","_verifyPhoneNumber","_x222","_x223","_x224","_verifyPhoneNumber2","_callee176","recaptchaToken","phoneInfoOptions","session","mfaEnrollmentId","_response","_yield$sendPhoneVerif","_context176","phoneEnrollmentInfo","phoneSessionInfo","multiFactorHint","multiFactorUid","mfaPendingCredential","phoneSignInInfo","phoneResponseInfo","_reset","PhoneAuthProvider","phoneOptions","applicationVerifier","_fromVerification","_ref32","_fromTokenResponse","PHONE_SIGN_IN_METHOD","IdpCredential","_AuthCredential5","_super22","_this38","_buildIdpRequest","sessionId","returnIdpCredential","_signIn","_reauth","_link","_x227","_link2","_callee178","_context178","AbstractPopupRedirectOperation","pendingPromise","eventManager","_onAuthEvent","_this39","_ref33","_callee86","_context86","onExecution","registerConsumer","_x228","_x229","_callee87","urlResponse","_context87","getIdpTask","_x230","unregisterAndCleanUp","unregisterConsumer","cleanUp","_POLL_WINDOW_CLOSE_TIMEOUT","PopupOperation","_AbstractPopupRedirec","_onExecution","_executeNotNull","_super23","_this40","authWindow","pollId","currentPopupAction","cancel","_callee88","_context88","_callee89","_this41","_context89","_openPopup","associatedEvent","_originValidation","_isIframeWebStorageSupported","isSupported","pollUserCancellation","_this42","closed","encodeURIComponent","MultiFactorAssertionImpl","factorId","_finalizeEnroll","_finalizeSignIn","PhoneMultiFactorAssertionImpl","_MultiFactorAssertion","_super25","_this46","finalizeEnrollPhoneMfa","phoneVerificationInfo","finalizeSignInPhoneMfa","PhoneMultiFactorGenerator","_fromCredential","FACTOR_ID","TotpMultiFactorGenerator","_generateSecret","oneTimePassword","TotpMultiFactorAssertionImpl","_fromSecret","enrollmentId","_fromEnrollmentId","_callee96","mfaSession","_context96","totpEnrollmentInfo","TotpSecret","_fromStartTotpMfaEnrollmentResponse","_x277","_MultiFactorAssertion2","_finalizeSignIn2","_finalizeEnroll2","_super26","otp","_this47","_callee97","_context97","totpVerificationInfo","_makeTotpVerificationInfo","_x278","_x279","_x280","_callee98","_context98","_x281","_x282","secretKey","hashingAlgorithm","codeLength","codeIntervalSeconds","enrollmentCompletionDeadline","accountName","issuer","useDefaults","_isEmptyString","totpSessionInfo","sharedSecretKey","verificationCodeLength","periodSec","finalizeEnrollmentTime","input","AuthInterop","internalListeners","_getToken2","assertAuthConfigured","_callee99","_context99","_x283","onIdTokenChanged","updateProactiveRefresh","el","createElement","setAttribute","onload","onerror","charset","getElementsByTagName","appendChild","container","_ref38","deps","getProvider","_app$options","hierarchy","_updateErrorMap","_initializeWithPersistence","_initializeAuthInstance","setInstantiationMode","setInstanceCreatedCallback","_instanceIdentifier","_instance","initialize","getVersionForPlatform"],"sourceRoot":""}