openrod 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -2
- package/THIRD_PARTY_NOTICES.md +84 -1
- package/dist/assets/index-DBqg9X9x.js +553 -0
- package/dist/assets/index-HZ0q_FBv.css +1 -0
- package/dist/assets/index.esm-BqjC2fhp.js +376 -0
- package/dist/assets/index.esm-Cj6nXjOx.js +16 -0
- package/dist/assets/index.esm-Z1y-oluO.js +1666 -0
- package/dist/assets/terminal-view-D-SQcdM5.js +40 -0
- package/dist/index.html +3 -3
- package/package.json +8 -1
- package/server/announcements.js +22 -0
- package/server/api.js +54 -11
- package/server/capabilities.js +13 -0
- package/server/cli.js +18 -2
- package/server/cloud-deployment.js +29 -0
- package/server/cloud-proxy.js +19 -9
- package/server/cloud-runtime.js +72 -0
- package/server/cloud-ssh-proxy.cjs +22 -4
- package/server/cloud-transfer.js +1 -1
- package/server/compute.js +18 -7
- package/server/image-templates.js +17 -0
- package/server/ingress.js +3 -0
- package/server/local-cloud-native.js +7 -1
- package/server/local-cloud.js +3 -3
- package/server/machines.js +33 -18
- package/server/policy-template-store.js +1 -0
- package/server/remote-gateway.js +26 -6
- package/server/remote-http.js +1 -1
- package/server/resource-import-portable.js +155 -0
- package/server/resource-imports.js +412 -0
- package/server/sandbox-identity.js +1 -1
- package/server/security.js +30 -14
- package/server/setup-discovery.js +2 -1
- package/server/setup-packages.js +138 -59
- package/server/setup-preparation.js +4 -3
- package/server/start.js +29 -7
- package/server/worker-auth.js +2 -2
- package/shared/agent-access.js +26 -4
- package/shared/analytics-release.json +5 -0
- package/src/lib/activity-inventory.js +1 -1
- package/src/lib/analytics.js +334 -0
- package/src/lib/api.js +28 -11
- package/src/lib/cloud-sign-in-error.js +13 -0
- package/src/lib/cloud-transfer.js +1 -1
- package/src/lib/combined-activity.js +95 -0
- package/src/lib/connection-host.js +6 -0
- package/src/lib/egress-inventory.js +63 -0
- package/src/lib/local-cloud.js +16 -3
- package/src/lib/location-choice.js +7 -0
- package/src/lib/location-data-reader.js +25 -0
- package/src/lib/locations.js +18 -8
- package/src/lib/placement.js +1 -1
- package/src/lib/resource-imports.js +63 -0
- package/src/lib/resource-sources.js +105 -0
- package/src/lib/sandbox-creations.js +14 -9
- package/src/lib/sandboxes.js +5 -1
- package/src/lib/working-location.js +10 -0
- package/dist/assets/index-89TNohi_.css +0 -1
- package/dist/assets/index-DoKK2G9s.js +0 -545
- package/dist/assets/terminal-view-DzqQnmh2.js +0 -40
|
@@ -0,0 +1,1666 @@
|
|
|
1
|
+
import{t as ne,u as ie,v as X,w as h,x as Je,y as Ze,z as zn,g as I,e as jt,A as Bt,B as Kn,m as $n,C as v,E as jn,G as Bn,S as fe,H as Yn,L as Jn,I as Yt,F as et,J as tt,K as Xn,M as Qn,N as Zn,O as ei,P as ti,i as wt,Q as yt,r as vt,R as ni}from"./index.esm-BqjC2fhp.js";/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2021 Google LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/const Js={PHONE:"phone",TOTP:"totp"},Xs={FACEBOOK:"facebook.com",GITHUB:"github.com",GOOGLE:"google.com",PASSWORD:"password",PHONE:"phone",TWITTER:"twitter.com"},Qs={EMAIL_LINK:"emailLink",EMAIL_PASSWORD:"password",FACEBOOK:"facebook.com",GITHUB:"github.com",GOOGLE:"google.com",PHONE:"phone",TWITTER:"twitter.com"},Zs={LINK:"link",REAUTHENTICATE:"reauthenticate",SIGN_IN:"signIn"},eo={EMAIL_SIGNIN:"EMAIL_SIGNIN",PASSWORD_RESET:"PASSWORD_RESET",RECOVER_EMAIL:"RECOVER_EMAIL",REVERT_SECOND_FACTOR_ADDITION:"REVERT_SECOND_FACTOR_ADDITION",VERIFY_AND_CHANGE_EMAIL:"VERIFY_AND_CHANGE_EMAIL",VERIFY_EMAIL:"VERIFY_EMAIL"};/**
|
|
17
|
+
* @license
|
|
18
|
+
* Copyright 2020 Google LLC
|
|
19
|
+
*
|
|
20
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
21
|
+
* you may not use this file except in compliance with the License.
|
|
22
|
+
* You may obtain a copy of the License at
|
|
23
|
+
*
|
|
24
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
25
|
+
*
|
|
26
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
27
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
28
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
29
|
+
* See the License for the specific language governing permissions and
|
|
30
|
+
* limitations under the License.
|
|
31
|
+
*/function ii(){return{"admin-restricted-operation":"This operation is restricted to administrators only.","argument-error":"","app-not-authorized":"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.","app-not-installed":"The requested mobile application corresponding to the identifier (Android package name or iOS bundle ID) provided is not installed on this device.","captcha-check-failed":"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.","code-expired":"The SMS code has expired. Please re-send the verification code to try again.","cordova-not-ready":"Cordova framework is not ready.","cors-unsupported":"This browser is not supported.","credential-already-in-use":"This credential is already associated with a different user account.","custom-token-mismatch":"The custom token corresponds to a different audience.","requires-recent-login":"This operation is sensitive and requires recent authentication. Log in again before retrying this request.","dependent-sdk-initialized-before-auth":"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.","dynamic-link-not-activated":"Please activate Dynamic Links in the Firebase Console and agree to the terms and conditions.","email-change-needs-verification":"Multi-factor users must always have a verified email.","email-already-in-use":"The email address is already in use by another account.","emulator-config-failed":'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.',"expired-action-code":"The action code has expired.","cancelled-popup-request":"This operation has been cancelled due to another conflicting popup being opened.","internal-error":"An internal AuthError has occurred.","invalid-app-credential":"The phone verification request contains an invalid application verifier. The reCAPTCHA token response is either invalid or expired.","invalid-app-id":"The mobile app identifier is not registered for the current project.","invalid-user-token":"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.","invalid-auth-event":"An internal AuthError has occurred.","invalid-verification-code":"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.","invalid-continue-uri":"The continue URL provided in the request is invalid.","invalid-cordova-configuration":"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.","invalid-custom-token":"The custom token format is incorrect. Please check the documentation.","invalid-dynamic-link-domain":"The provided dynamic link domain is not configured or authorized for the current project.","invalid-email":"The email address is badly formatted.","invalid-emulator-scheme":"Emulator URL must start with a valid scheme (http:// or https://).","invalid-api-key":"Your API key is invalid, please check you have copied it correctly.","invalid-cert-hash":"The SHA-1 certificate hash provided is invalid.","invalid-credential":"The supplied auth credential is incorrect, malformed or has expired.","invalid-message-payload":"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.","invalid-multi-factor-session":"The request does not contain a valid proof of first factor successful sign-in.","invalid-oauth-provider":"EmailAuthProvider is not supported for this operation. This operation only supports OAuth providers.","invalid-oauth-client-id":"The OAuth client ID provided is either invalid or does not match the specified API key.","unauthorized-domain":"This domain is not authorized for OAuth operations for your Firebase project. Edit the list of authorized domains from the Firebase console.","invalid-action-code":"The action code is invalid. This can happen if the code is malformed, expired, or has already been used.","wrong-password":"The password is invalid or the user does not have a password.","invalid-persistence-type":"The specified persistence type is invalid. It can only be local, session or none.","invalid-phone-number":"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].","invalid-provider-id":"The specified provider ID is invalid.","invalid-recipient-email":"The email corresponding to this action failed to send as the provided recipient email address is invalid.","invalid-sender":"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.","invalid-verification-id":"The verification ID used to create the phone auth credential is invalid.","invalid-tenant-id":"The Auth instance's tenant ID is invalid.","login-blocked":"Login blocked by user-provided method: {$originalMessage}","missing-android-pkg-name":"An Android Package Name must be provided if the Android App is required to be installed.","auth-domain-config-required":"Be sure to include authDomain when calling firebase.initializeApp(), by following the instructions in the Firebase console.","missing-app-credential":"The phone verification request is missing an application verifier assertion. A reCAPTCHA response token needs to be provided.","missing-verification-code":"The phone auth credential was created with an empty SMS verification code.","missing-continue-uri":"A continue URL must be provided in the request.","missing-iframe-start":"An internal AuthError has occurred.","missing-ios-bundle-id":"An iOS Bundle ID must be provided if an App Store ID is provided.","missing-or-invalid-nonce":"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.","missing-password":"A non-empty password must be provided","missing-multi-factor-info":"No second factor identifier is provided.","missing-multi-factor-session":"The request is missing proof of first factor successful sign-in.","missing-phone-number":"To send verification codes, provide a phone number for the recipient.","missing-verification-id":"The phone auth credential was created with an empty verification ID.","app-deleted":"This instance of FirebaseApp has been deleted.","multi-factor-info-not-found":"The user does not have a second factor matching the identifier provided.","multi-factor-auth-required":"Proof of ownership of a second factor is required to complete sign-in.","account-exists-with-different-credential":"An account already exists with the same email address but different sign-in credentials. Sign in using a provider associated with this email address.","network-request-failed":"A network AuthError (such as timeout, interrupted connection or unreachable host) has occurred.","no-auth-event":"An internal AuthError has occurred.","no-such-provider":"User was not linked to an account with the given provider.","null-user":"A null user object was provided as the argument for an operation which requires a non-null user object.","operation-not-allowed":"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.","operation-not-supported-in-this-environment":'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.',"popup-blocked":"Unable to establish a connection with the popup. It may have been blocked by the browser.","popup-closed-by-user":"The popup has been closed by the user before finalizing the operation.","provider-already-linked":"User can only be linked to one identity for the given provider.","quota-exceeded":"The project's quota for this operation has been exceeded.","redirect-cancelled-by-user":"The redirect operation has been cancelled by the user before finalizing.","redirect-operation-pending":"A redirect sign-in operation is already pending.","rejected-credential":"The request contains malformed or mismatching credentials.","second-factor-already-in-use":"The second factor is already enrolled on this account.","maximum-second-factor-count-exceeded":"The maximum allowed number of second factors on a user has been exceeded.","tenant-id-mismatch":"The provided tenant ID does not match the Auth instance's tenant ID",timeout:"The operation has timed out.","user-token-expired":"The user's credential is no longer valid. The user must sign in again.","too-many-requests":"We have blocked all requests from this device due to unusual activity. Try again later.","unauthorized-continue-uri":"The domain of the continue URL is not whitelisted. Please whitelist the domain in the Firebase console.","unsupported-first-factor":"Enrolling a second factor or signing in with a multi-factor account requires sign-in with a supported first factor.","unsupported-persistence-type":"The current environment does not support the specified persistence type.","unsupported-tenant-operation":"This operation is not supported in a multi-tenant context.","unverified-email":"The operation requires a verified email.","user-cancelled":"The user did not grant your application the permissions it requested.","user-not-found":"There is no user record corresponding to this identifier. The user may have been deleted.","user-disabled":"The user account has been disabled by an administrator.","user-mismatch":"The supplied credentials do not correspond to the previously signed in user.","user-signed-out":"","weak-password":"The password must be 6 characters long or more.","web-storage-unsupported":"This browser is not supported or 3rd party cookies and data may be disabled.","already-initialized":"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.","missing-recaptcha-token":"The reCAPTCHA token is missing when sending request to the backend.","invalid-recaptcha-token":"The reCAPTCHA token is invalid when sending request to the backend.","invalid-recaptcha-action":"The reCAPTCHA action is invalid when sending request to the backend.","recaptcha-not-enabled":"reCAPTCHA Enterprise integration is not enabled for this project.","missing-client-type":"The reCAPTCHA client type is missing when sending request to the backend.","missing-recaptcha-version":"The reCAPTCHA version is missing when sending request to the backend.","invalid-req-type":"Invalid request parameters.","invalid-recaptcha-version":"The reCAPTCHA version is invalid when sending request to the backend.","unsupported-password-policy-schema-version":"The password policy received from the backend uses a schema version that is not supported by this version of the Firebase SDK.","password-does-not-meet-requirements":"The password does not meet the requirements.","invalid-hosting-link-domain":"The provided Hosting link domain is not configured in Firebase Hosting or is not owned by the current project. This cannot be a default Hosting domain (`web.app` or `firebaseapp.com`)."}}function Jt(){return{"dependent-sdk-initialized-before-auth":"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."}}const to=ii,ri=Jt,Xt=new tt("auth","Firebase",Jt()),no={ADMIN_ONLY_OPERATION:"auth/admin-restricted-operation",ARGUMENT_ERROR:"auth/argument-error",APP_NOT_AUTHORIZED:"auth/app-not-authorized",APP_NOT_INSTALLED:"auth/app-not-installed",CAPTCHA_CHECK_FAILED:"auth/captcha-check-failed",CODE_EXPIRED:"auth/code-expired",CORDOVA_NOT_READY:"auth/cordova-not-ready",CORS_UNSUPPORTED:"auth/cors-unsupported",CREDENTIAL_ALREADY_IN_USE:"auth/credential-already-in-use",CREDENTIAL_MISMATCH:"auth/custom-token-mismatch",CREDENTIAL_TOO_OLD_LOGIN_AGAIN:"auth/requires-recent-login",DEPENDENT_SDK_INIT_BEFORE_AUTH:"auth/dependent-sdk-initialized-before-auth",DYNAMIC_LINK_NOT_ACTIVATED:"auth/dynamic-link-not-activated",EMAIL_CHANGE_NEEDS_VERIFICATION:"auth/email-change-needs-verification",EMAIL_EXISTS:"auth/email-already-in-use",EMULATOR_CONFIG_FAILED:"auth/emulator-config-failed",EXPIRED_OOB_CODE:"auth/expired-action-code",EXPIRED_POPUP_REQUEST:"auth/cancelled-popup-request",INTERNAL_ERROR:"auth/internal-error",INVALID_API_KEY:"auth/invalid-api-key",INVALID_APP_CREDENTIAL:"auth/invalid-app-credential",INVALID_APP_ID:"auth/invalid-app-id",INVALID_AUTH:"auth/invalid-user-token",INVALID_AUTH_EVENT:"auth/invalid-auth-event",INVALID_CERT_HASH:"auth/invalid-cert-hash",INVALID_CODE:"auth/invalid-verification-code",INVALID_CONTINUE_URI:"auth/invalid-continue-uri",INVALID_CORDOVA_CONFIGURATION:"auth/invalid-cordova-configuration",INVALID_CUSTOM_TOKEN:"auth/invalid-custom-token",INVALID_DYNAMIC_LINK_DOMAIN:"auth/invalid-dynamic-link-domain",INVALID_EMAIL:"auth/invalid-email",INVALID_EMULATOR_SCHEME:"auth/invalid-emulator-scheme",INVALID_IDP_RESPONSE:"auth/invalid-credential",INVALID_LOGIN_CREDENTIALS:"auth/invalid-credential",INVALID_MESSAGE_PAYLOAD:"auth/invalid-message-payload",INVALID_MFA_SESSION:"auth/invalid-multi-factor-session",INVALID_OAUTH_CLIENT_ID:"auth/invalid-oauth-client-id",INVALID_OAUTH_PROVIDER:"auth/invalid-oauth-provider",INVALID_OOB_CODE:"auth/invalid-action-code",INVALID_ORIGIN:"auth/unauthorized-domain",INVALID_PASSWORD:"auth/wrong-password",INVALID_PERSISTENCE:"auth/invalid-persistence-type",INVALID_PHONE_NUMBER:"auth/invalid-phone-number",INVALID_PROVIDER_ID:"auth/invalid-provider-id",INVALID_RECIPIENT_EMAIL:"auth/invalid-recipient-email",INVALID_SENDER:"auth/invalid-sender",INVALID_SESSION_INFO:"auth/invalid-verification-id",INVALID_TENANT_ID:"auth/invalid-tenant-id",MFA_INFO_NOT_FOUND:"auth/multi-factor-info-not-found",MFA_REQUIRED:"auth/multi-factor-auth-required",MISSING_ANDROID_PACKAGE_NAME:"auth/missing-android-pkg-name",MISSING_APP_CREDENTIAL:"auth/missing-app-credential",MISSING_AUTH_DOMAIN:"auth/auth-domain-config-required",MISSING_CODE:"auth/missing-verification-code",MISSING_CONTINUE_URI:"auth/missing-continue-uri",MISSING_IFRAME_START:"auth/missing-iframe-start",MISSING_IOS_BUNDLE_ID:"auth/missing-ios-bundle-id",MISSING_OR_INVALID_NONCE:"auth/missing-or-invalid-nonce",MISSING_MFA_INFO:"auth/missing-multi-factor-info",MISSING_MFA_SESSION:"auth/missing-multi-factor-session",MISSING_PHONE_NUMBER:"auth/missing-phone-number",MISSING_PASSWORD:"auth/missing-password",MISSING_SESSION_INFO:"auth/missing-verification-id",MODULE_DESTROYED:"auth/app-deleted",NEED_CONFIRMATION:"auth/account-exists-with-different-credential",NETWORK_REQUEST_FAILED:"auth/network-request-failed",NULL_USER:"auth/null-user",NO_AUTH_EVENT:"auth/no-auth-event",NO_SUCH_PROVIDER:"auth/no-such-provider",OPERATION_NOT_ALLOWED:"auth/operation-not-allowed",OPERATION_NOT_SUPPORTED:"auth/operation-not-supported-in-this-environment",POPUP_BLOCKED:"auth/popup-blocked",POPUP_CLOSED_BY_USER:"auth/popup-closed-by-user",PROVIDER_ALREADY_LINKED:"auth/provider-already-linked",QUOTA_EXCEEDED:"auth/quota-exceeded",REDIRECT_CANCELLED_BY_USER:"auth/redirect-cancelled-by-user",REDIRECT_OPERATION_PENDING:"auth/redirect-operation-pending",REJECTED_CREDENTIAL:"auth/rejected-credential",SECOND_FACTOR_ALREADY_ENROLLED:"auth/second-factor-already-in-use",SECOND_FACTOR_LIMIT_EXCEEDED:"auth/maximum-second-factor-count-exceeded",TENANT_ID_MISMATCH:"auth/tenant-id-mismatch",TIMEOUT:"auth/timeout",TOKEN_EXPIRED:"auth/user-token-expired",TOO_MANY_ATTEMPTS_TRY_LATER:"auth/too-many-requests",UNAUTHORIZED_DOMAIN:"auth/unauthorized-continue-uri",UNSUPPORTED_FIRST_FACTOR:"auth/unsupported-first-factor",UNSUPPORTED_PERSISTENCE:"auth/unsupported-persistence-type",UNSUPPORTED_TENANT_OPERATION:"auth/unsupported-tenant-operation",UNVERIFIED_EMAIL:"auth/unverified-email",USER_CANCELLED:"auth/user-cancelled",USER_DELETED:"auth/user-not-found",USER_DISABLED:"auth/user-disabled",USER_MISMATCH:"auth/user-mismatch",USER_SIGNED_OUT:"auth/user-signed-out",WEAK_PASSWORD:"auth/weak-password",WEB_STORAGE_UNSUPPORTED:"auth/web-storage-unsupported",ALREADY_INITIALIZED:"auth/already-initialized",RECAPTCHA_NOT_ENABLED:"auth/recaptcha-not-enabled",MISSING_RECAPTCHA_TOKEN:"auth/missing-recaptcha-token",INVALID_RECAPTCHA_TOKEN:"auth/invalid-recaptcha-token",INVALID_RECAPTCHA_ACTION:"auth/invalid-recaptcha-action",MISSING_CLIENT_TYPE:"auth/missing-client-type",MISSING_RECAPTCHA_VERSION:"auth/missing-recaptcha-version",INVALID_RECAPTCHA_VERSION:"auth/invalid-recaptcha-version",INVALID_REQ_TYPE:"auth/invalid-req-type",INVALID_HOSTING_LINK_DOMAIN:"auth/invalid-hosting-link-domain"};/**
|
|
32
|
+
* @license
|
|
33
|
+
* Copyright 2020 Google LLC
|
|
34
|
+
*
|
|
35
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
36
|
+
* you may not use this file except in compliance with the License.
|
|
37
|
+
* You may obtain a copy of the License at
|
|
38
|
+
*
|
|
39
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
40
|
+
*
|
|
41
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
42
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
43
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
44
|
+
* See the License for the specific language governing permissions and
|
|
45
|
+
* limitations under the License.
|
|
46
|
+
*/const ke=new Jn("@firebase/auth");function ye(n,...e){ke.logLevel<=Yt.WARN&&ke.warn(`Auth (${fe}): ${n}`,...e)}function ve(n,...e){ke.logLevel<=Yt.ERROR&&ke.error(`Auth (${fe}): ${n}`,...e)}/**
|
|
47
|
+
* @license
|
|
48
|
+
* Copyright 2020 Google LLC
|
|
49
|
+
*
|
|
50
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
51
|
+
* you may not use this file except in compliance with the License.
|
|
52
|
+
* You may obtain a copy of the License at
|
|
53
|
+
*
|
|
54
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
55
|
+
*
|
|
56
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
57
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
58
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
59
|
+
* See the License for the specific language governing permissions and
|
|
60
|
+
* limitations under the License.
|
|
61
|
+
*/function y(n,...e){throw nt(n,...e)}function w(n,...e){return nt(n,...e)}function Le(n,e,t){const i={...ri(),[e]:t};return new tt("auth","Firebase",i).create(e,{appName:n.name})}function T(n){return Le(n,"operation-not-supported-in-this-environment","Operations that alter the current user are not supported in conjunction with FirebaseServerApp")}function Q(n,e,t){const i=t;if(!(e instanceof i))throw i.name!==e.constructor.name&&y(n,"argument-error"),Le(n,"argument-error",`Type of ${e.constructor.name} does not match expected instance.Did you pass a reference from a different Auth SDK?`)}function nt(n,...e){if(typeof n!="string"){const t=e[0],i=[...e.slice(1)];return i[0]&&(i[0].appName=n.name),n._errorFactory.create(t,...i)}return Xt.create(n,...e)}function u(n,e,...t){if(!n)throw nt(e,...t)}function P(n){const e="INTERNAL ASSERTION FAILED: "+n;throw ve(e),new Error(e)}function b(n,e){n||P(e)}/**
|
|
62
|
+
* @license
|
|
63
|
+
* Copyright 2020 Google LLC
|
|
64
|
+
*
|
|
65
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
66
|
+
* you may not use this file except in compliance with the License.
|
|
67
|
+
* You may obtain a copy of the License at
|
|
68
|
+
*
|
|
69
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
70
|
+
*
|
|
71
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
72
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
73
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
74
|
+
* See the License for the specific language governing permissions and
|
|
75
|
+
* limitations under the License.
|
|
76
|
+
*/function ce(){var n;return typeof self<"u"&&((n=self.location)==null?void 0:n.href)||""}function it(){return At()==="http:"||At()==="https:"}function At(){var n;return typeof self<"u"&&((n=self.location)==null?void 0:n.protocol)||null}/**
|
|
77
|
+
* @license
|
|
78
|
+
* Copyright 2020 Google LLC
|
|
79
|
+
*
|
|
80
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
81
|
+
* you may not use this file except in compliance with the License.
|
|
82
|
+
* You may obtain a copy of the License at
|
|
83
|
+
*
|
|
84
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
85
|
+
*
|
|
86
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
87
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
88
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
89
|
+
* See the License for the specific language governing permissions and
|
|
90
|
+
* limitations under the License.
|
|
91
|
+
*/function si(){return typeof navigator<"u"&&navigator&&"onLine"in navigator&&typeof navigator.onLine=="boolean"&&(it()||ei()||"connection"in navigator)?navigator.onLine:!0}function oi(){if(typeof navigator>"u")return null;const n=navigator;return n.languages&&n.languages[0]||n.language||null}/**
|
|
92
|
+
* @license
|
|
93
|
+
* Copyright 2020 Google LLC
|
|
94
|
+
*
|
|
95
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
96
|
+
* you may not use this file except in compliance with the License.
|
|
97
|
+
* You may obtain a copy of the License at
|
|
98
|
+
*
|
|
99
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
100
|
+
*
|
|
101
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
102
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
103
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
104
|
+
* See the License for the specific language governing permissions and
|
|
105
|
+
* limitations under the License.
|
|
106
|
+
*/class pe{constructor(e,t){this.shortDelay=e,this.longDelay=t,b(t>e,"Short delay should be less than long delay!"),this.isMobile=Xn()||Qn()}get(){return si()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}}/**
|
|
107
|
+
* @license
|
|
108
|
+
* Copyright 2020 Google LLC
|
|
109
|
+
*
|
|
110
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
111
|
+
* you may not use this file except in compliance with the License.
|
|
112
|
+
* You may obtain a copy of the License at
|
|
113
|
+
*
|
|
114
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
115
|
+
*
|
|
116
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
117
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
118
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
119
|
+
* See the License for the specific language governing permissions and
|
|
120
|
+
* limitations under the License.
|
|
121
|
+
*/function rt(n,e){b(n.emulator,"Emulator should always be set here");const{url:t}=n.emulator;return e?`${t}${e.startsWith("/")?e.slice(1):e}`:t}/**
|
|
122
|
+
* @license
|
|
123
|
+
* Copyright 2020 Google LLC
|
|
124
|
+
*
|
|
125
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
126
|
+
* you may not use this file except in compliance with the License.
|
|
127
|
+
* You may obtain a copy of the License at
|
|
128
|
+
*
|
|
129
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
130
|
+
*
|
|
131
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
132
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
133
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
134
|
+
* See the License for the specific language governing permissions and
|
|
135
|
+
* limitations under the License.
|
|
136
|
+
*/class Qt{static initialize(e,t,i){this.fetchImpl=e,t&&(this.headersImpl=t),i&&(this.responseImpl=i)}static fetch(){if(this.fetchImpl)return this.fetchImpl;if(typeof self<"u"&&"fetch"in self)return self.fetch;if(typeof globalThis<"u"&&globalThis.fetch)return globalThis.fetch;if(typeof fetch<"u")return fetch;P("Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static headers(){if(this.headersImpl)return this.headersImpl;if(typeof self<"u"&&"Headers"in self)return self.Headers;if(typeof globalThis<"u"&&globalThis.Headers)return globalThis.Headers;if(typeof Headers<"u")return Headers;P("Could not find Headers implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static response(){if(this.responseImpl)return this.responseImpl;if(typeof self<"u"&&"Response"in self)return self.Response;if(typeof globalThis<"u"&&globalThis.Response)return globalThis.Response;if(typeof Response<"u")return Response;P("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}}/**
|
|
137
|
+
* @license
|
|
138
|
+
* Copyright 2020 Google LLC
|
|
139
|
+
*
|
|
140
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
141
|
+
* you may not use this file except in compliance with the License.
|
|
142
|
+
* You may obtain a copy of the License at
|
|
143
|
+
*
|
|
144
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
145
|
+
*
|
|
146
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
147
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
148
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
149
|
+
* See the License for the specific language governing permissions and
|
|
150
|
+
* limitations under the License.
|
|
151
|
+
*/const ai={CREDENTIAL_MISMATCH:"custom-token-mismatch",MISSING_CUSTOM_TOKEN:"internal-error",INVALID_IDENTIFIER:"invalid-email",MISSING_CONTINUE_URI:"internal-error",INVALID_PASSWORD:"wrong-password",MISSING_PASSWORD:"missing-password",INVALID_LOGIN_CREDENTIALS:"invalid-credential",EMAIL_EXISTS:"email-already-in-use",PASSWORD_LOGIN_DISABLED:"operation-not-allowed",INVALID_IDP_RESPONSE:"invalid-credential",INVALID_PENDING_TOKEN:"invalid-credential",FEDERATED_USER_ID_ALREADY_LINKED:"credential-already-in-use",MISSING_REQ_TYPE:"internal-error",EMAIL_NOT_FOUND:"user-not-found",RESET_PASSWORD_EXCEED_LIMIT:"too-many-requests",EXPIRED_OOB_CODE:"expired-action-code",INVALID_OOB_CODE:"invalid-action-code",MISSING_OOB_CODE:"internal-error",CREDENTIAL_TOO_OLD_LOGIN_AGAIN:"requires-recent-login",INVALID_ID_TOKEN:"invalid-user-token",TOKEN_EXPIRED:"user-token-expired",USER_NOT_FOUND:"user-token-expired",TOO_MANY_ATTEMPTS_TRY_LATER:"too-many-requests",PASSWORD_DOES_NOT_MEET_REQUIREMENTS:"password-does-not-meet-requirements",INVALID_CODE:"invalid-verification-code",INVALID_SESSION_INFO:"invalid-verification-id",INVALID_TEMPORARY_PROOF:"invalid-credential",MISSING_SESSION_INFO:"missing-verification-id",SESSION_EXPIRED:"code-expired",MISSING_ANDROID_PACKAGE_NAME:"missing-android-pkg-name",UNAUTHORIZED_DOMAIN:"unauthorized-continue-uri",INVALID_OAUTH_CLIENT_ID:"invalid-oauth-client-id",ADMIN_ONLY_OPERATION:"admin-restricted-operation",INVALID_MFA_PENDING_CREDENTIAL:"invalid-multi-factor-session",MFA_ENROLLMENT_NOT_FOUND:"multi-factor-info-not-found",MISSING_MFA_ENROLLMENT_ID:"missing-multi-factor-info",MISSING_MFA_PENDING_CREDENTIAL:"missing-multi-factor-session",SECOND_FACTOR_EXISTS:"second-factor-already-in-use",SECOND_FACTOR_LIMIT_EXCEEDED:"maximum-second-factor-count-exceeded",BLOCKING_FUNCTION_ERROR_RESPONSE:"internal-error",RECAPTCHA_NOT_ENABLED:"recaptcha-not-enabled",MISSING_RECAPTCHA_TOKEN:"missing-recaptcha-token",INVALID_RECAPTCHA_TOKEN:"invalid-recaptcha-token",INVALID_RECAPTCHA_ACTION:"invalid-recaptcha-action",MISSING_CLIENT_TYPE:"missing-client-type",MISSING_RECAPTCHA_VERSION:"missing-recaptcha-version",INVALID_RECAPTCHA_VERSION:"invalid-recaptcha-version",INVALID_REQ_TYPE:"invalid-req-type"};/**
|
|
152
|
+
* @license
|
|
153
|
+
* Copyright 2020 Google LLC
|
|
154
|
+
*
|
|
155
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
156
|
+
* you may not use this file except in compliance with the License.
|
|
157
|
+
* You may obtain a copy of the License at
|
|
158
|
+
*
|
|
159
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
160
|
+
*
|
|
161
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
162
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
163
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
164
|
+
* See the License for the specific language governing permissions and
|
|
165
|
+
* limitations under the License.
|
|
166
|
+
*/const ci=["/v1/accounts:signInWithCustomToken","/v1/accounts:signInWithEmailLink","/v1/accounts:signInWithIdp","/v1/accounts:signInWithPassword","/v1/accounts:signInWithPhoneNumber","/v1/token"],ui=new pe(3e4,6e4);function p(n,e){return n.tenantId&&!e.tenantId?{...e,tenantId:n.tenantId}:e}async function m(n,e,t,i,r={}){return Zt(n,r,async()=>{let s={},o={};i&&(e==="GET"?o=i:s={body:JSON.stringify(i)});const a=X({...o,key:n.config.apiKey}).slice(1),c=await n._getAdditionalHeaders();c["Content-Type"]="application/json",n.languageCode&&(c["X-Firebase-Locale"]=n.languageCode);const l={method:e,headers:c,...s};return ti()||(l.referrerPolicy="strict-origin-when-cross-origin"),n.emulatorConfig&&Ze(n.emulatorConfig.host)&&(l.credentials="include"),Qt.fetch()(await en(n,n.config.apiHost,t,a),l)})}async function Zt(n,e,t){n._canInitEmulator=!1;const i={...ai,...e};try{const r=new di(n),s=await Promise.race([t(),r.promise]);r.clearNetworkTimeout();const o=await s.json();if("needConfirmation"in o)throw re(n,"account-exists-with-different-credential",o);if(s.ok&&!("errorMessage"in o))return o;{const a=s.ok?o.errorMessage:o.error.message,[c,l]=a.split(" : ");if(c==="FEDERATED_USER_ID_ALREADY_LINKED")throw re(n,"credential-already-in-use",o);if(c==="EMAIL_EXISTS")throw re(n,"email-already-in-use",o);if(c==="USER_DISABLED")throw re(n,"user-disabled",o);const d=i[c]||c.toLowerCase().replace(/[_\s]+/g,"-");if(l)throw Le(n,d,l);y(n,d)}}catch(r){if(r instanceof et)throw r;y(n,"network-request-failed",{message:String(r)})}}async function D(n,e,t,i,r={}){const s=await m(n,e,t,i,r);return"mfaPendingCredential"in s&&y(n,"multi-factor-auth-required",{_serverResponse:s}),s}async function en(n,e,t,i){const r=`${e}${t}?${i}`,s=n,o=s.config.emulator?rt(n.config,r):`${n.config.apiScheme}://${r}`;return ci.includes(t)&&(await s._persistenceManagerAvailable,s._getPersistenceType()==="COOKIE")?s._getPersistence()._getFinalTarget(o).toString():o}function li(n){switch(n){case"ENFORCE":return"ENFORCE";case"AUDIT":return"AUDIT";case"OFF":return"OFF";default:return"ENFORCEMENT_STATE_UNSPECIFIED"}}class di{clearNetworkTimeout(){clearTimeout(this.timer)}constructor(e){this.auth=e,this.timer=null,this.promise=new Promise((t,i)=>{this.timer=setTimeout(()=>i(w(this.auth,"network-request-failed")),ui.get())})}}function re(n,e,t){const i={appName:n.name};t.email&&(i.email=t.email),t.phoneNumber&&(i.phoneNumber=t.phoneNumber);const r=w(n,e,i);return r.customData._tokenResponse=t,r}/**
|
|
167
|
+
* @license
|
|
168
|
+
* Copyright 2020 Google LLC
|
|
169
|
+
*
|
|
170
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
171
|
+
* you may not use this file except in compliance with the License.
|
|
172
|
+
* You may obtain a copy of the License at
|
|
173
|
+
*
|
|
174
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
175
|
+
*
|
|
176
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
177
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
178
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
179
|
+
* See the License for the specific language governing permissions and
|
|
180
|
+
* limitations under the License.
|
|
181
|
+
*/function Rt(n){return n!==void 0&&n.getResponse!==void 0}function Pt(n){return n!==void 0&&n.enterprise!==void 0}class tn{constructor(e){if(this.siteKey="",this.recaptchaEnforcementState=[],e.recaptchaKey===void 0)throw new Error("recaptchaKey undefined");this.siteKey=e.recaptchaKey.split("/")[3],this.recaptchaEnforcementState=e.recaptchaEnforcementState}getProviderEnforcementState(e){if(!this.recaptchaEnforcementState||this.recaptchaEnforcementState.length===0)return null;for(const t of this.recaptchaEnforcementState)if(t.provider&&t.provider===e)return li(t.enforcementState);return null}isProviderEnabled(e){return this.getProviderEnforcementState(e)==="ENFORCE"||this.getProviderEnforcementState(e)==="AUDIT"}isAnyProviderEnabled(){return this.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")||this.isProviderEnabled("PHONE_PROVIDER")}}/**
|
|
182
|
+
* @license
|
|
183
|
+
* Copyright 2020 Google LLC
|
|
184
|
+
*
|
|
185
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
186
|
+
* you may not use this file except in compliance with the License.
|
|
187
|
+
* You may obtain a copy of the License at
|
|
188
|
+
*
|
|
189
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
190
|
+
*
|
|
191
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
192
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
193
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
194
|
+
* See the License for the specific language governing permissions and
|
|
195
|
+
* limitations under the License.
|
|
196
|
+
*/async function hi(n){return(await m(n,"GET","/v1/recaptchaParams")).recaptchaSiteKey||""}async function nn(n,e){return m(n,"GET","/v2/recaptchaConfig",p(n,e))}/**
|
|
197
|
+
* @license
|
|
198
|
+
* Copyright 2020 Google LLC
|
|
199
|
+
*
|
|
200
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
201
|
+
* you may not use this file except in compliance with the License.
|
|
202
|
+
* You may obtain a copy of the License at
|
|
203
|
+
*
|
|
204
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
205
|
+
*
|
|
206
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
207
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
208
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
209
|
+
* See the License for the specific language governing permissions and
|
|
210
|
+
* limitations under the License.
|
|
211
|
+
*/async function fi(n,e){return m(n,"POST","/v1/accounts:delete",e)}async function pi(n,e){return m(n,"POST","/v1/accounts:update",e)}async function Ne(n,e){return m(n,"POST","/v1/accounts:lookup",e)}/**
|
|
212
|
+
* @license
|
|
213
|
+
* Copyright 2020 Google LLC
|
|
214
|
+
*
|
|
215
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
216
|
+
* you may not use this file except in compliance with the License.
|
|
217
|
+
* You may obtain a copy of the License at
|
|
218
|
+
*
|
|
219
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
220
|
+
*
|
|
221
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
222
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
223
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
224
|
+
* See the License for the specific language governing permissions and
|
|
225
|
+
* limitations under the License.
|
|
226
|
+
*/function se(n){if(n)try{const e=new Date(Number(n));if(!isNaN(e.getTime()))return e.toUTCString()}catch{}}/**
|
|
227
|
+
* @license
|
|
228
|
+
* Copyright 2020 Google LLC
|
|
229
|
+
*
|
|
230
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
231
|
+
* you may not use this file except in compliance with the License.
|
|
232
|
+
* You may obtain a copy of the License at
|
|
233
|
+
*
|
|
234
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
235
|
+
*
|
|
236
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
237
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
238
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
239
|
+
* See the License for the specific language governing permissions and
|
|
240
|
+
* limitations under the License.
|
|
241
|
+
*/function io(n,e=!1){return h(n).getIdToken(e)}async function mi(n,e=!1){const t=h(n),i=await t.getIdToken(e),r=De(i);u(r&&r.exp&&r.auth_time&&r.iat,t.auth,"internal-error");const s=typeof r.firebase=="object"?r.firebase:void 0,o=s==null?void 0:s.sign_in_provider;return{claims:r,token:i,authTime:se(Ge(r.auth_time)),issuedAtTime:se(Ge(r.iat)),expirationTime:se(Ge(r.exp)),signInProvider:o||null,signInSecondFactor:(s==null?void 0:s.sign_in_second_factor)||null}}function Ge(n){return Number(n)*1e3}function De(n){const[e,t,i]=n.split(".");if(e===void 0||t===void 0||i===void 0)return ve("JWT malformed, contained fewer than 3 sections"),null;try{const r=Yn(t);return r?JSON.parse(r):(ve("Failed to decode base64 JWT payload"),null)}catch(r){return ve("Caught error parsing JWT payload as JSON",r==null?void 0:r.toString()),null}}function St(n){const e=De(n);return u(e,"internal-error"),u(typeof e.exp<"u","internal-error"),u(typeof e.iat<"u","internal-error"),Number(e.exp)-Number(e.iat)}/**
|
|
242
|
+
* @license
|
|
243
|
+
* Copyright 2020 Google LLC
|
|
244
|
+
*
|
|
245
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
246
|
+
* you may not use this file except in compliance with the License.
|
|
247
|
+
* You may obtain a copy of the License at
|
|
248
|
+
*
|
|
249
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
250
|
+
*
|
|
251
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
252
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
253
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
254
|
+
* See the License for the specific language governing permissions and
|
|
255
|
+
* limitations under the License.
|
|
256
|
+
*/async function O(n,e,t=!1){if(t)return e;try{return await e}catch(i){throw i instanceof et&&gi(i)&&n.auth.currentUser===n&&await n.auth.signOut(),i}}function gi({code:n}){return n==="auth/user-disabled"||n==="auth/user-token-expired"}/**
|
|
257
|
+
* @license
|
|
258
|
+
* Copyright 2020 Google LLC
|
|
259
|
+
*
|
|
260
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
261
|
+
* you may not use this file except in compliance with the License.
|
|
262
|
+
* You may obtain a copy of the License at
|
|
263
|
+
*
|
|
264
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
265
|
+
*
|
|
266
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
267
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
268
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
269
|
+
* See the License for the specific language governing permissions and
|
|
270
|
+
* limitations under the License.
|
|
271
|
+
*/class Ii{constructor(e){this.user=e,this.isRunning=!1,this.timerId=null,this.errorBackoff=3e4}_start(){this.isRunning||(this.isRunning=!0,this.schedule())}_stop(){this.isRunning&&(this.isRunning=!1,this.timerId!==null&&clearTimeout(this.timerId))}getInterval(e){if(e){const t=this.errorBackoff;return this.errorBackoff=Math.min(this.errorBackoff*2,96e4),t}else{this.errorBackoff=3e4;const i=(this.user.stsTokenManager.expirationTime??0)-Date.now()-3e5;return Math.max(0,i)}}schedule(e=!1){if(!this.isRunning)return;const t=this.getInterval(e);this.timerId=setTimeout(async()=>{await this.iteration()},t)}async iteration(){try{await this.user.getIdToken(!0)}catch(e){(e==null?void 0:e.code)==="auth/network-request-failed"&&this.schedule(!0);return}this.schedule()}}/**
|
|
272
|
+
* @license
|
|
273
|
+
* Copyright 2020 Google LLC
|
|
274
|
+
*
|
|
275
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
276
|
+
* you may not use this file except in compliance with the License.
|
|
277
|
+
* You may obtain a copy of the License at
|
|
278
|
+
*
|
|
279
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
280
|
+
*
|
|
281
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
282
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
283
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
284
|
+
* See the License for the specific language governing permissions and
|
|
285
|
+
* limitations under the License.
|
|
286
|
+
*/class Xe{constructor(e,t){this.createdAt=e,this.lastLoginAt=t,this._initializeTime()}_initializeTime(){this.lastSignInTime=se(this.lastLoginAt),this.creationTime=se(this.createdAt)}_copy(e){this.createdAt=e.createdAt,this.lastLoginAt=e.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}}/**
|
|
287
|
+
* @license
|
|
288
|
+
* Copyright 2019 Google LLC
|
|
289
|
+
*
|
|
290
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
291
|
+
* you may not use this file except in compliance with the License.
|
|
292
|
+
* You may obtain a copy of the License at
|
|
293
|
+
*
|
|
294
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
295
|
+
*
|
|
296
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
297
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
298
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
299
|
+
* See the License for the specific language governing permissions and
|
|
300
|
+
* limitations under the License.
|
|
301
|
+
*/async function ue(n){var f;const e=n.auth,t=await n.getIdToken(),i=await O(n,Ne(e,{idToken:t}));u(i==null?void 0:i.users.length,e,"internal-error");const r=i.users[0];n._notifyReloadListener(r);const s=(f=r.providerUserInfo)!=null&&f.length?rn(r.providerUserInfo):[],o=Ei(n.providerData,s),a=n.isAnonymous,c=!(n.email&&r.passwordHash)&&!(o!=null&&o.length),l=a?c:!1,d={uid:r.localId,displayName:r.displayName||null,photoURL:r.photoUrl||null,email:r.email||null,emailVerified:r.emailVerified||!1,phoneNumber:r.phoneNumber||null,tenantId:r.tenantId||null,providerData:o,metadata:new Xe(r.createdAt,r.lastLoginAt),isAnonymous:l};Object.assign(n,d)}async function _i(n){const e=h(n);await ue(e),await e.auth._persistUserIfCurrent(e),e.auth._notifyListenersIfCurrent(e)}function Ei(n,e){return[...n.filter(i=>!e.some(r=>r.providerId===i.providerId)),...e]}function rn(n){return n.map(({providerId:e,...t})=>({providerId:e,uid:t.rawId||"",displayName:t.displayName||null,email:t.email||null,phoneNumber:t.phoneNumber||null,photoURL:t.photoUrl||null}))}/**
|
|
302
|
+
* @license
|
|
303
|
+
* Copyright 2020 Google LLC
|
|
304
|
+
*
|
|
305
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
306
|
+
* you may not use this file except in compliance with the License.
|
|
307
|
+
* You may obtain a copy of the License at
|
|
308
|
+
*
|
|
309
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
310
|
+
*
|
|
311
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
312
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
313
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
314
|
+
* See the License for the specific language governing permissions and
|
|
315
|
+
* limitations under the License.
|
|
316
|
+
*/async function Ti(n,e){const t=await Zt(n,{},async()=>{const i=X({grant_type:"refresh_token",refresh_token:e}).slice(1),{tokenApiHost:r,apiKey:s}=n.config,o=await en(n,r,"/v1/token",`key=${s}`),a=await n._getAdditionalHeaders();a["Content-Type"]="application/x-www-form-urlencoded";const c={method:"POST",headers:a,body:i};return n.emulatorConfig&&Ze(n.emulatorConfig.host)&&(c.credentials="include"),Qt.fetch()(o,c)});return{accessToken:t.access_token,expiresIn:t.expires_in,refreshToken:t.refresh_token}}async function wi(n,e){return m(n,"POST","/v2/accounts:revokeToken",p(n,e))}/**
|
|
317
|
+
* @license
|
|
318
|
+
* Copyright 2020 Google LLC
|
|
319
|
+
*
|
|
320
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
321
|
+
* you may not use this file except in compliance with the License.
|
|
322
|
+
* You may obtain a copy of the License at
|
|
323
|
+
*
|
|
324
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
325
|
+
*
|
|
326
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
327
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
328
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
329
|
+
* See the License for the specific language governing permissions and
|
|
330
|
+
* limitations under the License.
|
|
331
|
+
*/class B{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(e){u(e.idToken,"internal-error"),u(typeof e.idToken<"u","internal-error"),u(typeof e.refreshToken<"u","internal-error");const t="expiresIn"in e&&typeof e.expiresIn<"u"?Number(e.expiresIn):St(e.idToken);this.updateTokensAndExpiration(e.idToken,e.refreshToken,t)}updateFromIdToken(e){u(e.length!==0,"internal-error");const t=St(e);this.updateTokensAndExpiration(e,null,t)}async getToken(e,t=!1){return!t&&this.accessToken&&!this.isExpired?this.accessToken:(u(this.refreshToken,e,"user-token-expired"),this.refreshToken?(await this.refresh(e,this.refreshToken),this.accessToken):null)}clearRefreshToken(){this.refreshToken=null}async refresh(e,t){const{accessToken:i,refreshToken:r,expiresIn:s}=await Ti(e,t);this.updateTokensAndExpiration(i,r,Number(s))}updateTokensAndExpiration(e,t,i){this.refreshToken=t||null,this.accessToken=e||null,this.expirationTime=Date.now()+i*1e3}static fromJSON(e,t){const{refreshToken:i,accessToken:r,expirationTime:s}=t,o=new B;return i&&(u(typeof i=="string","internal-error",{appName:e}),o.refreshToken=i),r&&(u(typeof r=="string","internal-error",{appName:e}),o.accessToken=r),s&&(u(typeof s=="number","internal-error",{appName:e}),o.expirationTime=s),o}toJSON(){return{refreshToken:this.refreshToken,accessToken:this.accessToken,expirationTime:this.expirationTime}}_assign(e){this.accessToken=e.accessToken,this.refreshToken=e.refreshToken,this.expirationTime=e.expirationTime}_clone(){return Object.assign(new B,this.toJSON())}_performRefresh(){return P("not implemented")}}/**
|
|
332
|
+
* @license
|
|
333
|
+
* Copyright 2020 Google LLC
|
|
334
|
+
*
|
|
335
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
336
|
+
* you may not use this file except in compliance with the License.
|
|
337
|
+
* You may obtain a copy of the License at
|
|
338
|
+
*
|
|
339
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
340
|
+
*
|
|
341
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
342
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
343
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
344
|
+
* See the License for the specific language governing permissions and
|
|
345
|
+
* limitations under the License.
|
|
346
|
+
*/function U(n,e){u(typeof n=="string"||typeof n>"u","internal-error",{appName:e})}class R{constructor({uid:e,auth:t,stsTokenManager:i,...r}){this.providerId="firebase",this.proactiveRefresh=new Ii(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=e,this.auth=t,this.stsTokenManager=i,this.accessToken=i.accessToken,this.displayName=r.displayName||null,this.email=r.email||null,this.emailVerified=r.emailVerified||!1,this.phoneNumber=r.phoneNumber||null,this.photoURL=r.photoURL||null,this.isAnonymous=r.isAnonymous||!1,this.tenantId=r.tenantId||null,this.providerData=r.providerData?[...r.providerData]:[],this.metadata=new Xe(r.createdAt||void 0,r.lastLoginAt||void 0)}async getIdToken(e){const t=await O(this,this.stsTokenManager.getToken(this.auth,e));return u(t,this.auth,"internal-error"),this.accessToken!==t&&(this.accessToken=t,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),t}getIdTokenResult(e){return mi(this,e)}reload(){return _i(this)}_assign(e){this!==e&&(u(this.uid===e.uid,this.auth,"internal-error"),this.displayName=e.displayName,this.photoURL=e.photoURL,this.email=e.email,this.emailVerified=e.emailVerified,this.phoneNumber=e.phoneNumber,this.isAnonymous=e.isAnonymous,this.tenantId=e.tenantId,this.providerData=e.providerData.map(t=>({...t})),this.metadata._copy(e.metadata),this.stsTokenManager._assign(e.stsTokenManager))}_clone(e){const t=new R({...this,auth:e,stsTokenManager:this.stsTokenManager._clone()});return t.metadata._copy(this.metadata),t}_onReload(e){u(!this.reloadListener,this.auth,"internal-error"),this.reloadListener=e,this.reloadUserInfo&&(this._notifyReloadListener(this.reloadUserInfo),this.reloadUserInfo=null)}_notifyReloadListener(e){this.reloadListener?this.reloadListener(e):this.reloadUserInfo=e}_startProactiveRefresh(){this.proactiveRefresh._start()}_stopProactiveRefresh(){this.proactiveRefresh._stop()}async _updateTokensIfNecessary(e,t=!1){let i=!1;e.idToken&&e.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(e),i=!0),t&&await ue(this),await this.auth._persistUserIfCurrent(this),i&&this.auth._notifyListenersIfCurrent(this)}async delete(){if(I(this.auth.app))return Promise.reject(T(this.auth));const e=await this.getIdToken();return await O(this,fi(this.auth,{idToken:e})),this.stsTokenManager.clearRefreshToken(),this.auth.signOut()}toJSON(){return{uid:this.uid,email:this.email||void 0,emailVerified:this.emailVerified,displayName:this.displayName||void 0,isAnonymous:this.isAnonymous,photoURL:this.photoURL||void 0,phoneNumber:this.phoneNumber||void 0,tenantId:this.tenantId||void 0,providerData:this.providerData.map(e=>({...e})),stsTokenManager:this.stsTokenManager.toJSON(),_redirectEventId:this._redirectEventId,...this.metadata.toJSON(),apiKey:this.auth.config.apiKey,appName:this.auth.name}}get refreshToken(){return this.stsTokenManager.refreshToken||""}static _fromJSON(e,t){const i=t.displayName??void 0,r=t.email??void 0,s=t.phoneNumber??void 0,o=t.photoURL??void 0,a=t.tenantId??void 0,c=t._redirectEventId??void 0,l=t.createdAt??void 0,d=t.lastLoginAt??void 0,{uid:f,emailVerified:g,isAnonymous:j,providerData:ee,stsTokenManager:Tt}=t;u(f&&Tt,e,"internal-error");const qn=B.fromJSON(this.name,Tt);u(typeof f=="string",e,"internal-error"),U(i,e.name),U(r,e.name),u(typeof g=="boolean",e,"internal-error"),u(typeof j=="boolean",e,"internal-error"),U(s,e.name),U(o,e.name),U(a,e.name),U(c,e.name),U(l,e.name),U(d,e.name);const qe=new R({uid:f,auth:e,email:r,emailVerified:g,displayName:i,isAnonymous:j,photoURL:o,phoneNumber:s,tenantId:a,stsTokenManager:qn,createdAt:l,lastLoginAt:d});return ee&&Array.isArray(ee)&&(qe.providerData=ee.map(Gn=>({...Gn}))),c&&(qe._redirectEventId=c),qe}static async _fromIdTokenResponse(e,t,i=!1){const r=new B;r.updateFromServerResponse(t);const s=new R({uid:t.localId,auth:e,stsTokenManager:r,isAnonymous:i});return await ue(s),s}static async _fromGetAccountInfoResponse(e,t,i){const r=t.users[0];u(r.localId!==void 0,"internal-error");const s=r.providerUserInfo!==void 0?rn(r.providerUserInfo):[],o=!(r.email&&r.passwordHash)&&!(s!=null&&s.length),a=new B;a.updateFromIdToken(i);const c=new R({uid:r.localId,auth:e,stsTokenManager:a,isAnonymous:o}),l={uid:r.localId,displayName:r.displayName||null,photoURL:r.photoUrl||null,email:r.email||null,emailVerified:r.emailVerified||!1,phoneNumber:r.phoneNumber||null,tenantId:r.tenantId||null,providerData:s,metadata:new Xe(r.createdAt,r.lastLoginAt),isAnonymous:!(r.email&&r.passwordHash)&&!(s!=null&&s.length)};return Object.assign(c,l),c}}/**
|
|
347
|
+
* @license
|
|
348
|
+
* Copyright 2020 Google LLC
|
|
349
|
+
*
|
|
350
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
351
|
+
* you may not use this file except in compliance with the License.
|
|
352
|
+
* You may obtain a copy of the License at
|
|
353
|
+
*
|
|
354
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
355
|
+
*
|
|
356
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
357
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
358
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
359
|
+
* See the License for the specific language governing permissions and
|
|
360
|
+
* limitations under the License.
|
|
361
|
+
*/const kt=new Map;function k(n){b(n instanceof Function,"Expected a class definition");let e=kt.get(n);return e?(b(e instanceof n,"Instance stored in cache mismatched with class"),e):(e=new n,kt.set(n,e),e)}/**
|
|
362
|
+
* @license
|
|
363
|
+
* Copyright 2019 Google LLC
|
|
364
|
+
*
|
|
365
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
366
|
+
* you may not use this file except in compliance with the License.
|
|
367
|
+
* You may obtain a copy of the License at
|
|
368
|
+
*
|
|
369
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
370
|
+
*
|
|
371
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
372
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
373
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
374
|
+
* See the License for the specific language governing permissions and
|
|
375
|
+
* limitations under the License.
|
|
376
|
+
*/class sn{constructor(){this.type="NONE",this.storage={}}async _isAvailable(){return!0}async _set(e,t){this.storage[e]=t}async _get(e){const t=this.storage[e];return t===void 0?null:t}async _remove(e){delete this.storage[e]}_addListener(e,t){}_removeListener(e,t){}}sn.type="NONE";const Nt=sn;/**
|
|
377
|
+
* @license
|
|
378
|
+
* Copyright 2019 Google LLC
|
|
379
|
+
*
|
|
380
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
381
|
+
* you may not use this file except in compliance with the License.
|
|
382
|
+
* You may obtain a copy of the License at
|
|
383
|
+
*
|
|
384
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
385
|
+
*
|
|
386
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
387
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
388
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
389
|
+
* See the License for the specific language governing permissions and
|
|
390
|
+
* limitations under the License.
|
|
391
|
+
*/function Ae(n,e,t){return`firebase:${n}:${e}:${t}`}class G{constructor(e,t,i){this.persistence=e,this.auth=t,this.userKey=i;const{config:r,name:s}=this.auth;this.fullUserKey=Ae(this.userKey,r.apiKey,s),this.fullPersistenceKey=Ae("persistence",r.apiKey,s),this.boundEventHandler=t._onStorageEvent.bind(t);try{this.persistence._addListener(this.fullUserKey,this.boundEventHandler)}catch{}}setCurrentUser(e){return this.persistence._set(this.fullUserKey,e.toJSON())}async getCurrentUser(){const e=await this.persistence._get(this.fullUserKey);if(!e)return null;if(typeof e=="string"){const t=await Ne(this.auth,{idToken:e}).catch(()=>{});return t?R._fromGetAccountInfoResponse(this.auth,t,e):null}return R._fromJSON(this.auth,e)}removeCurrentUser(){return this.persistence._remove(this.fullUserKey)}savePersistenceForRedirect(){return this.persistence._set(this.fullPersistenceKey,this.persistence.type)}async setPersistence(e){if(this.persistence===e)return;const t=await this.getCurrentUser();if(await this.removeCurrentUser(),this.persistence=e,t)return this.setCurrentUser(t)}delete(){try{this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}catch{}}static async create(e,t,i="authUser"){if(!t.length)return new G(k(Nt),e,i);const r=(await Promise.all(t.map(async l=>{try{if(await l._isAvailable())return l}catch{return}}))).filter(l=>l);let s=r[0]||k(Nt);const o=Ae(i,e.config.apiKey,e.name);let a=null;for(const l of t)try{const d=await l._get(o);if(d){let f;if(typeof d=="string"){const g=await Ne(e,{idToken:d}).catch(()=>{});if(!g)break;f=await R._fromGetAccountInfoResponse(e,g,d)}else f=R._fromJSON(e,d);l!==s&&(a=f),s=l;break}}catch{}const c=r.filter(l=>l._shouldAllowMigration);return!s._shouldAllowMigration||!c.length?new G(s,e,i):(s=c[0],a&&await s._set(o,a.toJSON()),await Promise.all(t.map(async l=>{if(l!==s)try{await l._remove(o)}catch{}})),new G(s,e,i))}}/**
|
|
392
|
+
* @license
|
|
393
|
+
* Copyright 2020 Google LLC
|
|
394
|
+
*
|
|
395
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
396
|
+
* you may not use this file except in compliance with the License.
|
|
397
|
+
* You may obtain a copy of the License at
|
|
398
|
+
*
|
|
399
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
400
|
+
*
|
|
401
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
402
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
403
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
404
|
+
* See the License for the specific language governing permissions and
|
|
405
|
+
* limitations under the License.
|
|
406
|
+
*/function Ct(n){const e=n.toLowerCase();if(e.includes("opera/")||e.includes("opr/")||e.includes("opios/"))return"Opera";if(un(e))return"IEMobile";if(e.includes("msie")||e.includes("trident/"))return"IE";if(e.includes("edge/"))return"Edge";if(on(e))return"Firefox";if(e.includes("silk/"))return"Silk";if(dn(e))return"Blackberry";if(hn(e))return"Webos";if(an(e))return"Safari";if((e.includes("chrome/")||cn(e))&&!e.includes("edge/"))return"Chrome";if(ln(e))return"Android";{const t=/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/,i=n.match(t);if((i==null?void 0:i.length)===2)return i[1]}return"Other"}function on(n=v()){return/firefox\//i.test(n)}function an(n=v()){const e=n.toLowerCase();return e.includes("safari/")&&!e.includes("chrome/")&&!e.includes("crios/")&&!e.includes("android")}function cn(n=v()){return/crios\//i.test(n)}function un(n=v()){return/iemobile/i.test(n)}function ln(n=v()){return/android/i.test(n)}function dn(n=v()){return/blackberry/i.test(n)}function hn(n=v()){return/webos/i.test(n)}function st(n=v()){return/iphone|ipad|ipod/i.test(n)||/macintosh/i.test(n)&&/mobile/i.test(n)}function yi(n=v()){var e;return st(n)&&!!((e=window.navigator)!=null&&e.standalone)}function vi(){return jn()&&document.documentMode===10}function fn(n=v()){return st(n)||ln(n)||hn(n)||dn(n)||/windows phone/i.test(n)||un(n)}/**
|
|
407
|
+
* @license
|
|
408
|
+
* Copyright 2020 Google LLC
|
|
409
|
+
*
|
|
410
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
411
|
+
* you may not use this file except in compliance with the License.
|
|
412
|
+
* You may obtain a copy of the License at
|
|
413
|
+
*
|
|
414
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
415
|
+
*
|
|
416
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
417
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
418
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
419
|
+
* See the License for the specific language governing permissions and
|
|
420
|
+
* limitations under the License.
|
|
421
|
+
*/function pn(n,e=[]){let t;switch(n){case"Browser":t=Ct(v());break;case"Worker":t=`${Ct(v())}-${n}`;break;default:t=n}const i=e.length?e.join(","):"FirebaseCore-web";return`${t}/JsCore/${fe}/${i}`}/**
|
|
422
|
+
* @license
|
|
423
|
+
* Copyright 2022 Google LLC
|
|
424
|
+
*
|
|
425
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
426
|
+
* you may not use this file except in compliance with the License.
|
|
427
|
+
* You may obtain a copy of the License at
|
|
428
|
+
*
|
|
429
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
430
|
+
*
|
|
431
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
432
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
433
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
434
|
+
* See the License for the specific language governing permissions and
|
|
435
|
+
* limitations under the License.
|
|
436
|
+
*/class Ai{constructor(e){this.auth=e,this.queue=[]}pushCallback(e,t){const i=s=>new Promise((o,a)=>{try{const c=e(s);o(c)}catch(c){a(c)}});i.onAbort=t,this.queue.push(i);const r=this.queue.length-1;return()=>{this.queue[r]=()=>Promise.resolve()}}async runMiddleware(e){if(this.auth.currentUser===e)return;const t=[];try{for(const i of this.queue)await i(e),i.onAbort&&t.push(i.onAbort)}catch(i){t.reverse();for(const r of t)try{r()}catch{}throw this.auth._errorFactory.create("login-blocked",{originalMessage:i==null?void 0:i.message})}}}/**
|
|
437
|
+
* @license
|
|
438
|
+
* Copyright 2023 Google LLC
|
|
439
|
+
*
|
|
440
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
441
|
+
* you may not use this file except in compliance with the License.
|
|
442
|
+
* You may obtain a copy of the License at
|
|
443
|
+
*
|
|
444
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
445
|
+
*
|
|
446
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
447
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
448
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
449
|
+
* See the License for the specific language governing permissions and
|
|
450
|
+
* limitations under the License.
|
|
451
|
+
*/async function Ri(n,e={}){return m(n,"GET","/v2/passwordPolicy",p(n,e))}/**
|
|
452
|
+
* @license
|
|
453
|
+
* Copyright 2023 Google LLC
|
|
454
|
+
*
|
|
455
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
456
|
+
* you may not use this file except in compliance with the License.
|
|
457
|
+
* You may obtain a copy of the License at
|
|
458
|
+
*
|
|
459
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
460
|
+
*
|
|
461
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
462
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
463
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
464
|
+
* See the License for the specific language governing permissions and
|
|
465
|
+
* limitations under the License.
|
|
466
|
+
*/const Pi=6;class Si{constructor(e){var i;const t=e.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=t.minPasswordLength??Pi,t.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=t.maxPasswordLength),t.containsLowercaseCharacter!==void 0&&(this.customStrengthOptions.containsLowercaseLetter=t.containsLowercaseCharacter),t.containsUppercaseCharacter!==void 0&&(this.customStrengthOptions.containsUppercaseLetter=t.containsUppercaseCharacter),t.containsNumericCharacter!==void 0&&(this.customStrengthOptions.containsNumericCharacter=t.containsNumericCharacter),t.containsNonAlphanumericCharacter!==void 0&&(this.customStrengthOptions.containsNonAlphanumericCharacter=t.containsNonAlphanumericCharacter),this.enforcementState=e.enforcementState,this.enforcementState==="ENFORCEMENT_STATE_UNSPECIFIED"&&(this.enforcementState="OFF"),this.allowedNonAlphanumericCharacters=((i=e.allowedNonAlphanumericCharacters)==null?void 0:i.join(""))??"",this.forceUpgradeOnSignin=e.forceUpgradeOnSignin??!1,this.schemaVersion=e.schemaVersion}validatePassword(e){const t={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(e,t),this.validatePasswordCharacterOptions(e,t),t.isValid&&(t.isValid=t.meetsMinPasswordLength??!0),t.isValid&&(t.isValid=t.meetsMaxPasswordLength??!0),t.isValid&&(t.isValid=t.containsLowercaseLetter??!0),t.isValid&&(t.isValid=t.containsUppercaseLetter??!0),t.isValid&&(t.isValid=t.containsNumericCharacter??!0),t.isValid&&(t.isValid=t.containsNonAlphanumericCharacter??!0),t}validatePasswordLengthOptions(e,t){const i=this.customStrengthOptions.minPasswordLength,r=this.customStrengthOptions.maxPasswordLength;i&&(t.meetsMinPasswordLength=e.length>=i),r&&(t.meetsMaxPasswordLength=e.length<=r)}validatePasswordCharacterOptions(e,t){this.updatePasswordCharacterOptionsStatuses(t,!1,!1,!1,!1);let i;for(let r=0;r<e.length;r++)i=e.charAt(r),this.updatePasswordCharacterOptionsStatuses(t,i>="a"&&i<="z",i>="A"&&i<="Z",i>="0"&&i<="9",this.allowedNonAlphanumericCharacters.includes(i))}updatePasswordCharacterOptionsStatuses(e,t,i,r,s){this.customStrengthOptions.containsLowercaseLetter&&(e.containsLowercaseLetter||(e.containsLowercaseLetter=t)),this.customStrengthOptions.containsUppercaseLetter&&(e.containsUppercaseLetter||(e.containsUppercaseLetter=i)),this.customStrengthOptions.containsNumericCharacter&&(e.containsNumericCharacter||(e.containsNumericCharacter=r)),this.customStrengthOptions.containsNonAlphanumericCharacter&&(e.containsNonAlphanumericCharacter||(e.containsNonAlphanumericCharacter=s))}}/**
|
|
467
|
+
* @license
|
|
468
|
+
* Copyright 2020 Google LLC
|
|
469
|
+
*
|
|
470
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
471
|
+
* you may not use this file except in compliance with the License.
|
|
472
|
+
* You may obtain a copy of the License at
|
|
473
|
+
*
|
|
474
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
475
|
+
*
|
|
476
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
477
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
478
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
479
|
+
* See the License for the specific language governing permissions and
|
|
480
|
+
* limitations under the License.
|
|
481
|
+
*/class ki{constructor(e,t,i,r){this.app=e,this.heartbeatServiceProvider=t,this.appCheckServiceProvider=i,this.config=r,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new bt(this),this.idTokenSubscription=new bt(this),this.beforeStateQueue=new Ai(this),this.redirectUser=null,this.isProactiveRefreshEnabled=!1,this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION=1,this._canInitEmulator=!0,this._isInitialized=!1,this._deleted=!1,this._initializationPromise=null,this._popupRedirectResolver=null,this._errorFactory=Xt,this._agentRecaptchaConfig=null,this._tenantRecaptchaConfigs={},this._projectPasswordPolicy=null,this._tenantPasswordPolicies={},this._resolvePersistenceManagerAvailable=void 0,this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=e.name,this.clientVersion=r.sdkClientVersion,this._persistenceManagerAvailable=new Promise(s=>this._resolvePersistenceManagerAvailable=s)}_initializeWithPersistence(e,t){return t&&(this._popupRedirectResolver=k(t)),this._initializationPromise=this.queue(async()=>{var i,r,s;if(!this._deleted){try{this.persistenceManager=await G.create(this,e)}catch(o){ye(`Failed to initialize persistence: ${o}`),this.persistenceManager=await G.create(this,[])}finally{(i=this._resolvePersistenceManagerAvailable)==null||i.call(this)}if(!this._deleted){if((r=this._popupRedirectResolver)!=null&&r._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch{}try{await this.initializeCurrentUser(t)}catch(o){ye(`Failed to initialize current user: ${o}`),await this.directlySetCurrentUser(null).catch(()=>{})}this.lastNotifiedUid=((s=this.currentUser)==null?void 0:s.uid)||null,!this._deleted&&(this._isInitialized=!0)}}}),this._initializationPromise}async _onStorageEvent(){if(this._deleted)return;const e=await this.assertedPersistence.getCurrentUser();if(!(!this.currentUser&&!e)){if(this.currentUser&&e&&this.currentUser.uid===e.uid){this._currentUser._assign(e),await this.currentUser.getIdToken();return}await this._updateCurrentUser(e,!0)}}async initializeCurrentUserFromIdToken(e){try{const t=await Ne(this,{idToken:e}),i=await R._fromGetAccountInfoResponse(this,t,e);await this.directlySetCurrentUser(i)}catch(t){console.warn("FirebaseServerApp could not login user with provided authIdToken: ",t),await this.directlySetCurrentUser(null)}}async initializeCurrentUser(e){var s;if(I(this.app)){const o=this.app.settings.authIdToken;return o?new Promise(a=>{setTimeout(()=>this.initializeCurrentUserFromIdToken(o).then(a,a))}):this.directlySetCurrentUser(null)}const t=await this.assertedPersistence.getCurrentUser();let i=t,r=!1;if(e&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();const o=(s=this.redirectUser)==null?void 0:s._redirectEventId,a=i==null?void 0:i._redirectEventId,c=await this.tryRedirectSignIn(e);(!o||o===a)&&(c!=null&&c.user)&&(i=c.user,r=!0)}if(!i)return this.directlySetCurrentUser(null);if(!i._redirectEventId){if(r)try{await this.beforeStateQueue.runMiddleware(i)}catch(o){i=t,this._popupRedirectResolver._overrideRedirectResult(this,()=>Promise.reject(o))}return i?this.reloadAndSetCurrentUserOrClear(i):this.directlySetCurrentUser(null)}return u(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===i._redirectEventId?this.directlySetCurrentUser(i):this.reloadAndSetCurrentUserOrClear(i)}async tryRedirectSignIn(e){let t=null;try{t=await this._popupRedirectResolver._completeRedirectFn(this,e,!0)}catch{await this._setRedirectUser(null)}return t}async reloadAndSetCurrentUserOrClear(e){try{await ue(e)}catch(t){if((t==null?void 0:t.code)!=="auth/network-request-failed")return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(e)}useDeviceLanguage(){this.languageCode=oi()}async _delete(){this._deleted=!0}async updateCurrentUser(e){if(I(this.app))return Promise.reject(T(this));const t=e?h(e):null;return t&&u(t.auth.config.apiKey===this.config.apiKey,this,"invalid-user-token"),this._updateCurrentUser(t&&t._clone(this))}async _updateCurrentUser(e,t=!1){if(!this._deleted)return e&&u(this.tenantId===e.tenantId,this,"tenant-id-mismatch"),t||await this.beforeStateQueue.runMiddleware(e),this.queue(async()=>{await this.directlySetCurrentUser(e),this.notifyAuthListeners()})}async signOut(){return I(this.app)?Promise.reject(T(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(e){return I(this.app)?Promise.reject(T(this)):this.queue(async()=>{await this.assertedPersistence.setPersistence(k(e))})}_getRecaptchaConfig(){return this.tenantId==null?this._agentRecaptchaConfig:this._tenantRecaptchaConfigs[this.tenantId]}async validatePassword(e){this._getPasswordPolicyInternal()||await this._updatePasswordPolicy();const t=this._getPasswordPolicyInternal();return t.schemaVersion!==this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION?Promise.reject(this._errorFactory.create("unsupported-password-policy-schema-version",{})):t.validatePassword(e)}_getPasswordPolicyInternal(){return this.tenantId===null?this._projectPasswordPolicy:this._tenantPasswordPolicies[this.tenantId]}async _updatePasswordPolicy(){const e=await Ri(this),t=new Si(e);this.tenantId===null?this._projectPasswordPolicy=t:this._tenantPasswordPolicies[this.tenantId]=t}_getPersistenceType(){return this.assertedPersistence.persistence.type}_getPersistence(){return this.assertedPersistence.persistence}_updateErrorMap(e){this._errorFactory=new tt("auth","Firebase",e())}onAuthStateChanged(e,t,i){return this.registerStateListener(this.authStateSubscription,e,t,i)}beforeAuthStateChanged(e,t){return this.beforeStateQueue.pushCallback(e,t)}onIdTokenChanged(e,t,i){return this.registerStateListener(this.idTokenSubscription,e,t,i)}authStateReady(){return new Promise((e,t)=>{if(this.currentUser)e();else{const i=this.onAuthStateChanged(()=>{i(),e()},t)}})}async revokeAccessToken(e){if(this.currentUser){const t=await this.currentUser.getIdToken(),i={providerId:"apple.com",tokenType:"ACCESS_TOKEN",token:e,idToken:t};this.tenantId!=null&&(i.tenantId=this.tenantId),await wi(this,i)}}toJSON(){var e;return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:(e=this._currentUser)==null?void 0:e.toJSON()}}async _setRedirectUser(e,t){const i=await this.getOrInitRedirectPersistenceManager(t);return e===null?i.removeCurrentUser():i.setCurrentUser(e)}async getOrInitRedirectPersistenceManager(e){if(!this.redirectPersistenceManager){const t=e&&k(e)||this._popupRedirectResolver;u(t,this,"argument-error"),this.redirectPersistenceManager=await G.create(this,[k(t._redirectPersistence)],"redirectUser"),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager}async _redirectUserForId(e){var t,i;return this._isInitialized&&await this.queue(async()=>{}),((t=this._currentUser)==null?void 0:t._redirectEventId)===e?this._currentUser:((i=this.redirectUser)==null?void 0:i._redirectEventId)===e?this.redirectUser:null}async _persistUserIfCurrent(e){if(e===this.currentUser)return this.queue(async()=>this.directlySetCurrentUser(e))}_notifyListenersIfCurrent(e){e===this.currentUser&&this.notifyAuthListeners()}_key(){return`${this.config.authDomain}:${this.config.apiKey}:${this.name}`}_startProactiveRefresh(){this.isProactiveRefreshEnabled=!0,this.currentUser&&this._currentUser._startProactiveRefresh()}_stopProactiveRefresh(){this.isProactiveRefreshEnabled=!1,this.currentUser&&this._currentUser._stopProactiveRefresh()}get _currentUser(){return this.currentUser}notifyAuthListeners(){var t;if(!this._isInitialized)return;this.idTokenSubscription.next(this.currentUser);const e=((t=this.currentUser)==null?void 0:t.uid)??null;this.lastNotifiedUid!==e&&(this.lastNotifiedUid=e,this.authStateSubscription.next(this.currentUser))}registerStateListener(e,t,i,r){if(this._deleted)return()=>{};const s=typeof t=="function"?t:t.next.bind(t);let o=!1;const a=this._isInitialized?Promise.resolve():this._initializationPromise;if(u(a,this,"internal-error"),a.then(()=>{o||s(this.currentUser)}).catch(c=>{if(!o)if(typeof t!="function"&&t.error)t.error(c);else if(i)i(c);else throw c}),typeof t=="function"){const c=e.addObserver(t,i,r);return()=>{o=!0,c()}}else{const c=e.addObserver(t);return()=>{o=!0,c()}}}async directlySetCurrentUser(e){if(this.currentUser&&this.currentUser!==e&&this._currentUser._stopProactiveRefresh(),e&&this.isProactiveRefreshEnabled&&e._startProactiveRefresh(),this.currentUser=e,this.persistenceManager)try{e?await this.persistenceManager.setCurrentUser(e):await this.persistenceManager.removeCurrentUser()}catch(t){const i=(t==null?void 0:t.message)||String(t),r=Le(this,"internal-error",`An internal AuthError has occurred: ${i}`);throw r.customData={originalError:t},r}}queue(e){return this.operations=this.operations.then(e,e),this.operations}get assertedPersistence(){return u(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(e){!e||this.frameworks.includes(e)||(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=pn(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){var r;const e={"X-Client-Version":this.clientVersion};this.app.options.appId&&(e["X-Firebase-gmpid"]=this.app.options.appId);const t=await((r=this.heartbeatServiceProvider.getImmediate({optional:!0}))==null?void 0:r.getHeartbeatsHeader());t&&(e["X-Firebase-Client"]=t);const i=await this._getAppCheckToken();return i&&(e["X-Firebase-AppCheck"]=i),e}async _getAppCheckToken(){var t;if(I(this.app)&&this.app.settings.appCheckToken)return this.app.settings.appCheckToken;const e=await((t=this.appCheckServiceProvider.getImmediate({optional:!0}))==null?void 0:t.getToken());return e!=null&&e.error&&ye(`Error while retrieving App Check token: ${e.error}`),e==null?void 0:e.token}}function _(n){return h(n)}class bt{constructor(e){this.auth=e,this.observer=null,this.addObserver=ni(t=>this.observer=t)}get next(){return u(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}/**
|
|
482
|
+
* @license
|
|
483
|
+
* Copyright 2020 Google LLC
|
|
484
|
+
*
|
|
485
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
486
|
+
* you may not use this file except in compliance with the License.
|
|
487
|
+
* You may obtain a copy of the License at
|
|
488
|
+
*
|
|
489
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
490
|
+
*
|
|
491
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
492
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
493
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
494
|
+
* See the License for the specific language governing permissions and
|
|
495
|
+
* limitations under the License.
|
|
496
|
+
*/let me={async loadJS(){throw new Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function Ni(n){me=n}function ot(n){return me.loadJS(n)}function Ci(){return me.recaptchaV2Script}function bi(){return me.recaptchaEnterpriseScript}function Oi(){return me.gapiScript}function mn(n){return`__${n}${Math.floor(Math.random()*1e6)}`}/**
|
|
497
|
+
* @license
|
|
498
|
+
* Copyright 2020 Google LLC
|
|
499
|
+
*
|
|
500
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
501
|
+
* you may not use this file except in compliance with the License.
|
|
502
|
+
* You may obtain a copy of the License at
|
|
503
|
+
*
|
|
504
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
505
|
+
*
|
|
506
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
507
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
508
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
509
|
+
* See the License for the specific language governing permissions and
|
|
510
|
+
* limitations under the License.
|
|
511
|
+
*/const Li=500,Di=6e4,Te=1e12;class Mi{constructor(e){this.auth=e,this.counter=Te,this._widgets=new Map}render(e,t){const i=this.counter;return this._widgets.set(i,new Vi(e,this.auth.name,t||{})),this.counter++,i}reset(e){var i;const t=e||Te;(i=this._widgets.get(t))==null||i.delete(),this._widgets.delete(t)}getResponse(e){var i;const t=e||Te;return((i=this._widgets.get(t))==null?void 0:i.getResponse())||""}async execute(e){var i;const t=e||Te;return(i=this._widgets.get(t))==null||i.execute(),""}}class Ui{constructor(){this.enterprise=new Fi}ready(e){e()}execute(e,t){return Promise.resolve("token")}render(e,t){return""}}class Fi{ready(e){e()}execute(e,t){return Promise.resolve("token")}render(e,t){return""}}class Vi{constructor(e,t,i){this.params=i,this.timerId=null,this.deleted=!1,this.responseToken=null,this.clickHandler=()=>{this.execute()};const r=typeof e=="string"?document.getElementById(e):e;u(r,"argument-error",{appName:t}),this.container=r,this.isVisible=this.params.size!=="invisible",this.isVisible?this.execute():this.container.addEventListener("click",this.clickHandler)}getResponse(){return this.checkIfDeleted(),this.responseToken}delete(){this.checkIfDeleted(),this.deleted=!0,this.timerId&&(clearTimeout(this.timerId),this.timerId=null),this.container.removeEventListener("click",this.clickHandler)}execute(){this.checkIfDeleted(),!this.timerId&&(this.timerId=window.setTimeout(()=>{this.responseToken=Hi(50);const{callback:e,"expired-callback":t}=this.params;if(e)try{e(this.responseToken)}catch{}this.timerId=window.setTimeout(()=>{if(this.timerId=null,this.responseToken=null,t)try{t()}catch{}this.isVisible&&this.execute()},Di)},Li))}checkIfDeleted(){if(this.deleted)throw new Error("reCAPTCHA mock was already deleted!")}}function Hi(n){const e=[],t="1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";for(let i=0;i<n;i++)e.push(t.charAt(Math.floor(Math.random()*t.length)));return e.join("")}/**
|
|
512
|
+
* @license
|
|
513
|
+
* Copyright 2022 Google LLC
|
|
514
|
+
*
|
|
515
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
516
|
+
* you may not use this file except in compliance with the License.
|
|
517
|
+
* You may obtain a copy of the License at
|
|
518
|
+
*
|
|
519
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
520
|
+
*
|
|
521
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
522
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
523
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
524
|
+
* See the License for the specific language governing permissions and
|
|
525
|
+
* limitations under the License.
|
|
526
|
+
*/const xi="recaptcha-enterprise",oe="NO_RECAPTCHA",Ot="onFirebaseAuthREInstanceReady";class S{constructor(e){this.type=xi,this.auth=_(e)}async verify(e="verify",t=!1){async function i(s){if(!t){if(s.tenantId==null&&s._agentRecaptchaConfig!=null)return s._agentRecaptchaConfig.siteKey;if(s.tenantId!=null&&s._tenantRecaptchaConfigs[s.tenantId]!==void 0)return s._tenantRecaptchaConfigs[s.tenantId].siteKey}return new Promise(async(o,a)=>{nn(s,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}).then(c=>{if(c.recaptchaKey===void 0)a(new Error("recaptcha Enterprise site key undefined"));else{const l=new tn(c);return s.tenantId==null?s._agentRecaptchaConfig=l:s._tenantRecaptchaConfigs[s.tenantId]=l,o(l.siteKey)}}).catch(c=>{a(c)})})}function r(s,o,a){const c=window.grecaptcha;Pt(c)?c.enterprise.ready(()=>{c.enterprise.execute(s,{action:e}).then(l=>{o(l)}).catch(()=>{o(oe)})}):a(Error("No reCAPTCHA enterprise script loaded."))}return this.auth.settings.appVerificationDisabledForTesting?new Ui().execute("siteKey",{action:"verify"}):new Promise((s,o)=>{i(this.auth).then(async a=>{if(!t&&Pt(window.grecaptcha)&&S.scriptInjectionDeferred)await S.scriptInjectionDeferred.promise,r(a,s,o);else{if(typeof window>"u"){o(new Error("RecaptchaVerifier is only supported in browser"));return}let c=bi();c.length!==0&&(c+=a+`&onload=${Ot}`),S.scriptInjectionDeferred=new Zn,window[Ot]=()=>{var l;(l=S.scriptInjectionDeferred)==null||l.resolve()},ot(c).then(()=>{var l;return(l=S.scriptInjectionDeferred)==null?void 0:l.promise}).then(()=>{r(a,s,o)}).catch(l=>{o(l)})}}).catch(a=>{o(a)})})}}S.scriptInjectionDeferred=null;async function te(n,e,t,i=!1,r=!1){const s=new S(n);let o;if(r)o=oe;else try{o=await s.verify(t)}catch{o=await s.verify(t,!0)}const a={...e};if(t==="mfaSmsEnrollment"||t==="mfaSmsSignIn"){if("phoneEnrollmentInfo"in a){const c=a.phoneEnrollmentInfo.phoneNumber,l=a.phoneEnrollmentInfo.recaptchaToken;Object.assign(a,{phoneEnrollmentInfo:{phoneNumber:c,recaptchaToken:l,captchaResponse:o,clientType:"CLIENT_TYPE_WEB",recaptchaVersion:"RECAPTCHA_ENTERPRISE"}})}else if("phoneSignInInfo"in a){const c=a.phoneSignInInfo.recaptchaToken;Object.assign(a,{phoneSignInInfo:{recaptchaToken:c,captchaResponse:o,clientType:"CLIENT_TYPE_WEB",recaptchaVersion:"RECAPTCHA_ENTERPRISE"}})}return a}return i?Object.assign(a,{captchaResp:o}):Object.assign(a,{captchaResponse:o}),Object.assign(a,{clientType:"CLIENT_TYPE_WEB"}),Object.assign(a,{recaptchaVersion:"RECAPTCHA_ENTERPRISE"}),a}async function W(n,e,t,i,r){var s,o;if(r==="EMAIL_PASSWORD_PROVIDER")if((s=n._getRecaptchaConfig())!=null&&s.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")){const a=await te(n,e,t,t==="getOobCode");return i(n,a)}else return i(n,e).catch(async a=>{if(a.code==="auth/missing-recaptcha-token"){console.log(`${t} is protected by reCAPTCHA Enterprise for this project. Automatically triggering the reCAPTCHA flow and restarting the flow.`);const c=await te(n,e,t,t==="getOobCode");return i(n,c)}else return Promise.reject(a)});else if(r==="PHONE_PROVIDER")if((o=n._getRecaptchaConfig())!=null&&o.isProviderEnabled("PHONE_PROVIDER")){const a=await te(n,e,t);return i(n,a).catch(async c=>{var l;if(((l=n._getRecaptchaConfig())==null?void 0:l.getProviderEnforcementState("PHONE_PROVIDER"))==="AUDIT"&&(c.code==="auth/missing-recaptcha-token"||c.code==="auth/invalid-app-credential")){console.log(`Failed to verify with reCAPTCHA Enterprise. Automatically triggering the reCAPTCHA v2 flow to complete the ${t} flow.`);const d=await te(n,e,t,!1,!0);return i(n,d)}return Promise.reject(c)})}else{const a=await te(n,e,t,!1,!0);return i(n,a)}else return Promise.reject(r+" provider is not supported.")}async function gn(n){const e=_(n),t=await nn(e,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}),i=new tn(t);e.tenantId==null?e._agentRecaptchaConfig=i:e._tenantRecaptchaConfigs[e.tenantId]=i,i.isAnyProviderEnabled()&&new S(e).verify()}/**
|
|
527
|
+
* @license
|
|
528
|
+
* Copyright 2020 Google LLC
|
|
529
|
+
*
|
|
530
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
531
|
+
* you may not use this file except in compliance with the License.
|
|
532
|
+
* You may obtain a copy of the License at
|
|
533
|
+
*
|
|
534
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
535
|
+
*
|
|
536
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
537
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
538
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
539
|
+
* See the License for the specific language governing permissions and
|
|
540
|
+
* limitations under the License.
|
|
541
|
+
*/function Wi(n,e){const t=jt(n,"auth");if(t.isInitialized()){const r=t.getImmediate(),s=t.getOptions();if(Je(s,e??{}))return r;y(r,"already-initialized")}return t.initialize({options:e})}function qi(n,e){const t=(e==null?void 0:e.persistence)||[],i=(Array.isArray(t)?t:[t]).map(k);e!=null&&e.errorMap&&n._updateErrorMap(e.errorMap),n._initializeWithPersistence(i,e==null?void 0:e.popupRedirectResolver)}function Gi(n,e,t){const i=_(n);u(/^https?:\/\//.test(e),i,"invalid-emulator-scheme");const r=!!(t!=null&&t.disableWarnings),s=In(e),{host:o,port:a}=zi(e),c=a===null?"":`:${a}`,l={url:`${s}//${o}${c}/`},d=Object.freeze({host:o,port:a,protocol:s.replace(":",""),options:Object.freeze({disableWarnings:r})});if(!i._canInitEmulator){u(i.config.emulator&&i.emulatorConfig,i,"emulator-config-failed"),u(Je(l,i.config.emulator)&&Je(d,i.emulatorConfig),i,"emulator-config-failed");return}i.config.emulator=l,i.emulatorConfig=d,i.settings.appVerificationDisabledForTesting=!0,Ze(o)?zn(`${s}//${o}${c}`):r||Ki()}function In(n){const e=n.indexOf(":");return e<0?"":n.substr(0,e+1)}function zi(n){const e=In(n),t=/(\/\/)?([^?#/]+)/.exec(n.substr(e.length));if(!t)return{host:"",port:null};const i=t[2].split("@").pop()||"",r=/^(\[[^\]]+\])(:|$)/.exec(i);if(r){const s=r[1];return{host:s,port:Lt(i.substr(s.length+1))}}else{const[s,o]=i.split(":");return{host:s,port:Lt(o)}}}function Lt(n){if(!n)return null;const e=Number(n);return isNaN(e)?null:e}function Ki(){function n(){const e=document.createElement("p"),t=e.style;e.innerText="Running in emulator mode. Do not use with production credentials.",t.position="fixed",t.width="100%",t.backgroundColor="#ffffff",t.border=".1em solid #000000",t.color="#b50000",t.bottom="0px",t.left="0px",t.margin="0px",t.zIndex="10000",t.textAlign="center",e.classList.add("firebase-emulator-warning"),document.body.appendChild(e)}typeof console<"u"&&typeof console.info=="function"&&console.info("WARNING: You are using the Auth Emulator, which is intended for local testing only. Do not use with production credentials."),typeof window<"u"&&typeof document<"u"&&(document.readyState==="loading"?window.addEventListener("DOMContentLoaded",n):n())}/**
|
|
542
|
+
* @license
|
|
543
|
+
* Copyright 2020 Google LLC
|
|
544
|
+
*
|
|
545
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
546
|
+
* you may not use this file except in compliance with the License.
|
|
547
|
+
* You may obtain a copy of the License at
|
|
548
|
+
*
|
|
549
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
550
|
+
*
|
|
551
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
552
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
553
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
554
|
+
* See the License for the specific language governing permissions and
|
|
555
|
+
* limitations under the License.
|
|
556
|
+
*/class ge{constructor(e,t){this.providerId=e,this.signInMethod=t}toJSON(){return P("not implemented")}_getIdTokenResponse(e){return P("not implemented")}_linkToIdToken(e,t){return P("not implemented")}_getReauthenticationResolver(e){return P("not implemented")}}/**
|
|
557
|
+
* @license
|
|
558
|
+
* Copyright 2020 Google LLC
|
|
559
|
+
*
|
|
560
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
561
|
+
* you may not use this file except in compliance with the License.
|
|
562
|
+
* You may obtain a copy of the License at
|
|
563
|
+
*
|
|
564
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
565
|
+
*
|
|
566
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
567
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
568
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
569
|
+
* See the License for the specific language governing permissions and
|
|
570
|
+
* limitations under the License.
|
|
571
|
+
*/async function _n(n,e){return m(n,"POST","/v1/accounts:resetPassword",p(n,e))}async function $i(n,e){return m(n,"POST","/v1/accounts:update",e)}async function ji(n,e){return m(n,"POST","/v1/accounts:signUp",e)}async function Bi(n,e){return m(n,"POST","/v1/accounts:update",p(n,e))}/**
|
|
572
|
+
* @license
|
|
573
|
+
* Copyright 2020 Google LLC
|
|
574
|
+
*
|
|
575
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
576
|
+
* you may not use this file except in compliance with the License.
|
|
577
|
+
* You may obtain a copy of the License at
|
|
578
|
+
*
|
|
579
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
580
|
+
*
|
|
581
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
582
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
583
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
584
|
+
* See the License for the specific language governing permissions and
|
|
585
|
+
* limitations under the License.
|
|
586
|
+
*/async function Yi(n,e){return D(n,"POST","/v1/accounts:signInWithPassword",p(n,e))}async function Me(n,e){return m(n,"POST","/v1/accounts:sendOobCode",p(n,e))}async function Ji(n,e){return Me(n,e)}async function Xi(n,e){return Me(n,e)}async function Qi(n,e){return Me(n,e)}async function Zi(n,e){return Me(n,e)}/**
|
|
587
|
+
* @license
|
|
588
|
+
* Copyright 2020 Google LLC
|
|
589
|
+
*
|
|
590
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
591
|
+
* you may not use this file except in compliance with the License.
|
|
592
|
+
* You may obtain a copy of the License at
|
|
593
|
+
*
|
|
594
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
595
|
+
*
|
|
596
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
597
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
598
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
599
|
+
* See the License for the specific language governing permissions and
|
|
600
|
+
* limitations under the License.
|
|
601
|
+
*/async function er(n,e){return D(n,"POST","/v1/accounts:signInWithEmailLink",p(n,e))}async function tr(n,e){return D(n,"POST","/v1/accounts:signInWithEmailLink",p(n,e))}/**
|
|
602
|
+
* @license
|
|
603
|
+
* Copyright 2020 Google LLC
|
|
604
|
+
*
|
|
605
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
606
|
+
* you may not use this file except in compliance with the License.
|
|
607
|
+
* You may obtain a copy of the License at
|
|
608
|
+
*
|
|
609
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
610
|
+
*
|
|
611
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
612
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
613
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
614
|
+
* See the License for the specific language governing permissions and
|
|
615
|
+
* limitations under the License.
|
|
616
|
+
*/class le extends ge{constructor(e,t,i,r=null){super("password",i),this._email=e,this._password=t,this._tenantId=r}static _fromEmailAndPassword(e,t){return new le(e,t,"password")}static _fromEmailAndCode(e,t,i=null){return new le(e,t,"emailLink",i)}toJSON(){return{email:this._email,password:this._password,signInMethod:this.signInMethod,tenantId:this._tenantId}}static fromJSON(e){const t=typeof e=="string"?JSON.parse(e):e;if(t!=null&&t.email&&(t!=null&&t.password)){if(t.signInMethod==="password")return this._fromEmailAndPassword(t.email,t.password);if(t.signInMethod==="emailLink")return this._fromEmailAndCode(t.email,t.password,t.tenantId)}return null}async _getIdTokenResponse(e){switch(this.signInMethod){case"password":const t={returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"};return W(e,t,"signInWithPassword",Yi,"EMAIL_PASSWORD_PROVIDER");case"emailLink":return er(e,{email:this._email,oobCode:this._password});default:y(e,"internal-error")}}async _linkToIdToken(e,t){switch(this.signInMethod){case"password":const i={idToken:t,returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"};return W(e,i,"signUpPassword",ji,"EMAIL_PASSWORD_PROVIDER");case"emailLink":return tr(e,{idToken:t,email:this._email,oobCode:this._password});default:y(e,"internal-error")}}_getReauthenticationResolver(e){return this._getIdTokenResponse(e)}}/**
|
|
617
|
+
* @license
|
|
618
|
+
* Copyright 2020 Google LLC
|
|
619
|
+
*
|
|
620
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
621
|
+
* you may not use this file except in compliance with the License.
|
|
622
|
+
* You may obtain a copy of the License at
|
|
623
|
+
*
|
|
624
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
625
|
+
*
|
|
626
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
627
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
628
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
629
|
+
* See the License for the specific language governing permissions and
|
|
630
|
+
* limitations under the License.
|
|
631
|
+
*/async function C(n,e){return D(n,"POST","/v1/accounts:signInWithIdp",p(n,e))}/**
|
|
632
|
+
* @license
|
|
633
|
+
* Copyright 2020 Google LLC
|
|
634
|
+
*
|
|
635
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
636
|
+
* you may not use this file except in compliance with the License.
|
|
637
|
+
* You may obtain a copy of the License at
|
|
638
|
+
*
|
|
639
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
640
|
+
*
|
|
641
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
642
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
643
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
644
|
+
* See the License for the specific language governing permissions and
|
|
645
|
+
* limitations under the License.
|
|
646
|
+
*/const nr="http://localhost";class L extends ge{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(e){const t=new L(e.providerId,e.signInMethod);return e.idToken||e.accessToken?(e.idToken&&(t.idToken=e.idToken),e.accessToken&&(t.accessToken=e.accessToken),e.nonce&&!e.pendingToken&&(t.nonce=e.nonce),e.pendingToken&&(t.pendingToken=e.pendingToken)):e.oauthToken&&e.oauthTokenSecret?(t.accessToken=e.oauthToken,t.secret=e.oauthTokenSecret):y("argument-error"),t}toJSON(){return{idToken:this.idToken,accessToken:this.accessToken,secret:this.secret,nonce:this.nonce,pendingToken:this.pendingToken,providerId:this.providerId,signInMethod:this.signInMethod}}static fromJSON(e){const t=typeof e=="string"?JSON.parse(e):e,{providerId:i,signInMethod:r,...s}=t;if(!i||!r)return null;const o=new L(i,r);return o.idToken=s.idToken||void 0,o.accessToken=s.accessToken||void 0,o.secret=s.secret,o.nonce=s.nonce,o.pendingToken=s.pendingToken||null,o}_getIdTokenResponse(e){const t=this.buildRequest();return C(e,t)}_linkToIdToken(e,t){const i=this.buildRequest();return i.idToken=t,C(e,i)}_getReauthenticationResolver(e){const t=this.buildRequest();return t.autoCreate=!1,C(e,t)}buildRequest(){const e={requestUri:nr,returnSecureToken:!0};if(this.pendingToken)e.pendingToken=this.pendingToken;else{const t={};this.idToken&&(t.id_token=this.idToken),this.accessToken&&(t.access_token=this.accessToken),this.secret&&(t.oauth_token_secret=this.secret),t.providerId=this.providerId,this.nonce&&!this.pendingToken&&(t.nonce=this.nonce),e.postBody=X(t)}return e}}/**
|
|
647
|
+
* @license
|
|
648
|
+
* Copyright 2020 Google LLC
|
|
649
|
+
*
|
|
650
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
651
|
+
* you may not use this file except in compliance with the License.
|
|
652
|
+
* You may obtain a copy of the License at
|
|
653
|
+
*
|
|
654
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
655
|
+
*
|
|
656
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
657
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
658
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
659
|
+
* See the License for the specific language governing permissions and
|
|
660
|
+
* limitations under the License.
|
|
661
|
+
*/async function Dt(n,e){return m(n,"POST","/v1/accounts:sendVerificationCode",p(n,e))}async function ir(n,e){return D(n,"POST","/v1/accounts:signInWithPhoneNumber",p(n,e))}async function rr(n,e){const t=await D(n,"POST","/v1/accounts:signInWithPhoneNumber",p(n,e));if(t.temporaryProof)throw re(n,"account-exists-with-different-credential",t);return t}const sr={USER_NOT_FOUND:"user-not-found"};async function or(n,e){const t={...e,operation:"REAUTH"};return D(n,"POST","/v1/accounts:signInWithPhoneNumber",p(n,t),sr)}/**
|
|
662
|
+
* @license
|
|
663
|
+
* Copyright 2020 Google LLC
|
|
664
|
+
*
|
|
665
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
666
|
+
* you may not use this file except in compliance with the License.
|
|
667
|
+
* You may obtain a copy of the License at
|
|
668
|
+
*
|
|
669
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
670
|
+
*
|
|
671
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
672
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
673
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
674
|
+
* See the License for the specific language governing permissions and
|
|
675
|
+
* limitations under the License.
|
|
676
|
+
*/class z extends ge{constructor(e){super("phone","phone"),this.params=e}static _fromVerification(e,t){return new z({verificationId:e,verificationCode:t})}static _fromTokenResponse(e,t){return new z({phoneNumber:e,temporaryProof:t})}_getIdTokenResponse(e){return ir(e,this._makeVerificationRequest())}_linkToIdToken(e,t){return rr(e,{idToken:t,...this._makeVerificationRequest()})}_getReauthenticationResolver(e){return or(e,this._makeVerificationRequest())}_makeVerificationRequest(){const{temporaryProof:e,phoneNumber:t,verificationId:i,verificationCode:r}=this.params;return e&&t?{temporaryProof:e,phoneNumber:t}:{sessionInfo:i,code:r}}toJSON(){const e={providerId:this.providerId};return this.params.phoneNumber&&(e.phoneNumber=this.params.phoneNumber),this.params.temporaryProof&&(e.temporaryProof=this.params.temporaryProof),this.params.verificationCode&&(e.verificationCode=this.params.verificationCode),this.params.verificationId&&(e.verificationId=this.params.verificationId),e}static fromJSON(e){typeof e=="string"&&(e=JSON.parse(e));const{verificationId:t,verificationCode:i,phoneNumber:r,temporaryProof:s}=e;return!i&&!t&&!r&&!s?null:new z({verificationId:t,verificationCode:i,phoneNumber:r,temporaryProof:s})}}/**
|
|
677
|
+
* @license
|
|
678
|
+
* Copyright 2020 Google LLC
|
|
679
|
+
*
|
|
680
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
681
|
+
* you may not use this file except in compliance with the License.
|
|
682
|
+
* You may obtain a copy of the License at
|
|
683
|
+
*
|
|
684
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
685
|
+
*
|
|
686
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
687
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
688
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
689
|
+
* See the License for the specific language governing permissions and
|
|
690
|
+
* limitations under the License.
|
|
691
|
+
*/function ar(n){switch(n){case"recoverEmail":return"RECOVER_EMAIL";case"resetPassword":return"PASSWORD_RESET";case"signIn":return"EMAIL_SIGNIN";case"verifyEmail":return"VERIFY_EMAIL";case"verifyAndChangeEmail":return"VERIFY_AND_CHANGE_EMAIL";case"revertSecondFactorAddition":return"REVERT_SECOND_FACTOR_ADDITION";default:return null}}function cr(n){const e=ne(ie(n)).link,t=e?ne(ie(e)).deep_link_id:null,i=ne(ie(n)).deep_link_id;return(i?ne(ie(i)).link:null)||i||t||e||n}class Ie{constructor(e){const t=ne(ie(e)),i=t.apiKey??null,r=t.oobCode??null,s=ar(t.mode??null);u(i&&r&&s,"argument-error"),this.apiKey=i,this.operation=s,this.code=r,this.continueUrl=t.continueUrl??null,this.languageCode=t.lang??null,this.tenantId=t.tenantId??null}static parseLink(e){const t=cr(e);try{return new Ie(t)}catch{return null}}}function ro(n){return Ie.parseLink(n)}/**
|
|
692
|
+
* @license
|
|
693
|
+
* Copyright 2020 Google LLC
|
|
694
|
+
*
|
|
695
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
696
|
+
* you may not use this file except in compliance with the License.
|
|
697
|
+
* You may obtain a copy of the License at
|
|
698
|
+
*
|
|
699
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
700
|
+
*
|
|
701
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
702
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
703
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
704
|
+
* See the License for the specific language governing permissions and
|
|
705
|
+
* limitations under the License.
|
|
706
|
+
*/class K{constructor(){this.providerId=K.PROVIDER_ID}static credential(e,t){return le._fromEmailAndPassword(e,t)}static credentialWithLink(e,t){const i=Ie.parseLink(t);return u(i,"argument-error"),le._fromEmailAndCode(e,i.code,i.tenantId)}}K.PROVIDER_ID="password";K.EMAIL_PASSWORD_SIGN_IN_METHOD="password";K.EMAIL_LINK_SIGN_IN_METHOD="emailLink";/**
|
|
707
|
+
* @license
|
|
708
|
+
* Copyright 2020 Google LLC
|
|
709
|
+
*
|
|
710
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
711
|
+
* you may not use this file except in compliance with the License.
|
|
712
|
+
* You may obtain a copy of the License at
|
|
713
|
+
*
|
|
714
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
715
|
+
*
|
|
716
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
717
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
718
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
719
|
+
* See the License for the specific language governing permissions and
|
|
720
|
+
* limitations under the License.
|
|
721
|
+
*/class M{constructor(e){this.providerId=e,this.defaultLanguageCode=null,this.customParameters={}}setDefaultLanguage(e){this.defaultLanguageCode=e}setCustomParameters(e){return this.customParameters=e,this}getCustomParameters(){return this.customParameters}}/**
|
|
722
|
+
* @license
|
|
723
|
+
* Copyright 2019 Google LLC
|
|
724
|
+
*
|
|
725
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
726
|
+
* you may not use this file except in compliance with the License.
|
|
727
|
+
* You may obtain a copy of the License at
|
|
728
|
+
*
|
|
729
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
730
|
+
*
|
|
731
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
732
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
733
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
734
|
+
* See the License for the specific language governing permissions and
|
|
735
|
+
* limitations under the License.
|
|
736
|
+
*/class Z extends M{constructor(){super(...arguments),this.scopes=[]}addScope(e){return this.scopes.includes(e)||this.scopes.push(e),this}getScopes(){return[...this.scopes]}}class Re extends Z{static credentialFromJSON(e){const t=typeof e=="string"?JSON.parse(e):e;return u("providerId"in t&&"signInMethod"in t,"argument-error"),L._fromParams(t)}credential(e){return this._credential({...e,nonce:e.rawNonce})}_credential(e){return u(e.idToken||e.accessToken,"argument-error"),L._fromParams({...e,providerId:this.providerId,signInMethod:this.providerId})}static credentialFromResult(e){return Re.oauthCredentialFromTaggedObject(e)}static credentialFromError(e){return Re.oauthCredentialFromTaggedObject(e.customData||{})}static oauthCredentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthIdToken:t,oauthAccessToken:i,oauthTokenSecret:r,pendingToken:s,nonce:o,providerId:a}=e;if(!i&&!r&&!t&&!s||!a)return null;try{return new Re(a)._credential({idToken:t,accessToken:i,nonce:o,pendingToken:s})}catch{return null}}}/**
|
|
737
|
+
* @license
|
|
738
|
+
* Copyright 2020 Google LLC
|
|
739
|
+
*
|
|
740
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
741
|
+
* you may not use this file except in compliance with the License.
|
|
742
|
+
* You may obtain a copy of the License at
|
|
743
|
+
*
|
|
744
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
745
|
+
*
|
|
746
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
747
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
748
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
749
|
+
* See the License for the specific language governing permissions and
|
|
750
|
+
* limitations under the License.
|
|
751
|
+
*/class F extends Z{constructor(){super("facebook.com")}static credential(e){return L._fromParams({providerId:F.PROVIDER_ID,signInMethod:F.FACEBOOK_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return F.credentialFromTaggedObject(e)}static credentialFromError(e){return F.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return F.credential(e.oauthAccessToken)}catch{return null}}}F.FACEBOOK_SIGN_IN_METHOD="facebook.com";F.PROVIDER_ID="facebook.com";/**
|
|
752
|
+
* @license
|
|
753
|
+
* Copyright 2020 Google LLC
|
|
754
|
+
*
|
|
755
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
756
|
+
* you may not use this file except in compliance with the License.
|
|
757
|
+
* You may obtain a copy of the License at
|
|
758
|
+
*
|
|
759
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
760
|
+
*
|
|
761
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
762
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
763
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
764
|
+
* See the License for the specific language governing permissions and
|
|
765
|
+
* limitations under the License.
|
|
766
|
+
*/class V extends Z{constructor(){super("google.com"),this.addScope("profile")}static credential(e,t){return L._fromParams({providerId:V.PROVIDER_ID,signInMethod:V.GOOGLE_SIGN_IN_METHOD,idToken:e,accessToken:t})}static credentialFromResult(e){return V.credentialFromTaggedObject(e)}static credentialFromError(e){return V.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthIdToken:t,oauthAccessToken:i}=e;if(!t&&!i)return null;try{return V.credential(t,i)}catch{return null}}}V.GOOGLE_SIGN_IN_METHOD="google.com";V.PROVIDER_ID="google.com";/**
|
|
767
|
+
* @license
|
|
768
|
+
* Copyright 2020 Google LLC
|
|
769
|
+
*
|
|
770
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
771
|
+
* you may not use this file except in compliance with the License.
|
|
772
|
+
* You may obtain a copy of the License at
|
|
773
|
+
*
|
|
774
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
775
|
+
*
|
|
776
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
777
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
778
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
779
|
+
* See the License for the specific language governing permissions and
|
|
780
|
+
* limitations under the License.
|
|
781
|
+
*/class H extends Z{constructor(){super("github.com")}static credential(e){return L._fromParams({providerId:H.PROVIDER_ID,signInMethod:H.GITHUB_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return H.credentialFromTaggedObject(e)}static credentialFromError(e){return H.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return H.credential(e.oauthAccessToken)}catch{return null}}}H.GITHUB_SIGN_IN_METHOD="github.com";H.PROVIDER_ID="github.com";/**
|
|
782
|
+
* @license
|
|
783
|
+
* Copyright 2020 Google LLC
|
|
784
|
+
*
|
|
785
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
786
|
+
* you may not use this file except in compliance with the License.
|
|
787
|
+
* You may obtain a copy of the License at
|
|
788
|
+
*
|
|
789
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
790
|
+
*
|
|
791
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
792
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
793
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
794
|
+
* See the License for the specific language governing permissions and
|
|
795
|
+
* limitations under the License.
|
|
796
|
+
*/const ur="http://localhost";class de extends ge{constructor(e,t){super(e,e),this.pendingToken=t}_getIdTokenResponse(e){const t=this.buildRequest();return C(e,t)}_linkToIdToken(e,t){const i=this.buildRequest();return i.idToken=t,C(e,i)}_getReauthenticationResolver(e){const t=this.buildRequest();return t.autoCreate=!1,C(e,t)}toJSON(){return{signInMethod:this.signInMethod,providerId:this.providerId,pendingToken:this.pendingToken}}static fromJSON(e){const t=typeof e=="string"?JSON.parse(e):e,{providerId:i,signInMethod:r,pendingToken:s}=t;return!i||!r||!s||i!==r?null:new de(i,s)}static _create(e,t){return new de(e,t)}buildRequest(){return{requestUri:ur,returnSecureToken:!0,pendingToken:this.pendingToken}}}/**
|
|
797
|
+
* @license
|
|
798
|
+
* Copyright 2020 Google LLC
|
|
799
|
+
*
|
|
800
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
801
|
+
* you may not use this file except in compliance with the License.
|
|
802
|
+
* You may obtain a copy of the License at
|
|
803
|
+
*
|
|
804
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
805
|
+
*
|
|
806
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
807
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
808
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
809
|
+
* See the License for the specific language governing permissions and
|
|
810
|
+
* limitations under the License.
|
|
811
|
+
*/const lr="saml.";class Qe extends M{constructor(e){u(e.startsWith(lr),"argument-error"),super(e)}static credentialFromResult(e){return Qe.samlCredentialFromTaggedObject(e)}static credentialFromError(e){return Qe.samlCredentialFromTaggedObject(e.customData||{})}static credentialFromJSON(e){const t=de.fromJSON(e);return u(t,"argument-error"),t}static samlCredentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{pendingToken:t,providerId:i}=e;if(!t||!i)return null;try{return de._create(i,t)}catch{return null}}}/**
|
|
812
|
+
* @license
|
|
813
|
+
* Copyright 2020 Google LLC
|
|
814
|
+
*
|
|
815
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
816
|
+
* you may not use this file except in compliance with the License.
|
|
817
|
+
* You may obtain a copy of the License at
|
|
818
|
+
*
|
|
819
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
820
|
+
*
|
|
821
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
822
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
823
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
824
|
+
* See the License for the specific language governing permissions and
|
|
825
|
+
* limitations under the License.
|
|
826
|
+
*/class x extends Z{constructor(){super("twitter.com")}static credential(e,t){return L._fromParams({providerId:x.PROVIDER_ID,signInMethod:x.TWITTER_SIGN_IN_METHOD,oauthToken:e,oauthTokenSecret:t})}static credentialFromResult(e){return x.credentialFromTaggedObject(e)}static credentialFromError(e){return x.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthAccessToken:t,oauthTokenSecret:i}=e;if(!t||!i)return null;try{return x.credential(t,i)}catch{return null}}}x.TWITTER_SIGN_IN_METHOD="twitter.com";x.PROVIDER_ID="twitter.com";/**
|
|
827
|
+
* @license
|
|
828
|
+
* Copyright 2020 Google LLC
|
|
829
|
+
*
|
|
830
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
831
|
+
* you may not use this file except in compliance with the License.
|
|
832
|
+
* You may obtain a copy of the License at
|
|
833
|
+
*
|
|
834
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
835
|
+
*
|
|
836
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
837
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
838
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
839
|
+
* See the License for the specific language governing permissions and
|
|
840
|
+
* limitations under the License.
|
|
841
|
+
*/async function En(n,e){return D(n,"POST","/v1/accounts:signUp",p(n,e))}/**
|
|
842
|
+
* @license
|
|
843
|
+
* Copyright 2020 Google LLC
|
|
844
|
+
*
|
|
845
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
846
|
+
* you may not use this file except in compliance with the License.
|
|
847
|
+
* You may obtain a copy of the License at
|
|
848
|
+
*
|
|
849
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
850
|
+
*
|
|
851
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
852
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
853
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
854
|
+
* See the License for the specific language governing permissions and
|
|
855
|
+
* limitations under the License.
|
|
856
|
+
*/class A{constructor(e){this.user=e.user,this.providerId=e.providerId,this._tokenResponse=e._tokenResponse,this.operationType=e.operationType}static async _fromIdTokenResponse(e,t,i,r=!1){const s=await R._fromIdTokenResponse(e,i,r),o=Mt(i);return new A({user:s,providerId:o,_tokenResponse:i,operationType:t})}static async _forOperation(e,t,i){await e._updateTokensIfNecessary(i,!0);const r=Mt(i);return new A({user:e,providerId:r,_tokenResponse:i,operationType:t})}}function Mt(n){return n.providerId?n.providerId:"phoneNumber"in n?"phone":null}/**
|
|
857
|
+
* @license
|
|
858
|
+
* Copyright 2020 Google LLC
|
|
859
|
+
*
|
|
860
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
861
|
+
* you may not use this file except in compliance with the License.
|
|
862
|
+
* You may obtain a copy of the License at
|
|
863
|
+
*
|
|
864
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
865
|
+
*
|
|
866
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
867
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
868
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
869
|
+
* See the License for the specific language governing permissions and
|
|
870
|
+
* limitations under the License.
|
|
871
|
+
*/async function so(n){var r;if(I(n.app))return Promise.reject(T(n));const e=_(n);if(await e._initializationPromise,(r=e.currentUser)!=null&&r.isAnonymous)return new A({user:e.currentUser,providerId:null,operationType:"signIn"});const t=await En(e,{returnSecureToken:!0}),i=await A._fromIdTokenResponse(e,"signIn",t,!0);return await e._updateCurrentUser(i.user),i}/**
|
|
872
|
+
* @license
|
|
873
|
+
* Copyright 2020 Google LLC
|
|
874
|
+
*
|
|
875
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
876
|
+
* you may not use this file except in compliance with the License.
|
|
877
|
+
* You may obtain a copy of the License at
|
|
878
|
+
*
|
|
879
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
880
|
+
*
|
|
881
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
882
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
883
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
884
|
+
* See the License for the specific language governing permissions and
|
|
885
|
+
* limitations under the License.
|
|
886
|
+
*/class Ce extends et{constructor(e,t,i,r){super(t.code,t.message),this.operationType=i,this.user=r,Object.setPrototypeOf(this,Ce.prototype),this.customData={appName:e.name,tenantId:e.tenantId??void 0,_serverResponse:t.customData._serverResponse,operationType:i}}static _fromErrorAndOperation(e,t,i,r){return new Ce(e,t,i,r)}}function Tn(n,e,t,i){return(e==="reauthenticate"?t._getReauthenticationResolver(n):t._getIdTokenResponse(n)).catch(s=>{throw s.code==="auth/multi-factor-auth-required"?Ce._fromErrorAndOperation(n,s,e,i):s})}/**
|
|
887
|
+
* @license
|
|
888
|
+
* Copyright 2020 Google LLC
|
|
889
|
+
*
|
|
890
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
891
|
+
* you may not use this file except in compliance with the License.
|
|
892
|
+
* You may obtain a copy of the License at
|
|
893
|
+
*
|
|
894
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
895
|
+
*
|
|
896
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
897
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
898
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
899
|
+
* See the License for the specific language governing permissions and
|
|
900
|
+
* limitations under the License.
|
|
901
|
+
*/function wn(n){return new Set(n.map(({providerId:e})=>e).filter(e=>!!e))}/**
|
|
902
|
+
* @license
|
|
903
|
+
* Copyright 2019 Google LLC
|
|
904
|
+
*
|
|
905
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
906
|
+
* you may not use this file except in compliance with the License.
|
|
907
|
+
* You may obtain a copy of the License at
|
|
908
|
+
*
|
|
909
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
910
|
+
*
|
|
911
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
912
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
913
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
914
|
+
* See the License for the specific language governing permissions and
|
|
915
|
+
* limitations under the License.
|
|
916
|
+
*/async function oo(n,e){const t=h(n);await Ue(!0,t,e);const{providerUserInfo:i}=await pi(t.auth,{idToken:await t.getIdToken(),deleteProvider:[e]}),r=wn(i||[]);return t.providerData=t.providerData.filter(s=>r.has(s.providerId)),r.has("phone")||(t.phoneNumber=null),await t.auth._persistUserIfCurrent(t),t}async function at(n,e,t=!1){const i=await O(n,e._linkToIdToken(n.auth,await n.getIdToken()),t);return A._forOperation(n,"link",i)}async function Ue(n,e,t){await ue(e);const i=wn(e.providerData),r=n===!1?"provider-already-linked":"no-such-provider";u(i.has(t)===n,e.auth,r)}/**
|
|
917
|
+
* @license
|
|
918
|
+
* Copyright 2019 Google LLC
|
|
919
|
+
*
|
|
920
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
921
|
+
* you may not use this file except in compliance with the License.
|
|
922
|
+
* You may obtain a copy of the License at
|
|
923
|
+
*
|
|
924
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
925
|
+
*
|
|
926
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
927
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
928
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
929
|
+
* See the License for the specific language governing permissions and
|
|
930
|
+
* limitations under the License.
|
|
931
|
+
*/async function yn(n,e,t=!1){const{auth:i}=n;if(I(i.app))return Promise.reject(T(i));const r="reauthenticate";try{const s=await O(n,Tn(i,r,e,n),t);u(s.idToken,i,"internal-error");const o=De(s.idToken);u(o,i,"internal-error");const{sub:a}=o;return u(n.uid===a,i,"user-mismatch"),A._forOperation(n,r,s)}catch(s){throw(s==null?void 0:s.code)==="auth/user-not-found"&&y(i,"user-mismatch"),s}}/**
|
|
932
|
+
* @license
|
|
933
|
+
* Copyright 2020 Google LLC
|
|
934
|
+
*
|
|
935
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
936
|
+
* you may not use this file except in compliance with the License.
|
|
937
|
+
* You may obtain a copy of the License at
|
|
938
|
+
*
|
|
939
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
940
|
+
*
|
|
941
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
942
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
943
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
944
|
+
* See the License for the specific language governing permissions and
|
|
945
|
+
* limitations under the License.
|
|
946
|
+
*/async function vn(n,e,t=!1){if(I(n.app))return Promise.reject(T(n));const i="signIn",r=await Tn(n,i,e),s=await A._fromIdTokenResponse(n,i,r);return t||await n._updateCurrentUser(s.user),s}async function ct(n,e){return vn(_(n),e)}async function dr(n,e){const t=h(n);return await Ue(!1,t,e.providerId),at(t,e)}async function hr(n,e){return yn(h(n),e)}/**
|
|
947
|
+
* @license
|
|
948
|
+
* Copyright 2020 Google LLC
|
|
949
|
+
*
|
|
950
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
951
|
+
* you may not use this file except in compliance with the License.
|
|
952
|
+
* You may obtain a copy of the License at
|
|
953
|
+
*
|
|
954
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
955
|
+
*
|
|
956
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
957
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
958
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
959
|
+
* See the License for the specific language governing permissions and
|
|
960
|
+
* limitations under the License.
|
|
961
|
+
*/async function fr(n,e){return D(n,"POST","/v1/accounts:signInWithCustomToken",p(n,e))}/**
|
|
962
|
+
* @license
|
|
963
|
+
* Copyright 2020 Google LLC
|
|
964
|
+
*
|
|
965
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
966
|
+
* you may not use this file except in compliance with the License.
|
|
967
|
+
* You may obtain a copy of the License at
|
|
968
|
+
*
|
|
969
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
970
|
+
*
|
|
971
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
972
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
973
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
974
|
+
* See the License for the specific language governing permissions and
|
|
975
|
+
* limitations under the License.
|
|
976
|
+
*/async function ao(n,e){if(I(n.app))return Promise.reject(T(n));const t=_(n),i=await fr(t,{token:e,returnSecureToken:!0}),r=await A._fromIdTokenResponse(t,"signIn",i);return await t._updateCurrentUser(r.user),r}/**
|
|
977
|
+
* @license
|
|
978
|
+
* Copyright 2020 Google LLC
|
|
979
|
+
*
|
|
980
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
981
|
+
* you may not use this file except in compliance with the License.
|
|
982
|
+
* You may obtain a copy of the License at
|
|
983
|
+
*
|
|
984
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
985
|
+
*
|
|
986
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
987
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
988
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
989
|
+
* See the License for the specific language governing permissions and
|
|
990
|
+
* limitations under the License.
|
|
991
|
+
*/class _e{constructor(e,t){this.factorId=e,this.uid=t.mfaEnrollmentId,this.enrollmentTime=new Date(t.enrolledAt).toUTCString(),this.displayName=t.displayName}static _fromServerResponse(e,t){return"phoneInfo"in t?ut._fromServerResponse(e,t):"totpInfo"in t?lt._fromServerResponse(e,t):y(e,"internal-error")}}class ut extends _e{constructor(e){super("phone",e),this.phoneNumber=e.phoneInfo}static _fromServerResponse(e,t){return new ut(t)}}class lt extends _e{constructor(e){super("totp",e)}static _fromServerResponse(e,t){return new lt(t)}}/**
|
|
992
|
+
* @license
|
|
993
|
+
* Copyright 2020 Google LLC
|
|
994
|
+
*
|
|
995
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
996
|
+
* you may not use this file except in compliance with the License.
|
|
997
|
+
* You may obtain a copy of the License at
|
|
998
|
+
*
|
|
999
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1000
|
+
*
|
|
1001
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1002
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1003
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1004
|
+
* See the License for the specific language governing permissions and
|
|
1005
|
+
* limitations under the License.
|
|
1006
|
+
*/function Fe(n,e,t){var i;u(((i=t.url)==null?void 0:i.length)>0,n,"invalid-continue-uri"),u(typeof t.dynamicLinkDomain>"u"||t.dynamicLinkDomain.length>0,n,"invalid-dynamic-link-domain"),u(typeof t.linkDomain>"u"||t.linkDomain.length>0,n,"invalid-hosting-link-domain"),e.continueUrl=t.url,e.dynamicLinkDomain=t.dynamicLinkDomain,e.linkDomain=t.linkDomain,e.canHandleCodeInApp=t.handleCodeInApp,t.iOS&&(u(t.iOS.bundleId.length>0,n,"missing-ios-bundle-id"),e.iOSBundleId=t.iOS.bundleId),t.android&&(u(t.android.packageName.length>0,n,"missing-android-pkg-name"),e.androidInstallApp=t.android.installApp,e.androidMinimumVersionCode=t.android.minimumVersion,e.androidPackageName=t.android.packageName)}/**
|
|
1007
|
+
* @license
|
|
1008
|
+
* Copyright 2020 Google LLC
|
|
1009
|
+
*
|
|
1010
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1011
|
+
* you may not use this file except in compliance with the License.
|
|
1012
|
+
* You may obtain a copy of the License at
|
|
1013
|
+
*
|
|
1014
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1015
|
+
*
|
|
1016
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1017
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1018
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1019
|
+
* See the License for the specific language governing permissions and
|
|
1020
|
+
* limitations under the License.
|
|
1021
|
+
*/async function dt(n){const e=_(n);e._getPasswordPolicyInternal()&&await e._updatePasswordPolicy()}async function co(n,e,t){const i=_(n),r={requestType:"PASSWORD_RESET",email:e,clientType:"CLIENT_TYPE_WEB"};t&&Fe(i,r,t),await W(i,r,"getOobCode",Xi,"EMAIL_PASSWORD_PROVIDER")}async function uo(n,e,t){await _n(h(n),{oobCode:e,newPassword:t}).catch(async i=>{throw i.code==="auth/password-does-not-meet-requirements"&&dt(n),i})}async function lo(n,e){await Bi(h(n),{oobCode:e})}async function pr(n,e){const t=h(n),i=await _n(t,{oobCode:e}),r=i.requestType;switch(u(r,t,"internal-error"),r){case"EMAIL_SIGNIN":break;case"VERIFY_AND_CHANGE_EMAIL":u(i.newEmail,t,"internal-error");break;case"REVERT_SECOND_FACTOR_ADDITION":u(i.mfaInfo,t,"internal-error");default:u(i.email,t,"internal-error")}let s=null;return i.mfaInfo&&(s=_e._fromServerResponse(_(t),i.mfaInfo)),{data:{email:(i.requestType==="VERIFY_AND_CHANGE_EMAIL"?i.newEmail:i.email)||null,previousEmail:(i.requestType==="VERIFY_AND_CHANGE_EMAIL"?i.email:i.newEmail)||null,multiFactorInfo:s},operation:r}}async function ho(n,e){const{data:t}=await pr(h(n),e);return t.email}async function fo(n,e,t){if(I(n.app))return Promise.reject(T(n));const i=_(n),o=await W(i,{returnSecureToken:!0,email:e,password:t,clientType:"CLIENT_TYPE_WEB"},"signUpPassword",En,"EMAIL_PASSWORD_PROVIDER").catch(c=>{throw c.code==="auth/password-does-not-meet-requirements"&&dt(n),c}),a=await A._fromIdTokenResponse(i,"signIn",o);return await i._updateCurrentUser(a.user),a}function po(n,e,t){return I(n.app)?Promise.reject(T(n)):ct(h(n),K.credential(e,t)).catch(async i=>{throw i.code==="auth/password-does-not-meet-requirements"&&dt(n),i})}/**
|
|
1022
|
+
* @license
|
|
1023
|
+
* Copyright 2020 Google LLC
|
|
1024
|
+
*
|
|
1025
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1026
|
+
* you may not use this file except in compliance with the License.
|
|
1027
|
+
* You may obtain a copy of the License at
|
|
1028
|
+
*
|
|
1029
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1030
|
+
*
|
|
1031
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1032
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1033
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1034
|
+
* See the License for the specific language governing permissions and
|
|
1035
|
+
* limitations under the License.
|
|
1036
|
+
*/async function mo(n,e,t){const i=_(n),r={requestType:"EMAIL_SIGNIN",email:e,clientType:"CLIENT_TYPE_WEB"};function s(o,a){u(a.handleCodeInApp,i,"argument-error"),a&&Fe(i,o,a)}s(r,t),await W(i,r,"getOobCode",Qi,"EMAIL_PASSWORD_PROVIDER")}function go(n,e){const t=Ie.parseLink(e);return(t==null?void 0:t.operation)==="EMAIL_SIGNIN"}async function Io(n,e,t){if(I(n.app))return Promise.reject(T(n));const i=h(n),r=K.credentialWithLink(e,t||ce());return u(r._tenantId===(i.tenantId||null),i,"tenant-id-mismatch"),ct(i,r)}/**
|
|
1037
|
+
* @license
|
|
1038
|
+
* Copyright 2020 Google LLC
|
|
1039
|
+
*
|
|
1040
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1041
|
+
* you may not use this file except in compliance with the License.
|
|
1042
|
+
* You may obtain a copy of the License at
|
|
1043
|
+
*
|
|
1044
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1045
|
+
*
|
|
1046
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1047
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1048
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1049
|
+
* See the License for the specific language governing permissions and
|
|
1050
|
+
* limitations under the License.
|
|
1051
|
+
*/async function mr(n,e){return m(n,"POST","/v1/accounts:createAuthUri",p(n,e))}/**
|
|
1052
|
+
* @license
|
|
1053
|
+
* Copyright 2020 Google LLC
|
|
1054
|
+
*
|
|
1055
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1056
|
+
* you may not use this file except in compliance with the License.
|
|
1057
|
+
* You may obtain a copy of the License at
|
|
1058
|
+
*
|
|
1059
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1060
|
+
*
|
|
1061
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1062
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1063
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1064
|
+
* See the License for the specific language governing permissions and
|
|
1065
|
+
* limitations under the License.
|
|
1066
|
+
*/async function _o(n,e){const t=it()?ce():"http://localhost",i={identifier:e,continueUri:t},{signinMethods:r}=await mr(h(n),i);return r||[]}async function Eo(n,e){const t=h(n),r={requestType:"VERIFY_EMAIL",idToken:await n.getIdToken()};e&&Fe(t.auth,r,e);const{email:s}=await Ji(t.auth,r);s!==n.email&&await n.reload()}async function To(n,e,t){const i=h(n),s={requestType:"VERIFY_AND_CHANGE_EMAIL",idToken:await n.getIdToken(),newEmail:e};t&&Fe(i.auth,s,t);const{email:o}=await Zi(i.auth,s);o!==n.email&&await n.reload()}/**
|
|
1067
|
+
* @license
|
|
1068
|
+
* Copyright 2020 Google LLC
|
|
1069
|
+
*
|
|
1070
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1071
|
+
* you may not use this file except in compliance with the License.
|
|
1072
|
+
* You may obtain a copy of the License at
|
|
1073
|
+
*
|
|
1074
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1075
|
+
*
|
|
1076
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1077
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1078
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1079
|
+
* See the License for the specific language governing permissions and
|
|
1080
|
+
* limitations under the License.
|
|
1081
|
+
*/async function gr(n,e){return m(n,"POST","/v1/accounts:update",e)}/**
|
|
1082
|
+
* @license
|
|
1083
|
+
* Copyright 2020 Google LLC
|
|
1084
|
+
*
|
|
1085
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1086
|
+
* you may not use this file except in compliance with the License.
|
|
1087
|
+
* You may obtain a copy of the License at
|
|
1088
|
+
*
|
|
1089
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1090
|
+
*
|
|
1091
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1092
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1093
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1094
|
+
* See the License for the specific language governing permissions and
|
|
1095
|
+
* limitations under the License.
|
|
1096
|
+
*/async function wo(n,e){const{displayName:t,photoURL:i}=e;if(t===void 0&&i===void 0)return;const r=h(n),o={idToken:await r.getIdToken(),displayName:t,photoUrl:i,returnSecureToken:!0},a=await O(r,gr(r.auth,o));r.displayName=a.displayName||null,r.photoURL=a.photoUrl||null;const c=r.providerData.find(({providerId:l})=>l==="password");c&&(c.displayName=r.displayName,c.photoURL=r.photoURL),await r._updateTokensIfNecessary(a)}function yo(n,e){const t=h(n);return I(t.auth.app)?Promise.reject(T(t.auth)):An(t,e,null)}function vo(n,e){return An(h(n),null,e)}async function An(n,e,t){const{auth:i}=n,s={idToken:await n.getIdToken(),returnSecureToken:!0};e&&(s.email=e),t&&(s.password=t);const o=await O(n,$i(i,s));await n._updateTokensIfNecessary(o,!0)}/**
|
|
1097
|
+
* @license
|
|
1098
|
+
* Copyright 2019 Google LLC
|
|
1099
|
+
*
|
|
1100
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1101
|
+
* you may not use this file except in compliance with the License.
|
|
1102
|
+
* You may obtain a copy of the License at
|
|
1103
|
+
*
|
|
1104
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1105
|
+
*
|
|
1106
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1107
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1108
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1109
|
+
* See the License for the specific language governing permissions and
|
|
1110
|
+
* limitations under the License.
|
|
1111
|
+
*/function Ir(n){var r,s;if(!n)return null;const{providerId:e}=n,t=n.rawUserInfo?JSON.parse(n.rawUserInfo):{},i=n.isNewUser||n.kind==="identitytoolkit#SignupNewUserResponse";if(!e&&(n!=null&&n.idToken)){const o=(s=(r=De(n.idToken))==null?void 0:r.firebase)==null?void 0:s.sign_in_provider;if(o){const a=o!=="anonymous"&&o!=="custom"?o:null;return new Y(i,a)}}if(!e)return null;switch(e){case"facebook.com":return new _r(i,t);case"github.com":return new Er(i,t);case"google.com":return new Tr(i,t);case"twitter.com":return new wr(i,t,n.screenName||null);case"custom":case"anonymous":return new Y(i,null);default:return new Y(i,e,t)}}class Y{constructor(e,t,i={}){this.isNewUser=e,this.providerId=t,this.profile=i}}class Rn extends Y{constructor(e,t,i,r){super(e,t,i),this.username=r}}class _r extends Y{constructor(e,t){super(e,"facebook.com",t)}}class Er extends Rn{constructor(e,t){super(e,"github.com",t,typeof(t==null?void 0:t.login)=="string"?t==null?void 0:t.login:null)}}class Tr extends Y{constructor(e,t){super(e,"google.com",t)}}class wr extends Rn{constructor(e,t,i){super(e,"twitter.com",t,i)}}function Ao(n){const{user:e,_tokenResponse:t}=n;return e.isAnonymous&&!t?{providerId:null,isNewUser:!1,profile:null}:Ir(t)}/**
|
|
1112
|
+
* @license
|
|
1113
|
+
* Copyright 2020 Google LLC
|
|
1114
|
+
*
|
|
1115
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1116
|
+
* you may not use this file except in compliance with the License.
|
|
1117
|
+
* You may obtain a copy of the License at
|
|
1118
|
+
*
|
|
1119
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1120
|
+
*
|
|
1121
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1122
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1123
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1124
|
+
* See the License for the specific language governing permissions and
|
|
1125
|
+
* limitations under the License.
|
|
1126
|
+
*/function Ro(n,e){return h(n).setPersistence(e)}function Po(n){return gn(n)}async function So(n,e){return _(n).validatePassword(e)}function yr(n,e,t,i){return h(n).onIdTokenChanged(e,t,i)}function vr(n,e,t){return h(n).beforeAuthStateChanged(e,t)}function ko(n,e,t,i){return h(n).onAuthStateChanged(e,t,i)}function No(n){h(n).useDeviceLanguage()}function Co(n,e){return h(n).updateCurrentUser(e)}function bo(n){return h(n).signOut()}function Oo(n,e){return _(n).revokeAccessToken(e)}async function Lo(n){return h(n).delete()}/**
|
|
1127
|
+
* @license
|
|
1128
|
+
* Copyright 2020 Google LLC
|
|
1129
|
+
*
|
|
1130
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1131
|
+
* you may not use this file except in compliance with the License.
|
|
1132
|
+
* You may obtain a copy of the License at
|
|
1133
|
+
*
|
|
1134
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1135
|
+
*
|
|
1136
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1137
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1138
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1139
|
+
* See the License for the specific language governing permissions and
|
|
1140
|
+
* limitations under the License.
|
|
1141
|
+
*/class q{constructor(e,t,i){this.type=e,this.credential=t,this.user=i}static _fromIdtoken(e,t){return new q("enroll",e,t)}static _fromMfaPendingCredential(e){return new q("signin",e)}toJSON(){return{multiFactorSession:{[this.type==="enroll"?"idToken":"pendingCredential"]:this.credential}}}static fromJSON(e){var t,i;if(e!=null&&e.multiFactorSession){if((t=e.multiFactorSession)!=null&&t.pendingCredential)return q._fromMfaPendingCredential(e.multiFactorSession.pendingCredential);if((i=e.multiFactorSession)!=null&&i.idToken)return q._fromIdtoken(e.multiFactorSession.idToken)}return null}}/**
|
|
1142
|
+
* @license
|
|
1143
|
+
* Copyright 2020 Google LLC
|
|
1144
|
+
*
|
|
1145
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1146
|
+
* you may not use this file except in compliance with the License.
|
|
1147
|
+
* You may obtain a copy of the License at
|
|
1148
|
+
*
|
|
1149
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1150
|
+
*
|
|
1151
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1152
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1153
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1154
|
+
* See the License for the specific language governing permissions and
|
|
1155
|
+
* limitations under the License.
|
|
1156
|
+
*/class ht{constructor(e,t,i){this.session=e,this.hints=t,this.signInResolver=i}static _fromError(e,t){const i=_(e),r=t.customData._serverResponse,s=(r.mfaInfo||[]).map(a=>_e._fromServerResponse(i,a));u(r.mfaPendingCredential,i,"internal-error");const o=q._fromMfaPendingCredential(r.mfaPendingCredential);return new ht(o,s,async a=>{const c=await a._process(i,o);delete r.mfaInfo,delete r.mfaPendingCredential;const l={...r,idToken:c.idToken,refreshToken:c.refreshToken};switch(t.operationType){case"signIn":const d=await A._fromIdTokenResponse(i,t.operationType,l);return await i._updateCurrentUser(d.user),d;case"reauthenticate":return u(t.user,i,"internal-error"),A._forOperation(t.user,t.operationType,l);default:y(i,"internal-error")}})}async resolveSignIn(e){const t=e;return this.signInResolver(t)}}function Do(n,e){var r;const t=h(n),i=e;return u(e.customData.operationType,t,"argument-error"),u((r=i.customData._serverResponse)==null?void 0:r.mfaPendingCredential,t,"argument-error"),ht._fromError(t,i)}/**
|
|
1157
|
+
* @license
|
|
1158
|
+
* Copyright 2020 Google LLC
|
|
1159
|
+
*
|
|
1160
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1161
|
+
* you may not use this file except in compliance with the License.
|
|
1162
|
+
* You may obtain a copy of the License at
|
|
1163
|
+
*
|
|
1164
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1165
|
+
*
|
|
1166
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1167
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1168
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1169
|
+
* See the License for the specific language governing permissions and
|
|
1170
|
+
* limitations under the License.
|
|
1171
|
+
*/function Ut(n,e){return m(n,"POST","/v2/accounts/mfaEnrollment:start",p(n,e))}function Ar(n,e){return m(n,"POST","/v2/accounts/mfaEnrollment:finalize",p(n,e))}function Rr(n,e){return m(n,"POST","/v2/accounts/mfaEnrollment:start",p(n,e))}function Pr(n,e){return m(n,"POST","/v2/accounts/mfaEnrollment:finalize",p(n,e))}function Sr(n,e){return m(n,"POST","/v2/accounts/mfaEnrollment:withdraw",p(n,e))}class ft{constructor(e){this.user=e,this.enrolledFactors=[],e._onReload(t=>{t.mfaInfo&&(this.enrolledFactors=t.mfaInfo.map(i=>_e._fromServerResponse(e.auth,i)))})}static _fromUser(e){return new ft(e)}async getSession(){return q._fromIdtoken(await this.user.getIdToken(),this.user)}async enroll(e,t){const i=e,r=await this.getSession(),s=await O(this.user,i._process(this.user.auth,r,t));return await this.user._updateTokensIfNecessary(s),this.user.reload()}async unenroll(e){const t=typeof e=="string"?e:e.uid,i=await this.user.getIdToken();try{const r=await O(this.user,Sr(this.user.auth,{idToken:i,mfaEnrollmentId:t}));this.enrolledFactors=this.enrolledFactors.filter(({uid:s})=>s!==t),await this.user._updateTokensIfNecessary(r),await this.user.reload()}catch(r){throw r}}}const ze=new WeakMap;function Mo(n){const e=h(n);return ze.has(e)||ze.set(e,ft._fromUser(e)),ze.get(e)}const be="__sak";/**
|
|
1172
|
+
* @license
|
|
1173
|
+
* Copyright 2019 Google LLC
|
|
1174
|
+
*
|
|
1175
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1176
|
+
* you may not use this file except in compliance with the License.
|
|
1177
|
+
* You may obtain a copy of the License at
|
|
1178
|
+
*
|
|
1179
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1180
|
+
*
|
|
1181
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1182
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1183
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1184
|
+
* See the License for the specific language governing permissions and
|
|
1185
|
+
* limitations under the License.
|
|
1186
|
+
*/class Pn{constructor(e,t){this.storageRetriever=e,this.type=t}_isAvailable(){try{return this.storage?(this.storage.setItem(be,"1"),this.storage.removeItem(be),Promise.resolve(!0)):Promise.resolve(!1)}catch{return Promise.resolve(!1)}}_set(e,t){return this.storage.setItem(e,JSON.stringify(t)),Promise.resolve()}_get(e){const t=this.storage.getItem(e);return Promise.resolve(t?JSON.parse(t):null)}_remove(e){return this.storage.removeItem(e),Promise.resolve()}get storage(){return this.storageRetriever()}}/**
|
|
1187
|
+
* @license
|
|
1188
|
+
* Copyright 2020 Google LLC
|
|
1189
|
+
*
|
|
1190
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1191
|
+
* you may not use this file except in compliance with the License.
|
|
1192
|
+
* You may obtain a copy of the License at
|
|
1193
|
+
*
|
|
1194
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1195
|
+
*
|
|
1196
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1197
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1198
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1199
|
+
* See the License for the specific language governing permissions and
|
|
1200
|
+
* limitations under the License.
|
|
1201
|
+
*/const kr=1e3,Nr=10;class Sn extends Pn{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(e,t)=>this.onStorageEvent(e,t),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=fn(),this._shouldAllowMigration=!0}forAllChangedKeys(e){for(const t of Object.keys(this.listeners)){const i=this.storage.getItem(t),r=this.localCache[t];i!==r&&e(t,r,i)}}onStorageEvent(e,t=!1){if(!e.key){this.forAllChangedKeys((o,a,c)=>{this.notifyListeners(o,c)});return}const i=e.key;t?this.detachListener():this.stopPolling();const r=()=>{const o=this.storage.getItem(i);!t&&this.localCache[i]===o||this.notifyListeners(i,o)},s=this.storage.getItem(i);vi()&&s!==e.newValue&&e.newValue!==e.oldValue?setTimeout(r,Nr):r()}notifyListeners(e,t){this.localCache[e]=t;const i=this.listeners[e];if(i)for(const r of Array.from(i))r(t&&JSON.parse(t))}startPolling(){this.stopPolling(),this.pollTimer=setInterval(()=>{this.forAllChangedKeys((e,t,i)=>{this.onStorageEvent(new StorageEvent("storage",{key:e,oldValue:t,newValue:i}),!0)})},kr)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}attachListener(){window.addEventListener("storage",this.boundEventHandler)}detachListener(){window.removeEventListener("storage",this.boundEventHandler)}_addListener(e,t){Object.keys(this.listeners).length===0&&(this.fallbackToPolling?this.startPolling():this.attachListener()),this.listeners[e]||(this.listeners[e]=new Set,this.localCache[e]=this.storage.getItem(e)),this.listeners[e].add(t)}_removeListener(e,t){this.listeners[e]&&(this.listeners[e].delete(t),this.listeners[e].size===0&&delete this.listeners[e]),Object.keys(this.listeners).length===0&&(this.detachListener(),this.stopPolling())}async _set(e,t){await super._set(e,t),this.localCache[e]=JSON.stringify(t)}async _get(e){const t=await super._get(e);return this.localCache[e]=JSON.stringify(t),t}async _remove(e){await super._remove(e),delete this.localCache[e]}}Sn.type="LOCAL";const Cr=Sn;/**
|
|
1202
|
+
* @license
|
|
1203
|
+
* Copyright 2025 Google LLC
|
|
1204
|
+
*
|
|
1205
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1206
|
+
* you may not use this file except in compliance with the License.
|
|
1207
|
+
* You may obtain a copy of the License at
|
|
1208
|
+
*
|
|
1209
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1210
|
+
*
|
|
1211
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1212
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1213
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1214
|
+
* See the License for the specific language governing permissions and
|
|
1215
|
+
* limitations under the License.
|
|
1216
|
+
*/const br=1e3;function Ke(n){var i;const e=n.replace(/[\\^$.*+?()[\]{}|]/g,"\\$&"),t=RegExp(`${e}=([^;]+)`);return((i=document.cookie.match(t))==null?void 0:i[1])??null}function $e(n){return`${window.location.protocol==="http:"?"__dev_":"__HOST-"}FIREBASE_${n.split(":")[3]}`}class kn{constructor(){this.type="COOKIE",this.listenerUnsubscribes=new Map}_getFinalTarget(e){if(typeof window===void 0)return e;const t=new URL(`${window.location.origin}/__cookies__`);return t.searchParams.set("finalTarget",e),t}async _isAvailable(){return typeof isSecureContext=="boolean"&&!isSecureContext||typeof navigator>"u"||typeof document>"u"?!1:navigator.cookieEnabled??!0}async _set(e,t){}async _get(e){if(!this._isAvailable())return null;const t=$e(e);if(window.cookieStore){const i=await window.cookieStore.get(t);return i==null?void 0:i.value}return Ke(t)}async _remove(e){if(!this._isAvailable()||!await this._get(e))return;const i=$e(e);document.cookie=`${i}=;Max-Age=34560000;Partitioned;Secure;SameSite=Strict;Path=/;Priority=High`,await fetch("/__cookies__",{method:"DELETE"}).catch(()=>{})}_addListener(e,t){if(!this._isAvailable())return;const i=$e(e);if(window.cookieStore){const a=(l=>{const d=l.changed.find(g=>g.name===i);d&&t(d.value),l.deleted.find(g=>g.name===i)&&t(null)}),c=()=>window.cookieStore.removeEventListener("change",a);return this.listenerUnsubscribes.set(t,c),window.cookieStore.addEventListener("change",a)}let r=Ke(i);const s=setInterval(()=>{const a=Ke(i);a!==r&&(t(a),r=a)},br),o=()=>clearInterval(s);this.listenerUnsubscribes.set(t,o)}_removeListener(e,t){const i=this.listenerUnsubscribes.get(t);i&&(i(),this.listenerUnsubscribes.delete(t))}}kn.type="COOKIE";const Uo=kn;/**
|
|
1217
|
+
* @license
|
|
1218
|
+
* Copyright 2020 Google LLC
|
|
1219
|
+
*
|
|
1220
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1221
|
+
* you may not use this file except in compliance with the License.
|
|
1222
|
+
* You may obtain a copy of the License at
|
|
1223
|
+
*
|
|
1224
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1225
|
+
*
|
|
1226
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1227
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1228
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1229
|
+
* See the License for the specific language governing permissions and
|
|
1230
|
+
* limitations under the License.
|
|
1231
|
+
*/class Nn extends Pn{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(e,t){}_removeListener(e,t){}}Nn.type="SESSION";const Cn=Nn;/**
|
|
1232
|
+
* @license
|
|
1233
|
+
* Copyright 2019 Google LLC
|
|
1234
|
+
*
|
|
1235
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1236
|
+
* you may not use this file except in compliance with the License.
|
|
1237
|
+
* You may obtain a copy of the License at
|
|
1238
|
+
*
|
|
1239
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1240
|
+
*
|
|
1241
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1242
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1243
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1244
|
+
* See the License for the specific language governing permissions and
|
|
1245
|
+
* limitations under the License.
|
|
1246
|
+
*/function Or(n){return Promise.all(n.map(async e=>{try{return{fulfilled:!0,value:await e}}catch(t){return{fulfilled:!1,reason:t}}}))}/**
|
|
1247
|
+
* @license
|
|
1248
|
+
* Copyright 2019 Google LLC
|
|
1249
|
+
*
|
|
1250
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1251
|
+
* you may not use this file except in compliance with the License.
|
|
1252
|
+
* You may obtain a copy of the License at
|
|
1253
|
+
*
|
|
1254
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1255
|
+
*
|
|
1256
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1257
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1258
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1259
|
+
* See the License for the specific language governing permissions and
|
|
1260
|
+
* limitations under the License.
|
|
1261
|
+
*/class Ve{constructor(e){this.eventTarget=e,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(e){const t=this.receivers.find(r=>r.isListeningto(e));if(t)return t;const i=new Ve(e);return this.receivers.push(i),i}isListeningto(e){return this.eventTarget===e}async handleEvent(e){const t=e,{eventId:i,eventType:r,data:s}=t.data,o=this.handlersMap[r];if(!(o!=null&&o.size))return;t.ports[0].postMessage({status:"ack",eventId:i,eventType:r});const a=Array.from(o).map(async l=>l(t.origin,s)),c=await Or(a);t.ports[0].postMessage({status:"done",eventId:i,eventType:r,response:c})}_subscribe(e,t){Object.keys(this.handlersMap).length===0&&this.eventTarget.addEventListener("message",this.boundEventHandler),this.handlersMap[e]||(this.handlersMap[e]=new Set),this.handlersMap[e].add(t)}_unsubscribe(e,t){this.handlersMap[e]&&t&&this.handlersMap[e].delete(t),(!t||this.handlersMap[e].size===0)&&delete this.handlersMap[e],Object.keys(this.handlersMap).length===0&&this.eventTarget.removeEventListener("message",this.boundEventHandler)}}Ve.receivers=[];/**
|
|
1262
|
+
* @license
|
|
1263
|
+
* Copyright 2020 Google LLC
|
|
1264
|
+
*
|
|
1265
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1266
|
+
* you may not use this file except in compliance with the License.
|
|
1267
|
+
* You may obtain a copy of the License at
|
|
1268
|
+
*
|
|
1269
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1270
|
+
*
|
|
1271
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1272
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1273
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1274
|
+
* See the License for the specific language governing permissions and
|
|
1275
|
+
* limitations under the License.
|
|
1276
|
+
*/function He(n="",e=10){let t="";for(let i=0;i<e;i++)t+=Math.floor(Math.random()*10);return n+t}/**
|
|
1277
|
+
* @license
|
|
1278
|
+
* Copyright 2019 Google LLC
|
|
1279
|
+
*
|
|
1280
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1281
|
+
* you may not use this file except in compliance with the License.
|
|
1282
|
+
* You may obtain a copy of the License at
|
|
1283
|
+
*
|
|
1284
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1285
|
+
*
|
|
1286
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1287
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1288
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1289
|
+
* See the License for the specific language governing permissions and
|
|
1290
|
+
* limitations under the License.
|
|
1291
|
+
*/class Lr{constructor(e){this.target=e,this.handlers=new Set}removeMessageHandler(e){e.messageChannel&&(e.messageChannel.port1.removeEventListener("message",e.onMessage),e.messageChannel.port1.close()),this.handlers.delete(e)}async _send(e,t,i=50){const r=typeof MessageChannel<"u"?new MessageChannel:null;if(!r)throw new Error("connection_unavailable");let s,o;return new Promise((a,c)=>{const l=He("",20);r.port1.start();const d=setTimeout(()=>{c(new Error("unsupported_event"))},i);o={messageChannel:r,onMessage(f){const g=f;if(g.data.eventId===l)switch(g.data.status){case"ack":clearTimeout(d),s=setTimeout(()=>{c(new Error("timeout"))},3e3);break;case"done":clearTimeout(s),a(g.data.response);break;default:clearTimeout(d),clearTimeout(s),c(new Error("invalid_response"));break}}},this.handlers.add(o),r.port1.addEventListener("message",o.onMessage),this.target.postMessage({eventType:e,eventId:l,data:t},[r.port2])}).finally(()=>{o&&this.removeMessageHandler(o)})}}/**
|
|
1292
|
+
* @license
|
|
1293
|
+
* Copyright 2020 Google LLC
|
|
1294
|
+
*
|
|
1295
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1296
|
+
* you may not use this file except in compliance with the License.
|
|
1297
|
+
* You may obtain a copy of the License at
|
|
1298
|
+
*
|
|
1299
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1300
|
+
*
|
|
1301
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1302
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1303
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1304
|
+
* See the License for the specific language governing permissions and
|
|
1305
|
+
* limitations under the License.
|
|
1306
|
+
*/function E(){return window}function Dr(n){E().location.href=n}/**
|
|
1307
|
+
* @license
|
|
1308
|
+
* Copyright 2020 Google LLC.
|
|
1309
|
+
*
|
|
1310
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1311
|
+
* you may not use this file except in compliance with the License.
|
|
1312
|
+
* You may obtain a copy of the License at
|
|
1313
|
+
*
|
|
1314
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1315
|
+
*
|
|
1316
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1317
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1318
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1319
|
+
* See the License for the specific language governing permissions and
|
|
1320
|
+
* limitations under the License.
|
|
1321
|
+
*/function pt(){return typeof E().WorkerGlobalScope<"u"&&typeof E().importScripts=="function"}async function Mr(){if(!(navigator!=null&&navigator.serviceWorker))return null;try{return(await navigator.serviceWorker.ready).active}catch{return null}}function Ur(){var n;return((n=navigator==null?void 0:navigator.serviceWorker)==null?void 0:n.controller)||null}function Fr(){return pt()?self:null}/**
|
|
1322
|
+
* @license
|
|
1323
|
+
* Copyright 2019 Google LLC
|
|
1324
|
+
*
|
|
1325
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1326
|
+
* you may not use this file except in compliance with the License.
|
|
1327
|
+
* You may obtain a copy of the License at
|
|
1328
|
+
*
|
|
1329
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1330
|
+
*
|
|
1331
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1332
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1333
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1334
|
+
* See the License for the specific language governing permissions and
|
|
1335
|
+
* limitations under the License.
|
|
1336
|
+
*/const bn="firebaseLocalStorageDb",Vr=1,Oe="firebaseLocalStorage",On="fbase_key";class Ee{constructor(e){this.request=e}toPromise(){return new Promise((e,t)=>{this.request.addEventListener("success",()=>{e(this.request.result)}),this.request.addEventListener("error",()=>{t(this.request.error)})})}}function xe(n,e){return n.transaction([Oe],e?"readwrite":"readonly").objectStore(Oe)}function Hr(){const n=indexedDB.deleteDatabase(bn);return new Ee(n).toPromise()}function Ln(){const n=indexedDB.open(bn,Vr);return new Promise((e,t)=>{n.addEventListener("error",()=>{t(n.error)}),n.addEventListener("upgradeneeded",()=>{const i=n.result;try{i.createObjectStore(Oe,{keyPath:On})}catch(r){t(r)}}),n.addEventListener("success",async()=>{const i=n.result;i.objectStoreNames.contains(Oe)?e(i):(i.close(),await Hr(),e(await Ln()))})})}async function Ft(n,e,t){const i=xe(n,!0).put({[On]:e,value:t});return new Ee(i).toPromise()}async function xr(n,e){const t=xe(n,!1).get(e),i=await new Ee(t).toPromise();return i===void 0?null:i.value}function Vt(n,e){const t=xe(n,!0).delete(e);return new Ee(t).toPromise()}const Wr=800,qr=3;class Dn{registerLifecycleListeners(){typeof window<"u"&&typeof window.addEventListener=="function"&&(window.addEventListener("pagehide",this.onPageHide),window.addEventListener("pageshow",this.onPageShow))}unregisterLifecycleListeners(){typeof window<"u"&&typeof window.removeEventListener=="function"&&(window.removeEventListener("pagehide",this.onPageHide),window.removeEventListener("pageshow",this.onPageShow))}constructor(){this.type="LOCAL",this.dbPromise=null,this._shouldAllowMigration=!0,this.listeners={},this.localCache={},this.pollTimer=null,this.isClosing=!1,this.pendingWrites=0,this.receiver=null,this.sender=null,this.serviceWorkerReceiverAvailable=!1,this.activeServiceWorker=null,this.onPageHide=()=>{this.isClosing=!0,this.stopPolling(),this.dbPromise&&(this.dbPromise.then(e=>e.close()).catch(()=>{}),this.dbPromise=null)},this.onPageShow=()=>{this.isClosing&&(this.isClosing=!1,Object.keys(this.listeners).length>0&&this.startPolling())},this._workerInitializationPromise=this.initializeServiceWorkerMessaging().then(()=>{},()=>{})}async _openDb(){return this.dbPromise?this.dbPromise:(this.dbPromise=Ln(),this.dbPromise.catch(()=>{this.dbPromise=null}),this.dbPromise)}async _withRetries(e){let t=0;for(;;)try{const i=await this._openDb();return await e(i)}catch(i){if(t++>qr)throw i;if(this.dbPromise){const r=this.dbPromise;this.dbPromise=null;try{(await r).close()}catch{}}}}async initializeServiceWorkerMessaging(){return pt()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=Ve._getInstance(Fr()),this.receiver._subscribe("keyChanged",async(e,t)=>({keyProcessed:(await this._poll()).includes(t.key)})),this.receiver._subscribe("ping",async(e,t)=>["keyChanged"])}async initializeSender(){var t,i;if(this.activeServiceWorker=await Mr(),!this.activeServiceWorker)return;this.sender=new Lr(this.activeServiceWorker);const e=await this.sender._send("ping",{},800);e&&(t=e[0])!=null&&t.fulfilled&&(i=e[0])!=null&&i.value.includes("keyChanged")&&(this.serviceWorkerReceiverAvailable=!0)}async notifyServiceWorker(e){if(!(!this.sender||!this.activeServiceWorker||Ur()!==this.activeServiceWorker))try{await this.sender._send("keyChanged",{key:e},this.serviceWorkerReceiverAvailable?800:50)}catch{}}async _isAvailable(){try{return indexedDB?(await this._withRetries(async e=>{await Ft(e,be,"1"),await Vt(e,be)}),!0):!1}catch{}return!1}async _withPendingWrite(e){this.pendingWrites++;try{await e()}finally{this.pendingWrites--}}async _set(e,t){return this._withPendingWrite(async()=>(await this._withRetries(i=>Ft(i,e,t)),this.localCache[e]=t,this.notifyServiceWorker(e)))}async _get(e){const t=await this._withRetries(i=>xr(i,e));return this.localCache[e]=t,t}async _remove(e){return this._withPendingWrite(async()=>(await this._withRetries(t=>Vt(t,e)),delete this.localCache[e],this.notifyServiceWorker(e)))}async _poll(){if(this.isClosing)return[];try{const e=await this._withRetries(r=>{const s=xe(r,!1).getAll();return new Ee(s).toPromise()});if(this.isClosing)return[];if(!e)return[];if(this.pendingWrites!==0)return[];const t=[],i=new Set;if(e.length!==0)for(const{fbase_key:r,value:s}of e)i.add(r),JSON.stringify(this.localCache[r])!==JSON.stringify(s)&&(this.notifyListeners(r,s),t.push(r));for(const r of Object.keys(this.localCache))this.localCache[r]&&!i.has(r)&&(this.notifyListeners(r,null),t.push(r));return t}catch(e){return this.isClosing||ye(`Firebase Auth cross-tab polling failed with error: ${e}`),[]}}notifyListeners(e,t){this.localCache[e]=t;const i=this.listeners[e];if(i)for(const r of Array.from(i))r(t)}startPolling(){this.stopPolling(),this.pollTimer=setInterval(async()=>this._poll(),Wr)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}_addListener(e,t){Object.keys(this.listeners).length===0&&(this.startPolling(),this.registerLifecycleListeners()),this.listeners[e]||(this.listeners[e]=new Set,this._get(e)),this.listeners[e].add(t)}_removeListener(e,t){this.listeners[e]&&(this.listeners[e].delete(t),this.listeners[e].size===0&&delete this.listeners[e]),Object.keys(this.listeners).length===0&&(this.stopPolling(),this.unregisterLifecycleListeners())}}Dn.type="LOCAL";const Gr=Dn;/**
|
|
1337
|
+
* @license
|
|
1338
|
+
* Copyright 2020 Google LLC
|
|
1339
|
+
*
|
|
1340
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1341
|
+
* you may not use this file except in compliance with the License.
|
|
1342
|
+
* You may obtain a copy of the License at
|
|
1343
|
+
*
|
|
1344
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1345
|
+
*
|
|
1346
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1347
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1348
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1349
|
+
* See the License for the specific language governing permissions and
|
|
1350
|
+
* limitations under the License.
|
|
1351
|
+
*/function Ht(n,e){return m(n,"POST","/v2/accounts/mfaSignIn:start",p(n,e))}function zr(n,e){return m(n,"POST","/v2/accounts/mfaSignIn:finalize",p(n,e))}function Kr(n,e){return m(n,"POST","/v2/accounts/mfaSignIn:finalize",p(n,e))}/**
|
|
1352
|
+
* @license
|
|
1353
|
+
* Copyright 2020 Google LLC
|
|
1354
|
+
*
|
|
1355
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1356
|
+
* you may not use this file except in compliance with the License.
|
|
1357
|
+
* You may obtain a copy of the License at
|
|
1358
|
+
*
|
|
1359
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1360
|
+
*
|
|
1361
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1362
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1363
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1364
|
+
* See the License for the specific language governing permissions and
|
|
1365
|
+
* limitations under the License.
|
|
1366
|
+
*/const je=mn("rcb"),$r=new pe(3e4,6e4);class jr{constructor(){var e;this.hostLanguage="",this.counter=0,this.librarySeparatelyLoaded=!!((e=E().grecaptcha)!=null&&e.render)}load(e,t=""){return u(Br(t),e,"argument-error"),this.shouldResolveImmediately(t)&&Rt(E().grecaptcha)?Promise.resolve(E().grecaptcha):new Promise((i,r)=>{const s=E().setTimeout(()=>{r(w(e,"network-request-failed"))},$r.get());E()[je]=()=>{E().clearTimeout(s),delete E()[je];const a=E().grecaptcha;if(!a||!Rt(a)){r(w(e,"internal-error"));return}const c=a.render;a.render=(l,d)=>{const f=c(l,d);return this.counter++,f},this.hostLanguage=t,i(a)};const o=`${Ci()}?${X({onload:je,render:"explicit",hl:t})}`;ot(o).catch(()=>{clearTimeout(s),r(w(e,"internal-error"))})})}clearedOneInstance(){this.counter--}shouldResolveImmediately(e){var t;return!!((t=E().grecaptcha)!=null&&t.render)&&(e===this.hostLanguage||this.counter>0||this.librarySeparatelyLoaded)}}function Br(n){return n.length<=6&&/^\s*[a-zA-Z0-9\-]*\s*$/.test(n)}class Yr{async load(e){return new Mi(e)}clearedOneInstance(){}}/**
|
|
1367
|
+
* @license
|
|
1368
|
+
* Copyright 2020 Google LLC
|
|
1369
|
+
*
|
|
1370
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1371
|
+
* you may not use this file except in compliance with the License.
|
|
1372
|
+
* You may obtain a copy of the License at
|
|
1373
|
+
*
|
|
1374
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1375
|
+
*
|
|
1376
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1377
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1378
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1379
|
+
* See the License for the specific language governing permissions and
|
|
1380
|
+
* limitations under the License.
|
|
1381
|
+
*/const ae="recaptcha",Jr={theme:"light",type:"image"};class Fo{constructor(e,t,i={...Jr}){this.parameters=i,this.type=ae,this.destroyed=!1,this.widgetId=null,this.tokenChangeListeners=new Set,this.renderPromise=null,this.recaptcha=null,this.auth=_(e),this.isInvisible=this.parameters.size==="invisible",u(typeof document<"u",this.auth,"operation-not-supported-in-this-environment");const r=typeof t=="string"?document.getElementById(t):t;u(r,this.auth,"argument-error"),this.container=r,this.parameters.callback=this.makeTokenCallback(this.parameters.callback),this._recaptchaLoader=this.auth.settings.appVerificationDisabledForTesting?new Yr:new jr,this.validateStartingState()}async verify(){this.assertNotDestroyed();const e=await this.render(),t=this.getAssertedRecaptcha(),i=t.getResponse(e);return i||new Promise(r=>{const s=o=>{o&&(this.tokenChangeListeners.delete(s),r(o))};this.tokenChangeListeners.add(s),this.isInvisible&&t.execute(e)})}render(){try{this.assertNotDestroyed()}catch(e){return Promise.reject(e)}return this.renderPromise?this.renderPromise:(this.renderPromise=this.makeRenderPromise().catch(e=>{throw this.renderPromise=null,e}),this.renderPromise)}_reset(){this.assertNotDestroyed(),this.widgetId!==null&&this.getAssertedRecaptcha().reset(this.widgetId)}clear(){this.assertNotDestroyed(),this.destroyed=!0,this._recaptchaLoader.clearedOneInstance(),this.isInvisible||this.container.childNodes.forEach(e=>{this.container.removeChild(e)})}validateStartingState(){u(!this.parameters.sitekey,this.auth,"argument-error"),u(this.isInvisible||!this.container.hasChildNodes(),this.auth,"argument-error"),u(typeof document<"u",this.auth,"operation-not-supported-in-this-environment")}makeTokenCallback(e){return t=>{if(this.tokenChangeListeners.forEach(i=>i(t)),typeof e=="function")e(t);else if(typeof e=="string"){const i=E()[e];typeof i=="function"&&i(t)}}}assertNotDestroyed(){u(!this.destroyed,this.auth,"internal-error")}async makeRenderPromise(){if(await this.init(),!this.widgetId){let e=this.container;if(!this.isInvisible){const t=document.createElement("div");e.appendChild(t),e=t}this.widgetId=this.getAssertedRecaptcha().render(e,this.parameters)}return this.widgetId}async init(){u(it()&&!pt(),this.auth,"internal-error"),await Xr(),this.recaptcha=await this._recaptchaLoader.load(this.auth,this.auth.languageCode||void 0);const e=await hi(this.auth);u(e,this.auth,"internal-error"),this.parameters.sitekey=e}getAssertedRecaptcha(){return u(this.recaptcha,this.auth,"internal-error"),this.recaptcha}}function Xr(){let n=null;return new Promise(e=>{if(document.readyState==="complete"){e();return}n=()=>e(),window.addEventListener("load",n)}).catch(e=>{throw n&&window.removeEventListener("load",n),e})}/**
|
|
1382
|
+
* @license
|
|
1383
|
+
* Copyright 2020 Google LLC
|
|
1384
|
+
*
|
|
1385
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1386
|
+
* you may not use this file except in compliance with the License.
|
|
1387
|
+
* You may obtain a copy of the License at
|
|
1388
|
+
*
|
|
1389
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1390
|
+
*
|
|
1391
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1392
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1393
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1394
|
+
* See the License for the specific language governing permissions and
|
|
1395
|
+
* limitations under the License.
|
|
1396
|
+
*/class mt{constructor(e,t){this.verificationId=e,this.onConfirmation=t}confirm(e){const t=z._fromVerification(this.verificationId,e);return this.onConfirmation(t)}}async function Vo(n,e,t){if(I(n.app))return Promise.reject(T(n));const i=_(n),r=await We(i,e,h(t));return new mt(r,s=>ct(i,s))}async function Ho(n,e,t){const i=h(n);await Ue(!1,i,"phone");const r=await We(i.auth,e,h(t));return new mt(r,s=>dr(i,s))}async function xo(n,e,t){const i=h(n);if(I(i.auth.app))return Promise.reject(T(i.auth));const r=await We(i.auth,e,h(t));return new mt(r,s=>hr(i,s))}async function We(n,e,t){var i;if(!n._getRecaptchaConfig())try{await gn(n)}catch{console.log("Failed to initialize reCAPTCHA Enterprise config. Triggering the reCAPTCHA v2 verification.")}try{let r;if(typeof e=="string"?r={phoneNumber:e}:r=e,"session"in r){const s=r.session;if("phoneNumber"in r){u(s.type==="enroll",n,"internal-error");const o={idToken:s.credential,phoneEnrollmentInfo:{phoneNumber:r.phoneNumber,clientType:"CLIENT_TYPE_WEB"}};return(await W(n,o,"mfaSmsEnrollment",async(d,f)=>{if(f.phoneEnrollmentInfo.captchaResponse===oe){u((t==null?void 0:t.type)===ae,d,"argument-error");const g=await Be(d,f,t);return Ut(d,g)}return Ut(d,f)},"PHONE_PROVIDER").catch(d=>Promise.reject(d))).phoneSessionInfo.sessionInfo}else{u(s.type==="signin",n,"internal-error");const o=((i=r.multiFactorHint)==null?void 0:i.uid)||r.multiFactorUid;u(o,n,"missing-multi-factor-info");const a={mfaPendingCredential:s.credential,mfaEnrollmentId:o,phoneSignInInfo:{clientType:"CLIENT_TYPE_WEB"}};return(await W(n,a,"mfaSmsSignIn",async(f,g)=>{if(g.phoneSignInInfo.captchaResponse===oe){u((t==null?void 0:t.type)===ae,f,"argument-error");const j=await Be(f,g,t);return Ht(f,j)}return Ht(f,g)},"PHONE_PROVIDER").catch(f=>Promise.reject(f))).phoneResponseInfo.sessionInfo}}else{const s={phoneNumber:r.phoneNumber,clientType:"CLIENT_TYPE_WEB"};return(await W(n,s,"sendVerificationCode",async(l,d)=>{if(d.captchaResponse===oe){u((t==null?void 0:t.type)===ae,l,"argument-error");const f=await Be(l,d,t);return Dt(l,f)}return Dt(l,d)},"PHONE_PROVIDER").catch(l=>Promise.reject(l))).sessionInfo}}finally{t==null||t._reset()}}async function Wo(n,e){const t=h(n);if(I(t.auth.app))return Promise.reject(T(t.auth));await at(t,e)}async function Be(n,e,t){u(t.type===ae,n,"argument-error");const i=await t.verify();u(typeof i=="string",n,"argument-error");const r={...e};if("phoneEnrollmentInfo"in r){const s=r.phoneEnrollmentInfo.phoneNumber,o=r.phoneEnrollmentInfo.captchaResponse,a=r.phoneEnrollmentInfo.clientType,c=r.phoneEnrollmentInfo.recaptchaVersion;return Object.assign(r,{phoneEnrollmentInfo:{phoneNumber:s,recaptchaToken:i,captchaResponse:o,clientType:a,recaptchaVersion:c}}),r}else if("phoneSignInInfo"in r){const s=r.phoneSignInInfo.captchaResponse,o=r.phoneSignInInfo.clientType,a=r.phoneSignInInfo.recaptchaVersion;return Object.assign(r,{phoneSignInInfo:{recaptchaToken:i,captchaResponse:s,clientType:o,recaptchaVersion:a}}),r}else return Object.assign(r,{recaptchaToken:i}),r}/**
|
|
1397
|
+
* @license
|
|
1398
|
+
* Copyright 2020 Google LLC
|
|
1399
|
+
*
|
|
1400
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1401
|
+
* you may not use this file except in compliance with the License.
|
|
1402
|
+
* You may obtain a copy of the License at
|
|
1403
|
+
*
|
|
1404
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1405
|
+
*
|
|
1406
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1407
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1408
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1409
|
+
* See the License for the specific language governing permissions and
|
|
1410
|
+
* limitations under the License.
|
|
1411
|
+
*/class J{constructor(e){this.providerId=J.PROVIDER_ID,this.auth=_(e)}verifyPhoneNumber(e,t){return We(this.auth,e,h(t))}static credential(e,t){return z._fromVerification(e,t)}static credentialFromResult(e){const t=e;return J.credentialFromTaggedObject(t)}static credentialFromError(e){return J.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{phoneNumber:t,temporaryProof:i}=e;return t&&i?z._fromTokenResponse(t,i):null}}J.PROVIDER_ID="phone";J.PHONE_SIGN_IN_METHOD="phone";/**
|
|
1412
|
+
* @license
|
|
1413
|
+
* Copyright 2021 Google LLC
|
|
1414
|
+
*
|
|
1415
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1416
|
+
* you may not use this file except in compliance with the License.
|
|
1417
|
+
* You may obtain a copy of the License at
|
|
1418
|
+
*
|
|
1419
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1420
|
+
*
|
|
1421
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1422
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1423
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1424
|
+
* See the License for the specific language governing permissions and
|
|
1425
|
+
* limitations under the License.
|
|
1426
|
+
*/function $(n,e){return e?k(e):(u(n._popupRedirectResolver,n,"argument-error"),n._popupRedirectResolver)}/**
|
|
1427
|
+
* @license
|
|
1428
|
+
* Copyright 2019 Google LLC
|
|
1429
|
+
*
|
|
1430
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1431
|
+
* you may not use this file except in compliance with the License.
|
|
1432
|
+
* You may obtain a copy of the License at
|
|
1433
|
+
*
|
|
1434
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1435
|
+
*
|
|
1436
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1437
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1438
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1439
|
+
* See the License for the specific language governing permissions and
|
|
1440
|
+
* limitations under the License.
|
|
1441
|
+
*/class gt extends ge{constructor(e){super("custom","custom"),this.params=e}_getIdTokenResponse(e){return C(e,this._buildIdpRequest())}_linkToIdToken(e,t){return C(e,this._buildIdpRequest(t))}_getReauthenticationResolver(e){return C(e,this._buildIdpRequest())}_buildIdpRequest(e){const t={requestUri:this.params.requestUri,sessionId:this.params.sessionId,postBody:this.params.postBody,tenantId:this.params.tenantId,pendingToken:this.params.pendingToken,returnSecureToken:!0,returnIdpCredential:!0};return e&&(t.idToken=e),t}}function Qr(n){return vn(n.auth,new gt(n),n.bypassAuthState)}function Zr(n){const{auth:e,user:t}=n;return u(t,e,"internal-error"),yn(t,new gt(n),n.bypassAuthState)}async function es(n){const{auth:e,user:t}=n;return u(t,e,"internal-error"),at(t,new gt(n),n.bypassAuthState)}/**
|
|
1442
|
+
* @license
|
|
1443
|
+
* Copyright 2020 Google LLC
|
|
1444
|
+
*
|
|
1445
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1446
|
+
* you may not use this file except in compliance with the License.
|
|
1447
|
+
* You may obtain a copy of the License at
|
|
1448
|
+
*
|
|
1449
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1450
|
+
*
|
|
1451
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1452
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1453
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1454
|
+
* See the License for the specific language governing permissions and
|
|
1455
|
+
* limitations under the License.
|
|
1456
|
+
*/class Mn{constructor(e,t,i,r,s=!1){this.auth=e,this.resolver=i,this.user=r,this.bypassAuthState=s,this.pendingPromise=null,this.eventManager=null,this.filter=Array.isArray(t)?t:[t]}execute(){return new Promise(async(e,t)=>{this.pendingPromise={resolve:e,reject:t};try{this.eventManager=await this.resolver._initialize(this.auth),await this.onExecution(),this.eventManager.registerConsumer(this)}catch(i){this.reject(i)}})}async onAuthEvent(e){const{urlResponse:t,sessionId:i,postBody:r,tenantId:s,error:o,type:a}=e;if(o){this.reject(o);return}const c={auth:this.auth,requestUri:t,sessionId:i,tenantId:s||void 0,postBody:r||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(a)(c))}catch(l){this.reject(l)}}onError(e){this.reject(e)}getIdpTask(e){switch(e){case"signInViaPopup":case"signInViaRedirect":return Qr;case"linkViaPopup":case"linkViaRedirect":return es;case"reauthViaPopup":case"reauthViaRedirect":return Zr;default:y(this.auth,"internal-error")}}resolve(e){b(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(e),this.unregisterAndCleanUp()}reject(e){b(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.reject(e),this.unregisterAndCleanUp()}unregisterAndCleanUp(){this.eventManager&&this.eventManager.unregisterConsumer(this),this.pendingPromise=null,this.cleanUp()}}/**
|
|
1457
|
+
* @license
|
|
1458
|
+
* Copyright 2020 Google LLC
|
|
1459
|
+
*
|
|
1460
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1461
|
+
* you may not use this file except in compliance with the License.
|
|
1462
|
+
* You may obtain a copy of the License at
|
|
1463
|
+
*
|
|
1464
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1465
|
+
*
|
|
1466
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1467
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1468
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1469
|
+
* See the License for the specific language governing permissions and
|
|
1470
|
+
* limitations under the License.
|
|
1471
|
+
*/const ts=new pe(2e3,1e4);async function qo(n,e,t){if(I(n.app))return Promise.reject(w(n,"operation-not-supported-in-this-environment"));const i=_(n);Q(n,e,M);const r=$(i,t);return new N(i,"signInViaPopup",e,r).executeNotNull()}async function Go(n,e,t){const i=h(n);if(I(i.auth.app))return Promise.reject(w(i.auth,"operation-not-supported-in-this-environment"));Q(i.auth,e,M);const r=$(i.auth,t);return new N(i.auth,"reauthViaPopup",e,r,i).executeNotNull()}async function zo(n,e,t){const i=h(n);Q(i.auth,e,M);const r=$(i.auth,t);return new N(i.auth,"linkViaPopup",e,r,i).executeNotNull()}class N extends Mn{constructor(e,t,i,r,s){super(e,t,r,s),this.provider=i,this.authWindow=null,this.pollId=null,N.currentPopupAction&&N.currentPopupAction.cancel(),N.currentPopupAction=this}async executeNotNull(){const e=await this.execute();return u(e,this.auth,"internal-error"),e}async onExecution(){b(this.filter.length===1,"Popup operations only handle one event");const e=He();this.authWindow=await this.resolver._openPopup(this.auth,this.provider,this.filter[0],e),this.authWindow.associatedEvent=e,this.resolver._originValidation(this.auth).catch(t=>{this.reject(t)}),this.resolver._isIframeWebStorageSupported(this.auth,t=>{t||this.reject(w(this.auth,"web-storage-unsupported"))}),this.pollUserCancellation()}get eventId(){var e;return((e=this.authWindow)==null?void 0:e.associatedEvent)||null}cancel(){this.reject(w(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,N.currentPopupAction=null}pollUserCancellation(){const e=()=>{var t,i;if((i=(t=this.authWindow)==null?void 0:t.window)!=null&&i.closed){this.pollId=window.setTimeout(()=>{this.pollId=null,this.reject(w(this.auth,"popup-closed-by-user"))},8e3);return}this.pollId=window.setTimeout(e,ts.get())};e()}}N.currentPopupAction=null;/**
|
|
1472
|
+
* @license
|
|
1473
|
+
* Copyright 2020 Google LLC
|
|
1474
|
+
*
|
|
1475
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1476
|
+
* you may not use this file except in compliance with the License.
|
|
1477
|
+
* You may obtain a copy of the License at
|
|
1478
|
+
*
|
|
1479
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1480
|
+
*
|
|
1481
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1482
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1483
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1484
|
+
* See the License for the specific language governing permissions and
|
|
1485
|
+
* limitations under the License.
|
|
1486
|
+
*/const ns="pendingRedirect",Pe=new Map;class is extends Mn{constructor(e,t,i=!1){super(e,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],t,void 0,i),this.eventId=null}async execute(){let e=Pe.get(this.auth._key());if(!e){try{const i=await rs(this.resolver,this.auth)?await super.execute():null;e=()=>Promise.resolve(i)}catch(t){e=()=>Promise.reject(t)}Pe.set(this.auth._key(),e)}return this.bypassAuthState||Pe.set(this.auth._key(),()=>Promise.resolve(null)),e()}async onAuthEvent(e){if(e.type==="signInViaRedirect")return super.onAuthEvent(e);if(e.type==="unknown"){this.resolve(null);return}if(e.eventId){const t=await this.auth._redirectUserForId(e.eventId);if(t)return this.user=t,super.onAuthEvent(e);this.resolve(null)}}async onExecution(){}cleanUp(){}}async function rs(n,e){const t=Fn(e),i=Un(n);if(!await i._isAvailable())return!1;const r=await i._get(t)==="true";return await i._remove(t),r}async function It(n,e){return Un(n)._set(Fn(e),"true")}function ss(n,e){Pe.set(n._key(),e)}function Un(n){return k(n._redirectPersistence)}function Fn(n){return Ae(ns,n.config.apiKey,n.name)}/**
|
|
1487
|
+
* @license
|
|
1488
|
+
* Copyright 2020 Google LLC
|
|
1489
|
+
*
|
|
1490
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1491
|
+
* you may not use this file except in compliance with the License.
|
|
1492
|
+
* You may obtain a copy of the License at
|
|
1493
|
+
*
|
|
1494
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1495
|
+
*
|
|
1496
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1497
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1498
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1499
|
+
* See the License for the specific language governing permissions and
|
|
1500
|
+
* limitations under the License.
|
|
1501
|
+
*/function Ko(n,e,t){return os(n,e,t)}async function os(n,e,t){if(I(n.app))return Promise.reject(T(n));const i=_(n);Q(n,e,M),await i._initializationPromise;const r=$(i,t);return await It(r,i),r._openRedirect(i,e,"signInViaRedirect")}function $o(n,e,t){return as(n,e,t)}async function as(n,e,t){const i=h(n);if(Q(i.auth,e,M),I(i.auth.app))return Promise.reject(T(i.auth));await i.auth._initializationPromise;const r=$(i.auth,t);await It(r,i.auth);const s=await Hn(i);return r._openRedirect(i.auth,e,"reauthViaRedirect",s)}function jo(n,e,t){return cs(n,e,t)}async function cs(n,e,t){const i=h(n);Q(i.auth,e,M),await i.auth._initializationPromise;const r=$(i.auth,t);await Ue(!1,i,e.providerId),await It(r,i.auth);const s=await Hn(i);return r._openRedirect(i.auth,e,"linkViaRedirect",s)}async function Bo(n,e){return await _(n)._initializationPromise,Vn(n,e,!1)}async function Vn(n,e,t=!1){if(I(n.app))return Promise.reject(T(n));const i=_(n),r=$(i,e),o=await new is(i,r,t).execute();return o&&!t&&(delete o.user._redirectEventId,await i._persistUserIfCurrent(o.user),await i._setRedirectUser(null,e)),o}async function Hn(n){const e=He(`${n.uid}:::`);return n._redirectEventId=e,await n.auth._setRedirectUser(n),await n.auth._persistUserIfCurrent(n),e}/**
|
|
1502
|
+
* @license
|
|
1503
|
+
* Copyright 2020 Google LLC
|
|
1504
|
+
*
|
|
1505
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1506
|
+
* you may not use this file except in compliance with the License.
|
|
1507
|
+
* You may obtain a copy of the License at
|
|
1508
|
+
*
|
|
1509
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1510
|
+
*
|
|
1511
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1512
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1513
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1514
|
+
* See the License for the specific language governing permissions and
|
|
1515
|
+
* limitations under the License.
|
|
1516
|
+
*/const us=600*1e3;class ls{constructor(e){this.auth=e,this.cachedEventUids=new Set,this.consumers=new Set,this.queuedRedirectEvent=null,this.hasHandledPotentialRedirect=!1,this.lastProcessedEventTime=Date.now()}registerConsumer(e){this.consumers.add(e),this.queuedRedirectEvent&&this.isEventForConsumer(this.queuedRedirectEvent,e)&&(this.sendToConsumer(this.queuedRedirectEvent,e),this.saveEventToCache(this.queuedRedirectEvent),this.queuedRedirectEvent=null)}unregisterConsumer(e){this.consumers.delete(e)}onEvent(e){if(this.hasEventBeenHandled(e))return!1;let t=!1;return this.consumers.forEach(i=>{this.isEventForConsumer(e,i)&&(t=!0,this.sendToConsumer(e,i),this.saveEventToCache(e))}),this.hasHandledPotentialRedirect||!ds(e)||(this.hasHandledPotentialRedirect=!0,t||(this.queuedRedirectEvent=e,t=!0)),t}sendToConsumer(e,t){var i;if(e.error&&!xn(e)){const r=((i=e.error.code)==null?void 0:i.split("auth/")[1])||"internal-error";t.onError(w(this.auth,r))}else t.onAuthEvent(e)}isEventForConsumer(e,t){const i=t.eventId===null||!!e.eventId&&e.eventId===t.eventId;return t.filter.includes(e.type)&&i}hasEventBeenHandled(e){return Date.now()-this.lastProcessedEventTime>=us&&this.cachedEventUids.clear(),this.cachedEventUids.has(xt(e))}saveEventToCache(e){this.cachedEventUids.add(xt(e)),this.lastProcessedEventTime=Date.now()}}function xt(n){return[n.type,n.eventId,n.sessionId,n.tenantId].filter(e=>e).join("-")}function xn({type:n,error:e}){return n==="unknown"&&(e==null?void 0:e.code)==="auth/no-auth-event"}function ds(n){switch(n.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return xn(n);default:return!1}}/**
|
|
1517
|
+
* @license
|
|
1518
|
+
* Copyright 2020 Google LLC
|
|
1519
|
+
*
|
|
1520
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1521
|
+
* you may not use this file except in compliance with the License.
|
|
1522
|
+
* You may obtain a copy of the License at
|
|
1523
|
+
*
|
|
1524
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1525
|
+
*
|
|
1526
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1527
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1528
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1529
|
+
* See the License for the specific language governing permissions and
|
|
1530
|
+
* limitations under the License.
|
|
1531
|
+
*/async function hs(n,e={}){return m(n,"GET","/v1/projects",e)}/**
|
|
1532
|
+
* @license
|
|
1533
|
+
* Copyright 2020 Google LLC
|
|
1534
|
+
*
|
|
1535
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1536
|
+
* you may not use this file except in compliance with the License.
|
|
1537
|
+
* You may obtain a copy of the License at
|
|
1538
|
+
*
|
|
1539
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1540
|
+
*
|
|
1541
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1542
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1543
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1544
|
+
* See the License for the specific language governing permissions and
|
|
1545
|
+
* limitations under the License.
|
|
1546
|
+
*/const fs=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,ps=/^https?/;async function ms(n){if(n.config.emulator)return;const{authorizedDomains:e}=await hs(n);for(const t of e)try{if(gs(t))return}catch{}y(n,"unauthorized-domain")}function gs(n){const e=ce(),{protocol:t,hostname:i}=new URL(e);if(n.startsWith("chrome-extension://")){const o=new URL(n);return o.hostname===""&&i===""?t==="chrome-extension:"&&n.replace("chrome-extension://","")===e.replace("chrome-extension://",""):t==="chrome-extension:"&&o.hostname===i}if(!ps.test(t))return!1;if(fs.test(n))return i===n;const r=n.replace(/\./g,"\\.");return new RegExp("^(.+\\."+r+"|"+r+")$","i").test(i)}/**
|
|
1547
|
+
* @license
|
|
1548
|
+
* Copyright 2020 Google LLC.
|
|
1549
|
+
*
|
|
1550
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1551
|
+
* you may not use this file except in compliance with the License.
|
|
1552
|
+
* You may obtain a copy of the License at
|
|
1553
|
+
*
|
|
1554
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1555
|
+
*
|
|
1556
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1557
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1558
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1559
|
+
* See the License for the specific language governing permissions and
|
|
1560
|
+
* limitations under the License.
|
|
1561
|
+
*/const Is=new pe(3e4,6e4);function Wt(){const n=E().___jsl;if(n!=null&&n.H){for(const e of Object.keys(n.H))if(n.H[e].r=n.H[e].r||[],n.H[e].L=n.H[e].L||[],n.H[e].r=[...n.H[e].L],n.CP)for(let t=0;t<n.CP.length;t++)n.CP[t]=null}}function _s(n){return new Promise((e,t)=>{var r,s,o;function i(){Wt(),gapi.load("gapi.iframes",{callback:()=>{e(gapi.iframes.getContext())},ontimeout:()=>{Wt(),t(w(n,"network-request-failed"))},timeout:Is.get()})}if((s=(r=E().gapi)==null?void 0:r.iframes)!=null&&s.Iframe)e(gapi.iframes.getContext());else if((o=E().gapi)!=null&&o.load)i();else{const a=mn("iframefcb");return E()[a]=()=>{gapi.load?i():t(w(n,"network-request-failed"))},ot(`${Oi()}?onload=${a}`).catch(c=>t(c))}}).catch(e=>{throw Se=null,e})}let Se=null;function Es(n){return Se=Se||_s(n),Se}/**
|
|
1562
|
+
* @license
|
|
1563
|
+
* Copyright 2020 Google LLC.
|
|
1564
|
+
*
|
|
1565
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1566
|
+
* you may not use this file except in compliance with the License.
|
|
1567
|
+
* You may obtain a copy of the License at
|
|
1568
|
+
*
|
|
1569
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1570
|
+
*
|
|
1571
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1572
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1573
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1574
|
+
* See the License for the specific language governing permissions and
|
|
1575
|
+
* limitations under the License.
|
|
1576
|
+
*/const Ts=new pe(5e3,15e3),ws="__/auth/iframe",ys="emulator/auth/iframe",vs={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},As=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function Rs(n){const e=n.config;u(e.authDomain,n,"auth-domain-config-required");const t=e.emulator?rt(e,ys):`https://${n.config.authDomain}/${ws}`,i={apiKey:e.apiKey,appName:n.name,v:fe},r=As.get(n.config.apiHost);r&&(i.eid=r);const s=n._getFrameworks();return s.length&&(i.fw=s.join(",")),`${t}?${X(i).slice(1)}`}async function Ps(n){const e=await Es(n),t=E().gapi;return u(t,n,"internal-error"),e.open({where:document.body,url:Rs(n),messageHandlersFilter:t.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:vs,dontclear:!0},i=>new Promise(async(r,s)=>{await i.restyle({setHideOnLeave:!1});const o=w(n,"network-request-failed"),a=E().setTimeout(()=>{s(o)},Ts.get());function c(){E().clearTimeout(a),r(i)}i.ping(c).then(c,()=>{s(o)})}))}/**
|
|
1577
|
+
* @license
|
|
1578
|
+
* Copyright 2020 Google LLC.
|
|
1579
|
+
*
|
|
1580
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1581
|
+
* you may not use this file except in compliance with the License.
|
|
1582
|
+
* You may obtain a copy of the License at
|
|
1583
|
+
*
|
|
1584
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1585
|
+
*
|
|
1586
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1587
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1588
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1589
|
+
* See the License for the specific language governing permissions and
|
|
1590
|
+
* limitations under the License.
|
|
1591
|
+
*/const Ss={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"},ks=500,Ns=600,Cs="_blank",bs="http://localhost";class qt{constructor(e){this.window=e,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch{}}}function Os(n,e,t,i=ks,r=Ns){const s=Math.max((window.screen.availHeight-r)/2,0).toString(),o=Math.max((window.screen.availWidth-i)/2,0).toString();let a="";const c={...Ss,width:i.toString(),height:r.toString(),top:s,left:o},l=v().toLowerCase();t&&(a=cn(l)?Cs:t),on(l)&&(e=e||bs,c.scrollbars="yes");const d=Object.entries(c).reduce((g,[j,ee])=>`${g}${j}=${ee},`,"");if(yi(l)&&a!=="_self")return Ls(e||"",a),new qt(null);const f=window.open(e||"",a,d);u(f,n,"popup-blocked");try{f.focus()}catch{}return new qt(f)}function Ls(n,e){const t=document.createElement("a");t.href=n,t.target=e;const i=document.createEvent("MouseEvent");i.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),t.dispatchEvent(i)}/**
|
|
1592
|
+
* @license
|
|
1593
|
+
* Copyright 2021 Google LLC
|
|
1594
|
+
*
|
|
1595
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1596
|
+
* you may not use this file except in compliance with the License.
|
|
1597
|
+
* You may obtain a copy of the License at
|
|
1598
|
+
*
|
|
1599
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1600
|
+
*
|
|
1601
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1602
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1603
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1604
|
+
* See the License for the specific language governing permissions and
|
|
1605
|
+
* limitations under the License.
|
|
1606
|
+
*/const Ds="__/auth/handler",Ms="emulator/auth/handler",Us=encodeURIComponent("fac");async function Gt(n,e,t,i,r,s){u(n.config.authDomain,n,"auth-domain-config-required"),u(n.config.apiKey,n,"invalid-api-key");const o={apiKey:n.config.apiKey,appName:n.name,authType:t,redirectUrl:i,v:fe,eventId:r};if(e instanceof M){e.setDefaultLanguage(n.languageCode),o.providerId=e.providerId||"",Bn(e.getCustomParameters())||(o.customParameters=JSON.stringify(e.getCustomParameters()));for(const[d,f]of Object.entries({}))o[d]=f}if(e instanceof Z){const d=e.getScopes().filter(f=>f!=="");d.length>0&&(o.scopes=d.join(","))}n.tenantId&&(o.tid=n.tenantId);const a=o;for(const d of Object.keys(a))a[d]===void 0&&delete a[d];const c=await n._getAppCheckToken(),l=c?`#${Us}=${encodeURIComponent(c)}`:"";return`${Fs(n)}?${X(a).slice(1)}${l}`}function Fs({config:n}){return n.emulator?rt(n,Ms):`https://${n.authDomain}/${Ds}`}/**
|
|
1607
|
+
* @license
|
|
1608
|
+
* Copyright 2020 Google LLC
|
|
1609
|
+
*
|
|
1610
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1611
|
+
* you may not use this file except in compliance with the License.
|
|
1612
|
+
* You may obtain a copy of the License at
|
|
1613
|
+
*
|
|
1614
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1615
|
+
*
|
|
1616
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1617
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1618
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1619
|
+
* See the License for the specific language governing permissions and
|
|
1620
|
+
* limitations under the License.
|
|
1621
|
+
*/const Ye="webStorageSupport";class Vs{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=Cn,this._completeRedirectFn=Vn,this._overrideRedirectResult=ss}async _openPopup(e,t,i,r){var o;b((o=this.eventManagers[e._key()])==null?void 0:o.manager,"_initialize() not called before _openPopup()");const s=await Gt(e,t,i,ce(),r);return Os(e,s,He())}async _openRedirect(e,t,i,r){await this._originValidation(e);const s=await Gt(e,t,i,ce(),r);return Dr(s),new Promise(()=>{})}_initialize(e){const t=e._key();if(this.eventManagers[t]){const{manager:r,promise:s}=this.eventManagers[t];return r?Promise.resolve(r):(b(s,"If manager is not set, promise should be"),s)}const i=this.initAndGetManager(e);return this.eventManagers[t]={promise:i},i.catch(()=>{delete this.eventManagers[t]}),i}async initAndGetManager(e){const t=await Ps(e),i=new ls(e);return t.register("authEvent",r=>(u(r==null?void 0:r.authEvent,e,"invalid-auth-event"),{status:i.onEvent(r.authEvent)?"ACK":"ERROR"}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[e._key()]={manager:i},this.iframes[e._key()]=t,i}_isIframeWebStorageSupported(e,t){this.iframes[e._key()].send(Ye,{type:Ye},r=>{var o;const s=(o=r==null?void 0:r[0])==null?void 0:o[Ye];s!==void 0&&t(!!s),y(e,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(e){const t=e._key();return this.originValidationPromises[t]||(this.originValidationPromises[t]=ms(e)),this.originValidationPromises[t]}get _shouldInitProactively(){return fn()||an()||st()}}const Hs=Vs;class Wn{constructor(e){this.factorId=e}_process(e,t,i){switch(t.type){case"enroll":return this._finalizeEnroll(e,t.credential,i);case"signin":return this._finalizeSignIn(e,t.credential);default:return P("unexpected MultiFactorSessionType")}}}class _t extends Wn{constructor(e){super("phone"),this.credential=e}static _fromCredential(e){return new _t(e)}_finalizeEnroll(e,t,i){return Ar(e,{idToken:t,displayName:i,phoneVerificationInfo:this.credential._makeVerificationRequest()})}_finalizeSignIn(e,t){return zr(e,{mfaPendingCredential:t,phoneVerificationInfo:this.credential._makeVerificationRequest()})}}class xs{constructor(){}static assertion(e){return _t._fromCredential(e)}}xs.FACTOR_ID="phone";class Ws{static assertionForEnrollment(e,t){return he._fromSecret(e,t)}static assertionForSignIn(e,t){return he._fromEnrollmentId(e,t)}static async generateSecret(e){var r;const t=e;u(typeof((r=t.user)==null?void 0:r.auth)<"u","internal-error");const i=await Rr(t.user.auth,{idToken:t.credential,totpEnrollmentInfo:{}});return Et._fromStartTotpMfaEnrollmentResponse(i,t.user.auth)}}Ws.FACTOR_ID="totp";class he extends Wn{constructor(e,t,i){super("totp"),this.otp=e,this.enrollmentId=t,this.secret=i}static _fromSecret(e,t){return new he(t,void 0,e)}static _fromEnrollmentId(e,t){return new he(t,e)}async _finalizeEnroll(e,t,i){return u(typeof this.secret<"u",e,"argument-error"),Pr(e,{idToken:t,displayName:i,totpVerificationInfo:this.secret._makeTotpVerificationInfo(this.otp)})}async _finalizeSignIn(e,t){u(this.enrollmentId!==void 0&&this.otp!==void 0,e,"argument-error");const i={verificationCode:this.otp};return Kr(e,{mfaPendingCredential:t,mfaEnrollmentId:this.enrollmentId,totpVerificationInfo:i})}}class Et{constructor(e,t,i,r,s,o,a){this.sessionInfo=o,this.auth=a,this.secretKey=e,this.hashingAlgorithm=t,this.codeLength=i,this.codeIntervalSeconds=r,this.enrollmentCompletionDeadline=s}static _fromStartTotpMfaEnrollmentResponse(e,t){return new Et(e.totpSessionInfo.sharedSecretKey,e.totpSessionInfo.hashingAlgorithm,e.totpSessionInfo.verificationCodeLength,e.totpSessionInfo.periodSec,new Date(e.totpSessionInfo.finalizeEnrollmentTime).toUTCString(),e.totpSessionInfo.sessionInfo,t)}_makeTotpVerificationInfo(e){return{sessionInfo:this.sessionInfo,verificationCode:e}}generateQrCodeUrl(e,t){var r;let i=!1;return(we(e)||we(t))&&(i=!0),i&&(we(e)&&(e=((r=this.auth.currentUser)==null?void 0:r.email)||"unknownuser"),we(t)&&(t=this.auth.name)),`otpauth://totp/${t}:${e}?secret=${this.secretKey}&issuer=${t}&algorithm=${this.hashingAlgorithm}&digits=${this.codeLength}`}}function we(n){return typeof n>"u"||(n==null?void 0:n.length)===0}var zt="@firebase/auth",Kt="1.13.6";/**
|
|
1622
|
+
* @license
|
|
1623
|
+
* Copyright 2020 Google LLC
|
|
1624
|
+
*
|
|
1625
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1626
|
+
* you may not use this file except in compliance with the License.
|
|
1627
|
+
* You may obtain a copy of the License at
|
|
1628
|
+
*
|
|
1629
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1630
|
+
*
|
|
1631
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1632
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1633
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1634
|
+
* See the License for the specific language governing permissions and
|
|
1635
|
+
* limitations under the License.
|
|
1636
|
+
*/class qs{constructor(e){this.auth=e,this.internalListeners=new Map}getUid(){var e;return this.assertAuthConfigured(),((e=this.auth.currentUser)==null?void 0:e.uid)||null}async getToken(e){return this.assertAuthConfigured(),await this.auth._initializationPromise,this.auth.currentUser?{accessToken:await this.auth.currentUser.getIdToken(e)}:null}addAuthTokenListener(e){if(this.assertAuthConfigured(),this.internalListeners.has(e))return;const t=this.auth.onIdTokenChanged(i=>{e((i==null?void 0:i.stsTokenManager.accessToken)||null)});this.internalListeners.set(e,t),this.updateProactiveRefresh()}removeAuthTokenListener(e){this.assertAuthConfigured();const t=this.internalListeners.get(e);t&&(this.internalListeners.delete(e),t(),this.updateProactiveRefresh())}assertAuthConfigured(){u(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}}/**
|
|
1637
|
+
* @license
|
|
1638
|
+
* Copyright 2020 Google LLC
|
|
1639
|
+
*
|
|
1640
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1641
|
+
* you may not use this file except in compliance with the License.
|
|
1642
|
+
* You may obtain a copy of the License at
|
|
1643
|
+
*
|
|
1644
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1645
|
+
*
|
|
1646
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1647
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1648
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1649
|
+
* See the License for the specific language governing permissions and
|
|
1650
|
+
* limitations under the License.
|
|
1651
|
+
*/function Gs(n){switch(n){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";case"WebExtension":return"web-extension";default:return}}function zs(n){wt(new yt("auth",(e,{options:t})=>{const i=e.getProvider("app").getImmediate(),r=e.getProvider("heartbeat"),s=e.getProvider("app-check-internal"),{apiKey:o,authDomain:a}=i.options;u(o&&!o.includes(":"),"invalid-api-key",{appName:i.name});const c={apiKey:o,authDomain:a,clientPlatform:n,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:pn(n)},l=new ki(i,r,s,c);return qi(l,t),l},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e,t,i)=>{e.getProvider("auth-internal").initialize()})),wt(new yt("auth-internal",e=>{const t=_(e.getProvider("auth").getImmediate());return(i=>new qs(i))(t)},"PRIVATE").setInstantiationMode("EXPLICIT")),vt(zt,Kt,Gs(n)),vt(zt,Kt,"esm2020")}/**
|
|
1652
|
+
* @license
|
|
1653
|
+
* Copyright 2021 Google LLC
|
|
1654
|
+
*
|
|
1655
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1656
|
+
* you may not use this file except in compliance with the License.
|
|
1657
|
+
* You may obtain a copy of the License at
|
|
1658
|
+
*
|
|
1659
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1660
|
+
*
|
|
1661
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1662
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1663
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1664
|
+
* See the License for the specific language governing permissions and
|
|
1665
|
+
* limitations under the License.
|
|
1666
|
+
*/const Ks=300,$s=Bt("authIdTokenMaxAge")||Ks;let $t=null;const js=n=>async e=>{const t=e&&await e.getIdTokenResult(),i=t&&(new Date().getTime()-Date.parse(t.issuedAtTime))/1e3;if(i&&i>$s)return;const r=t==null?void 0:t.token;$t!==r&&($t=r,await fetch(n,{method:r?"POST":"DELETE",headers:r?{Authorization:`Bearer ${r}`}:{}}))};function Yo(n=$n()){const e=jt(n,"auth");if(e.isInitialized())return e.getImmediate();const t=Wi(n,{popupRedirectResolver:Hs,persistence:[Gr,Cr,Cn]}),i=Bt("authTokenSyncURL");if(i&&typeof isSecureContext=="boolean"&&isSecureContext){const s=new URL(i,location.origin);if(location.origin===s.origin){const o=js(s.toString());vr(t,o,()=>o(t.currentUser)),yr(t,a=>o(a))}}const r=Kn("auth");return r&&Gi(t,`http://${r}`),t}function Bs(){var n;return((n=document.getElementsByTagName("head"))==null?void 0:n[0])??document}Ni({loadJS(n){return new Promise((e,t)=>{const i=document.createElement("script");i.setAttribute("src",n),i.onload=e,i.onerror=r=>{const s=w("internal-error");s.customData=r,t(s)},i.type="text/javascript",i.charset="UTF-8",Bs().appendChild(i)})},gapiScript:"https://apis.google.com/js/api.js",recaptchaV2Script:"https://www.google.com/recaptcha/api.js",recaptchaEnterpriseScript:"https://www.google.com/recaptcha/enterprise.js?render="});zs("Browser");export{eo as ActionCodeOperation,Ie as ActionCodeURL,ge as AuthCredential,no as AuthErrorCodes,le as EmailAuthCredential,K as EmailAuthProvider,F as FacebookAuthProvider,Js as FactorId,H as GithubAuthProvider,V as GoogleAuthProvider,L as OAuthCredential,Re as OAuthProvider,Zs as OperationType,z as PhoneAuthCredential,J as PhoneAuthProvider,xs as PhoneMultiFactorGenerator,Xs as ProviderId,Fo as RecaptchaVerifier,Qe as SAMLAuthProvider,Qs as SignInMethod,Ws as TotpMultiFactorGenerator,Et as TotpSecret,x as TwitterAuthProvider,lo as applyActionCode,vr as beforeAuthStateChanged,Uo as browserCookiePersistence,Cr as browserLocalPersistence,Hs as browserPopupRedirectResolver,Cn as browserSessionPersistence,pr as checkActionCode,uo as confirmPasswordReset,Gi as connectAuthEmulator,fo as createUserWithEmailAndPassword,to as debugErrorMap,Lo as deleteUser,_o as fetchSignInMethodsForEmail,Ao as getAdditionalUserInfo,Yo as getAuth,io as getIdToken,mi as getIdTokenResult,Do as getMultiFactorResolver,Bo as getRedirectResult,Nt as inMemoryPersistence,Gr as indexedDBLocalPersistence,Wi as initializeAuth,Po as initializeRecaptchaConfig,go as isSignInWithEmailLink,dr as linkWithCredential,Ho as linkWithPhoneNumber,zo as linkWithPopup,jo as linkWithRedirect,Mo as multiFactor,ko as onAuthStateChanged,yr as onIdTokenChanged,ro as parseActionCodeURL,ri as prodErrorMap,hr as reauthenticateWithCredential,xo as reauthenticateWithPhoneNumber,Go as reauthenticateWithPopup,$o as reauthenticateWithRedirect,_i as reload,Oo as revokeAccessToken,Eo as sendEmailVerification,co as sendPasswordResetEmail,mo as sendSignInLinkToEmail,Ro as setPersistence,so as signInAnonymously,ct as signInWithCredential,ao as signInWithCustomToken,po as signInWithEmailAndPassword,Io as signInWithEmailLink,Vo as signInWithPhoneNumber,qo as signInWithPopup,Ko as signInWithRedirect,bo as signOut,oo as unlink,Co as updateCurrentUser,yo as updateEmail,vo as updatePassword,Wo as updatePhoneNumber,wo as updateProfile,No as useDeviceLanguage,So as validatePassword,To as verifyBeforeUpdateEmail,ho as verifyPasswordResetCode};
|